added to codetools defines preview a TreeView for the defines

git-svn-id: trunk@9160 -
This commit is contained in:
mattias 2006-04-22 14:09:14 +00:00
parent f5abc1d817
commit d613b09c25
6 changed files with 256 additions and 192 deletions

View File

@ -1,5 +1,3 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TStreamAsXMLForm','FORMDATA',[
'TPF0'#16'TStreamAsXMLForm'#15'StreamAsXMLForm'#13'ActiveControl'#7#7'Button1'
+#7'Caption'#6#15'StreamAsXMLForm'#12'ClientHeight'#3#178#1#11'ClientWidth'#3

View File

@ -227,10 +227,6 @@ type
FTransferMacros: TTransferMacroList;
procedure CreateComponents;
function CreateSeperator : TMenuItem;
procedure RebuildDefineTreeView;
procedure AddDefineNodes(ANode: TDefineTemplate; AParent: TTreeNode;
WithChilds,WithNextSiblings: boolean);
procedure SetNodeImages(ANode: TTreeNode; WithSubNodes: boolean);
procedure SetTransferMacros(const AValue: TTransferMacroList);
procedure ValueAsPathToValueAsText;
procedure SaveSelectedValues;
@ -557,7 +553,15 @@ end;
procedure TCodeToolsDefinesEditor.OpenPreviewMenuItemClick(Sender: TObject);
begin
ShowCodeToolsDefinesValuesDialog(DefineTree,'');
// apply changed tree
CodeToolBoss.DefineTree.AssignNonAutoCreated(DefineTree);
try
// show preview
ShowCodeToolsDefinesValuesDialog(DefineTree,'');
finally
// restore old tree
CodeToolsOpts.AssignGlobalDefineTemplatesToTree(CodeToolBoss.DefineTree);
end;
end;
procedure TCodeToolsDefinesEditor.InsertFPCProjectDefinesTemplateMenuItemClick(
@ -1113,69 +1117,6 @@ begin
Result.Caption := '-';
end;
procedure TCodeToolsDefinesEditor.RebuildDefineTreeView;
begin
DefineTreeView.Items.BeginUpdate;
DefineTreeView.Items.Clear;
AddDefineNodes(FDefineTree.RootTemplate,nil,true,true);
DefineTreeView.Items.EndUpdate;
end;
procedure TCodeToolsDefinesEditor.AddDefineNodes(
ANode: TDefineTemplate; AParent: TTreeNode;
WithChilds, WithNextSiblings: boolean);
var NewTreeNode: TTreeNode;
begin
if ANode=nil then exit;
//writeln(' AAA ',StringOfChar(' ',ANode.Level*2),' ',ANode.Name,' ',WithChilds,',',WithNextSiblings);
DefineTreeView.Items.BeginUpdate;
NewTreeNode:=DefineTreeView.Items.AddChildObject(AParent,ANode.Name,ANode);
SetNodeImages(NewTreeNode,false);
if WithChilds and (ANode.FirstChild<>nil) then begin
AddDefineNodes(ANode.FirstChild,NewTreeNode,true,true);
end;
if WithNextSiblings and (ANode.Next<>nil) then begin
AddDefineNodes(ANode.Next,AParent,WithChilds,true);
end;
DefineTreeView.Items.EndUpdate;
end;
procedure TCodeToolsDefinesEditor.SetNodeImages(ANode: TTreeNode;
WithSubNodes: boolean);
var ADefineTemplate: TDefineTemplate;
begin
ADefineTemplate:=TDefineTemplate(ANode.Data);
case ADefineTemplate.Action of
da_Define: ANode.ImageIndex:=0;
da_DefineRecurse: ANode.ImageIndex:=1;
da_Undefine: ANode.ImageIndex:=2;
da_UndefineRecurse: ANode.ImageIndex:=3;
da_UndefineAll: ANode.ImageIndex:=4;
da_Block: ANode.ImageIndex:=5;
da_Directory: ANode.ImageIndex:=6;
da_If: ANode.ImageIndex:=7;
da_IfDef: ANode.ImageIndex:=8;
da_IfNDef: ANode.ImageIndex:=9;
da_ElseIf: ANode.ImageIndex:=10;
da_Else: ANode.ImageIndex:=11;
else
ANode.ImageIndex:=-1;
end;
ANode.SelectedIndex:=ANode.ImageIndex;
if ADefineTemplate.IsAutoGenerated then begin
ANode.StateIndex:=13;
end else begin
ANode.StateIndex:=12;
end;
if WithSubNodes then begin
ANode:=ANode.GetFirstChild;
while ANode<>nil do begin
SetNodeImages(ANode,true);
ANode:=ANode.GetNextSibling;
end;
end;
end;
procedure TCodeToolsDefinesEditor.SetTransferMacros(
const AValue: TTransferMacroList);
begin
@ -1522,7 +1463,7 @@ begin
FLastSelectedNode:=nil;
FBoss:=ACodeToolBoss;
FDefineTree.Assign(ACodeToolBoss.DefineTree);
RebuildDefineTreeView;
RebuildDefineTreeView(DefineTreeView,DefineTree.RootTemplate);
ShowSelectedValues;
end;

View File

@ -1,32 +1,32 @@
object CodeToolsDefinesDialog: TCodeToolsDefinesDialog
Caption = 'CodeToolsDefinesDialog'
ClientHeight = 451
ClientWidth = 463
ClientHeight = 450
ClientWidth = 485
OnClose = CodeToolsDefinesDialogCLOSE
OnCreate = CodeToolsDefinesDialogCREATE
HorzScrollBar.Page = 464
VertScrollBar.Page = 452
PixelsPerInch = 112
HorzScrollBar.Page = 484
VertScrollBar.Page = 449
Left = 423
Height = 451
Height = 450
Top = 228
Width = 463
Width = 485
object DirectoryGroupbox: TGroupBox
Align = altop
Align = alTop
Caption = 'DirectoryGroupbox'
ClientHeight = 31
ClientWidth = 459
ParentColor = True
ClientWidth = 481
ParentCtl3D = False
TabOrder = 0
OnResize = DirectoryGroupboxRESIZE
Height = 48
Width = 463
Width = 485
object DirectoryCombobox: TComboBox
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
MaxLength = 0
OnChange = DirectoryComboboxCHANGE
ParentCtl3D = False
TabOrder = 0
TabStop = True
Text = 'DirectoryCombobox'
Left = 6
Height = 25
@ -34,10 +34,10 @@ object CodeToolsDefinesDialog: TCodeToolsDefinesDialog
Width = 360
end
object DirectoryBrowseButton: TButton
BorderSpacing.InnerBorder = 2
Caption = '...'
TabStop = True
TabOrder = 1
OnClick = DirectoryBrowseButtonCLICK
TabOrder = 1
Left = 375
Height = 26
Top = 1
@ -45,38 +45,39 @@ object CodeToolsDefinesDialog: TCodeToolsDefinesDialog
end
end
object ValuesListview: TListView
Align = alclient
Align = alClient
Columns = <>
ViewStyle = vsreport
TabOrder = 1
ViewStyle = vsReport
OnSelectItem = ValuesListviewSELECTITEM
Height = 272
Height = 271
Top = 48
Width = 463
Width = 280
end
object ValueGroupbox: TGroupBox
Align = albottom
Anchors = [akleft, akbottom]
Align = alBottom
Anchors = [akLeft, akBottom]
Caption = 'Value'
ClientHeight = 85
ClientWidth = 459
ParentColor = True
ClientWidth = 481
ParentCtl3D = False
TabOrder = 2
Height = 102
Top = 320
Width = 463
Top = 319
Width = 485
object ValueSynedit: TSynEdit
Align = alclient
Align = alBottom
Font.Height = -15
Font.Name = 'courier'
Height = 85
Name = 'ValueSynedit'
ParentColor = False
ParentCtl3D = False
TabOrder = 0
Width = 459
BookMarkOptions.OnChange = nil
Width = 481
BookMarkOptions.Xoffset = -18
Gutter.Visible = False
Gutter.OnChange = nil
Gutter.CodeFoldingWidth = 14
Keystrokes = <
item
Command = 3
@ -401,23 +402,42 @@ object CodeToolsDefinesDialog: TCodeToolsDefinesDialog
Lines.Strings = (
'ValueSynedit'
)
Options = [eoautoindent, eobrackethighlight, eoshowctrlmouselinks, eodragdropediting, eoscrollpasteol, eoshowscrollhint, eosmarttabs, eotabstospaces, eotrimtrailingspaces]
Options = [eoAutoIndent, eoDragDropEditing, eoScrollPastEol, eoShowScrollHint, eoSmartTabs, eoTabsToSpaces, eoTrimTrailingSpaces, eoBracketHighlight, eoShowCtrlMouseLinks]
ReadOnly = True
SelectedColor.OnChange = nil
Cursor = 65532
Cursor = crIBeam
Height = 85
Width = 459
Width = 481
end
end
object CloseButton: TButton
Anchors = [akleft, akbottom]
Align = albottom
ModalResult = 2
Align = alBottom
Anchors = [akLeft, akBottom]
BorderSpacing.InnerBorder = 2
Caption = 'CloseButton'
TabStop = True
ModalResult = 2
TabOrder = 3
Height = 29
Top = 422
Width = 463
Top = 421
Width = 485
end
object MainSplitter: TSplitter
Align = alRight
Height = 271
Width = 4
ResizeAnchor = akRight
Cursor = crHSplit
Left = 280
Height = 271
Top = 48
Width = 4
end
object ParsedTemplatesTreeView: TTreeView
Align = alRight
DefaultItemHeight = 14
TabOrder = 4
Left = 285
Height = 271
Top = 48
Width = 200
end
end

View File

@ -2,77 +2,83 @@
LazarusResources.Add('TCodeToolsDefinesDialog','FORMDATA',[
'TPF0'#23'TCodeToolsDefinesDialog'#22'CodeToolsDefinesDialog'#7'Caption'#6#22
+'CodeToolsDefinesDialog'#12'ClientHeight'#3#195#1#11'ClientWidth'#3#207#1#7
+'CodeToolsDefinesDialog'#12'ClientHeight'#3#194#1#11'ClientWidth'#3#229#1#7
+'OnClose'#7#27'CodeToolsDefinesDialogCLOSE'#8'OnCreate'#7#28'CodeToolsDefine'
+'sDialogCREATE'#18'HorzScrollBar.Page'#3#208#1#18'VertScrollBar.Page'#3#196#1
+#4'Left'#3#167#1#6'Height'#3#195#1#3'Top'#3#228#0#5'Width'#3#207#1#0#9'TGrou'
+'pBox'#17'DirectoryGroupbox'#5'Align'#7#5'altop'#7'Caption'#6#17'DirectoryGr'
+'oupbox'#12'ClientHeight'#2#31#11'ClientWidth'#3#203#1#11'ParentColor'#9#11
+'ParentCtl3D'#8#8'TabOrder'#2#0#8'OnResize'#7#23'DirectoryGroupboxRESIZE'#6
+'Height'#2'0'#5'Width'#3#207#1#0#9'TComboBox'#17'DirectoryCombobox'#9'MaxLen'
+'gth'#2#0#8'OnChange'#7#23'DirectoryComboboxCHANGE'#11'ParentCtl3D'#8#8'TabO'
+'rder'#2#0#7'TabStop'#9#4'Text'#6#17'DirectoryCombobox'#4'Left'#2#6#6'Height'
+#2#25#3'Top'#2#1#5'Width'#3'h'#1#0#0#7'TButton'#21'DirectoryBrowseButton'#7
+'Caption'#6#3'...'#7'TabStop'#9#8'TabOrder'#2#1#7'OnClick'#7#26'DirectoryBro'
+'wseButtonCLICK'#4'Left'#3'w'#1#6'Height'#2#26#3'Top'#2#1#5'Width'#2#31#0#0#0
+#9'TListView'#14'ValuesListview'#5'Align'#7#8'alclient'#7'Columns'#14#0#9'Vi'
+'ewStyle'#7#8'vsreport'#12'OnSelectItem'#7#24'ValuesListviewSELECTITEM'#6'He'
+'ight'#3#16#1#3'Top'#2'0'#5'Width'#3#207#1#0#0#9'TGroupBox'#13'ValueGroupbox'
+#5'Align'#7#8'albottom'#7'Anchors'#11#6'akleft'#8'akbottom'#0#7'Caption'#6#5
+'Value'#12'ClientHeight'#2'U'#11'ClientWidth'#3#203#1#11'ParentColor'#9#11'P'
+'arentCtl3D'#8#8'TabOrder'#2#2#6'Height'#2'f'#3'Top'#3'@'#1#5'Width'#3#207#1
+#0#8'TSynEdit'#12'ValueSynedit'#5'Align'#7#8'alclient'#11'Font.Height'#2#241
+#9'Font.Name'#6#7'courier'#6'Height'#2'U'#4'Name'#6#12'ValueSynedit'#11'Pare'
+'ntCtl3D'#8#8'TabOrder'#2#0#5'Width'#3#203#1#24'BookMarkOptions.OnChange'#13
+#14'Gutter.Visible'#8#15'Gutter.OnChange'#13#10'Keystrokes'#14#1#7'Command'#2
+#3#8'ShortCut'#2'&'#0#1#7'Command'#2'g'#8'ShortCut'#3'& '#0#1#7'Command'#3
+#211#0#8'ShortCut'#3'&@'#0#1#7'Command'#2#4#8'ShortCut'#2'('#0#1#7'Command'#2
+'h'#8'ShortCut'#3'( '#0#1#7'Command'#3#212#0#8'ShortCut'#3'(@'#0#1#7'Command'
+#2#1#8'ShortCut'#2'%'#0#1#7'Command'#2'e'#8'ShortCut'#3'% '#0#1#7'Command'#2
+#5#8'ShortCut'#3'%@'#0#1#7'Command'#2'i'#8'ShortCut'#3'%`'#0#1#7'Command'#2#2
+#8'ShortCut'#2''''#0#1#7'Command'#2'f'#8'ShortCut'#3''' '#0#1#7'Command'#2#6
+#8'ShortCut'#3'''@'#0#1#7'Command'#2'j'#8'ShortCut'#3'''`'#0#1#7'Command'#2
+#10#8'ShortCut'#2'"'#0#1#7'Command'#2'n'#8'ShortCut'#3'" '#0#1#7'Command'#2
+#14#8'ShortCut'#3'"@'#0#1#7'Command'#2'r'#8'ShortCut'#3'"`'#0#1#7'Command'#2
+#9#8'ShortCut'#2'!'#0#1#7'Command'#2'm'#8'ShortCut'#3'! '#0#1#7'Command'#2#13
+#8'ShortCut'#3'!@'#0#1#7'Command'#2'q'#8'ShortCut'#3'!`'#0#1#7'Command'#2#7#8
+'ShortCut'#2'$'#0#1#7'Command'#2'k'#8'ShortCut'#3'$ '#0#1#7'Command'#2#15#8
+'ShortCut'#3'$@'#0#1#7'Command'#2's'#8'ShortCut'#3'$`'#0#1#7'Command'#2#8#8
+'ShortCut'#2'#'#0#1#7'Command'#2'l'#8'ShortCut'#3'# '#0#1#7'Command'#2#16#8
+'ShortCut'#3'#@'#0#1#7'Command'#2't'#8'ShortCut'#3'#`'#0#1#7'Command'#3#223#0
+#8'ShortCut'#2'-'#0#1#7'Command'#3#201#0#8'ShortCut'#3'-@'#0#1#7'Command'#3
+'\'#2#8'ShortCut'#3'- '#0#1#7'Command'#3#246#1#8'ShortCut'#2'.'#0#1#7'Comman'
+'d'#3'['#2#8'ShortCut'#3'. '#0#1#7'Command'#3#245#1#8'ShortCut'#2#8#0#1#7'Co'
+'mmand'#3#245#1#8'ShortCut'#3#8' '#0#1#7'Command'#3#248#1#8'ShortCut'#3#8'@'
+#0#1#7'Command'#3'Y'#2#8'ShortCut'#4#8#128#0#0#0#1#7'Command'#3'Z'#2#8'Short'
+'Cut'#4#8#160#0#0#0#1#7'Command'#3#253#1#8'ShortCut'#2#13#0#1#7'Command'#3
+#199#0#8'ShortCut'#3'A@'#0#1#7'Command'#3#201#0#8'ShortCut'#3'C@'#0#1#7'Comm'
+'and'#3'b'#2#8'ShortCut'#3'I`'#0#1#7'Command'#3#253#1#8'ShortCut'#3'M@'#0#1#7
+'Command'#3#254#1#8'ShortCut'#3'N@'#0#1#7'Command'#3#247#1#8'ShortCut'#3'T@'
+#0#1#7'Command'#3'c'#2#8'ShortCut'#3'U`'#0#1#7'Command'#3'\'#2#8'ShortCut'#3
+'V@'#0#1#7'Command'#3'['#2#8'ShortCut'#3'X@'#0#1#7'Command'#3#251#1#8'ShortC'
+'ut'#3'Y@'#0#1#7'Command'#3#250#1#8'ShortCut'#3'Y`'#0#1#7'Command'#3'Y'#2#8
+'ShortCut'#3'Z@'#0#1#7'Command'#3'Z'#2#8'ShortCut'#3'Z`'#0#1#7'Command'#3'-'
+#1#8'ShortCut'#3'0@'#0#1#7'Command'#3'.'#1#8'ShortCut'#3'1@'#0#1#7'Command'#3
+'/'#1#8'ShortCut'#3'2@'#0#1#7'Command'#3'0'#1#8'ShortCut'#3'3@'#0#1#7'Comman'
+'d'#3'1'#1#8'ShortCut'#3'4@'#0#1#7'Command'#3'2'#1#8'ShortCut'#3'5@'#0#1#7'C'
+'ommand'#3'3'#1#8'ShortCut'#3'6@'#0#1#7'Command'#3'4'#1#8'ShortCut'#3'7@'#0#1
+#7'Command'#3'5'#1#8'ShortCut'#3'8@'#0#1#7'Command'#3'6'#1#8'ShortCut'#3'9@'
+#0#1#7'Command'#3'_'#1#8'ShortCut'#3'0`'#0#1#7'Command'#3'`'#1#8'ShortCut'#3
+'1`'#0#1#7'Command'#3'a'#1#8'ShortCut'#3'2`'#0#1#7'Command'#3'b'#1#8'ShortCu'
+'t'#3'3`'#0#1#7'Command'#3'c'#1#8'ShortCut'#3'4`'#0#1#7'Command'#3'd'#1#8'Sh'
+'ortCut'#3'5`'#0#1#7'Command'#3'e'#1#8'ShortCut'#3'6`'#0#1#7'Command'#3'f'#1
+#8'ShortCut'#3'7`'#0#1#7'Command'#3'g'#1#8'ShortCut'#3'8`'#0#1#7'Command'#3
+'h'#1#8'ShortCut'#3'9`'#0#1#7'Command'#3#231#0#8'ShortCut'#3'N`'#0#1#7'Comma'
+'nd'#3#232#0#8'ShortCut'#3'C`'#0#1#7'Command'#3#233#0#8'ShortCut'#3'L`'#0#1#7
,'Command'#3'd'#2#8'ShortCut'#2#9#0#1#7'Command'#3'e'#2#8'ShortCut'#3#9' '#0#1
+#7'Command'#3#250#0#8'ShortCut'#3'B`'#0#0#13'Lines.Strings'#1#6#12'ValueSyne'
+'dit'#0#7'Options'#11#12'eoautoindent'#18'eobrackethighlight'#20'eoshowctrlm'
+'ouselinks'#17'eodragdropediting'#15'eoscrollpasteol'#16'eoshowscrollhint'#11
+'eosmarttabs'#14'eotabstospaces'#20'eotrimtrailingspaces'#0#8'ReadOnly'#9#22
+'SelectedColor.OnChange'#13#6'Cursor'#4#252#255#0#0#6'Height'#2'U'#5'Width'#3
+#203#1#0#0#0#7'TButton'#11'CloseButton'#7'Anchors'#11#6'akleft'#8'akbottom'#0
+#5'Align'#7#8'albottom'#11'ModalResult'#2#2#7'Caption'#6#11'CloseButton'#7'T'
+'abStop'#9#8'TabOrder'#2#3#6'Height'#2#29#3'Top'#3#166#1#5'Width'#3#207#1#0#0
+#0
+'sDialogCREATE'#13'PixelsPerInch'#2'p'#18'HorzScrollBar.Page'#3#228#1#18'Ver'
+'tScrollBar.Page'#3#193#1#4'Left'#3#167#1#6'Height'#3#194#1#3'Top'#3#228#0#5
+'Width'#3#229#1#0#9'TGroupBox'#17'DirectoryGroupbox'#5'Align'#7#5'alTop'#7'C'
+'aption'#6#17'DirectoryGroupbox'#12'ClientHeight'#2#31#11'ClientWidth'#3#225
+#1#11'ParentCtl3D'#8#8'TabOrder'#2#0#8'OnResize'#7#23'DirectoryGroupboxRESIZ'
+'E'#6'Height'#2'0'#5'Width'#3#229#1#0#9'TComboBox'#17'DirectoryCombobox'#16
+'AutoCompleteText'#11#22'cbactEndOfLineComplete'#20'cbactSearchAscending'#0#9
+'MaxLength'#2#0#8'OnChange'#7#23'DirectoryComboboxCHANGE'#11'ParentCtl3D'#8#8
+'TabOrder'#2#0#4'Text'#6#17'DirectoryCombobox'#4'Left'#2#6#6'Height'#2#25#3
+'Top'#2#1#5'Width'#3'h'#1#0#0#7'TButton'#21'DirectoryBrowseButton'#25'Border'
+'Spacing.InnerBorder'#2#2#7'Caption'#6#3'...'#7'OnClick'#7#26'DirectoryBrows'
+'eButtonCLICK'#8'TabOrder'#2#1#4'Left'#3'w'#1#6'Height'#2#26#3'Top'#2#1#5'Wi'
+'dth'#2#31#0#0#0#9'TListView'#14'ValuesListview'#5'Align'#7#8'alClient'#7'Co'
+'lumns'#14#0#8'TabOrder'#2#1#9'ViewStyle'#7#8'vsReport'#12'OnSelectItem'#7#24
+'ValuesListviewSELECTITEM'#6'Height'#3#15#1#3'Top'#2'0'#5'Width'#3#24#1#0#0#9
+'TGroupBox'#13'ValueGroupbox'#5'Align'#7#8'alBottom'#7'Anchors'#11#6'akLeft'
+#8'akBottom'#0#7'Caption'#6#5'Value'#12'ClientHeight'#2'U'#11'ClientWidth'#3
+#225#1#11'ParentCtl3D'#8#8'TabOrder'#2#2#6'Height'#2'f'#3'Top'#3'?'#1#5'Widt'
+'h'#3#229#1#0#8'TSynEdit'#12'ValueSynedit'#5'Align'#7#8'alBottom'#11'Font.He'
+'ight'#2#241#9'Font.Name'#6#7'courier'#6'Height'#2'U'#4'Name'#6#12'ValueSyne'
+'dit'#11'ParentColor'#8#11'ParentCtl3D'#8#8'TabOrder'#2#0#5'Width'#3#225#1#23
+'BookMarkOptions.Xoffset'#2#238#14'Gutter.Visible'#8#23'Gutter.CodeFoldingWi'
+'dth'#2#14#10'Keystrokes'#14#1#7'Command'#2#3#8'ShortCut'#2'&'#0#1#7'Command'
+#2'g'#8'ShortCut'#3'& '#0#1#7'Command'#3#211#0#8'ShortCut'#3'&@'#0#1#7'Comma'
+'nd'#2#4#8'ShortCut'#2'('#0#1#7'Command'#2'h'#8'ShortCut'#3'( '#0#1#7'Comman'
+'d'#3#212#0#8'ShortCut'#3'(@'#0#1#7'Command'#2#1#8'ShortCut'#2'%'#0#1#7'Comm'
+'and'#2'e'#8'ShortCut'#3'% '#0#1#7'Command'#2#5#8'ShortCut'#3'%@'#0#1#7'Comm'
+'and'#2'i'#8'ShortCut'#3'%`'#0#1#7'Command'#2#2#8'ShortCut'#2''''#0#1#7'Comm'
+'and'#2'f'#8'ShortCut'#3''' '#0#1#7'Command'#2#6#8'ShortCut'#3'''@'#0#1#7'Co'
+'mmand'#2'j'#8'ShortCut'#3'''`'#0#1#7'Command'#2#10#8'ShortCut'#2'"'#0#1#7'C'
+'ommand'#2'n'#8'ShortCut'#3'" '#0#1#7'Command'#2#14#8'ShortCut'#3'"@'#0#1#7
+'Command'#2'r'#8'ShortCut'#3'"`'#0#1#7'Command'#2#9#8'ShortCut'#2'!'#0#1#7'C'
+'ommand'#2'm'#8'ShortCut'#3'! '#0#1#7'Command'#2#13#8'ShortCut'#3'!@'#0#1#7
+'Command'#2'q'#8'ShortCut'#3'!`'#0#1#7'Command'#2#7#8'ShortCut'#2'$'#0#1#7'C'
+'ommand'#2'k'#8'ShortCut'#3'$ '#0#1#7'Command'#2#15#8'ShortCut'#3'$@'#0#1#7
+'Command'#2's'#8'ShortCut'#3'$`'#0#1#7'Command'#2#8#8'ShortCut'#2'#'#0#1#7'C'
+'ommand'#2'l'#8'ShortCut'#3'# '#0#1#7'Command'#2#16#8'ShortCut'#3'#@'#0#1#7
+'Command'#2't'#8'ShortCut'#3'#`'#0#1#7'Command'#3#223#0#8'ShortCut'#2'-'#0#1
+#7'Command'#3#201#0#8'ShortCut'#3'-@'#0#1#7'Command'#3'\'#2#8'ShortCut'#3'- '
+#0#1#7'Command'#3#246#1#8'ShortCut'#2'.'#0#1#7'Command'#3'['#2#8'ShortCut'#3
+'. '#0#1#7'Command'#3#245#1#8'ShortCut'#2#8#0#1#7'Command'#3#245#1#8'ShortCu'
+'t'#3#8' '#0#1#7'Command'#3#248#1#8'ShortCut'#3#8'@'#0#1#7'Command'#3'Y'#2#8
+'ShortCut'#4#8#128#0#0#0#1#7'Command'#3'Z'#2#8'ShortCut'#4#8#160#0#0#0#1#7'C'
+'ommand'#3#253#1#8'ShortCut'#2#13#0#1#7'Command'#3#199#0#8'ShortCut'#3'A@'#0
+#1#7'Command'#3#201#0#8'ShortCut'#3'C@'#0#1#7'Command'#3'b'#2#8'ShortCut'#3
+'I`'#0#1#7'Command'#3#253#1#8'ShortCut'#3'M@'#0#1#7'Command'#3#254#1#8'Short'
+'Cut'#3'N@'#0#1#7'Command'#3#247#1#8'ShortCut'#3'T@'#0#1#7'Command'#3'c'#2#8
+'ShortCut'#3'U`'#0#1#7'Command'#3'\'#2#8'ShortCut'#3'V@'#0#1#7'Command'#3'['
+#2#8'ShortCut'#3'X@'#0#1#7'Command'#3#251#1#8'ShortCut'#3'Y@'#0#1#7'Command'
+#3#250#1#8'ShortCut'#3'Y`'#0#1#7'Command'#3'Y'#2#8'ShortCut'#3'Z@'#0#1#7'Com'
+'mand'#3'Z'#2#8'ShortCut'#3'Z`'#0#1#7'Command'#3'-'#1#8'ShortCut'#3'0@'#0#1#7
+'Command'#3'.'#1#8'ShortCut'#3'1@'#0#1#7'Command'#3'/'#1#8'ShortCut'#3'2@'#0
+#1#7'Command'#3'0'#1#8'ShortCut'#3'3@'#0#1#7'Command'#3'1'#1#8'ShortCut'#3'4'
+'@'#0#1#7'Command'#3'2'#1#8'ShortCut'#3'5@'#0#1#7'Command'#3'3'#1#8'ShortCut'
+#3'6@'#0#1#7'Command'#3'4'#1#8'ShortCut'#3'7@'#0#1#7'Command'#3'5'#1#8'Short'
+'Cut'#3'8@'#0#1#7'Command'#3'6'#1#8'ShortCut'#3'9@'#0#1#7'Command'#3'_'#1#8
+'ShortCut'#3'0`'#0#1#7'Command'#3'`'#1#8'ShortCut'#3'1`'#0#1#7'Command'#3'a'
+#1#8'ShortCut'#3'2`'#0#1#7'Command'#3'b'#1#8'ShortCut'#3'3`'#0#1#7'Command'#3
+'c'#1#8'ShortCut'#3'4`'#0#1#7'Command'#3'd'#1#8'ShortCut'#3'5`'#0#1#7'Comman'
+'d'#3'e'#1#8'ShortCut'#3'6`'#0#1#7'Command'#3'f'#1#8'ShortCut'#3'7`'#0#1#7'C'
+'ommand'#3'g'#1#8'ShortCut'#3'8`'#0#1#7'Command'#3'h'#1#8'ShortCut'#3'9`'#0#1
,#7'Command'#3#231#0#8'ShortCut'#3'N`'#0#1#7'Command'#3#232#0#8'ShortCut'#3'C'
+'`'#0#1#7'Command'#3#233#0#8'ShortCut'#3'L`'#0#1#7'Command'#3'd'#2#8'ShortCu'
+'t'#2#9#0#1#7'Command'#3'e'#2#8'ShortCut'#3#9' '#0#1#7'Command'#3#250#0#8'Sh'
+'ortCut'#3'B`'#0#0#13'Lines.Strings'#1#6#12'ValueSynedit'#0#7'Options'#11#12
+'eoAutoIndent'#17'eoDragDropEditing'#15'eoScrollPastEol'#16'eoShowScrollHint'
+#11'eoSmartTabs'#14'eoTabsToSpaces'#20'eoTrimTrailingSpaces'#18'eoBracketHig'
+'hlight'#20'eoShowCtrlMouseLinks'#0#8'ReadOnly'#9#6'Cursor'#7#7'crIBeam'#6'H'
+'eight'#2'U'#5'Width'#3#225#1#0#0#0#7'TButton'#11'CloseButton'#5'Align'#7#8
+'alBottom'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#25'BorderSpacing.InnerBorde'
+'r'#2#2#7'Caption'#6#11'CloseButton'#11'ModalResult'#2#2#8'TabOrder'#2#3#6'H'
+'eight'#2#29#3'Top'#3#165#1#5'Width'#3#229#1#0#0#9'TSplitter'#12'MainSplitte'
+'r'#5'Align'#7#7'alRight'#6'Height'#3#15#1#5'Width'#2#4#12'ResizeAnchor'#7#7
+'akRight'#6'Cursor'#7#8'crHSplit'#4'Left'#3#24#1#6'Height'#3#15#1#3'Top'#2'0'
+#5'Width'#2#4#0#0#9'TTreeView'#23'ParsedTemplatesTreeView'#5'Align'#7#7'alRi'
+'ght'#17'DefaultItemHeight'#2#14#8'TabOrder'#2#4#4'Left'#3#29#1#6'Height'#3
+#15#1#3'Top'#2'0'#5'Width'#3#200#0#0#0#0
]);

View File

@ -5,19 +5,25 @@ unit CodeToolsDefPreview;
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, ComCtrls, SynEdit, DefineTemplates, ExprEval, LazarusIDEStrConsts,
FileUtil, InputHistory;
Classes, SysUtils, Math, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ComCtrls, ExtCtrls, FileUtil,
SynEdit, DefineTemplates, ExprEval,
LazarusIDEStrConsts, InputHistory, IDEWindowIntf, CodeToolsOptions;
type
{ TCodeToolsDefinesDialog }
TCodeToolsDefinesDialog = class(TForm)
CloseButton: TBUTTON;
DirectoryBrowseButton: TBUTTON;
DirectoryCombobox: TCOMBOBOX;
DirectoryGroupbox: TGROUPBOX;
ValueSynedit: TSYNEDIT;
ValueGroupbox: TGROUPBOX;
ValuesListview: TLISTVIEW;
CloseButton: TButton;
DirectoryBrowseButton: TButton;
DirectoryCombobox: TComboBox;
DirectoryGroupbox: TGroupBox;
MainSplitter: TSplitter;
ParsedTemplatesTreeView: TTreeView;
ValueSynedit: TSynEdit;
ValueGroupbox: TGroupBox;
ValuesListview: TListView;
procedure CodeToolsDefinesDialogCLOSE(Sender: TObject;
var CloseAction: TCloseAction);
procedure CodeToolsDefinesDialogCREATE(Sender: TObject);
@ -32,6 +38,7 @@ type
procedure UpdateValues;
procedure UpdateValue;
procedure ClearValues;
procedure FillTemplateTree;
procedure SetComboBox(AComboBox: TComboBox; const NewText: string);
public
property DefineTree: TDefineTree read FDefineTree write SetDefineTree;
@ -40,6 +47,13 @@ type
function ShowCodeToolsDefinesValuesDialog(ADefineTree: TDefineTree;
const InitialDirectory: string): TModalresult;
procedure RebuildDefineTreeView(ATreeView: TTreeView;
RootTemplate: TDefineTemplate);
procedure AddDefineNodes(ATreeView: TTreeView; ANode: TDefineTemplate;
AParent: TTreeNode; WithChilds,WithNextSiblings: boolean);
procedure SetNodeImages(ANode: TTreeNode; WithSubNodes: boolean);
implementation
@ -48,7 +62,6 @@ function ShowCodeToolsDefinesValuesDialog(ADefineTree: TDefineTree;
var
CodeToolsDefinesDialog: TCodeToolsDefinesDialog;
begin
//writeln('ShowCodeToolsDefinesValuesDialog ',InitialDirectory);
CodeToolsDefinesDialog:=TCodeToolsDefinesDialog.Create(nil);
if InitialDirectory<>'' then
CodeToolsDefinesDialog.SetComboBox(CodeToolsDefinesDialog.DirectoryCombobox,
@ -58,6 +71,69 @@ begin
CodeToolsDefinesDialog.Free;
end;
procedure RebuildDefineTreeView(ATreeView: TTreeView;
RootTemplate: TDefineTemplate);
begin
ATreeView.Items.BeginUpdate;
ATreeView.Items.Clear;
AddDefineNodes(ATreeView,RootTemplate,nil,true,true);
ATreeView.Items.EndUpdate;
end;
procedure AddDefineNodes(
ATreeView: TTreeView; ANode: TDefineTemplate; AParent: TTreeNode;
WithChilds, WithNextSiblings: boolean);
var NewTreeNode: TTreeNode;
begin
if ANode=nil then exit;
ATreeView.Items.BeginUpdate;
NewTreeNode:=ATreeView.Items.AddChildObject(AParent,ANode.Name,ANode);
SetNodeImages(NewTreeNode,false);
if WithChilds and (ANode.FirstChild<>nil) then begin
AddDefineNodes(ATreeView,ANode.FirstChild,NewTreeNode,true,true);
end;
if WithNextSiblings and (ANode.Next<>nil) then begin
AddDefineNodes(ATreeView,ANode.Next,AParent,WithChilds,true);
end;
ATreeView.Items.EndUpdate;
end;
procedure SetNodeImages(ANode: TTreeNode;
WithSubNodes: boolean);
var ADefineTemplate: TDefineTemplate;
begin
ADefineTemplate:=TDefineTemplate(ANode.Data);
case ADefineTemplate.Action of
da_Define: ANode.ImageIndex:=0;
da_DefineRecurse: ANode.ImageIndex:=1;
da_Undefine: ANode.ImageIndex:=2;
da_UndefineRecurse: ANode.ImageIndex:=3;
da_UndefineAll: ANode.ImageIndex:=4;
da_Block: ANode.ImageIndex:=5;
da_Directory: ANode.ImageIndex:=6;
da_If: ANode.ImageIndex:=7;
da_IfDef: ANode.ImageIndex:=8;
da_IfNDef: ANode.ImageIndex:=9;
da_ElseIf: ANode.ImageIndex:=10;
da_Else: ANode.ImageIndex:=11;
else
ANode.ImageIndex:=-1;
end;
ANode.SelectedIndex:=ANode.ImageIndex;
if ADefineTemplate.IsAutoGenerated then begin
ANode.StateIndex:=13;
end else begin
ANode.StateIndex:=12;
end;
if WithSubNodes then begin
ANode:=ANode.GetFirstChild;
while ANode<>nil do begin
SetNodeImages(ANode,true);
ANode:=ANode.GetNextSibling;
end;
end;
end;
{ TCodeToolsDefinesDialog }
procedure TCodeToolsDefinesDialog.DirectoryGroupboxRESIZE(Sender: TObject);
@ -82,6 +158,7 @@ begin
if FDefineTree=AValue then exit;
FDefineTree:=AValue;
UpdateValues;
FillTemplateTree;
end;
procedure TCodeToolsDefinesDialog.UpdateValues;
@ -147,6 +224,11 @@ begin
ValuesListview.Items.Clear;
end;
procedure TCodeToolsDefinesDialog.FillTemplateTree;
begin
RebuildDefineTreeView(ParsedTemplatesTreeView,DefineTree.RootTemplate);
end;
procedure TCodeToolsDefinesDialog.SetComboBox(AComboBox: TComboBox;
const NewText: string);
var
@ -165,6 +247,8 @@ procedure TCodeToolsDefinesDialog.CodeToolsDefinesDialogCREATE(Sender: TObject);
var
ListColumn: TListColumn;
begin
IDEDialogLayoutList.ApplyLayout(Self,485,450);
Caption:=lisCTDefCodeToolsDirectoryValues;
ListColumn:=ValuesListview.Columns.Add;
@ -182,6 +266,9 @@ begin
DirectoryCombobox.ItemIndex:=0
else
DirectoryCombobox.Text:='';
MainSplitter.SetSplitterPosition(
Max(20,Min(ClientWidth-100,CodeToolsOpts.DefinesPreviewMainSplitterPos)));
end;
procedure TCodeToolsDefinesDialog.CodeToolsDefinesDialogCLOSE(Sender: TObject;
@ -189,6 +276,8 @@ procedure TCodeToolsDefinesDialog.CodeToolsDefinesDialogCLOSE(Sender: TObject;
begin
InputHistories.HistoryLists.GetList(hlCodeToolsDirectories,true).Assign(
DirectoryCombobox.Items);
CodeToolsOpts.DefinesPreviewMainSplitterPos:=MainSplitter.Left;
CodeToolsOpts.Save;
end;
procedure TCodeToolsDefinesDialog.DirectoryBrowseButtonCLICK(Sender: TObject);

View File

@ -59,6 +59,7 @@ type
// Define Templates
FGlobalDefineTemplates: TDefineTemplate;
FDefinesEditMainSplitterTop: integer;
FDefinesPreviewMainSplitterPos: integer;
// CodeCreation
FAddInheritedCodeToOverrideMethod: boolean;
@ -110,7 +111,9 @@ type
property GlobalDefineTemplates: TDefineTemplate read FGlobalDefineTemplates;
property DefinesEditMainSplitterTop: integer read FDefinesEditMainSplitterTop
write FDefinesEditMainSplitterTop;
property DefinesPreviewMainSplitterPos: integer
read FDefinesPreviewMainSplitterPos write FDefinesPreviewMainSplitterPos;
// CodeCreation
property CompleteProperties: boolean
read FCompleteProperties write FCompleteProperties;
@ -416,6 +419,8 @@ begin
LoadGlobalDefineTemplates;
FDefinesEditMainSplitterTop:=XMLConfig.GetValue(
'CodeToolsOptions/DefinesEditMainSplitter/Top',100);
FDefinesPreviewMainSplitterPos:=XMLConfig.GetValue(
'CodeToolsOptions/DefinesPreviewMainSplitter/Position',100);
// CodeCreation
FAddInheritedCodeToOverrideMethod:=XMLConfig.GetValue(
@ -504,6 +509,8 @@ begin
SaveGlobalDefineTemplates;
XMLConfig.SetDeleteValue('CodeToolsOptions/DefinesEditMainSplitter/Top',
FDefinesEditMainSplitterTop,100);
XMLConfig.SetDeleteValue('CodeToolsOptions/DefinesPreviewMainSplitter/Position',
FDefinesPreviewMainSplitterPos,280);
// CodeCreation
XMLConfig.SetDeleteValue(
@ -599,6 +606,7 @@ begin
if FGlobalDefineTemplates<>nil then
FGlobalDefineTemplates.SetDefineOwner(Self,true);
FDefinesEditMainSplitterTop:=CodeToolsOpts.DefinesEditMainSplitterTop;
FDefinesPreviewMainSplitterPos:=CodeToolsOpts.DefinesPreviewMainSplitterPos;
// CodeCreation
FLineLength:=CodeToolsOpts.FLineLength;
@ -636,6 +644,7 @@ begin
// define templates
ClearGlobalDefineTemplates;
FDefinesEditMainSplitterTop:=100;
FDefinesPreviewMainSplitterPos:=280;
// CodeCreation
FAddInheritedCodeToOverrideMethod:=true;
@ -684,6 +693,7 @@ begin
and (FGlobalDefineTemplates.IsEqual(
CodeToolsOpts.FGlobalDefineTemplates,true,true))
and (FDefinesEditMainSplitterTop=CodeToolsOpts.fDefinesEditMainSplitterTop)
and (FDefinesPreviewMainSplitterPos=CodeToolsOpts.FDefinesPreviewMainSplitterPos)
// CodeCreation
and (FLineLength=CodeToolsOpts.FLineLength)