IDE: project options: fixed build modes diff showing modes

git-svn-id: trunk@41492 -
This commit is contained in:
mattias 2013-06-02 16:29:21 +00:00
parent 430543d215
commit e43d2c2e7c
3 changed files with 30 additions and 27 deletions

View File

@ -29,8 +29,8 @@ unit BuildModeDiffDlg;
interface
uses
Classes, SysUtils, FileUtil, LazUTF8, Forms, Controls, Graphics, Dialogs,
ButtonPanel, StdCtrls, ComCtrls, LazarusIDEStrConsts, Project,
Classes, SysUtils, FileUtil, LazUTF8, LazLogger, Forms, Controls, Graphics,
Dialogs, ButtonPanel, StdCtrls, ComCtrls, LazarusIDEStrConsts, Project,
CompilerOptions, CompOptsModes;
type
@ -52,22 +52,23 @@ type
procedure FillDiffTreeView;
public
procedure SetBuildMode(aMode: TProjectBuildMode);
property aProject: TProject read fProject;
property LazProject: TProject read fProject;
property BaseMode: TProjectBuildMode read FBaseMode;
end;
function ShowBuildModeDiffDialog(aMode: TProjectBuildMode): TModalResult;
function ShowBuildModeDiffDialog(AProject: TProject; aMode: TProjectBuildMode): TModalResult;
implementation
function ShowBuildModeDiffDialog(aMode: TProjectBuildMode): TModalResult;
function ShowBuildModeDiffDialog(AProject: TProject; aMode: TProjectBuildMode): TModalResult;
var
BuildModeDiffDialog: TBuildModeDiffDialog;
begin
BuildModeDiffDialog:=TBuildModeDiffDialog.Create(nil);
try
BuildModeDiffDialog.fProject:=AProject;
BuildModeDiffDialog.SetBuildMode(aMode);
Result:=BuildModeDiffDialog.ShowModal;
finally
@ -113,8 +114,10 @@ begin
for i:=0 to fProject.BuildModes.Count-1 do
sl.Add(fProject.BuildModes[i].GetCaption);
ModeComboBox.Items.Assign(sl);
if BaseMode<>nil then
ModeComboBox.ItemIndex:=BaseMode.GetIndex
if BaseMode<>nil then begin
ModeComboBox.Text:=BaseMode.GetCaption;
ModeComboBox.ItemIndex:=sl.IndexOf(BaseMode.GetCaption);
end
else
ModeComboBox.Text:='(none)';
finally
@ -157,11 +160,11 @@ procedure TBuildModeDiffDialog.SetBuildMode(aMode: TProjectBuildMode);
begin
if aMode<>nil then
begin
fProject:=aMode.LazProject;
if aMode.LazProject<>nil then
fProject:=aMode.LazProject;
FBaseMode:=aMode;
end else
begin
fProject:=nil;
FBaseMode:=nil;
end;
FillModeComboBox;

View File

@ -9,6 +9,7 @@ object BuildModesForm: TBuildModesForm
OnCreate = FormCreate
OnDestroy = FormDestroy
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '1.1'
object BuildModesGroupBox: TGroupBox
Left = 6
@ -19,16 +20,16 @@ object BuildModesForm: TBuildModesForm
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Caption = 'BuildModesGroupBox'
ClientHeight = 276
ClientWidth = 594
ClientHeight = 288
ClientWidth = 596
TabOrder = 0
object BuildModesStringGrid: TStringGrid
AnchorSideTop.Control = BuildModeAddSpeedButton
AnchorSideTop.Side = asrBottom
Left = 0
Height = 254
Height = 266
Top = 22
Width = 594
Width = 596
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFillColumns = True
@ -38,19 +39,19 @@ object BuildModesForm: TBuildModesForm
ButtonStyle = cbsCheckboxColumn
MaxSize = 50
Title.Caption = 'Active'
Width = 196
Width = 198
end
item
ButtonStyle = cbsCheckboxColumn
MaxSize = 50
Title.Caption = 'InSession'
Width = 196
Width = 198
end
item
MaxSize = 500
SizePriority = 100
Title.Caption = 'Title'
Width = 196
Width = 198
end>
FixedCols = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll]
@ -59,9 +60,9 @@ object BuildModesForm: TBuildModesForm
OnSelection = BuildModesStringGridSelection
OnValidateEntry = BuildModesStringGridValidateEntry
ColWidths = (
196
196
196
198
198
198
)
end
object BuildModeAddSpeedButton: TSpeedButton
@ -127,8 +128,8 @@ object BuildModesForm: TBuildModesForm
end
object ButtonPanel1: TButtonPanel
Left = 6
Height = 34
Top = 326
Height = 36
Top = 324
Width = 600
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True

View File

@ -59,7 +59,7 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function GetSelectedBuildMode: TProjectBuildMode;
procedure SetActiveBuildModeByID(AValue: TProjectBuildMode);
procedure SetActiveBuildModeByID(const Identifier: string);
public
property ActiveBuildMode: TProjectBuildMode read GetActiveBuildMode write SetActiveBuildMode;
property BuildModes: TProjectBuildModes read fBuildModes;
@ -90,7 +90,7 @@ begin
OnSaveIDEOptionsHook(Nil, Project1.CompilerOptions);
// Copy to dialog
frm.fBuildModes.Assign(Project1.BuildModes, True);
frm.SetActiveBuildModeByID(Project1.ActiveBuildMode);
frm.SetActiveBuildModeByID(Project1.ActiveBuildMode.Identifier);
frm.fShowSession:=aShowSession;
// Show the form. Let user add / edit / delete.
Result := frm.ShowModal;
@ -187,8 +187,7 @@ end;
procedure TBuildModesForm.BuildModeDiffSpeedButtonClick(Sender: TObject);
begin
// show diff dialog
ShowBuildModeDiffDialog(GetSelectedBuildMode);
IncreaseBuildMacroChangeStamp;
ShowBuildModeDiffDialog(Project1,GetSelectedBuildMode);
end;
procedure TBuildModesForm.BuildModeAddSpeedButtonClick(Sender: TObject);
@ -519,13 +518,13 @@ begin
fActiveBuildMode := AValue;
end;
procedure TBuildModesForm.SetActiveBuildModeByID(AValue: TProjectBuildMode);
procedure TBuildModesForm.SetActiveBuildModeByID(const Identifier: string);
var
i: Integer;
begin
for i:=0 to fBuildModes.Count-1 do
begin
if fBuildModes[i].Identifier=AValue.Identifier then
if fBuildModes[i].Identifier=Identifier then
begin
ActiveBuildMode:=fBuildModes[i];
Break;