7.5  Graph Functions

(add-links graph-snip<%> graph-snip<%>)      PROCEDURE

(add-links 
 graph-snip<%>
 graph-snip<%>
  (union false? (is-a?/c pen%))
  (union false? (is-a?/c pen%))
  (union false? (is-a?/c brush%))
  (union false? (is-a?/c brush%)))
)      PROCEDURE

(add-links 
 graph-snip<%>
  graph-snip<%>
  (union false? (is-a?/c pen%))
  (union false? (is-a?/c pen%))
  (union false? (is-a?/c brush%))
  (union false? (is-a?/c brush%))
  (union false? string)
)      PROCEDURE

(add-links 
 graph-snip<%>
  graph-snip<%>
  (union false? (is-a?/c pen%))
  (union false? (is-a?/c pen%))
  (union false? (is-a?/c brush%))
  (union false? (is-a?/c brush%))
  number
  number
)      PROCEDURE

(add-links 
 graph-snip<%>
  graph-snip<%>
  (union false? (is-a?/c pen%))
  (union false? (is-a?/c pen%))
  (union false? (is-a?/c brush%))
  (union false? (is-a?/c brush%))
  number
  number
 
  (union false? string)
)      PROCEDURE

The add-links function connects a parent snip to a child snip in the same pasteboard.

When called with two arguments, connects the snips using a blue/purple color scheme for the links. The first snip is the parent and the second snip is the child.

When called with six arguments, uses the two pens and brushes for the color scheme. The first pen and the first brush are used when the mouse cursor is over the snip (or a child or parent) and the second pen and brush are used when the mouse cursor is not over the snip. The brush is used to draw inside the arrow head and the pen is used to draw the border of the arrowhead and the line connecting the two snips.

When called with a final string argument, the string is used as a label on the edge.

When called with two final number arguments, they are dx and dy offsets for the head and the tail of the arrow, first dx and then dy.

When called with two numbers and a string as the final three arguments, the numbers and strings behave as they do separately.

(add-links/text-colors 
 graph-snip<%>
  graph-snip<%>
  (union false? (is-a?/c pen%))
  (union false? (is-a?/c pen%))
  (union false? (is-a?/c brush%))
  (union false? (is-a?/c brush%))
 (union false? (is-a?/c color%)))
 (union false? (is-a?/c color%))
  number
  number
 
  (union false? string)
)      PROCEDURE

Behaves like add-links, except that seventh and eighth arguments specify colors for the text on the label (the arguments preceeding and following are treated like the last case of add-links).