Box-and-arrow items
One of the main reasons for the existence of the Slate is because we
want to be able to rapidly construct graphical editors for
``box-and-arrow'' diagrams. This is perhaps the most common structure
present in visual languages and computer/software diagrams (followed by
hierarchy), and includes all kinds of dataflow diagrams, state machines,
flowcharts, class hierarchy diagrams, object models, dataflow-diagrams
(as used in in structure analysis and design -- SA/SD), and circuit
diagrams. At present, the Slate only has some experimental item types
for these kinds of diagrams.
Terminal is a line that represents a "terminal" on some graphical
object. Its coordinates are the coordinates at which it "connects" to
whatever it is that it is a terminal of. It has the following options:
- -direction. The direction of the terminal away from its
origin (the point at which it "connects" to something), as a unit
vector. The "unit vector" is a Tcl list of two elements (x and y). The
default is
{1 0}
, meaning that the terminal will be
horizontal and drawn to connect to a node on its left, and to a wire
on its right.
- -fill. The color of the terminal.
- -length. The length of the line representing the terminal.
- -style. The "style" of terminal: arrow,
doublearrow, or blob. If arrow, the terminal is
just a simple arrow; if doublearrow, the arrow has two heads; if
blob, the terminal has a small circle at the wiring end.
- -type. The "type" of the terminal: input or
output. This is mainly used to control the appearance of the
terminal.
Enhancements: The "arrow" style should perhaps put a
"tail" on the wiring end of an input terminal (as in VEM).
Example: Create some terminals:
source $tycho/editors/slate/doc/internals/newslate.itcl
foreach {x y opts} {
100 50 {}
100 100 {-type output -fill red}
100 150 {-style blob -fill blue}
100 200 {-direction {1 1} -style doublearrow}
} {
eval $slate create Terminal $x $y $opts
}
Node is an item that represents a node of a computation graph
of some kind. It is fully parameterized: the way the node is drawn and
the appearance of its terminals if given by configuration options.
For a specific application, you may prefer to write an item type
dedicated to the application. The Node item has the following options:
- -font. The font to use to display the textual name of the
node. By default, this is a twelve-point Helvetica font.
- -icontype. A list containing the item type to use to draw the
node, followed by options of the item. The item must accept exactly
four coordinates, and is assumed in fact to be rectangular.
The default is
{Frame -color green}
, meaning that the
icon will be a raised green pseudo-3D rectangle (not as bad as it
sounds!).
- -inputs. The positions of the input connections. This is a
flat list of x and y coordinates, as percentages of the
icon size and with the origin at the top left of the icon. By default,
this is
{0 50}
, meaning that there is a single input
halfway up the left edge of the icon. If a single integer is given when
setting this option, the option is set to a list such that that number
of inputs are evely spaced along the left edge of the icon. For
example, setting -inputs 2
will result in the
-inputs
being set to {0 25 0 75}
.
- -intype. A list containing the item type to use to draw the
input terminals, followed by options of the item. The item must accept
exactly two coordinates. The default is
{Terminal -type
input}
.
- -name. The name of the node, which is displayed immediately
underneath the node's icon. The default is "NoName."
- -outputs. The positions of the output connections. This is
must the same as the
inputs
option, except that output
terminals are by default placed at the right-hand side of the node icon.
- -outtype. A list containing the item type to use to draw the
output terminals, followed by options of the item. The default is
{Terminal -type output}
.
Enhancements: In an earlier version of the Slate, Node items
had primary and secondary "directions," so that you could flip the
node about the vertical and horizontal axes.
Caveats: The current release has a serious bug in the way
that tags and bindings to complex items that themselves contain complex
items are handled. Because of this, dragging and resizing Nodes does
not work.
Example: Create a node:
source $tycho/editors/slate/doc/internals/newslate.itcl
.t.s create Node 50 50 120 90 -inputs {0 50 50 0} -outputs 2 \
-name Foo -tags moveable \
-intype {Terminal -type input -style blob -fill red} \
-outtype {Terminal -type output -style doublearrow -fill blue}
(If you drag different bits of the Node with the mouse, you will see the
effect of the unsolved binding bug mentioned elsewhere in this
documentation.)
SmartLine
A SmartLine is a line item that is able to draw itself between
two arbitrary points using only vertical and horizontal lines. The line
needs to be told from what direction to approach each of its endpoints.
It is not included in this release.
Enhancements: SmartLine needs to support "manual"
dragging of line segments and vertices.
Back up
Tycho Home Page
Copyright © 1996, The Regents of the University of California.
All rights reserved.
Last updated: 96/12/11,
comments to: johnr@eecs.berkeley.edu