IDE: reorganize BuildMode and IDE option values project settings GUI

git-svn-id: trunk@38481 -
This commit is contained in:
juha 2012-09-02 12:21:39 +00:00
parent 38f6ef6f3d
commit 4bac432c75
6 changed files with 31 additions and 264 deletions

View File

@ -1298,7 +1298,7 @@ begin
// no parent and not a form
AControl.SetBounds(0,0,CompWidth,CompHeight);
AControl.DesignInfo := LeftTopToDesignInfo(CompLeft, CompTop);
//DebugLn(['TCustomFormEditor.CreateComponent ',dbgsName(AControl),' ',LazLongRec(AControl.DesignInfo).Lo,',',LongRec(AControl.DesignInfo).Hi]);
//DebugLn(['TCustomFormEditor.CreateComponent ',dbgsName(AControl),' ',LazLongRec(AControl.DesignInfo).Lo,',',LazLongRec(AControl.DesignInfo).Hi]);
end;
end
else

View File

@ -7,58 +7,25 @@ object BuildModesEditorFrame: TBuildModesEditorFrame
ClientWidth = 550
TabOrder = 0
DesignLeft = 460
DesignTop = 269
object BuildMacroValuesGroupBox: TGroupBox
Left = 6
Height = 234
Top = 181
Width = 538
Align = alClient
BorderSpacing.Around = 6
Caption = 'BuildMacroValuesGroupBox'
ClientHeight = 218
ClientWidth = 534
TabOrder = 2
object BuildMacroValuesStringGrid: TStringGrid
Left = 0
Height = 218
Top = 0
Width = 534
Align = alClient
AutoFillColumns = True
ColCount = 2
DefaultColWidth = 120
FixedCols = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goAlwaysShowEditor, goSmoothScroll]
RowCount = 2
TabOrder = 0
OnEditingDone = BuildMacroValuesStringGridEditingDone
OnSelectEditor = BuildMacroValuesStringGridSelectEditor
OnSelection = BuildMacroValuesStringGridSelection
ColWidths = (
265
265
)
end
end
DesignTop = 117
object BuildModesGroupBox: TGroupBox
Left = 6
Height = 158
Height = 250
Top = 6
Width = 538
Align = alTop
BorderSpacing.Around = 6
Caption = 'BuildModesGroupBox'
ClientHeight = 142
ClientWidth = 534
ClientHeight = 230
ClientWidth = 532
TabOrder = 0
object BuildModesStringGrid: TStringGrid
AnchorSideTop.Control = BuildModeAddSpeedButton
AnchorSideTop.Side = asrBottom
Left = 0
Height = 120
Height = 208
Top = 22
Width = 534
Width = 532
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFillColumns = True
@ -68,19 +35,19 @@ object BuildModesEditorFrame: TBuildModesEditorFrame
ButtonStyle = cbsCheckboxColumn
MaxSize = 50
Title.Caption = 'Active'
Width = 176
Width = 175
end
item
ButtonStyle = cbsCheckboxColumn
MaxSize = 50
Title.Caption = 'InSession'
Width = 176
Width = 175
end
item
MaxSize = 500
SizePriority = 100
Title.Caption = 'Title'
Width = 178
Width = 176
end>
FixedCols = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll]
@ -90,9 +57,9 @@ object BuildModesEditorFrame: TBuildModesEditorFrame
OnSelectCell = BuildModesStringGridSelectCell
OnValidateEntry = BuildModesStringGridValidateEntry
ColWidths = (
175
175
176
176
178
)
end
object BuildModeAddSpeedButton: TSpeedButton
@ -102,7 +69,6 @@ object BuildModesEditorFrame: TBuildModesEditorFrame
Height = 22
Top = 0
Width = 23
NumGlyphs = 0
OnClick = BuildModeAddSpeedButtonClick
ShowHint = True
ParentShowHint = False
@ -115,7 +81,6 @@ object BuildModesEditorFrame: TBuildModesEditorFrame
Height = 22
Top = 0
Width = 23
NumGlyphs = 0
OnClick = BuildModeDeleteSpeedButtonClick
ShowHint = True
ParentShowHint = False
@ -128,7 +93,6 @@ object BuildModesEditorFrame: TBuildModesEditorFrame
Height = 22
Top = 0
Width = 23
NumGlyphs = 0
OnClick = BuildModeMoveUpSpeedButtonClick
ShowHint = True
ParentShowHint = False
@ -141,7 +105,6 @@ object BuildModesEditorFrame: TBuildModesEditorFrame
Height = 22
Top = 0
Width = 23
NumGlyphs = 0
OnClick = BuildModeMoveDownSpeedButtonClick
ShowHint = True
ParentShowHint = False
@ -155,21 +118,11 @@ object BuildModesEditorFrame: TBuildModesEditorFrame
Top = 0
Width = 23
BorderSpacing.Left = 10
NumGlyphs = 0
OnClick = BuildModeDiffSpeedButtonClick
ShowHint = True
ParentShowHint = False
end
end
object Splitter1: TSplitter
Cursor = crVSplit
Left = 0
Height = 5
Top = 170
Width = 550
Align = alTop
ResizeAnchor = akTop
end
object BuildModesPopupMenu: TPopupMenu
left = 180
top = 60

View File

@ -44,8 +44,6 @@ type
TBuildModesEditorFrame = class(TAbstractIDEOptionsEditor)
BuildModeDiffSpeedButton: TSpeedButton;
BuildMacroValuesGroupBox: TGroupBox;
BuildMacroValuesStringGrid: TStringGrid;
BuildModeAddSpeedButton: TSpeedButton;
BuildModeDeleteSpeedButton: TSpeedButton;
BuildModeMoveDownSpeedButton: TSpeedButton;
@ -53,13 +51,7 @@ type
BuildModesGroupBox: TGroupBox;
BuildModesPopupMenu: TPopupMenu;
BuildModesStringGrid: TStringGrid;
Splitter1: TSplitter;
procedure BuildModeDiffSpeedButtonClick(Sender: TObject);
procedure BuildMacroValuesStringGridEditingDone(Sender: TObject);
procedure BuildMacroValuesStringGridSelectEditor(Sender: TObject; aCol,
aRow: Integer; var Editor: TWinControl);
procedure BuildMacroValuesStringGridSelection(Sender: TObject; aCol,
aRow: Integer);
procedure BuildModeAddSpeedButtonClick(Sender: TObject);
procedure BuildModeDeleteSpeedButtonClick(Sender: TObject);
procedure BuildModeMoveDownSpeedButtonClick(Sender: TObject);
@ -73,17 +65,13 @@ type
aRow: Integer; const OldValue: string; var NewValue: String);
private
FLoadShowSessionFromProject: boolean;
FMacroValues: TProjectBuildMacros;
FProject: TProject;
FShowSession: boolean;
FSwitchingMode: boolean;
fModeActiveCol: integer;
fModeInSessionCol: integer;
fModeNameCol: integer;
procedure UpdateMacrosControls;
function GetAllBuildMacros: TStrings;
procedure CleanMacrosGrid;
procedure SaveMacros(UpdateControls: boolean);
procedure UpdateInheritedOptions;
procedure FillBuildModesGrid;
procedure UpdateBuildModeButtons;
@ -102,7 +90,6 @@ type
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
property AProject: TProject read FProject;
property MacroValues: TProjectBuildMacros read FMacroValues;
property SwitchingMode: boolean read FSwitchingMode; // the active mode is currently switched
property ShowSession: boolean read FShowSession write SetShowSession;
property LoadShowSessionFromProjects: boolean read FLoadShowSessionFromProject
@ -116,73 +103,6 @@ implementation
{ TBuildModesEditorFrame }
procedure TBuildModesEditorFrame.BuildMacroValuesStringGridSelectEditor(
Sender: TObject; aCol, aRow: Integer; var Editor: TWinControl);
var
PickList: TPickListCellEditor;
sl: TStringList;
Macros: TStrings;
Grid: TStringGrid;
MacroName: string;
i: LongInt;
Macro: TLazBuildMacro;
begin
if MacroValues=nil then exit;
Grid:=BuildMacroValuesStringGrid;
//debugln(['TBuildModesEditorFrame.BuildMacroValuesStringGridSelectEditor ',acol,',',aRow,' ',DbgSName(Editor)]);
if aCol=0 then begin
// list all build MacroValues
if not (Editor is TPickListCellEditor) then exit;
PickList:=TPickListCellEditor(Editor);
sl:=TStringList.Create;
Macros:=nil;
try
if aRow=Grid.RowCount-1 then
sl.Add('(none)')
else
sl.Add('(delete)');
Macros:=GetAllBuildMacros;
sl.AddStrings(Macros);
PickList.Items.Assign(sl);
finally
Macros.Free;
sl.Free;
end;
end else if aCol=1 then begin
// list all possible values of current macro
if not (Editor is TPickListCellEditor) then exit;
PickList:=TPickListCellEditor(Editor);
MacroName:=Grid.Cells[0,aRow];
sl:=TStringList.Create;
try
Macros:=GetAllBuildMacros;
i:=Macros.IndexOf(MacroName);
if i>=0 then begin
Macro:=TLazBuildMacro(Macros.Objects[i]);
sl.AddStrings(Macro.Values);
end else begin
sl.Add('');
end;
PickList.Items.Assign(sl);
finally
Macros.Free;
sl.Free;
end;
end;
end;
procedure TBuildModesEditorFrame.BuildMacroValuesStringGridEditingDone(
Sender: TObject);
begin
//debugln(['TBuildModesEditorFrame.BuildMacroValuesStringGridEditingDone ']);
SaveMacros(true);
end;
procedure TBuildModesEditorFrame.BuildModeDiffSpeedButtonClick(Sender: TObject);
begin
FSwitchingMode:=true;
@ -199,12 +119,6 @@ begin
end;
end;
procedure TBuildModesEditorFrame.BuildMacroValuesStringGridSelection(
Sender: TObject; aCol, aRow: Integer);
begin
CleanMacrosGrid;
end;
procedure TBuildModesEditorFrame.BuildModeAddSpeedButtonClick(Sender: TObject);
var
i: Integer;
@ -283,8 +197,7 @@ begin
Grid.Row:=i;
end;
procedure TBuildModesEditorFrame.BuildModeMoveDownSpeedButtonClick(
Sender: TObject);
procedure TBuildModesEditorFrame.BuildModeMoveDownSpeedButtonClick(Sender: TObject);
var
i: Integer;
begin
@ -370,10 +283,8 @@ var
b: Boolean;
i: Integer;
begin
//debugln(['TBuildModesEditorFrame.BuildModesStringGridValidateEntry Row=',aRow,' Col=',aCol,' ',NewValue]);
i:=aRow-1;
if (i<0) or (i>=AProject.BuildModes.Count) then exit;
//debugln(['TBuildModesEditorFrame.SaveModes ',i]);
CurMode:=AProject.BuildModes[i];
if aCol=fModeInSessionCol then
begin
@ -401,23 +312,6 @@ begin
end;
end;
procedure TBuildModesEditorFrame.UpdateMacrosControls;
var
Grid: TStringGrid;
i: Integer;
begin
Grid:=BuildMacroValuesStringGrid;
Grid.RowCount:=MacroValues.Count+2; // + titles + add button
for i:=0 to MacroValues.Count-1 do begin
Grid.Cells[0,i+1]:=MacroValues.Names[i];
Grid.Cells[1,i+1]:=MacroValues.ValueFromIndex(i);
end;
i:=MacroValues.Count+1;
Grid.Cells[0,i]:='(none)';
Grid.Cells[1,i]:='';
end;
procedure TBuildModesEditorFrame.SetShowSession(const AValue: boolean);
begin
if AValue=FShowSession then exit;
@ -523,67 +417,6 @@ begin
TStringList(Result).Sort;
end;
procedure TBuildModesEditorFrame.CleanMacrosGrid;
var
Grid: TStringGrid;
aRow: Integer;
MacroName: string;
NeedNewRow: Boolean;
begin
Grid:=BuildMacroValuesStringGrid;
// delete rows
for aRow:=Grid.RowCount-2 downto 1 do begin
if aRow=Grid.Row then continue; // row is selected
MacroName:=Grid.Cells[0,aRow];
if (MacroName<>'') and IsValidIdent(MacroName) then continue; // valid macro name
// delete row
Grid.DeleteColRow(false,aRow);
end;
NeedNewRow:=Grid.RowCount<2;
if (not NeedNewRow) then begin
MacroName:=Grid.Cells[0,Grid.RowCount-1];
if (MacroName<>'') and IsValidIdent(MacroName) then
NeedNewRow:=true;
end;
if NeedNewRow then begin
Grid.RowCount:=Grid.RowCount+1;
Grid.Cells[0,Grid.RowCount-1]:='(new)';
Grid.Cells[1,Grid.RowCount-1]:='';
end;
end;
procedure TBuildModesEditorFrame.SaveMacros(UpdateControls: boolean);
var
Grid: TStringGrid;
aRow: Integer;
MacroName: string;
Values: TStringList;
Value: string;
begin
if MacroValues=nil then exit;
Grid:=BuildMacroValuesStringGrid;
Values:=TStringList.Create;
try
for aRow:=1 to Grid.RowCount-1 do begin
MacroName:=Grid.Cells[0,aRow];
if (MacroName='') or (not IsValidIdent(MacroName)) then continue;
Value:=Grid.Cells[1,aRow];
Values.Values[MacroName]:=Value;
end;
//debugln(['TBuildModesEditorFrame.Save changed=',not MacroValues.Equals(Values),' New="',Values.Text,'"']);
if not MacroValues.Equals(Values) then begin
// has changed
MacroValues.Assign(Values);
IncreaseBuildMacroChangeStamp;
if UpdateControls then begin
UpdateInheritedOptions;
end;
end;
finally
Values.Free;
end;
end;
procedure TBuildModesEditorFrame.UpdateInheritedOptions;
var
InhOptionCtrl: TCompilerInheritedOptionsFrame;
@ -642,16 +475,13 @@ begin
else
CurMode:=nil;
BuildModeAddSpeedButton.Hint:=Format(lisAddNewBuildModeCopyingSettingsFrom, [
Identifier]);
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]
);
BuildModeMoveDownSpeedButton.Enabled:=i<BuildModesStringGrid.RowCount-2;
BuildModeMoveDownSpeedButton.Hint:=Format(lisMoveOnePositionDown, [Identifier]);
BuildModeDiffSpeedButton.Hint:=lisShowDifferencesBetweenModes;
end;
@ -696,8 +526,6 @@ begin
end;
procedure TBuildModesEditorFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
var
Grid: TStringGrid;
begin
BuildModesGroupBox.Caption:=lisBuildModes;
DoShowSession;
@ -707,15 +535,6 @@ begin
BuildModeMoveUpSpeedButton.LoadGlyphFromLazarusResource('arrow_up');
BuildModeMoveDownSpeedButton.LoadGlyphFromLazarusResource('arrow_down');
BuildModeDiffSpeedButton.LoadGlyphFromLazarusResource('menu_tool_diff');
BuildMacroValuesGroupBox.Caption:=lisIDEMacroValuesForFPCMacrosUseCustomOptions;
Grid:=BuildMacroValuesStringGrid;
Grid.Columns.Add;
Grid.Columns[0].Title.Caption:=lisMacroName;
Grid.Columns[0].ButtonStyle:=cbsPickList;
Grid.Columns.Add;
Grid.Columns[1].Title.Caption:=lisMacroValue;
Grid.Columns[1].ButtonStyle:=cbsPickList;
end;
procedure TBuildModesEditorFrame.ReadSettings(AOptions: TAbstractIDEOptions);
@ -726,17 +545,12 @@ begin
if AOptions is TProjectCompilerOptions then begin
PCOptions:=TProjectCompilerOptions(AOptions);
FProject:=PCOptions.LazProject;
FMacroValues:=FProject.ActiveBuildMode.MacroValues;
// modes
UpdateShowSession;
FillBuildModesGrid;
UpdateBuildModeButtons;
// macros
MacroValues.Assign(FProject.MacroValues);
UpdateMacrosControls;
// options dialog
UpdateDialogCaption;
end;
@ -744,9 +558,7 @@ end;
procedure TBuildModesEditorFrame.WriteSettings(AOptions: TAbstractIDEOptions);
begin
if AOptions is TProjectCompilerOptions then begin
SaveMacros(false);
end;
; // Do Nothing. Overrides an abstract method.
end;
class function TBuildModesEditorFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;

View File

@ -5269,6 +5269,7 @@ resourcestring
+'not-found errors. This can take a minute.';
lisActive = 'Active';
dlgBuildModes = 'Build Modes';
dlgIdeMacroValues = 'IDE Macro Values';
lisBuildModes = 'Build modes';
lisInSession = 'In session';
lisThereMustBeAtLeastOneBuildMode = 'There must be at least one build mode.';

View File

@ -132,7 +132,7 @@ uses
compiler_path_options, compiler_parsing_options, compiler_codegen_options,
compiler_linking_options, compiler_verbosity_options, compiler_messages_options,
compiler_other_options, compiler_inherited_options, compiler_compilation_options,
BuildModesEditor, compiler_buildmacro_options,
BuildModesEditor, compiler_buildmacro_options, IdeMacroValues,
// package option frames
package_usage_options, package_description_options, package_integration_options,
package_provides_options, package_i18n_options,

View File

@ -280,9 +280,16 @@ const
ProjectOptionsI18N = 600;
ProjectOptionsMisc = 700;
GroupPackage = 200100;
PackageOptionsUsage = 100;
PackageOptionsDescription = 200;
PackageOptionsIntegration = 300;
PackageOptionsProvides = 400;
PackageOptionsI18N = 500;
GroupCompiler = 100200;
CompilerOptionsSearchPaths = 0100;
CompilerOptionsBuildModes = 0200;
CompilerOptionsBuildModes = 0100;
CompilerOptionsSearchPaths = 0200;
CompilerOptionsParsing = 0300;
CompilerOptionsCodeGeneration = 0400;
CompilerOptionsLinking = 0500;
@ -290,15 +297,9 @@ const
CompilerOptionsMessages = 0700;
CompilerOptionsOther = 0800;
CompilerOptionsConditional = 0900;
CompilerOptionsInherited = 1000;
CompilerOptionsCompilation = 1100;
GroupPackage = 200100;
PackageOptionsUsage = 100;
PackageOptionsDescription = 200;
PackageOptionsIntegration = 300;
PackageOptionsProvides = 400;
PackageOptionsI18N = 500;
CompilerOptionsMacroValues = 1000;
CompilerOptionsInherited = 1100;
CompilerOptionsCompilation = 1200;
GroupPkgCompiler = 200200;