From d0f4d54bb9eb66cbd19fa4dabb56fc09f42bd22d Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Sun, 3 Mar 2013 23:49:27 +0100 Subject: [PATCH] Rename the application delegate, and hopefully catch the last vestiges of the old names. --- English.lproj/MainMenu.xib | 231 +----------------- Enjoyable.xcodeproj/project.pbxproj | 78 +++--- ...roller.h => EnjoyableApplicationDelegate.h | 8 +- ...roller.m => EnjoyableApplicationDelegate.m | 60 +++-- NJInputController.h => NJDeviceController.h | 4 +- NJInputController.m => NJDeviceController.m | 12 +- NJMappingsController.m | 12 +- NJOutput.h | 4 +- NJOutput.m | 2 +- NJOutputController.h | 4 +- NJOutputController.m | 2 +- NJOutputMapping.m | 4 +- NJOutputMouseMove.m | 4 +- NJOutputMouseScroll.m | 2 +- NJOutputSwitchMouseMode.m | 8 +- 15 files changed, 107 insertions(+), 328 deletions(-) rename ApplicationController.h => EnjoyableApplicationDelegate.h (73%) rename ApplicationController.m => EnjoyableApplicationDelegate.m (72%) rename NJInputController.h => NJDeviceController.h (84%) rename NJInputController.m => NJDeviceController.m (96%) diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 8dd62bf..1a87bd7 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -1125,13 +1125,13 @@ - ApplicationController + EnjoyableApplicationDelegate NJMappingsController - NJInputController + NJDeviceController NJOutputController @@ -2237,147 +2237,6 @@ - - ApplicationController - NSObject - - toggleActivity: - id - - - toggleActivity: - - toggleActivity: - id - - - - NSToolbarItem - NSMenuItem - ConfigsController - NSMenu - NSDrawer - JoystickController - NSWindow - TargetController - - - - activeButton - NSToolbarItem - - - activeMenuItem - NSMenuItem - - - configsController - ConfigsController - - - dockMenuBase - NSMenu - - - drawer - NSDrawer - - - jsController - JoystickController - - - mainWindow - NSWindow - - - targetController - TargetController - - - - IBProjectSource - ./Classes/ApplicationController.h - - - - ConfigsController - NSObject - - id - id - id - id - - - - addPressed: - id - - - exportPressed: - id - - - importPressed: - id - - - removePressed: - id - - - - NSButton - NSTableView - TargetController - - - - removeButton - NSButton - - - tableView - NSTableView - - - targetController - TargetController - - - - IBProjectSource - ./Classes/ConfigsController.h - - - - JoystickController - NSObject - - ConfigsController - NSOutlineView - TargetController - - - - configsController - ConfigsController - - - outlineView - NSOutlineView - - - targetController - TargetController - - - - IBProjectSource - ./Classes/JoystickController.h - - NJKeyInputField NSTextField @@ -2397,92 +2256,6 @@ ./Classes/NJKeyInputField.h - - TargetController - NSObject - - id - id - id - id - id - - - - configChosen: - id - - - mbtnChanged: - id - - - mdirChanged: - id - - - radioChanged: - id - - - sdirChanged: - id - - - - NSPopUpButton - ConfigsController - JoystickController - NJKeyInputField - NSSegmentedControl - NSSegmentedControl - NSMatrix - NSSegmentedControl - NSTextField - - - - configPopup - NSPopUpButton - - - configsController - ConfigsController - - - joystickController - JoystickController - - - keyInput - NJKeyInputField - - - mouseBtnSelect - NSSegmentedControl - - - mouseDirSelect - NSSegmentedControl - - - radioButtons - NSMatrix - - - scrollDirSelect - NSSegmentedControl - - - title - NSTextField - - - - IBProjectSource - ./Classes/TargetController.h - - 0 diff --git a/Enjoyable.xcodeproj/project.pbxproj b/Enjoyable.xcodeproj/project.pbxproj index c633833..ccdd256 100644 --- a/Enjoyable.xcodeproj/project.pbxproj +++ b/Enjoyable.xcodeproj/project.pbxproj @@ -27,9 +27,9 @@ D5617FE70FAFDB5800928B3A /* NJKeyInputField.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617FE60FAFDB5800928B3A /* NJKeyInputField.m */; }; D594BE860FAE6219007A85F2 /* NJDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = D594BE850FAE6219007A85F2 /* NJDevice.m */; }; D594BE8A0FAE64AD007A85F2 /* NJInput.m in Sources */ = {isa = PBXBuildFile; fileRef = D594BE890FAE64AD007A85F2 /* NJInput.m */; }; - D594BEF90FAE6FF2007A85F2 /* NJInputController.m in Sources */ = {isa = PBXBuildFile; fileRef = D594BEF80FAE6FF2007A85F2 /* NJInputController.m */; }; + D594BEF90FAE6FF2007A85F2 /* NJDeviceController.m in Sources */ = {isa = PBXBuildFile; fileRef = D594BEF80FAE6FF2007A85F2 /* NJDeviceController.m */; }; D594BF000FAE7397007A85F2 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D594BEFF0FAE7397007A85F2 /* IOKit.framework */; }; - D594BF830FAE9661007A85F2 /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = D594BF820FAE9661007A85F2 /* ApplicationController.m */; }; + D594BF830FAE9661007A85F2 /* EnjoyableApplicationDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D594BF820FAE9661007A85F2 /* EnjoyableApplicationDelegate.m */; }; D5F809710FB093400006A4DE /* NJOutputMapping.m in Sources */ = {isa = PBXBuildFile; fileRef = D5F809700FB093400006A4DE /* NJOutputMapping.m */; }; D5F80A9D0FB0A2FF0006A4DE /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = D5617A080FAEAF8300928B3A /* icon.icns */; }; EE1D7C9216E01E7000B000EB /* NSView+FirstResponder.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1D7C9116E01E7000B000EB /* NSView+FirstResponder.m */; }; @@ -78,11 +78,11 @@ D594BE850FAE6219007A85F2 /* NJDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJDevice.m; sourceTree = ""; }; D594BE880FAE64AD007A85F2 /* NJInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJInput.h; sourceTree = ""; }; D594BE890FAE64AD007A85F2 /* NJInput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJInput.m; sourceTree = ""; }; - D594BEF70FAE6FF2007A85F2 /* NJInputController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJInputController.h; sourceTree = ""; }; - D594BEF80FAE6FF2007A85F2 /* NJInputController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJInputController.m; sourceTree = ""; }; + D594BEF70FAE6FF2007A85F2 /* NJDeviceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJDeviceController.h; sourceTree = ""; }; + D594BEF80FAE6FF2007A85F2 /* NJDeviceController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJDeviceController.m; sourceTree = ""; }; D594BEFF0FAE7397007A85F2 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; - D594BF810FAE9661007A85F2 /* ApplicationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationController.h; sourceTree = ""; }; - D594BF820FAE9661007A85F2 /* ApplicationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationController.m; sourceTree = ""; }; + D594BF810FAE9661007A85F2 /* EnjoyableApplicationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EnjoyableApplicationDelegate.h; sourceTree = ""; }; + D594BF820FAE9661007A85F2 /* EnjoyableApplicationDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EnjoyableApplicationDelegate.m; sourceTree = ""; }; D5F8096F0FB093400006A4DE /* NJOutputMapping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJOutputMapping.h; sourceTree = ""; }; D5F809700FB093400006A4DE /* NJOutputMapping.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJOutputMapping.m; sourceTree = ""; }; EE1D7C9016E01E7000B000EB /* NSView+FirstResponder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSView+FirstResponder.h"; sourceTree = ""; }; @@ -109,44 +109,43 @@ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( - D5617D290FAF579A00928B3A /* NJInputAnalog.h */, - D5617D2A0FAF579A00928B3A /* NJInputAnalog.m */, + D594BF810FAE9661007A85F2 /* EnjoyableApplicationDelegate.h */, + D594BF820FAE9661007A85F2 /* EnjoyableApplicationDelegate.m */, + D594BEF70FAE6FF2007A85F2 /* NJDeviceController.h */, + D594BEF80FAE6FF2007A85F2 /* NJDeviceController.m */, + D5617A340FAEB74000928B3A /* NJMappingsController.h */, + D5617A350FAEB74000928B3A /* NJMappingsController.m */, + D5617FE20FAFD7B000928B3A /* NJOutputController.h */, + D5617FE30FAFD7B000928B3A /* NJOutputController.m */, + D5617FE50FAFDB5800928B3A /* NJKeyInputField.h */, + D5617FE60FAFDB5800928B3A /* NJKeyInputField.m */, + D5617A370FAEBA1800928B3A /* NJMapping.h */, + D5617A380FAEBA1800928B3A /* NJMapping.m */, D594BE840FAE6219007A85F2 /* NJDevice.h */, D594BE850FAE6219007A85F2 /* NJDevice.m */, + EEF86B7316E2241000674B87 /* NJInputPathElement.h */, D594BE880FAE64AD007A85F2 /* NJInput.h */, D594BE890FAE64AD007A85F2 /* NJInput.m */, - D5617D240FAF579300928B3A /* NJInputHat.h */, - D5617D250FAF579300928B3A /* NJInputHat.m */, + D5617D290FAF579A00928B3A /* NJInputAnalog.h */, + D5617D2A0FAF579A00928B3A /* NJInputAnalog.m */, D5617D180FAF568100928B3A /* NJInputButton.h */, D5617D190FAF568100928B3A /* NJInputButton.m */, - D594BEF70FAE6FF2007A85F2 /* NJInputController.h */, - D594BEF80FAE6FF2007A85F2 /* NJInputController.m */, - D594BF810FAE9661007A85F2 /* ApplicationController.h */, - D594BF820FAE9661007A85F2 /* ApplicationController.m */, - D5617A340FAEB74000928B3A /* NJMappingsController.h */, - D5617A350FAEB74000928B3A /* NJMappingsController.m */, - D5617A370FAEBA1800928B3A /* NJMapping.h */, - D5617A380FAEBA1800928B3A /* NJMapping.m */, - D5F8096F0FB093400006A4DE /* NJOutputMapping.h */, - D5F809700FB093400006A4DE /* NJOutputMapping.m */, + D5617D240FAF579300928B3A /* NJInputHat.h */, + D5617D250FAF579300928B3A /* NJInputHat.m */, D5617FD40FAFD06000928B3A /* NJOutput.h */, D5617FD50FAFD06000928B3A /* NJOutput.m */, D5617FD70FAFD1E600928B3A /* NJOutputKeyPress.h */, D5617FD80FAFD1E600928B3A /* NJOutputKeyPress.m */, - D5617FE20FAFD7B000928B3A /* NJOutputController.h */, - D5617FE30FAFD7B000928B3A /* NJOutputController.m */, - D5617FE50FAFDB5800928B3A /* NJKeyInputField.h */, - D5617FE60FAFDB5800928B3A /* NJKeyInputField.m */, - 8BD9B54115C230FE00929C5D /* NJOutputMouseMove.h */, - 8BD9B54215C230FE00929C5D /* NJOutputMouseMove.m */, + D5F8096F0FB093400006A4DE /* NJOutputMapping.h */, + D5F809700FB093400006A4DE /* NJOutputMapping.m */, 8B7E476A15C314A200C588FA /* NJOutputMouseButton.h */, 8B7E476B15C314A200C588FA /* NJOutputMouseButton.m */, + 8BD9B54115C230FE00929C5D /* NJOutputMouseMove.h */, + 8BD9B54215C230FE00929C5D /* NJOutputMouseMove.m */, 8BEFAD9A15C46BFF00823AEC /* NJOutputMouseScroll.h */, 8BEFAD9B15C46BFF00823AEC /* NJOutputMouseScroll.m */, 8BEFAD9E15C476DC00823AEC /* NJOutputSwitchMouseMode.h */, 8BEFAD9F15C476DC00823AEC /* NJOutputSwitchMouseMode.m */, - EEF86B7316E2241000674B87 /* NJInputPathElement.h */, - EEF86B7416E298CD00674B87 /* NJEvents.h */, ); name = Classes; sourceTree = ""; @@ -181,6 +180,7 @@ isa = PBXGroup; children = ( 080E96DDFE201D6D7F000001 /* Classes */, + EE1D5F8B16E403D600749C36 /* Categories */, 29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97317FDCFA39411CA2CEA /* Resources */, 29B97323FDCFA39411CA2CEA /* Frameworks */, @@ -192,12 +192,9 @@ 29B97315FDCFA39411CA2CEA /* Other Sources */ = { isa = PBXGroup; children = ( - 32CA4F630368D1EE00C91783 /* Enjoyable_Prefix.pch */, 29B97316FDCFA39411CA2CEA /* main.m */, - EE1D7C9416E0ECCF00B000EB /* NSError+Description.h */, - EE1D7C9516E0ECCF00B000EB /* NSError+Description.m */, - EE1D7C9016E01E7000B000EB /* NSView+FirstResponder.h */, - EE1D7C9116E01E7000B000EB /* NSView+FirstResponder.m */, + EEF86B7416E298CD00674B87 /* NJEvents.h */, + 32CA4F630368D1EE00C91783 /* Enjoyable_Prefix.pch */, ); name = "Other Sources"; sourceTree = ""; @@ -223,6 +220,17 @@ name = Frameworks; sourceTree = ""; }; + EE1D5F8B16E403D600749C36 /* Categories */ = { + isa = PBXGroup; + children = ( + EE1D7C9416E0ECCF00B000EB /* NSError+Description.h */, + EE1D7C9516E0ECCF00B000EB /* NSError+Description.m */, + EE1D7C9016E01E7000B000EB /* NSView+FirstResponder.h */, + EE1D7C9116E01E7000B000EB /* NSView+FirstResponder.m */, + ); + name = Categories; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -293,8 +301,8 @@ 8D11072D0486CEB800E47090 /* main.m in Sources */, D594BE860FAE6219007A85F2 /* NJDevice.m in Sources */, D594BE8A0FAE64AD007A85F2 /* NJInput.m in Sources */, - D594BEF90FAE6FF2007A85F2 /* NJInputController.m in Sources */, - D594BF830FAE9661007A85F2 /* ApplicationController.m in Sources */, + D594BEF90FAE6FF2007A85F2 /* NJDeviceController.m in Sources */, + D594BF830FAE9661007A85F2 /* EnjoyableApplicationDelegate.m in Sources */, D5617A360FAEB74000928B3A /* NJMappingsController.m in Sources */, D5617A390FAEBA1800928B3A /* NJMapping.m in Sources */, D5617D1A0FAF568100928B3A /* NJInputButton.m in Sources */, diff --git a/ApplicationController.h b/EnjoyableApplicationDelegate.h similarity index 73% rename from ApplicationController.h rename to EnjoyableApplicationDelegate.h index a1b8742..6a198e6 100644 --- a/ApplicationController.h +++ b/EnjoyableApplicationDelegate.h @@ -1,16 +1,16 @@ // -// ApplicationController.h +// EnjoyableApplicationDelegate.h // Enjoy // // Created by Sam McCall on 4/05/09. // Copyright 2009 University of Otago. All rights reserved. // -@class NJInputController; +@class NJDeviceController; @class NJOutputController; @class NJMappingsController; -@interface ApplicationController : NSObject { +@interface EnjoyableApplicationDelegate : NSObject { IBOutlet NSDrawer *drawer; IBOutlet NSWindow *mainWindow; IBOutlet NSToolbarItem *activeButton; @@ -18,7 +18,7 @@ IBOutlet NSMenu *dockMenuBase; } -@property (nonatomic, strong) IBOutlet NJInputController *inputController; +@property (nonatomic, strong) IBOutlet NJDeviceController *inputController; @property (nonatomic, strong) IBOutlet NJOutputController *outputController; @property (nonatomic, strong) IBOutlet NJMappingsController *mappingsController; diff --git a/ApplicationController.m b/EnjoyableApplicationDelegate.m similarity index 72% rename from ApplicationController.m rename to EnjoyableApplicationDelegate.m index faad07a..23324d3 100644 --- a/ApplicationController.m +++ b/EnjoyableApplicationDelegate.m @@ -1,20 +1,20 @@ // -// ApplicationController.m +// EnjoyableApplicationDelegate.m // Enjoy // // Created by Sam McCall on 4/05/09. // -#import "ApplicationController.h" +#import "EnjoyableApplicationDelegate.h" #import "NJMapping.h" #import "NJMappingsController.h" -#import "NJInputController.h" +#import "NJDeviceController.h" #import "NJOutputController.h" #import "NJEvents.h" -@implementation ApplicationController { - BOOL active; +@implementation EnjoyableApplicationDelegate { + NSInteger mappingsMenuIndex; } - (void)didSwitchApplication:(NSNotification *)notification { @@ -23,25 +23,30 @@ } - (void)applicationDidFinishLaunching:(NSNotification *)notification { + [NSNotificationCenter.defaultCenter + addObserver:self + selector:@selector(mappingDidChange:) + name:NJEventMappingChanged + object:nil]; + [NSNotificationCenter.defaultCenter + addObserver:self + selector:@selector(eventTranslationActivated:) + name:NJEventTranslationActivated + object:nil]; + [NSNotificationCenter.defaultCenter + addObserver:self + selector:@selector(eventTranslationDeactivated:) + name:NJEventTranslationDeactivated + object:nil]; + + mappingsMenuIndex = dockMenuBase.numberOfItems; + while (![dockMenuBase itemAtIndex:mappingsMenuIndex - 1].isSeparatorItem) + --mappingsMenuIndex; + [drawer open]; self.outputController.enabled = NO; [self.inputController setup]; [self.mappingsController load]; - [NSNotificationCenter.defaultCenter - addObserver:self - selector:@selector(mappingDidChange:) - name:NJEventMappingChanged - object:nil]; - [NSNotificationCenter.defaultCenter - addObserver:self - selector:@selector(eventTranslationActivated:) - name:NJEventTranslationActivated - object:nil]; - [NSNotificationCenter.defaultCenter - addObserver:self - selector:@selector(eventTranslationDeactivated:) - name:NJEventTranslationDeactivated - object:nil]; } - (void)applicationWillTerminate:(NSNotification *)aNotification { @@ -73,15 +78,8 @@ self.inputController.translatingEvents = !self.inputController.translatingEvents; } -- (NSInteger)firstMappingMenuIndex { - for (NSInteger i = dockMenuBase.numberOfItems - 1; i >= 0; --i) - if ([dockMenuBase itemAtIndex:i].isSeparatorItem) - return i + 1; - return dockMenuBase.numberOfItems; -} - - (void)mappingsChanged { - NSInteger removeFrom = self.firstMappingMenuIndex; + NSInteger removeFrom = mappingsMenuIndex; while (dockMenuBase.numberOfItems > removeFrom) [dockMenuBase removeItemAtIndex:dockMenuBase.numberOfItems - 1]; int added = 0; @@ -96,16 +94,16 @@ } - (void)mappingDidChange:(NSNotification *)note { - NSInteger firstMapping = self.firstMappingMenuIndex; NJMapping *current = note.object; NSArray *mappings = self.mappingsController.mappings; for (NSUInteger i = 0; i < mappings.count; ++i) - [dockMenuBase itemAtIndex:i + firstMapping].state = mappings[i] == current; + [dockMenuBase itemAtIndex:i + mappingsMenuIndex].state = mappings[i] == current; } - (void)chooseMapping:(id)sender { - NSInteger idx = [dockMenuBase indexOfItem:sender] - self.firstMappingMenuIndex; + NSInteger idx = [dockMenuBase indexOfItem:sender] - mappingsMenuIndex; NJMapping *chosen = self.mappingsController.mappings[idx]; [_mappingsController activateMapping:chosen]; } + @end diff --git a/NJInputController.h b/NJDeviceController.h similarity index 84% rename from NJInputController.h rename to NJDeviceController.h index fdd0532..2769222 100644 --- a/NJInputController.h +++ b/NJDeviceController.h @@ -1,5 +1,5 @@ // -// NJInputController.h +// NJDeviceController.h // Enjoy // // Created by Sam McCall on 4/05/09. @@ -11,7 +11,7 @@ @class NJMappingsController; @class NJOutputController; -@interface NJInputController : NSObject { +@interface NJDeviceController : NSObject { IBOutlet NSOutlineView *outlineView; IBOutlet NJOutputController *outputController; IBOutlet NJMappingsController *mappingsController; diff --git a/NJInputController.m b/NJDeviceController.m similarity index 96% rename from NJInputController.m rename to NJDeviceController.m index 618e99b..e68cfdb 100644 --- a/NJInputController.m +++ b/NJDeviceController.m @@ -1,11 +1,11 @@ // -// NJInputController.h +// NJDeviceController.m // Enjoy // // Created by Sam McCall on 4/05/09. // -#import "NJInputController.h" +#import "NJDeviceController.h" #import "NJMapping.h" #import "NJMappingsController.h" @@ -15,7 +15,7 @@ #import "NJOutputController.h" #import "NJEvents.h" -@implementation NJInputController { +@implementation NJDeviceController { IOHIDManagerRef hidManager; NSTimer *continuousTimer; NSMutableArray *runningOutputs; @@ -83,7 +83,7 @@ } static void input_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDValueRef value) { - NJInputController *controller = (__bridge NJInputController *)ctx; + NJDeviceController *controller = (__bridge NJDeviceController *)ctx; IOHIDDeviceRef device = IOHIDQueueGetDevice(inSender); if (controller.translatingEvents) { @@ -116,7 +116,7 @@ static int findAvailableIndex(NSArray *list, NJDevice *dev) { } static void add_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDDeviceRef device) { - NJInputController *controller = (__bridge NJInputController *)ctx; + NJDeviceController *controller = (__bridge NJDeviceController *)ctx; [controller addDeviceForDevice:device]; } @@ -128,7 +128,7 @@ static void add_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDDevi } static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDDeviceRef device) { - NJInputController *controller = (__bridge NJInputController *)ctx; + NJDeviceController *controller = (__bridge NJDeviceController *)ctx; [controller removeDeviceForDevice:device]; } diff --git a/NJMappingsController.m b/NJMappingsController.m index e01cb91..fe96462 100644 --- a/NJMappingsController.m +++ b/NJMappingsController.m @@ -7,7 +7,7 @@ #import "NJMappingsController.h" -#import "ApplicationController.h" +#import "EnjoyableApplicationDelegate.h" #import "NJMapping.h" #import "NJMappingsController.h" #import "NJOutput.h" @@ -62,7 +62,7 @@ - (IBAction)addPressed:(id)sender { NJMapping *newMapping = [[NJMapping alloc] initWithName:@"Untitled"]; [_mappings addObject:newMapping]; - [(ApplicationController *)NSApplication.sharedApplication.delegate mappingsChanged]; + [(EnjoyableApplicationDelegate *)NSApplication.sharedApplication.delegate mappingsChanged]; [tableView reloadData]; [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:_mappings.count - 1] byExtendingSelection:NO]; [tableView editColumn:0 row:_mappings.count - 1 withEvent:nil select:YES]; @@ -75,7 +75,7 @@ [_mappings removeObjectAtIndex:tableView.selectedRow]; [tableView reloadData]; - [(ApplicationController *)NSApplication.sharedApplication.delegate mappingsChanged]; + [(EnjoyableApplicationDelegate *)NSApplication.sharedApplication.delegate mappingsChanged]; [self activateMapping:_mappings[0]]; [self save]; } @@ -92,7 +92,7 @@ - (void)tableView:(NSTableView *)view setObjectValue:(NSString *)obj forTableColumn:(NSTableColumn *)col row:(NSInteger)index { [(NJMapping *)_mappings[index] setName:obj]; [tableView reloadData]; - [(ApplicationController *)NSApplication.sharedApplication.delegate mappingsChanged]; + [(EnjoyableApplicationDelegate *)NSApplication.sharedApplication.delegate mappingsChanged]; } - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { @@ -147,7 +147,7 @@ current = 0; _mappings = newMappings; [tableView reloadData]; - [(ApplicationController *)NSApplication.sharedApplication.delegate mappingsChanged]; + [(EnjoyableApplicationDelegate *)NSApplication.sharedApplication.delegate mappingsChanged]; [self activateMapping:_mappings[current]]; } } @@ -234,7 +234,7 @@ } [self save]; - [(ApplicationController *)NSApplication.sharedApplication.delegate mappingsChanged]; + [(EnjoyableApplicationDelegate *)NSApplication.sharedApplication.delegate mappingsChanged]; [self activateMapping:mapping]; [outputController loadCurrent]; diff --git a/NJOutput.h b/NJOutput.h index 2bfc167..b82c4e7 100644 --- a/NJOutput.h +++ b/NJOutput.h @@ -6,7 +6,7 @@ // Copyright 2009 University of Otago. All rights reserved. // -@class NJInputController; +@class NJDeviceController; @interface NJOutput : NSObject @@ -16,7 +16,7 @@ - (void)trigger; - (void)untrigger; -- (BOOL)update:(NJInputController *)jc; +- (BOOL)update:(NJDeviceController *)jc; - (NSDictionary *)serialize; + (NJOutput *)outputDeserialize:(NSDictionary *)serialization diff --git a/NJOutput.m b/NJOutput.m index dd751e1..ab29ed8 100644 --- a/NJOutput.m +++ b/NJOutput.m @@ -63,7 +63,7 @@ - (void)untrigger { } -- (BOOL)update:(NJInputController *)jc { +- (BOOL)update:(NJDeviceController *)jc { return NO; } diff --git a/NJOutputController.h b/NJOutputController.h index bf590a6..5b9a749 100644 --- a/NJOutputController.h +++ b/NJOutputController.h @@ -9,7 +9,7 @@ #import "NJKeyInputField.h" @class NJMappingsController; -@class NJInputController; +@class NJDeviceController; @class NJOutput; @class NJOutputMouseMove; @@ -22,7 +22,7 @@ IBOutlet NSTextField *title; IBOutlet NSPopUpButton *mappingPopup; IBOutlet NJMappingsController *mappingsController; - IBOutlet NJInputController *inputController; + IBOutlet NJDeviceController *inputController; } @property (assign) BOOL enabled; diff --git a/NJOutputController.m b/NJOutputController.m index f05c615..6725125 100644 --- a/NJOutputController.m +++ b/NJOutputController.m @@ -10,7 +10,7 @@ #import "NJMappingsController.h" #import "NJMapping.h" #import "NJInput.h" -#import "NJInputController.h" +#import "NJDeviceController.h" #import "NJKeyInputField.h" #import "NJOutputMapping.h" #import "NJOutputController.h" diff --git a/NJOutputMapping.m b/NJOutputMapping.m index e411172..5cd5d9f 100644 --- a/NJOutputMapping.m +++ b/NJOutputMapping.m @@ -7,7 +7,7 @@ #import "NJOutputMapping.h" -#import "ApplicationController.h" +#import "EnjoyableApplicationDelegate.h" #import "NJMapping.h" #import "NJMappingsController.h" @@ -37,7 +37,7 @@ } - (void)trigger { - ApplicationController *ctrl = NSApplication.sharedApplication.delegate; + EnjoyableApplicationDelegate *ctrl = NSApplication.sharedApplication.delegate; [ctrl.mappingsController activateMapping:_mapping]; } diff --git a/NJOutputMouseMove.m b/NJOutputMouseMove.m index 5e59d4e..3346fb2 100644 --- a/NJOutputMouseMove.m +++ b/NJOutputMouseMove.m @@ -7,7 +7,7 @@ #import "NJOutputMouseMove.h" -#import "NJInputController.h" +#import "NJDeviceController.h" @implementation NJOutputMouseMove { int sign; @@ -32,7 +32,7 @@ return output; } -- (BOOL)update:(NJInputController *)jc { +- (BOOL)update:(NJDeviceController *)jc { if (fabsf(self.magnitude) < 0.01) { sign = 0; return NO; // dead zone diff --git a/NJOutputMouseScroll.m b/NJOutputMouseScroll.m index 9057125..2f6d2d6 100644 --- a/NJOutputMouseScroll.m +++ b/NJOutputMouseScroll.m @@ -37,7 +37,7 @@ } } -- (BOOL)update:(NJInputController *)jc { +- (BOOL)update:(NJDeviceController *)jc { if (fabsf(self.magnitude) < 0.01f) { sign = 0; return NO; // dead zone diff --git a/NJOutputSwitchMouseMode.m b/NJOutputSwitchMouseMode.m index 3332a91..1750869 100644 --- a/NJOutputSwitchMouseMode.m +++ b/NJOutputSwitchMouseMode.m @@ -7,8 +7,8 @@ #import "NJOutputSwitchMouseMode.h" -#import "ApplicationController.h" -#import "NJInputController.h" +#import "EnjoyableApplicationDelegate.h" +#import "NJDeviceController.h" @implementation NJOutputSwitchMouseMode @@ -27,8 +27,8 @@ - (void)trigger { // FIXME: It's hacky to get at the controller this way, but it's // also hacky to pass it. Shouldn't need to do either. - ApplicationController *ac = NSApplication.sharedApplication.delegate; - NJInputController *jc = ac.inputController; + EnjoyableApplicationDelegate *ac = NSApplication.sharedApplication.delegate; + NJDeviceController *jc = ac.inputController; jc.frontWindowOnly = !jc.frontWindowOnly; } -- 2.30.2