mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Search for toolbar icons in 'runtimepath'
This commit is contained in:
@@ -1131,7 +1131,8 @@ static int MMReceiveQueueCap = 100;
|
||||
}
|
||||
|
||||
- (void)addToolbarItemToDictionaryWithLabel:(NSString *)title
|
||||
toolTip:(NSString *)tip icon:(NSString *)icon
|
||||
toolTip:(NSString *)tip
|
||||
icon:(NSString *)icon
|
||||
{
|
||||
// If the item corresponds to a separator then do nothing, since it is
|
||||
// already defined by Cocoa.
|
||||
@@ -1147,6 +1148,8 @@ static int MMReceiveQueueCap = 100;
|
||||
[item setAutovalidates:NO];
|
||||
|
||||
NSImage *img = [NSImage imageNamed:icon];
|
||||
if (!img)
|
||||
img = [[[NSImage alloc] initByReferencingFile:icon] autorelease];
|
||||
if (!img) {
|
||||
NSLog(@"WARNING: Could not find image with name '%@' to use as toolbar"
|
||||
" image for identifier '%@';"
|
||||
@@ -1163,8 +1166,10 @@ static int MMReceiveQueueCap = 100;
|
||||
[item release];
|
||||
}
|
||||
|
||||
- (void)addToolbarItemWithLabel:(NSString *)label tip:(NSString
|
||||
*)tip icon:(NSString *)icon atIndex:(int)idx
|
||||
- (void)addToolbarItemWithLabel:(NSString *)label
|
||||
tip:(NSString *)tip
|
||||
icon:(NSString *)icon
|
||||
atIndex:(int)idx
|
||||
{
|
||||
if (!toolbar) return;
|
||||
|
||||
|
||||
+12
-5
@@ -691,11 +691,6 @@ gui_mch_add_menu(vimmenu_T *menu, int idx)
|
||||
void
|
||||
gui_mch_add_menu_item(vimmenu_T *menu, int idx)
|
||||
{
|
||||
// NOTE! If 'iconfile' is not set but 'iconidx' is, use the name of the
|
||||
// menu item. (Should correspond to a stock item.)
|
||||
char_u *icon = menu->iconfile ? menu->iconfile :
|
||||
menu->iconidx >= 0 ? menu->dname :
|
||||
NULL;
|
||||
char_u *tip = menu->strings[MENU_INDEX_TIP]
|
||||
? menu->strings[MENU_INDEX_TIP] : menu->actext;
|
||||
NSArray *desc = descriptor_for_menu(menu);
|
||||
@@ -703,6 +698,18 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
|
||||
? [NSString stringWithFormat:@"%C", specialKeyToNSKey(menu->mac_key)]
|
||||
: [NSString string];
|
||||
int modifierMask = vimModMaskToEventModifierFlags(menu->mac_mods);
|
||||
char_u *icon = NULL;
|
||||
|
||||
if (menu_is_toolbar(menu->parent->name)) {
|
||||
char_u fname[MAXPATHL];
|
||||
|
||||
// TODO: Ensure menu->iconfile exists (if != NULL)
|
||||
icon = menu->iconfile;
|
||||
if (!icon && gui_find_bitmap(menu->name, fname, "bmp") == OK)
|
||||
icon = fname;
|
||||
if (!icon && menu->iconidx >= 0)
|
||||
icon = menu->dname;
|
||||
}
|
||||
|
||||
[[MMBackend sharedInstance] queueMessage:AddMenuItemMsgID properties:
|
||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
|
||||
@@ -4836,7 +4836,8 @@ ex_gui(eap)
|
||||
}
|
||||
|
||||
#if ((defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32) \
|
||||
|| defined(FEAT_GUI_PHOTON)) && defined(FEAT_TOOLBAR)) || defined(PROTO)
|
||||
|| defined(FEAT_GUI_PHOTON)) && defined(FEAT_TOOLBAR) \
|
||||
|| defined(FEAT_GUI_MACVIM)) || defined(PROTO)
|
||||
/*
|
||||
* This is shared between Athena, Motif and GTK.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user