comparison src/w32menu.c @ 32988:c3435dc00ed7

* lisp.h (KEYMAPP): New macro. (get_keymap): Remove. (get_keymap_1): Rename get_keymap. * keyboard.h (get_keymap_1, Fkeymapp): Remove prototype. * xterm.c (note_mode_line_highlight): Use KEYMAPP. * xmenu.c (single_submenu): Use KEYMAPP. (Fx_popup_menu): Fetch keymaps rather than checking Fkeymapp. Use KEYMAPP rather than Fkeymapp. * w32term.c (note_mode_line_highlight): Use KEYMAPP. * w32menu.c (True, False): Remove (use TRUE and FALSE instead). (Fx_popup_menu): Fetch keymaps rather than checking Fkeymapp. Use KEYMAPP rather than Fkeymapp. (single_submenu): Use KEYMAPP. (w32_menu_show, w32_dialog_show): Use TRUE. * minibuf.c (Fread_from_minibuffer): Update call to get_keymap. * keymap.c (KEYMAPP): Remove (moved to lisp.h). (Fkeymapp): Use KEYMAPP. (get_keymap): Rename from get_keymap_1. Remove old def. Return t when autoload=0 and error=0 and the keymap needs autoloading. (Fcopy_keymap): Check (eq (car x) 'keymap) rather than using Fkeymapp. (Fminor_mode_key_binding): Don't raise an error if the binding is not a keymap. (Fuse_global_map, Fuse_local_map): Allow autoloading. (Faccessible_keymaps): Fetch keymaps rather than checking Fkeymapp. * keyboard.c (read_char): get_keymap_1 -> get_keymap. Allow Vspecial_event_map to be autoloaded. (menu_bar_items): Fetch the keymap rather than using keymapp. (menu_bar_one_keymap): No need to follow func-indirect any more. (parse_menu_item): get_keymap_1 -> get_keymap. (tool_bar_items): Fetch the keymap rather than using keymapp. (read_key_sequence): Use KEYMAPP. * intervals.c (get_local_map): Use get_keymap rather than following function-indirections explicitly. * doc.c (Fsubstitute_command_keys): get_keymap_1 -> get_keymap.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 27 Oct 2000 22:20:19 +0000
parents bbd3be4db5f2
children c33b80a45f6a
comparison
equal deleted inserted replaced
32987:a2813d16337d 32988:c3435dc00ed7
50 /******************************************************************/ 50 /******************************************************************/
51 /* Definitions copied from lwlib.h */ 51 /* Definitions copied from lwlib.h */
52 52
53 typedef void * XtPointer; 53 typedef void * XtPointer;
54 typedef char Boolean; 54 typedef char Boolean;
55
56 #define True 1
57 #define False 0
58 55
59 enum button_type 56 enum button_type
60 { 57 {
61 BUTTON_TYPE_NONE, 58 BUTTON_TYPE_NONE,
62 BUTTON_TYPE_TOGGLE, 59 BUTTON_TYPE_TOGGLE,
720 title = Qnil; 717 title = Qnil;
721 GCPRO1 (title); 718 GCPRO1 (title);
722 719
723 /* Decode the menu items from what was specified. */ 720 /* Decode the menu items from what was specified. */
724 721
725 keymap = Fkeymapp (menu); 722 keymap = get_keymap (menu, 0, 0);
726 tem = Qnil; 723 if (CONSP (keymap))
727 if (CONSP (menu))
728 tem = Fkeymapp (Fcar (menu));
729 if (!NILP (keymap))
730 { 724 {
731 /* We were given a keymap. Extract menu info from the keymap. */ 725 /* We were given a keymap. Extract menu info from the keymap. */
732 Lisp_Object prompt; 726 Lisp_Object prompt;
733 keymap = get_keymap (menu);
734 727
735 /* Extract the detailed info to make one pane. */ 728 /* Extract the detailed info to make one pane. */
736 keymap_panes (&menu, 1, NILP (position)); 729 keymap_panes (&menu, 1, NILP (position));
737 730
738 /* Search for a string appearing directly as an element of the keymap. 731 /* Search for a string appearing directly as an element of the keymap.
745 if (!NILP (prompt) && menu_items_n_panes >= 0) 738 if (!NILP (prompt) && menu_items_n_panes >= 0)
746 XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME] = prompt; 739 XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME] = prompt;
747 740
748 keymaps = 1; 741 keymaps = 1;
749 } 742 }
750 else if (!NILP (tem)) 743 else if (CONSP (menu) && KEYMAPP (XCAR (menu)))
751 { 744 {
752 /* We were given a list of keymaps. */ 745 /* We were given a list of keymaps. */
753 int nmaps = XFASTINT (Flength (menu)); 746 int nmaps = XFASTINT (Flength (menu));
754 Lisp_Object *maps 747 Lisp_Object *maps
755 = (Lisp_Object *) alloca (nmaps * sizeof (Lisp_Object)); 748 = (Lisp_Object *) alloca (nmaps * sizeof (Lisp_Object));
761 supplies the menu title. */ 754 supplies the menu title. */
762 for (tem = menu, i = 0; CONSP (tem); tem = Fcdr (tem)) 755 for (tem = menu, i = 0; CONSP (tem); tem = Fcdr (tem))
763 { 756 {
764 Lisp_Object prompt; 757 Lisp_Object prompt;
765 758
766 maps[i++] = keymap = get_keymap (Fcar (tem)); 759 maps[i++] = keymap = get_keymap (Fcar (tem), 1, 0);
767 760
768 prompt = map_prompt (keymap); 761 prompt = map_prompt (keymap);
769 if (NILP (title) && !NILP (prompt)) 762 if (NILP (title) && !NILP (prompt))
770 title = prompt; 763 title = prompt;
771 } 764 }
1115 /* Loop over the given keymaps, making a pane for each map. 1108 /* Loop over the given keymaps, making a pane for each map.
1116 But don't make a pane that is empty--ignore that map instead. */ 1109 But don't make a pane that is empty--ignore that map instead. */
1117 for (i = 0; i < len; i++) 1110 for (i = 0; i < len; i++)
1118 { 1111 {
1119 if (SYMBOLP (mapvec[i]) 1112 if (SYMBOLP (mapvec[i])
1120 || (CONSP (mapvec[i]) 1113 || (CONSP (mapvec[i]) && !KEYMAPP (mapvec[i])))
1121 && NILP (Fkeymapp (mapvec[i]))))
1122 { 1114 {
1123 /* Here we have a command at top level in the menu bar 1115 /* Here we have a command at top level in the menu bar
1124 as opposed to a submenu. */ 1116 as opposed to a submenu. */
1125 top_level_items = 1; 1117 top_level_items = 1;
1126 push_menu_pane (Qnil, Qnil); 1118 push_menu_pane (Qnil, Qnil);
1732 #ifndef HAVE_MULTILINGUAL_MENU 1724 #ifndef HAVE_MULTILINGUAL_MENU
1733 if (STRING_MULTIBYTE (title)) 1725 if (STRING_MULTIBYTE (title))
1734 title = ENCODE_SYSTEM (title); 1726 title = ENCODE_SYSTEM (title);
1735 #endif 1727 #endif
1736 wv_title->name = (char *) XSTRING (title)->data; 1728 wv_title->name = (char *) XSTRING (title)->data;
1737 wv_title->enabled = True; 1729 wv_title->enabled = TRUE;
1738 wv_title->title = True; 1730 wv_title->title = TRUE;
1739 wv_title->button_type = BUTTON_TYPE_NONE; 1731 wv_title->button_type = BUTTON_TYPE_NONE;
1740 wv_title->next = wv_sep; 1732 wv_title->next = wv_sep;
1741 first_wv->contents = wv_title; 1733 first_wv->contents = wv_title;
1742 } 1734 }
1743 1735
1952 #ifdef HAVE_DIALOGS 1944 #ifdef HAVE_DIALOGS
1953 dialog_id = widget_id_tick++; 1945 dialog_id = widget_id_tick++;
1954 menu = lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv, 1946 menu = lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv,
1955 f->output_data.w32->widget, 1, 0, 1947 f->output_data.w32->widget, 1, 0,
1956 dialog_selection_callback, 0); 1948 dialog_selection_callback, 0);
1957 lw_modify_all_widgets (dialog_id, first_wv->contents, True); 1949 lw_modify_all_widgets (dialog_id, first_wv->contents, TRUE);
1958 #endif 1950 #endif
1959 1951
1960 /* Free the widget_value objects we used to specify the contents. */ 1952 /* Free the widget_value objects we used to specify the contents. */
1961 free_menubar_widget_value_tree (first_wv); 1953 free_menubar_widget_value_tree (first_wv);
1962 1954