MathDisplay.mesa
Mcisaac, July 23, 1987 3:36:04 pm PDT
Definitions for Displaying Mathematical Expressions
DIRECTORY
InternalExpr USING [EXPR],
Imager USING [Context, Color];
MathDisplay: CEDAR DEFINITIONS
~ BEGIN
Type Redefinitions
EXPR: TYPE ~ InternalExpr.EXPR;
Type Definitions
BOXTREE: TYPE ~ REF BoxTreeRep;
BoxTreeRep: TYPE ; -- use implementation type
Selection: TYPE ~ RECORD[expr: EXPR, color: Imager.Color];
Display & Formatting
Format: PUBLIC PROC[expr: EXPR] RETURNS [BOXTREE];
returns a boxed expression formatted in user space
Paint: PUBLIC PROC [box: BOXTREE, context: Imager.Context, selections: LIST OF Selection];
paints a boxed expression in the imager space given by context
Selection Operations
Selectable: PROC[expr: EXPR] RETURNS[BOOL];
effects: Returns TRUE iff expr is selectable.
SelectableParent: PROC[expr: EXPR] RETURNS[EXPR];
effects: Returns the parent (enclosing expression) of expr.
SIGNALS noSelection if no selectable parent exists.
SelectableChild: PROC[expr: EXPR] RETURNS[EXPR];
effects: Returns a child expressions (subexpression) for expr.
SIGNALS noSelection if no selectable child exists.
SelectableSibling: PROC[expr: EXPR] RETURNS[EXPR];
effects: Returns the "next" sibling expression from expr.
SIGNALS noSelection if no selectable sibling exists.
Replace: PROC[expr, old, new: EXPR] RETURNS[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.