DIRECTORY TiogaNode, TiogaLooks, TiogaTreeOps, Rope, ViewerClasses; EditNotify: CEDAR DEFINITIONS = BEGIN Ref: TYPE = TiogaNode.Ref; RefBranchNode: TYPE = TiogaNode.RefBranchNode; RefTextNode: TYPE = TiogaNode.RefTextNode; Looks: TYPE = TiogaLooks.Looks; Offset: TYPE = TiogaNode.Offset; ROPE: TYPE = Rope.ROPE; When: TYPE = { before, after }; Priority: TYPE = { high, normal, low }; EditNotifyProc: TYPE = PROC [change: REF READONLY Change]; 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]; ChangeSet: TYPE = PACKED ARRAY OfChange OF Flag; Flag: TYPE = BOOLEAN _ FALSE; defaultChangeSet: ChangeSet = ALL[TRUE]; Change: TYPE = RECORD [SELECT kind:OfChange FROM ChangingView => [ viewer: ViewerClasses.Viewer, old: TiogaNode.Location ], ChangingText => [ root: RefBranchNode, text: RefTextNode, start, newlen, oldlen: Offset, oldRope: ROPE, oldRuns: TiogaLooks.Runs ], ChangingTextForPaste => [ rope: ROPE, runs: TiogaLooks.Runs, start, len: Offset ], ChangingSpanForPaste => [ span: TiogaTreeOps.TreeSpan ], ChangingFormat => [ -- change format for node root: RefBranchNode, node: Ref, newFormatName, oldFormatName: TiogaNode.Name], ChangingProp => [ -- change property for node root: RefBranchNode, node: Ref, propName: ROPE, propAtom: ATOM, newval, oldval: REF], MovingGroup => [ destRoot, sourceRoot: RefBranchNode, dest, sourceStart, sourceEnd, from: Ref, contents: BOOL], MovingNodes => [ destRoot, sourceRoot, dest, first, last: RefBranchNode, pred: Ref, nesting: INTEGER, afterDest: BOOL], NodeNesting => [ -- change nesting of nodes [first..last] root, first, last: RefBranchNode, change: INTEGER], InsertingNode => [ -- insert new node root: RefBranchNode, new, old: Ref, where: Place], Misc => [ -- for other kinds of edits. root tells document which must be locked if undo root: RefBranchNode, info: REF], Misc2 => [ -- for other kinds of edits. roots tell documents which must be locked if undo root1, root2: RefBranchNode, info: REF], ENDCASE ]; Place: TYPE = { before, after, sibling, child }; OfChange: TYPE = { ChangingView, ChangingText, ChangingTextForPaste, ChangingSpanForPaste, ChangingFormat, ChangingProp, MovingGroup, MovingNodes, NodeNesting, InsertingNode, Misc, Misc2 }; END. ÔEditNotify.mesa; written by Bill Paxton, March 1981 edited by Bill Paxton, July 27, 1983 3:34 pm edited by McGregor, February 8, 1983 11:48 am edited by Maxwell, January 5, 1983 8:42 am 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 **** Notification Operations **** 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 **** Change Record **** from is the node before sourceStart. from and contents used for undo dest cannot be within nodes [first..last] pred is the node before first. pred and nesting used for undo Êb˜JšÏc3™3Jš,™,Jš-™-Jš*™*J˜šÏk ˜ J˜ J˜ J˜ J˜J˜—J˜Jšœ ž˜Jšž˜J˜Jšœžœ˜Jšœžœ˜.Jšœ žœ˜*Jšœžœ˜Jšœžœ˜ Jšžœžœžœ˜J˜šœžœ˜JšC™CJ˜—šœ žœ˜'JšF™Fš7™7š4™4J˜J˜———Jšœ!™!J˜Jš Ïnœžœžœ žœžœ ˜:J˜šŸ œžœ˜J˜J˜J˜J˜)Jš/™/šœ0™0Jšœ=™=Jšœ<™