projects
/
enjoyable.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5704217
)
'Convert to Modern Objective-C Syntax'...
author
Joe Wreschnig
<joe.wreschnig@gmail.com>
Tue, 26 Feb 2013 17:05:38 +0000
(18:05 +0100)
committer
Joe Wreschnig
<joe.wreschnig@gmail.com>
Tue, 26 Feb 2013 17:05:38 +0000
(18:05 +0100)
15 files changed:
ApplicationController.m
patch
|
blob
|
history
Config.m
patch
|
blob
|
history
ConfigsController.m
patch
|
blob
|
history
Enjoy.xcodeproj/project.pbxproj
patch
|
blob
|
history
JSActionAnalog.m
patch
|
blob
|
history
JSActionHat.m
patch
|
blob
|
history
Joystick.m
patch
|
blob
|
history
JoystickController.m
patch
|
blob
|
history
Target.m
patch
|
blob
|
history
TargetConfig.m
patch
|
blob
|
history
TargetController.m
patch
|
blob
|
history
TargetKeyboard.m
patch
|
blob
|
history
TargetMouseBtn.m
patch
|
blob
|
history
TargetMouseMove.m
patch
|
blob
|
history
TargetMouseScroll.m
patch
|
blob
|
history
diff --git
a/ApplicationController.m
b/ApplicationController.m
index
c87a6ee
..
4a4deea
100644
(file)
--- a/
ApplicationController.m
+++ b/
ApplicationController.m
@@
-42,9
+42,9
@@
pascal OSStatus appSwitch(EventHandlerCallRef handlerChain, EventRef event, void
ApplicationController* self = (ApplicationController*)userData;
NSDictionary* currentApp = [[NSWorkspace sharedWorkspace] activeApplication];
ProcessSerialNumber psn;
ApplicationController* self = (ApplicationController*)userData;
NSDictionary* currentApp = [[NSWorkspace sharedWorkspace] activeApplication];
ProcessSerialNumber psn;
- psn.lowLongOfPSN = [
[currentApp objectForKey:
@"NSApplicationProcessSerialNumberLow"] longValue];
- psn.highLongOfPSN = [
[currentApp objectForKey:
@"NSApplicationProcessSerialNumberHigh"] longValue];
- [self->configsController applicationSwitchedTo:
[currentApp objectForKey:
@"NSApplicationName"] withPsn: psn];
+ psn.lowLongOfPSN = [
currentApp[
@"NSApplicationProcessSerialNumberLow"] longValue];
+ psn.highLongOfPSN = [
currentApp[
@"NSApplicationProcessSerialNumberHigh"] longValue];
+ [self->configsController applicationSwitchedTo:
currentApp[
@"NSApplicationName"] withPsn: psn];
return noErr;
}
return noErr;
}
@@
-76,10
+76,10
@@
pascal OSStatus appSwitch(EventHandlerCallRef handlerChain, EventRef event, void
Config* current = [configsController currentConfig];
NSArray* configs = [configsController configs];
for(int i=0; i<[configs count]; i++)
Config* current = [configsController currentConfig];
NSArray* configs = [configsController configs];
for(int i=0; i<[configs count]; i++)
- [[dockMenuBase itemAtIndex: (2+i)] setState: ((
[configs objectAtIndex:
i] == current) ? YES : NO)];
+ [[dockMenuBase itemAtIndex: (2+i)] setState: ((
configs[
i] == current) ? YES : NO)];
}
-(void) chooseConfig: (id) sender {
}
-(void) chooseConfig: (id) sender {
- [configsController activateConfig: [
[configsController configs] objectAtIndex:
([dockMenuBase indexOfItem: sender]-2)] forApplication: NULL];
+ [configsController activateConfig: [
configsController configs][
([dockMenuBase indexOfItem: sender]-2)] forApplication: NULL];
}
@end
}
@end
diff --git
a/Config.m
b/Config.m
index
de3c1cc
..
27ca4f0
100644
(file)
--- a/
Config.m
+++ b/
Config.m
@@
-20,7
+20,7
@@
[entries setValue:target forKey: [jsa stringify]];
}
-(Target*) getTargetForAction: (id) jsa {
[entries setValue:target forKey: [jsa stringify]];
}
-(Target*) getTargetForAction: (id) jsa {
- return
[entries objectForKey:
[jsa stringify]];
+ return
entries[
[jsa stringify]];
}
@end
}
@end
diff --git
a/ConfigsController.m
b/ConfigsController.m
index
f6770cc
..
3168f8d
100644
(file)
--- a/
ConfigsController.m
+++ b/
ConfigsController.m
@@
-60,16
+60,16
@@
-(IBAction) removePressed: (id)sender {
// save changes first
[tableView reloadData];
-(IBAction) removePressed: (id)sender {
// save changes first
[tableView reloadData];
- Config* current_config =
[configs objectAtIndex:
[tableView selectedRow]];
+ Config* current_config =
configs[
[tableView selectedRow]];
if([current_config protect])
return;
[configs removeObjectAtIndex: [tableView selectedRow]];
// remove all "switch to configuration" actions
for(int i=0; i<[configs count]; i++) {
if([current_config protect])
return;
[configs removeObjectAtIndex: [tableView selectedRow]];
// remove all "switch to configuration" actions
for(int i=0; i<[configs count]; i++) {
- NSMutableDictionary* entries = [(Config*)
[configs objectAtIndex:
i] entries];
+ NSMutableDictionary* entries = [(Config*)
configs[
i] entries];
for(id key in entries) {
for(id key in entries) {
- Target* target = (Target*)
[entries objectForKey:
key];
+ Target* target = (Target*)
entries[
key];
if([target isKindOfClass: [TargetConfig class]] && [(TargetConfig*)target config] == current_config)
[entries removeObjectForKey: key];
}
if([target isKindOfClass: [TargetConfig class]] && [(TargetConfig*)target config] == current_config)
[entries removeObjectForKey: key];
}
@@
-81,19
+81,19
@@
-(void)tableViewSelectionDidChange:(NSNotification*) notify {
if (tableView.selectedRow < configs.count)
-(void)tableViewSelectionDidChange:(NSNotification*) notify {
if (tableView.selectedRow < configs.count)
- [self activateConfig: (Config*)
[configs objectAtIndex:
[tableView selectedRow]] forApplication: NULL];
+ [self activateConfig: (Config*)
configs[
[tableView selectedRow]] forApplication: NULL];
}
-(id) tableView: (NSTableView*)view objectValueForTableColumn: (NSTableColumn*) column row: (int) index {
NSParameterAssert(index >= 0 && index < [configs count]);
}
-(id) tableView: (NSTableView*)view objectValueForTableColumn: (NSTableColumn*) column row: (int) index {
NSParameterAssert(index >= 0 && index < [configs count]);
- return [
[configs objectAtIndex:
index] name];
+ return [
configs[
index] name];
}
-(void) tableView: (NSTableView*) view setObjectValue:obj forTableColumn:(NSTableColumn*) col row: (int)index {
NSParameterAssert(index >= 0 && index < [configs count]);
/* ugly hack so stringification doesn't fail */
NSString* newName = [(NSString*)obj stringByReplacingOccurrencesOfString: @"~" withString: @""];
}
-(void) tableView: (NSTableView*) view setObjectValue:obj forTableColumn:(NSTableColumn*) col row: (int)index {
NSParameterAssert(index >= 0 && index < [configs count]);
/* ugly hack so stringification doesn't fail */
NSString* newName = [(NSString*)obj stringByReplacingOccurrencesOfString: @"~" withString: @""];
- [(Config*)
[configs objectAtIndex:
index] setName: newName];
+ [(Config*)
configs[
index] setName: newName];
[targetController refreshConfigsPreservingSelection:YES];
[tableView reloadData];
[(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
[targetController refreshConfigsPreservingSelection:YES];
[tableView reloadData];
[(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
@@
-104,7
+104,7
@@
}
-(BOOL)tableView: (NSTableView*)view shouldEditTableColumn: (NSTableColumn*) column row: (int) index {
}
-(BOOL)tableView: (NSTableView*)view shouldEditTableColumn: (NSTableColumn*) column row: (int) index {
- return ![
[configs objectAtIndex:
index] protect];
+ return ![
configs[
index] protect];
}
-(Config*) currentConfig {
}
-(Config*) currentConfig {
@@
-130,37
+130,35
@@
NSMutableArray* ary = [[NSMutableArray alloc] init];
for(Config* config in configs) {
NSMutableDictionary* cfgInfo = [[NSMutableDictionary alloc] init];
NSMutableArray* ary = [[NSMutableArray alloc] init];
for(Config* config in configs) {
NSMutableDictionary* cfgInfo = [[NSMutableDictionary alloc] init];
-
[cfgInfo setObject:[config name] forKey:@"name"
];
+
cfgInfo[@"name"] = [config name
];
NSMutableDictionary* cfgEntries = [[NSMutableDictionary alloc] init];
for(id key in [config entries]) {
NSMutableDictionary* cfgEntries = [[NSMutableDictionary alloc] init];
for(id key in [config entries]) {
-
[cfgEntries setObject:[[[config entries]objectForKey:key]stringify] forKey: ke
y];
+
cfgEntries[key] = [[config entries][key]stringif
y];
}
}
-
[cfgInfo setObject: cfgEntries forKey: @"entries"]
;
+
cfgInfo[@"entries"] = cfgEntries
;
[ary addObject: cfgInfo];
}
[ary addObject: cfgInfo];
}
-
[envelope setObject: ary forKey: @"configurationList"]
;
-
[envelope setObject: [NSNumber numberWithInt: [configs indexOfObject: [self currentNeutralConfig] ] ] forKey: @"selectedIndex"
];
+
envelope[@"configurationList"] = ary
;
+
envelope[@"selectedIndex"] = [NSNumber numberWithInt: [configs indexOfObject: [self currentNeutralConfig] ]
];
return envelope;
}
-(void) loadAllFrom: (NSDictionary*) envelope{
if(envelope == NULL)
return;
return envelope;
}
-(void) loadAllFrom: (NSDictionary*) envelope{
if(envelope == NULL)
return;
- NSArray* ary =
[envelope objectForKey:
@"configurationList"];
+ NSArray* ary =
envelope[
@"configurationList"];
NSMutableArray* newConfigs = [[NSMutableArray alloc] init];
// have to do two passes in case config1 refers to config2 via a TargetConfig
for(int i=0; i<[ary count]; i++) {
Config* cfg = [[Config alloc] init];
NSMutableArray* newConfigs = [[NSMutableArray alloc] init];
// have to do two passes in case config1 refers to config2 via a TargetConfig
for(int i=0; i<[ary count]; i++) {
Config* cfg = [[Config alloc] init];
- [cfg setName:
[[ary objectAtIndex:i] objectForKey:@"name"]];
+ [cfg setName:
ary[i][@"name"]];
[newConfigs addObject: cfg];
}
[newConfigs addObject: cfg];
}
- [
[configs objectAtIndex:
0] setProtect: YES];
+ [
configs[
0] setProtect: YES];
for(int i=0; i<[ary count]; i++) {
for(int i=0; i<[ary count]; i++) {
- NSDictionary* dict =
[[ary objectAtIndex:i] objectForKey:
@"entries"];
+ NSDictionary* dict =
ary[i][
@"entries"];
for(id key in dict) {
for(id key in dict) {
- [[[newConfigs objectAtIndex:i] entries]
- setObject: [Target unstringify: [dict objectForKey: key] withConfigList: newConfigs]
- forKey: key];
+ [newConfigs[i] entries][key] = [Target unstringify: dict[key] withConfigList: newConfigs];
}
}
}
}
@@
-169,14
+167,14
@@
currentConfig = NULL;
[(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
currentConfig = NULL;
[(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
- int index = [
[envelope objectForKey:
@"selectedIndex"] intValue];
+ int index = [
envelope[
@"selectedIndex"] intValue];
if (index < configs.count)
if (index < configs.count)
- [self activateConfig:
[configs objectAtIndex:
index] forApplication: NULL];
+ [self activateConfig:
configs[
index] forApplication: NULL];
}
-(void) applicationSwitchedTo: (NSString*) name withPsn: (ProcessSerialNumber) psn {
for(int i=0; i<[configs count]; i++) {
}
-(void) applicationSwitchedTo: (NSString*) name withPsn: (ProcessSerialNumber) psn {
for(int i=0; i<[configs count]; i++) {
- Config* cfg =
[configs objectAtIndex:
i];
+ Config* cfg =
configs[
i];
if([[cfg name] isEqualToString: name]) {
[self activateConfig: cfg forApplication: &psn];
return;
if([[cfg name] isEqualToString: name]) {
[self activateConfig: cfg forApplication: &psn];
return;
diff --git
a/Enjoy.xcodeproj/project.pbxproj
b/Enjoy.xcodeproj/project.pbxproj
index
6ac1e0d
..
9fbdbb6
100644
(file)
--- a/
Enjoy.xcodeproj/project.pbxproj
+++ b/
Enjoy.xcodeproj/project.pbxproj
@@
-336,6
+336,7
@@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
@@
-349,7
+350,7
@@
GCC_PREFIX_HEADER = Enjoy_Prefix.pch;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
GCC_PREFIX_HEADER = Enjoy_Prefix.pch;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
- MACOSX_DEPLOYMENT_TARGET = 10.6;
+ MACOSX_DEPLOYMENT_TARGET = 10.6
.8
;
PRODUCT_NAME = Enjoy;
};
name = Debug;
PRODUCT_NAME = Enjoy;
};
name = Debug;
@@
-358,6
+359,7
@@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
@@
-369,7
+371,7
@@
GCC_PREFIX_HEADER = Enjoy_Prefix.pch;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
GCC_PREFIX_HEADER = Enjoy_Prefix.pch;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
- MACOSX_DEPLOYMENT_TARGET = 10.6;
+ MACOSX_DEPLOYMENT_TARGET = 10.6
.8
;
PRODUCT_NAME = Enjoy;
};
name = Release;
PRODUCT_NAME = Enjoy;
};
name = Release;
diff --git
a/JSActionAnalog.m
b/JSActionAnalog.m
index
e351996
..
2931464
100644
(file)
--- a/
JSActionAnalog.m
+++ b/
JSActionAnalog.m
@@
-9,12
+9,9
@@
- (id) initWithIndex: (int)newIndex {
if(self = [super init]) {
- (id) initWithIndex: (int)newIndex {
if(self = [super init]) {
- subActions = [NSArray arrayWithObjects:
- [[SubAction alloc] initWithIndex: 0 name: @"Low" base: self],
+ subActions = @[[[SubAction alloc] initWithIndex: 0 name: @"Low" base: self],
[[SubAction alloc] initWithIndex: 1 name: @"High" base: self],
[[SubAction alloc] initWithIndex: 1 name: @"High" base: self],
- [[SubAction alloc] initWithIndex: 2 name: @"Analog" base: self],
- nil
- ];
+ [[SubAction alloc] initWithIndex: 2 name: @"Analog" base: self]];
[subActions retain];
index = newIndex;
name = [[NSString alloc] initWithFormat: @"Axis %d", (index+1)];
[subActions retain];
index = newIndex;
name = [[NSString alloc] initWithFormat: @"Axis %d", (index+1)];
@@
-23,8
+20,8
@@
}
-(id) findSubActionForValue: (IOHIDValueRef) value {
}
-(id) findSubActionForValue: (IOHIDValueRef) value {
- if ([
[subActions objectAtIndex:
2] active]) {
- return
[subActions objectAtIndex:
2]; // TODO?
+ if ([
subActions[
2] active]) {
+ return
subActions[
2]; // TODO?
}
//Target* target = [[base->configsController currentConfig] getTargetForAction: [subActions objectAtIndex: 0]];
}
//Target* target = [[base->configsController currentConfig] getTargetForAction: [subActions objectAtIndex: 0]];
@@
-33,21
+30,21
@@
double parsed = [self getRealValue: raw];
if(parsed < -0.3) // fixed?!
double parsed = [self getRealValue: raw];
if(parsed < -0.3) // fixed?!
- return
[subActions objectAtIndex:
0];
+ return
subActions[
0];
else if(parsed > 0.3)
else if(parsed > 0.3)
- return
[subActions objectAtIndex:
1];
+ return
subActions[
1];
return NULL;
}
-(void) notifyEvent: (IOHIDValueRef) value {
// Analog action is always active
return NULL;
}
-(void) notifyEvent: (IOHIDValueRef) value {
// Analog action is always active
- [
[subActions objectAtIndex:
2] setActive: true];
+ [
subActions[
2] setActive: true];
int raw = IOHIDValueGetIntegerValue(value);
double parsed = [self getRealValue: raw];
int raw = IOHIDValueGetIntegerValue(value);
double parsed = [self getRealValue: raw];
- [
[subActions objectAtIndex:
0] setActive: (parsed < -0.3)];
- [
[subActions objectAtIndex:
1] setActive: (parsed > 0.3)];
+ [
subActions[
0] setActive: (parsed < -0.3)];
+ [
subActions[
1] setActive: (parsed > 0.3)];
}
-(double) getRealValue: (int)value {
}
-(double) getRealValue: (int)value {
diff --git
a/JSActionHat.m
b/JSActionHat.m
index
1ea30af
..
61241b9
100644
(file)
--- a/
JSActionHat.m
+++ b/
JSActionHat.m
@@
-28,13
+28,10
@@
NO, NO, YES, NO , // W
- (id) init {
if(self = [super init]) {
- (id) init {
if(self = [super init]) {
- subActions = [NSArray arrayWithObjects:
- [[SubAction alloc] initWithIndex: 0 name: @"Up" base: self],
+ subActions = @[[[SubAction alloc] initWithIndex: 0 name: @"Up" base: self],
[[SubAction alloc] initWithIndex: 1 name: @"Down" base: self],
[[SubAction alloc] initWithIndex: 2 name: @"Left" base: self],
[[SubAction alloc] initWithIndex: 1 name: @"Down" base: self],
[[SubAction alloc] initWithIndex: 2 name: @"Left" base: self],
- [[SubAction alloc] initWithIndex: 3 name: @"Right" base: self],
- nil
- ];
+ [[SubAction alloc] initWithIndex: 3 name: @"Right" base: self]];
[subActions retain];
name = @"Hat switch";
}
[subActions retain];
name = @"Hat switch";
}
@@
-46,34
+43,34
@@
NO, NO, YES, NO , // W
if(IOHIDElementGetLogicalMax(IOHIDValueGetElement(value)) == 7) {
// 8-way
switch(parsed) {
if(IOHIDElementGetLogicalMax(IOHIDValueGetElement(value)) == 7) {
// 8-way
switch(parsed) {
- case 0: return
[subActions objectAtIndex:
0];
- case 4: return
[subActions objectAtIndex:
1];
- case 6: return
[subActions objectAtIndex:
2];
- case 2: return
[subActions objectAtIndex:
3];
+ case 0: return
subActions[
0];
+ case 4: return
subActions[
1];
+ case 6: return
subActions[
2];
+ case 2: return
subActions[
3];
}
} else if(IOHIDElementGetLogicalMax(IOHIDValueGetElement(value)) == 8) {
// 8-way
switch(parsed) {
}
} else if(IOHIDElementGetLogicalMax(IOHIDValueGetElement(value)) == 8) {
// 8-way
switch(parsed) {
- case 1: return
[subActions objectAtIndex:
0];
- case 5: return
[subActions objectAtIndex:
1];
- case 7: return
[subActions objectAtIndex:
2];
- case 3: return
[subActions objectAtIndex:
3];
+ case 1: return
subActions[
0];
+ case 5: return
subActions[
1];
+ case 7: return
subActions[
2];
+ case 3: return
subActions[
3];
}
} else if(IOHIDElementGetLogicalMax(IOHIDValueGetElement(value)) == 3) {
// 4-way
switch(parsed) {
}
} else if(IOHIDElementGetLogicalMax(IOHIDValueGetElement(value)) == 3) {
// 4-way
switch(parsed) {
- case 0: return
[subActions objectAtIndex:
0];
- case 2: return
[subActions objectAtIndex:
1];
- case 3: return
[subActions objectAtIndex:
2];
- case 1: return
[subActions objectAtIndex:
3];
+ case 0: return
subActions[
0];
+ case 2: return
subActions[
1];
+ case 3: return
subActions[
2];
+ case 1: return
subActions[
3];
}
} else if(IOHIDElementGetLogicalMax(IOHIDValueGetElement(value)) == 4) {
// 4-way
switch(parsed) {
}
} else if(IOHIDElementGetLogicalMax(IOHIDValueGetElement(value)) == 4) {
// 4-way
switch(parsed) {
- case 1: return
[subActions objectAtIndex:
0];
- case 3: return
[subActions objectAtIndex:
1];
- case 4: return
[subActions objectAtIndex:
2];
- case 2: return
[subActions objectAtIndex:
3];
+ case 1: return
subActions[
0];
+ case 3: return
subActions[
1];
+ case 4: return
subActions[
2];
+ case 2: return
subActions[
3];
}
}
return NULL;
}
}
return NULL;
@@
-88,7
+85,7
@@
NO, NO, YES, NO , // W
}
BOOL* activeSubactions = (size == 8) ? active_eightway : active_fourway;
for(int i=0; i<4; i++)
}
BOOL* activeSubactions = (size == 8) ? active_eightway : active_fourway;
for(int i=0; i<4; i++)
- [
[subActions objectAtIndex:
i] setActive: activeSubactions[parsed * 4 + i]];
+ [
subActions[
i] setActive: activeSubactions[parsed * 4 + i]];
}
@end
}
@end
diff --git
a/Joystick.m
b/Joystick.m
index
8fa6791
..
fd08ee6
100644
(file)
--- a/
Joystick.m
+++ b/
Joystick.m
@@
-48,7
+48,7
@@
int axes = 0;
for(int i=0; i<[elements count]; i++) {
int axes = 0;
for(int i=0; i<[elements count]; i++) {
- IOHIDElementRef element = (IOHIDElementRef)
[elements objectAtIndex:
i];
+ IOHIDElementRef element = (IOHIDElementRef)
elements[
i];
int type = IOHIDElementGetType(element);
int usage = IOHIDElementGetUsage(element);
int usagePage = IOHIDElementGetUsagePage(element);
int type = IOHIDElementGetType(element);
int usage = IOHIDElementGetUsage(element);
int usagePage = IOHIDElementGetUsagePage(element);
@@
-96,8
+96,8
@@
- (JSAction*) findActionByCookie: (void*) cookie {
for(int i=0; i<[children count]; i++)
- (JSAction*) findActionByCookie: (void*) cookie {
for(int i=0; i<[children count]; i++)
- if([
[children objectAtIndex:
i]cookie] == cookie)
- return (JSAction*)
[children objectAtIndex:
i];
+ if([
children[
i]cookie] == cookie)
+ return (JSAction*)
children[
i];
return NULL;
}
return NULL;
}
diff --git
a/JoystickController.m
b/JoystickController.m
index
1bf5b43
..
6b748df
100644
(file)
--- a/
JoystickController.m
+++ b/
JoystickController.m
@@
-23,7
+23,7
@@
-(void) finalize {
for(int i=0; i<[joysticks count]; i++) {
-(void) finalize {
for(int i=0; i<[joysticks count]; i++) {
- [
[joysticks objectAtIndex:
i] invalidate];
+ [
joysticks[
i] invalidate];
}
IOHIDManagerClose(hidManager, kIOHIDOptionsTypeNone);
CFRelease(hidManager);
}
IOHIDManagerClose(hidManager, kIOHIDOptionsTypeNone);
CFRelease(hidManager);
@@
-33,8
+33,8
@@
static NSMutableDictionary* create_criterion( UInt32 inUsagePage, UInt32 inUsage )
{
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
static NSMutableDictionary* create_criterion( UInt32 inUsagePage, UInt32 inUsage )
{
NSMutableDictionary* dict = [[NSMutableDictionary alloc] init];
-
[dict setObject: [NSNumber numberWithInt: inUsagePage] forKey: (NSString*)CFSTR(kIOHIDDeviceUsagePageKey)
];
-
[dict setObject: [NSNumber numberWithInt: inUsage] forKey: (NSString*)CFSTR(kIOHIDDeviceUsageKey)
];
+
dict[(NSString*)CFSTR(kIOHIDDeviceUsagePageKey)] = [NSNumber numberWithInt: inUsagePage
];
+
dict[(NSString*)CFSTR(kIOHIDDeviceUsageKey)] = [NSNumber numberWithInt: inUsage
];
return dict;
}
return dict;
}
@@
-74,7
+74,7
@@
void input_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDVal
[mainAction notifyEvent: value];
NSArray* subactions = [mainAction subActions];
if(!subactions)
[mainAction notifyEvent: value];
NSArray* subactions = [mainAction subActions];
if(!subactions)
- subactions =
[NSArray arrayWithObject:
mainAction];
+ subactions =
@[
mainAction];
for(id subaction in subactions) {
Target* target = [[self->configsController currentConfig] getTargetForAction:subaction];
if(!target)
for(id subaction in subactions) {
Target* target = [[self->configsController currentConfig] getTargetForAction:subaction];
if(!target)
@@
-121,7
+121,7
@@
int findAvailableIndex(id list, Joystick* js) {
for(int index=0;;index++) {
available = YES;
for(int i=0; i<[list count]; i++) {
for(int index=0;;index++) {
available = YES;
for(int i=0; i<[list count]; i++) {
- js2 =
[list objectAtIndex:
i];
+ js2 =
list[
i];
if([js2 vendorId] == [js vendorId] && [js2 productId] == [js productId] && [js index] == index) {
available = NO;
break;
if([js2 vendorId] == [js vendorId] && [js2 productId] == [js productId] && [js index] == index) {
available = NO;
break;
@@
-169,12
+169,9
@@
void remove_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDDe
-(void) setup {
hidManager = IOHIDManagerCreate( kCFAllocatorDefault, kIOHIDOptionsTypeNone);
-(void) setup {
hidManager = IOHIDManagerCreate( kCFAllocatorDefault, kIOHIDOptionsTypeNone);
- NSArray *criteria = [NSArray arrayWithObjects:
- create_criterion(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick),
+ NSArray *criteria = @[create_criterion(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick),
create_criterion(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad),
create_criterion(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad),
- create_criterion(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController),
- //create_criterion(kHIDPage_GenericDesktop, kHIDUsage_GD_Keyboard),
- nil];
+ create_criterion(kHIDPage_GenericDesktop, kHIDUsage_GD_MultiAxisController)];
IOHIDManagerSetDeviceMatchingMultiple(hidManager, (CFArrayRef)criteria);
IOHIDManagerSetDeviceMatchingMultiple(hidManager, (CFArrayRef)criteria);
@@
-234,13
+231,13
@@
void remove_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDDe
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item {
if(item == nil)
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item {
if(item == nil)
- return
[joysticks objectAtIndex:
index];
+ return
joysticks[
index];
if([item isKindOfClass: [Joystick class]])
if([item isKindOfClass: [Joystick class]])
- return [
[item children] objectAtIndex:
index];
+ return [
item children][
index];
if([item isKindOfClass: [JSAction class]])
if([item isKindOfClass: [JSAction class]])
- return [
[item subActions] objectAtIndex:
index];
+ return [
item subActions][
index];
return NULL;
}
return NULL;
}
diff --git
a/Target.m
b/Target.m
index
ec2d6a1
..
052f01a
100644
(file)
--- a/
Target.m
+++ b/
Target.m
@@
-10,7
+10,7
@@
+(Target*) unstringify: (NSString*) str withConfigList: (NSArray*) configs {
NSArray* components = [str componentsSeparatedByString:@"~"];
NSParameterAssert([components count]);
+(Target*) unstringify: (NSString*) str withConfigList: (NSArray*) configs {
NSArray* components = [str componentsSeparatedByString:@"~"];
NSParameterAssert([components count]);
- NSString* typeTag =
[components objectAtIndex:
0];
+ NSString* typeTag =
components[
0];
if([typeTag isEqualToString:@"key"])
return [TargetKeyboard unstringifyImpl:components];
if([typeTag isEqualToString:@"cfg"])
if([typeTag isEqualToString:@"key"])
return [TargetKeyboard unstringifyImpl:components];
if([typeTag isEqualToString:@"cfg"])
diff --git
a/TargetConfig.m
b/TargetConfig.m
index
dae7786
..
f62755d
100644
(file)
--- a/
TargetConfig.m
+++ b/
TargetConfig.m
@@
-18,11
+18,11
@@
+(TargetConfig*) unstringifyImpl: (NSArray*) comps withConfigList: (NSArray*) configs {
NSParameterAssert([comps count] == 2);
+(TargetConfig*) unstringifyImpl: (NSArray*) comps withConfigList: (NSArray*) configs {
NSParameterAssert([comps count] == 2);
- NSString* name =
[comps objectAtIndex:
1];
+ NSString* name =
comps[
1];
TargetConfig* target = [[TargetConfig alloc] init];
for(int i=0; i<[configs count]; i++)
TargetConfig* target = [[TargetConfig alloc] init];
for(int i=0; i<[configs count]; i++)
- if([[
[configs objectAtIndex:
i] name] isEqualToString:name]) {
- [target setConfig:
[configs objectAtIndex:
i]];
+ if([[
configs[
i] name] isEqualToString:name]) {
+ [target setConfig:
configs[
i]];
return target;
}
NSLog(@"Warning: couldn't find matching config to restore from: %@",name);
return target;
}
NSLog(@"Warning: couldn't find matching config to restore from: %@",name);
diff --git
a/TargetController.m
b/TargetController.m
index
3442a61
..
9f85fd9
100644
(file)
--- a/
TargetController.m
+++ b/
TargetController.m
@@
-47,7
+47,7
@@
case 2:
{
TargetConfig* c = [[TargetConfig alloc] init];
case 2:
{
TargetConfig* c = [[TargetConfig alloc] init];
- [c setConfig: [
[configsController configs] objectAtIndex:
[configPopup indexOfSelectedItem]]];
+ [c setConfig: [
configsController configs][
[configPopup indexOfSelectedItem]]];
return c;
}
case 3: {
return c;
}
case 3: {
@@
-185,7
+185,7
@@
NSArray* configs = [configsController configs];
[configPopup removeAllItems];
for(int i=0; i<[configs count]; i++) {
NSArray* configs = [configsController configs];
[configPopup removeAllItems];
for(int i=0; i<[configs count]; i++) {
- [configPopup addItemWithTitle: [
[configs objectAtIndex:
i]name]];
+ [configPopup addItemWithTitle: [
configs[
i]name]];
}
if(preserve)
[configPopup selectItemAtIndex:initialIndex];
}
if(preserve)
[configPopup selectItemAtIndex:initialIndex];
diff --git
a/TargetKeyboard.m
b/TargetKeyboard.m
index
40661b8
..
f171a50
100644
(file)
--- a/
TargetKeyboard.m
+++ b/
TargetKeyboard.m
@@
-16,8
+16,8
@@
+(TargetKeyboard*) unstringifyImpl: (NSArray*) comps {
NSParameterAssert([comps count] == 3);
TargetKeyboard* target = [[TargetKeyboard alloc] init];
+(TargetKeyboard*) unstringifyImpl: (NSArray*) comps {
NSParameterAssert([comps count] == 3);
TargetKeyboard* target = [[TargetKeyboard alloc] init];
- [target setVk: [
[comps objectAtIndex:
1] integerValue]];
- [target setDescr:
[comps objectAtIndex:
2]];
+ [target setVk: [
comps[
1] integerValue]];
+ [target setDescr:
comps[
2]];
return target;
}
return target;
}
diff --git
a/TargetMouseBtn.m
b/TargetMouseBtn.m
index
7429874
..
172f740
100644
(file)
--- a/
TargetMouseBtn.m
+++ b/
TargetMouseBtn.m
@@
-19,7
+19,7
@@
+(TargetMouseBtn*) unstringifyImpl: (NSArray*) comps {
NSParameterAssert([comps count] == 2);
TargetMouseBtn* target = [[TargetMouseBtn alloc] init];
+(TargetMouseBtn*) unstringifyImpl: (NSArray*) comps {
NSParameterAssert([comps count] == 2);
TargetMouseBtn* target = [[TargetMouseBtn alloc] init];
- [target setWhich: [
[comps objectAtIndex:
1] integerValue]];
+ [target setWhich: [
comps[
1] integerValue]];
return target;
}
return target;
}
diff --git
a/TargetMouseMove.m
b/TargetMouseMove.m
index
8cf09d2
..
86dd736
100644
(file)
--- a/
TargetMouseMove.m
+++ b/
TargetMouseMove.m
@@
-23,7
+23,7
@@
+(TargetMouseMove*) unstringifyImpl: (NSArray*) comps {
NSParameterAssert([comps count] == 2);
TargetMouseMove* target = [[TargetMouseMove alloc] init];
+(TargetMouseMove*) unstringifyImpl: (NSArray*) comps {
NSParameterAssert([comps count] == 2);
TargetMouseMove* target = [[TargetMouseMove alloc] init];
- [target setDir: [
[comps objectAtIndex:
1] integerValue]];
+ [target setDir: [
comps[
1] integerValue]];
return target;
}
return target;
}
diff --git
a/TargetMouseScroll.m
b/TargetMouseScroll.m
index
a1cca9c
..
be64f7a
100644
(file)
--- a/
TargetMouseScroll.m
+++ b/
TargetMouseScroll.m
@@
-19,7
+19,7
@@
+(TargetMouseScroll*) unstringifyImpl: (NSArray*) comps {
NSParameterAssert([comps count] == 2);
TargetMouseScroll* target = [[TargetMouseScroll alloc] init];
+(TargetMouseScroll*) unstringifyImpl: (NSArray*) comps {
NSParameterAssert([comps count] == 2);
TargetMouseScroll* target = [[TargetMouseScroll alloc] init];
- [target setHowMuch: [
[comps objectAtIndex:
1] integerValue]];
+ [target setHowMuch: [
comps[
1] integerValue]];
return target;
}
return target;
}