1 | unit UFormSettings;
|
---|
2 |
|
---|
3 | {$mode delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
---|
9 | Menus, Spin, ExtCtrls, ULanguages;
|
---|
10 |
|
---|
11 | type
|
---|
12 |
|
---|
13 | { TFormSettings }
|
---|
14 |
|
---|
15 | TFormSettings = class(TForm)
|
---|
16 | Bevel1: TBevel;
|
---|
17 | ButtonOk: TButton;
|
---|
18 | ButtonCancel: TButton;
|
---|
19 | CheckBoxReopenLastFileOnStart: TCheckBox;
|
---|
20 | CheckBoxAutomaticDPI: TCheckBox;
|
---|
21 | CheckBoxStartMinimizedToTray: TCheckBox;
|
---|
22 | CheckBoxStartOnLogon: TCheckBox;
|
---|
23 | CheckBoxAlwaysOnTop: TCheckBox;
|
---|
24 | ComboBoxLanguage: TComboBox;
|
---|
25 | Label1: TLabel;
|
---|
26 | Label2: TLabel;
|
---|
27 | SpinEditDPI: TSpinEdit;
|
---|
28 | procedure ButtonOkClick(Sender: TObject);
|
---|
29 | procedure CheckBoxAutomaticDPIChange(Sender: TObject);
|
---|
30 | procedure CheckBoxStartOnLogonChange(Sender: TObject);
|
---|
31 | procedure FormCreate(Sender: TObject);
|
---|
32 | procedure FormShow(Sender: TObject);
|
---|
33 | private
|
---|
34 | { private declarations }
|
---|
35 | public
|
---|
36 | procedure Load;
|
---|
37 | procedure Save;
|
---|
38 | procedure UpdateInterface;
|
---|
39 | end;
|
---|
40 |
|
---|
41 | var
|
---|
42 | FormSettings: TFormSettings;
|
---|
43 |
|
---|
44 | implementation
|
---|
45 |
|
---|
46 | {$R *.lfm}
|
---|
47 |
|
---|
48 | uses
|
---|
49 | UCore;
|
---|
50 |
|
---|
51 | { TFormSettings }
|
---|
52 |
|
---|
53 | procedure TFormSettings.FormShow(Sender: TObject);
|
---|
54 | begin
|
---|
55 | Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
|
---|
56 | ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language);
|
---|
57 | if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
|
---|
58 | end;
|
---|
59 |
|
---|
60 | procedure TFormSettings.ButtonOkClick(Sender: TObject);
|
---|
61 | begin
|
---|
62 | if ComboBoxLanguage.ItemIndex <> -1 then
|
---|
63 | Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
|
---|
64 | end;
|
---|
65 |
|
---|
66 | procedure TFormSettings.CheckBoxAutomaticDPIChange(Sender: TObject);
|
---|
67 | begin
|
---|
68 | UpdateInterface;
|
---|
69 | end;
|
---|
70 |
|
---|
71 | procedure TFormSettings.CheckBoxStartOnLogonChange(Sender: TObject);
|
---|
72 | begin
|
---|
73 | UpdateInterface;
|
---|
74 | end;
|
---|
75 |
|
---|
76 | procedure TFormSettings.FormCreate(Sender: TObject);
|
---|
77 | begin
|
---|
78 | Core.CoolTranslator1.TranslateComponentRecursive(Self);
|
---|
79 | end;
|
---|
80 |
|
---|
81 | procedure TFormSettings.Load;
|
---|
82 | begin
|
---|
83 | CheckBoxAlwaysOnTop.Checked := Core.AlwaysOnTop;
|
---|
84 | CheckBoxStartOnLogon.Checked := Core.StartOnLogon;
|
---|
85 | CheckBoxStartMinimizedToTray.Checked := Core.StartMinimizedToTray;
|
---|
86 | CheckBoxAutomaticDPI.Checked := Core.ScaleDPI1.AutoDetect;
|
---|
87 | SpinEditDPI.Value := Core.ScaleDPI1.DPI.X;
|
---|
88 | CheckBoxReopenLastFileOnStart.Checked := Core.ReopenLastFileOnStart;
|
---|
89 | UpdateInterface;
|
---|
90 | end;
|
---|
91 |
|
---|
92 | procedure TFormSettings.Save;
|
---|
93 | begin
|
---|
94 | Core.AlwaysOnTop := CheckBoxAlwaysOnTop.Checked;
|
---|
95 | Core.StartOnLogon := CheckBoxStartOnLogon.Checked;
|
---|
96 | Core.StartMinimizedToTray := CheckBoxStartMinimizedToTray.Checked;
|
---|
97 | Core.ScaleDPI1.AutoDetect := CheckBoxAutomaticDPI.Checked;
|
---|
98 | Core.ScaleDPI1.DPI := Point(SpinEditDPI.Value, SpinEditDPI.Value);
|
---|
99 | Core.ReopenLastFileOnStart := CheckBoxReopenLastFileOnStart.Checked;
|
---|
100 | end;
|
---|
101 |
|
---|
102 | procedure TFormSettings.UpdateInterface;
|
---|
103 | begin
|
---|
104 | CheckBoxStartMinimizedToTray.Enabled := CheckBoxStartOnLogon.Checked;
|
---|
105 | SpinEditDPI.Enabled := not CheckBoxAutomaticDPI.Checked;
|
---|
106 | Label2.Enabled := not CheckBoxAutomaticDPI.Checked;
|
---|
107 | end;
|
---|
108 |
|
---|
109 | end.
|
---|
110 |
|
---|