{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.1/4.4.

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@aq.org
http://www.aq.org/~js/

Copyright
The library is copyright © 1992-1996 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
j:pref:string_ui - labelled UI for global variable (undocumented)
j:pref:boolean_ui - labelled UI for global variable (undocumented)
j:pref:radio_ui - labelled UI for global variable (undocumented)
j:pref:show_module - cause panel to show prefs for module
j:pref:module_ui - create pref panel for module (undocumented)
j:pref:create_panel - create a preferences panel (undocumented)
j:pref:show_panel - create and display a 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 as Tcl code 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.

j:pref:string_ui
Description
This procedure creates the user interface to control a string­valued preference.  It's mainly intended to be used by j:pref:module_ui, and is not yet documented.

j:pref:boolean_ui
Description
This procedure creates the user interface to control a boolean­valued preference.  It's mainly intended to be used by j:pref:module_ui, and is not yet documented.

j:pref:radio_ui
Description
This procedure creates the user interface to control a one­of­many preference.  It's mainly intended to be used by j:pref:module_ui, and is not yet documented.

j:pref:show_module
Usage
	j:pref:show_module [module]
Arguments
	module - the module to display

Description
This procedure displays the interface for the preferences in module, creating the panel containing module if necessary.  It's used by the option menu at the top of a preferences panel, but you can also call it from your own code.  For instance, if you had a printing panel, you might want to put a button on it that would allow the user to set printing­related preferences.

j:pref:module_ui
Description
This procedure creates the user interface corresponding to a particular preferences module.  It's mainly intended to be used by j:pref:show_panel, and is not yet documented.

j:pref:create_panel
Description
This procedure creates a preference panel, but doesn't show one of its modules.  It's intended for use by j:pref:show_panel, and is not yet documented.

j:pref:show_panel
Usage
	j:pref:show_panel panel
Arguments
	panel - the pathname of the panel to create
Example
	j:pref:show_panel .editor_prefs

Description
This procedure creates (if necessary) and displays the preferences panel panel, which should previously have been populated by preference modules by j:pref:module and j:pref:preference (both in jprefs.tcl).  The first preference module registered for panel will be displayed, with an option menu at the top of the panel for displaying the other modules in panel.
} {{{display:foreground:Red {10.287 11.0}} {jdoc:anchor:anchorname {3.0 4.0 8.0 9.0 12.0 13.0 21.0 22.0 35.0 36.0 100.0 101.0 104.0 105.0 108.0 109.0 112.0 113.0 121.0 122.0 129.0 130.0}} {sel {6.47 6.54}} {jdoc:xref:link {4.57 4.64 4.111 4.147 10.215 10.236 10.244 10.261 10.265 10.286 23.0 23.19 23.29 23.65 27.0 27.18 30.0 30.17 33.1 33.11 39.16 39.27 48.98 48.134 102.117 102.133 106.118 106.134 110.115 110.131 123.128 123.145 127.106 127.123 138.149 138.162 138.167 138.184 138.194 138.204}} {jdoc:xref:manpage {10.131 10.138}} {richtext:font:roman {2.0 3.0 4.0 4.4 4.18 4.57 4.64 4.115 4.122 6.24 6.38 8.0 9.21 10.20 10.34 10.107 10.116 10.131 10.138 10.219 10.226 10.248 10.253 10.265 10.286 10.287 11.0 12.0 14.0 15.0 15.9 16.0 16.22 18.0 19.0 21.0 23.19 23.33 23.40 24.0 24.16 24.50 25.17 25.51 26.15 26.49 27.18 27.57 28.16 28.47 29.19 29.48 29.63 30.0 30.17 30.58 31.0 32.0 33.0 33.1 33.11 35.0 37.21 37.22 37.29 38.0 39.15 39.37 39.55 41.0 42.0 42.201 42.208 42.250 42.264 44.421 44.435 46.3 46.8 48.98 48.134 52.0 53.0 53.18 53.39 54.9 54.19 56.0 57.0 57.18 57.34 58.9 58.16 60.0 61.0 61.18 61.36 62.9 62.13 64.0 65.0 65.18 65.38 66.9 66.15 68.0 69.0 69.18 69.38 70.9 70.15 72.0 73.0 73.18 73.41 73.46 73.60 76.0 77.0 77.18 77.35 77.39 77.44 78.9 78.15 80.0 81.0 81.18 81.35 81.39 81.41 82.9 82.15 84.0 85.0 85.18 85.35 85.39 85.42 86.9 86.15 88.0 89.0 89.18 89.35 89.39 89.44 90.9 90.15 92.0 93.0 93.18 93.34 94.9 94.15 94.125 94.132 96.37 96.50 96.54 96.63 96.164 96.181 96.276 96.277 96.358 96.367 96.443 96.445 96.450 96.459 96.460 96.469 100.0 102.0 102.117 102.133 104.0 106.0 106.118 106.134 108.0 110.0 110.115 110.131 112.0 114.0 114.1 114.20 114.21 114.27 115.0 116.0 116.1 116.7 118.0 119.0 119.61 119.67 119.99 119.105 121.0 123.0 123.128 123.145 125.0 127.0 127.106 127.123 129.0 131.0 131.1 131.24 132.0 133.0 133.1 133.6 134.0 136.0 137.0 138.0 138.73 138.78 138.149 138.162 138.167 138.184 138.194 138.204 138.251 138.256 138.356 138.361 139.0}} {richtext:font:italic {24.50 24.65 25.51 25.66 26.49 26.64 28.47 28.62 29.48 29.63 37.22 37.29 39.8 39.13 46.3 46.8 114.21 114.27 116.1 116.7 119.61 119.67 119.99 119.105 131.19 131.24 133.1 133.6 138.73 138.78 138.251 138.256 138.356 138.361}} {richtext:font:bold {4.4 4.18 4.57 4.64 4.115 4.122 6.24 6.38 10.20 10.34 10.219 10.226 33.1 33.11 42.250 42.264 44.421 44.435 96.37 96.50 96.54 96.63 96.358 96.367 96.450 96.459 96.460 96.469 138.194 138.204}} {richtext:font:bolditalic {10.248 10.253 10.265 10.286 48.98 48.134}} {richtext:font:typewriter {10.107 10.116 10.131 10.138 15.0 15.9 16.0 16.22 23.0 23.19 23.33 23.40 24.0 24.16 24.65 25.17 25.66 26.15 26.64 27.18 27.57 28.16 28.62 29.19 30.0 30.17 30.58 31.0 37.0 37.21 39.0 39.8 39.13 39.15 39.37 39.55 42.201 42.208 53.18 53.39 54.9 54.19 57.18 57.34 58.9 58.16 61.18 61.36 62.9 62.13 65.18 65.38 66.9 66.15 69.18 69.38 70.9 70.15 73.18 73.41 73.46 73.60 77.18 77.35 77.39 77.44 78.9 78.15 81.18 81.35 81.39 81.41 82.9 82.15 85.18 85.35 85.39 85.42 86.9 86.15 89.18 89.35 89.39 89.44 90.9 90.15 93.18 93.34 94.9 94.15 94.125 94.132 96.164 96.181 96.276 96.277 96.443 96.445 102.117 102.133 106.118 106.134 110.115 110.131 114.1 114.20 123.128 123.145 127.106 127.123 131.1 131.19 135.0 136.0 138.149 138.162 138.167 138.184}} {richtext:font:heading0 {1.0 2.0}} {richtext:font:heading1 {3.0 4.0 8.0 9.0 12.0 13.0 21.0 22.0 35.0 36.0 100.0 101.0 104.0 105.0 108.0 109.0 112.0 113.0 121.0 122.0 125.0 126.0 129.0 130.0}} {richtext:font:heading2 {9.0 9.21 10.287 11.0 13.0 14.0 18.0 19.0 22.0 23.0 32.0 33.0 36.0 37.0 38.0 39.0 41.0 42.0 101.0 102.0 105.0 106.0 109.0 110.0 113.0 114.0 115.0 116.0 118.0 119.0 122.0 123.0 126.0 127.0 130.0 131.0 132.0 133.0 134.0 135.0 137.0 138.0}} {richtext:font:heading3 {52.0 53.0 56.0 57.0 60.0 61.0 64.0 65.0 68.0 69.0 72.0 73.0 76.0 77.0 80.0 81.0 84.0 85.0 88.0 89.0 92.0 93.0}} {{} {10.248 10.261 12.0 19.0 20.0 23.0 34.0 35.0}} {jdoc:link:jstools.jdoc {4.57 4.64}} {jdoc:manpage:tclvars {10.131 10.138}} {jdoc:link:jslibraries.jdoc#Usage {10.244 10.261}} {jdoc:link:jslibraries.jdoc {10.265 10.286}} {jdoc:anchorname:Credits_and_Copyright {12.0 13.0}} {jdoc:anchorname:Introduction {3.0 4.0}} {jdoc:anchorname:Usage {8.0 9.0}} {jdoc:topic:jstools {4.57 4.64}} {jdoc:link:jslibraries.tcl {10.215 10.236}} {jdoc:anchorname:Overview {21.0 22.0}} {jdoc:link:panels/prefs.jdoc {4.111 4.147 23.29 23.65 48.98 48.134}} {jdoc:link:jprefs.tcl.jdoc {33.1 33.11 138.194 138.204}} {jdoc:anchorname:j:global_pref_panel {35.0 36.0}} {jdoc:link:#j:global_pref_panel {23.0 23.19}} {jdoc:link:localisable.jdoc {39.16 39.27}} {jdoc:link:#j:pref:show_module {27.0 27.18}} {jdoc:anchorname:j:pref:string_ui {100.0 101.0}} {jdoc:anchorname:j:pref:boolean_ui {104.0 105.0}} {jdoc:anchorname:j:pref:radio_ui {108.0 109.0}} {jdoc:anchorname:j:pref:show_module {112.0 113.0}} {jdoc:link:jprefs.tcl#j:pref:module {138.149 138.162}} {jdoc:link:#j:pref:show_panel {30.0 30.17 123.128 123.145 127.106 127.123}} {jdoc:anchorname:j:pref:show_panel {129.0 130.0}} {jdoc:link:#j:pref:module_ui {102.117 102.133 106.118 106.134 110.115 110.131}} {jdoc:anchorname:j:pref:module_ui {121.0 122.0}} {jdoc:link:jprefs.tcl.jdoc#j:pref:preference {138.167 138.184}}} {{richptr 104.0} {del_from 139.0} {matchend 139.0} {abbrevstart 138.310} {abbrevend 138.319} {insert 6.54} {del_to 4.148} {matchstart 139.0} {anchor 19.36} {emacs_mark 139.0} {current 10.210}}} {}