ProjectGroups: Name the package with CamelCase. Formatting.

This commit is contained in:
Juha 2021-11-21 00:55:05 +02:00
parent a056886b72
commit 063797e76f
7 changed files with 34 additions and 52 deletions

View File

@ -106,7 +106,8 @@ Type
function GetNext(SkipChildren: boolean): TPGCompileTarget; function GetNext(SkipChildren: boolean): TPGCompileTarget;
function IndexOfBuildMode(aName: string): integer; function IndexOfBuildMode(aName: string): integer;
function FindBuildMode(aName: string): TPGBuildMode; 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; procedure Modified; virtual; abstract;
property Parent: TPGCompileTarget read FParent; property Parent: TPGCompileTarget read FParent;
property Filename: string read FFilename write SetFilename; // Absolute, not relative. property Filename: string read FFilename write SetFilename; // Absolute, not relative.
@ -574,21 +575,16 @@ var
i: Integer; i: Integer;
begin begin
// check first child // check first child
if (not SkipChildren) and (ProjectGroup<>nil) and (ProjectGroup.TargetCount>0) if (not SkipChildren) and (ProjectGroup<>nil) and (ProjectGroup.TargetCount>0) then
then begin exit(ProjectGroup.Targets[0]);
Result:=ProjectGroup.Targets[0];
exit(Result);
end;
// check next sibling // check next sibling
aTarget:=Self; aTarget:=Self;
while aTarget.Parent<>nil do begin while aTarget.Parent<>nil do begin
PG:=aTarget.Parent.ProjectGroup; PG:=aTarget.Parent.ProjectGroup;
if PG<>nil then begin if PG<>nil then begin
i:=PG.IndexOfTarget(aTarget); i:=PG.IndexOfTarget(aTarget);
if (i>=0) and (i+1<PG.TargetCount) then begin if (i>=0) and (i+1<PG.TargetCount) then
Result:=PG.Targets[i+1]; exit(PG.Targets[i+1]);
exit(Result);
end;
end; end;
aTarget:=aTarget.Parent; aTarget:=aTarget.Parent;
end; end;

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<Package Version="4"> <Package Version="4">
<Name Value="lazprojectgroups"/> <Name Value="LazProjectGroups"/>
<Type Value="RunAndDesignTime"/> <Type Value="RunAndDesignTime"/>
<Author Value="Mattias Gaertner, Michael Van Canneyt"/> <Author Value="Mattias Gaertner, Michael Van Canneyt"/>
<CompilerOptions> <CompilerOptions>

View File

@ -98,8 +98,7 @@ begin
ShowTargetPathsCheckBox.Checked:=FLastShowTargetPaths; ShowTargetPathsCheckBox.Checked:=FLastShowTargetPaths;
end; end;
class function TProjGrpOptionsFrame. class function TProjGrpOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
SupportedOptionsClass: TAbstractIDEOptionsClass;
begin begin
Result:=IDEEditorGroups.GetByIndex(GroupEnvironment)^.GroupClass; Result:=IDEEditorGroups.GetByIndex(GroupEnvironment)^.GroupClass;
end; end;

View File

@ -41,10 +41,11 @@ uses
Controls, Forms, Dialogs, Controls, Forms, Dialogs,
// CodeTools // CodeTools
FileProcs, CodeToolManager, CodeCache, FileProcs, CodeToolManager, CodeCache,
// BuildIntf
PackageIntf, PackageDependencyIntf, PackageLinkIntf, ProjectIntf, CompOptsIntf,
BaseIDEIntf, IDEExternToolIntf, MacroIntf, MacroDefIntf,
// IdeIntf // IdeIntf
PackageIntf, ProjectIntf, MenuIntf, LazIDEIntf, IDEDialogs, CompOptsIntf, MenuIntf, LazIDEIntf, IDEDialogs, IDECommands, IDEMsgIntf, ToolBarIntf,
BaseIDEIntf, IDECommands, IDEExternToolIntf, MacroIntf, IDEMsgIntf,
ToolBarIntf, MacroDefIntf, PackageDependencyIntf, PackageLinkIntf,
// ProjectGroups // ProjectGroups
ProjectGroupIntf, ProjectGroupStrConst; ProjectGroupIntf, ProjectGroupStrConst;
@ -105,7 +106,6 @@ type
public public
constructor Create(aOwner: TProjectGroup); constructor Create(aOwner: TProjectGroup);
Destructor Destroy; override; Destructor Destroy; override;
end; end;
TTargetEvent = procedure(Sender: TObject; Target: TPGCompileTarget) of object; TTargetEvent = procedure(Sender: TObject; Target: TPGCompileTarget) of object;
@ -1462,7 +1462,8 @@ end;
function TIDECompileTarget.PerformBuildModeAction(AAction: TPGTargetAction; function TIDECompileTarget.PerformBuildModeAction(AAction: TPGTargetAction;
aModeIdentifier: string): TPGActionResult; aModeIdentifier: string): TPGActionResult;
begin begin
if TargetType<>ttProject then exit(arNotAllowed); if TargetType<>ttProject then
exit(arNotAllowed);
Result:=ProjectAction(AAction,aModeIdentifier); Result:=ProjectAction(AAction,aModeIdentifier);
end; end;
@ -1818,7 +1819,7 @@ var
begin begin
Result:=arFailed; Result:=arFailed;
debugln(['TIDECompileTarget.ProjectAction ',Filename]); debugln(['TIDECompileTarget.ProjectAction: Action=', AAction, ', Filename=', Filename]);
aProject:=LazarusIDE.ActiveProject; aProject:=LazarusIDE.ActiveProject;
if (aProject<>nil) if (aProject<>nil)
and (CompareFilenames(aProject.ProjectInfoFile,Filename)=0) and (CompareFilenames(aProject.ProjectInfoFile,Filename)=0)
@ -1847,7 +1848,6 @@ begin
if not CheckIDEIsReadyForBuild then exit; if not CheckIDEIsReadyForBuild then exit;
// save project // save project
if LazarusIDE.DoSaveProject([])<>mrOk then exit; if LazarusIDE.DoSaveProject([])<>mrOk then exit;
R:= crCompile; R:= crCompile;
if (AAction=taCompileClean) then if (AAction=taCompileClean) then
R:= crBuild; R:= crBuild;
@ -1909,10 +1909,8 @@ begin
taCompileFromHere: taCompileFromHere:
begin begin
if not CheckIDEIsReadyForBuild then exit; if not CheckIDEIsReadyForBuild then exit;
// save files // save files
if LazarusIDE.DoSaveProject([])<>mrOk then exit; if LazarusIDE.DoSaveProject([])<>mrOk then exit;
LazarusIDE.ToolStatus:=itBuilder; LazarusIDE.ToolStatus:=itBuilder;
try try
if BuildModeCount>1 then begin if BuildModeCount>1 then begin
@ -2102,10 +2100,7 @@ begin
while (aTarget<>nil) do while (aTarget<>nil) do
begin begin
if AAction in aTarget.AllowedActions then if AAction in aTarget.AllowedActions then
begin exit(aTarget.PerformAction(AAction));
Result:=aTarget.PerformAction(AAction);
exit;
end;
aTarget:=TIDECompileTarget(aTarget.GetNext(false)); aTarget:=TIDECompileTarget(aTarget.GetNext(false));
end; end;
Result:=arOK; Result:=arOK;

View File

@ -17,12 +17,14 @@ uses
Classes, SysUtils, Classes, SysUtils,
// LCL // LCL
Forms, Controls, Graphics, Dialogs, ComCtrls, Menus, Forms, Controls, Graphics, Dialogs, ComCtrls, Menus,
ActnList, LCLProc, Clipbrd, ImgList, LCLType, ActnList, Clipbrd, ImgList, LCLType,
// LazUtils // LazUtils
LazFileUtils, LazLoggerBase, LazFileCache, LazFileUtils, LazLoggerBase, LazFileCache,
// BuildIntf
PackageIntf, ProjectIntf,
// IdeIntf // IdeIntf
LazIDEIntf, PackageIntf, ProjectIntf, ProjectGroupIntf, MenuIntf, IDEWindowIntf, LazIDEIntf, ProjectGroupIntf, MenuIntf, IDEWindowIntf, IDEDialogs, IDECommands,
IDEDialogs, IDECommands, IDEImagesIntf, IDEImagesIntf,
// ProjectGroups // ProjectGroups
ProjectGroupStrConst, ProjectGroup, PrjGrpOptionsFrm, PrjGrpInfoFrm; ProjectGroupStrConst, ProjectGroup, PrjGrpOptionsFrm, PrjGrpInfoFrm;
@ -247,7 +249,7 @@ type
function SelectedTarget: TPGCompileTarget; function SelectedTarget: TPGCompileTarget;
function GetTVNodeFilename(TVNode: TTreeNode): string; function GetTVNodeFilename(TVNode: TTreeNode): string;
function GetBuildMode(TVNode: TTreeNode): TPGBuildMode; function GetBuildMode(TVNode: TTreeNode): TPGBuildMode;
function GetNearestTargget(TVNode: TTreeNode): TPGCompileTarget; function GetNearestTarget(TVNode: TTreeNode): TPGCompileTarget;
function SelectedNodeType: TPGCompileTarget; function SelectedNodeType: TPGCompileTarget;
procedure UpdateIDEMenuCommandFromAction(Sender: TObject; Item: TIDEMenuCommand); procedure UpdateIDEMenuCommandFromAction(Sender: TObject; Item: TIDEMenuCommand);
procedure UpdateStatusBarTargetCount; procedure UpdateStatusBarTargetCount;
@ -390,13 +392,10 @@ begin
//debugln(['TProjectGroupEditorForm.SetProjectGroup START ',FProjectGroup=AValue,' new=',DbgSName(AValue)]); //debugln(['TProjectGroupEditorForm.SetProjectGroup START ',FProjectGroup=AValue,' new=',DbgSName(AValue)]);
if FProjectGroup=AValue then Exit; if FProjectGroup=AValue then Exit;
if ProjectGroup<>nil then if ProjectGroup<>nil then
begin
ClearEventCallBacks(ProjectGroup); ClearEventCallBacks(ProjectGroup);
end;
FProjectGroup:=AValue; FProjectGroup:=AValue;
if ProjectGroup<>nil then begin if ProjectGroup<>nil then
SetEventCallBacks(ProjectGroup); SetEventCallBacks(ProjectGroup);
end;
FActiveTarget:=Nil; FActiveTarget:=Nil;
ShowProjectGroup; ShowProjectGroup;
end; end;
@ -831,7 +830,6 @@ begin
end; end;
end; end;
end; end;
SBPG.Panels[piActiveTarget].Text:=s; SBPG.Panels[piActiveTarget].Text:=s;
end; end;
@ -1003,7 +1001,8 @@ begin
UpdateIDEMenuCommandFromAction(Sender,MnuCmdTargetCompileClean); UpdateIDEMenuCommandFromAction(Sender,MnuCmdTargetCompileClean);
end; end;
function TProjectGroupEditorForm.AllowPerform(ATargetAction: TPGTargetAction; AAction: TAction = Nil): Boolean; function TProjectGroupEditorForm.AllowPerform(ATargetAction: TPGTargetAction;
AAction: TAction): Boolean;
Var Var
ND: TNodeData; ND: TNodeData;
aTarget: TPGCompileTarget; aTarget: TPGCompileTarget;
@ -1014,7 +1013,7 @@ begin
if ND.Target<>nil then begin if ND.Target<>nil then begin
Result:=(not ND.Target.Missing) and (ATargetAction in ND.Target.AllowedActions); Result:=(not ND.Target.Missing) and (ATargetAction in ND.Target.AllowedActions);
end else begin end else begin
aTarget:=GetNearestTargget(TVPG.Selected); aTarget:=GetNearestTarget(TVPG.Selected);
case ND.NodeType of case ND.NodeType of
ntBuildMode: ntBuildMode:
Result:=(not aTarget.Missing) Result:=(not aTarget.Missing)
@ -1026,15 +1025,13 @@ begin
AAction.Enabled:=Result; AAction.Enabled:=Result;
end; end;
procedure TProjectGroupEditorForm.AProjectGroupAddCurrentExecute( procedure TProjectGroupEditorForm.AProjectGroupAddCurrentExecute(Sender: TObject);
Sender: TObject);
begin begin
if LazarusIDE.ActiveProject.ProjectInfoFile<>'' then if LazarusIDE.ActiveProject.ProjectInfoFile<>'' then
AddTarget(LazarusIDE.ActiveProject.ProjectInfoFile); AddTarget(LazarusIDE.ActiveProject.ProjectInfoFile);
end; end;
procedure TProjectGroupEditorForm.AProjectGroupAddCurrentUpdate( procedure TProjectGroupEditorForm.AProjectGroupAddCurrentUpdate(Sender: TObject);
Sender: TObject);
begin begin
(Sender as TAction).Enabled := (FProjectGroup<>nil) and (LazarusIDE.ActiveProject<>nil) (Sender as TAction).Enabled := (FProjectGroup<>nil) and (LazarusIDE.ActiveProject<>nil)
and (LazarusIDE.ActiveProject.ProjectInfoFile<>''); and (LazarusIDE.ActiveProject.ProjectInfoFile<>'');
@ -1071,7 +1068,7 @@ begin
if aTarget<>nil then if aTarget<>nil then
aTarget.GetOwnerProjectGroup.Perform(aTarget,ATargetAction) aTarget.GetOwnerProjectGroup.Perform(aTarget,ATargetAction)
else begin else begin
aTarget:=GetNearestTargget(TVPG.Selected); aTarget:=GetNearestTarget(TVPG.Selected);
case ND.NodeType of case ND.NodeType of
ntBuildMode: ntBuildMode:
aTarget.PerformBuildModeAction(ATargetAction,ND.Value); aTarget.PerformBuildModeAction(ATargetAction,ND.Value);
@ -1084,8 +1081,7 @@ begin
Perform(taCompile); Perform(taCompile);
end; end;
procedure TProjectGroupEditorForm.ATargetCompileFromHereExecute(Sender: TObject procedure TProjectGroupEditorForm.ATargetCompileFromHereExecute(Sender: TObject);
);
begin begin
Perform(taCompileFromHere); Perform(taCompileFromHere);
end; end;
@ -1312,7 +1308,7 @@ begin
end; end;
end; end;
function TProjectGroupEditorForm.GetNearestTargget(TVNode: TTreeNode function TProjectGroupEditorForm.GetNearestTarget(TVNode: TTreeNode
): TPGCompileTarget; ): TPGCompileTarget;
begin begin
Result:=nil; Result:=nil;
@ -1634,7 +1630,7 @@ begin
// find project node // find project node
Result:=FindTVNodeOfTarget(aMode.Target); Result:=FindTVNodeOfTarget(aMode.Target);
if Result=nil then exit; if Result=nil then exit;
// find build mdoe node // find build mode node
Result:=FindBuildModeNodeRecursively(Result,aMode.Identifier); Result:=FindBuildModeNodeRecursively(Result,aMode.Identifier);
end; end;

View File

@ -158,8 +158,6 @@ begin
// add IDE options frame // add IDE options frame
PGOptionsFrameID:=RegisterIDEOptionsEditor(GroupEnvironment, PGOptionsFrameID:=RegisterIDEOptionsEditor(GroupEnvironment,
TProjGrpOptionsFrame,PGOptionsFrameID)^.Index; TProjGrpOptionsFrame,PGOptionsFrameID)^.Index;
end; end;
finalization finalization

View File

@ -312,10 +312,8 @@ begin
if Assigned(FOnCmdLineCreate) then begin if Assigned(FOnCmdLineCreate) then begin
Abort:=false; Abort:=false;
FOnCmdLineCreate(CmdLine,Abort); FOnCmdLineCreate(CmdLine,Abort);
if Abort then begin if Abort then
Result:=mrAbort; exit(mrAbort);
exit;
end;
end; end;
if ConsoleVerbosity>=0 then if ConsoleVerbosity>=0 then
DebugLn('[TCompiler.Compile] CmdLine="',CompilerFilename+CmdLine,'"'); DebugLn('[TCompiler.Compile] CmdLine="',CompilerFilename+CmdLine,'"');