comparison src/menu.c @ 436:a1c5a6cb2675 v7.0112

updated for version 7.0112
author vimboss
date Thu, 21 Jul 2005 21:11:17 +0000
parents f713fc55bf7b
children c8b6b7e1005d
comparison
equal deleted inserted replaced
435:73f016dbb279 436:a1c5a6cb2675
61 /* The character for each menu mode */ 61 /* The character for each menu mode */
62 static char_u menu_mode_chars[] = {'n', 'v', 'o', 'i', 'c', 't'}; 62 static char_u menu_mode_chars[] = {'n', 'v', 'o', 'i', 'c', 't'};
63 63
64 static char_u e_notsubmenu[] = N_("E327: Part of menu-item path is not sub-menu"); 64 static char_u e_notsubmenu[] = N_("E327: Part of menu-item path is not sub-menu");
65 static char_u e_othermode[] = N_("E328: Menu only exists in another mode"); 65 static char_u e_othermode[] = N_("E328: Menu only exists in another mode");
66 static char_u e_nomenu[] = N_("E329: No menu of that name"); 66 static char_u e_nomenu[] = N_("E329: No menu \"%s\"");
67 67
68 #ifdef FEAT_TOOLBAR 68 #ifdef FEAT_TOOLBAR
69 static const char *toolbar_names[] = 69 static const char *toolbar_names[] =
70 { 70 {
71 /* 0 */ "New", "Open", "Save", "Undo", "Redo", 71 /* 0 */ "New", "Open", "Save", "Undo", "Redo",
839 } 839 }
840 menu = menu->next; 840 menu = menu->next;
841 } 841 }
842 if (*name != NUL && *name != '*' && menu == NULL) 842 if (*name != NUL && *name != '*' && menu == NULL)
843 { 843 {
844 EMSG(_(e_nomenu)); 844 EMSG2(_(e_nomenu), name);
845 return FAIL; 845 return FAIL;
846 } 846 }
847 847
848 #ifdef FEAT_GUI 848 #ifdef FEAT_GUI
849 /* Want to update menus now even if mode not changed */ 849 /* Want to update menus now even if mode not changed */
932 if (*name != NUL) 932 if (*name != NUL)
933 { 933 {
934 if (menu == NULL) 934 if (menu == NULL)
935 { 935 {
936 if (!silent) 936 if (!silent)
937 EMSG(_(e_nomenu)); 937 EMSG2(_(e_nomenu), name);
938 return FAIL; 938 return FAIL;
939 } 939 }
940 940
941 941
942 /* Recalculate modes for menu based on the new updated children */ 942 /* Recalculate modes for menu based on the new updated children */
1077 } 1077 }
1078 menu = menu->next; 1078 menu = menu->next;
1079 } 1079 }
1080 if (menu == NULL) 1080 if (menu == NULL)
1081 { 1081 {
1082 EMSG(_(e_nomenu)); 1082 EMSG2(_(e_nomenu), name);
1083 vim_free(path_name); 1083 vim_free(path_name);
1084 return FAIL; 1084 return FAIL;
1085 } 1085 }
1086 name = p; 1086 name = p;
1087 parent = menu; 1087 parent = menu;
1394 #endif /* FEAT_CMDL_COMPL */ 1394 #endif /* FEAT_CMDL_COMPL */
1395 1395
1396 /* 1396 /*
1397 * Skip over this element of the menu path and return the start of the next 1397 * Skip over this element of the menu path and return the start of the next
1398 * element. Any \ and ^Vs are removed from the current element. 1398 * element. Any \ and ^Vs are removed from the current element.
1399 * "name" may be modified.
1399 */ 1400 */
1400 char_u * 1401 char_u *
1401 menu_name_skip(name) 1402 menu_name_skip(name)
1402 char_u *name; 1403 char_u *name;
1403 { 1404 {
1870 mode = get_menu_mode(); 1871 mode = get_menu_mode();
1871 if (mode == MENU_INDEX_INVALID) 1872 if (mode == MENU_INDEX_INVALID)
1872 return; 1873 return;
1873 mode = menu_mode_chars[mode]; 1874 mode = menu_mode_chars[mode];
1874 1875
1876 #ifdef FEAT_AUTOCMD
1877 {
1878 char_u ename[2];
1879
1880 ename[0] = mode;
1881 ename[1] = NUL;
1882 apply_autocmds(EVENT_MENUPOPUP, ename, NULL, FALSE, curbuf);
1883 }
1884 #endif
1885
1875 for (menu = root_menu; menu != NULL; menu = menu->next) 1886 for (menu = root_menu; menu != NULL; menu = menu->next)
1876 if (STRNCMP("PopUp", menu->name, 5) == 0 && menu->name[5] == mode) 1887 if (STRNCMP("PopUp", menu->name, 5) == 0 && menu->name[5] == mode)
1877 break; 1888 break;
1878 1889
1879 /* Only show a popup when it is defined and has entries */ 1890 /* Only show a popup when it is defined and has entries */