From dcedf147ddcb6c21768cea94a2f06b93007d2a82 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Sun, 3 Mar 2013 22:37:54 +0100 Subject: [PATCH] Big rename part 3: 'target' to 'output'. --- ApplicationController.h | 4 +- ApplicationController.m | 6 +- English.lproj/MainMenu.xib | 64 ++++++------- Enjoyable.xcodeproj/project.pbxproj | 96 +++++++++---------- NJInputController.h | 6 +- NJInputController.m | 80 ++++++++-------- NJMapping.h | 6 +- NJMapping.m | 8 +- NJMappingsController.h | 4 +- NJMappingsController.m | 26 ++--- Target.h => NJOutput.h | 8 +- Target.m => NJOutput.m | 36 +++---- TargetController.h => NJOutputController.h | 10 +- TargetController.m => NJOutputController.m | 66 ++++++------- TargetKeyboard.h => NJOutputKeyPress.h | 6 +- TargetKeyboard.m => NJOutputKeyPress.m | 16 ++-- TargetConfig.h => NJOutputMapping.h | 6 +- TargetConfig.m => NJOutputMapping.m | 14 +-- TargetMouseBtn.h => NJOutputMouseButton.h | 6 +- TargetMouseBtn.m => NJOutputMouseButton.m | 18 ++-- TargetMouseMove.h => NJOutputMouseMove.h | 6 +- TargetMouseMove.m => NJOutputMouseMove.m | 20 ++-- TargetMouseScroll.h => NJOutputMouseScroll.h | 6 +- TargetMouseScroll.m => NJOutputMouseScroll.m | 20 ++-- NJOutputSwitchMouseMode.h | 12 +++ ...eMouseScope.m => NJOutputSwitchMouseMode.m | 15 ++- TargetToggleMouseScope.h | 12 --- 27 files changed, 288 insertions(+), 289 deletions(-) rename Target.h => NJOutput.h (72%) rename Target.m => NJOutput.m (62%) rename TargetController.h => NJOutputController.h (81%) rename TargetController.m => NJOutputController.m (74%) rename TargetKeyboard.h => NJOutputKeyPress.h (67%) rename TargetKeyboard.m => NJOutputKeyPress.m (61%) rename TargetConfig.h => NJOutputMapping.h (70%) rename TargetConfig.m => NJOutputMapping.m (72%) rename TargetMouseBtn.h => NJOutputMouseButton.h (57%) rename TargetMouseBtn.m => NJOutputMouseButton.m (77%) rename TargetMouseMove.h => NJOutputMouseMove.h (55%) rename TargetMouseMove.m => NJOutputMouseMove.m (78%) rename TargetMouseScroll.h => NJOutputMouseScroll.h (55%) rename TargetMouseScroll.m => NJOutputMouseScroll.m (74%) create mode 100644 NJOutputSwitchMouseMode.h rename TargetToggleMouseScope.m => NJOutputSwitchMouseMode.m (64%) delete mode 100644 TargetToggleMouseScope.h diff --git a/ApplicationController.h b/ApplicationController.h index 88c9d29..a1b8742 100644 --- a/ApplicationController.h +++ b/ApplicationController.h @@ -7,7 +7,7 @@ // @class NJInputController; -@class TargetController; +@class NJOutputController; @class NJMappingsController; @interface ApplicationController : NSObject { @@ -19,7 +19,7 @@ } @property (nonatomic, strong) IBOutlet NJInputController *inputController; -@property (nonatomic, strong) IBOutlet TargetController *targetController; +@property (nonatomic, strong) IBOutlet NJOutputController *outputController; @property (nonatomic, strong) IBOutlet NJMappingsController *mappingsController; - (IBAction)toggleActivity:(id)sender; diff --git a/ApplicationController.m b/ApplicationController.m index 50f9c29..faad07a 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -10,7 +10,7 @@ #import "NJMapping.h" #import "NJMappingsController.h" #import "NJInputController.h" -#import "TargetController.h" +#import "NJOutputController.h" #import "NJEvents.h" @implementation ApplicationController { @@ -24,7 +24,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification { [drawer open]; - self.targetController.enabled = NO; + self.outputController.enabled = NO; [self.inputController setup]; [self.mappingsController load]; [NSNotificationCenter.defaultCenter @@ -92,7 +92,7 @@ keyEquivalent:keyEquiv]; } - [_targetController refreshMappings]; + [_outputController refreshMappings]; } - (void)mappingDidChange:(NSNotification *)note { diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index c2ebf64..8dd62bf 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -1134,7 +1134,7 @@ NJInputController - TargetController + NJOutputController @@ -1277,19 +1277,19 @@ - targetController + mappingsController - + - 695 + 822 - mappingsController + outputController - + - 822 + 826 @@ -1339,14 +1339,6 @@ 611 - - - targetController - - - - 712 - dockMenuBase @@ -1371,6 +1363,14 @@ 820 + + + outputController + + + + 825 + addPressed: @@ -1403,14 +1403,6 @@ 520 - - - targetController - - - - 697 - exportPressed: @@ -1427,6 +1419,14 @@ 816 + + + outputController + + + + 827 + dataSource @@ -1451,14 +1451,6 @@ 692 - - - joystickController - - - - 694 - title @@ -1555,6 +1547,14 @@ 824 + + + inputController + + + + 828 + keyDelegate @@ -2233,7 +2233,7 @@ - 824 + 828 diff --git a/Enjoyable.xcodeproj/project.pbxproj b/Enjoyable.xcodeproj/project.pbxproj index cbcf390..c633833 100644 --- a/Enjoyable.xcodeproj/project.pbxproj +++ b/Enjoyable.xcodeproj/project.pbxproj @@ -8,10 +8,10 @@ /* Begin PBXBuildFile section */ 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; - 8B7E476C15C314A200C588FA /* TargetMouseBtn.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B7E476B15C314A200C588FA /* TargetMouseBtn.m */; }; - 8BD9B54315C230FF00929C5D /* TargetMouseMove.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD9B54215C230FE00929C5D /* TargetMouseMove.m */; }; - 8BEFAD9C15C46BFF00823AEC /* TargetMouseScroll.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BEFAD9B15C46BFF00823AEC /* TargetMouseScroll.m */; }; - 8BEFADA015C476DC00823AEC /* TargetToggleMouseScope.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BEFAD9F15C476DC00823AEC /* TargetToggleMouseScope.m */; }; + 8B7E476C15C314A200C588FA /* NJOutputMouseButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B7E476B15C314A200C588FA /* NJOutputMouseButton.m */; }; + 8BD9B54315C230FF00929C5D /* NJOutputMouseMove.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD9B54215C230FE00929C5D /* NJOutputMouseMove.m */; }; + 8BEFAD9C15C46BFF00823AEC /* NJOutputMouseScroll.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BEFAD9B15C46BFF00823AEC /* NJOutputMouseScroll.m */; }; + 8BEFADA015C476DC00823AEC /* NJOutputSwitchMouseMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BEFAD9F15C476DC00823AEC /* NJOutputSwitchMouseMode.m */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; @@ -21,16 +21,16 @@ D5617D1A0FAF568100928B3A /* NJInputButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617D190FAF568100928B3A /* NJInputButton.m */; }; D5617D260FAF579300928B3A /* NJInputHat.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617D250FAF579300928B3A /* NJInputHat.m */; }; D5617D2B0FAF579A00928B3A /* NJInputAnalog.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617D2A0FAF579A00928B3A /* NJInputAnalog.m */; }; - D5617FD60FAFD06000928B3A /* Target.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617FD50FAFD06000928B3A /* Target.m */; }; - D5617FD90FAFD1E600928B3A /* TargetKeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617FD80FAFD1E600928B3A /* TargetKeyboard.m */; }; - D5617FE40FAFD7B000928B3A /* TargetController.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617FE30FAFD7B000928B3A /* TargetController.m */; }; + D5617FD60FAFD06000928B3A /* NJOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617FD50FAFD06000928B3A /* NJOutput.m */; }; + D5617FD90FAFD1E600928B3A /* NJOutputKeyPress.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617FD80FAFD1E600928B3A /* NJOutputKeyPress.m */; }; + D5617FE40FAFD7B000928B3A /* NJOutputController.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617FE30FAFD7B000928B3A /* NJOutputController.m */; }; 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 */; }; D594BF000FAE7397007A85F2 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D594BEFF0FAE7397007A85F2 /* IOKit.framework */; }; D594BF830FAE9661007A85F2 /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = D594BF820FAE9661007A85F2 /* ApplicationController.m */; }; - D5F809710FB093400006A4DE /* TargetConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = D5F809700FB093400006A4DE /* TargetConfig.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 */; }; EE1D7C9616E0ECCF00B000EB /* NSError+Description.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1D7C9516E0ECCF00B000EB /* NSError+Description.m */; }; @@ -44,14 +44,14 @@ 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* Enjoyable_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enjoyable_Prefix.pch; sourceTree = ""; }; - 8B7E476A15C314A200C588FA /* TargetMouseBtn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TargetMouseBtn.h; sourceTree = ""; }; - 8B7E476B15C314A200C588FA /* TargetMouseBtn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TargetMouseBtn.m; sourceTree = ""; }; - 8BD9B54115C230FE00929C5D /* TargetMouseMove.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TargetMouseMove.h; sourceTree = ""; }; - 8BD9B54215C230FE00929C5D /* TargetMouseMove.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TargetMouseMove.m; sourceTree = ""; }; - 8BEFAD9A15C46BFF00823AEC /* TargetMouseScroll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TargetMouseScroll.h; sourceTree = ""; }; - 8BEFAD9B15C46BFF00823AEC /* TargetMouseScroll.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TargetMouseScroll.m; sourceTree = ""; }; - 8BEFAD9E15C476DC00823AEC /* TargetToggleMouseScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TargetToggleMouseScope.h; sourceTree = ""; }; - 8BEFAD9F15C476DC00823AEC /* TargetToggleMouseScope.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TargetToggleMouseScope.m; sourceTree = ""; }; + 8B7E476A15C314A200C588FA /* NJOutputMouseButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJOutputMouseButton.h; sourceTree = ""; }; + 8B7E476B15C314A200C588FA /* NJOutputMouseButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJOutputMouseButton.m; sourceTree = ""; }; + 8BD9B54115C230FE00929C5D /* NJOutputMouseMove.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJOutputMouseMove.h; sourceTree = ""; }; + 8BD9B54215C230FE00929C5D /* NJOutputMouseMove.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJOutputMouseMove.m; sourceTree = ""; }; + 8BEFAD9A15C46BFF00823AEC /* NJOutputMouseScroll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJOutputMouseScroll.h; sourceTree = ""; }; + 8BEFAD9B15C46BFF00823AEC /* NJOutputMouseScroll.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJOutputMouseScroll.m; sourceTree = ""; }; + 8BEFAD9E15C476DC00823AEC /* NJOutputSwitchMouseMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJOutputSwitchMouseMode.h; sourceTree = ""; }; + 8BEFAD9F15C476DC00823AEC /* NJOutputSwitchMouseMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJOutputSwitchMouseMode.m; sourceTree = ""; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8D1107320486CEB800E47090 /* Enjoyable.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Enjoyable.app; sourceTree = BUILT_PRODUCTS_DIR; }; D549CA4B0FBB441B00BC8203 /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = ""; }; @@ -66,12 +66,12 @@ D5617D250FAF579300928B3A /* NJInputHat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJInputHat.m; sourceTree = ""; }; D5617D290FAF579A00928B3A /* NJInputAnalog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJInputAnalog.h; sourceTree = ""; }; D5617D2A0FAF579A00928B3A /* NJInputAnalog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJInputAnalog.m; sourceTree = ""; }; - D5617FD40FAFD06000928B3A /* Target.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Target.h; sourceTree = ""; }; - D5617FD50FAFD06000928B3A /* Target.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Target.m; sourceTree = ""; }; - D5617FD70FAFD1E600928B3A /* TargetKeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TargetKeyboard.h; sourceTree = ""; }; - D5617FD80FAFD1E600928B3A /* TargetKeyboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TargetKeyboard.m; sourceTree = ""; }; - D5617FE20FAFD7B000928B3A /* TargetController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TargetController.h; sourceTree = ""; }; - D5617FE30FAFD7B000928B3A /* TargetController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TargetController.m; sourceTree = ""; }; + D5617FD40FAFD06000928B3A /* NJOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJOutput.h; sourceTree = ""; }; + D5617FD50FAFD06000928B3A /* NJOutput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJOutput.m; sourceTree = ""; }; + D5617FD70FAFD1E600928B3A /* NJOutputKeyPress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJOutputKeyPress.h; sourceTree = ""; }; + D5617FD80FAFD1E600928B3A /* NJOutputKeyPress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJOutputKeyPress.m; sourceTree = ""; }; + D5617FE20FAFD7B000928B3A /* NJOutputController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJOutputController.h; sourceTree = ""; }; + D5617FE30FAFD7B000928B3A /* NJOutputController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJOutputController.m; sourceTree = ""; }; D5617FE50FAFDB5800928B3A /* NJKeyInputField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJKeyInputField.h; sourceTree = ""; }; D5617FE60FAFDB5800928B3A /* NJKeyInputField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJKeyInputField.m; sourceTree = ""; }; D594BE840FAE6219007A85F2 /* NJDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJDevice.h; sourceTree = ""; }; @@ -83,8 +83,8 @@ 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 = ""; }; - D5F8096F0FB093400006A4DE /* TargetConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TargetConfig.h; sourceTree = ""; }; - D5F809700FB093400006A4DE /* TargetConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TargetConfig.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 = ""; }; EE1D7C9116E01E7000B000EB /* NSView+FirstResponder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSView+FirstResponder.m"; sourceTree = ""; }; EE1D7C9416E0ECCF00B000EB /* NSError+Description.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSError+Description.h"; sourceTree = ""; }; @@ -127,24 +127,24 @@ D5617A350FAEB74000928B3A /* NJMappingsController.m */, D5617A370FAEBA1800928B3A /* NJMapping.h */, D5617A380FAEBA1800928B3A /* NJMapping.m */, - D5F8096F0FB093400006A4DE /* TargetConfig.h */, - D5F809700FB093400006A4DE /* TargetConfig.m */, - D5617FD40FAFD06000928B3A /* Target.h */, - D5617FD50FAFD06000928B3A /* Target.m */, - D5617FD70FAFD1E600928B3A /* TargetKeyboard.h */, - D5617FD80FAFD1E600928B3A /* TargetKeyboard.m */, - D5617FE20FAFD7B000928B3A /* TargetController.h */, - D5617FE30FAFD7B000928B3A /* TargetController.m */, + D5F8096F0FB093400006A4DE /* NJOutputMapping.h */, + D5F809700FB093400006A4DE /* NJOutputMapping.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 /* TargetMouseMove.h */, - 8BD9B54215C230FE00929C5D /* TargetMouseMove.m */, - 8B7E476A15C314A200C588FA /* TargetMouseBtn.h */, - 8B7E476B15C314A200C588FA /* TargetMouseBtn.m */, - 8BEFAD9A15C46BFF00823AEC /* TargetMouseScroll.h */, - 8BEFAD9B15C46BFF00823AEC /* TargetMouseScroll.m */, - 8BEFAD9E15C476DC00823AEC /* TargetToggleMouseScope.h */, - 8BEFAD9F15C476DC00823AEC /* TargetToggleMouseScope.m */, + 8BD9B54115C230FE00929C5D /* NJOutputMouseMove.h */, + 8BD9B54215C230FE00929C5D /* NJOutputMouseMove.m */, + 8B7E476A15C314A200C588FA /* NJOutputMouseButton.h */, + 8B7E476B15C314A200C588FA /* NJOutputMouseButton.m */, + 8BEFAD9A15C46BFF00823AEC /* NJOutputMouseScroll.h */, + 8BEFAD9B15C46BFF00823AEC /* NJOutputMouseScroll.m */, + 8BEFAD9E15C476DC00823AEC /* NJOutputSwitchMouseMode.h */, + 8BEFAD9F15C476DC00823AEC /* NJOutputSwitchMouseMode.m */, EEF86B7316E2241000674B87 /* NJInputPathElement.h */, EEF86B7416E298CD00674B87 /* NJEvents.h */, ); @@ -300,15 +300,15 @@ D5617D1A0FAF568100928B3A /* NJInputButton.m in Sources */, D5617D260FAF579300928B3A /* NJInputHat.m in Sources */, D5617D2B0FAF579A00928B3A /* NJInputAnalog.m in Sources */, - D5617FD60FAFD06000928B3A /* Target.m in Sources */, - D5617FD90FAFD1E600928B3A /* TargetKeyboard.m in Sources */, - D5617FE40FAFD7B000928B3A /* TargetController.m in Sources */, + D5617FD60FAFD06000928B3A /* NJOutput.m in Sources */, + D5617FD90FAFD1E600928B3A /* NJOutputKeyPress.m in Sources */, + D5617FE40FAFD7B000928B3A /* NJOutputController.m in Sources */, D5617FE70FAFDB5800928B3A /* NJKeyInputField.m in Sources */, - D5F809710FB093400006A4DE /* TargetConfig.m in Sources */, - 8BD9B54315C230FF00929C5D /* TargetMouseMove.m in Sources */, - 8B7E476C15C314A200C588FA /* TargetMouseBtn.m in Sources */, - 8BEFAD9C15C46BFF00823AEC /* TargetMouseScroll.m in Sources */, - 8BEFADA015C476DC00823AEC /* TargetToggleMouseScope.m in Sources */, + D5F809710FB093400006A4DE /* NJOutputMapping.m in Sources */, + 8BD9B54315C230FF00929C5D /* NJOutputMouseMove.m in Sources */, + 8B7E476C15C314A200C588FA /* NJOutputMouseButton.m in Sources */, + 8BEFAD9C15C46BFF00823AEC /* NJOutputMouseScroll.m in Sources */, + 8BEFADA015C476DC00823AEC /* NJOutputSwitchMouseMode.m in Sources */, EE1D7C9216E01E7000B000EB /* NSView+FirstResponder.m in Sources */, EE1D7C9616E0ECCF00B000EB /* NSError+Description.m in Sources */, ); diff --git a/NJInputController.h b/NJInputController.h index feea2e2..fdd0532 100644 --- a/NJInputController.h +++ b/NJInputController.h @@ -9,16 +9,16 @@ @class NJDevice; @class NJInput; @class NJMappingsController; -@class TargetController; +@class NJOutputController; @interface NJInputController : NSObject { IBOutlet NSOutlineView *outlineView; - IBOutlet TargetController *targetController; + IBOutlet NJOutputController *outputController; IBOutlet NJMappingsController *mappingsController; } - (void)setup; -- (NJDevice *)findJoystickByRef:(IOHIDDeviceRef)device; +- (NJDevice *)findDeviceByRef:(IOHIDDeviceRef)device; @property (nonatomic, readonly) NJInput *selectedInput; @property (nonatomic, assign) NSPoint mouseLoc; diff --git a/NJInputController.m b/NJInputController.m index a708d82..618e99b 100644 --- a/NJInputController.m +++ b/NJInputController.m @@ -11,21 +11,21 @@ #import "NJMappingsController.h" #import "NJDevice.h" #import "NJInput.h" -#import "Target.h" -#import "TargetController.h" +#import "NJOutput.h" +#import "NJOutputController.h" #import "NJEvents.h" @implementation NJInputController { IOHIDManagerRef hidManager; NSTimer *continuousTimer; - NSMutableArray *runningTargets; - NSMutableArray *_joysticks; + NSMutableArray *runningOutputs; + NSMutableArray *_devices; } - (id)init { if ((self = [super init])) { - _joysticks = [[NSMutableArray alloc] initWithCapacity:16]; - runningTargets = [[NSMutableArray alloc] initWithCapacity:32]; + _devices = [[NSMutableArray alloc] initWithCapacity:16]; + runningOutputs = [[NSMutableArray alloc] initWithCapacity:32]; } return self; } @@ -43,9 +43,9 @@ } } -- (void)addRunningTarget:(Target *)target { - if (![runningTargets containsObject:target]) { - [runningTargets addObject:target]; +- (void)addRunningOutput:(NJOutput *)output { + if (![runningOutputs containsObject:output]) { + [runningOutputs addObject:output]; } if (!continuousTimer) { continuousTimer = [NSTimer scheduledTimerWithTimeInterval:1.f/60.f @@ -53,33 +53,33 @@ selector:@selector(updateContinuousInputs:) userInfo:nil repeats:YES]; - NSLog(@"Scheduled continuous target timer."); + NSLog(@"Scheduled continuous output timer."); } } -- (void)runTargetForDevice:(IOHIDDeviceRef)device value:(IOHIDValueRef)value { - NJDevice *dev = [self findJoystickByRef:device]; +- (void)runOutputForDevice:(IOHIDDeviceRef)device value:(IOHIDValueRef)value { + NJDevice *dev = [self findDeviceByRef:device]; NJInput *mainInput = [dev inputForEvent:value]; [mainInput notifyEvent:value]; NSArray *children = mainInput.children ? mainInput.children : mainInput ? @[mainInput] : @[]; for (NJInput *subInput in children) { - Target *target = mappingsController.currentMapping[subInput]; - target.magnitude = mainInput.magnitude; - target.running = subInput.active; - if (target.running && target.isContinuous) - [self addRunningTarget:target]; + NJOutput *output = mappingsController.currentMapping[subInput]; + output.magnitude = mainInput.magnitude; + output.running = subInput.active; + if (output.running && output.isContinuous) + [self addRunningOutput:output]; } } -- (void)showTargetForDevice:(IOHIDDeviceRef)device value:(IOHIDValueRef)value { - NJDevice *dev = [self findJoystickByRef:device]; +- (void)showOutputForDevice:(IOHIDDeviceRef)device value:(IOHIDValueRef)value { + NJDevice *dev = [self findDeviceByRef:device]; NJInput *handler = [dev handlerForEvent:value]; if (!handler) return; [self expandRecursive:handler]; [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:[outlineView rowForItem:handler]] byExtendingSelection: NO]; - [targetController focusKey]; + [outputController focusKey]; } static void input_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDValueRef value) { @@ -87,9 +87,9 @@ static void input_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDVa IOHIDDeviceRef device = IOHIDQueueGetDevice(inSender); if (controller.translatingEvents) { - [controller runTargetForDevice:device value:value]; + [controller runOutputForDevice:device value:value]; } else if ([NSApplication sharedApplication].mainWindow.isVisible) { - [controller showTargetForDevice:device value:value]; + [controller showOutputForDevice:device value:value]; } } @@ -107,21 +107,21 @@ static int findAvailableIndex(NSArray *list, NJDevice *dev) { } } -- (void)addJoystickForDevice:(IOHIDDeviceRef)device { +- (void)addDeviceForDevice:(IOHIDDeviceRef)device { IOHIDDeviceRegisterInputValueCallback(device, input_callback, (__bridge void*)self); NJDevice *dev = [[NJDevice alloc] initWithDevice:device]; - dev.index = findAvailableIndex(_joysticks, dev); - [_joysticks addObject:dev]; + dev.index = findAvailableIndex(_devices, dev); + [_devices addObject:dev]; [outlineView reloadData]; } static void add_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDDeviceRef device) { NJInputController *controller = (__bridge NJInputController *)ctx; - [controller addJoystickForDevice:device]; + [controller addDeviceForDevice:device]; } -- (NJDevice *)findJoystickByRef:(IOHIDDeviceRef)device { - for (NJDevice *dev in _joysticks) +- (NJDevice *)findDeviceByRef:(IOHIDDeviceRef)device { + for (NJDevice *dev in _devices) if (dev.device == device) return dev; return nil; @@ -129,14 +129,14 @@ 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; - [controller removeJoystickForDevice:device]; + [controller removeDeviceForDevice:device]; } -- (void)removeJoystickForDevice:(IOHIDDeviceRef)device { - NJDevice *match = [self findJoystickByRef:device]; +- (void)removeDeviceForDevice:(IOHIDDeviceRef)device { + NJDevice *match = [self findDeviceByRef:device]; IOHIDDeviceRegisterInputValueCallback(device, NULL, NULL); if (match) { - [_joysticks removeObject:match]; + [_devices removeObject:match]; [outlineView reloadData]; } @@ -144,15 +144,15 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD - (void)updateContinuousInputs:(NSTimer *)timer { self.mouseLoc = [NSEvent mouseLocation]; - for (Target *target in [runningTargets copy]) { - if (![target update:self]) { - [runningTargets removeObject:target]; + for (NJOutput *output in [runningOutputs copy]) { + if (![output update:self]) { + [runningOutputs removeObject:output]; } } - if (!runningTargets.count) { + if (!runningOutputs.count) { [continuousTimer invalidate]; continuousTimer = nil; - NSLog(@"Unscheduled continuous target timer."); + NSLog(@"Unscheduled continuous output timer."); } } @@ -196,7 +196,7 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD - (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id )item { - return item ? item.children.count : _joysticks.count; + return item ? item.children.count : _devices.count; } - (BOOL)outlineView:(NSOutlineView *)outlineView @@ -207,7 +207,7 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id )item { - return item ? item.children[index] : _joysticks[index]; + return item ? item.children[index] : _devices[index]; } - (id)outlineView:(NSOutlineView *)outlineView @@ -218,7 +218,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn - (void)outlineViewSelectionDidChange:(NSNotification *)notification { - [targetController loadCurrent]; + [outputController loadCurrent]; } - (void)setTranslatingEvents:(BOOL)translatingEvents { diff --git a/NJMapping.h b/NJMapping.h index a4068ff..f997fa8 100644 --- a/NJMapping.h +++ b/NJMapping.h @@ -6,7 +6,7 @@ // Copyright 2009 University of Otago. All rights reserved. // -@class Target; +@class NJOutput; @class NJInput; @interface NJMapping : NSObject @@ -15,8 +15,8 @@ @property (nonatomic, readonly) NSMutableDictionary *entries; - (id)initWithName:(NSString *)name; -- (Target *)objectForKeyedSubscript:(NJInput *)input; -- (void)setObject:(Target *)target forKeyedSubscript:(NJInput *)input; +- (NJOutput *)objectForKeyedSubscript:(NJInput *)input; +- (void)setObject:(NJOutput *)output forKeyedSubscript:(NJInput *)input; - (NSDictionary *)serialize; @end diff --git a/NJMapping.m b/NJMapping.m index a5f810c..4e7c4b2 100644 --- a/NJMapping.m +++ b/NJMapping.m @@ -19,14 +19,14 @@ return self; } -- (Target *)objectForKeyedSubscript:(NJInput *)input { +- (NJOutput *)objectForKeyedSubscript:(NJInput *)input { return input ? _entries[input.uid] : nil; } -- (void)setObject:(Target *)target forKeyedSubscript:(NJInput *)input { +- (void)setObject:(NJOutput *)output forKeyedSubscript:(NJInput *)input { if (input) { - if (target) - _entries[input.uid] = target; + if (output) + _entries[input.uid] = output; else [_entries removeObjectForKey:input.uid]; } diff --git a/NJMappingsController.h b/NJMappingsController.h index cda477f..d793714 100644 --- a/NJMappingsController.h +++ b/NJMappingsController.h @@ -7,14 +7,14 @@ // @class NJMapping; -@class TargetController; +@class NJOutputController; @interface NJMappingsController : NSObject { IBOutlet NSButton *removeButton; IBOutlet NSTableView *tableView; - IBOutlet TargetController *targetController; + IBOutlet NJOutputController *outputController; } @property (nonatomic, readonly) NJMapping *currentMapping; diff --git a/NJMappingsController.m b/NJMappingsController.m index e5b2b7d..e01cb91 100644 --- a/NJMappingsController.m +++ b/NJMappingsController.m @@ -10,8 +10,8 @@ #import "ApplicationController.h" #import "NJMapping.h" #import "NJMappingsController.h" -#import "Target.h" -#import "TargetController.h" +#import "NJOutput.h" +#import "NJOutputController.h" #import "NJEvents.h" @implementation NJMappingsController { @@ -53,7 +53,7 @@ manualMapping = mapping; _currentMapping = mapping; [removeButton setEnabled:_mappings[0] != mapping]; - [targetController loadCurrent]; + [outputController loadCurrent]; [NSNotificationCenter.defaultCenter postNotificationName:NJEventMappingChanged object:_currentMapping]; [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:[_mappings indexOfObject:mapping]] byExtendingSelection:NO]; @@ -124,7 +124,7 @@ NSArray *storedMappings = envelope[@"mappings"]; NSMutableArray* newMappings = [[NSMutableArray alloc] initWithCapacity:storedMappings.count]; - // have to do two passes in case mapping1 refers to mapping2 via a TargetMapping + // have to do two passes in case mapping1 refers to mapping2 via a NJOutputMapping for (NSDictionary *storedMapping in storedMappings) { NJMapping *mapping = [[NJMapping alloc] initWithName:storedMapping[@"name"]]; [newMappings addObject:mapping]; @@ -134,10 +134,10 @@ NSDictionary *entries = storedMappings[i][@"entries"]; NJMapping *mapping = newMappings[i]; for (id key in entries) { - Target *target = [Target targetDeserialize:entries[key] - withMappings:newMappings]; - if (target) - mapping.entries[key] = target; + NJOutput *output = [NJOutput outputDeserialize:entries[key] + withMappings:newMappings]; + if (output) + mapping.entries[key] = output; } } @@ -174,10 +174,10 @@ for (id key in entries) { NSDictionary *value = entries[key]; if ([key isKindOfClass:NSString.class]) { - Target *target = [Target targetDeserialize:value - withMappings:_mappings]; - if (target) - mapping.entries[key] = target; + NJOutput *output = [NJOutput outputDeserialize:value + withMappings:_mappings]; + if (output) + mapping.entries[key] = output; } } return mapping; @@ -236,7 +236,7 @@ [self save]; [(ApplicationController *)NSApplication.sharedApplication.delegate mappingsChanged]; [self activateMapping:mapping]; - [targetController loadCurrent]; + [outputController loadCurrent]; if (conflict && !mergeInto) { [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:_mappings.count - 1] byExtendingSelection:NO]; diff --git a/Target.h b/NJOutput.h similarity index 72% rename from Target.h rename to NJOutput.h index 1a37f01..2bfc167 100644 --- a/Target.h +++ b/NJOutput.h @@ -1,5 +1,5 @@ // -// Target.h +// NJOutput.h // Enjoy // // Created by Sam McCall on 5/05/09. @@ -8,7 +8,7 @@ @class NJInputController; -@interface Target : NSObject +@interface NJOutput : NSObject @property (nonatomic, assign) float magnitude; @property (nonatomic, assign) BOOL running; @@ -19,8 +19,8 @@ - (BOOL)update:(NJInputController *)jc; - (NSDictionary *)serialize; -+ (Target *)targetDeserialize:(NSDictionary *)serialization - withMappings:(NSArray *)mappings; ++ (NJOutput *)outputDeserialize:(NSDictionary *)serialization + withMappings:(NSArray *)mappings; + (NSString *)serializationCode; @end diff --git a/Target.m b/NJOutput.m similarity index 62% rename from Target.m rename to NJOutput.m index 097562e..dd751e1 100644 --- a/Target.m +++ b/NJOutput.m @@ -1,20 +1,20 @@ // -// Target.m +// NJOutput.m // Enjoy // // Created by Sam McCall on 5/05/09. // -#import "Target.h" +#import "NJOutput.h" -#import "TargetKeyboard.h" -#import "TargetConfig.h" -#import "TargetMouseMove.h" -#import "TargetMouseBtn.h" -#import "TargetMouseScroll.h" -#import "TargetToggleMouseScope.h" +#import "NJOutputKeyPress.h" +#import "NJOutputMapping.h" +#import "NJOutputMouseMove.h" +#import "NJOutputMouseButton.h" +#import "NJOutputMouseScroll.h" +#import "NJOutputSwitchMouseMode.h" -@implementation Target { +@implementation NJOutput { BOOL running; } @@ -29,7 +29,7 @@ } - (BOOL)isEqual:(id)object { - return [object isKindOfClass:Target.class] + return [object isKindOfClass:NJOutput.class] && [[self serialize] isEqual:[object serialize]]; } @@ -37,21 +37,21 @@ return [[self serialize] hash]; } -+ (Target *)targetDeserialize:(NSDictionary *)serialization ++ (NJOutput *)outputDeserialize:(NSDictionary *)serialization withMappings:(NSArray *)mappings { // Don't crash loading old/bad mappings (but don't load them either). if (![serialization isKindOfClass:NSDictionary.class]) return nil; NSString *type = serialization[@"type"]; - for (Class cls in @[TargetKeyboard.class, - TargetConfig.class, - TargetMouseMove.class, - TargetMouseBtn.class, - TargetMouseScroll.class, - TargetToggleMouseScope.class + for (Class cls in @[NJOutputKeyPress.class, + NJOutputMapping.class, + NJOutputMouseMove.class, + NJOutputMouseButton.class, + NJOutputMouseScroll.class, + NJOutputSwitchMouseMode.class ]) { if ([type isEqualToString:cls.serializationCode]) - return [cls targetDeserialize:serialization withMappings:mappings]; + return [cls outputDeserialize:serialization withMappings:mappings]; } return nil; diff --git a/TargetController.h b/NJOutputController.h similarity index 81% rename from TargetController.h rename to NJOutputController.h index da7974c..bf590a6 100644 --- a/TargetController.h +++ b/NJOutputController.h @@ -1,5 +1,5 @@ // -// TargetController.h +// NJOutputController.h // Enjoy // // Created by Sam McCall on 5/05/09. @@ -10,10 +10,10 @@ @class NJMappingsController; @class NJInputController; -@class Target; -@class TargetMouseMove; +@class NJOutput; +@class NJOutputMouseMove; -@interface TargetController : NSObject { +@interface NJOutputController : NSObject { IBOutlet NJKeyInputField *keyInput; IBOutlet NSMatrix *radioButtons; IBOutlet NSSegmentedControl *mouseDirSelect; @@ -22,7 +22,7 @@ IBOutlet NSTextField *title; IBOutlet NSPopUpButton *mappingPopup; IBOutlet NJMappingsController *mappingsController; - IBOutlet NJInputController *joystickController; + IBOutlet NJInputController *inputController; } @property (assign) BOOL enabled; diff --git a/TargetController.m b/NJOutputController.m similarity index 74% rename from TargetController.m rename to NJOutputController.m index 1da2c99..f05c615 100644 --- a/TargetController.m +++ b/NJOutputController.m @@ -1,26 +1,26 @@ // -// TargetController.m +// NJOutputController.m // Enjoy // // Created by Sam McCall on 5/05/09. // -#import "TargetController.h" +#import "NJOutputController.h" #import "NJMappingsController.h" #import "NJMapping.h" #import "NJInput.h" #import "NJInputController.h" #import "NJKeyInputField.h" -#import "TargetConfig.h" -#import "TargetController.h" -#import "TargetKeyboard.h" -#import "TargetMouseBtn.h" -#import "TargetMouseMove.h" -#import "TargetMouseScroll.h" -#import "TargetToggleMouseScope.h" +#import "NJOutputMapping.h" +#import "NJOutputController.h" +#import "NJOutputKeyPress.h" +#import "NJOutputMouseButton.h" +#import "NJOutputMouseMove.h" +#import "NJOutputMouseScroll.h" +#import "NJOutputSwitchMouseMode.h" -@implementation TargetController +@implementation NJOutputController - (void)cleanUpInterface { NSInteger row = radioButtons.selectedRow; @@ -97,17 +97,17 @@ [self commit]; } -- (Target *)currentTarget { - return mappingsController.currentMapping[joystickController.selectedInput]; +- (NJOutput *)currentOutput { + return mappingsController.currentMapping[inputController.selectedInput]; } -- (Target *)makeTarget { +- (NJOutput *)makeOutput { switch (radioButtons.selectedRow) { case 0: return nil; case 1: if (keyInput.hasKeyCode) { - TargetKeyboard *k = [[TargetKeyboard alloc] init]; + NJOutputKeyPress *k = [[NJOutputKeyPress alloc] init]; k.vk = keyInput.keyCode; return k; } else { @@ -115,27 +115,27 @@ } break; case 2: { - TargetConfig *c = [[TargetConfig alloc] init]; + NJOutputMapping *c = [[NJOutputMapping alloc] init]; c.mapping = mappingsController.mappings[mappingPopup.indexOfSelectedItem]; return c; } case 3: { - TargetMouseMove *mm = [[TargetMouseMove alloc] init]; + NJOutputMouseMove *mm = [[NJOutputMouseMove alloc] init]; mm.axis = mouseDirSelect.selectedSegment; return mm; } case 4: { - TargetMouseBtn *mb = [[TargetMouseBtn alloc] init]; + NJOutputMouseButton *mb = [[NJOutputMouseButton alloc] init]; mb.button = mouseBtnSelect.selectedSegment == 0 ? kCGMouseButtonLeft : kCGMouseButtonRight; return mb; } case 5: { - TargetMouseScroll *ms = [[TargetMouseScroll alloc] init]; + NJOutputMouseScroll *ms = [[NJOutputMouseScroll alloc] init]; ms.amount = scrollDirSelect.selectedSegment ? 1 : -1; return ms; } case 6: { - TargetToggleMouseScope *tms = [[TargetToggleMouseScope alloc] init]; + NJOutputSwitchMouseMode *tms = [[NJOutputSwitchMouseMode alloc] init]; return tms; } default: @@ -145,7 +145,7 @@ - (void)commit { [self cleanUpInterface]; - mappingsController.currentMapping[joystickController.selectedInput] = [self makeTarget]; + mappingsController.currentMapping[inputController.selectedInput] = [self makeOutput]; [mappingsController save]; } @@ -162,7 +162,7 @@ [scrollDirSelect setEnabled:enabled]; } -- (void)loadTarget:(Target *)target forInput:(NJInput *)input { +- (void)loadOutput:(NJOutput *)output forInput:(NJInput *)input { if (!input) { self.enabled = NO; title.stringValue = @""; @@ -175,32 +175,32 @@ title.stringValue = [[NSString alloc] initWithFormat:@"%@ > %@", mappingsController.currentMapping.name, inpFullName]; } - if ([target isKindOfClass:TargetKeyboard.class]) { + if ([output isKindOfClass:NJOutputKeyPress.class]) { [radioButtons selectCellAtRow:1 column:0]; - keyInput.keyCode = [(TargetKeyboard*)target vk]; - } else if ([target isKindOfClass:TargetConfig.class]) { + keyInput.keyCode = [(NJOutputKeyPress*)output vk]; + } else if ([output isKindOfClass:NJOutputMapping.class]) { [radioButtons selectCellAtRow:2 column:0]; NSUInteger idx = [mappingsController.mappings - indexOfObject:[(TargetConfig *)target mapping]]; + indexOfObject:[(NJOutputMapping *)output mapping]]; if (idx == NSNotFound) { [radioButtons selectCellAtRow:self.enabled ? 0 : -1 column:0]; [mappingPopup selectItemAtIndex:-1]; } else [mappingPopup selectItemAtIndex:idx]; } - else if ([target isKindOfClass:TargetMouseMove.class]) { + else if ([output isKindOfClass:NJOutputMouseMove.class]) { [radioButtons selectCellAtRow:3 column:0]; - [mouseDirSelect setSelectedSegment:[(TargetMouseMove *)target axis]]; + [mouseDirSelect setSelectedSegment:[(NJOutputMouseMove *)output axis]]; } - else if ([target isKindOfClass:TargetMouseBtn.class]) { + else if ([output isKindOfClass:NJOutputMouseButton.class]) { [radioButtons selectCellAtRow:4 column:0]; - mouseBtnSelect.selectedSegment = [(TargetMouseBtn *)target button] == kCGMouseButtonLeft ? 0 : 1; + mouseBtnSelect.selectedSegment = [(NJOutputMouseButton *)output button] == kCGMouseButtonLeft ? 0 : 1; } - else if ([target isKindOfClass:TargetMouseScroll.class]) { + else if ([output isKindOfClass:NJOutputMouseScroll.class]) { [radioButtons selectCellAtRow:5 column:0]; - scrollDirSelect.selectedSegment = [(TargetMouseScroll *)target amount] > 0; + scrollDirSelect.selectedSegment = [(NJOutputMouseScroll *)output amount] > 0; } - else if ([target isKindOfClass:TargetToggleMouseScope.class]) { + else if ([output isKindOfClass:NJOutputSwitchMouseMode.class]) { [radioButtons selectCellAtRow:6 column:0]; } else { [radioButtons selectCellAtRow:self.enabled ? 0 : -1 column:0]; @@ -209,7 +209,7 @@ } - (void)loadCurrent { - [self loadTarget:self.currentTarget forInput:joystickController.selectedInput]; + [self loadOutput:self.currentOutput forInput:inputController.selectedInput]; } - (void)focusKey { diff --git a/TargetKeyboard.h b/NJOutputKeyPress.h similarity index 67% rename from TargetKeyboard.h rename to NJOutputKeyPress.h index 551bb8d..052b010 100644 --- a/TargetKeyboard.h +++ b/NJOutputKeyPress.h @@ -1,14 +1,14 @@ // -// TargetKeyboard.h +// NJOutputKeyPress.h // Enjoy // // Created by Sam McCall on 5/05/09. // Copyright 2009 University of Otago. All rights reserved. // -#import "Target.h" +#import "NJOutput.h" -@interface TargetKeyboard : Target +@interface NJOutputKeyPress : NJOutput @property (nonatomic, assign) CGKeyCode vk; diff --git a/TargetKeyboard.m b/NJOutputKeyPress.m similarity index 61% rename from TargetKeyboard.m rename to NJOutputKeyPress.m index eaabd07..c2000d8 100644 --- a/TargetKeyboard.m +++ b/NJOutputKeyPress.m @@ -1,29 +1,29 @@ // -// TargetKeyboard.m +// NJOutputKeyPress.m // Enjoy // // Created by Sam McCall on 5/05/09. // -#import "TargetKeyboard.h" +#import "NJOutputKeyPress.h" #import "NJKeyInputField.h" -@implementation TargetKeyboard +@implementation NJOutputKeyPress + (NSString *)serializationCode { return @"key"; } - (NSDictionary *)serialize { - return @{ @"type": @"key", @"key": @(_vk) }; + return @{ @"type": @"key press", @"key": @(_vk) }; } -+ (Target *)targetDeserialize:(NSDictionary *)serialization ++ (NJOutput *)outputDeserialize:(NSDictionary *)serialization withMappings:(NSArray *)mappings { - TargetKeyboard *target = [[TargetKeyboard alloc] init]; - target.vk = [serialization[@"key"] intValue]; - return target; + NJOutputKeyPress *output = [[NJOutputKeyPress alloc] init]; + output.vk = [serialization[@"key"] intValue]; + return output; } - (void)trigger { diff --git a/TargetConfig.h b/NJOutputMapping.h similarity index 70% rename from TargetConfig.h rename to NJOutputMapping.h index 1018e5d..e8c3029 100644 --- a/TargetConfig.h +++ b/NJOutputMapping.h @@ -1,16 +1,16 @@ // -// TargetConfig.h +// NJOutputMapping.h // Enjoy // // Created by Sam McCall on 6/05/09. // Copyright 2009 University of Otago. All rights reserved. // -#import "Target.h" +#import "NJOutput.h" @class NJMapping; -@interface TargetConfig : Target +@interface NJOutputMapping : NJOutput @property (nonatomic, weak) NJMapping *mapping; diff --git a/TargetConfig.m b/NJOutputMapping.m similarity index 72% rename from TargetConfig.m rename to NJOutputMapping.m index 0f892c6..e411172 100644 --- a/TargetConfig.m +++ b/NJOutputMapping.m @@ -1,17 +1,17 @@ // -// TargetConfig.m +// NJOutputMapping.m // Enjoy // // Created by Sam McCall on 6/05/09. // -#import "TargetConfig.h" +#import "NJOutputMapping.h" #import "ApplicationController.h" #import "NJMapping.h" #import "NJMappingsController.h" -@implementation TargetConfig +@implementation NJOutputMapping + (NSString *)serializationCode { return @"mapping"; @@ -23,14 +23,14 @@ : nil; } -+ (TargetConfig *)targetDeserialize:(NSDictionary *)serialization ++ (NJOutputMapping *)outputDeserialize:(NSDictionary *)serialization withMappings:(NSArray *)mappings { NSString *name = serialization[@"name"]; - TargetConfig *target = [[TargetConfig alloc] init]; + NJOutputMapping *output = [[NJOutputMapping alloc] init]; for (NJMapping *mapping in mappings) { if ([mapping.name isEqualToString:name]) { - target.mapping = mapping; - return target; + output.mapping = mapping; + return output; } } return nil; diff --git a/TargetMouseBtn.h b/NJOutputMouseButton.h similarity index 57% rename from TargetMouseBtn.h rename to NJOutputMouseButton.h index 2597b2d..4d790e5 100644 --- a/TargetMouseBtn.h +++ b/NJOutputMouseButton.h @@ -1,13 +1,13 @@ // -// TargetMouseBtn.h +// NJOutputMouseButton.h // Enjoy // // Created by Yifeng Huang on 7/27/12. // -#import "Target.h" +#import "NJOutput.h" -@interface TargetMouseBtn : Target +@interface NJOutputMouseButton : NJOutput @property (nonatomic, assign) CGMouseButton button; diff --git a/TargetMouseBtn.m b/NJOutputMouseButton.m similarity index 77% rename from TargetMouseBtn.m rename to NJOutputMouseButton.m index a19b484..0cc403f 100644 --- a/TargetMouseBtn.m +++ b/NJOutputMouseButton.m @@ -1,27 +1,27 @@ // -// TargetMouseBtn.m +// NJOutputMouseButton.m // Enjoy // // Created by Yifeng Huang on 7/27/12. // -#import "TargetMouseBtn.h" +#import "NJOutputMouseButton.h" -@implementation TargetMouseBtn +@implementation NJOutputMouseButton + (NSString *)serializationCode { - return @"mbtn"; + return @"mouse button"; } - (NSDictionary *)serialize { - return @{ @"type": @"mbtn", @"button": @(_button) }; + return @{ @"type": @"mouse button", @"button": @(_button) }; } -+ (Target *)targetDeserialize:(NSDictionary *)serialization ++ (NJOutput *)outputDeserialize:(NSDictionary *)serialization withMappings:(NSArray *)mappings { - TargetMouseBtn *target = [[TargetMouseBtn alloc] init]; - target.button = [serialization[@"button"] intValue]; - return target; + NJOutputMouseButton *output = [[NJOutputMouseButton alloc] init]; + output.button = [serialization[@"button"] intValue]; + return output; } -(void) trigger { diff --git a/TargetMouseMove.h b/NJOutputMouseMove.h similarity index 55% rename from TargetMouseMove.h rename to NJOutputMouseMove.h index e91b569..21db416 100644 --- a/TargetMouseMove.h +++ b/NJOutputMouseMove.h @@ -1,13 +1,13 @@ // -// TargetMouseMove.h +// NJOutputMouseMove.h // Enjoy // // Created by Yifeng Huang on 7/26/12. // -#import "Target.h" +#import "NJOutput.h" -@interface TargetMouseMove : Target +@interface NJOutputMouseMove : NJOutput @property (nonatomic, assign) int axis; diff --git a/TargetMouseMove.m b/NJOutputMouseMove.m similarity index 78% rename from TargetMouseMove.m rename to NJOutputMouseMove.m index b1d52a0..5e59d4e 100644 --- a/TargetMouseMove.m +++ b/NJOutputMouseMove.m @@ -1,15 +1,15 @@ // -// TargetMouseMove.m +// NJOutputMouseMove.m // Enjoy // // Created by Yifeng Huang on 7/26/12. // -#import "TargetMouseMove.h" +#import "NJOutputMouseMove.h" #import "NJInputController.h" -@implementation TargetMouseMove { +@implementation NJOutputMouseMove { int sign; } @@ -18,18 +18,18 @@ } + (NSString *)serializationCode { - return @"mmove"; + return @"mouse move"; } - (NSDictionary *)serialize { - return @{ @"type": @"mmove", @"axis": @(_axis) }; + return @{ @"type": @"mouse move", @"axis": @(_axis) }; } -+ (Target *)targetDeserialize:(NSDictionary *)serialization ++ (NJOutput *)outputDeserialize:(NSDictionary *)serialization withMappings:(NSArray *)mappings { - TargetMouseMove *target = [[TargetMouseMove alloc] init]; - target.axis = [serialization[@"axis"] intValue]; - return target; + NJOutputMouseMove *output = [[NJOutputMouseMove alloc] init]; + output.axis = [serialization[@"axis"] intValue]; + return output; } - (BOOL)update:(NJInputController *)jc { @@ -38,7 +38,7 @@ return NO; // dead zone } - // If the input crossed over High/Low, this target is done. + // If the input crossed over High/Low, this output is done. if (!sign) sign = self.magnitude < 0 ? -1 : 1; else if (sign / self.magnitude < 0) { diff --git a/TargetMouseScroll.h b/NJOutputMouseScroll.h similarity index 55% rename from TargetMouseScroll.h rename to NJOutputMouseScroll.h index d261659..6ef2cdc 100644 --- a/TargetMouseScroll.h +++ b/NJOutputMouseScroll.h @@ -1,13 +1,13 @@ // -// TargetMouseScroll.h +// NJOutputMouseScroll.h // Enjoy // // Created by Yifeng Huang on 7/28/12. // -#import "Target.h" +#import "NJOutput.h" -@interface TargetMouseScroll : Target +@interface NJOutputMouseScroll : NJOutput @property (nonatomic, assign) int amount; diff --git a/TargetMouseScroll.m b/NJOutputMouseScroll.m similarity index 74% rename from TargetMouseScroll.m rename to NJOutputMouseScroll.m index 8f87c02..9057125 100644 --- a/TargetMouseScroll.m +++ b/NJOutputMouseScroll.m @@ -1,29 +1,29 @@ // -// TargetMouseScroll.m +// NJOutputMouseScroll.m // Enjoy // // Created by Yifeng Huang on 7/28/12. // -#import "TargetMouseScroll.h" +#import "NJOutputMouseScroll.h" -@implementation TargetMouseScroll { +@implementation NJOutputMouseScroll { int sign; } + (NSString *)serializationCode { - return @"mscroll"; + return @"mouse scroll"; } - (NSDictionary *)serialize { - return @{ @"type": @"mscroll", @"amount": @(_amount) }; + return @{ @"type": @"mouse scroll", @"amount": @(_amount) }; } -+ (Target *)targetDeserialize:(NSDictionary *)serialization ++ (NJOutput *)outputDeserialize:(NSDictionary *)serialization withMappings:(NSArray *)mappings { - TargetMouseScroll *target = [[TargetMouseScroll alloc] init]; - target.amount = [serialization[@"amount"] intValue]; - return target; + NJOutputMouseScroll *output = [[NJOutputMouseScroll alloc] init]; + output.amount = [serialization[@"amount"] intValue]; + return output; } - (void)trigger { @@ -43,7 +43,7 @@ return NO; // dead zone } - // If the input crossed over High/Low, this target is done. + // If the input crossed over High/Low, this output is done. if (!sign) sign = self.magnitude < 0 ? -1 : 1; else if (sign / self.magnitude < 0) { diff --git a/NJOutputSwitchMouseMode.h b/NJOutputSwitchMouseMode.h new file mode 100644 index 0000000..790f84b --- /dev/null +++ b/NJOutputSwitchMouseMode.h @@ -0,0 +1,12 @@ +// +// NJOutputSwitchMouseMode.h +// Enjoy +// +// Created by Yifeng Huang on 7/28/12. +// + +#import "NJOutput.h" + +@interface NJOutputSwitchMouseMode : NJOutput + +@end diff --git a/TargetToggleMouseScope.m b/NJOutputSwitchMouseMode.m similarity index 64% rename from TargetToggleMouseScope.m rename to NJOutputSwitchMouseMode.m index 0413b73..3332a91 100644 --- a/TargetToggleMouseScope.m +++ b/NJOutputSwitchMouseMode.m @@ -1,29 +1,28 @@ // -// TargetToggleMouseScope.m +// NJOutputSwitchMouseMode.m // Enjoy // // Created by Yifeng Huang on 7/28/12. // -#import "TargetToggleMouseScope.h" +#import "NJOutputSwitchMouseMode.h" #import "ApplicationController.h" #import "NJInputController.h" -@implementation TargetToggleMouseScope +@implementation NJOutputSwitchMouseMode + (NSString *)serializationCode { - return @"mtoggle"; + return @"switch mouse mode"; } - (NSDictionary *)serialize { - return @{ @"type": @"mtoggle" }; + return @{ @"type": @"switch mouse mode" }; } -+ (Target *)targetDeserialize:(NSDictionary *)serialization ++ (NJOutput *)outputDeserialize:(NSDictionary *)serialization withMappings:(NSArray *)mappings { - TargetToggleMouseScope *target = [[TargetToggleMouseScope alloc] init]; - return target; + return [[NJOutputSwitchMouseMode alloc] init]; } - (void)trigger { // FIXME: It's hacky to get at the controller this way, but it's diff --git a/TargetToggleMouseScope.h b/TargetToggleMouseScope.h deleted file mode 100644 index a935c67..0000000 --- a/TargetToggleMouseScope.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// TargetToggleMouseScope.h -// Enjoy -// -// Created by Yifeng Huang on 7/28/12. -// - -#import "Target.h" - -@interface TargetToggleMouseScope : Target - -@end -- 2.30.2