TreeGrapherViewer.mesa
Copyright Ó 1990, 1991 by Xerox Corporation. All rights reserved.
Michael Plass, July 13, 1990 1:04 pm PDT
DIRECTORY
Imager USING [Context],
ImagerColor USING [Color],
ImagerFont USING [Font],
Prop USING [PropList],
RefTab USING [Ref],
Rope USING [ROPE],
TreeGrapher USING [Node, LayoutParameters],
Vector2 USING [VEC],
ViewerClasses USING [ClickProc];
TreeGrapherViewer: CEDAR DEFINITIONS
~
BEGIN
OPEN ImagerColor, ImagerFont, Rope, Vector2;
ViewerData: TYPE ~ REF ViewerDataRep;
ViewerDataRep:
TYPE ~
RECORD [
tree: TreeGrapher.Node,
origin: VEC,
style: RefTab.Ref, -- of TextFormat
lp: TreeGrapher.LayoutParameters,
click: ViewerClasses.ClickProc ¬ NIL -- default: clientData will narrow to TreeGrapher.Node
];
TextFormat: TYPE ~ REF TextFormatRep;
TextFormatRep:
TYPE ~
RECORD [
font: LIST OF Font, -- last one re-used; cyclic list OK
skip: REAL ¬ 12.0,
textColor: Color,
fillColors: LIST OF Color ¬ NIL,
borderWidth: REAL ¬ 1.0,
bearoff: VEC ¬ [3.0, 2.0],
propList: Prop.PropList
];
TreeGrapher.Node creation
ClassData: TYPE ~ REF ClassDataRep; -- lives in Node.classData for all of the following
ClassDataRep:
TYPE =
RECORD [
more: REF,
paint: PROC [TreeGrapher.Node, Imager.Context],
click: ViewerClasses.ClickProc -- clientData will narrow to TreeGrapher.Node
];
NodeFromText:
PROC [lines:
LIST
OF
ROPE, textFormat: TextFormat, fillSizes:
LIST
OF
REAL ¬
NIL, clientData:
REF ¬
NIL, click: ViewerClasses.ClickProc ¬
NIL]
RETURNS [TreeGrapher.Node];
TextData: TYPE ~ REF TextDataRep;
TextDataRep:
TYPE =
RECORD [
lines: LIST OF ROPE,
clientData: REF ¬ NIL,
fillSizes: LIST OF REAL ¬ NIL
];
NodeFromRope: PROC [label: ROPE, textFormat: TextFormat] RETURNS [TreeGrapher.Node];
Misc
FindFormat:
PROC [data: ViewerData, formatName:
ATOM]
RETURNS [result: TextFormat];
TreeFromSExpr:
PROC [sexpr:
REF, data: ViewerData]
RETURNS [TreeGrapher.Node];
NodeFromRef: PROC [ref: REF, data: ViewerData] RETURNS [TreeGrapher.Node];
NewViewerData: PROC RETURNS [ViewerData];
END.