BoxTree.mesa
Definitions for Displaying Mathematical Expressions
11/17/87 - this may be obsoleted by MathDisplay.mesa
DIRECTORY
InternalExpr USING [EXPR],
Imager USING [Context, Color];
BoxTree: CEDAR DEFINITIONS
~ BEGIN
Type Definitions
BOXTREE: TYPE ~ REF BoxTreeRep;
BoxTreeRep: TYPE ; -- use implementation type
STYLE: TYPE ~
RECORD [
scale: REAL ← 1.0, -- scaling factor for bounding box
looks: REF ANYNIL -- italics, bold...
];
Selection: TYPE ~ RECORD[expr: InternalExpr.EXPR, color: Imager.Color];
Display & Formatting
Format: PUBLIC PROC [expr: InternalExpr.EXPR, style: STYLE] RETURNS [boxTree: BOXTREE];
returns a boxed expression formatted in user space
Paint: PUBLIC PROC [boxTree: BOXTREE, context: Imager.Context, selections: LIST OF Selection];
paints a boxed expression in the imager space given by context
Selection Operations
Selectable: PROC[expr: InternalExpr.EXPR] RETURNS[BOOL];
effects: Returns TRUE iff expr is selectable.
SelectableParent: PROC[expr: InternalExpr.EXPR] RETURNS[InternalExpr.EXPR];
effects: Returns the parent (enclosing expression) of expr.
SIGNALS noSelection if no selectable parent exists.
SelectableChild: PROC[expr: InternalExpr.EXPR] RETURNS[InternalExpr.EXPR];
effects: Returns a child expressions (subexpression) for expr.
SIGNALS noSelection if no selectable child exists.
SelectableSibling: PROC[expr: InternalExpr.EXPR] RETURNS[InternalExpr.EXPR];
effects: Returns the "next" sibling expression from expr.
SIGNALS noSelection if no selectable sibling exists.
Replace: PROC[expr, old, new: InternalExpr.EXPR] RETURNS[InternalExpr.EXPR];
effects: Returns a copy of expression expr with new substituted for old.
caveats: Return value must be reformatted before Paint[]'ing.
Note that new is used (not a copy).
Signals & Errors
unable: ERROR[reason: ATOM];
noSelection: ERROR;
END.