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