projects
/
enjoyable.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
24bdb92
)
Use identity rather than equality when looking for equivalent mappings.
author
Joe Wreschnig
<joe.wreschnig@gmail.com>
Sun, 17 Mar 2013 21:25:42 +0000
(22:25 +0100)
committer
Joe Wreschnig
<joe.wreschnig@gmail.com>
Sun, 17 Mar 2013 21:25:42 +0000
(22:25 +0100)
Categories/NSMenu+RepresentedObjectAccessors.h
patch
|
blob
|
history
Categories/NSMenu+RepresentedObjectAccessors.m
patch
|
blob
|
history
Classes/NJOutputController.m
patch
|
blob
|
history
Info.plist
patch
|
blob
|
history
diff --git
a/Categories/NSMenu+RepresentedObjectAccessors.h
b/Categories/NSMenu+RepresentedObjectAccessors.h
index
ecb28a6
..
8514fcb
100644
(file)
--- a/
Categories/NSMenu+RepresentedObjectAccessors.h
+++ b/
Categories/NSMenu+RepresentedObjectAccessors.h
@@
-12,16
+12,10
@@
// Helpers for using represented objects in menu items.
- (NSMenuItem *)itemWithRepresentedObject:(id)object;
// Helpers for using represented objects in menu items.
- (NSMenuItem *)itemWithRepresentedObject:(id)object;
+- (NSMenuItem *)itemWithIdenticalRepresentedObject:(id)object;
// Returns the first menu item in the receiver that has a given
// represented object.
// Returns the first menu item in the receiver that has a given
// represented object.
-- (void)removeItemWithRepresentedObject:(id)object;
- // Removes the first menu item representing the given object in the
- // receiver.
- //
- // After it removes the menu item, this method posts an
- // NSMenuDidRemoveItemNotification.
-
- (NSMenuItem *)lastItem;
// Return the last menu item in the receiver, or nil if the menu
// has no items.
- (NSMenuItem *)lastItem;
// Return the last menu item in the receiver, or nil if the menu
// has no items.
@@
-37,10
+31,12
@@
@interface NSPopUpButton (RepresentedObjectAccessors)
- (NSMenuItem *)itemWithRepresentedObject:(id)object;
@interface NSPopUpButton (RepresentedObjectAccessors)
- (NSMenuItem *)itemWithRepresentedObject:(id)object;
+- (NSMenuItem *)itemWithIdenticalRepresentedObject:(id)object;
// Returns the first item in the receiver's menu that has a given
// represented object.
- (void)selectItemWithRepresentedObject:(id)object;
// Returns the first item in the receiver's menu that has a given
// represented object.
- (void)selectItemWithRepresentedObject:(id)object;
+- (void)selectItemWithIdenticalRepresentedObject:(id)object;
// Selects the first item in the receiver's menu that has a give
// represented object.
// Selects the first item in the receiver's menu that has a give
// represented object.
diff --git
a/Categories/NSMenu+RepresentedObjectAccessors.m
b/Categories/NSMenu+RepresentedObjectAccessors.m
index
a63f083
..
6d1c969
100644
(file)
--- a/
Categories/NSMenu+RepresentedObjectAccessors.m
+++ b/
Categories/NSMenu+RepresentedObjectAccessors.m
@@
-17,10
+17,11
@@
return nil;
}
return nil;
}
-- (void)removeItemWithRepresentedObject:(id)object {
- NSInteger idx = [self indexOfItemWithRepresentedObject:object];
- if (idx != -1)
- [self removeItemAtIndex:idx];
+- (NSMenuItem *)itemWithIdenticalRepresentedObject:(id)object {
+ for (NSMenuItem *item in self.itemArray)
+ if (item.representedObject == object)
+ return item;
+ return nil;
}
- (NSMenuItem *)lastItem {
}
- (NSMenuItem *)lastItem {
@@
-40,9
+41,18
@@
return [self.menu itemWithRepresentedObject:object];
}
return [self.menu itemWithRepresentedObject:object];
}
+- (NSMenuItem *)itemWithIdenticalRepresentedObject:(id)object {
+ return [self.menu itemWithIdenticalRepresentedObject:object];
+}
+
- (void)selectItemWithRepresentedObject:(id)object {
[self selectItemAtIndex:[self indexOfItemWithRepresentedObject:object]];
}
- (void)selectItemWithRepresentedObject:(id)object {
[self selectItemAtIndex:[self indexOfItemWithRepresentedObject:object]];
}
+- (void)selectItemWithIdenticalRepresentedObject:(id)object {
+ NSMenuItem *item = [self.menu itemWithIdenticalRepresentedObject:object];
+ [self selectItem:item];
+}
+
@end
@end
diff --git
a/Classes/NJOutputController.m
b/Classes/NJOutputController.m
index
fd160e6
..
5235837
100644
(file)
--- a/
Classes/NJOutputController.m
+++ b/
Classes/NJOutputController.m
@@
-243,7
+243,7
@@
keyInput.keyCode = [(NJOutputKeyPress*)output keyCode];
} else if ([output isKindOfClass:NJOutputMapping.class]) {
[radioButtons selectCellAtRow:2 column:0];
keyInput.keyCode = [(NJOutputKeyPress*)output keyCode];
} else if ([output isKindOfClass:NJOutputMapping.class]) {
[radioButtons selectCellAtRow:2 column:0];
- NSMenuItem *item = [mappingPopup itemWithRepresentedObject:[(NJOutputMapping *)output mapping]];
+ NSMenuItem *item = [mappingPopup itemWith
Identical
RepresentedObject:[(NJOutputMapping *)output mapping]];
[mappingPopup selectItem:item];
unknownMapping.hidden = !!item;
unknownMapping.title = [(NJOutputMapping *)output mappingName];
[mappingPopup selectItem:item];
unknownMapping.hidden = !!item;
unknownMapping.title = [(NJOutputMapping *)output mappingName];
@@
-295,7
+295,7
@@
item.representedObject = mapping;
[mappingPopup.menu addItem:item];
}
item.representedObject = mapping;
[mappingPopup.menu addItem:item];
}
- [mappingPopup selectItemWithRepresentedObject:current];
+ [mappingPopup selectItemWith
Identical
RepresentedObject:current];
}
- (void)mappingDidChange:(NSNotification *)note {
}
- (void)mappingDidChange:(NSNotification *)note {
diff --git
a/Info.plist
b/Info.plist
index
15d916e
..
393ccf5
100644
(file)
--- a/
Info.plist
+++ b/
Info.plist
@@
-46,7
+46,7
@@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>4
79
</string>
+ <string>4
82
</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>NSHumanReadableCopyright</key>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>NSHumanReadableCopyright</key>