X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Classes%2FEnjoyableApplicationDelegate.m;h=634f3621ab9ce5f4eaeb02d65d6534971dbb5f24;hp=aaa9f00e5118ce373963795958b5445d20d7682b;hb=1d9578185de7fb08cf1f4b1e42812e87d8e18040;hpb=22efc1e5000d462091f3156ee5a8959be32cfb11 diff --git a/Classes/EnjoyableApplicationDelegate.m b/Classes/EnjoyableApplicationDelegate.m index aaa9f00..634f362 100644 --- a/Classes/EnjoyableApplicationDelegate.m +++ b/Classes/EnjoyableApplicationDelegate.m @@ -55,7 +55,6 @@ } - (void)applicationDidFinishLaunching:(NSNotification *)notification { - [self.inputController setup]; [window makeKeyAndOrderFront:nil]; } @@ -126,7 +125,7 @@ } - (void)addMappingsToMenu:(NSMenu *)menu withKeys:(BOOL)withKeys atIndex:(NSInteger)index { - static const NSUInteger MAXIMUM_ITEMS = 5; + static const NSUInteger MAXIMUM_ITEMS = 15; int added = 0; for (NJMapping *mapping in self.mappingsController) { NSString *keyEquiv = (++added < 10 && withKeys) ? @(added).stringValue : @""; @@ -137,9 +136,14 @@ item.state = mapping == self.mappingsController.currentMapping; [menu insertItem:item atIndex:index++]; if (added == MAXIMUM_ITEMS && self.mappingsController.mappings.count > MAXIMUM_ITEMS + 1) { - NSMenuItem *end = [[NSMenuItem alloc] initWithTitle:@"…" + NSString *msg = [NSString stringWithFormat:@"(and %lu more…)", + self.mappingsController.mappings.count - MAXIMUM_ITEMS]; + NSMenuItem *end = [[NSMenuItem alloc] initWithTitle:msg action:@selector(restoreWindowAndShowMappings:) keyEquivalent:@""]; + // There must be a represented object here so the item gets + // removed correctly when the menus are regenerated. + end.representedObject = self.mappingsController.mappings; end.target = self; [menu insertItem:end atIndex:index++]; break;