-
Notifications
You must be signed in to change notification settings - Fork 29
/
uOptions.pas
112 lines (100 loc) · 2.86 KB
/
uOptions.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
unit uOptions;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, ExtCtrls, uConfig, Mask, JvToolEdit,
JvMaskEdit, JvSpin, JvExMask;
type
TfOptions = class(TForm)
Panel1: TPanel;
bOK: TButton;
bCancel: TButton;
pc: TPageControl;
tsDisplay: TTabSheet;
tsPrivacy: TTabSheet;
GroupBox1: TGroupBox;
cbTrackMRU: TCheckBox;
cbClearMRUOnExit: TCheckBox;
Label1: TLabel;
cbTimeDisplay: TComboBox;
cbShowFullPath: TCheckBox;
cbHideLibFuncs: TCheckBox;
bClearMRU: TButton;
Label2: TLabel;
tsMain: TTabSheet;
Label3: TLabel;
deWorkingDir: TJvDirectoryEdit;
cbHideFastFuncs: TCheckBox;
Label4: TLabel;
seFastThreshold: TJvSpinEdit;
seMaxMRUCount: TJvSpinEdit;
Label5: TLabel;
Editor: TTabSheet;
Label6: TLabel;
deEditorPath: TJvFilenameEdit;
Label7: TLabel;
procedure FormCreate(Sender: TObject);
procedure bOKClick(Sender: TObject);
procedure bClearMRUClick(Sender: TObject);
private
function GetConfig: TConfig;
{ Private declarations }
public
{ Public declarations }
property Config: TConfig read GetConfig;
end;
var
fOptions: TfOptions;
implementation
{$R *.dfm}
uses uMain;
procedure TfOptions.FormCreate(Sender: TObject);
begin
pc.ActivePageIndex := 0;
// fill stuff
// Main
deWorkingDir.Text := Config.WorkingDir;
// Display
cbTimeDisplay.ItemIndex := Ord(Config.TimeDisplay);
cbHideFastFuncs.Checked := Config.HideFastFuncs;
seFastThreshold.Value := Config.FastThreshold;
cbHideLibFuncs.Checked := Config.HideLibFuncs;
cbShowFullPath.Checked := Config.ShowFullPath;
// privacy
cbTrackMRU.Checked := Config.TrackMRU;
cbClearMRUOnExit.Checked := Config.ClearMRUOnExit;
seMaxMRUCount.Value := Config.MaxMRUCount;
//editor
deEditorPath.Text := Config.EditorPath;
end;
procedure TfOptions.bOKClick(Sender: TObject);
begin
// save stuff
// Main
Config.WorkingDir := deWorkingDir.Text;
// Display
Config.TimeDisplay := TTimeDisplay(cbTimeDisplay.ItemIndex);
Config.HideFastFuncs := cbHideFastFuncs.Checked;
Config.FastThreshold := seFastThreshold.AsInteger;
Config.HideLibFuncs := cbHideLibFuncs.Checked;
Config.ShowFullPath := cbShowFullPath.Checked;
// Privacy
Config.TrackMRU := cbTrackMRU.Checked;
Config.ClearMRUOnExit := cbClearMRUOnExit.Checked;
Config.MaxMRUCount := seMaxMRUCount.AsInteger;
//editor
Config.EditorPath := deEditorPath.Text;
// then save
Config.Save;
ModalResult := mrOk;
end;
function TfOptions.GetConfig: TConfig;
begin
Result := fMain.Config;
end;
procedure TfOptions.bClearMRUClick(Sender: TObject);
begin
Config.ClearMRU;
MessageDlg('Recent list cleared.', mtInformation, [mbOK], 0);
end;
end.