IDEIntf: added OnShow handler for TIDEMenuSection, h2pas wizard: implemented adding/editing text tools

git-svn-id: trunk@9698 -
This commit is contained in:
mattias 2006-08-02 16:36:35 +00:00
parent cec4ac6957
commit be15116595
20 changed files with 814 additions and 838 deletions

View File

@ -171,8 +171,10 @@ type
TH2PasTool = class(TIDEExternalToolOptions)
private
FH2PasFile: TH2PasFile;
FTargetFilename: string;
public
property H2PasFile: TH2PasFile read FH2PasFile write FH2PasFile;
property TargetFilename: string read FTargetFilename write FTargetFilename;
end;
{ TH2PasConverter }
@ -182,6 +184,7 @@ type
FAutoOpenLastProject: boolean;
FExecuting: boolean;
Fh2pasFilename: string;
FLastUsedFilename: string;
FModified: boolean;
FProject: TH2PasProject;
FProjectHistory: TStrings;
@ -213,6 +216,7 @@ type
function GetH2PasErrorPostion(const Line: string;
out aFilename: string;
out LineNumber, Column: integer): boolean;
function FileIsRelated(const aFilename: string): Boolean;
public
property Project: TH2PasProject read FProject write SetProject;
property ProjectHistory: TStrings read FProjectHistory write SetProjectHistory;
@ -224,6 +228,7 @@ type
property h2pasFilename: string read Fh2pasFilename write Seth2pasFilename;
property Modified: boolean read FModified write FModified;
property Executing: boolean read FExecuting;
property LastUsedFilename: string read FLastUsedFilename;
end;
implementation
@ -935,7 +940,7 @@ begin
LineNumber:=REVar(1);
MsgType:=REVar(2);
Msg:=REVar(3);
Line.Line:=Tool.H2PasFile.Filename+'('+LineNumber+') '+MsgType+': '+Msg;
Line.Line:=Tool.TargetFilename+'('+LineNumber+') '+MsgType+': '+Msg;
end;
//DebugLn(['TH2PasConverter.OnParseH2PasLine ',Line.Line]);
end;
@ -1137,6 +1142,7 @@ begin
Result:=mrOK;
FExecuting:=true;
try
FLastUsedFilename:='';
// convert every c header file
for i:=0 to Project.CHeaderFileCount-1 do begin
AFile:=Project.CHeaderFiles[i];
@ -1162,6 +1168,7 @@ var
TextConverter: TIDETextConverter;
begin
Result:=mrCancel;
FLastUsedFilename:='';
// check if file exists
InputFilename:=AFile.Filename;
@ -1173,7 +1180,7 @@ begin
end;
OutputFilename:=AFile.GetOutputFilename;
TempCHeaderFilename:=ChangeFileExt(OutputFilename,'.h.tmp');
TempCHeaderFilename:=ChangeFileExt(OutputFilename,'.tmp.h');
if not CopyFile(InputFilename,TempCHeaderFilename) then begin
Result:=IDEMessageDialog('Copying file failed',
'Unable to copy file "'+InputFilename+'"'#13
@ -1185,6 +1192,9 @@ begin
TextConverter:=TIDETextConverter.Create(nil);
try
TextConverter.Filename:=TempCHeaderFilename;
FLastUsedFilename:=TextConverter.Filename;
TextConverter.LoadFromFile(InputFilename,true,true,false);
DebugLn(['TH2PasConverter.ConvertFile TempCHeaderFilename="',TempCHeaderFilename,'"']);
// run converters for .h file to make it compatible for h2pas
Result:=TextConverter.Execute(Project.PreH2PasTools);
@ -1198,8 +1208,9 @@ begin
try
Tool.Title:='h2pas';
Tool.H2PasFile:=AFile;
Tool.TargetFilename:=TextConverter.Filename;
Tool.Filename:=GetH2PasFilename;
Tool.CmdLineParams:=AFile.GetH2PasParameters(TempCHeaderFilename);
Tool.CmdLineParams:=AFile.GetH2PasParameters(Tool.TargetFilename);
Tool.ScanOutput:=true;
Tool.ShowAllOutput:=true;
Tool.WorkingDirectory:=Project.BaseDir;
@ -1256,6 +1267,12 @@ begin
end;
end;
function TH2PasConverter.FileIsRelated(const aFilename: string): Boolean;
begin
Result:=(CompareFilenames(AFilename,LastUsedFilename)=0)
or ((Project<>nil) and (Project.CHeaderFileWithFilename(aFilename)<>nil));
end;
end.

View File

@ -16,11 +16,11 @@ object H2PasDialog: TH2PasDialog
Top = 205
Width = 785
object MainPageControl: TPageControl
ActivePage = ConvertTabSheet
ActivePage = h2pasOptionsTabSheet
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
TabIndex = 2
TabOrder = 0
TabOrder = 4
TabStop = True
AnchorSideBottom.Control = OpenSettingsButton
Height = 465
@ -105,6 +105,24 @@ object H2PasDialog: TH2PasDialog
Width = 5
end
end
object PreH2PasTabSheet: TTabSheet
Caption = 'PreH2PasTabSheet'
ClientHeight = 435
ClientWidth = 781
Left = 2
Height = 435
Top = 28
Width = 781
object PreH2PasGroupBox: TGroupBox
Align = alClient
Caption = 'PreH2PasGroupBox'
ClientHeight = 435
ClientWidth = 781
TabOrder = 0
Height = 435
Width = 781
end
end
object h2pasOptionsTabSheet: TTabSheet
Caption = 'h2pasOptionsTabSheet'
ClientHeight = 435
@ -226,395 +244,6 @@ object H2PasDialog: TH2PasDialog
Width = 768
end
end
object ConvertTabSheet: TTabSheet
Caption = 'ConvertTabSheet'
ClientHeight = 435
ClientWidth = 781
Left = 2
Height = 435
Top = 28
Width = 781
object ConvertButton: TButton
AutoSize = True
BorderSpacing.InnerBorder = 4
Caption = 'ConvertButton'
OnClick = ConvertButtonClick
TabOrder = 0
Left = 6
Height = 26
Top = 396
Width = 93
end
object ConvertErrorGroupBox: TGroupBox
Anchors = [akTop, akLeft, akRight]
Caption = 'ConvertErrorGroupBox'
ClientHeight = 130
ClientWidth = 764
TabOrder = 1
AnchorSideTop.Control = ConvertUpDownSplitter
AnchorSideTop.Side = asrBottom
Left = 6
Height = 147
Top = 217
Width = 768
object ConvertErrorSynEdit: TSynEdit
Align = alClient
Font.Height = -12
Font.Name = 'courier'
Height = 130
Name = 'ConvertErrorSynEdit'
ParentColor = False
TabOrder = 0
Width = 764
BookMarkOptions.Xoffset = 30
Gutter.ShowLineNumbers = True
Gutter.CodeFoldingWidth = 14
Highlighter = SynCppSyn1
Keystrokes = <
item
Command = 3
ShortCut = 38
end
item
Command = 103
ShortCut = 8230
end
item
Command = 211
ShortCut = 16422
end
item
Command = 4
ShortCut = 40
end
item
Command = 104
ShortCut = 8232
end
item
Command = 212
ShortCut = 16424
end
item
Command = 1
ShortCut = 37
end
item
Command = 101
ShortCut = 8229
end
item
Command = 5
ShortCut = 16421
end
item
Command = 105
ShortCut = 24613
end
item
Command = 2
ShortCut = 39
end
item
Command = 102
ShortCut = 8231
end
item
Command = 6
ShortCut = 16423
end
item
Command = 106
ShortCut = 24615
end
item
Command = 10
ShortCut = 34
end
item
Command = 110
ShortCut = 8226
end
item
Command = 14
ShortCut = 16418
end
item
Command = 114
ShortCut = 24610
end
item
Command = 9
ShortCut = 33
end
item
Command = 109
ShortCut = 8225
end
item
Command = 13
ShortCut = 16417
end
item
Command = 113
ShortCut = 24609
end
item
Command = 7
ShortCut = 36
end
item
Command = 107
ShortCut = 8228
end
item
Command = 15
ShortCut = 16420
end
item
Command = 115
ShortCut = 24612
end
item
Command = 8
ShortCut = 35
end
item
Command = 108
ShortCut = 8227
end
item
Command = 16
ShortCut = 16419
end
item
Command = 116
ShortCut = 24611
end
item
Command = 223
ShortCut = 45
end
item
Command = 201
ShortCut = 16429
end
item
Command = 604
ShortCut = 8237
end
item
Command = 502
ShortCut = 46
end
item
Command = 603
ShortCut = 8238
end
item
Command = 501
ShortCut = 8
end
item
Command = 501
ShortCut = 8200
end
item
Command = 504
ShortCut = 16392
end
item
Command = 601
ShortCut = 32776
end
item
Command = 602
ShortCut = 40968
end
item
Command = 509
ShortCut = 13
end
item
Command = 199
ShortCut = 16449
end
item
Command = 201
ShortCut = 16451
end
item
Command = 610
ShortCut = 24649
end
item
Command = 509
ShortCut = 16461
end
item
Command = 510
ShortCut = 16462
end
item
Command = 503
ShortCut = 16468
end
item
Command = 611
ShortCut = 24661
end
item
Command = 604
ShortCut = 16470
end
item
Command = 603
ShortCut = 16472
end
item
Command = 507
ShortCut = 16473
end
item
Command = 506
ShortCut = 24665
end
item
Command = 601
ShortCut = 16474
end
item
Command = 602
ShortCut = 24666
end
item
Command = 301
ShortCut = 16432
end
item
Command = 302
ShortCut = 16433
end
item
Command = 303
ShortCut = 16434
end
item
Command = 304
ShortCut = 16435
end
item
Command = 305
ShortCut = 16436
end
item
Command = 306
ShortCut = 16437
end
item
Command = 307
ShortCut = 16438
end
item
Command = 308
ShortCut = 16439
end
item
Command = 309
ShortCut = 16440
end
item
Command = 310
ShortCut = 16441
end
item
Command = 351
ShortCut = 24624
end
item
Command = 352
ShortCut = 24625
end
item
Command = 353
ShortCut = 24626
end
item
Command = 354
ShortCut = 24627
end
item
Command = 355
ShortCut = 24628
end
item
Command = 356
ShortCut = 24629
end
item
Command = 357
ShortCut = 24630
end
item
Command = 358
ShortCut = 24631
end
item
Command = 359
ShortCut = 24632
end
item
Command = 360
ShortCut = 24633
end
item
Command = 231
ShortCut = 24654
end
item
Command = 232
ShortCut = 24643
end
item
Command = 233
ShortCut = 24652
end
item
Command = 612
ShortCut = 9
end
item
Command = 613
ShortCut = 8201
end
item
Command = 250
ShortCut = 24642
end>
Lines.Strings = (
'ConvertErrorSynEdit'
)
Options = [eoAutoIndent, eoDragDropEditing, eoGroupUndo, eoShowScrollHint, eoShowSpecialChars, eoSmartTabDelete, eoSmartTabs, eoTabsToSpaces, eoTrimTrailingSpaces, eoBracketHighlight]
ReadOnly = True
Cursor = crIBeam
Height = 130
Width = 764
end
end
object ConvertUpDownSplitter: TSplitter
Align = alNone
Beveled = True
Cursor = crVSplit
Height = 5
Width = 781
ResizeAnchor = akBottom
Cursor = crVSplit
Left = -10
Height = 5
Top = 212
Width = 781
end
end
object SettingsTabSheet: TTabSheet
Caption = 'SettingsTabSheet'
ClientHeight = 435
@ -729,6 +358,21 @@ object H2PasDialog: TH2PasDialog
Top = 470
Width = 122
end
object ConvertButton: TButton
AutoSize = True
BorderSpacing.Left = 15
BorderSpacing.InnerBorder = 4
Caption = 'ConvertButton'
OnClick = ConvertButtonClick
TabOrder = 0
AnchorSideLeft.Control = SaveSettingsButton
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = SaveSettingsButton
Left = 271
Height = 26
Top = 470
Width = 93
end
object CloseButton: TButton
Anchors = [akRight, akBottom]
AutoSize = True
@ -746,10 +390,4 @@ object H2PasDialog: TH2PasDialog
Top = 470
Width = 81
end
object SynCppSyn1: TSynCppSyn
DefaultFilter = 'C++-Quelltexte (*.c,*.cpp,*.h,*.hpp,*.hh)|*.c;*.cpp;*.h;*.hpp;*.hh'
Enabled = False
left = 312
top = 80
end
end

View File

@ -7,20 +7,20 @@ LazarusResources.Add('TH2PasDialog','FORMDATA',[
+'oy'#9'OnKeyDown'#7#11'FormKeyDown'#13'PixelsPerInch'#2'K'#8'Position'#7#15
+'poDesktopCenter'#18'HorzScrollBar.Page'#3#16#3#18'VertScrollBar.Page'#3#244
+#1#4'Left'#3#245#0#6'Height'#3#245#1#3'Top'#3#205#0#5'Width'#3#17#3#0#12'TPa'
+'geControl'#15'MainPageControl'#10'ActivePage'#7#15'ConvertTabSheet'#5'Align'
+#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'TabI'
+'ndex'#2#2#8'TabOrder'#2#0#7'TabStop'#9#24'AnchorSideBottom.Control'#7#18'Op'
+'enSettingsButton'#6'Height'#3#209#1#5'Width'#3#17#3#0#9'TTabSheet'#13'Files'
+'TabSheet'#7'Caption'#6#13'FilesTabSheet'#12'ClientHeight'#3#179#1#11'Client'
+'Width'#3#13#3#4'Left'#2#2#6'Height'#3#179#1#3'Top'#2#28#5'Width'#3#13#3#0#13
+'TCheckListBox'#24'CHeaderFilesCheckListBox'#5'Align'#7#6'alLeft'#11'BorderS'
+'tyle'#7#8'bsSingle'#11'OnItemClick'#7'!CHeaderFilesCheckListBoxItemClick'#8
+'TabOrder'#2#0#7'TabStop'#9#8'TopIndex'#2#255#6'Height'#3#179#1#5'Width'#3
+#255#0#0#0#7'TButton'#21'AddCHeaderFilesButton'#18'BorderSpacing.Left'#2#6#25
+'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#21'AddCHeaderFilesButton'#7'OnC'
+'lick'#7#26'AddCHeaderFilesButtonClick'#8'TabOrder'#2#1#22'AnchorSideLeft.Co'
+'ntrol'#7#21'CHeaderFilesSplitter1'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4
+'Left'#3#10#1#6'Height'#2#25#3'Top'#2#12#5'Width'#3#185#0#0#0#7'TButton'#24
+'geControl'#15'MainPageControl'#10'ActivePage'#7#20'h2pasOptionsTabSheet'#5
+'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0
+#8'TabIndex'#2#2#8'TabOrder'#2#4#7'TabStop'#9#24'AnchorSideBottom.Control'#7
+#18'OpenSettingsButton'#6'Height'#3#209#1#5'Width'#3#17#3#0#9'TTabSheet'#13
+'FilesTabSheet'#7'Caption'#6#13'FilesTabSheet'#12'ClientHeight'#3#179#1#11'C'
+'lientWidth'#3#13#3#4'Left'#2#2#6'Height'#3#179#1#3'Top'#2#28#5'Width'#3#13#3
+#0#13'TCheckListBox'#24'CHeaderFilesCheckListBox'#5'Align'#7#6'alLeft'#11'Bo'
+'rderStyle'#7#8'bsSingle'#11'OnItemClick'#7'!CHeaderFilesCheckListBoxItemCli'
+'ck'#8'TabOrder'#2#0#7'TabStop'#9#8'TopIndex'#2#255#6'Height'#3#179#1#5'Widt'
+'h'#3#255#0#0#0#7'TButton'#21'AddCHeaderFilesButton'#18'BorderSpacing.Left'#2
+#6#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#21'AddCHeaderFilesButton'#7
+'OnClick'#7#26'AddCHeaderFilesButtonClick'#8'TabOrder'#2#1#22'AnchorSideLeft'
+'.Control'#7#21'CHeaderFilesSplitter1'#19'AnchorSideLeft.Side'#7#9'asrBottom'
+#4'Left'#3#10#1#6'Height'#2#25#3'Top'#2#12#5'Width'#3#185#0#0#0#7'TButton'#24
+'DeleteCHeaderFilesButton'#18'BorderSpacing.Left'#2#6#25'BorderSpacing.Inner'
+'Border'#2#4#7'Caption'#6#24'DeleteCHeaderFilesButton'#7'OnClick'#7#29'Delet'
+'eCHeaderFilesButtonClick'#8'TabOrder'#2#2#22'AnchorSideLeft.Control'#7#21'C'
@ -37,38 +37,43 @@ LazarusResources.Add('TH2PasDialog','FORMDATA',[
+'ilesSplitter1'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#3#10#1#6'Heig'
+'ht'#2#25#3'Top'#3#137#0#5'Width'#3#185#0#0#0#9'TSplitter'#21'CHeaderFilesSp'
+'litter1'#7'Beveled'#9#6'Height'#3#179#1#5'Width'#2#5#6'Cursor'#7#8'crHSplit'
+#4'Left'#3#255#0#6'Height'#3#179#1#5'Width'#2#5#0#0#0#9'TTabSheet'#20'h2pasO'
+'ptionsTabSheet'#7'Caption'#6#20'h2pasOptionsTabSheet'#12'ClientHeight'#3#179
+#1#11'ClientWidth'#3#13#3#4'Left'#2#2#6'Height'#3#179#1#3'Top'#2#28#5'Width'
+#3#13#3#0#6'TLabel'#12'LibNameLabel'#17'BorderSpacing.Top'#2#10#7'Caption'#6
+#12'LibNameLabel'#5'Color'#7#6'clNone'#11'ParentColor'#8#21'AnchorSideTop.Co'
+'ntrol'#7#11'LibnameEdit'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#6#6
+'Height'#2#13#3'Top'#3#25#1#5'Width'#2'Q'#0#0#6'TLabel'#14'OutputExtLabel'#7
+'Caption'#6#14'OutputExtLabel'#5'Color'#7#6'clNone'#11'ParentColor'#8#21'Anc'
+'horSideTop.Control'#7#13'OutputExtEdit'#18'AnchorSideTop.Side'#7#9'asrCente'
+'r'#4'Left'#2#6#6'Height'#2#13#3'Top'#3'9'#1#5'Width'#2'V'#0#0#6'TLabel'#14
+'OutputDirLabel'#7'Caption'#6#14'OutputDirLabel'#5'Color'#7#6'clNone'#11'Par'
+'entColor'#8#21'AnchorSideTop.Control'#7#13'OutputDirEdit'#18'AnchorSideTop.'
+'Side'#7#9'asrCenter'#4'Left'#2#6#6'Height'#2#13#3'Top'#3'V'#1#5'Width'#2'U'
+#0#0#5'TEdit'#11'LibnameEdit'#18'BorderSpacing.Left'#2#6#17'BorderSpacing.To'
+'p'#2#6#13'OnEditingDone'#7#22'LibnameEditEditingDone'#8'TabOrder'#2#0#4'Tex'
+'t'#6#11'LibnameEdit'#22'AnchorSideLeft.Control'#7#12'LibNameLabel'#19'Ancho'
+'rSideLeft.Side'#7#9'asrBottom'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'
+#2']'#6'Height'#2#23#3'Top'#3#20#1#5'Width'#2'q'#0#0#5'TEdit'#13'OutputExtEd'
+'it'#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#13'OnEditingDone'#7
+#24'OutputExtEditEditingDone'#8'TabOrder'#2#1#4'Text'#6#13'OutputExtEdit'#22
+'AnchorSideLeft.Control'#7#14'OutputExtLabel'#19'AnchorSideLeft.Side'#7#9'as'
+'rBottom'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2'b'#6'Height'#2#23#3
+'Top'#3'4'#1#5'Width'#2'P'#0#0#5'TEdit'#13'OutputDirEdit'#18'BorderSpacing.L'
+'eft'#2#6#17'BorderSpacing.Top'#2#6#13'OnEditingDone'#7#24'OutputDirEditEdit'
+'ingDone'#8'TabOrder'#2#2#4'Text'#6#13'OutputDirEdit'#22'AnchorSideLeft.Cont'
+'rol'#7#14'OutputDirLabel'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorS'
+'ideTop.Control'#7#13'OutputExtEdit'#18'AnchorSideTop.Side'#7#9'asrBottom'#4
+'Left'#2'a'#6'Height'#2#23#3'Top'#3'Q'#1#5'Width'#3#141#1#0#0#7'TButton'#21
,'OutputDirBrowseButton'#7'Anchors'#11#5'akTop'#6'akLeft'#8'akBottom'#0#25'Bo'
+'rderSpacing.InnerBorder'#2#4#7'Caption'#6#3'...'#7'OnClick'#7#26'OutputDirB'
+'rowseButtonClick'#8'TabOrder'#2#3#22'AnchorSideLeft.Control'#7#13'OutputDir'
+'Edit'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#13
+#4'Left'#3#255#0#6'Height'#3#179#1#5'Width'#2#5#0#0#0#9'TTabSheet'#16'PreH2P'
+'asTabSheet'#7'Caption'#6#16'PreH2PasTabSheet'#12'ClientHeight'#3#179#1#11'C'
+'lientWidth'#3#13#3#4'Left'#2#2#6'Height'#3#179#1#3'Top'#2#28#5'Width'#3#13#3
+#0#9'TGroupBox'#16'PreH2PasGroupBox'#5'Align'#7#8'alClient'#7'Caption'#6#16
+'PreH2PasGroupBox'#12'ClientHeight'#3#179#1#11'ClientWidth'#3#13#3#8'TabOrde'
+'r'#2#0#6'Height'#3#179#1#5'Width'#3#13#3#0#0#0#9'TTabSheet'#20'h2pasOptions'
+'TabSheet'#7'Caption'#6#20'h2pasOptionsTabSheet'#12'ClientHeight'#3#179#1#11
+'ClientWidth'#3#13#3#4'Left'#2#2#6'Height'#3#179#1#3'Top'#2#28#5'Width'#3#13
+#3#0#6'TLabel'#12'LibNameLabel'#17'BorderSpacing.Top'#2#10#7'Caption'#6#12'L'
+'ibNameLabel'#5'Color'#7#6'clNone'#11'ParentColor'#8#21'AnchorSideTop.Contro'
+'l'#7#11'LibnameEdit'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#6#6'He'
+'ight'#2#13#3'Top'#3#25#1#5'Width'#2'Q'#0#0#6'TLabel'#14'OutputExtLabel'#7'C'
+'aption'#6#14'OutputExtLabel'#5'Color'#7#6'clNone'#11'ParentColor'#8#21'Anch'
+'orSideTop.Control'#7#13'OutputExtEdit'#18'AnchorSideTop.Side'#7#9'asrCenter'
+#4'Left'#2#6#6'Height'#2#13#3'Top'#3'9'#1#5'Width'#2'V'#0#0#6'TLabel'#14'Out'
+'putDirLabel'#7'Caption'#6#14'OutputDirLabel'#5'Color'#7#6'clNone'#11'Parent'
+'Color'#8#21'AnchorSideTop.Control'#7#13'OutputDirEdit'#18'AnchorSideTop.Sid'
+'e'#7#9'asrCenter'#4'Left'#2#6#6'Height'#2#13#3'Top'#3'V'#1#5'Width'#2'U'#0#0
+#5'TEdit'#11'LibnameEdit'#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2
+#6#13'OnEditingDone'#7#22'LibnameEditEditingDone'#8'TabOrder'#2#0#4'Text'#6
+#11'LibnameEdit'#22'AnchorSideLeft.Control'#7#12'LibNameLabel'#19'AnchorSide'
+'Left.Side'#7#9'asrBottom'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2']'
+#6'Height'#2#23#3'Top'#3#20#1#5'Width'#2'q'#0#0#5'TEdit'#13'OutputExtEdit'#18
+'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#13'OnEditingDone'#7#24'Ou'
+'tputExtEditEditingDone'#8'TabOrder'#2#1#4'Text'#6#13'OutputExtEdit'#22'Anch'
+'orSideLeft.Control'#7#14'OutputExtLabel'#19'AnchorSideLeft.Side'#7#9'asrBot'
+'tom'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2'b'#6'Height'#2#23#3'To'
+'p'#3'4'#1#5'Width'#2'P'#0#0#5'TEdit'#13'OutputDirEdit'#18'BorderSpacing.Lef'
,'t'#2#6#17'BorderSpacing.Top'#2#6#13'OnEditingDone'#7#24'OutputDirEditEditin'
+'gDone'#8'TabOrder'#2#2#4'Text'#6#13'OutputDirEdit'#22'AnchorSideLeft.Contro'
+'l'#7#14'OutputDirLabel'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSid'
+'eTop.Control'#7#13'OutputExtEdit'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'L'
+'eft'#2'a'#6'Height'#2#23#3'Top'#3'Q'#1#5'Width'#3#141#1#0#0#7'TButton'#21'O'
+'utputDirBrowseButton'#7'Anchors'#11#5'akTop'#6'akLeft'#8'akBottom'#0#25'Bor'
+'derSpacing.InnerBorder'#2#4#7'Caption'#6#3'...'#7'OnClick'#7#26'OutputDirBr'
+'owseButtonClick'#8'TabOrder'#2#3#22'AnchorSideLeft.Control'#7#13'OutputDirE'
+'dit'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#13
+'OutputDirEdit'#24'AnchorSideBottom.Control'#7#13'OutputDirEdit'#21'AnchorSi'
+'deBottom.Side'#7#9'asrBottom'#4'Left'#3#238#1#6'Height'#2#23#3'Top'#3'Q'#1#5
+'Width'#2' '#0#0#11'TCheckGroup'#22'h2pasOptionsCheckGroup'#8'AutoFill'#9#7
@ -79,115 +84,54 @@ LazarusResources.Add('TH2PasDialog','FORMDATA',[
+'dSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cc'
+'lLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#2#7'Columns'
+#2#2#11'OnItemClick'#7#31'h2pasOptionsCheckGroupItemClick'#8'TabOrder'#2#4#4
+'Left'#2#6#6'Height'#3#8#1#3'Top'#2#4#5'Width'#3#0#3#0#0#0#9'TTabSheet'#15'C'
+'onvertTabSheet'#7'Caption'#6#15'ConvertTabSheet'#12'ClientHeight'#3#179#1#11
+'ClientWidth'#3#13#3#4'Left'#2#2#6'Height'#3#179#1#3'Top'#2#28#5'Width'#3#13
+#3#0#7'TButton'#13'ConvertButton'#8'AutoSize'#9#25'BorderSpacing.InnerBorder'
+#2#4#7'Caption'#6#13'ConvertButton'#7'OnClick'#7#18'ConvertButtonClick'#8'Ta'
+'bOrder'#2#0#4'Left'#2#6#6'Height'#2#26#3'Top'#3#140#1#5'Width'#2']'#0#0#9'T'
+'GroupBox'#20'ConvertErrorGroupBox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRig'
+'ht'#0#7'Caption'#6#20'ConvertErrorGroupBox'#12'ClientHeight'#3#130#0#11'Cli'
+'entWidth'#3#252#2#8'TabOrder'#2#1#21'AnchorSideTop.Control'#7#21'ConvertUpD'
+'ownSplitter'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#3
+#147#0#3'Top'#3#217#0#5'Width'#3#0#3#0#8'TSynEdit'#19'ConvertErrorSynEdit'#5
+'Align'#7#8'alClient'#11'Font.Height'#2#244#9'Font.Name'#6#7'courier'#6'Heig'
+'ht'#3#130#0#4'Name'#6#19'ConvertErrorSynEdit'#11'ParentColor'#8#8'TabOrder'
+#2#0#5'Width'#3#252#2#23'BookMarkOptions.Xoffset'#2#30#22'Gutter.ShowLineNum'
+'bers'#9#23'Gutter.CodeFoldingWidth'#2#14#11'Highlighter'#7#10'SynCppSyn1'#10
+'Keystrokes'#14#1#7'Command'#2#3#8'ShortCut'#2'&'#0#1#7'Command'#2'g'#8'Shor'
+'tCut'#3'& '#0#1#7'Command'#3#211#0#8'ShortCut'#3'&@'#0#1#7'Command'#2#4#8'S'
+'hortCut'#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'S'
+'hortCut'#3'% '#0#1#7'Command'#2#5#8'ShortCut'#3'%@'#0#1#7'Command'#2'i'#8'S'
+'hortCut'#3'%`'#0#1#7'Command'#2#2#8'ShortCut'#2''''#0#1#7'Command'#2'f'#8'S'
+'hortCut'#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'S'
+'hortCut'#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'S'
+'hortCut'#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'S'
+'hortCut'#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'Comman'
+'d'#3#245#1#8'ShortCut'#2#8#0#1#7'Command'#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'ShortCut'#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'Command'#3'b'#2#8'ShortCut'#3'I`'#0#1#7'Comma'
+'nd'#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'ShortCut'#3'Y@'#0#1#7'Command'#3#250#1#8'ShortC'
+'ut'#3'Y`'#0#1#7'Command'#3'Y'#2#8'ShortCut'#3'Z@'#0#1#7'Command'#3'Z'#2#8'S'
+'hortCut'#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'Comman'
+'d'#3'2'#1#8'ShortCut'#3'5@'#0#1#7'Command'#3'3'#1#8'ShortCut'#3'6@'#0#1#7'C'
+'ommand'#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'ShortCut'#3'3`'#0#1#7'Command'#3'c'#1#8'ShortCu'
+'t'#3'4`'#0#1#7'Command'#3'd'#1#8'ShortCut'#3'5`'#0#1#7'Command'#3'e'#1#8'Sh'
+'ortCut'#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'Command'#3#232#0#8'ShortCut'#3'C`'#0#1#7'Comm'
+'and'#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#19'ConvertErrorSynEdit'#0#7'Options'#11#12'eoAuto'
+'Indent'#17'eoDragDropEditing'#11'eoGroupUndo'#16'eoShowScrollHint'#18'eoSho'
+'wSpecialChars'#16'eoSmartTabDelete'#11'eoSmartTabs'#14'eoTabsToSpaces'#20'e'
+'oTrimTrailingSpaces'#18'eoBracketHighlight'#0#8'ReadOnly'#9#6'Cursor'#7#7'c'
+'rIBeam'#6'Height'#3#130#0#5'Width'#3#252#2#0#0#0#9'TSplitter'#21'ConvertUpD'
+'ownSplitter'#5'Align'#7#6'alNone'#7'Beveled'#9#6'Cursor'#7#8'crVSplit'#6'He'
+'ight'#2#5#5'Width'#3#13#3#12'ResizeAnchor'#7#8'akBottom'#6'Cursor'#7#8'crVS'
+'plit'#4'Left'#2#246#6'Height'#2#5#3'Top'#3#212#0#5'Width'#3#13#3#0#0#0#9'TT'
+'abSheet'#16'SettingsTabSheet'#7'Caption'#6#16'SettingsTabSheet'#12'ClientHe'
+'ight'#3#179#1#11'ClientWidth'#3#13#3#4'Left'#2#2#6'Height'#3#179#1#3'Top'#2
+#28#5'Width'#3#13#3#0#6'TLabel'#18'H2PasFilenameLabel'#7'Caption'#6#18'H2Pas'
+'FilenameLabel'#5'Color'#7#6'clNone'#11'ParentColor'#8#21'AnchorSideTop.Cont'
+'rol'#7#17'H2PasFilenameEdit'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2
+#6#6'Height'#2#13#3'Top'#2#9#5'Width'#2'x'#0#0#9'TCheckBox'#30'OpenLastProje'
+'ctOnStartCheckBox'#7'Caption'#6#30'OpenLastProjectOnStartCheckBox'#8'OnChan'
+'ge'#7'$OpenLastProjectOnStartCheckBoxChange'#8'TabOrder'#2#0#4'Left'#2#6#6
+'Height'#2#20#3'Top'#2'*'#5'Width'#3#216#0#0#0#7'TButton'#20'SaveSettingsAsB'
+'utton'#8'AutoSize'#9#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#20'Save'
+'SettingsAsButton'#7'OnClick'#7#25'SaveSettingsAsButtonClick'#8'TabOrder'#2#1
+#4'Left'#2#6#6'Height'#2#26#3'Top'#2'R'#5'Width'#3#137#0#0#0#5'TEdit'#17'H2P'
+'asFilenameEdit'#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#13'OnE'
+'ditingDone'#7#28'H2PasFilenameEditEditingDone'#8'TabOrder'#2#2#4'Text'#6#17
+'H2PasFilenameEdit'#22'AnchorSideLeft.Control'#7#18'H2PasFilenameLabel'#19'A'
+'nchorSideLeft.Side'#7#9'asrBottom'#4'Left'#3#132#0#6'Height'#2#23#3'Top'#2#4
+#5'Width'#3'`'#1#0#0#7'TButton'#25'h2pasFilenameBrowseButton'#7'Anchors'#11#5
+'akTop'#6'akLeft'#8'akBottom'#0#25'BorderSpacing.InnerBorder'#2#4#7'Caption'
+#6#3'...'#7'OnClick'#7#30'h2pasFilenameBrowseButtonClick'#8'TabOrder'#2#3#22
+'AnchorSideLeft.Control'#7#17'H2PasFilenameEdit'#19'AnchorSideLeft.Side'#7#9
+'asrBottom'#21'AnchorSideTop.Control'#7#17'H2PasFilenameEdit'#24'AnchorSideB'
+'ottom.Control'#7#17'H2PasFilenameEdit'#21'AnchorSideBottom.Side'#7#9'asrBot'
+'tom'#4'Left'#3#228#1#6'Height'#2#23#3'Top'#2#4#5'Width'#2'#'#0#0#7'TButton'
+#17'NewSettingsButton'#8'AutoSize'#9#25'BorderSpacing.InnerBorder'#2#4#7'Cap'
+'tion'#6#17'NewSettingsButton'#7'OnClick'#7#22'NewSettingsButtonClick'#8'Tab'
+'Order'#2#4#4'Left'#2#6#6'Height'#2#26#3'Top'#2'|'#5'Width'#2'v'#0#0#0#0#7'T'
+'Button'#18'OpenSettingsButton'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#8'Auto'
+'Size'#9#20'BorderSpacing.Around'#2#5#25'BorderSpacing.InnerBorder'#2#4#7'Ca'
+'ption'#6#18'OpenSettingsButton'#7'OnClick'#7#23'OpenSettingsButtonClick'#8
+'TabOrder'#2#1#22'AnchorSideLeft.Control'#7#5'Owner'#24'AnchorSideBottom.Con'
+'trol'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2#5#6'Hei'
+'ght'#2#26#3'Top'#3#214#1#5'Width'#2'|'#0#0#7'TButton'#18'SaveSettingsButton'
+#7'Anchors'#11#6'akLeft'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'
+#2#5#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#18'SaveSettingsButton'#7
+'OnClick'#7#23'SaveSettingsButtonClick'#8'TabOrder'#2#2#22'AnchorSideLeft.Co'
+'ntrol'#7#18'OpenSettingsButton'#19'AnchorSideLeft.Side'#7#9'asrBottom'#24'A'
+'nchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'
+#4'Left'#3#134#0#6'Height'#2#26#3'Top'#3#214#1#5'Width'#2'z'#0#0#7'TButton'
+#11'CloseButton'#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#20'Bor'
+'derSpacing.Around'#2#5#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#11'Cl'
+'oseButton'#7'OnClick'#7#16'CloseButtonClick'#8'TabOrder'#2#3#23'AnchorSideR'
+'ight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorS'
+'ideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Le'
+'ft'#3#187#2#6'Height'#2#26#3'Top'#3#214#1#5'Width'#2'Q'#0#0#10'TSynCppSyn'
+#10'SynCppSyn1'#13'DefaultFilter'#6'BC++-Quelltexte (*.c,*.cpp,*.h,*.hpp,*.h'
+'h)|*.c;*.cpp;*.h;*.hpp;*.hh'#7'Enabled'#8#4'left'#3'8'#1#3'top'#2'P'#0#0#0
+'Left'#2#6#6'Height'#3#8#1#3'Top'#2#4#5'Width'#3#0#3#0#0#0#9'TTabSheet'#16'S'
+'ettingsTabSheet'#7'Caption'#6#16'SettingsTabSheet'#12'ClientHeight'#3#179#1
+#11'ClientWidth'#3#13#3#4'Left'#2#2#6'Height'#3#179#1#3'Top'#2#28#5'Width'#3
+#13#3#0#6'TLabel'#18'H2PasFilenameLabel'#7'Caption'#6#18'H2PasFilenameLabel'
+#5'Color'#7#6'clNone'#11'ParentColor'#8#21'AnchorSideTop.Control'#7#17'H2Pas'
+'FilenameEdit'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#6#6'Height'#2
+#13#3'Top'#2#9#5'Width'#2'x'#0#0#9'TCheckBox'#30'OpenLastProjectOnStartCheck'
+'Box'#7'Caption'#6#30'OpenLastProjectOnStartCheckBox'#8'OnChange'#7'$OpenLas'
+'tProjectOnStartCheckBoxChange'#8'TabOrder'#2#0#4'Left'#2#6#6'Height'#2#20#3
+'Top'#2'*'#5'Width'#3#216#0#0#0#7'TButton'#20'SaveSettingsAsButton'#8'AutoSi'
+'ze'#9#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#20'SaveSettingsAsButto'
+'n'#7'OnClick'#7#25'SaveSettingsAsButtonClick'#8'TabOrder'#2#1#4'Left'#2#6#6
+'Height'#2#26#3'Top'#2'R'#5'Width'#3#137#0#0#0#5'TEdit'#17'H2PasFilenameEdit'
+#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#13'OnEditingDone'#7#28
+'H2PasFilenameEditEditingDone'#8'TabOrder'#2#2#4'Text'#6#17'H2PasFilenameEdi'
+'t'#22'AnchorSideLeft.Control'#7#18'H2PasFilenameLabel'#19'AnchorSideLeft.Si'
+'de'#7#9'asrBottom'#4'Left'#3#132#0#6'Height'#2#23#3'Top'#2#4#5'Width'#3'`'#1
+#0#0#7'TButton'#25'h2pasFilenameBrowseButton'#7'Anchors'#11#5'akTop'#6'akLef'
+'t'#8'akBottom'#0#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#3'...'#7'On'
+'Click'#7#30'h2pasFilenameBrowseButtonClick'#8'TabOrder'#2#3#22'AnchorSideLe'
+'ft.Control'#7#17'H2PasFilenameEdit'#19'AnchorSideLeft.Side'#7#9'asrBottom'
+#21'AnchorSideTop.Control'#7#17'H2PasFilenameEdit'#24'AnchorSideBottom.Contr'
+'ol'#7#17'H2PasFilenameEdit'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'
+#3#228#1#6'Height'#2#23#3'Top'#2#4#5'Width'#2'#'#0#0#7'TButton'#17'NewSettin'
+'gsButton'#8'AutoSize'#9#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#17'N'
+'ewSettingsButton'#7'OnClick'#7#22'NewSettingsButtonClick'#8'TabOrder'#2#4#4
+'Left'#2#6#6'Height'#2#26#3'Top'#2'|'#5'Width'#2'v'#0#0#0#0#7'TButton'#18'Op'
+'enSettingsButton'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#8'AutoSize'#9#20'Bo'
+'rderSpacing.Around'#2#5#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#18'O'
+'penSettingsButton'#7'OnClick'#7#23'OpenSettingsButtonClick'#8'TabOrder'#2#1
+#22'AnchorSideLeft.Control'#7#5'Owner'#24'AnchorSideBottom.Control'#7#5'Owne'
+'r'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2#5#6'Height'#2#26#3'To'
+'p'#3#214#1#5'Width'#2'|'#0#0#7'TButton'#18'SaveSettingsButton'#7'Anchors'#11
+#6'akLeft'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#5#25'Borde'
+'rSpacing.InnerBorder'#2#4#7'Caption'#6#18'SaveSettingsButton'#7'OnClick'#7
+#23'SaveSettingsButtonClick'#8'TabOrder'#2#2#22'AnchorSideLeft.Control'#7#18
+'OpenSettingsButton'#19'AnchorSideLeft.Side'#7#9'asrBottom'#24'AnchorSideBot'
+'tom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3
+#134#0#6'Height'#2#26#3'Top'#3#214#1#5'Width'#2'z'#0#0#7'TButton'#13'Convert'
+'Button'#8'AutoSize'#9#18'BorderSpacing.Left'#2#15#25'BorderSpacing.InnerBor'
+'der'#2#4#7'Caption'#6#13'ConvertButton'#7'OnClick'#7#18'ConvertButtonClick'
+#8'TabOrder'#2#0#22'AnchorSideLeft.Control'#7#18'SaveSettingsButton'#19'Anch'
+'orSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#18'SaveSettings'
+'Button'#4'Left'#3#15#1#6'Height'#2#26#3'Top'#3#214#1#5'Width'#2']'#0#0#7'TB'
+'utton'#11'CloseButton'#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9
,#20'BorderSpacing.Around'#2#5#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6
+#11'CloseButton'#7'OnClick'#7#16'CloseButtonClick'#8'TabOrder'#2#3#23'Anchor'
+'SideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'An'
+'chorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'
+#4'Left'#3#187#2#6'Height'#2#26#3'Top'#3#214#1#5'Width'#2'Q'#0#0#0
]);

View File

@ -28,8 +28,7 @@ uses
SynEdit, SynHighlighterCPP,
FileProcs,
IDEMsgIntf, MenuIntf, IDECommands, BaseIDEIntf, IDEDialogs, LazIDEIntf,
SrcEditorIntf,
CodeToolManager, CodeCache,
CodeToolManager, SrcEditorIntf, IDETextConverter,
H2PasStrConsts, H2PasConvert, IDETextConvListEdit;
type
@ -38,8 +37,6 @@ type
TH2PasDialog = class(TForm)
MainPageControl: TPageControl;
ConvertUpDownSplitter: TSplitter;
SynCppSyn1: TSynCppSyn;
// c header files
FilesTabSheet: TTabSheet;
@ -50,6 +47,11 @@ type
DeleteCHeaderFilesButton: TButton;
CHeaderFilesCheckListBox: TCheckListBox;
// pre h2pas
PreH2PasTabSheet: TTabSheet;
PreH2PasGroupBox: TGroupBox;
PreH2PasEdit: TTextConvListEditor;
// h2pas
h2pasOptionsTabSheet: TTabSheet;
h2pasOptionsCheckGroup: TCheckGroup;
@ -61,13 +63,6 @@ type
OutputDirLabel: TLabel;
OutputDirBrowseButton: TButton;
// convert
PreH2PasEdit: TTextConvListEditor;
ConvertTabSheet: TTabSheet;
ConvertButton: TButton;
ConvertErrorGroupBox: TGroupBox;
ConvertErrorSynEdit: TSynEdit;
// settings
SettingsTabSheet: TTabSheet;
h2pasFilenameBrowseButton: TButton;
@ -80,6 +75,7 @@ type
// buttons at bottom
OpenSettingsButton: TButton;
SaveSettingsButton: TButton;
ConvertButton: TButton;
CloseButton: TButton;
procedure AddCHeaderFilesButtonClick(Sender: TObject);
@ -108,15 +104,20 @@ type
procedure UnselectAllCHeaderFilesButtonClick(Sender: TObject);
procedure h2pasFilenameBrowseButtonClick(Sender: TObject);
procedure h2pasOptionsCheckGroupItemClick(Sender: TObject; Index: LongInt);
procedure OnShowSrcEditSection(Sender: TObject);
procedure OnAddSearchAndReplaceBeforeH2PasClick(Sender: TObject);
private
FConverter: TH2PasConverter;
FSrcEditAddSearchReplaceMenuItem: TIDEMenuCommand;
FSrcEditSection: TIDEMenuSection;
function GetProject: TH2PasProject;
procedure UpdateAll;
procedure UpdateProjectChanged; // show project settings
procedure UpdateCaption;
procedure ClearMessages;
procedure UpdateHighlighter;
procedure CreateLazarusMenuItems;
// project settings
procedure UpdateFilesPage;
@ -134,7 +135,6 @@ type
public
function Convert: TModalResult;
procedure ShowH2PasError(MsgLine: integer);
procedure ClearError;
function SaveSettings: TModalResult;
function SaveGlobalSettings: TModalResult;
@ -143,6 +143,9 @@ type
function OpenProject(const Filename: string; Flags: TOpenFlags): TModalResult;
property Converter: TH2PasConverter read FConverter;
property Project: TH2PasProject read GetProject;
property SrcEditSection: TIDEMenuSection read FSrcEditSection;
property SrcEditAddSearchReplaceMenuItem: TIDEMenuCommand
read FSrcEditAddSearchReplaceMenuItem;
end;
var
@ -160,7 +163,7 @@ procedure ExecuteH2PasTool(Sender: TObject);
begin
if H2PasDialog=nil then
H2PasDialog:=TH2PasDialog.Create(Application);
H2PasDialog.Show;
H2PasDialog.ShowOnTop;
end;
procedure Register;
@ -209,8 +212,8 @@ begin
OutputExtLabel.Caption:='Output extension of new file';
OutputDirLabel.Caption:='Output directory';
LibNameLabel.Caption:='-l Library name';
ConvertTabSheet.Caption:='Convert';
ConvertButton.Caption:='Run converter and h2pas';
PreH2PasTabSheet.Caption:='Before h2pas';
PreH2PasGroupBox.Caption:='Conversions before running h2pas';
SettingsTabSheet.Caption:='Settings';
H2PasFilenameLabel.Caption:='h2pas program path';
OpenLastProjectOnStartCheckBox.Caption:='Open last settings on start';
@ -218,26 +221,25 @@ begin
NewSettingsButton.Caption:='New/Clear settings';
OpenSettingsButton.Caption:='&Open Settings';
SaveSettingsButton.Caption:='&Save Settings';
ConvertButton.Caption:='Run converter and h2pas';
CloseButton.Caption:='&Close';
PreH2PasEdit:=TTextConvListEditor.Create(Self);
with PreH2PasEdit do begin
Name:='PreH2PasEdit';
Align:=alTop;
AnchorToNeighbour(akBottom,0,ConvertUpDownSplitter);
Align:=alClient;
OnModified:=@PreH2PasEditModified;
Parent:=ConvertTabSheet;
Parent:=PreH2PasGroupBox;
Visible:=true;// Note: it's a form, and visible default is false
end;
LazarusIDE.AddHandlerOnSavedAll(@OnIDESavedAll);
CreateLazarusMenuItems;
// create converter
FConverter:=TH2PasConverter.Create;
LoadGlobalSettings;
ClearError;
UpdateHighlighter;
// create project
if Converter.AutoOpenLastProject
and FileExists(Converter.CurrentProjectFilename) then
@ -345,6 +347,7 @@ end;
procedure TH2PasDialog.FormDestroy(Sender: TObject);
begin
FreeAndNil(fSrcEditSection);
PreH2PasEdit.ListOfTools:=nil;
FreeAndNil(FConverter);
end;
@ -504,6 +507,40 @@ begin
end;
end;
procedure TH2PasDialog.OnShowSrcEditSection(Sender: TObject);
var
SrcEdit: TSourceEditorInterface;
begin
SrcEdit:=SourceEditorWindow.ActiveEditor;
SrcEditSection.Visible:=(SrcEdit<>nil)
and Converter.FileIsRelated(SrcEdit.FileName);
//DebugLn(['TH2PasDialog.OnShowSrcEditSection ',SrcEditSection.Visible]);
end;
procedure TH2PasDialog.OnAddSearchAndReplaceBeforeH2PasClick(Sender: TObject);
var
Tool: TCustomTextConverterTool;
SrcEdit: TSourceEditorInterface;
s: String;
begin
//DebugLn(['TH2PasDialog.OnAddSearchAndReplaceBeforeH2PasClick']);
SrcEdit:=SourceEditorWindow.ActiveEditor;
if SrcEdit=nil then exit;
MainPageControl.ActivePage:=PreH2PasTabSheet;
ShowOnTop;
// get current source editor selection or line
s:=SrcEdit.Selection;
if s='' then
s:=SrcEdit.CurrentLineText;
// add a search and replace tool
Tool:=PreH2PasEdit.CreateTool(TTextReplaceTool);
TTextReplaceTool(Tool).SearchFor:=s;
if (System.Pos(#10,s)>0) or (System.Pos(#13,s)>0) then
TTextReplaceTool(Tool).Options:=TTextReplaceTool(Tool).Options+[trtMultiLine];
PreH2PasEdit.PropertyGrid.RefreshPropertyValues;
//DebugLn(['TH2PasDialog.OnAddSearchAndReplaceBeforeH2PasClick ',s]);
end;
function TH2PasDialog.GetProject: TH2PasProject;
begin
Result:=Converter.Project;
@ -541,11 +578,18 @@ begin
IDEMessagesWindow.Clear;
end;
procedure TH2PasDialog.UpdateHighlighter;
procedure TH2PasDialog.CreateLazarusMenuItems;
begin
SourceEditorWindow.GetHighlighterSettings(SynCppSyn1);
SourceEditorWindow.GetEditorControlSettings(ConvertErrorSynEdit);
ConvertErrorSynEdit.Gutter.ShowLineNumbers:=true;
// add a context menu to the source editor
fSrcEditSection:=RegisterIDESubMenu(SrcEditMenuSectionFirstStatic,
'h2pas project','h2pas',nil,nil);
fSrcEditSection.AddHandlerOnShow(@OnShowSrcEditSection);
// add a menu item to easily create a Search and replace from the current
// selection or line of the source editor.
fSrcEditAddSearchReplaceMenuItem:=RegisterIDEMenuCommand(SrcEditSection,
'Add "search and replace" tool before h2pas',
'Add "search and replace" tool before h2pas',
@OnAddSearchAndReplaceBeforeH2PasClick);
end;
procedure TH2PasDialog.UpdateFilesPage;
@ -687,8 +731,7 @@ end;
function TH2PasDialog.Convert: TModalResult;
begin
Result:=mrCancel;
ClearError;
if not Project.HasEnabledFiles then begin
IDEMessageDialog('Nothing to do',
'No c header file is enabled, so nothing to do.',
@ -717,56 +760,14 @@ begin
end;
procedure TH2PasDialog.ShowH2PasError(MsgLine: integer);
var
Line: TIDEMessageLine;
LineNumber: integer;
Column: integer;
CodeBuf: TCodeBuffer;
NewPos: TPoint;
Filename: string;
s: String;
begin
if MsgLine<0 then
MsgLine:=Converter.FindH2PasErrorMessage;
if (MsgLine<0) or (MsgLine>=IDEMessagesWindow.LinesCount) then begin
ClearError;
exit;
end;
Line:=IDEMessagesWindow.Lines[MsgLine];
if not Converter.GetH2PasErrorPostion(Line.Msg,Filename,LineNumber,Column)
then exit;
DebugLn(['TH2PasDialog.ShowH2PasError LineNumber=',LineNumber,' Column=',Column,' Filename=',Filename]);
// open error position in synedit
CodeBuf:=CodeToolBoss.LoadFile(Filename,false,false);
if CodeBuf=nil then exit;
ConvertErrorSynEdit.BeginUpdate;
CodeBuf.AssignTo(ConvertErrorSynEdit.Lines,false);
NewPos:=Point(Column,LineNumber);
if NewPos.Y<1 then NewPos.Y:=1;
if NewPos.X<1 then NewPos.X:=1;
ConvertErrorSynEdit.LogicalCaretXY:=NewPos;
ConvertErrorSynEdit.TopLine:=NewPos.Y-3;
ConvertErrorSynEdit.EndUpdate;
// show error position in groupbox
s:='Error: ';
if LineNumber>=1 then
s:=s+IntToStr(LineNumber);
if Column>=1 then begin
if LineNumber>=1 then
s:=s+',';
s:=s+IntToStr(Column);
end;
s:=s+' '+Filename;
ConvertErrorGroupBox.Caption:=s;
end;
procedure TH2PasDialog.ClearError;
begin
ConvertErrorSynEdit.Lines.Clear;
ConvertErrorGroupBox.Caption:='No error';
LazarusIDE.DoJumpToCompilerMessage(MsgLine,true);
end;
function TH2PasDialog.SaveSettings: TModalResult;

View File

@ -1,16 +1,16 @@
object TextConvListEditor: TTextConvListEditor
ActiveControl = ToolsListBox
Caption = 'TextConvListEditor'
ClientHeight = 316
ClientHeight = 227
ClientWidth = 519
Constraints.MinHeight = 200
Constraints.MinWidth = 400
OnCreate = FormCreate
PixelsPerInch = 75
HorzScrollBar.Page = 518
VertScrollBar.Page = 315
VertScrollBar.Page = 226
Left = 290
Height = 316
Height = 227
Top = 202
Width = 519
object ToolsLabel: TLabel
@ -31,11 +31,10 @@ object TextConvListEditor: TTextConvListEditor
AnchorSideTop.Control = ToolsLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ToolsSplitter
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = UpDownSplitter
Height = 120
Top = 24
Width = 236
Width = 232
end
object UpDownSplitter: TSplitter
Align = alNone
@ -55,7 +54,10 @@ object TextConvListEditor: TTextConvListEditor
object ToolsPanel: TPanel
Anchors = [akTop, akLeft, akRight, akBottom]
BevelOuter = bvNone
Caption = 'ToolsPanel'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 6
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 144
@ -74,7 +76,9 @@ object TextConvListEditor: TTextConvListEditor
Caption = 'AddToolButton'
OnClick = AddToolButtonClick
TabOrder = 0
Left = 6
Height = 26
Top = 6
Width = 120
end
object DeleteToolButton: TButton
@ -82,8 +86,9 @@ object TextConvListEditor: TTextConvListEditor
Caption = 'DeleteToolButton'
OnClick = DeleteToolButtonClick
TabOrder = 1
Left = 120
Left = 132
Height = 26
Top = 6
Width = 137
end
object MoveToolUpButton: TButton
@ -91,8 +96,9 @@ object TextConvListEditor: TTextConvListEditor
Caption = 'MoveToolUpButton'
OnClick = MoveToolUpButtonClick
TabOrder = 2
Left = 6
Height = 26
Top = 26
Top = 38
Width = 120
end
object MoveToolDownButton: TButton
@ -100,9 +106,9 @@ object TextConvListEditor: TTextConvListEditor
Caption = 'MoveToolDownButton'
OnClick = MoveToolDownButtonClick
TabOrder = 3
Left = 120
Left = 132
Height = 26
Top = 26
Top = 38
Width = 137
end
object CopyToolButton: TButton
@ -110,8 +116,9 @@ object TextConvListEditor: TTextConvListEditor
Caption = 'CopyToolButton'
OnClick = CopyToolButtonClick
TabOrder = 4
Left = 6
Height = 26
Top = 52
Top = 70
Width = 120
end
object PasteButton: TButton
@ -119,9 +126,9 @@ object TextConvListEditor: TTextConvListEditor
Caption = 'PasteButton'
OnClick = PasteButtonClick
TabOrder = 5
Left = 120
Left = 132
Height = 26
Top = 52
Top = 70
Width = 137
end
object CloneButton: TButton
@ -129,8 +136,9 @@ object TextConvListEditor: TTextConvListEditor
Caption = 'CloneButton'
OnClick = CloneButtonClick
TabOrder = 6
Left = 6
Height = 26
Top = 78
Top = 102
Width = 120
end
end

View File

@ -2,53 +2,55 @@
LazarusResources.Add('TTextConvListEditor','FORMDATA',[
'TPF0'#19'TTextConvListEditor'#18'TextConvListEditor'#13'ActiveControl'#7#12
+'ToolsListBox'#7'Caption'#6#18'TextConvListEditor'#12'ClientHeight'#3'<'#1#11
+'ClientWidth'#3#7#2#21'Constraints.MinHeight'#3#200#0#20'Constraints.MinWidt'
+'h'#3#144#1#8'OnCreate'#7#10'FormCreate'#13'PixelsPerInch'#2'K'#18'HorzScrol'
+'lBar.Page'#3#6#2#18'VertScrollBar.Page'#3';'#1#4'Left'#3'"'#1#6'Height'#3'<'
+#1#3'Top'#3#202#0#5'Width'#3#7#2#0#6'TLabel'#10'ToolsLabel'#7'Caption'#6#10
+'ToolsLabel'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#12#6'Height'#2
+#13#3'Top'#2#9#5'Width'#2'>'#0#0#8'TListBox'#12'ToolsListBox'#7'Anchors'#11#5
+'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#17'BorderSpacing.Top'#2#2#17'OnSe'
+'lectionChange'#7#27'ToolsListBoxSelectionChange'#8'TabOrder'#2#0#8'TopIndex'
+#2#255#21'AnchorSideTop.Control'#7#10'ToolsLabel'#18'AnchorSideTop.Side'#7#9
+'asrBottom'#23'AnchorSideRight.Control'#7#13'ToolsSplitter'#20'AnchorSideRig'
+'ht.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#14'UpDownSplitter'#6
+'Height'#2'x'#3'Top'#2#24#5'Width'#3#236#0#0#0#9'TSplitter'#14'UpDownSplitte'
+'r'#5'Align'#7#6'alNone'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Bev'
+'eled'#9#6'Cursor'#7#8'crVSplit'#6'Height'#2#5#5'Width'#3#7#2#12'ResizeAncho'
+'r'#7#8'akBottom'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.'
+'Side'#7#9'asrBottom'#6'Cursor'#7#8'crVSplit'#6'Height'#2#5#3'Top'#3#144#0#5
+'Width'#3#7#2#0#0#6'TPanel'#10'ToolsPanel'#7'Anchors'#11#5'akTop'#6'akLeft'#7
+'akRight'#8'akBottom'#0#10'BevelOuter'#7#6'bvNone'#7'Caption'#6#10'ToolsPane'
+'l'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizin'
+'g.ControlsPerLine'#2#2#12'ClientHeight'#3#144#0#11'ClientWidth'#3#27#1#8'Ta'
+'bOrder'#2#1#22'AnchorSideLeft.Control'#7#13'ToolsSplitter'#19'AnchorSideLef'
+'t.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSide'
+'Right.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#14'UpDownSplitter'
+#4'Left'#3#236#0#6'Height'#3#144#0#5'Width'#3#27#1#0#7'TButton'#13'AddToolBu'
+'tton'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#13'AddToolButton'#7'On'
+'Click'#7#18'AddToolButtonClick'#8'TabOrder'#2#0#6'Height'#2#26#5'Width'#2'x'
+#0#0#7'TButton'#16'DeleteToolButton'#25'BorderSpacing.InnerBorder'#2#4#7'Cap'
+'tion'#6#16'DeleteToolButton'#7'OnClick'#7#21'DeleteToolButtonClick'#8'TabOr'
+'der'#2#1#4'Left'#2'x'#6'Height'#2#26#5'Width'#3#137#0#0#0#7'TButton'#16'Mov'
+'eToolUpButton'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#16'MoveToolUp'
+'Button'#7'OnClick'#7#21'MoveToolUpButtonClick'#8'TabOrder'#2#2#6'Height'#2
+#26#3'Top'#2#26#5'Width'#2'x'#0#0#7'TButton'#18'MoveToolDownButton'#25'Borde'
+'rSpacing.InnerBorder'#2#4#7'Caption'#6#18'MoveToolDownButton'#7'OnClick'#7
+#23'MoveToolDownButtonClick'#8'TabOrder'#2#3#4'Left'#2'x'#6'Height'#2#26#3'T'
+'op'#2#26#5'Width'#3#137#0#0#0#7'TButton'#14'CopyToolButton'#25'BorderSpacin'
+'g.InnerBorder'#2#4#7'Caption'#6#14'CopyToolButton'#7'OnClick'#7#19'CopyTool'
+'ButtonClick'#8'TabOrder'#2#4#6'Height'#2#26#3'Top'#2'4'#5'Width'#2'x'#0#0#7
+'ToolsListBox'#7'Caption'#6#18'TextConvListEditor'#12'ClientHeight'#3#227#0
+#11'ClientWidth'#3#7#2#21'Constraints.MinHeight'#3#200#0#20'Constraints.MinW'
+'idth'#3#144#1#8'OnCreate'#7#10'FormCreate'#13'PixelsPerInch'#2'K'#18'HorzSc'
+'rollBar.Page'#3#6#2#18'VertScrollBar.Page'#3#226#0#4'Left'#3'"'#1#6'Height'
+#3#227#0#3'Top'#3#202#0#5'Width'#3#7#2#0#6'TLabel'#10'ToolsLabel'#7'Caption'
+#6#10'ToolsLabel'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#12#6'Heig'
+'ht'#2#13#3'Top'#2#9#5'Width'#2'>'#0#0#8'TListBox'#12'ToolsListBox'#7'Anchor'
+'s'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#17'BorderSpacing.Top'#2#2
+#17'OnSelectionChange'#7#27'ToolsListBoxSelectionChange'#8'TabOrder'#2#0#8'T'
+'opIndex'#2#255#21'AnchorSideTop.Control'#7#10'ToolsLabel'#18'AnchorSideTop.'
+'Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#13'ToolsSplitter'#24'Anc'
+'horSideBottom.Control'#7#14'UpDownSplitter'#6'Height'#2'x'#3'Top'#2#24#5'Wi'
+'dth'#3#232#0#0#0#9'TSplitter'#14'UpDownSplitter'#5'Align'#7#6'alNone'#7'Anc'
+'hors'#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Beveled'#9#6'Cursor'#7#8'crVSpli'
+'t'#6'Height'#2#5#5'Width'#3#7#2#12'ResizeAnchor'#7#8'akBottom'#23'AnchorSid'
+'eRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#6'Cursor'
+#7#8'crVSplit'#6'Height'#2#5#3'Top'#3#144#0#5'Width'#3#7#2#0#0#6'TPanel'#10
+'ToolsPanel'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#10'Be'
+'velOuter'#7#6'bvNone'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.T'
+'opBottomSpacing'#2#6#29'ChildSizing.HorizontalSpacing'#2#6#27'ChildSizing.V'
+'erticalSpacing'#2#6#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBott'
+'om'#27'ChildSizing.ControlsPerLine'#2#2#12'ClientHeight'#3#144#0#11'ClientW'
+'idth'#3#27#1#8'TabOrder'#2#1#22'AnchorSideLeft.Control'#7#13'ToolsSplitter'
+#19'AnchorSideLeft.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#5'Owne'
+'r'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#14
+'UpDownSplitter'#4'Left'#3#236#0#6'Height'#3#144#0#5'Width'#3#27#1#0#7'TButt'
+'on'#13'AddToolButton'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#13'Add'
+'ToolButton'#7'OnClick'#7#18'AddToolButtonClick'#8'TabOrder'#2#0#4'Left'#2#6
+#6'Height'#2#26#3'Top'#2#6#5'Width'#2'x'#0#0#7'TButton'#16'DeleteToolButton'
+#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#16'DeleteToolButton'#7'OnCli'
+'ck'#7#21'DeleteToolButtonClick'#8'TabOrder'#2#1#4'Left'#3#132#0#6'Height'#2
+#26#3'Top'#2#6#5'Width'#3#137#0#0#0#7'TButton'#16'MoveToolUpButton'#25'Borde'
+'rSpacing.InnerBorder'#2#4#7'Caption'#6#16'MoveToolUpButton'#7'OnClick'#7#21
+'MoveToolUpButtonClick'#8'TabOrder'#2#2#4'Left'#2#6#6'Height'#2#26#3'Top'#2
+'&'#5'Width'#2'x'#0#0#7'TButton'#18'MoveToolDownButton'#25'BorderSpacing.Inn'
+'erBorder'#2#4#7'Caption'#6#18'MoveToolDownButton'#7'OnClick'#7#23'MoveToolD'
+'ownButtonClick'#8'TabOrder'#2#3#4'Left'#3#132#0#6'Height'#2#26#3'Top'#2'&'#5
+'Width'#3#137#0#0#0#7'TButton'#14'CopyToolButton'#25'BorderSpacing.InnerBord'
+'er'#2#4#7'Caption'#6#14'CopyToolButton'#7'OnClick'#7#19'CopyToolButtonClick'
+#8'TabOrder'#2#4#4'Left'#2#6#6'Height'#2#26#3'Top'#2'F'#5'Width'#2'x'#0#0#7
+'TButton'#11'PasteButton'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#11
+'PasteButton'#7'OnClick'#7#16'PasteButtonClick'#8'TabOrder'#2#5#4'Left'#2'x'
+#6'Height'#2#26#3'Top'#2'4'#5'Width'#3#137#0#0#0#7'TButton'#11'CloneButton'
+'PasteButton'#7'OnClick'#7#16'PasteButtonClick'#8'TabOrder'#2#5#4'Left'#3#132
+#0#6'Height'#2#26#3'Top'#2'F'#5'Width'#3#137#0#0#0#7'TButton'#11'CloneButton'
+#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#11'CloneButton'#7'OnClick'#7
+#16'CloneButtonClick'#8'TabOrder'#2#6#6'Height'#2#26#3'Top'#2'N'#5'Width'#2
+'x'#0#0#0#9'TSplitter'#13'ToolsSplitter'#5'Align'#7#6'alNone'#7'Anchors'#11#5
+'akTop'#6'akLeft'#8'akBottom'#0#7'Beveled'#9#6'Height'#3#144#0#5'Width'#2#4
+#21'AnchorSideTop.Control'#7#5'Owner'#23'AnchorSideRight.Control'#7#5'Owner'
+#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#14'U'
+'pDownSplitter'#6'Cursor'#7#8'crHSplit'#4'Left'#3#232#0#6'Height'#3#144#0#5
+'Width'#2#4#0#0#0
+#16'CloneButtonClick'#8'TabOrder'#2#6#4'Left'#2#6#6'Height'#2#26#3'Top'#2'f'
+#5'Width'#2'x'#0#0#0#9'TSplitter'#13'ToolsSplitter'#5'Align'#7#6'alNone'#7'A'
+'nchors'#11#5'akTop'#6'akLeft'#8'akBottom'#0#7'Beveled'#9#6'Height'#3#144#0#5
+'Width'#2#4#21'AnchorSideTop.Control'#7#5'Owner'#23'AnchorSideRight.Control'
+#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Cont'
+'rol'#7#14'UpDownSplitter'#6'Cursor'#7#8'crHSplit'#4'Left'#3#232#0#6'Height'
+#3#144#0#5'Width'#2#4#0#0#0
]);

View File

@ -22,9 +22,9 @@ unit IDETextConvListEdit;
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
ClipBrd,
IDETextConverter, ExtCtrls, ObjectInspector, Buttons,
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ClipBrd, Buttons, ExtCtrls,
IDETextConverter, ObjectInspector,
IDETextConvListAdd;
type
@ -63,10 +63,16 @@ type
procedure SetModified(const AValue: boolean);
procedure UpdateAll;
procedure UpdateToolsListBox;
procedure UpdateButtons;
procedure MoveSelection(Offset: integer);
function GetCurrentTool: TCustomTextConverterTool;
procedure MakeToolCaptionUnique(NewTool: TCustomTextConverterTool);
procedure MakeToolNameUnique(NewTool: TCustomTextConverterTool);
procedure MakeToolCaptionAndNameUnique(NewTool: TCustomTextConverterTool);
public
procedure SelectTool(Tool: TCustomTextConverterTool);
function CreateTool(ToolClass: TCustomTextConverterToolClass
): TCustomTextConverterTool;
property ListOfTools: TComponent read FListOfTools write SetListOfTools;
property Modified: boolean read FModified write SetModified;
property OnModified: TNotifyEvent read FOnModified write FOnModified;
@ -98,6 +104,8 @@ begin
PropertyGrid.AnchorToNeighbour(akTop,0,UpDownSplitter);
PropertyGrid.Parent:=Self;
PropertyGrid.OnModified:=@PropertyGridModified;
UpdateButtons;
end;
procedure TTextConvListEditor.MoveToolDownButtonClick(Sender: TObject);
@ -127,6 +135,7 @@ begin
raise Exception.Create('not a TCustomTextConverterTool');
end;
NewTool:=TCustomTextConverterTool(NewComponent);
MakeToolCaptionAndNameUnique(NewTool);
Modified:=true;
UpdateToolsListBox;
SelectTool(NewTool);
@ -140,9 +149,13 @@ begin
end;
procedure TTextConvListEditor.PropertyGridModified(Sender: TObject);
var
Tool: TCustomTextConverterTool;
begin
if GetCurrentTool<>nil then
Modified:=true;
Tool:=GetCurrentTool;
if Tool=nil then exit;
MakeToolCaptionAndNameUnique(Tool);
Modified:=true;
end;
procedure TTextConvListEditor.ToolsListBoxSelectionChange(Sender: TObject;
@ -151,6 +164,8 @@ var
Tool: TCustomTextConverterTool;
begin
if User then ;
if csDestroying in ComponentState then exit;
UpdateButtons;
Tool:=GetCurrentTool;
PropertyGrid.TIObject:=Tool;
end;
@ -158,14 +173,10 @@ end;
procedure TTextConvListEditor.AddToolButtonClick(Sender: TObject);
var
ToolClass: TCustomTextConverterToolClass;
NewTool: TCustomTextConverterTool;
begin
if FListOfTools=nil then exit;
if ShowIDETextConvListAddDlg(ToolClass)<>mrOk then exit;
NewTool:=ToolClass.Create(FListOfTools);
Modified:=true;
UpdateToolsListBox;
SelectTool(NewTool);
CreateTool(ToolClass);
end;
procedure TTextConvListEditor.CloneButtonClick(Sender: TObject);
@ -177,6 +188,7 @@ begin
if Tool=nil then exit;
NewTool:=TCustomTextConverterToolClass(Tool.ClassType).Create(FListOfTools);
NewTool.Assign(Tool);
MakeToolCaptionAndNameUnique(NewTool);
Modified:=true;
UpdateToolsListBox;
SelectTool(NewTool);
@ -251,7 +263,7 @@ begin
sl:=TStringList.Create;
if FListOfTools<>nil then begin
for i:=0 to FListOfTools.ComponentCount-1 do begin
Tool:=FListOfTools as TCustomTextConverterTool;
Tool:=FListOfTools.Components[i] as TCustomTextConverterTool;
sl.Add(Tool.Caption);
end;
end;
@ -267,6 +279,19 @@ begin
sl.Free;
end;
procedure TTextConvListEditor.UpdateButtons;
var
i: LongInt;
begin
i:=ToolsListBox.ItemIndex;
DeleteToolButton.Enabled:=(i>=0);
MoveToolDownButton.Enabled:=(i<ToolsListBox.Items.Count-1);
MoveToolUpButton.Enabled:=(i>0);
CloneButton.Enabled:=(i>=0);
PasteButton.Enabled:=true;
CopyToolButton.Enabled:=(i>=0);
end;
procedure TTextConvListEditor.MoveSelection(Offset: integer);
var
i: LongInt;
@ -295,6 +320,82 @@ begin
Result:=TCustomTextConverterTool(FListOfTools.Components[i]);
end;
procedure TTextConvListEditor.MakeToolCaptionUnique(NewTool: TCustomTextConverterTool);
var
NewCaption: String;
function CaptionIsUnique: Boolean;
var
i: Integer;
CurTool: TCustomTextConverterTool;
begin
if NewCaption='' then exit(false);
for i:=0 to FListOfTools.ComponentCount-1 do begin
CurTool:=TCustomTextConverterTool(FListOfTools.Components[i]);
if CurTool=NewTool then continue;
if CompareText(CurTool.Caption,NewCaption)=0 then exit(false);
end;
Result:=true;
NewTool.Caption:=NewCaption;
end;
begin
NewCaption:=NewTool.Caption;
if CaptionIsUnique then exit;
NewCaption:=NewTool.FirstLineOfClassDescription;
if NewCaption='' then NewCaption:=NewTool.ClassName;
while not CaptionIsUnique do
NewCaption:=CreateNextIdentifier(NewCaption);
end;
procedure TTextConvListEditor.MakeToolNameUnique(
NewTool: TCustomTextConverterTool);
var
NewName: String;
procedure MakeValidIdentifier;
var
i: Integer;
begin
for i:=length(NewName) downto 1 do
if not (NewName[i] in ['0'..'9','_','a'..'z','A'..'Z']) then
System.Delete(NewName,i,1);
if (NewName<>'') and (NewName[1] in ['0'..'9']) then
NewName:='_'+NewName;
end;
function NameIsUnique: Boolean;
var
i: Integer;
CurTool: TCustomTextConverterTool;
begin
MakeValidIdentifier;
if NewName='' then exit(false);
for i:=0 to FListOfTools.ComponentCount-1 do begin
CurTool:=TCustomTextConverterTool(FListOfTools.Components[i]);
if CurTool=NewTool then continue;
if CompareText(CurTool.Name,NewName)=0 then exit(false);
end;
Result:=true;
NewTool.Name:=NewName;
end;
begin
NewName:=NewTool.Name;
if NameIsUnique then exit;
NewName:=NewTool.FirstLineOfClassDescription;
if NewName='' then NewName:=NewTool.ClassName;
while not NameIsUnique do
NewName:=CreateNextIdentifier(NewName);
end;
procedure TTextConvListEditor.MakeToolCaptionAndNameUnique(
NewTool: TCustomTextConverterTool);
begin
MakeToolNameUnique(NewTool);
MakeToolCaptionUnique(NewTool);
end;
procedure TTextConvListEditor.SelectTool(Tool: TCustomTextConverterTool);
var
i: LongInt;
@ -306,6 +407,18 @@ begin
ToolsListBox.ItemIndex:=i;
end;
function TTextConvListEditor.CreateTool(ToolClass: TCustomTextConverterToolClass
): TCustomTextConverterTool;
begin
Result:=nil;
if FListOfTools=nil then exit;
Result:=ToolClass.Create(FListOfTools);
MakeToolCaptionAndNameUnique(Result);
Modified:=true;
UpdateToolsListBox;
SelectTool(Result);
end;
initialization
{$I idetextconvlistedit.lrs}

View File

@ -34,12 +34,12 @@ unit SourceEditProcs;
interface
uses
Classes, SysUtils, LCLProc, LCLType, GraphType, Graphics,
Classes, SysUtils, LCLProc, LCLType, GraphType, Graphics, Controls,
SynEdit, SynRegExpr, SynCompletion,
BasicCodeTools, CodeTree, CodeToolManager, PascalParserTool, FileProcs,
IdentCompletionTool,
BasicCodeTools, CodeTree, CodeCache, CodeToolManager, PascalParserTool,
FileProcs, IdentCompletionTool,
LazIDEIntf, TextTools, IDETextConverter,
MainIntf, EditorOptions, CodeToolsOptions;
DialogProcs, MainIntf, EditorOptions, CodeToolsOptions;
type
@ -48,6 +48,8 @@ type
TLazTextConverterToolClasses = class(TTextConverterToolClasses)
protected
function GetTempFilename: string; override;
function LoadFromFile(Converter: TIDETextConverter; const AFilename: string;
UpdateFromDisk, Revert: Boolean): Boolean; override;
end;
procedure SetupTextConverters;
@ -504,6 +506,28 @@ begin
Result:=FileProcs.GetTempFilename(BaseDir,'convert_');
end;
function TLazTextConverterToolClasses.LoadFromFile(
Converter: TIDETextConverter; const AFilename: string; UpdateFromDisk,
Revert: Boolean): Boolean;
var
TheFilename: String;
CodeBuf: TCodeBuffer;
begin
TheFilename:=CleanAndExpandFilename(AFilename);
CodeBuf:=CodeToolBoss.LoadFile(TheFilename,UpdateFromDisk,Revert);
if CodeBuf=nil then
exit(false);
Result:=true;
case Converter.CurrentType of
tctSource:
Converter.Source:=CodeBuf.Source;
tctFile:
Result:=SaveStringToFile(Converter.Filename,CodeBuf.Source,[])=mrOk;
tctStrings:
CodeBuf.AssignTo(Converter.Strings,true);
end;
end;
initialization
REException:=ERegExpr;
REMatchesFunction:=@SynREMatches;

View File

@ -817,116 +817,124 @@ var
procedure RegisterStandardSourceEditorMenuItems;
var
Path: String;
SubPath: String;
SubSubPath: String;
AParent: TIDEMenuSection;
I: Integer;
begin
SourceEditorMenuRoot:=RegisterIDEMenuRoot(SourceEditorMenuRootName);
Path:=SourceEditorMenuRoot.Name;
AParent:=SourceEditorMenuRoot;
// register the first dynamic section for often used context sensitive stuff
SrcEditMenuSectionFirstDynamic:=RegisterIDEMenuSection(Path,
SrcEditMenuSectionFirstDynamic:=RegisterIDEMenuSection(AParent,
'First dynamic section');
// register the first static section
SrcEditMenuSectionFirstStatic:=RegisterIDEMenuSection(Path,'First static section');
SubPath:=SrcEditMenuSectionFirstStatic.GetPath;
SrcEditMenuFindDeclaration:=RegisterIDEMenuCommand(SubPath,'Find Declaration',
SrcEditMenuSectionFirstStatic:=RegisterIDEMenuSection(AParent,'First static section');
AParent:=SrcEditMenuSectionFirstStatic;
SrcEditMenuFindDeclaration:=RegisterIDEMenuCommand(AParent,'Find Declaration',
uemFindDeclaration);
SrcEditMenuProcedureJump:=RegisterIDEMenuCommand(SubPath,'Procedure Jump',
SrcEditMenuProcedureJump:=RegisterIDEMenuCommand(AParent,'Procedure Jump',
uemProcedureJump);
SrcEditMenuOpenFileAtCursor:=RegisterIDEMenuCommand(SubPath,
SrcEditMenuOpenFileAtCursor:=RegisterIDEMenuCommand(AParent,
'Open File At Cursor',uemOpenFileAtCursor);
SrcEditMenuClosePage:=RegisterIDEMenuCommand(SubPath,
SrcEditMenuClosePage:=RegisterIDEMenuCommand(AParent,
'Close Page',uemClosePage);
// register the Clipboard section
SrcEditMenuSectionClipboard:=RegisterIDEMenuSection(Path,'Clipboard');
SubPath:=SrcEditMenuSectionClipboard.GetPath;
SrcEditMenuCut:=RegisterIDEMenuCommand(SubPath,'Cut',uemCut);
SrcEditMenuCopy:=RegisterIDEMenuCommand(SubPath,'Copy',uemCopy);
SrcEditMenuPaste:=RegisterIDEMenuCommand(SubPath,'Paste',uemPaste);
SrcEditMenuCopyFilename:=RegisterIDEMenuCommand(SubPath,'Copy filename',uemCopyFilename);
AParent:=SourceEditorMenuRoot;
SrcEditMenuSectionClipboard:=RegisterIDEMenuSection(AParent,'Clipboard');
AParent:=SrcEditMenuSectionClipboard;
SrcEditMenuCut:=RegisterIDEMenuCommand(AParent,'Cut',uemCut);
SrcEditMenuCopy:=RegisterIDEMenuCommand(AParent,'Copy',uemCopy);
SrcEditMenuPaste:=RegisterIDEMenuCommand(AParent,'Paste',uemPaste);
SrcEditMenuCopyFilename:=RegisterIDEMenuCommand(AParent,'Copy filename',
uemCopyFilename);
// register the Marks section
SrcEditMenuSectionMarks:=RegisterIDEMenuSection(Path,'Marks section');
SubPath:=SrcEditMenuSectionMarks.GetPath;
AParent:=SourceEditorMenuRoot;
SrcEditMenuSectionMarks:=RegisterIDEMenuSection(AParent,'Marks section');
AParent:=SrcEditMenuSectionMarks;
// register the Goto Bookmarks Submenu
SrcEditSubMenuGotoBookmarks:=RegisterIDESubMenu(SubPath,'Goto bookmarks',
SrcEditSubMenuGotoBookmarks:=RegisterIDESubMenu(AParent,'Goto bookmarks',
uemGotoBookmark);
SubSubPath:=SrcEditSubMenuGotoBookmarks.GetPath;
AParent:=SrcEditSubMenuGotoBookmarks;
for I := 0 to 9 do
RegisterIDEMenuCommand(SubSubPath,'GotoBookmark'+IntToStr(I),
RegisterIDEMenuCommand(AParent,'GotoBookmark'+IntToStr(I),
uemBookmarkN+IntToStr(i));
SrcEditMenuNextBookmark:=RegisterIDEMenuCommand(SubSubPath,
SrcEditMenuNextBookmark:=RegisterIDEMenuCommand(AParent,
'Goto next Bookmark',uemNextBookmark);
SrcEditMenuPrevBookmark:=RegisterIDEMenuCommand(SubSubPath,
SrcEditMenuPrevBookmark:=RegisterIDEMenuCommand(AParent,
'Goto previous Bookmark',uemPrevBookmark);
// register the Set Bookmarks Submenu
SrcEditSubMenuSetBookmarks:=RegisterIDESubMenu(SubPath,'Set bookmarks',
AParent:=SrcEditMenuSectionMarks;
SrcEditSubMenuSetBookmarks:=RegisterIDESubMenu(AParent,'Set bookmarks',
uemSetBookmark);
SubSubPath:=SrcEditSubMenuSetBookmarks.GetPath;
AParent:=SrcEditSubMenuSetBookmarks;
for I := 0 to 9 do
RegisterIDEMenuCommand(SubSubPath,'SetBookmark'+IntToStr(I),
RegisterIDEMenuCommand(AParent,'SetBookmark'+IntToStr(I),
uemBookmarkN+IntToStr(i));
SrcEditMenuSetFreeBookmark:=RegisterIDEMenuCommand(SubSubPath,
SrcEditMenuSetFreeBookmark:=RegisterIDEMenuCommand(AParent,
'Set a free Bookmark',uemSetFreeBookmark);
// register the Debug submenu
AParent:=SrcEditMenuSectionMarks;
SrcEditSubMenuDebug:=RegisterIDESubMenu(AParent,'Debug',uemDebugWord);
// register the File Specific dynamic section
SrcEditMenuSectionFileDynamic:=RegisterIDEMenuSection(Path,
AParent:=SourceEditorMenuRoot;
SrcEditMenuSectionFileDynamic:=RegisterIDEMenuSection(AParent,
'File dynamic section');
// register the Debug submenu
SrcEditSubMenuDebug:=RegisterIDESubMenu(SubPath,'Debug',uemDebugWord);
SubSubPath:=SrcEditSubMenuDebug.GetPath;
AParent:=SrcEditSubMenuDebug;
// register the Debug submenu items
SrcEditMenuAddBreakpoint:=RegisterIDEMenuCommand(SubSubPath,'Add Breakpoint',
SrcEditMenuAddBreakpoint:=RegisterIDEMenuCommand(AParent,'Add Breakpoint',
uemAddBreakpoint);
SrcEditMenuAddWatchAtCursor:=RegisterIDEMenuCommand(SubSubPath,
SrcEditMenuAddWatchAtCursor:=RegisterIDEMenuCommand(AParent,
'Add Watch at Cursor',uemAddWatchAtCursor);
SrcEditMenuRunToCursor:=RegisterIDEMenuCommand(SubSubPath,
SrcEditMenuRunToCursor:=RegisterIDEMenuCommand(AParent,
'Run to cursor',uemRunToCursor);
SrcEditMenuViewCallStack:=RegisterIDEMenuCommand(SubSubPath,
SrcEditMenuViewCallStack:=RegisterIDEMenuCommand(AParent,
'View Call Stack',uemViewCallStack);
// register the Move Page section
SrcEditMenuSectionMovePage:=RegisterIDEMenuSection(Path,'Move Page section');
SubPath:=SrcEditMenuSectionMovePage.GetPath;
SrcEditMenuMoveEditorLeft:=RegisterIDEMenuCommand(SubPath,'MoveEditorLeft',
AParent:=SourceEditorMenuRoot;
SrcEditMenuSectionMovePage:=RegisterIDEMenuSection(AParent,'Move Page section');
AParent:=SrcEditMenuSectionMovePage;
SrcEditMenuMoveEditorLeft:=RegisterIDEMenuCommand(AParent,'MoveEditorLeft',
uemMoveEditorLeft);
SrcEditMenuMoveEditorRight:=RegisterIDEMenuCommand(SubPath,'MoveEditorRight',
SrcEditMenuMoveEditorRight:=RegisterIDEMenuCommand(AParent,'MoveEditorRight',
uemMoveEditorRight);
// register the Refactoring submenu
SrcEditSubMenuRefactor:=RegisterIDESubMenu(Path,'Refactoring',uemRefactor);
SubSubPath:=SrcEditSubMenuRefactor.GetPath;
SrcEditMenuCompleteCode:=RegisterIDEMenuCommand(SubSubPath,'CompleteCode',
AParent:=SourceEditorMenuRoot;
SrcEditSubMenuRefactor:=RegisterIDESubMenu(AParent,'Refactoring',uemRefactor);
AParent:=SrcEditSubMenuRefactor;
SrcEditMenuCompleteCode:=RegisterIDEMenuCommand(AParent,'CompleteCode',
uemCompleteCode);
SrcEditMenuEncloseSelection:=RegisterIDEMenuCommand(SubSubPath,
SrcEditMenuEncloseSelection:=RegisterIDEMenuCommand(AParent,
'EncloseSelection',uemEncloseSelection);
SrcEditMenuExtractProc:=RegisterIDEMenuCommand(SubSubPath,
SrcEditMenuExtractProc:=RegisterIDEMenuCommand(AParent,
'ExtractProc',uemExtractProc);
SrcEditMenuInvertAssignment:=RegisterIDEMenuCommand(SubSubPath,
SrcEditMenuInvertAssignment:=RegisterIDEMenuCommand(AParent,
'InvertAssignment',uemInvertAssignment);
SrcEditMenuFindIdentifierReferences:=RegisterIDEMenuCommand(SubSubPath,
SrcEditMenuFindIdentifierReferences:=RegisterIDEMenuCommand(AParent,
'FindIdentifierReferences',uemFindIdentifierReferences);
SrcEditMenuRenameIdentifier:=RegisterIDEMenuCommand(SubSubPath,
SrcEditMenuRenameIdentifier:=RegisterIDEMenuCommand(AParent,
'RenameIdentifier',uemRenameIdentifier);
// register the Flags section
SrcEditMenuSectionFlags:=RegisterIDEMenuSection(Path,'Flags section');
SubPath:=SrcEditMenuSectionFlags.GetPath;
SrcEditMenuReadOnly:=RegisterIDEMenuCommand(SubPath,'ReadOnly',uemReadOnly);
AParent:=SourceEditorMenuRoot;
SrcEditMenuSectionFlags:=RegisterIDEMenuSection(AParent,'Flags section');
AParent:=SrcEditMenuSectionFlags;
SrcEditMenuReadOnly:=RegisterIDEMenuCommand(AParent,'ReadOnly',uemReadOnly);
SrcEditMenuReadOnly.ShowAlwaysCheckable:=true;
SrcEditMenuShowLineNumbers:=RegisterIDEMenuCommand(SubPath,'ShowLineNumbers',
SrcEditMenuShowLineNumbers:=RegisterIDEMenuCommand(AParent,'ShowLineNumbers',
uemShowLineNumbers);
SrcEditMenuShowLineNumbers.ShowAlwaysCheckable:=true;
SrcEditMenuShowUnitInfo:=RegisterIDEMenuCommand(SubPath,'ShowUnitInfo',
SrcEditMenuShowUnitInfo:=RegisterIDEMenuCommand(AParent,'ShowUnitInfo',
uemShowUnitInfo);
SrcEditMenuSectionHighlighter:=RegisterIDEMenuSection(SubPath,'Highlighter');
SrcEditMenuEditorProperties:=RegisterIDEMenuCommand(SubPath,
SrcEditMenuSectionHighlighter:=RegisterIDEMenuSection(AParent,'Highlighter');
SrcEditMenuEditorProperties:=RegisterIDEMenuCommand(AParent,
'EditorProperties',uemEditorProperties);
end;
@ -3686,6 +3694,8 @@ begin
end;
if Assigned(OnPopupMenu) then OnPopupMenu(@AddContextPopupMenuItem);
SourceEditorMenuRoot.NotifySubSectionOnShow(Self);
end;
procedure TSourceNotebook.NotebookShowTabHint(Sender: TObject;

View File

@ -27,7 +27,8 @@ unit IDETextConverter;
interface
uses
Classes, SysUtils, LCLProc, Controls, Forms, FileUtil, SrcEditorIntf;
Classes, SysUtils, LCLProc, Controls, Forms, FileUtil, SrcEditorIntf,
PropEdits;
type
TCustomTextConverterTool = class;
@ -53,27 +54,40 @@ type
FStrings: TStrings;
FCurrentType: TTextConverterType;
FFileIsTemporary: boolean;
FStringsIsTemporary: Boolean;
procedure CreateTempFilename;
function GetFilename: string;
function GetSource: string;
function GetStrings: TStrings;
procedure RemoveStrings;
procedure SaveToFile(const NewFilename: string);
procedure SetFilename(const AValue: string);
procedure SetSource(const AValue: string);
procedure SetStrings(const AValue: TStrings);
procedure SetCurrentType(const AValue: TTextConverterType);
procedure SetFileIsTemporary(const AValue: boolean);
procedure SaveToFile(const NewFilename: string);
procedure CreateTempFilename;
procedure SetStringsIsTemporary(const AValue: Boolean);
protected
function GetTempFilename: string; virtual;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure Clear;
function Execute(ToolList: TComponent): TModalResult;// run the tools
function LoadFromFile(const AFilename: string;
UseIDECache: Boolean = true;
UpdateFromDisk: Boolean = true;
Revert: Boolean = false
): Boolean; virtual;
procedure InitWithFilename(const AFilename: string);
procedure InitWithSource(const ASource: string);
procedure InitWithStrings(const aStrings: TStrings);
property CurrentType: TTextConverterType read FCurrentType write SetCurrentType;
property Source: string read GetSource write SetSource;
property Filename: string read GetFilename write SetFilename;
property Strings: TStrings read GetStrings write SetStrings;
property FileIsTemporary: boolean read FFileIsTemporary write SetFileIsTemporary;
property StringsIsTemporary: Boolean read FStringsIsTemporary write SetStringsIsTemporary;
end;
{ TCustomTextConverterTool
@ -87,15 +101,15 @@ type
procedure SetCaption(const AValue: string);
procedure SetDescription(const AValue: string);
public
constructor Create(TheOwner: TComponent); override;
function Execute(aText: TIDETextConverter): TModalResult; virtual; abstract;
procedure Assign(Source: TPersistent); override;
class function ClassDescription: string; virtual; abstract;
class function ClassDescription: string; virtual; abstract;//the first line should be a short title
class function FirstLineOfClassDescription: string;
published
property Name;
property Caption: string read FCaption write SetCaption;
property Description: string read FDescription write SetDescription;
property Enabled: boolean read FEnabled write FEnabled;
property Enabled: boolean read FEnabled write FEnabled default True;
end;
TCustomTextConverterToolClass = class of TCustomTextConverterTool;
@ -108,7 +122,7 @@ type
trtRegExpr, // use regular expressions for find and replace
trtMultiLine // ignore line boundaries. The expression can span multiple lines.
//TODO trtSearchInReplacement,// when replaced, continue search at start of replacement, instead of end of replacement
//TODO trtReplaceUntilNotFound// restart replace until the pattern not found
//TODO trtReplaceUntilNotFound// restart replace until pattern not found
);
TTextReplaceToolOptions = set of TTextReplaceToolOption;
@ -159,6 +173,8 @@ type
property Items[Index: integer]: TCustomTextConverterToolClass read GetItems; default;
property Count: integer read GetCount;
function GetTempFilename: string; virtual; abstract;
function LoadFromFile(Converter: TIDETextConverter; const AFilename: string;
UpdateFromDisk, Revert: Boolean): Boolean; virtual; abstract;
end;
var
@ -189,6 +205,7 @@ begin
SrcTool:=Src.Components[i] as TCustomTextConverterTool;
NewTool:=TCustomTextConverterToolClass(SrcTool.ClassType).Create(Dest);
NewTool.Assign(SrcTool);
NewTool.Name:=SrcTool.Name;
end;
end;
@ -217,16 +234,28 @@ begin
Result:=FStrings;
end;
procedure TIDETextConverter.RemoveStrings;
begin
if StringsIsTemporary then
FStrings.Free;
FStrings:=nil;
FStringsIsTemporary:=false;
end;
procedure TIDETextConverter.SetSource(const AValue: string);
begin
FCurrentType:=tctSource;
RemoveStrings;
FSource:=AValue;
end;
procedure TIDETextConverter.SetStrings(const AValue: TStrings);
begin
FCurrentType:=tctStrings;
if (AValue<>FStrings) and StringsIsTemporary then
FreeAndNil(FStrings);
FStrings:=AValue;
FStringsIsTemporary:=false;
end;
procedure TIDETextConverter.SetCurrentType(const AValue: TTextConverterType);
@ -243,7 +272,7 @@ begin
tctStrings:
if FStrings<>nil then begin
FSource:=FStrings.Text;
FreeAndNil(FStrings);
RemoveStrings;
end;
tctFile:
if FileExists(FFilename) then begin
@ -266,6 +295,7 @@ begin
if FStrings<>nil then
RaiseGDBException('TTextConverterText.SetCurrentType FStrings<>nil');
FStrings:=TStringList.Create;
fStringsIsTemporary:=true;
case FCurrentType of
tctSource:
begin
@ -284,6 +314,8 @@ begin
tctFile:
// convert to File
begin
// keep old Filename, so that a Filename, Source, Filename combination
// uses the same Filename
if FFilename='' then
CreateTempFilename;
case FCurrentType of
@ -302,7 +334,7 @@ begin
tctStrings:
if FStrings<>nil then begin
FStrings.SaveToFile(FFilename);
FreeAndNil(FStrings);
RemoveStrings;
end;
end;
end;
@ -340,6 +372,7 @@ begin
tctStrings:
begin
fStrings.SaveToFile(TrimmedFilename);
RemoveStrings;
end;
end;
FCurrentType:=tctFile;
@ -352,6 +385,12 @@ begin
FFileIsTemporary:=true;
end;
procedure TIDETextConverter.SetStringsIsTemporary(const AValue: Boolean);
begin
if FStringsIsTemporary=AValue then exit;
FStringsIsTemporary:=AValue;
end;
function TIDETextConverter.GetTempFilename: string;
begin
if TextConverterToolClasses<>nil then
@ -368,9 +407,18 @@ end;
destructor TIDETextConverter.Destroy;
begin
RemoveStrings;
inherited Destroy;
end;
procedure TIDETextConverter.Clear;
begin
FFilename:='';
FSource:='';
RemoveStrings;
FCurrentType:=tctSource;
end;
function TIDETextConverter.Execute(ToolList: TComponent): TModalResult;
var
i: Integer;
@ -392,6 +440,61 @@ begin
end;
end;
function TIDETextConverter.LoadFromFile(const AFilename: string;
UseIDECache: Boolean; UpdateFromDisk: Boolean; Revert: Boolean): Boolean;
var
fs: TFileStream;
begin
if UseIDECache and (TextConverterToolClasses<>nil) then begin
Result:=TextConverterToolClasses.LoadFromFile(Self,AFilename,
UpdateFromDisk,Revert);
end else begin
Result:=false;
try
case CurrentType of
tctSource:
begin
fs:=TFileStream.Create(AFilename,fmOpenRead);
try
SetLength(FSource,fs.Size);
if fSource<>'' then
fs.Read(fSource[1],length(fSource));
finally
fs.Free;
end;
end;
tctFile:
CopyFile(AFilename,FFilename);
tctStrings:
FStrings.LoadFromFile(AFilename);
end;
Result:=true;
except
end;
end;
end;
procedure TIDETextConverter.InitWithFilename(const AFilename: string);
begin
Clear;
FCurrentType:=tctFile;
FFilename:=AFilename;
end;
procedure TIDETextConverter.InitWithSource(const ASource: string);
begin
Clear;
FCurrentType:=tctSource;
FSource:=ASource;
end;
procedure TIDETextConverter.InitWithStrings(const aStrings: TStrings);
begin
Clear;
FCurrentType:=tctStrings;
FStrings:=aStrings;
end;
{ TCustomTextConverterTool }
procedure TCustomTextConverterTool.SetCaption(const AValue: string);
@ -406,13 +509,18 @@ begin
FDescription:=AValue;
end;
constructor TCustomTextConverterTool.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
Enabled:=true;
end;
procedure TCustomTextConverterTool.Assign(Source: TPersistent);
var
Src: TCustomTextConverterTool;
begin
if Source is TCustomTextConverterTool then begin
Src:=TCustomTextConverterTool(Source);
Name:=Src.Name;
Caption:=Src.Caption;
Description:=Src.Description;
end else
@ -462,8 +570,10 @@ var
Flags: TSrcEditSearchOptions;
Prompt: Boolean;
begin
DebugLn(['TCustomTextReplaceTool.Execute ',dbgsName(Self),' ',dbgsName(aText)]);
Result:=mrCancel;
if aText=nil then exit;
if SearchFor='' then exit(mrOk);
Source:=aText.Source;
Flags:=[];
if trtMatchCase in Options then Include(Flags,sesoMatchCase);
@ -474,6 +584,7 @@ begin
Result:=IDESearchInText('',Source,SearchFor,ReplaceWith,Flags,Prompt,nil);
if Result=mrOk then
aText.Source:=Source;
DebugLn(['TCustomTextReplaceTool.Execute END Result=',Result=mrOk]);
end;
procedure TCustomTextReplaceTool.Assign(Source: TPersistent);
@ -563,5 +674,11 @@ begin
ComponentClass:=FindByName(aClassName);
end;
initialization
RegisterPropertyEditor(TypeInfo(AnsiString),
TCustomTextReplaceTool, 'SearchFor', TStringMultilinePropertyEditor);
RegisterPropertyEditor(TypeInfo(AnsiString),
TCustomTextReplaceTool, 'ReplaceWith', TStringMultilinePropertyEditor);
end.

View File

@ -235,12 +235,8 @@ end;
procedure TLazIDEInterface.DoCallNotifyHandler(
HandlerType: TLazarusIDEHandlerType);
var
i: Integer;
begin
i:=FLazarusIDEHandlers[HandlerType].Count;
while FLazarusIDEHandlers[HandlerType].NextDownIndex(i) do
TNotifyEvent(FLazarusIDEHandlers[HandlerType][i])(Self);
FLazarusIDEHandlers[HandlerType].CallNotifyEvents(Self);
end;
function TLazIDEInterface.DoCallModalFunctionHandler(

View File

@ -14,13 +14,6 @@
Abstract:
Interface to the IDE menus.
ToDo:
- Create MainBar menu with the menu interface
- Create Source Editor Popupmenu with the menu interface
- Create CodeExplorer Popupmenu with the menu interface
- Create Project Inspector Popupmenu with the menu interface
- Create Messages Popupmenu with the menu interface
}
unit MenuIntf;
@ -128,26 +121,36 @@ type
imssClearing
);
TIDEMenuSectionStates = set of TIDEMenuSectionState;
TIDEMenuSectionHandlerType = (
imshtOnShow // called before showing. Use this to enable/disable context sensitive items.
);
TIDEMenuSection = class(TIDEMenuItem)
private
FBottomSeparator: TMenuItem;
FChildMenuItemsCreated: boolean;
FChildsAsSubMenu: boolean;
FInvalidChildEndIndex: Integer;
FInvalidChildStartIndex: Integer;
FItems: TFPList;
FNeedBottomSeparator: boolean;
FNeedTopSeparator: boolean;
FSectionHandlers: array[TIDEMenuSectionHandlerType] of TMethodList;
FStates: TIDEMenuSectionStates;
FSubMenuImages: TCustomImageList;
FItems: TFPList;
FTopSeparator: TMenuItem;
FChildMenuItemsCreated: boolean;
FVisibleCount: integer;
FInvalidChildStartIndex: Integer;
FInvalidChildEndIndex: Integer;
FUpdateLock: Integer;
FVisibleCount: integer;
function GetItems(Index: Integer): TIDEMenuItem;
procedure SeparatorDestroy(Sender : TObject);
procedure FreeSeparators;
procedure AddHandler(HandlerType: TIDEMenuSectionHandlerType;
const AMethod: TMethod; AsLast: boolean = false);
procedure RemoveHandler(HandlerType: TIDEMenuSectionHandlerType;
const AMethod: TMethod);
protected
procedure MenuItemClick(Sender: TObject); override;
procedure SetMenuItem(const AValue: TMenuItem); override;
procedure SetChildsAsSubMenu(const AValue: boolean); virtual;
procedure SetSubMenuImages(const AValue: TCustomImageList); virtual;
@ -177,6 +180,12 @@ type
function Size: integer; override;
procedure BeginUpdate;
procedure EndUpdate;
procedure NotifySubSectionOnShow(Sender: TObject;
WithChilds: Boolean = true); virtual;
procedure RemoveAllHandlersOfObject(AnObject: TObject);
procedure AddHandlerOnShow(const OnShowEvent: TNotifyEvent;
AsLast: boolean = false);
procedure RemoveHandlerOnShow(const OnShowEvent: TNotifyEvent);
procedure WriteDebugReport(const Prefix: string;
MenuItemDebugReport: boolean); override;
procedure ConsistencyCheck; override;
@ -352,12 +361,14 @@ var
// Source Editor: Popupmenu
SourceEditorMenuRoot: TIDEMenuSection;
// Source Editor: First dynamic section for often used context sensitive stuff
// The items are cleared automatically after each popup.
SrcEditMenuSectionFirstDynamic: TIDEMenuSection;
// Source Editor: First static section (e.g. Find Declaration)
SrcEditMenuSectionFirstStatic: TIDEMenuSection;
// Source Editor: Clipboard section (e.g. cut, copy, paste)
SrcEditMenuSectionClipboard: TIDEMenuSection;
// Source Editor: File Specific dynamic section
// The items are cleared automatically after each popup.
SrcEditMenuSectionFileDynamic: TIDEMenuSection;
// Source Editor: Marks section
SrcEditMenuSectionMarks: TIDEMenuSection;
@ -1065,6 +1076,25 @@ begin
end;
end;
procedure TIDEMenuSection.NotifySubSectionOnShow(Sender: TObject;
WithChilds: Boolean);
var
i: Integer;
Child: TIDEMenuItem;
begin
//DebugLn(['TIDEMenuSection.NotifySubSectionOnShow ',Name,' ChildsAsSubMenu=',ChildsAsSubMenu,' Count=',Count]);
FSectionHandlers[imshtOnShow].CallNotifyEvents(Sender);
if WithChilds or (not ChildsAsSubMenu) then begin
i:=0;
while i<Count do begin
Child:=Items[i];
if Child is TIDEMenuSection then
TIDEMenuSection(Child).NotifySubSectionOnShow(Sender,false);
inc(i);
end;
end;
end;
procedure TIDEMenuSection.ItemVisibleActiveChanged(AnItem: TIDEMenuItem);
var
OldVisibleActive: Boolean;
@ -1285,6 +1315,26 @@ begin
UpdateMenuStructure;
end;
procedure TIDEMenuSection.RemoveAllHandlersOfObject(AnObject: TObject);
var
HandlerType: TIDEMenuSectionHandlerType;
begin
for HandlerType:=Low(TIDEMenuSectionHandlerType)
to High(TIDEMenuSectionHandlerType) do
FSectionHandlers[HandlerType].RemoveAllMethodsOfObject(AnObject);
end;
procedure TIDEMenuSection.AddHandlerOnShow(const OnShowEvent: TNotifyEvent;
AsLast: boolean);
begin
AddHandler(imshtOnShow,TMethod(OnShowEvent));
end;
procedure TIDEMenuSection.RemoveHandlerOnShow(const OnShowEvent: TNotifyEvent);
begin
RemoveHandler(imshtOnShow,TMethod(OnShowEvent));
end;
procedure TIDEMenuSection.WriteDebugReport(const Prefix: string;
MenuItemDebugReport: boolean);
var
@ -1343,6 +1393,26 @@ begin
FreeAndNil(FBottomSeparator);
end;
procedure TIDEMenuSection.AddHandler(HandlerType: TIDEMenuSectionHandlerType;
const AMethod: TMethod; AsLast: boolean);
begin
if FSectionHandlers[HandlerType]=nil then
FSectionHandlers[HandlerType]:=TMethodList.Create;
FSectionHandlers[HandlerType].Add(AMethod);
end;
procedure TIDEMenuSection.RemoveHandler(
HandlerType: TIDEMenuSectionHandlerType; const AMethod: TMethod);
begin
FSectionHandlers[HandlerType].Remove(AMethod);
end;
procedure TIDEMenuSection.MenuItemClick(Sender: TObject);
begin
inherited MenuItemClick(Sender);
NotifySubSectionOnShow(Sender);
end;
procedure TIDEMenuSection.SetMenuItem(const AValue: TMenuItem);
begin
if MenuItem=AValue then exit;

View File

@ -5954,13 +5954,13 @@ begin
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('AnsiString'),
TFileNameEdit, 'Filter', TFileDlgFilterProperty);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TAnchorSide'),
nil, 'AnchorSideLeft', THiddenPropertyEditor);
TControl, 'AnchorSideLeft', THiddenPropertyEditor);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TAnchorSide'),
nil, 'AnchorSideTop', THiddenPropertyEditor);
TControl, 'AnchorSideTop', THiddenPropertyEditor);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TAnchorSide'),
nil, 'AnchorSideRight', THiddenPropertyEditor);
TControl, 'AnchorSideRight', THiddenPropertyEditor);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TAnchorSide'),
nil, 'AnchorSideBottom', THiddenPropertyEditor);
TControl, 'AnchorSideBottom', THiddenPropertyEditor);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('AnsiString'),
TCustomPropertyStorage, 'Filename', TFileNamePropertyEditor);
end;
@ -5991,7 +5991,6 @@ begin
end;
initialization
{$I stringspropeditdlg.lrs}
{$I collectionpropeditform.lrs}
InitPropEdits;

View File

@ -524,12 +524,8 @@ end;
procedure TApplication.NotifyIdleHandler;
------------------------------------------------------------------------------}
procedure TApplication.NotifyIdleHandler;
var
i: integer;
begin
i:=FApplicationHandlers[ahtIdle].Count;
while FApplicationHandlers[ahtIdle].NextDownIndex(i) do
TNotifyEvent(FApplicationHandlers[ahtIdle][i])(Self);
FApplicationHandlers[ahtIdle].CallNotifyEvents(Self);
end;
{------------------------------------------------------------------------------
@ -537,32 +533,20 @@ end;
------------------------------------------------------------------------------}
procedure TApplication.NotifyIdleEndHandler;
var
i: integer;
begin
i:=FApplicationHandlers[ahtIdleEnd].Count;
while FApplicationHandlers[ahtIdleEnd].NextDownIndex(i) do
TNotifyEvent(FApplicationHandlers[ahtIdleEnd][i])(Self);
FApplicationHandlers[ahtIdleEnd].CallNotifyEvents(Self);
end;
procedure TApplication.NotifyActivateHandler;
var
i: integer;
begin
if Assigned(OnActivate) then OnActivate(Self);
i:=FApplicationHandlers[ahtActivate].Count;
while FApplicationHandlers[ahtActivate].NextDownIndex(i) do
TNotifyEvent(FApplicationHandlers[ahtActivate][i])(Self);
FApplicationHandlers[ahtActivate].CallNotifyEvents(Self);
end;
procedure TApplication.NotifyDeactivateHandler;
var
i: integer;
begin
if Assigned(OnDeactivate) then OnDeactivate(Self);
i:=FApplicationHandlers[ahtDeactivate].Count;
while FApplicationHandlers[ahtDeactivate].NextDownIndex(i) do
TNotifyEvent(FApplicationHandlers[ahtDeactivate][i])(Self);
FApplicationHandlers[ahtDeactivate].CallNotifyEvents(Self);
end;
{------------------------------------------------------------------------------

View File

@ -387,6 +387,7 @@ begin
s:=AsText;
if s<>'' then
MemStream.Write(s[1],length(s));
MemStream.Position:=0;
ReadComponentFromTextStream(MemStream,RootComponent,OnFindComponentClass,
Owner,Parent);
finally

View File

@ -1322,12 +1322,8 @@ begin
end;
procedure TControl.DoCallNotifyHandler(HandlerType: TControlHandlerType);
var
i: Integer;
begin
i:=FControlHandlers[HandlerType].Count;
while FControlHandlers[HandlerType].NextDownIndex(i) do
TNotifyEvent(FControlHandlers[HandlerType][i])(Self);
FControlHandlers[HandlerType].CallNotifyEvents(Self);
end;
{------------------------------------------------------------------------------

View File

@ -608,14 +608,10 @@ end;
Calls user handler
------------------------------------------------------------------------------}
procedure TCustomForm.DoCreate;
var
i: LongInt;
begin
LockRealizeBounds;
if Assigned(FOnCreate) then FOnCreate(Self);
i:=FFormHandlers[fhtCreate].Count;
while FFormHandlers[fhtCreate].NextDownIndex(i) do
TNotifyEvent(FFormHandlers[fhtCreate][i])(Self);
FFormHandlers[fhtCreate].CallNotifyEvents(Self);
UnlockRealizeBounds;
end;
@ -1829,12 +1825,8 @@ begin
end;
procedure TCustomForm.DoFirstShow;
var
i: LongInt;
begin
i:=FFormHandlers[fhtFirstShow].Count;
while FFormHandlers[fhtFirstShow].NextDownIndex(i) do
TNotifyEvent(FFormHandlers[fhtFirstShow][i])(Self);
FFormHandlers[fhtFirstShow].CallNotifyEvents(Self);
end;
{------------------------------------------------------------------------------}

View File

@ -178,9 +178,7 @@ var
HandlerType: TMenuItemHandlerType;
begin
//debugln('TMenuItem.Destroy A ',dbgsName(Self));
i:=FMenuItemHandlers[mihtDestroy].Count;
while FMenuItemHandlers[mihtDestroy].NextDownIndex(i) do
TNotifyEvent(FMenuItemHandlers[mihtDestroy][i])(Self);
FMenuItemHandlers[mihtDestroy].CallNotifyEvents(Self);
if FBitmap<>nil then
FreeAndNil(FBitmap);
DestroyHandle;

View File

@ -60,6 +60,7 @@ type
procedure Insert(Index: integer; const AMethod: TMethod);
procedure Move(OldIndex, NewIndex: integer);
procedure RemoveAllMethodsOfObject(const AnObject: TObject);
procedure CallNotifyEvents(Sender: TObject);
public
property Items[Index: integer]: TMethod read GetItems write SetItems; default;
end;
@ -743,6 +744,15 @@ begin
end;
end;
procedure TMethodList.CallNotifyEvents(Sender: TObject);
var
i: LongInt;
begin
i:=Count;
while NextDownIndex(i) do
TNotifyEvent(Items[i])(Self);
end;
{------------------------------------------------------------------------------
procedure RaiseGDBException(const Msg: string);

View File

@ -402,7 +402,54 @@ type
procedure WriteData(Writer: TWriter);
function HasData: Boolean;
end;
{ TReaderUniqueNamer - dummy class, used by the reader functions to rename
components, that are read from a stream, on the fly. }
TReaderUniqueNamer = class
procedure OnSetName(Reader: TReader; Component: TComponent;
var Name: string);
end;
{ TReaderUniqueNamer }
procedure TReaderUniqueNamer.OnSetName(Reader: TReader; Component: TComponent;
var Name: string);
procedure MakeValidIdentifier;
var
i: Integer;
begin
for i:=length(Name) downto 1 do
if not (Name[i] in ['0'..'9','_','a'..'z','A'..'Z']) then
System.Delete(Name,i,1);
if (Name<>'') and (Name[1] in ['0'..'9']) then
Name:='_'+Name;
end;
function NameIsUnique: Boolean;
var
Owner: TComponent;
i: Integer;
CurComponent: TComponent;
begin
Result:=true;
if Name='' then exit;
Owner:=Component.Owner;
if Owner=nil then exit;
for i:=0 to Owner.ComponentCount-1 do begin
CurComponent:=Owner.Components[i];
if CurComponent=Component then continue;
if CompareText(CurComponent.Name,Name)=0 then exit(false);
end;
end;
begin
MakeValidIdentifier;
while not NameIsUnique do
Name:=CreateNextIdentifier(Name);
end;
{ TDefineRectPropertyClass }
constructor TDefineRectPropertyClass.Create(AValue, ADefaultRect: PRect);
@ -570,6 +617,7 @@ var
IsInherited: Boolean;
AClassName: String;
AClass: TComponentClass;
UniqueNamer: TReaderUniqueNamer;
begin
// get root class
AClassName:=GetClassNameFromLRSStream(AStream,IsInherited);
@ -599,14 +647,27 @@ begin
// read the root component
DestroyDriver:=false;
Reader:=nil;
UniqueNamer:=nil;
try
UniqueNamer:=TReaderUniqueNamer.Create;
Reader:=CreateLRSReader(AStream,DestroyDriver);
Reader.Root:=RootComponent;
Reader.Owner:=TheOwner;
Reader.Parent:=Parent;
Reader.OnFindComponentClass:=OnFindComponentClass;
Reader.ReadRootComponent(RootComponent);
Reader.OnSetName:=@UniqueNamer.OnSetName;
Reader.BeginReferences;
try
Reader.Driver.BeginRootComponent;
RootComponent:=Reader.ReadComponent(RootComponent);
Reader.FixupReferences;
finally
Reader.EndReferences;
end;
finally
if DestroyDriver then
Reader.Driver.Free;
UniqueNamer.Free;
Reader.Free;
end;
end;
@ -683,24 +744,19 @@ procedure LoadComponentFromConfig(Config: TConfigStorage; const Path: string;
var
s: String;
TxtStream: TMemoryStream;
BinStream: TMemoryStream;
begin
// read from config
s:=Config.GetValue(Path,'');
BinStream:=nil;
TxtStream:=nil;
try
// convert text format into binary format
TxtStream:=TMemoryStream.Create;
if s<>'' then
TxtStream.Write(s[1],length(s));
BinStream:=TMemoryStream.Create;
LRSObjectTextToBinary(TxtStream,BinStream);
TxtStream.Position:=0;
// create component from stream
ReadComponentFromBinaryStream(BinStream,RootComponent,OnFindComponentClass,
TheOwner,Parent);
ReadComponentFromTextStream(TxtStream,RootComponent,OnFindComponentClass,
TheOwner,Parent);
finally
BinStream.Free;
TxtStream.Free;
end;
end;