projects
/
enjoyable.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
22efc1e
)
Set mapping menu limit to 15/16, and show the number of unshown mappings in the item...
author
Joe Wreschnig
<joe.wreschnig@gmail.com>
Fri, 8 Mar 2013 23:16:07 +0000
(
00:16
+0100)
committer
Joe Wreschnig
<joe.wreschnig@gmail.com>
Fri, 8 Mar 2013 23:16:07 +0000
(
00:16
+0100)
Classes/EnjoyableApplicationDelegate.m
patch
|
blob
|
history
diff --git
a/Classes/EnjoyableApplicationDelegate.m
b/Classes/EnjoyableApplicationDelegate.m
index
aaa9f00
..
2710e3a
100644
(file)
--- a/
Classes/EnjoyableApplicationDelegate.m
+++ b/
Classes/EnjoyableApplicationDelegate.m
@@
-126,7
+126,7
@@
}
- (void)addMappingsToMenu:(NSMenu *)menu withKeys:(BOOL)withKeys atIndex:(NSInteger)index {
}
- (void)addMappingsToMenu:(NSMenu *)menu withKeys:(BOOL)withKeys atIndex:(NSInteger)index {
- static const NSUInteger MAXIMUM_ITEMS = 5;
+ static const NSUInteger MAXIMUM_ITEMS =
1
5;
int added = 0;
for (NJMapping *mapping in self.mappingsController) {
NSString *keyEquiv = (++added < 10 && withKeys) ? @(added).stringValue : @"";
int added = 0;
for (NJMapping *mapping in self.mappingsController) {
NSString *keyEquiv = (++added < 10 && withKeys) ? @(added).stringValue : @"";
@@
-137,9
+137,14
@@
item.state = mapping == self.mappingsController.currentMapping;
[menu insertItem:item atIndex:index++];
if (added == MAXIMUM_ITEMS && self.mappingsController.mappings.count > MAXIMUM_ITEMS + 1) {
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:@""];
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;
end.target = self;
[menu insertItem:end atIndex:index++];
break;