while (![dockMenuBase itemAtIndex:mappingsMenuIndex - 1].isSeparatorItem)
--mappingsMenuIndex;
- [drawer open];
self.outputController.enabled = NO;
[self.inputController setup];
[self.mappingsController load];
}
- (void)eventTranslationActivated:(NSNotification *)note {
- activeButton.image = [NSImage imageNamed:@"NSStopProgressFreestandingTemplate"];
- activeMenuItem.state = [note.object translatingEvents];
[NSWorkspace.sharedWorkspace.notificationCenter
- addObserver:self
- selector:@selector(didSwitchApplication:)
- name:NSWorkspaceDidActivateApplicationNotification
- object:nil];
+ addObserver:self
+ selector:@selector(didSwitchApplication:)
+ name:NSWorkspaceDidActivateApplicationNotification
+ object:nil];
NSLog(@"Listening for application changes.");
}
- (void)eventTranslationDeactivated:(NSNotification *)note {
- activeButton.image = [NSImage imageNamed:@"NSGoRightTemplate"];
- activeMenuItem.state = [note.object translatingEvents];
[NSWorkspace.sharedWorkspace.notificationCenter
- removeObserver:self
- name:NSWorkspaceDidActivateApplicationNotification
- object:nil];
+ removeObserver:self
+ name:NSWorkspaceDidActivateApplicationNotification
+ object:nil];
NSLog(@"Ignoring application changes.");
}
while (dockMenuBase.numberOfItems > removeFrom)
[dockMenuBase removeItemAtIndex:dockMenuBase.numberOfItems - 1];
int added = 0;
- for (NJMapping *mapping in self.mappingsController.mappings) {
+ for (NJMapping *mapping in self.mappingsController) {
NSString *keyEquiv = ++added < 10 ? @(added).stringValue : @"";
[dockMenuBase addItemWithTitle:mapping.name
action:@selector(chooseMapping:)
- (void)chooseMapping:(id)sender {
NSInteger idx = [dockMenuBase indexOfItem:sender] - mappingsMenuIndex;
- NJMapping *chosen = self.mappingsController.mappings[idx];
+ NJMapping *chosen = self.mappingsController[idx];
[_mappingsController activateMapping:chosen];
}