tpad help

Configuration

You can configure tpad by editing the file tpad.conf. This file uses the Tcl(n) syntax. Tcl provides a good reconfigurability but when editing tpad.conf you must be care not to make any syntax error otherwise tpad won't start. It is advisable to make a backup copy of tpad.conf before modifying it or to make changes to a copy of tpad.conf and check the syntax by running it with the Tcl interpreter before overwriting the real tpad.conf with it. To do those things you should use commands similar to the following:

$ cp tpad.conf tpad.conf.default
$ cp tpad.conf tpad.conf.copy
... editing tpad.conf.copy
$ tclsh8.4 tpad.conf.copy
$ mv tpad.conf.copy tpad.conf

If you want to make changes only for a single user, instead of modifying the global configuration file, you can copy it as a hidden per user configuration file named ~/.tpadrc and make changes only here. If something goes wrong and tpad doesn't start anymore, you can simply delete ~/.tpadrc and start again.

When you run tpad it will first search for ~/.tpadrc; if it can't find this, it will try to load the global configuration file tpad.conf, so ~/.tpadrc completely overrides tpad.conf.

This is the default global configuration file shipped with this version:

## Configuration file for tpad version 1.1
# Win95/98 (TM) Notepad clone written in Tcl/Tk
#
# You can safely change global constants and default values
# of global variables below as long as you make no syntax errors.
# See Tcl(n) for a summary of Tcl language syntax.
#
# Please report any bug found to the author.
#
# author: Antonio Bonifati <http://go.to/ninuzzo>
# distributed under GNU GPL
## last revised on: $Date: 2004/01/03 22:00 $

## initialize global constants
set tpad(version) 1.1
# file types listbox entries
set tpad(types) {
  {{All Files}      *                         }
  {{Text Files}     {.txt .text}              }
  {{HTML Files}     {.html .htm .shtml .xhtml}}
  {{XML Files}      .xml                      }
  {{TCL Scripts}    .tcl                      }
  {{C Source Files} {.c .h}                   }
}
set tpad(tearoff) no   ;# include tearoff in pulldown menus (no, yes)
set tpad(fg) black     ;# text and entry foreground color
set tpad(bg) white     ;# text and entry background color
set tpad(selfg) white  ;# selection foreground color
set tpad(selbg) navy   ;# selection background color
set tpad(font) Courier ;# font to use (a fixed size font is recommended)
set tpad(lpr) lpr      ;# lpr(1) like command and options \
                          to use for off line printing
set tpad(logfac) yes   ;# turn on log creation facility (no, yes)
set tpad(timefmt) %c   ;# date and time format
# command to run an external browser to read the HTML help
set tpad(browsercmd) mozilla
# path to where the HTML documentation lives
set tpad(helpath) /usr/local/share/doc/tpad
set tk_strictMotif 0   ;# strict Motif compliance (0, 1)
## end of global constants initialization

## initialize global vars to default values
set tpad_wrap none   ;# wrap mode (none, word)
set tpad_pattern {}  ;# search pattern
set tpad_dir down    ;# search direction (up, down)
set tpad_case no     ;# case sensitive search (no, yes)
## end of global var initialization

Even though you don't know Tcl, you should not have too much trouble to change the configuration file to suit your needs. Here are some notes about every constant or variable to help you a bit. The possible values a variable may assume are bracketed. If you get stuck at something contact me, but first please read this page and the Tcl documentation referenced here, and try to fix things yourself :-)

When speaking of boolean values, no is the same as 0 and yes is the same as 1. If you need to set a variable to a string which has more than one word in it, remember to use the open braces around (e.g. {word1 word2}) otherwise Tcl will complain.

tpad(version) [version number]
This states what version tpad is. Unless you are a developer, you shouldn't change this.
tpad(types) [nested Tcl lists]
This option defines the file types in the file types listbox of a file dialog. You should not have too much problems editing this following the example. For details, see tk_getOpenFile(n) or tk_getSaveFile(n), especially the section titled SPECIFYING FILE PATTERNS.
tpad(tearoff) [no,yes]
Specifies whether or not the menu should include a tear-off entry at the top. A tear-off appears as a dashed line at the top of the menu. Invoking the tear-off entry causes a torn-off copy to be made of the menu and all of its submenus.
tpad(fg) [color name]
Text foreground color. See colors(n). I prefer black on white as on paper. Just make sure there is enough contrast.
tpad(bg) [color name]
Text background color. Ditto.
tpad(selfg) [color name]
Selection foreground color. Ditto.
tpad(selbg) [color name]
Selection background color. Ditto.
tpad(font) [font desc]
Choose the font and size to use. If you want to change this you should read the font(n) manual page (skip at section FONT DESCRIPTION if you are in a hurry).
tpad(lpr) [shell command]
This command will be invoked by the Print option in the File menu to send tpad's buffer to a printer. It must be a filter program. Under Unix you can use lpr(1). See this manpage for a description of the option you can add. For example under FreeBSD if you want to use pr(1) to paginate the output you can make this variabile value as {lpr -p}
tpad(logfac) [no,yes]
Turn log creation facility on/off. Log creation facility is on by default, which is useful to people who need to write log or diary files. If for some reasons you don't want it, set this to no.
tpad(timefmt) [time description]
A string that describes how the date and time inserted by the Edit/Date/Time menu option are to be formatted. Please refer to the clock(n) manual page (see the help about the clock format subcommand). The default value is %c which stands for a locale specific date and time format.
tpad(browsercmd) [command line]
This command will be used to run an external browser when the Help option under the Help menu is selected. You can also use command line options understood by the browser of your choice here.
tpad(helpath) [directory path]
This must be set to the path to the directory where are located these HTML help files. The index page file name (index.html) will be concatenated with this path and the resulting argument will be the last argument passed to the command specified by the previous constant tpad(browsercmd).
tk_strictMotif [0,1]
If set to 1 requires strict Motif compliance. It is better to leave it to 0 because it may affect some key bindings. For example if its value is 1, Control-h won't work. You can find more information by reading the manpage Tk_StrictMotif(3).
tpad_wrap [none,word]
Specifies how to handle lines in the text that are too long to be displayed in a single line of the text's window. The value must be none or word. A wrap mode of none means that each line of text appears as exactly one line on the screen; extra characters that don't fit on the screen are not displayed. In the word mode each line of text will be broken up into several screen lines if necessary to keep all the characters visible and a line break will only be made at word boundaries.
tpad_pattern [string]
What search pattern do you want for default? If none use the empty string here.
tpad_dir [up,down]
What search direction do you prefer for default? You will be alerted when a search gets to the beginning or the end of the file.
tpad_case [no,yes]
Do you prefer case sensitive or insensitive search for default? What kind do you need most of the time?

Return to Contents