1 | unit UFormSettings;
|
---|
2 |
|
---|
3 | {$mode delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
---|
9 | ULanguages;
|
---|
10 |
|
---|
11 | type
|
---|
12 |
|
---|
13 | { TFormSettings }
|
---|
14 |
|
---|
15 | TFormSettings = class(TForm)
|
---|
16 | ButtonOk: TButton;
|
---|
17 | ButtonCancel: TButton;
|
---|
18 | CheckBoxStartMinimizedToTray: TCheckBox;
|
---|
19 | CheckBoxStartOnLogon: TCheckBox;
|
---|
20 | CheckBoxAlwaysOnTop: TCheckBox;
|
---|
21 | ComboBoxLanguage: TComboBox;
|
---|
22 | Label1: TLabel;
|
---|
23 | procedure ButtonOkClick(Sender: TObject);
|
---|
24 | procedure CheckBoxStartOnLogonChange(Sender: TObject);
|
---|
25 | procedure FormShow(Sender: TObject);
|
---|
26 | private
|
---|
27 | { private declarations }
|
---|
28 | public
|
---|
29 | procedure Load;
|
---|
30 | procedure Save;
|
---|
31 | procedure UpdateInterface;
|
---|
32 | end;
|
---|
33 |
|
---|
34 | var
|
---|
35 | FormSettings: TFormSettings;
|
---|
36 |
|
---|
37 | implementation
|
---|
38 |
|
---|
39 | {$R *.lfm}
|
---|
40 |
|
---|
41 | uses
|
---|
42 | UFormMain, UCore;
|
---|
43 |
|
---|
44 | { TFormSettings }
|
---|
45 |
|
---|
46 | procedure TFormSettings.FormShow(Sender: TObject);
|
---|
47 | begin
|
---|
48 | FormMain.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
|
---|
49 | ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(FormMain.CoolTranslator1.Language);
|
---|
50 | if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
|
---|
51 | end;
|
---|
52 |
|
---|
53 | procedure TFormSettings.ButtonOkClick(Sender: TObject);
|
---|
54 | begin
|
---|
55 | if ComboBoxLanguage.ItemIndex <> -1 then
|
---|
56 | FormMain.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
|
---|
57 | end;
|
---|
58 |
|
---|
59 | procedure TFormSettings.CheckBoxStartOnLogonChange(Sender: TObject);
|
---|
60 | begin
|
---|
61 | UpdateInterface;
|
---|
62 | end;
|
---|
63 |
|
---|
64 | procedure TFormSettings.Load;
|
---|
65 | begin
|
---|
66 | CheckBoxAlwaysOnTop.Checked := Core.AlwaysOnTop;
|
---|
67 | CheckBoxStartOnLogon.Checked := Core.StartOnLogon;
|
---|
68 | CheckBoxStartMinimizedToTray.Checked := Core.StartMinimizedToTray;
|
---|
69 | UpdateInterface;
|
---|
70 | end;
|
---|
71 |
|
---|
72 | procedure TFormSettings.Save;
|
---|
73 | begin
|
---|
74 | Core.AlwaysOnTop := CheckBoxAlwaysOnTop.Checked;
|
---|
75 | Core.StartOnLogon := CheckBoxStartOnLogon.Checked;
|
---|
76 | Core.StartMinimizedToTray := CheckBoxStartMinimizedToTray.Checked;
|
---|
77 | end;
|
---|
78 |
|
---|
79 | procedure TFormSettings.UpdateInterface;
|
---|
80 | begin
|
---|
81 | CheckBoxStartMinimizedToTray.Enabled := CheckBoxStartOnLogon.Checked;
|
---|
82 | end;
|
---|
83 |
|
---|
84 | end.
|
---|
85 |
|
---|