project groups: enable/disable build modes

git-svn-id: trunk@50433 -
This commit is contained in:
mattias 2015-11-20 09:43:43 +00:00
parent 0d62cb6fed
commit 318abf35d9
2 changed files with 134 additions and 8 deletions

View File

@ -96,6 +96,7 @@ object ProjectGroupEditorForm: TProjectGroupEditorForm
StateImages = ImageListMain
TabOrder = 1
OnDblClick = TVPGDblClick
OnMouseDown = TVPGMouseDown
Options = [tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
end
object SBPG: TStatusBar
@ -118,7 +119,7 @@ object ProjectGroupEditorForm: TProjectGroupEditorForm
left = 128
top = 184
Bitmap = {
4C69160000001000000010000000FFFFFF009E6E4D2B9D6D4CD69D6D4BC59D6C
4C69180000001000000010000000FFFFFF009E6E4D2B9D6D4CD69D6D4BC59D6C
4BFF9C6C4AFF9C6B49FF9B6A49FF9B6A48FF9A6947FF996846FF986745FF9364
43FF845D3EDEFFFFFF00FFFFFF00FFFFFF009D6D4C919D6D4BFEBB9778FFAC82
62FFAC8161FFAB8060FFAB7F5FFFAA7F5EFFA87E5DFFA87C5CFF9D6D4CFF9766
@ -822,7 +823,71 @@ object ProjectGroupEditorForm: TProjectGroupEditorForm
F8FFFEFBF8FFFEFBF8FFFEFBF8FFFEFBF8FFFEFBF8FFFEFBF8FFFEFBF8FFFEFB
F8FFC89A7CFFC79879FFAD6B40FFD8AB8EFFCD9570FFBD7342FFB76835FFB568
35FFB46734FFB26634FFB06533FFAE6433FFAC6332FFAA6232FFA96132FFA860
31FFA76132FFAB693CFFBC8661FF
31FFA76132FFAB693CFFBC8661FFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004EA2
57914A9D527FFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004DA1569163B3
6DFF5FAF69FF41914979FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004CA0559162B26CFF82D1
8FFF7AC885FF57A660FF38843F7BFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004B9F549160B06AFF81CF8DFF7FCF
8BFF58A761FF398540FF347E3A08FFFFFF00FFFFFF005FBB6A435CB76765FFFF
FF00FFFFFF00FFFFFF00FFFFFF004B9E53915FAF69FF7FCE8AFF7ECE89FF57A6
60FF37823DFC337D3908FFFFFF00FFFFFF005FBA6A3C5CB666E66DC079FF55AC
5F6FFFFFFF00FFFFFF004A9D52915EAE68FF7DCD89FF7CCD87FF56A55FFF3681
3CFC327C3808FFFFFF00FFFFFF005EB969465BB566E479C986FF80CE8DFF51A6
5AFC4DA1566F499C518B5CAD67FF7CCC86FF79CB85FF54A45DFF35803BFC317B
3708FFFFFF00FFFFFF00FFFFFF005AB4650959B063FF6BBD76FF84D290FF7AC9
85FF60B26AFF63B46DFF78C983FF78CB82FF53A35CFF347F3AFD317A3608FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0053A95C0A51A65AFF63B56DFF7ECE
89FF7BCC87FF76CA81FF76C981FF52A25AFF347E3AFE30793508FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004B9E530A499A51FF5BAC
64FF77CA82FF74C87EFF51A059FF337D39FE2F783508FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF004292490A408E
47FF54A35CFF4F9F57FF327C38FE2E773408FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF003985
400A37833DFF317B37FB2E763307FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00317A360A2D753207FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF006360
F80AFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF007774FF1F7774
FF2BFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00625FF82B5D5B
F76F5956F53EFFFFFF00FFFFFF00FFFFFF00FFFFFF007774FF1F7A77FFFF7976
FEFF726FFD2BFFFFFF00FFFFFF00FFFFFF00FFFFFF00615EF82B6461F8FF6A68
F9FF5451F3A84F4DF229FFFFFF00FFFFFF007774FF1F7A77FFFF817EFFFF817E
FEFF7471FDFF6C69FB2BFFFFFF00FFFFFF00605DF72B625FF8FF6F6DFBFF7E7C
FFFF625FF8FF4A47F06F4542EE02FFFFFF007673FF087471FEFD7D7AFEFF8A87
FFFF7C79FDFF6C69FBFF6361F92B5F5CF72B615EF8FF6E6CFAFF7D7AFFFF615F
F7FF4946F0FC4441EE05FFFFFF00FFFFFF00FFFFFF00716EFD086E6BFCFC7774
FDFF8682FFFF7673FCFF6462F8FF605DF7FF6D6AFAFF7B79FFFF605DF7FF4845
EFFC4341EE08FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF006967FB086663
F9FC706DFBFF807EFFFF7E7BFFFF7C79FFFF7977FFFF5E5CF7FF4744EFFC4240
EE08FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00615E
F8085D5AF6FD7D79FFFF5E5BFFFF5B58FFFF7674FFFF4643EFFD413FED08FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF005C59
F62B5D5BF7FF7976FFFF5956FFFF5754FFFF7270FFFF4846F0FF3C39EB2BFFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF005B58F62B5C5A
F6FF6764FAFF7472FFFF7370FFFF706EFFFF6E6CFFFF5755F7FF3F3DEEFF3230
E82BFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF005A57F52B5B59F6FF6663
FAFF7471FFFF5A58F6FF4341EEFC3E3CECFD504DF4FF6867FFFF504EF5FF3634
EBFF2A27E52BFFFFFF00FFFFFF00FFFFFF005956F52B5B58F6FF6562FAFF7170
FFFF5956F6FF4240EEFC3E3BEC083937EB083532E9FC4745F2FF6362FFFF4A48
F4FF2F2DE9FF2220E32BFFFFFF00FFFFFF005451F3415856F5FF6361FAFF5855
F6FF413FEDFC3D3AEC08FFFFFF00FFFFFF00302DE7082C2AE6FC413FF1FF4C4A
F6FF312FEAFF1F1DE241FFFFFF00FFFFFF00FFFFFF004A47F0414F4CF2FF403E
EDFD3C39EB08FFFFFF00FFFFFF00FFFFFF00FFFFFF002725E5082422E4FC312F
EAFF1F1DE241FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF003F3DED413B38
EB08FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00211FE3081E1C
E241FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00
}
end
object PopupMenuMore: TPopupMenu

View File

@ -130,6 +130,8 @@ type
procedure FormDestroy(Sender: TObject);
procedure PopupMenuMorePopup(Sender: TObject);
procedure TVPGDblClick(Sender: TObject);
procedure TVPGMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
FProjectGroup: TProjectGroup;
FProjectGroupTVNode: TTreeNode;
@ -167,10 +169,11 @@ type
procedure FillProjectNode(AParent: TTreeNode; T: TPGCompileTarget);
procedure FillTargetNode(AParent: TTreeNode; T: TPGCompileTarget);
procedure FillProjectGroupNode(AParent: TTreeNode; AProjectGroup: TProjectGroup; Out TargetNodes: TTargetNodes);
function GetNodeIndex(ANodeType: TNodeType; ANodeData: TPGCompileTarget ): Integer;
function GetNodeImageIndex(ANodeType: TNodeType; ANodeData: TPGCompileTarget ): Integer;
function SelectedNodeData: TNodeData;
function SelectedTarget: TPGCompileTarget;
function GetTVNodeFilename(TVNode: TTreeNode): string;
function GetBuildMode(TVNode: TTreeNode): TPGBuildMode;
function SelectedNodeType: TPGCompileTarget;
procedure UpdateIDEMenuCommandFromAction(Sender: TObject; Item: TIDEMenuCommand);
procedure UpdateStatusBarTargetCount;
@ -225,6 +228,10 @@ var
// Node state image index
NSIActive : Integer = 20; // State index for active.
// overlay index
NSIChecked : Integer = 22;
NSIUnchecked : Integer = 23;
// Action image indexes
iiProjectGroupSave : Integer = -1;
iiProjectGroupSaveAs : Integer = -1;
@ -562,6 +569,33 @@ begin
end;
end;
procedure TProjectGroupEditorForm.TVPGMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
TVNode: TTreeNode;
ND: TNodeData;
aMode: TPGBuildMode;
begin
TVNode:=TVPG.GetNodeAt(X,Y);
ND:=TNodeData(TVNode.Data);
if ND=nil then exit;
if mbLeft=Button then begin
if (ND.NodeType=ntBuildMode) and ([ssShift,ssCtrl]*Shift=[]) then
begin
if (TVNode.DisplayStateIconLeft<X) and (X<TVNode.DisplayIconLeft) then
begin
if TVNode.StateIndex=NSIChecked then
TVNode.StateIndex:=NSIUnchecked
else
TVNode.StateIndex:=NSIChecked;
aMode:=GetBuildMode(TVNode);
if aMode<>nil then
aMode.Compile:=TVNode.StateIndex=NSIChecked;
end;
end;
end;
end;
procedure TProjectGroupEditorForm.OnTargetAdded(Sender: TObject;
Target: TPGCompileTarget);
Var
@ -848,7 +882,7 @@ begin
end;
end;
function TProjectGroupEditorForm.GetNodeIndex(ANodeType: TNodeType;
function TProjectGroupEditorForm.GetNodeImageIndex(ANodeType: TNodeType;
ANodeData: TPGCompileTarget): Integer;
begin
Case ANodeType of
@ -918,6 +952,24 @@ begin
end;
end;
function TProjectGroupEditorForm.GetBuildMode(TVNode: TTreeNode): TPGBuildMode;
var
ND: TNodeData;
begin
Result:=nil;
if TVNode=nil then exit;
ND:=TNodeData(TVNode.Data);
if (ND=nil) or (ND.NodeType<>ntBuildMode) then exit;
while TVNode<>nil do begin
if (TVNode.Data<>nil) and (TNodeData(TVNode.Data).Target<>nil) then
begin
Result:=TNodeData(TVNode.Data).Target.FindBuildMode(ND.Value);
exit;
end;
TVNode:=TVNode.Parent;
end;
end;
function TProjectGroupEditorForm.SelectedNodeType: TPGCompileTarget;
Var
N: TNodeData;
@ -935,7 +987,7 @@ begin
Node.Data:=ANodeData;
If (ACaption<>'') then
Node.Text:=ACaption;
Node.ImageIndex:=GetNodeIndex(ANodeData.NodeType,ANodeData.Target);
Node.ImageIndex:=GetNodeImageIndex(ANodeData.NodeType,ANodeData.Target);
Node.SelectedIndex:=Node.ImageIndex;
if Assigned(ANodeData.Target) and ANodeData.Target.Active then
Node.StateIndex:=NSIActive
@ -1196,15 +1248,24 @@ procedure TProjectGroupEditorForm.FillProjectNode(AParent: TTreeNode;
Var
FileNodes,DepNodes: TTargetNodes;
i: Integer;
BuildModeNode: TTreeNode;
BuildModeNode, TVNode: TTreeNode;
aMode: TPGBuildMode;
begin
TVPG.BeginUpdate;
try
// buildmodes
if T.BuildModeCount>1 then begin
if T.BuildModeCount>1 then
begin
BuildModeNode:=CreateSectionNode(AParent,lisNodeBuildModes,ntBuildModes);
for i:=0 to T.BuildModeCount-1 do
CreateSubNode(BuildModeNode,ntBuildMode,T,T.BuildModes[i].Identifier);
begin
aMode:=T.BuildModes[i];
TVNode:=CreateSubNode(BuildModeNode,ntBuildMode,T,aMode.Identifier);
if aMode.Compile then
TVNode.StateIndex:=NSIChecked
else
TVNode.StateIndex:=NSIUnchecked;
end;
end;
// files
FileNodes[False]:=CreateSectionNode(AParent,lisNodeFiles,ntFiles);