5. Customizing Visible Attributes

When user presses button or issues the View->Customize Attributes... menu command, a special dialog for customizing visible attributes is shown.

Figure 2. Customizing visible attributes

The dialog window contains four elemens: the attribute list, the pattern list, hint pattern editor and input line for editing a single pattern.

A pattern here means a template for one line of text to be displayed under each node in the TrEd's main window. A pattern may contain any text, but some special substrings have special meaning:

${attr}

Any occurence of this substring is replaced by current node's value of attribute named attr.

#{color}

This sequence of characters may be used to change the color of any following text generated by the pattern. The color may be either a name of a color, e.g. black, red or darkblue, or one of ten symbolic names custom0, custom1 to custom9. In the later case, the resulting color depends on current settings of the CustomColorn configuration options (where n is one of 0...9).

<?code?>

This sequence may encapsulate any Perl code. The code is interpreted in time of evaluation of the pattern (i.e. just before the line is actually to be displayed) and the result returned by the code is inserted in the place of the sequence.

Note that the returned value may also contain any of the sequences above, except the <?...?> sequence.

In the code, the value of a certain attribute attr for the current node may be referred to as $${attr}. The current node itself may be referrenced as $this (so it is for example possible to access current node's parent by $this->parent).

label:

If this string appears at the very beginning of a pattern, the pattern may be treated specially. There are only four pattern labels valid in current version of TrEd. These are node, edge, style and root-style. Patterns labeled with any other label are ignored.

Patterns labeled as node are used to display a line of to text under each node of the tree as described above.

Patterns labeled as edge behave likewise but the text is drawn across (or beside) the edge connecting the node with its parent. It is not drawn at all for the root node.

Patterns labeled as style do not result in any text visible on the screen but are also interpolated and the result is scanned for the special tree styling instructions described bellow that may dynamically alter the appearens of the nodes, edges and text labels of the displayed trees.

Patterns labeled as root-style behave in much the same way as the style but are only interpolated once (for the root node) and the styling instructions defined here have lower precedence than those of style patterns.

#{object-feature:value}

These instructions may affect appearence of all elements of the tree. They should be used within style and root-style labeled patterns only, but may be created dynamically utilizing the <? ... ?> perl-code evaluation.

See Table 1. for list of objects, their features and possible values.

Table 1. Styling instructions

object-feature Description and a list of possible values
Node-addbeforeskip

Additional horizontal space before node in pixels

Node-addafterskip

Additional horizontal space after node in pixels

Node-disableedgelabelspace

If set the value is “yes” no additional horizontal skip for edge labels is added during positioning the node.

NodeLabel-valign

This instruction may be used only within root-style patterns. It takes one of the following values: “top”, “center”, and “bottom”. This feature specifies which side of the group of node labels should be placed towards the node. If “top” is selected (which is the default value), node labels appear bellow the node. If “bottom” is selected, node labels are displayed above the node. If the value of “center” is used, node labels are displayed across the node.

NodeLabel-halign

One of the following values may be used: “left”, “center”, and “right”. This feature specifies which side of the group of node labels should be placed towards the node. E.g, if “right” is selected (which is the default value), node labels appear left of the node.

NodeLabel-yadj

Adjust vertical position of node labels by extra amount of pixels.

NodeLabel-dodrawbox

If View->Draw boxes around labels is not selected and this instruction is set to “yes” for a given node , box is still drawn around the node's labels.

NodeLabel-nodrawbox

If View->Draw boxes around labels is selected and this instruction is set to “yes” for a given node, no box is drawn around the node's labels.

EdgeLabel-yadj

Adjust vertical position of edge labels by extra amount of pixels. The horizontal position is adjusted automatically.

EdgeLabel-halign

One of the values “right”, “center”, and “left” may be used to specify which side of the edge label should be oriented towards the edge.

EdgeLabel-valign

One of the values “top”, “center”, and “bottom” may be used to specify which side of the edge label should be oriented towards the edge.

EdgeLabel-dodrawbox

If View->Draw boxes around edge labels is not selected and this instruction is set to “yes” for a given node , box is still drawn around the node's edge labels.

EdgeLabel-nodrawbox

If View->Draw boxes around edge labels is selected and this instruction is set to “yes” for a given node, no box is drawn around the node's edge labels.

Oval-dash

Dash pattern for the outline of the point representing the node of the tree. A dash pattern is a sequence of arbitrary of the following characters “.,-_”. Space can be used to enlarge the space between other line elements, and can not occur as the first position in the string.

Oval-activedash

Dash pattern for the outline of the point when mouse is over the point. See description of Oval-dash for more information on dash patterns.

Oval-dashoffset

The starting offset (in pixels) into the pattern provided by the Oval-dash instruction.

Oval-fill

The color that fills the node.

Oval-activefill

The color to fill the node when mouse is over it.

Oval-outline

The color of the outline of the node.

Oval-activeoutline

The color of the outline of the node when mouse is over it.

Oval-width

Width of the outline of the node.

Oval-activewidth

Width of the outline of the node when mouse is over it.

Line-arrow

One of the values “first”, “both”, “last”, may be used to make arrow to be drawn on one or both sides of the edge connecting the given node with its parent.

Line-feature

Features dash, activedash, fill, activefill, width, and activewidth may be used to style the edge. Their values and meaning is similar to those of Oval, as described above.

Text<position>-fill

This feature may be used to set the color of a certain text object. The object is determined by its position which may have one of the following forms: [attribute-name], [attribute-name][n], or [attribute-name][n][m], where attribute-name is name of an attribute, n is the ordinal number of pattern which is the source of the text object and m is ordinal number of the attribute reference (${attribute-name}) within that pattern.

Text<position>-activefill

This feature may be used to set the color of a certain text object when mouse is over it. The syntax of position is as above.

TextBg<position>-feature

This instruction may be used to set features of an underlying rectangle of certain text object. The syntax of position is as above, except that only the first two forms are accepted, because text objects appearing on one line have common underlying rectangle. The following features are supported: dash, activedash, dashoffset, fill, activefill, outline, activeoutline, width, and activewidth.

TextBox-feature

This instruction may be used to set features of the frame drawn around the group of node labels. The following features are supported: dash, activedash, dashoffset, fill, activefill, outline, activeoutline, width, and activewidth.

EdgeTextBox-feature

This instruction may be used to set features of the frame drawn around the group of node's edge labels. The list of supported features is the same as that of TextBox.

The same syntax that applies to patterns applies also to the hint pattern, except that only attribute value and perl code interpolations are accepted. The hint pattern is interpolated and displayed in a floating `tool-tip' like frame whenever user positions the mouse cursor above a node and waits for a while. (The lenght of the time interval may be customized by setting the HintWait option to the desired number of milliseconds).

A pattern may be added to the pattern list by typing the pattern to the input entry in the bottom of the window and pressing the Add/Paste button. The pattern is inserted just before the pattern currently selected in the list (or to the end of the list if no pattern is selected).

To remove a pattern from the pattern list, either the Delete or Cut button may be used. In the latter case, the pattern is copied to the input entry first.

The list of attributes provides a shortcut for inserting ${attr} sequences into the input entry as well as for inserting simple patterns of the form ${attr} to the pattern list.

To insert a simple ${attr} pattern to the pattern list, select attr from the Attributes list and press the Add/Place button. If you press the Add as hint button, the pattern is inserted to the current cursor's position in the hint pattern editor.

To insert the above sequence to the current cursor's position on the entry line, double-click the attr item in the Attributes list.

Note

Note that patterns are stored in the FS files as a special sequence at the end of the file ignored by other FS-format tools (e.g. Michal Kren's Graph). If you wish to use the same pattern settings for all the files you open, you should either write a macro providing this feature, or manually append the sequence to all the FS files you use.