This class provides a visual editor specialized for editing forests. A forest is a data structure that includes any number of trees. A tree is a data structure with nodes that are either a root or have exactly one parent, and that have any number of children. It is invoked automatically when opening any file with the ".fst" extension in its name. The forest editor is derived from the Graphics class, and therefore inherits all of its features.
Menu commands for adding new nodes, deleting nodes, and editing
the name or contents of the nodes are provided.
Here is an example of how to use the EditForest:
::tycho::view EditForest [list -file \
$TYCHO/editors/visedit/test/sample.fst]
Clicking the left mouse button on any node selects it. Clicking away from any node deselects selected nodes. The selected node may be deleted using the Cut command, which also saves the node to the clipboard. A node in the clipboard may be pasted using the Paste command. If a node is selected when the Paste command is issued, then the node in the clipboard is pasted as a child of the selected node. Otherwise, it is pasted as a root node. The Copy command saves a node to the clipboard without deleting it. However, this node can only be pasted in another window, because every node is required to have a unique name.
A selected node may be edited using the Edit Node command. A new root may be added using the New Root command. A new child node may be added to a selected node using the New Child command.
The contents of a node is an arbitrary Tcl string. However, if the data takes a certain form, then the display and behavior of the editor can be controlled very precisely. In particular, the contents of the node can be a list, with items in the list being lists lists of the form "{keyword value}". The following keywords are currently understood:
getFont
method of the FontManager
class.
EditForestWidget
. The point may be a string identifying
a named anchor in an HTML file, or "{line linenumber}" or
"{range start end}" for text files, or any other destination
that is understood by the seePoint
method of the
widget that will display the hyperlink.