<<-- TiogaDocument.mesa; written by S. McGregor>> <<-- Edited by McGregor on August 19, 1983 10:16 am>> <<-- Edited by Paxton on December 28, 1982 2:07 pm>> DIRECTORY Rope USING [ROPE], TiogaLooks USING [Looks, noLooks], TiogaDisplayTable USING [DisplayTable], TiogaNode USING [Location, RefBranchNode], ViewerClasses USING [Viewer]; TiogaDocument: CEDAR DEFINITIONS = BEGIN TiogaDocumentData: TYPE = REF TiogaDocumentDataRec; TiogaDocumentDataRec: TYPE = MACHINE DEPENDENT RECORD [ -- 9 words text: TiogaNode.RefBranchNode, -- the underlying document data displayTable: TiogaDisplayTable.DisplayTable, -- displayed node information clipLevel: ClipCount _ maxClip, -- controls level clipping for this viewer unused: [0..4) _ 0, scrollGlitch: BOOL _ FALSE, -- if true then try to glitch when scroll scrollSelectionId: SelectionId _ primary, -- scroll to make this visible fixStart: BOOL _ FALSE, -- fix it so it starts after CR or at start of node readOnly: BOOL _ FALSE, -- user edits inhibited movedOut: BOOL _ FALSE, -- have moved nodes out of document since last screen refresh movedIn: BOOL _ FALSE, -- have moved nodes into document since last screen refresh dirty: BOOL _ FALSE, -- haven't refreshed since last edit invisible: BOOL _ FALSE, -- refresh won't happen because iconic or obscured or ... tsInfo: TSInfo _ NIL, -- special procs when in typescript mode lockProcess: PROCESS _ NIL, -- process holding lock on this data structure who: Rope.ROPE, -- who locked the tdd lock: [0..64) _ 0, -- locking for put/get/paints etc. interrupt: [0..64) _ 0, -- number of processes waiting for lock and asking for interrupt < 0>> scroll: Scroll _ no, -- controls scrolling after refresh commentFilter: CommentFilter _ includeComments -- controls showing of comment nodes ]; SelectionId: TYPE = {primary, secondary, feedback}; ClipCount: TYPE = [0..32) ; maxClip: ClipCount = 31; -- use 5 bits for this CommentFilter: TYPE = { includeComments, excludeComments, onlyComments }; Scroll: TYPE = { no, endofdoc, endofsel }; ttyChars: CARDINAL = 128; -- size of input buffer for TS; overflow goes to rope TSInfo: TYPE = REF TSInfoRec; TSInfoRec: TYPE = RECORD [ iIncr: CONDITION, -- raised whenever add to input looks: TiogaLooks.Looks _ TiogaLooks.noLooks, -- for PutChar inputRope: Rope.ROPE, -- for overflow from input array inputLoc: INT _ 0, -- index of next char to read from rope input: PACKED ARRAY [0..ttyChars) OF CHARACTER, iQp, oQp: [0..ttyChars) _ 0, -- read and write indexes for input buffer intParam: INT, -- parameter from TIP waitingInGetChar: BOOL _ FALSE, abort: BOOL _ FALSE ]; Selection: TYPE = REF SelectionRec; SelectionRec: TYPE = RECORD [ viewer: ViewerClasses.Viewer, data: TiogaDocumentData, start: SelectionPoint, end: SelectionPoint, caretX, caretY: INTEGER, granularity: SelectionGrain, punctuation: PunctuationPosition, -- whether spaces are part of the selection insertion: BeforeAfter, looks: TiogaLooks.Looks _ TiogaLooks.noLooks, -- caret looks pendingDelete: BOOL _ FALSE -- Laurel-style pending deletion of selection ]; SelectionPoint: TYPE = RECORD [ pos: TiogaNode.Location, line: INTEGER _ 0, x: INTEGER _ 0, y: INTEGER _ 0, w: INTEGER _ 0, h: INTEGER _ 0, clipped: BOOL _ FALSE, metricsValid: BOOL _ FALSE]; SelectionGrain: TYPE = {point, char, word, node, branch} _ char; PunctuationPosition: TYPE = {none, leading, trailing} _ none; BeforeAfter: TYPE = {before, after} _ before; fatalTiogaError: ERROR ; SpinAndLock: PROC [tdd: TiogaDocumentData, who: Rope.ROPE, interrupt, defer: BOOL _ FALSE] RETURNS [ok: BOOL]; <> <> < 0, returns false without locking.>> Unlock: PROC [tdd: TiogaDocumentData]; <<-- give up the lock>> RecordViewerForRoot: PROC [viewer: ViewerClasses.Viewer, root: TiogaNode.RefBranchNode]; ForgetViewer: PROC [viewer: ViewerClasses.Viewer]; <<-- remove this from the root => viewer mapping>> GetViewerForRoot: PROC [root: TiogaNode.RefBranchNode] RETURNS [viewer: ViewerClasses.Viewer]; END.