Clean up a bunch of properties; remove unused ones, use automatic ones where possible...
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Thu, 28 Feb 2013 21:11:53 +0000 (22:11 +0100)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Thu, 28 Feb 2013 21:11:53 +0000 (22:11 +0100)
18 files changed:
ApplicationController.m
ConfigsController.h
ConfigsController.m
JSAction.m
JSActionButton.h
JSActionButton.m
Joystick.h
Joystick.m
JoystickController.m
KeyInputTextView.h
KeyInputTextView.m
Target.m
TargetConfig.m
TargetKeyboard.h
TargetKeyboard.m
TargetMouseBtn.m
TargetMouseMove.m
TargetMouseScroll.m

index aa51eeb..6a34916 100644 (file)
     BOOL active;
 }
 
     BOOL active;
 }
 
-@synthesize jsController;
-@synthesize targetController;
-@synthesize configsController;
-
 - (void)didSwitchApplication:(NSNotification *)notification {
     NSRunningApplication *currentApp = notification.userInfo[NSWorkspaceApplicationKey];
     [self.configsController activateConfigForProcess:currentApp.localizedName];
 - (void)didSwitchApplication:(NSNotification *)notification {
     NSRunningApplication *currentApp = notification.userInfo[NSWorkspaceApplicationKey];
     [self.configsController activateConfigForProcess:currentApp.localizedName];
@@ -81,6 +77,6 @@
 - (void)chooseConfig:(id)sender {
     int idx = [dockMenuBase indexOfItem:sender] - [self firstConfigMenuIndex];
     Config *chosen = self.configsController.configs[idx];
 - (void)chooseConfig:(id)sender {
     int idx = [dockMenuBase indexOfItem:sender] - [self firstConfigMenuIndex];
     Config *chosen = self.configsController.configs[idx];
-    [configsController activateConfig:chosen];
+    [_configsController activateConfig:chosen];
 }
 @end
 }
 @end
index a408d3b..e616e1e 100644 (file)
 @class TargetController;
 
 @interface ConfigsController : NSObject {
 @class TargetController;
 
 @interface ConfigsController : NSObject {
-       IBOutlet NSButton *removeButton;
-       IBOutlet NSTableView *tableView;
-       IBOutlet TargetController *targetController;
+    IBOutlet NSButton *removeButton;
+    IBOutlet NSTableView *tableView;
+    IBOutlet TargetController *targetController;
 }
 
 }
 
+@property (readonly) Config *currentConfig;
+@property (readonly) NSArray *configs;
+
 - (IBAction)addPressed:(id)sender;
 - (IBAction)removePressed:(id)sender;
 - (void)activateConfig:(Config *)config;
 - (void)activateConfigForProcess:(NSString *)processName;
 
 - (IBAction)addPressed:(id)sender;
 - (IBAction)removePressed:(id)sender;
 - (void)activateConfig:(Config *)config;
 - (void)activateConfigForProcess:(NSString *)processName;
 
-- (NSDictionary *)dumpAll;
-- (void)loadAllFrom:(NSDictionary*) dict;
-
-@property (readonly) Config *currentConfig;
-@property (readonly) NSArray *configs;
-
 - (void)save;
 - (void)load;
 
 - (void)save;
 - (void)load;
 
index 4227d43..769fabd 100644 (file)
 #import "TargetController.h"
 
 @implementation ConfigsController {
 #import "TargetController.h"
 
 @implementation ConfigsController {
-    NSMutableArray *configs;
+    NSMutableArray *_configs;
     Config *manualConfig;
 }
 
     Config *manualConfig;
 }
 
-@synthesize currentConfig;
-@synthesize configs;
-
 - (id)init {
     if ((self = [super init])) {
 - (id)init {
     if ((self = [super init])) {
-        configs = [[NSMutableArray alloc] init];
-        currentConfig = [[Config alloc] initWithName:@"(default)"];
-        manualConfig = currentConfig;
-        [configs addObject:currentConfig];
+        _configs = [[NSMutableArray alloc] init];
+        _currentConfig = [[Config alloc] initWithName:@"(default)"];
+        manualConfig = _currentConfig;
+        [_configs addObject:_currentConfig];
     }
     return self;
 }
 
 - (Config *)objectForKeyedSubscript:(NSString *)name {
     }
     return self;
 }
 
 - (Config *)objectForKeyedSubscript:(NSString *)name {
-    for (Config *config in configs)
+    for (Config *config in _configs)
         if ([name isEqualToString:config.name])
             return config;
     return nil;
         if ([name isEqualToString:config.name])
             return config;
     return nil;
 - (void)activateConfig:(Config *)config {
     if (!config)
         config = manualConfig;
 - (void)activateConfig:(Config *)config {
     if (!config)
         config = manualConfig;
-    if (currentConfig == config)
+    if (_currentConfig == config)
         return;
     manualConfig = config;
         return;
     manualConfig = config;
-    currentConfig = config;
+    _currentConfig = config;
     [targetController reset];
     [targetController reset];
-    [removeButton setEnabled:configs[0] != config];
+    [removeButton setEnabled:_configs[0] != config];
     [targetController load];
     [(ApplicationController *)[[NSApplication sharedApplication] delegate] configChanged];
     [targetController load];
     [(ApplicationController *)[[NSApplication sharedApplication] delegate] configChanged];
-    [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:[configs indexOfObject:config]] byExtendingSelection:NO];
+    [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:[_configs indexOfObject:config]] byExtendingSelection:NO];
 }
 
 - (IBAction)addPressed:(id)sender {
     Config *newConfig = [[Config alloc] initWithName:@"Untitled"];
 }
 
 - (IBAction)addPressed:(id)sender {
     Config *newConfig = [[Config alloc] initWithName:@"Untitled"];
-    [configs addObject:newConfig];
+    [_configs addObject:newConfig];
     [(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
     [tableView reloadData];
     [(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
     [tableView reloadData];
-    [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:configs.count - 1] byExtendingSelection:NO];
-    [tableView editColumn:0 row:[configs count] - 1 withEvent:nil select:YES];
+    [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:_configs.count - 1] byExtendingSelection:NO];
+    [tableView editColumn:0 row:[_configs count] - 1 withEvent:nil select:YES];
 }
 
 - (IBAction)removePressed:(id)sender {
     if (tableView.selectedRow == 0)
         return;
     
 }
 
 - (IBAction)removePressed:(id)sender {
     if (tableView.selectedRow == 0)
         return;
     
-    Config *toRemove = configs[tableView.selectedRow];
-    [configs removeObjectAtIndex:tableView.selectedRow];
+    Config *toRemove = _configs[tableView.selectedRow];
+    [_configs removeObjectAtIndex:tableView.selectedRow];
     
     
-    if (toRemove == currentConfig)
-        currentConfig = configs[0];
+    if (toRemove == _currentConfig)
+        _currentConfig = _configs[0];
     if (toRemove == manualConfig)
     if (toRemove == manualConfig)
-        manualConfig = configs[0];
+        manualConfig = _configs[0];
     
     [(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
     [tableView reloadData];
     
     [(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
     [tableView reloadData];
 
 -(void)tableViewSelectionDidChange:(NSNotification *)notify {
     if (tableView.selectedRow >= 0)
 
 -(void)tableViewSelectionDidChange:(NSNotification *)notify {
     if (tableView.selectedRow >= 0)
-        [self activateConfig:configs[tableView.selectedRow]];
+        [self activateConfig:_configs[tableView.selectedRow]];
 }
 
 - (id)tableView:(NSTableView *)view objectValueForTableColumn:(NSTableColumn *)column row:(int)index {
 }
 
 - (id)tableView:(NSTableView *)view objectValueForTableColumn:(NSTableColumn *)column row:(int)index {
-    return [configs[index] name];
+    return [_configs[index] name];
 }
 
 - (void)tableView:(NSTableView *)view setObjectValue:(NSString *)obj forTableColumn:(NSTableColumn *)col row:(int)index {
 }
 
 - (void)tableView:(NSTableView *)view setObjectValue:(NSString *)obj forTableColumn:(NSTableColumn *)col row:(int)index {
-    [(Config *)configs[index] setName:obj];
+    [(Config *)_configs[index] setName:obj];
     [targetController refreshConfigsPreservingSelection:YES];
     [tableView reloadData];
     [(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
 }
 
 - (int)numberOfRowsInTableView:(NSTableView*)table {
     [targetController refreshConfigsPreservingSelection:YES];
     [tableView reloadData];
     [(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
 }
 
 - (int)numberOfRowsInTableView:(NSTableView*)table {
-    return [configs count];
+    return [_configs count];
 }
 
 - (BOOL)tableView:(NSTableView *)view shouldEditTableColumn:(NSTableColumn *)column row:(int)index {
 }
 
 - (BOOL)tableView:(NSTableView *)view shouldEditTableColumn:(NSTableColumn *)column row:(int)index {
 }
 
 - (NSDictionary *)dumpAll {
 }
 
 - (NSDictionary *)dumpAll {
-    NSMutableArray *ary = [[NSMutableArray alloc] initWithCapacity:configs.count];
-    for (Config *config in configs) {
+    NSMutableArray *ary = [[NSMutableArray alloc] initWithCapacity:_configs.count];
+    for (Config *config in _configs) {
         NSMutableDictionary* cfgEntries = [[NSMutableDictionary alloc] initWithCapacity:config.entries.count];
         for (id key in config.entries)
             cfgEntries[key] = [config.entries[key] serialize];
         NSMutableDictionary* cfgEntries = [[NSMutableDictionary alloc] initWithCapacity:config.entries.count];
         for (id key in config.entries)
             cfgEntries[key] = [config.entries[key] serialize];
                           @"entries": cfgEntries,
                         }];
     }
                           @"entries": cfgEntries,
                         }];
     }
-    NSUInteger current = currentConfig ? [configs indexOfObject:currentConfig] : 0;
+    NSUInteger current = _currentConfig ? [_configs indexOfObject:_currentConfig] : 0;
     return @{ @"configurationList": ary,
               @"selectedConfiguration": @(current) };
 }
     return @{ @"configurationList": ary,
               @"selectedConfiguration": @(current) };
 }
         int current = [envelope[@"selectedConfiguration"] unsignedIntValue];
         if (current >= newConfigs.count)
             current = 0;
         int current = [envelope[@"selectedConfiguration"] unsignedIntValue];
         if (current >= newConfigs.count)
             current = 0;
-        configs = newConfigs;
+        _configs = newConfigs;
         [tableView reloadData];
         [(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
         [tableView reloadData];
         [(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
-        [self activateConfig:configs[current]];
+        [self activateConfig:_configs[current]];
     }
 }
 
     }
 }
 
index 0216e58..6903c56 100644 (file)
@@ -9,12 +9,6 @@
 
 @implementation JSAction
 
 
 @implementation JSAction
 
-@synthesize cookie;
-@synthesize children;
-@synthesize base;
-@synthesize name;
-@synthesize active;
-
 - (id)initWithName:(NSString *)newName base:(JSAction *)newBase {
     if ((self = [super init])) {
         self.name = newName;
 - (id)initWithName:(NSString *)newName base:(JSAction *)newBase {
     if ((self = [super init])) {
         self.name = newName;
@@ -28,7 +22,7 @@
 }
 
 - (NSString *)uid {
 }
 
 - (NSString *)uid {
-    return [NSString stringWithFormat:@"%@~%@", [self.base uid], self.name];
+    return [NSString stringWithFormat:@"%@~%@", [_base uid], _name];
 }
 
 - (void)notifyEvent:(IOHIDValueRef)value {
 }
 
 - (void)notifyEvent:(IOHIDValueRef)value {
index c4ba063..927606d 100644 (file)
@@ -12,6 +12,4 @@
 
 - (id)initWithName:(NSString *)name idx:(int)idx max:(int)max;
 
 
 - (id)initWithName:(NSString *)name idx:(int)idx max:(int)max;
 
-@property (assign) int max;
-
 @end
 @end
index 12449ce..c74c0e2 100644 (file)
@@ -8,17 +8,14 @@
 #import "JSActionButton.h"
 
 @implementation JSActionButton {
 #import "JSActionButton.h"
 
 @implementation JSActionButton {
-    BOOL active;
+    int _max;
 }
 
 }
 
-@synthesize max;
-@synthesize active;
-
-- (id)initWithName:(NSString *)name_ idx:(int)idx max:(int)max_ {
+- (id)initWithName:(NSString *)name idx:(int)idx max:(int)max {
     if ((self = [super init])) {
     if ((self = [super init])) {
-        self.max = max_;
-        if (name_.length)
-            self.name = [NSString stringWithFormat:@"Button %d - %@", idx, name_];
+        _max = max;
+        if (name.length)
+            self.name = [NSString stringWithFormat:@"Button %d - %@", idx, name];
         else
             self.name = [NSString stringWithFormat:@"Button %d", idx];
     }
         else
             self.name = [NSString stringWithFormat:@"Button %d", idx];
     }
 }
 
 - (id)findSubActionForValue:(IOHIDValueRef)val {
 }
 
 - (id)findSubActionForValue:(IOHIDValueRef)val {
-    return (IOHIDValueGetIntegerValue(val) == max) ? self : nil;
+    return (IOHIDValueGetIntegerValue(val) == _max) ? self : nil;
 }
 
 - (void)notifyEvent:(IOHIDValueRef)value {
 }
 
 - (void)notifyEvent:(IOHIDValueRef)value {
-    active = IOHIDValueGetIntegerValue(value) == max;
+    self.active = IOHIDValueGetIntegerValue(value) == _max;
 }
 
 @end
 }
 
 @end
index 2aea487..1c254a7 100644 (file)
@@ -10,8 +10,6 @@
 
 @interface Joystick : NSObject
 
 
 @interface Joystick : NSObject
 
-@property (assign) int vendorId;
-@property (assign) int productId;
 @property (assign) int index;
 @property (copy) NSString *productName;
 @property (assign) IOHIDDeviceRef device;
 @property (assign) int index;
 @property (copy) NSString *productName;
 @property (assign) IOHIDDeviceRef device;
index ae278b3..35b40c5 100644 (file)
@@ -60,28 +60,24 @@ static NSArray *ActionsForElement(IOHIDDeviceRef device, id base) {
     return children;
 }
 
     return children;
 }
 
-@implementation Joystick
-
-@synthesize vendorId;
-@synthesize productId;
-@synthesize productName;
-@synthesize index;
-@synthesize device;
-@synthesize children;
+@implementation Joystick {
+    int vendorId;
+    int productId;
+}
 
 - (id)initWithDevice:(IOHIDDeviceRef)dev {
     if ((self = [super init])) {
         self.device = dev;
         self.productName = (__bridge NSString *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDProductKey));
 
 - (id)initWithDevice:(IOHIDDeviceRef)dev {
     if ((self = [super init])) {
         self.device = dev;
         self.productName = (__bridge NSString *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDProductKey));
-        self.vendorId = [(__bridge NSNumber *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDVendorIDKey)) intValue];
-        self.productId = [(__bridge NSNumber *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDProductIDKey)) intValue];
+        vendorId = [(__bridge NSNumber *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDVendorIDKey)) intValue];
+        productId = [(__bridge NSNumber *)IOHIDDeviceGetProperty(dev, CFSTR(kIOHIDProductIDKey)) intValue];
         self.children = ActionsForElement(dev, self);
     }
     return self;
 }
 
 - (NSString *)name {
         self.children = ActionsForElement(dev, self);
     }
     return self;
 }
 
 - (NSString *)name {
-    return [NSString stringWithFormat:@"%@ #%d", productName, index];
+    return [NSString stringWithFormat:@"%@ #%d", _productName, _index];
 }
 
 - (id)base {
 }
 
 - (id)base {
@@ -89,11 +85,11 @@ static NSArray *ActionsForElement(IOHIDDeviceRef device, id base) {
 }
 
 - (NSString *)uid {
 }
 
 - (NSString *)uid {
-    return [NSString stringWithFormat: @"%d:%d:%d", vendorId, productId, index];
+    return [NSString stringWithFormat: @"%d:%d:%d", vendorId, productId, _index];
 }
 
 - (JSAction *)findActionByCookie:(void *)cookie {
 }
 
 - (JSAction *)findActionByCookie:(void *)cookie {
-    for (JSAction *child in children)
+    for (JSAction *child in _children)
         if (child.cookie == cookie)
             return child;
     return nil;
         if (child.cookie == cookie)
             return child;
     return nil;
index 13db938..84366ef 100644 (file)
     NSMutableArray *runningTargets;
 }
 
     NSMutableArray *runningTargets;
 }
 
-@synthesize joysticks;
-@synthesize selectedAction;
-@synthesize frontWindowOnly;
-@synthesize mouseLoc;
-@synthesize sendingRealEvents;
-
 - (id)init {
     if ((self = [super init])) {
 - (id)init {
     if ((self = [super init])) {
-        joysticks = [[NSMutableArray alloc] initWithCapacity:16];
+        _joysticks = [[NSMutableArray alloc] initWithCapacity:16];
         runningTargets = [[NSMutableArray alloc] initWithCapacity:32];
     }
     return self;
         runningTargets = [[NSMutableArray alloc] initWithCapacity:32];
     }
     return self;
@@ -112,7 +106,7 @@ static void add_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDDevi
 }
 
 - (Joystick *)findJoystickByRef:(IOHIDDeviceRef)device {
 }
 
 - (Joystick *)findJoystickByRef:(IOHIDDeviceRef)device {
-    for (Joystick *js in joysticks)
+    for (Joystick *js in _joysticks)
         if (js.device == device)
             return js;
     return nil;
         if (js.device == device)
             return js;
     return nil;
@@ -183,7 +177,7 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD
 }
 
 - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item {
 }
 
 - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item {
-    return item ? [[item children] count] : [joysticks count];
+    return item ? [[item children] count] : _joysticks.count;
 }
 
 - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item {
 }
 
 - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item {
@@ -191,7 +185,7 @@ static void remove_callback(void *ctx, IOReturn inResult, void *inSender, IOHIDD
 }
 
 - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item {
 }
 
 - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item {
-    return item ? [item children][index] : joysticks[index];
+    return item ? [item children][index] : _joysticks[index];
 }
 
 - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item  {
 }
 
 - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item  {
index a3cd4ff..485af1c 100644 (file)
@@ -13,7 +13,6 @@
        IBOutlet TargetController *targetController;
 }
 
        IBOutlet TargetController *targetController;
 }
 
-@property (copy) NSString* descr;
 @property (assign) int vk;
 @property (readonly) BOOL hasKey;
 @property (assign) BOOL enabled;
 @property (assign) int vk;
 @property (readonly) BOOL hasKey;
 @property (assign) BOOL enabled;
index 7bda696..1bb7952 100644 (file)
@@ -14,8 +14,6 @@
     BOOL enabled;
 }
 
     BOOL enabled;
 }
 
-@synthesize descr;
-
 - (id)initWithFrame:(NSRect)frameRect {
     if ((self = [super initWithFrame:frameRect])) {
         self.alignment = NSCenterTextAlignment;
 - (id)initWithFrame:(NSRect)frameRect {
     if ((self = [super initWithFrame:frameRect])) {
         self.alignment = NSCenterTextAlignment;
 }
 
 - (BOOL)acceptsFirstResponder {
 }
 
 - (BOOL)acceptsFirstResponder {
-    return enabled;
+    return self.enabled;
 }
 
 - (BOOL)becomeFirstResponder {
 }
 
 - (BOOL)becomeFirstResponder {
 
 - (void)setVk:(int)key {
     vk = key;
 
 - (void)setVk:(int)key {
     vk = key;
-    descr = [KeyInputTextView stringForKeyCode:key];
-    [self setStringValue:descr];
+    [self setStringValue:[KeyInputTextView stringForKeyCode:key]];
     if (self.hasKey)
         [targetController keyChanged];
 }
     if (self.hasKey)
         [targetController keyChanged];
 }
 - (void)keyDown:(NSEvent *)evt {
     if (!evt.isARepeat) {
         self.vk = evt.keyCode;
 - (void)keyDown:(NSEvent *)evt {
     if (!evt.isARepeat) {
         self.vk = evt.keyCode;
-        [[self window] makeFirstResponder:nil];
+        [self.window makeFirstResponder:nil];
     }
 }
 
     }
 }
 
index 35af184..36da021 100644 (file)
--- a/Target.m
+++ b/Target.m
@@ -18,8 +18,6 @@
     BOOL running;
 }
 
     BOOL running;
 }
 
-@synthesize magnitude;
-
 + (NSString *)serializationCode {
     [self doesNotRecognizeSelector:_cmd];
     return nil;
 + (NSString *)serializationCode {
     [self doesNotRecognizeSelector:_cmd];
     return nil;
index 1fef7a9..e9c374e 100644 (file)
@@ -18,8 +18,8 @@
 }
 
 - (NSDictionary *)serialize {
 }
 
 - (NSDictionary *)serialize {
-    return self.config
-        ? @{ @"type": @"cfg", @"name": self.config.name }
+    return _config
+        ? @{ @"type": @"cfg", @"name": _config.name }
         : @{};
 }
 
         : @{};
 }
 
@@ -37,7 +37,7 @@
 }
 
 - (void)trigger {
 }
 
 - (void)trigger {
-    [[(ApplicationController *)[[NSApplication sharedApplication] delegate] configsController] activateConfig:self.config];
+    [[(ApplicationController *)[[NSApplication sharedApplication] delegate] configsController] activateConfig:_config];
 }
 
 @end
 }
 
 @end
index 6599332..a4766e1 100644 (file)
@@ -11,6 +11,5 @@
 @interface TargetKeyboard : Target
 
 @property (assign) CGKeyCode vk;
 @interface TargetKeyboard : Target
 
 @property (assign) CGKeyCode vk;
-@property (readonly) NSString* descr;
 
 @end
 
 @end
index 0d0583e..a3a0b51 100644 (file)
 
 @implementation TargetKeyboard
 
 
 @implementation TargetKeyboard
 
-@synthesize vk;
-
 + (NSString *)serializationCode {
     return @"key";
 }
 
 - (NSDictionary *)serialize {
 + (NSString *)serializationCode {
     return @"key";
 }
 
 - (NSDictionary *)serialize {
-    return @{ @"type": @"key", @"key": @(self.vk) };
+    return @{ @"type": @"key", @"key": @(_vk) };
 }
 
 + (Target *)targetDeserialize:(NSDictionary *)serialization
                   withConfigs:(NSArray *)configs {
 }
 
 + (Target *)targetDeserialize:(NSDictionary *)serialization
                   withConfigs:(NSArray *)configs {
-       TargetKeyboard *target = [[TargetKeyboard alloc] init];
+    TargetKeyboard *target = [[TargetKeyboard alloc] init];
     target.vk = [serialization[@"key"] intValue];
     target.vk = [serialization[@"key"] intValue];
-       return target;
-}
-
--(void) trigger {
-       CGEventRef keyDown = CGEventCreateKeyboardEvent(NULL, vk, YES);
-       CGEventPost(kCGHIDEventTap, keyDown);
-       CFRelease(keyDown);
+    return target;
 }
 
 }
 
--(void) untrigger {
-       CGEventRef keyUp = CGEventCreateKeyboardEvent(NULL, vk, NO);
-       CGEventPost(kCGHIDEventTap, keyUp);
-       CFRelease(keyUp);
+- (void)trigger {
+    CGEventRef keyDown = CGEventCreateKeyboardEvent(NULL, _vk, YES);
+    CGEventPost(kCGHIDEventTap, keyDown);
+    CFRelease(keyDown);
 }
 
 }
 
-- (NSString *)descr {
-    return [KeyInputTextView stringForKeyCode:self.vk];
+- (void)untrigger {
+    CGEventRef keyUp = CGEventCreateKeyboardEvent(NULL, _vk, NO);
+    CGEventPost(kCGHIDEventTap, keyUp);
+    CFRelease(keyUp);
 }
 
 @end
 }
 
 @end
index 2f56f7e..3efb88a 100644 (file)
 
 @implementation TargetMouseBtn
 
 
 @implementation TargetMouseBtn
 
-@synthesize button;
-
 + (NSString *)serializationCode {
     return @"mbtn";
 }
 
 - (NSDictionary *)serialize {
 + (NSString *)serializationCode {
     return @"mbtn";
 }
 
 - (NSDictionary *)serialize {
-    return @{ @"type": @"mbtn", @"button": @(self.button) };
+    return @{ @"type": @"mbtn", @"button": @(_button) };
 }
 
 + (Target *)targetDeserialize:(NSDictionary *)serialization
 }
 
 + (Target *)targetDeserialize:(NSDictionary *)serialization
     NSRect screenRect = [[NSScreen mainScreen] frame];
     NSInteger height = screenRect.size.height;
     NSPoint mouseLoc = [NSEvent mouseLocation];
     NSRect screenRect = [[NSScreen mainScreen] frame];
     NSInteger height = screenRect.size.height;
     NSPoint mouseLoc = [NSEvent mouseLocation];
-    CGEventType eventType = (button == kCGMouseButtonLeft) ? kCGEventLeftMouseDown : kCGEventRightMouseDown;
+    CGEventType eventType = (_button == kCGMouseButtonLeft) ? kCGEventLeftMouseDown : kCGEventRightMouseDown;
     CGEventRef click = CGEventCreateMouseEvent(NULL,
                                                eventType,
                                                CGPointMake(mouseLoc.x, height - mouseLoc.y),
     CGEventRef click = CGEventCreateMouseEvent(NULL,
                                                eventType,
                                                CGPointMake(mouseLoc.x, height - mouseLoc.y),
-                                               button);
+                                               _button);
     CGEventPost(kCGHIDEventTap, click);
     CFRelease(click);
 }
     CGEventPost(kCGHIDEventTap, click);
     CFRelease(click);
 }
     NSRect screenRect = [[NSScreen mainScreen] frame];
     NSInteger height = screenRect.size.height;
     NSPoint mouseLoc = [NSEvent mouseLocation];
     NSRect screenRect = [[NSScreen mainScreen] frame];
     NSInteger height = screenRect.size.height;
     NSPoint mouseLoc = [NSEvent mouseLocation];
-    CGEventType eventType = (button == kCGMouseButtonLeft) ? kCGEventLeftMouseUp : kCGEventRightMouseUp;
+    CGEventType eventType = (_button == kCGMouseButtonLeft) ? kCGEventLeftMouseUp : kCGEventRightMouseUp;
     CGEventRef click = CGEventCreateMouseEvent(NULL,
                                                eventType,
                                                CGPointMake(mouseLoc.x, height - mouseLoc.y),
     CGEventRef click = CGEventCreateMouseEvent(NULL,
                                                eventType,
                                                CGPointMake(mouseLoc.x, height - mouseLoc.y),
-                                               button);
+                                               _button);
     CGEventPost(kCGHIDEventTap, click);
     CFRelease(click);
 }
     CGEventPost(kCGHIDEventTap, click);
     CFRelease(click);
 }
index 893bbb6..8bbfd42 100644 (file)
     return YES;
 }
 
     return YES;
 }
 
-@synthesize axis;
-
 + (NSString *)serializationCode {
     return @"mmove";
 }
 
 - (NSDictionary *)serialize {
 + (NSString *)serializationCode {
     return @"mmove";
 }
 
 - (NSDictionary *)serialize {
-    return @{ @"type": @"mmove", @"axis": @(self.axis) };
+    return @{ @"type": @"mmove", @"axis": @(_axis) };
 }
 
 + (Target *)targetDeserialize:(NSDictionary *)serialization
 }
 
 + (Target *)targetDeserialize:(NSDictionary *)serialization
@@ -57,7 +55,7 @@
     if ([jc frontWindowOnly])
         speed = 12.f;
     float dx = 0.f, dy = 0.f;
     if ([jc frontWindowOnly])
         speed = 12.f;
     float dx = 0.f, dy = 0.f;
-    if (axis == 0)
+    if (_axis == 0)
         dx = self.magnitude * speed;
     else
         dy = self.magnitude * speed;
         dx = self.magnitude * speed;
     else
         dy = self.magnitude * speed;
index 4d6f409..6986004 100644 (file)
 
 @implementation TargetMouseScroll
 
 
 @implementation TargetMouseScroll
 
-@synthesize amount;
-
 + (NSString *)serializationCode {
     return @"mscroll";
 }
 
 - (NSDictionary *)serialize {
 + (NSString *)serializationCode {
     return @"mscroll";
 }
 
 - (NSDictionary *)serialize {
-    return @{ @"type": @"mscroll", @"amount": @(self.amount) };
+    return @{ @"type": @"mscroll", @"amount": @(_amount) };
 }
 
 + (Target *)targetDeserialize:(NSDictionary *)serialization
 }
 
 + (Target *)targetDeserialize:(NSDictionary *)serialization
@@ -30,7 +28,7 @@
     CGEventRef scroll = CGEventCreateScrollWheelEvent(NULL,
                                                       kCGScrollEventUnitLine,
                                                       1,
     CGEventRef scroll = CGEventCreateScrollWheelEvent(NULL,
                                                       kCGScrollEventUnitLine,
                                                       1,
-                                                      self.amount);
+                                                      _amount);
     CGEventPost(kCGHIDEventTap, scroll);
     CFRelease(scroll);
 }
     CGEventPost(kCGHIDEventTap, scroll);
     CFRelease(scroll);
 }