source: branches/CpuSingleSize/Forms/FormMain.pas

Last change on this file was 238, checked in by chronos, 16 months ago
  • Modified: Removed U prefix from unit names.
  • Fixed: Memory leaks.
File size: 2.1 KB
Line 
1unit FormMain;
2
3interface
4
5uses
6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls,
7 ExtCtrls, Menus, Cpu, Machine, Assembler, FormMessages, FormAssembler;
8
9type
10
11 { TFormMain }
12
13 TFormMain = class(TForm)
14 ButtonLoad: TButton;
15 ButtonStart: TButton;
16 ButtonStop: TButton;
17 MainMenu1: TMainMenu;
18 MenuItem1: TMenuItem;
19 MenuItem10: TMenuItem;
20 MenuItem11: TMenuItem;
21 MenuItem12: TMenuItem;
22 MenuItem14: TMenuItem;
23 MenuItem15: TMenuItem;
24 MenuItem16: TMenuItem;
25 MenuItem17: TMenuItem;
26 MenuItem19: TMenuItem;
27 MenuItem2: TMenuItem;
28 MenuItem3: TMenuItem;
29 MenuItem4: TMenuItem;
30 MenuItem5: TMenuItem;
31 MenuItem6: TMenuItem;
32 MenuItem7: TMenuItem;
33 MenuItem8: TMenuItem;
34 MenuItem9: TMenuItem;
35 PanelCenter: TPanel;
36 PanelBottom: TPanel;
37 Splitter1: TSplitter;
38 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
39 procedure FormCreate(Sender: TObject);
40 procedure FormDestroy(Sender: TObject);
41 procedure FormShow(Sender: TObject);
42 private
43 public
44 FormMessages: TFormMessages;
45 FormAssembler: TFormAssembler;
46 procedure DockForm(Form: TForm; DockSite: TWinControl);
47 procedure DockInit;
48 end;
49
50
51implementation
52
53{$R *.lfm}
54
55{ TFormMain }
56
57procedure TFormMain.FormCreate(Sender: TObject);
58begin
59 FormMessages := TFormMessages.Create(nil);
60 FormAssembler := TFormAssembler.Create(nil);
61 FormMessages.OnSelect := FormAssembler.Select;
62end;
63
64procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
65begin
66 Application.Terminate;
67end;
68
69procedure TFormMain.FormDestroy(Sender: TObject);
70begin
71 FreeAndNil(FormAssembler);
72 FreeAndNil(FormMessages);
73end;
74
75procedure TFormMain.FormShow(Sender: TObject);
76begin
77 DockInit;
78 FormAssembler.SynEdit1.Lines.LoadFromFile('Sample.asm');
79end;
80
81procedure TFormMain.DockForm(Form: TForm; DockSite: TWinControl);
82begin
83 Form.ManualDock(DockSite, nil, alClient);
84 Form.Align := alClient;
85 Form.Show;
86end;
87
88procedure TFormMain.DockInit;
89begin
90 DockForm(FormAssembler, PanelCenter);
91 DockForm(FormMessages, PanelBottom);
92 PanelBottom.Height := Height div 5;
93end;
94
95end.
96
Note: See TracBrowser for help on using the repository browser.