DrawArrow:
PROC [context: Graphics.Context] =
BEGIN
-- apply an orientation to a point
MapPoint:
PROC [p: CD.Position, cellSize: CD.Position, orient: CD.Orientation]
RETURNS [CD.Position] =
INLINE
BEGIN
RETURN[CDOrient.MapPosition[
itemInCell: [x1: p.x, y1: p.y, x2: p.x, y2: p.y],
cellSize: cellSize, cellInstOrient: orient]];
END;
MapReal:
PROC[x, y:
REAL]
RETURNS [xi, yi:
INT] =
INLINE BEGIN
orig: CD.Position;
orig.x ← Real.Fix[x]; orig.y ← Real.Fix[y];
orig ← CDInline.AddPoints[MapPoint[orig, aptr.ob.size, orient], pos];
RETURN[orig.x, orig.y];
END;
RealPoint: TYPE = RECORD [x: REAL, y: REAL];
RealPointArray8: TYPE = ARRAY NAT[0..8) OF RealPoint;
x, y: INT;
sx1, sx2, sy1, sy2: INT;
arrow: RealPointArray8 ← [ [0,0], [0,0.75], [0.25,0.5], [0.75,1], [1,0.75], [0.5,0.25], [0.75,0], [0,0] ];
path: Graphics.Path ← Graphics.NewPath[size: 8];
IF context = NIL THEN RETURN;
-- draw the arrow
[sx1, sy1] ← MapReal[0.0, 0.0];
[sx2, sy2] ← MapReal[arrowSize, arrowSize];
[x, y] ← MapReal[arrow[0].x * arrowSize, arrow[0].y * arrowSize];
Graphics.MoveTo[path, x, y, TRUE];
FOR i:
INT
IN [1..8)
DO
[x, y] ← MapReal[arrow[i].x * arrowSize, arrow[i].y * arrowSize];
Graphics.LineTo[path, x , y];
ENDLOOP;
Graphics.DrawArea[self: context, path: path];
END;
DrawName: PROC [context: Graphics.Context] =
BEGIN
name: Rope.ROPE ← NARROW[aptr.ob.specificRef, MarkObj].name;
allr: CD.Rect ← [x1: arrowSize * markScale, y1: 0, x2: markWidth * markScale, y2: markHeight * markScale];
r: CD.Rect;
r ← CDInline.MoveRect[CDOrient.MapRect[allr, aptr.ob.size, orient], pos];
pr.drawComment[r, name, pr];
END;