Permalink
Browse files

Fix handling of built-in toolbar icons

In particular, this patch ensures that built-in toolbar icons are
properly used when menus are translated.
  • Loading branch information...
1 parent 6cc607a commit 3506261522fa182c448c77395449c5fab608afaf @b4winckler committed Aug 29, 2009
Showing with 15 additions and 2 deletions.
  1. +3 −2 src/MacVim/gui_macvim.m
  2. +11 −0 src/menu.c
  3. +1 −0 src/proto/menu.pro
View
@@ -781,9 +781,10 @@
&& lookup_menu_iconfile(menu->name, fname))
icon = fname;
- // Last resort, use display name (usually signals a builtin icon)
+ // Still no icon found, try using a builtin icon. (If this also fails,
+ // then a warning icon will be displayed).
if (!icon)
- icon = menu->dname;
+ icon = lookup_toolbar_item(menu->iconidx);
}
[[MMBackend sharedInstance] queueMessage:AddMenuItemMsgID properties:
View
@@ -2859,6 +2859,17 @@ ex_macmenu(eap)
#endif
}
+
+ char_u *
+lookup_toolbar_item(idx)
+ int idx;
+{
+ if (idx >= 0 && idx < TOOLBAR_NAME_COUNT)
+ return (char_u*)toolbar_names[idx];
+
+ return NULL;
+}
+
#endif /* FEAT_GUI_MACVIM */
#endif /* FEAT_MENU */
View
@@ -22,5 +22,6 @@ void ex_menutranslate __ARGS((exarg_T *eap));
#ifdef FEAT_GUI_MACVIM
void ex_macmenu __ARGS((exarg_T *eap));
void ex_macmenukey __ARGS((exarg_T *eap));
+char_u *lookup_toolbar_item __ARGS((int idx));
#endif
/* vim: set ft=c : */

0 comments on commit 3506261

Please sign in to comment.