XEROX TMENU 2 4 1 TMENU 1 4 By: Mark Stefik, Daniel G. Bobrow, and Chris Tong (Stefik.pa@Xerox.com) The TMENU package provides the following features: TMenus. These are interactive menus intended for reducing the amount of typing to an Interlisp-D program. When an item is selected in a menu, an expression is inserted into the TTY input buffer. It can be used to simplify the entry of common LISP commands or long names. Windowshades. Windowshades are a modification that can be made to any window in order to conserve screen space. They make a window "roll up" when not in use, leaving behind only the title. When the mouse is clicked inside the remaining bar, the window unrolls for interaction, and rolls up again at completion. Windowshades can be used with TMenus. Msgs to the Prompt window. Two functions are provided for clearing and printing to the Interlisp-D prompt window. These functions take an arbitrary number of arguments and preserve the black background shade of the window. INTERACTION WITH TMENUS TMenus are placed on the display under program control using the functions described below.Once a menu is on the screen, items may be selected using the LEFT mouse button. This causes some text to be inserted into the teletype buffer. In the default case, this text is just the item in the window, but it can alternatively be the result of evaluating an expression. In the default case, the text is followed by a blank space in the buffer, but it can be followed alternatively by an arbitrary string (such as the empty string or a carriage return). Non-default cases are controlled by arguments to the TMenu function.The MIDDLE mouse button is used for user-interactions that change the menu. When the middle button is depressed inside a menu, another pop-up menu (a meta-menu!) appears that provides several options for changing the menu, such as adding or deleting items. One of the options is to recompute the set of items by evaluating an expression associated with the menu.The RIGHT mouse button is used for the usual window commands. These commands work inthe standard way except that when a TMenu is reshaped, internal functions are invoked to adjust the configuration of rows and columns in order to create a menu that is visually appealing. MAIN FUNCTIONS TMenu (itemExpr title displaySpec windowShadeFlg buttonFndefaultTrailerString) [Function] TMenu is the function for creating a menu in a window on the display. Its arguments are as follows: itemExpr an expression for computing the list of items that is saved with the menu. In the usual case,itemExpr is a list, whose items are either atoms or lists of the form:(displayThis evalThis comment trailerString)where displayThis is the form displayed in the menu, evalThis is the form evaluated to createthe text for the input buffer, comment is displayed in the prompt window if the LEFT button is held over an item for an extended period, and trailerString is the string inserted after anexpression in the input buffer. Most of these fields are optional. The default value for evalThisis the entry in displayThis. The default trailerString can be specified for a TMenu in thedefaultTrailerString argument above. Otherwise it is a space if the expression is an atom, and the empty string otherwise. This definition of fields for menu items is compatible with the usual set for the Interlisp-D menu package, with the addition of the trailerString field. Special cases: If itemExpr is an atom, it must be the name of a global variable to be evaluated to yield the list of the form described above (e.g., MYFNS). If itemExpr is a list and the first element of the list has a functional definition, then that function is evaluated to yield the list.This is intended for cases where the list is to be computed. title The title of the menu. This title is used as the title of the window containing the menu. displaySpec This argument has several possible interpretations that control the display of the menu. IfdisplaySpec is a region, then the window for the menu is placed in that region. If displaySpec is a number, that number is used as the number of columns in the menu display and a minimum size window is allocated for displaying the entire menu. The user is prompted with a ghost box to place the menu on the display. If displaySpec is T, then the number of columns is computed by TMenu assuming a maximum of 15 rows per column and the user is prompted for placement as before. If displaySpec is NIL, then the user is prompted to place a bounding box for the menu and TMenu tries to compute an arrangement of rows and columns that is visually pleasing. windowShadeFlg If T, the window containing the menu is augmented with a window shade so that the menu"rolls up" if not in use. If windowshadeFlg is NIL, the menu is placed in a window on the screen. buttonFn Optional argument that allows the caller to specify his own function for handling the LEFT andMIDDLE buttons. defaultTrailerString Optional argument that allows the caller to specify the default string to follow each item printed. Can be overridden for specific items by the trailerString argument in the itemExpr. EXAMPLE The following expression:(TMenu 'MYFNS "Common Fns" T) would create a window titled "CommonFns" and display the list of functions in the window. The window would contain columns of up to 15 functions each, and would be placed on the screenunder user control. If the user later used the MIDDLE button to add or delete items from the menu, then the list in the variable MYFNS would be updated as the menu is updated. MakeFileMenus (fileName) [Function] MakeFileMenus is the function for creating a set of menus for the functions and variables in afile. A window is created for each menu. The menus are placed under user control and are all given window shades. The argument fileName is the name of a file. Example If the file is MYFILE, then the fns on MYFILEFNS and the vars on MYFILEVARS would be displayed in menus. MakeFileMenus would look for file commands of the form (FNS * FnsLst)and (VARS * VarsLst) on the command. CloseFileMenus (fileName) [Function] Closes all of the TMenu windows associated with the given file. Window ShadesMakeWindowShade (window) [Function] Modifies the given window to provide a window shade. If the window argument is NIL, then the window is selected which is under the cursor. If the window argument is T, it waits for the CTRL key to be depressed, and then selects the window under the cursor.Prompt Window FunctionsPROMPT (arg1 arg2 arg3 ...)Prints an arbitrary number of arguments to the prompt window, after first clearing the window.A call with no arguments simply clears the window. CPROMPT (arg1 arg2 arg3 ...) [Function] Same as prompt except the arguments are printed centered in the window. (LIST ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC ) STARTINGPAGE# 1) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC )) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC )) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC )) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC ) STARTINGPAGE# NIL) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC )) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL)))))($$È ((È (È(ŠŠ8(ŠŠ8DÈÈ PAGEHEADING RUNNINGHEADMODERN MODERN MODERN ?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8)) MODERN MODERN MODERNLOGO HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN I3  QÅìFe¿U_ î»q½¢ÔAÅ Hlzº