File: WhiteboardDB.mesa
Copyright (C) 1984 by Xerox Corporation. All rights reserved.
Last edited by: Donahue, January 21, 1985 8:50:56 am PST
Last Edited by: Jennifer Widom, August 24, 1984 8:29:30 pm PDT
Last Edited by: Winkler, December 18, 1984 10:50:20 am PST
DIRECTORY
Rope USING [ROPE],
ViewerClasses USING [Viewer],
ViewerTools USING [TiogaContents],
WhiteboardDB:
CEDAR
DEFINITIONS =
BEGIN
Viewer: TYPE = ViewerClasses.Viewer;
ROPE: TYPE = Rope.ROPE;
whiteboard: ATOM;
stopped:
BOOL;
stopped becomes true when the database has been shut down by executing a Checkpoint proc (since the transaction must be closed at this point). Operations executed after stopped becomes true will be ignored.
readOnly:
BOOL;
Is the current database read only
WBError:
ERROR[reason:
ATOM];
When operations in this interface fail, they raise this error. The current list of ATOMs that may be returned include $WrongVersion (the version stamp of the whiteboard disagrees with the one in the database), $ReadOnly (the whiteboard database is readonly), $ServerDown (can't establish a connection to the server to do the store), $InternalError (either a Cypress or a Whiteboards problem -- contact implementor), $TransactionAbort (retrying the operation will probably be sufficient).
Procedures for updating and querying a Whiteboard database
Display:
PROC[eName:
ROPE, v: Viewer ←
NIL]
RETURNS[Viewer];
Display the named whiteboard in the given viewer. When this is called, the named whiteboard is known to exist.
GetWBName:
PROC[wb: Viewer]
RETURNS [name:
ROPE];
Return the name of the whiteboard being displayed in the viewer (if it is a whiteboard displayer).
Destroy:
PROC[eName:
ROPE];
Destroy the named whiteboard.
New:
PROC[eName:
ROPE]
RETURNS[success:
BOOL];
Create a new whiteboard entity with the given name (it will initially have no contents). This is a "noop" if a whiteboard with this name already exists. Returns false if new whiteboard can't be created.
Save:
PROC[wb: Viewer];
Take all of the logged changes to the whiteboard viewer and update the whiteboard database to reflect them. The procedures for logging changes to a whiteboard viewer are given below.
WBExists:
PROC[eName:
ROPE]
RETURNS[alreadyExists:
BOOL];
Check if the named whiteboard exists in the current database.
CopyWB:
PROC[from, to:
ROPE];
Copies the contents of one whiteboard to another. If the "to" whiteboard already exists, it will be erased. Otherwise a new whiteboard is created.
EnumerateWhiteboards:
PROC[eName:
ROPE ←
NIL]
RETURNS[wbList:
LIST
OF
ROPE];
Enumerates all whiteboards contained in the named whiteboard. If no name is supplied,
all whiteboards in the current database are enumerated.
GetIconProps:
PROC[wbIcon: Viewer]
RETURNS[name:
ROPE, type:
ATOM];
Get the important information out of an icon on a whiteboard.
GetToolArgument:
PROC[wbIcon: Viewer]
RETURNS[argument:
ROPE];
Get the argument information for a tool.
Dumping to and loading from a file.
Dump:
PROC[to:
ROPE];
Dump the contents of the database to a file.
Load:
PROC[from:
ROPE];
Reload the contents of the database from the given file.
Logging procedures: Note that the following procedures do not update the Whiteboard database -- actions are logged behind the viewer until a Save or Reset is performed (Reset erases the logged actions). The whiteboard being operated on is an implicit argument: it is the parent of the viewer provided. In each procedure, the contents of the viewer may be changed and the fact of the change is logged -- but the DB is not updated. Since these operations do not touch the database, they cannot raise any errors.
NewIcon:
PROC[wb: Viewer, x, y:
INT, name:
ROPE, type:
ATOM, icon:
ROPE, label:
ROPE ←
NIL, argument:
ROPE ←
NIL]
RETURNS [new: Viewer];
Add a new icon to a whiteboard at the specified coordinates, setting the properties of the icon to be the ones given. The name and type properties can be retrieved using the GetProps operation given above; the label and icon properties are used only for displaying the icon -- the icon property gives the name of the icon to be used and label gives the label to be used (if different from name). Note: the only type used within the whiteboards code is the "whiteboard" type defined above. The viewer that was created is returned.
NewBox:
PROC[wb: Viewer, x, y, w, h:
INT, contents: ViewerTools.TiogaContents ←
NIL]
RETURNS [new: Viewer];
Add a new text box to a viewer at the specified position with the specified contents. The viewer that was created is returned.
Delete:
PROC[child: Viewer];
Delete the child viewer from the whiteboard
EditText:
PROC[box: Viewer];
Log that the contents of the specified text box have been edited
Grow:
PROC[box: Viewer];
Log that the size of the specified text box has been changed
Move:
PROC[child: Viewer];
Log that the position of the specified child has been changed
Erase:
PROC[wb: Viewer];
Erase the entire contents of the whiteboard
Reset:
PROC[wb: Viewer];
Reset the log for the whiteboard and redisplay the whiteboard's contents (the version number is ignored here, since the contents are being entirely recreated)
EstablishWhiteboardDB:
PROC[DBFile:
ROPE ←
NIL];
Initially set up or reset the user's Whiteboard segment.
Close:
PROC[];
Shut down all connections with databases necessary for Whiteboards to run.
END...