mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 15:39:49 +02:00
Packager: use ListViewFilterEdit in OpenInstalledPackages window.
git-svn-id: trunk@47161 -
This commit is contained in:
parent
cbae1c8558
commit
3f37b16f15
@ -1,40 +1,51 @@
|
||||
object OpenLoadedPackagesDlg: TOpenLoadedPackagesDlg
|
||||
Left = 407
|
||||
Height = 494
|
||||
Height = 501
|
||||
Top = 151
|
||||
Width = 447
|
||||
ActiveControl = PkgListView
|
||||
Width = 446
|
||||
ActiveControl = FilterEdit
|
||||
Caption = 'OpenLoadedPackagesDlg'
|
||||
ClientHeight = 494
|
||||
ClientWidth = 447
|
||||
ClientHeight = 501
|
||||
ClientWidth = 446
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.3'
|
||||
object HintMemo: TMemo
|
||||
Left = 0
|
||||
Left = 3
|
||||
Height = 121
|
||||
Top = 327
|
||||
Width = 447
|
||||
Top = 332
|
||||
Width = 440
|
||||
Align = alBottom
|
||||
BorderSpacing.Left = 3
|
||||
BorderSpacing.Right = 3
|
||||
Lines.Strings = (
|
||||
'Memo1'
|
||||
)
|
||||
ReadOnly = True
|
||||
ScrollBars = ssAutoBoth
|
||||
TabOrder = 0
|
||||
TabOrder = 3
|
||||
end
|
||||
object PkgListView: TListView
|
||||
Left = 0
|
||||
Height = 322
|
||||
Top = 0
|
||||
Width = 447
|
||||
Align = alClient
|
||||
AnchorSideTop.Control = FilterEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Splitter1
|
||||
Left = 3
|
||||
Height = 300
|
||||
Top = 27
|
||||
Width = 440
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 3
|
||||
BorderSpacing.Top = 3
|
||||
BorderSpacing.Right = 3
|
||||
Columns = <>
|
||||
ReadOnly = True
|
||||
RowSelect = True
|
||||
SortType = stText
|
||||
TabOrder = 1
|
||||
ViewStyle = vsReport
|
||||
OnDblClick = PkgListViewDblClick
|
||||
OnSelectItem = PkgListViewSelectItem
|
||||
end
|
||||
@ -42,16 +53,16 @@ object OpenLoadedPackagesDlg: TOpenLoadedPackagesDlg
|
||||
Cursor = crVSplit
|
||||
Left = 0
|
||||
Height = 5
|
||||
Top = 322
|
||||
Width = 447
|
||||
Top = 327
|
||||
Width = 446
|
||||
Align = alBottom
|
||||
ResizeAnchor = akBottom
|
||||
end
|
||||
object ButtonPanel1: TButtonPanel
|
||||
Left = 6
|
||||
Height = 34
|
||||
Top = 454
|
||||
Width = 435
|
||||
Height = 36
|
||||
Top = 459
|
||||
Width = 434
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
OKButton.OnClick = OpenButtonClick
|
||||
@ -62,7 +73,18 @@ object OpenLoadedPackagesDlg: TOpenLoadedPackagesDlg
|
||||
CloseButton.DefaultCaption = True
|
||||
CancelButton.Name = 'CancelButton'
|
||||
CancelButton.DefaultCaption = True
|
||||
TabOrder = 3
|
||||
TabOrder = 4
|
||||
ShowButtons = [pbOK, pbCancel, pbHelp]
|
||||
end
|
||||
object FilterEdit: TListViewFilterEdit
|
||||
Left = 3
|
||||
Height = 21
|
||||
Top = 3
|
||||
Width = 147
|
||||
ButtonWidth = 23
|
||||
NumGlyphs = 1
|
||||
MaxLength = 0
|
||||
TabOrder = 0
|
||||
FilteredListview = PkgListView
|
||||
end
|
||||
end
|
||||
|
@ -31,9 +31,8 @@ unit OpenInstalledPkgDlg;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Buttons, ComCtrls, StdCtrls,
|
||||
FileCtrl, Dialogs, LCLProc, ExtCtrls, ButtonPanel,
|
||||
IDEHelpIntf, IDEWindowIntf, PackageIntf,
|
||||
SysUtils, Forms, Controls, ComCtrls, StdCtrls, ExtCtrls, LCLProc, ButtonPanel,
|
||||
IDEHelpIntf, IDEWindowIntf, PackageIntf, ListViewFilterEdit,
|
||||
PackageDefs, LazarusIDEStrConsts, PackageSystem;
|
||||
|
||||
type
|
||||
@ -42,6 +41,7 @@ type
|
||||
|
||||
TOpenLoadedPackagesDlg = class(TForm)
|
||||
ButtonPanel1: TButtonPanel;
|
||||
FilterEdit: TListViewFilterEdit;
|
||||
PkgListView: TListView;
|
||||
HintMemo: TMemo;
|
||||
Splitter1: TSplitter;
|
||||
@ -50,10 +50,8 @@ type
|
||||
procedure HelpButtonClick(Sender: TObject);
|
||||
procedure OpenButtonClick(Sender: TObject);
|
||||
procedure PkgListViewDblClick(Sender: TObject);
|
||||
procedure PkgListViewSelectItem(Sender: TObject; Item: TListItem;
|
||||
Selected: Boolean);
|
||||
procedure PkgListViewSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
|
||||
private
|
||||
function PkgStateToString(APackage: TLazPackage): string;
|
||||
public
|
||||
Package: TLazPackage;
|
||||
procedure UpdateSelection;
|
||||
@ -127,12 +125,9 @@ begin
|
||||
end;
|
||||
|
||||
procedure TOpenLoadedPackagesDlg.OpenButtonClick(Sender: TObject);
|
||||
var
|
||||
PkgName: String;
|
||||
begin
|
||||
if PkgListView.Selected=nil then exit;
|
||||
PkgName:=PkgListView.Selected.Caption;
|
||||
Package:=PackageGraph.FindPackageWithName(PkgName,nil);
|
||||
Package:=PackageGraph.FindPackageWithName(PkgListView.Selected.Caption,nil);
|
||||
if Package=nil then
|
||||
ModalResult:=mrCancel
|
||||
else
|
||||
@ -147,7 +142,6 @@ begin
|
||||
IDEDialogLayoutList.ApplyLayout(Self,450,450);
|
||||
|
||||
with PkgListView do begin
|
||||
ViewStyle:=vsReport;
|
||||
NewColumn:=Columns.Add;
|
||||
NewColumn.Caption:=lisOIPPackageName;
|
||||
NewColumn.Width:=150;
|
||||
@ -172,7 +166,7 @@ begin
|
||||
LazarusHelp.ShowHelpForIDEControl(Self);
|
||||
end;
|
||||
|
||||
function TOpenLoadedPackagesDlg.PkgStateToString(APackage: TLazPackage): string;
|
||||
function PkgStateToString(APackage: TLazPackage): string;
|
||||
|
||||
procedure AddState(const s: string);
|
||||
begin
|
||||
@ -198,30 +192,41 @@ begin
|
||||
end;
|
||||
|
||||
procedure TOpenLoadedPackagesDlg.UpdatePackageList;
|
||||
var
|
||||
Cnt: Integer;
|
||||
i: Integer;
|
||||
CurPkg: TLazPackage;
|
||||
CurListItem: TListItem;
|
||||
begin
|
||||
PkgListView.BeginUpdate;
|
||||
Cnt:=PackageGraph.Count;
|
||||
for i:=0 to Cnt-1 do begin
|
||||
CurPkg:=PackageGraph[i];
|
||||
if PkgListView.Items.Count>i then begin
|
||||
CurListItem:=PkgListView.Items[i];
|
||||
CurListItem.SubItems[0]:=CurPkg.Version.AsString;
|
||||
CurListItem.SubItems[1]:=PkgStateToString(CurPkg);
|
||||
end else begin
|
||||
CurListItem:=PkgListView.Items.Add;
|
||||
CurListItem.SubItems.Add(CurPkg.Version.AsString);
|
||||
CurListItem.SubItems.Add(PkgStateToString(CurPkg));
|
||||
end;
|
||||
CurListItem.Caption:=CurPkg.Name;
|
||||
|
||||
procedure UpdateOnePackage(aPkg: TLazPackage);
|
||||
var
|
||||
Data: TStringArray;
|
||||
begin
|
||||
SetLength(Data, 3);
|
||||
Data[0] := aPkg.Name;
|
||||
Data[1] := aPkg.Version.AsString;
|
||||
Data[2] := PkgStateToString(aPkg);
|
||||
FilterEdit.Items.Add(Data);
|
||||
end;
|
||||
PkgListView.AlphaSort;
|
||||
PkgListView.EndUpdate;
|
||||
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
FilterEdit.Items.Clear;
|
||||
for i:=0 to PackageGraph.Count-1 do
|
||||
UpdateOnePackage(PackageGraph[i]);
|
||||
FilterEdit.InvalidateFilter;
|
||||
//PkgListView.BeginUpdate;
|
||||
//PkgListView.AlphaSort;
|
||||
//PkgListView.EndUpdate;
|
||||
end;
|
||||
|
||||
//if PkgListView.Items.Count>i then begin
|
||||
// CurListItem:=PkgListView.Items[i];
|
||||
// CurListItem.SubItems[0]:=CurPkg.Version.AsString;
|
||||
// CurListItem.SubItems[1]:=PkgStateToString(CurPkg);
|
||||
//end else begin
|
||||
//CurListItem:=PkgListView.Items.Add;
|
||||
//CurListItem.SubItems.Add(CurPkg.Version.AsString);
|
||||
//CurListItem.SubItems.Add(PkgStateToString(CurPkg));
|
||||
//end;
|
||||
//CurListItem.Caption:=CurPkg.Name;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user