THE STYLESHEET PACKAGE

H. Tayloe Stansbury

edited by R. Burton 28 September 1983: added STOP button.


Stylesheets are collections of menus.  These collections pop up all at once in a block.  This block does not disappear until all menus in it have been dealt with, and the user signals that he is done.

Stylesheets are intended to be used in situations wherein the computer wants an answer to several related questions all at once.  One example is font selection.  To select a font, the user needs to specify font family (Times Roman, Helvetica, etc.), font size (8 point, 10 point, etc.), and font style (bold, italic, etc.).  Rather than prompt for each of these parameters in succession, one could use a stylesheet to prompt for it all at once.

When the stylesheet pops up, it will shade (preselect) default selections (if provided) in each of the menus.  The user can either decide that the default selections are OK, or change them to suit his taste.  (The default selection mechanism can be used to convey the current state of something the user is trying to change with the stylesheet: for example, the current looks of the text with which the user is dissatisfied.)

When the user is finished, he hits the DONE button and the stylesheet disappears, and the final selections are returned.  There is also a STOP button that if selected returns NIL from STYLESHEET and is intended to provide the user with a convenient way of aborting the selection.  Note:  This means that NIL can be returned from a call to STYLESHEET.

Not all menus in a stylesheet need be filled in.  Menus that need not be filled in have a CLEAR button, which can be used to remove selections made in that menu.  


To create a stylesheet, call
(CREATE.STYLE Prop1 Value1 Prop2 Value2 ... PropN ValueN)
CREATE.STYLE accepts an arbitrary number of property-value pairs.  Properties currently recognised are

ITEMS: A list of menus.  Most menu format parameters contained in menu records are honored by the stylesheet package.  WHENSELECTEDFNs are, of course, ignored.

SELECTIONS:  A list of menu items, each one corresponding to a menu in ITEMS.  The specified selections will be shaded in the appropriate menu, and will be the default selections.  If not specified or too short, it will be filled out with NILs (no selection).

NEED.NOT.FILL.IN:  A list of T or NIL, each one corresponding to a menu in ITEMS.  T indicates that the corresponding menu need not be filled in and will be given a clear button.  If the list is too short, it will be filled out with NILs.  If a single T or NIL is given instead of a list, it will be replaced by a list of Ts or a list of NILs, respectively.

TITLE: The title that will be given to the stylesheet.  If no title is specified, the stylesheet will not have a title bar.

POSITION:  The screen position (of type POSITION) of the lower left-hand corner of the stylesheet.  If position is not specified, the function STYLESHEET will prompt for the postion (using GETBOXPOSITION).  STYLESHEET will modify positions as necessary to ensure that the entire stylesheet will be on the screen.

Stylesheets can be modified by calling 
(STYLE.PROP Stylesheet Prop Newvalue)
STYLE.PROP always returns the old value of the specified property of the specified stylesheet.  If Newvalue is provided (even if NIL), it replaces the old value.  If not provided, the old value remains.  (Just like WINDOWPROP.)

To use the stylesheet thus created, call
(STYLESHEET Stylesheet)
This returns a list of selections the user made from the stylesheet.  (If a selection is returned as NIL, that indicates that no selection was made.)

One can determine in advance of displaying a stylesheet how big it will be.  (This may help in determining a reasonable screen position for the stylesheet.)  The relevant functions are
(STYLESHEET.IMAGEWIDTH Stylesheet)
and 
(STYLESHEET.IMAGEHEIGHT Stylesheet)
They return the width and height, respectively, of the stylesheet in pixels.



The package is located on {PHYLUM}<LISPSOURCES> in STYLESHEET.DCOM.  To familiarize yourself with its workings, you might want to load it and try the following example:

(STYLESHEET
  (CREATE.STYLE 
    'ITEMS 
      (LIST
        (CREATE MENU ITEMS ← '(TIMES% ROMAN HELVETICA GACHA))
        (CREATE MENU ITEMS ← '(8 9 10 11 12 14))
        (CREATE MENU ITEMS ← '(REGULAR BOLD ITALIC BOLD% ITALIC)))
    'SELECTIONS '(TIMES% ROMAN 11 REGULAR)
    'NEED.NOT.FILL.IN T]



Please direct all bug reports and suggestions to STANSBURY.PA.