PREF: Application preferences module

OBSOLETE -- this needs to be reviewed

It is the object of this module to save various settings related to how an
application functions so that as the user begins to make modifications, those
settings will be saved for future instances of the program.

Preference types:
------------------------------------------

Global:
These settings would apply to all applications that use wylib.  Examples are:
  - Text font and size for each widget type (text, entry, label, etc. )
  - Background color for each widget type
  - Default print destination (line,letterhead,label)
  - Mega and regular widget internal settings
    - text key bindings
    - print destinations
    - loadby default operators
  - all class option settings (borderwidths, colors, sizes etc.)

Application:
These settings apply only to a particular application (the one you are
running when you change the setting).  Examples are:

  - All settings available in the global section, but only for the app
  - Toplevel window sizes and relative screen locations
  - Embedded pane sizes
  - Mega and regular widget internal settings.  These are unique to the
    particular niche the widget is in (each mlb in the pane would have
    a distinct set of preferences).
    - mlb display fields and their widths
    - loadby queries

Variants:
Sometimes you may want a different set of preferences depending on where
you are logging in from or what kind of display you have.  Some examples are:

  - Display resolution
    - Have a different set of font sizes for smaller screens.
    - Have a different set of default pane sizes for smaller screens.
    
  - Display name
    - Don't do dial-in screen pops unless I'm logged on in my office.
      Perhaps this is unique enough to address it specifically for that
      feature rather than as a general feature of preferences.

------------------------------------------
Widget support:

Using preferences:
Any time a widget is instantiated, it should inherit all preferences
applicable to it.  This should be available for native widgets up through
megawidgets (whole toplevels).

Widget characteristics should be applied in the following priority:

  - Settings applicable only to this display resolution
  - Settings applicable only to this (niche in this) application
  - Global settings

Saving preferences:
It would be neat to save preferences any time a settable characteristic
is changed (like right after a pane is resized).  But implementation could
be messy (trying to trap all possible resizing events).

We could save certain settings each time the widget is destroyed.  This can 
be counter-intuitive at times (killing a widget means you want to keep its 
characteristics).  But if we bind the save to an orderly close (rather than
a kill), this should work pretty well.

For some preferences we can just require the user to enter a preferences 
dialog and save changes manually.

A setting like a pane size should be settable interactively (like by
dragging a sizer bar).  Settings like font size and color should probably
be set in a preferences dialog.

------------------------------------------
Preferences can then be categorized as follows:

Automatic:
  - typically a geometry
  - or a saved widget state (such as a query or field order)
  - changed interactively (by normal widget usage)
  - saved on close
  - restored on instantiation
  - it would be nice to have a switch to indicate if a saved setting is a
    screen geometry so we can only restore it if the screen size matches
  - saved in a file called appname.widget_name.rc

Manual:
  - typically a style option: fonts, colors, borders, etc (option)
  - or a variable value (default printer, phone extension)
  - changed/saved in a preferences dialog
  - restored on instantiation
  - scope can be: global (all applications), 
                  resolution (all applications at this resolution)
                  application (this application at any resolution)
  - options which could potentially be set globally are saved in files:
                  global: all.gbl.rc
                  resolution: 1600x1200.gbl.rc
                  application: appname.gbl.rc
  - options which can only belong to a single application are in:
                  application: appname.rc

Preferences also have the following characteristics:
  - The value might be maintained in a variable
  - The value might be managed using the option command
  - The value might be maintained in a widget state (configure/cget)
    but hopefully all of these can be managed by an option too

------------------------------------------
Traditional tk options are set as follows:

  option add *Mlb*Listbox.font fixed widgetDefault
  option add *Mlb*Listbox.borderWidth 1 widgetDefault
  
A typical global variable might be initialized as follows:

  set cnf(chprnt) {C}

Instead, lets record a set of preferences for a widget as follows:

pref::init 
    -o {*Mlb*Listbox.font		font	fixed	{Listbox font:}		{What font to use inside screen widgets containing lists of text}}
    -o {*Mlb*Listbox.borderWidthv	pint	1	{Listbox border width:}	{How wide the sunken border is around screen widgets containing lists of text}}
    -o {*Mlb*Listbox.background		color	grey94	{Listbox background:}	{The background color for screen widgets containing lists of text}}
    -v {chprnt				ent	C	{Check printer:}	{The printer you write checks on}}

------------------------------------------
