IDE: New EnvOption + CheckBox for showing/hiding build modes in project options.

git-svn-id: trunk@42002 -
This commit is contained in:
juha 2013-07-05 13:25:49 +00:00
parent 25f4b56aca
commit 3929a183c3
4 changed files with 59 additions and 79 deletions

View File

@ -283,6 +283,7 @@ type
FMakeFileHistory: TStringList; FMakeFileHistory: TStringList;
FCompilerMessagesFileHistory: TStringList; FCompilerMessagesFileHistory: TStringList;
FBuildMatrixOptions: TBuildMatrixOptions; FBuildMatrixOptions: TBuildMatrixOptions;
FUseBuildModes: Boolean;
FIsGlobalMode: TStrToBoolEvent; FIsGlobalMode: TStrToBoolEvent;
// TODO: store per debuggerclass options // TODO: store per debuggerclass options
@ -539,6 +540,7 @@ type
// global build options // global build options
property BuildMatrixOptions: TBuildMatrixOptions read FBuildMatrixOptions; property BuildMatrixOptions: TBuildMatrixOptions read FBuildMatrixOptions;
property UseBuildModes: Boolean read FUseBuildModes write FUseBuildModes;
// Debugger // Debugger
procedure SaveDebuggerPropertiesList; procedure SaveDebuggerPropertiesList;
@ -1188,6 +1190,7 @@ begin
Cfg.AppendBasePath('BuildMatrix'); Cfg.AppendBasePath('BuildMatrix');
FBuildMatrixOptions.LoadFromConfig(Cfg); FBuildMatrixOptions.LoadFromConfig(Cfg);
Cfg.UndoAppendBasePath; Cfg.UndoAppendBasePath;
FUseBuildModes:=XMLConfig.GetValue(Path+'Build/UseBuildModes',false);
// backup // backup
LoadBackupInfo(FBackupInfoProjectFiles LoadBackupInfo(FBackupInfoProjectFiles
@ -1532,6 +1535,7 @@ begin
Cfg.AppendBasePath('BuildMatrix'); Cfg.AppendBasePath('BuildMatrix');
FBuildMatrixOptions.SaveToConfig(Cfg,IsGlobalMode); FBuildMatrixOptions.SaveToConfig(Cfg,IsGlobalMode);
Cfg.UndoAppendBasePath; Cfg.UndoAppendBasePath;
XMLConfig.SetDeleteValue(Path+'Build/UseBuildModes',FUseBuildModes,false);
// backup // backup
SaveBackupInfo(FBackupInfoProjectFiles SaveBackupInfo(FBackupInfoProjectFiles

View File

@ -1,7 +1,7 @@
object IDEOptionsDialog: TIDEOptionsDialog object IDEOptionsDialog: TIDEOptionsDialog
Left = 308 Left = 372
Height = 404 Height = 404
Top = 206 Top = 202
Width = 689 Width = 689
ActiveControl = FilterEdit ActiveControl = FilterEdit
BorderIcons = [biSystemMenu] BorderIcons = [biSystemMenu]
@ -19,8 +19,8 @@ object IDEOptionsDialog: TIDEOptionsDialog
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = Owner
Left = 6 Left = 6
Height = 34 Height = 41
Top = 364 Top = 357
Width = 677 Width = 677
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
@ -40,7 +40,7 @@ object IDEOptionsDialog: TIDEOptionsDialog
end end
object CatTVSplitter: TSplitter object CatTVSplitter: TSplitter
Left = 255 Left = 255
Height = 364 Height = 357
Top = 0 Top = 0
Width = 4 Width = 4
end end
@ -48,12 +48,12 @@ object IDEOptionsDialog: TIDEOptionsDialog
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
Left = 0 Left = 0
Height = 364 Height = 357
Top = 0 Top = 0
Width = 255 Width = 255
Align = alLeft Align = alLeft
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 364 ClientHeight = 357
ClientWidth = 255 ClientWidth = 255
Constraints.MinWidth = 150 Constraints.MinWidth = 150
TabOrder = 2 TabOrder = 2
@ -65,8 +65,8 @@ object IDEOptionsDialog: TIDEOptionsDialog
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = SettingsPanel AnchorSideBottom.Control = SettingsPanel
Left = 6 Left = 6
Height = 309 Height = 300
Top = 35 Top = 37
Width = 249 Width = 249
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -84,7 +84,7 @@ object IDEOptionsDialog: TIDEOptionsDialog
AnchorSideTop.Control = CategoryPanel AnchorSideTop.Control = CategoryPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 6 Left = 6
Height = 23 Height = 25
Top = 6 Top = 6
Width = 200 Width = 200
OnFilterItem = FilterEditFilterItem OnFilterItem = FilterEditFilterItem
@ -94,7 +94,6 @@ object IDEOptionsDialog: TIDEOptionsDialog
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Font.Color = clBtnShadow
MaxLength = 0 MaxLength = 0
ParentFont = False ParentFont = False
TabOrder = 1 TabOrder = 1
@ -103,7 +102,7 @@ object IDEOptionsDialog: TIDEOptionsDialog
object SettingsPanel: TPanel object SettingsPanel: TPanel
Left = 0 Left = 0
Height = 20 Height = 20
Top = 344 Top = 337
Width = 255 Width = 255
Align = alBottom Align = alBottom
AutoSize = True AutoSize = True
@ -127,35 +126,27 @@ object IDEOptionsDialog: TIDEOptionsDialog
ClientHeight = 40 ClientHeight = 40
ClientWidth = 424 ClientWidth = 424
TabOrder = 3 TabOrder = 3
object BuildModeLabel: TLabel
Left = 12
Height = 15
Top = 10
Width = 61
Caption = 'Build Mode'
ParentColor = False
end
object BuildModeComboBox: TComboBox object BuildModeComboBox: TComboBox
AnchorSideLeft.Control = BuildModeLabel AnchorSideLeft.Control = UseBuildModeCheckBox
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BuildModeLabel AnchorSideTop.Control = UseBuildModeCheckBox
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 80 Left = 119
Height = 23 Height = 25
Top = 6 Top = 5
Width = 154 Width = 154
BorderSpacing.Left = 7 BorderSpacing.Left = 7
ItemHeight = 15 ItemHeight = 0
OnSelect = BuildModeComboBoxSelect OnSelect = BuildModeComboBoxSelect
Style = csDropDownList Style = csDropDownList
TabOrder = 0 TabOrder = 0
end end
object BuildModeManageButton: TButton object BuildModeManageButton: TButton
AnchorSideLeft.Control = BuildModeInSessionCheckBox AnchorSideLeft.Control = BuildModeComboBox
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BuildModeComboBox AnchorSideTop.Control = BuildModeComboBox
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 326 Left = 288
Height = 25 Height = 25
Top = 5 Top = 5
Width = 25 Width = 25
@ -164,18 +155,15 @@ object IDEOptionsDialog: TIDEOptionsDialog
OnClick = BuildModeManageButtonClick OnClick = BuildModeManageButtonClick
TabOrder = 1 TabOrder = 1
end end
object BuildModeInSessionCheckBox: TCheckBox object UseBuildModeCheckBox: TCheckBox
AnchorSideLeft.Control = BuildModeComboBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BuildModeComboBox
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 240 Left = 12
Height = 19 Height = 21
Top = 8 Top = 7
Width = 71 Width = 100
BorderSpacing.Left = 6 BorderSpacing.Left = 6
Caption = 'In session' Caption = 'Build modes'
OnChange = BuildModeInSessionCheckBoxChange OnChange = UseBuildModeCheckBoxChange
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 2 TabOrder = 2
@ -190,12 +178,12 @@ object IDEOptionsDialog: TIDEOptionsDialog
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ButtonPanel AnchorSideBottom.Control = ButtonPanel
Left = 259 Left = 259
Height = 324 Height = 317
Top = 40 Top = 40
Width = 424 Width = 424
HorzScrollBar.Page = 424 HorzScrollBar.Page = 424
HorzScrollBar.Tracking = True HorzScrollBar.Tracking = True
VertScrollBar.Page = 324 VertScrollBar.Page = 317
VertScrollBar.Tracking = True VertScrollBar.Tracking = True
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Right = 6 BorderSpacing.Right = 6

View File

@ -51,8 +51,7 @@ type
TIDEOptionsDialog = class(TAbstractOptionsEditorDialog) TIDEOptionsDialog = class(TAbstractOptionsEditorDialog)
BuildModeComboBox: TComboBox; BuildModeComboBox: TComboBox;
BuildModeInSessionCheckBox: TCheckBox; UseBuildModeCheckBox: TCheckBox;
BuildModeLabel: TLabel;
BuildModeManageButton: TButton; BuildModeManageButton: TButton;
BuildModeSelectPanel: TPanel; BuildModeSelectPanel: TPanel;
ButtonPanel: TButtonPanel; ButtonPanel: TButtonPanel;
@ -62,8 +61,8 @@ type
EditorsPanel: TScrollBox; EditorsPanel: TScrollBox;
FilterEdit: TTreeFilterEdit; FilterEdit: TTreeFilterEdit;
SettingsPanel: TPanel; SettingsPanel: TPanel;
procedure UseBuildModeCheckBoxChange(Sender: TObject);
procedure BuildModeComboBoxSelect(Sender: TObject); procedure BuildModeComboBoxSelect(Sender: TObject);
procedure BuildModeInSessionCheckBoxChange(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);
@ -97,7 +96,7 @@ type
procedure SetSettings(const AValue: TIDEOptionsEditorSettings); procedure SetSettings(const AValue: TIDEOptionsEditorSettings);
function AllBuildModes: boolean; function AllBuildModes: boolean;
procedure UpdateBuildModeButtons; procedure UpdateBuildModeButtons;
procedure SetBuldModeVisibility(AVisibility: Boolean); procedure SetBuildModeVisibility(AVisibility: Boolean);
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
function ShowModal: Integer; override; function ShowModal: Integer; override;
@ -133,11 +132,8 @@ begin
FEditorsCreated := False; FEditorsCreated := False;
FEditorToOpen := nil; FEditorToOpen := nil;
SettingsPanel.Constraints.MinHeight:=0; SettingsPanel.Constraints.MinHeight:=0;
SetBuldModeVisibility(False); SetBuildModeVisibility(False);
BuildModeLabel.Caption:=lisBuildMode; UseBuildModeCheckBox.Caption:=lisBuildModes;
BuildModeInSessionCheckBox.Caption:=lisInSession;
BuildModeInSessionCheckBox.Hint:=
lisEnableThisToStoreTheBuildModeInYourSessionLpsInste;
IDEDialogLayoutList.ApplyLayout(Self, Width, Height); IDEDialogLayoutList.ApplyLayout(Self, Width, Height);
Caption := dlgIDEOptions; Caption := dlgIDEOptions;
@ -173,7 +169,7 @@ end;
procedure TIDEOptionsDialog.IDEOptionsDialogKeyPress(Sender: TObject; var Key: char); procedure TIDEOptionsDialog.IDEOptionsDialogKeyPress(Sender: TObject; var Key: char);
begin begin
debugln(['TIDEOptionsDialog.IDEOptionsDialogKeyPress ',ord(Key)]); //debugln(['TIDEOptionsDialog.IDEOptionsDialogKeyPress ',ord(Key)]);
end; end;
procedure TIDEOptionsDialog.CategoryTreeChange(Sender: TObject; Node: TTreeNode); procedure TIDEOptionsDialog.CategoryTreeChange(Sender: TObject; Node: TTreeNode);
@ -200,7 +196,7 @@ begin
GroupClass := FindGroupClass(Node); GroupClass := FindGroupClass(Node);
end; end;
// Show the Build Mode panel for project compiler options // Show the Build Mode panel for project compiler options
SetBuldModeVisibility((GroupClass <> nil) and (GroupClass.InheritsFrom(TProjectCompilerOptions))); SetBuildModeVisibility((GroupClass <> nil) and (GroupClass.InheritsFrom(TProjectCompilerOptions)));
// Hide the old and show the new editor frame // Hide the old and show the new editor frame
if Assigned(AEditor) then if Assigned(AEditor) then
FNewLastSelected := AEditor.Rec; FNewLastSelected := AEditor.Rec;
@ -216,35 +212,22 @@ begin
end; end;
end; end;
procedure TIDEOptionsDialog.UseBuildModeCheckBoxChange(Sender: TObject);
begin
EnvironmentOptions.UseBuildModes:=(Sender as TCheckBox).Checked;
UpdateBuildModeButtons;
end;
procedure TIDEOptionsDialog.BuildModeComboBoxSelect(Sender: TObject); procedure TIDEOptionsDialog.BuildModeComboBoxSelect(Sender: TObject);
begin begin
if AllBuildModes then begin if AllBuildModes then begin
ShowMessage('This will allow changing all build modes at once. Not implemented yet.'); ShowMessage('This will allow changing all build modes at once. Not implemented yet.');
BuildModeInSessionCheckBox.Enabled:=false;
end end
else begin else begin
SwitchBuildMode(BuildModeComboBox.Text,BuildModeSelectPanel.Visible); SwitchBuildMode(BuildModeComboBox.Text,BuildModeSelectPanel.Visible);
end; end;
end; end;
procedure TIDEOptionsDialog.BuildModeInSessionCheckBoxChange(Sender: TObject);
var
NewInSession: Boolean;
begin
NewInSession:=BuildModeInSessionCheckBox.Checked;
if NewInSession and (Project1.ActiveBuildMode=Project1.BuildModes[0]) then
begin
IDEMessageDialog(lisCCOErrorCaption,
lisTheFirstBuildModeIsTheDefaultModeAndMustBeStoredIn,
mtError,[mbCancel]);
BuildModeInSessionCheckBox.Checked:=false;
end else begin
Project1.ActiveBuildMode.InSession:=BuildModeInSessionCheckBox.Checked;
if ModeMatrixFrame<>nil then
ModeMatrixFrame.UpdateModes;
end;
end;
procedure TIDEOptionsDialog.BuildModeManageButtonClick(Sender: TObject); procedure TIDEOptionsDialog.BuildModeManageButtonClick(Sender: TObject);
begin begin
if ShowBuildModesDlg(Project1.SessionStorage in pssHasSeparateSession) <> mrOK then if ShowBuildModesDlg(Project1.SessionStorage in pssHasSeparateSession) <> mrOK then
@ -613,13 +596,19 @@ begin
end; end;
procedure TIDEOptionsDialog.UpdateBuildModeButtons; procedure TIDEOptionsDialog.UpdateBuildModeButtons;
var
ManyBuildModes: Boolean;
begin begin
BuildModeInSessionCheckBox.Visible:=Project1.SessionStorage in pssHasSeparateSession; ManyBuildModes:=Project1.BuildModes.Count > 1;
BuildModeInSessionCheckBox.Enabled:=not AllBuildModes; if ManyBuildModes then
BuildModeInSessionCheckBox.Checked:=Project1.ActiveBuildMode.InSession; EnvironmentOptions.UseBuildModes := True;
UseBuildModeCheckBox.Checked:=EnvironmentOptions.UseBuildModes;
UseBuildModeCheckBox.Visible := not ManyBuildModes;
BuildModeComboBox.Visible := EnvironmentOptions.UseBuildModes;
BuildModeManageButton.Visible := EnvironmentOptions.UseBuildModes;
end; end;
procedure TIDEOptionsDialog.SetBuldModeVisibility(AVisibility: Boolean); procedure TIDEOptionsDialog.SetBuildModeVisibility(AVisibility: Boolean);
begin begin
BuildModeSelectPanel.Visible := AVisibility; BuildModeSelectPanel.Visible := AVisibility;
if AVisibility then if AVisibility then

View File

@ -5378,12 +5378,11 @@ resourcestring
dlgIdeMacroValues = 'IDE Macro Values'; dlgIdeMacroValues = 'IDE Macro Values';
lisBuildModes = 'Build modes'; lisBuildModes = 'Build modes';
lisInSession = 'In session'; lisInSession = 'In session';
lisBuildMode = 'Build Mode'; //lisEnableThisToStoreTheBuildModeInYourSessionLpsInste = 'Enable this to '
lisEnableThisToStoreTheBuildModeInYourSessionLpsInste = 'Enable this to ' // +'store the build mode in your session (.lps) instead of the lpi';
+'store the build mode in your session (.lps) instead of the lpi'; lisTheDefaultModeMustBeStoredInProject =
'The default mode must be stored in project, not in session.';
lisThereMustBeAtLeastOneBuildMode = 'There must be at least one build mode.'; lisThereMustBeAtLeastOneBuildMode = 'There must be at least one build mode.';
lisTheFirstBuildModeIsTheDefaultModeAndMustBeStoredIn = 'The first build '
+'mode is the default mode and must be stored in the project, not in the session.';
lisDuplicateEntry = 'Duplicate entry'; lisDuplicateEntry = 'Duplicate entry';
lisThereIsAlreadyABuildModeWithThisName = 'There is already a build mode ' lisThereIsAlreadyABuildModeWithThisName = 'There is already a build mode '
+'with this name.'; +'with this name.';