New visualizer
This commit is contained in:
@@ -18,6 +18,10 @@ uses
|
||||
Myc.Ast.Scope,
|
||||
Myc.Ast.Binding;
|
||||
|
||||
const
|
||||
cDataPinColor = TAlphaColors.Dodgerblue;
|
||||
cExecPinColor = TAlphaColors.Lightgreen;
|
||||
|
||||
type
|
||||
TPinConnection = record
|
||||
OutputPin: TControl;
|
||||
@@ -25,9 +29,6 @@ type
|
||||
constructor Create(AOutputPin, AInputPin: TControl);
|
||||
end;
|
||||
|
||||
// Enum to select the visualization style.
|
||||
TVisualizationMode = (vmDetailed, vmControlFlow);
|
||||
|
||||
TAuraWorkspace = class(TStyledControl)
|
||||
private
|
||||
FConnections: TArray<TPinConnection>;
|
||||
@@ -45,12 +46,7 @@ type
|
||||
procedure DblClick; override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
procedure BuildTree(
|
||||
const RootNode: IAstNode;
|
||||
const RootDescriptor: IScopeDescriptor;
|
||||
const Position: TPointF;
|
||||
AMode: TVisualizationMode
|
||||
);
|
||||
procedure Build(const RootNode: IAstNode; const Position: TPointF);
|
||||
function GetChildrenMatrix(var Matrix: TMatrix; var Simple: Boolean): Boolean; override;
|
||||
function Zoom(Factor: Single): Boolean;
|
||||
|
||||
@@ -95,7 +91,7 @@ implementation
|
||||
uses
|
||||
System.Math,
|
||||
FMX.Platform,
|
||||
Myc.Fmx.AstEditor;
|
||||
Myc.Fmx.AstVisualizer;
|
||||
|
||||
{ TPinConnection }
|
||||
|
||||
@@ -113,23 +109,9 @@ begin
|
||||
FZoom := 1.0;
|
||||
end;
|
||||
|
||||
procedure TAuraWorkspace.BuildTree(
|
||||
const RootNode: IAstNode;
|
||||
const RootDescriptor: IScopeDescriptor;
|
||||
const Position: TPointF;
|
||||
AMode: TVisualizationMode
|
||||
);
|
||||
var
|
||||
connections: TList<TPinConnection>;
|
||||
procedure TAuraWorkspace.Build(const RootNode: IAstNode; const Position: TPointF);
|
||||
begin
|
||||
connections := TList<TPinConnection>.Create;
|
||||
try
|
||||
// Create the scope descriptor from the execution scope provided by the binder.
|
||||
RootNode.Accept(TAstToAuraNodeVisitor.Create(Self, Self, Position, connections, nil, AMode, nil, nil, RootDescriptor));
|
||||
FConnections := FConnections + connections.ToArray;
|
||||
finally
|
||||
connections.Free;
|
||||
end;
|
||||
RootNode.Accept(TAstVisualizer.CreateVisitor(Self, Position));
|
||||
end;
|
||||
|
||||
procedure TAuraWorkspace.DoDeleteChildren;
|
||||
|
||||
Reference in New Issue
Block a user