selector:@selector(mappingListDidChange:)
name:NJEventMappingListChanged
object:nil];
- [NSNotificationCenter.defaultCenter
- addObserver:self
- selector:@selector(mappingDidChange:)
- name:NJEventMappingChanged
- object:nil];
}
return self;
}
[self commit];
}
-- (NJOutput *)currentOutput {
- return inputController.currentMapping[_input];
-}
-
- (NJOutput *)makeOutput {
switch (radioButtons.selectedRow) {
case 0:
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: {
- (void)commit {
[self cleanUpInterface];
- inputController.currentMapping[_input] = [self makeOutput];
- [inputController save];
+ [self.delegate outputViewController:self
+ setOutput:[self makeOutput]
+ forInput:_input];
}
- (BOOL)enabled {
}
- (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];
[self cleanUpInterface];
}
-- (void)loadInput:(NJInput *)input {
- _input = input;
- [self loadOutput:self.currentOutput forInput:input];
-}
-
- (void)focusKey {
if (radioButtons.selectedRow <= 1)
[keyInput.window makeFirstResponder:keyInput];
[mappingPopup selectItemWithIdenticalRepresentedObject:current];
}
-- (void)mappingDidChange:(NSNotification *)note {
- [self loadInput:_input];
-}
-
@end