mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 21:59:16 +02:00
IDE, IDEIntf: Ability to register custom option editors for files in packages
git-svn-id: trunk@59911 -
This commit is contained in:
parent
9d545d09b1
commit
344263decc
@ -238,6 +238,8 @@ const
|
|||||||
|
|
||||||
GroupPkgCompiler = 200200;
|
GroupPkgCompiler = 200200;
|
||||||
|
|
||||||
|
GroupPackageFile = 200300;
|
||||||
|
|
||||||
var
|
var
|
||||||
HasGUI: boolean = true; // lazbuild sets this to false
|
HasGUI: boolean = true; // lazbuild sets this to false
|
||||||
|
|
||||||
|
@ -412,6 +412,17 @@ type
|
|||||||
property Package: TIDEPackage read GetPackage;
|
property Package: TIDEPackage read GetPackage;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TAbstractPackageFileIDEOptions }
|
||||||
|
|
||||||
|
TAbstractPackageFileIDEOptions = class(TAbstractIDEOptions)
|
||||||
|
protected
|
||||||
|
function GetPackageFile: TLazPackageFile; virtual; abstract;
|
||||||
|
function GetPackage: TIDEPackage; virtual; abstract;
|
||||||
|
public
|
||||||
|
property PackageFile: TLazPackageFile read GetPackageFile;
|
||||||
|
property Package: TIDEPackage read GetPackage;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
PackageDescriptors: TPackageDescriptors; // will be set by the IDE
|
PackageDescriptors: TPackageDescriptors; // will be set by the IDE
|
||||||
|
@ -4773,6 +4773,7 @@ resourcestring
|
|||||||
+'%sThis means it will be installed in the IDE.'
|
+'%sThis means it will be installed in the IDE.'
|
||||||
+'%sInstallation packages must be designtime Packages.';
|
+'%sInstallation packages must be designtime Packages.';
|
||||||
lisPckOptsPackageOptions = 'Package Options';
|
lisPckOptsPackageOptions = 'Package Options';
|
||||||
|
lisPckOptsPackageFileOptions = 'Additional Package File Options';
|
||||||
|
|
||||||
// package explorer (package graph)
|
// package explorer (package graph)
|
||||||
lisMenuPackageGraph = 'Package Graph';
|
lisMenuPackageGraph = 'Package Graph';
|
||||||
|
@ -788,7 +788,23 @@ type
|
|||||||
procedure UpdateAll(Immediately: boolean = false); virtual; abstract;
|
procedure UpdateAll(Immediately: boolean = false); virtual; abstract;
|
||||||
property LazPackage: TLazPackage read GetLazPackage write SetLazPackage;
|
property LazPackage: TLazPackage read GetLazPackage write SetLazPackage;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TPackageFileIDEOptions }
|
||||||
|
|
||||||
|
TPackageFileIDEOptions = class(TAbstractPackageFileIDEOptions)
|
||||||
|
private
|
||||||
|
FPackageFile: TLazPackageFile;
|
||||||
|
FLazPackage: TLazPackage;
|
||||||
|
protected
|
||||||
|
function GetPackageFile: TLazPackageFile; override;
|
||||||
|
function GetPackage: TLazPackage; override;
|
||||||
|
public
|
||||||
|
constructor Create(APackage: TLazPackage; APackageFile: TLazPackageFile);
|
||||||
|
class function GetInstance: TAbstractIDEOptions; override;
|
||||||
|
class function GetGroupCaption: string; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
LazPkgXMLFileVersion = 4;
|
LazPkgXMLFileVersion = 4;
|
||||||
@ -1401,6 +1417,35 @@ begin
|
|||||||
Result:=nil;
|
Result:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TPackageFileIDEOptions }
|
||||||
|
|
||||||
|
function TPackageFileIDEOptions.GetPackageFile: TLazPackageFile;
|
||||||
|
begin
|
||||||
|
Result := FPackageFile;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TPackageFileIDEOptions.Create(APackage: TLazPackage; APackageFile: TLazPackageFile);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FLazPackage := APackage;
|
||||||
|
FPackageFile := APackageFile;
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TPackageFileIDEOptions.GetGroupCaption: string;
|
||||||
|
begin
|
||||||
|
Result := lisPckOptsPackageFileOptions;
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TPackageFileIDEOptions.GetInstance: TAbstractIDEOptions;
|
||||||
|
begin
|
||||||
|
Result := Nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TPackageFileIDEOptions.GetPackage: TLazPackage;
|
||||||
|
begin
|
||||||
|
Result := FLazPackage;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TPkgFile }
|
{ TPkgFile }
|
||||||
|
|
||||||
procedure TPkgFile.SetFilename(const AValue: string);
|
procedure TPkgFile.SetFilename(const AValue: string);
|
||||||
@ -4679,6 +4724,7 @@ end;
|
|||||||
initialization
|
initialization
|
||||||
RegisterIDEOptionsGroup(GroupPackage, TPackageIDEOptions);
|
RegisterIDEOptionsGroup(GroupPackage, TPackageIDEOptions);
|
||||||
RegisterIDEOptionsGroup(GroupPkgCompiler, TPkgCompilerOptions);
|
RegisterIDEOptionsGroup(GroupPkgCompiler, TPkgCompilerOptions);
|
||||||
|
RegisterIDEOptionsGroup(GroupPackageFile, TPackageFileIDEOptions);
|
||||||
PackageDependencies:=TAVLTree.Create(@ComparePkgDependencyNames);
|
PackageDependencies:=TAVLTree.Create(@ComparePkgDependencyNames);
|
||||||
|
|
||||||
finalization
|
finalization
|
||||||
|
@ -15,7 +15,7 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
OnDropFiles = FormDropFiles
|
OnDropFiles = FormDropFiles
|
||||||
LCLVersion = '1.9.0.0'
|
LCLVersion = '2.1.0.0'
|
||||||
object ToolBar: TToolBar
|
object ToolBar: TToolBar
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 48
|
Height = 48
|
||||||
@ -30,7 +30,7 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
object PropsGroupBox: TGroupBox
|
object PropsGroupBox: TGroupBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 118
|
Height = 118
|
||||||
Top = 316
|
Top = 218
|
||||||
Width = 464
|
Width = 464
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
Caption = 'PropsGroupBox'
|
Caption = 'PropsGroupBox'
|
||||||
@ -39,9 +39,9 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
object CallRegisterProcCheckBox: TCheckBox
|
object CallRegisterProcCheckBox: TCheckBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 21
|
Height = 23
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 187
|
Width = 202
|
||||||
Caption = 'CallRegisterProcCheckBox'
|
Caption = 'CallRegisterProcCheckBox'
|
||||||
OnChange = CallRegisterProcCheckBoxChange
|
OnChange = CallRegisterProcCheckBoxChange
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
@ -51,10 +51,10 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
object AddToUsesPkgSectionCheckBox: TCheckBox
|
object AddToUsesPkgSectionCheckBox: TCheckBox
|
||||||
AnchorSideLeft.Control = CallRegisterProcCheckBox
|
AnchorSideLeft.Control = CallRegisterProcCheckBox
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
Left = 197
|
Left = 212
|
||||||
Height = 21
|
Height = 23
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 222
|
Width = 239
|
||||||
BorderSpacing.Left = 10
|
BorderSpacing.Left = 10
|
||||||
Caption = 'AddToUsesPkgSectionCheckBox'
|
Caption = 'AddToUsesPkgSectionCheckBox'
|
||||||
OnChange = AddToUsesPkgSectionCheckBoxChange
|
OnChange = AddToUsesPkgSectionCheckBoxChange
|
||||||
@ -67,9 +67,9 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
AnchorSideTop.Control = MinVersionEdit
|
AnchorSideTop.Control = MinVersionEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 21
|
Height = 23
|
||||||
Top = 2
|
Top = 7
|
||||||
Width = 179
|
Width = 191
|
||||||
Caption = 'UseMinVersionCheckBox'
|
Caption = 'UseMinVersionCheckBox'
|
||||||
OnChange = UseMinVersionCheckBoxChange
|
OnChange = UseMinVersionCheckBoxChange
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
@ -78,8 +78,8 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
AnchorSideLeft.Control = UseMinVersionCheckBox
|
AnchorSideLeft.Control = UseMinVersionCheckBox
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = PropsGroupBox
|
AnchorSideTop.Control = PropsGroupBox
|
||||||
Left = 189
|
Left = 201
|
||||||
Height = 25
|
Height = 36
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 100
|
Width = 100
|
||||||
BorderSpacing.Left = 10
|
BorderSpacing.Left = 10
|
||||||
@ -92,9 +92,9 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
AnchorSideTop.Control = MaxVersionEdit
|
AnchorSideTop.Control = MaxVersionEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 21
|
Height = 23
|
||||||
Top = 29
|
Top = 45
|
||||||
Width = 183
|
Width = 194
|
||||||
Caption = 'UseMaxVersionCheckBox'
|
Caption = 'UseMaxVersionCheckBox'
|
||||||
OnChange = UseMaxVersionCheckBoxChange
|
OnChange = UseMaxVersionCheckBoxChange
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
@ -104,9 +104,9 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = MinVersionEdit
|
AnchorSideTop.Control = MinVersionEdit
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 193
|
Left = 204
|
||||||
Height = 25
|
Height = 36
|
||||||
Top = 27
|
Top = 38
|
||||||
Width = 100
|
Width = 100
|
||||||
BorderSpacing.Left = 10
|
BorderSpacing.Left = 10
|
||||||
BorderSpacing.Top = 2
|
BorderSpacing.Top = 2
|
||||||
@ -119,9 +119,9 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
AnchorSideTop.Control = MaxVersionEdit
|
AnchorSideTop.Control = MaxVersionEdit
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 25
|
Height = 35
|
||||||
Top = 58
|
Top = 80
|
||||||
Width = 163
|
Width = 178
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
Caption = 'ApplyDependencyButton'
|
Caption = 'ApplyDependencyButton'
|
||||||
@ -129,8 +129,6 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
end
|
end
|
||||||
object RegisteredPluginsGroupBox: TGroupBox
|
object RegisteredPluginsGroupBox: TGroupBox
|
||||||
AnchorSideTop.Control = CallRegisterProcCheckBox
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 71
|
Height = 71
|
||||||
Top = 27
|
Top = 27
|
||||||
@ -160,10 +158,10 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
AnchorSideLeft.Control = AddToUsesPkgSectionCheckBox
|
AnchorSideLeft.Control = AddToUsesPkgSectionCheckBox
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = AddToUsesPkgSectionCheckBox
|
AnchorSideTop.Control = AddToUsesPkgSectionCheckBox
|
||||||
Left = 425
|
Left = 457
|
||||||
Height = 21
|
Height = 23
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 209
|
Width = 225
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
Caption = 'DisableI18NForLFMCheckBox'
|
Caption = 'DisableI18NForLFMCheckBox'
|
||||||
OnChange = DisableI18NForLFMCheckBoxChange
|
OnChange = DisableI18NForLFMCheckBoxChange
|
||||||
@ -183,7 +181,7 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
Cursor = crVSplit
|
Cursor = crVSplit
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 5
|
Height = 5
|
||||||
Top = 311
|
Top = 213
|
||||||
Width = 464
|
Width = 464
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
ResizeAnchor = akBottom
|
ResizeAnchor = akBottom
|
||||||
@ -246,8 +244,8 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 163
|
Left = 163
|
||||||
Height = 25
|
Height = 36
|
||||||
Top = 2
|
Top = -4
|
||||||
Width = 300
|
Width = 300
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
@ -315,7 +313,7 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
end
|
end
|
||||||
object ItemsTreeView: TTreeView
|
object ItemsTreeView: TTreeView
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 234
|
Height = 136
|
||||||
Top = 77
|
Top = 77
|
||||||
Width = 464
|
Width = 464
|
||||||
Align = alClient
|
Align = alClient
|
||||||
@ -334,24 +332,33 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
OnSelectionChanged = ItemsTreeViewSelectionChanged
|
OnSelectionChanged = ItemsTreeViewSelectionChanged
|
||||||
Options = [tvoAllowMultiselect, tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
|
Options = [tvoAllowMultiselect, tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
|
||||||
end
|
end
|
||||||
|
object EditorsGroupsPanel: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 98
|
||||||
|
Top = 336
|
||||||
|
Width = 464
|
||||||
|
Align = alBottom
|
||||||
|
BevelOuter = bvNone
|
||||||
|
TabOrder = 6
|
||||||
|
end
|
||||||
object ItemsPopupMenu: TPopupMenu
|
object ItemsPopupMenu: TPopupMenu
|
||||||
OnPopup = ItemsPopupMenuPopup
|
OnPopup = ItemsPopupMenuPopup
|
||||||
left = 180
|
Left = 180
|
||||||
top = 10
|
Top = 10
|
||||||
end
|
end
|
||||||
object UsePopupMenu: TPopupMenu
|
object UsePopupMenu: TPopupMenu
|
||||||
OnPopup = UsePopupMenuPopup
|
OnPopup = UsePopupMenuPopup
|
||||||
left = 70
|
Left = 70
|
||||||
top = 10
|
Top = 10
|
||||||
end
|
end
|
||||||
object MorePopupMenu: TPopupMenu
|
object MorePopupMenu: TPopupMenu
|
||||||
OnPopup = MorePopupMenuPopup
|
OnPopup = MorePopupMenuPopup
|
||||||
left = 300
|
Left = 300
|
||||||
top = 10
|
Top = 10
|
||||||
end
|
end
|
||||||
object AddPopupMenu: TPopupMenu
|
object AddPopupMenu: TPopupMenu
|
||||||
left = 120
|
Left = 120
|
||||||
top = 10
|
Top = 10
|
||||||
object mnuAddDiskFile: TMenuItem
|
object mnuAddDiskFile: TMenuItem
|
||||||
Caption = 'Add file...'
|
Caption = 'Add file...'
|
||||||
Default = True
|
Default = True
|
||||||
|
@ -43,7 +43,7 @@ uses
|
|||||||
// IDEIntf
|
// IDEIntf
|
||||||
IDEImagesIntf, MenuIntf, LazIDEIntf, ProjectIntf,
|
IDEImagesIntf, MenuIntf, LazIDEIntf, ProjectIntf,
|
||||||
FormEditingIntf, PackageDependencyIntf, PackageIntf, IDEHelpIntf, IDEOptionsIntf,
|
FormEditingIntf, PackageDependencyIntf, PackageIntf, IDEHelpIntf, IDEOptionsIntf,
|
||||||
NewItemIntf, IDEWindowIntf, IDEDialogs, ComponentReg,
|
NewItemIntf, IDEWindowIntf, IDEDialogs, ComponentReg, IDEOptEditorIntf,
|
||||||
// IDE
|
// IDE
|
||||||
MainBase, IDEProcs, LazarusIDEStrConsts, IDEDefs, CompilerOptions,
|
MainBase, IDEProcs, LazarusIDEStrConsts, IDEDefs, CompilerOptions,
|
||||||
EnvironmentOpts, DialogProcs, InputHistory, PackageDefs, AddToPackageDlg,
|
EnvironmentOpts, DialogProcs, InputHistory, PackageDefs, AddToPackageDlg,
|
||||||
@ -182,6 +182,12 @@ type
|
|||||||
);
|
);
|
||||||
TPEFlags = set of TPEFlag;
|
TPEFlags = set of TPEFlag;
|
||||||
|
|
||||||
|
TIDEPackageOptsDlgAction = (
|
||||||
|
iodaRead,
|
||||||
|
iodaWrite,
|
||||||
|
iodaRestore
|
||||||
|
);
|
||||||
|
|
||||||
{ TPackageEditorForm }
|
{ TPackageEditorForm }
|
||||||
|
|
||||||
TPackageEditorForm = class(TBasePackageEditor,IFilesEditorInterface)
|
TPackageEditorForm = class(TBasePackageEditor,IFilesEditorInterface)
|
||||||
@ -233,6 +239,7 @@ type
|
|||||||
UsePopupMenu: TPopupMenu;
|
UsePopupMenu: TPopupMenu;
|
||||||
ItemsPopupMenu: TPopupMenu;
|
ItemsPopupMenu: TPopupMenu;
|
||||||
MorePopupMenu: TPopupMenu;
|
MorePopupMenu: TPopupMenu;
|
||||||
|
EditorsGroupsPanel: TPanel;
|
||||||
procedure AddToProjectClick(Sender: TObject);
|
procedure AddToProjectClick(Sender: TObject);
|
||||||
procedure AddToUsesPkgSectionCheckBoxChange(Sender: TObject);
|
procedure AddToUsesPkgSectionCheckBoxChange(Sender: TObject);
|
||||||
procedure ApplyDependencyButtonClick(Sender: TObject);
|
procedure ApplyDependencyButtonClick(Sender: TObject);
|
||||||
@ -320,6 +327,8 @@ type
|
|||||||
FSingleSelectedNode: TTreeNode;
|
FSingleSelectedNode: TTreeNode;
|
||||||
FSingleSelectedFile: TPkgFile;
|
FSingleSelectedFile: TPkgFile;
|
||||||
FSingleSelectedDep: TPkgDependency;
|
FSingleSelectedDep: TPkgDependency;
|
||||||
|
FHasEditorsGroups: Boolean;
|
||||||
|
FOptionsShownOfFile: TPkgFile;
|
||||||
FFirstNodeData: array[TPENodeType] of TPENodeData;
|
FFirstNodeData: array[TPENodeType] of TPENodeData;
|
||||||
fUpdateLock: integer;
|
fUpdateLock: integer;
|
||||||
fForcedFlags: TPEFlags;
|
fForcedFlags: TPEFlags;
|
||||||
@ -332,6 +341,7 @@ type
|
|||||||
procedure SetShowDirectoryHierarchy(const AValue: boolean);
|
procedure SetShowDirectoryHierarchy(const AValue: boolean);
|
||||||
procedure SetSortAlphabetically(const AValue: boolean);
|
procedure SetSortAlphabetically(const AValue: boolean);
|
||||||
procedure SetupComponents;
|
procedure SetupComponents;
|
||||||
|
procedure CreatePackageFileEditors;
|
||||||
function OnTreeViewGetImageIndex({%H-}Str: String; Data: TObject; var {%H-}AIsEnabled: Boolean): Integer;
|
function OnTreeViewGetImageIndex({%H-}Str: String; Data: TObject; var {%H-}AIsEnabled: Boolean): Integer;
|
||||||
procedure UpdateNodeImage(TVNode: TTreeNode);
|
procedure UpdateNodeImage(TVNode: TTreeNode);
|
||||||
procedure UpdateNodeImage(TVNode: TTreeNode; NodeData: TPENodeData; Item: TObject);
|
procedure UpdateNodeImage(TVNode: TTreeNode; NodeData: TPENodeData; Item: TObject);
|
||||||
@ -352,6 +362,10 @@ type
|
|||||||
procedure ExtendIncPathForNewIncludeFile(const AnIncludeFile: string;
|
procedure ExtendIncPathForNewIncludeFile(const AnIncludeFile: string;
|
||||||
var IgnoreIncPaths: TFilenameToStringTree);
|
var IgnoreIncPaths: TFilenameToStringTree);
|
||||||
function CanBeAddedToProject: boolean;
|
function CanBeAddedToProject: boolean;
|
||||||
|
procedure TraverseSettings(AOptions: TPackageFileIDEOptions; anAction: TIDEPackageOptsDlgAction);
|
||||||
|
procedure FileOptionsToGui;
|
||||||
|
procedure GuiToFileOptions;
|
||||||
|
procedure FileOptionsChange(Sender: TObject);
|
||||||
protected
|
protected
|
||||||
fFlags: TPEFlags;
|
fFlags: TPEFlags;
|
||||||
procedure SetLazPackage(const AValue: TLazPackage); override;
|
procedure SetLazPackage(const AValue: TLazPackage); override;
|
||||||
@ -2007,6 +2021,8 @@ begin
|
|||||||
Name:='DirSummaryLabel';
|
Name:='DirSummaryLabel';
|
||||||
Parent:=PropsGroupBox;
|
Parent:=PropsGroupBox;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
CreatePackageFileEditors;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.SetDependencyDefaultFilename(AsPreferred: boolean);
|
procedure TPackageEditorForm.SetDependencyDefaultFilename(AsPreferred: boolean);
|
||||||
@ -2644,6 +2660,8 @@ var
|
|||||||
begin
|
begin
|
||||||
if not CanUpdate(pefNeedUpdateProperties,Immediately) then exit;
|
if not CanUpdate(pefNeedUpdateProperties,Immediately) then exit;
|
||||||
|
|
||||||
|
GuiToFileOptions;
|
||||||
|
|
||||||
FPlugins.Clear;
|
FPlugins.Clear;
|
||||||
|
|
||||||
// check selection
|
// check selection
|
||||||
@ -2784,6 +2802,13 @@ begin
|
|||||||
else begin
|
else begin
|
||||||
PropsGroupBox.Enabled:=false;
|
PropsGroupBox.Enabled:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if FSingleSelectedFile<>nil then begin
|
||||||
|
EditorsGroupsPanel.Visible := FHasEditorsGroups;
|
||||||
|
FileOptionsToGui;
|
||||||
|
end else begin
|
||||||
|
EditorsGroupsPanel.Visible := False;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
EnableAlign;
|
EnableAlign;
|
||||||
end;
|
end;
|
||||||
@ -3122,6 +3147,7 @@ end;
|
|||||||
|
|
||||||
procedure TPackageEditorForm.DoSave(SaveAs: boolean);
|
procedure TPackageEditorForm.DoSave(SaveAs: boolean);
|
||||||
begin
|
begin
|
||||||
|
GuiToFileOptions;
|
||||||
PackageEditors.SavePackage(LazPackage,SaveAs);
|
PackageEditors.SavePackage(LazPackage,SaveAs);
|
||||||
UpdateTitle;
|
UpdateTitle;
|
||||||
UpdateButtons;
|
UpdateButtons;
|
||||||
@ -3296,6 +3322,132 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPackageEditorForm.TraverseSettings(AOptions: TPackageFileIDEOptions; anAction: TIDEPackageOptsDlgAction);
|
||||||
|
|
||||||
|
procedure Traverse(Control: TWinControl);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if Control <> nil then
|
||||||
|
begin
|
||||||
|
if Control is TAbstractIDEOptionsEditor then
|
||||||
|
with TAbstractIDEOptionsEditor(Control) do
|
||||||
|
begin
|
||||||
|
case anAction of
|
||||||
|
iodaRead: ReadSettings(AOptions);
|
||||||
|
iodaWrite: WriteSettings(AOptions);
|
||||||
|
iodaRestore: RestoreSettings(AOptions);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
for i := 0 to Control.ControlCount -1 do
|
||||||
|
if Control.Controls[i] is TWinControl then
|
||||||
|
begin
|
||||||
|
Traverse(TWinControl(Control.Controls[i]));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Traverse(EditorsGroupsPanel);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPackageEditorForm.CreatePackageFileEditors;
|
||||||
|
|
||||||
|
var
|
||||||
|
Instance: TAbstractIDEOptionsEditor;
|
||||||
|
i, j: integer;
|
||||||
|
Rec: PIDEOptionsGroupRec;
|
||||||
|
ACaption: string;
|
||||||
|
ItemTabSheet: TTabSheet;
|
||||||
|
GroupPageControl: TPageControl;
|
||||||
|
GroupGroupBox: TGroupBox;
|
||||||
|
begin
|
||||||
|
FHasEditorsGroups := False;
|
||||||
|
IDEEditorGroups.Resort;
|
||||||
|
|
||||||
|
for i := 0 to IDEEditorGroups.Count - 1 do
|
||||||
|
begin
|
||||||
|
Rec := IDEEditorGroups[i];
|
||||||
|
DebugLn(['TPackageEditorForm.CreatePackageFileEditors ',Rec^.GroupClass.ClassName]);
|
||||||
|
if (Rec^.GroupClass.InheritsFrom(TAbstractPackageFileIDEOptions)) and (Rec^.Items <> nil) then
|
||||||
|
begin
|
||||||
|
if Rec^.GroupClass<>nil then
|
||||||
|
ACaption := Rec^.GroupClass.GetGroupCaption
|
||||||
|
else
|
||||||
|
ACaption := format('Group<%d>',[i]);
|
||||||
|
GroupGroupBox := TGroupBox.Create(Self);
|
||||||
|
GroupGroupBox.Caption := ACaption;
|
||||||
|
GroupGroupBox.Align := alClient;
|
||||||
|
GroupGroupBox.Parent := EditorsGroupsPanel;
|
||||||
|
GroupPageControl := TPageControl.Create(Self);
|
||||||
|
GroupPageControl.Parent := GroupGroupBox;
|
||||||
|
GroupPageControl.Align := alClient;
|
||||||
|
FHasEditorsGroups := True;
|
||||||
|
|
||||||
|
for j := 0 to Rec^.Items.Count - 1 do
|
||||||
|
begin
|
||||||
|
ItemTabSheet := GroupPageControl.AddTabSheet;
|
||||||
|
ItemTabSheet.Align := alClient;
|
||||||
|
|
||||||
|
Instance := Rec^.Items[j]^.EditorClass.Create(Self);
|
||||||
|
// Instance.OnLoadIDEOptions := @LoadIDEOptions;
|
||||||
|
// Instance.OnSaveIDEOptions := @SaveIDEOptions;
|
||||||
|
// In principle the parameter should be a TAbstractOptionsEditorDialog,
|
||||||
|
// but in this case this is not available, so pass nil.
|
||||||
|
// Better would be to change the structure of the classes to avoid this
|
||||||
|
// problem.
|
||||||
|
Instance.Setup(Nil);
|
||||||
|
Instance.OnChange := @FileOptionsChange;
|
||||||
|
Instance.Tag := Rec^.Items[j]^.Index;
|
||||||
|
Instance.Parent := ItemTabSheet;
|
||||||
|
Instance.Rec := Rec^.Items[j];
|
||||||
|
ItemTabSheet.Caption := Instance.GetTitle;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
EditorsGroupsPanel.Visible := FHasEditorsGroups;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPackageEditorForm.FileOptionsToGui;
|
||||||
|
var
|
||||||
|
PackageOptions: TPackageFileIDEOptions;
|
||||||
|
begin
|
||||||
|
if Assigned(FSingleSelectedFile) then
|
||||||
|
begin
|
||||||
|
FOptionsShownOfFile := FSingleSelectedFile;
|
||||||
|
PackageOptions := TPackageFileIDEOptions.Create(LazPackage, FOptionsShownOfFile);
|
||||||
|
try
|
||||||
|
PackageOptions.DoBeforeRead;
|
||||||
|
TraverseSettings(PackageOptions, iodaRead);
|
||||||
|
PackageOptions.DoAfterRead;
|
||||||
|
finally;
|
||||||
|
PackageOptions.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPackageEditorForm.GuiToFileOptions;
|
||||||
|
var
|
||||||
|
PackageOptions: TPackageFileIDEOptions;
|
||||||
|
begin
|
||||||
|
if Assigned(FOptionsShownOfFile) then
|
||||||
|
begin
|
||||||
|
PackageOptions := TPackageFileIDEOptions.Create(LazPackage, FOptionsShownOfFile);
|
||||||
|
try
|
||||||
|
PackageOptions.DoBeforeWrite(False);
|
||||||
|
TraverseSettings(PackageOptions, iodaWrite);
|
||||||
|
PackageOptions.DoAfterWrite(False);
|
||||||
|
finally;
|
||||||
|
PackageOptions.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TPackageEditorForm.FileOptionsChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
LazPackage.Modified := True;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TPackageEditors }
|
{ TPackageEditors }
|
||||||
|
|
||||||
function TPackageEditors.GetEditors(Index: integer): TPackageEditorForm;
|
function TPackageEditors.GetEditors(Index: integer): TPackageEditorForm;
|
||||||
|
Loading…
Reference in New Issue
Block a user