Changeset 230 for branches/xpascal/Forms/FormMain.pas
- Timestamp:
- Jun 26, 2023, 12:08:45 PM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/xpascal/Forms/FormMain.pas
r229 r230 6 6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Menus, 7 7 ActnList, ExtCtrls, SynHighlighterPas, SynEdit, Source, Optimizer, 8 Generator, FormSource, FormMessages, FormOutput, Form Ex;8 Generator, FormSource, FormMessages, FormOutput, FormConsole, FormEx; 9 9 10 10 type … … 14 14 TFormMain = class(TFormEx) 15 15 ACompile: TAction; 16 AConsole: TAction; 16 17 ATest: TAction; 17 18 AGenerateXml: TAction; … … 40 41 Splitter1: TSplitter; 41 42 procedure ACompileExecute(Sender: TObject); 43 procedure AConsoleExecute(Sender: TObject); 42 44 procedure AExitExecute(Sender: TObject); 43 45 procedure AGenerateCSharpExecute(Sender: TObject); … … 58 60 FormMessages: TFormMessages; 59 61 FormOutput: TFormOutput; 62 FormConsole: TFormConsole; 60 63 procedure Generate(GeneratorClass: TGeneratorClass); 61 64 procedure ExecutorOutput(Text: string); 65 function ExecutorInput: string; 62 66 procedure InterpreterError(Pos: TPoint; Text: string); 63 67 procedure UpdateInterface; … … 83 87 if not Initialized then begin 84 88 Initialized := True; 85 FormSource.SynEditSource.Lines.LoadFromFile('Test.pas'); 89 FormSource.SynEditSource.Lines.LoadFromFile('Examples' + DirectorySeparator + 90 'Example.pas'); 86 91 ARun.Execute; 87 92 end; … … 94 99 if Assigned(FormMessages) then FreeAndNil(FormMessages); 95 100 if Assigned(FormOutput) then FreeAndNil(FormOutput); 101 if Assigned(FormConsole) then FreeAndNil(FormConsole); 96 102 end; 97 103 … … 107 113 FormOutput.Show; 108 114 DockForm(FormOutput, PanelOutput); 115 FormConsole := TFormConsole.Create(nil); 116 FormConsole.Show; 117 DockForm(FormConsole, PanelOutput); 109 118 UpdateInterface; 110 119 end; … … 121 130 FormOutput.SetText(Generator.Output); 122 131 TargetFileName := 'Generated' + DirectorySeparator + 123 Generator.Name + DirectorySeparator + ' Test' + Generator.FileExt;132 Generator.Name + DirectorySeparator + 'Example' + Generator.FileExt; 124 133 ForceDirectories(ExtractFileDir(TargetFileName)); 125 134 FormOutput.SynEditOutput.Lines.SaveToFile(TargetFileName); … … 152 161 end; 153 162 163 procedure TFormMain.AConsoleExecute(Sender: TObject); 164 begin 165 166 end; 167 154 168 procedure TFormMain.AGenerateCSharpExecute(Sender: TObject); 155 169 begin … … 161 175 Generate(TGeneratorCSharp); 162 176 end; 177 DockForm(FormOutput, PanelOutput); 163 178 end; 164 179 … … 171 186 Generate(TGeneratorPascal); 172 187 end; 188 DockForm(FormOutput, PanelOutput); 173 189 end; 174 190 … … 182 198 Generate(TGeneratorPhp); 183 199 end; 200 DockForm(FormOutput, PanelOutput); 184 201 end; 185 202 … … 192 209 Generate(TGeneratorXml); 193 210 end; 211 DockForm(FormOutput, PanelOutput); 194 212 end; 195 213 … … 236 254 Executor.Prog := Prog; 237 255 Executor.OnOutput := ExecutorOutput; 256 Executor.OnInput := ExecutorInput; 238 257 Executor.Run; 239 258 Executor.Free; 240 259 end; 260 DockForm(FormConsole, PanelOutput); 261 FormConsole.Memo1.SetFocus; 241 262 end; 242 263 … … 259 280 procedure TFormMain.ExecutorOutput(Text: string); 260 281 begin 261 FormOutput.SynEditOutput.Text := FormOutput.SynEditOutput.Text + Text; 282 FormConsole.Memo1.Text := FormConsole.Memo1.Text + Text; 283 end; 284 285 function TFormMain.ExecutorInput: string; 286 begin 287 Result := FormConsole.GetInputString; 262 288 end; 263 289
Note:
See TracChangeset
for help on using the changeset viewer.