mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 17:16:01 +02:00
IDE: View Package Links: added facets lpk file valid+invalid
git-svn-id: trunk@39992 -
This commit is contained in:
parent
e2b176f2e8
commit
0f0194cc50
@ -239,6 +239,8 @@ resourcestring
|
||||
lisConvert = 'Convert';
|
||||
lisPLDShowGlobalLinks = 'Show global links';
|
||||
lisPLDShowUserLinks = 'Show user links';
|
||||
lrsPLDLpkFileValid = 'lpk file valid %s';
|
||||
lrsPLDLpkFileInvalid = 'lpk file invalid %s';
|
||||
lisPLDGlobal = 'Global';
|
||||
lisCTDefDefineTemplates = 'Define templates';
|
||||
lisMenuCloseAll = 'Close A&ll';
|
||||
|
@ -12,7 +12,7 @@ object PackageLinksDialog: TPackageLinksDialog
|
||||
LCLVersion = '1.1'
|
||||
object ScopeGroupBox: TGroupBox
|
||||
Left = 0
|
||||
Height = 83
|
||||
Height = 113
|
||||
Top = 0
|
||||
Width = 659
|
||||
Align = alTop
|
||||
@ -22,11 +22,12 @@ object PackageLinksDialog: TPackageLinksDialog
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.HorizontalSpacing = 6
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ClientHeight = 66
|
||||
ClientHeight = 96
|
||||
ClientWidth = 655
|
||||
TabOrder = 0
|
||||
object ShowGlobalLinksCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = ScopeGroupBox
|
||||
AnchorSideTop.Control = ScopeGroupBox
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 6
|
||||
@ -38,22 +39,55 @@ object PackageLinksDialog: TPackageLinksDialog
|
||||
TabOrder = 0
|
||||
end
|
||||
object ShowUserLinksCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = ScopeGroupBox
|
||||
AnchorSideTop.Control = ShowGlobalLinksCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 36
|
||||
Width = 170
|
||||
Width = 161
|
||||
Caption = 'ShowUserLinksCheckBox'
|
||||
Checked = True
|
||||
OnChange = ShowUserLinksCheckBoxChange
|
||||
State = cbChecked
|
||||
TabOrder = 1
|
||||
end
|
||||
object LPKFileValidCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = ScopeGroupBox
|
||||
AnchorSideTop.Control = ShowUserLinksCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 66
|
||||
Width = 147
|
||||
Caption = 'LPKFileValidCheckBox'
|
||||
Checked = True
|
||||
OnChange = LPKFileValidCheckBoxChange
|
||||
State = cbChecked
|
||||
TabOrder = 2
|
||||
end
|
||||
object LPKFileInvalidCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = LPKFileValidCheckBox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LPKFileValidCheckBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 168
|
||||
Height = 24
|
||||
Top = 66
|
||||
Width = 155
|
||||
BorderSpacing.Left = 15
|
||||
Caption = 'LPKFileInvalidCheckBox'
|
||||
Checked = True
|
||||
OnChange = LPKFileInvalidCheckBoxChange
|
||||
State = cbChecked
|
||||
TabOrder = 3
|
||||
end
|
||||
end
|
||||
object PkgStringGrid: TStringGrid
|
||||
AnchorSideBottom.Control = BtnPanel
|
||||
Left = 0
|
||||
Height = 326
|
||||
Top = 83
|
||||
Height = 296
|
||||
Top = 113
|
||||
Width = 659
|
||||
Align = alTop
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
|
@ -48,13 +48,17 @@ type
|
||||
|
||||
TPkgLinkInfo = class(TPackageLink)
|
||||
private
|
||||
FIsValid: boolean;
|
||||
FLPKInfo: TLPKInfo;
|
||||
FVisible: boolean;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Assign(Source: TPersistent); override;
|
||||
property Origin;
|
||||
property LPKInfo: TLPKInfo read FLPKInfo;
|
||||
property Visible: boolean read FVisible write FVisible;
|
||||
property IsValid: boolean read FIsValid write FIsValid;
|
||||
end;
|
||||
|
||||
{ TPackageLinksDialog }
|
||||
@ -62,6 +66,8 @@ type
|
||||
TPackageLinksDialog = class(TForm)
|
||||
BtnPanel: TPanel;
|
||||
CloseBitBtn: TBitBtn;
|
||||
LPKFileValidCheckBox: TCheckBox;
|
||||
LPKFileInvalidCheckBox: TCheckBox;
|
||||
LPKParsingTimer: TTimer;
|
||||
ShowUserLinksCheckBox: TCheckBox;
|
||||
ShowGlobalLinksCheckBox: TCheckBox;
|
||||
@ -70,18 +76,25 @@ type
|
||||
UpdateGlobalLinksButton: TButton;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure LPKFileValidCheckBoxChange(Sender: TObject);
|
||||
procedure LPKFileInvalidCheckBoxChange(Sender: TObject);
|
||||
procedure LPKParsingTimerTimer(Sender: TObject);
|
||||
procedure OnAllLPKParsed(Sender: TObject);
|
||||
procedure ShowGlobalLinksCheckBoxChange(Sender: TObject);
|
||||
procedure ShowUserLinksCheckBoxChange(Sender: TObject);
|
||||
procedure UpdateGlobalLinksButtonClick(Sender: TObject);
|
||||
private
|
||||
FCountLPKValid: integer;
|
||||
FCountLPKInvalid: integer;
|
||||
FLinks: TAvglVLTree;// tree of TPkgLinkInfo sorted for names
|
||||
FCollectingOrigin: TPkgLinkOrigin;
|
||||
procedure UpdateFacets;
|
||||
procedure UpdatePackageList;
|
||||
procedure ClearLinks;
|
||||
procedure IteratePackages(APackage: TLazPackageID);
|
||||
public
|
||||
property CountLPKValid: integer read FCountLPKValid;
|
||||
property CountLPKInvalid: integer read FCountLPKInvalid;
|
||||
end;
|
||||
|
||||
function ShowPackageLinks: TModalResult;
|
||||
@ -108,10 +121,7 @@ procedure TPackageLinksDialog.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Caption:=lisPLDPackageLinks;
|
||||
ScopeGroupBox.Caption:=dlgScope;
|
||||
ShowGlobalLinksCheckBox.Caption:=lisPLDShowGlobalLinks
|
||||
+' ('+PkgLinks.GetGlobalLinkDirectory+'*.lpl)';
|
||||
ShowUserLinksCheckBox.Caption:=lisPLDShowUserLinks
|
||||
+' ('+PkgLinks.GetUserLinkFile+')';
|
||||
UpdateFacets;
|
||||
UpdateGlobalLinksButton.Caption:=lrsReadLplFiles;
|
||||
CloseBitBtn.Caption:=lisClose;
|
||||
|
||||
@ -127,6 +137,16 @@ begin
|
||||
ClearLinks;
|
||||
end;
|
||||
|
||||
procedure TPackageLinksDialog.LPKFileValidCheckBoxChange(Sender: TObject);
|
||||
begin
|
||||
UpdatePackageList;
|
||||
end;
|
||||
|
||||
procedure TPackageLinksDialog.LPKFileInvalidCheckBoxChange(Sender: TObject);
|
||||
begin
|
||||
UpdatePackageList;
|
||||
end;
|
||||
|
||||
procedure TPackageLinksDialog.LPKParsingTimerTimer(Sender: TObject);
|
||||
begin
|
||||
UpdatePackageList;
|
||||
@ -162,6 +182,7 @@ var
|
||||
i: Integer;
|
||||
OriginStr: String;
|
||||
Info: TLPKInfo;
|
||||
NextNode: TAvgLvlTreeNode;
|
||||
begin
|
||||
// collect links
|
||||
ClearLinks;
|
||||
@ -180,13 +201,47 @@ begin
|
||||
// query additional information from lpk files
|
||||
LPKInfoCache.EnterCritSection;
|
||||
try
|
||||
FCountLPKValid:=0;
|
||||
FCountLPKInvalid:=0;
|
||||
Node:=FLinks.FindLowest;
|
||||
while Node<>nil do begin
|
||||
Link:=TPkgLinkInfo(Node.Data);
|
||||
Link.Visible:=true;
|
||||
NextNode:=Node.Successor;
|
||||
Info:=LPKInfoCache.FindPkgInfoWithFilename(Link.GetEffectiveFilename);
|
||||
if Info<>nil then
|
||||
Link.LPKInfo.Assign(Info);
|
||||
Node:=Node.Successor;
|
||||
|
||||
// filter for Validity
|
||||
if Link.Visible then begin
|
||||
Link.IsValid:=true;
|
||||
if Info<>nil then begin
|
||||
Link.LPKInfo.Assign(Info);
|
||||
if Link.LPKInfo.LPKParsed=lpkiParsedError then
|
||||
Link.IsValid:=false;
|
||||
end;
|
||||
if Link.IsValid then begin
|
||||
if not LPKFileValidCheckBox.Checked then Link.Visible:=false;
|
||||
end else begin
|
||||
if not LPKFileInvalidCheckBox.Checked then Link.Visible:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
if Link.Visible then begin
|
||||
// todo filter for text
|
||||
|
||||
end;
|
||||
|
||||
if Link.Visible then begin
|
||||
// this link is shown => increase facet counters
|
||||
if Link.IsValid then
|
||||
inc(FCountLPKValid)
|
||||
else
|
||||
inc(FCountLPKInvalid);
|
||||
end else begin
|
||||
// delete link
|
||||
Link.Free;
|
||||
FLinks.Delete(Node);
|
||||
end;
|
||||
Node:=NextNode;
|
||||
end;
|
||||
finally
|
||||
LPKInfoCache.LeaveCritSection;
|
||||
@ -205,6 +260,13 @@ begin
|
||||
Node:=FLinks.FindLowest;
|
||||
while Node<>nil do begin
|
||||
Link:=TPkgLinkInfo(Node.Data);
|
||||
Node:=Node.Successor;
|
||||
|
||||
Info:=Link.LPKInfo;
|
||||
if Info<>nil then begin
|
||||
|
||||
end;
|
||||
|
||||
PkgStringGrid.Cells[0,i]:=Link.Name;
|
||||
PkgStringGrid.Cells[1,i]:=Link.Version.AsString;
|
||||
if Link.Origin=ploGlobal then
|
||||
@ -214,11 +276,24 @@ begin
|
||||
PkgStringGrid.Cells[2,i]:=OriginStr;
|
||||
PkgStringGrid.Cells[3,i]:=dbgs(FileExistsCached(Link.GetEffectiveFilename));
|
||||
PkgStringGrid.Cells[4,i]:=Link.GetEffectiveFilename;
|
||||
|
||||
inc(i);
|
||||
Node:=Node.Successor;
|
||||
end;
|
||||
|
||||
PkgStringGrid.AutoAdjustColumns;
|
||||
UpdateFacets;
|
||||
end;
|
||||
|
||||
procedure TPackageLinksDialog.UpdateFacets;
|
||||
begin
|
||||
ShowGlobalLinksCheckBox.Caption:=lisPLDShowGlobalLinks
|
||||
+' ('+PkgLinks.GetGlobalLinkDirectory+'*.lpl)';
|
||||
ShowUserLinksCheckBox.Caption:=lisPLDShowUserLinks
|
||||
+' ('+PkgLinks.GetUserLinkFile+')';
|
||||
LPKFileValidCheckBox.Caption:=Format(lrsPLDLpkFileValid, [IntToStr(
|
||||
CountLPKValid)]);
|
||||
LPKFileInvalidCheckBox.Caption:=Format(lrsPLDLpkFileInvalid, [IntToStr(
|
||||
CountLPKInvalid)]);
|
||||
end;
|
||||
|
||||
procedure TPackageLinksDialog.ClearLinks;
|
||||
|
Loading…
Reference in New Issue
Block a user