XEROX MULTIMENU 2 4 1 MULTIMENU 1 4 By: Eric Schoen (Schoen.pa@Xerox.com) MULTIMENU is a package which allows you to create a number of menus or windows to be associated with a main window. For example, consider an editor whose commands (menu driven) are a function of the item selected in the editor window. It is nice to have those menus which are contextually inappropriate to disappear, and to have the only appropriate menu (or menus) be highlighted in some way. (MAKEMENUS WINDOW MENULST WIDTH) [Function] WINDOW is the window to associate the menus with. MENULST is a list of menus of windows to associate. Each item in the list is an instance of the record MENULSTENTRY. The MENUITEMS field of each instance may be: ÿÿïfÿ A menu item list, in standard Interlisp-D format; ÿÿïfÿ An already created MENU; ÿÿïfÿ An already created WINDOW; ÿÿïfÿ A LITATOM which resolves to a MENU or WINDOW. For each MENULSTENTRY containing an item list, the menu will be created in a standard form: centered items and a 2 pixel border. If MENUSCROLLFLG is a number, and MENUITEMS is a list or a MENU, if the height of the menu is greater than MENUSCROLLFLG, the menu is placed in a scrolling window, limited to MENUSCROLLFLG pixels high. If WIDTH is specified, all menus are created with ITEMWIDTH=WIDTH. If not specified, MAKEMENUS calls the function \FIND-WIDEST-MENU, to determine the width for created menus. The main window gets several properties for bookkeeping; CLOSEFN and MOVEFN are set so that its subsidiary windows are also closed or moved, and RESHAPEFN becomes DON'T. The new property ITEMMENU is a list of subsidiary windows of the form (TITLE . WINDOW) where WINDOW is either a window from MENULST or the window containing a MENU from MENULST. The new property MINMENUHEIGHT keeps track of the bottom of the column of menus. (DELETEALLMENUS MAINW) [Function] Deletes all menus associated with MAINW. (CREATEWINDOWFROMBOX WIDTH HEIGHT TITLE) [Function] Uses GETBOXPOSITION to ghost a region WIDTH by HEIGHT, returning a window created at the final position, having title TITLE. (GRAYMENU MAINWINDOW MENUID #ITEMSTOGRAY) [Function] Grays out the menu. If #ITEMSTOGRAY is NIL, The window's BUTTONEVENTFN is stored away as another property so the menu is deactivated, and the menu is completely grayed over. If #ITEMSTOGRAY is a number, that number of menu items, counting from the bottom of the menu, going up, is grayed over. Grayed over items in such a partially grayed menus will not respond to selection. If #ITEMSTOGRAY is 0, UNGRAYMENU is called, instead. (UNGRAYMENU MAINWINDOW MENUID) [Function] Reactivates a (partially) grayed the menu, restoring both its appearance and original behavior. (ADDMULTIMENU MAINW NEWMENULSTENTRY WHERE) [Function] Adds a new menu to the menucolumn. WHERE list of form (FIRST), (LAST), (BEFORE ), or (AFTER ). If NIL, WHERE defaults to (LAST). (DELMULTIMENU MAINW MENUID) [Function] Deletes the menu with MENUID; all menus beneath the deleted one move up to fill up the blank space. (CHANGEMULTIMENU MAINW OLDMENUID NEWMENUID) [Function] Deletes the oldmenu and replaces it with the new one. (MENUEXISTS MAINW MENUID) [Function] Returns T if there is a menu with MENUID associated with MAINW. (MAKETTYWINDOW MAINW TTYH) [Function] Makes a TTY window associated with window MAINW. This window will be as wide as MAINW plus the WIDTH of the menucolumn associated with MAINW, and will be TTYH (default \TTYHEIGHT) high. The window is located directly below MAINW. (WINDOWDOFUN WINDOW FN) [Function] An NLAMBDA. Resets the TTYDISPLAYSTREAM to WINDOW (if NIL, creates one with MAKETTYWINDOW) and evaluates FN. (\MAKEMENU WINDOW MENULSTENTRY WIDTH) [Function] Puts up the individual menus or windows. (\FIND-WIDEST-MENU MENULST) [Function] Scans MENULST to determine the widest menu or window. (\FIND-MENUCOLUMN-HEIGHT MENULST) [Function] Like above, only returns the height of the column of menus to be created from MENULST. (\MENUCLOSEFN WINDOW) [Function] The function put on the main window's CLOSEFN property, to close the subsidiary menus/windows. (\MENUMOVEFN WINDOW) [Function] Like above, but for the MOVEFN property. Uses RELMOVEW to retain the same relative position between the main window and subsidiary windows after the move. The record template MENULSTENTRY is defined as (RECORD MENULSTENTRY (MENUITEMS MENUTITLE SELECTEDFN MENUID MENUSCROLLFLG)). If MENUID is NIL, it receives the value of MENUTITLE. MENUSCROLLFLG is either NIL : Never scroll; a NUMBER : Limit the menu to NUMBER pixels high, and make it scroll. If menu is shorter than NUMBER pixels, a standard (non-scrolling) menu is created. BOTTOMJUSTIFY : Make the window no higher than the height left at the bottom of the current menucolumn; the menu is made scrollable if its "natural" height is clipped at all. (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 )) (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  TIMESROMAN MODERN MODERN MODERNLOGO  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN   HRULE.GETFNMODERN  HRULE.GETFNMODERN 'š 51fÇÀ))9„9Š5/b9”-d:6+@,ó)r5)-62Y(d'£Íš ¨ {zº