-- TEditOpsImpl.mesa, Edited by Paxton on October 28, 1982 11:47 am
DIRECTORY
Rope USING [ROPE],
TEditDocument USING [Selection],
TEditSelection USING [pSel, sSel],
TEditScrolling USING [AutoScroll],
UndoEvent,
ViewerClasses USING [Viewer],
TEditOps;
TEditOpsImpl:
CEDAR PROGRAM
IMPORTS TEditSelection, TEditScrolling
EXPORTS TEditOps =
BEGIN OPEN TEditOps, TEditSelection, ViewerClasses;
------ Selections and their contents ------
GetSelContents:
PUBLIC
PROC
RETURNS [contents: Rope.
ROPE] =
{
RETURN[
IF pSel.viewer=
NIL
THEN
NIL
ELSE NARROW[pSel.viewer.class.get[pSel.viewer, $SelChars]]]} ;
GetSelData:
PUBLIC
PROC [primary:
BOOLEAN ←
TRUE]
RETURNS [data: TEditDocument.Selection] =
{RETURN [IF primary THEN pSel ELSE sSel]} ;
------ display ------
AutoScroll:
PUBLIC
PROC [tryToGlitch:
BOOLEAN ←
TRUE] = {
TEditScrolling.AutoScroll[tryToGlitch: tryToGlitch] }; -- scroll to selection
------ Viewers and contents ------
GetTextContents:
PUBLIC
PROC [viewer: Viewer]
RETURNS [contents: Rope.
ROPE] =
{RETURN[NARROW[viewer.class.get[viewer]]]} ;
SetTextContents:
PUBLIC
PROC [viewer: Viewer, contents: Rope.
ROPE] =
{viewer.class.set[viewer, contents]} ;
END.