packager:

- remove package options dialog
  - remove compiler options button
  - call new package + compiler options dialog on options button click

git-svn-id: trunk@29502 -
This commit is contained in:
paul 2011-02-13 06:31:42 +00:00
parent 9224d401fc
commit 98b5643d20
5 changed files with 44 additions and 1347 deletions

2
.gitattributes vendored
View File

@ -5600,8 +5600,6 @@ packager/pkggraphexplorer.pas svneol=native#text/pascal
packager/pkglinksdlg.lfm svneol=native#text/plain
packager/pkglinksdlg.pas svneol=native#text/plain
packager/pkgmanager.pas svneol=native#text/pascal
packager/pkgoptionsdlg.lfm svneol=native#text/plain
packager/pkgoptionsdlg.pas svneol=native#text/pascal
packager/pkgvirtualuniteditor.lfm svneol=native#text/plain
packager/pkgvirtualuniteditor.pas svneol=native#text/pascal
packager/registration/Makefile.compiled svneol=native#text/plain

View File

@ -6,6 +6,8 @@ inherited PackageEditorForm: TPackageEditorForm
Caption = 'PackageEditorForm'
ClientHeight = 450
ClientWidth = 577
Constraints.MinHeight = 300
Constraints.MinWidth = 400
KeyPreview = True
OnClose = PackageEditorFormClose
OnCloseQuery = PackageEditorFormCloseQuery
@ -23,19 +25,18 @@ inherited PackageEditorForm: TPackageEditorForm
object FilePropsGroupBox: TGroupBox[1]
Left = 0
Height = 118
Top = 310
Top = 309
Width = 577
Align = alBottom
Caption = 'FilePropsGroupBox'
ClientHeight = 97
ClientWidth = 569
ClientHeight = 100
ClientWidth = 573
TabOrder = 1
OnResize = FilePropsGroupBoxResize
object CallRegisterProcCheckBox: TCheckBox
Left = 0
Height = 22
Height = 19
Top = 0
Width = 209
Width = 158
Caption = 'CallRegisterProcCheckBox'
OnChange = CallRegisterProcCheckBoxChange
ParentShowHint = False
@ -45,10 +46,10 @@ inherited PackageEditorForm: TPackageEditorForm
object AddToUsesPkgSectionCheckBox: TCheckBox
AnchorSideLeft.Control = CallRegisterProcCheckBox
AnchorSideLeft.Side = asrBottom
Left = 219
Height = 22
Left = 168
Height = 19
Top = 0
Width = 248
Width = 191
BorderSpacing.Left = 10
Caption = 'AddToUsesPkgSectionCheckBox'
OnChange = AddToUsesPkgSectionCheckBoxChange
@ -61,9 +62,9 @@ inherited PackageEditorForm: TPackageEditorForm
AnchorSideTop.Control = MinVersionEdit
AnchorSideTop.Side = asrCenter
Left = 0
Height = 22
Height = 19
Top = 2
Width = 197
Width = 151
Caption = 'UseMinVersionCheckBox'
OnChange = UseMinVersionCheckBoxChange
TabOrder = 2
@ -72,8 +73,8 @@ inherited PackageEditorForm: TPackageEditorForm
AnchorSideLeft.Control = UseMinVersionCheckBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = FilePropsGroupBox
Left = 207
Height = 27
Left = 161
Height = 23
Top = 0
Width = 100
BorderSpacing.Left = 10
@ -86,9 +87,9 @@ inherited PackageEditorForm: TPackageEditorForm
AnchorSideTop.Control = MaxVersionEdit
AnchorSideTop.Side = asrCenter
Left = 0
Height = 22
Top = 31
Width = 201
Height = 19
Top = 27
Width = 152
Caption = 'UseMaxVersionCheckBox'
OnChange = UseMaxVersionCheckBoxChange
TabOrder = 4
@ -98,9 +99,9 @@ inherited PackageEditorForm: TPackageEditorForm
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = MinVersionEdit
AnchorSideTop.Side = asrBottom
Left = 211
Height = 27
Top = 29
Left = 162
Height = 23
Top = 25
Width = 100
BorderSpacing.Left = 10
BorderSpacing.Top = 2
@ -113,9 +114,9 @@ inherited PackageEditorForm: TPackageEditorForm
AnchorSideTop.Control = MaxVersionEdit
AnchorSideTop.Side = asrBottom
Left = 0
Height = 27
Top = 62
Width = 188
Height = 25
Top = 54
Width = 159
AutoSize = True
BorderSpacing.Top = 6
Caption = 'ApplyDependencyButton'
@ -127,19 +128,19 @@ inherited PackageEditorForm: TPackageEditorForm
AnchorSideTop.Side = asrBottom
Left = 0
Height = 60
Top = 37
Width = 569
Top = 40
Width = 573
Align = alBottom
BorderSpacing.Top = 6
Caption = 'RegisteredPluginsGroupBox'
ClientHeight = 39
ClientWidth = 561
ClientHeight = 42
ClientWidth = 569
TabOrder = 7
object RegisteredListBox: TListBox
Left = 0
Height = 39
Height = 42
Top = 0
Width = 561
Width = 569
Align = alClient
ItemHeight = 0
OnDrawItem = RegisteredListBoxDrawItem
@ -150,8 +151,8 @@ inherited PackageEditorForm: TPackageEditorForm
end
object StatusBar: TStatusBar[2]
Left = 0
Height = 22
Top = 428
Height = 23
Top = 427
Width = 577
Panels = <>
end
@ -159,31 +160,31 @@ inherited PackageEditorForm: TPackageEditorForm
Cursor = crVSplit
Left = 0
Height = 5
Top = 305
Top = 304
Width = 577
Align = alBottom
ResizeAnchor = akBottom
end
object ItemsPanel: TPanel[4]
Left = 0
Height = 257
Height = 256
Top = 48
Width = 577
Align = alClient
BevelOuter = bvNone
ClientHeight = 257
ClientHeight = 256
ClientWidth = 577
TabOrder = 4
object FilesTreeView: TTreeView
AnchorSideTop.Control = FilterEdit
AnchorSideTop.Side = asrBottom
Left = 0
Height = 230
Top = 27
Height = 233
Top = 23
Width = 577
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
DefaultItemHeight = 19
DefaultItemHeight = 17
PopupMenu = FilesPopupMenu
ReadOnly = True
TabOrder = 0
@ -199,7 +200,7 @@ inherited PackageEditorForm: TPackageEditorForm
AnchorSideRight.Control = ItemsPanel
AnchorSideRight.Side = asrBottom
Left = 46
Height = 27
Height = 23
Top = 0
Width = 531
Anchors = [akTop, akLeft, akRight]
@ -215,7 +216,7 @@ inherited PackageEditorForm: TPackageEditorForm
AnchorSideBottom.Control = FilterEdit
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 27
Height = 23
Top = 0
Width = 23
AllowAllUp = True
@ -234,7 +235,7 @@ inherited PackageEditorForm: TPackageEditorForm
AnchorSideBottom.Control = FilterEdit
AnchorSideBottom.Side = asrBottom
Left = 23
Height = 27
Height = 23
Top = 0
Width = 23
AllowAllUp = True

View File

@ -47,7 +47,7 @@ uses
// IDE
MainIntf, IDEProcs, LazConf, LazarusIDEStrConsts, IDEOptionDefs, IDEDefs,
IDEContextHelpEdit, CompilerOptions, ComponentReg,
PackageDefs, PkgOptionsDlg, AddToPackageDlg, PkgVirtualUnitEditor,
PackageDefs, AddToPackageDlg, PkgVirtualUnitEditor,
MissingPkgFilesDlg, PackageSystem;
const
@ -98,7 +98,6 @@ var
PkgEditMenuRemove: TIDEMenuCommand;
PkgEditMenuGeneralOptions: TIDEMenuCommand;
PkgEditMenuCompilerOptions: TIDEMenuCommand;
PkgEditMenuViewPackageSource: TIDEMenuCommand;
type
@ -163,7 +162,6 @@ type
RemoveBitBtn: TToolButton;
UseBitBtn: TToolButton;
OptionsBitBtn: TToolButton;
CompilerOptionsBitBtn: TToolButton;
MoreBitBtn: TToolButton;
HelpBitBtn: TToolButton;
// items
@ -197,12 +195,10 @@ type
procedure CompileAllCleanClick(Sender: TObject);
procedure CompileBitBtnClick(Sender: TObject);
procedure CompileCleanClick(Sender: TObject);
procedure CompilerOptionsBitBtnClick(Sender: TObject);
procedure CreateMakefileClick(Sender: TObject);
procedure DirectoryHierarchySpeedButtonClick(Sender: TObject);
procedure EditVirtualUnitMenuItemClick(Sender: TObject);
procedure ExpandDirectoryMenuItemClick(Sender: TObject);
procedure FilePropsGroupBoxResize(Sender: TObject);
procedure FilesPopupMenuPopup(Sender: TObject);
procedure FilesTreeViewDblClick(Sender: TObject);
procedure FilesTreeViewKeyPress(Sender: TObject; var Key: Char);
@ -512,7 +508,6 @@ begin
PkgEditMenuSectionMisc:=RegisterIDEMenuSection(PackageEditorMenuRoot,'Misc');
AParent:=PkgEditMenuSectionMisc;
PkgEditMenuGeneralOptions:=RegisterIDEMenuCommand(AParent,'General Options',lisPckEditGeneralOptions);
PkgEditMenuCompilerOptions:=RegisterIDEMenuCommand(AParent,'Compiler Options',dlgCompilerOptions);
PkgEditMenuViewPackageSource:=RegisterIDEMenuCommand(AParent,'View Package Source',lisPckEditViewPackageSource);
end;
@ -711,8 +706,6 @@ begin
SetItem(PkgEditMenuRemove,@RemoveBitBtnClick,true,RemoveBitBtn.Enabled);
SetItem(PkgEditMenuGeneralOptions,@OptionsBitBtnClick,true,OptionsBitBtn.Enabled);
SetItem(PkgEditMenuCompilerOptions,@CompilerOptionsBitBtnClick,true,
CompilerOptionsBitBtn.Enabled);
SetItem(PkgEditMenuViewPackageSource,@ViewPkgSourceClick);
finally
PackageEditorMenuRoot.EndUpdate;
@ -920,7 +913,9 @@ end;
procedure TPackageEditorForm.OptionsBitBtnClick(Sender: TObject);
begin
ShowPackageOptionsDlg(LazPackage);
CurPackage := LazPackage;
// TODO: LazPackage.ReadOnly ?
LazarusIDE.DoOpenIDEOptions(nil, Format(lisPckEditCompilerOptionsForPackage, [LazPackage.IDAsString]), [TLazPackage, TPkgCompilerOptions]);
UpdateButtons;
UpdateTitle;
UpdateStatusBar;
@ -1124,10 +1119,6 @@ begin
DoUseUnitsInDirectory(false);
end;
procedure TPackageEditorForm.FilePropsGroupBoxResize(Sender: TObject);
begin
end;
procedure TPackageEditorForm.AddBitBtnClick(Sender: TObject);
var
IgnoreUnitPaths, IgnoreIncPaths: TFilenameToStringTree;
@ -1448,16 +1439,6 @@ begin
DoCompile(false,false);
end;
procedure TPackageEditorForm.CompilerOptionsBitBtnClick(Sender: TObject);
begin
CurPackage := LazPackage;
// TODO: LazPackage.ReadOnly ?
LazarusIDE.DoOpenIDEOptions(nil, Format(lisPckEditCompilerOptionsForPackage, [LazPackage.IDAsString]), [TLazPackage, TPkgCompilerOptions]);
UpdateTitle;
UpdateButtons;
UpdateStatusBar;
end;
procedure TPackageEditorForm.CreateMakefileClick(Sender: TObject);
begin
PackageEditors.CreateMakefile(LazPackage);
@ -1543,8 +1524,6 @@ begin
RemoveBitBtn := CreateToolButton('RemoveBitBtn', lisExtToolRemove, lisPckEditRemoveSelectedItem, 'laz_delete', @RemoveBitBtnClick);
CreateDivider;
OptionsBitBtn := CreateToolButton('OptionsBitBtn', dlgFROpts, lisPckEditEditGeneralOptions, 'pkg_properties', @OptionsBitBtnClick);
CompilerOptionsBitBtn := CreateToolButton('CompilerOptionsBitBtn', lisPckEditCompOpts, lisPckEditEditOptionsToCompilePackage, 'menu_compiler_options', @CompilerOptionsBitBtnClick);
CreateDivider;
HelpBitBtn := CreateToolButton('HelpBitBtn', GetButtonCaption(idButtonHelp), lisPkgEdThereAreMoreFunctionsInThePopupmenu, 'menu_help', @HelpBitBtnClick);
MoreBitBtn := CreateToolButton('MoreBitBtn', lisPckEditMore, lisPkgEdThereAreMoreFunctionsInThePopupmenu, '', nil);
@ -1709,7 +1688,6 @@ begin
UseBitBtn.DropdownMenu:=nil;
end;
OptionsBitBtn.Enabled:=true;
CompilerOptionsBitBtn.Enabled:=true;
end;
procedure TPackageEditorForm.UpdateFiles(Immediately: boolean);

View File

@ -1,650 +0,0 @@
object PackageOptionsDialog: TPackageOptionsDialog
Left = 333
Height = 450
Top = 256
Width = 528
Caption = 'PackageOptionsDialog'
ClientHeight = 450
ClientWidth = 528
Constraints.MinHeight = 450
Constraints.MinWidth = 520
OnClose = PackageOptionsDialogClose
OnCreate = FormCreate
LCLVersion = '0.9.29'
object Notebook: TPageControl
Left = 0
Height = 404
Top = 0
Width = 528
ActivePage = DescriptionPage
Align = alClient
TabIndex = 1
TabOrder = 0
object UsagePage: TTabSheet
Caption = 'Usage'
ClientHeight = 387
ClientWidth = 524
object AddPathsGroupBox: TGroupBox
Left = 6
Height = 133
Top = 6
Width = 512
Align = alTop
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Add paths to dependent packages/projects'
ClientHeight = 133
ClientWidth = 512
TabOrder = 0
object UnitPathLabel: TLabel
AnchorSideLeft.Control = AddPathsGroupBox
AnchorSideTop.Control = UnitPathEdit
AnchorSideTop.Side = asrCenter
Left = 6
Height = 16
Top = 8
Width = 26
BorderSpacing.Left = 6
Caption = 'Unit'
ParentColor = False
end
object IncludePathLabel: TLabel
AnchorSideLeft.Control = AddPathsGroupBox
AnchorSideTop.Control = IncludePathEdit
Left = 6
Height = 16
Top = 33
Width = 46
BorderSpacing.Left = 6
Caption = 'Include'
ParentColor = False
end
object ObjectPathLabel: TLabel
AnchorSideLeft.Control = AddPathsGroupBox
AnchorSideTop.Control = ObjectPathEdit
AnchorSideTop.Side = asrCenter
Left = 6
Height = 16
Top = 62
Width = 40
BorderSpacing.Left = 6
Caption = 'Object'
ParentColor = False
end
object LibraryPathLabel: TLabel
AnchorSideLeft.Control = AddPathsGroupBox
AnchorSideTop.Control = LibraryPathEdit
AnchorSideTop.Side = asrCenter
Left = 6
Height = 16
Top = 89
Width = 43
BorderSpacing.Left = 6
Caption = 'Library'
ParentColor = False
end
object UnitPathEdit: TEdit
AnchorSideLeft.Control = LibraryPathEdit
AnchorSideTop.Control = AddPathsGroupBox
AnchorSideRight.Control = AddPathsGroupBox
AnchorSideRight.Side = asrBottom
Left = 80
Height = 21
Top = 6
Width = 378
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
BorderSpacing.Right = 50
TabOrder = 0
end
object IncludePathEdit: TEdit
AnchorSideLeft.Control = LibraryPathEdit
AnchorSideTop.Control = UnitPathEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AddPathsGroupBox
AnchorSideRight.Side = asrBottom
Left = 80
Height = 21
Top = 33
Width = 378
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
BorderSpacing.Right = 50
TabOrder = 1
end
object ObjectPathEdit: TEdit
AnchorSideLeft.Control = LibraryPathEdit
AnchorSideTop.Control = IncludePathEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AddPathsGroupBox
AnchorSideRight.Side = asrBottom
Left = 80
Height = 21
Top = 60
Width = 378
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
BorderSpacing.Right = 50
TabOrder = 2
end
object LibraryPathEdit: TEdit
AnchorSideLeft.Control = AddPathsGroupBox
AnchorSideTop.Control = ObjectPathEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AddPathsGroupBox
AnchorSideRight.Side = asrBottom
Left = 80
Height = 21
Top = 87
Width = 378
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 80
BorderSpacing.Top = 6
BorderSpacing.Right = 50
BorderSpacing.Bottom = 6
TabOrder = 3
end
end
object AddOptionsGroupBox: TGroupBox
Left = 6
Height = 179
Top = 145
Width = 512
Align = alClient
BorderSpacing.Around = 6
Caption = 'Add options to dependent packages and projects'
ClientHeight = 179
ClientWidth = 512
TabOrder = 1
object LinkerOptionsLabel: TLabel
AnchorSideLeft.Control = AddOptionsGroupBox
AnchorSideTop.Control = LinkerOptionsMemo
Left = 6
Height = 16
Top = 6
Width = 38
BorderSpacing.Left = 6
Caption = 'Linker'
ParentColor = False
end
object CustomOptionsLabel: TLabel
AnchorSideLeft.Control = AddOptionsGroupBox
AnchorSideTop.Control = CustomOptionsMemo
Left = 6
Height = 16
Top = 74
Width = 47
BorderSpacing.Left = 6
Caption = 'Custom'
ParentColor = False
end
object LinkerOptionsMemo: TMemo
AnchorSideLeft.Control = CustomOptionsMemo
AnchorSideTop.Control = AddOptionsGroupBox
AnchorSideRight.Control = AddOptionsGroupBox
AnchorSideRight.Side = asrBottom
Left = 63
Height = 62
Top = 6
Width = 439
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
BorderSpacing.Right = 6
ScrollBars = ssAutoVertical
TabOrder = 0
end
object CustomOptionsMemo: TMemo
AnchorSideLeft.Control = CustomOptionsLabel
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = LinkerOptionsMemo
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AddOptionsGroupBox
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = AddOptionsGroupBox
AnchorSideBottom.Side = asrBottom
Left = 63
Height = 80
Top = 74
Width = 439
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 10
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
ScrollBars = ssAutoVertical
TabOrder = 1
end
end
object ProjectGroupBox: TGroupBox
Left = 6
Height = 51
Top = 330
Width = 512
Align = alBottom
AutoSize = True
BorderSpacing.Around = 6
Caption = 'ProjectGroupBox'
ClientHeight = 51
ClientWidth = 512
TabOrder = 2
object AddPackageUnitToProjectCheckBox: TCheckBox
Left = 6
Height = 20
Top = 6
Width = 496
Align = alTop
BorderSpacing.Around = 6
Caption = 'AddPackageUnitToProjectCheckBox'
TabOrder = 0
end
end
end
object DescriptionPage: TTabSheet
Caption = 'Description'
ClientHeight = 371
ClientWidth = 524
object DescriptionGroupBox: TGroupBox
AnchorSideLeft.Control = DescriptionPage
AnchorSideTop.Control = DescriptionPage
AnchorSideRight.Control = DescriptionPage
AnchorSideRight.Side = asrBottom
Left = 6
Height = 96
Top = 6
Width = 512
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
Caption = 'Description/Abstract'
ClientHeight = 75
ClientWidth = 504
TabOrder = 0
object DescriptionMemo: TMemo
AnchorSideLeft.Control = DescriptionGroupBox
AnchorSideTop.Control = DescriptionGroupBox
AnchorSideRight.Control = DescriptionGroupBox
AnchorSideBottom.Control = DescriptionGroupBox
Left = 6
Height = 63
Top = 6
Width = 492
Align = alClient
BorderSpacing.Around = 6
ScrollBars = ssAutoBoth
TabOrder = 0
end
end
object AuthorGroupBox: TGroupBox
AnchorSideLeft.Control = DescriptionPage
AnchorSideTop.Control = DescriptionGroupBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DescriptionPage
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 60
Top = 108
Width = 512
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Author:'
ClientHeight = 39
ClientWidth = 504
TabOrder = 1
object AuthorEdit: TEdit
AnchorSideBottom.Control = AuthorGroupBox
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 27
Top = 6
Width = 492
Align = alTop
BorderSpacing.Around = 6
TabOrder = 0
end
end
object LicenseGroupBox: TGroupBox
AnchorSideLeft.Control = DescriptionPage
AnchorSideTop.Control = AuthorGroupBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DescriptionPage
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = VersionGroupBox
Left = 6
Height = 85
Top = 174
Width = 512
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Caption = 'License:'
ClientHeight = 64
ClientWidth = 504
TabOrder = 2
object LicenseMemo: TMemo
AnchorSideLeft.Control = LicenseGroupBox
AnchorSideTop.Control = LicenseGroupBox
AnchorSideRight.Control = LicenseGroupBox
AnchorSideBottom.Control = LicenseGroupBox
Left = 6
Height = 52
Top = 6
Width = 492
Align = alClient
BorderSpacing.Around = 6
ScrollBars = ssAutoBoth
TabOrder = 0
end
end
object VersionGroupBox: TGroupBox
AnchorSideLeft.Control = DescriptionPage
AnchorSideTop.Control = LicenseGroupBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DescriptionPage
AnchorSideBottom.Control = DescriptionPage
Left = 6
Height = 100
Top = 265
Width = 512
Align = alBottom
BorderSpacing.Around = 6
Caption = 'Version'
ClientHeight = 79
ClientWidth = 504
TabOrder = 3
object VersionMajorLabel: TLabel
Left = 6
Height = 18
Top = 3
Width = 39
Caption = 'Major'
ParentColor = False
end
object VersionMinorLabel: TLabel
Left = 110
Height = 18
Top = 3
Width = 39
Caption = 'Minor'
ParentColor = False
end
object VersionReleaseLabel: TLabel
Left = 214
Height = 18
Top = 3
Width = 52
Caption = 'Release'
ParentColor = False
end
object VersionBuildLabel: TLabel
Left = 318
Height = 18
Top = 3
Width = 91
Caption = 'Build Number'
ParentColor = False
end
object VersionMajorSpinEdit: TSpinEdit
AnchorSideLeft.Control = VersionGroupBox
Left = 6
Height = 27
Top = 20
Width = 68
BorderSpacing.Left = 6
MaxValue = 9999
TabOrder = 0
end
object VersionMinorSpinEdit: TSpinEdit
Left = 110
Height = 27
Top = 20
Width = 68
MaxValue = 9999
TabOrder = 1
end
object VersionReleaseSpinEdit: TSpinEdit
Left = 214
Height = 27
Top = 20
Width = 68
MaxValue = 9999
TabOrder = 2
end
object VersionBuildSpinEdit: TSpinEdit
Left = 318
Height = 27
Top = 20
Width = 68
MaxValue = 9999
TabOrder = 3
end
end
end
object IDEPage: TTabSheet
Caption = 'IDE Integration'
ClientHeight = 371
ClientWidth = 524
object PkgTypeRadioGroup: TRadioGroup
AnchorSideLeft.Control = IDEPage
AnchorSideTop.Control = IDEPage
AnchorSideRight.Control = IDEPage
AnchorSideRight.Side = asrBottom
Left = 6
Height = 116
Top = 6
Width = 514
Anchors = [akTop, akLeft, akRight]
AutoFill = True
BorderSpacing.Around = 6
Caption = 'PackageType'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 95
ClientWidth = 506
ItemIndex = 2
Items.Strings = (
'Designtime only'
'Runtime only'
'Designtime and Runtime'
)
OnClick = PkgTypeRadioGroupClick
TabOrder = 0
end
object UpdateRadioGroup: TRadioGroup
AnchorSideLeft.Control = IDEPage
AnchorSideTop.Control = PkgTypeRadioGroup
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = IDEPage
AnchorSideRight.Side = asrBottom
Left = 6
Height = 116
Top = 128
Width = 514
Anchors = [akTop, akLeft, akRight]
AutoFill = True
BorderSpacing.Around = 6
Caption = 'Update/Rebuild'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 95
ClientWidth = 506
ItemIndex = 0
Items.Strings = (
'Automatically rebuild as needed'
'Auto rebuild when rebuilding all'
'Manual compilation (never automatically)'
)
TabOrder = 1
end
object LazDocGroupBox: TGroupBox
AnchorSideLeft.Control = IDEPage
AnchorSideTop.Control = UpdateRadioGroup
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = IDEPage
AnchorSideRight.Side = asrBottom
Left = 6
Height = 58
Top = 250
Width = 514
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'LazDoc - Lazarus documentation'
ClientHeight = 37
ClientWidth = 506
TabOrder = 2
object LazDocPathEdit: TEdit
AnchorSideLeft.Control = LazDocGroupBox
AnchorSideTop.Control = LazDocGroupBox
Left = 6
Height = 27
Top = 6
Width = 418
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
TabOrder = 0
end
end
end
object ProvidesPage: TTabSheet
Caption = 'Provides'
ClientHeight = 375
ClientWidth = 526
object ProvidesGroupBox: TGroupBox
AnchorSideLeft.Control = ProvidesPage
AnchorSideTop.Control = ProvidesPage
AnchorSideRight.Control = ProvidesPage
AnchorSideBottom.Control = ProvidesPage
Left = 6
Height = 363
Top = 6
Width = 514
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Caption = 'This package provides the same as the following packages:'
ClientHeight = 363
ClientWidth = 514
TabOrder = 0
object ProvidesMemo: TMemo
AnchorSideLeft.Control = ProvidesGroupBox
AnchorSideTop.Control = ProvidesGroupBox
AnchorSideRight.Control = ProvidesGroupBox
AnchorSideBottom.Control = ProvidesGroupBox
Left = 6
Height = 347
Top = 6
Width = 498
Align = alClient
BorderSpacing.Around = 6
ScrollBars = ssAutoVertical
TabOrder = 0
end
end
end
object i18n: TTabSheet
Caption = 'i18n'
ClientHeight = 387
ClientWidth = 524
object I18NGroupBox: TGroupBox
AnchorSideLeft.Control = i18n
AnchorSideTop.Control = EnableI18NCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = i18n
AnchorSideRight.Side = asrBottom
Left = 6
Height = 74
Top = 33
Width = 512
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
Caption = 'i18n Options'
ClientHeight = 74
ClientWidth = 512
TabOrder = 0
object PoOutDirLabel: TLabel
AnchorSideLeft.Control = I18NGroupBox
AnchorSideTop.Control = I18NGroupBox
Left = 6
Height = 16
Top = 6
Width = 126
BorderSpacing.Around = 6
Caption = 'PO Output Directory:'
ParentColor = False
end
object POOutDirEdit: TEdit
AnchorSideLeft.Control = I18NGroupBox
AnchorSideTop.Control = PoOutDirLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = POOutDirButton
Left = 6
Height = 21
Top = 28
Width = 415
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
TabOrder = 0
end
object POOutDirButton: TButton
AnchorSideTop.Control = POOutDirEdit
AnchorSideRight.Control = I18NGroupBox
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = POOutDirEdit
AnchorSideBottom.Side = asrBottom
Left = 427
Height = 21
Top = 28
Width = 75
Anchors = [akTop, akRight, akBottom]
AutoSize = True
BorderSpacing.Right = 6
Caption = '...'
OnClick = POOutputDirectoryButtonClick
TabOrder = 1
end
end
object EnableI18NCheckBox: TCheckBox
Left = 6
Height = 20
Top = 7
Width = 96
Caption = 'Enable i18n'
OnChange = EnableI18NCheckBoxChange
TabOrder = 1
end
end
end
object ButtonPanel1: TButtonPanel
Left = 6
Height = 34
Top = 410
Width = 516
OKButton.Name = 'OKButton'
OKButton.Caption = '&OK'
OKButton.OnClick = OkButtonClick
HelpButton.Name = 'HelpButton'
HelpButton.Caption = '&Help'
HelpButton.Enabled = False
CloseButton.Name = 'CloseButton'
CloseButton.Caption = '&Close'
CloseButton.Enabled = False
CancelButton.Name = 'CancelButton'
CancelButton.Caption = 'Cancel'
TabOrder = 1
ShowButtons = [pbOK, pbCancel]
ShowBevel = False
end
end

View File

@ -1,630 +0,0 @@
{ $Id$ }
{
/***************************************************************************
pkgoptionsdlg.pas
-----------------
***************************************************************************/
***************************************************************************
* *
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Author: Mattias Gaertner
Abstract:
TPackageOptionsDialog is the form for the general options of a package.
}
unit PkgOptionsDlg;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LCLProc, Forms, Controls, Buttons,
ExtCtrls, ComCtrls, StdCtrls, Spin, Dialogs, PathEditorDlg,
IDEProcs, IDEWindowIntf, IDEDialogs, MacroIntf, PackageIntf,
LazarusIDEStrConsts,
BrokenDependenciesDlg, PackageDefs, PackageSystem, CompilerOptions,
ButtonPanel;
type
{ TPackageOptionsDialog }
TPackageOptionsDialog = class(TForm)
AdditionalInfoButton: TButton;
AddPackageUnitToProjectCheckBox: TCheckBox;
ButtonPanel1: TButtonPanel;
EnableI18NCheckBox: TCheckBox;
ProjectGroupBox: TGroupBox;
I18NGroupBox: TGroupBox;
ProvidesGroupBox: TGroupBox;
LazDocGroupBox: TGroupBox;
ProvidesMemo: TMemo;
i18n: TTabSheet;
POOutDirButton: TButton;
POOutDirEdit: TEdit;
PkgTypeRadioGroup: TRadioGroup;
LazDocPathEdit: TEdit;
UpdateRadioGroup: TRadioGroup;
VersionReleaseLabel: TLabel;
VersionReleaseSpinEdit: TSpinEdit;
VersionMinorLabel: TLabel;
VersionMajorSpinEdit: TSpinEdit;
VersionMajorLabel: TLabel;
VersionGroupBox: TGroupBox;
DescriptionGroupBox: TGroupBox;
AuthorGroupBox: TGroupBox;
AddPathsGroupBox: TGroupBox;
CopyrightEdit: TEdit;
CopyrightLabel: TLabel;
DescriptionEdit: TEdit;
LicenseGroupBox: TGroupBox;
DescriptionLabel: TLabel;
LicenseMemo: TMemo;
IncludePathEdit: TEdit;
LinkerOptionsLabel: TLabel;
CustomOptionsLabel: TLabel;
LinkerOptionsMemo: TMemo;
CustomOptionsMemo: TMemo;
DescriptionMemo: TMemo;
ObjectPathEdit: TEdit;
LibraryPathEdit: TEdit;
AddOptionsGroupBox: TGroupBox;
AuthorEdit: TEdit;
UnitPathLabel: TLabel;
Notebook: TPageControl;
UnitPathEdit: TEdit;
PoOutDirLabel: TLabel;
IncludePathLabel: TLabel;
ObjectPathLabel: TLabel;
LibraryPathLabel: TLabel;
UsagePage: TTabSheet;
DescriptionPage: TTabSheet;
IDEPage: TTabSheet;
ProvidesPage: TTabSheet;
VersionBuildLabel: TLabel;
VersionMinorSpinEdit: TSpinEdit;
VersionBuildSpinEdit: TSpinEdit;
UnitPathButton: TPathEditorButton;
IncludePathButton: TPathEditorButton;
ObjectPathButton: TPathEditorButton;
LibraryPathButton: TPathEditorButton;
LazDocPathButton: TPathEditorButton;
procedure EnableI18NCheckBoxChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure OkButtonClick(Sender: TObject);
procedure POOutputDirectoryButtonClick(Sender: TObject);
procedure PackageOptionsDialogClose(Sender: TObject;
var CloseAction: TCloseAction);
procedure PathEditBtnClick(Sender: TObject);
procedure PathEditBtnExecuted(Sender: TObject);
procedure PkgTypeRadioGroupClick(Sender: TObject);
private
FLazPackage: TLazPackage;
procedure SetLazPackage(const AValue: TLazPackage);
procedure SetupComponents;
procedure SetupUsagePage;
procedure SetupIDEPage;
procedure ReadOptionsFromPackage;
procedure ReadPkgTypeFromPackage;
function GetEditForPathButton(AButton: TPathEditorButton): TEdit;
function ShowMsgPackageTypeMustBeDesign: Boolean;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
public
property LazPackage: TLazPackage read FLazPackage write SetLazPackage;
end;
function ShowPackageOptionsDlg(APackage: TLazPackage): TModalResult;
var
PackageOptionsDialog: TPackageOptionsDialog;
implementation
{$R *.lfm}
uses
Math;
function ShowPackageOptionsDlg(APackage: TLazPackage): TModalResult;
var
PkgOptsDlg: TPackageOptionsDialog;
begin
PkgOptsDlg:=TPackageOptionsDialog.Create(nil);
PkgOptsDlg.LazPackage:=APackage;
Result:=PkgOptsDlg.ShowModal;
PkgOptsDlg.Free;
end;
{ TPackageOptionsDialog }
procedure TPackageOptionsDialog.PathEditBtnClick(Sender: TObject);
var
AButton: TPathEditorButton;
OldPath: String;
AnEdit: TEdit;
Templates: String;
begin
if not (Sender is TPathEditorButton) then exit;
AButton:=TPathEditorButton(Sender);
AnEdit:=GetEditForPathButton(AButton);
OldPath:=AnEdit.Text;
if AButton=UnitPathButton then begin
Templates:=SetDirSeparators(
'$(PkgOutDir)'
+'$(LazarusDir)/lcl/units/$(TargetCPU)-$(TargetOS)'
+';$(LazarusDir)/lcl/units/$(TargetCPU)-$(TargetOS)/$(LCLWidgetType)'
+';$(LazarusDir)/components/codetools/units/$(TargetCPU)-$(TargetOS)'
+';$(LazarusDir)/components/custom'
+';$(LazarusDir)/packager/units/$(TargetCPU)-$(TargetOS)'
);
end
else if AButton=IncludePathButton then begin
Templates:='include';
end else
if AButton=ObjectPathButton then begin
Templates:='objects';
end else
if AButton=LibraryPathButton then begin
Templates:='';
end else
if AButton=LazDocPathButton then begin
Templates:='docs';
end;
AButton.CurrentPathEditor.Path:=OldPath;
AButton.CurrentPathEditor.Templates:=SetDirSeparators(Templates);
end;
procedure TPackageOptionsDialog.PathEditBtnExecuted(Sender: TObject);
var
AButton: TPathEditorButton;
NewPath: String;
AnEdit: TEdit;
OldPath: String;
CurDir: string;
StartPos: Integer;
DlgResult: TModalResult;
OldStartPos: LongInt;
begin
if not (Sender is TPathEditorButton) then exit;
AButton:=TPathEditorButton(Sender);
if AButton.CurrentPathEditor.ModalResult<>mrOk then exit;
NewPath:=AButton.CurrentPathEditor.Path;
AnEdit:=GetEditForPathButton(AButton);
OldPath:=AnEdit.Text;
if OldPath<>NewPath then begin
// check NewPath
StartPos:=1;
repeat
OldStartPos:=StartPos;
CurDir:=GetNextDirectoryInSearchPath(NewPath,StartPos);
if CurDir<>'' then begin
IDEMacros.SubstituteMacros(CurDir);
LazPackage.LongenFilename(CurDir);
if not DirPathExists(CurDir) then begin
DlgResult:=QuestionDlg(lisEnvOptDlgDirectoryNotFound,
Format(lisDirectoryNotFound, ['"', CurDir, '"']),
mtError, [mrIgnore, mrYes, lisRemoveFromSearchPath, mrCancel], 0);
case DlgResult of
mrIgnore: ;
mrYes:
begin
// remove directory from search path
NewPath:=copy(NewPath,1,OldStartPos-1)
+copy(NewPath,StartPos,length(NewPath));
StartPos:=OldStartPos;
end;
else
// undo
NewPath:=OldPath;
break;
end;
end;
end;
until StartPos>length(NewPath);
end;
AnEdit.Text:=NewPath;
end;
procedure TPackageOptionsDialog.PkgTypeRadioGroupClick(Sender: TObject);
begin
if LazPackage=nil then exit;
if (PkgTypeRadioGroup.ItemIndex=1) and (LazPackage.PackageType<>lptRunTime)
then begin
// user sets to runtime only
if (LazPackage.AutoInstall<>pitNope) then begin
ShowMsgPackageTypeMustBeDesign;
end;
end;
end;
procedure TPackageOptionsDialog.EnableI18NCheckBoxChange(Sender: TObject);
begin
I18NGroupBox.Enabled := EnableI18NCheckBox.Checked;
end;
procedure TPackageOptionsDialog.FormCreate(Sender: TObject);
begin
NoteBook.PageIndex := 0;
end;
procedure TPackageOptionsDialog.OkButtonClick(Sender: TObject);
var
NewPackageType: TLazPackageType;
NewVersion: TPkgVersion;
BrokenDependencies: TFPList;
RenameDependencies: Boolean;
MsgResult: TModalResult;
begin
if LazPackage.ReadOnly then exit;
// check changes
// package type
case PkgTypeRadioGroup.ItemIndex of
0: NewPackageType:=lptDesignTime;
1: NewPackageType:=lptRunTime;
else NewPackageType:=lptRunAndDesignTime;
end;
if NewPackageType<>LazPackage.PackageType then begin
if (NewPackageType=lptRunTime) and (LazPackage.AutoInstall<>pitNope) then
begin
if ShowMsgPackageTypeMustBeDesign then exit;
end;
end;
// version
NewVersion:=TPkgVersion.Create;
try
NewVersion.Major:=RoundToInt(VersionMajorSpinEdit.Value);
NewVersion.Minor:=RoundToInt(VersionMinorSpinEdit.Value);
NewVersion.Release:=RoundToInt(VersionReleaseSpinEdit.Value);
NewVersion.Build:=RoundToInt(VersionBuildSpinEdit.Value);
// check for broken dependencies
BrokenDependencies:=PackageGraph.GetBrokenDependenciesWhenChangingPkgID(
LazPackage,LazPackage.Name,NewVersion);
RenameDependencies:=false;
try
if BrokenDependencies.Count>0 then begin
MsgResult:=ShowBrokenDependencies(BrokenDependencies,
DefaultBrokenDepButtons);
if MsgResult=mrYes then
RenameDependencies:=true
else if MsgResult=mrNo then
RenameDependencies:=false
else
exit;
end;
finally
BrokenDependencies.Free;
end;
PackageGraph.ChangePackageID(LazPackage,LazPackage.Name,NewVersion,
RenameDependencies,true);
finally
NewVersion.Free;
end;
// Description page
LazPackage.Description:=DescriptionMemo.Text;
LazPackage.Author:=AuthorEdit.Text;
LazPackage.License:=LicenseMemo.Text;
// Usage page
LazPackage.PackageType:=NewPackageType;
with LazPackage.UsageOptions do begin
UnitPath:=TrimSearchPath(UnitPathEdit.Text,'');
IncludePath:=TrimSearchPath(IncludePathEdit.Text,'');
ObjectPath:=TrimSearchPath(ObjectPathEdit.Text,'');
LibraryPath:=TrimSearchPath(LibraryPathEdit.Text,'');
LinkerOptions:=LinkerOptionsMemo.Text;
CustomOptions:=CustomOptionsMemo.Text;
end;
LazPackage.AddToProjectUsesSection:=AddPackageUnitToProjectCheckBox.Checked;
// IDE integration page
case UpdateRadioGroup.ItemIndex of
2: LazPackage.AutoUpdate:=pupManually;
1: LazPackage.AutoUpdate:=pupOnRebuildingAll;
else LazPackage.AutoUpdate:=pupAsNeeded;
end;
LazPackage.LazDocPaths:=LazDocPathEdit.Text;
// Provides page
LazPackage.Provides:=ProvidesMemo.Lines;
// i18n
LazPackage.EnableI18N := EnableI18NCheckBox.Checked;
LazPackage.POOutputDirectory:=POOutDirEdit.Text;
ModalResult:=mrOk;
end;
procedure TPackageOptionsDialog.POOutputDirectoryButtonClick(Sender: TObject);
var
NewDirectory: string;
begin
NewDirectory:=LazSelectDirectory(lisPOChoosePoFileDirectory,
LazPackage.Directory);
if NewDirectory='' then exit;
LazPackage.ShortenFilename(NewDirectory,true);
POOutDirEdit.Text:=NewDirectory;
end;
procedure TPackageOptionsDialog.PackageOptionsDialogClose(Sender: TObject;
var CloseAction: TCloseAction);
begin
IDEDialogLayoutList.SaveLayout(Self);
end;
procedure TPackageOptionsDialog.SetLazPackage(const AValue: TLazPackage);
begin
if FLazPackage=AValue then exit;
FLazPackage:=AValue;
ReadOptionsFromPackage;
end;
procedure TPackageOptionsDialog.SetupComponents;
begin
Notebook.Page[0].Caption:=lisPckOptsUsage;
Notebook.Page[1].Caption:=lisCodeHelpDescrTag;
Notebook.Page[2].Caption:=lisPckOptsIDEIntegration;
Notebook.Page[3].Caption:=lisPckOptsProvides;
Notebook.Page[4].Caption:=dlgPOI18n;
ButtonPanel1.OKButton.Caption:=lisOk;
ButtonPanel1.CancelButton.Caption:=dlgCancel;
SetupUsagePage;
SetupIDEPage;
//Description page
DescriptionGroupBox.Caption:=lisPckOptsDescriptionAbstract;
AuthorGroupBox.Caption:=lisPckOptsAuthor;
LicenseGroupBox.Caption:=lisPckOptsLicense;
VersionGroupBox.Caption:=lisVersion;
VersionMajorLabel.Caption:=lisPckOptsMajor;
VersionMinorLabel.Caption:=lisPckOptsMinor;
VersionReleaseLabel.Caption:=lisPckOptsRelease;
VersionBuildLabel.Caption:=lisBuildNumber;
//Provides page
ProvidesGroupBox.Caption:=lisPckOptsThisPackageProvidesTheSameAsTheFollowingPackages;
//i18n page
EnableI18NCheckBox.Caption:=rsEnableI18n;
I18NGroupBox.Caption:=rsI18nOptions;
PoOutDirlabel.Caption:=rsPOOutputDirectory;
end;
procedure TPackageOptionsDialog.SetupIDEPage;
begin
// lazdoc
PkgTypeRadioGroup.Caption:=lisPckOptsPackageType;
PkgTypeRadioGroup.Items[0]:=lisPckOptsDesigntimeOnly;
PkgTypeRadioGroup.Items[1]:=lisPckOptsRuntimeOnly;
PkgTypeRadioGroup.Items[2]:=lisPckOptsDesigntimeAndRuntime;
UpdateRadioGroup.Caption:=lisPckOptsUpdateRebuild;
UpdateRadioGroup.Items[0]:=lisPckOptsAutomaticallyRebuildAsNeeded;
UpdateRadioGroup.Items[1]:=lisPckOptsAutoRebuildWhenRebuildingAll;
UpdateRadioGroup.Items[2]:=lisPckOptsManualCompilationNeverAutomatically;
LazDocGroupBox.Caption:=lisPckOptsLazDocLazarusDocumentation;
LazDocPathButton:=TPathEditorButton.Create(Self);
with LazDocPathButton do begin
Name:='LazDocPathButton';
Caption:='...';
AutoSize:=true;
Anchors:=[akRight];
AnchorParallel(akRight,6,LazDocGroupBox);
AnchorParallel(akTop,0,LazDocPathEdit);
AnchorParallel(akBottom,0,LazDocPathEdit);
OnClick:=@PathEditBtnClick;
OnExecuted:=@PathEditBtnExecuted;
Parent:=LazDocGroupBox;
end;
LazDocPathEdit.AnchorToNeighbour(akRight,0,LazDocPathButton);
end;
procedure TPackageOptionsDialog.SetupUsagePage;
begin
// Usage page
AddPathsGroupBox.Caption:=lisPckOptsAddPathsToDependentPackagesProjects;
UnitPathLabel.Caption:=lisPkgFileTypeUnit;
IncludePathLabel.Caption:=lisPckOptsInclude;
ObjectPathLabel.Caption:=lisPckOptsObject;
LibraryPathLabel.Caption:=lisPckOptsLibrary;
AddOptionsGroupBox.Caption:=lisPckOptsAddOptionsToDependentPackagesAndProjects;
LinkerOptionsLabel.Caption:=lisPckOptsLinker;
CustomOptionsLabel.Caption:=lisPckOptsCustom;
UnitPathButton:=TPathEditorButton.Create(Self);
with UnitPathButton do begin
Name:='UnitPathButton';
Parent:=AddPathsGroupBox;
Caption:='...';
AutoSize:=true;
Anchors:=[akRight];
AnchorParallel(akRight,6,AddPathsGroupBox);
AnchorParallel(akTop,0,UnitPathEdit);
AnchorParallel(akBottom,0,UnitPathEdit);
OnClick:=@PathEditBtnClick;
OnExecuted:=@PathEditBtnExecuted;
end;
IncludePathButton:=TPathEditorButton.Create(Self);
with IncludePathButton do begin
Name:='IncludePathButton';
Parent:=AddPathsGroupBox;
Caption:='...';
AutoSize:=true;
Anchors:=[akRight];
AnchorParallel(akRight,6,AddPathsGroupBox);
AnchorParallel(akTop,0,IncludePathEdit);
AnchorParallel(akBottom,0,IncludePathEdit);
OnClick:=@PathEditBtnClick;
OnExecuted:=@PathEditBtnExecuted;
end;
ObjectPathButton:=TPathEditorButton.Create(Self);
with ObjectPathButton do begin
Name:='ObjectPathButton';
Parent:=AddPathsGroupBox;
Caption:='...';
AutoSize:=true;
Anchors:=[akRight];
AnchorParallel(akRight,6,AddPathsGroupBox);
AnchorParallel(akTop,0,ObjectPathEdit);
AnchorParallel(akBottom,0,ObjectPathEdit);
OnClick:=@PathEditBtnClick;
OnExecuted:=@PathEditBtnExecuted;
end;
LibraryPathButton:=TPathEditorButton.Create(Self);
with LibraryPathButton do begin
Name:='LibraryPathButton';
Parent:=AddPathsGroupBox;
Caption:='...';
AutoSize:=true;
Anchors:=[akRight];
AnchorParallel(akRight,6,AddPathsGroupBox);
AnchorParallel(akTop,0,LibraryPathEdit);
AnchorParallel(akBottom,0,LibraryPathEdit);
OnClick:=@PathEditBtnClick;
OnExecuted:=@PathEditBtnExecuted;
end;
ProjectGroupBox.Caption:=dlgEnvProject;
AddPackageUnitToProjectCheckBox.Caption:=podAddPackageUnitToUsesSection;
end;
procedure TPackageOptionsDialog.ReadOptionsFromPackage;
begin
if LazPackage=nil then exit;
ButtonPanel1.OKButton.Enabled:=not LazPackage.ReadOnly;
// Description page
DescriptionMemo.Text:=LazPackage.Description;
AuthorEdit.Text:=LazPackage.Author;
LicenseMemo.Text:=LazPackage.License;
VersionMajorSpinEdit.Value:=LazPackage.Version.Major;
VersionMinorSpinEdit.Value:=LazPackage.Version.Minor;
VersionReleaseSpinEdit.Value:=LazPackage.Version.Release;
VersionBuildSpinEdit.Value:=LazPackage.Version.Build;
// Usage page
ReadPkgTypeFromPackage;
case LazPackage.AutoUpdate of
pupAsNeeded: UpdateRadioGroup.ItemIndex:=0;
pupOnRebuildingAll: UpdateRadioGroup.ItemIndex:=1;
else UpdateRadioGroup.ItemIndex:=2;
end;
with LazPackage.UsageOptions do begin
UnitPathEdit.Text:=UnitPath;
IncludePathEdit.Text:=IncludePath;
ObjectPathEdit.Text:=ObjectPath;
LibraryPathEdit.Text:=LibraryPath;
LinkerOptionsMemo.Text:=LinkerOptions;
CustomOptionsMemo.Text:=CustomOptions;
end;
AddPackageUnitToProjectCheckBox.Checked:=LazPackage.AddToProjectUsesSection;
// IDE integration
LazDocPathEdit.Text:=LazPackage.LazDocPaths;
// Provides
ProvidesMemo.Lines.Assign(LazPackage.Provides);
// i18n
EnableI18NCheckBox.Checked := LazPackage.EnableI18N;
I18NGroupBox.Enabled := LazPackage.EnableI18N;
POOutDirEdit.Text:=LazPackage.POOutputDirectory;
end;
procedure TPackageOptionsDialog.ReadPkgTypeFromPackage;
begin
case LazPackage.PackageType of
lptDesignTime: PkgTypeRadioGroup.ItemIndex:=0;
lptRunTime: PkgTypeRadioGroup.ItemIndex:=1;
else PkgTypeRadioGroup.ItemIndex:=2;
end;
end;
function TPackageOptionsDialog.GetEditForPathButton(AButton: TPathEditorButton
): TEdit;
begin
if AButton=UnitPathButton then
Result:=UnitPathEdit
else if AButton=IncludePathButton then
Result:=IncludePathEdit
else if AButton=ObjectPathButton then
Result:=ObjectPathEdit
else if AButton=LibraryPathButton then
Result:=LibraryPathEdit
else if AButton=LazDocPathButton then
Result:=LazDocPathEdit
else
Result:=nil;
end;
function TPackageOptionsDialog.ShowMsgPackageTypeMustBeDesign: Boolean;
begin
if MessageDlg(lisPckOptsInvalidPackageType,
Format(lisPckOptsThePackageHasTheAutoInstallFlagThisMeans, ['"',
LazPackage.IDAsString, '"', #13, #13]),
mtWarning,[mbIgnore,mbCancel],0) <>mrIgnore
then begin
Result:=true;
ReadPkgTypeFromPackage;
end else
Result:=false;
end;
constructor TPackageOptionsDialog.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
Name:='PackageOptionsDialog';
Caption:=lisPckOptsPackageOptions;
SetupComponents;
Position:=poScreenCenter;
IDEDialogLayoutList.ApplyLayout(Self,450,400);
end;
destructor TPackageOptionsDialog.Destroy;
begin
inherited Destroy;
end;
end.