GGUserInputImpl.mesa
Author: Eric Bier on June 6, 1985 1:01:02 am PDT
Last edited by Bier on January 29, 1987 10:59:31 am PST
Contents: Procedures which handle user actions (menu buttons and mouse actions).
Pier, February 3, 1987 12:50:17 pm PST
Kurlander August 24, 1986 1:00:26 pm PDT
DIRECTORY
Atom, BiScrollers, Convert, GGBasicTypes, GGError, GGEvent, GGInterfaceTypes, GGModelTypes, GGMouseEvent, GGObjects, GGSessionLog, GGUserInput, Imager, ImagerTransformation, IO, Menus, Rope, SlackProcess, TIPUser, ViewerClasses, ViewerTools;
GGUserInputImpl: CEDAR PROGRAM
IMPORTS Atom, BiScrollers, Convert, GGError, GGObjects, GGSessionLog, SlackProcess, GGEvent, GGMouseEvent, IO, Rope, ViewerTools
EXPORTS GGUserInput = BEGIN
GargoyleData: TYPE = GGInterfaceTypes.GargoyleData;
Outline: TYPE = GGModelTypes.Outline;
Point: TYPE = GGBasicTypes.Point;
Viewer: TYPE = ViewerClasses.Viewer;
SlackHandle: TYPE = SlackProcess.SlackHandle;
EventProc: TYPE = SlackProcess.EventProc;
Input from the Outside World
From Buttons and Menus
MenuNotify: PUBLIC PROC [clientData: REF ANY, action: LIST OF REF ANY] = {
Used by several menu classes as the procedure to call when a menu click occurs.
gargoyleData: GargoyleData ← NARROW[clientData];
HandleMouseless[action, gargoyleData];
};
From Playback Scripts
PlayAction: PUBLIC PROC [point: Point, action: LIST OF REF ANY, mouseEvent: BOOL, gargoyleData: GargoyleData] = {
IF mouseEvent THEN HandleMouse[point, action, gargoyleData]
ELSE HandleMouseless[action, gargoyleData];
};
From Mouse and Keyboard
InputNotify: PUBLIC PROC [self: ViewerClasses.Viewer, input: LIST OF REF ANY] = {
ViewerClasses.NotifyProc
Called by the TIP table machinery when an action is received from mouse or keyboard. Self is an ActionArea.
gargoyleData: GargoyleData ← NARROW[BiScrollers.ClientDataOfViewer[self]];
IF printAllInput THEN PrintAllInput[input, gargoyleData];
WITH input.first SELECT FROM
mousePlace: BiScrollers.ClientCoords => {
controlPoint: Point ← [mousePlace.x, mousePlace.y];
This puts the control point in Gargoyle coordinates.
HandleMouse[controlPoint, input.rest, gargoyleData];
};
refChar: REF CHAR => {
Need our own copy of the ref and char, because the system will reuse the storage without telling us!!
myRefChar: REF CHARNEW[CHAR ← refChar^];
HandleMouseless[LIST[$AddChar, myRefChar], gargoyleData];
};
ENDCASE => HandleMouseless[input, gargoyleData];
};
Handling Actions
From the Mouse
HandleMouse: PROC [controlPoint: Point, input: LIST OF REF ANY, gargoyleData: GargoyleData] = {
atom: ATOMNARROW[input.first];
atomName: Rope.ROPE ← Atom.GetPName[atom];
IF Rope.Equal[Rope.Substr[atomName, 0, 5], "Start", TRUE] THEN {
SlackProcess.QueueInputActionWithPoint[gargoyleData.slackHandle, GGMouseEvent.HandleMouse, input, controlPoint, gargoyleData, NIL];
SlackProcess.QueueInputAction[gargoyleData.slackHandle, GGEvent.SawTextFinish, LIST[$SawTextFinish], gargoyleData, NIL];
}
ELSE SELECT atom FROM
$GuardUp, $MouseUp, $AllUp => SlackProcess.QueueInputActionWithPoint[gargoyleData.slackHandle, GGMouseEvent.HandleMouse, input, controlPoint, gargoyleData, NIL];
$During => SlackProcess.QueueInputActionWithPoint[gargoyleData.slackHandle, GGMouseEvent.HandleMouse, input, controlPoint, gargoyleData, LIST[$During]];
ENDCASE => NotYetImplementedMessage[atom, gargoyleData];
};
From Buttons, Menus, or Keyboard
HandleMouseless: PROC [action: LIST OF REF ANY, gargoyleData: GargoyleData] = {
Non-mouse actions. These actions could come from the TIP table or from bugging a menu.
atom: ATOMNARROW[action.first];
SELECT atom FROM
$PaintActionArea => SimpleQueue[gargoyleData.slackHandle, GGEvent.PaintActionArea, action, gargoyleData];
$Abort => SimpleQueue[gargoyleData.slackHandle, GGMouseEvent.HandleMouseless, action, gargoyleData];
$NoOp => {};
$AddChar => SimpleQueue[gargoyleData.slackHandle, GGEvent.AddChar, action, gargoyleData];
File Line
$Clear => SimpleQueue[gargoyleData.slackHandle, GGEvent.Clear, action, gargoyleData];
$Reset => SimpleQueue[gargoyleData.slackHandle, GGEvent.Reset, action, gargoyleData];
$Get => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.Get, action, gargoyleData];
};
$Merge => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.Merge, action, gargoyleData];
};
$Store => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.Store, action, gargoyleData];
};
$Save => SimpleQueue[gargoyleData.slackHandle, GGEvent.Save, action, gargoyleData];
$Split => NotYetImplementedMessage[atom, gargoyleData];
$Stuff => SimpleQueue[gargoyleData.slackHandle, GGEvent.StuffIt, action, gargoyleData];
$StuffScreen => SimpleQueue[gargoyleData.slackHandle, GGEvent.StuffItScreen, action, gargoyleData];
Interpress Menu
$MergeIPEditable => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.MergeIPEditable, action, gargoyleData];
};
$MergeIPSlice => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.MergeIPSlice, action, gargoyleData];
};
$ToIP => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.ToIP, action, gargoyleData];
};
$ToIPScreen => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.ToIPScreen, action, gargoyleData];
};
$IncludeIPByReference => SimpleQueue[gargoyleData.slackHandle, GGEvent.IncludeIPByReference, action, gargoyleData];
$IncludeIPByValue => SimpleQueue[gargoyleData.slackHandle, GGEvent.IncludeIPByValue, action, gargoyleData];
$ShowIPIncludeMode => SimpleQueue[gargoyleData.slackHandle, GGEvent.ShowIPIncludeMode, action, gargoyleData];
$ToIPLit => SimpleQueue[gargoyleData.slackHandle, GGEvent.ToIPLit, action, gargoyleData];
$ToIPTestGravity => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.ToIPTestGravity, action, gargoyleData];
};
Master Line
Hierarchy Menu
$Delete => SimpleQueue[gargoyleData.slackHandle, GGEvent.Delete, action, gargoyleData];
$Undelete => SimpleQueue[gargoyleData.slackHandle, GGEvent.Undelete, action, gargoyleData];
$UnionCombine => SimpleQueue[gargoyleData.slackHandle, GGEvent.UnionCombine, action, gargoyleData];
$SelectAll => SimpleQueue[gargoyleData.slackHandle, GGEvent.SelectAll, action, gargoyleData];
$AddHoles => SimpleQueue[gargoyleData.slackHandle, GGEvent.AddHoles, action, gargoyleData];
$Weld => SimpleQueue[gargoyleData.slackHandle, GGEvent.Weld, action, gargoyleData];
$SplitSegment => SimpleQueue[gargoyleData.slackHandle, GGEvent.SplitSegment, action, gargoyleData];
Transform Menu
$Rotate, $Scale, $ScaleX, $ScaleY, $TranslateX, $TranslateY => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.TransRotScale, action, gargoyleData];
};
$SixPointTransform => SimpleQueue[gargoyleData.slackHandle, GGEvent.SixPointTransform, action, gargoyleData];
$FourPointTransform => SimpleQueue[gargoyleData.slackHandle, GGEvent.FourPointTransform, action, gargoyleData];
Overlap Menu
$Top => SimpleQueue[gargoyleData.slackHandle, GGEvent.Top, action, gargoyleData];
$Bottom => SimpleQueue[gargoyleData.slackHandle, GGEvent.Bottom, action, gargoyleData];
$UpOne => SimpleQueue[gargoyleData.slackHandle, GGEvent.UpOne, action, gargoyleData];
$DownOne => SimpleQueue[gargoyleData.slackHandle, GGEvent.DownOne, action, gargoyleData];
Edit Curve Menu
$Close => SimpleQueue[gargoyleData.slackHandle, GGEvent.Close, action, gargoyleData];
$ShowPoints => SimpleQueue[gargoyleData.slackHandle, GGEvent.ShowPoints, action, gargoyleData];
$HidePoints => SimpleQueue[gargoyleData.slackHandle, GGEvent.HidePoints, action, gargoyleData];
View Menu
$Refresh => SimpleQueue[gargoyleData.slackHandle, GGEvent.Refresh, action, gargoyleData];
$DisableRefresh => SimpleQueue[gargoyleData.slackHandle, GGEvent.DisableRefresh, action, gargoyleData];
$EnableRefresh => SimpleQueue[gargoyleData.slackHandle, GGEvent.EnableRefresh, action, gargoyleData];
Shapes Menu
$PolygonInCircle => {
action ← CheckForSelectedInt[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.PolygonInCircle, action, gargoyleData];
};
$KnotchedLine => SimpleQueue[gargoyleData.slackHandle, GGEvent.NewKnotchedLine, action, gargoyleData];
$NewCircle => SimpleQueue[gargoyleData.slackHandle, GGEvent.NewCircle, action, gargoyleData];
$NewBox => SimpleQueue[gargoyleData.slackHandle, GGEvent.NewBox, action, gargoyleData];
$NewArrow => SimpleQueue[gargoyleData.slackHandle, GGEvent.NewArrow, action, gargoyleData];
$Frame => SimpleQueue[gargoyleData.slackHandle, GGEvent.Frame, action, gargoyleData];
Debug Menu
$TestGravity => SimpleQueue[gargoyleData.slackHandle, GGEvent.TestGravity, action, gargoyleData];
$ToIPTestGravity => SimpleQueue[gargoyleData.slackHandle, GGEvent.ToIPTestGravity, action, gargoyleData];
$TestMultiGravity => SimpleQueue[gargoyleData.slackHandle, GGEvent.TestMultiGravity, action, gargoyleData];
$Statistics => SimpleQueue[gargoyleData.slackHandle, GGEvent.Statistics, action, gargoyleData];
$ResetStatistics => SimpleQueue[gargoyleData.slackHandle, GGEvent.ResetStatistics, action, gargoyleData];
$DrawTouchPoints => SimpleQueue[gargoyleData.slackHandle, GGEvent.DrawTouchPoints, action, gargoyleData];
$DescribeTouchPoints => SimpleQueue[gargoyleData.slackHandle, GGEvent.DescribeTouchPoints, action, gargoyleData];
$DrawTightBoxes => SimpleQueue[gargoyleData.slackHandle, GGEvent.DrawTightBoxes, action, gargoyleData];
$DrawBoundBoxes => SimpleQueue[gargoyleData.slackHandle, GGEvent.DrawBoundBoxes, action, gargoyleData];
$DrawOutlineBoxes => SimpleQueue[gargoyleData.slackHandle, GGEvent.DrawOutlineBoxes, action, gargoyleData];
$DrawSelectionBox => SimpleQueue[gargoyleData.slackHandle, GGEvent.DrawSelectionBox, action, gargoyleData];
$DrawMovingBox => SimpleQueue[gargoyleData.slackHandle, GGEvent.DrawMovingBox, action, gargoyleData];
$Typescript => SimpleQueue[gargoyleData.slackHandle, GGEvent.Typescript, action, gargoyleData];
$SlackLog => SimpleQueue[gargoyleData.slackHandle, GGEvent.SlackLog, action, gargoyleData];
$DescribeCaretObject => SimpleQueue[gargoyleData.slackHandle, GGEvent.DescribeCaretObject, action, gargoyleData];
$DescribeCaretObject => SimpleQueue[gargoyleData.slackHandle, GGEvent.DescribeCaretObject, action, gargoyleData];
$FSMInfo => SimpleQueue[gargoyleData.slackHandle, FSMInfo, action, gargoyleData];
$Splice => SimpleQueue[gargoyleData.slackHandle, GGEvent.Splice, action, gargoyleData];
$PrintAllInput => printAllInput ← TRUE;
$ResetAllInput => printAllInput ← FALSE;
$CauseAnError => SimpleQueue[gargoyleData.slackHandle, CauseAnError, action, gargoyleData];
Style Menus
$LineWidth => {
action ← CheckForSelectedReal[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.LineWidth, action, gargoyleData];
};
$PrintLineWidth => SimpleQueue[gargoyleData.slackHandle, GGEvent.PrintLineWidth, action, gargoyleData];
$SelectMatchingWidth => {
action ← CheckForSelectedReal[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.SelectMatchingWidth, action, gargoyleData];
};
$DashesFromSelection => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.DashesFromSelection, action, gargoyleData];
};
$DashesOff => {
SimpleQueue[gargoyleData.slackHandle, GGEvent.DashesOff, action, gargoyleData];
};
$Arrows => SimpleQueue[gargoyleData.slackHandle, GGEvent.Arrows, action, gargoyleData];
$AreaColorFromColorTool => SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaColorFromColorTool, action, gargoyleData];
$AreaColorFollowColorTool => SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaColorFollowColorTool, action, gargoyleData];
$AreaColorToColorTool => SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaColorToColorTool, action, gargoyleData];
$AreaColorFromSelectedName => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaColorFromSelectedName, action, gargoyleData];
};
$AreaColorFromSelectedRGB => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaColorFromSelectedRGB, action, gargoyleData];
};
$PrintAreaColor => SimpleQueue[gargoyleData.slackHandle, GGEvent.PrintAreaColor, action, gargoyleData];
$SelectMatchingAreaRGB => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.SelectMatchingAreaColor, action, gargoyleData];
};
$SelectMatchingAreaCNS => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.SelectMatchingAreaColor, action, gargoyleData];
};
$AreaColorBlack => SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaColorBlack, action, gargoyleData];
$AreaColorWhite => SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaColorWhite, action, gargoyleData];
$AreaColorGray => SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaColorGray, action, gargoyleData];
$AreaColorNone => SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaColorNone, action, gargoyleData];
$LineColorFromColorTool => SimpleQueue[gargoyleData.slackHandle, GGEvent.LineColorFromColorTool, action, gargoyleData];
$LineColorFollowColorTool => SimpleQueue[gargoyleData.slackHandle, GGEvent.LineColorFollowColorTool, action, gargoyleData];
$LineColorToColorTool => SimpleQueue[gargoyleData.slackHandle, GGEvent.LineColorToColorTool, action, gargoyleData];
$LineColorFromSelectedName => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.LineColorFromSelectedName, action, gargoyleData];
};
$LineColorFromSelectedRGB => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.LineColorFromSelectedRGB, action, gargoyleData];
};
$SelectMatchingLineRGB => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.SelectMatchingLineColor, action, gargoyleData];
};
$SelectMatchingLineCNS => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.SelectMatchingLineColor, action, gargoyleData];
};
$PrintLineColor => SimpleQueue[gargoyleData.slackHandle, GGEvent.PrintLineColor, action, gargoyleData];
$LineColorBlack => SimpleQueue[gargoyleData.slackHandle, GGEvent.LineColorBlack, action, gargoyleData];
$LineColorWhite => SimpleQueue[gargoyleData.slackHandle, GGEvent.LineColorWhite, action, gargoyleData];
$LineColorGray => SimpleQueue[gargoyleData.slackHandle, GGEvent.LineColorGray, action, gargoyleData];
$LineColorNone => SimpleQueue[gargoyleData.slackHandle, GGEvent.LineColorNone, action, gargoyleData];
Text Menu
$AddText => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.AddText, action, gargoyleData];
};
$AmplifySpaceFromSelection => {
action ← CheckForSelectedReal[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.AmplifySpaceFromSelection, action, gargoyleData];
};
$PrintAmplifySpace => {
SimpleQueue[gargoyleData.slackHandle, GGEvent.PrintAmplifySpace, action, gargoyleData];
};
$DropShadowOn => {
SimpleQueue[gargoyleData.slackHandle, GGEvent.DropShadowOn, action, gargoyleData];
};
$DropShadowOff => {
SimpleQueue[gargoyleData.slackHandle, GGEvent.DropShadowOff, action, gargoyleData];
};
Fonts Menu
$SetLookAlikes => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.SetLookAlikes, action, gargoyleData];
};
$SetPressFont => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.SetPressFont, action, gargoyleData];
};
$SetPrintFont => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.SetPrintFont, action, gargoyleData];
};
$SetScreenFont => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.SetScreenFont, action, gargoyleData];
};
$SetFontDetailed => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.SetFontDetailed, action, gargoyleData];
};
$SetFontLiteral => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.SetFontLiteral, action, gargoyleData];
};
$ChangeFont => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.ChangeFont, action, gargoyleData];
};
$SetDefaultFontValues => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.SetDefaultFontValues, action, gargoyleData];
};
$ShowFontValues => SimpleQueue[gargoyleData.slackHandle, GGEvent.ShowFontValues, action, gargoyleData];
$ShowFontValuesLiteral => SimpleQueue[gargoyleData.slackHandle, GGEvent.ShowFontValuesLiteral, action, gargoyleData];
$ShowDefaultFontValues => SimpleQueue[gargoyleData.slackHandle, GGEvent.ShowDefaultFontValues, action, gargoyleData];
$FindTextMatchingSelected => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.FindTextMatchingSelected, action, gargoyleData];
};
$FindTextMatchingValues => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.FindTextMatchingValues, action, gargoyleData];
};
$FindTextMatchingFamily => {
action ← CheckForSelectedRope[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.FindTextMatchingFamily, action, gargoyleData];
};
Group Menu
$AddToGroup => SimpleQueue[gargoyleData.slackHandle, GGEvent.AddToGroup, action, gargoyleData];
$SelectGroup => SimpleQueue[gargoyleData.slackHandle, GGEvent.SelectGroup, action, gargoyleData];
$RemoveFromGroup => SimpleQueue[gargoyleData.slackHandle, GGEvent.RemoveFromGroup, action, gargoyleData];
$PrintGroupsOfSelected => SimpleQueue[gargoyleData.slackHandle, GGEvent.PrintGroupsOfSelected, action, gargoyleData];
$PrintAllGroups => SimpleQueue[gargoyleData.slackHandle, GGEvent.PrintAllGroups, action, gargoyleData];
AreaSelect Menu
$AreaSelectNew => SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaSelectNew, action, gargoyleData];
$AreaSelectExtend => SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaSelectExtend, action, gargoyleData];
$AreaSelectNewAndDelete => SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaSelectNewAndDelete, action, gargoyleData];
$AreaSelectDegenerate => SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaSelectDegenerate, action, gargoyleData];
$AreaSelectAll => SimpleQueue[gargoyleData.slackHandle, GGEvent.AreaSelectAll, action, gargoyleData];
Curve Menu
$SetStraight => SimpleQueue[gargoyleData.slackHandle, GGEvent.SetStraight, action, gargoyleData];
$SetArc => SimpleQueue[gargoyleData.slackHandle, GGEvent.SetArc, action, gargoyleData];
$SetSnowflake => SimpleQueue[gargoyleData.slackHandle, GGEvent.SetSnowflake, action, gargoyleData];
$SetConic => SimpleQueue[gargoyleData.slackHandle, GGEvent.SetConic, action, gargoyleData];
$SetBezier => SimpleQueue[gargoyleData.slackHandle, GGEvent.SetBezier, action, gargoyleData];
$SetNaturalSpline => SimpleQueue[gargoyleData.slackHandle, GGEvent.SetNaturalSpline, action, gargoyleData];
$SetBSpline => SimpleQueue[gargoyleData.slackHandle, GGEvent.SetBSpline, action, gargoyleData];
$SelectMatchingCurve => SimpleQueue[gargoyleData.slackHandle, GGEvent.SelectMatchingCurve, action, gargoyleData];
Other Curve-related stuff
$DescribeCurve => SimpleQueue[gargoyleData.slackHandle, GGEvent.DescribeCurve, action, gargoyleData];
$AddControlPoint => SimpleQueue[gargoyleData.slackHandle, GGEvent.AddControlPoint, action, gargoyleData];
$DeleteControlPoint => SimpleQueue[gargoyleData.slackHandle, GGEvent.DeleteControlPoint, action, gargoyleData];
$AddJoint => SimpleQueue[gargoyleData.slackHandle, GGEvent.AddJoint, action, gargoyleData];
Gravity Line:
$GravityChoiceChange => SimpleQueue[gargoyleData.slackHandle, GGEvent.GravityChoiceChange, action, gargoyleData];
$GravityExtentChange => SimpleQueue[gargoyleData.slackHandle, GGEvent.GravityExtentChange, action, gargoyleData];
$SetGravityExtent => SimpleQueue[gargoyleData.slackHandle, GGEvent.SetGravityExtent, action, gargoyleData];
$ToggleGravity => SimpleQueue[gargoyleData.slackHandle, GGEvent.ToggleGravity, action, gargoyleData];
$ToggleAlignments => SimpleQueue[gargoyleData.slackHandle, GGEvent.ToggleAlignments, action, gargoyleData];
$MakeHot => SimpleQueue[gargoyleData.slackHandle, GGEvent.MakeHot, action, gargoyleData];
$MakeAllHot => SimpleQueue[gargoyleData.slackHandle, GGEvent.MakeAllHot, action, gargoyleData];
$MakeCold => SimpleQueue[gargoyleData.slackHandle, GGEvent.MakeCold, action, gargoyleData];
$MakeAllCold => SimpleQueue[gargoyleData.slackHandle, GGEvent.MakeAllCold, action, gargoyleData];
$ShowHot => SimpleQueue[gargoyleData.slackHandle, GGEvent.ShowHot, action, gargoyleData];
$HideHot => SimpleQueue[gargoyleData.slackHandle, GGEvent.HideHot, action, gargoyleData];
$DropAnchor => SimpleQueue[gargoyleData.slackHandle, GGEvent.DropAnchor, action, gargoyleData];
$LiftAnchor => SimpleQueue[gargoyleData.slackHandle, GGEvent.KillAnchor, action, gargoyleData];
$StandardAlignments => SimpleQueue[gargoyleData.slackHandle, GGEvent.StandardAlignments, action, gargoyleData];
$ToggleShowColors => SimpleQueue[gargoyleData.slackHandle, GGEvent.ToggleShowColors, action, gargoyleData];
$ScreenChoiceChange => SimpleQueue[gargoyleData.slackHandle, GGEvent.ScreenChoiceChange, action, gargoyleData];
$ToggleMidpoints => SimpleQueue[gargoyleData.slackHandle, GGEvent.ToggleMidpoints, action, gargoyleData];
$ToggleHeuristics => SimpleQueue[gargoyleData.slackHandle, GGEvent.ToggleHeuristics, action, gargoyleData];
Unit Line
$RadiusUnitFromSegment => SimpleQueue[gargoyleData.slackHandle, GGEvent.ScaleUnitFromSegment, action, gargoyleData];
$RadiusUnitFromValue => SimpleQueue[gargoyleData.slackHandle, GGEvent.ScaleUnitFromValue, action, gargoyleData];
$RadiusUnitFromSelection => {
action ← CheckForSelectedReal[atom, action];
SimpleQueue[gargoyleData.slackHandle, GGEvent.ScaleUnitFromSelection, action, gargoyleData];
};
$InchScaleUnit => SimpleQueue[gargoyleData.slackHandle, GGEvent.InchScaleUnit, action, gargoyleData];
$CentimeterScaleUnit => SimpleQueue[gargoyleData.slackHandle, GGEvent.CentimeterScaleUnit, action, gargoyleData];
$PrintScaleUnit => SimpleQueue[gargoyleData.slackHandle, GGEvent.PrintScaleUnit, action, gargoyleData];
Slope Line
$SlopePrompt => SimpleQueue[gargoyleData.slackHandle, GGEvent.SlopePrompt, action, gargoyleData];
$AddSlope => SimpleQueue[gargoyleData.slackHandle, GGEvent.AddSlope, action, gargoyleData];
$GetSlope => SimpleQueue[gargoyleData.slackHandle, GGEvent.GetSlope, action, gargoyleData];
$ToggleSlope => SimpleQueue[gargoyleData.slackHandle, GGEvent.ToggleSlope, action, gargoyleData];
$DeleteSlope => SimpleQueue[gargoyleData.slackHandle, GGEvent.DeleteSlope, action, gargoyleData];
Angle Line
$AnglePrompt => SimpleQueue[gargoyleData.slackHandle, GGEvent.AnglePrompt, action, gargoyleData];
$AddAngle => SimpleQueue[gargoyleData.slackHandle, GGEvent.AddAngle, action, gargoyleData];
$GetAngle => SimpleQueue[gargoyleData.slackHandle, GGEvent.GetAngle, action, gargoyleData];
$ToggleAngle => SimpleQueue[gargoyleData.slackHandle, GGEvent.ToggleAngle, action, gargoyleData];
$DeleteAngle => SimpleQueue[gargoyleData.slackHandle, GGEvent.DeleteAngle, action, gargoyleData];
Radius Line
$RadiusPrompt => SimpleQueue[gargoyleData.slackHandle, GGEvent.RadiusPrompt, action, gargoyleData];
$AddRadius => SimpleQueue[gargoyleData.slackHandle, GGEvent.AddRadius, action, gargoyleData];
$GetRadius => SimpleQueue[gargoyleData.slackHandle, GGEvent.GetRadius, action, gargoyleData];
$ToggleRadius => SimpleQueue[gargoyleData.slackHandle, GGEvent.ToggleRadius, action, gargoyleData];
$DeleteRadius => SimpleQueue[gargoyleData.slackHandle, GGEvent.DeleteRadius, action, gargoyleData];
Distance Line
$DistancePrompt => SimpleQueue[gargoyleData.slackHandle, GGEvent.DistancePrompt, action, gargoyleData];
$AddDistance => SimpleQueue[gargoyleData.slackHandle, GGEvent.AddDistance, action, gargoyleData];
$GetDistance => SimpleQueue[gargoyleData.slackHandle, GGEvent.GetDistance, action, gargoyleData];
$ToggleDistance => SimpleQueue[gargoyleData.slackHandle, GGEvent.ToggleDistance, action, gargoyleData];
$DeleteDistance => SimpleQueue[gargoyleData.slackHandle, GGEvent.DeleteDistance, action, gargoyleData];
Coordinate Line
$MeasureSlopeHit => SimpleQueue[gargoyleData.slackHandle, GGEvent.MeasureSlopeHit, action, gargoyleData];
$MeasureAngleHit => SimpleQueue[gargoyleData.slackHandle, GGEvent.MeasureAngleHit, action, gargoyleData];
$MeasureRadiusHit => SimpleQueue[gargoyleData.slackHandle, GGEvent.MeasureRadiusHit, action, gargoyleData];
$MeasureLineDistHit => SimpleQueue[gargoyleData.slackHandle, GGEvent.MeasureLineDistHit, action, gargoyleData];
Miscellaneous Tip Table only
$ReloadTipTable => SimpleQueue[gargoyleData.slackHandle, GGEvent.ReloadTipTable, action, gargoyleData];
$AllAlignmentsOff => SimpleQueue[gargoyleData.slackHandle, GGEvent.AllAlignmentsOff, action, gargoyleData];
$InitializeAlignments => SimpleQueue[gargoyleData.slackHandle, GGEvent.InitializeAlignments, action, gargoyleData];
$DeleteCaretSegment => SimpleQueue[gargoyleData.slackHandle, GGEvent.DeleteCaretSegment, action, gargoyleData];
$IPSnapShot => SimpleQueue[gargoyleData.slackHandle, GGEvent.IPSnapShot, action, gargoyleData];
$EndOfSessionLogMessage => SimpleQueue[gargoyleData.slackHandle, GGSessionLog.EndOfSessionLogMessage, action, gargoyleData];
ENDCASE => NotYetImplementedMessage[atom, gargoyleData];
};
Utility Routines
SimpleQueue: PROC [handle: SlackHandle, callBack: EventProc, inputAction: LIST OF REF ANY, clientData: REF ANY] = {
SlackProcess.QueueInputAction[handle, callBack, inputAction, clientData, NIL];
};
printAllInput: BOOLFALSE; -- controlled by Debug menu
PrintAllInput: PROC [input: LIST OF REF ANY, gargoyleData: GargoyleData] = {
FOR list: LIST OF REF ANY ← input, list.rest UNTIL list = NIL DO
WITH list.first SELECT FROM
atom: ATOM => GGError.AppendTypescript[gargoyleData.feedback, Atom.GetPName[atom], oneLiner];
int: REF INT => GGError.AppendTypescript[gargoyleData.feedback, IO.PutFR["%g ", [integer[int^]]], oneLiner];
refChar: REF CHAR => GGError.AppendTypescript[gargoyleData.feedback, IO.PutFR["%g ", [character[refChar^]]], oneLiner];
coords: BiScrollers.ClientCoords => GGError.AppendTypescript[gargoyleData.feedback, IO.PutFR["(%1.2f, %1.2f) ", [real[coords.x]], [real[coords.y]]], oneLiner];
ENDCASE => ERROR;
ENDLOOP;
};
NotYetImplementedMessage: PROC [atom: ATOM, gargoyleData: GargoyleData] = {
GGError.Append[gargoyleData.feedback, "User action ", begin];
GGError.Append[gargoyleData.feedback, Atom.GetPName[atom], middle];
GGError.Append[gargoyleData.feedback, " is not yet implemented", end];
GGError.Blink[gargoyleData.feedback];
};
CheckForSelectedRope: PROC [atom: ATOM, action: LIST OF REF ANY] RETURNS [newAction: LIST OF REF ANY] = {
IF action.rest = NIL THEN { -- interactive call
newAction ← LIST[atom, ViewerTools.GetSelectionContents[]];
}
ELSE IF ISTYPE[action.rest.first, REF TEXT] THEN { -- TIP table call
newAction ← LIST[atom, Rope.FromRefText[NARROW[action.rest.first]]];
}
ELSE newAction ← action; -- SessionLog call
};
CheckForSelectedReal: PROC [atom: ATOM, action: LIST OF REF ANY] RETURNS [newAction: LIST OF REF ANY] = {
rope: Rope.ROPE;
real: REAL;
IF action.rest = NIL THEN { -- interactive call
rope ← ViewerTools.GetSelectionContents[];
real ← Convert.RealFromRope[rope ! Convert.Error => {real ← -1.0; CONTINUE}];
newAction ← LIST[atom, NEW[REAL ← real]];
}
ELSE IF ISTYPE[action.rest.first, REF TEXT] THEN { -- TIP table call
rope ← Rope.FromRefText[NARROW[action.rest.first]];
real ← Convert.RealFromRope[rope ! Convert.Error => {real ← -1.0; CONTINUE}];
newAction ← LIST[atom, NEW[REAL ← real]];
}
ELSE newAction ← action; -- SessionLog call
};
CheckForSelectedInt: PROC [atom: ATOM, action: LIST OF REF ANY] RETURNS [newAction: LIST OF REF ANY] = {
rope: Rope.ROPE;
int: INT;
IF action.rest = NIL THEN { -- interactive call
rope ← ViewerTools.GetSelectionContents[];
int ← IO.GetInt[IO.RIS[rope] ! IO.EndOfStream, IO.Error => {int ← -1; CONTINUE}];
newAction ← LIST[atom, NEW[INT ← int]];
}
ELSE IF ISTYPE[action.rest.first, REF INT] THEN { -- TIP table call or SessionLog call
newAction ← action;
}
ELSE ERROR;
};
FSMInfo: PROC [event: LIST OF REF ANY, clientData: REF ANY] = {
gargoyleData: GargoyleData ← NARROW[clientData];
mouseMode, state: Rope.ROPE;
mouseMode ← Atom.GetPName[gargoyleData.mouseMode];
state ← Atom.GetPName[gargoyleData.state];
GGError.PutF[gargoyleData.feedback, oneLiner, "mouseMode = %g. state = %g.", [rope[mouseMode]], [rope[state]]];
};
CauseAnError: PROC [event: LIST OF REF ANY, clientData: REF ANY] = {
gargoyleData: GargoyleData ← NARROW[clientData];
scene: GGModelTypes.Scene ← gargoyleData.scene;
firstSlice, secondSlice: GGModelTypes.Slice;
sliceGen: GGModelTypes.SliceGenerator;
sliceGen ← GGObjects.SlicesInScene[scene];
firstSlice ← GGObjects.NextSlice[sliceGen];
secondSlice ← GGObjects.NextSlice[sliceGen];
SIGNAL GGError.Problem[msg: "Client requested SIGNAL"];
};
END.