IDEIntf: added IDESearchInText, added text converter tools

git-svn-id: trunk@9683 -
This commit is contained in:
mattias 2006-07-26 16:51:44 +00:00
parent db551f79b8
commit eca40584b9
25 changed files with 1664 additions and 557 deletions

5
.gitattributes vendored
View File

@ -163,7 +163,9 @@ components/h2pas/h2pasdlg.pas svneol=native#text/plain
components/h2pas/h2passtrconsts.pas svneol=native#text/plain
components/h2pas/h2paswizard.lpk svneol=native#text/plain
components/h2pas/h2paswizard.pas svneol=native#text/plain
components/h2pas/textconverter.pas svneol=native#text/plain
components/h2pas/idetextconvlistedit.lfm svneol=native#text/plain
components/h2pas/idetextconvlistedit.lrs svneol=native#text/plain
components/h2pas/idetextconvlistedit.pas svneol=native#text/plain
components/images/examples/README.txt svneol=native#text/plain
components/images/examples/imagesexample.lpi svneol=native#text/plain
components/images/examples/imagesexample.lpr svneol=native#text/pascal
@ -1412,6 +1414,7 @@ ideintf/idedialogs.pas svneol=native#text/plain
ideintf/ideexterntoolintf.pas svneol=native#text/plain
ideintf/idehelpintf.pas svneol=native#text/plain
ideintf/idemsgintf.pas svneol=native#text/plain
ideintf/idetextconverter.pas svneol=native#text/plain
ideintf/idewindowintf.pas svneol=native#text/plain
ideintf/imagelisteditor.lfm svneol=native#text/plain
ideintf/imagelisteditor.lrs svneol=native#text/plain

View File

@ -23,9 +23,10 @@ unit H2PasConvert;
interface
uses
Classes, SysUtils, LCLProc, LazConfigStorage, XMLPropStorage, Forms, Controls,
Dialogs, FileUtil, FileProcs,
TextTools, IDEExternToolIntf, IDEDialogs, LazIDEIntf, IDEMsgIntf;
Classes, SysUtils, LCLProc, LResources, LazConfigStorage, XMLPropStorage,
Forms, Controls, Dialogs, FileUtil, FileProcs,
TextTools, IDEExternToolIntf, IDEDialogs, LazIDEIntf, IDEMsgIntf,
IDETextConverter;
type
TH2PasProject = class;
@ -81,6 +82,7 @@ type
FPackAllRecords: boolean;
FPalmOSSYSTrap: boolean;
FPforPointers: boolean;
FPreH2PasTools: TComponent;
FStripComments: boolean;
FStripCommentsAndInfo: boolean;
FTforTypedefs: boolean;
@ -141,6 +143,7 @@ type
property BaseDir: string read FBaseDir;
property IsVirtual: boolean read FIsVirtual;
property Converter: TH2PasConverter read FConverter;
property PreH2PasTools: TComponent read FPreH2PasTools;
// h2pas options
property ConstantsInsteadOfEnums: boolean read FConstantsInsteadOfEnums write SetConstantsInsteadOfEnums;
@ -554,6 +557,7 @@ end;
constructor TH2PasProject.Create;
begin
FCHeaderFiles:=TFPList.Create;
FPreH2PasTools:=TComponent.Create(nil);
Clear;
end;
@ -589,6 +593,8 @@ begin
FOutputDirectory:='';
while CHeaderFileCount>0 do
CHeaderFiles[CHeaderFileCount-1].Free;
FPreH2PasTools.Free;
FPreH2PasTools:=TComponent.Create(nil);
FModified:=false;
end;
@ -597,6 +603,8 @@ var
Src: TH2PasProject;
i: Integer;
NewCHeaderFile: TH2PasFile;
SrcComponent: TComponent;
NewComponent: TObject;
begin
if Source is TH2PasProject then begin
Src:=TH2PasProject(Source);
@ -626,6 +634,16 @@ begin
NewCHeaderFile.Project:=Self;
NewCHeaderFile.Assign(Src.CHeaderFiles[i]);
end;
FPreH2PasTools.Free;
FPreH2PasTools:=TComponent.Create(nil);
for i:=0 to Src.FPreH2PasTools.ComponentCount-1 do begin
SrcComponent:=Src.FPreH2PasTools.Components[i];
if SrcComponent is TCustomTextConverterTool then begin
NewComponent:=
TComponentClass(SrcComponent.ClassType).Create(FPreH2PasTools);
TCustomTextConverterTool(NewComponent).Assign(SrcComponent);
end;
end;
Modified:=true;
end;
end else begin
@ -658,15 +676,21 @@ begin
and (FOutputDirectory=AProject.FOutputDirectory);
if not Result then exit;
for i:=0 to CHeaderFileCount-1 do
if not CHeaderFiles[i].IsEqual(AProject.CHeaderFiles[i]) then exit(false);
if not CHeaderFiles[i].IsEqual(AProject.CHeaderFiles[i]) then
exit(false);
if not CompareComponents(FPreH2PasTools,AProject.FPreH2PasTools) then
exit(false);
end;
procedure TH2PasProject.Load(Config: TConfigStorage);
var
NewCHeaderFileCount: LongInt;
NewCHeaderFile: TH2PasFile;
NewCount: LongInt;
i: Integer;
NewCHeaderFile: TH2PasFile;
NewComponent: TComponent;
begin
Clear;
// FFilename is not saved
FConstantsInsteadOfEnums:=Config.GetValue('ConstantsInsteadOfEnums/Value',true);
FCompactOutputmode:=Config.GetValue('CompactOutputmode/Value',false);
@ -690,8 +714,8 @@ begin
// load CHeaderFiles
Config.AppendBasePath('CHeaderFiles');
try
NewCHeaderFileCount:=Config.GetValue('Count',0);
for i:=0 to NewCHeaderFileCount-1 do begin
NewCount:=Config.GetValue('Count',0);
for i:=0 to NewCount-1 do begin
Config.AppendBasePath('File'+IntToStr(i+1));
try
NewCHeaderFile:=TH2PasFile.Create;
@ -705,6 +729,24 @@ begin
Config.UndoAppendBasePath;
end;
// load PreH2PasTools
Config.AppendBasePath('PreH2PasTools');
try
NewCount:=Config.GetValue('Count',0);
for i:=0 to NewCount-1 do begin
Config.AppendBasePath('Tool'+IntToStr(i+1));
try
NewComponent:=nil;
LoadComponentFromConfig(Config,'Value',NewComponent,
@TextConverterToolClasses.FindClass,FPreH2PasTools);
finally
Config.UndoAppendBasePath;
end;
end;
finally
Config.UndoAppendBasePath;
end;
FModified:=false;
end;
@ -747,6 +789,21 @@ begin
finally
Config.UndoAppendBasePath;
end;
Config.AppendBasePath('PreH2PasTools');
try
Config.SetDeleteValue('Count',FPreH2PasTools.ComponentCount,0);
for i:=0 to FPreH2PasTools.ComponentCount-1 do begin
Config.AppendBasePath('Tool'+IntToStr(i+1));
try
SaveComponentToConfig(Config,'Value',FPreH2PasTools.Components[i]);
finally
Config.UndoAppendBasePath;
end;
end;
finally
Config.UndoAppendBasePath;
end;
FModified:=false;
end;

View File

@ -11,9 +11,9 @@ object H2PasDialog: TH2PasDialog
Position = poDesktopCenter
HorzScrollBar.Page = 784
VertScrollBar.Page = 500
Left = 258
Left = 245
Height = 501
Top = 143
Top = 205
Width = 785
object MainPageControl: TPageControl
ActivePage = ConvertTabSheet
@ -93,6 +93,7 @@ object H2PasDialog: TH2PasDialog
Width = 185
end
object CHeaderFilesSplitter1: TSplitter
Beveled = True
Height = 435
Width = 5
Cursor = crHSplit
@ -236,9 +237,9 @@ object H2PasDialog: TH2PasDialog
Caption = 'ConvertButton'
OnClick = ConvertButtonClick
TabOrder = 0
Left = 14
Left = 6
Height = 26
Top = 12
Top = 396
Width = 93
end
object ConvertErrorGroupBox: TGroupBox
@ -247,9 +248,11 @@ object H2PasDialog: TH2PasDialog
ClientHeight = 130
ClientWidth = 764
TabOrder = 1
AnchorSideTop.Control = ConvertUpDownSplitter
AnchorSideTop.Side = asrBottom
Left = 6
Height = 147
Top = 52
Top = 217
Width = 768
object ConvertErrorSynEdit: TSynEdit
Align = alClient
@ -598,6 +601,19 @@ object H2PasDialog: TH2PasDialog
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'
@ -733,7 +749,7 @@ object H2PasDialog: TH2PasDialog
object SynCppSyn1: TSynCppSyn
DefaultFilter = 'C++-Quelltexte (*.c,*.cpp,*.h,*.hpp,*.hh)|*.c;*.cpp;*.h;*.hpp;*.hh'
Enabled = False
left = 174
top = 92
left = 312
top = 80
end
end

View File

@ -6,184 +6,189 @@ LazarusResources.Add('TH2PasDialog','FORMDATA',[
+#14'FormCloseQuery'#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestr'
+'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#2#1#6'Height'#3#245#1#3'Top'#3#143#0#5'Width'#3#17#3#0#12'TPage'
+'Control'#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'TabInd'
+'ex'#2#2#8'TabOrder'#2#0#24'AnchorSideBottom.Control'#7#18'OpenSettingsButto'
+'n'#6'Height'#3#209#1#5'Width'#3#17#3#0#9'TTabSheet'#13'FilesTabSheet'#7'Cap'
+'tion'#6#13'FilesTabSheet'#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#13'TCheckListBox'
+#24'CHeaderFilesCheckListBox'#5'Align'#7#6'alLeft'#11'OnItemClick'#7'!CHeade'
+'rFilesCheckListBoxItemClick'#8'TabOrder'#2#0#8'TopIndex'#2#255#6'Height'#3
+#179#1#5'Width'#3#255#0#0#0#7'TButton'#21'AddCHeaderFilesButton'#18'BorderSp'
+'acing.Left'#2#6#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#21'AddCHeade'
+'rFilesButton'#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'Bor'
+'derSpacing.InnerBorder'#2#4#7'Caption'#6#24'DeleteCHeaderFilesButton'#7'OnC'
+'lick'#7#29'DeleteCHeaderFilesButtonClick'#8'TabOrder'#2#2#22'AnchorSideLeft'
+'.Control'#7#21'CHeaderFilesSplitter1'#19'AnchorSideLeft.Side'#7#9'asrBottom'
+#4'Left'#3#10#1#6'Height'#2#25#3'Top'#2'3'#5'Width'#3#185#0#0#0#7'TButton'#27
+'SelectAllCHeaderFilesButton'#18'BorderSpacing.Left'#2#6#25'BorderSpacing.In'
+'nerBorder'#2#4#7'Caption'#6#27'SelectAllCHeaderFilesButton'#7'OnClick'#7' S'
+'electAllCHeaderFilesButtonClick'#8'TabOrder'#2#3#22'AnchorSideLeft.Control'
+#7#21'CHeaderFilesSplitter1'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#3
+#10#1#6'Height'#2#25#3'Top'#2'a'#5'Width'#3#185#0#0#0#7'TButton'#29'Unselect'
+'AllCHeaderFilesButton'#18'BorderSpacing.Left'#2#6#25'BorderSpacing.InnerBor'
+'der'#2#4#7'Caption'#6#29'UnselectAllCHeaderFilesButton'#7'OnClick'#7'"Unsel'
+'ectAllCHeaderFilesButtonClick'#8'TabOrder'#2#4#22'AnchorSideLeft.Control'#7
+#21'CHeaderFilesSplitter1'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Left'#3
+#10#1#6'Height'#2#25#3'Top'#3#137#0#5'Width'#3#185#0#0#0#9'TSplitter'#21'CHe'
+'aderFilesSplitter1'#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'h2pasOpt'
+'ionsTabSheet'#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.Contr'
+'ol'#7#11'LibnameEdit'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#6#6'H'
+'eight'#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
+'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
+'Caption'#6#22'h2pasOptionsCheckGroup'#28'ChildSizing.LeftRightSpacing'#2#6
+#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24
+'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenou'
+'sChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'Chil'
+'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#14#6'Height'#2#26#3'Top'#2#12#5'Width'#2']'#0#0#9'TGr'
+'oupBox'#20'ConvertErrorGroupBox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'
+#0#7'Caption'#6#20'ConvertErrorGroupBox'#12'ClientHeight'#3#130#0#11'ClientW'
+'idth'#3#252#2#8'TabOrder'#2#1#4'Left'#2#6#6'Height'#3#147#0#3'Top'#2'4'#5'W'
+'idth'#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'Height'#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#24'BookMarkOptions.OnChange'#13#22'Gutter.Sho'
+'wLineNumbers'#9#15'Gutter.OnChange'#13#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'ShortCut'#3'& '#0#1#7'Command'#3#211#0#8'ShortCu'
+'t'#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'ShortCu'
+'t'#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'Short'
+'Cut'#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'ShortCut'#3#8' '#0#1#7'Command'#3#248#1#8'ShortCut'#3#8'@'#0#1#7'Comman'
+'d'#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'ShortC'
+'ut'#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'ShortCut'#3'N@'#0#1#7'Command'#3#247#1#8'ShortCut'#3'T@'#0#1#7'Comm'
+'and'#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'Command'#3'Z'#2#8'ShortCut'#3'Z`'#0#1#7'Command'#3'-'#1#8'ShortCu'
+'t'#3'0@'#0#1#7'Command'#3'.'#1#8'ShortCut'#3'1@'#0#1#7'Command'#3'/'#1#8'Sh'
+'ortCut'#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'Comman'
+'d'#3'5'#1#8'ShortCut'#3'8@'#0#1#7'Command'#3'6'#1#8'ShortCut'#3'9@'#0#1#7'C'
+'ommand'#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'Command'#3'e'#1#8'ShortCut'#3'6`'#0#1#7'Command'#3'f'#1#8'ShortCu'
+'t'#3'7`'#0#1#7'Command'#3'g'#1#8'ShortCut'#3'8`'#0#1#7'Command'#3'h'#1#8'Sh'
+'ortCut'#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'ShortCut'#2#9#0#1#7'Command'#3'e'#2#8'ShortCut'#3#9' '#0#1#7'Comma'
+'nd'#3#250#0#8'ShortCut'#3'B`'#0#0#13'Lines.Strings'#1#6#19'ConvertErrorSynE'
+'dit'#0#7'Options'#11#12'eoAutoIndent'#17'eoDragDropEditing'#11'eoGroupUndo'
+#16'eoShowScrollHint'#18'eoShowSpecialChars'#16'eoSmartTabDelete'#11'eoSmart'
+'Tabs'#14'eoTabsToSpaces'#20'eoTrimTrailingSpaces'#18'eoBracketHighlight'#0#8
+'ReadOnly'#9#22'SelectedColor.OnChange'#13#6'Cursor'#7#7'crIBeam'#6'Height'#3
+#130#0#5'Width'#3#252#2#0#0#0#0#9'TTabSheet'#16'SettingsTabSheet'#7'Caption'
+#6#16'SettingsTabSheet'#12'ClientHeight'#3#179#1#11'ClientWidth'#3#13#3#4'Le'
+'ft'#2#2#6'Height'#3#179#1#3'Top'#2#28#5'Width'#3#13#3#0#6'TLabel'#18'H2PasF'
+'ilenameLabel'#7'Caption'#6#18'H2PasFilenameLabel'#5'Color'#7#6'clNone'#11'P'
+'arentColor'#8#21'AnchorSideTop.Control'#7#17'H2PasFilenameEdit'#18'AnchorSi'
+'deTop.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'OpenLastProjectOnStartCheckBox'#7'Caption'#6#30'Open'
+'LastProjectOnStartCheckBox'#8'OnChange'#7'$OpenLastProjectOnStartCheckBoxCh'
+'ange'#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'AutoSize'#9#25'BorderSpacing.In'
+'nerBorder'#2#4#7'Caption'#6#20'SaveSettingsAsButton'#7'OnClick'#7#25'SaveSe'
+'ttingsAsButtonClick'#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'H2PasFilenameEditEditing'
+'Done'#8'TabOrder'#2#2#4'Text'#6#17'H2PasFilenameEdit'#22'AnchorSideLeft.Con'
+'trol'#7#18'H2PasFilenameLabel'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'Lef'
+'t'#3#132#0#6'Height'#2#23#3'Top'#2#4#5'Width'#3'`'#1#0#0#7'TButton'#25'h2pa'
+'sFilenameBrowseButton'#7'Anchors'#11#5'akTop'#6'akLeft'#8'akBottom'#0#25'Bo'
+'rderSpacing.InnerBorder'#2#4#7'Caption'#6#3'...'#7'OnClick'#7#30'h2pasFilen'
+'ameBrowseButtonClick'#8'TabOrder'#2#3#22'AnchorSideLeft.Control'#7#17'H2Pas'
+'FilenameEdit'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Contr'
+'ol'#7#17'H2PasFilenameEdit'#24'AnchorSideBottom.Control'#7#17'H2PasFilename'
+'Edit'#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'NewSettingsButton'#8'AutoSize'
+#9#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#17'NewSettingsButton'#7'On'
+'Click'#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'OpenSettingsButton'#7'An'
+'chors'#11#6'akLeft'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#5
+#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#18'OpenSettingsButton'#7'OnC'
+'lick'#7#23'OpenSettingsButtonClick'#8'TabOrder'#2#1#22'AnchorSideLeft.Contr'
+'ol'#7#5'Owner'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.'
+'Side'#7#9'asrBottom'#4'Left'#2#5#6'Height'#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.Control'#7#18'OpenSettingsButton'#19'Anch'
+'orSideLeft.Side'#7#9'asrBottom'#24'AnchorSideBottom.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'akRigh'
+'t'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#5#25'BorderSpacin'
+'g.InnerBorder'#2#4#7'Caption'#6#11'CloseButton'#7'OnClick'#7#16'CloseButton'
+'Click'#8'TabOrder'#2#3#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSide'
+'Right.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#5'Owner'#21'Ancho'
+'rSideBottom.Side'#7#9'asrBottom'#4'Left'#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,*.hh)|*.c;*.cpp;*.h;*.hpp;*.hh'#7'Enabled'#8
+#4'left'#3#174#0#3'top'#2'\'#0#0#0
+#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#24'AnchorSideBottom.Control'#7#18'OpenSettingsBut'
+'ton'#6'Height'#3#209#1#5'Width'#3#17#3#0#9'TTabSheet'#13'FilesTabSheet'#7'C'
+'aption'#6#13'FilesTabSheet'#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#13'TCheckListBo'
+'x'#24'CHeaderFilesCheckListBox'#5'Align'#7#6'alLeft'#11'OnItemClick'#7'!CHe'
+'aderFilesCheckListBoxItemClick'#8'TabOrder'#2#0#8'TopIndex'#2#255#6'Height'
+#3#179#1#5'Width'#3#255#0#0#0#7'TButton'#21'AddCHeaderFilesButton'#18'Border'
+'Spacing.Left'#2#6#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#21'AddCHea'
+'derFilesButton'#7'OnClick'#7#26'AddCHeaderFilesButtonClick'#8'TabOrder'#2#1
+#22'AnchorSideLeft.Control'#7#21'CHeaderFilesSplitter1'#19'AnchorSideLeft.Si'
+'de'#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.InnerBorder'#2#4#7'Caption'#6#24'DeleteCHeaderFilesButton'#7
+'OnClick'#7#29'DeleteCHeaderFilesButtonClick'#8'TabOrder'#2#2#22'AnchorSideL'
+'eft.Control'#7#21'CHeaderFilesSplitter1'#19'AnchorSideLeft.Side'#7#9'asrBot'
+'tom'#4'Left'#3#10#1#6'Height'#2#25#3'Top'#2'3'#5'Width'#3#185#0#0#0#7'TButt'
+'on'#27'SelectAllCHeaderFilesButton'#18'BorderSpacing.Left'#2#6#25'BorderSpa'
+'cing.InnerBorder'#2#4#7'Caption'#6#27'SelectAllCHeaderFilesButton'#7'OnClic'
+'k'#7' SelectAllCHeaderFilesButtonClick'#8'TabOrder'#2#3#22'AnchorSideLeft.C'
+'ontrol'#7#21'CHeaderFilesSplitter1'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4
+'Left'#3#10#1#6'Height'#2#25#3'Top'#2'a'#5'Width'#3#185#0#0#0#7'TButton'#29
+'UnselectAllCHeaderFilesButton'#18'BorderSpacing.Left'#2#6#25'BorderSpacing.'
+'InnerBorder'#2#4#7'Caption'#6#29'UnselectAllCHeaderFilesButton'#7'OnClick'#7
+'"UnselectAllCHeaderFilesButtonClick'#8'TabOrder'#2#4#22'AnchorSideLeft.Cont'
+'rol'#7#21'CHeaderFilesSplitter1'#19'AnchorSideLeft.Side'#7#9'asrBottom'#4'L'
+'eft'#3#10#1#6'Height'#2#25#3'Top'#3#137#0#5'Width'#3#185#0#0#0#9'TSplitter'
+#21'CHeaderFilesSplitter1'#7'Beveled'#9#6'Height'#3#179#1#5'Width'#2#5#6'Cur'
+'sor'#7#8'crHSplit'#4'Left'#3#255#0#6'Height'#3#179#1#5'Width'#2#5#0#0#0#9'T'
+'TabSheet'#20'h2pasOptionsTabSheet'#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.Control'#7#11'LibnameEdit'#18'AnchorSideTop.Side'#7#9'asrCent'
+'er'#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'Par'
+'entColor'#8#21'AnchorSideTop.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'OutputDirLabel'#7'Caption'#6#14'OutputDirLabel'#5'Color'#7
+#6'clNone'#11'ParentColor'#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'Bo'
+'rderSpacing.Top'#2#6#13'OnEditingDone'#7#22'LibnameEditEditingDone'#8'TabOr'
+'der'#2#0#4'Text'#6#11'LibnameEdit'#22'AnchorSideLeft.Control'#7#12'LibNameL'
+'abel'#19'AnchorSideLeft.Side'#7#9'asrBottom'#18'AnchorSideTop.Side'#7#9'asr'
+'Bottom'#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'O'
+'nEditingDone'#7#24'OutputExtEditEditingDone'#8'TabOrder'#2#1#4'Text'#6#13'O'
+'utputExtEdit'#22'AnchorSideLeft.Control'#7#14'OutputExtLabel'#19'AnchorSide'
+'Left.Side'#7#9'asrBottom'#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.Left'#2#6#17'BorderSpacing.Top'#2#6#13'OnEditingDone'#7#24'Ou'
+'tputDirEditEditingDone'#8'TabOrder'#2#2#4'Text'#6#13'OutputDirEdit'#22'Anch'
+'orSideLeft.Control'#7#14'OutputDirLabel'#19'AnchorSideLeft.Side'#7#9'asrBot'
+'tom'#21'AnchorSideTop.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'akB'
,'ottom'#0#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#3'...'#7'OnClick'#7
+#26'OutputDirBrowseButtonClick'#8'TabOrder'#2#3#22'AnchorSideLeft.Control'#7
+#13'OutputDirEdit'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.C'
+'ontrol'#7#13'OutputDirEdit'#24'AnchorSideBottom.Control'#7#13'OutputDirEdit'
+#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#238#1#6'Height'#2#23#3'T'
+'op'#3'Q'#1#5'Width'#2' '#0#0#11'TCheckGroup'#22'h2pasOptionsCheckGroup'#8'A'
+'utoFill'#9#7'Caption'#6#22'h2pasOptionsCheckGroup'#28'ChildSizing.LeftRight'
+'Spacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHor'
+'izontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24
+'crsHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChi'
+'lds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Lay'
+'out'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#2
+#7'Columns'#2#2#11'OnItemClick'#7#31'h2pasOptionsCheckGroupItemClick'#8'TabO'
+'rder'#2#4#4'Left'#2#6#6'Height'#3#8#1#3'Top'#2#4#5'Width'#3#0#3#0#0#0#9'TTa'
+'bSheet'#15'ConvertTabSheet'#7'Caption'#6#15'ConvertTabSheet'#12'ClientHeigh'
+'t'#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'BorderSpaci'
+'ng.InnerBorder'#2#4#7'Caption'#6#13'ConvertButton'#7'OnClick'#7#18'ConvertB'
+'uttonClick'#8'TabOrder'#2#0#4'Left'#2#6#6'Height'#2#26#3'Top'#3#140#1#5'Wid'
+'th'#2']'#0#0#9'TGroupBox'#20'ConvertErrorGroupBox'#7'Anchors'#11#5'akTop'#6
+'akLeft'#7'akRight'#0#7'Caption'#6#20'ConvertErrorGroupBox'#12'ClientHeight'
+#3#130#0#11'ClientWidth'#3#252#2#8'TabOrder'#2#1#21'AnchorSideTop.Control'#7
+#21'ConvertUpDownSplitter'#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'ConvertErr'
+'orSynEdit'#5'Align'#7#8'alClient'#11'Font.Height'#2#244#9'Font.Name'#6#7'co'
+'urier'#6'Height'#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#24'BookMa'
+'rkOptions.OnChange'#13#22'Gutter.ShowLineNumbers'#9#15'Gutter.OnChange'#13
+#23'Gutter.CodeFoldingWidth'#2#14#11'Highlighter'#7#10'SynCppSyn1'#10'Keystr'
+'okes'#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'ShortCu'
+'t'#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'ShortC'
+'ut'#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'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'ShortC'
+'ut'#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'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'Comma'
+'nd'#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'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'ShortCu'
+'t'#3'1@'#0#1#7'Command'#3'/'#1#8'ShortCut'#3'2@'#0#1#7'Command'#3'0'#1#8'Sh'
+'ortCut'#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'ShortCut'#3'8@'#0#1#7'Comman'
+'d'#3'6'#1#8'ShortCut'#3'9@'#0#1#7'Command'#3'_'#1#8'ShortCut'#3'0`'#0#1#7'C'
+'ommand'#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'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'ShortCu'
+'t'#3'8`'#0#1#7'Command'#3'h'#1#8'ShortCut'#3'9`'#0#1#7'Command'#3#231#0#8'S'
+'hortCut'#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'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'Lin'
+'es.Strings'#1#6#19'ConvertErrorSynEdit'#0#7'Options'#11#12'eoAutoIndent'#17
+'eoDragDropEditing'#11'eoGroupUndo'#16'eoShowScrollHint'#18'eoShowSpecialCha'
+'rs'#16'eoSmartTabDelete'#11'eoSmartTabs'#14'eoTabsToSpaces'#20'eoTrimTraili'
+'ngSpaces'#18'eoBracketHighlight'#0#8'ReadOnly'#9#22'SelectedColor.OnChange'
+#13#6'Cursor'#7#7'crIBeam'#6'Height'#3#130#0#5'Width'#3#252#2#0#0#0#9'TSplit'
+'ter'#21'ConvertUpDownSplitter'#5'Align'#7#6'alNone'#7'Beveled'#9#6'Cursor'#7
+#8'crVSplit'#6'Height'#2#5#5'Width'#3#13#3#12'ResizeAnchor'#7#8'akBottom'#6
+'Cursor'#7#8'crVSplit'#4'Left'#2#246#6'Height'#2#5#3'Top'#3#212#0#5'Width'#3
+#13#3#0#0#0#9'TTabSheet'#16'SettingsTabSheet'#7'Caption'#6#16'SettingsTabShe'
+'et'#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'Capt'
+'ion'#6#18'H2PasFilenameLabel'#5'Color'#7#6'clNone'#11'ParentColor'#8#21'Anc'
+'horSideTop.Control'#7#17'H2PasFilenameEdit'#18'AnchorSideTop.Side'#7#9'asrC'
+'enter'#4'Left'#2#6#6'Height'#2#13#3'Top'#2#9#5'Width'#2'x'#0#0#9'TCheckBox'
+#30'OpenLastProjectOnStartCheckBox'#7'Caption'#6#30'OpenLastProjectOnStartCh'
+'eckBox'#8'OnChange'#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'S'
+'aveSettingsAsButton'#8'AutoSize'#9#25'BorderSpacing.InnerBorder'#2#4#7'Capt'
+'ion'#6#20'SaveSettingsAsButton'#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.To'
+'p'#2#6#13'OnEditingDone'#7#28'H2PasFilenameEditEditingDone'#8'TabOrder'#2#2
+#4'Text'#6#17'H2PasFilenameEdit'#22'AnchorSideLeft.Control'#7#18'H2PasFilena'
+'meLabel'#19'AnchorSideLeft.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'Tab'
+'Order'#2#3#22'AnchorSideLeft.Control'#7#17'H2PasFilenameEdit'#19'AnchorSide'
+'Left.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#17'H2PasFilenameEdit'
+#24'AnchorSideBottom.Control'#7#17'H2PasFilenameEdit'#21'AnchorSideBottom.Si'
+'de'#7#9'asrBottom'#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.InnerBord'
+'er'#2#4#7'Caption'#6#17'NewSettingsButton'#7'OnClick'#7#22'NewSettingsButto'
+'nClick'#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'OpenSettingsButton'#7'Anchors'#11#6'akLeft'#8'akBotto'
+'m'#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#5#25'BorderSpacing.InnerBorde'
+'r'#2#4#7'Caption'#6#18'OpenSettingsButton'#7'OnClick'#7#23'OpenSettingsButt'
+'onClick'#8'TabOrder'#2#1#22'AnchorSideLeft.Control'#7#5'Owner'#24'AnchorSid'
+'eBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'
+#2#5#6'Height'#2#26#3'Top'#3#214#1#5'Width'#2'|'#0#0#7'TButton'#18'SaveSetti'
+'ngsButton'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpa'
+'cing.Around'#2#5#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#18'SaveSett'
+'ingsButton'#7'OnClick'#7#23'SaveSettingsButtonClick'#8'TabOrder'#2#2#22'Anc'
+'horSideLeft.Control'#7#18'OpenSettingsButton'#19'AnchorSideLeft.Side'#7#9'a'
+'srBottom'#24'AnchorSideBottom.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'AutoS'
+'ize'#9#20'BorderSpacing.Around'#2#5#25'BorderSpacing.InnerBorder'#2#4#7'Cap'
+'tion'#6#11'CloseButton'#7'OnClick'#7#16'CloseButtonClick'#8'TabOrder'#2#3#23
+'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'
+#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBo'
+'ttom'#4'Left'#3#187#2#6'Height'#2#26#3'Top'#3#214#1#5'Width'#2'Q'#0#0#10'TS'
+'ynCppSyn'#10'SynCppSyn1'#13'DefaultFilter'#6'BC++-Quelltexte (*.c,*.cpp,*.h'
+',*.hpp,*.hh)|*.c;*.cpp;*.h;*.hpp;*.hh'#7'Enabled'#8#4'left'#3'8'#1#3'top'#2
+'P'#0#0#0
]);

View File

@ -30,7 +30,7 @@ uses
IDEMsgIntf, MenuIntf, IDECommands, BaseIDEIntf, IDEDialogs, LazIDEIntf,
SrcEditorIntf,
CodeToolManager, CodeCache,
H2PasStrConsts, H2PasConvert;
H2PasStrConsts, H2PasConvert, IDETextConvListEdit;
type
@ -38,6 +38,7 @@ type
TH2PasDialog = class(TForm)
MainPageControl: TPageControl;
ConvertUpDownSplitter: TSplitter;
SynCppSyn1: TSynCppSyn;
// c header files
@ -61,6 +62,7 @@ type
OutputDirBrowseButton: TButton;
// convert
PreH2PasEdit: TTTextConvListEditor;
ConvertTabSheet: TTabSheet;
ConvertButton: TButton;
ConvertErrorGroupBox: TGroupBox;
@ -217,6 +219,16 @@ begin
SaveSettingsButton.Caption:='&Save Settings';
CloseButton.Caption:='&Close';
PreH2PasEdit:=TTTextConvListEditor.Create(Self);
with PreH2PasEdit do begin
Name:='PreH2PasEdit';
Align:=alTop;
AnchorToNeighbour(akBottom,0,ConvertUpDownSplitter);
Parent:=ConvertTabSheet;
Visible:=true;
DebugLn(['TH2PasDialog.FormCreate ',dbgs(BoundsRect)]);
end;
LazarusIDE.AddHandlerOnSavedAll(@OnIDESavedAll);
// create converter

View File

@ -38,8 +38,8 @@
<UnitName Value="H2PasStrConsts"/>
</Item5>
<Item6>
<Filename Value="textconverter.pas"/>
<UnitName Value="textconverter"/>
<Filename Value="idetextconvlistedit.pas"/>
<UnitName Value="idetextconvlistedit"/>
</Item6>
</Files>
<Type Value="RunAndDesignTime"/>

View File

@ -7,7 +7,8 @@ unit H2PasWizard;
interface
uses
H2PasConvert, H2PasDlg, H2PasStrConsts, TextConverter, LazarusPackageIntf;
H2PasConvert, H2PasDlg, H2PasStrConsts, IDETextConvListEdit,
LazarusPackageIntf;
implementation

View File

@ -0,0 +1,145 @@
object TTextConvListEditor: TTTextConvListEditor
ActiveControl = ToolsListBox
Caption = 'TTextConvListEditor'
ClientHeight = 316
ClientWidth = 519
Constraints.MinHeight = 200
Constraints.MinWidth = 400
OnCreate = FormCreate
PixelsPerInch = 75
HorzScrollBar.Page = 518
VertScrollBar.Page = 315
Left = 290
Height = 316
Top = 202
Width = 519
object ToolsLabel: TLabel
Caption = 'ToolsLabel'
Color = clNone
ParentColor = False
Left = 12
Height = 13
Top = 9
Width = 62
end
object ToolsListBox: TListBox
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
TabOrder = 0
TopIndex = -1
AnchorSideTop.Control = ToolsLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ToolsSplitter
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = UpDownSplitter
AnchorSideBottom.Side = asrBottom
Height = 125
Top = 24
Width = 236
end
object UpDownSplitter: TSplitter
Align = alNone
Anchors = [akTop, akLeft, akRight]
Beveled = True
Cursor = crVSplit
Height = 5
Width = 519
ResizeAnchor = akBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Cursor = crVSplit
Height = 5
Top = 144
Width = 519
end
object ToolsPanel: TPanel
Anchors = [akTop, akLeft, akRight, akBottom]
BevelOuter = bvNone
Caption = 'ToolsPanel'
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 149
ClientWidth = 287
TabOrder = 1
AnchorSideLeft.Control = ToolsSplitter
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = UpDownSplitter
AnchorSideBottom.Side = asrBottom
Left = 232
Height = 149
Width = 287
object AddToolButton: TButton
BorderSpacing.InnerBorder = 4
Caption = 'AddToolButton'
TabOrder = 0
Height = 26
Width = 120
end
object DeleteToolButton: TButton
BorderSpacing.InnerBorder = 4
Caption = 'DeleteToolButton'
TabOrder = 1
Left = 120
Height = 26
Width = 137
end
object MoveToolUpButton: TButton
BorderSpacing.InnerBorder = 4
Caption = 'MoveToolUpButton'
TabOrder = 2
Height = 26
Top = 26
Width = 120
end
object MoveToolDownButton: TButton
BorderSpacing.InnerBorder = 4
Caption = 'MoveToolDownButton'
TabOrder = 3
Left = 120
Height = 26
Top = 26
Width = 137
end
object CopyToolButton: TButton
BorderSpacing.InnerBorder = 4
Caption = 'CopyToolButton'
TabOrder = 4
Height = 26
Top = 52
Width = 120
end
object PasteButton: TButton
BorderSpacing.InnerBorder = 4
Caption = 'PasteButton'
TabOrder = 5
Left = 120
Height = 26
Top = 52
Width = 137
end
object CloneButton: TButton
BorderSpacing.InnerBorder = 4
Caption = 'CloneButton'
TabOrder = 6
Height = 26
Top = 78
Width = 120
end
end
object ToolsSplitter: TSplitter
Align = alNone
Anchors = [akTop, akLeft, akBottom]
Beveled = True
Height = 144
Width = 4
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = UpDownSplitter
Cursor = crHSplit
Left = 232
Height = 144
Width = 4
end
end

View File

@ -0,0 +1,50 @@
{ Dies ist eine automatisch erzeugte Lazarus-Ressourcendatei }
LazarusResources.Add('TTTextConvListEditor','FORMDATA',[
'TPF0'#20'TTTextConvListEditor'#19'TTextConvListEditor'#13'ActiveControl'#7#12
+'ToolsListBox'#7'Caption'#6#19'TTextConvListEditor'#12'ClientHeight'#3'<'#1
+#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';'#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#8'Tab'
+'Order'#2#0#8'TopIndex'#2#255#21'AnchorSideTop.Control'#7#10'ToolsLabel'#18
+'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#13'ToolsSp'
+'litter'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'
+#7#14'UpDownSplitter'#21'AnchorSideBottom.Side'#7#9'asrBottom'#6'Height'#2'}'
+#3'Top'#2#24#5'Width'#3#236#0#0#0#9'TSplitter'#14'UpDownSplitter'#5'Align'#7
+#6'alNone'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Beveled'#9#6'Curs'
+'or'#7#8'crVSplit'#6'Height'#2#5#5'Width'#3#7#2#12'ResizeAnchor'#7#8'akBotto'
+'m'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrB'
+'ottom'#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'ak'
+'Bottom'#0#10'BevelOuter'#7#6'bvNone'#7'Caption'#6#10'ToolsPanel'#18'ChildSi'
+'zing.Layout'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPer'
+'Line'#2#2#12'ClientHeight'#3#149#0#11'ClientWidth'#3#31#1#8'TabOrder'#2#1#22
+'AnchorSideLeft.Control'#7#13'ToolsSplitter'#23'AnchorSideRight.Control'#7#5
+'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'
+#7#14'UpDownSplitter'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#232
+#0#6'Height'#3#149#0#5'Width'#3#31#1#0#7'TButton'#13'AddToolButton'#25'Borde'
+'rSpacing.InnerBorder'#2#4#7'Caption'#6#13'AddToolButton'#8'TabOrder'#2#0#6
+'Height'#2#26#5'Width'#2'x'#0#0#7'TButton'#16'DeleteToolButton'#25'BorderSpa'
+'cing.InnerBorder'#2#4#7'Caption'#6#16'DeleteToolButton'#8'TabOrder'#2#1#4'L'
+'eft'#2'x'#6'Height'#2#26#5'Width'#3#137#0#0#0#7'TButton'#16'MoveToolUpButto'
+'n'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#16'MoveToolUpButton'#8'Ta'
+'bOrder'#2#2#6'Height'#2#26#3'Top'#2#26#5'Width'#2'x'#0#0#7'TButton'#18'Move'
+'ToolDownButton'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#18'MoveToolD'
+'ownButton'#8'TabOrder'#2#3#4'Left'#2'x'#6'Height'#2#26#3'Top'#2#26#5'Width'
+#3#137#0#0#0#7'TButton'#14'CopyToolButton'#25'BorderSpacing.InnerBorder'#2#4
+#7'Caption'#6#14'CopyToolButton'#8'TabOrder'#2#4#6'Height'#2#26#3'Top'#2'4'#5
+'Width'#2'x'#0#0#7'TButton'#11'PasteButton'#25'BorderSpacing.InnerBorder'#2#4
+#7'Caption'#6#11'PasteButton'#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'#25'BorderSpacing.'
+'InnerBorder'#2#4#7'Caption'#6#11'CloneButton'#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'Heigh'
+'t'#3#144#0#5'Width'#2#4#21'AnchorSideTop.Control'#7#5'Owner'#23'AnchorSideR'
+'ight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorS'
+'ideBottom.Control'#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

@ -0,0 +1,82 @@
{
*****************************************************************************
* *
* See the file COPYING.modifiedLGPL, included in this distribution, *
* for details about the copyright. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
*****************************************************************************
Author: Mattias Gaertner
Abstract:
An editor for a list of TCustomTextConverterTool.
}
unit IDETextConvListEdit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
IDETextConverter, ExtCtrls, ObjectInspector, Buttons;
type
{ TTTextConvListEditor }
TTTextConvListEditor = class(TForm)
AddToolButton: TButton;
CloneButton: TButton;
PasteButton: TButton;
CopyToolButton: TButton;
MoveToolDownButton: TButton;
MoveToolUpButton: TButton;
DeleteToolButton: TButton;
ToolsSplitter: TSplitter;
ToolsPanel: TPanel;
ToolsListBox: TListBox;
UpDownSplitter: TSplitter;
ToolsLabel: TLabel;
PropertyGrid: TCustomPropertiesGrid;
procedure FormCreate(Sender: TObject);
private
public
end;
var
TTextConvListEditor: TTTextConvListEditor;
implementation
{ TTTextConvListEditor }
procedure TTTextConvListEditor.FormCreate(Sender: TObject);
begin
Caption:='Text conversion tools editor';
ToolsLabel.Caption:='Tools:';
// buttons
AddToolButton.Caption:='Add new tool';
CloneButton.Caption:='Add a copy';
PasteButton.Caption:='Add from clipboard';
CopyToolButton.Caption:='Copy tool to clipboard';
MoveToolDownButton.Caption:='Move down';
MoveToolUpButton.Caption:='Move up';
DeleteToolButton.Caption:='Delete tool';
PropertyGrid:=TCustomPropertiesGrid.Create(Self);
PropertyGrid.Align:=alBottom;
PropertyGrid.AnchorToNeighbour(akTop,0,UpDownSplitter);
PropertyGrid.Parent:=Self;
end;
initialization
{$I idetextconvlistedit.lrs}
end.

View File

@ -1,39 +0,0 @@
{ Copyright (C) 2006 Mattias Gaertner
This source is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This code is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
A copy of the GNU General Public License is available on the World Wide Web
at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing
to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
}
unit TextConverter;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type
TTextConverterBaseTool = class(TPersistent)
public
property Name: string;
property LocalizedName: string;
property Description: string;
end;
implementation
end.

View File

@ -1,92 +1,88 @@
object SearchForm: TSearchForm
Left = 452
Height = 149
Top = 286
Width = 428
HorzScrollBar.Page = 427
VertScrollBar.Page = 148
BorderStyle = bsDialog
Caption = 'Searching....'
ClientHeight = 149
ClientWidth = 428
OnCreate = SearchFormCREATE
OnDestroy = SearchFormDESTROY
ParentFont = True
PixelsPerInch = 112
Position = poOwnerFormCenter
HorzScrollBar.Page = 427
VertScrollBar.Page = 148
Left = 461
Height = 149
Top = 289
Width = 428
object Panel2: TPanel
Height = 149
Width = 428
Align = alClient
BevelInner = bvLowered
ClientHeight = 149
ClientWidth = 428
FullRepaint = False
ParentFont = True
TabOrder = 0
TabStop = True
Height = 149
Width = 428
OnClick = Panel2Click
object lblMatches: TLabel
Color = clNone
ParentColor = False
Left = 96
Height = 17
Top = 80
Width = 321
end
object MatchesLabel: TLabel
Caption = 'Matches'
Color = clNone
ParentColor = False
end
object MatchesLabel: TLabel
Left = 16
Height = 17
Top = 80
Width = 64
end
object lblProgress: TLabel
Caption = 'Matches'
Color = clNone
ParentColor = False
end
object lblProgress: TLabel
Left = 96
Height = 17
Top = 48
Width = 320
end
object SearchingLabel: TLabel
Caption = 'Searching:'
Color = clNone
ParentColor = False
end
object SearchingLabel: TLabel
Left = 16
Height = 17
Top = 48
Width = 64
end
object SearchTextLabel: TLabel
Caption = 'Search Text:'
Caption = 'Searching:'
Color = clNone
ParentColor = False
end
object SearchTextLabel: TLabel
Left = 16
Height = 17
Top = 16
Width = 80
end
object lblSearchText: TLabel
Caption = 'Search Text:'
Color = clNone
ParentColor = False
end
object lblSearchText: TLabel
Left = 96
Height = 17
Top = 16
Width = 320
Color = clNone
ParentColor = False
end
object btnCancel: TButton
AutoSize = True
Caption = 'Cancel'
Default = True
OnClick = btnAbortCLICK
TabOrder = 0
Left = 177
Height = 25
Top = 112
Width = 75
AutoSize = True
BorderSpacing.InnerBorder = 4
Caption = 'Cancel'
Default = True
OnClick = btnAbortCLICK
TabOrder = 0
end
end
end

View File

@ -1,25 +1,26 @@
{ Dies ist eine automatisch erzeugte Lazarus-Ressourcendatei }
LazarusResources.Add('TSearchForm','FORMDATA',[
'TPF0'#11'TSearchForm'#10'SearchForm'#11'BorderStyle'#7#8'bsDialog'#7'Caption'
+#6#13'Searching....'#12'ClientHeight'#3#149#0#11'ClientWidth'#3#172#1#8'OnCr'
+'eate'#7#16'SearchFormCREATE'#9'OnDestroy'#7#17'SearchFormDESTROY'#10'Parent'
+'Font'#9#13'PixelsPerInch'#2'p'#8'Position'#7#17'poOwnerFormCenter'#18'HorzS'
+'crollBar.Page'#3#171#1#18'VertScrollBar.Page'#3#148#0#4'Left'#3#205#1#6'Hei'
+'ght'#3#149#0#3'Top'#3'!'#1#5'Width'#3#172#1#0#6'TPanel'#6'Panel2'#5'Align'#7
+#8'alClient'#10'BevelInner'#7#9'bvLowered'#12'ClientHeight'#3#149#0#11'Clien'
+'tWidth'#3#172#1#11'FullRepaint'#8#10'ParentFont'#9#8'TabOrder'#2#0#7'TabSto'
+'p'#9#6'Height'#3#149#0#5'Width'#3#172#1#0#6'TLabel'#10'lblMatches'#5'Color'
+#7#6'clNone'#11'ParentColor'#8#4'Left'#2'`'#6'Height'#2#17#3'Top'#2'P'#5'Wid'
+'th'#3'A'#1#0#0#6'TLabel'#12'MatchesLabel'#7'Caption'#6#7'Matches'#5'Color'#7
+#6'clNone'#11'ParentColor'#8#4'Left'#2#16#6'Height'#2#17#3'Top'#2'P'#5'Width'
+#2'@'#0#0#6'TLabel'#11'lblProgress'#5'Color'#7#6'clNone'#11'ParentColor'#8#4
+'Left'#2'`'#6'Height'#2#17#3'Top'#2'0'#5'Width'#3'@'#1#0#0#6'TLabel'#14'Sear'
+'chingLabel'#7'Caption'#6#10'Searching:'#5'Color'#7#6'clNone'#11'ParentColor'
+#8#4'Left'#2#16#6'Height'#2#17#3'Top'#2'0'#5'Width'#2'@'#0#0#6'TLabel'#15'Se'
+'archTextLabel'#7'Caption'#6#12'Search Text:'#5'Color'#7#6'clNone'#11'Parent'
+'Color'#8#4'Left'#2#16#6'Height'#2#17#3'Top'#2#16#5'Width'#2'P'#0#0#6'TLabel'
+#13'lblSearchText'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2'`'#6'Hei'
+'ght'#2#17#3'Top'#2#16#5'Width'#3'@'#1#0#0#7'TButton'#9'btnCancel'#8'AutoSiz'
+'e'#9#7'Caption'#6#6'Cancel'#7'Default'#9#7'OnClick'#7#13'btnAbortCLICK'#8'T'
+'abOrder'#2#0#4'Left'#3#177#0#6'Height'#2#25#3'Top'#2'p'#5'Width'#2'K'#0#0#0
+#0
'TPF0'#11'TSearchForm'#10'SearchForm'#4'Left'#3#196#1#6'Height'#3#149#0#3'Top'
+#3#30#1#5'Width'#3#172#1#18'HorzScrollBar.Page'#3#171#1#18'VertScrollBar.Pag'
+'e'#3#148#0#11'BorderStyle'#7#8'bsDialog'#7'Caption'#6#13'Searching....'#8'O'
+'nCreate'#7#16'SearchFormCREATE'#9'OnDestroy'#7#17'SearchFormDESTROY'#10'Par'
+'entFont'#9#8'Position'#7#17'poOwnerFormCenter'#0#6'TPanel'#6'Panel2'#6'Heig'
+'ht'#3#149#0#5'Width'#3#172#1#5'Align'#7#8'alClient'#10'BevelInner'#7#9'bvLo'
+'wered'#11'FullRepaint'#8#10'ParentFont'#9#8'TabOrder'#2#0#7'TabStop'#9#7'On'
+'Click'#7#11'Panel2Click'#0#6'TLabel'#10'lblMatches'#4'Left'#2'`'#6'Height'#2
+#17#3'Top'#2'P'#5'Width'#3'A'#1#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6
+'TLabel'#12'MatchesLabel'#4'Left'#2#16#6'Height'#2#17#3'Top'#2'P'#5'Width'#2
+'@'#7'Caption'#6#7'Matches'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLa'
+'bel'#11'lblProgress'#4'Left'#2'`'#6'Height'#2#17#3'Top'#2'0'#5'Width'#3'@'#1
+#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#14'SearchingLabel'#4'L'
+'eft'#2#16#6'Height'#2#17#3'Top'#2'0'#5'Width'#2'@'#7'Caption'#6#10'Searchin'
+'g:'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#15'SearchTextLabel'
+#4'Left'#2#16#6'Height'#2#17#3'Top'#2#16#5'Width'#2'P'#7'Caption'#6#12'Searc'
+'h Text:'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#13'lblSearchT'
+'ext'#4'Left'#2'`'#6'Height'#2#17#3'Top'#2#16#5'Width'#3'@'#1#5'Color'#7#6'c'
+'lNone'#11'ParentColor'#8#0#0#7'TButton'#9'btnCancel'#4'Left'#3#177#0#6'Heig'
+'ht'#2#25#3'Top'#2'p'#5'Width'#2'K'#8'AutoSize'#9#25'BorderSpacing.InnerBord'
+'er'#2#4#7'Caption'#6#6'Cancel'#7'Default'#9#7'OnClick'#7#13'btnAbortCLICK'#8
+'TabOrder'#2#0#0#0#0#0
]);

View File

@ -41,7 +41,6 @@ uses
// ide
LazarusIDEStrConsts, InputHistory, FindInFilesDlg, SearchResultView;
type
{ TSearchForm }
@ -55,21 +54,22 @@ type
lblProgress: TLABEL;
lblSearchText: TLABEL;
Panel2: TPANEL;
procedure OnAddMatch(const Filename: string; const StartPos,
EndPos: TPoint; const Lines: string);
procedure Panel2Click(Sender: TObject);
procedure SearchFormCREATE(Sender: TObject);
procedure SearchFormDESTROY(Sender: TObject);
procedure btnAbortCLICK(Sender: TObject);
private
fAbort: boolean;
fAborting: boolean;
fFlags: TSrcEditSearchOptions;
fAbortString: string;
fCaseSensitive: Boolean;
fmask: string;
fMask: string;
fMatches: longint;
fPad: string;
fParsedMasks: TStringList; //Holds the parsed masks.
FPromptOnReplace: boolean;
FProgress: TIDESearchInTextProgress;
fPromptOnReplace: boolean;
fRecursive: boolean;
fRegExp: Boolean;
FReplaceText: string;
fResultsList: TStrings;
fResultsWindow: integer;
@ -79,10 +79,7 @@ type
fSearchOpen: boolean;
fSearchProject: boolean;
fTheDirectory: string;
fWholeWord: Boolean;
fReplace: boolean;
fReplaceAll: boolean;
procedure SearchFile(TheFileName: string);
fAborting: boolean;
procedure DoFindInFiles(TheFileName: string);
procedure DoFindInSearchList;
procedure ParseMask;
@ -91,6 +88,8 @@ type
function PadAndShorten(FileName: string): string;
procedure SetOptions(TheOptions: TLazFindInFileSearchOptions);
function GetOptions: TLazFindInFileSearchOptions;
procedure SearchFile(const aFilename: string);
procedure SetFlag(Flag: TSrcEditSearchOption; AValue: boolean);
public
Procedure DoSearch;
property SearchDirectory: string read fTheDirectory write fTheDirectory;
@ -104,185 +103,114 @@ type
property SearchMask: string read fMask write fMask;
property Pad: string read fPad write fPad;
property ResultsWindow: integer read fResultsWindow write fResultsWindow;
property PromptOnReplace: boolean read FPromptOnReplace write FPromptOnReplace;
property PromptOnReplace: boolean read fPromptOnReplace write fPromptOnReplace;// this is asked once and can be changed when prompting
property Progress: TIDESearchInTextProgress read FProgress;
end;
var
SearchForm: TSearchForm;
function SearchInText(const TheFileName: string;
var TheText: string;// if TheFileName='' then use TheText
SearchFor, ReplaceText: string;
Flags: TSrcEditSearchOptions; var Prompt: boolean;
Progress: TIDESearchInTextProgress = nil
): TModalResult;
implementation
{ TSearchForm }
procedure TSearchForm.btnAbortCLICK(Sender: TObject);
begin
fAbort:= true;
end;
procedure TSearchForm.SearchFormCREATE(Sender: TObject);
begin
//Set Defaults
MatchesLabel.Caption:=lissMatches;
SearchingLabel.Caption:=lissSearching;
SearchTextLabel.Caption:=lissSearchText;
btnCancel.Caption:=dlgCancel;
Caption:=dlgSearchCaption;
fWholeWord:= false;
fReplace:=false;
fReplaceAll:=false;
fCaseSensitive:= false;
fRecursive:= True;
fAbort:= false;
fAbortString:= dlgSearchAbort;
fPad:= '...';
fRegExp:= false;
fAborting:= false;
fSearchProject:= false;
fSearchOpen:= false;
fSearchFiles:= false;
self.Caption:= dlgSearchCaption;
end;//SearchFormCreate
procedure TSearchForm.SearchFormDESTROY(Sender: TObject);
begin
FreeAndNil(fParsedMasks);
end;
procedure TSearchForm.SetOptions(TheOptions: TLazFindInFileSearchOptions);
begin
fWholeWord:= (fifWholeWord in TheOptions);
fReplace:=(fifReplace in TheOptions);
fReplaceAll:=(fifReplaceAll in TheOptions);
fCaseSensitive:= (fifMatchCase in TheOptions);
fRegExp := (fifRegExpr in TheOptions);
frecursive:= (fifIncludeSubDirs in TheOptions);
fSearchProject:= (fifSearchProject in TheOptions);
fSearchOpen:= (fifSearchOpen in TheOptions);
fSearchFiles:= (fifSearchDirectories in TheOptions);
end;//SetOptions
function TSearchForm.GetOptions: TLazFindInFileSearchOptions;
begin
Result:=[];
if fWholeWord then include(Result,fifWholeWord);
if fCaseSensitive then include(Result,fifMatchCase);
if fReplace then include(Result,fifReplace);
if fReplaceAll then include(Result,fifReplaceAll);
if fRegExp then include(Result,fifRegExpr);
if fRecursive then include(Result,fifIncludeSubDirs);
if fRecursive then include(Result,fifIncludeSubDirs);
if fSearchProject then include(Result, fifSearchProject);
if fSearchOpen then include(Result,fifSearchOpen);
if fSearchFiles then include(Result,fifSearchDirectories);
end;//GetOptions
procedure TSearchForm.DoSearch;
begin
PromptOnReplace:=true;
lblSearchText.Caption:= fSearchFor;
fMatches:= 0;
ParseMask;
if Assigned(fResultsList) then
begin
if fSearchFiles then
begin
DoFindInFiles(fTheDirectory);
end;//if
if fSearchProject or fSearchOpen then
DoFindInSearchList;
end;//if
if Assigned(fResultsList) and (fResultsList.Count = 0) then
fResultsList.Add(lisFileNotFound);
Close;
end;//DoSearch
procedure TSearchForm.SearchFile(TheFileName: string);
const
WordBreakChars = [#0..#31,'.', ',', ';', ':', '"', '''', '!', '?', '[', ']',
const
WordBreakChars = [#0..#31,'.', ',', ';', ':', '"', '''', '!', '?', '[', ']',
'(', ')', '{', '}', '^', '-', '=', '+', '*', '/', '\', '|', ' '];
WhiteSpaceChars = [' ',#10,#13,#9];
WhiteSpaceChars = [' ',#10,#13,#9];
function SearchInLine(const SearchStr: string; SrcLog: TSourceLog;
LineNumber: integer; WholeWords: boolean; StartInLine: integer;
var MatchStartInLine: integer): boolean;
// search SearchStr in SrcLog line
// returns MatchStartInLine=1 for start of line
var
LineRange: TLineRange;
Src: String;
StartPos: PChar;
EndPos: PChar;
i: Integer;
SearchLen: Integer;
LineStartPos: PChar;
FirstChar: Char;
Found: Boolean;
CharInFront: PChar;
CharBehind: PChar;
begin
Result:=false;
if SearchStr='' then exit;
SrcLog.GetLineRange(LineNumber,LineRange);
Src:=SrcLog.Source;
SearchLen:=length(SearchStr);
LineStartPos:=@Src[LineRange.StartPos];
StartPos:=LineStartPos+StartInLine-1;
EndPos:=@Src[LineRange.EndPos-SearchLen+1];
FirstChar:=SearchStr[1];
while (StartPos<EndPos) do begin
if FirstChar=StartPos^ then begin
i:=1;
while (i<=SearchLen) and (StartPos[i-1]=SearchStr[i]) do
inc(i);
if i>SearchLen then begin
Found:=true;
MatchStartInLine:=StartPos-LineStartPos+1;
if WholeWords then begin
CharInFront:=StartPos-1;
CharBehind:=StartPos+SearchLen;
if ((MatchStartInLine=1)
or (CharInFront^ in WordBreakChars))
and ((StartPos+SearchLen=@Src[LineRange.EndPos])
or (CharBehind^ in WordBreakChars))
then begin
// word start and word end
end else begin
// not whole word
Found:=false;
end;
end;
if Found then begin
Result:=true;
exit;
function SearchInLine(const SearchStr: string; SrcLog: TSourceLog;
LineNumber: integer; WholeWords: boolean; StartInLine: integer;
var MatchStartInLine: integer): boolean;
// search SearchStr in SrcLog line
// returns MatchStartInLine=1 for start of line
var
LineRange: TLineRange;
Src: String;
StartPos: PChar;
EndPos: PChar;
i: Integer;
SearchLen: Integer;
LineStartPos: PChar;
FirstChar: Char;
Found: Boolean;
CharInFront: PChar;
CharBehind: PChar;
begin
Result:=false;
if SearchStr='' then exit;
SrcLog.GetLineRange(LineNumber,LineRange);
Src:=SrcLog.Source;
SearchLen:=length(SearchStr);
LineStartPos:=@Src[LineRange.StartPos];
StartPos:=LineStartPos+StartInLine-1;
EndPos:=@Src[LineRange.EndPos-SearchLen+1];
FirstChar:=SearchStr[1];
while (StartPos<EndPos) do begin
if FirstChar=StartPos^ then begin
i:=1;
while (i<=SearchLen) and (StartPos[i-1]=SearchStr[i]) do
inc(i);
if i>SearchLen then begin
Found:=true;
MatchStartInLine:=StartPos-LineStartPos+1;
if WholeWords then begin
CharInFront:=StartPos-1;
CharBehind:=StartPos+SearchLen;
if ((MatchStartInLine=1)
or (CharInFront^ in WordBreakChars))
and ((StartPos+SearchLen=@Src[LineRange.EndPos])
or (CharBehind^ in WordBreakChars))
then begin
// word start and word end
end else begin
// not whole word
Found:=false;
end;
end;
if Found then begin
Result:=true;
exit;
end;
end;
inc(StartPos);
end;
inc(StartPos);
end;
function TrimLineAndMatch(const Line: string; var APosition: integer): string;
var
StartPos: Integer;
EndPos: Integer;
begin
StartPos:=1;
while (StartPos<=length(Line)) and (Line[StartPos] in WhiteSpaceChars) do
inc(StartPos);
EndPos:=length(Line)+1;
while (EndPos>=StartPos) and (Line[EndPos-1] in WhiteSpaceChars) do
dec(EndPos);
dec(APosition,StartPos-1);
Result:=copy(Line,StartPos,EndPos-StartPos);
end;
{Start SearchFile ============================================================}
end;
function TrimLineAndMatch(const Line: string; var APosition: integer): string;
var
OriginalFile: TSourceLog; // The original File being searched
StartPos: Integer;
EndPos: Integer;
begin
StartPos:=1;
while (StartPos<=length(Line)) and (Line[StartPos] in WhiteSpaceChars) do
inc(StartPos);
EndPos:=length(Line)+1;
while (EndPos>=StartPos) and (Line[EndPos-1] in WhiteSpaceChars) do
dec(EndPos);
dec(APosition,StartPos-1);
Result:=copy(Line,StartPos,EndPos-StartPos);
end;
function SearchInText(const TheFileName: string;
var TheText: string;// if TheFileName='' then use TheText
SearchFor, ReplaceText: string;
Flags: TSrcEditSearchOptions; var Prompt: boolean;
Progress: TIDESearchInTextProgress = nil
): TModalResult;
var
OriginalFile: TSourceLog;// The original File being searched
CaseFile: TSourceLog; // The working File being searched
Line: integer; // Loop Counter
Match: integer; // Position of match in line.
Line: integer; // Loop Counter
Match: integer; // Position of match in line.
CurLine: String;
CurLineReplaceOffset: integer; // e.g. if in the current line 'ABC'
// was replaced by 'a', then CurLineReplaceOffset is -2
@ -299,15 +227,33 @@ var
ReplacedTextCapacity: integer;
ReplacedTextLength: integer;
ReplacedTextOriginalPos: integer;// 1-based. e.g. 2 bytes has been replaced => ReplacedTextOriginalPos=3.
function FileIsOpenInSourceEditor: boolean;
procedure DoAbort;
begin
if not SrcEditValid then
SrcEdit:=SourceEditorWindow.SourceEditorIntfWithFilename(TheFileName);
SrcEditValid:=true;
Result:=SrcEdit<>nil;
if Progress<>nil then
Progress.Abort:=true;
Result:=mrAbort;
end;
procedure ProcessMessages;
begin
Application.ProcessMessages;
if (Progress<>nil) and Progress.Abort then
Result:=mrAbort;
end;
function FileIsOpenInSourceEditor: boolean;
begin
if not SrcEditValid then begin
if (TheFileName<>'') then
SrcEdit:=SourceEditorWindow.SourceEditorIntfWithFilename(TheFileName)
else
SrcEdit:=nil;
SrcEditValid:=true;
end;
Result:=SrcEdit<>nil;
end;
procedure GrowNewText(NewLength: integer);
var
NewCapacity: Integer;
@ -328,7 +274,7 @@ var
ReplacedTextCapacity:=NewCapacity;
ReAllocMem(ReplacedText,ReplacedTextCapacity);
end;
procedure EnablePaintLock;
begin
if (not PaintLockEnabled) and FileIsOpenInSourceEditor then begin
@ -336,20 +282,20 @@ var
SrcEdit.BeginUpdate;
end;
end;
procedure DisablePaintLock;
begin
if PaintLockEnabled then
SrcEdit.EndUpdate;
PaintLockEnabled:=false;
end;
procedure EndLocks;
begin
DisablePaintLock;
SrcEditValid:=false;
end;
procedure DoReplaceLine;
var
ASearch: String;
@ -361,18 +307,18 @@ var
begin
// create replacement
AReplace:=ReplaceText;
if fRegExp then
if sesoRegExpr in Flags then
AReplace:=RE.Substitute(AReplace);
// ask the user
if PromptOnReplace then begin
if Prompt and (TheFileName<>'') then begin
// open the place in the source editor
EndLocks;
if LazarusIDE.DoOpenFileAndJumpToPos(TheFileName,Point(Match,Line+1),
-1,-1,[ofUseCache,ofDoNotLoadResource,ofVirtualFile,ofRegularFile])
<>mrOk then
begin
fAbort:=true;
DoAbort;
exit;
end;
ASearch:=copy(CurLine,Match,MatchLen);
@ -380,13 +326,13 @@ var
if not FileIsOpenInSourceEditor then
RaiseGDBException('inconsistency');
SrcEdit.SelectText(Line+1,Match,Line+1,Match+MatchLen);
SrcEdit.AskReplace(Self,ASearch,AReplace,Line,Match,Action);
SrcEdit.AskReplace(nil,ASearch,AReplace,Line,Match,Action);
case Action of
seraSkip: exit;
seraReplace: ;
seraReplaceAll: PromptOnReplace:=false;
seraReplaceAll: Prompt:=false;
else
fAbort:=true;
DoAbort;
exit;
end;
end;
@ -423,7 +369,7 @@ var
// adjust replace offset
inc(CurLineReplaceOffset,length(AReplace)-MatchLen);
end;
procedure CommitChanges;
var
GapLength: Integer;
@ -433,7 +379,7 @@ var
begin
EndLocks;
if ReplacedText<>nil then begin
if not fAbort then begin
if SearchInText<>mrAbort then begin
GapLength:=OriginalFile.SourceLength+1-ReplacedTextOriginalPos;
NewLength:=ReplacedTextLength+GapLength;
GrowNewText(NewLength);
@ -446,12 +392,16 @@ var
SetLength(NewText,ReplacedTextLength);
if NewText<>'' then
System.Move(ReplacedText[0],NewText[1],length(NewText));
OriginalFile.Source:=NewText;
if not OriginalFile.SaveToFile(TheFileName) then begin
CurResult:=MessageDlg('Write error',
'Error writing file "'+TheFileName+'"',
mtError,[mbCancel,mbAbort],0);
if CurResult=mrAbort then fAbort:=true;
if (TheFileName<>'') then begin
OriginalFile.Source:=NewText;
if (not OriginalFile.SaveToFile(TheFileName)) then begin
CurResult:=MessageDlg('Write error',
'Error writing file "'+TheFileName+'"',
mtError,[mbCancel,mbAbort],0);
if CurResult=mrAbort then DoAbort;
end;
end else begin
TheText:=NewText;
end;
end;
FreeMem(ReplacedText);
@ -460,18 +410,17 @@ var
var
WorkLine: String;
TrimmedCurLine: String;
TrimmedMatch: LongInt;
LastMatchStart: LongInt;
LastMatchEnd: Integer;
Found: Boolean;
begin
if fAbort then exit;
if (Progress<>nil) and Progress.Abort then exit(mrAbort);
Result:=mrOk;
OriginalFile:=nil;
CaseFile:=nil;
RE:=nil;
SearchAllHitsInLine:=fReplace;
SearchAllHitsInLine:=sesoReplace in Flags;
SrcEdit:=nil;
SrcEditValid:=false;
PaintLockEnabled:=false;
@ -480,45 +429,48 @@ begin
ReplacedTextLength:=0;
ReplacedTextOriginalPos:=1;
fResultsList.BeginUpdate;
try
MatchLen:= Length(fSearchFor);
TempSearch:= fSearchFor;
MatchLen:= Length(SearchFor);
TempSearch:= SearchFor;
// load text (do not use CodeToolBoss cache system to save memory)
// load text (to save memory, do not use codetools cache system)
if FileIsOpenInSourceEditor then begin
OriginalFile:=TSourceLog.Create(SrcEdit.GetText(false));
end else begin
end else if TheFileName<>'' then begin
OriginalFile:=TSourceLog.Create('');
OriginalFile.LoadFromFile(TheFileName);
end else begin
OriginalFile:=TSourceLog.Create('');
OriginalFile.Source:=TheText;
end;
// convert case
if fCaseSensitive then begin
if sesoMatchCase in Flags then begin
CaseFile:=OriginalFile;
end else begin
CaseFile:=TSourceLog.Create(UpperCaseStr(OriginalFile.Source));
TempSearch:=UpperCaseStr(TempSearch);
end;
if fRegExp then begin
if sesoRegExpr in Flags then begin
//Set up the regular expression search engine.
RE:= TRegExpr.Create;
With RE do
begin
Expression:= fSearchFor;
ModifierI:= not fCaseSensitive;
Expression:= SearchFor;
ModifierI:= not (sesoMatchCase in Flags);
ModifierM:= False; //for now
end;
end;
//writeln('TheFileName=',TheFileName,' len=',OriginalFile.SourceLength,' Cnt=',OriginalFile.LineCount,' TempSearch=',TempSearch);
Application.ProcessMessages;
ProcessMessages;
CurLine:='';
for Line:= 0 to OriginalFile.LineCount -1 do begin
if (Line and $fff)=0 then begin
EndLocks;
Application.ProcessMessages;
ProcessMessages;
end;
Match:=1;
MatchLen:=0;
@ -526,10 +478,10 @@ begin
repeat
LastMatchStart:=Match;
LastMatchEnd:=Match+MatchLen;
// search
Found:=false;
if fRegExp then begin
if sesoRegExpr in Flags then begin
// search every line for regular expression
if LastMatchStart=LastMatchEnd then begin
CurLine:=OriginalFile.GetLine(Line);
@ -544,43 +496,34 @@ begin
end;
end else begin
Found:=SearchInLine(TempSearch,CaseFile,Line,
fWholeWord,LastMatchEnd,Match);
sesoWholeWord in Flags,LastMatchEnd,Match);
if Found then begin
if (LastMatchStart=LastMatchEnd) then
CurLine:=OriginalFile.GetLine(Line);
MatchLen:=length(TempSearch);
end;
end;
// add found place
if Found then begin
//DebugLn('TSearchForm.SearchFile CurLine="',CurLine,'" Found=',dbgs(Found),' Match=',dbgs(Match),' MatchLen=',dbgs(MatchLen),' Line=',dbgs(Line));
if fReplace then begin
if sesoReplace in Flags then begin
DoReplaceLine
end else begin
TrimmedMatch:=Match;
TrimmedCurLine:=TrimLineAndMatch(CurLine,TrimmedMatch);
SearchResultsView.AddMatch(fResultsWindow,
TheFileName,Point(Match,Line+1),
TrimmedCurLine, TrimmedMatch, MatchLen);
UpdateMatches;
if (Progress<>nil)
and (Progress.OnAddMatch<>nil) then
Progress.OnAddMatch(TheFileName,Point(Match,Line+1),
Point(Match+MatchLen,Line+1),CurLine);
end;
end else
break;
until fAbort or (not SearchAllHitsInLine) or (MatchLen<1);
until (Result=mrAbort) or (not SearchAllHitsInLine) or (MatchLen<1);
// check abort
if fAbort and not fAborting then
begin
fResultsList.Insert(0,fAbortString);
fAborting:= True;
break;
end
else if fAbort then
begin
break;
end;//if
if (Result=mrAbort) then begin
exit;
end;
end;//for
finally
CommitChanges;
@ -589,11 +532,118 @@ begin
FreeAndNil(OriginalFile);
FreeAndNil(CaseFile);
FreeAndNil(RE);
fResultsList.EndUpdate;
end;
end;//SearchFile
{ TSearchForm }
procedure TSearchForm.btnAbortCLICK(Sender: TObject);
begin
Progress.Abort:= true;
end;
procedure TSearchForm.SearchFormCREATE(Sender: TObject);
begin
//Set Defaults
MatchesLabel.Caption:=lissMatches;
SearchingLabel.Caption:=lissSearching;
SearchTextLabel.Caption:=lissSearchText;
btnCancel.Caption:=dlgCancel;
Caption:=dlgSearchCaption;
fProgress:=TIDESearchInTextProgress.Create;
FProgress.OnAddMatch:=@OnAddMatch;
fFlags:=[];
fPromptOnReplace:=true;
fRecursive:= True;
Progress.Abort:= false;
fAbortString:= dlgSearchAbort;
fPad:= '...';
fSearchProject:= false;
fSearchOpen:= false;
fSearchFiles:= false;
Caption:= dlgSearchCaption;
end;
procedure TSearchForm.Panel2Click(Sender: TObject);
begin
end;
procedure TSearchForm.OnAddMatch(const Filename: string; const StartPos,
EndPos: TPoint; const Lines: string);
var
MatchLen: Integer;
TrimmedMatch: LongInt;
TrimmedCurLine: String;
begin
TrimmedMatch:=StartPos.X;
TrimmedCurLine:=TrimLineAndMatch(Lines,TrimmedMatch);
MatchLen:=EndPos.X-StartPos.X;
if MatchLen<1 then MatchLen:=1;
SearchResultsView.AddMatch(fResultsWindow,
FileName,StartPos,
TrimmedCurLine, TrimmedMatch, MatchLen);
UpdateMatches;
end;
procedure TSearchForm.SearchFormDESTROY(Sender: TObject);
begin
FreeAndNil(fParsedMasks);
FreeAndNil(fProgress);
end;
procedure TSearchForm.SetOptions(TheOptions: TLazFindInFileSearchOptions);
begin
SetFlag(sesoWholeWord,fifWholeWord in TheOptions);
SetFlag(sesoReplace,fifReplace in TheOptions);
SetFlag(sesoReplaceAll,fifReplaceAll in TheOptions);
SetFlag(sesoMatchCase,fifMatchCase in TheOptions);
SetFlag(sesoRegExpr,fifRegExpr in TheOptions);
fRecursive:= (fifIncludeSubDirs in TheOptions);
fSearchProject:= (fifSearchProject in TheOptions);
fSearchOpen:= (fifSearchOpen in TheOptions);
fSearchFiles:= (fifSearchDirectories in TheOptions);
end;//SetOptions
function TSearchForm.GetOptions: TLazFindInFileSearchOptions;
begin
Result:=[];
if sesoWholeWord in fFlags then include(Result,fifWholeWord);
if sesoMatchCase in fFlags then include(Result,fifMatchCase);
if sesoReplace in fFlags then include(Result,fifReplace);
if sesoReplaceAll in fFlags then include(Result,fifReplaceAll);
if sesoRegExpr in fFlags then include(Result,fifRegExpr);
if fRecursive then include(Result,fifIncludeSubDirs);
if fSearchProject then include(Result, fifSearchProject);
if fSearchOpen then include(Result,fifSearchOpen);
if fSearchFiles then include(Result,fifSearchDirectories);
end;//GetOptions
procedure TSearchForm.DoSearch;
begin
PromptOnReplace:=true;
fAborting:=false;
Progress.Abort:=false;
lblSearchText.Caption:= fSearchFor;
fMatches:= 0;
ParseMask;
if Assigned(fResultsList) then
begin
if fSearchFiles then
begin
DoFindInFiles(fTheDirectory);
end;//if
if fSearchProject or fSearchOpen then
DoFindInSearchList;
end;//if
if Assigned(fResultsList) and (fResultsList.Count = 0) then
fResultsList.Add(lisFileNotFound);
Close;
end;//DoSearch
procedure TSearchForm.DoFindInFiles(TheFileName: string);
var
//Loop counter
@ -623,13 +673,13 @@ begin
UpdateProgress(TempDir + FileInfo.Name);
SearchFile(TempDir + FileInfo.Name);
end;//if
if fAbort and not fAborting then
if Progress.Abort and not fAborting then
begin
fAborting:= True;
fResultsList.Insert(0,fAbortString);
break;
end
else if fAbort then
else if Progress.Abort then
begin
break;
end;
@ -648,13 +698,13 @@ begin
and (FileInfo.Name<>'')
then
DoFindInFiles(TempDir + FileInfo.Name);
if fAbort and not fAborting then
if Progress.Abort and not fAborting then
begin
fAborting:= True;
fResultsList.Insert(0,fAbortString);
break;
end
else if fAbort then
else if Progress.Abort then
begin
break;
end;
@ -717,7 +767,6 @@ begin
end;//else
end;//ParseMask
procedure TSearchForm.UpdateMatches;
begin
inc(fMatches);
@ -738,6 +787,28 @@ begin
end;//while
end;//UpdateProgress
procedure TSearchForm.SearchFile(const aFilename: string);
var
Src: String;
begin
fResultsList.BeginUpdate;
try
Src:='';
SearchInText(aFilename,Src,fSearchFor,FReplaceText,FFlags,
fPromptOnReplace,Progress);
finally
fResultsList.EndUpdate;
end;
end;
procedure TSearchForm.SetFlag(Flag: TSrcEditSearchOption; AValue: boolean);
begin
if AValue then
Include(fFlags,Flag)
else
Exclude(fFlags,Flag);
end;
function TSearchForm.PadAndShorten(FileName: string): string;
var
FoundAt: integer;

View File

@ -105,7 +105,7 @@ uses
// source editing
UnitEditor, CodeToolsOptions, IDEOptionDefs, CheckLFMDlg,
CodeToolsDefines, DiffDialog, DiskDiffsDialog, UnitInfoDlg, EditorOptions,
MsgQuickFixes, ViewUnit_dlg,
SourceEditProcs, MsgQuickFixes, ViewUnit_dlg,
// converter
DelphiUnit2Laz, DelphiProject2Laz, LazXMLForms,
// rest of the ide
@ -825,7 +825,7 @@ type
procedure DoArrangeSourceEditorAndMessageView(PutOnTop: boolean);
// methods for debugging, compiling and external tools
function GetTestBuildDir: string; override;
function GetTestBuildDirectory: string; override;
function GetProjectTargetFilename: string; override;
function GetTargetOS: string;
function GetTestProjectFilename: string;
@ -1127,6 +1127,7 @@ begin
SetupFormEditor;
SetupSourceNotebook;
SetupControlSelection;
SetupTextConverters;
// Main IDE bar created and setup completed -> Show it
MainIDEBar.Show;
@ -5097,7 +5098,7 @@ end;
procedure TMainIDE.OnProjectGetTestDirectory(TheProject: TProject;
out TestDir: string);
begin
TestDir:=GetTestBuildDir;
TestDir:=GetTestBuildDirectory;
end;
procedure TMainIDE.OnProjectChangeInfoFile(TheProject: TProject);
@ -7605,7 +7606,7 @@ begin
WorkingDir:=Project1.ProjectDirectory;
SrcFilename:=CreateRelativePath(Project1.MainUnitInfo.Filename,WorkingDir);
end else begin
WorkingDir:=GetTestBuildDir;
WorkingDir:=GetTestBuildDirectory;
SrcFilename:=GetTestUnitFilename(Project1.MainUnitInfo);
end;
CompilerFilename:=Project1.GetCompilerFilename;
@ -9351,7 +9352,7 @@ begin
s:='';
end else if MacroName='testdir' then begin
if Project1<>nil then
s:=GetTestBuildDir
s:=GetTestBuildDirectory
else
s:='';
end else if MacroName='runcmdline' then begin
@ -9752,7 +9753,7 @@ begin
end;
end;
function TMainIDE.GetTestBuildDir: string;
function TMainIDE.GetTestBuildDirectory: string;
begin
Result:=EnvironmentOptions.TestBuildDirectory;
if (Result='') then exit;
@ -9799,7 +9800,7 @@ var TestDir: string;
begin
Result:='';
if AnUnitInfo=nil then exit;
TestDir:=GetTestBuildDir;
TestDir:=GetTestBuildDirectory;
if TestDir='' then exit;
Result:=ExtractFilename(AnUnitInfo.Filename);
if Result='' then exit;
@ -9820,7 +9821,7 @@ var
begin
Result:=false;
if Project1.IsVirtual then begin
TestDir:=GetTestBuildDir;
TestDir:=GetTestBuildDirectory;
Result:=CompareFileNames(TestDir,ExtractFilePath(AFilename))=0;
end;
end;

View File

@ -139,7 +139,6 @@ type
procedure DoCommand(EditorCommand: integer); virtual; abstract;
function GetTestBuildDir: string; virtual; abstract;
function GetProjectTargetFilename: string; virtual; abstract;
function GetTestUnitFilename(AnUnitInfo: TUnitInfo): string; virtual; abstract;
function IsTestUnitFilename(const AFilename: string): boolean; virtual; abstract;

View File

@ -36,9 +36,21 @@ interface
uses
Classes, SysUtils, LCLProc, LCLType, GraphType, Graphics,
SynEdit, SynRegExpr, SynCompletion,
BasicCodeTools, CodeTree, CodeToolManager, PascalParserTool,
BasicCodeTools, CodeTree, CodeToolManager, PascalParserTool, FileProcs,
IdentCompletionTool,
TextTools, MainIntf, EditorOptions, CodeToolsOptions;
LazIDEIntf, TextTools, IDETextConverter,
MainIntf, EditorOptions, CodeToolsOptions;
type
{ TTextConverter }
TTextConverter = class(TIDETextConverter)
protected
function GetTempFilename: string; override;
end;
procedure SetupTextConverters;
type
TCompletionType = (
@ -62,6 +74,12 @@ implementation
var
SynREEngine: TRegExpr;
procedure SetupTextConverters;
begin
TextConverterToolClasses:=TTextConverterToolClasses.Create;
TextConverterToolClasses.RegisterClass(TTextReplaceTool);
end;
function PaintCompletionItem(const AKey: string; ACanvas: TCanvas;
X, Y, MaxX: integer; ItemSelected: boolean; Index: integer;
aCompletion : TSynCompletion; CurrentCompletionType: TCompletionType;
@ -463,6 +481,23 @@ begin
SynREEngine.Split(TheText,Pieces);
end;
{ TTextConverter }
function TTextConverter.GetTempFilename: string;
var
BaseDir: String;
begin
BaseDir:='';
if LazarusIDE.ActiveProject<>nil then
BaseDir:=ExtractFilePath(LazarusIDE.ActiveProject.ProjectInfoFile);
if BaseDir='' then
BaseDir:=LazarusIDE.GetTestBuildDirectory;
if BaseDir='' then
BaseDir:=GetCurrentDir;
BaseDir:=CleanAndExpandDirectory(BaseDir);
Result:=FileProcs.GetTempFilename(BaseDir,'convert_');
end;
initialization
REException:=ERegExpr;
REMatchesFunction:=@SynREMatches;

View File

@ -1101,6 +1101,7 @@ var
SynAction: TSynReplaceAction;
begin
SynAction:=raCancel;
SourceNotebook.BringToFront;
OnReplace(Sender, ASearch, AReplace, Line, Column, SynAction);
case SynAction of
raSkip: Action:=seraSkip;
@ -2724,6 +2725,7 @@ end;
constructor TSourceNotebook.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
IDESearchInText:=@SearchInText;
Visible:=false;
Name:=NonModalIDEWindowNames[nmiwSourceNoteBookName];
Caption := locWndSrcEditor;

View File

@ -36,6 +36,7 @@ uses
IDEExternToolIntf,
IDEHelpIntf,
IDEMsgIntf,
IDETextConverter,
IDEWindowIntf,
ImageListEditor,
LazIDEIntf,

View File

@ -0,0 +1,491 @@
{
*****************************************************************************
* *
* See the file COPYING.modifiedLGPL, included in this distribution, *
* for details about the copyright. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
*****************************************************************************
Author: Mattias Gaertner
Abstract:
Defines a converter and tools to modify a Text. The Text can be a file,
a string or a TStrings.
Packages can register extra tools, which the IDE user can then be put
together to define a series of changes. For example several Find&Replace
tools can be added and then executed automatically.
For an extensive example, see the package in components/h2pas/.
}
unit IDETextConverter;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LCLProc, Controls, Forms, FileUtil, SrcEditorIntf;
type
TCustomTextConverterTool = class;
TTextConverterType = (
tctSource,
tctFile,
tctStrings
);
{ TIDETextConverter
A component to hold a Text and tools to change the Text.
For example to do several find and replace operations on the text.
The Text can be a file, a string or TStrings.
The Text is converted on the fly, whenever someone reads/write one of the
formats.
The tools are decendants of TCustomTextConverterTool. }
TIDETextConverter = class(TComponent)
private
FFilename: string;
FSource: string;
FStrings: TStrings;
FCurrentType: TTextConverterType;
FFileIsTemporary: boolean;
function GetFilename: string;
function GetSource: string;
function GetStrings: TStrings;
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;
protected
function GetTempFilename: string; virtual; abstract;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
function Execute(ToolList: TComponent): TModalResult;// run the tools
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;
end;
{ TCustomTextConverterTool
An abstract component to change a Text (TIDETextConverter). }
TCustomTextConverterTool = class(TComponent)
private
FCaption: string;
FDescription: string;
procedure SetCaption(const AValue: string);
procedure SetDescription(const AValue: string);
public
function Execute(aText: TIDETextConverter): TModalResult; virtual; abstract;
procedure Assign(Source: TPersistent); override;
published
property Name;
property Caption: string read FCaption write SetCaption;
property Description: string read FDescription write SetDescription;
end;
TCustomTextConverterToolClass = class of TCustomTextConverterTool;
{ TCustomTextReplaceTool
A tool to do a 'find and replace' in a text. }
TTextReplaceToolOption = (
trtMatchCase, // search case sensitive
trtWholeWord, // search at word boundaries
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
);
TTextReplaceToolOptions = set of TTextReplaceToolOption;
TCustomTextReplaceTool = class(TCustomTextConverterTool)
private
FOptions: TTextReplaceToolOptions;
FReplaceWith: string;
FSearchFor: string;
procedure SetOptions(const AValue: TTextReplaceToolOptions);
procedure SetReplaceWith(const AValue: string);
procedure SetSearchFor(const AValue: string);
public
function Execute(aText: TIDETextConverter): TModalResult; override;
procedure Assign(Source: TPersistent); override;
property SearchFor: string read FSearchFor write SetSearchFor;
property ReplaceWith: string read FReplaceWith write SetReplaceWith;
property Options: TTextReplaceToolOptions read FOptions write SetOptions;
end;
{ TTextReplaceTool }
TTextReplaceTool = class(TCustomTextReplaceTool)
published
property SearchFor;
property ReplaceWith;
property Options;
end;
{ TTextConverterToolClasses
A list to hold the registered TCustomTextConverterToolClass(es) }
TTextConverterToolClasses = class
private
FItems: TFPList;// list of TCustomTextConverterToolClass
function GetCount: integer;
function GetItems(Index: integer): TCustomTextConverterToolClass;
public
constructor Create;
destructor Destroy; override;
procedure RegisterClass(AClass: TCustomTextConverterToolClass);
procedure UnregisterClass(AClass: TCustomTextConverterToolClass);
function FindByName(const aClassName: string): TCustomTextConverterToolClass;
procedure FindClass(Reader: TReader; const aClassName: string;
var ComponentClass: TComponentClass);
property Items[Index: integer]: TCustomTextConverterToolClass read GetItems; default;
property Count: integer read GetCount;
end;
var
TextConverterToolClasses: TTextConverterToolClasses = nil;// set by the IDE
implementation
{ TIDETextConverter }
procedure TIDETextConverter.SetFilename(const AValue: string);
begin
SaveToFile(AValue);
end;
function TIDETextConverter.GetFilename: string;
begin
CurrentType:=tctFile;
Result:=FFilename;
end;
function TIDETextConverter.GetSource: string;
begin
CurrentType:=tctSource;
Result:=FSource;
end;
function TIDETextConverter.GetStrings: TStrings;
begin
CurrentType:=tctStrings;
Result:=FStrings;
end;
procedure TIDETextConverter.SetSource(const AValue: string);
begin
FCurrentType:=tctSource;
FSource:=AValue;
end;
procedure TIDETextConverter.SetStrings(const AValue: TStrings);
begin
FCurrentType:=tctStrings;
FStrings:=AValue;
end;
procedure TIDETextConverter.SetCurrentType(const AValue: TTextConverterType);
var
fs: TFileStream;
begin
if FCurrentType=AValue then exit;
case AValue of
tctSource:
// convert to Source
begin
FSource:='';
case FCurrentType of
tctStrings:
if FStrings<>nil then begin
FSource:=FStrings.Text;
FreeAndNil(FStrings);
end;
tctFile:
if FileExists(FFilename) then begin
fs:=TFileStream.Create(FFilename,fmCreate);
try
SetLength(FSource,fs.Size);
fs.Read(FSource[1],length(FSource));
finally
fs.Free;
end;
if FileIsTemporary then begin
DeleteFile(FFilename);
end;
end;
end;
end;
tctStrings:
// convert to TStrings
begin
if FStrings<>nil then
RaiseGDBException('TTextConverterText.SetCurrentType FStrings<>nil');
FStrings:=TStringList.Create;
case FCurrentType of
tctSource:
begin
FStrings.Text:=FSource;
FSource:='';
end;
tctFile:
if FileExists(FFilename) then begin
FStrings.LoadFromFile(FFilename);
if FileIsTemporary then begin
DeleteFile(FFilename);
end;
end;
end;
end;
tctFile:
// convert to File
begin
if FFilename='' then
CreateTempFilename;
case FCurrentType of
tctSource:
begin
fs:=TFileStream.Create(FFilename,fmCreate);
try
if FSource<>'' then begin
fs.Write(FSource[1],length(FSource));
FSource:='';
end;
finally
fs.Free;
end;
end;
tctStrings:
if FStrings<>nil then begin
FStrings.SaveToFile(FFilename);
FreeAndNil(FStrings);
end;
end;
end;
end;
FCurrentType:=AValue;
end;
procedure TIDETextConverter.SetFileIsTemporary(const AValue: boolean);
begin
if FFileIsTemporary=AValue then exit;
FFileIsTemporary:=AValue;
end;
procedure TIDETextConverter.SaveToFile(const NewFilename: string);
var
fs: TFileStream;
TrimmedFilename: String;
begin
TrimmedFilename:=TrimFilename(NewFilename);
case CurrentType of
tctFile:
if (FFilename<>'') and (FFilename<>TrimmedFilename)
and (FileExists(FFilename)) then
RenameFile(FFilename,TrimmedFilename);
tctSource:
begin
fs:=TFileStream.Create(TrimmedFilename,fmCreate);
try
if FSource<>'' then
fs.Write(FSource[1],length(FSource));
finally
fs.Free;
end;
end;
tctStrings:
begin
fStrings.SaveToFile(TrimmedFilename);
end;
end;
FCurrentType:=tctFile;
FFilename:=TrimmedFilename;
end;
procedure TIDETextConverter.CreateTempFilename;
begin
FFilename:=GetTempFilename;
FFileIsTemporary:=true;
end;
constructor TIDETextConverter.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FCurrentType:=tctSource;
end;
destructor TIDETextConverter.Destroy;
begin
inherited Destroy;
end;
function TIDETextConverter.Execute(ToolList: TComponent): TModalResult;
var
i: Integer;
Tool: TCustomTextConverterTool;
CurResult: TModalResult;
begin
Result:=mrOk;
for i:=0 to ToolList.ComponentCount-1 do begin
if ToolList.Components[i] is TCustomTextConverterTool then begin
Tool:=TCustomTextConverterTool(ToolList.Components[i]);
CurResult:=Tool.Execute(Self);
if CurResult=mrIgnore then
Result:=mrCancel
else if CurResult<>mrOk then
exit(mrAbort);
end;
end;
end;
{ TCustomTextConverterTool }
procedure TCustomTextConverterTool.SetCaption(const AValue: string);
begin
if FCaption=AValue then exit;
FCaption:=AValue;
end;
procedure TCustomTextConverterTool.SetDescription(const AValue: string);
begin
if FDescription=AValue then exit;
FDescription:=AValue;
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
inherited Assign(Source);
end;
{ TCustomTextReplaceTool }
procedure TCustomTextReplaceTool.SetOptions(
const AValue: TTextReplaceToolOptions);
begin
if FOptions=AValue then exit;
FOptions:=AValue;
end;
procedure TCustomTextReplaceTool.SetReplaceWith(const AValue: string);
begin
if FReplaceWith=AValue then exit;
FReplaceWith:=AValue;
end;
procedure TCustomTextReplaceTool.SetSearchFor(const AValue: string);
begin
if FSearchFor=AValue then exit;
FSearchFor:=AValue;
end;
function TCustomTextReplaceTool.Execute(aText: TIDETextConverter
): TModalResult;
var
Source: String;
Flags: TSrcEditSearchOptions;
Prompt: Boolean;
begin
Result:=mrCancel;
if aText=nil then exit;
Source:=aText.Source;
Flags:=[];
if trtMatchCase in Options then Include(Flags,sesoMatchCase);
if trtWholeWord in Options then Include(Flags,sesoWholeWord);
if trtRegExpr in Options then Include(Flags,sesoRegExpr);
if trtMultiLine in Options then Include(Flags,sesoMultiLine);
Prompt:=false;
Result:=IDESearchInText('',Source,SearchFor,ReplaceWith,Flags,Prompt,nil);
if Result=mrOk then
aText.Source:=Source;
end;
procedure TCustomTextReplaceTool.Assign(Source: TPersistent);
var
Src: TCustomTextReplaceTool;
begin
if Source is TCustomTextReplaceTool then begin
Src:=TCustomTextReplaceTool(Source);
SearchFor:=Src.SearchFor;
ReplaceWith:=Src.ReplaceWith;
Options:=Src.Options;
end;
inherited Assign(Source);
end;
{ TTextConverterToolClasses }
function TTextConverterToolClasses.GetCount: integer;
begin
Result:=FItems.Count;
end;
function TTextConverterToolClasses.GetItems(Index: integer
): TCustomTextConverterToolClass;
begin
Result:=TCustomTextConverterToolClass(FItems[Index]);
end;
constructor TTextConverterToolClasses.Create;
begin
FItems:=TFPList.Create;
end;
destructor TTextConverterToolClasses.Destroy;
begin
FItems.Clear;
FreeAndNil(FItems);
inherited Destroy;
end;
procedure TTextConverterToolClasses.RegisterClass(
AClass: TCustomTextConverterToolClass);
begin
if FItems.IndexOf(AClass)<0 then
FItems.Add(AClass);
end;
procedure TTextConverterToolClasses.UnregisterClass(
AClass: TCustomTextConverterToolClass);
begin
FItems.Remove(AClass);
end;
function TTextConverterToolClasses.FindByName(const aClassName: string
): TCustomTextConverterToolClass;
var
i: Integer;
begin
for i:=0 to FItems.Count-1 do begin
Result:=Items[i];
if CompareText(Result.ClassName,aClassName)=0 then exit;
end;
Result:=nil;
end;
procedure TTextConverterToolClasses.FindClass(Reader: TReader;
const aClassName: string; var ComponentClass: TComponentClass);
begin
if Reader=nil then ;
ComponentClass:=FindByName(aClassName);
end;
end.

View File

@ -171,9 +171,11 @@ type
function GetSecondaryConfigPath: String; virtual; abstract;
procedure CopySecondaryConfigFile(const AFilename: String); virtual; abstract;
// filenames, paths
function CreateNewUniqueFilename(const Prefix, Ext: string;
NewOwner: TObject; Flags: TSearchIDEFileFlags;
TryWithoutNumber: boolean): string; virtual; abstract;
function GetTestBuildDirectory: string; virtual; abstract;
// macros
function SubstituteMacros(var s: string): boolean; virtual; abstract;

View File

@ -23,9 +23,18 @@ uses
Classes, SysUtils, LCLProc, FileUtil, Forms, Controls, ProjectIntf;
type
TSrcEditSearchOption = (sesoMatchCase, sesoWholeWord, sesoBackwards,
sesoEntireScope, sesoSelectedOnly, sesoReplace, sesoReplaceAll, sesoPrompt,
sesoRegExpr, sesoRegExprMultiLine);
TSrcEditSearchOption = (
sesoMatchCase,
sesoWholeWord,
sesoBackwards,
sesoEntireScope,
sesoSelectedOnly,
sesoReplace,
sesoReplaceAll,
sesoPrompt,
sesoRegExpr,
sesoMultiLine
);
TSrcEditSearchOptions = set of TSrcEditSearchOption;
TSrcEditReplaceAction = (seraCancel, seraSkip, seraReplace, seraReplaceAll);
@ -224,6 +233,37 @@ function RegisterCodeMacro(const Name: string;
OnGetValueMethod: TIDECodeMacroGetValueMethod): TIDECodeMacro;
{ SearchInFile to search in a file.
This can be interactively or without user interaction.
If the file is open in the source editor, changes will be added to the undo
history.
}
type
TIDESearchInTextAddMatch = procedure(const Filename: string;
const StartPos, EndPos: TPoint;
const Lines: string) of object;
{ TIDESearchInTextProgress }
TIDESearchInTextProgress = class
private
FAbort: boolean;
FOnAddMatch: TIDESearchInTextAddMatch;
protected
procedure SetAbort(const AValue: boolean); virtual;
public
property Abort: boolean read FAbort write SetAbort;
property OnAddMatch: TIDESearchInTextAddMatch read FOnAddMatch write FOnAddMatch;
end;
TIDESearchInTextFunction = function(const TheFileName: string;
var TheText: string;// if TheFileName='' then use TheText
SearchFor, ReplaceText: string; Flags: TSrcEditSearchOptions;
var Prompt: boolean; Progress: TIDESearchInTextProgress = nil): TModalResult;
var
IDESearchInText: TIDESearchInTextFunction = nil;// set by the IDE
implementation
function RegisterCodeMacro(const Name: string; const ShortDescription,
@ -302,5 +342,13 @@ begin
Result:=nil;
end;
{ TIDESearchInTextProgress }
procedure TIDESearchInTextProgress.SetAbort(const AValue: boolean);
begin
if FAbort=AValue then exit;
fAbort:=AValue;
end;
end.

View File

@ -87,6 +87,8 @@ function GetPathElement(const Path: string; StartPos: integer;
Stopper: char): string;
//------------------------------------------------------------------------------
// Internal stuff.

View File

@ -22,7 +22,7 @@ unit LazConfigStorage;
interface
uses
Classes, SysUtils;
Classes, SysUtils;
type
{ TConfigStorage }

View File

@ -36,7 +36,8 @@ unit LResources;
interface
uses
Classes, SysUtils, Types, FPCAdds, TypInfo, DynQueue, LCLProc, LCLStrConsts;
Classes, SysUtils, Types, FPCAdds, TypInfo, DynQueue, LCLProc, LCLStrConsts,
LazConfigStorage;
type
{ TLResourceList }
@ -269,11 +270,22 @@ function GetClassNameFromLRSStream(s: TStream; out IsInherited: Boolean): shorts
procedure GetComponentInfoFromLRSStream(s: TStream;
out ComponentName, ComponentClassName: string;
out IsInherited: Boolean);
procedure WriteComponentAsBinaryToStream(AStream: TStream; AComponent: TComponent);
procedure WriteComponentAsBinaryToStream(AStream: TStream;
AComponent: TComponent);
procedure ReadComponentFromBinaryStream(AStream: TStream;
var RootComponent: TComponent;
OnFindComponentClass: TFindComponentClassEvent;
TheOwner: TComponent = nil);
procedure SaveComponentToConfig(Config: TConfigStorage; const Path: string;
AComponent: TComponent);
procedure LoadComponentFromConfig(Config: TConfigStorage; const Path: string;
var RootComponent: TComponent;
OnFindComponentClass: TFindComponentClassEvent;
TheOwner: TComponent = nil);
function CompareComponents(Component1, Component2: TComponent): boolean;
function CompareMemStreams(Stream1, Stream2: TCustomMemoryStream): boolean;
procedure BinaryToLazarusResourceCode(BinStream, ResStream: TStream;
const ResourceName, ResourceType: String);
@ -588,6 +600,120 @@ begin
end;
end;
procedure SaveComponentToConfig(Config: TConfigStorage; const Path: string;
AComponent: TComponent);
var
BinStream: TMemoryStream;
TxtStream: TMemoryStream;
s: string;
begin
BinStream:=nil;
TxtStream:=nil;
try
// write component to stream
BinStream:=TMemoryStream.Create;
WriteComponentAsBinaryToStream(BinStream,AComponent);
// convert it to human readable text format
BinStream.Position:=0;
TxtStream:=TMemoryStream.Create;
LRSObjectBinaryToText(BinStream,TxtStream);
// convert stream to string
SetLength(s,TxtStream.Size);
TxtStream.Position:=0;
if s<>'' then
TxtStream.Read(s[1],length(s));
// write to config
Config.SetDeleteValue(Path,s,'');
finally
BinStream.Free;
TxtStream.Free;
end;
end;
procedure LoadComponentFromConfig(Config: TConfigStorage; const Path: string;
var RootComponent: TComponent;
OnFindComponentClass: TFindComponentClassEvent; TheOwner: TComponent);
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);
// create component from stream
ReadComponentFromBinaryStream(BinStream,RootComponent,OnFindComponentClass,
TheOwner);
finally
BinStream.Free;
TxtStream.Free;
end;
end;
function CompareComponents(Component1, Component2: TComponent): boolean;
var
Stream1: TMemoryStream;
Stream2: TMemoryStream;
i: Integer;
begin
if Component1=Component2 then exit(true);
Result:=false;
// quick checks
if (Component1=nil) or (Component2=nil) then exit;
if (Component1.ClassType<>Component2.ClassType) then exit;
if Component1.ComponentCount<>Component2.ComponentCount then exit;
for i:=0 to Component1.ComponentCount-1 do begin
if Component1.Components[i].ClassType<>Component2.Components[i].ClassType
then exit;
end;
// expensive streaming test
try
Stream1:=nil;
Stream2:=nil;
try
Stream1:=TMemoryStream.Create;
WriteComponentAsBinaryToStream(Stream1,Component1);
Stream2:=TMemoryStream.Create;
WriteComponentAsBinaryToStream(Stream2,Component2);
Result:=CompareMemStreams(Stream1,Stream2);
finally
Stream1.Free;
Stream2.Free;
end;
except
end;
end;
function CompareMemStreams(Stream1, Stream2: TCustomMemoryStream
): boolean;
var
Buffer1, Buffer2: array[1..1024] of byte;
BufLength: Integer;
Count: LongInt;
begin
if Stream1=Stream2 then exit(true);
Result:=false;
if (Stream1=nil) or (Stream2=nil) then exit;
if Stream1.Size<>Stream2.Size then exit;
Stream1.Position:=0;
Stream2.Position:=0;
BufLength:=High(Buffer1)-Low(Buffer1)+1;
repeat
Count:=Stream1.Read(Buffer1[1],BufLength);
if Count=0 then exit(true);
Stream2.Read(Buffer2[1],BufLength);
if not CompareMem(@Buffer1[1],@Buffer2[1],Count) then exit;
until false;
end;
procedure BinaryToLazarusResourceCode(BinStream,ResStream:TStream;
const ResourceName, ResourceType: String);
{ example ResStream: