GGUserInputImpl.mesa
Author: Eric Bier on June 6, 1985 1:01:02 am PDT
Last edited by Bier on October 17, 1985 4:50:34 pm PDT
Contents: Procedures which handle user actions (menu buttons and mouse actions).
DIRECTORY
Atom, GGDrawProcess, GGError, GGEvent, GGInterfaceTypes, GGModelTypes, GGMouseEvent, GGUserInput, GGWindow, Imager, ImagerTransformation, Menus, Rope, TIPUser, ViewerClasses;
GGUserInputImpl: CEDAR PROGRAM
IMPORTS Atom, GGError, GGDrawProcess, GGEvent, GGMouseEvent, GGWindow
EXPORTS GGUserInput =
BEGIN
Camera: TYPE = GGModelTypes.Camera;
GargoyleData: TYPE = GGInterfaceTypes.GargoyleData;
GGButtonData: TYPE = GGInterfaceTypes.GGButtonData;
Point: TYPE = GGModelTypes.Point;
Viewer: TYPE = ViewerClasses.Viewer;
HandleMenuAction: PUBLIC Menus.ClickProc = {
buttonData: GGButtonData ← NARROW[clientData];
gargoyleData: GargoyleData ← NARROW[buttonData.gargoyleData];
action: LIST OF REF ANY ← buttonData.action;
GeneralDispatch[action, gargoyleData]; -- put the action on the slack queue and return
};
IF ISTYPE[input.first, TIPUser.TIPScreenCoords] THEN {
mousePlace ← NARROW[input.first];
controlPoint[1] ← mousePlace.mouseX;
controlPoint[2] ← mousePlace.mouseY;
controlPoint ← GGWindow.ScreenToCamera[controlPoint, gargoyleData.camera];
GGDrawProcess.LogRawMouse[controlPoint];
};
PlayAction: PUBLIC PROC [point: Point, action: LIST OF REF ANY, mouseEvent: BOOL, gargoyleData: GargoyleData] = {
IF mouseEvent THEN InputCameraCoords[point, action, gargoyleData]
ELSE GeneralDispatch[action, gargoyleData];
};
InputNotify: PUBLIC PROCEDURE [self: ViewerClasses.Viewer, input: LIST OF REF ANY] = {
Self is an ActionArea.
gargoyleData: GargoyleData ← NARROW[self.data];
IF ISTYPE[input.first, TIPUser.TIPScreenCoords] THEN {
controlPoint: Point;
camera: Camera ← gargoyleData.camera;
mousePlace: TIPUser.TIPScreenCoords ← NARROW[input.first];
p: ImagerTransformation.VEC;
p ← ImagerTransformation.Transform[ImagerTransformation.Invert[context.state.T], [mousePlace.mouseX, mousePlace.mouseY]];
controlPoint[1] ← mousePlace.mouseX;
controlPoint[2] ← mousePlace.mouseY;
This puts the control point in screen coordinates (screen dots).
controlPoint ← GGWindow.ScreenToCamera[controlPoint, camera];
Convert to camera coordinates.
InputCameraCoords[controlPoint, input.rest, gargoyleData];
}
ELSE GeneralDispatch[input, gargoyleData];
};
InputCameraCoords: PROC [controlPoint: Point, input: LIST OF REF ANY, gargoyleData: GargoyleData] = {
atom: ATOM;
atom ← NARROW[input.first];
SELECT atom FROM
$StartSelectPoint => GGDrawProcess.QueueInputAction[GGMouseEvent.StartSelectPoint, input, controlPoint, gargoyleData];
$EndSelectPoint => GGDrawProcess.QueueInputAction[GGMouseEvent.EndSelectPoint, input, controlPoint, gargoyleData];
$StartCopySelect => NotYetImplementedMessage[atom];
$EndCopySelect => NotYetImplementedMessage[atom];
$StartAdd => GGDrawProcess.QueueInputAction[GGMouseEvent.StartAdd, input, controlPoint, gargoyleData];
$EndAdd => GGDrawProcess.QueueInputAction[GGMouseEvent.EndAdd, input, controlPoint, gargoyleData];
$StartDeselectPoint => NotYetImplementedMessage[atom];
$StartSelectTrajectory => GGDrawProcess.QueueInputAction[GGMouseEvent.StartSelectTrajectory, input, controlPoint, gargoyleData];
$StartCopySelectTrajectory => GGDrawProcess.QueueInputAction[GGMouseEvent.StartCopySelectTrajectory, input, controlPoint, gargoyleData];
$StartDrag => GGDrawProcess.QueueInputAction[GGMouseEvent.StartDrag, input, controlPoint, gargoyleData];
$EndDrag => GGDrawProcess.QueueInputAction[GGMouseEvent.EndDrag, input, controlPoint, gargoyleData];
$StartScale => GGDrawProcess.QueueInputAction[GGMouseEvent.StartScale, input, controlPoint, gargoyleData];
$EndScale => GGDrawProcess.QueueInputAction[GGMouseEvent.EndScale, input, controlPoint, gargoyleData];
$StartExtend => GGDrawProcess.QueueInputAction[GGMouseEvent.StartExtend, input, controlPoint, gargoyleData];
$StartCopyExtend => NotYetImplementedMessage[atom];
$StartRotate => GGDrawProcess.QueueInputAction[GGMouseEvent.StartRotate, input, controlPoint, gargoyleData];
$EndRotate => GGDrawProcess.QueueInputAction[GGMouseEvent.EndRotate, input, controlPoint, gargoyleData];
$DuringCopySelect,
$DuringDeselectPoint, $EndDeselectPoint,
$DuringSelectTrajectory, $EndSelectTrajectory,
$DuringCopySelectTrajectory, $EndCopySelectTrajectory,
$DuringExtend, $EndExtend,
$DuringCopyExtend, $EndCopyExtend
=> {};
$DuringSelectPoint => GGDrawProcess.QueueOrBashInputAction[GGMouseEvent.DuringSelectPoint, input, controlPoint, gargoyleData];
$DuringAdd => GGDrawProcess.QueueOrBashInputAction[GGMouseEvent.DuringAdd, input, controlPoint, gargoyleData];
$DuringDrag => GGDrawProcess.QueueOrBashInputAction[GGMouseEvent.DuringDrag, input, controlPoint, gargoyleData];
$DuringRotate => GGDrawProcess.QueueOrBashInputAction[GGMouseEvent.DuringRotate, input, controlPoint, gargoyleData];
$DuringScale => GGDrawProcess.QueueOrBashInputAction[GGMouseEvent.DuringScale, input, controlPoint, gargoyleData];
ENDCASE => NotYetImplementedMessage[atom];
}; -- end of InputCameraCoords
NotYetImplementedMessage: PROC [atom: ATOM] = {
GGError.Append["User action ", begin];
GGError.Append[Atom.GetPName[atom], middle];
GGError.Append[" is not yet implemented", end];
GGError.Blink[];
};
GeneralDispatch: PUBLIC PROC [action: LIST OF REF ANY, gargoyleData: GargoyleData] = {
These actions could come from the TIP table or from bugging a menu.
atom: ATOMNARROW[action.first];
SELECT atom FROM
$NoOp => {};
File Line
$Clear => NotYetImplementedMessage[atom];
$Reset => NotYetImplementedMessage[atom];
$Get => NotYetImplementedMessage[atom];
$Store => NotYetImplementedMessage[atom];
$Split => NotYetImplementedMessage[atom];
$Interpress => SimpleQueue[GGEvent.Interpress, action, gargoyleData];
Master Line
Hierarchy Menu
$Delete => SimpleQueue[GGEvent.Delete, action, gargoyleData];
$SelectAll => SimpleQueue[GGEvent.SelectAll, action, gargoyleData];
Curve Menu
$SetStraight => SimpleQueue[GGEvent.SetStraight, action, gargoyleData];
$SetArc => SimpleQueue[GGEvent.SetArc, action, gargoyleData];
$SetConic => SimpleQueue[GGEvent.SetConic, action, gargoyleData];
$SetBezier => SimpleQueue[GGEvent.SetBezier, action, gargoyleData];
$SetSpline => SimpleQueue[GGEvent.SetSpline, action, gargoyleData];
Edit Curve Menu
$Close => SimpleQueue[GGEvent.Close, action, gargoyleData];
$ShowPoints => SimpleQueue[GGEvent.ShowPoints, action, gargoyleData];
$HidePoints => SimpleQueue[GGEvent.HidePoints, action, gargoyleData];
View Menu
$Refresh => SimpleQueue[GGEvent.Refresh, action, gargoyleData];
$DisableRefresh => SimpleQueue[GGEvent.DisableRefresh, action, gargoyleData];
$EnableRefresh => SimpleQueue[GGEvent.EnableRefresh, action, gargoyleData];
Debug Menu
$TestGravity => SimpleQueue[GGEvent.TestGravity, action, gargoyleData];
$DrawTouchPoints => SimpleQueue[GGEvent.DrawTouchPoints, action, gargoyleData];
$DescribeTouchPoints => SimpleQueue[GGEvent.DescribeTouchPoints, action, gargoyleData];
$DrawBoundBoxes => SimpleQueue[GGEvent.DrawBoundBoxes, action, gargoyleData];
$DrawSelectionBox => SimpleQueue[GGEvent.DrawSelectionBox, action, gargoyleData];
$Typescript => SimpleQueue[GGEvent.Typescript, action, gargoyleData];
$SlackLog => SimpleQueue[GGEvent.SlackLog, action, gargoyleData];
$DescribeCaretObject => SimpleQueue[GGEvent.DescribeCaretObject, action, gargoyleData];
Style Line
$LineWidth => SimpleQueue[GGEvent.LineWidth, action, gargoyleData];
$AreaColorBlack => SimpleQueue[GGEvent.AreaColorBlack, action, gargoyleData];
$AreaColorWhite => SimpleQueue[GGEvent.AreaColorWhite, action, gargoyleData];
$AreaColorGray => SimpleQueue[GGEvent.AreaColorGray, action, gargoyleData];
Alignment Line:
$MakeHot => SimpleQueue[GGEvent.MakeHot, action, gargoyleData];
$MakeCold => SimpleQueue[GGEvent.MakeCold, action, gargoyleData];
$DropAnchor => SimpleQueue[GGEvent.DropAnchor, action, gargoyleData];
$LiftAnchor => SimpleQueue[GGEvent.KillAnchor, action, gargoyleData];
$GravityChoiceChange => SimpleQueue[GGEvent.GravityChoiceChange, action, gargoyleData];
$GravityExtentChange => SimpleQueue[GGEvent.GravityExtentChange, action, gargoyleData];
$ToggleAlwaysOn => SimpleQueue[GGEvent.ToggleAlwaysOn, action, gargoyleData];
$ToggleDoubleBuffer => SimpleQueue[GGEvent.ToggleDoubleBuffer, action, gargoyleData];
$SlopePrompt => SimpleQueue[GGEvent.SlopePrompt, action, gargoyleData];
$AddSlope => SimpleQueue[GGEvent.AddSlope, action, gargoyleData];
$GetSlope => SimpleQueue[GGEvent.GetSlope, action, gargoyleData];
$ToggleSlope => SimpleQueue[GGEvent.ToggleSlope, action, gargoyleData];
$DeleteSlope => SimpleQueue[GGEvent.DeleteSlope, action, gargoyleData];
$RadiusPrompt => SimpleQueue[GGEvent.RadiusPrompt, action, gargoyleData];
$AddRadius => SimpleQueue[GGEvent.AddRadius, action, gargoyleData];
$GetRadius => SimpleQueue[GGEvent.GetRadius, action, gargoyleData];
$ToggleRadius => SimpleQueue[GGEvent.ToggleRadius, action, gargoyleData];
$DeleteRadius => SimpleQueue[GGEvent.DeleteRadius, action, gargoyleData];
$DistancePrompt => SimpleQueue[GGEvent.DistancePrompt, action, gargoyleData];
$AddDistance => SimpleQueue[GGEvent.AddDistance, action, gargoyleData];
$GetDistance => SimpleQueue[GGEvent.GetDistance, action, gargoyleData];
$ToggleDistance => SimpleQueue[GGEvent.ToggleDistance, action, gargoyleData];
$DeleteDistance => SimpleQueue[GGEvent.DeleteDistance, action, gargoyleData];
Miscellaneous
$ReloadTipTable => GGWindow.ReloadTipTable[gargoyleData]; -- should be moved to GGEventImpl
ENDCASE => NotYetImplementedMessage[atom];
}; -- end of InputNotify
EventProc: TYPE = GGDrawProcess.EventProc;
SimpleQueue: PROC [callBack: EventProc, inputAction: LIST OF REF ANY, gargoyleData: GargoyleData] = GGDrawProcess.QueueInputActionNoPoint;
END.