X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Classes%2FNJOutputViewController.m;h=ee5d260b60a24333c2b24c64a55da95dba7f32ce;hp=a0f356fc38771c8756136f4f639d8daeadc5659f;hb=4fd28dc6483fd7c8323196abdbf4f1833a284e03;hpb=1d10a45acf54217e765614cd2b4667297c1f7083 diff --git a/Classes/NJOutputViewController.m b/Classes/NJOutputViewController.m index a0f356f..ee5d260 100644 --- a/Classes/NJOutputViewController.m +++ b/Classes/NJOutputViewController.m @@ -30,11 +30,6 @@ selector:@selector(mappingListDidChange:) name:NJEventMappingListChanged object:nil]; - [NSNotificationCenter.defaultCenter - addObserver:self - selector:@selector(mappingDidChange:) - name:NJEventMappingChanged - object:nil]; } return self; } @@ -157,10 +152,6 @@ [self commit]; } -- (NJOutput *)currentOutput { - return inputController.currentMapping[_input]; -} - - (NJOutput *)makeOutput { switch (radioButtons.selectedRow) { case 0: @@ -176,7 +167,8 @@ break; case 2: { NJOutputMapping *c = [[NJOutputMapping alloc] init]; - c.mapping = inputController.mappings[mappingPopup.indexOfSelectedItem]; + c.mapping = [self.delegate outputViewController:self + mappingForIndex:mappingPopup.indexOfSelectedItem]; return c; } case 3: { @@ -204,8 +196,9 @@ - (void)commit { [self cleanUpInterface]; - inputController.currentMapping[_input] = [self makeOutput]; - [inputController save]; + [self.delegate outputViewController:self + setOutput:[self makeOutput] + forInput:_input]; } - (BOOL)enabled { @@ -227,11 +220,12 @@ } - (void)loadOutput:(NJOutput *)output forInput:(NJInput *)input { + _input = input; if (!input) { - self.enabled = NO; + [self setEnabled:NO]; title.stringValue = @""; } else { - self.enabled = YES; + [self setEnabled:YES]; NSString *inpFullName = input.name; for (NJInputPathElement *cur = input.parent; cur; cur = cur.parent) { inpFullName = [[NSString alloc] initWithFormat:@"%@ ▸ %@", cur.name, inpFullName]; @@ -273,11 +267,6 @@ [self cleanUpInterface]; } -- (void)loadInput:(NJInput *)input { - _input = input; - [self loadOutput:self.currentOutput forInput:input]; -} - - (void)focusKey { if (radioButtons.selectedRow <= 1) [keyInput.window makeFirstResponder:keyInput]; @@ -300,8 +289,4 @@ [mappingPopup selectItemWithIdenticalRepresentedObject:current]; } -- (void)mappingDidChange:(NSNotification *)note { - [self loadInput:_input]; -} - @end