From eb9ae7c6c0504f07fe058e9be43ec26763be4591 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Thu, 14 Mar 2013 20:05:05 +0100 Subject: [PATCH] Some more renames. --- Classes/EnjoyableApplicationDelegate.m | 12 ++-- Classes/NJDevice.m | 2 +- Classes/NJDeviceController.h | 4 +- Classes/NJDeviceController.m | 26 ++++---- Classes/NJInput.h | 2 +- Classes/NJInput.m | 4 +- Classes/NJInputAnalog.m | 2 +- Classes/NJMappingMenuController.h | 4 +- Classes/NJMappingMenuController.m | 20 +++--- Info.plist | 2 +- Other Sources/NJEvents.h | 4 +- Resources/English.lproj/Localizable.strings | Bin 7520 -> 7516 bytes Resources/English.lproj/MainMenu.xib | 66 +++++++------------- 13 files changed, 63 insertions(+), 85 deletions(-) diff --git a/Classes/EnjoyableApplicationDelegate.m b/Classes/EnjoyableApplicationDelegate.m index b1d9907..db62f53 100644 --- a/Classes/EnjoyableApplicationDelegate.m +++ b/Classes/EnjoyableApplicationDelegate.m @@ -31,13 +31,13 @@ object:nil]; [NSNotificationCenter.defaultCenter addObserver:self - selector:@selector(eventTranslationActivated:) - name:NJEventTranslationActivated + selector:@selector(eventSimulationStarted:) + name:NJEventSimulationStarted object:nil]; [NSNotificationCenter.defaultCenter addObserver:self - selector:@selector(eventTranslationDeactivated:) - name:NJEventTranslationDeactivated + selector:@selector(eventSimulationStopped:) + name:NJEventSimulationStopped object:nil]; [self.mappingsController load]; @@ -104,7 +104,7 @@ return NO; } -- (void)eventTranslationActivated:(NSNotification *)note { +- (void)eventSimulationStarted:(NSNotification *)note { statusItem.image = [NSImage imageNamed:@"Status Menu Icon"]; [NSWorkspace.sharedWorkspace.notificationCenter addObserver:self @@ -113,7 +113,7 @@ object:nil]; } -- (void)eventTranslationDeactivated:(NSNotification *)note { +- (void)eventSimulationStopped:(NSNotification *)note { statusItem.image = [NSImage imageNamed:@"Status Menu Icon Disabled"]; [NSWorkspace.sharedWorkspace.notificationCenter removeObserver:self diff --git a/Classes/NJDevice.m b/Classes/NJDevice.m index e4c6b3d..b03898f 100644 --- a/Classes/NJDevice.m +++ b/Classes/NJDevice.m @@ -81,7 +81,7 @@ static NSArray *InputsForElement(IOHIDDeviceRef device, id parent) { } - (NSString *)uid { - return [NSString stringWithFormat: @"%d:%d:%d", _vendorId, _productId, _index]; + return [NSString stringWithFormat:@"%d:%d:%d", _vendorId, _productId, _index]; } - (NJInput *)findInputByCookie:(IOHIDElementCookie)cookie { diff --git a/Classes/NJDeviceController.h b/Classes/NJDeviceController.h index f49d647..1391121 100644 --- a/Classes/NJDeviceController.h +++ b/Classes/NJDeviceController.h @@ -26,8 +26,8 @@ @property (nonatomic, readonly) NJInput *selectedInput; @property (nonatomic, assign) NSPoint mouseLoc; -@property (nonatomic, assign) BOOL translatingEvents; +@property (nonatomic, assign) BOOL simulatingEvents; -- (IBAction)translatingEventsChanged:(NSButton *)sender; +- (IBAction)simulatingEventsChanged:(NSButton *)sender; @end diff --git a/Classes/NJDeviceController.m b/Classes/NJDeviceController.m index 8cc5f2a..39ec389 100644 --- a/Classes/NJDeviceController.m +++ b/Classes/NJDeviceController.m @@ -144,7 +144,7 @@ - (void)hidManager:(NJHIDManager *)manager valueChanged:(IOHIDValueRef)value fromDevice:(IOHIDDeviceRef)device { - if (self.translatingEvents) { + if (self.simulatingEvents) { [self runOutputForDevice:device value:value]; } else { [self showOutputForDevice:device value:value]; @@ -222,7 +222,7 @@ static int findAvailableIndex(NSArray *list, NJDevice *dev) { didPresentSelector:nil contextInfo:nil]; } - self.translatingEvents = NO; + self.simulatingEvents = NO; if (manager.running) [self hidManagerDidStart:manager]; else @@ -312,18 +312,18 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn forKey:@"expanded rows"]; } -- (void)setTranslatingEvents:(BOOL)translatingEvents { - if (translatingEvents != _translatingEvents) { - _translatingEvents = translatingEvents; - NSInteger state = translatingEvents ? NSOnState : NSOffState; +- (void)setSimulatingEvents:(BOOL)simulatingEvents { + if (simulatingEvents != _simulatingEvents) { + _simulatingEvents = simulatingEvents; + NSInteger state = simulatingEvents ? NSOnState : NSOffState; translatingEventsButton.state = state; - NSString *name = translatingEvents - ? NJEventTranslationActivated - : NJEventTranslationDeactivated; + NSString *name = simulatingEvents + ? NJEventSimulationStarted + : NJEventSimulationStopped; [NSNotificationCenter.defaultCenter postNotificationName:name object:self]; - if (!translatingEvents && !NSApplication.sharedApplication.isActive) + if (!simulatingEvents && !NSApplication.sharedApplication.isActive) [self stopHid]; else [self startHid]; @@ -343,12 +343,12 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn } - (void)stopHidIfDisabled:(NSNotification *)application { - if (!self.translatingEvents) + if (!self.simulatingEvents) [self stopHid]; } -- (IBAction)translatingEventsChanged:(NSButton *)sender { - self.translatingEvents = sender.state == NSOnState; +- (IBAction)simulatingEventsChanged:(NSButton *)sender { + self.simulatingEvents = sender.state == NSOnState; } @end diff --git a/Classes/NJInput.h b/Classes/NJInput.h index db47121..b530c37 100644 --- a/Classes/NJInput.h +++ b/Classes/NJInput.h @@ -18,7 +18,7 @@ element:(IOHIDElementRef)element parent:(NJInputPathElement *)parent; -@property (nonatomic, assign) IOHIDElementCookie cookie; +@property (nonatomic, readonly) IOHIDElementCookie cookie; @property (nonatomic, assign) BOOL active; @property (nonatomic, assign) float magnitude; diff --git a/Classes/NJInput.m b/Classes/NJInput.m index 82d5993..d7144a0 100644 --- a/Classes/NJInput.m +++ b/Classes/NJInput.m @@ -14,11 +14,11 @@ element:(IOHIDElementRef)element parent:(NJInputPathElement *)parent { - NSString *elementName = (__bridge NSString *)(IOHIDElementGetName(element)); + NSString *elementName = (__bridge NSString *)IOHIDElementGetName(element); if (elementName.length) name = [name stringByAppendingFormat:@"- %@", elementName]; if ((self = [super initWithName:name eid:eid parent:parent])) { - self.cookie = IOHIDElementGetCookie(element); + _cookie = IOHIDElementGetCookie(element); } return self; } diff --git a/Classes/NJInputAnalog.m b/Classes/NJInputAnalog.m index 3746c11..1f65f48 100644 --- a/Classes/NJInputAnalog.m +++ b/Classes/NJInputAnalog.m @@ -25,7 +25,7 @@ static float normalize(CFIndex p, CFIndex min, CFIndex max) { if ((self = [super initWithName:NJINPUT_NAME(NSLocalizedString(@"axis %d", @"axis name"), index) eid:NJINPUT_DID("Axis", index) element:element - parent:nil])) { + parent:parent])) { self.children = @[[[NJInput alloc] initWithName:NSLocalizedString(@"axis low", @"axis low trigger") eid:@"Low" parent:self], diff --git a/Classes/NJMappingMenuController.h b/Classes/NJMappingMenuController.h index 9c9432a..a2de7e9 100644 --- a/Classes/NJMappingMenuController.h +++ b/Classes/NJMappingMenuController.h @@ -42,8 +42,8 @@ @property (nonatomic, assign) BOOL hasKeyEquivalents; // Whether or not to add key equivalents to the menu items. -@property (nonatomic, strong) IBOutlet NSMenuItem *eventTranslationToggle; - // A menu item representing the current event translation state. +@property (nonatomic, strong) IBOutlet NSMenuItem *eventSimulationToggle; + // A menu item representing the current event simulation state. // This outlet is optional. diff --git a/Classes/NJMappingMenuController.m b/Classes/NJMappingMenuController.m index 03ce31d..6d9250f 100644 --- a/Classes/NJMappingMenuController.m +++ b/Classes/NJMappingMenuController.m @@ -27,12 +27,12 @@ name:NJEventMappingChanged object:nil]; [center addObserver:self - selector:@selector(eventTranslationActivated:) - name:NJEventTranslationActivated + selector:@selector(eventSimulationStarted:) + name:NJEventSimulationStarted object:nil]; [center addObserver:self - selector:@selector(eventTranslationDeactivated:) - name:NJEventTranslationDeactivated + selector:@selector(eventSimulationStopped:) + name:NJEventSimulationStopped object:nil]; } return self; @@ -99,14 +99,14 @@ item.state = mapping == item.representedObject; } -- (void)eventTranslationActivated:(NSNotification *)note { - self.eventTranslationToggle.title = NSLocalizedString(@"Disable", - @"menu item text to disable event translation"); +- (void)eventSimulationStarted:(NSNotification *)note { + self.eventSimulationToggle.title = NSLocalizedString(@"Disable", + @"menu item text to disable event simulation"); } -- (void)eventTranslationDeactivated:(NSNotification *)note { - self.eventTranslationToggle.title = NSLocalizedString(@"Enable", - @"menu item text to enable event translation"); +- (void)eventSimulationStopped:(NSNotification *)note { + self.eventSimulationToggle.title = NSLocalizedString(@"Enable", + @"menu item text to enable event simulation"); } @end diff --git a/Info.plist b/Info.plist index bc56ad4..0ea7a95 100644 --- a/Info.plist +++ b/Info.plist @@ -46,7 +46,7 @@ CFBundleSignature ???? CFBundleVersion - 296 + 298 LSApplicationCategoryType public.app-category.utilities NSHumanReadableCopyright diff --git a/Other Sources/NJEvents.h b/Other Sources/NJEvents.h index 5485154..204a270 100644 --- a/Other Sources/NJEvents.h +++ b/Other Sources/NJEvents.h @@ -8,8 +8,8 @@ #define NJEventMappingChanged @"com.yukkurigames.Enjoyable.MappingChanged" #define NJEventMappingListChanged @"com.yukkurigames.Enjoyable.MappingListChanged" -#define NJEventTranslationActivated @"com.yukkurigames.Enjoyable.EventTranslationActivated" -#define NJEventTranslationDeactivated @"com.yukkurigames.Enjoyable.EventTranslationDeactivated" +#define NJEventSimulationStarted @"com.yukkurigames.Enjoyable.EventSimulationStarted" +#define NJEventSimulationStopped @"com.yukkurigames.Enjoyable.EventSimulationStopped" #define NJMappingKey @"com.yukkurigames.Enjoyable.Mapping" #define NJMappingListKey @"com.yukkurigames.Enjoyable.MappingList" diff --git a/Resources/English.lproj/Localizable.strings b/Resources/English.lproj/Localizable.strings index 8b9a71782f2bf1dcc87e4fa301c7df7b43d4a61f..0e30ce1842093ae8662c75ed023e88a319e3faa0 100644 GIT binary patch delta 36 lcmaE0b;oK$8Vh?dLncEmL+NBjR`JPgEJZN>W=7U{2>{lI3Pb<^ delta 36 jcmca(^}uRF8VhF$LlHwFLmor% {664, 323} - + 256 @@ -501,7 +501,6 @@ -2147483374 {{20, 20}, {194, 283}} - _NS:22 YES @@ -531,7 +530,6 @@ Lg 274 {{20, 20}, {194, 283}} - _NS:22 YES @@ -566,7 +564,6 @@ aW5nLg {232, 321} - YES NO @@ -662,7 +659,6 @@ aW5nLg {{1, 1}, {232, 321}} - @@ -673,7 +669,6 @@ aW5nLg -2147483392 {{1, 1}, {8, 298}} - NO @@ -685,7 +680,6 @@ aW5nLg -2147483392 {{-100, -100}, {473, 15}} - NO 1 @@ -696,7 +690,6 @@ aW5nLg {234, 323} - 150034 @@ -710,7 +703,6 @@ aW5nLg {234, 323} - _NS:9 NSView @@ -724,7 +716,6 @@ aW5nLg 265 {{189, 117}, {224, 20}} - _NS:9 YES @@ -766,7 +757,6 @@ aW5nLg 268 {{343, 31}, {70, 18}} - _NS:9 YES @@ -797,7 +787,6 @@ aW5nLg 265 {{189, 33}, {150, 20}} - _NS:9 YES @@ -842,7 +831,6 @@ aW5nLg 265 {{191, 24}, {146, 16}} - _NS:9 YES @@ -868,7 +856,6 @@ aW5nLg 265 {{189, 70}, {224, 24}} - _NS:9 YES @@ -922,7 +909,6 @@ aW5nLg 265 {{191, 108}, {220, 16}} - _NS:9 YES @@ -948,7 +934,6 @@ aW5nLg 265 {{191, 196}, {220, 23}} - _NS:9 NJKeyInputField @@ -958,7 +943,6 @@ aW5nLg 265 {{188, 153}, {226, 26}} - YES @@ -991,7 +975,6 @@ aW5nLg 268 {{24, 20}, {163, 250}} - NO 6 @@ -1122,7 +1105,6 @@ aW5nLg 266 {{9, 286}, {412, 17}} - YES @@ -1146,7 +1128,6 @@ aW5nLg 10 {{12, 276}, {406, 5}} - {0, 0} @@ -1173,15 +1154,12 @@ aW5nLg {{233, 0}, {431, 323}} - _NS:9 NSView {664, 323} - - {{0, 0}, {1440, 878}} @@ -1669,14 +1647,6 @@ aW5nLg 826 - - - translatingEventsChanged: - - - - 878 - translatingEventsButton @@ -1709,6 +1679,14 @@ aW5nLg 976 + + + simulatingEventsChanged: + + + + 978 + mappingsController @@ -2101,14 +2079,6 @@ aW5nLg 933 - - - eventTranslationToggle - - - - 951 - menu @@ -2125,6 +2095,14 @@ aW5nLg 956 + + + eventSimulationToggle + + + + 980 + menu @@ -2143,11 +2121,11 @@ aW5nLg - eventTranslationToggle + eventSimulationToggle - 959 + 979 @@ -2167,11 +2145,11 @@ aW5nLg - eventTranslationToggle + eventSimulationToggle - 965 + 981 @@ -3267,7 +3245,7 @@ aW5nLg - 977 + 981 -- 2.30.2