mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-31 05:52:38 +02:00
New form for Build Mode Management
git-svn-id: trunk@39269 -
This commit is contained in:
parent
11eb3f7337
commit
4edee9917b
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -4588,6 +4588,8 @@ ide/buildlazdialog.pas svneol=native#text/pascal
|
||||
ide/buildmanager.pas svneol=native#text/plain
|
||||
ide/buildmodediffdlg.lfm svneol=native#text/plain
|
||||
ide/buildmodediffdlg.pas svneol=native#text/plain
|
||||
ide/buildmodesmanager.lfm svneol=native#text/plain
|
||||
ide/buildmodesmanager.pas svneol=native#text/plain
|
||||
ide/buildprofilemanager.lfm svneol=native#text/plain
|
||||
ide/buildprofilemanager.pas svneol=native#text/plain
|
||||
ide/buildprojectdlg.lfm svneol=native#text/plain
|
||||
|
148
ide/buildmodesmanager.lfm
Normal file
148
ide/buildmodesmanager.lfm
Normal file
@ -0,0 +1,148 @@
|
||||
object BuildModesForm: TBuildModesForm
|
||||
Left = 473
|
||||
Height = 366
|
||||
Top = 550
|
||||
Width = 612
|
||||
Caption = 'BuildModesForm'
|
||||
ClientHeight = 366
|
||||
ClientWidth = 612
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
LCLVersion = '1.1'
|
||||
object BuildModesGroupBox: TGroupBox
|
||||
Left = 6
|
||||
Height = 305
|
||||
Top = 6
|
||||
Width = 600
|
||||
Align = alTop
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'BuildModesGroupBox'
|
||||
ClientHeight = 288
|
||||
ClientWidth = 596
|
||||
TabOrder = 0
|
||||
object BuildModesStringGrid: TStringGrid
|
||||
AnchorSideTop.Control = BuildModeAddSpeedButton
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 266
|
||||
Top = 22
|
||||
Width = 596
|
||||
Align = alBottom
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
AutoFillColumns = True
|
||||
ColCount = 3
|
||||
Columns = <
|
||||
item
|
||||
ButtonStyle = cbsCheckboxColumn
|
||||
MaxSize = 50
|
||||
Title.Caption = 'Active'
|
||||
Width = 197
|
||||
end
|
||||
item
|
||||
ButtonStyle = cbsCheckboxColumn
|
||||
MaxSize = 50
|
||||
Title.Caption = 'InSession'
|
||||
Width = 197
|
||||
end
|
||||
item
|
||||
MaxSize = 500
|
||||
SizePriority = 100
|
||||
Title.Caption = 'Title'
|
||||
Width = 198
|
||||
end>
|
||||
FixedCols = 0
|
||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll]
|
||||
TabOrder = 0
|
||||
OnCheckboxToggled = BuildModesCheckboxToggled
|
||||
OnSelection = BuildModesStringGridSelection
|
||||
OnValidateEntry = BuildModesStringGridValidateEntry
|
||||
ColWidths = (
|
||||
197
|
||||
197
|
||||
198
|
||||
)
|
||||
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 ButtonPanel1: TButtonPanel
|
||||
Left = 6
|
||||
Height = 38
|
||||
Top = 322
|
||||
Width = 600
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
HelpButton.Name = 'HelpButton'
|
||||
HelpButton.DefaultCaption = True
|
||||
CloseButton.Name = 'CloseButton'
|
||||
CloseButton.DefaultCaption = True
|
||||
CancelButton.Name = 'CancelButton'
|
||||
CancelButton.DefaultCaption = True
|
||||
TabOrder = 1
|
||||
ShowButtons = [pbOK, pbCancel, pbHelp]
|
||||
end
|
||||
object BuildModesPopupMenu: TPopupMenu
|
||||
left = 208
|
||||
top = 88
|
||||
end
|
||||
end
|
467
ide/buildmodesmanager.pas
Normal file
467
ide/buildmodesmanager.pas
Normal file
@ -0,0 +1,467 @@
|
||||
unit BuildModesManager;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
Grids, Buttons, Menus, ButtonPanel, LCLProc,
|
||||
ProjectIntf, IDEImagesIntf, IDEOptionsIntf, CompOptsIntf,
|
||||
PackageDefs, TransferMacros, //compiler_inherited_options,
|
||||
PathEditorDlg, Project, LazarusIDEStrConsts, CompilerOptions, // PackageSystem,
|
||||
IDEProcs, BuildModeDiffDlg;
|
||||
|
||||
type
|
||||
|
||||
{ TBuildModesForm }
|
||||
|
||||
TBuildModesForm = class(TForm)
|
||||
BuildModeAddSpeedButton: TSpeedButton;
|
||||
BuildModeDeleteSpeedButton: TSpeedButton;
|
||||
BuildModeDiffSpeedButton: TSpeedButton;
|
||||
BuildModeMoveDownSpeedButton: TSpeedButton;
|
||||
BuildModeMoveUpSpeedButton: TSpeedButton;
|
||||
BuildModesGroupBox: TGroupBox;
|
||||
BuildModesPopupMenu: TPopupMenu;
|
||||
BuildModesStringGrid: TStringGrid;
|
||||
ButtonPanel1: TButtonPanel;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure BuildModeDiffSpeedButtonClick(Sender: TObject);
|
||||
procedure BuildModeAddSpeedButtonClick(Sender: TObject);
|
||||
procedure BuildModeDeleteSpeedButtonClick(Sender: TObject);
|
||||
procedure BuildModeMoveDownSpeedButtonClick(Sender: TObject);
|
||||
procedure BuildModeMoveUpSpeedButtonClick(Sender: TObject);
|
||||
procedure BuildModesCheckboxToggled(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);
|
||||
procedure FormShow(Sender: TObject);
|
||||
private
|
||||
FOnLoadOptionsHook: TOnLoadIDEOptions;
|
||||
FOnSaveOptionsHook: TOnSaveIDEOptions;
|
||||
FLoadShowSessionFromProject: boolean;
|
||||
FProject: TProject;
|
||||
FShowSession: boolean;
|
||||
FSwitchingMode: boolean;
|
||||
fModeActiveCol: integer;
|
||||
fModeInSessionCol: integer;
|
||||
fModeNameCol: integer;
|
||||
procedure FillBuildModesGrid;
|
||||
procedure UpdateBuildModeButtons;
|
||||
procedure ActivateMode(aMode: TProjectBuildMode);
|
||||
procedure UpdateShowSession;
|
||||
procedure SetShowSession(const AValue: boolean);
|
||||
procedure DoShowSession;
|
||||
procedure UpdateDialogCaption;
|
||||
public
|
||||
property SwitchingMode: boolean read FSwitchingMode; // the active mode is currently switched
|
||||
property ShowSession: boolean read FShowSession write SetShowSession;
|
||||
property LoadShowSessionFromProject: boolean read FLoadShowSessionFromProject
|
||||
write FLoadShowSessionFromProject;
|
||||
function GetSelectedBuildMode: TProjectBuildMode;
|
||||
public
|
||||
property OnLoadIDEOptionsHook: TOnLoadIDEOptions read FOnLoadOptionsHook write FOnLoadOptionsHook;
|
||||
property OnSaveIDEOptionsHook: TOnSaveIDEOptions read FOnSaveOptionsHook write FOnSaveOptionsHook;
|
||||
end;
|
||||
|
||||
var
|
||||
BuildModesForm: TBuildModesForm;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TBuildModesForm }
|
||||
|
||||
procedure TBuildModesForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
;
|
||||
end;
|
||||
|
||||
procedure TBuildModesForm.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
;
|
||||
end;
|
||||
|
||||
procedure TBuildModesForm.FormShow(Sender: TObject);
|
||||
begin
|
||||
FProject:=Project1; // Now hardcoded.
|
||||
// modes
|
||||
UpdateShowSession;
|
||||
FillBuildModesGrid;
|
||||
UpdateBuildModeButtons;
|
||||
// options dialog
|
||||
UpdateDialogCaption;
|
||||
|
||||
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 TBuildModesForm.BuildModeDiffSpeedButtonClick(Sender: TObject);
|
||||
begin
|
||||
FSwitchingMode:=true;
|
||||
try
|
||||
// save changes
|
||||
OnSaveIDEOptionsHook(Self,FProject.CompilerOptions);
|
||||
// show diff dialog
|
||||
ShowBuildModeDiffDialog(GetSelectedBuildMode);
|
||||
IncreaseBuildMacroChangeStamp;
|
||||
// load options
|
||||
OnLoadIDEOptionsHook(Self,FProject.CompilerOptions);
|
||||
finally
|
||||
FSwitchingMode:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBuildModesForm.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:=FProject.BuildModes[i];
|
||||
end
|
||||
else begin
|
||||
Identifier:='Mode';
|
||||
CurMode:=nil;
|
||||
end;
|
||||
// find unique name
|
||||
i:=0;
|
||||
repeat
|
||||
inc(i);
|
||||
NewName:=Identifier+IntToStr(i);
|
||||
until FProject.BuildModes.Find(NewName)=nil;
|
||||
// create new mode
|
||||
NewMode:=FProject.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;
|
||||
end;
|
||||
|
||||
procedure TBuildModesForm.BuildModeDeleteSpeedButtonClick(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
CurMode: TProjectBuildMode;
|
||||
Grid: TStringGrid;
|
||||
begin
|
||||
Grid:=BuildModesStringGrid;
|
||||
i:=Grid.Row-1;
|
||||
if i<0 then exit;
|
||||
if FProject.BuildModes.Count=1 then
|
||||
begin
|
||||
MessageDlg(lisCCOErrorCaption, lisThereMustBeAtLeastOneBuildMode,
|
||||
mtError,[mbCancel],0);
|
||||
exit;
|
||||
end;
|
||||
CurMode:=FProject.BuildModes[i];
|
||||
// when delete the activated: activate another
|
||||
if FProject.ActiveBuildMode=CurMode then
|
||||
begin
|
||||
if i<FProject.BuildModes.Count-1 then
|
||||
ActivateMode(FProject.BuildModes[i+1])
|
||||
else
|
||||
ActivateMode(FProject.BuildModes[i-1]);
|
||||
end;
|
||||
if FProject.ActiveBuildMode=CurMode then begin
|
||||
debugln(['TBuildModesEditorFrame.BuildModeDeleteSpeedButtonClick activate failed']);
|
||||
exit;
|
||||
end;
|
||||
// delete mode
|
||||
FProject.BuildModes.Delete(i);
|
||||
FillBuildModesGrid;
|
||||
// select next mode
|
||||
if i>=Grid.RowCount then
|
||||
Grid.Row:=Grid.RowCount-1
|
||||
else
|
||||
Grid.Row:=i;
|
||||
end;
|
||||
|
||||
procedure TBuildModesForm.BuildModeMoveDownSpeedButtonClick(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
i:=BuildModesStringGrid.Row-1;
|
||||
if i+1>=FProject.BuildModes.Count then exit;
|
||||
FProject.BuildModes.Move(i,i+1);
|
||||
FProject.BuildModes[0].InSession:=false;
|
||||
inc(i);
|
||||
FillBuildModesGrid;
|
||||
BuildModesStringGrid.Row:=i+1;
|
||||
end;
|
||||
|
||||
procedure TBuildModesForm.BuildModeMoveUpSpeedButtonClick(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
i:=BuildModesStringGrid.Row-1;
|
||||
if i<=0 then exit;
|
||||
FProject.BuildModes.Move(i,i-1);
|
||||
dec(i);
|
||||
FProject.BuildModes[0].InSession:=false;
|
||||
FillBuildModesGrid;
|
||||
BuildModesStringGrid.Row:=i+1;
|
||||
end;
|
||||
|
||||
procedure TBuildModesForm.BuildModesCheckboxToggled(Sender: TObject;
|
||||
aCol, aRow: Integer; aState: TCheckboxState);
|
||||
var
|
||||
CurMode: TProjectBuildMode;
|
||||
b: Boolean;
|
||||
i: Integer;
|
||||
Grid: TStringGrid;
|
||||
begin
|
||||
debugln(['TBuildModesForm.BuildModesCheckboxToggled Row=',aRow,' Col=',aCol,' ',ord(aState)]);
|
||||
i:=aRow-1;
|
||||
if (i<0) or (i>=FProject.BuildModes.Count) then exit;
|
||||
CurMode:=FProject.BuildModes[i];
|
||||
Grid:=BuildModesStringGrid;
|
||||
if aCol=fModeActiveCol then
|
||||
begin
|
||||
// activate
|
||||
if CurMode=FProject.ActiveBuildMode then begin
|
||||
debugln(['TBuildModesForm.BuildModesCheckboxToggled, is ActiveBuildMode',i]);
|
||||
// there must always be an active mode
|
||||
Grid.Cells[aCol,aRow]:=Grid.Columns[aCol].ValueChecked;
|
||||
end
|
||||
else begin
|
||||
debugln(['TBuildModesForm.BuildModesCheckboxToggled, another Mode',i]);
|
||||
ActivateMode(CurMode);
|
||||
end;
|
||||
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;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBuildModesForm.BuildModesStringGridSelection(Sender: TObject;
|
||||
aCol, aRow: Integer);
|
||||
begin
|
||||
UpdateBuildModeButtons;
|
||||
end;
|
||||
|
||||
procedure TBuildModesForm.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>=FProject.BuildModes.Count) then exit;
|
||||
CurMode:=FProject.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;
|
||||
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;
|
||||
end;
|
||||
UpdateDialogCaption;
|
||||
end;
|
||||
|
||||
procedure TBuildModesForm.FillBuildModesGrid;
|
||||
var
|
||||
i: Integer;
|
||||
CurMode: TProjectBuildMode;
|
||||
Grid: TStringGrid;
|
||||
begin
|
||||
if FProject=nil then exit;
|
||||
|
||||
Grid:=BuildModesStringGrid;
|
||||
Grid.BeginUpdate;
|
||||
Grid.RowCount:=FProject.BuildModes.Count+1;
|
||||
|
||||
for i:=0 to FProject.BuildModes.Count-1 do begin
|
||||
CurMode:=FProject.BuildModes[i];
|
||||
// active
|
||||
if CurMode=FProject.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 TBuildModesForm.UpdateBuildModeButtons;
|
||||
var
|
||||
i: Integer;
|
||||
CurMode: TProjectBuildMode;
|
||||
Identifier: string;
|
||||
begin
|
||||
i:=BuildModesStringGrid.Row-1;
|
||||
if (FProject<>nil) and (FProject.BuildModes<>nil)
|
||||
and (i>=0) and (i<FProject.BuildModes.Count) then
|
||||
begin
|
||||
CurMode:=FProject.BuildModes[i];
|
||||
Identifier:=BuildModesStringGrid.Cells[fModeNameCol,i+1];
|
||||
end
|
||||
else
|
||||
CurMode:=nil;
|
||||
|
||||
BuildModeAddSpeedButton.Hint:=Format(lisAddNewBuildModeCopyingSettingsFrom, [Identifier]);
|
||||
BuildModeDeleteSpeedButton.Enabled:=(CurMode<>nil) and (FProject.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 TBuildModesForm.ActivateMode(aMode: TProjectBuildMode);
|
||||
begin
|
||||
if aMode=FProject.ActiveBuildMode then exit;
|
||||
FSwitchingMode:=true;
|
||||
try
|
||||
// save changes
|
||||
OnSaveIDEOptionsHook(Self,FProject.CompilerOptions);
|
||||
// switch
|
||||
FProject.ActiveBuildMode:=aMode;
|
||||
IncreaseBuildMacroChangeStamp;
|
||||
// load options
|
||||
OnLoadIDEOptionsHook(Self,FProject.CompilerOptions);
|
||||
finally
|
||||
FSwitchingMode:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBuildModesForm.UpdateShowSession;
|
||||
begin
|
||||
if LoadShowSessionFromProject then
|
||||
ShowSession:=True;
|
||||
//ShowSession:=(FProject<>nil) Does not work, why?
|
||||
// and (FProject.SessionStorage in [pssInProjectDir,pssInIDEConfig]);
|
||||
end;
|
||||
|
||||
procedure TBuildModesForm.SetShowSession(const AValue: boolean);
|
||||
begin
|
||||
if AValue=FShowSession then exit;
|
||||
FShowSession:=AValue;
|
||||
DoShowSession;
|
||||
FillBuildModesGrid;
|
||||
end;
|
||||
|
||||
procedure TBuildModesForm.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 TBuildModesForm.UpdateDialogCaption;
|
||||
var
|
||||
s: String;
|
||||
begin
|
||||
if FProject<>nil then
|
||||
begin
|
||||
s := FProject.GetTitleOrName;
|
||||
s:=Format(dlgProjectOptionsFor, [s]);
|
||||
if FProject.BuildModes.Count>1 then
|
||||
s:=s+', '+copy(FProject.ActiveBuildMode.GetCaption,1,12);
|
||||
end else
|
||||
s:='TBuildModesEditorFrame.GetDialogCaption: no project';
|
||||
Caption:=s;
|
||||
end;
|
||||
|
||||
function TBuildModesForm.GetSelectedBuildMode: TProjectBuildMode;
|
||||
var
|
||||
i: LongInt;
|
||||
begin
|
||||
Result:=nil;
|
||||
if FProject=nil then exit;
|
||||
i:=BuildModesStringGrid.Row-1;
|
||||
if (i<0) or (i>=FProject.BuildModes.Count) then exit;
|
||||
Result:=FProject.BuildModes[i];
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user