source: trunk/Forms/FormNew.pas

Last change on this file was 89, checked in by chronos, 3 months ago
  • Added: Allow to select color palette in new game dialog.
  • Fixed: Use scrollboxes in options dialogs.
File size: 1.9 KB
Line 
1unit FormNew;
2
3interface
4
5uses
6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
7 Game, FormEx;
8
9type
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
32implementation
33
34{$R *.lfm}
35
36{ TFormNew }
37
38procedure TFormNew.FormCreate(Sender: TObject);
39var
40 TileSkin: TTileSkin;
41 ColorPalette: TColorPalette;
42begin
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;
60end;
61
62procedure TFormNew.Load(Game: TGame);
63begin
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);
69end;
70
71procedure TFormNew.Save(Game: TGame);
72begin
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);
78end;
79
80end.
81
Note: See TracBrowser for help on using the repository browser.