GGMenuImplA.mesa
Contents: Routines to build the Gargoyle control panel.
Copyright Ó 1985, 1987, 1988, 1989 by Xerox Corporation. All rights reserved.
Created by Pier on June 23, 1987 when GGMenuImpl overflowed
Last edited by Pier on October 17, 1990 4:10 pm PDT
Bier, June 12, 1991 11:21 am PDT
Eisenman, July 14, 1987 6:34:23 pm PDT
Doug Wyatt, December 18, 1989 2:04:01 pm PST
DIRECTORY
AtomButtons, EmbeddedButtons, Feedback, FeedbackTypes, GGBasicTypes, GGCircleCache, GGContainer, GGControlPanelTypes, GGCoreOps, GGEvent, GGInterfaceTypes, GGMenu, GGModelTypes, GGScene, GGSceneType, GGSegmentTypes, GGShapes, GGUserInput, GGUserProfile, GraphicsButton, Imager, ImagerFont, List, Menus, PFS, PutGet, Rope, Rules, TextNode, TiogaActive, TiogaOps, UserProfile, ViewerClasses, ViewerTools;
GGMenuImplA: CEDAR PROGRAM
IMPORTS AtomButtons, EmbeddedButtons, Feedback, GGCircleCache, GGContainer, GGCoreOps, GGEvent, GGMenu, GGShapes, GGUserInput, GGUserProfile, GraphicsButton, Imager, ImagerFont, List, PFS, PutGet, Rules, TiogaActive, TiogaOps, UserProfile, ViewerTools
EXPORTS GGInterfaceTypes, GGModelTypes, GGMenu = BEGIN
ControlsObj: PUBLIC TYPE = GGControlPanelTypes.ControlsObj;
MsgRouter: TYPE = FeedbackTypes.MsgRouter;
GGData: TYPE = GGInterfaceTypes.GGData;
GravityExtentData: TYPE = REF GravityExtentDataObj;
GravityExtentDataObj: TYPE = GGInterfaceTypes.GravityExtentDataObj;
Point: TYPE = GGBasicTypes.Point;
SceneObj: PUBLIC TYPE = GGSceneType.SceneObj; -- export of opaque type
SceneRef: TYPE = REF SceneObj;
Viewer: TYPE = ViewerClasses.Viewer;
ROPE: TYPE = Rope.ROPE;
popUpFont: Imager.Font; -- initialized in Init below;
entryHeight: CARDINAL = 15; -- height of a line of items
entryHSpace: CARDINAL = 2; -- horizontal space between items on a line
entryVSpace: CARDINAL = 2; -- vertical leading between lines
fullColumn: CARDINAL = 600; -- the width of the standard large left column.
smallNumberSize: CARDINAL = 60;
PUChoiceList: PROC [r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18, r19: AtomButtons.PopUpChoice ← [] ] RETURNS [list: AtomButtons.PopUpChoices] = GGCoreOps.PUChoiceList;
RList: PROC [ref1, ref2, ref3: REF ANYNIL] RETURNS [LIST OF REF ANY] = GGCoreOps.List;
AddARule: PROC [ggData: GGData] = {
rule: Rules.Rule ← Rules.Create[[
parent: ggData.controls.panel,
wy: ggData.height,
ww: ggData.controls.panel.cw,
wh: 2
]];
GGContainer.ChildXBound[ggData.controls.panel, rule];
ggData.height ← ggData.height + rule.wh + entryVSpace;
};
BuildControlPanel: PUBLIC PROC [ggData: GGData] = {
nextX: INTEGER;
GGMenu.BuildFileMenuLine[ggData];
nextX ← BuildMasterMenuLineA[ggData];
GGMenu.BuildMasterMenuLineB[ggData, nextX];
BuildActiveDocument[ggData];
GGMenu.BuildStyleMenuLine[ggData];
BuildGravityLine[ggData];
BuildSlopeLine[ggData];
BuildAngleLine[ggData];
BuildRadiusLine[ggData];
BuildDistanceLine[ggData];
BuildMeasureLine[ggData];
BuildFeedbackLine[ggData];
AddARule[ggData];
};
BuildFeedbackLine: PROC [ggData: GGData] = {
nextX: NAT ← AtomButtons.BuildButtonLine[ggData.controls.panel, 0, ggData.height, ggData, GGUserInput.EventNotify, LIST[
[label["Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Line", FeedbackLineInGGData, fullColumn]]
]];
ggData.height ← ggData.height + entryHeight;
};
FeedbackLineInGGData: AtomButtons.UpdateProc = {
If you update this routine, also update Init below.
Currently, we know of these message classes used in Gargoyle:
(BT) Complaint: Gargoyle informs the user of a user-initiated problem
(BT) Error: internal error. One of Gargoyle's invariants has been broken
(L) Confirm: Gargoyle asks the user to confirm a guarded operation
(L) DuringMouse: feedback generated each time the mouse is moved.
(L) Feedback: an acknowledgement that Gargoyle has done what you asked
(LT) Show: info that was explicitly requested (e.g. what color is this?)
(LT) Statistics: Gargoyle prints user requested statistics
(LT) Warning: Problems during a batch operation, like MergeInterpress
(T) Typescript: Output that only seems appropriate for the typescript, period.
(L) = send to label. (B) = send to label and blink. (T) = send to typescript
ggData: GGData ← NARROW[clientData];
router: MsgRouter ← Feedback.CreateRouter[];
FeedbackOps.SetMultiLabel[router, button, TRUE, LIST[$Error, $Complaint]]; -- blink
FeedbackOps.SetMultiLabel[router, button, FALSE, LIST[$DuringMouse, $Feedback, $Warning, $Confirm, $Show, $Statistics]];
FeedbackOps.SetMultiTypescript[router, $Gargoyle, LIST[$Error, $Warning, $Show, $Typescript, $Complaint, $Statistics]];
ggData.router ← router;
ggData.controls.feedbackLine ← button;
};
<<BuildMasterMenuLineA: PUBLIC PROC [ggData: GGData] RETURNS [nextX: INTEGER] = {
noOpChoice: AtomButtons.PopUpChoice ← [LIST [$NoOp], "", "no-op" ];
doc: Rope.ROPE ← Rope.Concat[GGUIUtility.GGHomeDirectory[], "GargoyleDoc.tioga"];
disableDecoding: BOOLNOT GGState.GetQuickClickMode[];
caretMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Caret Menu"]];
caretMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Caret", PUChoiceList [
Choice[RList [$CaretPositionFromSelection], "PositionFromSelection [T]", "Set the caret position (in current units) from the Tioga selection [<x>, <y>]"],
Choice[RList [$ShowCaretValues], "ShowCaretValues", "Show the current position (in current units) and angle (in degrees) of the caret"],
Choice[RList [$GrabInputFocus], "GrabInputFocus", "Move the input focus to the Gargoyle viewer without disturbing the caret"],
Choice[RList [$CaretAngleFromSelection], "AngleFromSelection [T]", "Set the caret angle (in degrees) from the Tioga selection"],
Choice[RList [$ShowAnchorValues], "ShowAnchorValues", "Show the current position (in current units) and angle (in degrees) of the anchor"]
],
-1, FALSE, popUpFont, caretMenuDoc, disableDecoding]];
transformMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Transform Menu"]];
transformMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Transform", PUChoiceList [
Choice[RList [$Scale], "Scale [GT]", "Scale selected objects by the number in the Tioga selection"],
Choice[RList [$ScaleXY], "ScaleXY [GT]", "Scale selected objects in X and Y by the two numbers in the Tioga selection"],
Choice[RList [$UnScale], "UnScale [GT]", "Scale selected objects by the reciprocal of the number in the Tioga selection"],
Choice[RList [$Rotate], "Rotate [GT]", "Rotate selected objects CCW about the Anchor by the number of degrees in the Tioga selection"],
Choice[RList [$Rotate, "90.0"], "Rotate 90 [G]", "Rotate selected objects CCW about the Anchor by 90 degrees"],
Choice[RList [$UnRotate], "UnRotate [GT]", "Rotate selected objects CW about the Anchor by the number of degrees in the Tioga selection"],
Choice[RList [$TranslateX], "TranslateX [GT]", "Translate selected objects in X direction by the number in the Tioga selection"],
Choice[RList [$TranslateXY], "TranslateXY [GT]", "Translate selected objects in X and Y directions by the two numbers in the Tioga selection"],
Choice[RList [$TranslateY], "TranslateY [GT]", "Translate selected objects in Y direction by the number in the Tioga selection"],
Choice[RList [$ScaleX, "-1.0"], "MirrorX [G]", "Scale selected objects by -1.0 in X direction"],
Choice[RList [$Rotate, "180.0"], "MirrorXY [G]", "Rotate selected objects by 180 degrees"],
Choice[RList [$ScaleY, "-1.0"], "MirrorY [G]", "Scale selected objects by -1.0 in Y direction"],
Choice[RList [$ScaleX], "ScaleX [GT]", "Scale selected objects in X direction by the number in the Tioga selection"],
Choice[RList [$SixPointTransform], "SixPoint [G]", "See GargoyleDoc for explanation"],
Choice[RList [$ScaleY], "ScaleY [GT]", "Scale selected objects in Y direction by the number in the Tioga selection"],
Choice[RList [$UnScaleX], "UnScaleX [GT]", "Scale selected objects in X direction by the reciprocal of the number in the Tioga selection"],
Choice[RList [$FourPointTransform], "FourPoint [G]", "See GargoyleDoc for explanation"],
Choice[RList [$UnScaleY], "UnScaleY [GT]", "Scale selected objects in Y direction by the reciprocal of the number in the Tioga selection"]
],
-1, FALSE, popUpFont, transformMenuDoc, disableDecoding]];
overlapMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Overlap Menu"]];
overlapMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Overlap", PUChoiceList [
Choice[RList [$Top], "Front [G]", "Move selected objects to the front"],
Choice[RList [$ShowPriorityValue], "ShowValue [G]", "Show the priority number for the selected object"],
Choice[RList [$Bottom], "Back [G]", "Move selected objects to the back"],
Choice[RList [$UpOne], "ForwardOne [G]", "Move selected objects one layer toward the front"],
Choice[RList [$FindPriorityFromSelection], "MatchFromSelection [T]", "Select the object at the priority number in the Tioga selection"],
Choice[RList [$DownOne], "BackOne [G]", "Move selected objects one layer toward the back"],
Choice[RList [$PutInFront], "PutInFront [G]", "Move the first selected objects in front of the last selected object"],
Choice[RList [$Exchange], "Exchange [G]", "Swap priority of the two selected objects"],
Choice[RList [$PutBehind], "PutBehind [G]", "Move the first selected objects behind the last selected object"],
Choice[RList [$UpFromSelection], "ForwardFromSelection [GT]", "Move selected objects toward the front by the number in the Tioga selection"],
Choice[RList [$PutAtSelection], "PutAtSelection [GT]", "Put the selected objects at the priority number in the Tioga selection"],
Choice[RList [$DownFromSelection], "BackFromSelection [GT]", "Move selected objects toward the back by the number in the Tioga selection"]
],
-1, FALSE, popUpFont, overlapMenuDoc, disableDecoding]];
curvesMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Curves Menu"]];
curvesMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Curves", PUChoiceList [
Choice[RList [$SetStraight], "Line (LOOK l) [G]", "Convert selected trajectories to straight lines"],
Choice[RList [$SetArc], "Arc (LOOK a) [G]", "Convert selected trajectories to arcs"],
Choice[RList [$SetConic], "Conic [GT]", "Convert selected trajectories to parabolas, using the pointiness [0.0 .. 1.0] in the Tioga selection"],
Choice[RList [$SetBezier], "Bezier (LOOK z) [G]", "Convert selected trajectories to Bezier splines"],
Choice[RList [$SetBSpline], "B-Spline (LOOK b) [G]", "Convert selected trajectories to B-Splines"],
Choice[RList [$SetNaturalSpline], "Natural Spline (LOOK n) [G]", "Convert selected trajectories to natural splines"],
noOpChoice,
Choice[RList [$SelectMatchingCurve], "MatchSelectedType [T]", "Select curve types matching type in the Tioga selection (Line, Straight Arc, Parabolic Conic, Bezier, BSpline, Cyclic Natural, Natural"],
noOpChoice,
Choice[RList [$SetConstraintType], "SetEditConstraint [T]", "Set EditConstraint to be none, tangent, or length"],
Choice[RList [$ShowConstraintType], "ShowEditConstraint", "Print current edit constrain type"],
Choice[RList [$SetMakeConstrained], "MakeConstrained [G]", "Enforce the current constraint at the selected trajectory joint or CP."]
],
-1, FALSE, popUpFont, curvesMenuDoc, disableDecoding]];
shapesMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Shapes Menu"]];
shapesMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Shapes", PUChoiceList [
noOpChoice,
Choice[RList [$SelectedBBox], "SelectedBBox", "Add the bounding box of all selected items to the scene"],
Choice[RList [$NewBox, NEW[REAL ← 1.0]], "Box", "Create a unit box about the Caret"],
Choice[RList [$NewCircle, NEW[REAL ← 1.0]], "Circle", "Create unit circle about the Caret"],
Choice[RList [$KnotchedLine, NEW[REAL ← 4.0], NEW[INT ← 8]], "KnotchedLine", "Create a sample knotched line at the caret"],
Choice[RList [$PolygonInCircle], "Polygon [T]", "Create a polygon about the Caret of the number of sides specified in the Tioga selection"],
Choice[RList [$Frame, NEW[REAL ← 8.5*72.0], NEW[REAL ← 11.0*72.0]], "8.5x11", "Create an 8.5x11 inch box at the origin"],
Choice[LIST [$Frame, NEW[REAL8.1*72.0], NEW[REAL8.9*72.0], NEW[REAL ← 0.0], NEW[REAL ← 1.3*72.0] ], "C2700", "Create an 8.1x8.9 inch box in the C2700 imaging area"],
Choice[RList [$Frame, NEW[REAL ← 640.0], NEW[REAL ← 480.0]], "640x480", "Create a 640x480 point box at the origin"],
Choice[RList [$MergeShapes, "[CedarChest7.0]<Gargoyle>GGBinderGridQuarterInch.gargoyle"], "8.5x11 grid", "Create a two grid axes with 1/4 inch spacings (make hot to use)"],
Choice[RList [$Frame, NEW[REAL ← 1024.0], NEW[REAL ← 768.0]], "1024x768", "Create a 1024x768 point box at the origin"],
Choice[RList [$Frame, NEW[REAL ← 38.0*72.0], NEW[REAL ← 50.666667*72.0]], "38x50.66 (Versatec)", "Create a 38x50.66 inch box at the origin"],
Choice[RList [$NewBox, NEW[REAL ← 1.0]], "Box", "Create a unit box about the Caret"],
Choice[RList [$NewArrow, NEW[REAL ← 0.5], NEW[REAL ← 0.125]], "Arrow", "Create a sample arrow at the caret"],
Choice[RList [$PolygonInCircle, NEW[INT ← 3]], "Triangle", "Create triangle about the Caret"],
Choice[RList [$PolygonInCircle, NEW[INT ← 4]], "Square", "Create square about the Caret"],
Choice[RList [$PolygonInCircle, NEW[INT ← 5]], "Pentagon", "Create pentagon about the Caret"],
Choice[RList [$PolygonInCircle, NEW[INT ← 6]], "Hexagon", "Create hexagon about the Caret"],
Choice[RList [$PolygonInCircle, NEW[INT ← 8]], "Octagon", "Create octagon about the Caret"]
],
-1, FALSE, popUpFont, shapesMenuDoc, disableDecoding]];
nextX ← AtomButtons.BuildButtonLine[ggData.controls.panel, 0, ggData.height, ggData, GGUserInput.EventNotify, LIST[
caretMenu, transformMenu, overlapMenu, curvesMenu, shapesMenu
]];
};
>>
FindControlPanel: PROC [] RETURNS [filename: ROPE ← NIL] = {
There are several places to look in for the Gargoyle control panel:
(1) The file specified in Gargoyle.ControlPanelFile: in the user profile.
(2) The file "[PCedar]<Gargoyle>GargoyleControlPanel.tioga" (useful during development)
(3) The file "[CedarCommon]<FamousFiles>GargoyleControlPanel.tioga"
(4) The file "[PCedar]<FamousFiles>GargoyleControlPanel.tioga"
Use whichever is found first. Return NIL if none are found.
value: LIST OF ROPE;
fullName: PFS.PATHNIL;
path: PFS.PATH;
value ← UserProfile.ListOfTokens["Gargoyle.ControlPanelFile", NIL];
IF value # NIL THEN {
FOR list: LIST OF ROPE ← value, list.rest UNTIL list = NIL DO
path ← PFS.PathFromRope[list.first];
fullName ← PFS.FileInfo[name: path ! PFS.Error=>CONTINUE].fullFName;
IF fullName # NIL THEN RETURN[PFS.RopeFromPath[fullName]];
ENDLOOP;
};
If that failed, try this:
path ← PFS.PathFromRope["[PCedar]<Gargoyle>GargoyleControlPanel.tioga"];
fullName ← PFS.FileInfo[name: path ! PFS.Error=>CONTINUE].fullFName;
IF fullName # NIL THEN RETURN[PFS.RopeFromPath[fullName]];
If that failed, try this:
path ← PFS.PathFromRope["[CedarCommon]<FamousFiles>GargoyleControlPanel.tioga"];
fullName ← PFS.FileInfo[name: path ! PFS.Error=>CONTINUE].fullFName;
IF fullName # NIL THEN RETURN[PFS.RopeFromPath[fullName]];
If that failed, try this:
path ← PFS.PathFromRope["[PCedar]<FamousFiles>GargoyleControlPanel.tioga"];
fullName ← PFS.FileInfo[name: path ! PFS.Error=>CONTINUE].fullFName;
IF fullName # NIL THEN RETURN[PFS.RopeFromPath[fullName]];
};
BuildActiveDocument: PROC [ggData: GGData] = {
nextX: NAT ← 0;
v: Viewer;
lines: NAT ← 3;
doc: TextNode.Ref ← NIL;
filename: ROPE ← FindControlPanel[];
IF filename = NIL THEN Feedback.AppendByName[$System, oneLiner, $Error, "No file found for Gargoyle control panel in [PCedar]<Gargoyle>, [CedarCommon]<FamousFiles>, [PCedar]<FamousFiles> nor in Gargoyle.ControlPanelFile user profile entry."]
ELSE {
Feedback.PutFByName[$System, oneLiner, $Feedback, "Loading %g as Gargoyle's control panel", [rope[filename]]];
doc ← PutGet.FromFile[filename];
};
v ← ViewerTools.MakeNewTextViewer[[
wx: 0, wy: ggData.height, wh: lines*entryHeight,
parent: ggData.controls.panel,
data: doc,
scrollable: TRUE, border: TRUE]];
ggData.controls.controlPanel ← TiogaActive.LookupDoc[v];
GGContainer.ChildXBound[ggData.controls.panel, v];
ggData.controls.controlPanelViewer ← v;
EmbeddedButtons.LinkDocToApplication[doc: ggData.controls.controlPanel, target: $Gargoyle, targetViewer: ggData.controls.actionArea, applicationData: ggData, notifyProc: ControlPanelNotify];
EmbeddedButtons.LinkDocToApplication[doc: ggData.controls.controlPanel, target: $UnQueuedGargoyle, targetViewer: ggData.controls.actionArea, applicationData: ggData, notifyProc: UnQueuedControlPanelNotify];
TiogaOps.Interpret[ggData.controls.controlPanelViewer, LIST[$ActivityOn]];
ggData.height ← ggData.height + lines*entryHeight;
};
ControlPanelNotify: EmbeddedButtons.NotifyProc = {
PROC [buttonInfo: ButtonInfo, events: LIST OF REF ANY, targetViewer: Viewer, applicationData: REF] RETURNS [result: REF ← NIL];
newEvent: LIST OF REF ANY ← List.Append[events]; -- make a copy of the eventList, because EmbeddedButtons resuses the original
GGUserInput.EventNotify[applicationData, newEvent];
};
UnQueuedControlPanelNotify: EmbeddedButtons.NotifyProc = {
PROC [buttonInfo: ButtonInfo, events: LIST OF REF ANY, targetViewer: Viewer, applicationData: REF] RETURNS [result: REF ← NIL];
newEvent: LIST OF REF ANY ← List.Append[events]; -- make a copy of the eventList, because EmbeddedButtons resuses the original
GGUserInput.UnQueuedEventNotify[applicationData, newEvent];
};
BuildGravityLine: PROC [ggData: GGData] = {
nextX: NAT ← 0;
ggData.controls.gravityTypeMenu ←
AtomButtons.BuildEnumTypeSelection[viewer: ggData.controls.panel, x: 4, y: ggData.height, maxWidth: 140,
clientData: ggData,
handleProc: GGUserInput.EventNotify,
title: "GravType:", default: "PreferPoints",
borderOnButtons: TRUE, style: flipThru, allInOneRow: TRUE,
buttonNames: LIST["PreferLines", "PreferPoints"],
atom: $GravityChoiceChange];
ggData.hitTest.gravityType ← pointsPreferred;
nextX ← ggData.controls.gravityTypeMenu.nextx;
nextX ← AtomButtons.BuildButtonLine[
ggData.controls.panel, nextX + entryHSpace, ggData.height, ggData, GGUserInput.EventNotify,
LIST[
[button["GravExtent:", LIST[LIST[$ShowGravExtent]]]]
]];
nextX ← GraphicsButton.BuildGraphicsButton[
container: ggData.controls.panel,
x: nextX + entryHSpace,
y: ggData.height,
w: 60, -- changed from 72 to make more room in line
h: entryHeight,
clientData: ggData,
choices: LIST[
[LIST[$GravityExtentChange, $ValueDown]],
[LIST[$GravityExtentChange, $InitialValue]],
[LIST[$GravityExtentChange, $ValueUp]]],
handleProc: GGUserInput.EventNotify,
repaintProc: GravityExtentRepaint,
buttonData: NEW[GravityExtentDataObj ← [extent: GGUserProfile.GetDefaultGravityExtent[]]],
updateProc: GravityExtentInGGData
];
nextX ← AtomButtons.BuildButtonLine[
ggData.controls.panel, nextX + entryHSpace, ggData.height, ggData, GGUserInput.EventNotify,
LIST[
[twoState["Gravity", LIST[$ToggleGravity], TRUE, GravityInGGData]],
[twoState["Midpts", LIST[$ToggleMidpoints], FALSE, MidpointsInGGData]],
[twoState["Auto", LIST[$ToggleHeuristics], GGUserProfile.GetDefaultHeuristics[], HeuristicsInGGData]],
[twoState["Alignments", LIST[$ToggleShowAlignments], TRUE, AlignmentsInGGData]]
],
entryHSpace];
ggData.height ← ggData.height + entryHeight;
};
BuildSlopeLine: PROC [ggData: GGData] = {
buttonHandle: AtomButtons.SortedButtonHandle;
nextX: NAT ← AtomButtons.BuildButtonLine[ggData.controls.panel, 0, ggData.height, ggData, GGUserInput.EventNotify,LIST[
[button["Slope:", LIST[LIST[$SlopePrompt]] ]],
[button["Get!", LIST[LIST[$GetSlope]] ]],
[button["Add!", LIST[LIST[$AddSlope]] ]],
[button["Delete!", LIST[LIST[$DeleteSlope]] ]]
]];
buttonHandle ← AtomButtons.CreateSortedButtonViewer[ggData.controls.panel, nextX, ggData.height];
ggData.controls.slopeHandle ← buttonHandle;
GGEvent.StandardSlopes[ggData, LIST[$InitStandardSlopes]];
ggData.height ← ggData.height + entryHeight;
};
BuildAngleLine: PROC [ggData: GGData] = {
buttonHandle: AtomButtons.SortedButtonHandle;
nextX: NAT ← AtomButtons.BuildButtonLine[ggData.controls.panel, 0, ggData.height, ggData, GGUserInput.EventNotify,LIST[
[button["Angle:", LIST[LIST[$AnglePrompt]] ]],
[button["Get!", LIST[LIST[$GetAngle]] ]],
[button["Add!", LIST[LIST[$AddAngle]] ]],
[button["Delete!", LIST[LIST[$DeleteAngle]] ]]
]];
buttonHandle ← AtomButtons.CreateSortedButtonViewer[ggData.controls.panel, nextX, ggData.height];
ggData.controls.angleHandle ← buttonHandle;
GGEvent.StandardAngles[ggData, LIST[$InitStandardAngles]];
ggData.height ← ggData.height + entryHeight;
};
BuildRadiusLine: PROC [ggData: GGData] = {
buttonHandle: AtomButtons.SortedButtonHandle;
nextX: NAT ← AtomButtons.BuildButtonLine[ggData.controls.panel, 0, ggData.height, ggData, GGUserInput.EventNotify, LIST[
[button["Radius:", LIST[LIST[$RadiusPrompt]] ]],
[button["Get!", LIST[LIST[$GetRadius]] ]],
[button["Add!", LIST[LIST[$AddRadius]] ]],
[button["Delete!", LIST[LIST[$DeleteRadius]] ]]
]];
buttonHandle ← AtomButtons.CreateSortedButtonViewer[ggData.controls.panel, nextX, ggData.height];
ggData.controls.radiusHandle ← buttonHandle;
GGEvent.StandardRadii[ggData, LIST[$InitStandardRadii]];
ggData.controls.radiusCircleCache ← GGCircleCache.Create[];
ggData.height ← ggData.height + entryHeight;
};
BuildDistanceLine: PROC [ggData: GGData] = {
buttonHandle: AtomButtons.SortedButtonHandle;
nextX: NAT ← AtomButtons.BuildButtonLine[ggData.controls.panel, 0, ggData.height, ggData, GGUserInput.EventNotify, LIST[
[button["LineDist:", LIST[LIST[$DistancePrompt]] ]],
[button["Get!", LIST[LIST[$GetDistance]] ]],
[button["Add!", LIST[LIST[$AddDistance]] ]],
[button["Delete!", LIST[LIST[$DeleteDistance]] ]]
]];
buttonHandle ← AtomButtons.CreateSortedButtonViewer[ggData.controls.panel, nextX, ggData.height];
ggData.controls.distanceHandle ← buttonHandle;
GGEvent.StandardDistances[ggData, LIST[$InitStandardDistances]];
ggData.height ← ggData.height + entryHeight;
};
BuildMeasureLine: PROC [ggData: GGData] = {
nextX: NAT ← AtomButtons.BuildButtonLine[ggData.controls.panel, 0, ggData.height, ggData, GGUserInput.EventNotify, LIST[
[label["Measure- "]],
[button["←", LIST[LIST[$MeasureSlopeFromSelection]], -1, TRUE ]],
[button["Slope:", LIST[LIST[$MeasureSlopeHit]], -1, TRUE ]],
[text["0.0", SlopeViewInGGData, smallNumberSize]],
[button["←", LIST[LIST[$MeasureAngleFromSelection]], -1, TRUE ]],
[button["Angle:", LIST[LIST[$MeasureAngleHit]], -1, TRUE ]],
[text["0.0", AngleViewInGGData, smallNumberSize]],
[button["←", LIST[LIST[$MeasureRadiusFromSelection]], -1, TRUE ]],
[button["Radius:", LIST[LIST[$MeasureRadiusHit]], -1, TRUE ]],
[text["0.0", DistanceViewInGGData, smallNumberSize]],
[button["←", LIST[LIST[$MeasureLineDistFromSelection]], -1, TRUE ]],
[button["LineDist:", LIST[LIST[$MeasureLineDistHit]], -1, TRUE ]],
[text["0.0", LineDistViewInGGData, smallNumberSize]]
]];
ggData.height ← ggData.height + entryHeight;
};
Style Line:
Gravity Line:
GravityInGGData: AtomButtons.InitTwoStateProc = {
ggData: GGData ← NARROW[clientData];
ggData.controls.gravButton ← twoState;
};
AlignmentsInGGData: AtomButtons.InitTwoStateProc = {
ggData: GGData ← NARROW[clientData];
ggData.controls.alignments ← twoState;
};
MidpointsInGGData: AtomButtons.InitTwoStateProc = {
ggData: GGData ← NARROW[clientData];
ggData.controls.midpointButton ← twoState;
};
HeuristicsInGGData: AtomButtons.InitTwoStateProc = {
ggData: GGData ← NARROW[clientData];
ggData.controls.heuristicsButton ← twoState;
};
GravityExtentInGGData: GraphicsButton.UpdateGraphicsButtonProc = {
ggData: GGData ← NARROW[clientData];
ggData.controls.gravityExtentButton ← stateInfo;
};
GravityExtentRepaint: PROC [dc: Imager.Context, clientData: REF ANY, buttonData: REF ANY, button: Viewer] = {
caretPoint: Point;
ged: GravityExtentData ← NARROW[buttonData];
extent: REAL ← ged.extent;
Imager.TranslateT[dc, [0, button.wh/2.0]];
caretPoint ← [extent, 0.0];
GGShapes.DrawCaret[dc, caretPoint, [0,-1], 1.0];
};
Distance Line:
SlopeViewInGGData: AtomButtons.UpdateProc = {
ggData: GGData ← NARROW[clientData];
ggData.controls.slopeView ← button;
};
AngleViewInGGData: AtomButtons.UpdateProc = {
ggData: GGData ← NARROW[clientData];
ggData.controls.angleView ← button;
};
DistanceViewInGGData: AtomButtons.UpdateProc = {
ggData: GGData ← NARROW[clientData];
ggData.controls.radiusView ← button;
};
LineDistViewInGGData: AtomButtons.UpdateProc = {
ggData: GGData ← NARROW[clientData];
ggData.controls.lineDistView ← button;
};
Choice: PROC [action: LIST OF REF ANY, actionImage: Rope.ROPE, doc: Rope.ROPE, font: Imager.Font ← NIL] RETURNS [AtomButtons.PopUpChoice]= {
RETURN[[action, actionImage, doc, font]];
};
gRouter: MsgRouter; -- the router used by routines that are too deep in Gargoyle to know what viewer they are working on behalf of. Sends output to the Gargoyle typescript and the Cedar Message Window.
Init: PROC = {
popUpFont ← ImagerFont.Find["xerox/tiogafonts/helvetica10I", substituteQuietly];
If you update the router, remember to also correct it in FeedbackLineInGGData above.
gRouter ← Feedback.CreateRouter[];
[] ← Feedback.RegisterRouter[gRouter, $Gargoyle];
FeedbackOps.SetMultiMessageWindow[gRouter, TRUE, LIST[$Error, $Complaint]]; -- blink
FeedbackOps.SetMultiMessageWindow[gRouter, FALSE, LIST[$DuringMouse, $Feedback, $Warning, $Confirm, $Show, $Statistics]];
FeedbackOps.SetMultiTypescript[gRouter, $Gargoyle, LIST[$Error, $Warning, $Show, $Typescript, $Complaint, $Statistics]];
};
Init[];
END.