diff --git a/Projects/RUTIS Wrappers/main.lfm b/Projects/RUTIS Wrappers/main.lfm index c51bf1d..aa9b137 100644 --- a/Projects/RUTIS Wrappers/main.lfm +++ b/Projects/RUTIS Wrappers/main.lfm @@ -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 diff --git a/Projects/RUTIS Wrappers/main.pas b/Projects/RUTIS Wrappers/main.pas index bfcab36..970b458 100644 --- a/Projects/RUTIS Wrappers/main.pas +++ b/Projects/RUTIS Wrappers/main.pas @@ -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. diff --git a/Projects/RUTIS Wrappers/ruwa.lpi b/Projects/RUTIS Wrappers/ruwa.lpi index 5d05197..24f3383 100644 --- a/Projects/RUTIS Wrappers/ruwa.lpi +++ b/Projects/RUTIS Wrappers/ruwa.lpi @@ -35,12 +35,12 @@ - + - + @@ -50,9 +50,9 @@ - - - + + + @@ -60,36 +60,36 @@ - + - + - + - + - + - + @@ -100,7 +100,7 @@ - + @@ -114,16 +114,15 @@ - - + - + - + @@ -131,7 +130,7 @@ - + @@ -139,131 +138,187 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - + - + - + - - + + - - + + - - + + - - + + - - + + + + + + diff --git a/Projects/RUTIS Wrappers/ruwa.lpr b/Projects/RUTIS Wrappers/ruwa.lpr index 4f19225..049bd79 100644 --- a/Projects/RUTIS Wrappers/ruwa.lpr +++ b/Projects/RUTIS Wrappers/ruwa.lpr @@ -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. diff --git a/Projects/RUTIS Wrappers/wrapfiles.lfm b/Projects/RUTIS Wrappers/wrapfiles.lfm new file mode 100644 index 0000000..52da044 --- /dev/null +++ b/Projects/RUTIS Wrappers/wrapfiles.lfm @@ -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 diff --git a/Projects/RUTIS Wrappers/wrapfiles.pas b/Projects/RUTIS Wrappers/wrapfiles.pas new file mode 100644 index 0000000..668a35c --- /dev/null +++ b/Projects/RUTIS Wrappers/wrapfiles.pas @@ -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. +