SVInputMonitorImpl.mesa
Author: Eric Bier on December 9, 1982 11:33 pm
Copyright © 1984 by Xerox Corporation. All rights reserved.
Last edited by Bier on May 23, 1985 5:50:00 pm PDT
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.
DIRECTORY
Menus,
Process,
SV2d,
SVArtworkUser,
SVInputMonitor,
SVStretch,
SVInterfaceTypes,
SVViewerInput;
SVInputMonitorImpl: MONITOR
IMPORTS Process, SVArtworkUser, SVStretch, SVViewerInput
EXPORTS SVInputMonitor =
BEGIN
ArtworkToolData: TYPE = SVInterfaceTypes.ArtworkToolData;
MouseButton: TYPE = Menus.MouseButton;
Point2d: TYPE = SV2d.Point2d;
ViewerToolData: TYPE = SVInterfaceTypes.ViewerToolData;
globalProcess: PROCESSNIL;
cameraCoords: Point2d;
clickAtom: ATOM;
vtData: ViewerToolData ← NIL;
awData: ArtworkToolData ← NIL;
globalWorkToDo: BOOLFALSE;
Restart: PUBLIC ENTRY PROC [] = {
Sometimes the Painter process is aborted because of a bug in one of the dispatched procedures. This procedure allows the user to get things going again.
globalWorkToDo ← FALSE;
Process.Detach[globalProcess ← FORK Painter];
};
NewMotion: PUBLIC ENTRY PROC [pt: Point2d, atom: ATOM, viewerToolData: ViewerToolData] = {
globalWorkToDo ← TRUE;
cameraCoords ← pt;
vtData ← viewerToolData;
clickAtom ← atom;
IF globalProcess = NIL THEN Process.Detach[globalProcess ← FORK Painter];
};
NewArtworkCommand: PUBLIC ENTRY PROC [atom: ATOM, artworkToolData: ArtworkToolData] = {
globalWorkToDo ← TRUE;
clickAtom ← atom;
awData ← artworkToolData;
IF globalProcess = NIL THEN Process.Detach[globalProcess ← FORK Painter];
};
Painter: PROC = {
WHILE WorkToDo[] DO
Dispatch[cameraCoords, clickAtom, vtData, awData];
ENDLOOP;
};
WorkToDo: PUBLIC ENTRY PROC RETURNS [x: BOOL] = {
x ← globalWorkToDo;
globalWorkToDo ← FALSE;
IF NOT x THEN globalProcess ← NIL; -- no mouse action. Let process die.
};
Dispatch: PROC [controlPoint: Point2d, atom: ATOM, viewerToolData: ViewerToolData, artworkToolData: ArtworkToolData] = {
SELECT atom FROM
$StartDrag => SVStretch.StartDrag[viewerToolData, controlPoint];
$SetDrag => SVStretch.SetDrag[viewerToolData, controlPoint];
$EndDrag => SVStretch.EndDrag[viewerToolData, controlPoint];
$StartCameraDrag => SVStretch.StartCameraDrag[viewerToolData, controlPoint];
$SetCameraDrag => SVStretch.SetCameraDrag[viewerToolData, controlPoint];
$EndCameraDrag => SVStretch.EndCameraDrag[viewerToolData, controlPoint];
$FrameUpLeft => SVViewerInput.FrameUpLeft[viewerToolData, controlPoint];
$FrameDownRightMove => SVViewerInput.FrameDownRightMove[viewerToolData, controlPoint];
$FrameDownRightEnd => SVViewerInput.FrameDownRightEnd[viewerToolData, controlPoint];
$DeleteFrame => SVViewerInput.DeleteFrame[viewerToolData];
$StartSkitter => SVViewerInput.StartSkitter[viewerToolData, controlPoint, first];
$DuringSkitter => SVViewerInput.DuringSkitter[viewerToolData, controlPoint, first];
$EndSkitter => SVViewerInput.EndSkitter[viewerToolData, controlPoint, first];
$StartBackSkitter => SVViewerInput.StartSkitter[viewerToolData, controlPoint, lastOfFirst];
$DuringBackSkitter => SVViewerInput.DuringSkitter[viewerToolData, controlPoint, lastOfFirst];
$EndBackSkitter => SVViewerInput.EndSkitter[viewerToolData, controlPoint, lastOfFirst];
$StartTopLevelSkitter => SVViewerInput.StartSkitter[viewerToolData, controlPoint, lastOfLevel1];
$DuringTopLevelSkitter => SVViewerInput.DuringSkitter[viewerToolData, controlPoint, lastOfLevel1];
$EndTopLevelSkitter => SVViewerInput.EndSkitter[viewerToolData, controlPoint, lastOfLevel1];
$StartCoordSkitter => SVViewerInput.StartCoordSkitter[viewerToolData, controlPoint];
$DuringCoordSkitter => SVViewerInput.DuringCoordSkitter[viewerToolData, controlPoint];
$EndCoordSkitter => SVViewerInput.EndCoordSkitter[viewerToolData, controlPoint];
$StartTightRope => SVViewerInput.StartTightRope[viewerToolData, controlPoint];
$DuringTightRope => SVViewerInput.DuringTightRope[viewerToolData, controlPoint];
$EndTightRope => SVViewerInput.EndTightRope[viewerToolData, controlPoint];
$StartWallWalk => SVViewerInput.StartWallWalk[viewerToolData, controlPoint];
$DuringWallWalk => SVViewerInput.DuringWallWalk[viewerToolData, controlPoint];
$EndWallWalk => SVViewerInput.EndWallWalk[viewerToolData, controlPoint];
$Paint => SVViewerInput.Paint[viewerToolData, controlPoint];
$OpenAISFile => SVArtworkUser.OpenFile[artworkToolData];
$CloseAISFile => SVArtworkUser.CloseFile[artworkToolData];
$ExtendSkitter => SVViewerInput.ExtendSkitter[viewerToolData, controlPoint, first];
$ExtendCoordSkitter => SVViewerInput.ExtendCoordSkitter[viewerToolData, controlPoint];
ENDCASE;
};
END.