From 16a7c0a04bd05f4012d5a97a53520802969cfc86 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Thu, 28 Feb 2013 20:20:55 +0100 Subject: [PATCH] Fix names while I still can. --- TargetController.m | 12 ++++++------ TargetMouseBtn.h | 2 +- TargetMouseBtn.m | 14 +++++++------- TargetMouseMove.h | 2 +- TargetMouseMove.m | 8 ++++---- TargetMouseScroll.h | 2 +- TargetMouseScroll.m | 8 ++++---- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/TargetController.m b/TargetController.m index 749feb2..08bf149 100644 --- a/TargetController.m +++ b/TargetController.m @@ -107,17 +107,17 @@ } case 3: { TargetMouseMove *mm = [[TargetMouseMove alloc] init]; - mm.dir = mouseDirSelect.selectedSegment; + mm.axis = mouseDirSelect.selectedSegment; return mm; } case 4: { TargetMouseBtn *mb = [[TargetMouseBtn alloc] init]; - mb.which = mouseBtnSelect.selectedSegment == 0 ? kCGMouseButtonLeft : kCGMouseButtonRight; + mb.button = mouseBtnSelect.selectedSegment == 0 ? kCGMouseButtonLeft : kCGMouseButtonRight; return mb; } case 5: { TargetMouseScroll *ms = [[TargetMouseScroll alloc] init]; - ms.howMuch = scrollDirSelect.selectedSegment ? 1 : -1; + ms.amount = scrollDirSelect.selectedSegment ? 1 : -1; return ms; } case 6: { @@ -180,15 +180,15 @@ } else if ([target isKindOfClass:[TargetMouseMove class]]) { [radioButtons setState:1 atRow:3 column:0]; - [mouseDirSelect setSelectedSegment:[(TargetMouseMove *)target dir]]; + [mouseDirSelect setSelectedSegment:[(TargetMouseMove *)target axis]]; } else if ([target isKindOfClass:[TargetMouseBtn class]]) { [radioButtons setState:1 atRow:4 column:0]; - mouseBtnSelect.selectedSegment = [(TargetMouseBtn *)target which] == kCGMouseButtonLeft ? 0 : 1; + mouseBtnSelect.selectedSegment = [(TargetMouseBtn *)target button] == kCGMouseButtonLeft ? 0 : 1; } else if ([target isKindOfClass:[TargetMouseScroll class]]) { [radioButtons setState:1 atRow:5 column:0]; - scrollDirSelect.selectedSegment = [(TargetMouseScroll *)target howMuch] > 0; + scrollDirSelect.selectedSegment = [(TargetMouseScroll *)target amount] > 0; } else if ([target isKindOfClass:[TargetToggleMouseScope class]]) { [radioButtons setState:1 atRow:6 column:0]; diff --git a/TargetMouseBtn.h b/TargetMouseBtn.h index a0b8516..e8d8013 100644 --- a/TargetMouseBtn.h +++ b/TargetMouseBtn.h @@ -10,6 +10,6 @@ @interface TargetMouseBtn : Target -@property (assign) CGMouseButton which; +@property (assign) CGMouseButton button; @end diff --git a/TargetMouseBtn.m b/TargetMouseBtn.m index 28fe536..2f56f7e 100644 --- a/TargetMouseBtn.m +++ b/TargetMouseBtn.m @@ -10,20 +10,20 @@ @implementation TargetMouseBtn -@synthesize which; +@synthesize button; + (NSString *)serializationCode { return @"mbtn"; } - (NSDictionary *)serialize { - return @{ @"type": @"mbtn", @"which": @(self.which) }; + return @{ @"type": @"mbtn", @"button": @(self.button) }; } + (Target *)targetDeserialize:(NSDictionary *)serialization withConfigs:(NSArray *)configs { TargetMouseBtn *target = [[TargetMouseBtn alloc] init]; - target.which = [serialization[@"which"] intValue]; + target.button = [serialization[@"button"] intValue]; return target; } @@ -31,11 +31,11 @@ NSRect screenRect = [[NSScreen mainScreen] frame]; NSInteger height = screenRect.size.height; NSPoint mouseLoc = [NSEvent mouseLocation]; - CGEventType eventType = (which == kCGMouseButtonLeft) ? kCGEventLeftMouseDown : kCGEventRightMouseDown; + CGEventType eventType = (button == kCGMouseButtonLeft) ? kCGEventLeftMouseDown : kCGEventRightMouseDown; CGEventRef click = CGEventCreateMouseEvent(NULL, eventType, CGPointMake(mouseLoc.x, height - mouseLoc.y), - which); + button); CGEventPost(kCGHIDEventTap, click); CFRelease(click); } @@ -44,11 +44,11 @@ NSRect screenRect = [[NSScreen mainScreen] frame]; NSInteger height = screenRect.size.height; NSPoint mouseLoc = [NSEvent mouseLocation]; - CGEventType eventType = (which == kCGMouseButtonLeft) ? kCGEventLeftMouseUp : kCGEventRightMouseUp; + CGEventType eventType = (button == kCGMouseButtonLeft) ? kCGEventLeftMouseUp : kCGEventRightMouseUp; CGEventRef click = CGEventCreateMouseEvent(NULL, eventType, CGPointMake(mouseLoc.x, height - mouseLoc.y), - which); + button); CGEventPost(kCGHIDEventTap, click); CFRelease(click); } diff --git a/TargetMouseMove.h b/TargetMouseMove.h index 24efa40..89f9c76 100644 --- a/TargetMouseMove.h +++ b/TargetMouseMove.h @@ -10,6 +10,6 @@ @interface TargetMouseMove : Target -@property (assign) int dir; +@property (assign) int axis; @end diff --git a/TargetMouseMove.m b/TargetMouseMove.m index f75f70b..893bbb6 100644 --- a/TargetMouseMove.m +++ b/TargetMouseMove.m @@ -18,20 +18,20 @@ return YES; } -@synthesize dir; +@synthesize axis; + (NSString *)serializationCode { return @"mmove"; } - (NSDictionary *)serialize { - return @{ @"type": @"mmove", @"dir": @(self.dir) }; + return @{ @"type": @"mmove", @"axis": @(self.axis) }; } + (Target *)targetDeserialize:(NSDictionary *)serialization withConfigs:(NSArray *)configs { TargetMouseMove *target = [[TargetMouseMove alloc] init]; - target.dir = [serialization[@"dir"] intValue]; + target.axis = [serialization[@"axis"] intValue]; return target; } @@ -57,7 +57,7 @@ if ([jc frontWindowOnly]) speed = 12.f; float dx = 0.f, dy = 0.f; - if (self.dir == 0) + if (axis == 0) dx = self.magnitude * speed; else dy = self.magnitude * speed; diff --git a/TargetMouseScroll.h b/TargetMouseScroll.h index cdfe010..5c13d5f 100644 --- a/TargetMouseScroll.h +++ b/TargetMouseScroll.h @@ -10,6 +10,6 @@ @interface TargetMouseScroll : Target -@property (assign) int howMuch; +@property (assign) int amount; @end diff --git a/TargetMouseScroll.m b/TargetMouseScroll.m index 3c417c1..4d6f409 100644 --- a/TargetMouseScroll.m +++ b/TargetMouseScroll.m @@ -10,27 +10,27 @@ @implementation TargetMouseScroll -@synthesize howMuch; +@synthesize amount; + (NSString *)serializationCode { return @"mscroll"; } - (NSDictionary *)serialize { - return @{ @"type": @"mscroll", @"howMuch": @(self.howMuch) }; + return @{ @"type": @"mscroll", @"amount": @(self.amount) }; } + (Target *)targetDeserialize:(NSDictionary *)serialization withConfigs:(NSArray *)configs { TargetMouseScroll *target = [[TargetMouseScroll alloc] init]; - target.howMuch = [serialization[@"howMuch"] intValue]; + target.amount = [serialization[@"amount"] intValue]; return target; } -(void) trigger { CGEventRef scroll = CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitLine, 1, - self.howMuch); + self.amount); CGEventPost(kCGHIDEventTap, scroll); CFRelease(scroll); } -- 2.30.2