mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-27 21:37:17 +01:00
Packager: Add online packages to the "New Requirement" dialog. Issue #32723, patch from Balázs.
git-svn-id: trunk@56481 -
This commit is contained in:
parent
a7a827f49e
commit
4fab6dcb04
@ -2768,6 +2768,9 @@ resourcestring
|
|||||||
lisFRForwardSearch = 'Forwar&d search';
|
lisFRForwardSearch = 'Forwar&d search';
|
||||||
lisFRBackwardSearch = '&Backward search';
|
lisFRBackwardSearch = '&Backward search';
|
||||||
dlgReplaceAll = 'Replace &All';
|
dlgReplaceAll = 'Replace &All';
|
||||||
|
lisLocalPkg = 'Local packages(%s)';
|
||||||
|
lisOnlinePkg = 'Online packages(%s)';
|
||||||
|
lisPkgInstConf = 'Do you wish to install the following packages from the main repository: ';
|
||||||
|
|
||||||
// IDEOptionDefs
|
// IDEOptionDefs
|
||||||
dlgGetPosition = 'Get position';
|
dlgGetPosition = 'Get position';
|
||||||
|
|||||||
@ -1,23 +1,26 @@
|
|||||||
object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
||||||
Left = 466
|
Left = 466
|
||||||
Height = 373
|
Height = 401
|
||||||
Top = 122
|
Top = 122
|
||||||
Width = 495
|
Width = 449
|
||||||
BorderIcons = [biSystemMenu]
|
BorderIcons = [biSystemMenu]
|
||||||
Caption = 'AddPkgDependencyDialog'
|
Caption = 'AddPkgDependencyDialog'
|
||||||
ClientHeight = 373
|
ClientHeight = 401
|
||||||
ClientWidth = 495
|
ClientWidth = 449
|
||||||
|
Constraints.MinHeight = 250
|
||||||
|
Constraints.MinWidth = 250
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
|
OnCreate = FormCreate
|
||||||
LCLVersion = '1.9.0.0'
|
LCLVersion = '1.9.0.0'
|
||||||
object DependPkgNameLabel: TLabel
|
object DependPkgNameLabel: TLabel
|
||||||
AnchorSideTop.Control = DependPkgNameFilter
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideTop.Side = asrCenter
|
|
||||||
AnchorSideRight.Control = DependPkgNameFilter
|
AnchorSideRight.Control = DependPkgNameFilter
|
||||||
Left = 34
|
Left = 34
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 20
|
Top = 11
|
||||||
Width = 121
|
Width = 121
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
|
BorderSpacing.Top = 3
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
||||||
BorderSpacing.CellAlignVertical = ccaCenter
|
BorderSpacing.CellAlignVertical = ccaCenter
|
||||||
@ -26,15 +29,17 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
end
|
end
|
||||||
object DependPkgNameFilter: TListFilterEdit
|
object DependPkgNameFilter: TListFilterEdit
|
||||||
AnchorSideLeft.Control = DependPkgNameListBox
|
AnchorSideLeft.Control = DependPkgNameListBox
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 161
|
Left = 161
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 16
|
Top = 7
|
||||||
Width = 326
|
Width = 280
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
NumGlyphs = 1
|
NumGlyphs = 1
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 3
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
MaxLength = 0
|
MaxLength = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
@ -48,15 +53,18 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = DependMinVersionEdit
|
AnchorSideBottom.Control = DependMinVersionEdit
|
||||||
Left = 161
|
Left = 161
|
||||||
Height = 227
|
Height = 265
|
||||||
Top = 45
|
Top = 36
|
||||||
Width = 326
|
Width = 280
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Bottom = 6
|
BorderSpacing.Bottom = 6
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
MultiSelect = True
|
MultiSelect = True
|
||||||
|
OnDrawItem = DependPkgNameListBoxDrawItem
|
||||||
|
OnSelectionChange = DependPkgNameListBoxSelectionChange
|
||||||
ScrollWidth = 282
|
ScrollWidth = 282
|
||||||
|
Style = lbOwnerDrawFixed
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object DependMinVersionEdit: TEdit
|
object DependMinVersionEdit: TEdit
|
||||||
@ -66,8 +74,8 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
AnchorSideBottom.Control = DependMaxVersionEdit
|
AnchorSideBottom.Control = DependMaxVersionEdit
|
||||||
Left = 161
|
Left = 161
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 278
|
Top = 307
|
||||||
Width = 326
|
Width = 280
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
@ -79,27 +87,25 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = DependPkgNameListBox
|
AnchorSideRight.Control = DependPkgNameListBox
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = ButtonPanel1
|
AnchorSideBottom.Control = BP
|
||||||
Left = 161
|
Left = 161
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 304
|
Top = 333
|
||||||
Width = 326
|
Width = 280
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
BorderSpacing.Top = 3
|
BorderSpacing.Top = 3
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
Text = 'DependMaxVersionEdit'
|
Text = 'DependMaxVersionEdit'
|
||||||
end
|
end
|
||||||
object DependMinVersionLabel: TLabel
|
object DependMinVersionLabel: TLabel
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = DependMinVersionEdit
|
AnchorSideTop.Control = DependMinVersionEdit
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
AnchorSideRight.Control = DependMinVersionEdit
|
Left = 24
|
||||||
Left = 27
|
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 282
|
Top = 311
|
||||||
Width = 128
|
Width = 128
|
||||||
Anchors = [akTop, akRight]
|
BorderSpacing.Left = 24
|
||||||
BorderSpacing.Right = 6
|
|
||||||
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
||||||
BorderSpacing.CellAlignVertical = ccaCenter
|
BorderSpacing.CellAlignVertical = ccaCenter
|
||||||
Caption = 'DependMinVersionLabel'
|
Caption = 'DependMinVersionLabel'
|
||||||
@ -111,7 +117,7 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 24
|
Left = 24
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 308
|
Top = 337
|
||||||
Width = 129
|
Width = 129
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
BorderSpacing.Left = 24
|
BorderSpacing.Left = 24
|
||||||
@ -121,21 +127,86 @@ object AddPkgDependencyDialog: TAddPkgDependencyDialog
|
|||||||
Caption = 'DependMaxVersionLabel'
|
Caption = 'DependMaxVersionLabel'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object ButtonPanel1: TButtonPanel
|
object BP: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 34
|
Height = 33
|
||||||
Top = 333
|
Top = 362
|
||||||
Width = 483
|
Width = 437
|
||||||
OKButton.Name = 'OKButton'
|
OKButton.Name = 'OKButton'
|
||||||
OKButton.DefaultCaption = True
|
OKButton.DefaultCaption = True
|
||||||
OKButton.OnClick = OKButtonClick
|
OKButton.OnClick = OKButtonClick
|
||||||
HelpButton.Name = 'HelpButton'
|
HelpButton.Name = 'HelpButton'
|
||||||
HelpButton.DefaultCaption = True
|
HelpButton.DefaultCaption = True
|
||||||
CloseButton.Name = 'CloseButton'
|
CloseButton.Name = 'CloseButton'
|
||||||
CloseButton.DefaultCaption = True
|
CloseButton.Caption = 'Install'
|
||||||
|
CloseButton.DefaultCaption = False
|
||||||
|
CloseButton.OnClick = CloseButtonClick
|
||||||
CancelButton.Name = 'CancelButton'
|
CancelButton.Name = 'CancelButton'
|
||||||
CancelButton.DefaultCaption = True
|
CancelButton.DefaultCaption = True
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
ShowButtons = [pbOK, pbCancel, pbHelp]
|
ShowGlyphs = []
|
||||||
|
end
|
||||||
|
object pnLocalPkg: TPanel
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideTop.Control = DependPkgNameListBox
|
||||||
|
AnchorSideTop.Side = asrCenter
|
||||||
|
AnchorSideRight.Control = DependPkgNameListBox
|
||||||
|
Left = 24
|
||||||
|
Height = 19
|
||||||
|
Top = 159
|
||||||
|
Width = 131
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Left = 24
|
||||||
|
BorderSpacing.Right = 6
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 19
|
||||||
|
ClientWidth = 131
|
||||||
|
Color = 15138790
|
||||||
|
ParentColor = False
|
||||||
|
TabOrder = 5
|
||||||
|
object cbLocalPkg: TCheckBox
|
||||||
|
Left = 0
|
||||||
|
Height = 19
|
||||||
|
Top = 0
|
||||||
|
Width = 100
|
||||||
|
Caption = 'Local packages'
|
||||||
|
Checked = True
|
||||||
|
Color = clDefault
|
||||||
|
OnChange = cbLocalPkgChange
|
||||||
|
ParentColor = False
|
||||||
|
State = cbChecked
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object pnOnlinePkg: TPanel
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideTop.Control = pnLocalPkg
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = DependPkgNameListBox
|
||||||
|
Left = 24
|
||||||
|
Height = 19
|
||||||
|
Top = 187
|
||||||
|
Width = 131
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Left = 24
|
||||||
|
BorderSpacing.Top = 9
|
||||||
|
BorderSpacing.Right = 6
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 19
|
||||||
|
ClientWidth = 131
|
||||||
|
Color = 14017529
|
||||||
|
ParentColor = False
|
||||||
|
TabOrder = 6
|
||||||
|
object cbOnlinePkg: TCheckBox
|
||||||
|
Left = 0
|
||||||
|
Height = 19
|
||||||
|
Top = 0
|
||||||
|
Width = 107
|
||||||
|
Caption = 'Online packages'
|
||||||
|
Checked = True
|
||||||
|
OnChange = cbLocalPkgChange
|
||||||
|
State = cbChecked
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -5,13 +5,14 @@ unit AddPkgDependencyDlg;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Laz_AVL_Tree, fgl,
|
Classes, SysUtils, Types, Laz_AVL_Tree, fgl,
|
||||||
// LCL
|
// LCL
|
||||||
Forms, Controls, Dialogs, StdCtrls, ButtonPanel, LCLProc,
|
Forms, Controls, Dialogs, StdCtrls, ButtonPanel, LCLProc, LCLType, Graphics,
|
||||||
|
LCLIntf, ExtCtrls,
|
||||||
// LazControls
|
// LazControls
|
||||||
ListFilterEdit,
|
ListFilterEdit,
|
||||||
// IDEIntf
|
// IDEIntf
|
||||||
IDEWindowIntf, PackageDependencyIntf, PackageIntf, IDEDialogs, IDEImagesIntf,
|
IDEWindowIntf, PackageDependencyIntf, PackageIntf, IDEDialogs, IDEImagesIntf, PackageLinkIntf,
|
||||||
// IDE
|
// IDE
|
||||||
LazarusIDEStrConsts, PackageDefs, PackageSystem, ProjPackCommon, ProjPackChecks;
|
LazarusIDEStrConsts, PackageDefs, PackageSystem, ProjPackCommon, ProjPackChecks;
|
||||||
|
|
||||||
@ -22,7 +23,9 @@ type
|
|||||||
{ TAddPkgDependencyDialog }
|
{ TAddPkgDependencyDialog }
|
||||||
|
|
||||||
TAddPkgDependencyDialog = class(TForm)
|
TAddPkgDependencyDialog = class(TForm)
|
||||||
ButtonPanel1: TButtonPanel;
|
BP: TButtonPanel;
|
||||||
|
cbLocalPkg: TCheckBox;
|
||||||
|
cbOnlinePkg: TCheckBox;
|
||||||
DependMaxVersionEdit: TEdit;
|
DependMaxVersionEdit: TEdit;
|
||||||
DependMaxVersionLabel: TLabel;
|
DependMaxVersionLabel: TLabel;
|
||||||
DependMinVersionEdit: TEdit;
|
DependMinVersionEdit: TEdit;
|
||||||
@ -30,14 +33,25 @@ type
|
|||||||
DependPkgNameFilter: TListFilterEdit;
|
DependPkgNameFilter: TListFilterEdit;
|
||||||
DependPkgNameLabel: TLabel;
|
DependPkgNameLabel: TLabel;
|
||||||
DependPkgNameListBox: TListBox;
|
DependPkgNameListBox: TListBox;
|
||||||
|
pnLocalPkg: TPanel;
|
||||||
|
pnOnlinePkg: TPanel;
|
||||||
|
procedure cbLocalPkgChange(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 FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure OKButtonClick(Sender: TObject);
|
procedure OKButtonClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
|
fUpdating: Boolean;
|
||||||
|
fSL: TStringList;
|
||||||
fPackages: TAVLTree; // tree of TLazPackage or TPackageLink
|
fPackages: TAVLTree; // tree of TLazPackage or TPackageLink
|
||||||
fProjPack: IProjPack;
|
fProjPack: IProjPack;
|
||||||
fResultDependencies: TPkgDependencyList;
|
fResultDependencies: TPkgDependencyList;
|
||||||
procedure AddUniquePackagesToList(APackageID: TLazPackageID);
|
procedure AddUniquePackagesToList(APackageID: TLazPackageID);
|
||||||
procedure UpdateAvailableDependencyNames;
|
procedure UpdateAvailableDependencyNames;
|
||||||
|
function IsInstallButtonVisible: Boolean;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -98,9 +112,117 @@ end;
|
|||||||
|
|
||||||
procedure TAddPkgDependencyDialog.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
procedure TAddPkgDependencyDialog.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
begin
|
begin
|
||||||
|
fSL.Free;
|
||||||
IDEDialogLayoutList.SaveLayout(Self);
|
IDEDialogLayoutList.SaveLayout(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TAddPkgDependencyDialog.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
fSL := TStringList.Create;
|
||||||
|
pnLocalPkg.Visible := OPMInterface <> nil;
|
||||||
|
pnOnlinePkg.Visible := OPMInterface <> nil;
|
||||||
|
BP.CloseButton.Visible := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TAddPkgDependencyDialog.DependPkgNameListBoxDrawItem(
|
||||||
|
Control: TWinControl; Index: Integer; ARect: TRect; State: TOwnerDrawState);
|
||||||
|
var
|
||||||
|
ItemText: string;
|
||||||
|
PackageLink: TPackageLink;
|
||||||
|
begin
|
||||||
|
with (Control as TListBox).Canvas do
|
||||||
|
begin
|
||||||
|
if odSelected In State then
|
||||||
|
begin
|
||||||
|
Pen.Color := clHighlightText;
|
||||||
|
Brush.Color := clHighlight;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Pen.Color := (Control as TListBox).Color;
|
||||||
|
if Assigned(OPMInterface) then
|
||||||
|
begin
|
||||||
|
PackageLink := TPackageLink(fSL.Objects[Index]);
|
||||||
|
if PackageLink.Origin = ploOnline then
|
||||||
|
Brush.Color := pnOnlinePkg.Color
|
||||||
|
else
|
||||||
|
Brush.Color := pnLocalPkg.Color
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Brush.Color := (Control as TListBox).Color;
|
||||||
|
end;
|
||||||
|
FillRect(ARect);
|
||||||
|
ItemText := (Control as TListBox).Items[Index];
|
||||||
|
DrawText(Handle, PChar(ItemText), Length(ItemText), ARect, DT_LEFT or DT_VCENTER or DT_SINGLELINE);
|
||||||
|
if odFocused In State then
|
||||||
|
begin
|
||||||
|
Brush.Color := (Control as TListBox).Color;
|
||||||
|
DrawFocusRect(ARect);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TAddPkgDependencyDialog.IsInstallButtonVisible: Boolean;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
|
PackageLink: TPackageLink;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
if (OPMInterface = nil) or (fSL.Count = 0) then
|
||||||
|
Exit;
|
||||||
|
for I := 0 to DependPkgNameListBox.Count - 1 do
|
||||||
|
begin
|
||||||
|
if DependPkgNameListBox.Selected[I] then
|
||||||
|
begin
|
||||||
|
PackageLink := TPackageLink(fSL.Objects[I]);
|
||||||
|
if PackageLink.Origin = ploOnline then
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TAddPkgDependencyDialog.DependPkgNameListBoxSelectionChange(
|
||||||
|
Sender: TObject; User: boolean);
|
||||||
|
begin
|
||||||
|
BP.CloseButton.Visible := IsInstallButtonVisible;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TAddPkgDependencyDialog.cbLocalPkgChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
UpdateAvailableDependencyNames;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TAddPkgDependencyDialog.CloseButtonClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
PkgList: String;
|
||||||
|
I: Integer;
|
||||||
|
begin
|
||||||
|
ModalResult := mrNone;
|
||||||
|
PkgList := '';
|
||||||
|
for I := 0 to DependPkgNameListBox.Count - 1 do
|
||||||
|
begin
|
||||||
|
if DependPkgNameListBox.Selected[I] then
|
||||||
|
begin
|
||||||
|
if TPackageLink(fSL.Objects[I]).Origin = ploOnline then
|
||||||
|
begin
|
||||||
|
if PkgList = '' then
|
||||||
|
PkgList := '"' + DependPkgNameListBox.Items[I] + '"'
|
||||||
|
else
|
||||||
|
PkgList := PkgList + ', "' + DependPkgNameListBox.Items[I] + '"';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if PkgList <> '' then
|
||||||
|
begin
|
||||||
|
if MessageDlg(lisPkgInstConf + sLineBreak + PkgList + ' ?', mtInformation, [mbYes, mbNo], 0) = mrNo then
|
||||||
|
Exit;
|
||||||
|
MessageDlg('Not yet implemented!', mtInformation, [mbOk], 0)
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TAddPkgDependencyDialog.AddUniquePackagesToList(APackageID: TLazPackageID);
|
procedure TAddPkgDependencyDialog.AddUniquePackagesToList(APackageID: TLazPackageID);
|
||||||
begin
|
begin
|
||||||
if (APackageID.IDAsString<>fProjPack.IDAsString) and (fPackages.Find(APackageID)=Nil) then
|
if (APackageID.IDAsString<>fProjPack.IDAsString) and (fPackages.Find(APackageID)=Nil) then
|
||||||
@ -110,21 +232,50 @@ end;
|
|||||||
procedure TAddPkgDependencyDialog.UpdateAvailableDependencyNames;
|
procedure TAddPkgDependencyDialog.UpdateAvailableDependencyNames;
|
||||||
var
|
var
|
||||||
ANode: TAVLTreeNode;
|
ANode: TAVLTreeNode;
|
||||||
sl: TStringList;
|
CntLocalPkg: Integer;
|
||||||
|
CntOnlinePkg: Integer;
|
||||||
begin
|
begin
|
||||||
|
if fUpdating then
|
||||||
|
Exit;
|
||||||
|
|
||||||
|
fUpdating := True;
|
||||||
|
try
|
||||||
|
CntLocalPkg := 0;
|
||||||
|
CntOnlinePkg := 0;
|
||||||
|
DependPkgNameListBox.Clear;
|
||||||
|
fSL.Clear;
|
||||||
fPackages.Clear;
|
fPackages.Clear;
|
||||||
PackageGraph.IteratePackages(fpfSearchAllExisting,@AddUniquePackagesToList);
|
PackageGraph.IteratePackages(fpfSearchAllExisting,@AddUniquePackagesToList);
|
||||||
sl:=TStringList.Create;
|
|
||||||
try
|
|
||||||
ANode:=fPackages.FindLowest;
|
ANode:=fPackages.FindLowest;
|
||||||
while ANode<>nil do begin
|
while ANode<>nil do begin
|
||||||
sl.Add(TLazPackageID(ANode.Data).Name);
|
if (TPackageLink(ANode.Data).Origin = ploOnline) and (cbOnlinePkg.Checked) and Assigned(OPMInterface) then
|
||||||
|
begin
|
||||||
|
Inc(CntOnlinePkg);
|
||||||
|
fSL.AddObject(TLazPackageID(ANode.Data).Name, TLazPackageID(ANode.Data));
|
||||||
|
end;
|
||||||
|
if (TPackageLink(ANode.Data).Origin <> ploOnline) and (cbLocalPkg.Checked) then
|
||||||
|
begin
|
||||||
|
Inc(CntLocalPkg);
|
||||||
|
fSL.AddObject(TLazPackageID(ANode.Data).Name, TLazPackageID(ANode.Data));
|
||||||
|
end;
|
||||||
ANode:=fPackages.FindSuccessor(ANode);
|
ANode:=fPackages.FindSuccessor(ANode);
|
||||||
end;
|
end;
|
||||||
DependPkgNameFilter.Items.Assign(sl);
|
DependPkgNameFilter.Items.BeginUpdate;
|
||||||
|
try
|
||||||
|
DependPkgNameFilter.Items.Clear;
|
||||||
|
DependPkgNameFilter.Items.Assign(fSL);
|
||||||
DependPkgNameFilter.InvalidateFilter;
|
DependPkgNameFilter.InvalidateFilter;
|
||||||
finally
|
finally
|
||||||
sl.Free;
|
DependPkgNameFilter.Items.EndUpdate;
|
||||||
|
end;
|
||||||
|
if Assigned(OPMInterface) then
|
||||||
|
begin
|
||||||
|
cbLocalPkg.Caption := Format(lisLocalPkg, [IntToStr(CntLocalPkg)]);
|
||||||
|
cbOnlinePkg.Caption := Format(lisOnlinePkg, [IntToStr(CntOnlinePkg)]);
|
||||||
|
BP.CloseButton.Visible := IsInstallButtonVisible;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
fUpdating := False;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -1122,11 +1122,12 @@ end;
|
|||||||
function TLazPackageLinks.FindLinkWithPkgNameWithIgnore(const PkgName: string;
|
function TLazPackageLinks.FindLinkWithPkgNameWithIgnore(const PkgName: string;
|
||||||
IgnoreFiles: TFilenameToStringTree): TPackageLink;
|
IgnoreFiles: TFilenameToStringTree): TPackageLink;
|
||||||
var
|
var
|
||||||
UserLink, GlobalLink: TLazPackageLink;
|
UserLink, OnlineLink, GlobalLink: TLazPackageLink;
|
||||||
begin
|
begin
|
||||||
UserLink:=FindLinkWithPkgNameInTree(FUserLinksSortID,PkgName,IgnoreFiles);
|
UserLink:=FindLinkWithPkgNameInTree(FUserLinksSortID,PkgName,IgnoreFiles);
|
||||||
|
OnlineLink:=FindLinkWithPkgNameInTree(FOnlineLinks,PkgName,IgnoreFiles);
|
||||||
GlobalLink:=FindLinkWithPkgNameInTree(FGlobalLinks,PkgName,IgnoreFiles);
|
GlobalLink:=FindLinkWithPkgNameInTree(FGlobalLinks,PkgName,IgnoreFiles);
|
||||||
Result:=GetNewerLink(UserLink,GlobalLink);
|
Result:=GetNewestLink(UserLink, OnlineLink, GlobalLink);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLazPackageLinks.FindLinkWithDependency(Dependency: TPkgDependencyID): TPackageLink;
|
function TLazPackageLinks.FindLinkWithDependency(Dependency: TPkgDependencyID): TPackageLink;
|
||||||
@ -1137,20 +1138,22 @@ end;
|
|||||||
function TLazPackageLinks.FindLinkWithDependencyWithIgnore(Dependency: TPkgDependencyID;
|
function TLazPackageLinks.FindLinkWithDependencyWithIgnore(Dependency: TPkgDependencyID;
|
||||||
IgnoreFiles: TFilenameToStringTree): TPackageLink;
|
IgnoreFiles: TFilenameToStringTree): TPackageLink;
|
||||||
var
|
var
|
||||||
UserLink, GlobalLink: TLazPackageLink;
|
UserLink, OnlineLink, GlobalLink: TLazPackageLink;
|
||||||
begin
|
begin
|
||||||
UserLink:=FindLinkWithDependencyInTree(FUserLinksSortID,Dependency,IgnoreFiles);
|
UserLink:=FindLinkWithDependencyInTree(FUserLinksSortID,Dependency,IgnoreFiles);
|
||||||
|
OnlineLink:=FindLinkWithDependencyInTree(FOnlineLinks,Dependency,IgnoreFiles);
|
||||||
GlobalLink:=FindLinkWithDependencyInTree(FGlobalLinks,Dependency,IgnoreFiles);
|
GlobalLink:=FindLinkWithDependencyInTree(FGlobalLinks,Dependency,IgnoreFiles);
|
||||||
Result:=GetNewerLink(UserLink,GlobalLink);
|
Result:=GetNewestLink(UserLink, OnlineLink, GlobalLink);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLazPackageLinks.FindLinkWithPackageID(APackageID: TLazPackageID): TPackageLink;
|
function TLazPackageLinks.FindLinkWithPackageID(APackageID: TLazPackageID): TPackageLink;
|
||||||
var
|
var
|
||||||
UserLink, GlobalLink: TLazPackageLink;
|
UserLink, OnlineLink, GlobalLink: TLazPackageLink;
|
||||||
begin
|
begin
|
||||||
UserLink:=FindLinkWithPackageIDInTree(FUserLinksSortID,APackageID);
|
UserLink:=FindLinkWithPackageIDInTree(FUserLinksSortID,APackageID);
|
||||||
|
OnlineLink:=FindLinkWithPackageIDInTree(FOnlineLinks,APackageID);
|
||||||
GlobalLink:=FindLinkWithPackageIDInTree(FGlobalLinks,APackageID);
|
GlobalLink:=FindLinkWithPackageIDInTree(FGlobalLinks,APackageID);
|
||||||
Result:=GetNewerLink(UserLink,GlobalLink);
|
Result:=GetNewestLink(UserLink, OnlineLink, GlobalLink);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLazPackageLinks.FindLinkWithFilename(const PkgName, LPKFilename: string): TPackageLink;
|
function TLazPackageLinks.FindLinkWithFilename(const PkgName, LPKFilename: string): TPackageLink;
|
||||||
@ -1168,8 +1171,9 @@ procedure TLazPackageLinks.IteratePackages(MustExist: boolean;
|
|||||||
begin
|
begin
|
||||||
if ploUser in Origins then
|
if ploUser in Origins then
|
||||||
IteratePackagesInTree(MustExist,FUserLinksSortID,Event);
|
IteratePackagesInTree(MustExist,FUserLinksSortID,Event);
|
||||||
|
//online packages are always virtual(meaning: the lpk does not exist localy)==> MustExist is false
|
||||||
if ploOnline in Origins then
|
if ploOnline in Origins then
|
||||||
IteratePackagesInTree(MustExist,FOnlineLinks,Event);
|
IteratePackagesInTree(False,FOnlineLinks,Event);
|
||||||
if ploGlobal in Origins then
|
if ploGlobal in Origins then
|
||||||
IteratePackagesInTree(MustExist,FGlobalLinks,Event);
|
IteratePackagesInTree(MustExist,FGlobalLinks,Event);
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user