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

View File

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

View File

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

View File

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