codepageconverter example allowsnow to select files

git-svn-id: trunk@7606 -
This commit is contained in:
mattias 2005-08-31 07:51:07 +00:00
parent 8bcd2298e6
commit 3029bd9362
7 changed files with 136 additions and 315 deletions

View File

@ -8,4 +8,3 @@
230 230
208 208
240 240

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<PathDelim Value="/"/> <PathDelim Value="\"/>
<Version Value="5"/> <Version Value="5"/>
<General> <General>
<Flags> <Flags>
@ -9,10 +9,10 @@
<SaveOnlyProjectUnits Value="True"/> <SaveOnlyProjectUnits Value="True"/>
</Flags> </Flags>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<ActiveEditorIndexAtStart Value="0"/>
<IconPath Value="./"/> <IconPath Value="./"/>
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Title Value="lazconverter"/> <Title Value="lazconverter"/>
<ActiveEditorIndexAtStart Value="0"/>
</General> </General>
<Units Count="2"> <Units Count="2">
<Unit0> <Unit0>
@ -21,31 +21,31 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UnitName Value="lazconverter"/> <UnitName Value="lazconverter"/>
<UsageCount Value="32"/> <UsageCount Value="36"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<CursorPos X="23" Y="61"/> <CursorPos X="1" Y="286"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<Filename Value="mainunit.pas"/> <Filename Value="mainunit.pas"/>
<ComponentName Value="LazConverterForm"/> <ComponentName Value="LazConverterForm"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<ResourceFilename Value="mainunit.lrs"/> <ResourceFilename Value="mainunit.lrs"/>
<TopLine Value="47"/> <TopLine Value="109"/>
<UnitName Value="mainunit"/> <UnitName Value="mainunit"/>
<UsageCount Value="32"/> <UsageCount Value="36"/>
</Unit1> </Unit1>
</Units> </Units>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<DestinationDirectory Value="/home/barko/tempo/out/"/> <DestinationDirectory Value="\home\barko\tempo\out\"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions> </PublishOptions>
<RunParams> <RunParams>
<local> <local>
<FormatVersion Value="1"/> <FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local> </local>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="2">
@ -60,8 +60,9 @@
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="5"/> <Version Value="5"/>
<PathDelim Value="\"/>
<SearchPaths> <SearchPaths>
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/> <SrcPath Value="$(LazarusDir)\lcl\;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)\"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>
<SyntaxOptions> <SyntaxOptions>

View File

@ -1,26 +1,27 @@
object LazConverterForm: TLazConverterForm object LazConverterForm: TLazConverterForm
Caption = 'Codepage LazConverter for PAS, LFM, LRS & INC files v0.0.5' Caption = 'Codepage LazConverter for PAS, LFM, LRS, LRT & INC files v0.0.6'
ClientHeight = 463 ClientHeight = 463
ClientWidth = 612 ClientWidth = 578
Constraints.MinHeight = 463 Constraints.MinHeight = 463
Constraints.MinWidth = 578 Constraints.MinWidth = 578
OnShow = Form1Show OnShow = Form1Show
PixelsPerInch = 95 PixelsPerInch = 96
Position = poScreenCenter Position = poScreenCenter
HorzScrollBar.Page = 611 HorzScrollBar.Page = 577
VertScrollBar.Page = 462 VertScrollBar.Page = 462
Left = 322 Left = 286
Height = 463 Height = 463
Top = 225 Top = 118
Width = 612 Width = 578
object Panel1: TPanel object Panel1: TPanel
Align = alTop
BorderSpacing.OnChange = nil BorderSpacing.OnChange = nil
ClientHeight = 192 ClientHeight = 200
ClientWidth = 612 ClientWidth = 578
FullRepaint = False FullRepaint = False
TabOrder = 0 TabOrder = 0
Height = 192 Height = 200
Width = 612 Width = 578
object Label1: TLabel object Label1: TLabel
BorderSpacing.OnChange = nil BorderSpacing.OnChange = nil
Caption = 'Path to your project:' Caption = 'Path to your project:'
@ -56,7 +57,7 @@ object LazConverterForm: TLazConverterForm
Left = 8 Left = 8
Height = 17 Height = 17
Top = 149 Top = 149
Width = 593 Width = 559
end end
object Edit1: TEdit object Edit1: TEdit
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
@ -65,7 +66,7 @@ object LazConverterForm: TLazConverterForm
Left = 8 Left = 8
Height = 23 Height = 23
Top = 32 Top = 32
Width = 513 Width = 479
end end
object Button1: TButton object Button1: TButton
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
@ -73,7 +74,7 @@ object LazConverterForm: TLazConverterForm
Caption = 'Path' Caption = 'Path'
OnClick = Button1Click OnClick = Button1Click
TabOrder = 1 TabOrder = 1
Left = 530 Left = 496
Height = 23 Height = 23
Top = 32 Top = 32
Width = 75 Width = 75
@ -81,36 +82,26 @@ object LazConverterForm: TLazConverterForm
object ComboBox1: TComboBox object ComboBox1: TComboBox
BorderSpacing.OnChange = nil BorderSpacing.OnChange = nil
MaxLength = 0 MaxLength = 0
TabOrder = 3 TabOrder = 2
Left = 8 Left = 8
Height = 25 Height = 21
Top = 80 Top = 80
Width = 200 Width = 200
end end
object ComboBox2: TComboBox object ComboBox2: TComboBox
BorderSpacing.OnChange = nil BorderSpacing.OnChange = nil
MaxLength = 0 MaxLength = 0
TabOrder = 6 TabOrder = 5
Left = 216 Left = 216
Height = 25 Height = 21
Top = 80 Top = 80
Width = 200 Width = 200
end end
object CheckBox1: TCheckBox
AllowGrayed = True
BorderSpacing.OnChange = nil
Caption = 'Include subdirectories'
TabOrder = 2
Left = 424
Height = 23
Top = 80
Width = 176
end
object Button2: TButton object Button2: TButton
BorderSpacing.OnChange = nil BorderSpacing.OnChange = nil
Caption = 'Search' Caption = 'Search'
OnClick = Button2Click OnClick = Button2Click
TabOrder = 4 TabOrder = 3
Left = 8 Left = 8
Height = 25 Height = 25
Top = 112 Top = 112
@ -120,7 +111,7 @@ object LazConverterForm: TLazConverterForm
BorderSpacing.OnChange = nil BorderSpacing.OnChange = nil
Caption = 'Convert' Caption = 'Convert'
OnClick = Button3Click OnClick = Button3Click
TabOrder = 5 TabOrder = 4
Left = 88 Left = 88
Height = 25 Height = 25
Top = 112 Top = 112
@ -130,24 +121,21 @@ object LazConverterForm: TLazConverterForm
Align = alBottom Align = alBottom
BorderSpacing.OnChange = nil BorderSpacing.OnChange = nil
Max = 100 Max = 100
TabOrder = 7 TabOrder = 6
TabStop = True TabStop = True
Left = 1 Left = 1
Height = 17 Height = 17
Top = 174 Top = 182
Width = 610 Width = 576
end end
end end
object Memo1: TMemo object FileListBox1: TFileListBox
Align = alBottom Align = alClient
Anchors = [akTop, akLeft, akRight, akBottom] PopupMenu = PopupMenu1
BorderSpacing.OnChange = nil
ReadOnly = True
TabOrder = 1 TabOrder = 1
WordWrap = False
Height = 263 Height = 263
Top = 200 Top = 200
Width = 612 Width = 578
end end
object SelectDirectoryDialog1: TSelectDirectoryDialog object SelectDirectoryDialog1: TSelectDirectoryDialog
Title = 'Select Directory' Title = 'Select Directory'
@ -156,4 +144,12 @@ object LazConverterForm: TLazConverterForm
left = 8 left = 8
top = 480 top = 480
end end
object PopupMenu1: TPopupMenu
left = 272
top = 123
object MenuItem1: TMenuItem
Caption = 'Remove from conversion'
OnClick = MenuItem1Click
end
end
end end

View File

@ -1,46 +1,45 @@
{ This is an automatically generated lazarus resource file } { This is an automatically generated lazarus resource file }
LazarusResources.Add('TLazConverterForm','FORMDATA',[ LazarusResources.Add('TLazConverterForm','FORMDATA',[
'TPF0'#17'TLazConverterForm'#16'LazConverterForm'#7'Caption'#6':Codepage LazC' 'TPF0'#17'TLazConverterForm'#16'LazConverterForm'#7'Caption'#6'?Codepage LazC'
+'onverter for PAS, LFM, LRS & INC files v0.0.5'#12'ClientHeight'#3#207#1#11 +'onverter for PAS, LFM, LRS, LRT & INC files v0.0.6'#12'ClientHeight'#3#207#1
+'ClientWidth'#3'd'#2#21'Constraints.MinHeight'#3#207#1#20'Constraints.MinWid' +#11'ClientWidth'#3'B'#2#21'Constraints.MinHeight'#3#207#1#20'Constraints.Min'
+'th'#3'B'#2#6'OnShow'#7#9'Form1Show'#13'PixelsPerInch'#2'_'#8'Position'#7#14 +'Width'#3'B'#2#6'OnShow'#7#9'Form1Show'#13'PixelsPerInch'#2'`'#8'Position'#7
+'poScreenCenter'#18'HorzScrollBar.Page'#3'c'#2#18'VertScrollBar.Page'#3#206#1 +#14'poScreenCenter'#18'HorzScrollBar.Page'#3'A'#2#18'VertScrollBar.Page'#3
+#4'Left'#3'B'#1#6'Height'#3#207#1#3'Top'#3#225#0#5'Width'#3'd'#2#0#6'TPanel' +#206#1#4'Left'#3#30#1#6'Height'#3#207#1#3'Top'#2'v'#5'Width'#3'B'#2#0#6'TPan'
+#6'Panel1'#22'BorderSpacing.OnChange'#13#12'ClientHeight'#3#192#0#11'ClientW' +'el'#6'Panel1'#5'Align'#7#5'alTop'#22'BorderSpacing.OnChange'#13#12'ClientHe'
+'idth'#3'd'#2#11'FullRepaint'#8#8'TabOrder'#2#0#6'Height'#3#192#0#5'Width'#3 +'ight'#3#200#0#11'ClientWidth'#3'B'#2#11'FullRepaint'#8#8'TabOrder'#2#0#6'He'
+'d'#2#0#6'TLabel'#6'Label1'#22'BorderSpacing.OnChange'#13#7'Caption'#6#21'Pa' +'ight'#3#200#0#5'Width'#3'B'#2#0#6'TLabel'#6'Label1'#22'BorderSpacing.OnChan'
+'th to your project:'#5'Color'#7#6'clNone'#4'Left'#2#8#6'Height'#2#19#3'Top' +'ge'#13#7'Caption'#6#21'Path to your project:'#5'Color'#7#6'clNone'#4'Left'#2
+#2#16#5'Width'#3#168#0#0#0#6'TLabel'#6'Label2'#22'BorderSpacing.OnChange'#13 +#8#6'Height'#2#19#3'Top'#2#16#5'Width'#3#168#0#0#0#6'TLabel'#6'Label2'#22'Bo'
+#7'Caption'#6#13'Convert From:'#5'Color'#7#6'clNone'#4'Left'#2#8#6'Height'#2 +'rderSpacing.OnChange'#13#7'Caption'#6#13'Convert From:'#5'Color'#7#6'clNone'
+#15#3'Top'#2'@'#5'Width'#3#159#0#0#0#6'TLabel'#6'Label3'#22'BorderSpacing.On' +#4'Left'#2#8#6'Height'#2#15#3'Top'#2'@'#5'Width'#3#159#0#0#0#6'TLabel'#6'Lab'
+'Change'#13#7'Caption'#6#11'Convert To:'#5'Color'#7#6'clNone'#4'Left'#3#216#0 +'el3'#22'BorderSpacing.OnChange'#13#7'Caption'#6#11'Convert To:'#5'Color'#7#6
+#6'Height'#2#15#3'Top'#2'@'#5'Width'#2'{'#0#0#6'TLabel'#6'Label6'#7'Anchors' +'clNone'#4'Left'#3#216#0#6'Height'#2#15#3'Top'#2'@'#5'Width'#2'{'#0#0#6'TLab'
+#11#5'akTop'#6'akLeft'#7'akRight'#0#22'BorderSpacing.OnChange'#13#7'Caption' +'el'#6'Label6'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#22'BorderSpacin'
+#6#8'Ready...'#5'Color'#7#6'clNone'#4'Left'#2#8#6'Height'#2#17#3'Top'#3#149#0 +'g.OnChange'#13#7'Caption'#6#8'Ready...'#5'Color'#7#6'clNone'#4'Left'#2#8#6
+#5'Width'#3'Q'#2#0#0#5'TEdit'#5'Edit1'#7'Anchors'#11#5'akTop'#6'akLeft'#7'ak' +'Height'#2#17#3'Top'#3#149#0#5'Width'#3'/'#2#0#0#5'TEdit'#5'Edit1'#7'Anchors'
+'Right'#0#22'BorderSpacing.OnChange'#13#8'TabOrder'#2#0#4'Left'#2#8#6'Height' +#11#5'akTop'#6'akLeft'#7'akRight'#0#22'BorderSpacing.OnChange'#13#8'TabOrder'
+#2#23#3'Top'#2' '#5'Width'#3#1#2#0#0#7'TButton'#7'Button1'#7'Anchors'#11#5'a' +#2#0#4'Left'#2#8#6'Height'#2#23#3'Top'#2' '#5'Width'#3#223#1#0#0#7'TButton'#7
+'kTop'#7'akRight'#0#22'BorderSpacing.OnChange'#13#7'Caption'#6#4'Path'#7'OnC' +'Button1'#7'Anchors'#11#5'akTop'#7'akRight'#0#22'BorderSpacing.OnChange'#13#7
+'lick'#7#12'Button1Click'#8'TabOrder'#2#1#4'Left'#3#18#2#6'Height'#2#23#3'To' +'Caption'#6#4'Path'#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#1#4'Left'#3
+'p'#2' '#5'Width'#2'K'#0#0#9'TComboBox'#9'ComboBox1'#22'BorderSpacing.OnChan' +#240#1#6'Height'#2#23#3'Top'#2' '#5'Width'#2'K'#0#0#9'TComboBox'#9'ComboBox1'
+'ge'#13#9'MaxLength'#2#0#8'TabOrder'#2#3#4'Left'#2#8#6'Height'#2#25#3'Top'#2 +#22'BorderSpacing.OnChange'#13#9'MaxLength'#2#0#8'TabOrder'#2#2#4'Left'#2#8#6
+'P'#5'Width'#3#200#0#0#0#9'TComboBox'#9'ComboBox2'#22'BorderSpacing.OnChange' +'Height'#2#21#3'Top'#2'P'#5'Width'#3#200#0#0#0#9'TComboBox'#9'ComboBox2'#22
+#13#9'MaxLength'#2#0#8'TabOrder'#2#6#4'Left'#3#216#0#6'Height'#2#25#3'Top'#2 +'BorderSpacing.OnChange'#13#9'MaxLength'#2#0#8'TabOrder'#2#5#4'Left'#3#216#0
+'P'#5'Width'#3#200#0#0#0#9'TCheckBox'#9'CheckBox1'#11'AllowGrayed'#9#22'Bord' +#6'Height'#2#21#3'Top'#2'P'#5'Width'#3#200#0#0#0#7'TButton'#7'Button2'#22'Bo'
+'erSpacing.OnChange'#13#7'Caption'#6#22'Include subdirectories'#8'TabOrder'#2 +'rderSpacing.OnChange'#13#7'Caption'#6#6'Search'#7'OnClick'#7#12'Button2Clic'
+#2#4'Left'#3#168#1#6'Height'#2#23#3'Top'#2'P'#5'Width'#3#176#0#0#0#7'TButton' +'k'#8'TabOrder'#2#3#4'Left'#2#8#6'Height'#2#25#3'Top'#2'p'#5'Width'#2'K'#0#0
+#7'Button2'#22'BorderSpacing.OnChange'#13#7'Caption'#6#6'Search'#7'OnClick'#7 +#7'TButton'#7'Button3'#22'BorderSpacing.OnChange'#13#7'Caption'#6#7'Convert'
+#12'Button2Click'#8'TabOrder'#2#4#4'Left'#2#8#6'Height'#2#25#3'Top'#2'p'#5'W' +#7'OnClick'#7#12'Button3Click'#8'TabOrder'#2#4#4'Left'#2'X'#6'Height'#2#25#3
+'idth'#2'K'#0#0#7'TButton'#7'Button3'#22'BorderSpacing.OnChange'#13#7'Captio' +'Top'#2'p'#5'Width'#2'{'#0#0#12'TProgressBar'#12'ProgressBar1'#5'Align'#7#8
+'n'#6#7'Convert'#7'OnClick'#7#12'Button3Click'#8'TabOrder'#2#5#4'Left'#2'X'#6 +'alBottom'#22'BorderSpacing.OnChange'#13#3'Max'#2'd'#8'TabOrder'#2#6#7'TabSt'
+'Height'#2#25#3'Top'#2'p'#5'Width'#2'{'#0#0#12'TProgressBar'#12'ProgressBar1' +'op'#9#4'Left'#2#1#6'Height'#2#17#3'Top'#3#182#0#5'Width'#3'@'#2#0#0#0#12'TF'
+#5'Align'#7#8'alBottom'#22'BorderSpacing.OnChange'#13#3'Max'#2'd'#8'TabOrder' +'ileListBox'#12'FileListBox1'#5'Align'#7#8'alClient'#9'PopupMenu'#7#10'Popup'
+#2#7#7'TabStop'#9#4'Left'#2#1#6'Height'#2#17#3'Top'#3#174#0#5'Width'#3'b'#2#0 +'Menu1'#8'TabOrder'#2#1#6'Height'#3#7#1#3'Top'#3#200#0#5'Width'#3'B'#2#0#0#22
+#0#0#5'TMemo'#5'Memo1'#5'Align'#7#8'alBottom'#7'Anchors'#11#5'akTop'#6'akLef' +'TSelectDirectoryDialog'#22'SelectDirectoryDialog1'#5'Title'#6#16'Select Dir'
+'t'#7'akRight'#8'akBottom'#0#22'BorderSpacing.OnChange'#13#8'ReadOnly'#9#8'T' +'ectory'#11'FilterIndex'#2#0#5'Title'#6#16'Select Directory'#4'left'#2#8#3't'
+'abOrder'#2#1#8'WordWrap'#8#6'Height'#3#7#1#3'Top'#3#200#0#5'Width'#3'd'#2#0 +'op'#3#224#1#0#0#10'TPopupMenu'#10'PopupMenu1'#4'left'#3#16#1#3'top'#2'{'#0#9
+#0#22'TSelectDirectoryDialog'#22'SelectDirectoryDialog1'#5'Title'#6#16'Selec' +'TMenuItem'#9'MenuItem1'#7'Caption'#6#22'Remove from conversion'#7'OnClick'#7
+'t Directory'#11'FilterIndex'#2#0#5'Title'#6#16'Select Directory'#4'left'#2#8 +#14'MenuItem1Click'#0#0#0#0
+#3'top'#3#224#1#0#0#0
]); ]);

View File

@ -1,15 +1,9 @@
TLAZCONVERTERFORM.CAPTION=Codepage LazConverter for PAS, LFM, LRS & INC files v0.0.4 TLAZCONVERTERFORM.CAPTION=Codepage LazConverter for PAS, LFM, LRS, LRT & INC files v0.0.6
TLABEL.CAPTION=Path to your project: TLABEL.CAPTION=Path to your project:
TBUTTON.CAPTION=Path
TLABEL.CAPTION=Convert From: TLABEL.CAPTION=Convert From:
TLABEL.CAPTION=Convert To: TLABEL.CAPTION=Convert To:
TCHECKBOX.CAPTION=Include subdirectories TLABEL.CAPTION=Ready...
TBUTTON.CAPTION=Path
TBUTTON.CAPTION=Search TBUTTON.CAPTION=Search
TBUTTON.CAPTION=Convert TBUTTON.CAPTION=Convert
TLABEL.CAPTION=Directory: TMENUITEM.CAPTION=Remove from conversion
TLABEL.CAPTION=Ready...
TBUTTON.CAPTION=Remove from conversion
TBUTTON.CAPTION=View
TMENUITEM.CAPTION=View File
TMENUITEM.CAPTION=-
TMENUITEM.CAPTION=Remove From Conversion

View File

@ -28,7 +28,7 @@ interface
uses uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls, Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, Buttons, ComCtrls, Menus StdCtrls, Buttons, ComCtrls, Menus
{$IFDEF TRANSLATESTRING}, DefaultTranslator{$ENDIF}; {$IFDEF TRANSLATESTRING}, DefaultTranslator{$ENDIF}, FileCtrl;
type type
@ -38,32 +38,35 @@ type
Button1: TButton; Button1: TButton;
Button2: TButton; Button2: TButton;
Button3: TButton; Button3: TButton;
CheckBox1: TCheckBox;
ComboBox1: TComboBox; ComboBox1: TComboBox;
ComboBox2: TComboBox; ComboBox2: TComboBox;
Edit1: TEdit; Edit1: TEdit;
FileListBox1: TFileListBox;
Label1: TLabel; Label1: TLabel;
Label2: TLabel; Label2: TLabel;
Label3: TLabel; Label3: TLabel;
Label6: TLabel; Label6: TLabel;
Memo1: TMemo; MenuItem1: TMenuItem;
Panel1: TPanel; Panel1: TPanel;
PopupMenu1: TPopupMenu;
ProgressBar1: TProgressBar; ProgressBar1: TProgressBar;
SelectDirectoryDialog1: TSelectDirectoryDialog; SelectDirectoryDialog1: TSelectDirectoryDialog;
procedure Button1Click(Sender: TObject); procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject); procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject); procedure Button3Click(Sender: TObject);
procedure Form1Show(Sender: TObject); procedure Form1Show(Sender: TObject);
procedure MenuItem1Click(Sender: TObject);
private private
{ private declarations } { private declarations }
public public
{ public declarations } { public declarations }
procedure CountFiles;
end; end;
var var
LazConverterForm: TLazConverterForm; LazConverterForm: TLazConverterForm;
allfiles:tstringlist;
const msgdone = 'Searching done... press CONVERT button! Files: ';
implementation implementation
@ -83,218 +86,34 @@ begin
result:=tmp; result:=tmp;
end; end;
Function LocWord(StartAT,Wordno:integer;Str:string):integer; procedure TLazConverterForm.CountFiles;
{local proc used by PosWord and Extract word}
var
W,L: integer;
Spacebefore: boolean;
begin begin
If (Str = '') or (wordno < 1) or (StartAT > length(Str)) then if FileListBox1.Items.Count-1<>-1 then
begin begin
LocWord := 0; label6.caption:=msgdone+inttostr(FileListBox1.Items.Count-1);
exit; end else label6.caption:=msgdone+'0';
end;
SpaceBefore := true;
W := 0;
L := length(Str);
StartAT := pred(StartAT);
While (W < Wordno) and (StartAT <= length(Str)) do
begin
StartAT := succ(StartAT);
If SpaceBefore and (Str[StartAT] <> ' ') then
begin
W := succ(W);
SpaceBefore := false;
end
else
If (SpaceBefore = false) and (Str[StartAT] = ' ') then
SpaceBefore := true;
end;
If W = Wordno then
LocWord := StartAT
else
LocWord := 0;
end; end;
Function ExtractWords(StartWord,NoWords:integer;Str:string):string;
var Start, finish : integer;
begin
If Str = '' then
begin
ExtractWords := '';
exit;
end;
Start := LocWord(1,StartWord,Str);
If Start <> 0 then
finish := LocWord(Start,succ(NoWords),Str)
else
begin
ExtractWords := '';
exit;
end;
If finish = 0 then {5.02A}
finish := succ(length(Str));
Repeat
finish := pred(finish);
Until Str[finish] <> ' ';
ExtractWords := copy(Str,Start,succ(finish-Start));
end; {Func ExtractWords}
Function WordCnt(Str:string):integer;
var
W,I: integer;
SpaceBefore: boolean;
begin
If Str = '' then
begin
WordCnt := 0;
exit;
end;
SpaceBefore := true;
W := 0;
For I := 1 to length(Str) do
begin
If SpaceBefore and (Str[I] <> ' ') then
begin
W := succ(W);
SpaceBefore := false;
end
else
If (SpaceBefore = false) and (Str[I] = ' ') then
SpaceBefore := true;
end;
WordCnt := W;
end;
function IsIn(Iskano:string; baza:string):boolean;
var
index,mindex,counter:integer;
tmp1:string;
tmp2:string;
begin
result:=false;
tmp1:=uppercase(iskano);
tmp2:=uppercase(baza);
counter:=0;
if pos('"',tmp1)<>0 then
begin
mindex:=1;
tmp1:=Replace(tmp1,'"','');
if pos(tmp1,tmp2)<>0 then
begin
counter:=1;
end;
end else
begin
mindex:=WordCnt(tmp1);
if mindex>0 then
begin
for index:=1 to mindex do
begin
if Pos(ExtractWords(index,1,tmp1),tmp2)<>0 then inc(counter);
end;
end;
end;
if counter=mindex then
begin
result:=true;
end;
end;
procedure GetAllFiles(mask: string; unignore:string; subdirs:boolean);
var
search: TSearchRec;
directory: string;
tmp:string;
const
{$ifdef unix}
msk='*';
delimeter='/';
{$else}
msk='*.*';
delimeter='\';
{$endif}
begin
directory := ExtractFilePath(mask);
// find all files
if FindFirst(mask, faAnyFile-faDirectory, search) = 0 then
begin
repeat
// add the files to the listbox
tmp:=trim(ExtractFileExt(search.Name));
if tmp<>'' then
begin
if pos('.',tmp)=1 then delete(tmp,1,1);
if IsIn(tmp,unignore) then
begin
allfiles.add(directory + search.Name);
end;
end;
until FindNext(search) <> 0;
end;
if subdirs then
begin
// Subdirectories/ Unterverzeichnisse
if FindFirst(directory + msk, faDirectory, search) = 0 then
begin
repeat
if ((search.Attr and faDirectory) = faDirectory)
and (search.Name[1] <> '.') and (search.Name<>'') then
GetAllFiles(directory + search.Name + delimeter + ExtractFileName(mask),
unignore,subdirs);
until FindNext(search) <> 0;
FindClose(search);
end;
end;
end;
{ TLazConverterForm }
procedure TLazConverterForm.Button1Click(Sender: TObject); procedure TLazConverterForm.Button1Click(Sender: TObject);
begin begin
if SelectDirectoryDialog1.Execute then if SelectDirectoryDialog1.Execute then
begin begin
edit1.text:=IncludeTrailingPathDelimiter(ExtractFileDir(SelectDirectoryDialog1.FileName)); edit1.text:=IncludeTrailingPathDelimiter(SelectDirectoryDialog1.FileName);
end; end;
end; end;
procedure TLazConverterForm.Button2Click(Sender: TObject); procedure TLazConverterForm.Button2Click(Sender: TObject);
var tmp:string;
const
{$ifdef unix}
msk='*';
{$else}
msk='*.*';
{$endif}
begin begin
memo1.text:=''; if trim(edit1.text)='' then
tmp:=trim(Edit1.text);
if tmp='' then
begin begin
button1click(sender);abort; button1click(sender);abort;
end; end;
edit1.text:=IncludeTrailingPathDelimiter(tmp); FileListBox1.Mask:='';
if DirectoryExists(tmp) then FileListBox1.Directory:='';
begin FileListBox1.Clear;
AllFiles.Text:=''; FileListBox1.Directory:=Edit1.text;
GetAllFiles(tmp+msk,'pas lfm lrs inc',checkbox1.checked); FileListBox1.Mask:='*.pas;*.lfm;*.lrs;*.inc;*.lrt';
label6.caption:='Searching done... press CONVERT button! Files: '+inttostr(allfiles.count); CountFiles;
memo1.text:=allfiles.text;
caption:=allfiles[0];
end;
end; end;
procedure TLazConverterForm.Button3Click(Sender: TObject); procedure TLazConverterForm.Button3Click(Sender: TObject);
@ -390,31 +209,31 @@ var tmp:tstringlist;
end; end;
begin begin
if allfiles.Count-1=-1 then abort; if FileListBox1.Items.count-1=-1 then abort;
if trim(combobox1.text)='' then abort; if trim(combobox1.text)='' then abort;
if trim(combobox2.text)='' then abort; if trim(combobox2.text)='' then abort;
tmp:=tstringlist.create; tmp:=tstringlist.create;
try try
ProgressBar1.Min:=0; ProgressBar1.Min:=0;
ProgressBar1.Max:=allfiles.count; ProgressBar1.Max:=FileListBox1.Items.count;
ProgressBar1.StepBy(1); ProgressBar1.StepBy(1);
for i:=0 to allfiles.count-1 do for i:=0 to FileListBox1.Items.count-1 do
begin begin
ok:=true; ok:=true;
try try
tmp.LoadFromFile(allfiles[i]); tmp.LoadFromFile(FileListBox1.Directory+FileListBox1.Items[i]);
except except
ok:=false; ok:=false;
end; end;
if ok then if ok then
begin begin
if pos('.LRS',uppercase(allfiles[i]))<>0 then if uppercase(ExtractFileExt(FileListBox1.Items[i]))='.LRS' then
begin begin
if ConvertMeLRS(tmp) then if ConvertMeLRS(tmp) then
begin begin
ok:=true; ok:=true;
try try
tmp.SaveToFile(allfiles[i]); tmp.SaveToFile(FileListBox1.Directory+FileListBox1.Items[i]);
except ok:=false; end; except ok:=false; end;
end; end;
end else end else
@ -423,7 +242,7 @@ begin
begin begin
ok:=true; ok:=true;
try try
tmp.SaveToFile(allfiles[i]); tmp.SaveToFile(FileListBox1.Directory+FileListBox1.Items[i]);
except ok:=false; end; except ok:=false; end;
end; end;
end; end;
@ -434,6 +253,9 @@ begin
ProgressBar1.Position:=0; ProgressBar1.Position:=0;
tmp.free; tmp.free;
label6.caption:='Done!'; label6.caption:='Done!';
FileListBox1.Mask:='';
FileListBox1.Directory:='';
FileListBox1.Clear;
end; end;
end; end;
@ -448,15 +270,25 @@ begin
except end; except end;
ComboBox1.text:=''; ComboBox1.text:='';
ComboBox2.text:=''; ComboBox2.text:='';
CheckBox1.Checked:=True;
Edit1.SetFocus; Edit1.SetFocus;
FileListBox1.Mask:='';
FileListBox1.Directory:='';
FileListBox1.Clear;
end;
procedure TLazConverterForm.MenuItem1Click(Sender: TObject);
begin
if FileListBox1.Items.count-1=-1 then abort;
try
FileListBox1.Items.Delete(FileListBox1.ItemIndex);
except end;
CountFiles;
end; end;
initialization initialization
{$I mainunit.lrs} {$I mainunit.lrs}
allfiles:=tstringlist.create;
finalization finalization
allfiles.free;
end. end.