DIRECTORY Pipal, PipalEdit, PipalInt, PipalInteractiveEdit, PipalReal; PipalTextEditor: CEDAR DEFINITIONS = BEGIN pipalTextClass: Pipal.Class; PipalText: TYPE = REF PipalTextRec; PipalTextRec: TYPE = RECORD [ rope: Pipal.ROPE _ NIL, size: PipalReal.Size _ PipalReal.emptySize]; Location: TYPE = INT; CreatePipalText: PROC [rope: Pipal.ROPE, size: PipalReal.Size _ PipalReal.emptySize] RETURNS [text: PipalText]; GetSelectionInterval: PROC [text: PipalText, position: PipalReal.Position, grain: SelectionGrain] RETURNS [interval: PipalInt.Interval, closerRight: BOOL]; textEditorClass: Pipal.Class; TextEditor: TYPE = REF TextEditorRec; TextEditorRec: TYPE = RECORD [ selections: ARRAY Selections OF Selection, paste: Pipal.ROPE _ NIL]; Selections: TYPE = {primary, secondary}; Selection: TYPE = RECORD [ valid: BOOL _ FALSE, interval: PipalInt.Interval, pendingDelete: BOOL _ FALSE, caretAfter: BOOL _ FALSE, granularity: SelectionGrain]; SelectionGrain: TYPE = {char, word}; Create: PROC [text: PipalText] RETURNS [editor: PipalEdit.Editor]; InsertRope: PROC [editor: PipalEdit.Editor, characters: Pipal.ROPE]; InsertChar: PROC [editor: PipalEdit.Editor, character: CHAR]; Move: PROC [editor: PipalEdit.Editor]; Copy: PROC [editor: PipalEdit.Editor]; Transpose: PROC [editor: PipalEdit.Editor]; Delete: PROC [editor: PipalEdit.Editor]; Paste: PROC [editor: PipalEdit.Editor]; Erase: PROC [editor: PipalEdit.Editor]; SetSelection: PROC [editor: PipalEdit.Editor, interval: PipalInt.Interval, selection: Selections _ primary, pendingDelete: BOOL _ FALSE, caretAfter: BOOL _ FALSE, granularity: SelectionGrain _ char]; CancelSelection: PROC [editor: PipalEdit.Editor, selection: Selections _ primary]; InteractiveEditor: PROC [size: PipalReal.Size] RETURNS [viewerData: PipalInteractiveEdit.ViewerData]; END. –PipalTextEditor.mesa Copyright Σ 1988 by Xerox Corporation. All rights reserved. Barth, February 5, 1988 3:32:46 pm PST Theory The Pipal text editor. The look and feel is stolen from Tioga. Text Class Convert a 2D position and grain specification into a selection interval and a boolean which indicates if the position was closer the right edge of the selection bounding box than the left edge. Text Editor Class Creation Make an editor object. Manipulation Insert the characters at the primary selection caret location. If pending delete then delete the primary selection, put it into the paste buffer, and reduce the primary selection size to 0. Errors: noPrimarySelection Insert the character at the primary selection caret location. If pending delete then delete the primary selection, put it into the paste buffer, and reduce the primary selection size to 0. Errors: noPrimarySelection Move the secondary selection to the primary selection caret location. If pending delete then delete the primary selection, put it into the paste buffer, and reduce the primary selection size to 0. Reduce the secondary selection size to 0. Errors: noPrimarySelection, noSecondarySelection Copy the secondary selection to the primary selection caret location. If pending delete then delete the primary selection, put it into the paste buffer, and reduce the primary selection size to 0. Errors: noPrimarySelection, noSecondarySelection Transpose the primary and secondary selections. Errors: noPrimarySelection, noSecondarySelection Delete the primary selection, put it into the paste buffer, and reduce the primary selection size to 0. Errors: noPrimarySelection Insert the paste buffer at the primary selection caret location. Errors: noPrimarySelection Delete the character before the primary selection caret. Errors: noPrimarySelection, noCharacterToErase Selection Invalidate the selection. Interactive Editor Make an empty editor. ΚS˜– "Cedar" stylešœ™Jšœ<™