IDE: package graph: show project

git-svn-id: trunk@40611 -
This commit is contained in:
mattias 2013-03-21 22:40:33 +00:00
parent e13ae5142d
commit 9f4298e8e4
2 changed files with 31 additions and 9 deletions

View File

@ -38,6 +38,8 @@ object PkgGraphExplorerDlg: TPkgGraphExplorerDlg
Width = 462
Align = alClient
NodeStyle.Shape = lgnsNone
NodeStyle.GapTop = 2
NodeStyle.GapBottom = 6
NodeStyle.DefaultImageIndex = -1
NodeStyle.Coloring = lgncRGB
OnDblClick = LvlGraphControl1DblClick

View File

@ -271,6 +271,17 @@ begin
end;
procedure TPkgGraphExplorerDlg.UpdateLvlGraph;
procedure AddEdges(LGNode: TLvlGraphNode; Dependency: TPkgDependency);
begin
while Dependency<>nil do begin
if Dependency.RequiredPackage<>nil then
LvlGraphControl1.Graph.GetEdge(LGNode,
LvlGraphControl1.Graph.GetNode(Dependency.RequiredPackage.IDAsString,true),true);
Dependency:=Dependency.NextRequiresDependency;
end;
end;
var
AVLNode: TAVLTreeNode;
CurPkg: TLazPackage;
@ -279,7 +290,7 @@ var
PkgName: String;
ViewNode: TLvlGraphNode;
OldSelected: String;
CurDependency: TPkgDependency;
ProjectNode: TLvlGraphNode;
begin
// rebuild internal sorted packages
fSortedPackages.Clear;
@ -293,27 +304,36 @@ begin
ViewNode:=LvlGraphControl1.Graph.FirstSelected;
if ViewNode<>nil then
OldSelected:=ViewNode.Caption;
// add a node for the project
ProjectNode:=nil;
if Project1<>nil then
ProjectNode:=LvlGraphControl1.Graph.GetNode(GroupPrefixProject,true);
// add nodes for packages
AVLNode:=fSortedPackages.FindLowest;
while AVLNode<>nil do begin
CurPkg:=TLazPackage(AVLNode.Data);
PkgName:=CurPkg.IDAsString;
ViewNode:=LvlGraphControl1.Graph.GetNode(PkgName,true);
ViewNode.ImageIndex:=GetPackageImageIndex(CurPkg);
ViewNode.Selected:=PkgName=OldSelected;
AVLNode:=fSortedPackages.FindSuccessor(AVLNode);
end;
// add dependencies
// add project dependencies
if ProjectNode<>nil then
AddEdges(ProjectNode,Project1.FirstRequiredDependency);
// add package dependencies
AVLNode:=fSortedPackages.FindLowest;
while AVLNode<>nil do begin
CurPkg:=TLazPackage(AVLNode.Data);
CurDependency:=CurPkg.FirstRequiredDependency;
while CurDependency<>nil do begin
if CurDependency.RequiredPackage<>nil then
LvlGraphControl1.Graph.GetEdge(CurPkg.IDAsString,CurDependency.RequiredPackage.IDAsString,true);
CurDependency:=CurDependency.NextRequiresDependency;
end;
ViewNode:=LvlGraphControl1.Graph.GetNode(CurPkg.IDAsString,true);
AddEdges(ViewNode,CurPkg.FirstRequiredDependency);
AVLNode:=fSortedPackages.FindSuccessor(AVLNode);
end;
LvlGraphControl1.SelectedNode:=LvlGraphControl1.Graph.GetNode(OldSelected,false);
LvlGraphControl1.EndUpdate;
end;