source: trunk/Forms/UFormSettings.pas

Last change on this file was 34, checked in by chronos, 8 years ago
  • Added: Interface localization support.
  • Added: Global settings dialog.
File size: 2.1 KB
Line 
1unit UFormSettings;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
9 Spin, ComCtrls;
10
11type
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
39var
40 FormSettings: TFormSettings;
41
42implementation
43
44{$R *.lfm}
45
46uses
47 UCore, ULanguages;
48
49{ TFormSettings }
50
51procedure TFormSettings.CheckBox2Change(Sender: TObject);
52begin
53 SpinEditX.Enabled := not CheckBox2.Checked;
54 SpinEditY.Enabled := not CheckBox2.Checked;
55end;
56
57procedure TFormSettings.FormCreate(Sender: TObject);
58begin
59 PageControl1.TabIndex := 0;
60end;
61
62procedure TFormSettings.FormShow(Sender: TObject);
63begin
64 {$IFDEF DEBUG}
65 TabSheetDebug.TabVisible := True;
66 {$ELSE}
67 TabSheetDebug.TabVisible := False;
68 {$ENDIF}
69end;
70
71procedure TFormSettings.Load;
72begin
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;
80end;
81
82procedure TFormSettings.Save;
83begin
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);
89end;
90
91end.
92
Note: See TracBrowser for help on using the repository browser.