From f864d363128de19fc6591b77ae9226b34166d715 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Sun, 3 Mar 2013 21:42:59 +0100 Subject: [PATCH] Big rename part 1: 'action' to 'input'. --- ApplicationController.h | 4 +- ApplicationController.m | 2 +- Config.h | 6 +- Config.m | 14 ++-- English.lproj/MainMenu.xib | 37 ++------- Enjoyable.xcodeproj/project.pbxproj | 76 +++++++++---------- Joystick.h => NJDevice.h | 12 +-- Joystick.m => NJDevice.m | 54 ++++++------- JSAction.h => NJInput.h | 10 +-- JSAction.m => NJInput.m | 10 +-- JSActionAnalog.h => NJInputAnalog.h | 6 +- JSActionAnalog.m => NJInputAnalog.m | 12 +-- JSActionButton.h => NJInputButton.h | 6 +- JSActionButton.m => NJInputButton.m | 8 +- JoystickController.h => NJInputController.h | 12 +-- JoystickController.m => NJInputController.m | 66 ++++++++-------- JSActionHat.h => NJInputHat.h | 6 +- JSActionHat.m => NJInputHat.m | 16 ++-- NJActionPathElement.h => NJInputPathElement.h | 4 +- Target.h | 4 +- Target.m | 2 +- TargetController.h | 4 +- TargetController.m | 22 +++--- TargetMouseMove.m | 6 +- TargetMouseScroll.m | 4 +- TargetToggleMouseScope.m | 4 +- 26 files changed, 190 insertions(+), 217 deletions(-) rename Joystick.h => NJDevice.h (67%) rename Joystick.m => NJDevice.m (64%) rename JSAction.h => NJInput.h (67%) rename JSAction.m => NJInput.m (68%) rename JSActionAnalog.h => NJInputAnalog.h (73%) rename JSActionAnalog.m => NJInputAnalog.m (78%) rename JSActionButton.h => NJInputButton.h (70%) rename JSActionButton.m => NJInputButton.m (81%) rename JoystickController.h => NJInputController.h (64%) rename JoystickController.m => NJInputController.m (79%) rename JSActionHat.h => NJInputHat.h (68%) rename JSActionHat.m => NJInputHat.m (86%) rename NJActionPathElement.h => NJInputPathElement.h (52%) diff --git a/ApplicationController.h b/ApplicationController.h index dc513ae..5dae0cc 100644 --- a/ApplicationController.h +++ b/ApplicationController.h @@ -6,7 +6,7 @@ // Copyright 2009 University of Otago. All rights reserved. // -@class JoystickController; +@class NJInputController; @class TargetController; @class ConfigsController; @@ -18,7 +18,7 @@ IBOutlet NSMenu *dockMenuBase; } -@property (nonatomic, strong) IBOutlet JoystickController *jsController; +@property (nonatomic, strong) IBOutlet NJInputController *jsController; @property (nonatomic, strong) IBOutlet TargetController *targetController; @property (nonatomic, strong) IBOutlet ConfigsController *configsController; diff --git a/ApplicationController.m b/ApplicationController.m index 1acc692..bc7c468 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -9,7 +9,7 @@ #import "Config.h" #import "ConfigsController.h" -#import "JoystickController.h" +#import "NJInputController.h" #import "TargetController.h" #import "NJEvents.h" diff --git a/Config.h b/Config.h index 606529d..a2ba55b 100644 --- a/Config.h +++ b/Config.h @@ -7,7 +7,7 @@ // @class Target; -@class JSAction; +@class NJInput; @interface Config : NSObject @@ -15,8 +15,8 @@ @property (nonatomic, readonly) NSMutableDictionary *entries; - (id)initWithName:(NSString *)name; -- (Target *)objectForKeyedSubscript:(JSAction *)action; -- (void)setObject:(Target *)target forKeyedSubscript:(JSAction *)action; +- (Target *)objectForKeyedSubscript:(NJInput *)input; +- (void)setObject:(Target *)target forKeyedSubscript:(NJInput *)input; - (NSDictionary *)serialize; @end diff --git a/Config.m b/Config.m index 046ccc2..1897734 100644 --- a/Config.m +++ b/Config.m @@ -7,7 +7,7 @@ #import "Config.h" -#import "JSAction.h" +#import "NJInput.h" @implementation Config @@ -19,16 +19,16 @@ return self; } -- (Target *)objectForKeyedSubscript:(JSAction *)action { - return action ? _entries[action.uid] : nil; +- (Target *)objectForKeyedSubscript:(NJInput *)input { + return input ? _entries[input.uid] : nil; } -- (void)setObject:(Target *)target forKeyedSubscript:(JSAction *)action { - if (action) { +- (void)setObject:(Target *)target forKeyedSubscript:(NJInput *)input { + if (input) { if (target) - _entries[action.uid] = target; + _entries[input.uid] = target; else - [_entries removeObjectForKey:action.uid]; + [_entries removeObjectForKey:input.uid]; } } diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 6e87fb0..e1e7aa1 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -409,7 +409,7 @@ {640, 300} - + 256 @@ -433,8 +433,7 @@ 256 {200, 298} - - + YES NO YES @@ -533,7 +532,6 @@ {{1, 1}, {200, 298}} - @@ -544,7 +542,6 @@ -2147483392 {{1, 1}, {8, 298}} - NO @@ -556,7 +553,6 @@ -2147483392 {{-100, -100}, {473, 15}} - NO 1 @@ -567,8 +563,7 @@ {202, 300} - - + 150034 @@ -581,7 +576,6 @@ {202, 300} - NSView @@ -594,7 +588,6 @@ 265 {{227, 123}, {180, 24}} - _NS:9 YES @@ -631,7 +624,6 @@ 265 {{227, 55}, {180, 24}} - _NS:9 YES @@ -663,7 +655,6 @@ 265 {{227, 89}, {180, 24}} - _NS:9 YES @@ -696,7 +687,6 @@ 265 {{229, 190}, {176, 24}} - _NS:9 NJKeyInputField @@ -706,7 +696,6 @@ 265 {{226, 156}, {182, 26}} - YES @@ -739,7 +728,6 @@ 268 {{20, 16}, {201, 236}} - NO 7 @@ -884,7 +872,6 @@ 266 {{0, 269}, {429, 17}} - YES @@ -908,7 +895,6 @@ 10 {{12, 258}, {405, 5}} - {0, 0} @@ -935,21 +921,17 @@ {{211, 0}, {429, 300}} - NSView {640, 300} - YES {640, 300} - - {{0, 0}, {1440, 878}} @@ -959,7 +941,7 @@ YES - + 256 @@ -975,7 +957,6 @@ 256 {320, 418} - YES NO @@ -1035,7 +1016,6 @@ {{1, 1}, {320, 418}} - @@ -1046,7 +1026,6 @@ -2147483392 {{306, 1}, {15, 403}} - NO @@ -1058,7 +1037,6 @@ -2147483392 {{1, 404}, {305, 15}} - NO 1 @@ -1069,7 +1047,6 @@ {{0, 34}, {322, 420}} - 133682 @@ -1085,7 +1062,6 @@ 260 {{10, 4}, {39, 28}} - YES @@ -1112,7 +1088,6 @@ 260 {{57, 4}, {39, 28}} - YES 603979776 @@ -1135,8 +1110,6 @@ {322, 454} - - NSView @@ -1158,7 +1131,7 @@ ConfigsController - JoystickController + NJInputController TargetController diff --git a/Enjoyable.xcodeproj/project.pbxproj b/Enjoyable.xcodeproj/project.pbxproj index e75f56c..5b21e99 100644 --- a/Enjoyable.xcodeproj/project.pbxproj +++ b/Enjoyable.xcodeproj/project.pbxproj @@ -18,16 +18,16 @@ D549CA4C0FBB441B00BC8203 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = D549CA4B0FBB441B00BC8203 /* Credits.rtf */; }; D5617A360FAEB74000928B3A /* ConfigsController.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617A350FAEB74000928B3A /* ConfigsController.m */; }; D5617A390FAEBA1800928B3A /* Config.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617A380FAEBA1800928B3A /* Config.m */; }; - D5617D1A0FAF568100928B3A /* JSActionButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617D190FAF568100928B3A /* JSActionButton.m */; }; - D5617D260FAF579300928B3A /* JSActionHat.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617D250FAF579300928B3A /* JSActionHat.m */; }; - D5617D2B0FAF579A00928B3A /* JSActionAnalog.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617D2A0FAF579A00928B3A /* JSActionAnalog.m */; }; + 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 */; }; D5617FE70FAFDB5800928B3A /* NJKeyInputField.m in Sources */ = {isa = PBXBuildFile; fileRef = D5617FE60FAFDB5800928B3A /* NJKeyInputField.m */; }; - D594BE860FAE6219007A85F2 /* Joystick.m in Sources */ = {isa = PBXBuildFile; fileRef = D594BE850FAE6219007A85F2 /* Joystick.m */; }; - D594BE8A0FAE64AD007A85F2 /* JSAction.m in Sources */ = {isa = PBXBuildFile; fileRef = D594BE890FAE64AD007A85F2 /* JSAction.m */; }; - D594BEF90FAE6FF2007A85F2 /* JoystickController.m in Sources */ = {isa = PBXBuildFile; fileRef = D594BEF80FAE6FF2007A85F2 /* JoystickController.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 */; }; @@ -60,12 +60,12 @@ D5617A350FAEB74000928B3A /* ConfigsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ConfigsController.m; sourceTree = ""; }; D5617A370FAEBA1800928B3A /* Config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Config.h; sourceTree = ""; }; D5617A380FAEBA1800928B3A /* Config.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Config.m; sourceTree = ""; }; - D5617D180FAF568100928B3A /* JSActionButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSActionButton.h; sourceTree = ""; }; - D5617D190FAF568100928B3A /* JSActionButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSActionButton.m; sourceTree = ""; }; - D5617D240FAF579300928B3A /* JSActionHat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSActionHat.h; sourceTree = ""; }; - D5617D250FAF579300928B3A /* JSActionHat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSActionHat.m; sourceTree = ""; }; - D5617D290FAF579A00928B3A /* JSActionAnalog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSActionAnalog.h; sourceTree = ""; }; - D5617D2A0FAF579A00928B3A /* JSActionAnalog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSActionAnalog.m; sourceTree = ""; }; + D5617D180FAF568100928B3A /* NJInputButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJInputButton.h; sourceTree = ""; }; + D5617D190FAF568100928B3A /* NJInputButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NJInputButton.m; sourceTree = ""; }; + D5617D240FAF579300928B3A /* NJInputHat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJInputHat.h; sourceTree = ""; }; + 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 = ""; }; @@ -74,12 +74,12 @@ D5617FE30FAFD7B000928B3A /* TargetController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TargetController.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 /* Joystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Joystick.h; sourceTree = ""; }; - D594BE850FAE6219007A85F2 /* Joystick.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Joystick.m; sourceTree = ""; }; - D594BE880FAE64AD007A85F2 /* JSAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAction.h; sourceTree = ""; }; - D594BE890FAE64AD007A85F2 /* JSAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSAction.m; sourceTree = ""; }; - D594BEF70FAE6FF2007A85F2 /* JoystickController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JoystickController.h; sourceTree = ""; }; - D594BEF80FAE6FF2007A85F2 /* JoystickController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JoystickController.m; sourceTree = ""; }; + D594BE840FAE6219007A85F2 /* NJDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NJDevice.h; sourceTree = ""; }; + 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 = ""; }; 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 = ""; }; @@ -89,7 +89,7 @@ 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 = ""; }; EE1D7C9516E0ECCF00B000EB /* NSError+Description.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSError+Description.m"; sourceTree = ""; }; - EEF86B7316E2241000674B87 /* NJActionPathElement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NJActionPathElement.h; sourceTree = ""; }; + EEF86B7316E2241000674B87 /* NJInputPathElement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NJInputPathElement.h; sourceTree = ""; }; EEF86B7416E298CD00674B87 /* NJEvents.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NJEvents.h; sourceTree = ""; }; /* End PBXFileReference section */ @@ -109,18 +109,18 @@ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( - D5617D290FAF579A00928B3A /* JSActionAnalog.h */, - D5617D2A0FAF579A00928B3A /* JSActionAnalog.m */, - D594BE840FAE6219007A85F2 /* Joystick.h */, - D594BE850FAE6219007A85F2 /* Joystick.m */, - D594BE880FAE64AD007A85F2 /* JSAction.h */, - D594BE890FAE64AD007A85F2 /* JSAction.m */, - D5617D240FAF579300928B3A /* JSActionHat.h */, - D5617D250FAF579300928B3A /* JSActionHat.m */, - D5617D180FAF568100928B3A /* JSActionButton.h */, - D5617D190FAF568100928B3A /* JSActionButton.m */, - D594BEF70FAE6FF2007A85F2 /* JoystickController.h */, - D594BEF80FAE6FF2007A85F2 /* JoystickController.m */, + D5617D290FAF579A00928B3A /* NJInputAnalog.h */, + D5617D2A0FAF579A00928B3A /* NJInputAnalog.m */, + D594BE840FAE6219007A85F2 /* NJDevice.h */, + D594BE850FAE6219007A85F2 /* NJDevice.m */, + D594BE880FAE64AD007A85F2 /* NJInput.h */, + D594BE890FAE64AD007A85F2 /* NJInput.m */, + D5617D240FAF579300928B3A /* NJInputHat.h */, + D5617D250FAF579300928B3A /* NJInputHat.m */, + D5617D180FAF568100928B3A /* NJInputButton.h */, + D5617D190FAF568100928B3A /* NJInputButton.m */, + D594BEF70FAE6FF2007A85F2 /* NJInputController.h */, + D594BEF80FAE6FF2007A85F2 /* NJInputController.m */, D594BF810FAE9661007A85F2 /* ApplicationController.h */, D594BF820FAE9661007A85F2 /* ApplicationController.m */, D5617A340FAEB74000928B3A /* ConfigsController.h */, @@ -145,7 +145,7 @@ 8BEFAD9B15C46BFF00823AEC /* TargetMouseScroll.m */, 8BEFAD9E15C476DC00823AEC /* TargetToggleMouseScope.h */, 8BEFAD9F15C476DC00823AEC /* TargetToggleMouseScope.m */, - EEF86B7316E2241000674B87 /* NJActionPathElement.h */, + EEF86B7316E2241000674B87 /* NJInputPathElement.h */, EEF86B7416E298CD00674B87 /* NJEvents.h */, ); name = Classes; @@ -291,15 +291,15 @@ buildActionMask = 2147483647; files = ( 8D11072D0486CEB800E47090 /* main.m in Sources */, - D594BE860FAE6219007A85F2 /* Joystick.m in Sources */, - D594BE8A0FAE64AD007A85F2 /* JSAction.m in Sources */, - D594BEF90FAE6FF2007A85F2 /* JoystickController.m in Sources */, + D594BE860FAE6219007A85F2 /* NJDevice.m in Sources */, + D594BE8A0FAE64AD007A85F2 /* NJInput.m in Sources */, + D594BEF90FAE6FF2007A85F2 /* NJInputController.m in Sources */, D594BF830FAE9661007A85F2 /* ApplicationController.m in Sources */, D5617A360FAEB74000928B3A /* ConfigsController.m in Sources */, D5617A390FAEBA1800928B3A /* Config.m in Sources */, - D5617D1A0FAF568100928B3A /* JSActionButton.m in Sources */, - D5617D260FAF579300928B3A /* JSActionHat.m in Sources */, - D5617D2B0FAF579A00928B3A /* JSActionAnalog.m in Sources */, + 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 */, diff --git a/Joystick.h b/NJDevice.h similarity index 67% rename from Joystick.h rename to NJDevice.h index e5566f1..ec607ac 100644 --- a/Joystick.h +++ b/NJDevice.h @@ -1,16 +1,16 @@ // -// Joystick.h +// NJDevice.h // Enjoy // // Created by Sam McCall on 4/05/09. // Copyright 2009 University of Otago. All rights reserved. // -#import "NJActionPathElement.h" +#import "NJInputPathElement.h" -@class JSAction; +@class NJInput; -@interface Joystick : NSObject +@interface NJDevice : NSObject @property (nonatomic, assign) int index; @property (nonatomic, copy) NSString *productName; @@ -20,7 +20,7 @@ @property (readonly) NSString *uid; - (id)initWithDevice:(IOHIDDeviceRef)device; -- (JSAction *)handlerForEvent:(IOHIDValueRef)value; -- (JSAction *)actionForEvent:(IOHIDValueRef)value; +- (NJInput *)handlerForEvent:(IOHIDValueRef)value; +- (NJInput *)inputForEvent:(IOHIDValueRef)value; @end diff --git a/Joystick.m b/NJDevice.m similarity index 64% rename from Joystick.m rename to NJDevice.m index 4753caf..69775d8 100644 --- a/Joystick.m +++ b/NJDevice.m @@ -1,18 +1,18 @@ // -// Joystick.m +// NJDevice.m // Enjoy // // Created by Sam McCall on 4/05/09. // -#import "Joystick.h" +#import "NJDevice.h" -#import "JSAction.h" -#import "JSActionAnalog.h" -#import "JSActionButton.h" -#import "JSActionHat.h" +#import "NJInput.h" +#import "NJInputAnalog.h" +#import "NJInputHat.h" +#import "NJInputButton.h" -static NSArray *ActionsForElement(IOHIDDeviceRef device, id base) { +static NSArray *InputsForElement(IOHIDDeviceRef device, id base) { CFArrayRef elements = IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone); NSMutableArray *children = [NSMutableArray arrayWithCapacity:CFArrayGetCount(elements)]; @@ -29,7 +29,7 @@ static NSArray *ActionsForElement(IOHIDDeviceRef device, id base) { long min = IOHIDElementGetPhysicalMin(element); CFStringRef elName = IOHIDElementGetName(element); - JSAction *action = nil; + NJInput *input = nil; if (!(type == kIOHIDElementTypeInput_Misc || type == kIOHIDElementTypeInput_Axis @@ -37,30 +37,30 @@ static NSArray *ActionsForElement(IOHIDDeviceRef device, id base) { continue; if (max - min == 1 || usagePage == kHIDPage_Button || type == kIOHIDElementTypeInput_Button) { - action = [[JSActionButton alloc] initWithName:(__bridge NSString *)elName - idx:++buttons - max:max]; + input = [[NJInputButton alloc] initWithName:(__bridge NSString *)elName + idx:++buttons + max:max]; } else if (usage == kHIDUsage_GD_Hatswitch) { - action = [[JSActionHat alloc] initWithIndex:++hats]; + input = [[NJInputHat alloc] initWithIndex:++hats]; } else if (usage >= kHIDUsage_GD_X && usage <= kHIDUsage_GD_Rz) { - action = [[JSActionAnalog alloc] initWithIndex:++axes - rawMin:min - rawMax:max]; + input = [[NJInputAnalog alloc] initWithIndex:++axes + rawMin:min + rawMax:max]; } else { continue; } // TODO(jfw): Should be moved into better constructors. - action.base = base; - action.cookie = IOHIDElementGetCookie(element); - [children addObject:action]; + input.base = base; + input.cookie = IOHIDElementGetCookie(element); + [children addObject:input]; } CFRelease(elements); return children; } -@implementation Joystick { +@implementation NJDevice { int vendorId; int productId; } @@ -71,7 +71,7 @@ static NSArray *ActionsForElement(IOHIDDeviceRef device, id base) { self.productName = (__bridge NSString *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDProductKey)); vendorId = [(__bridge NSNumber *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDVendorIDKey)) intValue]; productId = [(__bridge NSNumber *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDProductIDKey)) intValue]; - self.children = ActionsForElement(dev, self); + self.children = InputsForElement(dev, self); } return self; } @@ -88,22 +88,22 @@ static NSArray *ActionsForElement(IOHIDDeviceRef device, id base) { return [NSString stringWithFormat: @"%d:%d:%d", vendorId, productId, _index]; } -- (JSAction *)findActionByCookie:(IOHIDElementCookie)cookie { - for (JSAction *child in _children) +- (NJInput *)findInputByCookie:(IOHIDElementCookie)cookie { + for (NJInput *child in _children) if (child.cookie == cookie) return child; return nil; } -- (JSAction *)handlerForEvent:(IOHIDValueRef)value { - JSAction *mainAction = [self actionForEvent:value]; - return [mainAction findSubActionForValue:value]; +- (NJInput *)handlerForEvent:(IOHIDValueRef)value { + NJInput *mainInput = [self inputForEvent:value]; + return [mainInput findSubInputForValue:value]; } -- (JSAction *)actionForEvent:(IOHIDValueRef)value { +- (NJInput *)inputForEvent:(IOHIDValueRef)value { IOHIDElementRef elt = IOHIDValueGetElement(value); IOHIDElementCookie cookie = IOHIDElementGetCookie(elt); - return [self findActionByCookie:cookie]; + return [self findInputByCookie:cookie]; } @end diff --git a/JSAction.h b/NJInput.h similarity index 67% rename from JSAction.h rename to NJInput.h index dc00a8d..e2c8404 100644 --- a/JSAction.h +++ b/NJInput.h @@ -1,14 +1,14 @@ // -// JSAction.h +// NJInput.h // Enjoy // // Created by Sam McCall on 4/05/09. // Copyright 2009 University of Otago. All rights reserved. // -#import "NJActionPathElement.h" +#import "NJInputPathElement.h" -@interface JSAction : NSObject +@interface NJInput : NSObject @property (nonatomic, assign) IOHIDElementCookie cookie; @property (nonatomic, copy) NSArray *children; @@ -18,9 +18,9 @@ @property (nonatomic, readonly) float magnitude; @property (readonly) NSString *uid; -- (id)initWithName:(NSString *)newName base:(id )newBase; +- (id)initWithName:(NSString *)newName base:(id )newBase; - (void)notifyEvent:(IOHIDValueRef)value; -- (id)findSubActionForValue:(IOHIDValueRef)value; +- (id)findSubInputForValue:(IOHIDValueRef)value; @end diff --git a/JSAction.m b/NJInput.m similarity index 68% rename from JSAction.m rename to NJInput.m index 1cdbeb2..cccda29 100644 --- a/JSAction.m +++ b/NJInput.m @@ -1,15 +1,15 @@ // -// JSAction.m +// NJInput.m // Enjoy // // Created by Sam McCall on 4/05/09. // -#import "JSAction.h" +#import "NJInput.h" -@implementation JSAction +@implementation NJInput -- (id)initWithName:(NSString *)newName base:(id )newBase { +- (id)initWithName:(NSString *)newName base:(id )newBase { if ((self = [super init])) { self.name = newName; self.base = newBase; @@ -17,7 +17,7 @@ return self; } -- (id)findSubActionForValue:(IOHIDValueRef)value { +- (id)findSubInputForValue:(IOHIDValueRef)value { return NULL; } diff --git a/JSActionAnalog.h b/NJInputAnalog.h similarity index 73% rename from JSActionAnalog.h rename to NJInputAnalog.h index deaf3a5..e79ed89 100644 --- a/JSActionAnalog.h +++ b/NJInputAnalog.h @@ -1,5 +1,5 @@ // -// JSActionAnalog.h +// NJInputAnalog.h // Enjoy // // Created by Sam McCall on 5/05/09. @@ -8,9 +8,9 @@ #import -#import "JSAction.h" +#import "NJInput.h" -@interface JSActionAnalog : JSAction +@interface NJInputAnalog : NJInput - (id)initWithIndex:(int)index rawMin:(long)rawMin rawMax:(long)rawMax; diff --git a/JSActionAnalog.m b/NJInputAnalog.m similarity index 78% rename from JSActionAnalog.m rename to NJInputAnalog.m index 9c98f21..98ed018 100644 --- a/JSActionAnalog.m +++ b/NJInputAnalog.m @@ -1,5 +1,5 @@ // -// JSActionAnalog.m +// NJInputAnalog.m // Enjoy // // Created by Sam McCall on 5/05/09. @@ -7,13 +7,13 @@ #define DEAD_ZONE 0.3 -#import "JSActionAnalog.h" +#import "NJInputAnalog.h" static float normalize(long p, long min, long max) { return 2 * (p - min) / (float)(max - min) - 1; } -@implementation JSActionAnalog { +@implementation NJInputAnalog { float magnitude; long rawMin; long rawMax; @@ -22,15 +22,15 @@ static float normalize(long p, long min, long max) { - (id)initWithIndex:(int)index rawMin:(long)rawMin_ rawMax:(long)rawMax_ { if ((self = [super init])) { self.name = [[NSString alloc] initWithFormat: @"Axis %d", index]; - self.children = @[[[JSAction alloc] initWithName:@"Low" base:self], - [[JSAction alloc] initWithName:@"High" base:self]]; + self.children = @[[[NJInput alloc] initWithName:@"Low" base:self], + [[NJInput alloc] initWithName:@"High" base:self]]; rawMax = rawMax_; rawMin = rawMin_; } return self; } -- (id)findSubActionForValue:(IOHIDValueRef)value { +- (id)findSubInputForValue:(IOHIDValueRef)value { float mag = normalize(IOHIDValueGetIntegerValue(value), rawMin, rawMax); if (mag < -DEAD_ZONE) return self.children[0]; diff --git a/JSActionButton.h b/NJInputButton.h similarity index 70% rename from JSActionButton.h rename to NJInputButton.h index 8a4bdc6..31cba73 100644 --- a/JSActionButton.h +++ b/NJInputButton.h @@ -1,14 +1,14 @@ // -// JSActionButton.h +// NJInputButton.h // Enjoy // // Created by Sam McCall on 5/05/09. // Copyright 2009 University of Otago. All rights reserved. // -#import "JSAction.h" +#import "NJInput.h" -@interface JSActionButton : JSAction +@interface NJInputButton : NJInput - (id)initWithName:(NSString *)name idx:(int)idx max:(long)max; diff --git a/JSActionButton.m b/NJInputButton.m similarity index 81% rename from JSActionButton.m rename to NJInputButton.m index 7d2572a..c500276 100644 --- a/JSActionButton.m +++ b/NJInputButton.m @@ -1,13 +1,13 @@ // -// JSActionButton.m +// NJInputButton.m // Enjoy // // Created by Sam McCall on 5/05/09. // -#import "JSActionButton.h" +#import "NJInputButton.h" -@implementation JSActionButton { +@implementation NJInputButton { long _max; } @@ -22,7 +22,7 @@ return self; } -- (id)findSubActionForValue:(IOHIDValueRef)val { +- (id)findSubInputForValue:(IOHIDValueRef)val { return (IOHIDValueGetIntegerValue(val) == _max) ? self : nil; } diff --git a/JoystickController.h b/NJInputController.h similarity index 64% rename from JoystickController.h rename to NJInputController.h index d56f932..1c4853c 100644 --- a/JoystickController.h +++ b/NJInputController.h @@ -1,26 +1,26 @@ // -// JoystickController.h +// NJInputController.h // Enjoy // // Created by Sam McCall on 4/05/09. // Copyright 2009 University of Otago. All rights reserved. // -@class Joystick; -@class JSAction; +@class NJDevice; +@class NJInput; @class ConfigsController; @class TargetController; -@interface JoystickController : NSObject { +@interface NJInputController : NSObject { IBOutlet NSOutlineView *outlineView; IBOutlet TargetController *targetController; IBOutlet ConfigsController *configsController; } - (void)setup; -- (Joystick *)findJoystickByRef:(IOHIDDeviceRef)device; +- (NJDevice *)findJoystickByRef:(IOHIDDeviceRef)device; -@property (nonatomic, readonly) JSAction *selectedAction; +@property (nonatomic, readonly) NJInput *selectedInput; @property (nonatomic, assign) NSPoint mouseLoc; @property (nonatomic, assign) BOOL frontWindowOnly; @property (nonatomic, assign) BOOL translatingEvents; diff --git a/JoystickController.m b/NJInputController.m similarity index 79% rename from JoystickController.m rename to NJInputController.m index 2efd68f..9ee6d04 100644 --- a/JoystickController.m +++ b/NJInputController.m @@ -1,21 +1,21 @@ // -// JoystickController.m +// NJInputController.h // Enjoy // // Created by Sam McCall on 4/05/09. // -#import "JoystickController.h" +#import "NJInputController.h" #import "Config.h" #import "ConfigsController.h" -#import "Joystick.h" -#import "JSAction.h" +#import "NJDevice.h" +#import "NJInput.h" #import "Target.h" #import "TargetController.h" #import "NJEvents.h" -@implementation JoystickController { +@implementation NJInputController { IOHIDManagerRef hidManager; NSTimer *continuousTimer; NSMutableArray *runningTargets; @@ -36,7 +36,7 @@ CFRelease(hidManager); } -- (void)expandRecursive:(id )pathElement { +- (void)expandRecursive:(id )pathElement { if (pathElement) { [self expandRecursive:pathElement.base]; [outlineView expandItem:pathElement]; @@ -50,7 +50,7 @@ if (!continuousTimer) { continuousTimer = [NSTimer scheduledTimerWithTimeInterval:1.f/60.f target:self - selector:@selector(updateContinuousActions:) + selector:@selector(updateContinuousInputs:) userInfo:nil repeats:YES]; NSLog(@"Scheduled continuous target timer."); @@ -58,22 +58,22 @@ } - (void)runTargetForDevice:(IOHIDDeviceRef)device value:(IOHIDValueRef)value { - Joystick *js = [self findJoystickByRef:device]; - JSAction *mainAction = [js actionForEvent:value]; - [mainAction notifyEvent:value]; - NSArray *children = mainAction.children ? mainAction.children : mainAction ? @[mainAction] : @[]; - for (JSAction *subaction in children) { - Target *target = configsController.currentConfig[subaction]; - target.magnitude = mainAction.magnitude; - target.running = subaction.active; + NJDevice *js = [self findJoystickByRef:device]; + NJInput *mainInput = [js inputForEvent:value]; + [mainInput notifyEvent:value]; + NSArray *children = mainInput.children ? mainInput.children : mainInput ? @[mainInput] : @[]; + for (NJInput *subInput in children) { + Target *target = configsController.currentConfig[subInput]; + target.magnitude = mainInput.magnitude; + target.running = subInput.active; if (target.running && target.isContinuous) [self addRunningTarget:target]; } } - (void)showTargetForDevice:(IOHIDDeviceRef)device value:(IOHIDValueRef)value { - Joystick *js = [self findJoystickByRef:device]; - JSAction *handler = [js handlerForEvent:value]; + NJDevice *js = [self findJoystickByRef:device]; + NJInput *handler = [js handlerForEvent:value]; if (!handler) return; @@ -83,7 +83,7 @@ } static void input_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDValueRef value) { - JoystickController *controller = (__bridge JoystickController *)ctx; + NJInputController *controller = (__bridge NJInputController *)ctx; IOHIDDeviceRef device = IOHIDQueueGetDevice(inSender); if (controller.translatingEvents) { @@ -93,10 +93,10 @@ static void input_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDVa } } -static int findAvailableIndex(NSArray *list, Joystick *js) { +static int findAvailableIndex(NSArray *list, NJDevice *js) { for (int index = 1; ; index++) { BOOL available = YES; - for (Joystick *used in list) { + for (NJDevice *used in list) { if ([used.productName isEqualToString:js.productName] && used.index == index) { available = NO; break; @@ -109,31 +109,31 @@ static int findAvailableIndex(NSArray *list, Joystick *js) { - (void)addJoystickForDevice:(IOHIDDeviceRef)device { IOHIDDeviceRegisterInputValueCallback(device, input_callback, (__bridge void*)self); - Joystick *js = [[Joystick alloc] initWithDevice:device]; + NJDevice *js = [[NJDevice alloc] initWithDevice:device]; js.index = findAvailableIndex(_joysticks, js); [_joysticks addObject:js]; [outlineView reloadData]; } static void add_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDDeviceRef device) { - JoystickController *controller = (__bridge JoystickController *)ctx; + NJInputController *controller = (__bridge NJInputController *)ctx; [controller addJoystickForDevice:device]; } -- (Joystick *)findJoystickByRef:(IOHIDDeviceRef)device { - for (Joystick *js in _joysticks) +- (NJDevice *)findJoystickByRef:(IOHIDDeviceRef)device { + for (NJDevice *js in _joysticks) if (js.device == device) return js; return nil; } static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDDeviceRef device) { - JoystickController *controller = (__bridge JoystickController *)ctx; + NJInputController *controller = (__bridge NJInputController *)ctx; [controller removeJoystickForDevice:device]; } - (void)removeJoystickForDevice:(IOHIDDeviceRef)device { - Joystick *match = [self findJoystickByRef:device]; + NJDevice *match = [self findJoystickByRef:device]; IOHIDDeviceRegisterInputValueCallback(device, NULL, NULL); if (match) { [_joysticks removeObject:match]; @@ -142,7 +142,7 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD } -- (void)updateContinuousActions:(NSTimer *)timer { +- (void)updateContinuousInputs:(NSTimer *)timer { self.mouseLoc = [NSEvent mouseLocation]; for (Target *target in [runningTargets copy]) { if (![target update:self]) { @@ -189,30 +189,30 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD IOHIDManagerRegisterDeviceRemovalCallback(hidManager, remove_callback, (__bridge void *)self); } -- (JSAction *)selectedAction { - id item = [outlineView itemAtRow:outlineView.selectedRow]; +- (NJInput *)selectedInput { + id item = [outlineView itemAtRow:outlineView.selectedRow]; return (!item.children && item.base) ? item : nil; } - (NSInteger)outlineView:(NSOutlineView *)outlineView - numberOfChildrenOfItem:(id )item { + numberOfChildrenOfItem:(id )item { return item ? item.children.count : _joysticks.count; } - (BOOL)outlineView:(NSOutlineView *)outlineView - isItemExpandable:(id )item { + isItemExpandable:(id )item { return item ? [[item children] count] > 0: YES; } - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index - ofItem:(id )item { + ofItem:(id )item { return item ? item.children[index] : _joysticks[index]; } - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn - byItem:(id )item { + byItem:(id )item { return item ? item.name : @"root"; } diff --git a/JSActionHat.h b/NJInputHat.h similarity index 68% rename from JSActionHat.h rename to NJInputHat.h index 7c9ffce..5290d71 100644 --- a/JSActionHat.h +++ b/NJInputHat.h @@ -1,14 +1,14 @@ // -// JSActionHat.h +// NJInputHat.h // Enjoy // // Created by Sam McCall on 5/05/09. // Copyright 2009 University of Otago. All rights reserved. // -#import "JSAction.h" +#import "NJInput.h" -@interface JSActionHat : JSAction +@interface NJInputHat : NJInput - (id)initWithIndex:(int)index; diff --git a/JSActionHat.m b/NJInputHat.m similarity index 86% rename from JSActionHat.m rename to NJInputHat.m index 2cac39c..b7d0161 100644 --- a/JSActionHat.m +++ b/NJInputHat.m @@ -1,11 +1,11 @@ // -// JSActionHat.m +// NJInputHat.m // Enjoy // // Created by Sam McCall on 5/05/09. // -#import "JSActionHat.h" +#import "NJInputHat.h" static BOOL active_eightway[36] = { NO, NO, NO, NO , // center @@ -27,20 +27,20 @@ static BOOL active_fourway[20] = { NO, NO, YES, NO , // W }; -@implementation JSActionHat +@implementation NJInputHat - (id)initWithIndex:(int)index { if ((self = [super init])) { - self.children = @[[[JSAction alloc] initWithName:@"Up" base:self], - [[JSAction alloc] initWithName:@"Down" base:self], - [[JSAction alloc] initWithName:@"Left" base:self], - [[JSAction alloc] initWithName:@"Right" base:self]]; + self.children = @[[[NJInput alloc] initWithName:@"Up" base:self], + [[NJInput alloc] initWithName:@"Down" base:self], + [[NJInput alloc] initWithName:@"Left" base:self], + [[NJInput alloc] initWithName:@"Right" base:self]]; self.name = [NSString stringWithFormat:@"Hat Switch %d", index]; } return self; } -- (id)findSubActionForValue:(IOHIDValueRef)value { +- (id)findSubInputForValue:(IOHIDValueRef)value { long parsed = IOHIDValueGetIntegerValue(value); switch (IOHIDElementGetLogicalMax(IOHIDValueGetElement(value))) { case 7: // 8-way switch, 0-7. diff --git a/NJActionPathElement.h b/NJInputPathElement.h similarity index 52% rename from NJActionPathElement.h rename to NJInputPathElement.h index f5eb0ca..8fe5c65 100644 --- a/NJActionPathElement.h +++ b/NJInputPathElement.h @@ -1,9 +1,9 @@ #import -@protocol NJActionPathElement +@protocol NJInputPathElement - (NSArray *)children; -- (id ) base; +- (id ) base; - (NSString *)name; @end diff --git a/Target.h b/Target.h index df3535b..d234162 100644 --- a/Target.h +++ b/Target.h @@ -6,7 +6,7 @@ // Copyright 2009 University of Otago. All rights reserved. // -@class JoystickController; +@class NJInputController; @interface Target : NSObject @@ -16,7 +16,7 @@ - (void)trigger; - (void)untrigger; -- (BOOL)update:(JoystickController *)jc; +- (BOOL)update:(NJInputController *)jc; - (NSDictionary *)serialize; + (Target *)targetDeserialize:(NSDictionary *)serialization diff --git a/Target.m b/Target.m index 493f94a..42d004c 100644 --- a/Target.m +++ b/Target.m @@ -63,7 +63,7 @@ - (void)untrigger { } -- (BOOL)update:(JoystickController *)jc { +- (BOOL)update:(NJInputController *)jc { return NO; } diff --git a/TargetController.h b/TargetController.h index 9c03c08..7f9e159 100644 --- a/TargetController.h +++ b/TargetController.h @@ -9,7 +9,7 @@ #import "NJKeyInputField.h" @class ConfigsController; -@class JoystickController; +@class NJInputController; @class Target; @class TargetMouseMove; @@ -22,7 +22,7 @@ IBOutlet NSTextField *title; IBOutlet NSPopUpButton *configPopup; IBOutlet ConfigsController *configsController; - IBOutlet JoystickController *joystickController; + IBOutlet NJInputController *joystickController; } @property (assign) BOOL enabled; diff --git a/TargetController.m b/TargetController.m index 48119c2..2e53917 100644 --- a/TargetController.m +++ b/TargetController.m @@ -9,8 +9,8 @@ #import "ConfigsController.h" #import "Config.h" -#import "JSAction.h" -#import "JoystickController.h" +#import "NJInput.h" +#import "NJInputController.h" #import "NJKeyInputField.h" #import "TargetConfig.h" #import "TargetController.h" @@ -98,7 +98,7 @@ } - (Target *)currentTarget { - return configsController.currentConfig[joystickController.selectedAction]; + return configsController.currentConfig[joystickController.selectedInput]; } - (Target *)makeTarget { @@ -145,7 +145,7 @@ - (void)commit { [self cleanUpInterface]; - configsController.currentConfig[joystickController.selectedAction] = [self makeTarget]; + configsController.currentConfig[joystickController.selectedInput] = [self makeTarget]; [configsController save]; } @@ -162,17 +162,17 @@ [scrollDirSelect setEnabled:enabled]; } -- (void)loadTarget:(Target *)target forAction:(JSAction *)action { - if (!action) { +- (void)loadTarget:(Target *)target forInput:(NJInput *)input { + if (!input) { self.enabled = NO; title.stringValue = @""; } else { self.enabled = YES; - NSString *actFullName = action.name; - for (id cur = action.base; cur; cur = cur.base) { - actFullName = [[NSString alloc] initWithFormat:@"%@ > %@", cur.name, actFullName]; + NSString *inpFullName = input.name; + for (id cur = input.base; cur; cur = cur.base) { + inpFullName = [[NSString alloc] initWithFormat:@"%@ > %@", cur.name, inpFullName]; } - title.stringValue = [[NSString alloc] initWithFormat:@"%@ > %@", configsController.currentConfig.name, actFullName]; + title.stringValue = [[NSString alloc] initWithFormat:@"%@ > %@", configsController.currentConfig.name, inpFullName]; } if ([target isKindOfClass:TargetKeyboard.class]) { @@ -209,7 +209,7 @@ } - (void)loadCurrent { - [self loadTarget:self.currentTarget forAction:joystickController.selectedAction]; + [self loadTarget:self.currentTarget forInput:joystickController.selectedInput]; } - (void)focusKey { diff --git a/TargetMouseMove.m b/TargetMouseMove.m index 3ec8f38..2806827 100644 --- a/TargetMouseMove.m +++ b/TargetMouseMove.m @@ -7,7 +7,7 @@ #import "TargetMouseMove.h" -#import "JoystickController.h" +#import "NJInputController.h" @implementation TargetMouseMove { int sign; @@ -32,13 +32,13 @@ return target; } -- (BOOL)update:(JoystickController *)jc { +- (BOOL)update:(NJInputController *)jc { if (fabsf(self.magnitude) < 0.01) { sign = 0; return NO; // dead zone } - // If the action crossed over High/Low, this target is done. + // If the input crossed over High/Low, this target is done. if (!sign) sign = self.magnitude < 0 ? -1 : 1; else if (sign / self.magnitude < 0) { diff --git a/TargetMouseScroll.m b/TargetMouseScroll.m index 6595628..ac3b852 100644 --- a/TargetMouseScroll.m +++ b/TargetMouseScroll.m @@ -37,13 +37,13 @@ } } -- (BOOL)update:(JoystickController *)jc { +- (BOOL)update:(NJInputController *)jc { if (fabsf(self.magnitude) < 0.01f) { sign = 0; return NO; // dead zone } - // If the action crossed over High/Low, this target is done. + // If the input crossed over High/Low, this target is done. if (!sign) sign = self.magnitude < 0 ? -1 : 1; else if (sign / self.magnitude < 0) { diff --git a/TargetToggleMouseScope.m b/TargetToggleMouseScope.m index 863a35f..499e9c9 100644 --- a/TargetToggleMouseScope.m +++ b/TargetToggleMouseScope.m @@ -8,7 +8,7 @@ #import "TargetToggleMouseScope.h" #import "ApplicationController.h" -#import "JoystickController.h" +#import "NJInputController.h" @implementation TargetToggleMouseScope @@ -29,7 +29,7 @@ // 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; - JoystickController *jc = ac.jsController; + NJInputController *jc = ac.jsController; jc.frontWindowOnly = !jc.frontWindowOnly; } -- 2.30.2