IDE: Make the BuildModes combobox in IDE options dialog work.

git-svn-id: trunk@40839 -
This commit is contained in:
juha 2013-04-18 16:56:40 +00:00
parent 59f2adc660
commit 6ff3c16313
4 changed files with 72 additions and 35 deletions

View File

@ -67,6 +67,8 @@ type
end; end;
function ShowBuildModesDlg: TModalResult; function ShowBuildModesDlg: TModalResult;
procedure UpdateBuildModeCombo(aCombo: TComboBox);
procedure SetActiveBuildModeID(aID: string);
implementation implementation
@ -96,6 +98,30 @@ begin
end; end;
end; end;
procedure UpdateBuildModeCombo(aCombo: TComboBox);
var
i, ActiveIndex: Integer;
CurMode: TProjectBuildMode;
begin
ActiveIndex := 0;
aCombo.Clear;
aCombo.Items.Add(lisAllBuildModes);
for i := 0 to Project1.BuildModes.Count-1 do
begin
CurMode := Project1.BuildModes[i];
aCombo.Items.Add(CurMode.Identifier);
if CurMode = Project1.ActiveBuildMode then
ActiveIndex := i+1; // Will be set as ItemIndex in Combo.
end;
Assert(ActiveIndex > 0, 'UpdateBuildModeCombo: ActiveIndex = 0');
aCombo.ItemIndex := ActiveIndex;
end;
procedure SetActiveBuildModeID(aID: string);
begin
Project1.ActiveBuildModeID := aID;
end;
{ TBuildModesForm } { TBuildModesForm }
constructor TBuildModesForm.Create(AOwner: TComponent); constructor TBuildModesForm.Create(AOwner: TComponent);

View File

@ -2,12 +2,12 @@ object IDEOptionsDialog: TIDEOptionsDialog
Left = 121 Left = 121
Height = 404 Height = 404
Top = 96 Top = 96
Width = 675 Width = 689
ActiveControl = FilterEdit ActiveControl = FilterEdit
BorderIcons = [biSystemMenu] BorderIcons = [biSystemMenu]
Caption = 'IDEOptionsDialog' Caption = 'IDEOptionsDialog'
ClientHeight = 404 ClientHeight = 404
ClientWidth = 675 ClientWidth = 689
Constraints.MinHeight = 350 Constraints.MinHeight = 350
Constraints.MinWidth = 500 Constraints.MinWidth = 500
OnShow = FormShow OnShow = FormShow
@ -21,7 +21,7 @@ object IDEOptionsDialog: TIDEOptionsDialog
Left = 6 Left = 6
Height = 34 Height = 34
Top = 364 Top = 364
Width = 663 Width = 677
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
@ -114,10 +114,10 @@ object IDEOptionsDialog: TIDEOptionsDialog
Left = 259 Left = 259
Height = 40 Height = 40
Top = 0 Top = 0
Width = 413 Width = 427
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
ClientHeight = 40 ClientHeight = 40
ClientWidth = 413 ClientWidth = 427
TabOrder = 3 TabOrder = 3
object BuildModeLabel: TLabel object BuildModeLabel: TLabel
Left = 12 Left = 12
@ -133,16 +133,14 @@ object IDEOptionsDialog: TIDEOptionsDialog
AnchorSideTop.Control = BuildModeLabel AnchorSideTop.Control = BuildModeLabel
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 87 Left = 87
Height = 23 Height = 24
Top = 6 Top = 5
Width = 154 Width = 154
BorderSpacing.Left = 7 BorderSpacing.Left = 7
ItemHeight = 0 ItemHeight = 0
Items.Strings = ( OnClick = BuildModeComboBoxClick
'<All build modes>' OnSelect = BuildModeComboBoxSelect
'Juha''s test mode' Style = csDropDownList
'Another test mode'
)
TabOrder = 0 TabOrder = 0
end end
object BuildModeManageButton: TButton object BuildModeManageButton: TButton
@ -159,16 +157,6 @@ object IDEOptionsDialog: TIDEOptionsDialog
OnClick = BuildModeManageButtonClick OnClick = BuildModeManageButtonClick
TabOrder = 1 TabOrder = 1
end end
object Label1: TLabel
Left = 286
Height = 15
Top = 13
Width = 137
Caption = 'Under construction ...'
Color = clFuchsia
ParentColor = False
Transparent = False
end
end end
object EditorsPanel: TScrollBox object EditorsPanel: TScrollBox
AnchorSideLeft.Control = CatTVSplitter AnchorSideLeft.Control = CatTVSplitter
@ -179,8 +167,8 @@ object IDEOptionsDialog: TIDEOptionsDialog
Left = 259 Left = 259
Height = 324 Height = 324
Top = 40 Top = 40
Width = 413 Width = 427
HorzScrollBar.Page = 407 HorzScrollBar.Page = 421
HorzScrollBar.Tracking = True HorzScrollBar.Tracking = True
VertScrollBar.Page = 318 VertScrollBar.Page = 318
VertScrollBar.Tracking = True VertScrollBar.Tracking = True

View File

@ -31,7 +31,7 @@ interface
uses uses
Classes, SysUtils, Controls, Forms, ComCtrls, LCLProc, LCLType, Classes, SysUtils, Controls, Forms, ComCtrls, LCLProc, LCLType,
Buttons, ButtonPanel, ExtCtrls, EditBtn, StdCtrls, Buttons, ButtonPanel, ExtCtrls, EditBtn, StdCtrls, Dialogs,
TreeFilterEdit, IDEWindowIntf, IDEOptionsIntf, IDECommands, IDEHelpIntf, TreeFilterEdit, IDEWindowIntf, IDEOptionsIntf, IDECommands, IDEHelpIntf,
EnvironmentOpts, LazarusIDEStrConsts, CompOptsIntf, EditorOptions, EnvironmentOpts, LazarusIDEStrConsts, CompOptsIntf, EditorOptions,
{$IFDEF NewBuildModeWindow} {$IFDEF NewBuildModeWindow}
@ -62,8 +62,9 @@ type
EditorsPanel: TScrollBox; EditorsPanel: TScrollBox;
FilterEdit: TTreeFilterEdit; FilterEdit: TTreeFilterEdit;
BuildModeSelectPanel: TPanel; BuildModeSelectPanel: TPanel;
Label1: TLabel;
SettingsPanel: TPanel; SettingsPanel: TPanel;
procedure BuildModeComboBoxClick(Sender: TObject);
procedure BuildModeComboBoxSelect(Sender: TObject);
procedure BuildModeManageButtonClick(Sender: TObject); procedure BuildModeManageButtonClick(Sender: TObject);
procedure CategoryTreeChange(Sender: TObject; Node: TTreeNode); procedure CategoryTreeChange(Sender: TObject; Node: TTreeNode);
procedure CategoryTreeCollapsed(Sender: TObject; Node: TTreeNode); procedure CategoryTreeCollapsed(Sender: TObject; Node: TTreeNode);
@ -85,6 +86,7 @@ type
FEditorsCreated: Boolean; FEditorsCreated: Boolean;
SelectNode: TTreeNode; SelectNode: TTreeNode;
NewLastSelected: PIDEOptionsEditorRec; NewLastSelected: PIDEOptionsEditorRec;
PrevComboIndex: integer;
function FindGroupClass(Node: TTreeNode): TAbstractIDEOptionsClass; function FindGroupClass(Node: TTreeNode): TAbstractIDEOptionsClass;
procedure TraverseSettings(AOptions: TAbstractIDEOptions; anAction: TIDEOptsDlgAction); procedure TraverseSettings(AOptions: TAbstractIDEOptions; anAction: TIDEOptsDlgAction);
@ -149,6 +151,16 @@ begin
{.$ENDIF} {.$ENDIF}
end; end;
procedure TIDEOptionsDialog.FormShow(Sender: TObject);
begin
// make the category visible in the treeview
if (CategoryTree.Selected<>nil) and (CategoryTree.Selected.Parent<>nil) then
CategoryTree.TopItem:=CategoryTree.Selected.Parent;
{$IFDEF NewBuildModeWindow}
UpdateBuildModeCombo(BuildModeComboBox);
{$ENDIF}
end;
procedure TIDEOptionsDialog.HelpButtonClick(Sender: TObject); procedure TIDEOptionsDialog.HelpButtonClick(Sender: TObject);
begin begin
if PrevEditor<>nil then if PrevEditor<>nil then
@ -207,11 +219,28 @@ begin
end; end;
end; end;
procedure TIDEOptionsDialog.BuildModeComboBoxClick(Sender: TObject);
begin
PrevComboIndex := BuildModeComboBox.ItemIndex;
end;
procedure TIDEOptionsDialog.BuildModeComboBoxSelect(Sender: TObject);
begin
if BuildModeComboBox.Text = lisAllBuildModes then begin
ShowMessage('This will allow changing all build modes at once. Not implemented yet.');
BuildModeComboBox.ItemIndex := PrevComboIndex;
end
{$IFDEF NewBuildModeWindow}
else
SetActiveBuildModeID(BuildModeComboBox.Text);
{$ENDIF}
end;
procedure TIDEOptionsDialog.BuildModeManageButtonClick(Sender: TObject); procedure TIDEOptionsDialog.BuildModeManageButtonClick(Sender: TObject);
begin begin
{$IFDEF NewBuildModeWindow} {$IFDEF NewBuildModeWindow}
if ShowBuildModesDlg = mrOK then begin if ShowBuildModesDlg = mrOK then begin
UpdateBuildModeCombo(BuildModeComboBox);
end; end;
{$ENDIF} {$ENDIF}
end; end;
@ -260,13 +289,6 @@ begin
Result:=OptEditor.ContainsTextInCaption(FilterEdit.Filter); Result:=OptEditor.ContainsTextInCaption(FilterEdit.Filter);
end; end;
procedure TIDEOptionsDialog.FormShow(Sender: TObject);
begin
// make the category visible in the treeview
if (CategoryTree.Selected<>nil) and (CategoryTree.Selected.Parent<>nil) then
CategoryTree.TopItem:=CategoryTree.Selected.Parent;
end;
procedure TIDEOptionsDialog.OkButtonClick(Sender: TObject); procedure TIDEOptionsDialog.OkButtonClick(Sender: TObject);
begin begin
IDEEditorGroups.LastSelected := NewLastSelected; IDEEditorGroups.LastSelected := NewLastSelected;

View File

@ -155,7 +155,6 @@ resourcestring
lisLazarusLanguageID = 'Lazarus language ID (e.g. en, de, br, fi)'; lisLazarusLanguageID = 'Lazarus language ID (e.g. en, de, br, fi)';
lisLazarusLanguageName = 'Lazarus language name (e.g. english, deutsch)'; lisLazarusLanguageName = 'Lazarus language name (e.g. english, deutsch)';
lisLCLWidgetType = 'LCL widget type'; lisLCLWidgetType = 'LCL widget type';
lisNameOfActiveBuildMode = 'Name of active build mode';
lisCOVarious = '%s (various)'; lisCOVarious = '%s (various)';
lisTargetCPU = 'Target CPU'; lisTargetCPU = 'Target CPU';
lisTargetOS = 'Target OS'; lisTargetOS = 'Target OS';
@ -1272,6 +1271,8 @@ resourcestring
dlgReferenceColor = 'Reference'; dlgReferenceColor = 'Reference';
dlgValueColor = 'Value'; dlgValueColor = 'Value';
lisUnableToAddSetting = 'Unable to add setting'; lisUnableToAddSetting = 'Unable to add setting';
lisAllBuildModes = '<All build modes>';
lisNameOfActiveBuildMode = 'Name of active build mode';
lisIsAGroupASettingCanOnlyBeAddedToNormalBuildModes = '%s is a group. A ' lisIsAGroupASettingCanOnlyBeAddedToNormalBuildModes = '%s is a group. A '
+'setting can only be added to normal build modes.'; +'setting can only be added to normal build modes.';
lisPleaseSelectABuildModeFirst = 'Please select a build mode first.'; lisPleaseSelectABuildModeFirst = 'Please select a build mode first.';