#import "NJOutputMouseMove.h"
#import "NJOutputMouseScroll.h"
-@implementation NJOutputController
+@implementation NJOutputController {
+ NJInput *_input;
+}
- (id)init {
if ((self = [super init])) {
}
- (NJOutput *)currentOutput {
- return mappingsController.currentMapping[inputController.selectedInput];
+ return mappingsController.currentMapping[_input];
}
- (NJOutput *)makeOutput {
break;
case 2: {
NJOutputMapping *c = [[NJOutputMapping alloc] init];
- c.mapping = mappingsController[mappingPopup.indexOfSelectedItem];
+ c.mapping = mappingsController.mappings[mappingPopup.indexOfSelectedItem];
return c;
}
case 3: {
- (void)commit {
[self cleanUpInterface];
- mappingsController.currentMapping[inputController.selectedInput] = [self makeOutput];
+ mappingsController.currentMapping[_input] = [self makeOutput];
[mappingsController save];
}
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 itemWithIdenticalRepresentedObject:[(NJOutputMapping *)output mapping]];
[mappingPopup selectItem:item];
unknownMapping.hidden = !!item;
unknownMapping.title = [(NJOutputMapping *)output mappingName];
[self cleanUpInterface];
}
-- (void)loadCurrent {
- [self loadOutput:self.currentOutput forInput:inputController.selectedInput];
+- (void)loadInput:(NJInput *)input {
+ _input = input;
+ [self loadOutput:self.currentOutput forInput:input];
}
- (void)focusKey {
item.representedObject = mapping;
[mappingPopup.menu addItem:item];
}
- [mappingPopup selectItemWithRepresentedObject:current];
+ [mappingPopup selectItemWithIdenticalRepresentedObject:current];
}
- (void)mappingDidChange:(NSNotification *)note {
- [self loadCurrent];
+ [self loadInput:_input];
}
@end