X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Classes%2FNJOutputController.m;h=22c387fc9490107a4bee3a0d89e8fc7ef23556bc;hp=fd160e65af84f00995c93d36b0999ad1d8f99f83;hb=6a8c6539cc3f7a4b32a9f226da6ae06074e4f0cb;hpb=24bdb92798b9abe86c7954042a47523791736b7c diff --git a/Classes/NJOutputController.m b/Classes/NJOutputController.m index fd160e6..22c387f 100644 --- a/Classes/NJOutputController.m +++ b/Classes/NJOutputController.m @@ -20,7 +20,9 @@ #import "NJOutputMouseMove.h" #import "NJOutputMouseScroll.h" -@implementation NJOutputController +@implementation NJOutputController { + NJInput *_input; +} - (id)init { if ((self = [super init])) { @@ -157,7 +159,7 @@ } - (NJOutput *)currentOutput { - return mappingsController.currentMapping[inputController.selectedInput]; + return mappingsController.currentMapping[_input]; } - (NJOutput *)makeOutput { @@ -175,7 +177,7 @@ break; case 2: { NJOutputMapping *c = [[NJOutputMapping alloc] init]; - c.mapping = mappingsController[mappingPopup.indexOfSelectedItem]; + c.mapping = mappingsController.mappings[mappingPopup.indexOfSelectedItem]; return c; } case 3: { @@ -203,7 +205,7 @@ - (void)commit { [self cleanUpInterface]; - mappingsController.currentMapping[inputController.selectedInput] = [self makeOutput]; + mappingsController.currentMapping[_input] = [self makeOutput]; [mappingsController save]; } @@ -243,7 +245,7 @@ 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]; @@ -272,8 +274,9 @@ [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 { @@ -295,11 +298,11 @@ item.representedObject = mapping; [mappingPopup.menu addItem:item]; } - [mappingPopup selectItemWithRepresentedObject:current]; + [mappingPopup selectItemWithIdenticalRepresentedObject:current]; } - (void)mappingDidChange:(NSNotification *)note { - [self loadCurrent]; + [self loadInput:_input]; } @end