IDE: conditional compiler options: showing nodes

git-svn-id: trunk@17929 -
This commit is contained in:
mattias 2008-12-24 10:02:38 +00:00
parent 1c7160a11a
commit 0241535dad
5 changed files with 123 additions and 21 deletions

View File

@ -1117,10 +1117,10 @@ begin
DefineTreeView.Images := IDEImages.Images_24;
DefineTreeView.StateImages := IDEImages.Images_16;
DefineActionImages[Low(TDefineAction)] := -1;
for DefAction := Succ(Low(TDefineAction)) to High(TDefineAction) do
DefineActionImages[DefAction] := IDEImages.LoadImage(24, 'da_' + LowerCase(DefineActionNames[DefAction]));
DefineActionImages[Low(TDefineAction)] := -1;
AutogeneratedImage := IDEImages.LoadImage(16, 'laz_wand');
end;

View File

@ -224,13 +224,12 @@ begin
Value:=Trim(Value);
if Value='' then exit;
case ValueType of
cocvtNone: ; // ignore
cocvtUnitPath,cocvtSrcPath,cocvtIncludePath,cocvtObjectPath,cocvtLibraryPath,
cocvtDebugPath:
begin
FValues[ValueType]:=MergeSearchPaths(FValues[ValueType],Value);
end;
cocvtLinkerOptions,cocvtCustomOptions:
else
begin
if FValues[ValueType]<>'' then
FValues[ValueType]:=FValues[ValueType]+' ';

View File

@ -16,10 +16,15 @@ object CompOptsConditionalsFrame: TCompOptsConditionalsFrame
Top = 0
Width = 381
Align = alClient
AutoExpand = True
Ctl3D = False
DefaultItemHeight = 19
PopupMenu = COCPopupMenu
ReadOnly = True
RowSelect = True
ShowRoot = False
TabOrder = 0
Options = [tvoAutoExpand, tvoAutoInsertMark, tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRowSelect, tvoShowButtons, tvoShowLines, tvoShowSeparators, tvoToolTips]
end
object COCPopupMenu: TPopupMenu
left = 48

View File

@ -5,22 +5,25 @@ LazarusResources.Add('TCompOptsConditionalsFrame','FORMDATA',[
+#0#6'Height'#3#170#0#3'Top'#2#0#5'Width'#3#129#1#12'ClientHeight'#3#166#0#11
+'ClientWidth'#3'}'#1#5'Ctl3D'#8#8'TabOrder'#2#0#7'Visible'#8#10'DesignLeft'#3
+#173#1#9'DesignTop'#3'1'#1#0#9'TTreeView'#11'COCTreeView'#4'Left'#2#0#6'Heig'
+'ht'#3#166#0#3'Top'#2#0#5'Width'#3'}'#1#5'Align'#7#8'alClient'#5'Ctl3D'#8#17
+'DefaultItemHeight'#2#19#9'PopupMenu'#7#12'COCPopupMenu'#8'TabOrder'#2#0#0#0
+#10'TPopupMenu'#12'COCPopupMenu'#4'left'#2'0'#3'top'#2'0'#0#9'TMenuItem'#19
+'InsertAboveMenuItem'#7'Caption'#6#19'InsertAboveMenuItem'#12'RightJustify'#8
+#19'ShowAlwaysCheckable'#8#0#0#9'TMenuItem'#19'InsertBelowMenuItem'#7'Captio'
+'n'#6#19'InsertBelowMenuItem'#12'RightJustify'#8#19'ShowAlwaysCheckable'#8#0
+#0#9'TMenuItem'#19'InsertChildMenuItem'#7'Caption'#6#19'InsertChildMenuItem'
+#12'RightJustify'#8#19'ShowAlwaysCheckable'#8#0#0#9'TMenuItem'#14'DeleteMenu'
+'Item'#7'Caption'#6#14'DeleteMenuItem'#12'RightJustify'#8#19'ShowAlwaysCheck'
+'able'#8#0#0#9'TMenuItem'#14'MoveUpMenuItem'#7'Caption'#6#14'MoveUpMenuItem'
+#12'RightJustify'#8#19'ShowAlwaysCheckable'#8#0#0#9'TMenuItem'#16'MoveDownMe'
+'nuItem'#7'Caption'#6#16'MoveDownMenuItem'#12'RightJustify'#8#19'ShowAlwaysC'
+'heckable'#8#0#0#9'TMenuItem'#17'MoveLvlUpMenuItem'#7'Caption'#6#17'MoveLvlU'
+'pMenuItem'#12'RightJustify'#8#19'ShowAlwaysCheckable'#8#0#0#9'TMenuItem'#19
+'MoveLvlDownMenuItem'#7'Caption'#6#19'MoveLvlDownMenuItem'#12'RightJustify'#8
+#19'ShowAlwaysCheckable'#8#0#0#9'TMenuItem'#18'PropertiesMenuItem'#7'Caption'
+#6#18'PropertiesMenuItem'#12'RightJustify'#8#19'ShowAlwaysCheckable'#8#0#0#0
+#0
+'ht'#3#166#0#3'Top'#2#0#5'Width'#3'}'#1#5'Align'#7#8'alClient'#10'AutoExpand'
+#9#5'Ctl3D'#8#17'DefaultItemHeight'#2#19#9'PopupMenu'#7#12'COCPopupMenu'#8'R'
+'eadOnly'#9#9'RowSelect'#9#8'ShowRoot'#8#8'TabOrder'#2#0#7'Options'#11#13'tv'
+'oAutoExpand'#17'tvoAutoInsertMark'#17'tvoAutoItemHeight'#16'tvoHideSelectio'
+'n'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#12'tvoRowSelect'#14'tvoShowBut'
+'tons'#12'tvoShowLines'#17'tvoShowSeparators'#11'tvoToolTips'#0#0#0#10'TPopu'
+'pMenu'#12'COCPopupMenu'#4'left'#2'0'#3'top'#2'0'#0#9'TMenuItem'#19'InsertAb'
+'oveMenuItem'#7'Caption'#6#19'InsertAboveMenuItem'#12'RightJustify'#8#19'Sho'
+'wAlwaysCheckable'#8#0#0#9'TMenuItem'#19'InsertBelowMenuItem'#7'Caption'#6#19
+'InsertBelowMenuItem'#12'RightJustify'#8#19'ShowAlwaysCheckable'#8#0#0#9'TMe'
+'nuItem'#19'InsertChildMenuItem'#7'Caption'#6#19'InsertChildMenuItem'#12'Rig'
+'htJustify'#8#19'ShowAlwaysCheckable'#8#0#0#9'TMenuItem'#14'DeleteMenuItem'#7
+'Caption'#6#14'DeleteMenuItem'#12'RightJustify'#8#19'ShowAlwaysCheckable'#8#0
+#0#9'TMenuItem'#14'MoveUpMenuItem'#7'Caption'#6#14'MoveUpMenuItem'#12'RightJ'
+'ustify'#8#19'ShowAlwaysCheckable'#8#0#0#9'TMenuItem'#16'MoveDownMenuItem'#7
+'Caption'#6#16'MoveDownMenuItem'#12'RightJustify'#8#19'ShowAlwaysCheckable'#8
+#0#0#9'TMenuItem'#17'MoveLvlUpMenuItem'#7'Caption'#6#17'MoveLvlUpMenuItem'#12
+'RightJustify'#8#19'ShowAlwaysCheckable'#8#0#0#9'TMenuItem'#19'MoveLvlDownMe'
+'nuItem'#7'Caption'#6#19'MoveLvlDownMenuItem'#12'RightJustify'#8#19'ShowAlwa'
+'ysCheckable'#8#0#0#9'TMenuItem'#18'PropertiesMenuItem'#7'Caption'#6#18'Prop'
+'ertiesMenuItem'#12'RightJustify'#8#19'ShowAlwaysCheckable'#8#0#0#0#0
]);

View File

@ -25,6 +25,7 @@ interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, ComCtrls, Menus,
ProjectIntf, IDEImagesIntf,
CompOptsModes;
type
@ -44,11 +45,105 @@ type
MoveDownMenuItem: TMenuItem;
MoveUpMenuItem: TMenuItem;
private
FConditionals: TCompOptConditionals;
FNodeTypeImageIDs: array[TCOCNodeType] of integer;
procedure SetConditionals(const AValue: TCompOptConditionals);
procedure FillTreeView;
function NodeToCaption(Node: TCompOptCondNode): string;
function NodeToImageIndex(Node: TCompOptCondNode): integer;
public
constructor Create(TheOwner: TComponent); override;
property Conditionals: TCompOptConditionals read FConditionals write SetConditionals;
end;
implementation
{ TCompOptsConditionalsFrame }
procedure TCompOptsConditionalsFrame.SetConditionals(
const AValue: TCompOptConditionals);
begin
if FConditionals=AValue then exit;
FConditionals:=AValue;
FillTreeView;
end;
procedure TCompOptsConditionalsFrame.FillTreeView;
procedure Add(COCNode: TCompOptCondNode; ParentTVNode: TTreeNode);
var
TVNode: TTreeNode;
i: Integer;
begin
if COCNode=nil then exit;
TVNode:=COCTreeView.Items.AddChild(ParentTVNode,NodeToCaption(COCNode));
TVNode.ImageIndex:=FNodeTypeImageIDs[COCNode.NodeType];
TVNode.StateIndex:=TVNode.ImageIndex;
for i:=0 to COCNode.Count-1 do
Add(COCNode.Childs[i],TVNode);
end;
begin
COCTreeView.BeginUpdate;
COCTreeView.Items.Clear;
if Conditionals<>nil then begin
Add(Conditionals.Root,nil);
end;
COCTreeView.EndUpdate;
end;
function TCompOptsConditionalsFrame.NodeToCaption(Node: TCompOptCondNode
): string;
begin
case Node.NodeType of
cocntNone: Result:='Noop';
cocntIf: Result:='If '+Node.Value;
cocntIfdef: Result:='IfDef '+Node.Value;
cocntIfNdef: Result:='IfNDef '+Node.Value;
cocntElseIf: Result:='ElseIf '+Node.Value;
cocntElse: Result:='Else';
cocntAddValue:
begin
case Node.ValueType of
cocvtNone: Result:='Result:='+Node.Value,
cocvtUnitPath: Result:='Add unit path: '+Node.Value,
cocvtSrcPath: Result:='Add unit source path: '+Node.Value,
cocvtIncludePath: Result:='Add include path: '+Node.Value,
cocvtObjectPath: Result:='Add object path: '+Node.Value,
cocvtLibraryPath: Result:='Add library path: '+Node.Value,
cocvtDebugPath: Result:='Add debug path: '+Node.Value,
cocvtLinkerOptions: Result:='Add linker options: '+Node.Value,
cocvtCustomOptions: Result:='Add custom options: '+Node.Value,
else
Result:='(unknown ValueType)';
end;
end;
else
Result:='(unknown NodeType)';
end;
Result:=ValidUTF8String(Result);
end;
constructor TCompOptsConditionalsFrame.Create(TheOwner: TComponent);
var
nt: TCOCNodeType;
begin
inherited Create(TheOwner);
COCTreeView.Images := IDEImages.Images_24;
COCTreeView.StateImages := IDEImages.Images_16;
for nt:=Low(TCOCNodeType) to High(TCOCNodeType) do
FNodeTypeImageIDs[nt]:=-1;
FNodeTypeImageIDs[cocntNone]:=IDEImages.LoadImage(24,'da_none');
FNodeTypeImageIDs[cocntIf]:=IDEImages.LoadImage(24,'da_if');
FNodeTypeImageIDs[cocntIfdef]:=IDEImages.LoadImage(24,'da_ifdef');
FNodeTypeImageIDs[cocntIfNdef]:=IDEImages.LoadImage(24,'da_ifndef');
FNodeTypeImageIDs[cocntElseIf]:=IDEImages.LoadImage(24,'da_elseif');
FNodeTypeImageIDs[cocntElse]:=IDEImages.LoadImage(24,'da_else');
FNodeTypeImageIDs[cocntAddValue]:=IDEImages.LoadImage(24,'da_define');
end;
initialization
{$I options_compiler_conditionals.lrs}