mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 10:10:31 +02:00
cody: lvl graph: allow user to override minimize crossing algorithm
git-svn-id: trunk@40430 -
This commit is contained in:
parent
0986431fcd
commit
7c346d5b08
@ -415,7 +415,7 @@ type
|
|||||||
HardMaxTotal, HardMinOneNode, SoftMaxTotal, SoftMinOneNode: integer);
|
HardMaxTotal, HardMinOneNode, SoftMaxTotal, SoftMinOneNode: integer);
|
||||||
procedure SetAllNodeDrawSizes(PixelPerWeight: single = 1.0; MinWeight: single = 0.0);
|
procedure SetAllNodeDrawSizes(PixelPerWeight: single = 1.0; MinWeight: single = 0.0);
|
||||||
procedure MarkBackEdges;
|
procedure MarkBackEdges;
|
||||||
procedure MinimizeCrossings; // set all Node.Position to minimize crossings
|
procedure MinimizeCrossings; // permutate nodes to minimize crossings
|
||||||
procedure MinimizeOverlappings(MinPos: integer = 0;
|
procedure MinimizeOverlappings(MinPos: integer = 0;
|
||||||
NodeGapAbove: integer = 1; NodeGapBelow: integer = 1;
|
NodeGapAbove: integer = 1; NodeGapBelow: integer = 1;
|
||||||
aLevel: integer = -1); // set all Node.Position to minimize overlappings
|
aLevel: integer = -1); // set all Node.Position to minimize overlappings
|
||||||
@ -506,6 +506,7 @@ type
|
|||||||
FGraph: TLvlGraph;
|
FGraph: TLvlGraph;
|
||||||
FNodeStyle: TLvlGraphNodeStyle;
|
FNodeStyle: TLvlGraphNodeStyle;
|
||||||
FNodeUnderMouse: TLvlGraphNode;
|
FNodeUnderMouse: TLvlGraphNode;
|
||||||
|
FOnMinimizeCrossings: TNotifyEvent;
|
||||||
FOnSelectionChanged: TNotifyEvent;
|
FOnSelectionChanged: TNotifyEvent;
|
||||||
FOptions: TLvlGraphCtrlOptions;
|
FOptions: TLvlGraphCtrlOptions;
|
||||||
FScrollLeft: integer;
|
FScrollLeft: integer;
|
||||||
@ -560,6 +561,7 @@ type
|
|||||||
property ScrollTopMax: integer read FScrollTopMax;
|
property ScrollTopMax: integer read FScrollTopMax;
|
||||||
property ScrollLeft: integer read FScrollLeft write SetScrollLeft;
|
property ScrollLeft: integer read FScrollLeft write SetScrollLeft;
|
||||||
property ScrollLeftMax: integer read FScrollLeftMax;
|
property ScrollLeftMax: integer read FScrollLeftMax;
|
||||||
|
property OnMinimizeCrossings: TNotifyEvent read FOnMinimizeCrossings write FOnMinimizeCrossings;// provide an alternative minimize crossing algorithm
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TLvlGraphControl }
|
{ TLvlGraphControl }
|
||||||
@ -590,6 +592,7 @@ type
|
|||||||
property OnKeyDown;
|
property OnKeyDown;
|
||||||
property OnKeyPress;
|
property OnKeyPress;
|
||||||
property OnKeyUp;
|
property OnKeyUp;
|
||||||
|
property OnMinimizeCrossings;
|
||||||
property OnMouseDown;
|
property OnMouseDown;
|
||||||
property OnMouseEnter;
|
property OnMouseEnter;
|
||||||
property OnMouseLeave;
|
property OnMouseLeave;
|
||||||
@ -2164,7 +2167,10 @@ begin
|
|||||||
ClientHeight-HeaderHeight,round(single(TxtH)*NodeStyle.CaptionScale+0.5));
|
ClientHeight-HeaderHeight,round(single(TxtH)*NodeStyle.CaptionScale+0.5));
|
||||||
|
|
||||||
// sort nodes within levels to avoid crossings
|
// sort nodes within levels to avoid crossings
|
||||||
Graph.MinimizeCrossings;
|
if OnMinimizeCrossings<>nil then
|
||||||
|
OnMinimizeCrossings(Self)
|
||||||
|
else
|
||||||
|
Graph.MinimizeCrossings;
|
||||||
|
|
||||||
// position nodes without overlapping
|
// position nodes without overlapping
|
||||||
Graph.MinimizeOverlappings(HeaderHeight,GapTop,GapBottom);
|
Graph.MinimizeOverlappings(HeaderHeight,GapTop,GapBottom);
|
||||||
|
Loading…
Reference in New Issue
Block a user