IDE: compiler options: show session column only if session separate

git-svn-id: trunk@27752 -
This commit is contained in:
mattias 2010-10-18 16:43:49 +00:00
parent 4ae44f8cb3
commit 3c1071b4f1
5 changed files with 199 additions and 97 deletions

View File

@ -71,18 +71,25 @@ type
procedure BuildModesStringGridValidateEntry(sender: TObject; aCol, procedure BuildModesStringGridValidateEntry(sender: TObject; aCol,
aRow: Integer; const OldValue: string; var NewValue: String); aRow: Integer; const OldValue: string; var NewValue: String);
private private
FLoadShowSessionFromProject: boolean;
FMacroValues: TProjectBuildMacros; FMacroValues: TProjectBuildMacros;
FProject: TProject; FProject: TProject;
FShowSession: boolean;
FSwitchingMode: boolean; FSwitchingMode: boolean;
fActiveCol: integer;
fInSessionCol: integer;
fNameCol: integer;
procedure UpdateMacrosControls; procedure UpdateMacrosControls;
function GetAllBuildMacros: TStrings; function GetAllBuildMacros: TStrings;
procedure CleanMacrosGrid; procedure CleanMacrosGrid;
procedure SaveMacros(UpdateControls: boolean); procedure SaveMacros(UpdateControls: boolean);
procedure UpdateInheritedOptions; procedure UpdateInheritedOptions;
function FindOptionFrame(AClass: TComponentClass): TComponent;
procedure FillBuildModesGrid; procedure FillBuildModesGrid;
procedure UpdateBuildModeButtons; procedure UpdateBuildModeButtons;
procedure ActivateMode(aMode: TProjectBuildMode); procedure ActivateMode(aMode: TProjectBuildMode);
procedure UpdateShowSession;
procedure SetShowSession(const AValue: boolean);
procedure DoShowSession;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -94,6 +101,9 @@ type
property AProject: TProject read FProject; property AProject: TProject read FProject;
property MacroValues: TProjectBuildMacros read FMacroValues; property MacroValues: TProjectBuildMacros read FMacroValues;
property SwitchingMode: boolean read FSwitchingMode; // the active mode is currently switched 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;
end; end;
implementation implementation
@ -210,7 +220,7 @@ begin
// activate // activate
ActivateMode(NewMode); ActivateMode(NewMode);
// select identifier // select identifier
BuildModesStringGrid.Col:=2; BuildModesStringGrid.Col:=fNameCol;
BuildModesStringGrid.Row:=BuildModesStringGrid.RowCount-1; BuildModesStringGrid.Row:=BuildModesStringGrid.RowCount-1;
BuildModesStringGrid.EditorMode:=true; BuildModesStringGrid.EditorMode:=true;
end; end;
@ -227,7 +237,7 @@ begin
if i<0 then exit; if i<0 then exit;
if AProject.BuildModes.Count=1 then if AProject.BuildModes.Count=1 then
begin begin
MessageDlg('Error','There must be at least one build mode.', MessageDlg(lisCCOErrorCaption, lisThereMustBeAtLeastOneBuildMode,
mtError,[mbCancel],0); mtError,[mbCancel],0);
exit; exit;
end; end;
@ -292,28 +302,27 @@ begin
//debugln(['TBuildModesEditorFrame.BuildModesStringGridCheckboxToggled ',i]); //debugln(['TBuildModesEditorFrame.BuildModesStringGridCheckboxToggled ',i]);
CurMode:=AProject.BuildModes[i]; CurMode:=AProject.BuildModes[i];
Grid:=BuildModesStringGrid; Grid:=BuildModesStringGrid;
case aCol of if aCol=fActiveCol then
0: begin
// activate // activate
if CurMode=AProject.ActiveBuildMode then if CurMode=AProject.ActiveBuildMode then
// there must always be an active mode // there must always be an active mode
Grid.Cells[aCol,aRow]:=Grid.Columns[aCol].ValueChecked Grid.Cells[aCol,aRow]:=Grid.Columns[aCol].ValueChecked
else else
ActivateMode(CurMode); ActivateMode(CurMode);
1: end else if aCol=fInSessionCol then
begin
// in session
b:=aState=cbChecked;
if b and (i=0) then
begin begin
// in session Grid.Cells[aCol,aRow]:=Grid.Columns[aCol].ValueUnchecked;
b:=aState=cbChecked; MessageDlg(lisCCOErrorCaption,
if b and (i=0) then lisTheFirstBuildModeIsTheDefaultModeAndMustBeStoredIn,
begin mtError,[mbCancel],0);
Grid.Cells[aCol,aRow]:=Grid.Columns[aCol].ValueUnchecked; exit;
MessageDlg('Error',
'The first build mode is the default mode and must be stored in the project, not in the session.',
mtError,[mbCancel],0);
exit;
end;
CurMode.InSession:=b;
end; end;
CurMode.InSession:=b;
end; end;
end; end;
@ -344,33 +353,28 @@ begin
if (i<0) or (i>=AProject.BuildModes.Count) then exit; if (i<0) or (i>=AProject.BuildModes.Count) then exit;
//debugln(['TBuildModesEditorFrame.SaveModes ',i]); //debugln(['TBuildModesEditorFrame.SaveModes ',i]);
CurMode:=AProject.BuildModes[i]; CurMode:=AProject.BuildModes[i];
case aCol of if aCol=fInSessionCol then
0: begin
// activate is done in BuildModesStringGridCheckboxToggled // in session
; b:=NewValue=BuildModesStringGrid.Columns[aCol].ValueChecked;
1: if b and (i=0) then
begin begin
// in session NewValue:=OldValue;
b:=NewValue=BuildModesStringGrid.Columns[1].ValueChecked; MessageDlg(lisCCOErrorCaption,
if b and (i=0) then lisTheFirstBuildModeIsTheDefaultModeAndMustBeStoredIn2,
begin mtError,[mbCancel],0);
NewValue:=OldValue; exit;
MessageDlg('Error',
'The first build mode is the default mode and must be stored in the project, not in the session.',
mtError,[mbCancel],0);
exit;
end;
CurMode.InSession:=b;
end;
2:
begin
// identifier
s:=NewValue;
for j:=1 to length(s) do
if s[j]<' ' then s[j]:=' ';
CurMode.Identifier:=s;
NewValue:=s;
end; end;
CurMode.InSession:=b;
end
else if aCol=fNameCol then
begin
// identifier
s:=NewValue;
for j:=1 to length(s) do
if s[j]<' ' then s[j]:=' ';
CurMode.Identifier:=s;
NewValue:=s;
end; end;
end; end;
@ -391,6 +395,48 @@ begin
Grid.Cells[1,i]:=''; Grid.Cells[1,i]:='';
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;
fActiveCol:=0;
if FShowSession then
begin
fInSessionCol:=1;
fNameCol:=2;
if Grid.Columns.Count<3 then
Grid.Columns.Insert(fInSessionCol);
end else begin
fInSessionCol:=-1;
fNameCol:=1;
if Grid.Columns.Count>2 then
Grid.Columns.Delete(1);
end;
BuildModesStringGrid.Columns[fActiveCol].Title.Caption:=lisActive;
BuildModesStringGrid.Columns[fActiveCol].SizePriority:=1;
BuildModesStringGrid.Columns[fActiveCol].ButtonStyle:=cbsCheckboxColumn;
if fInSessionCol>=0 then
begin
BuildModesStringGrid.Columns[fInSessionCol].Title.Caption:=lisInSession;
BuildModesStringGrid.Columns[fInSessionCol].SizePriority:=1;
BuildModesStringGrid.Columns[fInSessionCol].ButtonStyle:=cbsCheckboxColumn;
end;
BuildModesStringGrid.Columns[fNameCol].Title.Caption:=lisDebugOptionsFrmName;
BuildModesStringGrid.Columns[fNameCol].SizePriority:=10;
BuildModesStringGrid.Columns[fNameCol].ButtonStyle:=cbsAuto;
Grid.EndUpdate(true);
end;
function TBuildModesEditorFrame.GetAllBuildMacros: TStrings; function TBuildModesEditorFrame.GetAllBuildMacros: TStrings;
procedure Add(aBuildMacro: TLazBuildMacro); procedure Add(aBuildMacro: TLazBuildMacro);
@ -497,59 +543,41 @@ var
InhOptionCtrl: TCompilerInheritedOptionsFrame; InhOptionCtrl: TCompilerInheritedOptionsFrame;
begin begin
InhOptionCtrl:=TCompilerInheritedOptionsFrame( InhOptionCtrl:=TCompilerInheritedOptionsFrame(
FindOptionFrame(TCompilerInheritedOptionsFrame)); FindOptionControl(TCompilerInheritedOptionsFrame));
//debugln(['TBuildModesEditorFrame.UpdateInheritedOptions ',DbgSName(InhOptionCtrl)]); //debugln(['TBuildModesEditorFrame.UpdateInheritedOptions ',DbgSName(InhOptionCtrl)]);
if InhOptionCtrl=nil then exit; if InhOptionCtrl=nil then exit;
InhOptionCtrl.UpdateInheritedTree(AProject.CompilerOptions); InhOptionCtrl.UpdateInheritedTree(AProject.CompilerOptions);
end; end;
function TBuildModesEditorFrame.FindOptionFrame(AClass: TComponentClass
): TComponent;
function Search(AControl: TControl): TComponent;
var
i: Integer;
AWinControl: TWinControl;
begin
if AControl is AClass then
exit(AControl);
if AControl is TWinControl then begin
AWinControl:=TWinControl(AControl);
for i:=0 to AWinControl.ControlCount-1 do begin
Result:=Search(AWinControl.Controls[i]);
if Result<>nil then exit;
end;
end;
Result:=nil;
end;
begin
Result:=Search(GetParentForm(Self));
end;
procedure TBuildModesEditorFrame.FillBuildModesGrid; procedure TBuildModesEditorFrame.FillBuildModesGrid;
var var
i: Integer; i: Integer;
CurMode: TProjectBuildMode; CurMode: TProjectBuildMode;
Grid: TStringGrid;
begin begin
if AProject=nil then exit; if AProject=nil then exit;
BuildModesStringGrid.RowCount:=AProject.BuildModes.Count+1;
Grid:=BuildModesStringGrid;
Grid.BeginUpdate;
Grid.RowCount:=AProject.BuildModes.Count+1;
for i:=0 to AProject.BuildModes.Count-1 do begin for i:=0 to AProject.BuildModes.Count-1 do begin
CurMode:=AProject.BuildModes[i]; CurMode:=AProject.BuildModes[i];
// active // active
if CurMode=AProject.ActiveBuildMode then if CurMode=AProject.ActiveBuildMode then
BuildModesStringGrid.Cells[0,i+1]:=BuildModesStringGrid.Columns[0].ValueChecked Grid.Cells[fActiveCol,i+1]:=Grid.Columns[fActiveCol].ValueChecked
else else
BuildModesStringGrid.Cells[0,i+1]:=BuildModesStringGrid.Columns[0].ValueUnchecked; Grid.Cells[fActiveCol,i+1]:=Grid.Columns[fActiveCol].ValueUnchecked;
// in session // in session
if CurMode.InSession then if fInSessionCol>=0 then
BuildModesStringGrid.Cells[1,i+1]:=BuildModesStringGrid.Columns[0].ValueChecked if CurMode.InSession then
else Grid.Cells[fInSessionCol,i+1]:=Grid.Columns[fInSessionCol].ValueChecked
BuildModesStringGrid.Cells[1,i+1]:=BuildModesStringGrid.Columns[0].ValueUnchecked; else
Grid.Cells[fInSessionCol,i+1]:=Grid.Columns[fInSessionCol].ValueUnchecked;
// identifier // identifier
BuildModesStringGrid.Cells[2,i+1]:=CurMode.Identifier; Grid.Cells[fNameCol,i+1]:=CurMode.Identifier;
end; end;
Grid.EndUpdate(true);
end; end;
procedure TBuildModesEditorFrame.UpdateBuildModeButtons; procedure TBuildModesEditorFrame.UpdateBuildModeButtons;
@ -563,19 +591,21 @@ begin
and (i>=0) and (i<AProject.BuildModes.Count) then and (i>=0) and (i<AProject.BuildModes.Count) then
begin begin
CurMode:=AProject.BuildModes[i]; CurMode:=AProject.BuildModes[i];
Identifier:=BuildModesStringGrid.Cells[2,i+1]; Identifier:=BuildModesStringGrid.Cells[fNameCol,i+1];
end end
else else
CurMode:=nil; CurMode:=nil;
BuildModeAddSpeedButton.Hint:='Add new build mode, copying settings from "'+Identifier+'"'; BuildModeAddSpeedButton.Hint:=Format(lisAddNewBuildModeCopyingSettingsFrom, [
Identifier]);
BuildModeDeleteSpeedButton.Enabled:=(CurMode<>nil) and (AProject.BuildModes.Count>1); BuildModeDeleteSpeedButton.Enabled:=(CurMode<>nil) and (AProject.BuildModes.Count>1);
BuildModeDeleteSpeedButton.Hint:='Delete mode "'+Identifier+'"'; BuildModeDeleteSpeedButton.Hint:=Format(lisDeleteMode, [Identifier]);
BuildModeMoveUpSpeedButton.Enabled:=(CurMode<>nil) and (i>0); BuildModeMoveUpSpeedButton.Enabled:=(CurMode<>nil) and (i>0);
BuildModeMoveUpSpeedButton.Hint:='Move "'+Identifier+'" one position up'; BuildModeMoveUpSpeedButton.Hint:=Format(lisMoveOnePositionUp, [Identifier]);
BuildModeMoveDownSpeedButton.Enabled:= BuildModeMoveDownSpeedButton.Enabled:=
i<BuildModesStringGrid.RowCount-2; i<BuildModesStringGrid.RowCount-2;
BuildModeMoveDownSpeedButton.Hint:='Move "'+Identifier+'" one position down'; BuildModeMoveDownSpeedButton.Hint:=Format(lisMoveOnePositionDown, [Identifier]
);
end; end;
procedure TBuildModesEditorFrame.ActivateMode(aMode: TProjectBuildMode); procedure TBuildModesEditorFrame.ActivateMode(aMode: TProjectBuildMode);
@ -595,9 +625,17 @@ begin
end; end;
end; end;
procedure TBuildModesEditorFrame.UpdateShowSession;
begin
if LoadShowSessionFromProjects then
ShowSession:=(AProject<>nil)
and (AProject.SessionStorage in [pssInProjectDir,pssInIDEConfig]);
end;
constructor TBuildModesEditorFrame.Create(TheOwner: TComponent); constructor TBuildModesEditorFrame.Create(TheOwner: TComponent);
begin begin
inherited Create(TheOwner); inherited Create(TheOwner);
FLoadShowSessionFromProject:=true;
FMacroValues:=TProjectBuildMacros.Create; FMacroValues:=TProjectBuildMacros.Create;
end; end;
@ -609,7 +647,7 @@ end;
function TBuildModesEditorFrame.GetTitle: String; function TBuildModesEditorFrame.GetTitle: String;
begin begin
Result := 'Build modes'; Result := lisBuildModes;
end; end;
procedure TBuildModesEditorFrame.Setup(ADialog: TAbstractOptionsEditorDialog); procedure TBuildModesEditorFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
@ -617,9 +655,7 @@ var
Grid: TStringGrid; Grid: TStringGrid;
begin begin
BuildModesGroupBox.Caption:=lisBuildModes; BuildModesGroupBox.Caption:=lisBuildModes;
BuildModesStringGrid.Columns[0].Title.Caption:=lisActive; DoShowSession;
BuildModesStringGrid.Columns[1].Title.Caption:=lisInSession;
BuildModesStringGrid.Columns[2].Title.Caption:=lisDebugOptionsFrmName;
BuildModeAddSpeedButton.LoadGlyphFromLazarusResource('laz_add'); BuildModeAddSpeedButton.LoadGlyphFromLazarusResource('laz_add');
BuildModeDeleteSpeedButton.LoadGlyphFromLazarusResource('laz_delete'); BuildModeDeleteSpeedButton.LoadGlyphFromLazarusResource('laz_delete');
@ -644,10 +680,15 @@ begin
if AOptions is TProjectCompilerOptions then begin if AOptions is TProjectCompilerOptions then begin
PCOptions:=TProjectCompilerOptions(AOptions); PCOptions:=TProjectCompilerOptions(AOptions);
FProject:=PCOptions.LazProject; FProject:=PCOptions.LazProject;
MacroValues.Assign(FProject.MacroValues);
UpdateMacrosControls; // modes
UpdateShowSession;
FillBuildModesGrid; FillBuildModesGrid;
UpdateBuildModeButtons; UpdateBuildModeButtons;
// macros
MacroValues.Assign(FProject.MacroValues);
UpdateMacrosControls;
end; end;
end; end;

View File

@ -6,9 +6,8 @@ inherited ProjectSaveOptionsFrame: TProjectSaveOptionsFrame
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 17 Height = 18
Top = 0 Top = 0
Width = 320 Width = 320
Align = alTop Align = alTop
@ -22,8 +21,8 @@ inherited ProjectSaveOptionsFrame: TProjectSaveOptionsFrame
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 17 Height = 18
Top = 23 Top = 24
Width = 320 Width = 320
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -37,8 +36,8 @@ inherited ProjectSaveOptionsFrame: TProjectSaveOptionsFrame
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 4 Height = 21
Top = 46 Top = 48
Width = 320 Width = 320
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoFill = True AutoFill = True
@ -53,6 +52,7 @@ inherited ProjectSaveOptionsFrame: TProjectSaveOptionsFrame
ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1 ChildSizing.ControlsPerLine = 1
OnClick = SaveSessionLocationRadioGroupClick
TabOrder = 2 TabOrder = 2
end end
end end

View File

@ -7,7 +7,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, Project, IDEOptionsIntf, ProjectIntf, LCLProc, StdCtrls, ExtCtrls, Project, IDEOptionsIntf, ProjectIntf, LCLProc,
LazarusIDEStrConsts, IDEProcs; LazarusIDEStrConsts, IDEProcs, BuildModesEditor;
type type
@ -17,14 +17,17 @@ type
SaveClosedUnitInfoCheckBox: TCheckBox; SaveClosedUnitInfoCheckBox: TCheckBox;
SaveOnlyProjectUnitInfoCheckBox: TCheckBox; SaveOnlyProjectUnitInfoCheckBox: TCheckBox;
SaveSessionLocationRadioGroup: TRadioGroup; SaveSessionLocationRadioGroup: TRadioGroup;
procedure SaveSessionLocationRadioGroupClick(Sender: TObject);
private private
{ private declarations } fProject: TProject;
function GetSessionLocation: TProjectSessionStorage;
public public
function GetTitle: string; override; function GetTitle: string; override;
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
procedure ReadSettings(AOptions: TAbstractIDEOptions); override; procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
procedure WriteSettings(AOptions: TAbstractIDEOptions); override; procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override; class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
property aProject: TProject read fProject;
end; end;
implementation implementation
@ -52,6 +55,26 @@ end;
{ TProjectSaveOptionsFrame } { TProjectSaveOptionsFrame }
procedure TProjectSaveOptionsFrame.SaveSessionLocationRadioGroupClick(
Sender: TObject);
var
BuildModesEditor: TBuildModesEditorFrame;
begin
BuildModesEditor:=TBuildModesEditorFrame(FindOptionControl(TBuildModesEditorFrame));
if BuildModesEditor<>nil then
begin
BuildModesEditor.LoadShowSessionFromProjects:=false;
BuildModesEditor.ShowSession:=GetSessionLocation in [pssInIDEConfig,pssInProjectDir];
end;
end;
function TProjectSaveOptionsFrame.GetSessionLocation: TProjectSessionStorage;
begin
Result := LocalizedNameToProjectSessionStorage(
SaveSessionLocationRadioGroup.Items[
SaveSessionLocationRadioGroup.ItemIndex]);
end;
function TProjectSaveOptionsFrame.GetTitle: string; function TProjectSaveOptionsFrame.GetTitle: string;
begin begin
Result := dlgPOSaveSession; Result := dlgPOSaveSession;
@ -70,6 +93,8 @@ end;
procedure TProjectSaveOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); procedure TProjectSaveOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
begin begin
if not (AOptions is TProject) then exit;
fProject:=TProject(AOptions);
with AOptions as TProject do with AOptions as TProject do
begin begin
SaveClosedUnitInfoCheckBox.Checked := (pfSaveClosedUnits in Flags); SaveClosedUnitInfoCheckBox.Checked := (pfSaveClosedUnits in Flags);
@ -82,6 +107,7 @@ procedure TProjectSaveOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
var var
AFlags: TProjectFlags; AFlags: TProjectFlags;
begin begin
if not (AOptions is TProject) then exit;
with AOptions as TProject do with AOptions as TProject do
begin begin
AFlags := Flags; AFlags := Flags;
@ -94,9 +120,7 @@ begin
else else
exclude(AFlags, pfSaveOnlyProjectUnits); exclude(AFlags, pfSaveOnlyProjectUnits);
if SaveSessionLocationRadioGroup.ItemIndex >= 0 then if SaveSessionLocationRadioGroup.ItemIndex >= 0 then
SessionStorage := LocalizedNameToProjectSessionStorage( SessionStorage := Self.GetSessionLocation;
SaveSessionLocationRadioGroup.Items[
SaveSessionLocationRadioGroup.ItemIndex]);
Flags := AFlags; Flags := AFlags;
end; end;
end; end;

View File

@ -4898,6 +4898,18 @@ resourcestring
lisActive = 'Active'; lisActive = 'Active';
lisBuildModes = 'Build modes'; lisBuildModes = 'Build modes';
lisInSession = 'In session'; lisInSession = '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.';
lisTheFirstBuildModeIsTheDefaultModeAndMustBeStoredIn2 = 'The first build '
+'mode is the default mode and must be stored in the project, not in the '
+'session.';
lisAddNewBuildModeCopyingSettingsFrom = 'Add new build mode, copying '
+'settings from "%s"';
lisDeleteMode = 'Delete mode "%s"';
lisMoveOnePositionUp = 'Move "%s" one position up';
lisMoveOnePositionDown = 'Move "%s" one position down';
implementation implementation

View File

@ -113,6 +113,7 @@ type
procedure RestoreSettings(AOptions: TAbstractIDEOptions); virtual; procedure RestoreSettings(AOptions: TAbstractIDEOptions); virtual;
class function SupportedOptionsClass: TAbstractIDEOptionsClass; virtual; abstract; class function SupportedOptionsClass: TAbstractIDEOptionsClass; virtual; abstract;
class function DefaultCollapseChildNodes: Boolean; virtual; class function DefaultCollapseChildNodes: Boolean; virtual;
function FindOptionControl(AClass: TControlClass): TControl;
property OnLoadIDEOptions: TOnLoadIDEOptions read FOnLoadIDEOptions write FOnLoadIDEOptions; property OnLoadIDEOptions: TOnLoadIDEOptions read FOnLoadIDEOptions write FOnLoadIDEOptions;
property OnSaveIDEOptions: TOnSaveIDEOptions read FOnSaveIDEOptions write FOnSaveIDEOptions; property OnSaveIDEOptions: TOnSaveIDEOptions read FOnSaveIDEOptions write FOnSaveIDEOptions;
@ -380,6 +381,30 @@ begin
Result := False; Result := False;
end; end;
function TAbstractIDEOptionsEditor.FindOptionControl(AClass: TControlClass
): TControl;
function Search(AControl: TControl): TControl;
var
i: Integer;
AWinControl: TWinControl;
begin
if AControl is AClass then
exit(AControl);
if AControl is TWinControl then begin
AWinControl:=TWinControl(AControl);
for i:=0 to AWinControl.ControlCount-1 do begin
Result:=Search(AWinControl.Controls[i]);
if Result<>nil then exit;
end;
end;
Result:=nil;
end;
begin
Result:=Search(GetParentForm(Self));
end;
{ TIDEOptionsEditorList } { TIDEOptionsEditorList }
function TIDEOptionsEditorList.GetItem(AIndex: Integer): PIDEOptionsEditorRec; function TIDEOptionsEditorList.GetItem(AIndex: Integer): PIDEOptionsEditorRec;