Repository navigation
Expand file tree
/
Copy pathuCustomize.pas
More file actions
141 lines (120 loc) · 3.04 KB
/
Copy pathuCustomize.pas
File metadata and controls
141 lines (120 loc) · 3.04 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
unit uCustomize;
interface
uses
System.SysUtils
, System.Types
, System.UITypes
, System.Classes
, FMX.Types
, FMX.Controls
, FMX.Forms
, FMX.Edit
, FMX.EditBox
, FMX.SpinBox
, FMX.StdCtrls
, FMX.Controls.Presentation
, FMX.Layouts
;
type
TfrmCustomize = class(TForm)
layoutRoot: TLayout;
layoutBase: TLayout;
lblPreferenceTitle: TLabel;
layoutButtonBase: TLayout;
btnOK: TButton;
btnCancel: TButton;
grpbxMenu: TGroupBox;
grpbxClickType: TGroupBox;
rdoActionTypeCopy: TRadioButton;
rdoActionTypeOpen: TRadioButton;
lblHistoryCount: TLabel;
spinHistoryCount: TSpinBox;
layoutHistoryCountBase: TLayout;
layoutHistoryClearButtonBase: TLayout;
btnHistoryClear: TButton;
layoutAutoRunBase: TLayout;
chbxAutoRun: TCheckBox;
grpbxSystem: TGroupBox;
procedure btnHistoryClearClick(Sender: TObject);
private class var
FCurrent: TfrmCustomize;
FIsShown: Boolean;
public
class function ShowCustomize(const iStyleBook: TStyleBook): Boolean;
class procedure BringToFrontSelf;
class property IsShown: Boolean read FIsShown;
end;
implementation
uses
PK.Utils.Dialogs
, PK.Utils.Form
, uConsts
, uIniManager
;
{$R *.fmx}
{ TfrmCustomize }
class procedure TfrmCustomize.BringToFrontSelf;
begin
if FCurrent <> nil then
begin
var U := TFormUtils.Create;
try
U.BringToFront(FCurrent);
finally
U.Free;
end;
end;
end;
procedure TfrmCustomize.btnHistoryClearClick(Sender: TObject);
begin
QueryYesNoDialog(
TMessageConsts.HistoryClear,
procedure (const iOK: Boolean)
begin
if iOK then
begin
TIniManager.Current.Clear;
ShowInfoDialog(TMessageConsts.HistoryCleared);
end;
end
);
end;
class function TfrmCustomize.ShowCustomize(
const iStyleBook: TStyleBook): Boolean;
begin
FCurrent := TfrmCustomize.Create(nil);
try
FCurrent.StyleBook := iStyleBook;
TFormUtils.SetMainScreenCenter(FCurrent);
// 設定読み込み
FCurrent.spinHistoryCount.Value := TIniManager.Current.MaxCount;
case TIniManager.Current.ActionType of
TIniManager.TActionType.atCopy:
FCurrent.rdoActionTypeCopy.IsChecked := True;
TIniManager.TActionType.atOpen:
FCurrent.rdoActionTypeOpen.IsChecked := True;
end;
FCurrent.chbxAutoRun.IsChecked := TIniManager.Current.AutoRun;
// 表示
FIsShown := True;
try
Result := FCurrent.ShowModal = mrOK;
finally
FIsShown := False;
end;
// 設定書き込み
if Result then
begin
TIniManager.Current.MaxCount := Trunc(FCurrent.spinHistoryCount.Value);
if FCurrent.rdoActionTypeCopy.IsChecked then
TIniManager.Current.ActionType := TIniManager.TActionType.atCopy;
if FCurrent.rdoActionTypeOpen.IsChecked then
TIniManager.Current.ActionType := TIniManager.TActionType.atOpen;
TIniManager.Current.AutoRun := FCurrent.chbxAutoRun.IsChecked;
TIniManager.Current.Save;
end;
finally
FreeAndNil(FCurrent);
end;
end;
end.