source: trunk/Forms/UFormNew.pas

Last change on this file was 74, checked in by chronos, 4 years ago
  • Modified: Update locking on combobox fill.
File size: 1.9 KB
Line 
1unit UFormNew;
2
3{$mode delphi}{$H+}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
9 UGame;
10
11type
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
34var
35 FormNew: TFormNew;
36
37implementation
38
39{$R *.lfm}
40
41uses
42 UCore;
43
44{ TFormNew }
45
46procedure TFormNew.FormCreate(Sender: TObject);
47var
48 I: TTileSkin;
49begin
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;
60end;
61
62procedure TFormNew.FormShow(Sender: TObject);
63begin
64 Core.PersistentForm1.Load(Self);
65end;
66
67procedure TFormNew.FormClose(Sender: TObject; var CloseAction: TCloseAction);
68begin
69 Core.PersistentForm1.Save(Self);
70end;
71
72procedure TFormNew.Load(Game: TGame);
73begin
74 ComboBoxSize.ItemIndex := Game.Board.Size.X - 2;
75 CheckBoxUndoEnabled.Checked := Game.UndoEnabled;
76 CheckBoxRecordHistory.Checked := Game.RecordHistory;
77 ComboBoxSkin.ItemIndex := Integer(Game.Skin);
78end;
79
80procedure TFormNew.Save(Game: TGame);
81begin
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);
86end;
87
88end.
89
Note: See TracBrowser for help on using the repository browser.