TSArtworkImpl.mesa
Michael Plass, December 8, 1982 3:22 pm
Last Edited by: Beach, October 10, 1983 4:29 pm
DIRECTORY
Rope,
TextNode,
TSArtwork,
TSGraphic,
TSObject,
TSOps,
TSOutput,
TSTranslate,
TSTranslatePrivate,
TSTypes;
TSArtworkImpl: CEDAR MONITOR
IMPORTS Rope, TSOps, TSOutput, TSTranslate, TSTranslatePrivate
EXPORTS TSArtwork = {
OPEN TSTypes;
ObjectFromBranchProc: TYPE = TSArtwork.ObjectFromBranchProc;
ROPE: TYPE = Rope.ROPE;
ARec: TYPE = RECORD [
artworkClassName: ROPE,
objectFromBranchProc: ObjectFromBranchProc
];
AList: LIST OF ARec ← NIL;
Register: PUBLIC ENTRY PROCEDURE [
artworkClassName: Rope.ROPE,
objectFromBranchProc: ObjectFromBranchProc
] = {ENABLE UNWIND => NULL;
AList ← CONS[[artworkClassName, objectFromBranchProc], AList];
};
Lookup: PUBLIC ENTRY PROCEDURE [artworkClassName: ROPE]
RETURNS [ObjectFromBranchProc] = {ENABLE UNWIND => NULL;
FOR a: LIST OF ARec ← AList, a.rest UNTIL a=NIL DO
IF a.first.artworkClassName.Equal[artworkClassName] THEN RETURN[a.first.objectFromBranchProc];
ENDLOOP;
RETURN[CreateTypesetObject];
};
CreateTypesetObject: PUBLIC ObjectFromBranchProc = {
object ← NEW[TSGraphic.ObjectRec];
object.paintProc ← TypesetObjectPaint;
object.layoutProc ← TypesetObjectLayout;
object.data ← NEW[TypesetObjectRec ← [node: node]];
};
TypesetObjectRec: TYPE = RECORD [
node: TextNode.Ref,
vlist: TSObject.ItemList
];
TypesetObjectLayout: TSGraphic.LayoutProc = TRUSTED {
data: REF TypesetObjectRec ← NARROW[self.data];
box: TSObject.Box;
data.vlist ← TSTranslate.TreeToVlist[data.node].galley;
TSTranslatePrivate.InitializeStateForNewNode[
data.vlist.listWriter,
NARROW[data.vlist.listWriter.writerData]
];
box ← TSOps.GetSlimBoxFrom[data.vlist];
extent ← box.extent;
};
TypesetObjectPaint: TSGraphic.PaintProc = {
data: REF TypesetObjectRec ← NARROW[self.data];
box: TSObject.Box ← TSOps.GetSlimBoxFrom[data.vlist];
TSOutput.BoxOut[NARROW[context], originX, originY, box^];
};
}.
Michael Plass, September 15, 1982 9:45 am. ENABLE UNWIND => NULL.
Michael Plass, December 8, 1982 3:22 pm. Changed TypesetObjectLayout to return dimensions instead of flexes.
Rick Beach, May 16, 1983 9:56 am. Moved NumberOfBoxes and FirstBoxOf to TSOps.