DIRECTORY
Atom USING[MakeAtom, GetPName],
DBIcons USING[IsRegistered],
Rope USING[ROPE, Length],
ViewerOps USING[FindViewer, AddProp],
ViewerClasses USING[Viewer],
Whiteboard USING[ToolInfo];
WhiteboardTools: CEDAR PROGRAM
IMPORTS ViewerOps, DBIcons, Atom, Rope
= BEGIN
SetToolProperty: PROC [name, instructions: Rope.ROPE, tool: ATOM, icon: ATOMNIL] RETURNS[ viewer: ViewerClasses.Viewer ] ~ {
viewer ← ViewerOps.FindViewer[name];
IF viewer = NIL THEN RETURN;
IF icon = NIL THEN {
iconName: Rope.ROPE = DBIcons.IsRegistered[Atom.GetPName[tool]].name;
IF iconName.Length[] # 0 THEN icon ← Atom.MakeAtom[iconName]
};
ViewerOps.AddProp[viewer, $ToolInfo, NEW[Whiteboard.ToolInfo ← [tool, icon, instructions]]]
};
END.