Rename from Enjoy/Enjoy2 to 'Enjoyable'. While I'm mucking in the project file, enabl...
[enjoyable.git] / JSActionButton.m
index c358c8d..7d2572a 100644 (file)
@@ -5,31 +5,29 @@
 //  Created by Sam McCall on 5/05/09.
 //
 
+#import "JSActionButton.h"
+
 @implementation JSActionButton {
-    BOOL active;
+    long _max;
 }
 
-@synthesize max;
-@synthesize active;
-
-- (id)initWithName:(NSString *)name_ idx:(int)idx max:(int)max_ {
+- (id)initWithName:(NSString *)name idx:(int)idx max:(long)max {
     if ((self = [super init])) {
-        self.index = idx;
-        self.max = max_;
-        if (name_.length)
-            self.name = [NSString stringWithFormat:@"Button %d - %@", self.index + 1, name_];
+        _max = max;
+        if (name.length)
+            self.name = [NSString stringWithFormat:@"Button %d - %@", idx, name];
         else
-            self.name = [NSString stringWithFormat:@"Button %d", self.index + 1];
+            self.name = [NSString stringWithFormat:@"Button %d", idx];
     }
     return self;
 }
 
 - (id)findSubActionForValue:(IOHIDValueRef)val {
-    return (IOHIDValueGetIntegerValue(val) == max) ? self : nil;
+    return (IOHIDValueGetIntegerValue(val) == _max) ? self : nil;
 }
 
 - (void)notifyEvent:(IOHIDValueRef)value {
-    active = IOHIDValueGetIntegerValue(value) == max;
+    self.active = IOHIDValueGetIntegerValue(value) == _max;
 }
 
 @end