fix #267 - Editing a compiler path only works when using the dialogs opened by the right buttons

This commit is contained in:
Basile Burg 2018-03-13 02:22:36 +01:00
parent 5dcf8257f0
commit 614d7a018f
2 changed files with 193 additions and 122 deletions

View File

@ -6,36 +6,36 @@ object CompilersPathsEditor: TCompilersPathsEditor
Caption = 'CompilersPathsEditor'
ClientHeight = 900
ClientWidth = 460
LCLVersion = '1.8.0.6'
LCLVersion = '1.8.2.0'
object ScrollBox1: TScrollBox
Left = 0
Height = 900
Top = 0
Width = 460
HorzScrollBar.Page = 116
VertScrollBar.Page = 897
HorzScrollBar.Page = 189
VertScrollBar.Page = 796
Align = alClient
AutoSize = True
ClientHeight = 898
ClientWidth = 458
ClientHeight = 896
ClientWidth = 456
TabOrder = 0
object grpDMD: TGroupBox
Left = 0
Height = 169
Top = 52
Width = 458
Height = 149
Top = 51
Width = 456
Align = alTop
AutoSize = True
Caption = 'DMD'
ClientHeight = 150
ClientWidth = 454
ClientHeight = 129
ClientWidth = 452
TabOrder = 0
object selDMDexe: TFileNameEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the compiler'
Top = 23
Width = 450
Top = 18
Width = 448
FilterIndex = 0
HideDirectories = False
ButtonWidth = 23
@ -49,10 +49,10 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object selDMDrt: TDirectoryEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the root of druntime sources'
Top = 73
Width = 450
Top = 61
Width = 448
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -65,10 +65,10 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object selDMDstd: TDirectoryEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the root of phobos sources'
Top = 123
Width = 450
Top = 104
Width = 448
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -81,9 +81,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText1: TStaticText
Left = 0
Height = 21
Height = 16
Top = 0
Width = 454
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -92,9 +92,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText2: TStaticText
Left = 0
Height = 21
Top = 50
Width = 454
Height = 16
Top = 43
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -103,9 +103,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText3: TStaticText
Left = 0
Height = 21
Top = 100
Width = 454
Height = 16
Top = 86
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -115,21 +115,21 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object grpGDC: TGroupBox
Left = 0
Height = 169
Top = 221
Width = 458
Height = 149
Top = 200
Width = 456
Align = alTop
AutoSize = True
Caption = 'GDC'
ClientHeight = 150
ClientWidth = 454
ClientHeight = 129
ClientWidth = 452
TabOrder = 1
object selGDCexe: TFileNameEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the compiler'
Top = 23
Width = 450
Top = 18
Width = 448
FilterIndex = 0
HideDirectories = False
ButtonWidth = 23
@ -143,10 +143,10 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object selGDCrt: TDirectoryEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the root of druntime sources'
Top = 73
Width = 450
Top = 61
Width = 448
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -159,10 +159,10 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object selGDCstd: TDirectoryEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the root of phobos sources'
Top = 123
Width = 450
Top = 104
Width = 448
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -175,9 +175,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText4: TStaticText
Left = 0
Height = 21
Height = 16
Top = 0
Width = 454
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -186,9 +186,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText5: TStaticText
Left = 0
Height = 21
Top = 50
Width = 454
Height = 16
Top = 43
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -197,9 +197,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText6: TStaticText
Left = 0
Height = 21
Top = 100
Width = 454
Height = 16
Top = 86
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -209,21 +209,21 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object grpLDC: TGroupBox
Left = 0
Height = 169
Top = 390
Width = 458
Height = 149
Top = 349
Width = 456
Align = alTop
AutoSize = True
Caption = 'LDC'
ClientHeight = 150
ClientWidth = 454
ClientHeight = 129
ClientWidth = 452
TabOrder = 2
object selLDCexe: TFileNameEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the compiler'
Top = 23
Width = 450
Top = 18
Width = 448
FilterIndex = 0
HideDirectories = False
ButtonWidth = 23
@ -237,10 +237,10 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object selLDCrt: TDirectoryEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the root of LDC runtime & phobos sources (can be a common folder)'
Top = 73
Width = 450
Top = 61
Width = 448
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -253,10 +253,10 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object selLDCstd: TDirectoryEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the root of phobos sources (can be empty)'
Top = 123
Width = 450
Top = 104
Width = 448
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -269,9 +269,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText7: TStaticText
Left = 0
Height = 21
Height = 16
Top = 0
Width = 454
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -280,9 +280,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText8: TStaticText
Left = 0
Height = 21
Top = 50
Width = 454
Height = 16
Top = 43
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -291,9 +291,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText9: TStaticText
Left = 0
Height = 21
Top = 100
Width = 454
Height = 16
Top = 86
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -303,21 +303,21 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object grpUSER1: TGroupBox
Left = 0
Height = 169
Top = 559
Width = 458
Height = 149
Top = 498
Width = 456
Align = alTop
AutoSize = True
Caption = 'User 1'
ClientHeight = 150
ClientWidth = 454
ClientHeight = 129
ClientWidth = 452
TabOrder = 3
object selUSER1exe: TFileNameEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the compiler'
Top = 23
Width = 450
Top = 18
Width = 448
FilterIndex = 0
HideDirectories = False
ButtonWidth = 23
@ -331,10 +331,10 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object selUSER1rt: TDirectoryEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the root of druntime sources'
Top = 73
Width = 450
Top = 61
Width = 448
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -347,10 +347,10 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object selUSER1std: TDirectoryEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the root of phobos sources'
Top = 123
Width = 450
Top = 104
Width = 448
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -363,9 +363,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText10: TStaticText
Left = 0
Height = 21
Height = 16
Top = 0
Width = 454
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -374,9 +374,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText11: TStaticText
Left = 0
Height = 21
Top = 50
Width = 454
Height = 16
Top = 43
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -385,9 +385,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText12: TStaticText
Left = 0
Height = 21
Top = 100
Width = 454
Height = 16
Top = 86
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -397,21 +397,21 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object grpUSER2: TGroupBox
Left = 0
Height = 169
Top = 728
Width = 458
Height = 149
Top = 647
Width = 456
Align = alTop
AutoSize = True
Caption = 'User 2'
ClientHeight = 150
ClientWidth = 454
ClientHeight = 129
ClientWidth = 452
TabOrder = 4
object selUSER2exe: TFileNameEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the compiler'
Top = 23
Width = 450
Top = 18
Width = 448
FilterIndex = 0
HideDirectories = False
ButtonWidth = 23
@ -425,10 +425,10 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object selUSER2rt: TDirectoryEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the root of druntime sources'
Top = 73
Width = 450
Top = 61
Width = 448
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -441,10 +441,10 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object selUSER2std: TDirectoryEdit
Left = 2
Height = 25
Height = 23
Hint = 'select the root of phobos sources'
Top = 123
Width = 450
Top = 104
Width = 448
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -457,9 +457,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText13: TStaticText
Left = 0
Height = 21
Height = 16
Top = 0
Width = 454
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -468,9 +468,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText14: TStaticText
Left = 0
Height = 21
Top = 50
Width = 454
Height = 16
Top = 43
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -479,9 +479,9 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object StaticText15: TStaticText
Left = 0
Height = 21
Top = 100
Width = 454
Height = 16
Top = 86
Width = 452
Align = alTop
Alignment = taCenter
AutoSize = True
@ -491,24 +491,24 @@ object CompilersPathsEditor: TCompilersPathsEditor
end
object GroupBox6: TGroupBox
Left = 0
Height = 52
Height = 51
Top = 0
Width = 458
Width = 456
Align = alTop
AutoSize = True
Caption = 'Default compiler for completion'
ClientHeight = 33
ClientWidth = 454
ClientHeight = 31
ClientWidth = 452
TabOrder = 5
object selDefault: TComboBox
Left = 4
Height = 25
Height = 23
Hint = 'select which the compiler for which the library paths are used by the completion daemon'
Top = 4
Width = 446
Width = 444
Align = alClient
BorderSpacing.Around = 4
ItemHeight = 0
ItemHeight = 15
ItemIndex = 0
Items.Strings = (
'DMD'

View File

@ -73,6 +73,8 @@ type
property modified: boolean read fModified write fModified;
end;
{ TCompilersPathsEditor }
TCompilersPathsEditor = class(TForm, ICEEditableOptions, ICECompilerSelector, ICEProjectObserver)
selDefault: TComboBox;
selDMDrt: TDirectoryEdit;
@ -117,6 +119,9 @@ type
fPaths: TCompilersPaths;
fPathsBackup: TCompilersPaths;
fProj: ICECommonProject;
procedure editedExe(sender: TObject);
procedure editedRt(sender: TObject);
procedure editedStd(sender: TObject);
procedure selectedExe(sender: TObject; var value: string);
procedure selectedRt(sender: TObject; var value: string);
procedure selectedStd(sender: TObject; var value: string);
@ -190,18 +195,33 @@ begin
selLDCexe.OnAcceptFileName:= @selectedExe;
selUSER1exe.OnAcceptFileName:= @selectedExe;
selUSER2exe.OnAcceptFileName:= @selectedExe;
selDMDexe.OnEditingDone:= @editedExe;
selGDCexe.OnEditingDone:= @editedExe;
selLDCexe.OnEditingDone:= @editedExe;
selUSER1exe.OnEditingDone:= @editedExe;
selUSER2exe.OnEditingDone:= @editedExe;
selDMDrt.OnAcceptDirectory:= @selectedRt;
selGDCrt.OnAcceptDirectory:= @selectedRt;
selLDCrt.OnAcceptDirectory:= @selectedRt;
selUSER1rt.OnAcceptDirectory:= @selectedRt;
selUSER2rt.OnAcceptDirectory:= @selectedRt;
selDMDrt.OnEditingDone:= @editedRt;
selGDCrt.OnEditingDone:= @editedRt;
selLDCrt.OnEditingDone:= @editedRt;
selUSER1rt.OnEditingDone:= @editedRt;
selUSER2rt.OnEditingDone:= @editedRt;
selDMDstd.OnAcceptDirectory:= @selectedStd;
selGDCstd.OnAcceptDirectory:= @selectedStd;
selLDCstd.OnAcceptDirectory:= @selectedStd;
selUSER1std.OnAcceptDirectory:= @selectedStd;
selUSER2std.OnAcceptDirectory:= @selectedStd;
selDMDstd.OnEditingDone:= @editedStd;
selGDCstd.OnEditingDone:= @editedStd;
selLDCstd.OnEditingDone:= @editedStd;
selUSER1std.OnEditingDone:= @editedStd;
selUSER2std.OnEditingDone:= @editedStd;
selDefault.OnSelect:= @selectedDefault;
@ -618,6 +638,23 @@ begin
fPaths.User2ExeName:=value;
end;
procedure TCompilersPathsEditor.editedExe(sender: TObject);
var
ctrl: TWinControl;
begin
ctrl := TWinControl(sender);
if ctrl.Parent = grpDMD then
fPaths.DmdExeName:=selDMDexe.FileName
else if ctrl.Parent = grpGDC then
fPaths.GDCExeName:=selGDCexe.FileName
else if ctrl.Parent = grpLDC then
fPaths.LdcExeName:=selLDCexe.FileName
else if ctrl.Parent = grpUSER1 then
fPaths.User1ExeName:=selUSER1exe.FileName
else if ctrl.Parent = grpUSER2 then
fPaths.User2ExeName:=selUSER2exe.FileName;
end;
procedure TCompilersPathsEditor.selectedRt(sender: TObject; var value: string);
var
ctrl: TWinControl;
@ -635,6 +672,23 @@ begin
fPaths.User2RuntimePath:=value;
end;
procedure TCompilersPathsEditor.editedRt(sender: TObject);
var
ctrl: TWinControl;
begin
ctrl := TWinControl(sender);
if ctrl.Parent = grpDMD then
fPaths.DmdRuntimePath:=selDMDrt.Directory
else if ctrl.Parent = grpGDC then
fPaths.GDCRuntimePath:=selGDCrt.Directory
else if ctrl.Parent = grpLDC then
fPaths.LdcRuntimePath:=selLDCrt.Directory
else if ctrl.Parent = grpUSER1 then
fPaths.User1RuntimePath:=selUSER1rt.Directory
else if ctrl.Parent = grpUSER2 then
fPaths.User2RuntimePath:=selUSER2rt.Directory;
end;
procedure TCompilersPathsEditor.selectedStd(sender: TObject; var value: string);
var
ctrl: TWinControl;
@ -652,6 +706,23 @@ begin
fPaths.User2PhobosPath:=value;
end;
procedure TCompilersPathsEditor.editedStd(sender: TObject);
var
ctrl: TWinControl;
begin
ctrl := TWinControl(sender);
if ctrl.Parent = grpDMD then
fPaths.DmdPhobosPath:=selDMDstd.Directory
else if ctrl.Parent = grpGDC then
fPaths.GDCPhobosPath:=selGDCstd.Directory
else if ctrl.Parent = grpLDC then
fPaths.LdcPhobosPath:=selLDCstd.Directory
else if ctrl.Parent = grpUSER1 then
fPaths.User1PhobosPath:=selUSER1std.Directory
else if ctrl.Parent = grpUSER2 then
fPaths.User2PhobosPath:=selUSER2std.Directory;
end;
procedure TCompilersPathsEditor.selectedDefault(sender: TObject);
begin
fPaths.defaultCompiler:= DCompiler(selDefault.ItemIndex);