<<>> <> <> <> DIRECTORY MathExpr USING [EXPR, AtomEXPR, CompoundEXPR, AtomClass, CompoundClass, MatrixClass], MathBox USING [BOX], MathTypes USING [Style], MathRules USING [Size], Rope USING [ROPE], Imager USING [Context, Color]; MathBoxTree: CEDAR DEFINITIONS ~ BEGIN <> ROPE: TYPE ~ Rope.ROPE; <> <> <> <> <> <> <<>> <> <> <> <> BoxTree: TYPE ~ REF BoxTreeRep; -- external abstract type BoxTreeRep: TYPE; -- internal concrete rep ObjectDisplay: TYPE ~ REF ObjectDisplayRep; -- external abstract type ObjectDisplayRep: TYPE; -- internal concrete rep <> Object: PROC[o: ObjectDisplay] RETURNS[Object]; <> <<>> <<>> <<>> <<>> <<>> <> Selection: TYPE ~ RECORD[expr: BoxTree, color: Imager.Color, borderOnly: BOOL _ FALSE]; <> MakeAtomicBoxTree: PROC[tag: ATOM, class: AtomClass, value: ROPE, relBox, absBox: BOX, parent: BoxTree _ NIL] RETURNS[BoxTree]; <> MakeCompoundBoxTree: PROC[tag: ATOM, class: CompoundClass, subExprs: LIST OF BoxTree, relBox, absBox: BOX, parent: BoxTree _ NIL] RETURNS[BoxTree]; <> <<>> MakeMatrixBoxTree: PROC[tag: ATOM, class: MatrixClass, nRows, nCols: INT, elements: LIST OF BoxTree, relBox, absBox: BOX, openSym, closeSym, space: BoxTree, parent: BoxTree _ NIL] RETURNS[BoxTree]; <> <<>> <> ASRopeFromBoxTree: PROC[expr: BoxTree, flavor: ATOM _ $AS] RETURNS[ROPE]; <> <<>> BoxTreeFromExpr: PROC[expr: EXPR] RETURNS[BoxTree]; <> << All Display formatting information is set to default values.>> <<>> ExprFromBoxTree: PROC[expr: BoxTree] RETURNS[EXPR]; <> Copy: PROC[expr: BoxTree] RETURNS[BoxTree]; <> <<>> <> Tag: PROC[expr: BoxTree] RETURNS[ATOM]; <> <<>> Class: PROC[expr: BoxTree] RETURNS[ATOM]; <> <<>> GetSubExprs: PROC[expr: BoxTree] RETURNS[LIST OF BoxTree]; AbsBox: PROC[expr: BoxTree] RETURNS[BOX]; <> << Returns NIL if no subexpressions exist.>> <> GetBoxTree: PROC[tag: ATOM, exprs: LIST OF BoxTree] RETURNS[BoxTree]; <> << SIGNALS exprNotFound if no association exists.>> <> Format: PROC[expr: BoxTree, size: Size] RETURNS[BOX]; <> <> << Returns a bounding box for expr.>> << SIGNALS unable[reason: ATOM] if Formatting can not be completed.>> Paint: PROC[expr: BoxTree, context: Imager.Context, absBox: BOX, selections: LIST OF Selection]; <> <> << Updates absolute bounding boxes (viewer coords).>> << SIGNALS unable[reason: ATOM] if Painting cannot be completed.>> <<>> <> BoxTreeFromCoords: PROC[expr: BoxTree, x, y: REAL] RETURNS[BoxTree]; <> << SIGNALS noSelection if no association exists.>> <<>> Selectable: PROC[expr: BoxTree] RETURNS[BOOL]; <> <<>> SelectableParent: PROC[expr: BoxTree] RETURNS[BoxTree]; <> << SIGNALS noSelection if no selectable parent exists.>> <<>> SelectableChild: PROC[expr: BoxTree] RETURNS[BoxTree]; <> << SIGNALS noSelection if no selectable child exists.>> SelectableSibling: PROC[expr: BoxTree] RETURNS[BoxTree]; <> << SIGNALS noSelection if no selectable sibling exists.>> <<>> Replace: PROC[expr, old, new: BoxTree] RETURNS[BoxTree]; <> <> << Note that new is used (not a copy).>> <<>> ReplacePair: TYPE ~ RECORD[old, new: BoxTree]; ReplaceN: PROC[expr: BoxTree, replacements: LIST OF ReplacePair] RETURNS[BoxTree]; <> << new substitured for old for each pair in replacements. >> <> << Note that the "new" components of replace pairs are used (not copies).>> <> unable: ERROR[reason: ATOM]; noSelection: ERROR; END.