EditNotify.mesa
Copyright Ó 1985, 1986, 1988, 1991, 1992 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, January 30, 1992 11:59 am PST
DIRECTORY
Tioga USING [Node, Location, Span],
Rope USING [ROPE],
Rosary USING [ROSARY];
EditNotify: CEDAR DEFINITIONS = BEGIN
ROPE: TYPE ~ Rope.ROPE;
ROSARY: TYPE ~ Rosary.ROSARY;
Node: TYPE ~ Tioga.Node;
ChangeType: TYPE = {
ChangingText, ChangingProp, ChangingSpanForPaste,
MovingNodes, NodeNesting, InsertingNode, ChangingView
};
Change: TYPE = RECORD [SELECT kind: ChangeType FROM
ChangingText => [
text: Node,
start, newlen, oldlen: INT,
oldRope: ROPE,
oldRuns: ROSARY,
oldCharSets: ROSARY,
oldCharProps: ROSARY
],
ChangingProp => [
node: Node,
name: ATOM, newval, oldval: REF
],
ChangingSpanForPaste => [
span: Tioga.Span
],
MovingNodes => [
dest, first, last, pred: Node, nesting: INTEGER,
afterDest: BOOL
],
dest cannot be within nodes [first..last]
pred is the node before first. pred and nesting used for undo
NodeNesting => [ -- change nesting of nodes [first..last]
first, last: Node, change: INTEGER
],
InsertingNode => [ -- insert new node after dest
new, dest: Node
],
ChangingView => [
view: REF,
old: Tioga.Location
],
ENDCASE
];
ChangeSet: TYPE = PACKED ARRAY ChangeType OF Flag;
Flag: TYPE = BOOL ¬ FALSE;
defaultChangeSet: ChangeSet = ALL[TRUE];
**** Notification Operations ****
EditNotifyProc: TYPE = PROC [change: REF READONLY Change];
When: TYPE = { before, after };
indicates whether notify before or after the change has taken place
Priority: TYPE = { high, normal, low };
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
AddNotifyProc: PROC [proc: EditNotifyProc, time: When ¬ after,
priority: Priority ¬ normal, changeSet: ChangeSet ¬ defaultChangeSet];
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
RemoveNotifyProc: PROC [proc: EditNotifyProc, time: When ¬ after];
remove proc from list of notification procedures
Notify: PROC [change: REF READONLY Change, time: When];
call the appropriate edit notify procs
END.