-- TiogaInput.mesa; Edited by Paxton on June 17, 1983 9:19 am
DIRECTORY
Rope USING [ROPE],
TiogaNode USING [RefBranchNode],
TiogaDocument USING [Selection, TiogaDocumentData],
UndoEvent USING [Ref],
ViewerClasses USING [Viewer];
TiogaInput: CEDAR DEFINITIONS = BEGIN
interpreterNesting: INTEGER;
currentEvent: UndoEvent.Ref; -- used by anyone who needs to save info for Undo/Cancel
EditState: TYPE = {
reset,  -- no edit specified
abort,  -- edit aborted
tolimbo, -- delete primary
toprimary, -- copy/move secondary selection to/onto primary
tosecondary, -- copy/move primary to/onto secondary
toboth  -- transpose primary and secondary
};
editState: EditState;
repeatList: LIST OF REF ANY;
chars: REF TEXT; -- buffer for typein
charsClosed, charsUsed, closeEvent: BOOL;
CloseEvent: PROC = INLINE { closeEvent ← TRUE };
CurrentEvent: PROC RETURNS [UndoEvent.Ref] = INLINE { RETURN [currentEvent] };
CloseEventNow: PROC;
CommandProc: TYPE = PROC [viewer: ViewerClasses.Viewer ← NIL]
RETURNS [recordAtom: BOOLTRUE, quit: BOOLFALSE];
Register: PROC [name: ATOM, proc: CommandProc, before: BOOLTRUE];
If before is true, proc goes at front of list. Else goes at end of list.
UnRegister: PROC [name: ATOM, proc: CommandProc];
Remove the proc from the list for the atom.
IsRegistered: PROC [name: ATOM, proc: CommandProc] RETURNS [BOOLEAN];
RecordInt: PROC [i: LONG INTEGER];
RecordChar: PROC [c: CHARACTER];
RecordRef: PROC [ref: REF ANY];
GetRepeatSequence: PROC RETURNS [params: LIST OF REF ANY];
ComIndex: TYPE = [0..9];
SetCommand: PROC [num: ComIndex, params: LIST OF REF ANY];
GetCommand: PROC [num: ComIndex] RETURNS [params: LIST OF REF ANY];
InterpInput: PROC [viewer: ViewerClasses.Viewer, params: LIST OF REF ANY,
increaseNestingCount: BOOLTRUE];
Interpret: PROC [viewer: ViewerClasses.Viewer, params: LIST OF REF ANY];
DontDoIt: SIGNAL; -- raised if user category is too low
BadMouse: SIGNAL; -- raised if mouse "color" is wrong
InterpretAtom: PROC [viewer: ViewerClasses.Viewer, atom: ATOM];
-- as if input from TIP
ResetInputStuff: PROC ;
SaveCoords: PROC [x,y: INTEGER];
ReadTipTables: PROC;
CheckSelection: PROC [sel: TiogaDocument.Selection] RETURNS [BOOLEAN];
AllLevels, FirstLevelOnly, MoreLevels, FewerLevels: CommandProc;
AllLines, FirstLineOnly, MoreLines, FewerLines: CommandProc;
MaxLevelShown: PROC [tdd: TiogaDocument.TiogaDocumentData] RETURNS [level: INTEGER];
MakePointSelection, Normalize: CommandProc;
Cancel, Repeat,
RestoreSelectionA, SaveSelectionA,
RestoreSelectionB, SaveSelectionB: CommandProc;
EditDirection: TYPE = {
toprimary, -- copy/move secondary selection to/onto primary
tosecondary, -- copy/move primary to/onto secondary
toboth   -- transpose primary and secondary
};
RegisterSecondarySelectionCommand: PROC [
name: ATOM, -- this is the name that goes in the TIP table; like EditText, EditLooks, ...
proc: PROC [dir: EditDirection], -- this is the procedure that will be called to do the work
toprimary, tosecondary, toboth: Rope.ROPE -- these are messages to be displayed in the MessageWindow
];
This is for commands that use both primary and secondary selections. Standard examples are for copying/moving/transposing text, looks, or formats.
UnRegisterSecondarySelectionCommand: PROC [name: ATOM];
END.