Skip to content

Commit 7172b54

Browse files
committed
Update config compilers dlg with auto-detect option
A check box was added to FmCompilersDlg that enables/disables the option to detect and register compilers at start up. Value of the option is stored in the config file via the TCompilerSettings class from Compilers.USettings unit.
1 parent 4ec90ae commit 7172b54

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

Src/FmCompilersDlg.dfm

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ inherited CompilersDlg: TCompilersDlg
138138
end
139139
end
140140
inherited btnHelp: TButton
141-
TabOrder = 4
141+
TabOrder = 5
142142
end
143143
inherited btnCancel: TButton
144-
TabOrder = 3
144+
TabOrder = 4
145145
end
146146
inherited btnOK: TButton
147-
TabOrder = 2
147+
TabOrder = 3
148148
OnClick = btnOKClick
149149
end
150150
object btnDetect: TButton
@@ -153,7 +153,17 @@ inherited CompilersDlg: TCompilersDlg
153153
Width = 153
154154
Height = 25
155155
Caption = '&Detect Delphi Compilers'
156-
TabOrder = 1
156+
TabOrder = 2
157157
OnClick = btnDetectClick
158158
end
159+
object chkStartupDetection: TCheckBox
160+
Left = 8
161+
Top = 336
162+
Width = 417
163+
Height = 17
164+
Caption =
165+
'Automatically register newly installed Delphi compilers at progr' +
166+
'am startup'
167+
TabOrder = 1
168+
end
159169
end

Src/FmCompilersDlg.pas

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ TCompilersDlg = class(TGenericOKDlg, INoPublicConstruct)
4545
frmSearchDirs: TCompilersDlgSearchDirsFrame;
4646
tsNamespaces: TTabSheet;
4747
frmNamespaces: TCompilersDlgNamespacesFrame;
48+
chkStartupDetection: TCheckBox;
4849
/// <summary>When Auto Detect Compilers button is clicked, sets executable
4950
/// program path for each installed compiler that can detect its own path.
5051
/// </summary>
@@ -124,6 +125,7 @@ implementation
124125
// Project
125126
Compilers.UAutoDetect,
126127
Compilers.UCompilers,
128+
Compilers.USettings,
127129
IntfCommon,
128130
UCtrlArranger,
129131
UExeFileType,
@@ -147,9 +149,16 @@ procedure TCompilersDlg.ArrangeForm;
147149
);
148150
// size dialogue and arrange inherited controls
149151
inherited;
150-
// arrange extra button in bottom button line
151-
btnDetect.Left := pnlBody.Left;
152-
btnDetect.Top := btnHelp.Top;
152+
TCtrlArranger.AlignLefts([btnDetect, chkStartupDetection], pnlBody.Left);
153+
// place chkStartupDetection below bevel under body panel
154+
TCtrlArranger.MoveBelow(bvlBottom, chkStartupDetection, 8);
155+
// push buttons below chkStartupDetection
156+
TCtrlArranger.AlignTops(
157+
[btnDetect, btnOK, btnCancel, btnHelp],
158+
TCtrlArranger.BottomOf(chkStartupDetection, 8)
159+
);
160+
// stretch form height to accomodate insertion of chkStartupDetection
161+
ClientHeight := TCtrlArranger.BottomOf(btnHelp, 6);
153162
end;
154163

155164
procedure TCompilersDlg.btnDetectClick(Sender: TObject);
@@ -237,12 +246,15 @@ class function TCompilersDlg.Execute(AOwner: TComponent;
237246
Dlg := InternalCreate(AOwner);
238247
try
239248
(Dlg.fLocalCompilers as IAssignable).Assign(ACompilers);
249+
Dlg.chkStartupDetection.Checked := TCompilerSettings.PermitStartupDetection;
240250
Result := Dlg.ShowModal = mrOK;
241251
if Result then
242252
begin
243253
(ACompilers as IAssignable).Assign(Dlg.fLocalCompilers);
244254
Persister := TPersistCompilers.Create;
245255
Persister.Save(ACompilers);
256+
TCompilerSettings.PermitStartupDetection :=
257+
Dlg.chkStartupDetection.Checked;
246258
end;
247259
finally
248260
Dlg.Free;

0 commit comments

Comments
 (0)