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