1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-21 16:55:01 -05:00

Half-way making the wrapper apps do multiple files at once.

This commit is contained in:
Raymond 2010-09-06 00:00:21 +02:00
parent 0e73c91ecc
commit 98fac58346
6 changed files with 321 additions and 90 deletions

View File

@ -2185,6 +2185,15 @@ object frmMain: TfrmMain
inline SynRightGutterPartList1: TSynRightGutterPartList
end
end
object btnAdvanced: TButton
Left = 544
Height = 25
Top = 5
Width = 80
Caption = 'Advanced'
OnClick = btnAdvancedClick
TabOrder = 2
end
end
object Splitter1: TSplitter
Left = 335

View File

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, SynEdit, SynHighlighterPas;
StdCtrls, SynEdit, SynHighlighterPas,wrapfiles;
type
@ -14,6 +14,7 @@ type
TfrmMain = class(TForm)
btnGo: TButton;
btnAdvanced: TButton;
pnlMain: TPanel;
Splitter1: TSplitter;
Splitter2: TSplitter;
@ -21,13 +22,14 @@ type
eOut: TSynEdit;
eDebug: TSynEdit;
PasHL: TSynPasSyn;
procedure btnAdvancedClick(Sender: TObject);
procedure btnGoClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
procedure ConvertRT(Input, Dbg, Output : TStrings);
var
frmMain: TfrmMain;
@ -40,14 +42,13 @@ uses
{ TfrmMain }
procedure TfrmMain.btnGoClick(Sender: TObject);
procedure ConvertRT(Input, Dbg, Output : TStrings);
procedure Debug(s: string); overload;
begin
if (Trim(eOut.Text) <> '') then
eDebug.Lines.Append(s)
if (Trim(Output.Text) <> '') then
Dbg.Append(s)
else
eDebug.Text := s;
Dbg.Text := s;
end;
procedure Debug(v: Variant); overload;
@ -57,10 +58,10 @@ procedure TfrmMain.btnGoClick(Sender: TObject);
procedure Write(s: string); overload;
begin
if (Trim(eOut.Text) <> '') then
eOut.Text := eOut.Text + s
if (Trim(Output.Text) <> '') then
Output.Text := Output.Text + s
else
eOut.Text := s;
Output.Text := s;
end;
procedure Write(v: Variant); overload;
@ -81,12 +82,12 @@ begin
m := TMemoryStream.Create;
try
eOut.BeginUpdate;
eOut.ClearAll;
eDebug.BeginUpdate;
eDebug.ClearAll;
Output.BeginUpdate;
Output.Clear;
Dbg.BeginUpdate;
Dbg.Clear;
eIn.Lines.SaveToStream(m);
Input.SaveToStream(m);
try
p.Run(m);
@ -158,11 +159,21 @@ begin
m.Free;
p.Free;
eOut.EndUpdate;
eDebug.EndUpdate;
Output.EndUpdate;
Dbg.EndUpdate;
end;
Debug('Done :)');
end;
procedure TfrmMain.btnGoClick(Sender: TObject);
begin
ConvertRT(eIn.Lines,eDebug.Lines,eOut.Lines);
end;
procedure TfrmMain.btnAdvancedClick(Sender: TObject);
begin
WrapFilesForm.ShowModal;
end;
end.

View File

@ -35,12 +35,12 @@
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="15">
<Units Count="20">
<Unit0>
<Filename Value="ruwa.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ruwa"/>
<UsageCount Value="20"/>
<UsageCount Value="22"/>
</Unit0>
<Unit1>
<Filename Value="main.pas"/>
@ -50,9 +50,9 @@
<UnitName Value="main"/>
<EditorIndex Value="0"/>
<WindowIndex Value="0"/>
<TopLine Value="115"/>
<CursorPos X="41" Y="150"/>
<UsageCount Value="20"/>
<TopLine Value="7"/>
<CursorPos X="24" Y="28"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
@ -60,36 +60,36 @@
<Filename Value="..\..\Units\Misc\v_MiscFunctions.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="v_MiscFunctions"/>
<UsageCount Value="20"/>
<UsageCount Value="22"/>
</Unit2>
<Unit3>
<Filename Value="..\..\Units\Misc\ValistusDefines.inc"/>
<IsPartOfProject Value="True"/>
<UsageCount Value="20"/>
<UsageCount Value="22"/>
</Unit3>
<Unit4>
<Filename Value="..\..\Units\Misc\CastaliaPasLex.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="CastaliaPasLex"/>
<UsageCount Value="20"/>
<UsageCount Value="22"/>
</Unit4>
<Unit5>
<Filename Value="..\..\Units\Misc\CastaliaPasLexTypes.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="CastaliaPasLexTypes"/>
<UsageCount Value="20"/>
<UsageCount Value="22"/>
</Unit5>
<Unit6>
<Filename Value="..\..\Units\Misc\CastaliaSimplePasPar.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="CastaliaSimplePasPar"/>
<UsageCount Value="20"/>
<UsageCount Value="22"/>
</Unit6>
<Unit7>
<Filename Value="..\..\Units\Misc\CastaliaSimplePasParTypes.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="CastaliaSimplePasParTypes"/>
<UsageCount Value="20"/>
<UsageCount Value="22"/>
</Unit7>
<Unit8>
<Filename Value="..\..\Units\Misc\v_autocompleteform.pas"/>
@ -100,7 +100,7 @@
<Filename Value="..\..\Units\Misc\v_Constants.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="v_Constants"/>
<UsageCount Value="20"/>
<UsageCount Value="22"/>
</Unit9>
<Unit10>
<Filename Value="..\..\Units\Misc\v_ideCodeInsight.pas"/>
@ -114,16 +114,15 @@
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="v_ideCodeParser"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<EditorIndex Value="6"/>
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="8" Y="8"/>
<UsageCount Value="20"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
</Unit11>
<Unit12>
<Filename Value="..\..\..\FPC\Source\rtl\win\sysutils.pp"/>
<Filename Value="C:\FPC\Source\rtl\win\sysutils.pp"/>
<UnitName Value="sysutils"/>
<WindowIndex Value="0"/>
<TopLine Value="567"/>
@ -131,7 +130,7 @@
<UsageCount Value="10"/>
</Unit12>
<Unit13>
<Filename Value="..\..\..\LazSVN\components\synedit\synedit.pp"/>
<Filename Value="C:\LazSVN\components\synedit\synedit.pp"/>
<UnitName Value="SynEdit"/>
<WindowIndex Value="0"/>
<TopLine Value="6433"/>
@ -139,131 +138,187 @@
<UsageCount Value="10"/>
</Unit13>
<Unit14>
<Filename Value="..\..\..\FPC\Source\rtl\win32\system.pp"/>
<Filename Value="C:\FPC\Source\rtl\win32\system.pp"/>
<UnitName Value="System"/>
<WindowIndex Value="0"/>
<TopLine Value="17"/>
<CursorPos X="2" Y="35"/>
<UsageCount Value="10"/>
</Unit14>
<Unit15>
<Filename Value="wrapfiles.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="WrapFilesForm"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="wrapfiles"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<WindowIndex Value="0"/>
<TopLine Value="64"/>
<CursorPos X="40" Y="80"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit15>
<Unit16>
<Filename Value="C:\lazarus\lcl\fileutil.pas"/>
<UnitName Value="FileUtil"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/>
<TopLine Value="23"/>
<CursorPos X="10" Y="49"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit16>
<Unit17>
<Filename Value="C:\lazarus\lcl\include\fileutil.inc"/>
<EditorIndex Value="5"/>
<WindowIndex Value="0"/>
<TopLine Value="379"/>
<CursorPos X="3" Y="391"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit17>
<Unit18>
<Filename Value="C:\FPC\FPCCheckout\rtl\objpas\classes\classesh.inc"/>
<EditorIndex Value="2"/>
<WindowIndex Value="0"/>
<TopLine Value="573"/>
<CursorPos X="15" Y="599"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit18>
<Unit19>
<Filename Value="C:\FPC\FPCCheckout\rtl\objpas\classes\stringl.inc"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/>
<TopLine Value="592"/>
<CursorPos X="3" Y="597"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit19>
</Units>
<JumpHistory Count="29" HistoryIndex="28">
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="main.pas"/>
<Caret Line="76" Column="45" TopLine="53"/>
<Caret Line="147" Column="18" TopLine="125"/>
</Position1>
<Position2>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="125" Column="24" TopLine="103"/>
<Filename Value="main.pas"/>
<Caret Line="150" Column="41" TopLine="115"/>
</Position2>
<Position3>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="864" Column="30" TopLine="846"/>
<Filename Value="main.pas"/>
<Caret Line="152" Column="41" TopLine="133"/>
</Position3>
<Position4>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="892" Column="26" TopLine="863"/>
<Filename Value="main.pas"/>
<Caret Line="9" Column="49" TopLine="7"/>
</Position4>
<Position5>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="1193" Column="133" TopLine="1175"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="15" Column="72" TopLine="1"/>
</Position5>
<Position6>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="1422" Column="28" TopLine="1404"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="19" Column="72" TopLine="1"/>
</Position6>
<Position7>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="1429" Column="114" TopLine="1404"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="20" Column="72" TopLine="1"/>
</Position7>
<Position8>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="1441" Column="36" TopLine="1424"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="22" Column="72" TopLine="3"/>
</Position8>
<Position9>
<Filename Value="main.pas"/>
<Caret Line="98" Column="24" TopLine="69"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="43" Column="1" TopLine="25"/>
</Position9>
<Position10>
<Filename Value="main.pas"/>
<Caret Line="80" Column="101" TopLine="63"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="44" Column="1" TopLine="26"/>
</Position10>
<Position11>
<Filename Value="main.pas"/>
<Caret Line="60" Column="12" TopLine="52"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="42" Column="1" TopLine="28"/>
</Position11>
<Position12>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="42" Column="89" TopLine="33"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="41" Column="1" TopLine="27"/>
</Position12>
<Position13>
<Filename Value="main.pas"/>
<Caret Line="83" Column="31" TopLine="63"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="43" Column="1" TopLine="29"/>
</Position13>
<Position14>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="43" Column="33" TopLine="25"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="44" Column="1" TopLine="30"/>
</Position14>
<Position15>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="379" Column="46" TopLine="361"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="46" Column="1" TopLine="32"/>
</Position15>
<Position16>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="656" Column="56" TopLine="638"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="51" Column="15" TopLine="35"/>
</Position16>
<Position17>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="674" Column="44" TopLine="656"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="52" Column="15" TopLine="36"/>
</Position17>
<Position18>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="680" Column="56" TopLine="654"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="37" Column="8" TopLine="23"/>
</Position18>
<Position19>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="701" Column="58" TopLine="683"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="71" Column="31" TopLine="56"/>
</Position19>
<Position20>
<Filename Value="main.pas"/>
<Caret Line="104" Column="24" TopLine="90"/>
<Caret Line="90" Column="10" TopLine="39"/>
</Position20>
<Position21>
<Filename Value="..\..\Units\Misc\v_ideCodeParser.pas"/>
<Caret Line="8" Column="8" TopLine="1"/>
<Filename Value="main.pas"/>
<Caret Line="49" Column="11" TopLine="23"/>
</Position21>
<Position22>
<Filename Value="main.pas"/>
<Caret Line="117" Column="51" TopLine="103"/>
<Caret Line="88" Column="14" TopLine="48"/>
</Position22>
<Position23>
<Filename Value="main.pas"/>
<Caret Line="100" Column="20" TopLine="105"/>
<Caret Line="90" Column="11" TopLine="64"/>
</Position23>
<Position24>
<Filename Value="main.pas"/>
<Caret Line="101" Column="1" TopLine="83"/>
<Caret Line="170" Column="46" TopLine="128"/>
</Position24>
<Position25>
<Filename Value="main.pas"/>
<Caret Line="137" Column="35" TopLine="111"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="72" Column="14" TopLine="27"/>
</Position25>
<Position26>
<Filename Value="main.pas"/>
<Caret Line="101" Column="1" TopLine="83"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="46" Column="23" TopLine="27"/>
</Position26>
<Position27>
<Filename Value="main.pas"/>
<Caret Line="78" Column="13" TopLine="61"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="50" Column="20" TopLine="32"/>
</Position27>
<Position28>
<Filename Value="main.pas"/>
<Caret Line="62" Column="22" TopLine="37"/>
<Filename Value="C:\FPC\FPCCheckout\rtl\objpas\classes\stringl.inc"/>
<Caret Line="625" Column="14" TopLine="608"/>
</Position28>
<Position29>
<Filename Value="main.pas"/>
<Caret Line="147" Column="18" TopLine="125"/>
<Filename Value="wrapfiles.pas"/>
<Caret Line="48" Column="48" TopLine="33"/>
</Position29>
<Position30>
<Filename Value="wrapfiles.pas"/>
<Caret Line="54" Column="1" TopLine="52"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>

View File

@ -9,13 +9,14 @@ uses
Interfaces, // this includes the LCL widgetset
Forms, main, v_MiscFunctions, CastaliaPasLex, CastaliaPasLexTypes,
CastaliaSimplePasPar, CastaliaSimplePasParTypes,
v_Constants, v_ideCodeParser;
v_Constants, v_ideCodeParser, wrapfiles;
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TfrmMain, frmMain);
Application.CreateForm(TWrapFilesForm, WrapFilesForm);
Application.Run;
end.

View File

@ -0,0 +1,72 @@
object WrapFilesForm: TWrapFilesForm
Left = 429
Height = 398
Top = 234
Width = 652
Caption = 'WrapFilesForm'
ClientHeight = 398
ClientWidth = 652
Constraints.MinHeight = 398
Constraints.MinWidth = 652
OnCreate = FormCreate
LCLVersion = '0.9.29'
object FileButton: TButton
Left = 16
Height = 25
Top = 16
Width = 75
Caption = 'Select files'
OnClick = FileButtonClick
TabOrder = 0
end
object FileBox: TListBox
Left = 16
Height = 220
Top = 56
Width = 616
Anchors = [akTop, akLeft, akRight, akBottom]
ItemHeight = 0
TabOrder = 1
end
object SaveDirEdit: TDirectoryEdit
Left = 200
Height = 21
Top = 16
Width = 152
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 0
MaxLength = 0
TabOrder = 2
end
object SaveDirLabel: TLabel
Left = 120
Height = 14
Top = 20
Width = 78
Caption = 'Save directory: '
ParentColor = False
end
object wrpBtn: TButton
Left = 472
Height = 25
Top = 16
Width = 75
Caption = 'Convert'
OnClick = wrpBtnClick
TabOrder = 3
end
object dbgMemo: TMemo
Left = 16
Height = 100
Top = 287
Width = 616
Anchors = [akRight, akBottom]
TabOrder = 4
end
object FileDialog: TOpenDialog
Options = [ofAllowMultiSelect, ofFileMustExist, ofEnableSizing, ofViewDetail]
left = 32
top = 56
end
end

View File

@ -0,0 +1,83 @@
unit wrapfiles;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
EditBtn;
type
{ TWrapFilesForm }
TWrapFilesForm = class(TForm)
dbgMemo: TMemo;
wrpBtn: TButton;
SaveDirEdit: TDirectoryEdit;
FileButton: TButton;
FileBox: TListBox;
FileDialog: TOpenDialog;
SaveDirLabel: TLabel;
procedure FileButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure wrpBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
WrapFilesForm: TWrapFilesForm;
implementation
uses
Main;
{$R *.lfm}
{ TWrapFilesForm }
procedure TWrapFilesForm.FileButtonClick(Sender: TObject);
begin
if FileDialog.Execute then
begin
FileBox.Items.AddStrings(FileDialog.Files);
end;
end;
procedure TWrapFilesForm.FormCreate(Sender: TObject);
begin
end;
procedure TWrapFilesForm.wrpBtnClick(Sender: TObject);
procedure dbg(s : string);
begin
dbgMemo.Lines.Add(s);
end;
var
i : integer;
Input, Output : TFileStream;
begin
if not DirectoryExists(SaveDirEdit.Directory) then
begin
Writeln(format('Dir %s does not exist',[SaveDirEdit.Directory]));
exit;
end;
if not FileBox.Items.Count < 1 then
begin
Writeln('No files loaded');
exit;
end;
for i := 0 to FileBox.Items.Count - 1 do
begin
end;
end;
end.