VoiceEditOps.mesa:
interface to the editing primitives supported [and intercepted for rejection] for voice viewers
Ades, April 28, 1986 5:47:16 pm PDT
DIRECTORY
Rope USING [ROPE],
TEditDocument USING [SelectionId],
TiogaOpsDefs USING [WhichSelection],
ViewerClasses USING [Viewer],
VoiceViewers USING [Selection, SoundInterval];
VoiceEditOps: CEDAR DEFINITIONS = BEGIN
Mumble: PROC [opAttempted: Rope.ROPE, viewerTypes: Rope.ROPE];
called when an edit op is attempted on a combination of viewer types for which it is invalid
DescribeSelection: PROC [which: TiogaOpsDefs.WhichSelection, forceDelete: BOOLEAN, returnSoundInterval: BOOLEAN, viewerAlreadyLocked: ViewerClasses.Viewer ← NIL] RETURNS [failed: BOOLEAN, selection: VoiceViewers.Selection, soundInterval: VoiceViewers.SoundInterval ← NIL];
this routine will characterise the voice corresponding to a selection: if the selection is pendingDelete [or if forceDelete] then the selection.ropeInterval will have non-zero length; if returnSoundInterval then the sound interval corresponding to the whole selection will be characterised - to be saved and inserted somewhere else
selections can only be described if the voiceLock can be taken out on them: this routine returns failed if it cannot get the lock; otherwise it returns with the lock still held. However the caller may pass a viewer in viewerAlreadyLocked to say that he already has that one locked and if this
selection is in the same viewer then we may proceed
ReplaceSelectionWithSavedInterval: PROC [selection: VoiceViewers.Selection, soundInterval: VoiceViewers.SoundInterval, leaveSelected: BOOLEAN] RETURNS [viewerDeleted: BOOLEAN, insertChars, positionAfterInsert: INT];
this routine actually does all the editing work for voice: it is passed a selection specification and a sound specification: if the selection is of non-zero length it is deleted; then if the sound is non-nil it is inserted. If the result of the call is that the contents of the viewer become NIL, then the viewer is deleted
selection.voiceViewerInfo will be updated to contain the new rope; selection.ropeInterval is only used for its start and length fields
if leaveSelected THEN primary selection will be a point at the cut point [soundInterval = NIL] or select the inserted interval; otherwise the primary selection will disappear. The secondary selection always disappears
Delete: PROC;
deletes the primary selection
Copy: PROC [target: TEditDocument.SelectionId ← primary];
copies the contents of the other selection to the target selection
Transpose: PROC [target: TEditDocument.SelectionId ← primary];
transposes the contents of the primary and secondary selections
END.