1 | unit FormNew;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
---|
7 | Game, FormEx;
|
---|
8 |
|
---|
9 | type
|
---|
10 |
|
---|
11 | { TFormNew }
|
---|
12 |
|
---|
13 | TFormNew = class(TFormEx)
|
---|
14 | ButtonCancel: TButton;
|
---|
15 | ButtonOk: TButton;
|
---|
16 | CheckBoxRecordHistory: TCheckBox;
|
---|
17 | CheckBoxUndoEnabled: TCheckBox;
|
---|
18 | ComboBoxColorPalette: TComboBox;
|
---|
19 | ComboBoxSize: TComboBox;
|
---|
20 | ComboBoxSkin: TComboBox;
|
---|
21 | Label1: TLabel;
|
---|
22 | Label2: TLabel;
|
---|
23 | Label3: TLabel;
|
---|
24 | ScrollBox1: TScrollBox;
|
---|
25 | procedure FormCreate(Sender: TObject);
|
---|
26 | public
|
---|
27 | procedure Load(Game: TGame);
|
---|
28 | procedure Save(Game: TGame);
|
---|
29 | end;
|
---|
30 |
|
---|
31 |
|
---|
32 | implementation
|
---|
33 |
|
---|
34 | {$R *.lfm}
|
---|
35 |
|
---|
36 | { TFormNew }
|
---|
37 |
|
---|
38 | procedure TFormNew.FormCreate(Sender: TObject);
|
---|
39 | var
|
---|
40 | TileSkin: TTileSkin;
|
---|
41 | ColorPalette: TColorPalette;
|
---|
42 | begin
|
---|
43 | ComboBoxSkin.Items.BeginUpdate;
|
---|
44 | try
|
---|
45 | ComboBoxSkin.Items.Clear;
|
---|
46 | for TileSkin := Low(SkinText) to High(SkinText) do
|
---|
47 | ComboBoxSkin.Items.Add(SkinText[TileSkin]);
|
---|
48 | finally
|
---|
49 | ComboBoxSkin.Items.EndUpdate;
|
---|
50 | end;
|
---|
51 |
|
---|
52 | ComboBoxColorPalette.Items.BeginUpdate;
|
---|
53 | try
|
---|
54 | ComboBoxColorPalette.Items.Clear;
|
---|
55 | for ColorPalette := Low(ColorPaletteText) to High(ColorPaletteText) do
|
---|
56 | ComboBoxColorPalette.Items.Add(ColorPaletteText[ColorPalette]);
|
---|
57 | finally
|
---|
58 | ComboBoxColorPalette.Items.EndUpdate;
|
---|
59 | end;
|
---|
60 | end;
|
---|
61 |
|
---|
62 | procedure TFormNew.Load(Game: TGame);
|
---|
63 | begin
|
---|
64 | ComboBoxSize.ItemIndex := Game.Board.Size.X - 2;
|
---|
65 | CheckBoxUndoEnabled.Checked := Game.UndoEnabled;
|
---|
66 | CheckBoxRecordHistory.Checked := Game.RecordHistory;
|
---|
67 | ComboBoxSkin.ItemIndex := Integer(Game.Skin);
|
---|
68 | ComboBoxColorPalette.ItemIndex := Integer(Game.ColorPalette);
|
---|
69 | end;
|
---|
70 |
|
---|
71 | procedure TFormNew.Save(Game: TGame);
|
---|
72 | begin
|
---|
73 | Game.Board.Size := Point(2 + ComboBoxSize.ItemIndex, 2 + ComboBoxSize.ItemIndex);
|
---|
74 | Game.UndoEnabled := CheckBoxUndoEnabled.Checked;
|
---|
75 | Game.RecordHistory := CheckBoxRecordHistory.Checked;
|
---|
76 | Game.Skin := TTileSkin(ComboBoxSkin.ItemIndex);
|
---|
77 | Game.ColorPalette := TColorPalette(ComboBoxColorPalette.ItemIndex);
|
---|
78 | end;
|
---|
79 |
|
---|
80 | end.
|
---|
81 |
|
---|