3.6. User-defined

This menu is devoted for user-defined commands. The new commands may be defined in the macro file. Here is a brief description of the few default macros defined by author of TrEd. These macros may be used in any context based on the default TredMacro context.

In the menu, there is the default keyboard shortcut displayed on the right of each command. The shortcut can be used to invoke the corresponding macro command. The mapping of the shortcuts and macros is defined in the macro file.

Note

Note that, there are no keyboards shotrcuts assigned to the standard (non-macro) menu commands, except only a few. The aim of this is to give user maximum freedom of choice of shortcuts for his/her own macro commands. There is a possibility to define bindings for many of the standard menu commands within the macro file.

Copy Values (F5)

Copies all values of the active node to an internal clipboard. These values may be pasted to any other node using the Paste Values command.

Cut Subtree (Ctrl+Insert)

Cuts the whole subtree of the active node and stores it in an iternal clipboard. It may be then pasted as a subtree of any of the remaining nodes with the Paste Subtree command.

Delete Node (F8)

Deletes active node. The node must be a leaf and must not be the root of the tree, otherwise this command is ignored.

Goto to first tree (Shift+<)

Displays the first tree in the file.

Goto to last tree (Shift+>)

Displays the last tree in the file.

Go to... (Alt+G)

Promts user to enter an ordinal number of a tree and displays it.

New Node (r-brother) (F7)

Creates new node as a right brother of the active node (does nothing if the active node is root).

New Node (son) (Shift+F7)

Creates new node as a son of the active node.

Paste Subtree (Shift+Insert)

Pastes the tree saved in an internal clipboard during the last call of the Cut Subtree command as a subtree of the active node.

Paste Values (F8)

Assignes the active nodes attribute values stored in an internal clipboard during the last call of the Copy Values command.

Perl-Search (Alt+H)

When invoked, displays a window with a small editor for Perl code. The Perl code entered by user is then evaluated for every node of the tree in the natural ordering starting from the current node. The evaluation stops on the first node for which the Perl code returns with true (i.e. a defined non-zero value). The node is then made active.

In the Perl code, the $this variable may be used to refer to the current node and $root variable may be used as a reference to the root of the tree. If $n refers to some node, then $n->{attr} is value of attr attribute for the node $n. The governor of a node $n is refered to as to Parent($n) or $n->parent, nearest left brother of $n in the tree structure is LBrother($n) or $n->lbrother; the right brother of $n is RBrother($n) or $n->rbrother. The first son of $n is referred to as to FirstSon($n) or $n->firstson. The root of the tree containing node $n can be reached with $n->root. A perl list of all child-nodes of $n may be obtained by $n->children method. If no such nodes exist, all these functions return zero `0'. Moreover, all the nodes of the tree are elements of the @nodes array (list) with the same order as they are displayed on the screen from left to right.

Note

$n->lbrother and $n->rbrother are not necesserilly displayed on left of $n.

Perl-Search Next (Alt+Shift+H)

Searches for the next node for which the Perl-expression given during the last call of Perl-Search command results in non-zero defined value.

Swap nodes (values only) (Ctrl+PageUp)

Makes the active node exchange all attribute values with its governing node.