DIRECTORY EditSpan USING [InsertBoxNode, InsertListNode, InsertBranchNode, InsertTextNode], Menus USING [AppendMenuEntry, CreateEntry, CreateMenu, Menu, MenuProc], TiogaDisplayTable USING [New], TiogaDocument USING [TiogaDocumentData, TiogaDocumentDataRec], TiogaNode USING [ItemClassID, Ref, RefBranchNode, RefTextNode], TiogaNodeOps USING [DocFromNode, FromRope, LookupItemID], TiogaPaint USING [TiogaPaint], TiogaTreeOps USING [Parent], TIPUser USING [TIPTable], ViewerClasses, ViewerOps USING [CreateViewer, PaintViewer, RegisterViewerClass]; TiogaViewerClassImpl: CEDAR MONITOR IMPORTS EditSpan, Menus, TiogaDisplayTable, TiogaNodeOps, TiogaPaint, TiogaTreeOps, --TreeCheck,-- ViewerOps = BEGIN OPEN TiogaDocument, ViewerClasses; TiogaNotify: NotifyProc = BEGIN END; TiogaInputModify: ModifyProc = BEGIN END; TiogaInit: InitProc = BEGIN tdd: TiogaDocumentData _ NARROW[self.data]; IF tdd#NIL THEN ERROR; -- not prepared for re-init yet tdd _ NEW[TiogaDocumentDataRec]; tdd.displayTable _ TiogaDisplayTable.New[100]; -- initial allocate of 100 rectangles. Be smarter later self.data _ tdd; HackDocument[tdd]; tdd.displayTable.objects[0].startPos _ [[tdd.text, NIL], 0]; END; HackDocument: PROC [tdd: TiogaDocumentData] = BEGIN root: TiogaNode.RefBranchNode; node: TiogaNode.Ref; boxClass: TiogaNode.ItemClassID _ TiogaNodeOps.LookupItemID[$TestBox, FALSE]; listClass: TiogaNode.ItemClassID _ TiogaNodeOps.LookupItemID[$TestList, FALSE]; text: TiogaNode.RefTextNode _ TiogaNodeOps.FromRope["This is a test of the default text class for Tioga 2. This test message is verbose so that it will overflow a single line on the screen, testing nodes split across multiple display rectangles."]; root _ TiogaNodeOps.DocFromNode[text]; node _ EditSpan.InsertBoxNode[root, text, boxClass]; -- box goes after the text node _ EditSpan.InsertBoxNode[root, node, boxClass]; -- second box node _ EditSpan.InsertListNode[root, node, listClass]; -- list goes after the second box node _ TiogaTreeOps.Parent[node]; -- this is the branch node for the first set of contents node _ EditSpan.InsertBranchNode[root, node]; -- second branch node _ EditSpan.InsertBoxNode[root, node, boxClass, child]; -- box as first child of new branch node _ EditSpan.InsertListNode[root, node, listClass]; -- list goes after the second box text _ EditSpan.InsertTextNode[root, node]; -- text goes after the list text.rope _ "More text, that goes on and on to further test out line breaking and what not. This is not the last sentence. This one isn't either. Finally, this is the last sentence"; tdd.text _ root; END; TiogaSet: SetProc = BEGIN END; TiogaGet: GetProc = BEGIN END; TiogaSave: SaveProc = BEGIN END; TiogaDestroy: DestroyProc = BEGIN END; TiogaScroll: ScrollProc = BEGIN END; ClearAndPaint: Menus.MenuProc = BEGIN self: ViewerClasses.Viewer _ NARROW[parent]; tdd: TiogaDocumentData _ NARROW[self.data]; tdd.displayTable.objects[0].startPos.path.node _ tdd.text; ViewerOps.PaintViewer[NARROW[parent], client]; END; LoadFileAndPaint: Menus.MenuProc = BEGIN ViewerOps.PaintViewer[NARROW[parent], client]; END; tiogaMenu: Menus.Menu _ Menus.CreateMenu[]; tiogaTIP: TIPUser.TIPTable; tiogaClass: ViewerClass _ NEW[ViewerClassRec _ [ paint: TiogaPaint.TiogaPaint, notify: TiogaNotify, modify: TiogaInputModify, init: TiogaInit, set: TiogaSet, get: TiogaGet, save: TiogaSave, destroy: TiogaDestroy, scroll: TiogaScroll, menu: tiogaMenu, tipTable: tiogaTIP ]]; Menus.AppendMenuEntry[tiogaMenu, Menus.CreateEntry["ClearAndPaint", ClearAndPaint]]; Menus.AppendMenuEntry[tiogaMenu, Menus.CreateEntry["LoadFileAndPaint", LoadFileAndPaint]]; ViewerOps.RegisterViewerClass [$Document, tiogaClass]; [] _ ViewerOps.CreateViewer[$Document, [name: "No Name"]]; END. ¼-- TiogaViewerClassImpl.mesa; Written by S. McGregor -- Edited by McGregor on August 30, 1983 2:52 pm TreeCheck USING [Verify], hack together a test document TreeCheck.Verify[root]; Êo˜JšÏc4™4Jš0™0J˜šÏk ˜ Jšœ žœC˜QJšœžœ<˜GJšœžœ˜Jšœžœ+˜>Jšœ žœ0˜?Jšœ žœ'˜9Jšœ žœ˜Jšœ žœ ˜Jšœžœ ˜Jšœ žœ ™Jšœ˜Jšœ žœ2˜AJ˜—Jšœž ˜#˜JšžœMœ ˜n—J˜Jšžœžœ˜(J˜šÏn œž˜Jšžœ˜—J˜šŸœž˜$Jšžœ˜—J˜šœž˜Jšœžœ ˜+Jš žœžœžœžœ˜6Jšœžœ˜ Jšœ/8˜gJšœ˜Jšœ˜Jšœ3žœ˜Jšœ<#˜_Jšœ7!˜XJšœ,˜GJ˜¹J™Jšœ˜Jšžœ˜—J˜šŸœ ž˜Jšžœ˜—J˜šŸœ ž˜Jšžœ˜—J˜šŸ œ ž˜Jšžœ˜—J˜šŸ œž˜!Jšžœ˜—J˜šŸ œž˜Jšžœ˜—J˜šŸ œž˜%Jšœžœ ˜,Jšœžœ ˜+Jšœ:˜:Jšœžœ˜.Jšžœ˜J˜—šŸœž˜(Jšœžœ˜.Jšžœ˜—J˜Jšœ+˜+Jšœ˜J˜šœžœ˜0J˜J˜J˜J˜J˜J˜J˜J˜J˜Jšœ˜Jšœ˜J˜J˜—JšœT˜TJšœZ˜ZJ˜J˜6J˜Jšœ:˜:J˜Jšžœ˜J˜—…—¨Ó