XEROX SMENU 2 4 1 SMENU 1 4 Unsupported INTRODUCTION This is a brief introduction, and explanation of a new structure that is called a Super MENU, or SMENU, (pronounced ess-menu). The SMENU is an extention of the current menu package, and has many valuable features which allow the user to have greater control over the appearance of menus. To create an smenu, you follow the same steps as you would for any other datatype. For example, in developing the super menu, I found it helpful to write a function that created an smenu for me. Here is the code for that function: (SETUP [LAMBDA NIL (create SMENU (SETQ TITLE "This is a test SMENU! ") (SETQ MENUOUTLINESIZE 5) (SETQ MENUBORDERSIZE 1) (SETQ ITEMS '(((EXPANDBITMAP BM4 2 2) NIL "LUCEY MAE" (10 9 80 80)) ('(THIS IS ARBITRARY TEXT) (PRINTBELLS) "FONT FITTING" (110 59 73 105) FITFONT) ( BM5 (PRINT "YOU SELECTED SAM" "SAM" (193 230 60 40)) ( "BIG TEXT" NIL NIL (14 227 145 82) (FONTCREATE 'HELVETICAD 24 'BOLD)) ))]) What I have here is an smenu called "This is a test SMENU". This particular smenu has four items. The label for the first item is a bitmap, and as a matter of fact, the bitmap that appears in the smenu will be twice as wide, and twice as tall as the original bitmap. That is because, the super menu allows the label to be anything that evaluates to a bitmap. There is no function for this item, the help string is "LUCY MAE", and the item appears in the region (10 9 80 80), in smenu coordinates. The font element is nil since font is meaningless for bitmaps. The second and fourth items in the smenu contain text. Notice that the label for the second item is a quoted list, while the label for the fourth item is a string. Both of these methods are acceptable for initially specifying a text label, however, the string will automatically be replaced by a quoted list of atoms the first time the user displays the smenu. This saves work for the computer, and also makes editing of the text easier. Also notice that the second item has the keyword "FITFONT". This means that the font for this item will be tailored to fit into the given region, if the size of the region increases, the text will get bigger, if the region is made smaller, the text will shrink. The fourth item will have HELVETICAd 24 BOLD text. If the font element of a text item is NIL the SMENUFONT is used, initially HELVETICA 10. To use the SUPERMENU package, load the file SUPERMENUS.DCOM, use "create" to make a supermenu record (SMENU is the real name), then use the following functions. To use the SUPERMENU EDITOR, load the file SMENUEDIT.DCOM and follow the editor documentation. SUPER MENUS Super Menus The super menu is basically a variation on the current menu package. The major difference between the two is that in the menu package, the user is restricted to just rows and columns for the items in the menu. Also, the creator has little control over the shape of the region for any particular item, this region is calculated to fit the length of the longest item, or if the user puts some restriction on the lenght of the menu, the item is simply clipped to fit into the region. The super menu, or smenu (pronounced ess-menu), allows much more specialization of the individual items for the smenu, (Super MENU). There are facilities to allow the user to choose the region for the item, the font for the item, or the user can ask to have the text fitted to the region. Also, unlike the menu package, the smenu package will break the text appropriately into several lines if necessary to make it fit nicely into the given region. Smenus can be either pop up or fixed. If fixed smenus are used, the smenu must be included in a window. (SMENU SMENU POSITION) [Function] This function provides smenus that pop up when they are used. It displays SMENU at POSITION (in screen coordinates) and waits for the user to select an item with a mouse key. Since smenus allow intersecting regions, there may be more than one item selected at one time. While any key is down, all selected items are video reversed. When all keys are released, SMENU'S WHENSELECTEDFN field is called for each selected item, (in the order they appear in the item list). This function is called with three arguments: (1) the item selected, (2) the smenu, and (3) the last mouse key released (LEFT, MIDDLE, or RIGHT). SMENU returns a collection of values which are the results of calling the WHENSELECTEDFN for all of the selected items, or if there is no function associated with a particular item, theresult of evaluating its label. If no items are selected, SMENUreturns the list (NIL). If POSITION is NIL, the smenu will either be displayed at the position given by SMENU'S SMEUNPOSITION field, if it is a POSITION, or at the current cursor position otherwise. (ADDSMENU SMENU WINDOW POSITION NEWIMAGEFLG-) [Function] This function provides smenus that remain active in windows. ADDSMENU displays SMENU at POSITION, (in screen coordinates), in WINDOW. SMENU is added to the SMENU property of WINDOW. The CURSORINFN and BUTTONEVENTFN of WINDOW are replaced with SMENUBUTTONFN, so that SMENU will be active during TTY wait. RESHAPEFN of WINDOW is set to restore SMENU'S image when the window is reshaped. When an item is selected, SMENU'S WHENSELECTEDFN field is called for each selected item, (in the order they appear in the item list). This function is called with three arguments: (1) the item selected, (2) the smenu, and (3) the last mouse key released (LEFT, MIDDLE, or RIGHT). If NEWIMAGEFLG is non nil, the image for the smenu is recomputed. This is helpful during the development of the smenu, or when making changes to the smenu. ADDMENU returns the window into which SMENU was placed. (DELETESMENU SMENU CLOSEFLG FROMWINDOW) [Function] This function removes SMENU from the window FROMWINDOW. If SMENU is the only smenu in the window and the CLOSEFLG is non-NIL, its window will be closed (by CLOSEW). IF FROMWINDOW is NIL, the window is taken from the WINDOW field of SMENU. If no window is found for SMENU, DELETESMENU does nothing. Smenu Fields A smenu is a datatype with the following fields: ITEMS [Smenu Field] The list of items to appear in the smenu. The item must be a list, its CAR will be evaluated, and will appear in the smenu. If the CAR of the item is a string, it will be replaced with a list of atoms, if the CAR of the item evaluates to a bitmap, the bitmap will be displayed in the smenu. The item should consist of five elements, 1. The label for the item. 2. A form whose value is returned upon selection. 3. A help string that is printed in the prompt window when a user presses a mouse key with the cursor pointing to this item. 4. The region in the smenu that the item will occupy. 5. The font for the item, (not meaningful for bitmaps). Of these elements, only the region is mandatory, of course labels are usually desirable. Also, if the font (5) is the atom FITFONT, the text font will be chosen to "fit" in the region. WHENSELECTEDFN [Smenu Field] A function to be called when an item is selected. The function is called with three arguments: (1) the item selected, (2) the smenu, and (3) the mouse key that the item was selected with (LEFT, MIDDLE, or RIGHT). The default function DEFAULTSMENUSELEDFN evaluates and returns the value of the CADR of the item if there is one, or simply returns the result of evaluating the label of item if the CADR is NIL. WHENHELDFN [Smenu Field] The function which is called when the user has a mouse key on an item for SMENUHELDWAIT milliseconds (initially 1200). The function is called with three arguments: (1) the item selected, (2) the smenu, and (3) the mouse key that the item was selected with (LEFT, MIDDLE, or RIGHT). WHENHELDFN is intended for prompting users. The default is DEFAULTSMENUHELDFN which prints (in the prompt window) the third element of the item or, if there is not a third element, the string "Will select this item when you release the button." WHENUNHELDFN [Smenu Field] If WHENHELDFN was called, WHENUNHELDFN will be called: (1) when the cursor leaves the item, (2) when a mouse key is released, or (3) when another key is pressed. The function is called with three arguments: (1) the item selected, (2) the smenu, and (3) the mouse that the item was selected with (LEFT, MIDDLE, or RIGHT). The default WHENUNHELDFN is the function CLRPROMPT (page 19.19), which simply clears the prompt window. SMENUPOSITION [Smenu Field] The position of the smenu to be used if the call to SMENU or ADDSMENU does not specify a position. SMENUPOSITION can be used to make the smenu come up in the same place every time. SMENUFONT [Smenu Field] The font in which the items will appear in the SMENU. Default is the value of SMENUFONT, initially Helvetica 10. Individual items may override this value, (see ITEMS field). TITLE [Smenu Field] If specified, a title will appear in a line above the smenu.The title font can be specified by the user, or if not specified will be the same as SMENUFONT. TITLEFONT [Smenu Field] This field is used to specify the font to be used for the SMENU title. SMENUBORDERSIZE [Smenu Field] The size of the border around each item region. If not specified the value is set to 0 (i.e. no border is used). SMENUOUTLINESIZE [Smenu Field] The size of the outline around the entire smenu. If not specified, a maximum of 1 and the SMENUBORDERSIZE is used. The following fields should be considered read only. SMENUHEIGHT [Smenu Field] Returns the height of the entire smenu. SMENUWIDTH [Smenu Field] Returns the width of the entire smenu. Miscellaneous SMenu functions (ITEMSELECTED SMENU ITEM BUTTON) [Function] Calls SMENU'S WHENSELECTEDFN on ITEM and BUTTON. It provides a programmatic way of making a selection. It does not change the display. (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 RUNNINGHEAD(È (MODERN MODERN MODERNLOGOMODERN MODERN TERMINAL MODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN    .!!AB&B00Ì¡_  ¾i(_<§6; 1[3…68Ë%²"%$º$½!³ª"G'z'{5")#'0Š(Ò¢zº