mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 22:39:11 +02:00
Packager: Get online package list while in AddPkgDependencyDialog.
git-svn-id: trunk@63982 -
This commit is contained in:
parent
3376030a0e
commit
7a95787973
@ -11,15 +11,16 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
Constraints.MinWidth = 300
|
Constraints.MinWidth = 300
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
LCLVersion = '1.9.0.0'
|
OnDestroy = FormDestroy
|
||||||
|
LCLVersion = '2.1.0.0'
|
||||||
object DependPkgNameLabel: TLabel
|
object DependPkgNameLabel: TLabel
|
||||||
AnchorSideTop.Control = DependPkgNameFilter
|
AnchorSideTop.Control = DependPkgNameFilter
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = DependPkgNameFilter
|
AnchorSideRight.Control = DependPkgNameFilter
|
||||||
Left = 34
|
Left = 38
|
||||||
Height = 15
|
Height = 18
|
||||||
Top = 11
|
Top = 14
|
||||||
Width = 121
|
Width = 141
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Top = 3
|
BorderSpacing.Top = 3
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
@ -33,15 +34,15 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 161
|
Left = 185
|
||||||
Height = 23
|
Height = 32
|
||||||
Top = 7
|
Top = 7
|
||||||
Width = 280
|
Width = 256
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
NumGlyphs = 1
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Top = 3
|
BorderSpacing.Top = 3
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
|
NumGlyphs = 1
|
||||||
MaxLength = 0
|
MaxLength = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
FilteredListbox = DependPkgNameListBox
|
FilteredListbox = DependPkgNameListBox
|
||||||
@ -53,10 +54,10 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
AnchorSideRight.Control = DependPkgNameFilter
|
AnchorSideRight.Control = DependPkgNameFilter
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = DependMinVersionEdit
|
AnchorSideBottom.Control = DependMinVersionEdit
|
||||||
Left = 161
|
Left = 185
|
||||||
Height = 239
|
Height = 205
|
||||||
Top = 62
|
Top = 74
|
||||||
Width = 280
|
Width = 256
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Bottom = 6
|
BorderSpacing.Bottom = 6
|
||||||
@ -65,7 +66,6 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
OnDrawItem = DependPkgNameListBoxDrawItem
|
OnDrawItem = DependPkgNameListBoxDrawItem
|
||||||
OnSelectionChange = DependPkgNameListBoxSelectionChange
|
OnSelectionChange = DependPkgNameListBoxSelectionChange
|
||||||
Options = []
|
Options = []
|
||||||
ScrollWidth = 271
|
|
||||||
Style = lbOwnerDrawVariable
|
Style = lbOwnerDrawVariable
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
end
|
end
|
||||||
@ -74,10 +74,10 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
AnchorSideRight.Control = DependPkgNameListBox
|
AnchorSideRight.Control = DependPkgNameListBox
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = DependMaxVersionEdit
|
AnchorSideBottom.Control = DependMaxVersionEdit
|
||||||
Left = 161
|
Left = 185
|
||||||
Height = 23
|
Height = 32
|
||||||
Top = 307
|
Top = 285
|
||||||
Width = 280
|
Width = 256
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
@ -90,10 +90,10 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
AnchorSideRight.Control = DependPkgNameListBox
|
AnchorSideRight.Control = DependPkgNameListBox
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = BP
|
AnchorSideBottom.Control = BP
|
||||||
Left = 161
|
Left = 185
|
||||||
Height = 23
|
Height = 32
|
||||||
Top = 333
|
Top = 320
|
||||||
Width = 280
|
Width = 256
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Top = 3
|
BorderSpacing.Top = 3
|
||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
@ -104,9 +104,9 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
AnchorSideTop.Control = DependMinVersionEdit
|
AnchorSideTop.Control = DependMinVersionEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 24
|
Left = 24
|
||||||
Height = 15
|
Height = 18
|
||||||
Top = 311
|
Top = 292
|
||||||
Width = 128
|
Width = 150
|
||||||
BorderSpacing.Left = 24
|
BorderSpacing.Left = 24
|
||||||
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
||||||
BorderSpacing.CellAlignVertical = ccaCenter
|
BorderSpacing.CellAlignVertical = ccaCenter
|
||||||
@ -118,9 +118,9 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
AnchorSideTop.Control = DependMaxVersionEdit
|
AnchorSideTop.Control = DependMaxVersionEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 24
|
Left = 24
|
||||||
Height = 15
|
Height = 18
|
||||||
Top = 337
|
Top = 327
|
||||||
Width = 129
|
Width = 153
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
BorderSpacing.Left = 24
|
BorderSpacing.Left = 24
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
@ -131,8 +131,8 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
end
|
end
|
||||||
object BP: TButtonPanel
|
object BP: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 33
|
Height = 37
|
||||||
Top = 362
|
Top = 358
|
||||||
Width = 437
|
Width = 437
|
||||||
OKButton.Name = 'OKButton'
|
OKButton.Name = 'OKButton'
|
||||||
OKButton.DefaultCaption = True
|
OKButton.DefaultCaption = True
|
||||||
@ -141,7 +141,6 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
HelpButton.DefaultCaption = True
|
HelpButton.DefaultCaption = True
|
||||||
CloseButton.Name = 'CloseButton'
|
CloseButton.Name = 'CloseButton'
|
||||||
CloseButton.Caption = 'Install'
|
CloseButton.Caption = 'Install'
|
||||||
CloseButton.DefaultCaption = False
|
|
||||||
CloseButton.OnClick = CloseButtonClick
|
CloseButton.OnClick = CloseButtonClick
|
||||||
CancelButton.Name = 'CancelButton'
|
CancelButton.Name = 'CancelButton'
|
||||||
CancelButton.DefaultCaption = True
|
CancelButton.DefaultCaption = True
|
||||||
@ -152,23 +151,23 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
AnchorSideLeft.Control = DependPkgNameListBox
|
AnchorSideLeft.Control = DependPkgNameListBox
|
||||||
AnchorSideTop.Control = DependPkgNameFilter
|
AnchorSideTop.Control = DependPkgNameFilter
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 161
|
Left = 185
|
||||||
Height = 19
|
Height = 22
|
||||||
Top = 37
|
Top = 46
|
||||||
Width = 48
|
Width = 60
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Top = 7
|
BorderSpacing.Top = 7
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 19
|
ClientHeight = 22
|
||||||
ClientWidth = 48
|
ClientWidth = 60
|
||||||
Color = 15138790
|
Color = 15138790
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object cbLocalPkg: TCheckBox
|
object cbLocalPkg: TCheckBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 19
|
Height = 22
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 48
|
Width = 60
|
||||||
Caption = 'Local'
|
Caption = 'Local'
|
||||||
Checked = True
|
Checked = True
|
||||||
Color = clDefault
|
Color = clDefault
|
||||||
@ -183,28 +182,25 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = DependPkgNameFilter
|
AnchorSideTop.Control = DependPkgNameFilter
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 216
|
Left = 252
|
||||||
Height = 19
|
Height = 22
|
||||||
Top = 37
|
Top = 46
|
||||||
Width = 55
|
Width = 69
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
BorderSpacing.Left = 7
|
BorderSpacing.Left = 7
|
||||||
BorderSpacing.Top = 7
|
BorderSpacing.Top = 7
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 19
|
ClientHeight = 22
|
||||||
ClientWidth = 55
|
ClientWidth = 69
|
||||||
Color = 14017529
|
Color = 14017529
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object cbOnlinePkg: TCheckBox
|
object cbOnlinePkg: TCheckBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 19
|
Height = 22
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 55
|
Width = 69
|
||||||
Caption = 'Online'
|
Caption = 'Online'
|
||||||
Checked = True
|
|
||||||
OnChange = cbLocalPkgChange
|
|
||||||
State = cbChecked
|
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -212,10 +208,10 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
AnchorSideTop.Control = pnLocalPkg
|
AnchorSideTop.Control = pnLocalPkg
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = DependPkgNameFilter
|
AnchorSideRight.Control = DependPkgNameFilter
|
||||||
Left = 41
|
Left = 46
|
||||||
Height = 15
|
Height = 18
|
||||||
Top = 39
|
Top = 48
|
||||||
Width = 114
|
Width = 133
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
||||||
|
@ -10,6 +10,8 @@ uses
|
|||||||
LCLType, LCLIntf, Forms, Controls, Dialogs, StdCtrls, ButtonPanel, Graphics, ExtCtrls,
|
LCLType, LCLIntf, Forms, Controls, Dialogs, StdCtrls, ButtonPanel, Graphics, ExtCtrls,
|
||||||
// LazControls
|
// LazControls
|
||||||
ListFilterEdit,
|
ListFilterEdit,
|
||||||
|
// LazUtils
|
||||||
|
LazLoggerBase,
|
||||||
// BuildIntf
|
// BuildIntf
|
||||||
PackageIntf, PackageLinkIntf, PackageDependencyIntf,
|
PackageIntf, PackageLinkIntf, PackageDependencyIntf,
|
||||||
// IDEIntf
|
// IDEIntf
|
||||||
@ -38,12 +40,14 @@ type
|
|||||||
pnLocalPkg: TPanel;
|
pnLocalPkg: TPanel;
|
||||||
pnOnlinePkg: TPanel;
|
pnOnlinePkg: TPanel;
|
||||||
procedure cbLocalPkgChange(Sender: TObject);
|
procedure cbLocalPkgChange(Sender: TObject);
|
||||||
|
procedure cbOnlinePkgChange(Sender: TObject);
|
||||||
procedure CloseButtonClick(Sender: TObject);
|
procedure CloseButtonClick(Sender: TObject);
|
||||||
procedure DependPkgNameListBoxDrawItem(Control: TWinControl;
|
procedure DependPkgNameListBoxDrawItem(Control: TWinControl;
|
||||||
Index: Integer; ARect: TRect; State: TOwnerDrawState);
|
Index: Integer; ARect: TRect; State: TOwnerDrawState);
|
||||||
procedure DependPkgNameListBoxSelectionChange(Sender: TObject; {%H-}User: boolean);
|
procedure DependPkgNameListBoxSelectionChange(Sender: TObject; {%H-}User: boolean);
|
||||||
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure FormDestroy(Sender: TObject);
|
||||||
procedure OKButtonClick(Sender: TObject);
|
procedure OKButtonClick(Sender: TObject);
|
||||||
function InstallOnlinePackages: TModalResult;
|
function InstallOnlinePackages: TModalResult;
|
||||||
private
|
private
|
||||||
@ -54,6 +58,7 @@ type
|
|||||||
procedure AddUniquePackagesToList(APackageID: TLazPackageID);
|
procedure AddUniquePackagesToList(APackageID: TLazPackageID);
|
||||||
procedure UpdateAvailableDependencyNames;
|
procedure UpdateAvailableDependencyNames;
|
||||||
function IsInstallButtonVisible: Boolean;
|
function IsInstallButtonVisible: Boolean;
|
||||||
|
procedure PackageListAvailable(Sender: TObject);
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -122,11 +127,24 @@ end;
|
|||||||
|
|
||||||
procedure TAddPkgDependencyDialog.FormCreate(Sender: TObject);
|
procedure TAddPkgDependencyDialog.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
DependPkgTypeLabel.Visible := OPMInterface <> nil;
|
if Assigned(OPMInterface) then
|
||||||
pnLocalPkg.Visible := OPMInterface <> nil;
|
cbOnlinePkg.Checked := OPMInterface.IsPackageListLoaded
|
||||||
pnOnlinePkg.Visible := OPMInterface <> nil;
|
else begin
|
||||||
BP.CloseButton.Visible := False; // CloseButton is now "Install".
|
DependPkgTypeLabel.Visible := False;
|
||||||
|
pnLocalPkg.Visible := False;
|
||||||
|
pnOnlinePkg.Visible := False;
|
||||||
|
end;
|
||||||
|
cbOnlinePkg.OnChange := @cbOnlinePkgChange; // Set handler after setting Checked.
|
||||||
|
BP.CloseButton.Visible := False; // CloseButton is now "Install".
|
||||||
DependPkgNameListBox.ItemHeight := MulDiv(20, Screen.PixelsPerInch, 96);
|
DependPkgNameListBox.ItemHeight := MulDiv(20, Screen.PixelsPerInch, 96);
|
||||||
|
if OPMInterface <> nil then
|
||||||
|
OPMInterface.AddPackageListNotification(@PackageListAvailable);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TAddPkgDependencyDialog.FormDestroy(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if OPMInterface <> nil then
|
||||||
|
OPMInterface.RemovePackageListNotification(@PackageListAvailable);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAddPkgDependencyDialog.DependPkgNameListBoxDrawItem(
|
procedure TAddPkgDependencyDialog.DependPkgNameListBoxDrawItem(
|
||||||
@ -175,6 +193,12 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TAddPkgDependencyDialog.PackageListAvailable(Sender: TObject);
|
||||||
|
begin
|
||||||
|
DebugLn(['TAddPkgDependencyDialog.PackageListAvailable: ', fProjPack.IDAsString]);
|
||||||
|
UpdateAvailableDependencyNames;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TAddPkgDependencyDialog.DependPkgNameListBoxSelectionChange(
|
procedure TAddPkgDependencyDialog.DependPkgNameListBoxSelectionChange(
|
||||||
Sender: TObject; User: boolean);
|
Sender: TObject; User: boolean);
|
||||||
begin
|
begin
|
||||||
@ -187,6 +211,15 @@ begin
|
|||||||
UpdateAvailableDependencyNames;
|
UpdateAvailableDependencyNames;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TAddPkgDependencyDialog.cbOnlinePkgChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Assert(Assigned(OPMInterface), 'TAddPkgDependencyDialog: OPMInterface=Nil.');
|
||||||
|
if (Sender as TCheckBox).Checked and not OPMInterface.IsPackageListLoaded then
|
||||||
|
OPMInterface.GetPackageList // ListBox will be updated later by an event.
|
||||||
|
else
|
||||||
|
UpdateAvailableDependencyNames;
|
||||||
|
end;
|
||||||
|
|
||||||
function TAddPkgDependencyDialog.InstallOnlinePackages: TModalResult;
|
function TAddPkgDependencyDialog.InstallOnlinePackages: TModalResult;
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
@ -216,6 +249,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAddPkgDependencyDialog.CloseButtonClick(Sender: TObject);
|
procedure TAddPkgDependencyDialog.CloseButtonClick(Sender: TObject);
|
||||||
|
// CloseButton is now "Install".
|
||||||
var
|
var
|
||||||
OpmRes: TModalResult;
|
OpmRes: TModalResult;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user