-- TEditInputOps.mesa, Edited by Paxton on December 31, 1982 2:16 pm
DIRECTORY
Rope USING [ROPE],
TextEdit USING [CapChange, Ref],
TextLooks USING [Look, Looks],
TextNode USING [Location, Ref, RefTextNode, Offset],
TEditDocument USING [Selection, SelectionGrain, SelectionId],
TEditLocks USING [Access];
TEditInputOps: CEDAR DEFINITIONS =
BEGIN OPEN TEditDocument;
CallWithLocks: PROC [
proc: PROC [root: TextEdit.Ref, tSel: Selection],
access: TEditLocks.Access ← write];
CallWithBothLocked: PROC [
proc: PROC [
sourceRoot, destRoot: TextEdit.Ref,
tSel, srcSel, targetSel: Selection],
targetSel, srcSel: Selection,
sourceAccess: TEditLocks.Access];
InsertChar: PROC [char: CHARACTER] ;
-- Inserts a character in the document at the primary selection and repaints
InsertRope: PROC [rope: Rope.ROPE];
-- like InsertChar, but for entire rope
InsertLineBreak: PROC;
-- insert a CR and then copies blanks from front of previous line
BufferedInsertChar: PROC [char: CHARACTER] ;
-- Exactly as InsertChar, but returns immediately, forking a repaint process. This is
-- intended for use with user type-in. See TEditBufferedInputImpl
BufferedInsertText: PROC [text: Rope.ROPE] ;
-- Exactly as InsertChar, but returns immediately, forking a repaint process. This is
-- intended for use with user type-in. See TEditBufferedInputImpl
WaitForInsertToFinish: PROCEDURE; -- returns after buffered input has completed
BackSpace: PROC [count: INT ← 1];
-- Deletes the character preceeding the insertion point and repaints the document
BackWord: PROC [count: INT ← 1];
-- Deletes the word preceeding the insertion point and repaints the document
DeleteNextChar: PROC [count: INT ← 1];
-- Deletes the character after the insertion point and repaints the document
DeleteNextWord: PROC [count: INT ← 1];
-- Deletes the word after the insertion point and repaints the document
GoToNextChar, GoToPreviousChar, GoToNextWord, GoToPreviousWord,
GoToNextNode, GoToPreviousNode: PROC [count: INT ← 1];
-- commands for moving caret
FindPrevWord: PROC [node: TextNode.RefTextNode, offset: TextNode.Offset]
RETURNS [nChars: CARDINAL];
FindNextWord: PROC [node: TextNode.RefTextNode, start: TextNode.Offset]
RETURNS [nChars: CARDINAL];
MakeControlCharacter, UnMakeControlCharacter: PROC ;
MakeOctalCharacter, UnMakeOctalCharacter: PROC ;
DoPendingDelete: PROC ;
Delete: PROC [saveForPaste: BOOLEANTRUE] ;
-- Deletes the primary selection
Paste: PROC;
-- insert the last deletion at current insertion point
SaveForPaste: PROC;
-- save the selection for future Paste
SaveSpanForPaste: PROC [
startLoc, endLoc: TextNode.Location, grain: TEditDocument.SelectionGrain];
-- like SaveForPaste, but saves the given span rather than the selection
Break: PROC;
-- break node at current insertion point
Join: PROC;
-- copies text of current insertion point node to end of previous node
-- then deletes node and makes point selection at place where joined them
Nest: PROC;
-- move the selection to a deeper nesting level in the tree
UnNest: PROC;
-- move the selection to a shallower nesting level in the tree
Move: PROC [target: SelectionId ← primary] ;
-- Move the contents of the other selection to the target selection
CheckReadonly: PROC [targetSel: Selection] RETURNS [BOOL];
Copy: PROC [target: SelectionId ← primary] ;
-- Copy the contents of the other selection to the target selection
CopyLooks: PROC [target: SelectionId ← primary] ;
-- Copy the looks of the other selection to the target selection
CopyType: PROC [target: SelectionId ← primary] ;
-- Copy the type of the other selection to the target selection
Transpose: PROC [target: SelectionId ← primary] ;
-- Transpose the contents of the primary and secondary selections
TransposeLooks: PROC [target: SelectionId ← primary] ;
-- Transpose the looks of the primary and secondary selections
TransposeType: PROC [target: SelectionId ← primary] ;
-- Transpose the types of the primary and secondary selections
InsertBrackets: PROC [left, right: CHAR];
-- insert left char at start of selection, right char after selection
SelectMatchingBrackets: PROC [left, right: CHAR];
-- extend selection until includes matching left and right brackets
DoSelectMatchingBrackets: PROC [left, right: CHAR] RETURNS [found: BOOL];
-- extend selection until includes matching left and right brackets
NextViewer: PROC [forward: BOOLEAN] ;
-- move selection to next viewer in left-right, top-bottom order
DoNextViewer: PROC [forward: BOOLEAN] RETURNS [found: BOOL];
FindPlaceholders: PROCEDURE [next: BOOLEAN];
DoFindPlaceholders: PROCEDURE [next, gotoend: BOOL,
startBoundaryNode, endBoundaryNode: TextNode.Ref ← NIL,
startBoundaryOffset: TextNode.Offset ← 0,
endBoundaryOffset: TextNode.Offset ← LAST[TextNode.Offset]]
RETURNS [found, wenttoend: BOOL];
Find: PROC;
-- find next instance of selected text
Position: PROC;
-- find location corresponding to selected number
InsertTime: PROC;
-- insert the current date and time
Capitalise: PROC [flavor: TextEdit.CapChange] ;
-- Perform the capitalisation operation on the target selection
ModifyLook: PROC [look: TextLooks.Look, op: ModifyOp] ;
-- change the looks of a selection
ModifyCaretLook: PROC [look: TextLooks.Look, op: ModifyOp] ;
-- change the looks of a selection caret
ModifyOp: TYPE = {add, remove} ;
ChangeLooks: PROC [add, remove: TextLooks.Looks] ;
-- wholesale change of the selection looks
ChangeCaretLooks: PROC [add, remove: TextLooks.Looks] ;
-- wholesale change of the caret looks
SetStyle: PROC ;
-- sets style of caret node to word before caret
SetStyleName: PROC [name: Rope.ROPE, node: TextNode.Ref ← NIL];
-- sets style of caret node to given name
-- if node is nil, sets style for caret node
ReloadStyle: PROC ;
-- reloads style of caret node
ReloadStyleName: PROC [name: Rope.ROPE];
-- reloads named style
SetType: PROC ;
-- sets type of caret node to word before caret
GetType: PROC ;
-- inserts type of caret node
SetTypeName: PROC [name: Rope.ROPE, node: TextNode.Ref ← NIL];
-- sets type of caret node to given name
-- if node is nil, sets type for caret node
SetCommentProp: PROC [flag: BOOLEAN];
RegisterAbbrevFailedProc: PROC [proc: PROC RETURNS [BOOL]];
-- called if ExpandAbbreviation finds an unknown key
-- call with NIL to unregister
-- only one proc registered at a time
ExpandAbbreviation: PROC;
-- expand abbreviation at insertion point
LoadAbbreviations: PROC [dictName: Rope.ROPE];
-- abbreviatiions files are loaded automatically
-- can call this to force reloading after have changed contents
EditFailed: PROC [msg: Rope.ROPENIL];
END.