DIRECTORY Rope USING [ROPE], TextEdit USING [RefTextNode], TextLooks USING [Looks, noLooks], TextNode USING [Location, Ref], ViewerClasses USING [Viewer]; TEditDocument: CEDAR DEFINITIONS = BEGIN TEditDocumentData: TYPE = REF TEditDocumentDataRec; TEditDocumentDataRec: TYPE = MACHINE DEPENDENT RECORD [ -- 9 words text: TextEdit.RefTextNode, -- the underlying text data lineTable: LineTable, -- displayed line 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 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 }; LineTable: TYPE = REF LineTableRec; LineTableRec: TYPE = RECORD [ lastLine: INTEGER _ 0, lastY: INTEGER _ 0, lines: SEQUENCE maxLines: INTEGER OF --Line-- LineRec ]; LineRec: TYPE = MACHINE DEPENDENT RECORD [ -- 9 words pos: TextNode.Location, -- first character in line valid: BOOL _ TRUE, -- metrics valid for this line end: LineBreak _ eon, -- reason for line break nChars: [0..8192) _ 0, -- number of characters in line yOffset: INTEGER _ 0, -- baseline from top of viewer xOffset: INTEGER _ 0, -- line offset from left edge of viewer width: INTEGER _ 0, -- width of displayed bits ascent: [0..512) _ 0, -- dy above baseline descent: [0..128) _ 0 -- dy below baseline ]; LineBreak: TYPE = { eon, cr, wrap } _ eon; 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: TextLooks.Looks _ TextLooks.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: TEditDocumentData, start: SelectionPoint, end: SelectionPoint, caretX, caretY: INTEGER, granularity: SelectionGrain, punctuation: PunctuationPosition, -- whether spaces are part of the selection insertion: BeforeAfter, looks: TextLooks.Looks _ TextLooks.noLooks, -- caret looks pendingDelete: BOOL _ FALSE -- Laurel-style pending deletion of selection ]; SelectionPoint: TYPE = RECORD [ pos: TextNode.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: TEditDocumentData, who: Rope.ROPE, interrupt, defer: BOOL _ FALSE] RETURNS [ok: BOOL]; Unlock: PROC [tdd: TEditDocumentData]; RecordViewerForRoot: PROC [viewer: ViewerClasses.Viewer, root: TextNode.Ref]; ForgetViewer: PROC [viewer: ViewerClasses.Viewer]; GetViewerForRoot: PROC [root: TextNode.Ref] RETURNS [viewer: ViewerClasses.Viewer]; END. ì-- TEditDocument.mesa; Edited by Paxton on December 28, 1982 2:07 pm display refresh will terminate if notices interrupt > 0 --Line: TYPE = REF LineRec; if caller is not the original locking process, waits for other process to unlock first if interrupt is true, increments tdd.interrupt to ask repaint of viewer to terminate if defer is true and interrupt is true and tdd.interrupt > 0, returns false without locking. -- give up the lock -- remove this from the root => viewer mapping ʘJšÏc+œ™DJ˜šÏk ˜ Jšœžœžœ˜Jšœ žœ˜Jšœ žœ˜!Jšœ žœ˜Jšœžœ ˜J˜—Jšœžœž˜(J˜Jšœžœžœ˜3š œžœžœž œžœ ˜BJšœ˜8Jšœ˜5Jšœ *˜JJšœ˜Jšœžœžœ)˜FJšœ*˜HJšœ žœžœ3˜LJšœ žœžœ˜/Jšœ žœžœ=˜UJšœ žœžœ;˜RJšœžœžœ$˜9Jšœ žœžœ9˜RJšœžœ(˜@Jšœ žœžœ.˜JJšœ žœ˜'Jšœ"˜7šœ@˜XJšœ7™7—Jšœ#˜:Jšœ/$˜SJ˜J˜—Jšœ žœ"˜3J˜Jšœ žœ ˜Jšœ˜/J˜Jšœžœ6˜IJ˜*J˜Jšœ žœžœ˜#šœžœžœ˜Jšœ žœ˜Jšœžœ˜Jš œžœ žœžœœ˜5J˜J˜—Jš™š œ žœžœž œžœ ˜5Jšœ˜2Jšœžœžœ˜2Jšœ˜.Jšœ˜6Jšœ žœ˜4Jšœ žœ'˜=Jšœžœ˜.Jšœ˜+Jšœ˜+J˜J˜—Jšœ žœ˜*J˜Jšœ žœ5˜OJ˜Jšœžœžœ ˜šœ žœžœ˜Jšœž œ˜1Jšœ,˜:Jšœžœ ˜6Jšœ žœ'˜:Jš œžœžœžœž œ˜/Jšœ*˜GJšœ žœ˜$Jšœžœžœ˜Jšœžœž˜J˜J˜—Jšœ žœžœ˜#šœžœžœ˜J˜J˜J˜J˜Jšœžœ˜J˜Jšœ"+˜MJ˜Jšœ-˜;Jšœžœžœ-˜JJ˜J˜—šœžœžœ˜J˜Jšœžœ˜Jšœžœ˜Jšœžœ˜Jšœžœ˜Jšœžœ˜Jšœ žœžœ˜Jšœžœžœ˜J˜—Jšœžœ,˜@J˜Jšœžœ$˜=J˜Jšœ žœ˜-J˜Jšœžœ˜J˜š Ïn œžœ$žœžœžœ˜ZJšžœžœ˜—JšœV™VJšœT™TJšœ\™\J˜JšŸœžœ˜&Jš™J˜JšŸœžœ4˜MJ˜šŸ œžœ ˜2Jš.™.J˜—JšŸœžœžœ ˜SJ˜Jšžœ˜J˜—…—þ