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