--file: QuickViewer.mesa
--Author: Frank Crow April 13, 1983 10:46 am
Last Edited by: CSChow, January 12, 1985 1:30:46 pm PST
DIRECTORY
Graphics USING [Context],
Menus USING [MouseButton],
Rope USING [ ROPE ];
--This interface provides a quick graphics interface. It features:
(1) Refresh: Erase and Redraw the display
(2) RollLeft (<<<): Translate the display. Left = -64, middle = -128, right = -256
(3) RollRight(>>>): Translate the display. Left = 64, middle = 128, right = 256
(4) Enlarge: Resize the display: Left = 1.2X, middle = 2X, right = 4X
(5) Reduce: Resize the display: Left = 0.8X, middle = 0.5X, right = 0.25X
(6) There is a scrollbar on the left to move the display up and down
(7) Controlled menus are menus which can be "opened" or "closed" by clicking the controlling buttons (cf. `levels' and `places' in Tioga.) 2 fixed menu lines and up to 5 controlled menu lines are allowed.
--Caveat: This interface only allows one instance of QuickViewer. Substantial redesign and changes are needed to make it handle multiple instances
QuickViewer: CEDAR DEFINITIONS =
BEGIN
BuildViewer: PROC[
ReDrawProc: PROC[Graphics.Context, REAL], --(1) context, (2) scaleFactor. If autoScaling = TRUE then QuickViewer will do the scaling automatically. If client wants to print ropes without the effect of scaling, the scaling has to be done by the redraw proc explicitly.
QuitProc: PROC[],
MenuButtonProc: PROC[ATOM, Menus.MouseButton, BOOL, BOOL], --event, mouseButton, shift, control--
ViewerClickProc: PROC[ATOM, REAL, REAL], --ATOM is one of {$LeftButton, $LeftHeld, $LeftUp, $MiddleButton,..., ..., $RighButton, ..., ...}, xControlPt, yControlPt
viewerTitle: Rope.ROPE,
autoScaling: BOOL, --If this is true then ReDrawProc don't have to handle scaling
menuLabelsLine0, menuLabelsLine1, --These are the fixed menu lines
controlledLine2, controlledLine3, controlledLine4, controlledLine5, controlledLine6: LIST OF ATOMNIL --The first atom in a controlled line is the controlling atom for that menu line. Any line (fixed or controlled) can be defaulted.
];
Make a viewer with the supplied menu labels. Use the supplied ReDrawProc
when the screen must be redrawn (because the viewer changes size, etc.).
Use the supplied QuitProc to clean up on program termination
(which occurs when the viewer is destroyed.
DrawInViewer: PROC [proc: PROC[Graphics.Context, REAL]];
--Callback procedure used to draw on display. QuickViewer will supply the graphics context to the supplied procedure then call it. The second argument is scaleFactor
EraseViewer: PROC[]; --Clears the viewer--
SetViewerName: PROC[name: Rope.ROPE]; --Change viewer name
END.