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'; lisFile = 'File';
lisNew = 'New'; lisNew = 'New';
lisClose = 'Close'; lisClose = 'Close';
lrsReadLplFiles = 'Read lpl files';
lisBtnClose = '&Close'; lisBtnClose = '&Close';
lisOk = 'OK'; lisOk = 'OK';
lisMenuOk = '&OK'; lisMenuOk = '&OK';

View File

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

View File

@ -3,34 +3,15 @@ object PackageLinksDialog: TPackageLinksDialog
Height = 451 Height = 451
Top = 189 Top = 189
Width = 659 Width = 659
ActiveControl = CloseBitBtn
Caption = 'PackageLinksDialog' Caption = 'PackageLinksDialog'
ClientHeight = 451 ClientHeight = 451
ClientWidth = 659 ClientWidth = 659
OnCreate = FormCreate OnCreate = FormCreate
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '0.9.27' LCLVersion = '1.1'
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
object ScopeGroupBox: TGroupBox object ScopeGroupBox: TGroupBox
Left = 0 Left = 0
Height = 93 Height = 113
Top = 0 Top = 0
Width = 659 Width = 659
Align = alTop Align = alTop
@ -41,23 +22,23 @@ object PackageLinksDialog: TPackageLinksDialog
ChildSizing.HorizontalSpacing = 6 ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 6 ChildSizing.VerticalSpacing = 6
ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.Layout = cclLeftToRightThenTopToBottom
ClientHeight = 75 ClientHeight = 96
ClientWidth = 655 ClientWidth = 655
TabOrder = 1 TabOrder = 0
object FileMustExistCheckBox: TCheckBox object FileMustExistCheckBox: TCheckBox
Left = 6 Left = 6
Height = 17 Height = 24
Top = 6 Top = 6
Width = 149 Width = 170
Caption = 'FileMustExistCheckBox' Caption = 'FileMustExistCheckBox'
OnChange = FileMustExistCheckBoxChange OnChange = FileMustExistCheckBoxChange
TabOrder = 0 TabOrder = 0
end end
object ShowGlobalLinksCheckBox: TCheckBox object ShowGlobalLinksCheckBox: TCheckBox
Left = 6 Left = 6
Height = 17 Height = 24
Top = 29 Top = 36
Width = 149 Width = 170
Caption = 'ShowGlobalLinksCheckBox' Caption = 'ShowGlobalLinksCheckBox'
Checked = True Checked = True
OnChange = ShowGlobalLinksCheckBoxChange OnChange = ShowGlobalLinksCheckBoxChange
@ -66,9 +47,9 @@ object PackageLinksDialog: TPackageLinksDialog
end end
object ShowUserLinksCheckBox: TCheckBox object ShowUserLinksCheckBox: TCheckBox
Left = 6 Left = 6
Height = 17 Height = 24
Top = 52 Top = 66
Width = 149 Width = 170
Caption = 'ShowUserLinksCheckBox' Caption = 'ShowUserLinksCheckBox'
Checked = True Checked = True
OnChange = ShowUserLinksCheckBoxChange OnChange = ShowUserLinksCheckBoxChange
@ -77,16 +58,55 @@ object PackageLinksDialog: TPackageLinksDialog
end end
end end
object PkgStringGrid: TStringGrid object PkgStringGrid: TStringGrid
AnchorSideBottom.Control = CloseBitBtn AnchorSideBottom.Control = BtnPanel
Left = 0 Left = 0
Height = 320 Height = 296
Top = 93 Top = 113
Width = 659 Width = 659
Align = alTop Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
ColCount = 4 ColCount = 4
FixedCols = 0 FixedCols = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goTabs, goColSpanning, goDblClickAutoSize, goSmoothScroll] 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 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
end end

View File

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