Changeset 208 for branches/interpreter2/UFormMain.pas
- Timestamp:
- Apr 22, 2020, 12:02:17 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/interpreter2/UFormMain.pas
r207 r208 15 15 TFormMain = class(TForm) 16 16 ACompile: TAction; 17 AGenerateXml: TAction; 17 18 AOptimize: TAction; 18 19 AExit: TAction; … … 22 23 AGeneratePascal: TAction; 23 24 ActionList1: TActionList; 24 Label2: TLabel;25 25 MainMenu1: TMainMenu; 26 MemoOutput: TMemo;27 26 MenuItem1: TMenuItem; 28 27 MenuItem2: TMenuItem; … … 31 30 MenuItem5: TMenuItem; 32 31 MenuItem6: TMenuItem; 32 MenuItem7: TMenuItem; 33 33 MenuItemRun: TMenuItem; 34 34 MenuItemGenerate: TMenuItem; 35 35 MenuItemFile: TMenuItem; 36 PanelOutput: TPanel; 36 37 PanelSource: TPanel; 37 38 PanelMessages: TPanel; … … 41 42 procedure AGeneratePascalExecute(Sender: TObject); 42 43 procedure AGeneratePhpExecute(Sender: TObject); 44 procedure AGenerateXmlExecute(Sender: TObject); 43 45 procedure AOptimizeExecute(Sender: TObject); 44 46 procedure ARunExecute(Sender: TObject); … … 68 70 uses 69 71 UParser, UExecutor, UGeneratorPascal, UGeneratorPhp, UFormMessages, UFormSource, 70 UGeneratorCSharp, UOptimizer ;72 UGeneratorCSharp, UOptimizer, UGeneratorXml, UFormOutput; 71 73 72 74 { TFormMain } … … 95 97 DockForm(FormMessages, PanelMessages); 96 98 DockForm(FormSource, PanelSource); 99 DockForm(FormOutput, PanelOutput); 97 100 UpdateInterface; 98 101 end; … … 124 127 ACompile.Execute; 125 128 AOptimize.Execute; 126 MemoOutput.Lines.Clear; 129 FormOutput.SynEditOutput.Highlighter := FormOutput.SynCppSyn1; 130 FormOutput.Clear; 127 131 if Assigned(Prog) then begin 128 132 Generator := TGeneratorCSharp.Create; 129 133 Generator.Prog := Prog; 130 134 Generator.Generate; 131 MemoOutput.Lines.Text := Generator.Output;132 Generator.Free; 133 MemoOutput.Lines.SaveToFile('Generated' + DirectorySeparator + 'Test.cs');135 FormOutput.SetText(Generator.Output); 136 Generator.Free; 137 FormOutput.SynEditOutput.Lines.SaveToFile('Generated' + DirectorySeparator + 'Test.cs'); 134 138 end; 135 139 end; … … 141 145 ACompile.Execute; 142 146 AOptimize.Execute; 143 MemoOutput.Lines.Clear; 147 FormOutput.SynEditOutput.Highlighter := FormOutput.SynPasSyn1; 148 FormOutput.SynEditOutput.Lines.Clear; 144 149 if Assigned(Prog) then begin 145 150 Generator := TGeneratorPascal.Create; 146 151 Generator.Prog := Prog; 147 152 Generator.Generate; 148 MemoOutput.Lines.Text := Generator.Output;149 Generator.Free; 150 MemoOutput.Lines.SaveToFile('Generated' + DirectorySeparator + 'Test.pas');153 FormOutput.SynEditOutput.Lines.Text := Generator.Output; 154 Generator.Free; 155 FormOutput.SynEditOutput.Lines.SaveToFile('Generated' + DirectorySeparator + 'Test.pas'); 151 156 end; 152 157 end; … … 157 162 begin 158 163 ACompile.Execute; 159 MemoOutput.Lines.Clear; 164 FormOutput.SynEditOutput.Highlighter := FormOutput.SynPhpSyn1; 165 FormOutput.SynEditOutput.Lines.Clear; 160 166 if Assigned(Prog) then begin 161 167 Generator := TGeneratorPhp.Create; 162 168 Generator.Prog := Prog; 163 169 Generator.Generate; 164 MemoOutput.Lines.Text := Generator.Output; 165 Generator.Free; 166 MemoOutput.Lines.SaveToFile('Generated' + DirectorySeparator + 'Test.php'); 170 FormOutput.SynEditOutput.Lines.Text := Generator.Output; 171 Generator.Free; 172 FormOutput.SynEditOutput.Lines.SaveToFile('Generated' + DirectorySeparator + 'Test.php'); 173 end; 174 end; 175 176 procedure TFormMain.AGenerateXmlExecute(Sender: TObject); 177 var 178 Generator: TGeneratorXml; 179 begin 180 ACompile.Execute; 181 FormOutput.SynEditOutput.Highlighter := FormOutput.SynXmlSyn1; 182 FormOutput.SynEditOutput.Lines.Clear; 183 if Assigned(Prog) then begin 184 Generator := TGeneratorXml.Create; 185 Generator.Prog := Prog; 186 Generator.Generate; 187 FormOutput.SynEditOutput.Lines.Text := Generator.Output; 188 Generator.Free; 189 FormOutput.SynEditOutput.Lines.SaveToFile('Generated' + DirectorySeparator + 'Test.xml'); 167 190 end; 168 191 end; … … 186 209 ACompile.Execute; 187 210 //AOptimize.Execute; 188 MemoOutput.Lines.Clear; 211 FormOutput.SynEditOutput.Highlighter := nil; 212 FormOutput.SynEditOutput.Lines.Clear; 189 213 if Assigned(Prog) then begin 190 214 Executor := TExecutor.Create; … … 214 238 procedure TFormMain.ExecutorOutput(Text: string); 215 239 begin 216 MemoOutput.Text := MemoOutput.Text + Text;240 FormOutput.SynEditOutput.Text := FormOutput.SynEditOutput.Text + Text; 217 241 end; 218 242
Note:
See TracChangeset
for help on using the changeset viewer.