mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 22:36:17 +02:00
Package editor: Create property Gui controls in code. Makes them easier to manage and reusable.
git-svn-id: trunk@63943 -
This commit is contained in:
parent
24f2147eae
commit
487e62d70d
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -11294,6 +11294,7 @@ packager/pkgregisterbase.pas svneol=native#text/pascal
|
|||||||
packager/pkgvirtualuniteditor.pas svneol=native#text/pascal
|
packager/pkgvirtualuniteditor.pas svneol=native#text/pascal
|
||||||
packager/projpackchecks.pas svneol=native#text/pascal
|
packager/projpackchecks.pas svneol=native#text/pascal
|
||||||
packager/projpackcommon.pas svneol=native#text/pascal
|
packager/projpackcommon.pas svneol=native#text/pascal
|
||||||
|
packager/projpackfilepropgui.pas svneol=native#text/pascal
|
||||||
packager/registration/Makefile.compiled svneol=native#text/plain
|
packager/registration/Makefile.compiled svneol=native#text/plain
|
||||||
packager/registration/README.txt svneol=native#text/plain
|
packager/registration/README.txt svneol=native#text/plain
|
||||||
packager/registration/fcl.lpk svneol=native#text/plain
|
packager/registration/fcl.lpk svneol=native#text/plain
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
object PackageEditorForm: TPackageEditorForm
|
object PackageEditorForm: TPackageEditorForm
|
||||||
Left = 299
|
Left = 340
|
||||||
Height = 455
|
Height = 455
|
||||||
Top = 248
|
Top = 245
|
||||||
Width = 464
|
Width = 464
|
||||||
AllowDropFiles = True
|
AllowDropFiles = True
|
||||||
BorderIcons = [biSystemMenu]
|
BorderIcons = [biSystemMenu]
|
||||||
@ -32,19 +32,19 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
object PropsGroupBox: TGroupBox
|
object PropsGroupBox: TGroupBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 216
|
Height = 216
|
||||||
Top = 218
|
Top = 216
|
||||||
Width = 464
|
Width = 464
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
Caption = 'PropsGroupBox'
|
Caption = 'PropsGroupBox'
|
||||||
ClientHeight = 196
|
ClientHeight = 186
|
||||||
ClientWidth = 462
|
ClientWidth = 460
|
||||||
ParentFont = False
|
ParentFont = False
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
object PropsPageControl: TPageControl
|
object PropsPageControl: TPageControl
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 196
|
Height = 186
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 462
|
Width = 460
|
||||||
ActivePage = CommonOptionsTabSheet
|
ActivePage = CommonOptionsTabSheet
|
||||||
Align = alClient
|
Align = alClient
|
||||||
ParentFont = False
|
ParentFont = False
|
||||||
@ -53,158 +53,14 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object CommonOptionsTabSheet: TTabSheet
|
object CommonOptionsTabSheet: TTabSheet
|
||||||
Caption = 'Common'
|
Caption = 'Common'
|
||||||
ClientHeight = 192
|
|
||||||
ClientWidth = 452
|
|
||||||
ParentFont = False
|
ParentFont = False
|
||||||
object CallRegisterProcCheckBox: TCheckBox
|
|
||||||
Left = 0
|
|
||||||
Height = 23
|
|
||||||
Top = 0
|
|
||||||
Width = 202
|
|
||||||
Caption = 'CallRegisterProcCheckBox'
|
|
||||||
OnChange = CallRegisterProcCheckBoxChange
|
|
||||||
ParentFont = False
|
|
||||||
ParentShowHint = False
|
|
||||||
ShowHint = True
|
|
||||||
TabOrder = 0
|
|
||||||
end
|
|
||||||
object AddToUsesPkgSectionCheckBox: TCheckBox
|
|
||||||
AnchorSideLeft.Control = CallRegisterProcCheckBox
|
|
||||||
AnchorSideLeft.Side = asrBottom
|
|
||||||
Left = 212
|
|
||||||
Height = 23
|
|
||||||
Top = 0
|
|
||||||
Width = 239
|
|
||||||
BorderSpacing.Left = 10
|
|
||||||
Caption = 'AddToUsesPkgSectionCheckBox'
|
|
||||||
OnChange = AddToUsesPkgSectionCheckBoxChange
|
|
||||||
ParentFont = False
|
|
||||||
ParentShowHint = False
|
|
||||||
ShowHint = True
|
|
||||||
TabOrder = 1
|
|
||||||
end
|
|
||||||
object UseMinVersionCheckBox: TCheckBox
|
|
||||||
AnchorSideLeft.Control = PropsGroupBox
|
|
||||||
AnchorSideTop.Control = MinVersionEdit
|
|
||||||
AnchorSideTop.Side = asrCenter
|
|
||||||
Left = 0
|
|
||||||
Height = 23
|
|
||||||
Top = 7
|
|
||||||
Width = 191
|
|
||||||
Caption = 'UseMinVersionCheckBox'
|
|
||||||
OnChange = UseMinVersionCheckBoxChange
|
|
||||||
ParentFont = False
|
|
||||||
TabOrder = 2
|
|
||||||
end
|
|
||||||
object MinVersionEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = UseMinVersionCheckBox
|
|
||||||
AnchorSideLeft.Side = asrBottom
|
|
||||||
AnchorSideTop.Control = PropsGroupBox
|
|
||||||
Left = 201
|
|
||||||
Height = 36
|
|
||||||
Top = 0
|
|
||||||
Width = 100
|
|
||||||
BorderSpacing.Left = 10
|
|
||||||
OnChange = MinVersionEditChange
|
|
||||||
ParentFont = False
|
|
||||||
TabOrder = 3
|
|
||||||
Text = 'MinVersionEdit'
|
|
||||||
end
|
|
||||||
object UseMaxVersionCheckBox: TCheckBox
|
|
||||||
AnchorSideLeft.Control = PropsGroupBox
|
|
||||||
AnchorSideTop.Control = MaxVersionEdit
|
|
||||||
AnchorSideTop.Side = asrCenter
|
|
||||||
Left = 0
|
|
||||||
Height = 23
|
|
||||||
Top = 45
|
|
||||||
Width = 194
|
|
||||||
Caption = 'UseMaxVersionCheckBox'
|
|
||||||
OnChange = UseMaxVersionCheckBoxChange
|
|
||||||
ParentFont = False
|
|
||||||
TabOrder = 4
|
|
||||||
end
|
|
||||||
object MaxVersionEdit: TEdit
|
|
||||||
AnchorSideLeft.Control = UseMaxVersionCheckBox
|
|
||||||
AnchorSideLeft.Side = asrBottom
|
|
||||||
AnchorSideTop.Control = MinVersionEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 204
|
|
||||||
Height = 36
|
|
||||||
Top = 38
|
|
||||||
Width = 100
|
|
||||||
BorderSpacing.Left = 10
|
|
||||||
BorderSpacing.Top = 2
|
|
||||||
OnChange = MaxVersionEditChange
|
|
||||||
ParentFont = False
|
|
||||||
TabOrder = 5
|
|
||||||
Text = 'MaxVersionEdit'
|
|
||||||
end
|
|
||||||
object ApplyDependencyButton: TButton
|
|
||||||
AnchorSideLeft.Control = PropsGroupBox
|
|
||||||
AnchorSideTop.Control = MaxVersionEdit
|
|
||||||
AnchorSideTop.Side = asrBottom
|
|
||||||
Left = 0
|
|
||||||
Height = 35
|
|
||||||
Top = 80
|
|
||||||
Width = 178
|
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Top = 6
|
|
||||||
Caption = 'ApplyDependencyButton'
|
|
||||||
OnClick = ApplyDependencyButtonClick
|
|
||||||
ParentFont = False
|
|
||||||
TabOrder = 6
|
|
||||||
end
|
|
||||||
object RegisteredPluginsGroupBox: TGroupBox
|
|
||||||
Left = 0
|
|
||||||
Height = 165
|
|
||||||
Top = 27
|
|
||||||
Width = 452
|
|
||||||
Align = alBottom
|
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
|
||||||
BorderSpacing.Top = 6
|
|
||||||
Caption = 'RegisteredPluginsGroupBox'
|
|
||||||
ClientHeight = 145
|
|
||||||
ClientWidth = 450
|
|
||||||
ParentFont = False
|
|
||||||
TabOrder = 7
|
|
||||||
object RegisteredListBox: TListBox
|
|
||||||
Left = 0
|
|
||||||
Height = 145
|
|
||||||
Top = 0
|
|
||||||
Width = 450
|
|
||||||
Align = alClient
|
|
||||||
ItemHeight = 0
|
|
||||||
OnDrawItem = RegisteredListBoxDrawItem
|
|
||||||
ParentFont = False
|
|
||||||
ScrollWidth = 448
|
|
||||||
Style = lbOwnerDrawFixed
|
|
||||||
TabOrder = 0
|
|
||||||
TopIndex = -1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
object DisableI18NForLFMCheckBox: TCheckBox
|
|
||||||
AnchorSideLeft.Control = AddToUsesPkgSectionCheckBox
|
|
||||||
AnchorSideLeft.Side = asrBottom
|
|
||||||
AnchorSideTop.Control = AddToUsesPkgSectionCheckBox
|
|
||||||
Left = 457
|
|
||||||
Height = 23
|
|
||||||
Top = 0
|
|
||||||
Width = 225
|
|
||||||
BorderSpacing.Left = 6
|
|
||||||
Caption = 'DisableI18NForLFMCheckBox'
|
|
||||||
OnChange = DisableI18NForLFMCheckBoxChange
|
|
||||||
ParentFont = False
|
|
||||||
ParentShowHint = False
|
|
||||||
ShowHint = True
|
|
||||||
TabOrder = 8
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object StatusBar: TStatusBar
|
object StatusBar: TStatusBar
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 21
|
Height = 23
|
||||||
Top = 434
|
Top = 432
|
||||||
Width = 464
|
Width = 464
|
||||||
Panels = <>
|
Panels = <>
|
||||||
ParentFont = False
|
ParentFont = False
|
||||||
@ -213,7 +69,7 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
Cursor = crVSplit
|
Cursor = crVSplit
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 5
|
Height = 5
|
||||||
Top = 213
|
Top = 211
|
||||||
Width = 464
|
Width = 464
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
ResizeAnchor = akBottom
|
ResizeAnchor = akBottom
|
||||||
@ -279,8 +135,8 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 163
|
Left = 163
|
||||||
Height = 36
|
Height = 32
|
||||||
Top = -4
|
Top = -2
|
||||||
Width = 300
|
Width = 300
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
@ -351,7 +207,7 @@ object PackageEditorForm: TPackageEditorForm
|
|||||||
end
|
end
|
||||||
object ItemsTreeView: TTreeView
|
object ItemsTreeView: TTreeView
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 136
|
Height = 134
|
||||||
Top = 77
|
Top = 77
|
||||||
Width = 464
|
Width = 464
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
@ -48,7 +48,7 @@ uses
|
|||||||
MainBase, IDEProcs, LazarusIDEStrConsts, IDEDefs, CompilerOptions,
|
MainBase, IDEProcs, LazarusIDEStrConsts, IDEDefs, CompilerOptions,
|
||||||
EnvironmentOpts, DialogProcs, InputHistory, PackageDefs, AddToPackageDlg,
|
EnvironmentOpts, DialogProcs, InputHistory, PackageDefs, AddToPackageDlg,
|
||||||
AddPkgDependencyDlg, AddFPMakeDependencyDlg, ProjPackChecks, PkgVirtualUnitEditor,
|
AddPkgDependencyDlg, AddFPMakeDependencyDlg, ProjPackChecks, PkgVirtualUnitEditor,
|
||||||
MissingPkgFilesDlg, PackageSystem, CleanPkgDeps;
|
MissingPkgFilesDlg, PackageSystem, CleanPkgDeps, ProjPackFilePropGui;
|
||||||
|
|
||||||
const
|
const
|
||||||
PackageEditorMenuRootName = 'PackageEditor';
|
PackageEditorMenuRootName = 'PackageEditor';
|
||||||
@ -202,7 +202,6 @@ type
|
|||||||
MoveUpBtn: TSpeedButton;
|
MoveUpBtn: TSpeedButton;
|
||||||
DirectoryHierarchyButton: TSpeedButton;
|
DirectoryHierarchyButton: TSpeedButton;
|
||||||
OpenButton: TSpeedButton;
|
OpenButton: TSpeedButton;
|
||||||
DisableI18NForLFMCheckBox: TCheckBox;
|
|
||||||
FilterEdit: TTreeFilterEdit;
|
FilterEdit: TTreeFilterEdit;
|
||||||
FilterPanel: TPanel;
|
FilterPanel: TPanel;
|
||||||
AddPopupMenu: TPopupMenu;
|
AddPopupMenu: TPopupMenu;
|
||||||
@ -223,29 +222,15 @@ type
|
|||||||
ItemsTreeView: TTreeView;
|
ItemsTreeView: TTreeView;
|
||||||
// properties
|
// properties
|
||||||
PropsGroupBox: TGroupBox;
|
PropsGroupBox: TGroupBox;
|
||||||
// file properties
|
PropsPageControl: TPageControl;
|
||||||
CallRegisterProcCheckBox: TCheckBox;
|
CommonOptionsTabSheet: TTabSheet;
|
||||||
AddToUsesPkgSectionCheckBox: TCheckBox;
|
|
||||||
RegisteredPluginsGroupBox: TGroupBox;
|
|
||||||
RegisteredListBox: TListBox;
|
|
||||||
// dependency properties
|
|
||||||
UseMinVersionCheckBox: TCheckBox;
|
|
||||||
MinVersionEdit: TEdit;
|
|
||||||
UseMaxVersionCheckBox: TCheckBox;
|
|
||||||
MaxVersionEdit: TEdit;
|
|
||||||
ApplyDependencyButton: TButton;
|
|
||||||
// statusbar
|
// statusbar
|
||||||
StatusBar: TStatusBar;
|
StatusBar: TStatusBar;
|
||||||
// hidden components
|
// hidden components
|
||||||
UsePopupMenu: TPopupMenu;
|
UsePopupMenu: TPopupMenu;
|
||||||
ItemsPopupMenu: TPopupMenu;
|
ItemsPopupMenu: TPopupMenu;
|
||||||
MorePopupMenu: TPopupMenu;
|
MorePopupMenu: TPopupMenu;
|
||||||
PropsPageControl: TPageControl;
|
|
||||||
CommonOptionsTabSheet: TTabSheet;
|
|
||||||
procedure AddToProjectClick(Sender: TObject);
|
procedure AddToProjectClick(Sender: TObject);
|
||||||
procedure AddToUsesPkgSectionCheckBoxChange(Sender: TObject);
|
|
||||||
procedure ApplyDependencyButtonClick(Sender: TObject);
|
|
||||||
procedure CallRegisterProcCheckBoxChange(Sender: TObject);
|
|
||||||
procedure ChangeFileTypeMenuItemClick(Sender: TObject);
|
procedure ChangeFileTypeMenuItemClick(Sender: TObject);
|
||||||
procedure CleanDependenciesMenuItemClick(Sender: TObject);
|
procedure CleanDependenciesMenuItemClick(Sender: TObject);
|
||||||
procedure ClearDependencyFilenameMenuItemClick(Sender: TObject);
|
procedure ClearDependencyFilenameMenuItemClick(Sender: TObject);
|
||||||
@ -257,7 +242,6 @@ type
|
|||||||
procedure CreateMakefileClick(Sender: TObject);
|
procedure CreateMakefileClick(Sender: TObject);
|
||||||
procedure CreateFpmakeFileClick(Sender: TObject);
|
procedure CreateFpmakeFileClick(Sender: TObject);
|
||||||
procedure DirectoryHierarchyButtonClick(Sender: TObject);
|
procedure DirectoryHierarchyButtonClick(Sender: TObject);
|
||||||
procedure DisableI18NForLFMCheckBoxChange(Sender: TObject);
|
|
||||||
procedure EditVirtualUnitMenuItemClick(Sender: TObject);
|
procedure EditVirtualUnitMenuItemClick(Sender: TObject);
|
||||||
procedure ExpandDirectoryMenuItemClick(Sender: TObject);
|
procedure ExpandDirectoryMenuItemClick(Sender: TObject);
|
||||||
procedure FilterEditKeyDown(Sender: TObject; var Key: Word; {%H-}Shift: TShiftState);
|
procedure FilterEditKeyDown(Sender: TObject; var Key: Word; {%H-}Shift: TShiftState);
|
||||||
@ -284,8 +268,6 @@ type
|
|||||||
procedure FixFilesCaseMenuItemClick(Sender: TObject);
|
procedure FixFilesCaseMenuItemClick(Sender: TObject);
|
||||||
procedure HelpBitBtnClick(Sender: TObject);
|
procedure HelpBitBtnClick(Sender: TObject);
|
||||||
procedure InstallClick(Sender: TObject);
|
procedure InstallClick(Sender: TObject);
|
||||||
procedure MaxVersionEditChange(Sender: TObject);
|
|
||||||
procedure MinVersionEditChange(Sender: TObject);
|
|
||||||
procedure MoveDownBtnClick(Sender: TObject);
|
procedure MoveDownBtnClick(Sender: TObject);
|
||||||
procedure MoveUpBtnClick(Sender: TObject);
|
procedure MoveUpBtnClick(Sender: TObject);
|
||||||
procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean);
|
procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean);
|
||||||
@ -296,8 +278,6 @@ type
|
|||||||
procedure PackageEditorFormCloseQuery(Sender: TObject; var CanClose: boolean);
|
procedure PackageEditorFormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
procedure PublishClick(Sender: TObject);
|
procedure PublishClick(Sender: TObject);
|
||||||
procedure ReAddMenuItemClick(Sender: TObject);
|
procedure ReAddMenuItemClick(Sender: TObject);
|
||||||
procedure RegisteredListBoxDrawItem({%H-}Control: TWinControl; Index: Integer;
|
|
||||||
ARect: TRect; {%H-}State: TOwnerDrawState);
|
|
||||||
procedure RemoveBitBtnClick(Sender: TObject);
|
procedure RemoveBitBtnClick(Sender: TObject);
|
||||||
procedure RevertClick(Sender: TObject);
|
procedure RevertClick(Sender: TObject);
|
||||||
procedure SaveAsClick(Sender: TObject);
|
procedure SaveAsClick(Sender: TObject);
|
||||||
@ -309,8 +289,6 @@ type
|
|||||||
procedure SortFilesMenuItemClick(Sender: TObject);
|
procedure SortFilesMenuItemClick(Sender: TObject);
|
||||||
procedure UninstallClick(Sender: TObject);
|
procedure UninstallClick(Sender: TObject);
|
||||||
procedure UseAllUnitsInDirectoryMenuItemClick(Sender: TObject);
|
procedure UseAllUnitsInDirectoryMenuItemClick(Sender: TObject);
|
||||||
procedure UseMaxVersionCheckBoxChange(Sender: TObject);
|
|
||||||
procedure UseMinVersionCheckBoxChange(Sender: TObject);
|
|
||||||
procedure UseNoUnitsInDirectoryMenuItemClick(Sender: TObject);
|
procedure UseNoUnitsInDirectoryMenuItemClick(Sender: TObject);
|
||||||
procedure UsePopupMenuPopup(Sender: TObject);
|
procedure UsePopupMenuPopup(Sender: TObject);
|
||||||
procedure ViewPkgSourceClick(Sender: TObject);
|
procedure ViewPkgSourceClick(Sender: TObject);
|
||||||
@ -326,6 +304,7 @@ type
|
|||||||
FRemovedFilesNode: TTreeNode;
|
FRemovedFilesNode: TTreeNode;
|
||||||
FRemovedRequiredNode: TTreeNode;
|
FRemovedRequiredNode: TTreeNode;
|
||||||
FPlugins: TStringList; // ComponentClassName, Objects=TPkgComponent
|
FPlugins: TStringList; // ComponentClassName, Objects=TPkgComponent
|
||||||
|
FPropGui: TProjPackFilePropGui;
|
||||||
FShowDirectoryHierarchy: boolean;
|
FShowDirectoryHierarchy: boolean;
|
||||||
FSortAlphabetically: boolean;
|
FSortAlphabetically: boolean;
|
||||||
FDirSummaryLabel: TLabel;
|
FDirSummaryLabel: TLabel;
|
||||||
@ -336,6 +315,9 @@ type
|
|||||||
procedure DoAddNewFile(NewItem: TNewIDEItemTemplate);
|
procedure DoAddNewFile(NewItem: TNewIDEItemTemplate);
|
||||||
procedure FreeNodeData(Typ: TPENodeType);
|
procedure FreeNodeData(Typ: TPENodeType);
|
||||||
function CreateNodeData(Typ: TPENodeType; aName: string; aRemoved: boolean): TPENodeData;
|
function CreateNodeData(Typ: TPENodeType; aName: string; aRemoved: boolean): TPENodeData;
|
||||||
|
function CreateToolButton(AName, ACaption, AHint, AImageName: String;
|
||||||
|
AOnClick: TNotifyEvent): TToolButton;
|
||||||
|
function CreateDivider: TToolButton;
|
||||||
procedure SetDependencyDefaultFilename(AsPreferred: boolean);
|
procedure SetDependencyDefaultFilename(AsPreferred: boolean);
|
||||||
procedure SetIdleConnected(AValue: boolean);
|
procedure SetIdleConnected(AValue: boolean);
|
||||||
procedure SetShowDirectoryHierarchy(const AValue: boolean);
|
procedure SetShowDirectoryHierarchy(const AValue: boolean);
|
||||||
@ -353,8 +335,8 @@ type
|
|||||||
procedure UpdateRequiredPkgs(Immediately: boolean = false);
|
procedure UpdateRequiredPkgs(Immediately: boolean = false);
|
||||||
procedure UpdatePEProperties(Immediately: boolean = false);
|
procedure UpdatePEProperties(Immediately: boolean = false);
|
||||||
procedure UpdateButtons(Immediately: boolean = false);
|
procedure UpdateButtons(Immediately: boolean = false);
|
||||||
procedure UpdateApplyDependencyButton(Immediately: boolean = false);
|
|
||||||
procedure UpdateStatusBar(Immediately: boolean = false);
|
procedure UpdateStatusBar(Immediately: boolean = false);
|
||||||
|
function GetDependencyToUpdate(Immediately: boolean): TPkgDependencyBase;
|
||||||
procedure GetDirectorySummary(DirNode: TTreeNode;
|
procedure GetDirectorySummary(DirNode: TTreeNode;
|
||||||
out FileCount, HasRegisterProcCount, AddToUsesPkgSectionCount: integer);
|
out FileCount, HasRegisterProcCount, AddToUsesPkgSectionCount: integer);
|
||||||
procedure ExtendUnitIncPathForNewUnit(const AnUnitFilename,
|
procedure ExtendUnitIncPathForNewUnit(const AnUnitFilename,
|
||||||
@ -367,6 +349,12 @@ type
|
|||||||
procedure FileOptionsToGui;
|
procedure FileOptionsToGui;
|
||||||
procedure GuiToFileOptions(Restore: boolean);
|
procedure GuiToFileOptions(Restore: boolean);
|
||||||
procedure FileOptionsChange(Sender: TObject);
|
procedure FileOptionsChange(Sender: TObject);
|
||||||
|
procedure CallRegisterProcCheckBoxChange(Sender: TObject);
|
||||||
|
procedure AddToUsesPkgSectionCheckBoxChange(Sender: TObject);
|
||||||
|
procedure ApplyDependencyButtonClick(Sender: TObject);
|
||||||
|
procedure RegisteredListBoxDrawItem({%H-}Control: TWinControl; Index: Integer;
|
||||||
|
ARect: TRect; {%H-}State: TOwnerDrawState);
|
||||||
|
procedure DisableI18NForLFMCheckBoxChange(Sender: TObject);
|
||||||
protected
|
protected
|
||||||
fFlags: TPEFlags;
|
fFlags: TPEFlags;
|
||||||
procedure SetLazPackage(const AValue: TLazPackage); override;
|
procedure SetLazPackage(const AValue: TLazPackage); override;
|
||||||
@ -1129,16 +1117,6 @@ begin
|
|||||||
PackageEditors.InstallPackage(LazPackage);
|
PackageEditors.InstallPackage(LazPackage);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.MaxVersionEditChange(Sender: TObject);
|
|
||||||
begin
|
|
||||||
UpdateApplyDependencyButton;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TPackageEditorForm.MinVersionEditChange(Sender: TObject);
|
|
||||||
begin
|
|
||||||
UpdateApplyDependencyButton;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TPackageEditorForm.SetDepDefaultFilenameMenuItemClick(Sender: TObject);
|
procedure TPackageEditorForm.SetDepDefaultFilenameMenuItemClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
SetDependencyDefaultFilename(false);
|
SetDependencyDefaultFilename(false);
|
||||||
@ -1269,14 +1247,14 @@ begin
|
|||||||
if CurObject is TPkgComponent then begin
|
if CurObject is TPkgComponent then begin
|
||||||
// draw registered component
|
// draw registered component
|
||||||
CurComponent:=TPkgComponent(CurObject);
|
CurComponent:=TPkgComponent(CurObject);
|
||||||
with RegisteredListBox.Canvas do begin
|
with FPropGui.RegisteredListBox do begin
|
||||||
if Assigned(CurComponent.RealPage) then
|
if Assigned(CurComponent.RealPage) then
|
||||||
CurStr:=Format(lisPckEditPage,[CurComponent.ComponentClass.ClassName,
|
CurStr:=Format(lisPckEditPage,[CurComponent.ComponentClass.ClassName,
|
||||||
CurComponent.RealPage.PageName])
|
CurComponent.RealPage.PageName])
|
||||||
else
|
else
|
||||||
CurStr:=CurComponent.ComponentClass.ClassName;
|
CurStr:=CurComponent.ComponentClass.ClassName;
|
||||||
TxtH:=TextHeight(CurStr);
|
TxtH:=Canvas.TextHeight(CurStr);
|
||||||
FillRect(ARect);
|
Canvas.FillRect(ARect);
|
||||||
IL:=CurComponent.Images;
|
IL:=CurComponent.Images;
|
||||||
II:=CurComponent.ImageIndex;
|
II:=CurComponent.ImageIndex;
|
||||||
//DebugLn('TPackageEditorForm.RegisteredListBoxDrawItem ',DbgSName(CurIcon),' ',CurComponent.ComponentClass.ClassName);
|
//DebugLn('TPackageEditorForm.RegisteredListBoxDrawItem ',DbgSName(CurIcon),' ',CurComponent.ComponentClass.ClassName);
|
||||||
@ -1284,14 +1262,12 @@ begin
|
|||||||
Res := IL.ResolutionForControl[0, Self];
|
Res := IL.ResolutionForControl[0, Self];
|
||||||
IconWidth:=Res.Width;
|
IconWidth:=Res.Width;
|
||||||
IconHeight:=Res.Height;
|
IconHeight:=Res.Height;
|
||||||
Res.Draw(RegisteredListBox.Canvas,
|
Res.Draw(Canvas,
|
||||||
ARect.Left+(25-IconWidth) div 2,
|
ARect.Left+(25-IconWidth) div 2,
|
||||||
ARect.Top+(ARect.Bottom-ARect.Top-IconHeight) div 2,
|
ARect.Top+(ARect.Bottom-ARect.Top-IconHeight) div 2, II);
|
||||||
II);
|
|
||||||
end;
|
end;
|
||||||
TextOut(ARect.Left+25,
|
Canvas.TextOut(ARect.Left+25,
|
||||||
ARect.Top+(ARect.Bottom-ARect.Top-TxtH) div 2,
|
ARect.Top+(ARect.Bottom-ARect.Top-TxtH) div 2, CurStr);
|
||||||
CurStr);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1467,6 +1443,7 @@ begin
|
|||||||
PackageEditors.DoFreeEditor(LazPackage);
|
PackageEditors.DoFreeEditor(LazPackage);
|
||||||
FLazPackage:=nil;
|
FLazPackage:=nil;
|
||||||
FreeAndNil(FPlugins);
|
FreeAndNil(FPlugins);
|
||||||
|
FreeAndNil(FPropGui);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.FormDropFiles(Sender: TObject;
|
procedure TPackageEditorForm.FormDropFiles(Sender: TObject;
|
||||||
@ -1563,18 +1540,6 @@ begin
|
|||||||
FFirstNodeData[Typ]:=Result;
|
FFirstNodeData[Typ]:=Result;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.UseMaxVersionCheckBoxChange(Sender: TObject);
|
|
||||||
begin
|
|
||||||
MaxVersionEdit.Enabled:=UseMaxVersionCheckBox.Checked;
|
|
||||||
UpdateApplyDependencyButton;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TPackageEditorForm.UseMinVersionCheckBoxChange(Sender: TObject);
|
|
||||||
begin
|
|
||||||
MinVersionEdit.Enabled:=UseMinVersionCheckBox.Checked;
|
|
||||||
UpdateApplyDependencyButton;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TPackageEditorForm.UseAllUnitsInDirectoryMenuItemClick(Sender: TObject);
|
procedure TPackageEditorForm.UseAllUnitsInDirectoryMenuItemClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
DoUseUnitsInDirectory(true);
|
DoUseUnitsInDirectory(true);
|
||||||
@ -1642,9 +1607,9 @@ begin
|
|||||||
if not (Item is TPkgFile) then continue;
|
if not (Item is TPkgFile) then continue;
|
||||||
CurFile:=TPkgFile(Item);
|
CurFile:=TPkgFile(Item);
|
||||||
if not (CurFile.FileType in PkgFileUnitTypes) then continue;
|
if not (CurFile.FileType in PkgFileUnitTypes) then continue;
|
||||||
if CurFile.AddToUsesPkgSection=AddToUsesPkgSectionCheckBox.Checked then continue;
|
if CurFile.AddToUsesPkgSection=FPropGui.AddToUsesPkgSectionCheckBox.Checked then continue;
|
||||||
// change flag
|
// change flag
|
||||||
CurFile.AddToUsesPkgSection:=AddToUsesPkgSectionCheckBox.Checked;
|
CurFile.AddToUsesPkgSection:=FPropGui.AddToUsesPkgSectionCheckBox.Checked;
|
||||||
if (not NodeData.Removed) and CurFile.AddToUsesPkgSection then begin
|
if (not NodeData.Removed) and CurFile.AddToUsesPkgSection then begin
|
||||||
// mark all other units with the same name as unused
|
// mark all other units with the same name as unused
|
||||||
for j:=0 to LazPackage.FileCount-1 do begin
|
for j:=0 to LazPackage.FileCount-1 do begin
|
||||||
@ -1666,62 +1631,14 @@ end;
|
|||||||
|
|
||||||
procedure TPackageEditorForm.ApplyDependencyButtonClick(Sender: TObject);
|
procedure TPackageEditorForm.ApplyDependencyButtonClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
Flags: TPkgDependencyFlags;
|
|
||||||
MinVers, MaxVers: TPkgVersion;
|
|
||||||
CurDependency: TPkgDependency;
|
CurDependency: TPkgDependency;
|
||||||
begin
|
begin
|
||||||
CurDependency:=GetSingleSelectedDependency;
|
CurDependency:=GetSingleSelectedDependency;
|
||||||
if (LazPackage=nil) or (CurDependency=nil)
|
if (LazPackage=nil) or (CurDependency=nil)
|
||||||
then exit;
|
or not FPropGui.CheckApplyDependency(CurDependency) then exit;
|
||||||
|
|
||||||
MinVers:=TPkgVersion.Create;
|
|
||||||
MaxVers:=TPkgVersion.Create;
|
|
||||||
try
|
|
||||||
// Assign relevant data to temp variables
|
|
||||||
Flags:=CurDependency.Flags;
|
|
||||||
MinVers.Assign(CurDependency.MinVersion);
|
|
||||||
MaxVers.Assign(CurDependency.MinVersion);
|
|
||||||
|
|
||||||
// read minimum version
|
|
||||||
if UseMinVersionCheckBox.Checked then begin
|
|
||||||
Include(Flags, pdfMinVersion);
|
|
||||||
if not MinVers.ReadString(MinVersionEdit.Text) then begin
|
|
||||||
MessageDlg(lisPckEditInvalidMinimumVersion,
|
|
||||||
Format(lisPckEditTheMinimumVersionIsNotAValidPackageVersion,
|
|
||||||
[MinVersionEdit.Text, LineEnding]),
|
|
||||||
mtError,[mbCancel],0);
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Exclude(Flags, pdfMinVersion);
|
|
||||||
|
|
||||||
// read maximum version
|
|
||||||
if UseMaxVersionCheckBox.Checked then begin
|
|
||||||
Include(Flags, pdfMaxVersion);
|
|
||||||
if not MaxVers.ReadString(MaxVersionEdit.Text) then begin
|
|
||||||
MessageDlg(lisPckEditInvalidMaximumVersion,
|
|
||||||
Format(lisPckEditTheMaximumVersionIsNotAValidPackageVersion,
|
|
||||||
[MaxVersionEdit.Text, LineEnding]),
|
|
||||||
mtError,[mbCancel],0);
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Exclude(Flags, pdfMaxVersion);
|
|
||||||
|
|
||||||
// Assign changes back to the dependency
|
|
||||||
CurDependency.Flags := Flags;
|
|
||||||
CurDependency.MinVersion.Assign(MinVers);
|
|
||||||
CurDependency.MaxVersion.Assign(MaxVers);
|
|
||||||
|
|
||||||
UpdateNodeImage(ItemsTreeView.Selected);
|
UpdateNodeImage(ItemsTreeView.Selected);
|
||||||
//fForcedFlags:=[pefNeedUpdateRequiredPkgs];
|
//fForcedFlags:=[pefNeedUpdateRequiredPkgs];
|
||||||
LazPackage.Modified:=True;
|
LazPackage.Modified:=True;
|
||||||
finally
|
|
||||||
MaxVers.Free;
|
|
||||||
MinVers.Free;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.CallRegisterProcCheckBoxChange(Sender: TObject);
|
procedure TPackageEditorForm.CallRegisterProcCheckBoxChange(Sender: TObject);
|
||||||
@ -1735,12 +1652,13 @@ begin
|
|||||||
if LazPackage=nil then exit;
|
if LazPackage=nil then exit;
|
||||||
for i:=0 to ItemsTreeView.SelectionCount-1 do begin
|
for i:=0 to ItemsTreeView.SelectionCount-1 do begin
|
||||||
TVNode:=ItemsTreeView.Selections[i];
|
TVNode:=ItemsTreeView.Selections[i];
|
||||||
if not GetNodeDataItem(TVNode,NodeData,Item) then continue;
|
if not GetNodeDataItem(TVNode,NodeData,Item) or not (Item is TPkgFile) then
|
||||||
if not (Item is TPkgFile) then continue;
|
continue;
|
||||||
CurFile:=TPkgFile(Item);
|
CurFile:=TPkgFile(Item);
|
||||||
if not (CurFile.FileType in PkgFileUnitTypes) then continue;
|
if not (CurFile.FileType in PkgFileUnitTypes)
|
||||||
if CurFile.HasRegisterProc=CallRegisterProcCheckBox.Checked then continue;
|
or CurFile.HasRegisterProc=FPropGui.CallRegisterProcCheckBox.Checked then
|
||||||
CurFile.HasRegisterProc:=CallRegisterProcCheckBox.Checked;
|
continue;
|
||||||
|
CurFile.HasRegisterProc:=FPropGui.CallRegisterProcCheckBox.Checked;
|
||||||
if not NodeData.Removed then
|
if not NodeData.Removed then
|
||||||
LazPackage.ModifySilently;
|
LazPackage.ModifySilently;
|
||||||
UpdateNodeImage(TVNode, NodeData, Item);
|
UpdateNodeImage(TVNode, NodeData, Item);
|
||||||
@ -1857,13 +1775,13 @@ begin
|
|||||||
try
|
try
|
||||||
for i:=0 to ItemsTreeView.SelectionCount-1 do begin
|
for i:=0 to ItemsTreeView.SelectionCount-1 do begin
|
||||||
TVNode:=ItemsTreeView.Selections[i];
|
TVNode:=ItemsTreeView.Selections[i];
|
||||||
if not GetNodeDataItem(TVNode,NodeData,Item) then continue;
|
if not GetNodeDataItem(TVNode,NodeData,Item) or not (Item is TPkgFile) then
|
||||||
if not (Item is TPkgFile) then continue;
|
|
||||||
CurFile:=TPkgFile(Item);
|
|
||||||
if not (CurFile.FileType in PkgFileUnitTypes) then continue;
|
|
||||||
if CurFile.DisableI18NForLFM=DisableI18NForLFMCheckBox.Checked then
|
|
||||||
continue;
|
continue;
|
||||||
CurFile.DisableI18NForLFM:=DisableI18NForLFMCheckBox.Checked;
|
CurFile:=TPkgFile(Item);
|
||||||
|
if not (CurFile.FileType in PkgFileUnitTypes)
|
||||||
|
or CurFile.DisableI18NForLFM=FPropGui.DisableI18NForLFMCheckBox.Checked then
|
||||||
|
continue;
|
||||||
|
CurFile.DisableI18NForLFM:=FPropGui.DisableI18NForLFMCheckBox.Checked;
|
||||||
if not NodeData.Removed then
|
if not NodeData.Removed then
|
||||||
LazPackage.Modified:=true;
|
LazPackage.Modified:=true;
|
||||||
end;
|
end;
|
||||||
@ -1897,9 +1815,8 @@ begin
|
|||||||
UpdateAll(true);
|
UpdateAll(true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.SetupComponents;
|
function TPackageEditorForm.CreateToolButton(AName, ACaption, AHint, AImageName: String;
|
||||||
|
AOnClick: TNotifyEvent): TToolButton;
|
||||||
function CreateToolButton(AName, ACaption, AHint, AImageName: String; AOnClick: TNotifyEvent): TToolButton;
|
|
||||||
begin
|
begin
|
||||||
Result := TToolButton.Create(Self);
|
Result := TToolButton.Create(Self);
|
||||||
Result.Name := AName;
|
Result.Name := AName;
|
||||||
@ -1913,7 +1830,7 @@ procedure TPackageEditorForm.SetupComponents;
|
|||||||
Result.Parent := ToolBar;
|
Result.Parent := ToolBar;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CreateDivider: TToolButton;
|
function TPackageEditorForm.CreateDivider: TToolButton;
|
||||||
begin
|
begin
|
||||||
Result := TToolButton.Create(Self);
|
Result := TToolButton.Create(Self);
|
||||||
Result.Style := tbsDivider;
|
Result.Style := tbsDivider;
|
||||||
@ -1921,6 +1838,7 @@ procedure TPackageEditorForm.SetupComponents;
|
|||||||
Result.Parent := ToolBar;
|
Result.Parent := ToolBar;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TPackageEditorForm.SetupComponents;
|
||||||
begin
|
begin
|
||||||
ImageIndexFiles := IDEImages.LoadImage('pkg_files');
|
ImageIndexFiles := IDEImages.LoadImage('pkg_files');
|
||||||
ImageIndexRemovedFiles := IDEImages.LoadImage('pkg_removedfiles');
|
ImageIndexRemovedFiles := IDEImages.LoadImage('pkg_removedfiles');
|
||||||
@ -1991,28 +1909,19 @@ begin
|
|||||||
PropsGroupBox.Caption:=lisPckEditFileProperties;
|
PropsGroupBox.Caption:=lisPckEditFileProperties;
|
||||||
CommonOptionsTabSheet.Caption:=lisPckEditCommonOptions;
|
CommonOptionsTabSheet.Caption:=lisPckEditCommonOptions;
|
||||||
|
|
||||||
CallRegisterProcCheckBox.Caption:=lisPckEditRegisterUnit;
|
FPropGui:=TProjPackFilePropGui.Create(CommonOptionsTabSheet);
|
||||||
CallRegisterProcCheckBox.Hint:=Format(lisPckEditCallRegisterProcedureOfSelectedUnit, ['"', '"']);
|
// file properties
|
||||||
|
FPropGui.AddToUsesPkgSectionCheckBox.OnChange := @AddToUsesPkgSectionCheckBoxChange;
|
||||||
AddToUsesPkgSectionCheckBox.Caption:=lisPkgMangUseUnit;
|
FPropGui.CallRegisterProcCheckBox.OnChange := @CallRegisterProcCheckBoxChange;
|
||||||
AddToUsesPkgSectionCheckBox.Hint:=lisPkgMangAddUnitToUsesClause;
|
FPropGui.RegisteredListBox.OnDrawItem := @RegisteredListBoxDrawItem;
|
||||||
|
FPropGui.DisableI18NForLFMCheckBox.OnChange := @DisableI18NForLFMCheckBoxChange;
|
||||||
DisableI18NForLFMCheckBox.Caption:=lisPckDisableI18NOfLfm;
|
// dependency properties
|
||||||
DisableI18NForLFMCheckBox.Hint:=lisPckWhenTheFormIsSavedTheIDECanStoreAllTTranslateString;
|
FPropGui.OnGetPkgDep := @GetDependencyToUpdate;
|
||||||
|
FPropGui.ApplyDependencyButton.OnClick := @ApplyDependencyButtonClick;
|
||||||
UseMinVersionCheckBox.Caption:=lisPckEditMinimumVersion;
|
|
||||||
UseMaxVersionCheckBox.Caption:=lisPckEditMaximumVersion;
|
|
||||||
ApplyDependencyButton.Caption:=lisPckEditApplyChanges;
|
|
||||||
RegisteredPluginsGroupBox.Caption:=lisPckEditRegisteredPlugins;
|
|
||||||
RegisteredListBox.ItemHeight:=ComponentPaletteImageHeight;
|
|
||||||
|
|
||||||
FDirSummaryLabel:=TLabel.Create(Self);
|
FDirSummaryLabel:=TLabel.Create(Self);
|
||||||
with FDirSummaryLabel do
|
FDirSummaryLabel.Name:='DirSummaryLabel';
|
||||||
begin
|
FDirSummaryLabel.Parent:=CommonOptionsTabSheet;
|
||||||
Name:='DirSummaryLabel';
|
|
||||||
Parent:=CommonOptionsTabSheet;
|
|
||||||
end;
|
|
||||||
|
|
||||||
CreatePackageFileEditors;
|
CreatePackageFileEditors;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2426,7 +2335,7 @@ begin
|
|||||||
if pefNeedUpdateButtons in fFlags then
|
if pefNeedUpdateButtons in fFlags then
|
||||||
UpdateButtons(true);
|
UpdateButtons(true);
|
||||||
if pefNeedUpdateApplyDependencyButton in fFlags then
|
if pefNeedUpdateApplyDependencyButton in fFlags then
|
||||||
UpdateApplyDependencyButton(true);
|
FPropGui.UpdateApplyDependencyButton(true);
|
||||||
if pefNeedUpdateStatusBar in fFlags then
|
if pefNeedUpdateStatusBar in fFlags then
|
||||||
UpdateStatusBar(true);
|
UpdateStatusBar(true);
|
||||||
IdleConnected:=false;
|
IdleConnected:=false;
|
||||||
@ -2444,7 +2353,6 @@ begin
|
|||||||
if (fUpdateLock>0) and not Immediately then begin
|
if (fUpdateLock>0) and not Immediately then begin
|
||||||
Include(fFlags,Flag);
|
Include(fFlags,Flag);
|
||||||
IdleConnected:=true;
|
IdleConnected:=true;
|
||||||
Result:=false;
|
|
||||||
end else begin
|
end else begin
|
||||||
Exclude(fFlags,Flag);
|
Exclude(fFlags,Flag);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
@ -2593,10 +2501,6 @@ begin
|
|||||||
UpdateButtons;
|
UpdateButtons;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.UpdatePEProperties(Immediately: boolean);
|
|
||||||
type
|
|
||||||
TMultiBool = (mubNone, mubAllTrue, mubAllFalse, mubMixed);
|
|
||||||
|
|
||||||
procedure MergeMultiBool(var b: TMultiBool; NewValue: boolean);
|
procedure MergeMultiBool(var b: TMultiBool; NewValue: boolean);
|
||||||
begin
|
begin
|
||||||
case b of
|
case b of
|
||||||
@ -2607,58 +2511,23 @@ type
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure SetCheckBox(Box: TCheckBox; aVisible: boolean; State: TMultiBool);
|
procedure TPackageEditorForm.UpdatePEProperties(Immediately: boolean);
|
||||||
begin
|
|
||||||
Box.Visible:=aVisible;
|
|
||||||
case State of
|
|
||||||
mubAllTrue:
|
|
||||||
begin
|
|
||||||
Box.State:=cbChecked;
|
|
||||||
Box.AllowGrayed:=false;
|
|
||||||
end;
|
|
||||||
mubAllFalse:
|
|
||||||
begin
|
|
||||||
Box.State:=cbUnchecked;
|
|
||||||
Box.AllowGrayed:=false;
|
|
||||||
end;
|
|
||||||
mubMixed:
|
|
||||||
begin
|
|
||||||
Box.AllowGrayed:=true;
|
|
||||||
Box.State:=cbGrayed;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
var
|
var
|
||||||
CurFile, SingleSelectedFile: TPkgFile;
|
CurFile, SingleSelectedFile: TPkgFile;
|
||||||
CurDependency, SingleSelectedDep: TPkgDependency;
|
CurDependency, SingleSelectedDep: TPkgDependency;
|
||||||
CurComponent: TPkgComponent;
|
CurComponent: TPkgComponent;
|
||||||
CurLine, CurFilename: string;
|
CurLine, CurFilename: string;
|
||||||
i, j: Integer;
|
TVNode, SingleSelectedDirectory, SingleSelectedNode: TTreeNode;
|
||||||
NodeData: TPENodeData;
|
NodeData: TPENodeData;
|
||||||
Item: TObject;
|
Item: TObject;
|
||||||
SelFileCount: Integer;
|
i, j: Integer;
|
||||||
SelDepCount: Integer;
|
SelFileCount, SelDepCount, SelUnitCount, SelDirCount, SelHasLFMCount: Integer;
|
||||||
SelHasRegisterProc: TMultiBool;
|
FileCount, HasRegisterProcCount, AddToUsesPkgSectionCount: integer;
|
||||||
SelAddToUsesPkgSection: TMultiBool;
|
SelHasRegisterProc, SelAddToUsesPkgSection, SelDisableI18NForLFM: TMultiBool;
|
||||||
SelDisableI18NForLFM: TMultiBool;
|
aVisible, OnlyFilesWithUnitsSelected, SingleSelectedRemoved: Boolean;
|
||||||
SelUnitCount: Integer;
|
|
||||||
SelDirCount: Integer;
|
|
||||||
SelHasLFMCount: Integer;
|
|
||||||
OnlyFilesSelected: Boolean;
|
|
||||||
OnlyFilesWithUnitsSelected: Boolean;
|
|
||||||
aVisible: Boolean;
|
|
||||||
TVNode: TTreeNode;
|
|
||||||
SingleSelectedDirectory, SingleSelectedNode: TTreeNode;
|
|
||||||
SingleSelectedRemoved: Boolean;
|
|
||||||
FileCount: integer;
|
|
||||||
HasRegisterProcCount: integer;
|
|
||||||
AddToUsesPkgSectionCount: integer;
|
|
||||||
begin
|
begin
|
||||||
if not CanUpdate(pefNeedUpdateProperties,Immediately) then exit;
|
if not CanUpdate(pefNeedUpdateProperties,Immediately) then exit;
|
||||||
|
|
||||||
GuiToFileOptions(False);
|
GuiToFileOptions(False);
|
||||||
|
|
||||||
FPlugins.Clear;
|
FPlugins.Clear;
|
||||||
|
|
||||||
// check selection
|
// check selection
|
||||||
@ -2688,12 +2557,12 @@ begin
|
|||||||
if CurFile.FileType in PkgFileUnitTypes then begin
|
if CurFile.FileType in PkgFileUnitTypes then begin
|
||||||
inc(SelUnitCount);
|
inc(SelUnitCount);
|
||||||
MergeMultiBool(SelAddToUsesPkgSection,CurFile.AddToUsesPkgSection);
|
MergeMultiBool(SelAddToUsesPkgSection,CurFile.AddToUsesPkgSection);
|
||||||
if (CurFile.FileType in PkgFileRealUnitTypes) then
|
if CurFile.FileType in PkgFileRealUnitTypes then
|
||||||
begin
|
begin
|
||||||
CurFilename:=CurFile.GetFullFilename;
|
CurFilename:=CurFile.GetFullFilename;
|
||||||
if FilenameIsAbsolute(CurFilename)
|
if FilenameIsAbsolute(CurFilename)
|
||||||
and FileExistsCached(ChangeFileExt(CurFilename,'.lfm'))
|
and FileExistsCached(ChangeFileExt(CurFilename,'.lfm')) then
|
||||||
then begin
|
begin
|
||||||
inc(SelHasLFMCount);
|
inc(SelHasLFMCount);
|
||||||
MergeMultiBool(SelDisableI18NForLFM,CurFile.DisableI18NForLFM);
|
MergeMultiBool(SelDisableI18NForLFM,CurFile.DisableI18NForLFM);
|
||||||
end;
|
end;
|
||||||
@ -2716,7 +2585,8 @@ begin
|
|||||||
inc(SelDirCount);
|
inc(SelDirCount);
|
||||||
SingleSelectedDirectory:=TVNode;
|
SingleSelectedDirectory:=TVNode;
|
||||||
SingleSelectedNode:=TVNode;
|
SingleSelectedNode:=TVNode;
|
||||||
end;
|
end //else if TVNode=FRequiredPackagesNode then
|
||||||
|
// DebugLn('UpdatePEProperties: Required packages selected');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (SelFileCount+SelDepCount+SelDirCount>1) then begin
|
if (SelFileCount+SelDepCount+SelDirCount>1) then begin
|
||||||
@ -2726,50 +2596,35 @@ begin
|
|||||||
SingleSelectedDirectory:=nil;
|
SingleSelectedDirectory:=nil;
|
||||||
SingleSelectedNode:=nil;
|
SingleSelectedNode:=nil;
|
||||||
end;
|
end;
|
||||||
OnlyFilesSelected:=(SelFileCount>0) and (SelDepCount=0) and (SelDirCount=0);
|
|
||||||
OnlyFilesWithUnitsSelected:=OnlyFilesSelected and (SelUnitCount>0);
|
|
||||||
|
|
||||||
//debugln(['TPackageEditorForm.UpdatePEProperties SelFileCount=',SelFileCount,' SelDepCount=',SelDepCount,' SelDirCount=',SelDirCount,' SelUnitCount=',SelUnitCount]);
|
//debugln(['TPackageEditorForm.UpdatePEProperties SelFileCount=',SelFileCount,' SelDepCount=',SelDepCount,' SelDirCount=',SelDirCount,' SelUnitCount=',SelUnitCount]);
|
||||||
//debugln(['TPackageEditorForm.UpdatePEProperties FSingleSelectedFile=',SingleSelectedFile<>nil,' FSingleSelectedDependency=',SingleSelectedDep<>nil,' SingleSelectedDirectory=',SingleSelectedDirectory<>nil]);
|
//debugln(['TPackageEditorForm.UpdatePEProperties FSingleSelectedFile=',SingleSelectedFile<>nil,' FSingleSelectedDependency=',SingleSelectedDep<>nil,' SingleSelectedDirectory=',SingleSelectedDirectory<>nil]);
|
||||||
|
|
||||||
|
OnlyFilesWithUnitsSelected:=
|
||||||
|
(SelFileCount>0) and (SelDepCount=0) and (SelDirCount=0) and (SelUnitCount>0);
|
||||||
|
FPropGui.ControlVisible := OnlyFilesWithUnitsSelected;
|
||||||
|
FPropGui.ControlEnabled := not LazPackage.ReadOnly;
|
||||||
DisableAlign;
|
DisableAlign;
|
||||||
try
|
try
|
||||||
|
FPropGui.SetAddToUsesCB(SelAddToUsesPkgSection); // 'Add to uses' of files
|
||||||
|
FPropGui.SetCallRegisterProcCB(SelHasRegisterProc); // 'RegisterProc' of files
|
||||||
|
FPropGui.SetRegisteredPluginsGB(FPlugins); // registered plugins
|
||||||
|
|
||||||
|
// Min/Max version of dependency (only single selection)
|
||||||
|
FPropGui.ControlVisible := SingleSelectedDep<>nil;
|
||||||
|
FPropGui.SetMinMaxVisibility;
|
||||||
|
|
||||||
|
// disable i18n for lfm
|
||||||
|
FPropGui.ControlVisible := OnlyFilesWithUnitsSelected and (SelHasLFMCount>0)
|
||||||
|
and LazPackage.EnableI18N and LazPackage.EnableI18NForLFM;
|
||||||
|
FPropGui.SetDisableI18NCB(SelDisableI18NForLFM);
|
||||||
|
|
||||||
// move up/down (only single selection)
|
// move up/down (only single selection)
|
||||||
aVisible:=(not (SortAlphabetically or SingleSelectedRemoved))
|
aVisible:=(not (SortAlphabetically or SingleSelectedRemoved))
|
||||||
and ((SingleSelectedFile<>nil) or (SingleSelectedDep<>nil));
|
and ((SingleSelectedFile<>nil) or (SingleSelectedDep<>nil));
|
||||||
MoveUpBtn.Enabled :=aVisible and Assigned(SingleSelectedNode.GetPrevVisibleSibling);
|
MoveUpBtn.Enabled :=aVisible and Assigned(SingleSelectedNode.GetPrevVisibleSibling);
|
||||||
MoveDownBtn.Enabled:=aVisible and Assigned(SingleSelectedNode.GetNextVisibleSibling);
|
MoveDownBtn.Enabled:=aVisible and Assigned(SingleSelectedNode.GetNextVisibleSibling);
|
||||||
|
|
||||||
// Min/Max version of dependency (only single selection)
|
|
||||||
aVisible:=SingleSelectedDep<>nil;
|
|
||||||
UseMinVersionCheckBox.Visible:=aVisible;
|
|
||||||
MinVersionEdit.Visible:=aVisible;
|
|
||||||
UseMaxVersionCheckBox.Visible:=aVisible;
|
|
||||||
MaxVersionEdit.Visible:=aVisible;
|
|
||||||
ApplyDependencyButton.Visible:=aVisible;
|
|
||||||
|
|
||||||
// 'RegisterProc' of files (supports multi selection)
|
|
||||||
SetCheckBox(CallRegisterProcCheckBox,OnlyFilesWithUnitsSelected, SelHasRegisterProc);
|
|
||||||
CallRegisterProcCheckBox.Enabled:=(not LazPackage.ReadOnly);
|
|
||||||
|
|
||||||
// 'Add to uses' of files (supports multi selection)
|
|
||||||
SetCheckBox(AddToUsesPkgSectionCheckBox,OnlyFilesWithUnitsSelected, SelAddToUsesPkgSection);
|
|
||||||
AddToUsesPkgSectionCheckBox.Enabled:=(not LazPackage.ReadOnly);
|
|
||||||
|
|
||||||
// disable i18n for lfm (supports multi selection)
|
|
||||||
SetCheckBox(DisableI18NForLFMCheckBox,
|
|
||||||
OnlyFilesWithUnitsSelected and (SelHasLFMCount>0) and LazPackage.EnableI18N
|
|
||||||
and LazPackage.EnableI18NForLFM,
|
|
||||||
SelDisableI18NForLFM);
|
|
||||||
DisableI18NForLFMCheckBox.Enabled:=(not LazPackage.ReadOnly);
|
|
||||||
|
|
||||||
// registered plugins (supports multi selection)
|
|
||||||
RegisteredPluginsGroupBox.Visible:=OnlyFilesWithUnitsSelected;
|
|
||||||
RegisteredPluginsGroupBox.Enabled:=(not LazPackage.ReadOnly);
|
|
||||||
if not RegisteredPluginsGroupBox.Visible then
|
|
||||||
FPlugins.Clear;
|
|
||||||
RegisteredListBox.Items.Assign(FPlugins);
|
|
||||||
|
|
||||||
// directory summary (only single selection)
|
// directory summary (only single selection)
|
||||||
FDirSummaryLabel.Visible:=(SelFileCount=0) and (SelDepCount=0) and (SelDirCount=1);
|
FDirSummaryLabel.Visible:=(SelFileCount=0) and (SelDepCount=0) and (SelDirCount=1);
|
||||||
|
|
||||||
@ -2780,16 +2635,12 @@ begin
|
|||||||
else if SingleSelectedDep<>nil then begin
|
else if SingleSelectedDep<>nil then begin
|
||||||
PropsGroupBox.Enabled:=not SingleSelectedRemoved;
|
PropsGroupBox.Enabled:=not SingleSelectedRemoved;
|
||||||
PropsGroupBox.Caption:=lisPckEditDependencyProperties;
|
PropsGroupBox.Caption:=lisPckEditDependencyProperties;
|
||||||
UseMinVersionCheckBox.Checked:=pdfMinVersion in SingleSelectedDep.Flags;
|
FPropGui.SetMinMaxValues(SingleSelectedDep);
|
||||||
MinVersionEdit.Text:=SingleSelectedDep.MinVersion.AsString;
|
FPropGui.UpdateApplyDependencyButton;
|
||||||
MinVersionEdit.Enabled:=pdfMinVersion in SingleSelectedDep.Flags;
|
|
||||||
UseMaxVersionCheckBox.Checked:=pdfMaxVersion in SingleSelectedDep.Flags;
|
|
||||||
MaxVersionEdit.Text:=SingleSelectedDep.MaxVersion.AsString;
|
|
||||||
MaxVersionEdit.Enabled:=pdfMaxVersion in SingleSelectedDep.Flags;
|
|
||||||
UpdateApplyDependencyButton;
|
|
||||||
end
|
end
|
||||||
else if SingleSelectedDirectory<>nil then begin
|
else if SingleSelectedDirectory<>nil then begin
|
||||||
PropsGroupBox.Enabled:=true;
|
PropsGroupBox.Enabled:=true;
|
||||||
|
PropsGroupBox.Caption:=lisPckEditFileProperties;
|
||||||
GetDirectorySummary(SingleSelectedDirectory,
|
GetDirectorySummary(SingleSelectedDirectory,
|
||||||
FileCount,HasRegisterProcCount,AddToUsesPkgSectionCount);
|
FileCount,HasRegisterProcCount,AddToUsesPkgSectionCount);
|
||||||
FDirSummaryLabel.Caption:=Format(
|
FDirSummaryLabel.Caption:=Format(
|
||||||
@ -2798,6 +2649,7 @@ begin
|
|||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
PropsGroupBox.Enabled:=false;
|
PropsGroupBox.Enabled:=false;
|
||||||
|
PropsGroupBox.Caption:=lisPckEditDependencyProperties;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if SingleSelectedFile<>nil then begin
|
if SingleSelectedFile<>nil then begin
|
||||||
@ -2866,38 +2718,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.UpdateApplyDependencyButton(Immediately: boolean);
|
function TPackageEditorForm.GetDependencyToUpdate(Immediately: boolean): TPkgDependencyBase;
|
||||||
var
|
|
||||||
DependencyChanged: Boolean;
|
|
||||||
AVersion: TPkgVersion;
|
|
||||||
CurDependency: TPkgDependency;
|
|
||||||
begin
|
begin
|
||||||
if not CanUpdate(pefNeedUpdateApplyDependencyButton,Immediately) then exit;
|
if CanUpdate(pefNeedUpdateApplyDependencyButton,Immediately) then
|
||||||
CurDependency:=GetSingleSelectedDependency;
|
Result:=GetSingleSelectedDependency
|
||||||
DependencyChanged:=false;
|
else
|
||||||
if (CurDependency<>nil) then begin
|
Result:=nil;
|
||||||
// check min version
|
|
||||||
if UseMinVersionCheckBox.Checked<>(pdfMinVersion in CurDependency.Flags) then
|
|
||||||
DependencyChanged:=true;
|
|
||||||
if UseMinVersionCheckBox.Checked then begin
|
|
||||||
AVersion:=TPkgVersion.Create;
|
|
||||||
if AVersion.ReadString(MinVersionEdit.Text)
|
|
||||||
and (AVersion.Compare(CurDependency.MinVersion)<>0) then
|
|
||||||
DependencyChanged:=true;
|
|
||||||
AVersion.Free;
|
|
||||||
end;
|
|
||||||
// check max version
|
|
||||||
if UseMaxVersionCheckBox.Checked<>(pdfMaxVersion in CurDependency.Flags) then
|
|
||||||
DependencyChanged:=true;
|
|
||||||
if UseMaxVersionCheckBox.Checked then begin
|
|
||||||
AVersion:=TPkgVersion.Create;
|
|
||||||
if AVersion.ReadString(MaxVersionEdit.Text)
|
|
||||||
and (AVersion.Compare(CurDependency.MaxVersion)<>0) then
|
|
||||||
DependencyChanged:=true;
|
|
||||||
AVersion.Free;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
ApplyDependencyButton.Enabled:=DependencyChanged;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.UpdateStatusBar(Immediately: boolean);
|
procedure TPackageEditorForm.UpdateStatusBar(Immediately: boolean);
|
||||||
@ -3427,15 +3253,12 @@ procedure TPackageEditorForm.TraverseSettings(AOptions: TAbstractPackageFileIDEO
|
|||||||
if Control <> nil then
|
if Control <> nil then
|
||||||
begin
|
begin
|
||||||
if Control is TAbstractIDEOptionsEditor then
|
if Control is TAbstractIDEOptionsEditor then
|
||||||
begin
|
|
||||||
Assert(False,'TPackageEditorForm.TraverseSettings: IDEOptionsEditor found under PropsPageControl');
|
|
||||||
with TAbstractIDEOptionsEditor(Control) do
|
with TAbstractIDEOptionsEditor(Control) do
|
||||||
case anAction of
|
case anAction of
|
||||||
iodaRead: ReadSettings(AOptions);
|
iodaRead: ReadSettings(AOptions);
|
||||||
iodaWrite: WriteSettings(AOptions);
|
iodaWrite: WriteSettings(AOptions);
|
||||||
iodaRestore: RestoreSettings(AOptions);
|
iodaRestore: RestoreSettings(AOptions);
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
for i := 0 to Control.ControlCount -1 do
|
for i := 0 to Control.ControlCount -1 do
|
||||||
if Control.Controls[i] is TWinControl then
|
if Control.Controls[i] is TWinControl then
|
||||||
Traverse(TWinControl(Control.Controls[i]));
|
Traverse(TWinControl(Control.Controls[i]));
|
||||||
@ -3443,12 +3266,10 @@ procedure TPackageEditorForm.TraverseSettings(AOptions: TAbstractPackageFileIDEO
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
DebugLn(['TPackageEditorForm.TraverseSettings: AOptions=', AOptions, ', Action=', anAction]);
|
|
||||||
Traverse(PropsPageControl);
|
Traverse(PropsPageControl);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.CreatePackageFileEditors;
|
procedure TPackageEditorForm.CreatePackageFileEditors;
|
||||||
|
|
||||||
var
|
var
|
||||||
Instance: TAbstractIDEOptionsEditor;
|
Instance: TAbstractIDEOptionsEditor;
|
||||||
i, j: integer;
|
i, j: integer;
|
||||||
@ -3458,7 +3279,6 @@ var
|
|||||||
ItemTabSheet: TTabSheet;
|
ItemTabSheet: TTabSheet;
|
||||||
begin
|
begin
|
||||||
IDEEditorGroups.Resort;
|
IDEEditorGroups.Resort;
|
||||||
|
|
||||||
for i := 0 to IDEEditorGroups.Count - 1 do
|
for i := 0 to IDEEditorGroups.Count - 1 do
|
||||||
begin
|
begin
|
||||||
Rec := IDEEditorGroups[i];
|
Rec := IDEEditorGroups[i];
|
||||||
@ -3469,12 +3289,10 @@ begin
|
|||||||
AGroupCaption := Rec^.GroupClass.GetGroupCaption
|
AGroupCaption := Rec^.GroupClass.GetGroupCaption
|
||||||
else
|
else
|
||||||
AGroupCaption := '';
|
AGroupCaption := '';
|
||||||
|
|
||||||
for j := 0 to Rec^.Items.Count - 1 do
|
for j := 0 to Rec^.Items.Count - 1 do
|
||||||
begin
|
begin
|
||||||
ItemTabSheet := PropsPageControl.AddTabSheet;
|
ItemTabSheet := PropsPageControl.AddTabSheet;
|
||||||
ItemTabSheet.Align := alClient;
|
ItemTabSheet.Align := alClient;
|
||||||
|
|
||||||
Instance := Rec^.Items[j]^.EditorClass.Create(Self);
|
Instance := Rec^.Items[j]^.EditorClass.Create(Self);
|
||||||
// Instance.OnLoadIDEOptions := @LoadIDEOptions;
|
// Instance.OnLoadIDEOptions := @LoadIDEOptions;
|
||||||
// Instance.OnSaveIDEOptions := @SaveIDEOptions;
|
// Instance.OnSaveIDEOptions := @SaveIDEOptions;
|
||||||
|
407
packager/projpackfilepropgui.pas
Normal file
407
packager/projpackfilepropgui.pas
Normal file
@ -0,0 +1,407 @@
|
|||||||
|
{
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* This source is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This code is distributed in the hope that it will be useful, but *
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||||
|
* General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* A copy of the GNU General Public License is available on the World *
|
||||||
|
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
|
||||||
|
* obtain it by writing to the Free Software Foundation, *
|
||||||
|
* Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA. *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
Author: Juha Manninen
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
TProjPackFilePropGui creates and sets layout for controls that are used for
|
||||||
|
properties of files and dependencies in a package or in a project.
|
||||||
|
Used by the package editor and the project inspector.
|
||||||
|
}
|
||||||
|
unit ProjPackFilePropGui;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils,
|
||||||
|
// LCL
|
||||||
|
LResources, Forms, Controls, StdCtrls, Dialogs,
|
||||||
|
// BuildIntf
|
||||||
|
PackageDependencyIntf,
|
||||||
|
// IdeIntf
|
||||||
|
FormEditingIntf,
|
||||||
|
// IDE
|
||||||
|
LazarusIDEStrConsts;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
TMultiBool = (mubNone, mubAllTrue, mubAllFalse, mubMixed);
|
||||||
|
TGetPkgDepEvent = function(Immediately: boolean): TPkgDependencyBase of object;
|
||||||
|
|
||||||
|
{ TProjPackFilePropGui }
|
||||||
|
|
||||||
|
TProjPackFilePropGui = class
|
||||||
|
private
|
||||||
|
fOwner: TWinControl;
|
||||||
|
fOnGetPkgDep: TGetPkgDepEvent;
|
||||||
|
procedure MinMaxVersionEditChange(Sender: TObject);
|
||||||
|
procedure UseMinVersionCheckBoxChange(Sender: TObject);
|
||||||
|
procedure UseMaxVersionCheckBoxChange(Sender: TObject);
|
||||||
|
public
|
||||||
|
// file properties
|
||||||
|
AddToUsesPkgSectionCheckBox: TCheckBox;
|
||||||
|
CallRegisterProcCheckBox: TCheckBox;
|
||||||
|
RegisteredPluginsGroupBox: TGroupBox;
|
||||||
|
RegisteredListBox: TListBox;
|
||||||
|
DisableI18NForLFMCheckBox: TCheckBox; // I18N
|
||||||
|
// dependency properties
|
||||||
|
UseMinVersionCheckBox: TCheckBox;
|
||||||
|
MinVersionEdit: TEdit;
|
||||||
|
UseMaxVersionCheckBox: TCheckBox;
|
||||||
|
MaxVersionEdit: TEdit;
|
||||||
|
ApplyDependencyButton: TButton;
|
||||||
|
// Values used when setting controls' visibility and Enabled state.
|
||||||
|
ControlVisible, ControlEnabled: Boolean;
|
||||||
|
|
||||||
|
constructor Create(aOwner: TWinControl);
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure SetAddToUsesCB(State: TMultiBool);
|
||||||
|
procedure SetCallRegisterProcCB(State: TMultiBool);
|
||||||
|
procedure SetRegisteredPluginsGB(aPlugins: TStringList);
|
||||||
|
procedure SetMinMaxVisibility;
|
||||||
|
procedure SetMinMaxValues(aDep: TPkgDependencyBase);
|
||||||
|
procedure SetDisableI18NCB(State: TMultiBool);
|
||||||
|
function CheckApplyDependency(aDep: TPkgDependencyBase): Boolean;
|
||||||
|
procedure UpdateApplyDependencyButton(Immediately: boolean = False);
|
||||||
|
|
||||||
|
property OnGetPkgDep: TGetPkgDepEvent read fOnGetPkgDep write fOnGetPkgDep;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{ TProjPackFilePropGui }
|
||||||
|
|
||||||
|
constructor TProjPackFilePropGui.Create(aOwner: TWinControl);
|
||||||
|
begin
|
||||||
|
fOwner := aOwner;
|
||||||
|
|
||||||
|
// file properties
|
||||||
|
// ---------------
|
||||||
|
CallRegisterProcCheckBox := TCheckBox.Create(fOwner);
|
||||||
|
CallRegisterProcCheckBox.Parent := fOwner;
|
||||||
|
CallRegisterProcCheckBox.Visible := False;
|
||||||
|
CallRegisterProcCheckBox.Left := 6;
|
||||||
|
CallRegisterProcCheckBox.Top := 0;
|
||||||
|
CallRegisterProcCheckBox.Width := 185;
|
||||||
|
CallRegisterProcCheckBox.ShowHint := True;
|
||||||
|
CallRegisterProcCheckBox.TabOrder := 0;
|
||||||
|
CallRegisterProcCheckBox.Caption := lisPckEditRegisterUnit;
|
||||||
|
CallRegisterProcCheckBox.Hint := Format(lisPckEditCallRegisterProcedureOfSelectedUnit, ['"', '"']);
|
||||||
|
|
||||||
|
AddToUsesPkgSectionCheckBox := TCheckBox.Create(fOwner);
|
||||||
|
AddToUsesPkgSectionCheckBox.Parent := fOwner;
|
||||||
|
AddToUsesPkgSectionCheckBox.Visible := False;
|
||||||
|
AddToUsesPkgSectionCheckBox.AnchorSideLeft.Control := CallRegisterProcCheckBox;
|
||||||
|
AddToUsesPkgSectionCheckBox.AnchorSideLeft.Side := asrBottom;
|
||||||
|
AddToUsesPkgSectionCheckBox.Left := 195;
|
||||||
|
AddToUsesPkgSectionCheckBox.Top := 0;
|
||||||
|
AddToUsesPkgSectionCheckBox.Width := 222;
|
||||||
|
AddToUsesPkgSectionCheckBox.BorderSpacing.Left := 10;
|
||||||
|
AddToUsesPkgSectionCheckBox.ShowHint := True;
|
||||||
|
AddToUsesPkgSectionCheckBox.TabOrder := 1;
|
||||||
|
AddToUsesPkgSectionCheckBox.Caption := lisPkgMangUseUnit;
|
||||||
|
AddToUsesPkgSectionCheckBox.Hint := lisPkgMangAddUnitToUsesClause;
|
||||||
|
|
||||||
|
RegisteredPluginsGroupBox := TGroupBox.Create(fOwner);
|
||||||
|
RegisteredPluginsGroupBox.Parent := fOwner;
|
||||||
|
RegisteredPluginsGroupBox.Visible := False;
|
||||||
|
RegisteredPluginsGroupBox.Left := 3;
|
||||||
|
RegisteredPluginsGroupBox.Height := 165;
|
||||||
|
RegisteredPluginsGroupBox.Top := 27;
|
||||||
|
RegisteredPluginsGroupBox.Width := 452;
|
||||||
|
RegisteredPluginsGroupBox.Align := alBottom;
|
||||||
|
RegisteredPluginsGroupBox.Anchors := [akTop, akLeft, akRight, akBottom];
|
||||||
|
RegisteredPluginsGroupBox.BorderSpacing.Top := 6;
|
||||||
|
RegisteredPluginsGroupBox.TabOrder := 7;
|
||||||
|
RegisteredPluginsGroupBox.Caption := lisPckEditRegisteredPlugins;
|
||||||
|
|
||||||
|
RegisteredListBox := TListBox.Create(fOwner);
|
||||||
|
RegisteredListBox.Parent := RegisteredPluginsGroupBox;
|
||||||
|
RegisteredListBox.Align := alClient;
|
||||||
|
RegisteredListBox.ScrollWidth := 448;
|
||||||
|
RegisteredListBox.Style := lbOwnerDrawFixed;
|
||||||
|
RegisteredListBox.TabOrder := 0;
|
||||||
|
RegisteredListBox.ItemHeight := ComponentPaletteImageHeight;
|
||||||
|
|
||||||
|
// I18N
|
||||||
|
DisableI18NForLFMCheckBox := TCheckBox.Create(fOwner);
|
||||||
|
DisableI18NForLFMCheckBox.Parent := fOwner;
|
||||||
|
DisableI18NForLFMCheckBox.Visible := False;
|
||||||
|
DisableI18NForLFMCheckBox.AnchorSideLeft.Control := AddToUsesPkgSectionCheckBox;
|
||||||
|
DisableI18NForLFMCheckBox.AnchorSideLeft.Side := asrBottom;
|
||||||
|
DisableI18NForLFMCheckBox.AnchorSideTop.Control := AddToUsesPkgSectionCheckBox;
|
||||||
|
DisableI18NForLFMCheckBox.Left := 423;
|
||||||
|
DisableI18NForLFMCheckBox.Top := 0;
|
||||||
|
DisableI18NForLFMCheckBox.Width := 208;
|
||||||
|
DisableI18NForLFMCheckBox.BorderSpacing.Left := 10;
|
||||||
|
DisableI18NForLFMCheckBox.ShowHint := True;
|
||||||
|
DisableI18NForLFMCheckBox.TabOrder := 8;
|
||||||
|
DisableI18NForLFMCheckBox.Caption := lisPckDisableI18NOfLfm;
|
||||||
|
DisableI18NForLFMCheckBox.Hint := lisPckWhenTheFormIsSavedTheIDECanStoreAllTTranslateString;
|
||||||
|
|
||||||
|
// dependency properties
|
||||||
|
// ---------------------
|
||||||
|
UseMinVersionCheckBox := TCheckBox.Create(fOwner);
|
||||||
|
UseMinVersionCheckBox.Parent := fOwner;
|
||||||
|
UseMinVersionCheckBox.Visible := False;
|
||||||
|
UseMinVersionCheckBox.AnchorSideTop.Control := MinVersionEdit;
|
||||||
|
UseMinVersionCheckBox.AnchorSideTop.Side := asrCenter;
|
||||||
|
UseMinVersionCheckBox.Left := 6;
|
||||||
|
UseMinVersionCheckBox.Top := 6;
|
||||||
|
UseMinVersionCheckBox.Width := 179;
|
||||||
|
UseMinVersionCheckBox.TabOrder := 2;
|
||||||
|
UseMinVersionCheckBox.Caption := lisPckEditMinimumVersion;
|
||||||
|
UseMinVersionCheckBox.OnChange := @UseMinVersionCheckBoxChange;
|
||||||
|
|
||||||
|
MinVersionEdit := TEdit.Create(fOwner);
|
||||||
|
MinVersionEdit.Parent := fOwner;
|
||||||
|
MinVersionEdit.Visible := False;
|
||||||
|
MinVersionEdit.AnchorSideLeft.Control := UseMinVersionCheckBox;
|
||||||
|
MinVersionEdit.AnchorSideLeft.Side := asrBottom;
|
||||||
|
MinVersionEdit.Left := 201;
|
||||||
|
MinVersionEdit.Top := 0;
|
||||||
|
MinVersionEdit.Width := 100;
|
||||||
|
MinVersionEdit.BorderSpacing.Left := 10;
|
||||||
|
MinVersionEdit.TabOrder := 3;
|
||||||
|
MinVersionEdit.OnChange := @MinMaxVersionEditChange;
|
||||||
|
|
||||||
|
UseMaxVersionCheckBox := TCheckBox.Create(fOwner);
|
||||||
|
UseMaxVersionCheckBox.Parent := fOwner;
|
||||||
|
UseMaxVersionCheckBox.Visible := False;
|
||||||
|
UseMaxVersionCheckBox.AnchorSideTop.Control := MaxVersionEdit;
|
||||||
|
UseMaxVersionCheckBox.AnchorSideTop.Side := asrCenter;
|
||||||
|
UseMaxVersionCheckBox.Left := 6;
|
||||||
|
UseMaxVersionCheckBox.Top := 43;
|
||||||
|
UseMaxVersionCheckBox.Width := 182;
|
||||||
|
UseMaxVersionCheckBox.TabOrder := 4;
|
||||||
|
UseMaxVersionCheckBox.Caption := lisPckEditMaximumVersion;
|
||||||
|
UseMaxVersionCheckBox.OnChange := @UseMaxVersionCheckBoxChange;
|
||||||
|
|
||||||
|
MaxVersionEdit := TEdit.Create(fOwner);
|
||||||
|
MaxVersionEdit.Parent := fOwner;
|
||||||
|
MaxVersionEdit.Visible := False;
|
||||||
|
MaxVersionEdit.AnchorSideLeft.Control := UseMaxVersionCheckBox;
|
||||||
|
MaxVersionEdit.AnchorSideLeft.Side := asrBottom;
|
||||||
|
MaxVersionEdit.AnchorSideTop.Control := MinVersionEdit;
|
||||||
|
MaxVersionEdit.AnchorSideTop.Side := asrBottom;
|
||||||
|
MaxVersionEdit.Left := 204;
|
||||||
|
MaxVersionEdit.Top := 38;
|
||||||
|
MaxVersionEdit.Width := 100;
|
||||||
|
MaxVersionEdit.BorderSpacing.Left := 10;
|
||||||
|
MaxVersionEdit.BorderSpacing.Top := 2;
|
||||||
|
MaxVersionEdit.TabOrder := 5;
|
||||||
|
MaxVersionEdit.OnChange := @MinMaxVersionEditChange;
|
||||||
|
|
||||||
|
ApplyDependencyButton := TButton.Create(fOwner);
|
||||||
|
ApplyDependencyButton.Parent := fOwner;
|
||||||
|
ApplyDependencyButton.Visible := False;
|
||||||
|
ApplyDependencyButton.AnchorSideTop.Control := MaxVersionEdit;
|
||||||
|
ApplyDependencyButton.AnchorSideTop.Side := asrBottom;
|
||||||
|
ApplyDependencyButton.Left := 6;
|
||||||
|
ApplyDependencyButton.Top := 80;
|
||||||
|
ApplyDependencyButton.AutoSize := True;
|
||||||
|
ApplyDependencyButton.BorderSpacing.Top := 6;
|
||||||
|
ApplyDependencyButton.TabOrder := 6;
|
||||||
|
ApplyDependencyButton.Caption := lisPckEditApplyChanges;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TProjPackFilePropGui.Destroy;
|
||||||
|
begin
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure SetCheckBox(Box: TCheckBox; aVisible: boolean; State: TMultiBool);
|
||||||
|
begin
|
||||||
|
Box.Visible:=aVisible;
|
||||||
|
case State of
|
||||||
|
mubAllTrue:
|
||||||
|
begin
|
||||||
|
Box.State:=cbChecked;
|
||||||
|
Box.AllowGrayed:=false;
|
||||||
|
end;
|
||||||
|
mubAllFalse:
|
||||||
|
begin
|
||||||
|
Box.State:=cbUnchecked;
|
||||||
|
Box.AllowGrayed:=false;
|
||||||
|
end;
|
||||||
|
mubMixed:
|
||||||
|
begin
|
||||||
|
Box.State:=cbGrayed;
|
||||||
|
Box.AllowGrayed:=true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjPackFilePropGui.SetAddToUsesCB(State: TMultiBool);
|
||||||
|
begin
|
||||||
|
SetCheckBox(AddToUsesPkgSectionCheckBox, ControlVisible, State);
|
||||||
|
AddToUsesPkgSectionCheckBox.Enabled := ControlEnabled;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjPackFilePropGui.SetCallRegisterProcCB(State: TMultiBool);
|
||||||
|
begin
|
||||||
|
SetCheckBox(CallRegisterProcCheckBox, ControlVisible, State);
|
||||||
|
CallRegisterProcCheckBox.Enabled := ControlEnabled;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjPackFilePropGui.SetRegisteredPluginsGB(aPlugins: TStringList);
|
||||||
|
begin
|
||||||
|
RegisteredPluginsGroupBox.Visible := ControlVisible;
|
||||||
|
RegisteredPluginsGroupBox.Enabled := ControlEnabled;
|
||||||
|
if not ControlVisible then
|
||||||
|
aPlugins.Clear;
|
||||||
|
RegisteredListBox.Items.Assign(aPlugins);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjPackFilePropGui.SetMinMaxVisibility;
|
||||||
|
begin
|
||||||
|
UseMinVersionCheckBox.Visible := ControlVisible;
|
||||||
|
MinVersionEdit.Visible := ControlVisible;
|
||||||
|
UseMaxVersionCheckBox.Visible := ControlVisible;
|
||||||
|
MaxVersionEdit.Visible := ControlVisible;
|
||||||
|
ApplyDependencyButton.Visible := ControlVisible;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjPackFilePropGui.SetMinMaxValues(aDep: TPkgDependencyBase);
|
||||||
|
begin
|
||||||
|
UseMinVersionCheckBox.Checked := pdfMinVersion in aDep.Flags;
|
||||||
|
MinVersionEdit.Text := aDep.MinVersion.AsString;
|
||||||
|
MinVersionEdit.Enabled := pdfMinVersion in aDep.Flags;
|
||||||
|
UseMaxVersionCheckBox.Checked := pdfMaxVersion in aDep.Flags;
|
||||||
|
MaxVersionEdit.Text := aDep.MaxVersion.AsString;
|
||||||
|
MaxVersionEdit.Enabled := pdfMaxVersion in aDep.Flags;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjPackFilePropGui.SetDisableI18NCB(State: TMultiBool);
|
||||||
|
begin
|
||||||
|
SetCheckBox(DisableI18NForLFMCheckBox, ControlVisible, State);
|
||||||
|
DisableI18NForLFMCheckBox.Enabled := ControlEnabled;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TProjPackFilePropGui.CheckApplyDependency(aDep: TPkgDependencyBase): Boolean;
|
||||||
|
var
|
||||||
|
Flags: TPkgDependencyFlags;
|
||||||
|
MinVers, MaxVers: TPkgVersion;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
MinVers:=TPkgVersion.Create;
|
||||||
|
MaxVers:=TPkgVersion.Create;
|
||||||
|
try
|
||||||
|
// Assign relevant data to temp variables
|
||||||
|
Flags:=aDep.Flags;
|
||||||
|
MinVers.Assign(aDep.MinVersion);
|
||||||
|
MaxVers.Assign(aDep.MinVersion);
|
||||||
|
|
||||||
|
// read minimum version
|
||||||
|
if UseMinVersionCheckBox.Checked then begin
|
||||||
|
Include(Flags, pdfMinVersion);
|
||||||
|
if not MinVers.ReadString(MinVersionEdit.Text) then begin
|
||||||
|
MessageDlg(lisPckEditInvalidMinimumVersion,
|
||||||
|
Format(lisPckEditTheMinimumVersionIsNotAValidPackageVersion,
|
||||||
|
[MinVersionEdit.Text, LineEnding]),
|
||||||
|
mtError,[mbCancel],0);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Exclude(Flags, pdfMinVersion);
|
||||||
|
|
||||||
|
// read maximum version
|
||||||
|
if UseMaxVersionCheckBox.Checked then begin
|
||||||
|
Include(Flags, pdfMaxVersion);
|
||||||
|
if not MaxVers.ReadString(MaxVersionEdit.Text) then begin
|
||||||
|
MessageDlg(lisPckEditInvalidMaximumVersion,
|
||||||
|
Format(lisPckEditTheMaximumVersionIsNotAValidPackageVersion,
|
||||||
|
[MaxVersionEdit.Text, LineEnding]),
|
||||||
|
mtError,[mbCancel],0);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Exclude(Flags, pdfMaxVersion);
|
||||||
|
|
||||||
|
// Assign changes back to the dependency
|
||||||
|
aDep.Flags := Flags;
|
||||||
|
aDep.MinVersion.Assign(MinVers);
|
||||||
|
aDep.MaxVersion.Assign(MaxVers);
|
||||||
|
Result := True;
|
||||||
|
finally
|
||||||
|
MaxVers.Free;
|
||||||
|
MinVers.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjPackFilePropGui.UpdateApplyDependencyButton(Immediately: boolean);
|
||||||
|
var
|
||||||
|
DependencyChanged: Boolean;
|
||||||
|
AVersion: TPkgVersion;
|
||||||
|
CurDependency: TPkgDependencyBase;
|
||||||
|
begin
|
||||||
|
Assert(Assigned(OnGetPkgDep), 'UpdateApplyDependencyButton: OnPkgDepToUpdate = Nil.');
|
||||||
|
CurDependency := OnGetPkgDep(Immediately);
|
||||||
|
DependencyChanged := false;
|
||||||
|
if Assigned(CurDependency) then
|
||||||
|
begin
|
||||||
|
// check min version
|
||||||
|
if UseMinVersionCheckBox.Checked <> (pdfMinVersion in CurDependency.Flags) then
|
||||||
|
DependencyChanged := true;
|
||||||
|
if UseMinVersionCheckBox.Checked then begin
|
||||||
|
AVersion := TPkgVersion.Create;
|
||||||
|
if AVersion.ReadString(MinVersionEdit.Text)
|
||||||
|
and (AVersion.Compare(CurDependency.MinVersion)<>0) then
|
||||||
|
DependencyChanged := true;
|
||||||
|
AVersion.Free;
|
||||||
|
end;
|
||||||
|
// check max version
|
||||||
|
if UseMaxVersionCheckBox.Checked <> (pdfMaxVersion in CurDependency.Flags) then
|
||||||
|
DependencyChanged := true;
|
||||||
|
if UseMaxVersionCheckBox.Checked then begin
|
||||||
|
AVersion := TPkgVersion.Create;
|
||||||
|
if AVersion.ReadString(MaxVersionEdit.Text)
|
||||||
|
and (AVersion.Compare(CurDependency.MaxVersion)<>0) then
|
||||||
|
DependencyChanged := true;
|
||||||
|
AVersion.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
ApplyDependencyButton.Enabled := DependencyChanged;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjPackFilePropGui.MinMaxVersionEditChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
UpdateApplyDependencyButton;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjPackFilePropGui.UseMinVersionCheckBoxChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
MinVersionEdit.Enabled := UseMinVersionCheckBox.Checked;
|
||||||
|
UpdateApplyDependencyButton;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TProjPackFilePropGui.UseMaxVersionCheckBoxChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
MaxVersionEdit.Enabled := UseMaxVersionCheckBox.Checked;
|
||||||
|
UpdateApplyDependencyButton;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user