DIRECTORY Rope USING [ROPE], ViewerClasses USING [Viewer, ViewerRec]; ViewerTools: CEDAR DEFINITIONS = BEGIN OPEN ViewerClasses; ROPE: TYPE ~ Rope.ROPE; Viewer: TYPE ~ ViewerClasses.Viewer; ViewerRec: TYPE ~ ViewerClasses.ViewerRec; FindExistingViewer: PROC [fileName: ROPE] RETURNS [viewer: Viewer]; MakeNewTextViewer: PROC [info: ViewerRec _ [], paint: BOOL _ TRUE] RETURNS [viewer: Viewer]; SelPos: TYPE = REF SelPosRec; SelPosRec: TYPE = RECORD [ start, length: LONG INTEGER _ 0, pendingDelete: BOOL _ FALSE, caretPos: {before, after} _ before ]; SetSelection: PROC [viewer: Viewer, selection: SelPos _ NIL]; GetSelectedViewer: PROC RETURNS [viewer: Viewer]; GetSelectionContents: PROC RETURNS [contents: ROPE]; GetSelection: PROC [viewer: Viewer] RETURNS [selection: SelPos]; GetContents: PROC [viewer: Viewer] RETURNS [contents: ROPE]; SetContents: PROC [viewer: Viewer, contents: ROPE, paint: BOOL _ TRUE]; TiogaContents: TYPE = REF TiogaContentsRec ; TiogaContentsRec: TYPE = RECORD [ contents: ROPE _ NIL, formatting: ROPE _ NIL ]; GetTiogaContents: PROC [viewer: Viewer] RETURNS [contents: TiogaContents]; SetTiogaContents: PROC [viewer: Viewer, contents: TiogaContents, paint: BOOL _ TRUE]; InhibitUserEdits: PROC [viewer: Viewer]; EnableUserEdits: PROC [viewer: Viewer]; END. าViewerTools.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Edited by McGregor on September 2, 1982 9:34 am Last Edited by: Maxwell, January 3, 1983 12:14 pm Doug Wyatt, March 28, 1985 9:28:15 pm PST Finding and Creating Viewers Returns NIL if none could be found. If info.parent=NIL then creates a top-level viewer. Specify name and file in info. Otherwise, pass wx, wy, ww, wh in info for size. For initial contents, pass a rope as the data field in info, or pass a filename in the file field. See Buttons.mesa for creating new buttons. See Containers.mesa for creating new labels. See Labels.mesa for creating new labels. Operations on Selections Set and scroll to a selection. For typescripts, NIL => caret at end. For other text viewers, NIL => entire contents in pending-delete mode. Works only for Tioga and Typescript viewers. Returns the selected viewer. Returns the contents of the selected viewer's selection. Works only when the input focus is in a Tioga and Typescript viewer. Returns the selected viewer and the position of its selection. Works only for Tioga viewers! Contents of Viewers Works for text and maybe some other classes Returns the contents of a Tioga document (formatting information is omitted). Set the contents of a Tioga document. Returns the contents and formatting of a Tioga document. Set the contents and formatting of a Tioga document. Prevent the user from editing a text viewer. Allow the user to edit a text viewer. ส– "Mesa" style˜codešฯc™Kšœ ฯmœ1™