diff --git a/components/ideintf/projectgroupintf.pp b/components/ideintf/projectgroupintf.pp index a20d9beada..68ade8f43c 100644 --- a/components/ideintf/projectgroupintf.pp +++ b/components/ideintf/projectgroupintf.pp @@ -106,7 +106,8 @@ Type function GetNext(SkipChildren: boolean): TPGCompileTarget; function IndexOfBuildMode(aName: string): integer; function FindBuildMode(aName: string): TPGBuildMode; - function PerformBuildModeAction(AAction: TPGTargetAction; aModeIdentifier: string): TPGActionResult; virtual; abstract; + function PerformBuildModeAction(AAction: TPGTargetAction; + aModeIdentifier: string): TPGActionResult; virtual; abstract; procedure Modified; virtual; abstract; property Parent: TPGCompileTarget read FParent; property Filename: string read FFilename write SetFilename; // Absolute, not relative. @@ -574,21 +575,16 @@ var i: Integer; begin // check first child - if (not SkipChildren) and (ProjectGroup<>nil) and (ProjectGroup.TargetCount>0) - then begin - Result:=ProjectGroup.Targets[0]; - exit(Result); - end; + if (not SkipChildren) and (ProjectGroup<>nil) and (ProjectGroup.TargetCount>0) then + exit(ProjectGroup.Targets[0]); // check next sibling aTarget:=Self; while aTarget.Parent<>nil do begin PG:=aTarget.Parent.ProjectGroup; if PG<>nil then begin i:=PG.IndexOfTarget(aTarget); - if (i>=0) and (i+1=0) and (i+1 - + diff --git a/components/projectgroups/prjgrpoptionsfrm.pas b/components/projectgroups/prjgrpoptionsfrm.pas index aa772110fc..bd93340604 100644 --- a/components/projectgroups/prjgrpoptionsfrm.pas +++ b/components/projectgroups/prjgrpoptionsfrm.pas @@ -98,8 +98,7 @@ begin ShowTargetPathsCheckBox.Checked:=FLastShowTargetPaths; end; -class function TProjGrpOptionsFrame. - SupportedOptionsClass: TAbstractIDEOptionsClass; +class function TProjGrpOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass; begin Result:=IDEEditorGroups.GetByIndex(GroupEnvironment)^.GroupClass; end; diff --git a/components/projectgroups/projectgroup.pp b/components/projectgroups/projectgroup.pp index 91c36fc7ca..3e36207de6 100644 --- a/components/projectgroups/projectgroup.pp +++ b/components/projectgroups/projectgroup.pp @@ -41,10 +41,11 @@ uses Controls, Forms, Dialogs, // CodeTools FileProcs, CodeToolManager, CodeCache, + // BuildIntf + PackageIntf, PackageDependencyIntf, PackageLinkIntf, ProjectIntf, CompOptsIntf, + BaseIDEIntf, IDEExternToolIntf, MacroIntf, MacroDefIntf, // IdeIntf - PackageIntf, ProjectIntf, MenuIntf, LazIDEIntf, IDEDialogs, CompOptsIntf, - BaseIDEIntf, IDECommands, IDEExternToolIntf, MacroIntf, IDEMsgIntf, - ToolBarIntf, MacroDefIntf, PackageDependencyIntf, PackageLinkIntf, + MenuIntf, LazIDEIntf, IDEDialogs, IDECommands, IDEMsgIntf, ToolBarIntf, // ProjectGroups ProjectGroupIntf, ProjectGroupStrConst; @@ -105,7 +106,6 @@ type public constructor Create(aOwner: TProjectGroup); Destructor Destroy; override; - end; TTargetEvent = procedure(Sender: TObject; Target: TPGCompileTarget) of object; @@ -1462,7 +1462,8 @@ end; function TIDECompileTarget.PerformBuildModeAction(AAction: TPGTargetAction; aModeIdentifier: string): TPGActionResult; begin - if TargetType<>ttProject then exit(arNotAllowed); + if TargetType<>ttProject then + exit(arNotAllowed); Result:=ProjectAction(AAction,aModeIdentifier); end; @@ -1818,7 +1819,7 @@ var begin Result:=arFailed; - debugln(['TIDECompileTarget.ProjectAction ',Filename]); + debugln(['TIDECompileTarget.ProjectAction: Action=', AAction, ', Filename=', Filename]); aProject:=LazarusIDE.ActiveProject; if (aProject<>nil) and (CompareFilenames(aProject.ProjectInfoFile,Filename)=0) @@ -1847,7 +1848,6 @@ begin if not CheckIDEIsReadyForBuild then exit; // save project if LazarusIDE.DoSaveProject([])<>mrOk then exit; - R:= crCompile; if (AAction=taCompileClean) then R:= crBuild; @@ -1909,10 +1909,8 @@ begin taCompileFromHere: begin if not CheckIDEIsReadyForBuild then exit; - // save files if LazarusIDE.DoSaveProject([])<>mrOk then exit; - LazarusIDE.ToolStatus:=itBuilder; try if BuildModeCount>1 then begin @@ -2102,10 +2100,7 @@ begin while (aTarget<>nil) do begin if AAction in aTarget.AllowedActions then - begin - Result:=aTarget.PerformAction(AAction); - exit; - end; + exit(aTarget.PerformAction(AAction)); aTarget:=TIDECompileTarget(aTarget.GetNext(false)); end; Result:=arOK; diff --git a/components/projectgroups/projectgroupeditor.pas b/components/projectgroups/projectgroupeditor.pas index 2da35b78d4..3c9cd96cc1 100644 --- a/components/projectgroups/projectgroupeditor.pas +++ b/components/projectgroups/projectgroupeditor.pas @@ -17,12 +17,14 @@ uses Classes, SysUtils, // LCL Forms, Controls, Graphics, Dialogs, ComCtrls, Menus, - ActnList, LCLProc, Clipbrd, ImgList, LCLType, + ActnList, Clipbrd, ImgList, LCLType, // LazUtils LazFileUtils, LazLoggerBase, LazFileCache, + // BuildIntf + PackageIntf, ProjectIntf, // IdeIntf - LazIDEIntf, PackageIntf, ProjectIntf, ProjectGroupIntf, MenuIntf, IDEWindowIntf, - IDEDialogs, IDECommands, IDEImagesIntf, + LazIDEIntf, ProjectGroupIntf, MenuIntf, IDEWindowIntf, IDEDialogs, IDECommands, + IDEImagesIntf, // ProjectGroups ProjectGroupStrConst, ProjectGroup, PrjGrpOptionsFrm, PrjGrpInfoFrm; @@ -247,7 +249,7 @@ type function SelectedTarget: TPGCompileTarget; function GetTVNodeFilename(TVNode: TTreeNode): string; function GetBuildMode(TVNode: TTreeNode): TPGBuildMode; - function GetNearestTargget(TVNode: TTreeNode): TPGCompileTarget; + function GetNearestTarget(TVNode: TTreeNode): TPGCompileTarget; function SelectedNodeType: TPGCompileTarget; procedure UpdateIDEMenuCommandFromAction(Sender: TObject; Item: TIDEMenuCommand); procedure UpdateStatusBarTargetCount; @@ -390,13 +392,10 @@ begin //debugln(['TProjectGroupEditorForm.SetProjectGroup START ',FProjectGroup=AValue,' new=',DbgSName(AValue)]); if FProjectGroup=AValue then Exit; if ProjectGroup<>nil then - begin ClearEventCallBacks(ProjectGroup); - end; FProjectGroup:=AValue; - if ProjectGroup<>nil then begin + if ProjectGroup<>nil then SetEventCallBacks(ProjectGroup); - end; FActiveTarget:=Nil; ShowProjectGroup; end; @@ -831,7 +830,6 @@ begin end; end; end; - SBPG.Panels[piActiveTarget].Text:=s; end; @@ -1003,7 +1001,8 @@ begin UpdateIDEMenuCommandFromAction(Sender,MnuCmdTargetCompileClean); end; -function TProjectGroupEditorForm.AllowPerform(ATargetAction: TPGTargetAction; AAction: TAction = Nil): Boolean; +function TProjectGroupEditorForm.AllowPerform(ATargetAction: TPGTargetAction; + AAction: TAction): Boolean; Var ND: TNodeData; aTarget: TPGCompileTarget; @@ -1014,7 +1013,7 @@ begin if ND.Target<>nil then begin Result:=(not ND.Target.Missing) and (ATargetAction in ND.Target.AllowedActions); end else begin - aTarget:=GetNearestTargget(TVPG.Selected); + aTarget:=GetNearestTarget(TVPG.Selected); case ND.NodeType of ntBuildMode: Result:=(not aTarget.Missing) @@ -1026,15 +1025,13 @@ begin AAction.Enabled:=Result; end; -procedure TProjectGroupEditorForm.AProjectGroupAddCurrentExecute( - Sender: TObject); +procedure TProjectGroupEditorForm.AProjectGroupAddCurrentExecute(Sender: TObject); begin if LazarusIDE.ActiveProject.ProjectInfoFile<>'' then AddTarget(LazarusIDE.ActiveProject.ProjectInfoFile); end; -procedure TProjectGroupEditorForm.AProjectGroupAddCurrentUpdate( - Sender: TObject); +procedure TProjectGroupEditorForm.AProjectGroupAddCurrentUpdate(Sender: TObject); begin (Sender as TAction).Enabled := (FProjectGroup<>nil) and (LazarusIDE.ActiveProject<>nil) and (LazarusIDE.ActiveProject.ProjectInfoFile<>''); @@ -1071,7 +1068,7 @@ begin if aTarget<>nil then aTarget.GetOwnerProjectGroup.Perform(aTarget,ATargetAction) else begin - aTarget:=GetNearestTargget(TVPG.Selected); + aTarget:=GetNearestTarget(TVPG.Selected); case ND.NodeType of ntBuildMode: aTarget.PerformBuildModeAction(ATargetAction,ND.Value); @@ -1084,8 +1081,7 @@ begin Perform(taCompile); end; -procedure TProjectGroupEditorForm.ATargetCompileFromHereExecute(Sender: TObject - ); +procedure TProjectGroupEditorForm.ATargetCompileFromHereExecute(Sender: TObject); begin Perform(taCompileFromHere); end; @@ -1312,7 +1308,7 @@ begin end; end; -function TProjectGroupEditorForm.GetNearestTargget(TVNode: TTreeNode +function TProjectGroupEditorForm.GetNearestTarget(TVNode: TTreeNode ): TPGCompileTarget; begin Result:=nil; @@ -1634,7 +1630,7 @@ begin // find project node Result:=FindTVNodeOfTarget(aMode.Target); if Result=nil then exit; - // find build mdoe node + // find build mode node Result:=FindBuildModeNodeRecursively(Result,aMode.Identifier); end; diff --git a/components/projectgroups/regprojectgroup.pp b/components/projectgroups/regprojectgroup.pp index fedf2ac521..e6a6087034 100644 --- a/components/projectgroups/regprojectgroup.pp +++ b/components/projectgroups/regprojectgroup.pp @@ -158,8 +158,6 @@ begin // add IDE options frame PGOptionsFrameID:=RegisterIDEOptionsEditor(GroupEnvironment, TProjGrpOptionsFrame,PGOptionsFrameID)^.Index; - - end; finalization diff --git a/ide/compiler.pp b/ide/compiler.pp index 293dc8eac2..511df9c5cf 100644 --- a/ide/compiler.pp +++ b/ide/compiler.pp @@ -312,10 +312,8 @@ begin if Assigned(FOnCmdLineCreate) then begin Abort:=false; FOnCmdLineCreate(CmdLine,Abort); - if Abort then begin - Result:=mrAbort; - exit; - end; + if Abort then + exit(mrAbort); end; if ConsoleVerbosity>=0 then DebugLn('[TCompiler.Compile] CmdLine="',CompilerFilename+CmdLine,'"');