IDE: start to use the new build mode window by default.

git-svn-id: trunk@41323 -
This commit is contained in:
juha 2013-05-20 12:08:59 +00:00
parent 7b26e3475c
commit 348410562f
6 changed files with 1 additions and 727 deletions

2
.gitattributes vendored
View File

@ -5011,8 +5011,6 @@ ide/fpmake.pp svneol=native#text/plain
ide/frames/atom_checkboxes_options.pas svneol=native#text/pascal
ide/frames/backup_options.lfm svneol=native#text/plain
ide/frames/backup_options.pas svneol=native#text/pascal
ide/frames/buildmodeseditor.lfm svneol=native#text/plain
ide/frames/buildmodeseditor.pas svneol=native#text/plain
ide/frames/codeexplorer_categories_options.lfm svneol=native#text/plain
ide/frames/codeexplorer_categories_options.pas svneol=native#text/pascal
ide/frames/codeexplorer_update_options.lfm svneol=native#text/plain

View File

@ -1,129 +0,0 @@
object BuildModesEditorFrame: TBuildModesEditorFrame
Left = 0
Height = 421
Top = 0
Width = 550
ClientHeight = 421
ClientWidth = 550
TabOrder = 0
DesignLeft = 337
DesignTop = 116
object BuildModesGroupBox: TGroupBox
Left = 6
Height = 250
Top = 6
Width = 538
Align = alTop
BorderSpacing.Around = 6
Caption = 'BuildModesGroupBox'
ClientHeight = 233
ClientWidth = 534
TabOrder = 0
object BuildModesStringGrid: TStringGrid
AnchorSideTop.Control = BuildModeAddSpeedButton
AnchorSideTop.Side = asrBottom
Left = 0
Height = 211
Top = 22
Width = 534
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFillColumns = True
ColCount = 3
Columns = <
item
ButtonStyle = cbsCheckboxColumn
MaxSize = 50
Title.Caption = 'Active'
Width = 176
end
item
ButtonStyle = cbsCheckboxColumn
MaxSize = 50
Title.Caption = 'InSession'
Width = 176
end
item
MaxSize = 500
SizePriority = 100
Title.Caption = 'Title'
Width = 178
end>
FixedCols = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll]
TabOrder = 0
OnCheckboxToggled = BuildModesStringGridCheckboxToggled
OnSelection = BuildModesStringGridSelection
OnValidateEntry = BuildModesStringGridValidateEntry
ColWidths = (
176
176
178
)
end
object BuildModeAddSpeedButton: TSpeedButton
AnchorSideLeft.Control = BuildModesGroupBox
AnchorSideTop.Control = BuildModesGroupBox
Left = 0
Height = 22
Top = 0
Width = 23
OnClick = BuildModeAddSpeedButtonClick
ShowHint = True
ParentShowHint = False
end
object BuildModeDeleteSpeedButton: TSpeedButton
AnchorSideLeft.Control = BuildModeAddSpeedButton
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BuildModesGroupBox
Left = 23
Height = 22
Top = 0
Width = 23
OnClick = BuildModeDeleteSpeedButtonClick
ShowHint = True
ParentShowHint = False
end
object BuildModeMoveUpSpeedButton: TSpeedButton
AnchorSideLeft.Control = BuildModeDeleteSpeedButton
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BuildModesGroupBox
Left = 46
Height = 22
Top = 0
Width = 23
OnClick = BuildModeMoveUpSpeedButtonClick
ShowHint = True
ParentShowHint = False
end
object BuildModeMoveDownSpeedButton: TSpeedButton
AnchorSideLeft.Control = BuildModeMoveUpSpeedButton
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BuildModesGroupBox
Left = 69
Height = 22
Top = 0
Width = 23
OnClick = BuildModeMoveDownSpeedButtonClick
ShowHint = True
ParentShowHint = False
end
object BuildModeDiffSpeedButton: TSpeedButton
AnchorSideLeft.Control = BuildModeMoveDownSpeedButton
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BuildModesGroupBox
Left = 102
Height = 22
Top = 0
Width = 23
BorderSpacing.Left = 10
OnClick = BuildModeDiffSpeedButtonClick
ShowHint = True
ParentShowHint = False
end
end
object BuildModesPopupMenu: TPopupMenu
left = 180
top = 60
end
end

View File

@ -1,554 +0,0 @@
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Abstract:
The frame for 'build modes' on the compiler options.
Allows to add/delete/edit build modes and build macro values.
It does not allow to define new build macros, only values.
}
unit BuildModesEditor;
{$mode objfpc}{$H+}
interface
uses
Math, Classes, SysUtils, LCLProc, Controls, FileUtil, Forms,
Grids, Graphics, Menus, ComCtrls, Dialogs, AvgLvlTree, DefineTemplates,
StdCtrls, GraphMath, ExtCtrls, Buttons,
ProjectIntf, IDEImagesIntf, IDEOptionsIntf, CompOptsIntf,
PackageDefs, compiler_inherited_options, TransferMacros,
PathEditorDlg, Project, PackageSystem, LazarusIDEStrConsts, CompilerOptions,
IDEProcs, BuildModeDiffDlg, Compiler_ModeMatrix;
type
{ TBuildModesEditorFrame }
TBuildModesEditorFrame = class(TAbstractIDEOptionsEditor)
BuildModeDiffSpeedButton: TSpeedButton;
BuildModeAddSpeedButton: TSpeedButton;
BuildModeDeleteSpeedButton: TSpeedButton;
BuildModeMoveDownSpeedButton: TSpeedButton;
BuildModeMoveUpSpeedButton: TSpeedButton;
BuildModesGroupBox: TGroupBox;
BuildModesPopupMenu: TPopupMenu;
BuildModesStringGrid: TStringGrid;
procedure BuildModeDiffSpeedButtonClick(Sender: TObject);
procedure BuildModeAddSpeedButtonClick(Sender: TObject);
procedure BuildModeDeleteSpeedButtonClick(Sender: TObject);
procedure BuildModeMoveDownSpeedButtonClick(Sender: TObject);
procedure BuildModeMoveUpSpeedButtonClick(Sender: TObject);
procedure BuildModesStringGridCheckboxToggled(sender: TObject; aCol,
aRow: Integer; aState: TCheckboxState);
procedure BuildModesStringGridSelection(Sender: TObject; aCol, aRow: Integer);
procedure BuildModesStringGridValidateEntry(sender: TObject; aCol,
aRow: Integer; const OldValue: string; var NewValue: String);
private
FLoadShowSessionFromProject: boolean;
FProject: TProject;
FShowSession: boolean;
FSwitchingMode: boolean;
fModeActiveCol: integer;
fModeInSessionCol: integer;
fModeNameCol: integer;
procedure UpdateInheritedOptions;
procedure FillBuildModesGrid;
procedure UpdateBuildModeButtons;
procedure ActivateMode(aMode: TProjectBuildMode);
procedure UpdateShowSession;
procedure SetShowSession(const AValue: boolean);
procedure DoShowSession;
procedure UpdateDialogCaption;
function GetDialogCaption: string;
procedure ModesChanged;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
function GetTitle: String; override;
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
property AProject: TProject read FProject;
property SwitchingMode: boolean read FSwitchingMode; // the active mode is currently switched
property ShowSession: boolean read FShowSession write SetShowSession;
property LoadShowSessionFromProjects: boolean read FLoadShowSessionFromProject
write FLoadShowSessionFromProject;
function GetSelectedBuildMode: TProjectBuildMode;
end;
implementation
{$R *.lfm}
{ TBuildModesEditorFrame }
procedure TBuildModesEditorFrame.BuildModeDiffSpeedButtonClick(Sender: TObject);
begin
FSwitchingMode:=true;
try
// save changes
OnSaveIDEOptions(Self,AProject.CompilerOptions);
// show diff dialog
ShowBuildModeDiffDialog(GetSelectedBuildMode);
IncreaseBuildMacroChangeStamp;
// load options
OnLoadIDEOptions(Self,AProject.CompilerOptions);
finally
FSwitchingMode:=false;
end;
end;
procedure TBuildModesEditorFrame.BuildModeAddSpeedButtonClick(Sender: TObject);
var
i: Integer;
NewName: String;
Identifier: String;
CurMode: TProjectBuildMode;
NewMode: TProjectBuildMode;
begin
// use current mode as template
i:=BuildModesStringGrid.Row-1;
if (i>=0) then
begin
Identifier:=BuildModesStringGrid.Cells[fModeNameCol,i+1];
CurMode:=AProject.BuildModes[i];
end
else begin
Identifier:='Mode';
CurMode:=nil;
end;
// find unique name
i:=0;
repeat
inc(i);
NewName:=Identifier+IntToStr(i);
until AProject.BuildModes.Find(NewName)=nil;
// create new mode
NewMode:=AProject.BuildModes.Add(NewName);
// clone
if CurMode<>nil then
NewMode.Assign(CurMode);
// show
FillBuildModesGrid;
// activate
ActivateMode(NewMode);
// select identifier
BuildModesStringGrid.Col:=fModeNameCol;
BuildModesStringGrid.Row:=BuildModesStringGrid.RowCount-1;
BuildModesStringGrid.EditorMode:=true;
ModesChanged;
end;
procedure TBuildModesEditorFrame.BuildModeDeleteSpeedButtonClick(Sender: TObject);
var
i: Integer;
CurMode: TProjectBuildMode;
Grid: TStringGrid;
begin
Grid:=BuildModesStringGrid;
i:=Grid.Row-1;
if i<0 then exit;
if AProject.BuildModes.Count=1 then
begin
MessageDlg(lisCCOErrorCaption, lisThereMustBeAtLeastOneBuildMode,
mtError,[mbCancel],0);
exit;
end;
CurMode:=AProject.BuildModes[i];
// when delete the activated: activate another
if AProject.ActiveBuildMode=CurMode then
begin
if i<AProject.BuildModes.Count-1 then
ActivateMode(AProject.BuildModes[i+1])
else
ActivateMode(AProject.BuildModes[i-1]);
end;
if AProject.ActiveBuildMode=CurMode then begin
debugln(['TBuildModesEditorFrame.BuildModeDeleteSpeedButtonClick activate failed']);
exit;
end;
// delete mode
AProject.BuildModes.Delete(i);
FillBuildModesGrid;
// select next mode
if i>=Grid.RowCount then
Grid.Row:=Grid.RowCount-1
else
Grid.Row:=i;
ModesChanged;
end;
procedure TBuildModesEditorFrame.BuildModeMoveDownSpeedButtonClick(Sender: TObject);
var
i: Integer;
begin
i:=BuildModesStringGrid.Row-1;
if i+1>=AProject.BuildModes.Count then exit;
AProject.BuildModes.Move(i,i+1);
AProject.BuildModes[0].InSession:=false;
inc(i);
FillBuildModesGrid;
BuildModesStringGrid.Row:=i+1;
ModesChanged;
end;
procedure TBuildModesEditorFrame.BuildModeMoveUpSpeedButtonClick(Sender: TObject);
var
i: Integer;
begin
i:=BuildModesStringGrid.Row-1;
if i<=0 then exit;
AProject.BuildModes.Move(i,i-1);
dec(i);
AProject.BuildModes[0].InSession:=false;
FillBuildModesGrid;
BuildModesStringGrid.Row:=i+1;
ModesChanged;
end;
procedure TBuildModesEditorFrame.BuildModesStringGridCheckboxToggled(
sender: TObject; aCol, aRow: Integer; aState: TCheckboxState);
var
CurMode: TProjectBuildMode;
b: Boolean;
i: Integer;
Grid: TStringGrid;
begin
//debugln(['TBuildModesEditorFrame.BuildModesStringGridCheckboxToggled Row=',aRow,' Col=',aCol,' ',ord(aState)]);
i:=aRow-1;
if (i<0) or (i>=AProject.BuildModes.Count) then exit;
//debugln(['TBuildModesEditorFrame.BuildModesStringGridCheckboxToggled ',i]);
CurMode:=AProject.BuildModes[i];
Grid:=BuildModesStringGrid;
if aCol=fModeActiveCol then
begin
// activate
if CurMode=AProject.ActiveBuildMode then
// there must always be an active mode
Grid.Cells[aCol,aRow]:=Grid.Columns[aCol].ValueChecked
else
ActivateMode(CurMode);
end else if aCol=fModeInSessionCol then
begin
// in session
b:=aState=cbChecked;
if b and (i=0) then
begin
Grid.Cells[aCol,aRow]:=Grid.Columns[aCol].ValueUnchecked;
MessageDlg(lisCCOErrorCaption,
lisTheFirstBuildModeIsTheDefaultModeAndMustBeStoredIn,
mtError,[mbCancel],0);
exit;
end;
CurMode.InSession:=b;
ModesChanged;
end;
end;
procedure TBuildModesEditorFrame.BuildModesStringGridSelection(Sender: TObject;
aCol, aRow: Integer);
begin
UpdateBuildModeButtons;
end;
procedure TBuildModesEditorFrame.BuildModesStringGridValidateEntry(sender: TObject;
aCol, aRow: Integer; const OldValue: string; var NewValue: String);
var
CurMode: TProjectBuildMode;
s: string;
j: Integer;
b: Boolean;
i: Integer;
begin
//debugln(['TBuildModesForm.BuildModesStringGridValidateEntry Row=',aRow,' Col=',aCol]);
i:=aRow-1;
if (i<0) or (i>=AProject.BuildModes.Count) then exit;
CurMode:=AProject.BuildModes[i];
if aCol=fModeInSessionCol then
begin
// in session
b:=NewValue=BuildModesStringGrid.Columns[aCol].ValueChecked;
if b and (i=0) then
begin
NewValue:=OldValue;
MessageDlg(lisCCOErrorCaption,
lisTheFirstBuildModeIsTheDefaultModeAndMustBeStoredIn,
mtError,[mbCancel],0);
exit;
end;
CurMode.InSession:=b;
ModesChanged;
end
else if aCol=fModeNameCol then
begin
// identifier
s:=NewValue;
for j:=1 to length(s) do
if s[j]<' ' then
s[j]:=' ';
CurMode.Identifier:=s;
NewValue:=s;
UpdateDialogCaption;
ModesChanged;
end;
end;
procedure TBuildModesEditorFrame.SetShowSession(const AValue: boolean);
begin
if AValue=FShowSession then exit;
FShowSession:=AValue;
DoShowSession;
FillBuildModesGrid;
end;
procedure TBuildModesEditorFrame.DoShowSession;
var
Grid: TStringGrid;
begin
Grid:=BuildModesStringGrid;
Grid.BeginUpdate;
fModeActiveCol:=0;
if FShowSession then
begin
fModeInSessionCol:=1;
fModeNameCol:=2;
if Grid.Columns.Count<3 then
Grid.Columns.Insert(fModeInSessionCol);
end else begin
fModeInSessionCol:=-1;
fModeNameCol:=1;
if Grid.Columns.Count>2 then
Grid.Columns.Delete(1);
end;
BuildModesStringGrid.Columns[fModeActiveCol].Title.Caption:=lisActive;
BuildModesStringGrid.Columns[fModeActiveCol].SizePriority:=1;
BuildModesStringGrid.Columns[fModeActiveCol].ButtonStyle:=cbsCheckboxColumn;
if fModeInSessionCol>=0 then
begin
BuildModesStringGrid.Columns[fModeInSessionCol].Title.Caption:=lisInSession;
BuildModesStringGrid.Columns[fModeInSessionCol].SizePriority:=1;
BuildModesStringGrid.Columns[fModeInSessionCol].ButtonStyle:=cbsCheckboxColumn;
end;
BuildModesStringGrid.Columns[fModeNameCol].Title.Caption:=lisName;
BuildModesStringGrid.Columns[fModeNameCol].SizePriority:=10;
BuildModesStringGrid.Columns[fModeNameCol].ButtonStyle:=cbsAuto;
Grid.EndUpdate(true);
end;
procedure TBuildModesEditorFrame.UpdateDialogCaption;
var
Form: TCustomForm;
begin
Form:=GetParentForm(Self);
if Form<>nil then
Form.Caption:=GetDialogCaption;
end;
function TBuildModesEditorFrame.GetDialogCaption: string;
begin
if AProject<>nil then
begin
Result := aProject.GetTitleOrName;
Result:=Format(dlgProjectOptionsFor, [Result]);
if AProject.BuildModes.Count>1 then
Result:=Result+', '+copy(AProject.ActiveBuildMode.GetCaption,1,12);
end else
Result:='TBuildModesEditorFrame.GetDialogCaption: no project';
end;
procedure TBuildModesEditorFrame.ModesChanged;
begin
if ModeMatrixFrame<>nil then
ModeMatrixFrame.UpdateModes;
end;
procedure TBuildModesEditorFrame.UpdateInheritedOptions;
var
InhOptionCtrl: TCompilerInheritedOptionsFrame;
begin
InhOptionCtrl:=TCompilerInheritedOptionsFrame(
FindOptionControl(TCompilerInheritedOptionsFrame));
//debugln(['TBuildModesEditorFrame.UpdateInheritedOptions ',DbgSName(InhOptionCtrl)]);
if InhOptionCtrl=nil then exit;
InhOptionCtrl.UpdateInheritedTree(AProject.CompilerOptions);
end;
procedure TBuildModesEditorFrame.FillBuildModesGrid;
var
i: Integer;
CurMode: TProjectBuildMode;
Grid: TStringGrid;
begin
if AProject=nil then exit;
Grid:=BuildModesStringGrid;
Grid.BeginUpdate;
Grid.RowCount:=AProject.BuildModes.Count+1;
for i:=0 to AProject.BuildModes.Count-1 do begin
CurMode:=AProject.BuildModes[i];
// active
if CurMode=AProject.ActiveBuildMode then
Grid.Cells[fModeActiveCol,i+1]:=Grid.Columns[fModeActiveCol].ValueChecked
else
Grid.Cells[fModeActiveCol,i+1]:=Grid.Columns[fModeActiveCol].ValueUnchecked;
// in session
if fModeInSessionCol>=0 then
if CurMode.InSession then
Grid.Cells[fModeInSessionCol,i+1]:=Grid.Columns[fModeInSessionCol].ValueChecked
else
Grid.Cells[fModeInSessionCol,i+1]:=Grid.Columns[fModeInSessionCol].ValueUnchecked;
// identifier
Grid.Cells[fModeNameCol,i+1]:=CurMode.Identifier;
end;
Grid.EndUpdate(true);
end;
procedure TBuildModesEditorFrame.UpdateBuildModeButtons;
var
i: Integer;
CurMode: TProjectBuildMode;
Identifier: string;
begin
i:=BuildModesStringGrid.Row-1;
if (AProject<>nil) and (AProject.BuildModes<>nil)
and (i>=0) and (i<AProject.BuildModes.Count) then
begin
CurMode:=AProject.BuildModes[i];
Identifier:=BuildModesStringGrid.Cells[fModeNameCol,i+1];
end
else
CurMode:=nil;
BuildModeAddSpeedButton.Hint:=Format(lisAddNewBuildModeCopyingSettingsFrom, [Identifier]);
BuildModeDeleteSpeedButton.Enabled:=(CurMode<>nil) and (AProject.BuildModes.Count>1);
BuildModeDeleteSpeedButton.Hint:=Format(lisDeleteMode, [Identifier]);
BuildModeMoveUpSpeedButton.Enabled:=(CurMode<>nil) and (i>0);
BuildModeMoveUpSpeedButton.Hint:=Format(lisMoveOnePositionUp, [Identifier]);
BuildModeMoveDownSpeedButton.Enabled:=i<BuildModesStringGrid.RowCount-2;
BuildModeMoveDownSpeedButton.Hint:=Format(lisMoveOnePositionDown, [Identifier]);
BuildModeDiffSpeedButton.Hint:=lisShowDifferencesBetweenModes;
end;
procedure TBuildModesEditorFrame.ActivateMode(aMode: TProjectBuildMode);
begin
if aMode=AProject.ActiveBuildMode then exit;
FSwitchingMode:=true;
try
// save changes
OnSaveIDEOptions(Self,AProject.CompilerOptions);
// switch
AProject.ActiveBuildMode:=aMode;
IncreaseBuildMacroChangeStamp;
// load options
OnLoadIDEOptions(Self,AProject.CompilerOptions);
finally
FSwitchingMode:=false;
end;
ModesChanged;
end;
procedure TBuildModesEditorFrame.UpdateShowSession;
begin
if LoadShowSessionFromProjects then
ShowSession:=(AProject<>nil)
and (AProject.SessionStorage in [pssInProjectDir,pssInIDEConfig]);
end;
constructor TBuildModesEditorFrame.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FLoadShowSessionFromProject:=true;
end;
destructor TBuildModesEditorFrame.Destroy;
begin
inherited Destroy;
end;
function TBuildModesEditorFrame.GetTitle: String;
begin
Result := dlgBuildModes;
end;
procedure TBuildModesEditorFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
begin
BuildModesGroupBox.Caption:=lisBuildModes;
DoShowSession;
BuildModeAddSpeedButton.LoadGlyphFromLazarusResource('laz_add');
BuildModeDeleteSpeedButton.LoadGlyphFromLazarusResource('laz_delete');
BuildModeMoveUpSpeedButton.LoadGlyphFromLazarusResource('arrow_up');
BuildModeMoveDownSpeedButton.LoadGlyphFromLazarusResource('arrow_down');
BuildModeDiffSpeedButton.LoadGlyphFromLazarusResource('menu_tool_diff');
end;
procedure TBuildModesEditorFrame.ReadSettings(AOptions: TAbstractIDEOptions);
var
PCOptions: TProjectCompilerOptions;
begin
//debugln(['TBuildModesEditorFrame.ReadSettings ',DbgSName(AOptions)]);
if AOptions is TProjectCompilerOptions then begin
PCOptions:=TProjectCompilerOptions(AOptions);
FProject:=PCOptions.LazProject;
// modes
UpdateShowSession;
FillBuildModesGrid;
UpdateBuildModeButtons;
// options dialog
UpdateDialogCaption;
end;
end;
procedure TBuildModesEditorFrame.WriteSettings(AOptions: TAbstractIDEOptions);
begin
; // Do Nothing. Overrides an abstract method.
end;
class function TBuildModesEditorFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
begin
Result := TProjectCompilerOptions;
end;
function TBuildModesEditorFrame.GetSelectedBuildMode: TProjectBuildMode;
var
i: LongInt;
begin
Result:=nil;
if aProject=nil then exit;
i:=BuildModesStringGrid.Row-1;
if (i<0) or (i>=AProject.BuildModes.Count) then exit;
Result:=AProject.BuildModes[i];
end;
initialization
RegisterIDEOptionsEditor(GroupCompiler, TBuildModesEditorFrame,
CompilerOptionsBuildModes);
end.

View File

@ -7,9 +7,6 @@ interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, Project, IDEOptionsIntf, ProjectIntf, LCLProc, IDEProcs,
{$IFnDEF NewBuildModeWindow}
BuildModesEditor,
{$ENDIF}
LazarusIDEStrConsts;
type
@ -61,19 +58,8 @@ end;
{ TProjectSaveOptionsFrame }
procedure TProjectSaveOptionsFrame.SaveSessionLocationRadioGroupClick(Sender: TObject);
{$IFnDEF NewBuildModeWindow}
var
BuildModesEditor: TBuildModesEditorFrame;
{$ENDIF}
begin
{$IFnDEF NewBuildModeWindow}
BuildModesEditor:=TBuildModesEditorFrame(FindOptionControl(TBuildModesEditorFrame));
if BuildModesEditor<>nil then
begin
BuildModesEditor.LoadShowSessionFromProjects:=false;
BuildModesEditor.ShowSession:=GetSessionLocation in [pssInIDEConfig,pssInProjectDir];
end;
{$ENDIF}
;
end;
function TProjectSaveOptionsFrame.GetSessionLocation: TProjectSessionStorage;

View File

@ -34,11 +34,7 @@ uses
Buttons, ButtonPanel, ExtCtrls, EditBtn, StdCtrls, Dialogs, TreeFilterEdit,
IDEWindowIntf, IDEOptionsIntf, IDECommands, IDEHelpIntf, ProjectIntf,
EnvironmentOpts, LazarusIDEStrConsts, CompOptsIntf, EditorOptions,
{$IFDEF NewBuildModeWindow}
BuildModesManager, project_save_options, Project;
{$ELSE}
BuildModesEditor;
{$ENDIF}
type
TIDEOptsDlgAction = (
@ -153,11 +149,9 @@ 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}
BuildModesManager.OnLoadIDEOptionsHook := @LoadIDEOptions;
BuildModesManager.OnSaveIDEOptionsHook := @SaveIDEOptions;
UpdateBuildModeCombo(BuildModeComboBox);
{$ENDIF}
end;
procedure TIDEOptionsDialog.HelpButtonClick(Sender: TObject);
@ -175,9 +169,7 @@ end;
procedure TIDEOptionsDialog.CategoryTreeChange(Sender: TObject; Node: TTreeNode);
var
{$IFDEF NewBuildModeWindow}
GroupClass: TAbstractIDEOptionsClass;
{$ENDIF}
AEditor: TAbstractIDEOptionsEditor;
begin
if Assigned(Node) then begin
@ -189,25 +181,19 @@ begin
Node := Node.GetFirstVisibleChild;
end;
AEditor := nil;
{$IFDEF NewBuildModeWindow}
GroupClass := nil;
{$ENDIF}
if Assigned(Node) and Assigned(Node.Data) then begin
Assert(TObject(Node.Data) is TAbstractIDEOptionsEditor,
'TIDEOptionsDialog.CategoryTreeChange: Node.Data is not TAbstractIDEOptionsEditor');
if CategoryTree.Selected = nil then
Node.Selected := True;
AEditor := TAbstractIDEOptionsEditor(Node.Data);
{$IFDEF NewBuildModeWindow}
GroupClass := FindGroupClass(Node);
{$ENDIF}
end;
// Show the Build Mode panel for Compiler Options
{$IFDEF NewBuildModeWindow}
if (GroupClass <> nil) and (GroupClass.InheritsFrom(TLazCompilerOptions)) then
BuildModeSelectPanel.Height:=40
else
{$ENDIF}
BuildModeSelectPanel.Height:=0;
// Hide the old and show the new editor frame
if Assigned(AEditor) then
@ -231,24 +217,19 @@ end;
procedure TIDEOptionsDialog.BuildModeComboBoxSelect(Sender: TObject);
begin
{$IFDEF NewBuildModeWindow}
if BuildModeComboBox.Text = lisAllBuildModes then begin
ShowMessage('This will allow changing all build modes at once. Not implemented yet.');
BuildModeComboBox.ItemIndex := PrevComboIndex;
end
else
SwitchBuildMode(BuildModeComboBox.Text);
{$ENDIF}
end;
procedure TIDEOptionsDialog.BuildModeManageButtonClick(Sender: TObject);
{$IFDEF NewBuildModeWindow}
var
ProjectSaveOptions: TProjectSaveOptionsFrame;
ShowSes: Boolean;
{$ENDIF}
begin
{$IFDEF NewBuildModeWindow}
ProjectSaveOptions:=TProjectSaveOptionsFrame(FindEditor(TProjectSaveOptionsFrame));
if Assigned(ProjectSaveOptions) then
ShowSes:=ProjectSaveOptions.GetSessionLocation in [pssInIDEConfig,pssInProjectDir]
@ -256,7 +237,6 @@ begin
ShowSes:=Project1.SessionStorage in [pssInProjectDir,pssInIDEConfig];
if ShowBuildModesDlg(ShowSes) = mrOK then
UpdateBuildModeCombo(BuildModeComboBox);
{$ENDIF}
end;
procedure TIDEOptionsDialog.CategoryTreeCollapsed(Sender: TObject; Node: TTreeNode);

View File

@ -133,9 +133,6 @@ uses
compiler_linking_options, compiler_verbosity_options, compiler_messages_options,
compiler_other_options, compiler_inherited_options, compiler_compilation_options,
compiler_buildmacro_options, IdeMacroValues,
{$IFnDEF NewBuildModeWindow}
BuildModesEditor,
{$ENDIF}
{$IFDEF EnableModeMatrix}
Compiler_ModeMatrix,
{$ENDIF}
@ -3547,11 +3544,7 @@ end;
procedure TMainIDE.mnuChgBuildModeClicked(Sender: TObject);
begin
{$IFDEF NewBuildModeWindow}
DoOpenIDEOptions(TCompilerPathOptionsFrame, '', [TProjectCompilerOptions], []);
{$ELSE}
DoOpenIDEOptions(TBuildModesEditorFrame, '', [TProjectCompilerOptions], []);
{$ENDIF}
end;
procedure TMainIDE.mnuSetBuildModeClick(Sender: TObject);