File: WhiteboardDBPrivate.mesa
Copyright (C) 1984 by Xerox Corporation. All rights reserved.
Last edited by: Donahue, January 3, 1985 11:59:28 am PST
Last Edited by: Winkler, December 18, 1984 11:18:04 am PST
DIRECTORY
DB USING [Entity, RelshipSet],
Rope USING [ROPE],
ViewerTools
USING [TiogaContents];
WhiteboardDBPrivate:
CEDAR
DEFINITIONS =
BEGIN
Whiteboard: TYPE = DB.Entity;
WBIcon: TYPE = DB.Entity;
WBNote: TYPE = DB.Entity;
WBItem: TYPE = DB.Entity;
ItemType: TYPE = {icon, note};
ChildSet: TYPE = REF ChildSetObject;
ChildSetObject: TYPE = RECORD[rs: DB.RelshipSet, screen: BOOL ← FALSE];
wbType:
ATOM;
Whiteboard items with this type are references to other whiteboards.
ROPE: TYPE = Rope.ROPE;
Structure of a whiteboard database.
A whiteboard database contains two types of entities: Whiteboards and WhiteboardItems; a whiteboard contains a collection of whiteboard items. Whiteboards also have a version number that is to be updated whenever any of the contents of the whiteboard changes (this is done by WhiteboardDB).
Whiteboard items are the entities that are contained on whiteboards (each entity belongs to only one whiteboad). Each whiteboard item has a position (where it is to be placed on its containing whiteboard) and a size (expressed as a height and width). There are two types of whiteboard items, WBIcons and WBNotes, each with different additional properties.
WBNotes are the text boxes on a whiteboard: they simply have contents and formatting properties, which are interpreted as a ViewerTools.TiogaContents record. WBNotes also have a flexible size, so a Grow operation is provided for this class of WhiteboardItems.
WBIcons are the icon entities on a whiteboard (they have a fixed size: 64 x 64). Each icon entity has two sets of properties:
"Display properties": the name of the icon to be used and the label to be painted on the icon. The icon names are mapped to icon flavors through the DBIcons database
"Icon properties": the name and type of the icon to be used when "opening" it. The current icon types used are $Whiteboard, $Tool (the name is used to lookup a tool in the DBTools database and the label becomes the argument to the tool), $Text (the name is taken as the name of a file), $ToolRope (the name is taken as the name of a tool that does not create a new viewer, but instead uses a Commander to get its arguments), and $Entity (the name is taken as the name of another database entity, eg., a calendar entry or Walnut message set). The use of these icon properties can be found in WhiteboardOpsImpl.
Operations on Whiteboards.
DeclareWhiteboard:
PROC[name:
ROPE]
RETURNS[wb: Whiteboard];
Find the whiteboard with the given name (creating a new one if necessary).
NameOf:
PROC[wb: Whiteboard]
RETURNS[name:
ROPE];
Give the name of the whiteboard supplied.
GetVersion:
PROC[wb: Whiteboard]
RETURNS[version:
INT];
Return the current version number of the whiteboard.
SetVersion:
PROC[wb: Whiteboard, version:
INT];
Set the version number of the whiteboard to have the given value.
GetGridSize:
PROC[wb: Whiteboard]
RETURNS[gridSize:
INT];
Return the current grid size of the whiteboard.
SetGridSize:
PROC[wb: Whiteboard, gridSize:
INT];
Set the grid size of the whiteboard to have the given value.
DestroyWhiteboard:
PROC[wb: Whiteboard];
Remove all references to the whiteboard from the database.
Exists:
PROC[name:
ROPE]
RETURNS[
BOOL];
Does a whiteboard by this name already exist in the database.
Enumerate:
PROC[]
RETURNS[wbList:
LIST
OF Whiteboard];
List all of the whiteboards stored in the database.
Generic operations on Whiteboard Items.
FetchWBItem:
PROC[name:
ROPE, type: ItemType]
RETURNS[item: WBItem];
Go from a name to the whiteboard item it denotes -- this procedure returns NIL if the item does not exist in the database.
Parent:
PROC[item: WBItem]
RETURNS[wb: Whiteboard];
The parent of the WBitem.
Children:
PROC[wb: Whiteboard, onlyWhiteboards:
BOOL ←
FALSE]
RETURNS[children: ChildSet];
Return an enumeration of all of the children of a whiteboard. If onlyWhiteboards, then the enumeration will produce only those children that are references to whiteboards
NextChild:
PROC[children: ChildSet]
RETURNS[child: WBItem];
Return the next child in the enumeration (if no children remain, produce NIL).
TypeOf:
PROC[item: WBItem]
RETURNS[type: ItemType];
Return the type of a whiteboard item.
Position:
PROC[item: WBItem]
RETURNS[x, y:
INT];
Return the position of a whiteboard item.
Size:
PROC[item: WBItem]
RETURNS[w, h:
INT];
Return the size of a whiteboard item.
Move:
PROC[item: WBItem, newX, newY:
INT];
Change the position of a whiteboard item (either note or icon).
Destroy:
PROC[item: WBItem];
Remove all references to the whiteboard item from the database.
Operations on Whiteboard Notes.
NewNote:
PROC[parent: Whiteboard, x, y, w, h:
INT, content: ViewerTools.TiogaContents]
RETURNS[newNote: WBNote];
Build a new note entity in the database with all of the supplied properties.
GetContents:
PROC[note: WBNote]
RETURNS[content: ViewerTools.TiogaContents];
Return the current Tioga contents of the note.
SetContents:
PROC[note: WBNote, content: ViewerTools.TiogaContents];
Change the contents of a note.
Grow:
PROC[note: WBNote, newW, newH:
INT];
Change the size of a note.
Operations on Whiteboard Icons.
NewIcon:
PROC[parent: Whiteboard, x, y:
INT, name, label, icon, argument:
ROPE, type:
ATOM]
RETURNS[newIcon: WBIcon];
Create a new icon entity in the database, with its position as specified (the height and width of an icon are 64). The label can be different from the name so that a more reasonable label can be displayed on the icon.
GetDisplayProps:
PROC[wbIcon: WBIcon]
RETURNS[label, icon:
ROPE];
Get the display properties of a whiteboard icon.
GetToolArgument:
PROC[wbIcon: WBIcon]
RETURNS[argument:
ROPE];
Get the display tool argument property of a whiteboard icon.
GetIconProps:
PROC[wbIcon: WBIcon]
RETURNS[name:
ROPE, type:
ATOM];
Get the "entity" properties of an icon -- those needed when the icon is "opened".
SetProps:
PROC[wbIcon: WBIcon, name, label, icon:
ROPE, type:
ATOM];
Change the properties of an icon.
Initialization.
ResetSchema:
PROC[];
Reinitialize all of the schema variables, if necessary and possible. Note: this procedure does not attempt to catch aborted transactions!
Initialize:
PROC[DBFile:
ROPE];
Initialize all of the schema variables. This is the procedure to call if the database has changed by having the user edit his profile, also.
WBSegment:
ROPE;
The file name of the current Whiteboard database (in case anyone is curious)
END...