1 | unit UFormNew;
|
---|
2 |
|
---|
3 | {$mode delphi}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
---|
9 | UGame;
|
---|
10 |
|
---|
11 | type
|
---|
12 |
|
---|
13 | { TFormNew }
|
---|
14 |
|
---|
15 | TFormNew = class(TForm)
|
---|
16 | ButtonCancel: TButton;
|
---|
17 | ButtonOk: TButton;
|
---|
18 | CheckBoxRecordHistory: TCheckBox;
|
---|
19 | CheckBoxUndoEnabled: TCheckBox;
|
---|
20 | ComboBoxSize: TComboBox;
|
---|
21 | Label1: TLabel;
|
---|
22 | procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
---|
23 | procedure FormCreate(Sender: TObject);
|
---|
24 | procedure FormShow(Sender: TObject);
|
---|
25 | private
|
---|
26 |
|
---|
27 | public
|
---|
28 | procedure Load(Game: TGame);
|
---|
29 | procedure Save(Game: TGame);
|
---|
30 | end;
|
---|
31 |
|
---|
32 | var
|
---|
33 | FormNew: TFormNew;
|
---|
34 |
|
---|
35 | implementation
|
---|
36 |
|
---|
37 | {$R *.lfm}
|
---|
38 |
|
---|
39 | uses
|
---|
40 | UCore;
|
---|
41 |
|
---|
42 | { TFormNew }
|
---|
43 |
|
---|
44 | procedure TFormNew.FormCreate(Sender: TObject);
|
---|
45 | begin
|
---|
46 | Core.Translator1.TranslateComponentRecursive(Self);
|
---|
47 | end;
|
---|
48 |
|
---|
49 | procedure TFormNew.FormShow(Sender: TObject);
|
---|
50 | begin
|
---|
51 | Core.PersistentForm1.Load(Self);
|
---|
52 | end;
|
---|
53 |
|
---|
54 | procedure TFormNew.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
---|
55 | begin
|
---|
56 | Core.PersistentForm1.Save(Self);
|
---|
57 | end;
|
---|
58 |
|
---|
59 | procedure TFormNew.Load(Game: TGame);
|
---|
60 | begin
|
---|
61 | ComboBoxSize.ItemIndex := Game.Board.Size.X - 2;
|
---|
62 | CheckBoxUndoEnabled.Checked := Game.UndoEnabled;
|
---|
63 | CheckBoxRecordHistory.Checked := Game.RecordHistory;
|
---|
64 | end;
|
---|
65 |
|
---|
66 | procedure TFormNew.Save(Game: TGame);
|
---|
67 | begin
|
---|
68 | Game.Board.Size := Point(2 + ComboBoxSize.ItemIndex, 2 + ComboBoxSize.ItemIndex);
|
---|
69 | Game.UndoEnabled := CheckBoxUndoEnabled.Checked;
|
---|
70 | Game.RecordHistory := CheckBoxRecordHistory.Checked;
|
---|
71 | end;
|
---|
72 |
|
---|
73 | end.
|
---|
74 |
|
---|