GraphMenus.mesa, Copyright Ó 1985, 1987 by Xerox Corporation. All rights reserved.
Last Edited by:
Christian Le Cocq April 27, 1987 5:48:33 pm PDT
Sweetsun Chen, November 27, 1985 3:42:10 pm PST
DIRECTORY
FS USING [ComponentPositions, Error, ExpandName],
Graph USING [BackgroundIndex, CaretIndex, ColorMap, ColorMode, Error, GraphHandle, GraphProc, ROPE, Viewer],
GraphCleanUp USING [CleanUpHandle],
GraphOps USING [Lock, Unlock],
GraphPrivate USING [CallWithLock, GetGraph, PaintAll, Print, RemoveAllCurves, ShowChart, ShowController, SwitchAuto, SwitchCaretVisibility, SwitchCaretBlinking, SwitchSlope, SwitchTarget, SwitchGrid, UserEditAllowed, WriteGraphFile, WriteTextFile],
GraphUtil USING [BlinkMsg, ControllerNotNil, HandleFromViewer, HandleNotNil, ReplaceFileExt, SetCursorForBackgroundIndex, UseCedarColors, UseDefaultColors, UseMyColors, WDirOfViewer],
Menus USING [AppendMenuEntry, CreateEntry, CreateMenu, GetNumberOfLines, Menu, MenuLine, MenuProc, MouseButton],
PopUpSelection USING [Request],
Rope USING [Concat, Find, IsEmpty],
Terminal USING [ColorCursorPresentation, Current, SetColorCursorPresentation, Virtual],
TiogaMenuOps USING [AllLevels, FewerLevels, FirstLevelOnly, MoreLevels],
TiogaOps USING [Jump, ViewerDoc],
ViewerBLT USING [ChangeNumberOfLines],
ViewerOps USING [FindViewer, MoveViewer, OpenIcon, PaintViewer, SaveViewer, TopViewer],
ViewerTools USING [GetSelectionContents, MakeNewTextViewer];
GraphMenus: CEDAR MONITOR
IMPORTS FS, Graph, GraphCleanUp, GraphOps, GraphPrivate, GraphUtil, Menus, PopUpSelection, Rope, Terminal, TiogaMenuOps, ViewerBLT, ViewerOps, ViewerTools
EXPORTS GraphPrivate = { OPEN Graph, GraphOps, GraphPrivate, GraphUtil;
menus
ControllerMenus: PUBLIC PROC [] RETURNS [menu: Menus.Menu] = {
ENABLE UNWIND => NULL;
menu ← Menus.CreateMenu[2];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry[name: "Chart", proc: ShowChartProc]];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry[name: "Spec", proc: ShowSpecProc]];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry[name: "Values", proc: ShowXYsProc]];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry[name: "Table", proc: ShowTableProc]];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry[name: "Levels", proc: LevelsProc]];
switches
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "AutoDiv", proc: AutoDivisionsProc], 1];
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "AutoBounds", proc: AutoBoundsProc], 1];
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "Xhair1", proc: PrimXhairProc], 1];
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "Xhair2", proc: SecXhairProc], 1];
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "Slope", proc: SlopeProc], 1];
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "TextCaret", proc: TextCaretProc], 1];
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "TargetX", proc: TargetXProc], 1];
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "TargetY", proc: TargetYProc], 1];
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "GridX", proc: GridXProc], 1];
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "GridY", proc: GridYProc], 1];
levels menus
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "FirstLevelOnly", proc: FirstLevelOnlyProc], 2];
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "MoreLevels", proc: MoreLevelsProc], 2];
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "FewerLevels", proc: FewerLevelsProc], 2];
Menus.AppendMenuEntry[
menu, Menus.CreateEntry[name: "AllLevels", proc: AllLevelsProc], 2];
}; -- ControllerMenus
menuprocs
ShowSpecProc: ENTRY Menus.MenuProc = {
show up the spec panel
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = {
IF ControllerNotNil[handle.controller] THEN { OPEN handle.controller;
IF NOT specVisible THEN {
specVisible ← TRUE; -- rule always goes with spec.
xysVisible ← tableVisible ← FALSE;
ViewerOps.MoveViewer[viewer: rule, x: 0, y: 399, w: rule.ww, h: 1, paint: FALSE];
ViewerOps.MoveViewer[viewer: xys, x: 1000, y: 0, w: 0, h: 0, paint: FALSE];
IF table # NIL THEN ViewerOps.MoveViewer[
viewer: table, x: 1000, y: 0, w: 0, h: 0, paint: FALSE];
ViewerOps.MoveViewer[viewer: spec, x: 0, y: 0, w: viewer.ww, h: 400, paint: TRUE];
ViewerOps.PaintViewer[viewer: viewer, hint: client];
};
};
};
CallWithLock[handle, proc];
}; -- ShowSpecProc
ShowXYsProc: ENTRY Menus.MenuProc = {
show up the XY values panel
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = {
IF ControllerNotNil[handle.controller] THEN { OPEN handle.controller;
IF NOT xysVisible THEN {
xysVisible ← TRUE;
specVisible ← tableVisible ← FALSE; -- rule always goes with spec.
ViewerOps.MoveViewer[viewer: spec, x: 1000, y: 0, w: 0, h: 0, paint: FALSE];
ViewerOps.MoveViewer[viewer: rule, x: 1000, y: 0, w: rule.ww, h: 1, paint: FALSE];
IF table # NIL THEN ViewerOps.MoveViewer[
viewer: table, x: 1000, y: 0, w: 0, h: 0, paint: FALSE];
ViewerOps.MoveViewer[viewer: xys, x: 0, y: 0, w: viewer.ww, h: 1000, paint: TRUE];
ViewerOps.PaintViewer[viewer: viewer, hint: client];
};
};
};
CallWithLock[handle, proc];
}; -- ShowXYsProc
ShowTableProc: ENTRY Menus.MenuProc = {
show up the table of texts and curves
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = {
IF ControllerNotNil[handle.controller] THEN { OPEN handle.controller;
IF NOT tableVisible THEN {
tableVisible ← TRUE;
specVisible ← xysVisible ← FALSE; -- rule always goes with spec.
ViewerOps.MoveViewer[viewer: spec, x: 1000, y: 0, w: 0, h: 0, paint: FALSE];
ViewerOps.MoveViewer[viewer: rule, x: 1000, y: 0, w: rule.ww, h: 1, paint: FALSE];
ViewerOps.MoveViewer[viewer: xys, x: 1000, y: 0, w: 0, h: 0, paint: FALSE];
IF table # NIL THEN ViewerOps.MoveViewer[
viewer: table, x: 0, y: 0, w: viewer.ww, h: 1000, paint: TRUE];
ViewerOps.PaintViewer[viewer: viewer, hint: client];
};
};
};
CallWithLock[handle, proc];
}; -- ShowTableProc
ShowChartProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
Lock[handle];
handle.waitingGraph ← TRUE;
ShowChart[handle]; -- will unlock handle. - No more, 11/13/85.
Unlock[handle]; -- added this on 11/13/85.
}; -- ShowChartProc
LevelsProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
IF HandleNotNil[handle] THEN {
Lock[handle]; { OPEN handle;
numLines: Menus.MenuLine ← Menus.GetNumberOfLines[controller.menu];
SELECT numLines FROM
2 => numLines ← 3;
3 => numLines ← 2;
ENDCASE => ERROR;
ViewerBLT.ChangeNumberOfLines[controller.viewer, numLines];
}; Unlock[handle];
};
}; -- SwitchesProc
SwitchIt: PROC [wasOn: BOOL, mouseButton: Menus.MouseButton, label: ROPE] RETURNS [BOOL] = {
RETURN[SELECT mouseButton FROM
red => NOT wasOn,
blue => wasOn,
ENDCASE => SELECT PopUpSelection.Request[
header: label, choice: LIST["on (red)", "off (blue)"], default: 1] FROM
1 => NOT wasOn,
2 => wasOn,
ENDCASE => FALSE];
}; -- SwitchIt
AutoDivisionsProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
IF SwitchIt[graph.auto[divisions], mouseButton, "Auto Divisions"] THEN SwitchAuto[handle, divisions];
};
CallWithLock[handle, proc];
}; -- AutoDivisionsProc
AutoBoundsProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
IF SwitchIt[graph.auto[bounds], mouseButton, "Auto Bounds"] THEN SwitchAuto[handle, bounds];
};
CallWithLock[handle, proc];
}; -- AutoBoundsProc
AutoBoundsProc: Menus.MenuProc = {
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
wasOn: BOOL ← graph.auto[bounds];
update, switchIt: BOOLTRUE;
SELECT mouseButton FROM
red => switchIt ← NOT wasOn;
blue => switchIt ← wasOn;
ENDCASE => SELECT PopUpMenu.RequestSelection[
label: "Auto Bounds", choice: LIST["on (red)", "off (blue)"], default: 1] FROM
1 => switchIt ← NOT wasOn;
2 => switchIt ← wasOn;
ENDCASE => switchIt ← update ← FALSE;
IF switchIt THEN SwitchAuto[handle, bounds]
ELSE IF update AND wasOn THEN {
IF chart.viewer = NIL THEN graph.bounds ← DataBounds[graph.entityList, graph.bounds]
ELSE PaintAll[handle];
};
};
CallWithLock[handle, proc];
}; -- AutoBoundsProc
PrimXhairProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
SwitchCaret[parent, mouseButton, primary, shift];
};
SecXhairProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
SwitchCaret[parent, mouseButton, secondary, shift];
};
TextCaretProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
SwitchCaret[parent, mouseButton, text, shift];
};
SwitchCaret: PROC[parent: REF ANY, mouseButton: Menus.MouseButton, index: CaretIndex, shift: BOOL] = {
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
IF shift THEN {
IF SwitchIt[chart.caretState[index].toBlink, mouseButton, "Blinking"] THEN {
SwitchCaretBlinking[handle, index];
IF chart.caretState[index].toBlink AND NOT graph.caret[index].on THEN
SwitchCaretVisibility[handle, index];
}
}
ELSE IF SwitchIt[graph.caret[index].on, mouseButton, "Caret"] THEN SwitchCaretVisibility[handle, index];
};
CallWithLock[handle, proc];
}; -- SwitchCaret
SlopeProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
IF SwitchIt[graph.showSlope, mouseButton, "Slope"] THEN SwitchSlope[handle];
};
CallWithLock[handle, proc];
}; -- SlopeProc
TargetXProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = {
IF SwitchIt[handle.graph.target[x].on, mouseButton, "Target X"] THEN
SwitchTarget[handle, x]};
CallWithLock[handle, proc];
}; -- TargetXProc
TargetYProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = {
IF SwitchIt[handle.graph.target[y].on, mouseButton, "Target X"] THEN
SwitchTarget[handle, y]};
CallWithLock[handle, proc];
}; -- TargetYProc
GridXProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = {
IF SwitchIt[handle.graph.grids[x], mouseButton, "Vertical Grids"] THEN
SwitchGrid[handle, x]};
CallWithLock[handle, proc];
}; -- GridXProc
GridYProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = {
IF SwitchIt[handle.graph.grids[y], mouseButton, "Horiz. Grids"] THEN
SwitchGrid[handle, y]};
CallWithLock[handle, proc];
}; -- GridYProc
FirstLevelOnlyProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = {TiogaMenuOps.FirstLevelOnly[handle.controller.table]};
CallWithLock[handle, proc];
}; -- FirstLevelOnlyProc
MoreLevelsProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = {TiogaMenuOps.MoreLevels[handle.controller.table]};
CallWithLock[handle, proc];
}; -- MoreLevelsProc
FewerLevelsProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = {TiogaMenuOps.FewerLevels[handle.controller.table]};
CallWithLock[handle, proc];
}; -- FewerLevelsProc
AllLevelsProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = {TiogaMenuOps.AllLevels[handle.controller.table]};
CallWithLock[handle, proc];
}; -- AllLevelsProc
ChartMenus: PUBLIC PROC [] RETURNS [menu: Menus.Menu] = {
ENABLE UNWIND => NULL;
menu ← Menus.CreateMenu[];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry["Color", SetColorProc]];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry["Cursor", SetCursorColorProc]];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry["Background", SetBackgroundIndexProc]];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry["Get", GetGraphProc]]; --, guarded: TRUE]];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry["Merge", MergeGraphProc]];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry["Store", PutGraphProc]];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry["List", ListGraphProc]];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry["Interpress", InterpressProc]];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry["Clear/Refresh", ClearRefreshProc]];
Menus.AppendMenuEntry
[menu, Menus.CreateEntry["Controller", ShowControllerProc]];
}; -- ChartMenus
menuprocs
SetColorProc: ENTRY Menus.MenuProc = {
[parent: REF, clientData: REF, mouseButton: MouseButton, shift, control: BOOL]
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
newColorMap: ColorMap;
newColorMode: ColorMode;
SELECT PopUpSelection.Request[
header: "Options",
choice: LIST[
"my colors",
"graph default colors",
"my colors ← graph default",
"cedar default colors",
"black and white"
],
default: 1] FROM
1 => {newColorMode ← color; newColorMap ← mine};
2 => {newColorMode ← color; newColorMap ← default};
3 => {newColorMode ← color; newColorMap ← replace};
4 => {newColorMode ← color; newColorMap ← cedar};
5 => {newColorMode ← bw; newColorMap ← colorMap};
ENDCASE => {newColorMode ← colorMode; newColorMap ← colorMap};
SetCursorForBackgroundIndex[backgroundIndex];
IF colorMode # newColorMode THEN {
colorMode ← newColorMode;
chart.viewer (parent) # nil
PaintAll[handle, TRUE, FALSE, TRUE];
};
IF colorMap # newColorMap THEN {
colorMap ← newColorMap;
SELECT newColorMap FROM
mine => UseMyColors[handle];
cedar => UseCedarColors[];
default => UseDefaultColors[];
replace => UseDefaultColors[handle];
ENDCASE;
};
}; -- proc
CallWithLock[handle, proc];
}; -- SetColorProc
SetCursorColorProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
virtual: Terminal.Virtual ← Terminal.Current[];
SELECT PopUpSelection.Request[
header: "Options",
choice: LIST["black", "white"],
default: 1] FROM
1 => [] ← Terminal.SetColorCursorPresentation[virtual, onesAreBlack];
2 => [] ← Terminal.SetColorCursorPresentation[virtual, onesAreWhite];
ENDCASE => SetCursorForBackgroundIndex[backgroundIndex]; -- *
};
CallWithLock[handle, proc];
}; -- SetCursorColorProc
SetBackgroundIndexProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
newBkGndIndex: BackgroundIndex = SELECT PopUpSelection.Request[
header: "Options",
choice: LIST["white", "gray", "dark gray", "black"],
default: 1] FROM
1 => white,
2 => gray,
3 => darkGray,
4 => black,
ENDCASE => backgroundIndex;
IF backgroundIndex # newBkGndIndex THEN {
backgroundIndex ← newBkGndIndex;
SetCursorForBackgroundIndex[backgroundIndex];
PaintAll[handle, TRUE, FALSE, TRUE];
};
};
CallWithLock[handle, proc];
}; -- SetBackgroundIndexProc
GetGraphProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
file, msg: ROPENIL;
[file, msg] ← SelectedFile[WDirOfViewer[chart.viewer], "graph"];
IF msg = NIL THEN {
SELECT PopUpSelection.Request[
header: "Confirm replacing data with", choice: LIST[file], default: 1] FROM
1 => {
handle ← GraphCleanUp.CleanUpHandle[handle, FALSE];
msg ← GetGraph[handle, file ! Error => {msg ← info; CONTINUE}];
IF msg = NIL THEN { -- replace the caption.
handle.chart.viewer.name ← file;
ViewerOps.PaintViewer[handle.chart.viewer, caption, FALSE, NIL];
};
};
ENDCASE;
};
IF msg # NIL THEN BlinkMsg[msg];
};
IF UserEditAllowed[handle] THEN CallWithLock[handle, proc];
}; -- GetGraphProc
SelectedFile: PROC [defaultWDir, defaultExt: ROPE] RETURNS [file, msg: ROPENIL] = {
try selected viewer first.
v: Viewer ← ViewerTools.GetSelectedViewer[];
IF v = NIL THEN msg ← hint
ELSE IF v.class.flavor = $Text THEN file ← v.file
file ← ViewerTools.GetSelectionContents[];
IF file.IsEmpty[] THEN msg ← "Please select a file name."
ELSE {
[file, ] ← FS.ExpandName[file, defaultWDir !
FS.Error => {msg ← error.explanation; CONTINUE}];
IF msg = NIL THEN IF file.Find["."] < 0 THEN file ← ReplaceFileExt[file, defaultExt];
};
}; -- SelectedFile
MergeGraphProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
file, msg: ROPENIL;
[file, msg] ← SelectedFile[WDirOfViewer[chart.viewer], "graph"];
IF msg = NIL THEN {
SELECT PopUpSelection.Request[
header: "Confirm merging data from", choice: LIST[file], default: 1] FROM
1 => msg ← GetGraph[handle, file ! Error => {msg ← info; CONTINUE}];
ENDCASE;
};
IF msg # NIL THEN BlinkMsg[msg];
};
IF UserEditAllowed[handle] THEN CallWithLock[handle, proc];
}; -- MergeGraphProc
ListGraphProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
file, msg: ROPENIL;
[file, msg] ← SelectedFile[WDirOfViewer[chart.viewer], "list"];
IF file.Find["/", 1] > 1 OR file.Find["]"] > 1 THEN msg ← "Please specify a local directory.";
IF msg = NIL THEN {
SELECT PopUpSelection.Request[
header: "Confirm listing data in", choice: LIST[file], default: 1] FROM
1 => {
v: Viewer;
msg ← WriteTextFile[handle, file];
v ← ViewerOps.FindViewer[file];
IF v = NIL THEN {
v ← ViewerTools.MakeNewTextViewer[info: [name: file, file: file]];
ViewerOps.SaveViewer[v];
};
IF v.iconic THEN ViewerOps.OpenIcon[icon: v, bottom: FALSE]
ELSE ViewerOps.TopViewer[viewer: v];
};
ENDCASE;
};
IF msg # NIL THEN BlinkMsg[msg];
};
CallWithLock[handle, proc];
}; -- ListGraphProc
PutGraphProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
file, msg, newName: ROPE;
[file, msg] ← SelectedFile[WDirOfViewer[chart.viewer], "graph"];
IF file.Find["/", 1] > 1 OR file.Find["]"] > 1 THEN msg ← "Please specify a local directory.";
IF msg = NIL THEN {
SELECT PopUpSelection.Request[
header: "Confirm file name", choice: LIST[file], default: 1] FROM
1 => [msg, newName] ← WriteGraphFile[handle, file
! Error => {msg ← info; CONTINUE}];
ENDCASE;
};
IF msg = NIL THEN BlinkMsg[newName.Concat[" is written."]]
ELSE BlinkMsg[msg]
};
CallWithLock[handle, proc];
}; -- PutGraphProc
InterpressProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
file, msg: ROPENIL;
printingColorMode, colorModeSave: ColorMode;
SELECT PopUpSelection.Request[
header: "Options",
choice: LIST["color", "black and white"],
default: 1] FROM
1 => printingColorMode ← color;
2 => printingColorMode ← bw;
ENDCASE => msg ← "You must choose either color or black-and-white.";
IF msg = NIL THEN [file, msg] ← SelectedFile[WDirOfViewer[chart.viewer], "ip"];
IF file.Find["/", 1] > 1 OR file.Find["]"] > 1 THEN msg ← "Please specify a local directory.";
IF msg = NIL THEN SELECT PopUpSelection.Request[
header: "Confirm writing interpress master in", choice: LIST[file], default: 1] FROM
1 => {
colorModeSave ← colorMode;
colorMode ← printingColorMode;
msg ← Print[handle, file ! Error => {msg ← info; CONTINUE}];
IF msg = NIL THEN msg ← file.Concat[" is written."];
colorMode ← colorModeSave;
};
ENDCASE;
BlinkMsg[msg];
};
CallWithLock[handle, proc];
}; -- InterpressProc
ClearRefreshProc: ENTRY Menus.MenuProc = {
ENABLE UNWIND => NULL;
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
proc: GraphProc = { OPEN handle;
SELECT PopUpSelection.Request[
header: "Options",
choice: LIST["refresh", "clear and refresh", "update div/bounds", "remove all curves"],
default: 1] FROM
1 => PaintAll[handle, FALSE, FALSE, TRUE];
2 => PaintAll[handle, TRUE, FALSE, TRUE];
3 => PaintAll[handle, TRUE, TRUE, TRUE];
4 => RemoveAllCurves[handle];
ENDCASE;
};
CallWithLock[handle, proc];
}; -- ClearRefreshProc
ShowControllerProc: ENTRY Menus.MenuProc = {
handle: GraphHandle ← HandleFromViewer[NARROW[parent]];
IF UserEditAllowed[handle] THEN {
proc: GraphProc = {
ShowController[handle, WDirOfViewer[handle.chart.viewer]];
};
CallWithLock[handle, proc];
};
}; -- ShowControllerProc
}.
LOG.
SChen, create at October 9, 1985 6:41:19 pm PDT