The Initialization File

On startup, redet attempts to read an initialization file called .redetrc. It looks first in the current working directory, then in the user's home directory.

The original initialization file format, which was supported for a time for backwards compatibility, is no longer supported.

An initialization file consists of a Tcl program. In addition to the primitives of the Tcl language, commands specific to the configuration of Redet are available. For most purposes you do not need to know anything about programming in general or Tcl in particular - you can just treat the initialization file as a sequence of parameter settings - but you can make use of the Tcl interpreter if you wish to. The initialization file is read by a safe interpreter. This means that some commands and other facilities of the language are made unavailable for security reasons.

A simple initialization file consists of a series of commands, most of which set parameters. Some commands take Boolean arguments, that is, they say yes or no. For example, the command BalloonHelpShowP is used to enable or disable balloon help. If you want to disable balloon help, give the command:

BalloonHelpShowP off

You can use on and off as in this example, or a variety of alternatives, including yes and no, t and f, and 1 and 0. Commands that take Boolean arguments all have names that end in P.

Other commands take non-Boolean arguments. Examples are:

PlacardBackgroundColor salmon
MenubarBackgroundColor \#C36176
BalloonHelpFontFamily  helvetica
BalloonHelpFontSize    12
BalloonHelpFontSlant    roman
BalloonHelpFontWeight    bold
BalloonHelpFontUnderline underline
AddUserPaletteEntry egrep vowels \[aeiouAEIOU\] "The English vowel letters"

The first line is a typical color setting. The command name consists of the name of the object followed by the aspect of the object whose color is to be set. The single argument of the command is the color. You can use color names like salmon or you can indicate the color you want by specifying its mixture of red, green, and blue. The second line exemplifies this.

A numerical color specification begins with a crosshatch. Since a crosshatch has a special meaning to Tcl, it is preceded by a backslash to give it its ordinary meaning. The main part consists of three groups of two characters. The first group specifies the amount of red, the second the amount of green, and the third the amount of blue. Each pair of characters represents two hexadecimal (base 16) digits. The hexadecimal digits are: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, and F. The proportion of each primary color is therefore specified as a number ranging from 00 (0*16 + 0*1 = 0) to FF (15*16 + 15*1 = 240 + 15 = 255).

The next five lines exemplify font settings. The command name indicates what aspect of the program the font is used for and which of the five properties is set. Such commands take a single argument. The choices for slant are roman and italic, for weight normal and bold, and for underlinging normal and underline. Font size is given in points. The font family should be the name of a font family available on your system.

The last line is an example of a command for specifying a user-defined palette entry. It takes four arguments. The first is the name of the program on whose palette the entry should appear. The second is the gloss to be shown on the left hand side of the palette. The third argument is the piece of notation to be shown on the right hand side of the palette. The fourth is a description of entry.

The command Initialization File Commands on the Help menu provides a complete list of the commands that you can use in your initialization file. You can write the list out to a file or pop it up on the screen. This list contains only the commands specific to Redet. The commands that are built in to Tcl are described in a variety of books and web sites.

There are just a few things you need to know about Tcl. One is that a crosshatch begins a comment. Any line beginning with a crosshatch will be ignored. If you want to put a comment on the same line as a command, you must end the command with a semi-colon.

A second is that certain other characters have a special meaning to Tcl. If you include such characters you may unintentionally be telling Tcl to do something that you did not intend. In Tcl square-brackets enclose a command whose value replaces whatever was between the square brackets. For example, the command:

puts "The current time is [clock format [clock seconds]]."
says to print the string The current time is followed by the current time and date. The command [clock seconds] returns the number of seconds since midnight, January 1, 1970. The command [clock format] takes this value and converts it into a string representing the time and date in a more conventional manner. This string becomes part of the overall string. The result looks like this:
Sun Aug 14 21:06:47 EDT 2005

If you need to include special characters such as square-brackets in strings and want them to have their ordinary values, you can quote them with a backslash, e.g. \[..

Most initialization file settings merely set parameters. There are, however, things that it is useful to do that take advantage of the availability of a real programming language. For example, you may wish to use different fonts depending on the language you are using. Here is an init file procedure that changes the menu font to 12 point Avantgarde in Russian language locales:

if {[regexp "^ru.*" [GetLocale]]} {
   MenuFontFamily avantgarde
   MenuFontSize 12
}

Next

Back to Table of Contents