mirror of
https://github.com/textmate/textmate.git
synced 2026-01-19 19:58:11 -05:00
Simplify NSMenu subclass
Now that the bundle menu doesn’t register any key equivalents, there is no need to manually go through all but the bundle menu to avoid having the system trigger bundle menu items.
This commit is contained in:
@@ -98,29 +98,12 @@ static CGPoint MenuPosition ()
|
||||
return YES;
|
||||
}
|
||||
|
||||
for(NSMenuItem* menuItem in [[self itemArray] reverseObjectEnumerator])
|
||||
{
|
||||
if(menuItem == bundlesMenuItem)
|
||||
{
|
||||
NSArray* bundleMenuItems = [[bundlesMenuItem submenu] itemArray];
|
||||
for(NSUInteger i = 0; i < [bundleMenuItems count]; ++i)
|
||||
{
|
||||
NSMenuItem* subMenuItem = bundleMenuItems[i];
|
||||
if(keyString == ns::create_event_string(subMenuItem.keyEquivalent, subMenuItem.keyEquivalentModifierMask))
|
||||
return [[bundlesMenuItem submenu] performActionForItemAtIndex:i], YES;
|
||||
}
|
||||
}
|
||||
else if([[menuItem submenu] performKeyEquivalent:anEvent])
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
if(keyString == "~@\uF702") // ⌥⌘⇠
|
||||
if([super performKeyEquivalent:anEvent])
|
||||
return YES;
|
||||
else if(keyString == "~@\uF702") // ⌥⌘⇠
|
||||
return [self performWindowMenuAction:@selector(selectPreviousTab:)];
|
||||
else if(keyString == "~@\uF703") // ⌥⌘⇢
|
||||
return [self performWindowMenuAction:@selector(selectNextTab:)];
|
||||
|
||||
return NO;
|
||||
}
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user