source: tags/1.1.0/Forms/UFormNew.pas

Last change on this file was 36, checked in by chronos, 5 years ago
  • Fixed: Missing UFormHistory files.
  • Added: Allow to disable moves history recording.
File size: 1.4 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 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
32var
33 FormNew: TFormNew;
34
35implementation
36
37{$R *.lfm}
38
39uses
40 UCore;
41
42{ TFormNew }
43
44procedure TFormNew.FormCreate(Sender: TObject);
45begin
46 Core.Translator1.TranslateComponentRecursive(Self);
47end;
48
49procedure TFormNew.FormShow(Sender: TObject);
50begin
51 Core.PersistentForm1.Load(Self);
52end;
53
54procedure TFormNew.FormClose(Sender: TObject; var CloseAction: TCloseAction);
55begin
56 Core.PersistentForm1.Save(Self);
57end;
58
59procedure TFormNew.Load(Game: TGame);
60begin
61 ComboBoxSize.ItemIndex := Game.Board.Size.X - 2;
62 CheckBoxUndoEnabled.Checked := Game.UndoEnabled;
63 CheckBoxRecordHistory.Checked := Game.RecordHistory;
64end;
65
66procedure TFormNew.Save(Game: TGame);
67begin
68 Game.Board.Size := Point(2 + ComboBoxSize.ItemIndex, 2 + ComboBoxSize.ItemIndex);
69 Game.UndoEnabled := CheckBoxUndoEnabled.Checked;
70 Game.RecordHistory := CheckBoxRecordHistory.Checked;
71end;
72
73end.
74
Note: See TracBrowser for help on using the repository browser.