Change KeyInputTextView from a TextView to a TextField. Simplifies the nib contents...
[enjoyable.git] / JoystickController.m
index 51c2a37..54734a8 100644 (file)
@@ -5,7 +5,7 @@
 //  Created by Sam McCall on 4/05/09.
 //
 
-#import "CoreFoundation/CoreFoundation.h"
+#import "JoystickController.h"
 
 @implementation JoystickController
 
@@ -127,7 +127,6 @@ static void add_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDDevi
     IOHIDDeviceRegisterInputValueCallback(device, input_callback, (__bridge void*)controller);
        Joystick *js = [[Joystick alloc] initWithDevice:device];
     js.index = findAvailableIndex(controller.joysticks, js);
-       [js populateActions];
        [[controller joysticks] addObject:js];
        [controller->outlineView reloadData];
 }
@@ -175,15 +174,12 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD
     CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer, kCFRunLoopDefaultMode);
 }
 
--(id) determineSelectedAction {
-       id item = [outlineView itemAtRow: [outlineView selectedRow]];
-       if(!item)
-               return NULL;
-       if([item isKindOfClass: [JSAction class]] && [item subActions] != NULL)
-               return NULL;
-       if([item isKindOfClass: [Joystick class]])
-               return NULL;
-       return item;
+- (JSAction *)selectedAction {
+    id item = [outlineView itemAtRow:outlineView.selectedRow];
+       if ([item isKindOfClass: [JSAction class]] && ![item subActions])
+               return item;
+    else
+        return nil;
 }
 
 /* outline view */
@@ -228,9 +224,8 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD
 
 - (void)outlineViewSelectionDidChange: (NSNotification*) notification {
        [targetController reset];
-       selectedAction = [self determineSelectedAction];
        [targetController load];
-       if(programmaticallySelecting)
+       if (programmaticallySelecting)
                [targetController focusKey];
        programmaticallySelecting = NO;
 }