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 | ComboBoxSkin: TComboBox;
|
---|
22 | Label1: TLabel;
|
---|
23 | Label2: TLabel;
|
---|
24 | procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
---|
25 | procedure FormCreate(Sender: TObject);
|
---|
26 | procedure FormShow(Sender: TObject);
|
---|
27 | private
|
---|
28 |
|
---|
29 | public
|
---|
30 | procedure Load(Game: TGame);
|
---|
31 | procedure Save(Game: TGame);
|
---|
32 | end;
|
---|
33 |
|
---|
34 | var
|
---|
35 | FormNew: TFormNew;
|
---|
36 |
|
---|
37 | implementation
|
---|
38 |
|
---|
39 | {$R *.lfm}
|
---|
40 |
|
---|
41 | uses
|
---|
42 | UCore;
|
---|
43 |
|
---|
44 | { TFormNew }
|
---|
45 |
|
---|
46 | procedure TFormNew.FormCreate(Sender: TObject);
|
---|
47 | var
|
---|
48 | I: TTileSkin;
|
---|
49 | begin
|
---|
50 | Core.Translator1.TranslateComponentRecursive(Self);
|
---|
51 | Core.ThemeManager1.UseTheme(Self);
|
---|
52 | ComboBoxSkin.Items.BeginUpdate;
|
---|
53 | try
|
---|
54 | ComboBoxSkin.Items.Clear;
|
---|
55 | for I := Low(SkinText) to High(SkinText) do
|
---|
56 | ComboBoxSkin.Items.Add(SkinText[I]);
|
---|
57 | finally
|
---|
58 | ComboBoxSkin.Items.EndUpdate;
|
---|
59 | end;
|
---|
60 | end;
|
---|
61 |
|
---|
62 | procedure TFormNew.FormShow(Sender: TObject);
|
---|
63 | begin
|
---|
64 | Core.PersistentForm1.Load(Self);
|
---|
65 | end;
|
---|
66 |
|
---|
67 | procedure TFormNew.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
---|
68 | begin
|
---|
69 | Core.PersistentForm1.Save(Self);
|
---|
70 | end;
|
---|
71 |
|
---|
72 | procedure TFormNew.Load(Game: TGame);
|
---|
73 | begin
|
---|
74 | ComboBoxSize.ItemIndex := Game.Board.Size.X - 2;
|
---|
75 | CheckBoxUndoEnabled.Checked := Game.UndoEnabled;
|
---|
76 | CheckBoxRecordHistory.Checked := Game.RecordHistory;
|
---|
77 | ComboBoxSkin.ItemIndex := Integer(Game.Skin);
|
---|
78 | end;
|
---|
79 |
|
---|
80 | procedure TFormNew.Save(Game: TGame);
|
---|
81 | begin
|
---|
82 | Game.Board.Size := Point(2 + ComboBoxSize.ItemIndex, 2 + ComboBoxSize.ItemIndex);
|
---|
83 | Game.UndoEnabled := CheckBoxUndoEnabled.Checked;
|
---|
84 | Game.RecordHistory := CheckBoxRecordHistory.Checked;
|
---|
85 | Game.Skin := TTileSkin(ComboBoxSkin.ItemIndex);
|
---|
86 | end;
|
---|
87 |
|
---|
88 | end.
|
---|
89 |
|
---|