mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-20 23:59:40 +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
|
||||
object FilterGroupBox: TGroupBox
|
||||
Left = 0
|
||||
Height = 92
|
||||
Top = 249
|
||||
Height = 94
|
||||
Top = 247
|
||||
Width = 553
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
Caption = 'FilterGroupBox'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ClientHeight = 75
|
||||
ClientHeight = 77
|
||||
ClientWidth = 549
|
||||
TabOrder = 1
|
||||
object CompatibleParamsCheckBox: TCheckBox
|
||||
@ -77,7 +77,7 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 15
|
||||
Top = 30
|
||||
Top = 31
|
||||
Width = 75
|
||||
Caption = 'RelationLabel'
|
||||
ParentColor = False
|
||||
@ -90,7 +90,7 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow
|
||||
AnchorSideRight.Control = FilterGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 87
|
||||
Height = 27
|
||||
Height = 29
|
||||
Top = 24
|
||||
Width = 456
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
@ -106,7 +106,7 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 51
|
||||
Top = 53
|
||||
Width = 152
|
||||
Caption = 'HideAbstractCheckBox'
|
||||
ParentShowHint = False
|
||||
@ -116,21 +116,51 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow
|
||||
end
|
||||
object ResultsGroupBox: TGroupBox
|
||||
Left = 0
|
||||
Height = 249
|
||||
Height = 247
|
||||
Top = 0
|
||||
Width = 553
|
||||
Align = alClient
|
||||
Caption = 'ResultsGroupBox'
|
||||
ClientHeight = 232
|
||||
ClientHeight = 230
|
||||
ClientWidth = 549
|
||||
TabOrder = 2
|
||||
object ResultsStringGrid: TStringGrid
|
||||
Left = 0
|
||||
Height = 212
|
||||
Height = 210
|
||||
Top = 20
|
||||
Width = 549
|
||||
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
|
||||
ColWidths = (
|
||||
182
|
||||
182
|
||||
183
|
||||
)
|
||||
end
|
||||
object ProgressBar1: TProgressBar
|
||||
Left = 0
|
||||
@ -144,7 +174,7 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow
|
||||
object Timer1: TTimer
|
||||
Interval = 300
|
||||
OnTimer = Timer1Timer
|
||||
left = 331
|
||||
top = 179
|
||||
left = 112
|
||||
top = 144
|
||||
end
|
||||
end
|
||||
|
||||
@ -124,6 +124,7 @@ type
|
||||
CurUnit: TCFOUnit; ExcludeAbstractProcs: boolean;
|
||||
var TargetGraphNode: TCFONode);
|
||||
procedure CalcDistances(NodeGraph: TCodeGraph; TargetGraphNode: TCFONode);
|
||||
procedure FillGrid(NodeGraph: TCodeGraph; TargetGraphNode: TCFONode);
|
||||
procedure FreeUsesGraph;
|
||||
function GetDefaultCaption: string;
|
||||
procedure FillFilterControls(ProcTool: TFindDeclarationTool;
|
||||
@ -224,14 +225,6 @@ begin
|
||||
end;
|
||||
end else if cfofGatherProcs in FFlags then begin
|
||||
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
|
||||
IdleConnected:=false;
|
||||
Done:=not IdleConnected;
|
||||
@ -323,6 +316,12 @@ var
|
||||
TargetGraphNode: TCFONode;
|
||||
begin
|
||||
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
|
||||
exit;
|
||||
debugln(['TCodyFindOverloadsWindow.GatherProcsOfAllUnits START']);
|
||||
@ -347,6 +346,7 @@ begin
|
||||
if TargetGraphNode<>nil then
|
||||
CalcDistances(NodeGraph,TargetGraphNode);
|
||||
|
||||
FillGrid(NodeGraph,TargetGraphNode);
|
||||
finally
|
||||
NodeGraph.Free;
|
||||
ProgNode.Free;
|
||||
@ -368,7 +368,7 @@ procedure TCodyFindOverloadsWindow.GatherProcsOfUnit(NodeGraph: TCodeGraph;
|
||||
RaiseCatchableException('');
|
||||
Result:=TCFONode(NodeGraph.GetGraphNode(ClassNode,false));
|
||||
if Result<>nil then exit;
|
||||
debugln(['AddClassNode ',Tool.ExtractClassName(ClassNode,false)]);
|
||||
//debugln(['AddClassNode ',Tool.ExtractClassName(ClassNode,false)]);
|
||||
Result:=TCFONode(NodeGraph.AddGraphNode(ClassNode));
|
||||
Result.Tool:=Tool;
|
||||
// create edge "reachable", so that all nodes are reachable
|
||||
@ -385,7 +385,7 @@ procedure TCodyFindOverloadsWindow.GatherProcsOfUnit(NodeGraph: TCodeGraph;
|
||||
i: Integer;
|
||||
Edge: TCFOEdge;
|
||||
begin
|
||||
debugln(['AddAncestors ',Tool.ExtractClassName(ClassNode,false)]);
|
||||
//debugln(['AddAncestors ',Tool.ExtractClassName(ClassNode,false)]);
|
||||
ListOfPFindContext:=nil;
|
||||
Params:=TFindDeclarationParams.Create(nil);
|
||||
try
|
||||
@ -564,6 +564,50 @@ begin
|
||||
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;
|
||||
begin
|
||||
FreeAndNil(FUsesGraph);
|
||||
@ -698,6 +742,7 @@ var
|
||||
TargetTool: TFindDeclarationTool;
|
||||
begin
|
||||
Result:=false;
|
||||
Caption:=GetDefaultCaption;
|
||||
|
||||
AbortParsing;
|
||||
ResultsStringGrid.Visible:=false;
|
||||
@ -749,6 +794,7 @@ begin
|
||||
FTargetName:=TargetTool.ExtractProcName(TargetProcNode,[phpWithoutClassName]);
|
||||
FTargetPath:=TargetTool.ExtractProcName(TargetProcNode,[phpAddClassName]);
|
||||
TargetTool.CleanPosToCaret(TargetProcNode.StartPos,FTargetXYPosition);
|
||||
Caption:=GetDefaultCaption+' - '+FTargetPath;
|
||||
|
||||
FillFilterControls(TargetTool,TargetProcNode);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user