DIRECTORY Menus, Process, Scratchpad2d, Scratchpad2dUser, SV2d, SVInputMonitor, SVInterfaceTypes, SVScratchpadMonitor, SVViewerTool, ViewerClasses; SVScratchpadMonitorImpl: MONITOR IMPORTS Process, Scratchpad2d, Scratchpad2dUser EXPORTS SVScratchpadMonitor = BEGIN MouseButton: TYPE = Menus.MouseButton; Point2d: TYPE = SV2d.Point2d; ScratchpadData: TYPE = SVInterfaceTypes.ScratchpadData; Viewer: TYPE = ViewerClasses.Viewer; globalProcess: PROCESS _ NIL; screenCoords: Point2d; clickAtom: ATOM; spData: ScratchpadData _ NIL; globalNew: BOOL _ FALSE; NewMotion: PUBLIC ENTRY PROC [pt: Point2d, atom: ATOM, scratchpadData: ScratchpadData] = { globalNew _ TRUE; screenCoords _ pt; spData _ scratchpadData; clickAtom _ atom; IF globalProcess = NIL THEN Process.Detach[globalProcess _ FORK Painter]; }; Painter: PROC = { WHILE New[] DO Dispatch[screenCoords, clickAtom, spData]; ENDLOOP; }; New: PUBLIC ENTRY PROC RETURNS [x: BOOL] = { x _ globalNew; globalNew _ FALSE; IF NOT x THEN globalProcess _ NIL; -- no mouse action. Let process die. }; Dispatch: PROC [controlPoint: Point2d, atom: ATOM, scratchpadData: ScratchpadData] = { SELECT atom FROM $MOVE => { IF scratchpadData.mode = drawLin THEN Scratchpad2d.MoveLinPoint[controlPoint, scratchpadData] ELSE Scratchpad2d.MoveRevoPoint[controlPoint, scratchpadData]; }; $MOVESTART => { IF scratchpadData.mode = drawLin THEN Scratchpad2d.MoveLinStart[controlPoint, scratchpadData] ELSE Scratchpad2d.MoveRevoStart[controlPoint, scratchpadData]; }; $MOVEEND => { self: Viewer _ scratchpadData.scratchViewerData.scratchpad; Scratchpad2dUser.DrawSceneButton[self, scratchpadData.scratchViewerData, red, FALSE, FALSE] }; ENDCASE; }; END. ΆSVScratchpadMonitorImpl.mesa Last edited by Bier on August 19, 1984 7:34:23 pm PDT Copyright c 1984 by Xerox Corporation. All rights reserved. Contents: A flexible setup, suggested by Scott McGregor, for processing mouse input as fast as you can (but no faster). I will use it to synchronize my mouse point processing with the mousepoint. If the processing algorithms become faster, this procedure will still do the right thing. Κ€˜Iheadšœ™Jšœ5™5Jšœ Οmœ1™J˜—šœ˜Jšžœžœ8˜]Jšžœ:˜>J˜—šœ ˜ Jšœ;˜;JšœNžœžœ˜[J˜—Jšžœ˜—Jšœ˜—J˜Jšžœ˜J˜J˜J˜—…—ž ψ