IDE: View Package Links: button to rescan lpl files

git-svn-id: trunk@39979 -
This commit is contained in:
mattias 2013-01-27 12:42:36 +00:00
parent 45267c6fbc
commit cd57873a93
4 changed files with 71 additions and 39 deletions

View File

@ -67,6 +67,7 @@ resourcestring
lisFile = 'File';
lisNew = 'New';
lisClose = 'Close';
lrsReadLplFiles = 'Read lpl files';
lisBtnClose = '&Close';
lisOk = 'OK';
lisMenuOk = '&OK';

View File

@ -111,7 +111,6 @@ type
property LastUsed: TDateTime read FLastUsed write FLastUsed;
end;
{ TPackageLinks }
TPackageLinks = class;
@ -466,9 +465,9 @@ begin
end;
Files:=TStringListUTF8.Create;
PkgVersion:=TPkgVersion.Create;
try
CodeToolBoss.DirectoryCachePool.GetListing(GlobalLinksDir,Files,false);
PkgVersion:=TPkgVersion.Create;
for i:=0 to Files.Count-1 do begin
LPLFilename:=GlobalLinksDir+Files[i];
if CompareFileExt(LPLFilename,'lpl')<>0 then continue;
@ -517,9 +516,9 @@ begin
CurPkgLink.Release;
end;
//WriteLinkTree(FGlobalLinks);
if PkgVersion<>nil then PkgVersion.Free;
finally
Files.Free;
PkgVersion.Free;
end;
end;

View File

@ -3,34 +3,15 @@ object PackageLinksDialog: TPackageLinksDialog
Height = 451
Top = 189
Width = 659
ActiveControl = CloseBitBtn
Caption = 'PackageLinksDialog'
ClientHeight = 451
ClientWidth = 659
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '0.9.27'
object CloseBitBtn: TBitBtn
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 582
Height = 26
Top = 419
Width = 71
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Around = 6
Caption = '&Close'
Kind = bkClose
ModalResult = 1
NumGlyphs = 0
TabOrder = 0
end
LCLVersion = '1.1'
object ScopeGroupBox: TGroupBox
Left = 0
Height = 93
Height = 113
Top = 0
Width = 659
Align = alTop
@ -41,23 +22,23 @@ object PackageLinksDialog: TPackageLinksDialog
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 6
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 75
ClientHeight = 96
ClientWidth = 655
TabOrder = 1
TabOrder = 0
object FileMustExistCheckBox: TCheckBox
Left = 6
Height = 17
Height = 24
Top = 6
Width = 149
Width = 170
Caption = 'FileMustExistCheckBox'
OnChange = FileMustExistCheckBoxChange
TabOrder = 0
end
object ShowGlobalLinksCheckBox: TCheckBox
Left = 6
Height = 17
Top = 29
Width = 149
Height = 24
Top = 36
Width = 170
Caption = 'ShowGlobalLinksCheckBox'
Checked = True
OnChange = ShowGlobalLinksCheckBoxChange
@ -66,9 +47,9 @@ object PackageLinksDialog: TPackageLinksDialog
end
object ShowUserLinksCheckBox: TCheckBox
Left = 6
Height = 17
Top = 52
Width = 149
Height = 24
Top = 66
Width = 170
Caption = 'ShowUserLinksCheckBox'
Checked = True
OnChange = ShowUserLinksCheckBoxChange
@ -77,16 +58,55 @@ object PackageLinksDialog: TPackageLinksDialog
end
end
object PkgStringGrid: TStringGrid
AnchorSideBottom.Control = CloseBitBtn
AnchorSideBottom.Control = BtnPanel
Left = 0
Height = 320
Top = 93
Height = 296
Top = 113
Width = 659
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
ColCount = 4
FixedCols = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goTabs, goColSpanning, goDblClickAutoSize, goSmoothScroll]
TabOrder = 1
end
object BtnPanel: TPanel
Left = 0
Height = 42
Top = 409
Width = 659
Align = alBottom
AutoSize = True
ClientHeight = 42
ClientWidth = 659
TabOrder = 2
object CloseBitBtn: TBitBtn
AnchorSideRight.Control = BtnPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = BtnPanel
AnchorSideBottom.Side = asrBottom
Left = 592
Height = 28
Top = 7
Width = 60
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Around = 6
Caption = '&Close'
Kind = bkClose
ModalResult = 1
TabOrder = 0
end
object UpdateGlobalLinksButton: TButton
Left = 7
Height = 27
Top = 7
Width = 152
AutoSize = True
BorderSpacing.Around = 6
Caption = 'UpdateGlobalLinksButton'
OnClick = UpdateGlobalLinksButtonClick
TabOrder = 1
end
end
end

View File

@ -38,7 +38,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, Grids, AVL_Tree,
Buttons, Grids, ExtCtrls, AVL_Tree,
FileProcs, PackageIntf,
LazarusIDEStrConsts, PackageDefs, PackageLinks;
@ -55,16 +55,19 @@ type
{ TPackageLinksDialog }
TPackageLinksDialog = class(TForm)
BtnPanel: TPanel;
CloseBitBtn: TBitBtn;
ShowUserLinksCheckBox: TCheckBox;
ShowGlobalLinksCheckBox: TCheckBox;
FileMustExistCheckBox: TCheckBox;
ScopeGroupBox: TGroupBox;
PkgStringGrid: TStringGrid;
UpdateGlobalLinksButton: TButton;
procedure FileMustExistCheckBoxChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ShowGlobalLinksCheckBoxChange(Sender: TObject);
procedure ShowUserLinksCheckBoxChange(Sender: TObject);
procedure UpdateGlobalLinksButtonClick(Sender: TObject);
private
FLinks: TAVLTree;// tree of TPkgLinkInfo sorted for names
FCollectingOrigin: TPkgLinkOrigin;
@ -99,13 +102,15 @@ end;
procedure TPackageLinksDialog.FormCreate(Sender: TObject);
begin
Caption:=lisPLDPackageLinks;
CloseBitBtn.Caption:=lisClose;
ScopeGroupBox.Caption:=dlgScope;
FileMustExistCheckBox.Caption:=lisPLDOnlyExistingFiles;
ShowGlobalLinksCheckBox.Caption:=lisPLDShowGlobalLinks
+' ('+PkgLinks.GetGlobalLinkDirectory+'*.lpl)';
ShowUserLinksCheckBox.Caption:=lisPLDShowUserLinks
+' ('+PkgLinks.GetUserLinkFile+')';
UpdateGlobalLinksButton.Caption:=lrsReadLplFiles;
CloseBitBtn.Caption:=lisClose;
UpdateAll;
end;
@ -119,6 +124,13 @@ begin
UpdatePackageList;
end;
procedure TPackageLinksDialog.UpdateGlobalLinksButtonClick(Sender: TObject);
begin
PkgLinks.ClearGlobalLinks;
PkgLinks.UpdateGlobalLinks;
UpdatePackageList;
end;
procedure TPackageLinksDialog.FileMustExistCheckBoxChange(Sender: TObject);
begin
UpdatePackageList;