TMENUFile: TMenu.pressRevised: December 7, 1982 by Mark Stefik, Daniel G. Bobrow, and Chris TongThe TMENU package provides the following features:TMenus. These are interactive menus intended for reducing the amount oftyping to an Interlisp-D program. When an item is selected in a menu, an expressionis inserted into the TTY input buffer. It can be used to simplify the entry ofcommon LISP commands or long names. Windowshades. Windowshades are a modification that can be made to anywindow in order to conserve screen space. They make a window "roll up" when notin use, leaving behind only the title. When the mouse is clicked inside the remainingbar, 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 printingto the Interlisp-D prompt window. These functions take an arbitrary number ofarguments and preserve the black background shade of the window.Interaction with TMenusTMenus 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 causessome text to be inserted into the teletype buffer. In the default case, this text is just the item in thewindow, but it can alternatively be the result of evaluating an expression. In the default case, thetext is followed by a blank space in the buffer, but it can be followed alternatively by an arbitrarystring (such as the empty string or a carriage return). Non-default cases are controlled byarguments to the TMenu function.The MIDDLE mouse button is used for user-interactions that change the menu. When theyellow button is depressed inside a menu, another pop-up menu (a meta-menu!) appears thatprovides several options for changing the menu, such as adding or deleting items. One of theoptions 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 adjustthe configuration of rows and columns in order to create a menu that is visually appealing. Main FunctionsTMenu (itemExpr title displaySpec windowShadeFlg buttonFndefaultTrailerString)TMenu is the function for creating a menu in a window on the display. Its arguments are asfollows:itemExpran 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&ap ^qF ]A@Zr26W^sr:UTTV7R%6Os tr%N#GL'/K=>;I%6Fksr6DNCc@$?@7uX@= rT ;W :M 8K 67. 5x P 3@0#2 /D= -E ,<^@)< 'O & ]%"@ 9"pi @%Qvpv Zp@/rJ  t@r;#@wtr>6Lt*r@ t r#tr@ tr8 0 U=X72held 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, andthe empty string otherwise. This definition of fields for menu items is compatible with theusual 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 evaluatedto yield the list of the form described above (e.g., MYFNS). If itemExpr is a list and the firstelement 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. titleThe title of the menu. This title is used as the title of the window containing the menu.displaySpecThis 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 isa number, that number is used as the number of columns in the menu display and a minimumsize window is allocated for displaying the entire menu. The user is prompted with a ghost boxto place the menu on the display. If displaySpec is T, then the number of columns is computedby TMenu assuming a maximum of 15 rows per column and the user is prompted forplacement as before. If displaySpec is NIL, then the user is prompted to place a bounding boxfor the menu and TMenu tries to compute an arrangement of rows and columns that is visuallypleasing.windowShadeFlgIf 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 thescreen.buttonFnOptional argument that allows the caller to specify his own function for handling the LEFT andMIDDLE buttons.defaultTrailerStringOptional argument that allows the caller to specify the default string to follow each itemprinted. Can be overridden for specific items by the trailerString argument in the itemExpr. ExampleThe following expression:(TMenu 'MYFNS "Common Fns" T)would create a window titled "CommonFns" and display the list of functions in the window. Thewindow 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 themenu, then the list in the variable MYFNS would be updated as the menu is updated.MakeFileMenus (fileName)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 allgiven window shades. The argument fileName is the name of a file. Nfr@b! t r@`5&t@_r t rt r$@]2-@\@@Z"#t r@W^tr,@U=tr@TVS@R> Ot@N#rE Jt @IsrN @Gt r< t r@Fk6"@D'8@Cc&t r-@A3@@[ t r9@>E@=S :'t @8rE@7t r@5 2pt@0rH@/h , ]n? [$@Xxpvp@UMr?t%Q -Qpi @Nivp@K>r&3 ID H6G"DmDpi@ARv@AR@AR@ARp@>&rU <2@90pv890890890p@6rG@, ,<=; TIMESROMAN  TIMESROMAN TIMESROMAN  TIMESROMAN  TIMESROMAN  TIMESROMAN  TIMESROMAN ^j/ tmenu.bravoStefikDecember 7, 1982 1:46 PM