-- File: SVViewerTool.mesa
-- Last edited by Bier on December 18, 1982 1:43 am
-- Author: Eric Bier before December 7, 1982 8:33 pm
-- My very own container-type class for solid viewers

DIRECTORY
ViewerOps USING [CreateViewer],
ViewerClasses USING [Viewer, ViewerRec];

SVViewerTool: DEFINITIONS IMPORTS ViewerOps =
BEGIN
OPEN ViewerClasses;

SolidViewerTool: TYPE = Viewer;
ViewerToolData: TYPE = REF ViewerToolDataObj;
ViewerToolDataObj: TYPE = RECORD [
 outer: SVViewerTool.SolidViewerTool ← NIL, -- handle for the enclosing container
 height: CARDINAL ← 0,
 textSection: ViewerTextData,
 viewerPicture: ViewerClasses.Viewer ← NIL,
 editToolData: REF ANY, -- to get rid of compilation dependencies
 yBounded: LIST OF Viewer ← NIL,
 xBounded: LIST OF Viewer ← NIL
 ];
 
ViewerTextData: TYPE = RECORD [
 activateLabel: ViewerClasses.Viewer ← NIL,
 viewStyle: ViewerClasses.Viewer ← NIL,
 ais: ViewerClasses.Viewer ← NIL,
 fileName: ViewerClasses.Viewer ← NIL,
 xyz: ViewerClasses.Viewer ← NIL,
 focalLength: ViewerClasses.Viewer ← NIL,
 projection: ViewerClasses.Viewer ← NIL,
 selected: ViewerClasses.Viewer ← NIL,
 isSelected: BOOL
 ];
 


-- Containers are just viewers that are convenient to hold other viewers.

Create: PROC [info: ViewerRec ← [], paint: BOOL ← TRUE] RETURNS [solidViewerTool: SolidViewerTool] =
 INLINE {RETURN[ViewerOps.CreateViewer[$SolidViewerTool, info, paint]]};
 -- Creates a new, empty container. You probably want to pass a name in the info record.

ChildYBound: PROC [solidViewerTool: SolidViewerTool, child: Viewer] = INLINE
 {solidViewerTool.class.set[self: solidViewerTool, data: child, op: $YBound]} ;
 -- constrain (child.wy + child.wh = solidViewerTool.wh)
 -- after next time solidViewerTool is painted
 
ChildXBound: PROC [solidViewerTool: SolidViewerTool, child: Viewer] = INLINE
 {solidViewerTool.class.set[self: solidViewerTool, data: child, op: $XBound]} ;
 -- constrain (child.wx + child.ww = solidViewerTool.ww)
 -- after next time solidViewerTool is painted


END.