mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-22 08:09:37 +01:00
cody: find overloads: fill grid
git-svn-id: trunk@49965 -
This commit is contained in:
parent
dab7f60716
commit
21c7e86155
@ -49,14 +49,14 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow
|
|||||||
end
|
end
|
||||||
object FilterGroupBox: TGroupBox
|
object FilterGroupBox: TGroupBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 92
|
Height = 94
|
||||||
Top = 249
|
Top = 247
|
||||||
Width = 553
|
Width = 553
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'FilterGroupBox'
|
Caption = 'FilterGroupBox'
|
||||||
ChildSizing.LeftRightSpacing = 6
|
ChildSizing.LeftRightSpacing = 6
|
||||||
ClientHeight = 75
|
ClientHeight = 77
|
||||||
ClientWidth = 549
|
ClientWidth = 549
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object CompatibleParamsCheckBox: TCheckBox
|
object CompatibleParamsCheckBox: TCheckBox
|
||||||
@ -77,7 +77,7 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow
|
|||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 30
|
Top = 31
|
||||||
Width = 75
|
Width = 75
|
||||||
Caption = 'RelationLabel'
|
Caption = 'RelationLabel'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
@ -90,7 +90,7 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow
|
|||||||
AnchorSideRight.Control = FilterGroupBox
|
AnchorSideRight.Control = FilterGroupBox
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 87
|
Left = 87
|
||||||
Height = 27
|
Height = 29
|
||||||
Top = 24
|
Top = 24
|
||||||
Width = 456
|
Width = 456
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
@ -106,7 +106,7 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 24
|
Height = 24
|
||||||
Top = 51
|
Top = 53
|
||||||
Width = 152
|
Width = 152
|
||||||
Caption = 'HideAbstractCheckBox'
|
Caption = 'HideAbstractCheckBox'
|
||||||
ParentShowHint = False
|
ParentShowHint = False
|
||||||
@ -116,21 +116,51 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow
|
|||||||
end
|
end
|
||||||
object ResultsGroupBox: TGroupBox
|
object ResultsGroupBox: TGroupBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 249
|
Height = 247
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 553
|
Width = 553
|
||||||
Align = alClient
|
Align = alClient
|
||||||
Caption = 'ResultsGroupBox'
|
Caption = 'ResultsGroupBox'
|
||||||
ClientHeight = 232
|
ClientHeight = 230
|
||||||
ClientWidth = 549
|
ClientWidth = 549
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object ResultsStringGrid: TStringGrid
|
object ResultsStringGrid: TStringGrid
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 212
|
Height = 210
|
||||||
Top = 20
|
Top = 20
|
||||||
Width = 549
|
Width = 549
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
AutoFillColumns = True
|
||||||
|
ColCount = 3
|
||||||
|
Columns = <
|
||||||
|
item
|
||||||
|
ReadOnly = True
|
||||||
|
SizePriority = 10
|
||||||
|
Title.Caption = 'Name'
|
||||||
|
Width = 182
|
||||||
|
end
|
||||||
|
item
|
||||||
|
MaxSize = 100
|
||||||
|
ReadOnly = True
|
||||||
|
Title.Alignment = taCenter
|
||||||
|
Title.Caption = 'Compatibility'
|
||||||
|
Width = 182
|
||||||
|
end
|
||||||
|
item
|
||||||
|
MaxSize = 100
|
||||||
|
ReadOnly = True
|
||||||
|
Title.Alignment = taCenter
|
||||||
|
Title.Caption = 'Distance'
|
||||||
|
Width = 183
|
||||||
|
end>
|
||||||
|
FixedCols = 0
|
||||||
|
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goRowSelect, goDblClickAutoSize, goSmoothScroll, goRowHighlight]
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
ColWidths = (
|
||||||
|
182
|
||||||
|
182
|
||||||
|
183
|
||||||
|
)
|
||||||
end
|
end
|
||||||
object ProgressBar1: TProgressBar
|
object ProgressBar1: TProgressBar
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -144,7 +174,7 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow
|
|||||||
object Timer1: TTimer
|
object Timer1: TTimer
|
||||||
Interval = 300
|
Interval = 300
|
||||||
OnTimer = Timer1Timer
|
OnTimer = Timer1Timer
|
||||||
left = 331
|
left = 112
|
||||||
top = 179
|
top = 144
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -124,6 +124,7 @@ type
|
|||||||
CurUnit: TCFOUnit; ExcludeAbstractProcs: boolean;
|
CurUnit: TCFOUnit; ExcludeAbstractProcs: boolean;
|
||||||
var TargetGraphNode: TCFONode);
|
var TargetGraphNode: TCFONode);
|
||||||
procedure CalcDistances(NodeGraph: TCodeGraph; TargetGraphNode: TCFONode);
|
procedure CalcDistances(NodeGraph: TCodeGraph; TargetGraphNode: TCFONode);
|
||||||
|
procedure FillGrid(NodeGraph: TCodeGraph; TargetGraphNode: TCFONode);
|
||||||
procedure FreeUsesGraph;
|
procedure FreeUsesGraph;
|
||||||
function GetDefaultCaption: string;
|
function GetDefaultCaption: string;
|
||||||
procedure FillFilterControls(ProcTool: TFindDeclarationTool;
|
procedure FillFilterControls(ProcTool: TFindDeclarationTool;
|
||||||
@ -224,14 +225,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end else if cfofGatherProcs in FFlags then begin
|
end else if cfofGatherProcs in FFlags then begin
|
||||||
GatherProcsOfAllUnits;
|
GatherProcsOfAllUnits;
|
||||||
FFlags:=FFlags-[cfofGatherProcs];
|
|
||||||
// hide progress bar and update stats
|
|
||||||
ProgressBar1.Visible:=false;
|
|
||||||
RefreshButton.Enabled:=true;
|
|
||||||
Timer1.Enabled:=false;
|
|
||||||
ResultsGroupBox.Caption:=Format('Units: %s', [IntToStr(FUsesGraph.FilesTree.Count)]);
|
|
||||||
// update controls
|
|
||||||
//UpdateAll;
|
|
||||||
end else
|
end else
|
||||||
IdleConnected:=false;
|
IdleConnected:=false;
|
||||||
Done:=not IdleConnected;
|
Done:=not IdleConnected;
|
||||||
@ -323,6 +316,12 @@ var
|
|||||||
TargetGraphNode: TCFONode;
|
TargetGraphNode: TCFONode;
|
||||||
begin
|
begin
|
||||||
Exclude(FFlags,cfofGatherProcs);
|
Exclude(FFlags,cfofGatherProcs);
|
||||||
|
Timer1.Enabled:=false;
|
||||||
|
// hide progress bar and update stats
|
||||||
|
ProgressBar1.Visible:=false;
|
||||||
|
RefreshButton.Enabled:=true;
|
||||||
|
ResultsGroupBox.Caption:=Format('Units: %s', [IntToStr(FUsesGraph.FilesTree.Count)]);
|
||||||
|
|
||||||
if FUsesGraph=nil then
|
if FUsesGraph=nil then
|
||||||
exit;
|
exit;
|
||||||
debugln(['TCodyFindOverloadsWindow.GatherProcsOfAllUnits START']);
|
debugln(['TCodyFindOverloadsWindow.GatherProcsOfAllUnits START']);
|
||||||
@ -347,6 +346,7 @@ begin
|
|||||||
if TargetGraphNode<>nil then
|
if TargetGraphNode<>nil then
|
||||||
CalcDistances(NodeGraph,TargetGraphNode);
|
CalcDistances(NodeGraph,TargetGraphNode);
|
||||||
|
|
||||||
|
FillGrid(NodeGraph,TargetGraphNode);
|
||||||
finally
|
finally
|
||||||
NodeGraph.Free;
|
NodeGraph.Free;
|
||||||
ProgNode.Free;
|
ProgNode.Free;
|
||||||
@ -368,7 +368,7 @@ procedure TCodyFindOverloadsWindow.GatherProcsOfUnit(NodeGraph: TCodeGraph;
|
|||||||
RaiseCatchableException('');
|
RaiseCatchableException('');
|
||||||
Result:=TCFONode(NodeGraph.GetGraphNode(ClassNode,false));
|
Result:=TCFONode(NodeGraph.GetGraphNode(ClassNode,false));
|
||||||
if Result<>nil then exit;
|
if Result<>nil then exit;
|
||||||
debugln(['AddClassNode ',Tool.ExtractClassName(ClassNode,false)]);
|
//debugln(['AddClassNode ',Tool.ExtractClassName(ClassNode,false)]);
|
||||||
Result:=TCFONode(NodeGraph.AddGraphNode(ClassNode));
|
Result:=TCFONode(NodeGraph.AddGraphNode(ClassNode));
|
||||||
Result.Tool:=Tool;
|
Result.Tool:=Tool;
|
||||||
// create edge "reachable", so that all nodes are reachable
|
// create edge "reachable", so that all nodes are reachable
|
||||||
@ -385,7 +385,7 @@ procedure TCodyFindOverloadsWindow.GatherProcsOfUnit(NodeGraph: TCodeGraph;
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
Edge: TCFOEdge;
|
Edge: TCFOEdge;
|
||||||
begin
|
begin
|
||||||
debugln(['AddAncestors ',Tool.ExtractClassName(ClassNode,false)]);
|
//debugln(['AddAncestors ',Tool.ExtractClassName(ClassNode,false)]);
|
||||||
ListOfPFindContext:=nil;
|
ListOfPFindContext:=nil;
|
||||||
Params:=TFindDeclarationParams.Create(nil);
|
Params:=TFindDeclarationParams.Create(nil);
|
||||||
try
|
try
|
||||||
@ -564,6 +564,50 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCodyFindOverloadsWindow.FillGrid(NodeGraph: TCodeGraph;
|
||||||
|
TargetGraphNode: TCFONode);
|
||||||
|
var
|
||||||
|
Grid: TStringGrid;
|
||||||
|
AVLNode: TAVLTreeNode;
|
||||||
|
GraphNode: TCFONode;
|
||||||
|
List: TFPList;
|
||||||
|
Row: Integer;
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
Grid:=ResultsStringGrid;
|
||||||
|
Grid.Visible:=true;
|
||||||
|
Grid.Columns[0].Title.Caption:='Name';
|
||||||
|
Grid.Columns[1].Title.Caption:='Compatibility';
|
||||||
|
Grid.Columns[2].Title.Caption:='Distance';
|
||||||
|
|
||||||
|
List:=TFPList.Create;
|
||||||
|
AVLNode:=NodeGraph.Nodes.FindLowest;
|
||||||
|
while AVLNode<>nil do begin
|
||||||
|
GraphNode:=TCFONode(AVLNode.Data);
|
||||||
|
AVLNode:=NodeGraph.Nodes.FindSuccessor(AVLNode);
|
||||||
|
if GraphNode=TargetGraphNode then continue;
|
||||||
|
if GraphNode.Node.Desc<>ctnProcedure then continue;
|
||||||
|
List.Add(GraphNode);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Grid.RowCount:=List.Count+1;
|
||||||
|
for Row:=1 to List.Count do begin
|
||||||
|
GraphNode:=TCFONode(List[Row-1]);
|
||||||
|
|
||||||
|
s:=GraphNode.Tool.ExtractProcName(GraphNode.Node,[phpAddClassName]);
|
||||||
|
Grid.Cells[0,Row]:=s;
|
||||||
|
|
||||||
|
case GraphNode.Compatibility of
|
||||||
|
tcExact: s:='fits exactly';
|
||||||
|
tcCompatible: s:='compatible';
|
||||||
|
tcIncompatible: s:='incompatible';
|
||||||
|
end;
|
||||||
|
Grid.Cells[1,Row]:=s;
|
||||||
|
|
||||||
|
Grid.Cells[2,Row]:=IntToStr(GraphNode.Distance);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCodyFindOverloadsWindow.FreeUsesGraph;
|
procedure TCodyFindOverloadsWindow.FreeUsesGraph;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FUsesGraph);
|
FreeAndNil(FUsesGraph);
|
||||||
@ -698,6 +742,7 @@ var
|
|||||||
TargetTool: TFindDeclarationTool;
|
TargetTool: TFindDeclarationTool;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
|
Caption:=GetDefaultCaption;
|
||||||
|
|
||||||
AbortParsing;
|
AbortParsing;
|
||||||
ResultsStringGrid.Visible:=false;
|
ResultsStringGrid.Visible:=false;
|
||||||
@ -749,6 +794,7 @@ begin
|
|||||||
FTargetName:=TargetTool.ExtractProcName(TargetProcNode,[phpWithoutClassName]);
|
FTargetName:=TargetTool.ExtractProcName(TargetProcNode,[phpWithoutClassName]);
|
||||||
FTargetPath:=TargetTool.ExtractProcName(TargetProcNode,[phpAddClassName]);
|
FTargetPath:=TargetTool.ExtractProcName(TargetProcNode,[phpAddClassName]);
|
||||||
TargetTool.CleanPosToCaret(TargetProcNode.StartPos,FTargetXYPosition);
|
TargetTool.CleanPosToCaret(TargetProcNode.StartPos,FTargetXYPosition);
|
||||||
|
Caption:=GetDefaultCaption+' - '+FTargetPath;
|
||||||
|
|
||||||
FillFilterControls(TargetTool,TargetProcNode);
|
FillFilterControls(TargetTool,TargetProcNode);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user