-- File: Scratchpad2dUser.mesa
-- Last edited by Bier on December 18, 1982 1:41 am
-- Author: Eric Bier on March 22, 1983 1:22 pm
-- Contents: Functions called by the buttons on a Scratchpad2d viewer.

DIRECTORY
 Containers,
 CoordSys,
 Graphics,
 Matrix3d,
 Menus,
 PadGraphics,
 SV2d,
 SweepGeometry,
 ViewerClasses;

Scratchpad2dUser: CEDAR DEFINITIONS =

BEGIN

CoordSystem: TYPE = REF CoordSysObj;
CoordSysObj: TYPE = CoordSys.CoordSysObj;
MouseButton: TYPE = Menus.MouseButton;
Path: TYPE = REF PathObj;
PathObj: TYPE = SV2d.PathObj;
Polygon: TYPE = REF PolygonObj;
PolygonObj: TYPE = SV2d.PolygonObj;
Point2d: TYPE = Matrix3d.Point2d;
Viewer: TYPE = ViewerClasses.Viewer;

ScratchViewerData: TYPE = REF ScratchViewerDataObj;
ScratchViewerDataObj: TYPE = RECORD [
 outer: Containers.Container ← NIL, -- handle for the enclosing container
 height: CARDINAL ← 0,
 textSection: TextSectionData,
 scratchpad: ViewerClasses.Viewer ← NIL
 ];

TextSectionData: TYPE = REF TextSectionDataObj;
TextSectionDataObj: TYPE = RECORD [
 degrees: ViewerClasses.Viewer ← NIL];

ScratchpadData: TYPE = REF ScratchpadDataObj;
ScratchpadDataObj: TYPE = RECORD [
 origin: Point2d,
 path: Path,
 mode: ScratchpadMode,
 index: NAT,
 scratchViewerData: ScratchViewerData,
 proc: PROC [dc: Graphics.Context]]; 
  
ScratchpadMode: TYPE = {off, pointAt, drawLin, drawRevo};

Painter: PROC [proc: PROC [Graphics.Context], scratchViewerData: ScratchViewerData ← NIL];
PaintLin: PROC [scratchViewerData: ScratchViewerData];
PaintRevo: PROC [scratchViewerData: ScratchViewerData];
Erase: PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL];
Normals: PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL];
PlaceOrigin: PROC [viewer: Viewer];

CrossHairs: PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL];

DrawScene: PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL];
DrawLin: PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL];
DrawRevo: PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL];
NewLin: PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL];
NewRevo: PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL];
TestPoints: PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL];
Circle: PROC [parent: REF ANY, clientData: REF ANY, mouseButton: MouseButton, shift, control: BOOL];
EditMode: TYPE = {lin, revo};
Edit: PROC [path: Path, mode: EditMode, scratchViewerData: ScratchViewerData];
-- makes poly be the current polygon.

END.