DIRECTORY TextNode USING [Location, Ref, RefTextNode, Span], TextLooks USING [Runs], Rope USING [ROPE], ViewerClasses USING [Viewer]; EditNotify: CEDAR DEFINITIONS = BEGIN Ref: TYPE = TextNode.Ref; RefTextNode: TYPE = TextNode.RefTextNode; Offset: TYPE = INT; ROPE: TYPE = Rope.ROPE; ChangeType: TYPE = { ChangingView, ChangingText, ChangingTextForPaste, ChangingSpanForPaste, ChangingFormat, ChangingProp, MovingNodes, NodeNesting, InsertingNode }; Change: TYPE = RECORD [SELECT kind: ChangeType FROM ChangingView => [ viewer: ViewerClasses.Viewer, old: TextNode.Location ], ChangingText => [ root: Ref, text: RefTextNode, start, newlen, oldlen: INT, oldRope: ROPE, oldRuns: TextLooks.Runs, oldCharSets: REF, oldCharProps: REF ], ChangingTextForPaste => [ rope: ROPE, runs: TextLooks.Runs, charSets: REF, charProps: REF, start, len: INT ], ChangingSpanForPaste => [ span: TextNode.Span ], ChangingFormat => [ -- change format for node root: Ref, node: Ref, newFormatName, oldFormatName: ATOM ], ChangingProp => [ -- change property for node root, node: Ref, propName: ROPE, propAtom: ATOM, newval, oldval: REF ], MovingNodes => [ destRoot, sourceRoot: Ref, dest, first, last, pred: Ref, nesting: INTEGER, afterDest: BOOL ], NodeNesting => [ -- change nesting of nodes [first..last] root, first, last: Ref, change: INTEGER ], InsertingNode => [ -- insert new node after dest root, new, dest: Ref ], ENDCASE ]; ChangeSet: TYPE = PACKED ARRAY ChangeType OF Flag; Flag: TYPE = BOOL _ FALSE; defaultChangeSet: ChangeSet = ALL[TRUE]; EditNotifyProc: TYPE = PROC [change: REF READONLY Change]; When: TYPE = { before, after }; Priority: TYPE = { high, normal, low }; AddNotifyProc: PROC [proc: EditNotifyProc, time: When _ after, priority: Priority _ normal, changeSet: ChangeSet _ defaultChangeSet]; RemoveNotifyProc: PROC [proc: EditNotifyProc, time: When _ after]; Notify: PROC [change: REF READONLY Change, time: When]; END. &EditNotify.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. written by Bill Paxton, March 1981 last edit by Bill Paxton, May 13, 1982 5:04 pm Last Edited by: Maxwell, January 5, 1983 8:42 am Rick Beach, March 27, 1985 1:11:24 pm PST Michael Plass, March 18, 1985 4:11:48 pm PST Doug Wyatt, March 2, 1985 3:29:41 pm PST **** Change Record **** dest cannot be within nodes [first..last] pred is the node before first. pred and nesting used for undo **** Notification Operations **** indicates whether notify before or after the change has taken place high priority procs called before normal, and normal called before low e.g., might use high priority for clearing style cache, normal for redisplay, and low for saving replay info add new proc to list of notification procedures call proc before/after any edit in its changeSet use time=before for applications such as saving text for undo use time=after for applications such as reformat & redisplay remove proc from list of notification procedures call the appropriate edit notify procs Κ‡˜codešœ™Kšœ Οmœ1™