New visualizer

This commit is contained in:
Michael Schimmel
2025-10-26 21:43:11 +01:00
parent e95a920dc7
commit a47cd3f1f4
3 changed files with 4 additions and 27 deletions
+1 -7
View File
@@ -123,7 +123,6 @@ end;
procedure TAuraNode.Paint;
var
rect: TRectF;
effectiveBorderWidth: Single;
begin
inherited; // Allow styled painting to occur first (if any)
@@ -142,7 +141,6 @@ begin
Canvas.Stroke.Thickness := 1;
Canvas.Stroke.Dash := TStrokeDash.Dot;
Canvas.DrawRect(TRectF.Create(0, 0, Width, Height), 0, 0, [], 1.0);
effectiveBorderWidth := 0;
end
else
begin
@@ -167,11 +165,7 @@ begin
Canvas.Stroke.Thickness := FBorderWidth;
Canvas.Stroke.Dash := TStrokeDash.Solid;
Canvas.DrawRect(rect, FBorderRadius, FBorderRadius, AllCorners, 1.0, TCornerType.Round);
effectiveBorderWidth := FBorderWidth;
end
else
effectiveBorderWidth := 0;
end;
end;
// Title drawing removed, handled by external labels now.
end;
+3 -12
View File
@@ -272,7 +272,6 @@ var
savedPos: TPointF;
child: IAstNode;
titleLabelHeight: Single;
childNode: TAuraNode; // To potentially use the return value
begin
auraNode := CreateNode(ANode); // Create node without title
auraNode.BeginUpdate;
@@ -290,7 +289,8 @@ begin
for child in AChildren do
begin
if Assigned(child) then // Ensure child node exists
childNode := CallAccept(child); // Use CallAccept, store result
{childNode :=}
CallAccept(child); // Use CallAccept, store result
// childNode is not explicitly used here for layout *after* the call,
// but its creation and positioning happened *within* CallAccept.
end;
@@ -395,8 +395,6 @@ begin
currentX := cNodePadding;
yPos := cNodePadding; // Initial Y position
maxHeightInRow := 0;
leftNode := nil;
rightNode := nil;
// 1. Left Expression Node (Visited Recursively)
savedParent := FParentControl;
@@ -508,9 +506,6 @@ begin
currentX := cNodePadding;
yPos := cNodePadding; // Initial Y position
maxHeightInRow := 0;
conditionNode := nil;
thenNode := nil;
elseNode := nil;
// 1. Condition Node
savedParent := FParentControl;
@@ -664,7 +659,6 @@ begin
var closeParen := AddLabel(auraNode, ')');
closeParen.Font.Style := closeParen.Font.Style - [TFontStyle.fsBold]; // Normal style
closeParen.Position.Point := TPointF.Create(currentX, yPos);
currentX := closeParen.Position.X + closeParen.Width + closeParen.Margins.Right + cNodePadding / 2; // Add final gap
maxHeightInTitleRow := Max(maxHeightInTitleRow, closeParen.Height + closeParen.Margins.Top + closeParen.Margins.Bottom);
end
else
@@ -673,7 +667,6 @@ begin
var emptyParens := AddLabel(auraNode, '()');
emptyParens.Font.Style := emptyParens.Font.Style - [TFontStyle.fsBold];
emptyParens.Position.Point := TPointF.Create(currentX, yPos);
currentX := emptyParens.Position.X + emptyParens.Width + emptyParens.Margins.Right + cNodePadding / 2;
maxHeightInTitleRow := Max(maxHeightInTitleRow, emptyParens.Height + emptyParens.Margins.Top + emptyParens.Margins.Bottom);
end;
@@ -740,7 +733,6 @@ begin
yPos := cNodePadding; // Start directly with padding
currentX := cNodePadding;
maxHeightInRow := 0;
calleeNode := nil;
// --- Visit Callee ---
savedParent := FParentControl;
@@ -877,7 +869,6 @@ begin
FParentControl := auraNode;
// Start position for children inside the node
yPos := cNodePadding;
prefixWidth := 0;
maxChildWidth := 0; // Max width including prefix + expression
// --- Determine width needed for 'return ' prefix ---
@@ -1009,6 +1000,7 @@ begin
currentX := nameLabel.Position.X + nameLabel.Width + nameLabel.Margins.Right + cNodePadding;
maxHeightInRow := Max(maxHeightInRow, nameLabel.Height + nameLabel.Margins.Top + nameLabel.Margins.Bottom);
opLabel := nil;
if Assigned(Node.Initializer) then
begin
// 3. Operator Label (only if initializer exists)
@@ -1085,7 +1077,6 @@ begin
currentX := cNodePadding;
labelYPos := cNodePadding; // Initial Y position for labels
maxHeightInRow := 0;
valueNode := nil;
// 1. Identifier Label
identifierLabel := AddLabel(auraNode, Node.Identifier.Name);
-8
View File
@@ -65,8 +65,6 @@ type
procedure EnterScope;
procedure ExitScope;
function IsValidIdentifier(const Name: string): Boolean;
// Helper to set and return the static type of a node
function SetType(const Node: IAstNode; const AType: IStaticType): IAstNode; overload;
function SetType(const NodeData: TDataValue; const AType: IStaticType): TDataValue; overload;
protected
@@ -387,12 +385,6 @@ begin
inherited;
end;
function TAstBinder.SetType(const Node: IAstNode; const AType: IStaticType): IAstNode;
begin
(Node as TAstNode).StaticType := AType;
Result := Node;
end;
function TAstBinder.SetType(const NodeData: TDataValue; const AType: IStaticType): TDataValue;
begin
if (not NodeData.IsVoid) and (NodeData.Kind = vkInterface) then