Copyright (C) 1994, Digital Equipment Corp. INTERFACEGEF - GraphVBT Edit Format - is a FormsVBT semi-equivalent for GraphVBT.GEF ;
Allows the reading and writing of GraphVBT windows as a string of s-expressions.
For a full description of the top-level objects and the meanings of their fields, read the GraphVBT interface.
The .gef file consists of an Ascii Sx expression (see Sx.i3). A typical element looks like:
(<ElementType> (Name <name>) (<PropName1> <value>) (<PropName2> <value>) ...)
The syntax of GEF values (GEF desired type - Sx type):
BOOLEAN: boolean
INTEGER: integer
REAL: integer or real
TEXT: integer, text or symbol
Enumerated: text or symbol of a valid element of the enumeration
ColorSpec:
Bg
or Fg
: builtin PaintOp.Bg, PaintOp.Fg
text or symbol: Color name (See ColorName.i3)
<real real real>: RGB specification (0 0 0 is Black, 1 1 1 is white)
FontSpec:
font sizes are given in world coordinates
BuiltIn
: builtin Font.BuiltIn
text or symbol: Font name (in X11 format)
-<foundry>-<family>-<weight>-<slant>-*-*-*-<size>-*-*-*-*-*-*
property format:
(Foundry <text>) - default *
(Family <text>) - default Helvetica
(Weight <text>) - default Medium
(Slant <one of R
, I
, O
, RI
, RO
, OT
>) - default R
(Size <real>) - default 0.0353 (10pt in default world and size)
Element: either a name of an element, or an sx expression describing a new element
Element types:
Graph: GEF.T = GraphVBT.T OBJECT ...
(Graph (World <west, east, north, south: REAL>) (Margin <margin: REAL>) (PixelSizeDivisor <w, h: INTEGER>) (PrefSize <width, height: REAL>) (Aspect <aspect: REAL>) (ClientData <data: Sx>) (Contents <sequence of elements: Element> ) )
Notes: World, Margin, PixelSizeDivisor, PreferredSize correspond directly to the GraphVBT properties of the same name ClientDate is an uninterpreted Sx expression (Sx.T) that can be used by the client of GEF. Contents MUST be the last attribute of a graph
Vertex: GEF.Vertex = GraphVBT.Vertex OBJECT ...
(Vertex (Shape <Rectangle | Ellipse>) (Pos <x, y: REAL>) (Size <w, h: REAL>) (Color <color: ColorSpec>) (Label <label: TEXT>) (Font <font: FontSpec>) (FontColor <color: ColorSpec>) (BorderColor <color: ColorSpec>) (BorderWidth <width: REAL>) )
VertexHighlight: GEF.VertexHighlight = GraphVBT.VertexHighlight OBJECT ...
(VertexHighlight (Vertex <vertex: Element>) (Color <color: ColorSpec>) (Width <width: REAL>) )
Edge: GEF.Edge = GraphVBT.Edge OBJECT ...
(Edge (Vertices <vertex0, vertex1: Element (must be vertex)>) (Controls <control0, control1: Element (must be vertex)>) (Width <width: REAL>) (Color <color: ColorSpec>) (Arrows <atVertex0, atVertex1: BOOLEAN>) )
Notes: Both vertices must be given Controls may both be NIL or both must be given
Polygon: GEF.Polygon = GraphVBT.Polygon OBJECT ...
(Polygon (Vertices <sequence of vertices: Element (must be vertex)>) (Color <color: ColorSpec>) )
Arc: GEF.Arc - an elliptical arc
(Arc (Center <vertex: Element (must be vertex)>) (Radius <r: REAL>) (Angle <start, stop: REAL>) (Transformation <a11, a12, a21, a22: REAL>) (Width <width: REAL>) (Color <color: ColorSpec>) (Arrow <atStart, atStop: BOOLEAN>) )
Notes:
The center must be a vertex element
Angle is measured in degrees clockwise with 0 degrees the positive
X-axis. The default is 0 and 360 for start and stop respectively.
Transformation defines a 2x2 transformation matrix which is applied
circle of radius Radius
at the origin which is then translated
by Center
. The default is 1.0, 0.0, 0.0, 1.0.
Arrow tells which endpoint of the arc gets an arrowhead
An arc gets translated into 1 - 4 bezier edges approximating
the desired arc
Frame: GEF.Frame - a synchronized set of actions in an animation
(Frame (Time <start, stop: REAL>) (Actions <sequence of actions: Element>) )
Move: GEF.Move - move some vertices along a path
(Move (Elements <sequence of elements: Element>) (Animate <animate: BOOLEAN>) (Path <sequence of edges: Element (must be edges)>) (Pos <x, y: REAL>) )
Notes:
The default for Animate
is TRUE
IF a path is provided, then Pos
is set to the last vertex of the last edge
in Path
. (If you really want to have pos different - not recommended - then
have the Pos
field after the Path
field.)
Pos does not make much sense for more than one vertex
Rotate: GEF.Rotate - rotate some vertices around a common center
(Rotate (Center <center: Vertex>) (Elements <sequence of elements: Element>) (Angle <angle: REAL>) (Ends <start, stop Vertex>) (Clockwise <clockwise: BOOLEAN>) )
Notes:
The direction of rotation (determined by the sign of Angle
or
by the value of Clockwise
) also depends on the world coordinates
of the graph. If north > south or west > east then the direction
is reversed. However if both north > south and west > east the
direction is preserved.
It is an error for both Angle
and Ends/Clockwise
to be given.
Angle
is given in degrees. CounterClockwise direction is positive.
Ends
and Clockwise
are used to derive the angle and direction
of rotation. The default for Clockwise
is FALSE.
IMPORT GEFError, GraphVBT, IntRefTbl, RefList, Point, Rd, Rsrc, SLisp, Thread; <* PRAGMA LL *> TYPE S_exp = REFANY; T <: TPublic; TPublic = GraphVBT.T OBJECT id : INTEGER; clientData: S_exp; (* client readable data *) elems : REF ARRAY OF REFANY; (* vertices, edges, etc. *) showAllElements: BOOLEAN := FALSE; METHODS init(interp: SLisp.T): T; END; Vertex <: VPublic; VPublic = GraphVBT.Vertex OBJECT END; Edge <: EPublic; EPublic = GraphVBT.Edge OBJECT END; VertexHighlight <: VHPublic; VHPublic = GraphVBT.VertexHighlight OBJECT END; Polygon <: PPublic; PPublic = GraphVBT.Polygon OBJECT END; Arc <: ArcPublic; ArcPublic = OBJECT END;
t
should be created with NEW(GEF.T).init() and should be installed if
there are any animations involved (that you want to see...)
intervals
is the mapping from s-expressions to character offsets in
the source for the GEF expression.
<* LL < t.mu *> PROCEDURE InitFromText (t : T; description : TEXT; intervals : IntRefTbl.T := NIL; showAllElements: BOOLEAN := FALSE) RAISES {GEFError.T, Thread.Alerted}; PROCEDURE InitFromFile (t : T; filename : TEXT; intervals : IntRefTbl.T := NIL; showAllElements: BOOLEAN := FALSE) RAISES {GEFError.T, Rd.Failure, Thread.Alerted}; PROCEDURE InitFromRd (t : T; rd : Rd.T; intervals : IntRefTbl.T := NIL; showAllElements: BOOLEAN := FALSE) RAISES {GEFError.T, Rd.Failure, Thread.Alerted}; PROCEDURE InitFromSx (t : T; sx : S_exp; showAllElements: BOOLEAN := FALSE) RAISES {GEFError.T, Thread.Alerted}; PROCEDURE InitFromRsrc (t : T; name : TEXT; path : Rsrc.Path; intervals : IntRefTbl.T := NIL; showAllElements: BOOLEAN := FALSE) RAISES {GEFError.T, Rd.Failure, Rsrc.NotFound, Thread.Alerted}; PROCEDURE MoveElem(t: T; elem: REFANY; pt: Point.T); <* LL = VBT.mu *>
moveelem
to pointpt
.pt
is in screen coordinates.
PROCEDURE AddElem(t: T; elem: REFANY); <* LL = VBT.mu *>
Addelem
tot
.
PROCEDURE RedisplayImage(t: T); <* LL = VBT.mu *>
redraw the GEF image
PROCEDURE InvokeEvent (t: T; event: TEXT; args: RefList.T; nonEventsOK := TRUE) RAISES {GEFError.T, Thread.Alerted}; <* LL < t.mu *>
invoke theevent
withargs. If
nonEventsOKthen there is no error is
eventis not defined in the view. Otherwise, it is reported as an error.
PROCEDURE EventData (t1, t2, t3, t4, t5, t6, t7, t8, t9, t10: TEXT := ""): RefList.T;
converts t1..t10 into a parsed s-expression. It is a runtime error if any tx cannot be parsed into a legal s-expression
END GEF.