File: init.html

package info (click to toggle)
redet 8.26-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,696 kB
  • sloc: tcl: 38,887; makefile: 58
file content (161 lines) | stat: -rw-r--r-- 6,650 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<!--Time-stamp: <2007-03-31 14:38:54 poser> -->
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
   <META NAME="Author" CONTENT="Bill Poser">

   <TITLE>Redet Reference Manual: The Initialization File</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFE2C0" VLINK="#0000EE" LINK="#AA0066" ALINK="#FF0000">

<H2><a name="init">The Initialization File</a></H2>
<P>
On startup, <i>redet</i> attempts to read an initialization
file called <i>.redetrc</i>. It looks first in the current
working directory, then in the user's home directory.
</p>
<p>
The original initialization file format, which was supported for a time for
backwards compatibility, is no longer supported.
</p>
<p>
An initialization file consists of a Tcl program. In addition to the
primitives of the Tcl language, commands specific to the configuration of
<i>Redet</i> 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 <i>safe</i> interpreter. This means that some commands
and other facilities of the language are made unavailable for security
reasons.
</p>
<p>
A simple initialization file consists of a series of commands, most of which
set parameters. Some commands take <i>Boolean</i> arguments, that is, they say yes or no.
For example, the command <i>BalloonHelpShowP</i> is used to enable or disable
balloon help. If you want to disable balloon help, give the command:
</p>
<blockquote>
BalloonHelpShowP off
</blockquote>
<P>
You can use <i>on</i> and <i>off</i> as in this example, or a variety of
alternatives, including <i>yes</i> and <i>no</i>,
<i>t</i> and <i>f</i>, and <i>1</i> and <i>0</i>. Commands that take Boolean
arguments all have names that end in <i>P</i>.
</p>
<P>
Other commands take non-Boolean arguments. Examples are:
</p>
<pre>
PlacardBackgroundColor salmon
MenubarBackgroundColor \#C36176
BalloonHelpFontFamily  helvetica
BalloonHelpFontSize    12
BalloonHelpFontSlant    roman
BalloonHelpFontWeight    bold
BalloonHelpFontUnderline underline
AddUserPaletteEntry egrep vowels \[aeiouAEIOU\] "The English vowel letters"
</pre>
<P>
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 <i>salmon</i> or you can
indicate the color you want by specifying its mixture of red, green, and blue.
The second line exemplifies this.
</p>
<P>
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).
</p>
<P>
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 <i>roman</i> and <i>italic</i>, for weight <i>normal</i> and <i>bold</i>,
and for underlinging <i>normal</i> and <i>underline</i>. Font size is
given in points. The font family should be the name of a font family
available on your system. 
</p>
<p>
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.
</p>
<P>
The command <i>Initialization File Commands</i> on the <i>Help</i> 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 <i>Redet</i>. The commands
that are built in to <i>Tcl</i> are described in a variety of books and
web sites.
</p>
<P>
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. 
</p>
<P>
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:

<blockquote>
puts "The current time is [clock format [clock seconds]]."
</blockquote>

says to print the string <i>The current time is</i> followed by
the current time and date. The command <i>[clock seconds]</i> returns
the number of seconds since midnight, January 1, 1970. The command
<i>[clock format]</i> 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:

<blockquote>
Sun Aug 14 21:06:47 EDT 2005
</blockquote>
<p>
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. <i>\[</i>..
</p>
<P>
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:
</p>
<PRE>
if {[regexp "^ru.*" [GetLocale]]} {
   MenuFontFamily avantgarde
   MenuFontSize 12
}
</pre>


<br>
<center><a href="locale.html">Next</a></center>
<br>
<center><a href="Manual.html">Back to Table of Contents</a></center>
</body>
</html>