mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-26 14:20:34 +02:00
cody: unit dependencies: project group
git-svn-id: trunk@40062 -
This commit is contained in:
parent
be0b77b0b1
commit
0c2f5b14df
@ -476,8 +476,8 @@ begin
|
||||
,aSize.cx,aSize.cy);
|
||||
|
||||
// radius
|
||||
fInnerRadius:=0.25*Min(ClientWidth,ClientHeight);
|
||||
fOuterRadius:=1.1*InnerRadius;
|
||||
fInnerRadius:=0.24*Min(ClientWidth,ClientHeight);
|
||||
fOuterRadius:=1.2*InnerRadius;
|
||||
|
||||
// degrees
|
||||
TotalSize:=0.0;
|
||||
|
@ -16,6 +16,8 @@ uses
|
||||
resourcestring
|
||||
rsSelectAUnit = 'Select an unit';
|
||||
rsClose = 'Close';
|
||||
const
|
||||
GroupPrefixProject = '-Project-';
|
||||
type
|
||||
TUDDUsesType = (
|
||||
uddutInterfaceUses,
|
||||
@ -51,12 +53,15 @@ type
|
||||
fCircleCategories: array[TUDDUsesType] of TCircleDiagramCategory;
|
||||
procedure SetCurrentUnit(AValue: TUGUnit);
|
||||
procedure SetIdleConnected(AValue: boolean);
|
||||
procedure CreateGroups;
|
||||
procedure CreateProjectGroup(AProject: TLazProject);
|
||||
procedure AddStartAndTargetUnits;
|
||||
procedure UpdateAll;
|
||||
procedure UpdateCurUnitDiagram;
|
||||
procedure UpdateCurUnitTreeView;
|
||||
function NodeTextToUnit(NodeText: string): TUGUnit;
|
||||
function UGUnitToNodeText(UGUnit: TUGUnit): string;
|
||||
function GetFPCSrcDir: string;
|
||||
public
|
||||
CurUnitDiagram: TCircleDiagramControl;
|
||||
property IdleConnected: boolean read FIdleConnected write SetIdleConnected;
|
||||
@ -160,6 +165,7 @@ var
|
||||
begin
|
||||
UsesGraph.Parse(true,Completed,200);
|
||||
if Completed then begin
|
||||
CreateGroups;
|
||||
IdleConnected:=false;
|
||||
ProgressBar1.Visible:=false;
|
||||
ProgressBar1.Style:=pbstNormal;
|
||||
@ -183,6 +189,49 @@ begin
|
||||
Application.RemoveOnIdleHandler(@OnIdle);
|
||||
end;
|
||||
|
||||
procedure TUnitDependenciesDialog.CreateGroups;
|
||||
var
|
||||
Node: TAVLTreeNode;
|
||||
CurUnit: TUGGroupUnit;
|
||||
FPCSrcDir: String;
|
||||
begin
|
||||
CreateProjectGroup(LazarusIDE.ActiveProject);
|
||||
|
||||
|
||||
FPCSrcDir:=AppendPathDelim(GetFPCSrcDir);
|
||||
|
||||
Node:=UsesGraph.FilesTree.FindLowest;
|
||||
while Node<>nil do begin
|
||||
CurUnit:=TUGGroupUnit(Node.Data);
|
||||
if CompareFilenames(FPCSrcDir,LeftStr(CurUnit.Filename,length(FPCSrcDir)))=0
|
||||
then begin
|
||||
// a unit in the FPC sources
|
||||
|
||||
end;
|
||||
if CurUnit.Group=nil then begin
|
||||
|
||||
end;
|
||||
Node:=UsesGraph.FilesTree.FindSuccessor(Node);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TUnitDependenciesDialog.CreateProjectGroup(AProject: TLazProject);
|
||||
var
|
||||
Grp: TUGGroup;
|
||||
i: Integer;
|
||||
Filename: String;
|
||||
CurUnit: TUGUnit;
|
||||
begin
|
||||
if AProject=nil then exit;
|
||||
Grp:=Groups.GetGroup(GroupPrefixProject,true);
|
||||
for i:=0 to AProject.FileCount-1 do begin
|
||||
Filename:=AProject.Files[i].Filename;
|
||||
CurUnit:=UsesGraph.GetUnit(Filename,false);
|
||||
if CurUnit is TUGGroupUnit then
|
||||
Grp.AddUnit(TUGGroupUnit(CurUnit));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TUnitDependenciesDialog.SetCurrentUnit(AValue: TUGUnit);
|
||||
begin
|
||||
if FCurrentUnit=AValue then Exit;
|
||||
@ -311,6 +360,14 @@ begin
|
||||
Result:=ExtractFileName(UGUnit.Filename);
|
||||
end;
|
||||
|
||||
function TUnitDependenciesDialog.GetFPCSrcDir: string;
|
||||
var
|
||||
UnitSet: TFPCUnitSetCache;
|
||||
begin
|
||||
UnitSet:=CodeToolBoss.GetUnitSetForDirectory('');
|
||||
Result:=UnitSet.FPCSourceDirectory;
|
||||
end;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user