Title

jprefpanel.tcl

Introduction

The jprefpanel.tcl library is distributed as part of the jstools package. It a single procedure which creates the jstools Global Preferences panel.

This document describes jprefpanel.tcl version 4.0/4.0.

Usage

Accessing the Library

In order to use the jprefpanel.tcl library, it (and any other libraries it depends on) must be in your Tcl auto_path, described in tclvars(n). Information about how to arrange that, and other conventions common to the jstools libraries, is in the Usage section of The jstools Libraries.

Credits and Copyright

Author

Jay Sekora

js@calumet.org

http://shore.net/~js/

Copyright

The library is copyright © 1992-1995 by Jay Sekora, but may be freely redistributed under the conditions at the top of the file.

Overview

Procedures

j:global_pref_panel - create the jstools Global Preferences panel

See Also

jprefs.tcl

j:global_pref_panel

Usage

j:global_pref_panel [options]

Option

-title title (localisable, default Global Preferences)

Description

This procedure creates a preference panel that lets users set preferences intended to be shared across multiple applications. Global preferences are accessed by applications as elements of the global J_PREFS array, and saved in X resource format in the file ~/.tk/defaults.

The main part of the panel contains various kinds of controls to manipulate particular preferences. At the bottom of the panel are two buttons labelled `Save' and `Done'. (Save is the default button.) The Done button simply dismisses the panel; the application will use whatever preferences are currently shown, but they will not be saved across sessions. The Save button writes the current preferences into the file ~/.tk/defaults before dismissing the panel, so that they can be read in the next time the application starts, or by other applications.

If title is specified, it will be the title of the panel, for use by the window manager.

Documentation for the Global Preferences panel itself (as opposed to the library) is available in The jstools Global Preferences Panel.

Currently, the controls available and the preferences they manipulate are:

Auto­position dialogue boxes

Checkbutton; sets J_PREFS(autoposition)

(Used by j:dialogue)

Confirm actions

Checkbutton; sets J_PREFS(confirm)

(Used by j:alert)

Fast file selector

Checkbutton; sets J_PREFS(j_fs_fast)

(Used by j:fs)

Visible Bell

Checkbutton; sets J_PREFS(visiblebell)

(Used by j:beep)

Audible Bell

Checkbutton; sets J_PREFS(audiblebell)

(Used by j:beep)

Strict Motif emulation

Checkbutton; sets J_PREFS(tk_strictMotif) and tk_strictMotif

(Used by Tk itself. Changing this preference currently has no effect until the next time the application is run; this might be considered a bug.)

Basic bindings

Radiobutton; sets J_PREFS(bindings) to basic

(Used by j:init; can also be checked by your code.)

vi bindings

Radiobutton; sets J_PREFS(bindings) to vi

(Used by j:init; can also be checked by your code.)

EDT bindings

Radiobutton; sets J_PREFS(bindings) to EDT

(Used by j:init; can also be checked by your code.)

Emacs bindings

Radiobutton; sets J_PREFS(bindings) to emacs

(Used by j:init; can also be checked by your code.)

Printer:

Entry field; sets J_PREFS(printer)

(Used by j:more; can also be used by your application. Note that in the current version of the library, it does not set the PRINTER environment variable.)

In addition to using commands in the jbindings.tcl or jinit.tcl libraries to set default text and entry bindings, your application may wish to consult the value of J_PREFS(bindings) in order to choose bindings for commands that it defines. For instance, you may wish to use `/' (a slash) to start a search if the user has selected vi or basic bindings, but Control-s if the user has selected Emacs bindings. Likewise, you might bind either `ZZ' or Control-x Control-q to save a document, depending on the user's preferred bindings.

Additional global preferences are likely to be defined in future versions of the library.

Future Directions

I want to implement a much more general preferences mechanism along the lines of that provided by Brent Welch's exmh application. Then there would be one Preferences panel available in each application, which would let the user get at application­specific preferences as well as global preferences.