-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfrmOptions.pas
84 lines (72 loc) · 1.86 KB
/
frmOptions.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
unit frmOptions;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TFormOptions = class(TForm)
chkDropWord: TCheckBox;
lblImgSIze: TLabel;
cbbImagesSize: TComboBox;
btnOK: TButton;
btnCancel: TButton;
lblCallTipAutoTimeout: TLabel;
edtHintTimeout: TEdit;
btnDefault: TButton;
procedure btnDefaultClick(Sender: TObject);
private
procedure LoadOptions;
procedure CommitOptions;
{ Private declarations }
public
{ Public declarations }
end;
function ShowOptions: Boolean;
implementation
uses
PyJediOptions;
const
cDisabledHintTimeout = 10000000;
{$R *.dfm}
function ShowOptions: Boolean;
begin
Result := false;
with TFormOptions.Create(nil) do
try
LoadOptions;
if ShowModal = mrOk then
begin
CommitOptions;
Result := True;
end;
finally
Free;
end;
end;
procedure TFormOptions.btnDefaultClick(Sender: TObject);
begin
PJOptions := __defaultOptions;
LoadOptions;
end;
procedure TFormOptions.CommitOptions;
begin
PJOptions.DropRestOfWord := chkDropWord.Checked;
if cbbImagesSize.ItemIndex >= 0 then
PJOptions.ImagesSize := StrToIntDef(cbbImagesSize.Text, 16)
else
PJOptions.ImagesSize := 16;
PJOptions.CallTipAutoTimeout := StrToIntDef(edtHintTimeout.Text, cDisabledHintTimeout);
if PJOptions.CallTipAutoTimeout < 0 then
PJOptions.CallTipAutoTimeout := cDisabledHintTimeout;
end;
procedure TFormOptions.LoadOptions;
begin
chkDropWord.Checked := PJOptions.DropRestOfWord;
cbbImagesSize.ItemIndex := cbbImagesSize.Items.IndexOf(
IntToStr(PJOptions.ImagesSize));
if PJOptions.CallTipAutoTimeout = cDisabledHintTimeout then
edtHintTimeout.Text := '-1'
else
edtHintTimeout.Text := IntToStr(PJOptions.CallTipAutoTimeout);
end;
end.