AST development

This commit is contained in:
Michael Schimmel
2025-08-30 16:10:49 +02:00
parent f00676a935
commit d033bd9405
+15 -2
View File
@@ -50,6 +50,7 @@ type
FSpacing: TPointF;
FLastNode: TAuraNode;
FConnections: TList<TPinConnection>;
FCurrentExec: TControl;
function CreateNodeControl(const ATitle, ADetails: string): TAuraNode;
function CreatePin(
AParentNode: TAuraNode;
@@ -175,7 +176,10 @@ end;
function TAstToAuraNodeVisitor.CreateInput(AParentNode: TAuraNode; const ACaption: string; AOffsetY: Single = 0): TControl;
begin
Result := CreatePin(AParentNode, psCircle, paLeft, cDataPinColor, 'data.in.' + ACaption, AOffsetY);
var cap := ACaption;
if cap <> '' then
cap := '.' + cap;
Result := CreatePin(AParentNode, psCircle, paLeft, cDataPinColor, 'data.in' + cap, AOffsetY);
Result.Hint := ACaption;
Result.ShowHint := ACaption <> '';
end;
@@ -188,6 +192,8 @@ end;
function TAstToAuraNodeVisitor.CreateEntry(AParentNode: TAuraNode; AOffsetY: Single = 0): TControl;
begin
Result := CreatePin(AParentNode, psTriangle, paLeft, cExecPinColor, 'exec.in', AOffsetY);
if FCurrentExec <> nil then
FConnections.Add(TPinConnection.Create(FCurrentExec, Result));
end;
function TAstToAuraNodeVisitor.CreateExit(AParentNode: TAuraNode; const ACaption: string; AOffsetY: Single = 0): TControl;
@@ -196,6 +202,8 @@ begin
if cap <> '' then
cap := '.' + cap;
Result := CreatePin(AParentNode, psTriangle, paRight, cExecPinColor, 'exec.out' + cap, AOffsetY);
FCurrentExec := Result;
end;
function TAstToAuraNodeVisitor.CreateNodeControl(const ATitle, ADetails: string): TAuraNode;
@@ -747,7 +755,6 @@ begin
inherited;
Canvas.Stroke.Kind := TBrushKind.Solid;
Canvas.Stroke.Color := TAlphaColors.Dodgerblue;
Canvas.Stroke.Thickness := 2;
// Gehe durch alle gespeicherten Verbindungen und zeichne sie
@@ -764,6 +771,12 @@ begin
LStartPoint := AbsoluteToLocal(LAbsoluteStart);
LEndPoint := AbsoluteToLocal(LAbsoluteEnd);
var str := LConnection.InputPin.TagString;
if Pos('data', str) = 0 then
Canvas.Stroke.Color := TAstToAuraNodeVisitor.cExecPinColor
else
Canvas.Stroke.Color := TAstToAuraNodeVisitor.cDataPinColor;
// Draw a Bezier curve with horizontal tangents at start and end points.
LPath := TPathData.Create;
try