projects
/
enjoyable.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
320e306
)
Clean up a bunch of properties; remove unused ones, use automatic ones where possible...
author
Joe Wreschnig
<joe.wreschnig@gmail.com>
Thu, 28 Feb 2013 21:11:53 +0000
(22:11 +0100)
committer
Joe Wreschnig
<joe.wreschnig@gmail.com>
Thu, 28 Feb 2013 21:11:53 +0000
(22:11 +0100)
18 files changed:
ApplicationController.m
patch
|
blob
|
history
ConfigsController.h
patch
|
blob
|
history
ConfigsController.m
patch
|
blob
|
history
JSAction.m
patch
|
blob
|
history
JSActionButton.h
patch
|
blob
|
history
JSActionButton.m
patch
|
blob
|
history
Joystick.h
patch
|
blob
|
history
Joystick.m
patch
|
blob
|
history
JoystickController.m
patch
|
blob
|
history
KeyInputTextView.h
patch
|
blob
|
history
KeyInputTextView.m
patch
|
blob
|
history
Target.m
patch
|
blob
|
history
TargetConfig.m
patch
|
blob
|
history
TargetKeyboard.h
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
aa51eeb
..
6a34916
100644
(file)
--- a/
ApplicationController.m
+++ b/
ApplicationController.m
@@
-16,10
+16,6
@@
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
diff --git
a/ConfigsController.h
b/ConfigsController.h
index
a408d3b
..
e616e1e
100644
(file)
--- a/
ConfigsController.h
+++ b/
ConfigsController.h
@@
-10,22
+10,19
@@
@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;
diff --git
a/ConfigsController.m
b/ConfigsController.m
index
4227d43
..
769fabd
100644
(file)
--- a/
ConfigsController.m
+++ b/
ConfigsController.m
@@
-14,25
+14,22
@@
#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;
@@
-47,37
+44,37
@@
- (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];
@@
-85,22
+82,22
@@
-(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 {
@@
-117,8
+114,8
@@
}
- (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];
@@
-126,7
+123,7
@@
@"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) };
}
@@
-153,10
+150,10
@@
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]];
}
}
}
}
diff --git
a/JSAction.m
b/JSAction.m
index
0216e58
..
6903c56
100644
(file)
--- a/
JSAction.m
+++ b/
JSAction.m
@@
-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 {
diff --git
a/JSActionButton.h
b/JSActionButton.h
index
c4ba063
..
927606d
100644
(file)
--- a/
JSActionButton.h
+++ b/
JSActionButton.h
@@
-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
diff --git
a/JSActionButton.m
b/JSActionButton.m
index
12449ce
..
c74c0e2
100644
(file)
--- a/
JSActionButton.m
+++ b/
JSActionButton.m
@@
-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];
}
@@
-26,11
+23,11
@@
}
- (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
diff --git
a/Joystick.h
b/Joystick.h
index
2aea487
..
1c254a7
100644
(file)
--- a/
Joystick.h
+++ b/
Joystick.h
@@
-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;
diff --git
a/Joystick.m
b/Joystick.m
index
ae278b3
..
35b40c5
100644
(file)
--- a/
Joystick.m
+++ b/
Joystick.m
@@
-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;
diff --git
a/JoystickController.m
b/JoystickController.m
index
13db938
..
84366ef
100644
(file)
--- a/
JoystickController.m
+++ b/
JoystickController.m
@@
-20,15
+20,9
@@
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 {
diff --git
a/KeyInputTextView.h
b/KeyInputTextView.h
index
a3cd4ff
..
485af1c
100644
(file)
--- a/
KeyInputTextView.h
+++ b/
KeyInputTextView.h
@@
-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;
diff --git
a/KeyInputTextView.m
b/KeyInputTextView.m
index
7bda696
..
1bb7952
100644
(file)
--- a/
KeyInputTextView.m
+++ b/
KeyInputTextView.m
@@
-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;
@@
-157,7
+155,7
@@
}
- (BOOL)acceptsFirstResponder {
}
- (BOOL)acceptsFirstResponder {
- return enabled;
+ return
self.
enabled;
}
- (BOOL)becomeFirstResponder {
}
- (BOOL)becomeFirstResponder {
@@
-176,8
+174,7
@@
- (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];
}
@@
-189,7
+186,7
@@
- (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];
}
}
}
}
diff --git
a/Target.m
b/Target.m
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;
diff --git
a/TargetConfig.m
b/TargetConfig.m
index
1fef7a9
..
e9c374e
100644
(file)
--- a/
TargetConfig.m
+++ b/
TargetConfig.m
@@
-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
diff --git
a/TargetKeyboard.h
b/TargetKeyboard.h
index
6599332
..
a4766e1
100644
(file)
--- a/
TargetKeyboard.h
+++ b/
TargetKeyboard.h
@@
-11,6
+11,5
@@
@interface TargetKeyboard : Target
@property (assign) CGKeyCode vk;
@interface TargetKeyboard : Target
@property (assign) CGKeyCode vk;
-@property (readonly) NSString* descr;
@end
@end
diff --git
a/TargetKeyboard.m
b/TargetKeyboard.m
index
0d0583e
..
a3a0b51
100644
(file)
--- a/
TargetKeyboard.m
+++ b/
TargetKeyboard.m
@@
-11,37
+11,31
@@
@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) un
trigger {
-
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
diff --git
a/TargetMouseBtn.m
b/TargetMouseBtn.m
index
2f56f7e
..
3efb88a
100644
(file)
--- a/
TargetMouseBtn.m
+++ b/
TargetMouseBtn.m
@@
-10,14
+10,12
@@
@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
@@
-31,11
+29,11
@@
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);
}
@@
-44,11
+42,11
@@
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);
}
diff --git
a/TargetMouseMove.m
b/TargetMouseMove.m
index
893bbb6
..
8bbfd42
100644
(file)
--- a/
TargetMouseMove.m
+++ b/
TargetMouseMove.m
@@
-18,14
+18,12
@@
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;
diff --git
a/TargetMouseScroll.m
b/TargetMouseScroll.m
index
4d6f409
..
6986004
100644
(file)
--- a/
TargetMouseScroll.m
+++ b/
TargetMouseScroll.m
@@
-10,14
+10,12
@@
@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);
}