DIRECTORY Buttons USING [ButtonProc, Create], Containers USING [ChildXBound, ChildYBound, Create], Convert USING [RopeFromInt, RopeFromReal], ChoiceButtons USING [BuildEnumTypeSelection, SelectionNotifierProc], Graph USING [ControlAction, Controller, Entity, GraphHandle, GraphProc, ROPE, Viewer], GraphConvert USING [AngleFromRope, JustifXFromRope, JustifYFromRope, MarkFromRope, OperandFromRope, RopeOfSlope], GraphPrivate USING [CallWithLock, GraphAtomProc, GraphPlaceProc, LockedAtomProc, Operate, SpecRemove, ResumeFromPanel, Update, UserEditAllowed], GraphUtil USING [ControllerViewerExits, GetIntField, HandleNotNil, RaiseError, SetIntField, SetToggleColor], Imager USING [Font], Labels USING [Create, Set], PopUpMenu USING [RequestSelection], Rules USING [Create], VFonts USING [EstablishFont], ViewerOps USING [AddProp, FetchProp], ViewerTools USING [MakeNewTextViewer, SetContents, SetSelection]; GraphPanel: CEDAR PROGRAM IMPORTS Buttons, ChoiceButtons, Containers, Convert, GraphConvert, GraphPrivate, GraphUtil, Labels, PopUpMenu, Rules, VFonts, ViewerOps, ViewerTools EXPORTS GraphPrivate = { OPEN Graph, GraphPrivate, GraphUtil; entryHeight: CARDINAL = 14; twiceEntryHeight: CARDINAL = 24; entryVSpace: CARDINAL = 6; entryHSpace: CARDINAL = 2; level1X: CARDINAL = 70; level2X: CARDINAL = 20; boldFont: Imager.Font _ VFonts.EstablishFont[family: "TimesRoman", size: 10, bold: TRUE]; mathFont: Imager.Font _ VFonts.EstablishFont[family: "Math", size: 10, bold: FALSE]; FlipToggle: PUBLIC GraphAtomProc = { IF HandleNotNil[handle] THEN { OPEN handle.controller; SELECT atom FROM $AutoDiv => auto[divisions] _ SetToggleColor[swDivisions, ~auto[divisions]]; $AutoBounds => auto[bounds] _ SetToggleColor[swBounds, ~auto[bounds]]; $Primary => caretOn[primary] _ SetToggleColor[swCaret[primary], ~caretOn[primary]]; $Secondary => caretOn[secondary] _ SetToggleColor[swCaret[secondary], ~caretOn[secondary]]; $Slope => slopeOn _ SetToggleColor[swSlope, ~slopeOn]; $TextCaret => caretOn[text] _ SetToggleColor[swCaret[text], ~caretOn[text]]; $TargetXOn => targetOn[x] _ SetToggleColor[swTarget[x], ~targetOn[x]]; $TargetYOn => targetOn[y] _ SetToggleColor[swTarget[y], ~targetOn[y]]; $GridX => gridOn[x] _ SetToggleColor[swGrid[x], ~gridOn[x]]; $GridY => gridOn[y] _ SetToggleColor[swGrid[y], ~gridOn[y]]; $Bold => boldOn _ SetToggleColor[swBold, boldOn]; $Italic => italicOn _ SetToggleColor[swItalic, ~italicOn]; ENDCASE => RaiseError[$UnknownAtom]; }; }; -- FlipToggle MakeSpec: PUBLIC GraphPlaceProc = { OPEN handle; SpecEntry: PROC[name: ROPE, atom: ATOM, autoX: BOOL _ TRUE, x: INTEGER _ 0] = { prev _ Buttons.Create[ info: [ name: name, parent: spec, wx: IF autoX THEN 0 ELSE x, wy: lastHeight, wh: entryHeight, -- default the width so that it will be computed for us border: FALSE ], clientData: atom, font: boldFont, proc: SpecEntryProc, paint: FALSE]; ViewerOps.AddProp[prev, atom, handle]; }; -- SpecEntry Toggle: PROC[name: ROPE, atom: ATOM, on, autoX: BOOL _ TRUE, x: INTEGER _ level1X] RETURNS [viewer: Viewer, bool: BOOL] = { prev _ Buttons.Create[ info: [ name: name, parent: spec, wx: IF autoX THEN NextX[prev] ELSE x, wy: lastHeight, wh: entryHeight, border: TRUE ], clientData: atom, proc: ToggleProc, paint: FALSE]; ViewerOps.AddProp[prev, atom, handle]; RETURN[prev, SetToggleColor[prev, on, FALSE]] }; -- Toggle prev, spec: Viewer; lastHeight: INTEGER _ entryVSpace; spec _ controller.spec _ Containers.Create[ info: [ wx: sx, wy: sy, ww: , wh: 400, border: FALSE, scrollable: TRUE, parent: controller.viewer ], paint: FALSE ]; Containers.ChildXBound[controller.viewer, spec]; Containers.ChildYBound[controller.viewer, spec]; SpecEntry["Divisions:", $Divisions]; [controller.swDivisions, controller.auto[divisions]] _ Toggle[ "Auto", $AutoDiv, graph.auto[divisions], FALSE, level1X]; controller.divX _ prev _ IntField[prev, spec, lastHeight, "x:", Convert.RopeFromInt[graph.division[x]], 60]; controller.divY _ prev _ IntField[prev, spec, lastHeight, "y:", Convert.RopeFromInt[graph.division[y]], 60]; lastHeight _ lastHeight + entryHeight; SpecEntry["Bounds:", $Bounds]; [controller.swBounds, controller.auto[bounds]] _ Toggle[ "Auto", $AutoBounds, graph.auto[bounds], FALSE, level1X]; controller.xmin _ prev _ Field[prev, spec, lastHeight, "xmin:", Convert.RopeFromReal[graph.bounds.xmin], 50]; controller.xmax _ prev _ Field[prev, spec, lastHeight, "xmax:", Convert.RopeFromReal[graph.bounds.xmax], 50]; controller.ymin _ prev _ Field[prev, spec, lastHeight, "ymin:", Convert.RopeFromReal[graph.bounds.ymin], 50]; controller.ymax _ prev _ Field[prev, spec, lastHeight, "ymax:", Convert.RopeFromReal[graph.bounds.ymax], 50]; lastHeight _ lastHeight + entryHeight; SpecEntry["Carets:", $Carets]; [controller.swCaret[primary], controller.caretOn[primary]] _ Toggle[ "primary", $Primary, graph.caret[primary].on, FALSE, level1X]; controller.caretPlace[primary][x] _ prev _ Field[prev, spec, lastHeight, "x:", Convert.RopeFromReal[graph.caret[primary].place.x], 40]; controller.caretPlace[primary][y] _ prev _ Field[prev, spec, lastHeight, "y:", Convert.RopeFromReal[graph.caret[primary].place.y], 40]; [controller.swCaret[secondary], controller.caretOn[secondary]] _ Toggle["secondary", $Secondary, graph.caret[secondary].on]; controller.caretPlace[secondary][x] _ prev _ Field[prev, spec, lastHeight, "x:", Convert.RopeFromReal[graph.caret[secondary].place.x], 40]; controller.caretPlace[secondary][y] _ prev _ Field[prev, spec, lastHeight, "y:", Convert.RopeFromReal[graph.caret[secondary].place.y], 40]; lastHeight _ lastHeight + entryHeight; [controller.swSlope, controller.slopeOn] _ Toggle[ "slope", $Slope, graph.showSlope, FALSE, level1X]; prev _ Label[prev, spec, lastHeight, "between crosshairs ="]; controller.slope _ prev _ Label[prev: prev, parent: spec, lastHeight: lastHeight, name: IF graph.showSlope THEN GraphConvert.RopeOfSlope[ graph.caret[primary].place, graph.caret[secondary].place] ELSE NIL, width: 120]; lastHeight _ lastHeight + entryHeight; [controller.swCaret[text], controller.caretOn[text]] _ Toggle["text caret", $TextCaret, graph.caret[text].on, FALSE, level1X]; controller.caretPlace[text][x] _ prev _ Field[prev, spec, lastHeight, "x:", Convert.RopeFromReal[graph.caret[text].place.x], 40]; controller.caretPlace[text][y] _ prev _ Field[prev, spec, lastHeight, "y:", Convert.RopeFromReal[graph.caret[text].place.y], 40]; lastHeight _ lastHeight + entryHeight; SpecEntry["Targets:", $Targets]; [controller.swTarget[x], controller.targetOn[x]] _ Toggle["x", $TargetXOn, graph.target[x].on, FALSE, level1X]; controller.targetWidth[x] _ prev _ Field[prev, spec, lastHeight, "width:", Convert.RopeFromReal[graph.target[x].width], 40]; controller.targetColor[x] _ prev _ Field[prev, spec, lastHeight, "color:", Convert.RopeFromInt[graph.target[x].colorIndex], 40]; controller.targetValue[x] _ prev _ Field[prev, spec, lastHeight, "value:", Convert.RopeFromReal[graph.target[x].value], 200]; lastHeight _ lastHeight + entryHeight; [controller.swTarget[y], controller.targetOn[y]] _ Toggle[ "y", $TargetYOn, graph.target[y].on, FALSE, level1X]; controller.targetWidth[y] _ prev _ Field[prev, spec, lastHeight, "width:", Convert.RopeFromReal[graph.target[y].width], 40]; controller.targetColor[y] _ prev _ Field[prev, spec, lastHeight, "color:", Convert.RopeFromInt[graph.target[y].colorIndex], 40]; controller.targetValue[y] _ prev _ Field[prev, spec, lastHeight, "value:", Convert.RopeFromReal[graph.target[y].value], 200]; lastHeight _ lastHeight + entryHeight; SpecEntry["Grids:", $Grids]; [controller.swGrid[x], controller.gridOn[x]] _ Toggle[ "x", $GridX, graph.grids[x], FALSE, level1X]; [controller.swGrid[y], controller.gridOn[y]] _ Toggle[ "y", $GridY, graph.grids[y]]; lastHeight _ lastHeight + entryHeight; SpecEntry["Color(", $Color]; controller.colorIndex _ prev _ IntField[prev, spec, lastHeight, "index:", "0", 40]; prev _ Label[prev: prev, parent: spec, lastHeight: lastHeight, name: "):", font: boldFont]; lastHeight _ lastHeight + entryHeight; controller.red _ prev _ Field[prev, spec, lastHeight, "red:", Convert.RopeFromReal[graph.color[0].R], 40, FALSE, level2X]; controller.green _ prev _ Field[prev, spec, lastHeight, "green:", Convert.RopeFromReal[graph.color[0].G], 40]; controller.blue _ prev _ Field[prev, spec, lastHeight, "blue:", Convert.RopeFromReal[graph.color[0].B], 40]; lastHeight _ lastHeight + entryHeight; SpecEntry["Font(", $Font]; controller.fontIndex _ prev _ IntField[prev, spec, lastHeight, "index:", "0", 40]; prev _ Label[prev: prev, parent: spec, lastHeight: lastHeight, name: "):", font: boldFont]; lastHeight _ lastHeight + entryHeight; controller.fontFamily _ prev _ Field[prev, spec, lastHeight, "family:", graph.font[0].family, 100, FALSE, level2X]; [controller.swBold, controller.boldOn] _ Toggle[ "bold", $Bold, graph.font[0].bold]; [controller.swItalic, controller.italicOn] _ Toggle[ "italic", $Italic, graph.font[0].italic]; controller.vFontSize _ prev _ IntField[prev, spec, lastHeight, "screen size:", Convert.RopeFromInt[graph.font[0].vFontSize], 40]; controller.pFontScale _ prev _ Field[prev, spec, lastHeight, "print scale:", Convert.RopeFromReal[graph.font[0].pFontScale], 100]; lastHeight _ lastHeight + entryHeight; SpecEntry["Text(", $Text]; controller.textId _ prev _ IntField[prev, spec, lastHeight, "id:", NIL, 70]; prev _ Label[prev: prev, parent: spec, lastHeight: lastHeight, name: "):", font: boldFont]; lastHeight _ lastHeight + entryHeight; controller.textContent _ prev _ Field[prev, spec, lastHeight, "name:", NIL, 2000, FALSE, level2X]; Containers.ChildXBound[spec, controller.textContent]; lastHeight _ lastHeight + entryHeight; controller.textPlaceX _ prev _ Field[prev, spec, lastHeight, "place x:", NIL, 60, FALSE, level2X]; controller.justifXRef _ ChoiceButtons.BuildEnumTypeSelection[ viewer: spec, x: NextX[prev], y: lastHeight, title: "", buttonNames: LIST["left", "center", "right"], default: "center", notifyClientProc: JustifXNotify, clientdata: handle, style: menuSelection]; controller.textPlaceY _ prev _ Field[prev, spec, lastHeight, "y:", NIL, 60, FALSE, controller.justifXRef.nextx + 10]; controller.justifYRef _ ChoiceButtons.BuildEnumTypeSelection[ viewer: spec, x: NextX[prev], y: lastHeight, title: "", buttonNames: LIST["top", "center", "bottom"], default: "bottom", notifyClientProc: JustifYNotify, clientdata: handle, style: menuSelection]; lastHeight _ lastHeight + entryHeight; controller.textColor _ prev _ IntField[prev, spec, lastHeight, "color:", NIL, 40, FALSE, level2X]; controller.textFont _ prev _ IntField[prev, spec, lastHeight, "font:", NIL, 40]; controller.textRotation _ prev _ Field[prev, spec, lastHeight, "rotation:", NIL, 60]; lastHeight _ lastHeight + entryHeight; SpecEntry["Curve(", $Entity]; controller.entityId _ prev _ IntField[prev, spec, lastHeight, "id:", NIL, 100]; prev _ Label[prev: prev, parent: spec, lastHeight: lastHeight, name: "):", font: boldFont]; lastHeight _ lastHeight + entryHeight; controller.entityName _ prev _ Field[prev, spec, lastHeight, "name:", NIL, 1000, FALSE, level2X]; Containers.ChildXBound[spec, controller.entityName]; lastHeight _ lastHeight + entryHeight; controller.entityCmt _ prev _ Field[prev, spec, lastHeight, "comment:", NIL, 1000, FALSE, level2X]; Containers.ChildXBound[spec, controller.entityCmt]; lastHeight _ lastHeight + entryHeight; controller.entityColor _ prev _ IntField[prev, spec, lastHeight, "color:", NIL, 40, FALSE, level2X]; controller.entityWidth _ prev _ Field[prev, spec, lastHeight, "width:", NIL, 100]; controller.markRef _ ChoiceButtons.BuildEnumTypeSelection[ viewer: spec, x: NextX[prev], y: lastHeight, title: "mark:", buttonNames: LIST["none", "round", "square", "diamond", "cross", "dollar", "percent"], default: "none", notifyClientProc: MarkNotify, clientdata: handle, borderOnButtons: FALSE, style: flipThru]; }; -- MakeSpec MakeRule: PUBLIC GraphPlaceProc = { OPEN handle; controller.rule _ Rules.Create[ info: [parent: controller.viewer, wx: sx, wy: sy, ww: 1000, wh: 1], paint: FALSE]; Containers.ChildXBound[controller.viewer, controller.rule]; }; -- MakeRule MakeXYValues: PUBLIC GraphPlaceProc = { OPEN handle; OpButton: PROC[name: ROPE, atom: ATOM, autoX: BOOL _ TRUE, x: INTEGER _ 0, font: Imager.Font _ boldFont] = { prev _ Buttons.Create[ info: [ name: name, parent: xys, wx: IF autoX THEN NextX[prev] ELSE x, wy: lastHeight, wh: entryHeight, -- default the width so that it will be computed for us border: FALSE ], clientData: atom, proc: OperationProc, font: font, paint: FALSE]; ViewerOps.AddProp[prev, atom, handle]; }; -- OpButton ValuesEntry: PROC[name: ROPE, proc: Buttons.ButtonProc _ NIL] = { prev _ Buttons.Create[ info: [ name: name, parent: xys, wx: NextX[prev], wy: lastHeight, wh: entryHeight, -- default the width so that it will be computed for us border: FALSE ], clientData: handle, font: boldFont, proc: proc, paint: FALSE]; }; -- ValuesEntry prev, xys: Viewer _ NIL; lastHeight: INTEGER _ entryVSpace; xys _ controller.xys _ Containers.Create[ info: [ wx: sx, wy: sy, ww: 1000, wh: 1000, border: FALSE, scrollable: FALSE, parent: controller.viewer ], paint: FALSE ]; Containers.ChildXBound[controller.viewer, xys]; Containers.ChildYBound[controller.viewer, xys]; prev _ Label[prev, xys, lastHeight, "Math operations", 0, FALSE, 0]; controller.operandRef _ ChoiceButtons.BuildEnumTypeSelection[ viewer: xys, x: NextX[prev], y: lastHeight, title: "operand:", buttonNames: LIST["selected y", "plotted y's", "x"], default: "selected y", notifyClientProc: OperandNotify, clientdata: handle, style: menuSelection]; OpButton["Resume", $Original, FALSE, controller.operandRef.nextx + 20]; lastHeight _ lastHeight + entryHeight; OpButton[name: "+", atom: $Sign, autoX: FALSE, x: 0, font: mathFont]; OpButton["abs", $Abs]; OpButton["1/r", $Reciprocal]; OpButton["e", $Exponential]; OpButton["ln", $NaturalLog]; OpButton["db", $DB]; OpButton["sqrt", $SqRt]; OpButton["sin", $Sine]; OpButton["cos", $Cosine]; OpButton["tan", $Tangent]; OpButton["atan", $ArcTan]; controller.angleRef _ ChoiceButtons.BuildEnumTypeSelection[ viewer: xys, x: 300, y: lastHeight, title: "angle:", buttonNames: LIST["degrees", "radians"], default: "radians", notifyClientProc: AngleNotify, clientdata: handle, style: menuSelection]; lastHeight _ lastHeight + entryHeight; OpButton["+", $Plus, FALSE, 0]; OpButton["-", $Minus]; OpButton[name: "X", atom: $Multiply, font: mathFont]; OpButton[name: "%", atom: $Divide, font: mathFont]; OpButton["log", $Logarithm]; OpButton["root", $Root]; OpButton["power", $Power]; controller.argument _ prev _ Field[prev, xys, lastHeight, "argument:", NIL, 50, FALSE, 300]; lastHeight _ lastHeight + entryHeight + entryVSpace; prev _ Rules.Create[info: [parent: xys, wy: lastHeight, ww: 0, wh: 1], paint: FALSE]; Containers.ChildXBound[xys, prev]; lastHeight _ lastHeight + entryVSpace; prev _ Label[prev, xys, lastHeight, "Values of", 0, FALSE, entryHSpace]; controller.xyLabel _ prev _ Labels.Create[ info: [name: NIL, parent: xys, border: TRUE, wx: NextX[prev], wy: lastHeight, ww: 17, wh: entryHeight], font: mathFont, paint: FALSE]; ValuesEntry["curve(", XYEntryProc]; controller.idOfy _ prev _ IntField[prev, xys, lastHeight, "id:", NIL, 90]; prev _ Label[prev: prev, parent: xys, lastHeight: lastHeight, name: ") ", font: boldFont]; controller.xsecLabel _ prev _ Labels.Create[ info: [name: NIL, parent: xys, border: TRUE, wx: NextX[prev], wy: lastHeight, ww: 17, wh: entryHeight], font: mathFont, paint: FALSE]; ValuesEntry["Cross-section(", XsecEntryProc]; controller.xat _ prev _ Field[prev, xys, lastHeight, "at x =", NIL, 90]; prev _ Label[prev: prev, parent: xys, lastHeight: lastHeight, name: ")", font: boldFont]; lastHeight _ lastHeight + entryHeight + entryVSpace; controller.values _ ViewerTools.MakeNewTextViewer[ info: [ parent: xys, wx: 0, wy: lastHeight, ww: 1000, wh: 1000, data: NIL, scrollable: TRUE, border: FALSE], paint: FALSE]; Containers.ChildXBound[xys, controller.values]; Containers.ChildYBound[xys, controller.values]; }; -- MakeXYValues NextX: PROC[prev: Viewer] RETURNS [INTEGER] = { RETURN[IF prev = NIL THEN 0 ELSE prev.wx + prev.ww + entryHSpace]}; SpecEntryProc: Buttons.ButtonProc -- PROC [parent: REF ANY, clientData: REF ANY _ NIL, mouseButton: MouseButton _ red, shift, control: BOOL _ FALSE] -- = { atom: ATOM _ NARROW[clientData]; handle: GraphHandle _ NARROW[ViewerOps.FetchProp[NARROW[parent], atom]]; IF HandleNotNil[handle] THEN { action: ControlAction _ noop; SELECT atom FROM $Divisions, $Bounds, $Carets, $Targets, $Grids, $Color, $Font => { IF NOT shift THEN SELECT mouseButton FROM red => action _ IF control THEN update ELSE resume; yellow => IF NOT control THEN SELECT PopUpMenu.RequestSelection[ "Options", LIST["Show", "Apply"], 1] FROM 1 => action _ resume; 2 => action _ update; ENDCASE; ENDCASE; }; $Text => { IF NOT shift THEN SELECT mouseButton FROM red => action _ IF control THEN update ELSE resume; yellow => IF NOT control THEN SELECT PopUpMenu.RequestSelection["Options", LIST["Show", "Apply", "Remove"], 1] FROM 1 => action _ resume; 2 => action _ update; 3 => action _ remove; ENDCASE; blue => IF NOT control THEN action _ remove; ENDCASE; }; $Entity => { SELECT mouseButton FROM red => { IF control THEN { action _ update; IF shift THEN atom _ $EntityAndValues; } ELSE action _ resume; }; yellow => IF NOT control THEN SELECT PopUpMenu.RequestSelection["Options", LIST["Show", "Set spec", "Set spec and values", "Remove"], 1] FROM 1 => action _ resume; 2 => action _ update; 3 => {action _ update; atom _ $EntityAndValues}; 4 => action _ remove; ENDCASE; blue => IF NOT control THEN action _ remove; ENDCASE; }; ENDCASE; IF NOT UserEditAllowed[handle] THEN IF (atom = $Entity OR atom = $EntityAndValues) AND action # resume THEN RETURN; SELECT action FROM resume => LockedAtomProc[handle, atom, ResumeFromPanel]; update => LockedAtomProc[handle, atom, Update]; remove => LockedAtomProc[handle, atom, SpecRemove]; noop => NULL; ENDCASE => RaiseError[$UnknowAction]; }; }; -- SpecEntryProc ToggleProc: Buttons.ButtonProc = { atom: ATOM _ NARROW[clientData]; handle: GraphHandle _ NARROW[ViewerOps.FetchProp[NARROW[parent], atom]]; LockedAtomProc[handle, atom, FlipToggle]; }; -- ToggleProc SetEntryPointer: PROC [handle: GraphHandle, v: Viewer] = { OPEN handle.controller; -- make sure handle and controller not nil before calling. Labels.Set[xyLabel, IF v = xyLabel THEN ")" ELSE NIL]; Labels.Set[xsecLabel, IF v = xsecLabel THEN ")" ELSE NIL]; }; -- SetEntryPointer XYEntryProc: Buttons.ButtonProc -- PROC [parent: REF ANY, clientData: REF ANY _ NIL, mouseButton: MouseButton _ red, shift, control: BOOL _ FALSE] -- = { handle: GraphHandle _ NARROW[clientData]; IF ControllerViewerExits[handle] AND NOT shift THEN { OPEN handle.controller; action: ControlAction _ noop; atom: ATOM _ $XYValues; SetEntryPointer[handle, xyLabel]; SELECT mouseButton FROM red => { IF control THEN { action _ update; } ELSE action _ resume; }; yellow => IF NOT control THEN { SELECT PopUpMenu.RequestSelection[ "Options", LIST["Show x and y values", "Set x and/or y values"], 1] FROM 1 => action _ resume; 2 => action _ update; ENDCASE => action _ noop; }; ENDCASE; IF NOT UserEditAllowed[handle] THEN IF action = update THEN RETURN; SELECT action FROM resume => LockedAtomProc[handle, atom, ResumeFromPanel]; update => LockedAtomProc[handle, atom, Update]; noop => NULL; ENDCASE => RaiseError[$UnknowAction]; }; }; -- XYEntryProc XsecEntryProc: Buttons.ButtonProc -- PROC [parent: REF ANY, clientData: REF ANY _ NIL, mouseButton: MouseButton _ red, shift, control: BOOL _ FALSE] -- = { handle: GraphHandle _ NARROW[clientData]; IF ControllerViewerExits[handle] AND NOT shift THEN { OPEN handle.controller; action: ControlAction _ noop; SetEntryPointer[handle, xsecLabel]; SELECT mouseButton FROM red => IF NOT control THEN action _ resume; yellow => IF NOT control THEN SELECT PopUpMenu.RequestSelection[ "Option", LIST["Show values for plotted curves at specified x"], 1] FROM 1 => action _ resume; ENDCASE => action _ noop; ENDCASE; SELECT action FROM resume => LockedAtomProc[handle, $Xsection, ResumeFromPanel]; ENDCASE; }; }; -- XsecEntryProc IntField: PROC [prev, parent: Viewer, lastHeight: INTEGER, label, contents: ROPE _ NIL, width: INTEGER _ 0, autoX: BOOL _ TRUE, x: INTEGER _ level1X, height: INTEGER _ entryHeight, scrollable: BOOL _ FALSE] RETURNS [viewer: Viewer] = { RETURN[Field[prev, parent, lastHeight, label, contents, width, autoX, x, height, scrollable, IntFieldPrompt]]; }; IntFieldPrompt: Buttons.ButtonProc = { contentsViewer: Viewer _ NARROW[ViewerOps.FetchProp[NARROW[parent], $Contents]]; IF shift THEN { msg: ROPE; old: INT; [msg, old] _ GetIntField[contentsViewer]; IF msg = NIL THEN { SELECT mouseButton FROM red => SetIntField[contentsViewer, old + 1]; blue => SetIntField[contentsViewer, old - 1]; ENDCASE => ViewerTools.SetSelection[contentsViewer]; }; } ELSE { SELECT mouseButton FROM blue => ViewerTools.SetContents[contentsViewer, NIL]; ENDCASE; ViewerTools.SetSelection[contentsViewer]; }; }; -- IntFieldPrompt Field: PROC [prev, parent: Viewer, lastHeight: INTEGER, label, contents: ROPE _ NIL, width: INTEGER _ 0, autoX: BOOL _ TRUE, x: INTEGER _ level1X, height: INTEGER _ entryHeight, scrollable: BOOL _ FALSE, prompt: Buttons.ButtonProc _ FieldPrompt] RETURNS [Viewer] = { labelViewer: Viewer _ prev _ Buttons.Create[ info: [ name: label, parent: parent, wx: IF autoX THEN NextX[prev] ELSE x, wy: lastHeight, wh: entryHeight, border: FALSE ], clientData: NIL, proc: prompt, paint: FALSE]; prev _ ViewerTools.MakeNewTextViewer[ info: [ parent: parent, wx: NextX[prev], wy: lastHeight, ww: width, wh: height, data: contents, scrollable: scrollable, border: FALSE], paint: FALSE]; ViewerOps.AddProp[labelViewer, $Contents, prev]; ViewerOps.AddProp[prev, $Label, label]; RETURN[prev]; }; -- Field FieldPrompt: Buttons.ButtonProc = { contentsViewer: Viewer _ NARROW[ViewerOps.FetchProp[NARROW[parent], $Contents]]; IF mouseButton = blue THEN ViewerTools.SetContents[contentsViewer, NIL]; ViewerTools.SetSelection[contentsViewer]; }; -- FieldPrompt Label: PROC[prev, parent: Viewer, lastHeight: INTEGER, name: ROPE _ NIL, width: INTEGER _ 0, autoX: BOOL _ TRUE, x: INTEGER _ 0, font: Imager.Font _ NIL] RETURNS [Viewer] = { prev _ Labels.Create[ info: [ name: name, parent: parent, wx: IF autoX THEN NextX[prev] ELSE x, wy: lastHeight, ww: width, wh: entryHeight, border: FALSE ], font: font, paint: FALSE]; RETURN[prev]; }; -- Label OperationProc: Buttons.ButtonProc = { atom: ATOM _ NARROW[clientData]; handle: GraphHandle _ NARROW[ViewerOps.FetchProp[NARROW[parent], atom]]; IF UserEditAllowed[handle] THEN LockedAtomProc[handle, atom, Operate]; }; -- OperationProc JustifXNotify: ChoiceButtons.SelectionNotifierProc = { handle: GraphHandle _ NARROW[clientdata]; IF HandleNotNil[handle] THEN { proc: GraphProc = { handle.controller.justifX _ GraphConvert.JustifXFromRope[name]; }; CallWithLock[handle, proc]; }; }; -- JustifXNotify JustifYNotify: ChoiceButtons.SelectionNotifierProc = { handle: GraphHandle _ NARROW[clientdata]; IF HandleNotNil[handle] THEN { proc: GraphProc = { handle.controller.justifY _ GraphConvert.JustifYFromRope[name]; }; CallWithLock[handle, proc]; }; }; -- JustifYNotify MarkNotify: ChoiceButtons.SelectionNotifierProc = { handle: GraphHandle _ NARROW[clientdata]; IF HandleNotNil[handle] THEN { proc: GraphProc = { handle.controller.mark _ GraphConvert.MarkFromRope[name]; }; CallWithLock[handle, proc]; }; }; -- MarkNotify OperandNotify: ChoiceButtons.SelectionNotifierProc = { handle: GraphHandle _ NARROW[clientdata]; IF HandleNotNil[handle] THEN { proc: GraphProc = { handle.controller.operand _ GraphConvert.OperandFromRope[name]; }; CallWithLock[handle, proc]; }; }; -- OperandNotify AngleNotify: ChoiceButtons.SelectionNotifierProc = { handle: GraphHandle _ NARROW[clientdata]; IF HandleNotNil[handle] THEN { proc: GraphProc = { handle.controller.angle _ GraphConvert.AngleFromRope[name]; }; CallWithLock[handle, proc]; }; }; -- AngleNotify }. LOG. SChen, created at October 9, 1985 6:49:24 pm PDT. dGraphPanel.mesa, Copyright c 1985 by Xerox Corporation. All rights reserved. Last Edited by: Sweetsun Chen, November 15, 1985 6:12:12 pm PST flips the toggles on spec Called by NewController, which should gurantee that handle and its refs are not nil, e.g., chart, graph, controller. divisions bounds crosshairs slope text caret targets grids color font text [] _ Label[name: "),", autoX: FALSE, x: controller.justifXRef.nextx]; [] _ Label[name: "),", autoX: FALSE, x: controller.justifYRef.nextx]; curve [] _ FieldLabel["group id:", $EntityGroupId, FALSE, controller.markRef.nextx]; controller.entityGroupId _ Field[NIL, 40]; curve group lastHeight _ lastHeight + twiceEntryHeight; [] _ SpecEntry["Curve Group:", $Group]; [] _ FieldLabel["(id:", $GroupId]; controller.groupId _ Field[NIL, 20]; [] _ Label[")"]; lastHeight _ lastHeight + entryHeight; [] _ FieldLabel["name:", $GroupName, FALSE, level2X]; controller.groupName _ Field[data: NIL, width: 2000]; Containers.ChildXBound[spec, controller.groupName]; lastHeight _ lastHeight + entryHeight; [] _ FieldLabel["x id:", $XId, FALSE, level2X]; controller.xId _ Field[data: NIL, width: 20]; lastHeight _ lastHeight + entryHeight; [] _ FieldLabel["y id's:", $YId, FALSE, level2X]; controller.yIds _ Field[ data: NIL, width: 2000, height: twiceEntryHeight, scrollable: TRUE] Containers.ChildXBound[spec, controller.yIds]; rule lastHeight _ lastHeight + entryHeight + entryVSpace; prev _ Rules.Create[ info: [parent: spec, wy: 400, ww: 1000, wh: 1], paint: FALSE]; Containers.ChildXBound[spec, prev]; Called by NewController, which should gurantee that handle and its refs are not nil. Called by NewController, which should gurantee that handle and its refs are not nil, e.g., chart, graph, controller. title operand resume values unary operations angle binary operations argument rule xy values controller.xyLabel _ prev _ Label[prev, xys, lastHeight, NIL, 15, FALSE, 0, mathFont]; crosssection lastHeight _ lastHeight + entryHeight; controller.xsecLabel _ prev _ Label[prev, xys, lastHeight, NIL, 15, FALSE, 0, mathFont]; values SELECT PopUpMenu.RequestSelection[ "Options", LIST["Set y values", "Set x values", "Set x and y values"], 1] FROM 1 => atom _ $YValues; 2 => atom _ $XValues; 3 => NULL; -- atom _ $XYValues; ENDCASE => action _ noop; action _ update; SELECT PopUpMenu.RequestSelection[ "Options", LIST["Show x and y values", "Set y values", "Set x values", "Set x and y values"], 1] FROM 1 => action _ resume; 2 => atom _ $YValues; 3 => atom _ $XValues; 4 => NULL; -- atom _ $XYValues; ENDCASE => action _ noop; PROC [name: ROPE, clientdata: REF ANY] Ê?˜JšœÏmœ1™Mšœ™Icode™/—J˜šÏk ˜ Jšœžœ˜#Jšœ4˜4Jšœžœ˜*Jšœžœ1˜DJšœžœ=žœ ˜VJšœ žœ_˜qJšœ žœ~˜Jšœ žœ]˜lJšœžœ˜Jšœžœ˜Jšœ žœ˜#Jšœžœ ˜Jšœžœ˜Jšœ žœ˜%Jšœ žœ0˜A—J˜šœ žœž˜Jšžœ˜”Jšžœžœ ˜=—J˜Jšœ žœ˜Jšœžœ˜ Jšœ žœ˜Jšœ žœ˜Jšœ žœ˜Jšœ žœ˜JšœSžœ˜YJšœMžœ˜TJ˜šœ žœ˜$Jšœ™šžœžœžœ˜6šžœž˜JšœL˜LJšœF˜FJšœS˜SJšœ[˜[Jšœ6˜6JšœL˜LJšœF˜FJšœF˜FJšœ<˜˜>Jšœ)žœ ˜9—šœ:˜:Jšœ2˜2—šœ9˜9Jšœ2˜2—J™J™Jšœ&˜&Jšœ˜šœ8˜8Jšœ)žœ ˜9—šœ6˜6Jšœ6˜6—šœ6˜6Jšœ6˜6—šœ6˜6Jšœ6˜6—šœ6˜6Jšœ6˜6—J˜J™ Jšœ&˜&Jšœ˜šœD˜DJšœ.žœ ˜>—šœH˜HJšœ>˜>—šœH˜HJšœ>˜>—šœ@˜@Jšœ;˜;—šœJ˜JJšœ@˜@—šœJ˜JJšœ@˜@—J˜J™Jšœ&˜&šœ2˜2Jšœ"žœ ˜2—Jšœ=˜=šœQ˜Qšœžœžœ˜7Jšœ9˜9Jšžœžœ˜ —Jšœ ˜ —J˜J™ Jšœ&˜&Jšœnžœ ˜~šœE˜EJšœ;˜;—šœE˜EJšœ;˜;J˜—J™Jšœ&˜&Jšœ ˜ šœ2˜2Jšœ,žœ ˜<—šœ@˜@Jšœ;˜;—šœ@˜@Jšœ?˜?—šœ@˜@Jšœ<˜<—J˜Jšœ&˜&šœ:˜:Jšœ%žœ ˜5—šœ@˜@Jšœ;˜;—šœ@˜@Jšœ?˜?—šœ@˜@Jšœ<˜<—J™J™Jšœ&˜&Jšœ˜šœ6˜6Jšœžœ ˜-—šœ6˜6Jšœ˜—J˜J™Jšœ&˜&Jšœ˜JšœS˜SJšœ[˜[J˜Jšœ&˜&šœ5˜5Jšœ4žœ ˜D—šœ7˜7Jšœ6˜6—šœ6˜6Jšœ5˜5—J˜J™Jšœ&˜&Jšœ˜JšœR˜RJšœ[˜[Jšœ&˜&šœ<˜˜>JšœB˜B—šœ<˜