mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 14:49:29 +02:00
IDE: Move Build Mode Management to its own form
git-svn-id: trunk@39272 -
This commit is contained in:
parent
ef65901375
commit
e4a4d8582a
@ -6,8 +6,8 @@ object BuildModesEditorFrame: TBuildModesEditorFrame
|
||||
ClientHeight = 421
|
||||
ClientWidth = 550
|
||||
TabOrder = 0
|
||||
DesignLeft = 460
|
||||
DesignTop = 117
|
||||
DesignLeft = 337
|
||||
DesignTop = 116
|
||||
object BuildModesGroupBox: TGroupBox
|
||||
Left = 6
|
||||
Height = 250
|
||||
@ -16,16 +16,16 @@ object BuildModesEditorFrame: TBuildModesEditorFrame
|
||||
Align = alTop
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'BuildModesGroupBox'
|
||||
ClientHeight = 230
|
||||
ClientWidth = 532
|
||||
ClientHeight = 233
|
||||
ClientWidth = 534
|
||||
TabOrder = 0
|
||||
object BuildModesStringGrid: TStringGrid
|
||||
AnchorSideTop.Control = BuildModeAddSpeedButton
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 208
|
||||
Height = 211
|
||||
Top = 22
|
||||
Width = 532
|
||||
Width = 534
|
||||
Align = alBottom
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
AutoFillColumns = True
|
||||
@ -35,31 +35,30 @@ object BuildModesEditorFrame: TBuildModesEditorFrame
|
||||
ButtonStyle = cbsCheckboxColumn
|
||||
MaxSize = 50
|
||||
Title.Caption = 'Active'
|
||||
Width = 175
|
||||
Width = 176
|
||||
end
|
||||
item
|
||||
ButtonStyle = cbsCheckboxColumn
|
||||
MaxSize = 50
|
||||
Title.Caption = 'InSession'
|
||||
Width = 175
|
||||
Width = 176
|
||||
end
|
||||
item
|
||||
MaxSize = 500
|
||||
SizePriority = 100
|
||||
Title.Caption = 'Title'
|
||||
Width = 176
|
||||
Width = 178
|
||||
end>
|
||||
FixedCols = 0
|
||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll]
|
||||
TabOrder = 0
|
||||
OnCheckboxToggled = BuildModesStringGridCheckboxToggled
|
||||
OnSelection = BuildModesStringGridSelection
|
||||
OnSelectCell = BuildModesStringGridSelectCell
|
||||
OnValidateEntry = BuildModesStringGridValidateEntry
|
||||
ColWidths = (
|
||||
175
|
||||
175
|
||||
176
|
||||
176
|
||||
178
|
||||
)
|
||||
end
|
||||
object BuildModeAddSpeedButton: TSpeedButton
|
||||
|
@ -58,8 +58,6 @@ type
|
||||
procedure BuildModeMoveUpSpeedButtonClick(Sender: TObject);
|
||||
procedure BuildModesStringGridCheckboxToggled(sender: TObject; aCol,
|
||||
aRow: Integer; aState: TCheckboxState);
|
||||
procedure BuildModesStringGridSelectCell(Sender: TObject; aCol,
|
||||
aRow: Integer; var CanSelect: Boolean);
|
||||
procedure BuildModesStringGridSelection(Sender: TObject; aCol, aRow: Integer);
|
||||
procedure BuildModesStringGridValidateEntry(sender: TObject; aCol,
|
||||
aRow: Integer; const OldValue: string; var NewValue: String);
|
||||
@ -71,7 +69,6 @@ type
|
||||
fModeActiveCol: integer;
|
||||
fModeInSessionCol: integer;
|
||||
fModeNameCol: integer;
|
||||
function GetAllBuildMacros: TStrings;
|
||||
procedure UpdateInheritedOptions;
|
||||
procedure FillBuildModesGrid;
|
||||
procedure UpdateBuildModeButtons;
|
||||
@ -261,21 +258,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.BuildModesStringGridSelectCell(
|
||||
Sender: TObject; aCol, aRow: Integer; var CanSelect: Boolean);
|
||||
begin
|
||||
|
||||
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);
|
||||
procedure TBuildModesEditorFrame.BuildModesStringGridValidateEntry(sender: TObject;
|
||||
aCol, aRow: Integer; const OldValue: string; var NewValue: String);
|
||||
var
|
||||
CurMode: TProjectBuildMode;
|
||||
s: string;
|
||||
@ -283,6 +273,7 @@ var
|
||||
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];
|
||||
@ -305,7 +296,8 @@ begin
|
||||
// identifier
|
||||
s:=NewValue;
|
||||
for j:=1 to length(s) do
|
||||
if s[j]<' ' then s[j]:=' ';
|
||||
if s[j]<' ' then
|
||||
s[j]:=' ';
|
||||
CurMode.Identifier:=s;
|
||||
NewValue:=s;
|
||||
UpdateDialogCaption;
|
||||
@ -375,48 +367,6 @@ begin
|
||||
Result:='TBuildModesEditorFrame.GetDialogCaption: no project';
|
||||
end;
|
||||
|
||||
function TBuildModesEditorFrame.GetAllBuildMacros: TStrings;
|
||||
|
||||
procedure Add(aBuildMacro: TLazBuildMacro);
|
||||
begin
|
||||
if GetAllBuildMacros.IndexOf(aBuildMacro.Identifier)>=0 then exit;
|
||||
GetAllBuildMacros.AddObject(aBuildMacro.Identifier,aBuildMacro);
|
||||
end;
|
||||
|
||||
procedure Add(CompOpts: TLazCompilerOptions);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to CompOpts.BuildMacros.Count-1 do
|
||||
Add(CompOpts.BuildMacros[i]);
|
||||
end;
|
||||
|
||||
var
|
||||
PkgList: TFPList;
|
||||
APackage: TLazPackage;
|
||||
i: Integer;
|
||||
begin
|
||||
Result:=TStringList.Create;
|
||||
if AProject=nil then exit;
|
||||
Add(AProject.CompilerOptions);
|
||||
PkgList:=nil;
|
||||
try
|
||||
PackageGraph.GetAllRequiredPackages(AProject.FirstRequiredDependency,PkgList);
|
||||
if PkgList<>nil then begin
|
||||
for i:=0 to PkgList.Count-1 do begin
|
||||
if TObject(PkgList[i]) is TLazPackage then begin
|
||||
APackage:=TLazPackage(PkgList[i]);
|
||||
Add(APackage.CompilerOptions);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
PkgList.Free;
|
||||
end;
|
||||
|
||||
TStringList(Result).Sort;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.UpdateInheritedOptions;
|
||||
var
|
||||
InhOptionCtrl: TCompilerInheritedOptionsFrame;
|
||||
|
@ -42,7 +42,7 @@ object ProjectSaveOptionsFrame: TProjectSaveOptionsFrame
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 4
|
||||
Height = 20
|
||||
Top = 108
|
||||
Width = 320
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
@ -58,6 +58,7 @@ object ProjectSaveOptionsFrame: TProjectSaveOptionsFrame
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
Constraints.MinHeight = 20
|
||||
OnClick = SaveSessionLocationRadioGroupClick
|
||||
TabOrder = 4
|
||||
end
|
||||
|
@ -6,8 +6,11 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, ExtCtrls, Project, IDEOptionsIntf, ProjectIntf, LCLProc,
|
||||
LazarusIDEStrConsts, IDEProcs, BuildModesEditor;
|
||||
StdCtrls, ExtCtrls, Project, IDEOptionsIntf, ProjectIntf, LCLProc, IDEProcs,
|
||||
{$IFnDEF NewBuildModeWindow}
|
||||
BuildModesEditor,
|
||||
{$ENDIF}
|
||||
LazarusIDEStrConsts;
|
||||
|
||||
type
|
||||
|
||||
@ -22,9 +25,9 @@ type
|
||||
procedure SaveSessionLocationRadioGroupClick(Sender: TObject);
|
||||
private
|
||||
fProject: TProject;
|
||||
function GetSessionLocation: TProjectSessionStorage;
|
||||
public
|
||||
function GetTitle: string; override;
|
||||
function GetSessionLocation: TProjectSessionStorage;
|
||||
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
|
||||
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
|
||||
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
|
||||
@ -57,24 +60,26 @@ end;
|
||||
|
||||
{ TProjectSaveOptionsFrame }
|
||||
|
||||
procedure TProjectSaveOptionsFrame.SaveSessionLocationRadioGroupClick(
|
||||
Sender: TObject);
|
||||
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;
|
||||
begin
|
||||
Result := LocalizedNameToProjectSessionStorage(
|
||||
SaveSessionLocationRadioGroup.Items[
|
||||
SaveSessionLocationRadioGroup.ItemIndex]);
|
||||
SaveSessionLocationRadioGroup.Items[SaveSessionLocationRadioGroup.ItemIndex]);
|
||||
end;
|
||||
|
||||
function TProjectSaveOptionsFrame.GetTitle: string;
|
||||
|
@ -18,8 +18,8 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
Left = 6
|
||||
Height = 41
|
||||
Top = 357
|
||||
Height = 38
|
||||
Top = 360
|
||||
Width = 663
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Right = 6
|
||||
@ -39,18 +39,18 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
|
||||
end
|
||||
object CatTVSplitter: TSplitter[1]
|
||||
Left = 255
|
||||
Height = 357
|
||||
Height = 360
|
||||
Top = 0
|
||||
Width = 4
|
||||
end
|
||||
object CategoryPanel: TPanel[2]
|
||||
Left = 0
|
||||
Height = 357
|
||||
Height = 360
|
||||
Top = 0
|
||||
Width = 255
|
||||
Align = alLeft
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 357
|
||||
ClientHeight = 360
|
||||
ClientWidth = 255
|
||||
Constraints.MinWidth = 150
|
||||
TabOrder = 2
|
||||
@ -62,11 +62,12 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = SettingsPanel
|
||||
Left = 6
|
||||
Height = 299
|
||||
Top = 38
|
||||
Height = 304
|
||||
Top = 36
|
||||
Width = 249
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Top = 5
|
||||
DefaultItemHeight = 18
|
||||
ReadOnly = True
|
||||
TabOrder = 0
|
||||
OnChange = CategoryTreeChange
|
||||
@ -79,7 +80,7 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
|
||||
AnchorSideLeft.Control = CategoryPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 25
|
||||
Height = 23
|
||||
Top = 8
|
||||
Width = 200
|
||||
OnFilterItem = FilterEditFilterItem
|
||||
@ -88,6 +89,7 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
|
||||
NumGlyphs = 1
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
Font.Color = clBtnShadow
|
||||
MaxLength = 0
|
||||
ParentFont = False
|
||||
TabOrder = 1
|
||||
@ -96,7 +98,7 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
|
||||
object SettingsPanel: TPanel
|
||||
Left = 0
|
||||
Height = 20
|
||||
Top = 337
|
||||
Top = 340
|
||||
Width = 255
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
@ -119,9 +121,9 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
|
||||
TabOrder = 3
|
||||
object BuildModeLabel: TLabel
|
||||
Left = 12
|
||||
Height = 17
|
||||
Height = 15
|
||||
Top = 10
|
||||
Width = 70
|
||||
Width = 68
|
||||
Caption = 'Build Mode'
|
||||
ParentColor = False
|
||||
end
|
||||
@ -130,9 +132,9 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = BuildModeLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 89
|
||||
Height = 29
|
||||
Top = 4
|
||||
Left = 87
|
||||
Height = 25
|
||||
Top = 5
|
||||
Width = 154
|
||||
BorderSpacing.Left = 7
|
||||
ItemHeight = 0
|
||||
@ -148,9 +150,9 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = BuildModeComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 250
|
||||
Left = 248
|
||||
Height = 25
|
||||
Top = 6
|
||||
Top = 5
|
||||
Width = 27
|
||||
BorderSpacing.Left = 7
|
||||
Caption = '...'
|
||||
@ -159,9 +161,9 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 286
|
||||
Height = 17
|
||||
Height = 15
|
||||
Top = 13
|
||||
Width = 138
|
||||
Width = 137
|
||||
Caption = 'Under construction ...'
|
||||
Color = clFuchsia
|
||||
ParentColor = False
|
||||
@ -175,12 +177,12 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Control = ButtonPanel
|
||||
Left = 259
|
||||
Height = 317
|
||||
Height = 320
|
||||
Top = 40
|
||||
Width = 413
|
||||
HorzScrollBar.Page = 409
|
||||
HorzScrollBar.Tracking = True
|
||||
VertScrollBar.Page = 313
|
||||
VertScrollBar.Page = 316
|
||||
VertScrollBar.Tracking = True
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
TabOrder = 4
|
||||
|
@ -31,10 +31,15 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Controls, Forms, ComCtrls, LCLProc, LCLType,
|
||||
Buttons, ButtonPanel, ExtCtrls,
|
||||
IDEWindowIntf, IDEOptionsIntf, IDECommands, IDEHelpIntf,
|
||||
EnvironmentOpts, LazarusIDEStrConsts,
|
||||
CompOptsIntf, EditorOptions, TreeFilterEdit, EditBtn, StdCtrls;
|
||||
Buttons, ButtonPanel, ExtCtrls, EditBtn, StdCtrls,
|
||||
TreeFilterEdit, IDEWindowIntf, IDEOptionsIntf, IDECommands, IDEHelpIntf,
|
||||
EnvironmentOpts, LazarusIDEStrConsts, CompOptsIntf, EditorOptions,
|
||||
{$IFDEF NewBuildModeWindow}
|
||||
BuildModesManager, project_save_options,
|
||||
{$ELSE}
|
||||
BuildModesEditor,
|
||||
{$ENDIF}
|
||||
ProjectIntf;
|
||||
|
||||
type
|
||||
TIDEOptsDlgAction = (
|
||||
@ -140,6 +145,9 @@ begin
|
||||
ButtonPanel.HelpButton.OnClick := @HelpButtonClick;
|
||||
|
||||
OnKeyPress:=@IDEOptionsDialogKeyPress;
|
||||
{$IFnDEF NewBuildModeWindow}
|
||||
BuildModeManageButton.Visible:=False;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TIDEOptionsDialog.HelpButtonClick(Sender: TObject);
|
||||
@ -199,8 +207,46 @@ begin
|
||||
end;
|
||||
|
||||
procedure TIDEOptionsDialog.BuildModeManageButtonClick(Sender: TObject);
|
||||
{$IFDEF NewBuildModeWindow}
|
||||
var
|
||||
BuildModesForm: TBuildModesForm;
|
||||
ProjectSaveOptions: TProjectSaveOptionsFrame;
|
||||
Rec: PIDEOptionsGroupRec;
|
||||
i: Integer;
|
||||
{$ENDIF}
|
||||
begin
|
||||
;
|
||||
{$IFDEF NewBuildModeWindow}
|
||||
BuildModesForm := TBuildModesForm.Create(nil);
|
||||
try
|
||||
BuildModesForm.OnLoadIDEOptionsHook := @LoadIDEOptions;
|
||||
BuildModesForm.OnSaveIDEOptionsHook := @SaveIDEOptions;
|
||||
{ Does not really work (?)
|
||||
ProjectSaveOptions:=Nil;
|
||||
Rec := IDEEditorGroups.GetByIndex(GroupProject);
|
||||
if Rec <> nil then
|
||||
begin
|
||||
for i := 0 to Rec^.Items.Count-1 do begin
|
||||
if Rec^.Items.Items[i]^.EditorClass = TProjectSaveOptionsFrame then begin
|
||||
ProjectSaveOptions:=TProjectSaveOptionsFrame(Rec^.Items.Items[i]^.EditorClass);
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if ProjectSaveOptions<>nil then
|
||||
begin
|
||||
BuildModesForm.LoadShowSessionFromProject:=false;
|
||||
BuildModesForm.ShowSession:=ProjectSaveOptions.GetSessionLocation in [pssInIDEConfig,pssInProjectDir];
|
||||
end;
|
||||
}
|
||||
BuildModesForm.LoadShowSessionFromProject:=false;
|
||||
BuildModesForm.ShowSession:=True;
|
||||
if BuildModesForm.ShowModal = mrOK then begin
|
||||
;
|
||||
end;
|
||||
finally
|
||||
BuildModesForm.Free;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TIDEOptionsDialog.CategoryTreeCollapsed(Sender: TObject; Node: TTreeNode);
|
||||
@ -473,9 +519,7 @@ begin
|
||||
begin
|
||||
Rec := IDEEditorGroups[i];
|
||||
//DebugLn(['TIDEOptionsDialog.CreateEditors ',Rec^.GroupClass.ClassName]);
|
||||
if not PassesFilter(Rec) then
|
||||
Continue;
|
||||
if Rec^.Items <> nil then
|
||||
if PassesFilter(Rec) and (Rec^.Items <> nil) then
|
||||
begin
|
||||
if Rec^.GroupClass<>nil then
|
||||
ACaption := Rec^.GroupClass.GetGroupCaption
|
||||
|
@ -132,7 +132,10 @@ 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, IdeMacroValues,
|
||||
compiler_buildmacro_options, IdeMacroValues,
|
||||
{.$IFnDEF NewBuildModeWindow} // remove '.' to remove the BuildModesEditor options frame
|
||||
BuildModesEditor,
|
||||
{.$ENDIF}
|
||||
// package option frames
|
||||
package_usage_options, package_description_options, package_integration_options,
|
||||
package_provides_options, package_i18n_options,
|
||||
@ -3514,7 +3517,9 @@ end;
|
||||
|
||||
procedure TMainIDE.mnuChgBuildModeClicked(Sender: TObject);
|
||||
begin
|
||||
{.$IFnDEF NewBuildModeWindow} // remove '.' to remove the BuildModesEditor options frame
|
||||
DoOpenIDEOptions(TBuildModesEditorFrame, '', [TProjectCompilerOptions], []);
|
||||
{.$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuSetBuildModeClick(Sender: TObject);
|
||||
|
Loading…
Reference in New Issue
Block a user