3. Menu commands

The following paragraphs describe menu commands. Each submenu in TrEd has as its first item a tear-off line (- - - - -) which can be used to tear the menu off and place it as a separate window anywhere on your desktop.

3.1. File

Open ...

Opens an existing file that the user chooses in the Open dialog box. The file may be either in the FS-format (usually a file with a .fs extension) or a file in the CSTS SGML format. In the later case, James Clark's SGML parser SP must be installed and the sgmls configuration option must point to its binary executable nsgmls, unless it can be found in PATH.

TrEd expects files in the ISO-8859-2 (ISO Latin 2) encoding (which by TrEd is transparently translated to Windows 1250 encoding and back on Microsoft Windows systems).

Close

Closes current file. If the file is modified but not saved, user is prompted to save it.

Filelist

Opens a Filelist dialog window which allows user to create, load, modify and save lists of files for browsing, editing or searching pruposes. See more detail in Section 6..

Save

Saves the active file to the disk. A backup file is created by appending a tilde `~' to the filename (which is a UNIX convention for naming backups).

Save As ...

Prompts user for a new name of the file using a standard file dialog and then performs the Save command.

Recent Files

This submenu displays ten most recently opened files. User may quickly reopen any of them by clicking on the corresponding item.

Previous File

Closes the active file (asking user to save it if modified) and opens the previous file in the current filelist (see Section 6.).

Next File

Closes the active file (asking user to save it if modified) and opens the next file in the current filelist (see Section 6.).

Print ...

Opens a Print Dialog. TrEd can only print to PostScript or Encapsulated PostScript which works fine on Unix/Linux systems (using standard lpr command). Windows users may print by printing to file and then opening the file in a PostScript interpreter (e.g. GhostView).

Encapsulated PostScript files (EPS) may be created here and used for preparation of other printed materials e.g. PDF of LaTeX documents.

  • In the Print dialog you can specify a printing command to be used or (if Print to file is checked) a filename of the destination file.

  • If Create EPS is checked, Encapsulated Postcript is created with the tightiest possible bounding box.

  • When printing, TrEd always uses a PostSript (Type1) font from a file given by the PsFontFile configuration option. TrEd cannot, however, calculate the proper dimensions and kerning of the tree from the font file, so the given font is expected to have the same or very similar metrics as the current font used on display. If it is not the case, you may specify another display font TrEd should get the metrics from, by setting the PsFontName option. The Use Type1 Postsrcipt Font button in the Print dialog must be checked to use this feature.

  • To print the `sentence' together with the tree, check the Print sentence button. A `sentence' is actually a chain consisting of values of the value-attributes (i.e. @V attributes in FS format) of all nodes in the tree.

  • It is possible to print more than one tree within one command. This is realized by entering a comma-separated list of numbers or ranges of numbers, that correspond to the desired trees or tree-ranges in the active file, to the Page range field. First tree in the file has number 1, second has number 2, etc. Ranges are pairs of numbers like `3-20' which covers all trees starting from the tree no. 3 to no. 20. If the first number in the range is omitted, 1 is assumed. If the second number in the range is ommited, the number of the last tree in the active file is assumed. The order of the trees given in the list is preserved and also, one tree may be printed more than once.

    Example:

    To print trees from 1 to 5, then trees no. 7, 11, 12 and 5 again, use e.g. one of the following lists:
    1-5,7,11,12,5
    1-5,7,11-12,5
    -5,7,11-12,5

Edit config ...

Opens a small configuration file editor (see Section 7. for the details about configuration options). To apply the new configuration, save the configuration file to disk and leave the editor press the Save and Apply button. To apply changes without saving them, press Apply. The Close button closes the editor without making any changes to the present configuration.

Note

Some configuration options even if applied take effect only after restarting TrEd.

Reload config ...

Use this command to reload the configuration file from disk and apply the new options. This command is useful if you have changed the configuration file in some other editor or in an another running instance of TrEd. As above, note, that some configuration changes still take effect only after restarting TrEd.

Quit

Exits the editor and in case that active file is modified and not yet saved, prompts the user to save it.

3.2. View

Previous Tree

Display previous tree in the current file.

Next Tree

Display next tree in the current file.

Draw boxes around labels

If this item is checked, square boxes are drawn around the group of node labels.

Draw boxes around edge labels

If this item is checked, square boxes are drawn around the group of edge attributes.

Show Hidden Nodes

Toggle displaying the hidden subtrees of the tree. If this item is checked, nodes makred as hidden using a special attribute (see FS-format description for details) and all their subtrees are also displayed.

Highlight Attributes

Toggle highlighting certain attributes with user-defined colors. See Section 7. for details on customizing colors and FS-format description to learn about how to specify which attributes are highlighted.

Sort Attributes in Dialogs

Toggle sorting attributes by name in all dialog windows displaying any form of a list of attributes or attribute values.

Close current view

Closes focused view if more than one views are present.

Split view horizontally

Create and focus a new view by splitting the current view horizontally. Sizes of the new and old view may be adjusted by dragging the thin that separats them. User may switch between views by clicking into the view he or she wants to focus. All subsequent keyboard shorcuts as well as menu and button commands are applied to the focused view. The focused view is distinguished from other views by black border drawn around it (both color and width of this border may be customized, see HighlightWindowColor and HighlightWindowWidth configuration options described bellow).

Split view vertically

Create and focus a new view by splitting the current view vertically. Sizes of the new and old view may be adjusted by dragging the thin that separats them. See also little more detailed description of Split view horizontally.

List of sentences ...

Display a window containing a list of all `sentences' based on all trees in the current file. A `sentence' is a chain consisting of values of the value-attributes (i.e. @V attributes in FS format) of all nodes in the tree.

Customize attributes

Open a dialog box in which the user can select the attributes that should be displayed and modify the way the attributes are presented. See Section 5. for more detail.

List of Named Macros...

Display a window containing a list of all user-defined macros in current context and the corresponding keyboard shortcuts. User may immediately run a macro by double-clicking a corresponding item in the list, or by pressing the Run and Close button. In the latter case, the window is closed. The Sort by name and Sort by keyboard shortcuts radio-buttons let user to switch between the two modes of ordering the list.

3.3. Node

New Node

Creates a new node and connects it as a child of the active node. All the attribute values of this node are left empty.

Remove Active Node

Passes all the children of the active node to its parent and deletes the active node. Does nothing if the active node is the root of the tree.

Insert New Tree

Inserts new tree before the current tree. The new tree consists of one empty node (its root) only.

Insert New Tree After

Inserts new tree after the current tree. The new tree consists of one empty node (its root) only.

Remove Whole Current Tree

Removes the current tree from the file and displays the following tree (or the preceding tree, in case the current tree was the last one in the file).

Edit Attributes

Displays the Edit Node Attributes dialog box with the list of all attributes defined for the file and the values assigned to them in the active node. There are two types of attributes and therefore two ways to edit them:

  1. In case of an attribute where no fixed set of possible values is given (see FS-format description for details about types of attributes) the values of the attributes are displayed in a editable line and user may change simply edit them. The usual keyboard-shortcuts for Cut (Ctrl+X), Copy (Ctrl+C) and Paste (Ctrl+V) operations may be used during the editing of the values.

  2. In case of attribute where a fixed set of possible values is given, user cannot simply edit the value entry, but to change it he/she must press the button [...] on the right of the value entry. A dialog box displays where user may select one or more (depending on the status of the multiple select check-box) values for the given attribute within the list of values from the predefined set.

Find ...

This command displays a dialog box in which user may specify a search criterion for a node search. The search is based on regular expressions, wild-card patterns or literal strings matching the desired nodes values. In the dialog, there is an entry for each defined attribute into which user may enter a regular expression, exhaustive regular expression (i.e. the pattern must match the whole value being searched), wild-card pattern (where ? matches any character and * matches any number of any characters) or a literal string (depending on the value of the Search method option-menu).

In the Search file-list option-menu, the user may choose a file-list to search through.

When user presses Find button, TrEd searches for the first matching node in the selected file-list (or current file in case the [Current file only] option was selected from the Search file-list menu). A node matches if and only if all its attributes match the given patterns. (If no pattern is given for a certain attributes, these attributes are always considered to match). If a matching node is found, this node is displayed and made active.

Find Next ...

Searches for the first node matching the criteria of the previous use of the Find ... command.

Find Previous ...

Searches for the first preceding node matching the criterion given in a previous use of the Find ... command.

3.4. Session

This menu lets user switch between currently open files and change current file-list.

TrEd allows having multiple files open. In case the user tries to open a file while another file is already open, modified, and yet not saved, TrEd offers the user to save changes in the current file and close it, close it withought saving or to keep the file open. In the latter case, the file is not closed nor any changes are discarded but the file stays open and remains in the Session menu under the Open files label. Any number of files can be simultaneously open in this way. User may resume any open file and display it in the current window by choosing the corresponding item in the Session menu.

The File lists contains a list of currently present file-lists. User may switch to another file-list by choosing the corresponding item. The lastly open file of the selected file-list is then re-opened and displayed. To edit an existing file-list, remove it or create new file-lists, user must use File->File List ....

If current file-list contains more than one file, user may use File->Previous File (or press ) and File->Next File (or press ) to open previous or next file in the file-list.

3.5. Bookmarks

This menu maintains user's bookmarks. Bookmarks are stored in an ordinary file-list named Bookmarks and consist of a file name, tree number suffix and node position.

Add Bookmars menu command is used to bookmark the current position in the file and tree.

The Last action menu command automatically opens and displayes the place where user made last change to the tree structure or a node attribute. This is special feature is realized by a special hidden bookmark which is maintained by TrEd and does not appear in the bookmark list or Bookmark file-list.

The rest of the Bookmarks menu lists all defined bookmarks. User may follow a bookmark by choosing the corresponding item.

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. If no such node exists, 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.

3.7. Help

About

Displays the About dialog where the information about version, current file name and format, number of trees, and more is given.