WhiteboardNut.mesa
Copyright (C) 1984 by Xerox Corporation. All rights reserved.
last edited by:
John Maxwell on: September 22, 1982 12:19 pm
Willie-Sue on: February 22, 1983 4:19 pm
Cattell on: April 21, 1983 4:02 pm
Donahue, December 26, 1984 9:21:56 am PST
(Removed use of PressPrinter stuff -- press files now get treated like tools)
Widom, August 24, 1984 7:21:39 pm PDT
Last Edited by: Winkler, December 18, 1984 5:21:52 pm PST
DIRECTORY
Commander USING [CommandObject, Handle],
CommandTool USING [DoCommand],
DB,
IO USING[noWhereStream, STREAM],
Nut,
Rope USING [Cat, ROPE],
TiogaMenuOps USING [Open],
ViewerClasses USING [Viewer, ViewerRec, ViewerFlavor],
ViewerOps,
WhiteboardDB,
WhiteboardViewers;
WhiteboardNut: CEDAR PROGRAM
IMPORTS
CommandTool, IO, Nut, Rope, TiogaMenuOps, ViewerOps, WhiteboardDB, WhiteboardViewers =
BEGIN
OPEN ViewerClasses;
ROPE: TYPE = Rope.ROPE;
CreateWBViewer: PUBLIC PROC[eName: ROPE, parent: Viewer] =
BEGIN
newV: Viewer;
If whiteboard has been deleted, do nothing
IF NOT WhiteboardDB.WBExists[eName] THEN RETURN;
try to find a viewer that might have been created
newV ← ViewerOps.FindViewer[Rope.Cat["Whiteboard: ", eName]];
IF newV = NIL OR newV.destroyed THEN {
newV ← Nut.GetSpawnedProperty[parent];
IF newV = NIL OR newV.destroyed OR newV.newVersion OR Nut.GetFrozenProperty[newV] OR newV.class.flavor # WhiteboardViewers.wb
THEN newV ← NIL;
newV ← WhiteboardDB.Display[eName, newV];
[] ← Nut.SetSpawnedProperty[parent, newV] }
ELSE Open[newV];
RETURN;
END;
WhiteboardDisplay: Nut.NutProc = {
IF NOT WhiteboardDB.WBExists[eName] THEN RETURN[NIL];
v ← WhiteboardDB.Display[eName, lastSpawned]
};
CreateTextViewer: PUBLIC PROC[eName: ROPE] =
BEGIN
newV: Viewer;
newV ← ViewerOps.FindViewer[eName];
IF newV = NIL OR newV.destroyed THEN newV ← TiogaMenuOps.Open[fileName: eName]
ELSE Open[newV];
RETURN;
END;
DoCommandFile: PUBLIC PROC[commandFile: ROPE] =
BEGIN
cmd: Commander.Handle ← NEW[Commander.CommandObject ← []];
cmd.out ← IO.noWhereStream;
cmd.err ← IO.noWhereStream;
[] ← CommandTool.DoCommand[commandLine: Rope.Cat["///Commands/Command ", commandFile, " &\n"], parent: cmd];
END;
Open: PROC[viewer: Viewer] =
BEGIN
IF viewer#NIL THEN
IF viewer.iconic THEN ViewerOps.OpenIcon[viewer]
ELSE ViewerOps.PaintViewer[viewer, all];
END;
register the necessary procedures with Nut for outside clients of Whiteboards
Nut.Register["Whiteboard", $Whiteboard, WhiteboardDisplay, WhiteboardDisplay]
END...