mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 08:59:32 +02:00
IDE: Make the BuildModes combobox in IDE options dialog work.
git-svn-id: trunk@40839 -
This commit is contained in:
parent
59f2adc660
commit
6ff3c16313
@ -67,6 +67,8 @@ type
|
||||
end;
|
||||
|
||||
function ShowBuildModesDlg: TModalResult;
|
||||
procedure UpdateBuildModeCombo(aCombo: TComboBox);
|
||||
procedure SetActiveBuildModeID(aID: string);
|
||||
|
||||
|
||||
implementation
|
||||
@ -96,6 +98,30 @@ begin
|
||||
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 }
|
||||
|
||||
constructor TBuildModesForm.Create(AOwner: TComponent);
|
||||
|
@ -2,12 +2,12 @@ object IDEOptionsDialog: TIDEOptionsDialog
|
||||
Left = 121
|
||||
Height = 404
|
||||
Top = 96
|
||||
Width = 675
|
||||
Width = 689
|
||||
ActiveControl = FilterEdit
|
||||
BorderIcons = [biSystemMenu]
|
||||
Caption = 'IDEOptionsDialog'
|
||||
ClientHeight = 404
|
||||
ClientWidth = 675
|
||||
ClientWidth = 689
|
||||
Constraints.MinHeight = 350
|
||||
Constraints.MinWidth = 500
|
||||
OnShow = FormShow
|
||||
@ -21,7 +21,7 @@ object IDEOptionsDialog: TIDEOptionsDialog
|
||||
Left = 6
|
||||
Height = 34
|
||||
Top = 364
|
||||
Width = 663
|
||||
Width = 677
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
@ -114,10 +114,10 @@ object IDEOptionsDialog: TIDEOptionsDialog
|
||||
Left = 259
|
||||
Height = 40
|
||||
Top = 0
|
||||
Width = 413
|
||||
Width = 427
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
ClientHeight = 40
|
||||
ClientWidth = 413
|
||||
ClientWidth = 427
|
||||
TabOrder = 3
|
||||
object BuildModeLabel: TLabel
|
||||
Left = 12
|
||||
@ -133,16 +133,14 @@ object IDEOptionsDialog: TIDEOptionsDialog
|
||||
AnchorSideTop.Control = BuildModeLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 87
|
||||
Height = 23
|
||||
Top = 6
|
||||
Height = 24
|
||||
Top = 5
|
||||
Width = 154
|
||||
BorderSpacing.Left = 7
|
||||
ItemHeight = 0
|
||||
Items.Strings = (
|
||||
'<All build modes>'
|
||||
'Juha''s test mode'
|
||||
'Another test mode'
|
||||
)
|
||||
OnClick = BuildModeComboBoxClick
|
||||
OnSelect = BuildModeComboBoxSelect
|
||||
Style = csDropDownList
|
||||
TabOrder = 0
|
||||
end
|
||||
object BuildModeManageButton: TButton
|
||||
@ -159,16 +157,6 @@ object IDEOptionsDialog: TIDEOptionsDialog
|
||||
OnClick = BuildModeManageButtonClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 286
|
||||
Height = 15
|
||||
Top = 13
|
||||
Width = 137
|
||||
Caption = 'Under construction ...'
|
||||
Color = clFuchsia
|
||||
ParentColor = False
|
||||
Transparent = False
|
||||
end
|
||||
end
|
||||
object EditorsPanel: TScrollBox
|
||||
AnchorSideLeft.Control = CatTVSplitter
|
||||
@ -179,8 +167,8 @@ object IDEOptionsDialog: TIDEOptionsDialog
|
||||
Left = 259
|
||||
Height = 324
|
||||
Top = 40
|
||||
Width = 413
|
||||
HorzScrollBar.Page = 407
|
||||
Width = 427
|
||||
HorzScrollBar.Page = 421
|
||||
HorzScrollBar.Tracking = True
|
||||
VertScrollBar.Page = 318
|
||||
VertScrollBar.Tracking = True
|
||||
|
@ -31,7 +31,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Controls, Forms, ComCtrls, LCLProc, LCLType,
|
||||
Buttons, ButtonPanel, ExtCtrls, EditBtn, StdCtrls,
|
||||
Buttons, ButtonPanel, ExtCtrls, EditBtn, StdCtrls, Dialogs,
|
||||
TreeFilterEdit, IDEWindowIntf, IDEOptionsIntf, IDECommands, IDEHelpIntf,
|
||||
EnvironmentOpts, LazarusIDEStrConsts, CompOptsIntf, EditorOptions,
|
||||
{$IFDEF NewBuildModeWindow}
|
||||
@ -62,8 +62,9 @@ type
|
||||
EditorsPanel: TScrollBox;
|
||||
FilterEdit: TTreeFilterEdit;
|
||||
BuildModeSelectPanel: TPanel;
|
||||
Label1: TLabel;
|
||||
SettingsPanel: TPanel;
|
||||
procedure BuildModeComboBoxClick(Sender: TObject);
|
||||
procedure BuildModeComboBoxSelect(Sender: TObject);
|
||||
procedure BuildModeManageButtonClick(Sender: TObject);
|
||||
procedure CategoryTreeChange(Sender: TObject; Node: TTreeNode);
|
||||
procedure CategoryTreeCollapsed(Sender: TObject; Node: TTreeNode);
|
||||
@ -85,6 +86,7 @@ type
|
||||
FEditorsCreated: Boolean;
|
||||
SelectNode: TTreeNode;
|
||||
NewLastSelected: PIDEOptionsEditorRec;
|
||||
PrevComboIndex: integer;
|
||||
|
||||
function FindGroupClass(Node: TTreeNode): TAbstractIDEOptionsClass;
|
||||
procedure TraverseSettings(AOptions: TAbstractIDEOptions; anAction: TIDEOptsDlgAction);
|
||||
@ -149,6 +151,16 @@ begin
|
||||
{.$ENDIF}
|
||||
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);
|
||||
begin
|
||||
if PrevEditor<>nil then
|
||||
@ -207,11 +219,28 @@ begin
|
||||
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);
|
||||
begin
|
||||
{$IFDEF NewBuildModeWindow}
|
||||
if ShowBuildModesDlg = mrOK then begin
|
||||
|
||||
UpdateBuildModeCombo(BuildModeComboBox);
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
@ -260,13 +289,6 @@ begin
|
||||
Result:=OptEditor.ContainsTextInCaption(FilterEdit.Filter);
|
||||
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);
|
||||
begin
|
||||
IDEEditorGroups.LastSelected := NewLastSelected;
|
||||
|
@ -155,7 +155,6 @@ resourcestring
|
||||
lisLazarusLanguageID = 'Lazarus language ID (e.g. en, de, br, fi)';
|
||||
lisLazarusLanguageName = 'Lazarus language name (e.g. english, deutsch)';
|
||||
lisLCLWidgetType = 'LCL widget type';
|
||||
lisNameOfActiveBuildMode = 'Name of active build mode';
|
||||
lisCOVarious = '%s (various)';
|
||||
lisTargetCPU = 'Target CPU';
|
||||
lisTargetOS = 'Target OS';
|
||||
@ -1272,6 +1271,8 @@ resourcestring
|
||||
dlgReferenceColor = 'Reference';
|
||||
dlgValueColor = 'Value';
|
||||
lisUnableToAddSetting = 'Unable to add setting';
|
||||
lisAllBuildModes = '<All build modes>';
|
||||
lisNameOfActiveBuildMode = 'Name of active build mode';
|
||||
lisIsAGroupASettingCanOnlyBeAddedToNormalBuildModes = '%s is a group. A '
|
||||
+'setting can only be added to normal build modes.';
|
||||
lisPleaseSelectABuildModeFirst = 'Please select a build mode first.';
|
||||
|
Loading…
Reference in New Issue
Block a user