EditGroup.mesa; written by Bill Paxton, July 1983
edited by Bill Paxton, July 21, 1983 3:42 pm
DIRECTORY
TiogaNode,
TiogaTreeOps,
UndoEvent;
EditGroup: CEDAR DEFINITIONS = BEGIN
Ref: TYPE = TiogaNode.Ref;
RefBranchNode: TYPE = TiogaNode.RefBranchNode;
TreeLoc: TYPE = TiogaTreeOps.TreeLoc;
TreeSpan: TYPE = TiogaTreeOps.TreeSpan;
Event: TYPE = UndoEvent.Ref;
A "group" is defined by two sibling nodes and includes those nodes and their contents and their children (if they are branch nodes). The end node for the group must come after the start node or be equal to the start node.
Editing operations on the nontext contents of nodes usual deal with groups.
CannotDoEdit: ERROR;
DeleteGroup: PROC [
root: RefBranchNode, start, end: Ref, saveForPaste: BOOLEANTRUE, event: Event ← NIL];
ReplaceGroup: PROC [
destRoot, sourceRoot: RefBranchNode, destStart, destEnd: Ref,
sourceStart, sourceEnd: Ref, saveForPaste: BOOLEANTRUE, event: Event ← NIL];
Copies the source group after the dest group and then deletes the dest group.
Takes care of overlap between source and dest.
CopyGroup: PROC [
destRoot, sourceRoot: RefBranchNode, dest: Ref, contents: BOOL,
sourceStart, sourceEnd: Ref, event: Event ← NIL];
If contents is true, copy the group to start of the contents list of dest.
Otherwise, copy the group to immediately after dest.
MoveGroup: PROC [
destRoot, sourceRoot: RefBranchNode, dest: Ref, contents: BOOL,
sourceStart, sourceEnd: Ref, event: Event ← NIL];
If contents is true, move the group to start of the contents list of dest.
Otherwise, move the group to immediately after dest.
MoveGroupOnto: PROC [
destRoot, sourceRoot: RefBranchNode, destStart, destEnd: Ref,
sourceStart, sourceEnd: Ref, saveForPaste: BOOLEANTRUE, event: Event ← NIL];
Moves the source group after the dest group and then deletes the dest group.
Takes care of overlap between source and dest.
TransposeGroups: PROC [
alphaRoot, betaRoot: RefBranchNode, alphaStart, alphaEnd: Ref,
betaStart, betaEnd: Ref, event: Event ← NIL]
RETURNS [newAlphaStart, newAlphaEnd, newBetaStart, newBetaEnd: Ref];
Transposes the alpha group and the beta group.
Takes care of overlap between alpha and beta.
END.