GGMenuImplC.mesa
Copyright Ó 1985, 1987, 1988, 1989 by Xerox Corporation. All rights reserved.
Created by Pier, June 23, 1987, when GGMenuImpl overflowed
Pier, October 17, 1990 3:30 pm PDT
Bier, June 12, 1991 11:23 am PDT
Doug Wyatt, December 19, 1989 11:15:30 am PST
Last tweaked by Mike Spreitzer on May 3, 1990 3:50:48 pm PDT
DIRECTORY
AtomButtons, Feedback, FeedbackOps, FeedbackTypes, FS, GGBasicTypes, GGControlPanelTypes, GGCoreOps, GGInterfaceTypes, GGMenu, GGModelTypes, GGRefreshTypes, GGSceneType, GGSegmentTypes, GGUserInput, Imager, ImagerFont, Menus, Rope, ViewerClasses;
GGMenuImplC:
CEDAR
PROGRAM
IMPORTS AtomButtons, Feedback, FeedbackOps, FS, GGCoreOps, GGUserInput, ImagerFont
EXPORTS GGMenu, GGModelTypes, GGInterfaceTypes = BEGIN
Controls: TYPE = REF ControlsObj;
ControlsObj: PUBLIC TYPE = GGControlPanelTypes.ControlsObj;
MsgRouter: TYPE = FeedbackTypes.MsgRouter;
GGData: TYPE = GGInterfaceTypes.GGData;
RefreshDataObj: PUBLIC TYPE = GGRefreshTypes.RefreshDataObj;
SceneObj: PUBLIC TYPE = GGSceneType.SceneObj; -- export of opaque type
SceneRef: TYPE = REF SceneObj;
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: PUBLIC PROC [r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, r20, r21, r22, r23: AtomButtons.PopUpChoice ← [] ] RETURNS [list: AtomButtons.PopUpChoices] = {
OPEN AtomButtons;
InnerCons: PROC[r: PopUpChoice] = {rList ← CONS[r, rList]; };
rList: PopUpChoices;
IF r0.action#NIL THEN InnerCons[r0];
IF r1.action#NIL THEN InnerCons[r1];
IF r2.action#NIL THEN InnerCons[r2];
IF r3.action#NIL THEN InnerCons[r3];
IF r4.action#NIL THEN InnerCons[r4];
IF r5.action#NIL THEN InnerCons[r5];
IF r6.action#NIL THEN InnerCons[r6];
IF r7.action#NIL THEN InnerCons[r7];
IF r8.action#NIL THEN InnerCons[r8];
IF r9.action#NIL THEN InnerCons[r9];
IF r10.action#NIL THEN InnerCons[r10];
IF r11.action#NIL THEN InnerCons[r11];
IF r12.action#NIL THEN InnerCons[r12];
IF r13.action#NIL THEN InnerCons[r13];
IF r14.action#NIL THEN InnerCons[r14];
IF r15.action#NIL THEN InnerCons[r15];
IF r16.action#NIL THEN InnerCons[r16];
IF r17.action#NIL THEN InnerCons[r17];
IF r18.action#NIL THEN InnerCons[r18];
IF r19.action#NIL THEN InnerCons[r19];
IF r20.action#NIL THEN InnerCons[r20];
IF r21.action#NIL THEN InnerCons[r21];
IF r22.action#NIL THEN InnerCons[r22];
IF r23.action#NIL THEN InnerCons[r23];
FOR dummy: PopUpChoices ← rList, dummy.rest UNTIL dummy=NIL DO
list ← CONS[dummy.first, list];
ENDLOOP;
};
List: PROC [ref1, ref2, ref3: REF ANY ← NIL] RETURNS [LIST OF REF ANY] = GGCoreOps.List;
<<BuildFileMenuLine:
PUBLIC
PROC [ggData: GGData] = {
noOpChoice: AtomButtons.PopUpChoice ← [LIST [$NoOp], "", "no-op" ];
doc: Rope.ROPE ← Rope.Concat[GGUIUtility.GGHomeDirectory[], "GargoyleDoc.tioga"];
disableDecoding: BOOL ← NOT GGState.GetQuickClickMode[];
mergeMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Merge Menu"]];
mergeMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Merge", PUChoiceList [
Choice[List [$MergeAll], "MergeAll", "Merges in geometry, options and defaults from a Gargoyle file"],
Choice[List [$MergeShapes], "MergeShapes", "Merges in geometry from a Gargoyle file"],
Choice[List [$MergeOptions], "MergeOptions", "Merges in options and defaults from a Gargoyle file"],
Choice[List [$MergeAlignments], "MergeAlignments", "Merges in alignment menu state from a Gargoyle file"]
],
-1, FALSE, popUpFont, mergeMenuDoc, disableDecoding]];
stuffMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Stuff Menu"]];
stuffMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Stuff", PUChoiceList [
Choice[List [$StuffToTioga], "ToTioga [GT]", "Stuff selected objects into Tioga node"],
Choice[List [$StuffToFile], "ToFile [GT]", "Store selected objects to the Gargoyle file named in the Tioga selection"],
Choice[List [$MergeFromTioga], "MergeFromTioga [T]", "Merge Gargoyle objects from Tioga node"],
Choice[List [$StuffToTiogaBordered], "ToTiogaBordered [GT]", "Stuff selected objects into Tioga node with border"],
Choice[List [$StuffToFileAlt], "ToFileAlt [GT]", "Store selected objects to the Gargoyle file named in the Tioga selection using alternate fonts"],
Choice[List [$GrabFromTioga], "GrabFromTioga [T]", "Merge Gargoyle objects from Tioga node and translate to caret"],
Choice[List [$StuffToTiogaFit], "ToTiogaFit [GT]", "Stuff selected objects into Tioga node and fit to margins"],
noOpChoice,
Choice[List [$GetFromTioga], "GetFromTioga [T]", "Get Gargoyle objects from Tioga node, clearing first"],
Choice[List [$StuffToTiogaBorderedAndFit], "ToTiogaBorderedAndFit [GT]", "Stuff selected objects into Tioga node with border and fit to margins"],
noOpChoice,
Choice[List [$MergeFromGargoyle], "MergeFromGargoyle [G]", "Merge selected Gargoyle objects from another Gargoyle viewer into this Gargoyle viewer"],
Choice[List [$StuffToTiogaAlt], "StuffToTiogaAlt [GT]", "Stuff selected objects into Tioga node using alternate fonts"]
],
-1, FALSE, popUpFont, stuffMenuDoc, disableDecoding]];
interpressMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Interpress Menu"]];
interpressMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["IP", PUChoiceList [
Choice[List [$ToIP], "ToFile [T]", "Store all objects to the IP file named in the Tioga selection"],
Choice[List [$IPToTioga], "StuffToTioga [GT]", "Stuff selected objects into Tioga node"],
Choice[List [$MergeIPEditable], "MergeIPEditable [T]", "Merge objects from the IP file named in the Tioga selection into the scene"],
Choice[List [$ToIPScreen], "ToFileAlt [T]", "Store all objects to the IP file named in the Tioga selection using alternate fonts"],
Choice[List [$IPToTiogaBordered], "StuffToTiogaBordered [GT]", "Stuff selected objects into Tioga node with border"],
Choice[List [$MergeIPSlice], "MergeIPSlice [T]", "Merge a single slice containing the IP file named in the Tioga selection into the scene, with optional page boundaries"],
Choice[List [$ToIPSelected], "ToFileSelected [GT]", "Store all selected objects to the IP file named in the Tioga selection"],
Choice[List [$IPToTiogaFit], "StuffToTiogaFit [GT]", "Stuff selected objects into Tioga node and fit to margins"],
Choice[List [$IPMergeFromTioga], "MergeFromTioga [T]", "Merge the IP Artwork node in the Tioga selection into the scene"],
noOpChoice,
Choice[List [$IPToTiogaBorderedAndFit], "StuffToTiogaBorderedAndFit [GT]", "Stuff selected objects into Tioga node with border and fit to margins"],
Choice[List [$IPToTiogaAlt], "StuffToTiogaAlt [GT]", "Stuff selected objects into Tioga node using alternate fonts"],
Choice[List [$IncludeIPByReference], "IncludeByReference", "File out IP objects by file name reference only"],
Choice[List [$ShowIPIncludeMode], "ShowIncludeMode", "Print IP include mode"],
Choice[List [$IncludeIPByValue], "IncludeByValue", "File out IP objects directly"]
],
-1, FALSE, popUpFont, interpressMenuDoc, disableDecoding]];
scriptMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Script Menu"]];
scriptMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Script", PUChoiceList [
Choice[List [$ScriptAction, $Playback], "PlaybackScript [T]", "Replay actions from the file named in the Tioga selection"],
Choice[List [$ShowScripts], "ShowScripts", "List, in order, the names of the scripts that would recreate the current picture"],
noOpChoice,
Choice[List [$ScriptAction, $FastPlay], "FastPlayScript [T]", "Do a PlaybackScript, with screen update suppressed"],
noOpChoice,
noOpChoice,
Choice[List [$ScriptAction, $Open], "OpenScript [T]", "Create a file as named in the Tioga Selection and store future actions in it"],
Choice[List [$ScriptAction, $Append], "AppendToScript [T]", "Append future actions to the file named in the Tioga Selection"],
Choice[List [$ScriptAction, $Close], "CloseScript", "Stop sending actions to the currently open file (files most be closed before they can be played back)"]
],
-1, FALSE, popUpFont, scriptMenuDoc, disableDecoding]];
helpMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Help Menu"]];
helpMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Help", PUChoiceList [
Choice[List [$Help, $MouseActions], "MouseActions", "Opens a file with a summary of Gargoyle mouse and keyboard actions"],
Choice[List [$Help, $Fonts], "Fonts", "Opens a file with a summary of Gargoyle font naming conventions and some examples"],
Choice[List [$Help, $Colors], "Colors", "Opens a file with a list of available color palettes"]
],
-1, FALSE, popUpFont, helpMenuDoc, disableDecoding]];
nextX: INTEGER ← 0;
nextX ← AtomButtons.BuildButtonLine [ggData.controls.panel, 0, ggData.height, ggData, GGUserInput.EventNotify, LIST[
[button["Clear", LIST[LIST[$Clear]], -1, FALSE, NIL, ConfirmClear]],
[button["Restore", LIST[LIST[$Reset]], -1, FALSE, NIL, ConfirmReset]],
[button["Get", LIST[LIST[$Get]], -1, FALSE, NIL, ConfirmGet]], -- guarded in spite of Tioga viewers menus
[button["Store", LIST[LIST[$Store]], -1, FALSE, NIL, ConfirmStore]],
[button["Save", LIST[LIST[$Save]] ]],
mergeMenu,
stuffMenu,
interpressMenu
]];
nextX ← AtomButtons.BuildButtonLine [ggData.controls.panel, nextX+entryHSpace, ggData.height, ggData, GGUserInput.UnQueuedEventNotify, LIST[
scriptMenu,
helpMenu
]];
nextX ← AtomButtons.BuildUnQueuedButtonLine [ggData.controls.panel, nextX+entryHSpace, ggData.height, ggData, LIST[
["Revive!", button, ReviveButton] -- must be unqueued
]];
nextX ← AtomButtons.BuildButtonLine [ggData.controls.panel, nextX+entryHSpace, ggData.height, ggData, GGUserInput.EventNotify, LIST[
[button["Typescript", LIST[LIST[$Typescript]] ]]
]];
ggData.height ← ggData.height + entryHeight;
};
>>
BuildStyleMenuLine: PUBLIC PROC [ggData: GGData] = {
noOpChoice: AtomButtons.PopUpChoice ← [LIST [$NoOp], "", "no-op" ];
doc: Rope.ROPE ← Rope.Concat[GGUIUtility.GGHomeDirectory[], "GargoyleDoc.tioga"];
disableDecoding: BOOL ← NOT GGState.GetQuickClickMode[];
strokeMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Stroke Menu"]];
strokeMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Stroke", PUChoiceList [
Choice[List [$LineWidth], "WidthFromSelection [GT]", "Assign the stroke width in the Tioga selection to selected curve segments"],
Choice[List [$PrintStrokeValues], "ShowValues [G]", "Show stroke values of selected curve segment"],
Choice[List [$LineWidth, NEW[REAL ← 1.0]], "1 pt (LOOK 1) [G]", "Assign unit stroke width to selected curve segments"],
Choice[List [$LineEnd], "EndFromSelection [GT]", "Assign the stroke end in the Tioga selection to selected curve segments (i.e. round, butt, square)"],
Choice[List [$SelectMatchingWidth], "MatchSelectedWidth [T]", "Select all curve segments having stroke width specified in the Tioga selection"],
Choice[List [$LineWidth, NEW[REAL ← 0.0]], "0 pt (LOOK 0) [G]", "Assign zero stroke width to selected curve segments"],
Choice[List [$DashesFromSelection], "DashesFromSelection [GT]", "Assign the dash pattern in the Tioga selection to selected curve segments: [<on>, <off>] <start> <length>" ],
Choice[List [$SelectMatchingDashes], "MatchSelectedDashes [T]", "Select all curve segments having dash pattern specified in the Tioga selection: [<on>, <off>] <start> <length>"],
Choice[List [$DashesOff], "DashesOff [G]", "Remove dashes from selected curve segments"],
Choice[List [$TrajJoints], "JointFromSelection [GT]", "Assign the stroke joint in the Tioga selection to selected curve segments (i.e. round, miter, bevel)"],
Choice[List [$ShowDefaultStrokeValues], "ShowDefaults", "Print default stroke values for width, end, joint, and dashes"],
Choice[List [$SetDefaultStrokeValues], "MakeDefaults [G]", "Set stroke default values from the currently selected curve segment"],
Choice[List [$CopyStrokeValues], "Copy [G]", "Copy stroke values from the last selected slice to all other selected slices"],
noOpChoice,
noOpChoice
],
-1, FALSE, popUpFont, strokeMenuDoc, disableDecoding]];
popUpButtonDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Color Menu"]];
colorMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Color", PUChoiceList [
Choice[List [$LineColorFromColorTool], "FromColorTool [G]", "Make selected strokes have the color in the ColorTool"],
Choice[List [$PrintLineColor], "ShowStrokeColor [G]", "Print stroke color of selected stroke"],
Choice[List [$LineColorToColorTool], "ToColorTool [G]", "Send the stroke color of the selected strokes to the ColorTool"],
Choice[List [$LineColorNone], "none [G]", "Make selected strokes have no color (invisible)"],
Choice[List [$LineColorFollowColorTool], "FollowColorTool [G]", "Selected stroke colors will track the ColorTool. Any mouse click terminates FollowColorTool"],
Choice[List [$LineColorWhite], "white [G]", "Make selected strokes have color white"],
Choice[List [$LineColorFromSelectedName], "FromSelectedName [GT]", "Make selected strokes have the color named in the Tioga selection (e.g. vivid green)"],
Choice[List [$SelectMatchingLineCNS], "MatchSelectedName [T]", "Select strokes whose color matches the name in the Tioga selection (e.g. vivid green)"],
Choice[List [$LineColorBlack], "black [G]", "Make selected strokes have color black"],
Choice[List [$LineColorFromSelectedRGB], "FromSelectedRGB [GT]", "Make selected strokes have the RGB specified in the Tioga selection (e.g. 0.5 0.9 0.67)"],
Choice[List [$SelectMatchingLineRGB], "MatchSelectedRGB [T]", "Select strokes whose color matches the RGB in the Tioga selection (e.g. 0.5 0.9 0.67)"],
Choice[List [$LineColorGray], "gray [G]", "Make selected strokes have color gray"],
Choice[List [$CopyStrokeColor], "Copy [G]", "Copy the stroke color from the last selected stroke to all other selected strokes"],
Choice[List [$ShowDefaultLineColor], "ShowDefault", "Print default stroke color"],
Choice[List [$SetDefaultLineColor], "MakeDefault [G]", "Set the default stroke color from the currently selected stroke"],
Choice[List [$StrokeColorFromSelectedCMYK], "FromSelectedCMYK", "Make selected strokes have the CMYK specified in the Tioga selection (e.g., 0.5 0.9 0.67 0.3)"],
Choice[List [$StrokeColorFromSelectedIntensity], "FromSelectedIntensity", "Make selected strokes gray (intensity specified in the Tioga selection (e.g., 0.3))"],
Choice[List [$StrokeHueFromColorTool], "HueFromColorTool", "Make selected strokes have the same hue (HSV) as the ColorTool color"]
],
-1, FALSE, popUpFont, popUpButtonDoc, disableDecoding]];
fillMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Fill Menu"]];
fillMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Fill", PUChoiceList [
Choice[List [$AreaColorFromColorTool], "FromColorTool [G]", "Make selected objects have the fill color in the ColorTool"],
Choice[List [$PrintAreaColor], "ShowFillColor [G]", "Print fill color of selected objects"],
Choice[List [$AreaColorToColorTool], "ToColorTool [G]", "Send the fill color of the selected objects to the ColorTool"],
Choice[List [$AreaColorNone], "none [G]", "Make selected objects have no fill color"],
Choice[List [$AreaColorFollowColorTool], "FollowColorTool [G]", "Selected fill colors will track the ColorTool. Any mouse click terminates FollowColorTool"],
Choice[List [$AreaColorWhite], "white [G]", "Make selected objects have fill color white"],
Choice[List [$AreaColorFromSelectedName], "FromSelectedName [GT]", "Make selected objects have the fill color named in the Tioga selection (e.g. vivid green)"],
Choice[List [$SelectMatchingAreaCNS], "MatchSelectedName [T]", "Select objects whose fill color matches the name in the Tioga selection (e.g. vivid green)"],
Choice[List [$AreaColorBlack], "black [G]", "Make selected objects have fill color black"],
Choice[List [$AreaColorFromSelectedRGB], "FromSelectedRGB [GT]", "Make selected objects have the fill RGB specified in the Tioga selection (e.g. 0.5 0.9 0.67)"],
Choice[List [$SelectMatchingAreaRGB], "MatchSelectedRGB [T]", "Select objects whose fill color matches the RGB in the Tioga selection (e.g. 0.5 0.9 0.67)"],
Choice[List [$AreaColorGray], "gray [G]", "Make selected objects have fill color gray"],
Choice[List [$CopyFillColor], "Copy [G]", "Copy the fill color from the last selected object to all other selected objects"],
Choice[List [$ShowDefaultFillColor], "ShowDefault", "Print default fill color"],
Choice[List [$SetDefaultFillColor], "MakeDefault [G]", "Set the default fill color from the currently selected object"],
Choice[List [$SetWash, $White], "WashToWhite", "Create a color wash from the selected fill color to white"],
Choice[List [$SetWash, $ColorTool], "WashToColorTool", "Create a color wash from the selected fill color to the ColorTool color"],
Choice[List [$SetWash, $Black], "WashToBlack", "Create a color wash from the selected fill color to black"],
Choice[List [$FillColorFromSelectedCMYK], "FromSelectedCMYK", "Make selected objects have the fill CMYK specified in the Tioga selection (e.g., 0.5 0.9 0.67 0.3)"],
Choice[List [$FillColorFromSelectedIntensity], "FromSelectedIntensity", "Make selected objects have a gray fill (intensity specified in the Tioga selection (e.g., 0.3))"],
Choice[List [$FillHueFromColorTool], "HueFromColorTool", "Make selected objects have the same hue (HSV) as the ColorTool color"]
],
-1, FALSE, popUpFont, fillMenuDoc, disableDecoding]];
editMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Edit Menu"]];
editMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Edit", PUChoiceList [
Choice[List [$AddControlPoint], "Add CP (^p)", "Add a control point to a curve at the caret"],
Choice[List [$DescribeCurve, $Selected], "DescribeSelected [G]", "Print a description of the selected object"],
Choice[List [$DeleteControlPoint], "Delete CP (^P) [G]", "Delete the selected control point"],
Choice[List [$AddHoles], "MakeHoles (^h) [G]", "Use the last selected closed trajectory as a fence and convert the remaining closed trajectories to holes in that fence"],
Choice[List [$Weld], "Weld (^w) [G]", "Weld one or two selected open trajectories together"],
Choice[List [$DeleteHoles], "UnMakeHoles (^H) [G]", "Replace fully selected composite outlines with simple outlines, one simple outline per element"],
Choice[List [$SetOddWrap], "SetOddWrap [G]", "Set all selected outlines to display themselves with odd fill rule"],
Choice[List [$ShowWrapRule], "ShowWrapRule", "Print value of wrap rule for selected object"],
Choice[List [$SetNonZeroWrap], "SetNonZeroWrap [G]", "Set all selected outlines to display themselves with non-zero fill rule"],
Choice[List [$OrientCW], "OrientCW [G]", "Orient all selected object clockwise"],
Choice[List [$ShowOrientation], "ShowOrientation [G]", "Print value of orientation for selected object"],
Choice[List [$OrientCCW], "OrientCCW [G]", "Orient all selected object counterclockwise"],
Choice[List [$AddJoint], "AddJoint (^j)", "Add a joint to a curve at the caret"],
Choice[List [$Reorient], "Reorient [G]", "Reverse orientation of all selected objects"],
Choice[List [$SetCombine, $ORs, $NoOp], "Combine [G]", "Create an object which is the union of selected objects (straight line segments only for now)"],
Choice[List [$ApplyAllDefaults], "ApplyAllDefaults [G]", "Apply current default looks to all selected objects"],
Choice[List [$ShowAllDefaults], "ShowAllDefaults", "Print values of current defaults (hint: look in typescript)"],
Choice[List [$StandardDefaults], "StandardDefaults", "Reset defaults to original values"],
Choice[List [$Delete], "Delete (DEL) [G]", "Delete selected objects"],
Choice[List [$HistoryTool], "HistoryTool", "Open or build a new history tool"],
noOpChoice
],
-1, FALSE, popUpFont, editMenuDoc, disableDecoding]];
selectMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Select Menu"]];
selectMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Select", PUChoiceList [
Choice[List [$CycleSelection, $Forward], "CycleSelection (^n)", "Select a different object near where the caret was when the last selection was made (cycling forward through the list)"],
Choice[List [$SelectAll], "Select All (^d)", "Select every object in the scene"],
Choice[List [$CycleSelection, $Backward], "UnCycleSelection (^N)", "Select a different object near where the caret was when the last selection was made (cycling backward through the list)"],
Choice[List [$MoveSelection, $Forward], "SelectForward (^u)", "Select the object immediately in front of the currently selected object"],
Choice[List [$DeselectAll], "Deselect All (^D)", "Deselect every object in the scene"],
Choice[List [$MoveSelection, $Backward], "SelectBackward (^o)", "Select the object immediately behind the currently selected object"],
Choice[List [$MoveSelection, $ShrinkForward], "ShrinkForward (^U)", "Select the front child of the currently selected parent"],
Choice[List [$MoveSelection, $Grow], "Grow (^i)", "Select the parent of the currently selected child"],
Choice[List [$MoveSelection, $ShrinkBackward], "ShrinkBackward (^O)", "Select the back child of the currently selected parent"],
Choice[List [$SelectCoincident], "Coincident", "Select every segment with coincident end points"],
Choice[List [$SelectUnseeableSegs], "UnSeeableSegs", "Select every segment that can never be seen"],
Choice[List [$SelectUnseeableObjs], "UnSeeableObj", "Select most complete objects that can never be seen"]
],
-1, FALSE, popUpFont, selectMenuDoc, disableDecoding]];
hotSpotsMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["HotSpots Menu"]];
hotSpotsMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["HotSpots", PUChoiceList [
Choice[List [$MakeHot], "MakeHot (^s) [G]", "Make all selected objects hot"],
noOpChoice,
Choice[List [$MakeCold], "MakeCold (^S) [G]", "Make all selected objects cold"],
Choice[List [$DropAnchor], "DropAnchor (^a)", "Drop anchor at caret"],
noOpChoice,
Choice[List [$LiftAnchor], "LiftAnchor (^A)", "Remove anchor"],
Choice[List [$MakeAllHot], "MakeAllHot (^ss)", "Make all objects hot"],
noOpChoice,
Choice[List [$MakeAllCold], "MakeAllCold (^SS)", "Make all objects cold"],
Choice[List [$StandardAlignments], "StandardAlignments", "Restore standard alignments"]
],
-1, FALSE, popUpFont, hotSpotsMenuDoc, disableDecoding]];
pointsPerIn: REAL = 72.0;
pointsPerCm: REAL = 72.0/2.54;
unitsMenuDoc: PopUpButtons.Help ← PopUpButtons.HelpFromDoc[doc, LIST["Units Menu"]];
unitsMenu: AtomButtons.ButtonLineEntry ←
[popUpButton["Units", PUChoiceList [
[LIST[$SetScaleUnit, NEW[REAL ← pointsPerIn], $Noisy], "Inches", "Set unit value to 1 inch"],
[LIST[$PrintScaleUnit], "ShowValue", "Print current unit value"],
[LIST[$SetScaleUnit, NEW[REAL ← 1.0], $Noisy], "Points", "Set unit value to 1 point"],
[LIST[$RadiusUnitFromSegment], "FromSegment [G]", "Set unit value to length of selected segment"],
[LIST[$RadiusUnitFromValue], "FromRadiusValue", "Set unit value from number in RadiusValue"],
[LIST[$RadiusUnitFromSelection], "FromSelection [T]", "Set unit value from number in the Tioga selection"],
[LIST[$SetScaleUnit, NEW[REAL ← pointsPerCm], $Noisy], "Centimeters", "Set unit value to 1 centimeter"]
],
-1, FALSE, popUpFont, unitsMenuDoc, disableDecoding]];
nextX: INTEGER ← AtomButtons.BuildButtonLine[ggData.controls.panel, 0, ggData.height, ggData, GGUserInput.EventNotify, LIST[
strokeMenu, colorMenu, fillMenu, editMenu, selectMenu, hotSpotsMenu, unitsMenu
]];
ggData.controls.screenStyle ← AtomButtons.BuildEnumTypeSelection[viewer: ggData.controls.panel, x: nextX + entryHSpace, y: ggData.height, maxWidth: 144, clientData: ggData, handleProc: GGUserInput.EventNotify, title: "ScreenStyle:", default: "SpecifiedFonts", borderOnButtons: TRUE, style: flipThru, allInOneRow: TRUE, buttonNames: LIST["SpecifiedFonts", "AlternateFonts", "WYSIWYG"], atom: $ScreenChoiceChange];
nextX ← AtomButtons.BuildButtonLine[ggData.controls.panel, ggData.controls.screenStyle.nextx + entryHSpace, ggData.height, ggData, GGUserInput.EventNotify, LIST[
[twoState["Buffer", LIST[$ToggleBuffer], TRUE, BufferInGGData]]
]];
ggData.height ← ggData.height + entryHeight + entryVSpace;
};
ShowColorsInGGData: AtomButtonsTypes.InitTwoStateProc = {
ggData: GGData ← NARROW[clientData];
ggData.refresh.showColors ← twoState;
};
BufferInGGData: AtomButtons.InitTwoStateProc = {
PROC [name: Rope.ROPE, clientData: REF ANY, twoState: TwoState];
ggData: GGData ← NARROW[clientData];
ggData.controls.bufferButton ← twoState;
};
ConfirmClear: PROC [clientData: REF ANY] = {
ggData: GGData ← NARROW[clientData];
Feedback.Append[ggData.router, oneLiner, $Confirm, "Confirm deletion of all objects"];
};
ConfirmReset: PROC [clientData: REF ANY] = {
ggData: GGData ← NARROW[clientData];
filename: Rope.ROPE ← GGState.GetFullName[ggData];
IF Rope.Equal[filename, NIL] THEN Feedback.Append[ggData.router, oneLiner, $Complaint, "Restore failed: no file loaded. Do not confirm."]
ELSE Feedback.Append[ggData.router, oneLiner, $Confirm, "Confirm restore to original file"];
};
ConfirmGet: PROC [clientData: REF ANY] = {
-- This proc is a mess but can't be easily sanitized
fullName: Rope.ROPE;
success: BOOL ← FALSE;
ggData: GGData ← NARROW[clientData];
filename: Rope.ROPE ← ViewerTools.GetSelectionContents[];
IF Rope.Equal[filename, NIL] THEN Feedback.Append[ggData.router, oneLiner, $Complaint, "Get failed: no filename specified. Do not confirm."]
ELSE {
[fullName, success, ----] ← GGFileOps.GetGargoyleFileName["Get", filename, ggData.currentWDir, ggData.router, FALSE];
IF NOT success THEN Feedback.Append[ggData.router, oneLiner, $Complaint, "Get failed: bad filename specified. Do not confirm."]
ELSE Feedback.PutF[ggData.router, oneLiner, $Confirm, "Confirm Get of %g as a new scene", [rope[fullName]] ];
};
};
ConfirmStore: PROC [clientData: REF ANY] = {
-- This proc is a mess but can't be easily sanitized
fullName: Rope.ROPE;
success: BOOL ← FALSE;
ggData: GGData ← NARROW[clientData];
filename: Rope.ROPE ← ViewerTools.GetSelectionContents[];
IF Rope.Equal[filename, NIL] THEN Feedback.Append[ggData.router, oneLiner, $Complaint, "Store failed: no filename specified. Do not confirm."]
ELSE {
[fullName, success, ----] ← GGFileOps.GetGargoyleFileName["Store", filename, ggData.currentWDir, ggData.router, FALSE];
IF NOT success THEN Feedback.Append[ggData.router, oneLiner, $Complaint, "Store failed: bad filename specified. Do not confirm."]
ELSE Feedback.PutF[ggData.router, oneLiner, $Confirm, "Confirm Store to %g [%g File]", [rope[fullName]], [rope[IF FileExists[fullName] THEN "Old" ELSE "New"]] ];
};
};
FileExists:
PROC [fileName: Rope.
ROPE]
RETURNS [answer:
BOOL ←
TRUE] = {
[] ←
FS.FileInfo[fileName !
FS.Error =>
IF error.code=$unknownFile
THEN { answer ←
FALSE;
CONTINUE };
DKW: if some other error.code, reject is probably better than unnamed ERROR
];
};
ReviveButton: Menus.ClickProc = {
ggData: GGData ← NARROW[clientData];
scene: SceneRef ← NARROW[ggData.scene];
GGMouseEvent.ResetMouseMachinery[ggData];
CodeTimer.ResetTable[CodeTimer.GetTable[$Gargoyle]];
SlackProcess.Restart[ggData.slackHandle];
ggData.camera.quality ← fast;
ggData.refresh.suppressRefresh ← FALSE;
ggData.refresh.suppressScreen ← FALSE;
ggData.refresh.areaFollowColorTool ← ggData.refresh.lineFollowColorTool ← FALSE;
scene.ptrValid ← scene.prioritiesValid ← FALSE;
ggData.aborted ← ALL[FALSE];
GGHistory.KillAdvanceCapture[ggData];
IF mouseButton#blue THEN GGWindow.RestoreScreenAndInvariants[paintAction: $PaintEntireScene, ggData: ggData, remake: triggerBag, edited: FALSE, okToSkipCapture: TRUE]
};
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]];
};
popUpFont: ImagerFont.Font; -- initialized in Init below;
Init: PROC = {
popUpFont ← ImagerFont.Find["xerox/tiogafonts/helvetica10I"];
};
Init[];
END.