1 | unit FormSettings;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
---|
7 | Spin, ComCtrls, ExtCtrls, FormEx;
|
---|
8 |
|
---|
9 | type
|
---|
10 |
|
---|
11 | { TFormSettings }
|
---|
12 |
|
---|
13 | TFormSettings = class(TFormEx)
|
---|
14 | ButtonOk: TButton;
|
---|
15 | ButtonCancel: TButton;
|
---|
16 | CheckBox2: TCheckBox;
|
---|
17 | CheckBoxAutoSaveTurn: TCheckBox;
|
---|
18 | CheckBoxDevelMode: TCheckBox;
|
---|
19 | CheckBoxReopenLastFile: TCheckBox;
|
---|
20 | ComboBoxLanguage: TComboBox;
|
---|
21 | ComboBoxTheme: TComboBox;
|
---|
22 | Label1: TLabel;
|
---|
23 | Label2: TLabel;
|
---|
24 | Label3: TLabel;
|
---|
25 | Label4: TLabel;
|
---|
26 | Label5: TLabel;
|
---|
27 | Label6: TLabel;
|
---|
28 | PageControl1: TPageControl;
|
---|
29 | Panel1: TPanel;
|
---|
30 | Panel2: TPanel;
|
---|
31 | SpinEditAnimSpeed: TSpinEdit;
|
---|
32 | SpinEditX: TSpinEdit;
|
---|
33 | SpinEditY: TSpinEdit;
|
---|
34 | TabSheetGeneral: TTabSheet;
|
---|
35 | TabSheetDebug: TTabSheet;
|
---|
36 | procedure CheckBox2Change(Sender: TObject);
|
---|
37 | procedure FormCreate(Sender: TObject);
|
---|
38 | procedure FormShow(Sender: TObject);
|
---|
39 | public
|
---|
40 | procedure Load;
|
---|
41 | procedure Save;
|
---|
42 | end;
|
---|
43 |
|
---|
44 |
|
---|
45 | implementation
|
---|
46 |
|
---|
47 | {$R *.lfm}
|
---|
48 |
|
---|
49 | uses
|
---|
50 | Core, Languages, Theme;
|
---|
51 |
|
---|
52 | { TFormSettings }
|
---|
53 |
|
---|
54 | procedure TFormSettings.CheckBox2Change(Sender: TObject);
|
---|
55 | begin
|
---|
56 | SpinEditX.Enabled := not CheckBox2.Checked;
|
---|
57 | SpinEditY.Enabled := not CheckBox2.Checked;
|
---|
58 | end;
|
---|
59 |
|
---|
60 | procedure TFormSettings.FormCreate(Sender: TObject);
|
---|
61 | begin
|
---|
62 | PageControl1.TabIndex := 0;
|
---|
63 | Core.Core.ThemeManager1.Themes.LoadToStrings(ComboBoxTheme.Items);
|
---|
64 | Core.Core.Translator1.LanguageListToStrings(ComboBoxLanguage.Items);
|
---|
65 | end;
|
---|
66 |
|
---|
67 | procedure TFormSettings.FormShow(Sender: TObject);
|
---|
68 | begin
|
---|
69 | {$IFDEF DEBUG}
|
---|
70 | TabSheetDebug.TabVisible := True;
|
---|
71 | {$ELSE}
|
---|
72 | TabSheetDebug.TabVisible := False;
|
---|
73 | {$ENDIF}
|
---|
74 | end;
|
---|
75 |
|
---|
76 | procedure TFormSettings.Load;
|
---|
77 | begin
|
---|
78 | ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.Core.Translator1.Language);
|
---|
79 | if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
|
---|
80 | ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.Core.ThemeManager1.Theme);
|
---|
81 | if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0;
|
---|
82 | CheckBoxDevelMode.Checked := Core.Core.DevelMode;
|
---|
83 | SpinEditAnimSpeed.Value := Core.Core.AnimationSpeed;
|
---|
84 | CheckBox2.Checked := Core.Core.ScaleDPI1.AutoDetect;
|
---|
85 | SpinEditX.Value := Core.Core.ScaleDPI1.DPI.X;
|
---|
86 | SpinEditY.Value := Core.Core.ScaleDPI1.DPI.Y;
|
---|
87 | CheckBoxAutoSaveTurn.Checked := Core.Core.AutoSaveEnabled;
|
---|
88 | CheckBoxReopenLastFile.Checked := Core.Core.ReopenLastFile;
|
---|
89 | end;
|
---|
90 |
|
---|
91 | procedure TFormSettings.Save;
|
---|
92 | begin
|
---|
93 | if ComboBoxLanguage.ItemIndex <> -1 then
|
---|
94 | Core.Core.Translator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
|
---|
95 | if ComboBoxTheme.ItemIndex <> -1 then
|
---|
96 | Core.Core.ThemeManager1.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
|
---|
97 | Core.Core.DevelMode := CheckBoxDevelMode.Checked;
|
---|
98 | Core.Core.AnimationSpeed := SpinEditAnimSpeed.Value;
|
---|
99 | Core.Core.ScaleDPI1.AutoDetect := CheckBox2.Checked;
|
---|
100 | Core.Core.ScaleDPI1.DPI := Point(SpinEditX.Value, SpinEditY.Value);
|
---|
101 | Core.Core.AutoSaveEnabled := CheckBoxAutoSaveTurn.Checked;
|
---|
102 | Core.Core.ReopenLastFile := CheckBoxReopenLastFile.Checked;
|
---|
103 | end;
|
---|
104 |
|
---|
105 | end.
|
---|
106 |
|
---|