Changeset 46 for branches/DelphiToC/UMainForm.pas
- Timestamp:
- Aug 9, 2010, 11:22:45 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DelphiToC/UMainForm.pas
r42 r46 8 8 SysUtils, Variants, Classes, Graphics, Controls, Forms, 9 9 Dialogs, StdCtrls, UPascalSource, UPascalCompiler, UAssemblerSource, 10 UCSource, ComCtrls, USourceTree; 10 UProducerC, ComCtrls, SynEdit, SynHighlighterPas, USourceTree, 11 UProducerPascal; 11 12 12 13 const … … 14 15 15 16 type 17 18 { TMainForm } 19 16 20 TMainForm = class(TForm) 17 Memo1: TMemo;18 21 Button1: TButton; 22 ComboBox1: TComboBox; 19 23 Memo2: TMemo; 20 24 Memo3: TMemo; 25 SynEdit1: TSynEdit; 26 SynPasSyn1: TSynPasSyn; 21 27 TreeView1: TTreeView; 28 procedure ComboBox1Change(Sender: TObject); 22 29 procedure FormShow(Sender: TObject); 23 30 procedure FormClose(Sender: TObject; var Action: TCloseAction); … … 46 53 begin 47 54 MainForm.Memo3.Clear; 48 Compiler.SourceCode.Assign(Memo1.Lines); 49 Compiler.Compile; 55 Compiler.SourceCode.Assign(SynEdit1.Lines); 56 57 Memo2.Clear; 58 if ComboBox1.ItemIndex = 0 then begin 59 Compiler.Producer.Free; 60 Compiler.Producer := TProducerPascal.Create; 61 Compiler.Producer.ProgramCode := Compiler.ProgramCode; 62 Compiler.Compile; 63 with TProducerPascal(Compiler.Producer) do 64 Memo2.Lines.Assign(TextSource); 65 end else 66 if ComboBox1.ItemIndex = 1 then begin 67 Compiler.Producer.Free; 68 Compiler.Producer := TCProducer.Create; 69 Compiler.Producer.ProgramCode := Compiler.ProgramCode; 70 Compiler.Compile; 71 with TCProducer(Compiler.Producer) do 72 Memo2.Lines.Assign(TextSource); 73 end else 74 if ComboBox1.ItemIndex = 2 then begin 75 Compiler.Producer.Free; 76 Compiler.Producer := TAssemblerProducer.Create; 77 Compiler.Producer.ProgramCode := Compiler.ProgramCode; 78 Compiler.Compile; 79 with TAssemblerProducer(Compiler.Producer) do 80 for I := 0 to AssemblyCode.Count - 1 do 81 Memo2.Lines.Add(TAssemblerLine(AssemblyCode[I]).AsString); 82 end; 83 50 84 SourceTree.TreeView := TreeView1; 51 85 SourceTree.Code := Compiler.ProgramCode; 52 86 SourceTree.Fill; 53 Memo2.Clear;54 if Compiler.Producer is TAssemblerProducer then begin55 with TAssemblerProducer(Compiler.Producer) do56 for I := 0 to AssemblyCode.Count - 1 do57 Memo2.Lines.Add(TAssemblerLine(AssemblyCode[I]).AsString);58 end else59 if Compiler.Producer is TCProducer then begin60 with TCProducer(Compiler.Producer) do61 Memo2.Lines.Assign(TextSource);62 end;63 87 end; 64 88 … … 70 94 procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction); 71 95 begin 72 Memo1.Lines.SaveToFile(ExampleFileName);96 SynEdit1.Lines.SaveToFile(ExampleFileName); 73 97 end; 74 98 … … 89 113 begin 90 114 WindowState := wsMaximized; 91 Memo1.Lines.LoadFromFile(ExampleFileName); 115 SynEdit1.Lines.LoadFromFile(ExampleFileName); 116 Button1Click(Self); 117 end; 118 119 procedure TMainForm.ComboBox1Change(Sender: TObject); 120 begin 92 121 Button1Click(Self); 93 122 end;
Note:
See TracChangeset
for help on using the changeset viewer.