<> <> <> <> <<>> 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 }; <> <> <> <> <> <> <<};>> <<>> 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] = { <> gargoyleData: GargoyleData _ NARROW[self.data]; IF ISTYPE[input.first, TIPUser.TIPScreenCoords] THEN { controlPoint: Point; camera: Camera _ gargoyleData.camera; mousePlace: TIPUser.TIPScreenCoords _ NARROW[input.first]; <> <

> controlPoint[1] _ mousePlace.mouseX; controlPoint[2] _ mousePlace.mouseY; <> controlPoint _ GGWindow.ScreenToCamera[controlPoint, camera]; <> 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] = { <> atom: ATOM _ NARROW[action.first]; SELECT atom FROM $NoOp => {}; <> $Clear => NotYetImplementedMessage[atom]; $Reset => NotYetImplementedMessage[atom]; $Get => NotYetImplementedMessage[atom]; $Store => NotYetImplementedMessage[atom]; $Split => NotYetImplementedMessage[atom]; $Interpress => SimpleQueue[GGEvent.Interpress, action, gargoyleData]; <> <<>> <> $Delete => SimpleQueue[GGEvent.Delete, action, gargoyleData]; $SelectAll => SimpleQueue[GGEvent.SelectAll, action, gargoyleData]; <<>> <> $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]; <> $Close => SimpleQueue[GGEvent.Close, action, gargoyleData]; $ShowPoints => SimpleQueue[GGEvent.ShowPoints, action, gargoyleData]; $HidePoints => SimpleQueue[GGEvent.HidePoints, action, gargoyleData]; <> <<>> $Refresh => SimpleQueue[GGEvent.Refresh, action, gargoyleData]; $DisableRefresh => SimpleQueue[GGEvent.DisableRefresh, action, gargoyleData]; $EnableRefresh => SimpleQueue[GGEvent.EnableRefresh, action, gargoyleData]; <<>> <> $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]; <