X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=TargetController.m;h=3442a61e3912169d45437683405bcff8e7f9ad24;hp=9b075a15945ca851b8f5aa679d42952738cbd7ac;hb=61f8cdec21ab083b29c22aa11fda54d6005666ca;hpb=ac4ed3987b6aaefc836294f89ff1f569fad6ac6b diff --git a/TargetController.m b/TargetController.m index 9b075a1..3442a61 100644 --- a/TargetController.m +++ b/TargetController.m @@ -15,7 +15,17 @@ [[[NSApplication sharedApplication] mainWindow] makeFirstResponder: sender]; [self commit]; } +-(IBAction)mdirChanged:(id)sender { + [radioButtons setState: 1 atRow: 3 column: 0]; + [[[NSApplication sharedApplication] mainWindow] makeFirstResponder: sender]; + [self commit]; +} -(IBAction)mbtnChanged:(id)sender { + [radioButtons setState: 1 atRow: 4 column: 0]; + [[[NSApplication sharedApplication] mainWindow] makeFirstResponder: sender]; + [self commit]; +} +-(IBAction)sdirChanged:(id)sender { [radioButtons setState: 1 atRow: 5 column: 0]; [[[NSApplication sharedApplication] mainWindow] makeFirstResponder: sender]; [self commit]; @@ -41,18 +51,12 @@ return c; } case 3: { - // mouse X + // mouse X/Y TargetMouseMove *mm = [[TargetMouseMove alloc] init]; - [mm setDir: 0]; + [mm setDir: [mouseDirSelect selectedSegment]]; return mm; } case 4: { - // mouse Y - TargetMouseMove *mm = [[TargetMouseMove alloc] init]; - [mm setDir: 1]; - return mm; - } - case 5: { // mouse button TargetMouseBtn *mb = [[TargetMouseBtn alloc] init]; if ([mouseBtnSelect selectedSegment] == 0) { @@ -63,6 +67,22 @@ } return mb; } + case 5: { + // scroll + TargetMouseScroll *ms = [[TargetMouseScroll alloc] init]; + if ([scrollDirSelect selectedSegment] == 0) { + [ms setHowMuch: -1]; + } + else { + [ms setHowMuch: 1]; + } + return ms; + } + case 6: { + // toggle mouse scope + TargetToggleMouseScope *tms = [[TargetToggleMouseScope alloc] init]; + return tms; + } } return NULL; } @@ -83,7 +103,9 @@ -(void) reset { [keyInput clear]; [radioButtons setState: 1 atRow: 0 column: 0]; + [mouseDirSelect setSelectedSegment: 0]; [mouseBtnSelect setSelectedSegment: 0]; + [scrollDirSelect setSelectedSegment: 0]; [self refreshConfigsPreservingSelection: NO]; } @@ -91,7 +113,9 @@ [radioButtons setEnabled: enabled]; [keyInput setEnabled: enabled]; [configPopup setEnabled: enabled]; + [mouseDirSelect setEnabled: enabled]; [mouseBtnSelect setEnabled: enabled]; + [scrollDirSelect setEnabled: enabled]; } -(BOOL) enabled { return [radioButtons isEnabled]; @@ -127,17 +151,25 @@ [configPopup selectItemAtIndex: [[configsController configs] indexOfObject: [(TargetConfig*)target config]]]; } else if ([target isKindOfClass: [TargetMouseMove class]]) { - if ([(TargetMouseMove *)target dir] == 0) - [radioButtons setState:1 atRow: 3 column: 0]; - else - [radioButtons setState:1 atRow: 4 column: 0]; + [radioButtons setState:1 atRow: 3 column: 0]; + [mouseDirSelect setSelectedSegment: [(TargetMouseMove *)target dir]]; } else if ([target isKindOfClass: [TargetMouseBtn class]]) { - [radioButtons setState: 1 atRow: 5 column: 0]; + [radioButtons setState: 1 atRow: 4 column: 0]; if ([(TargetMouseBtn *)target which] == kCGMouseButtonLeft) [mouseBtnSelect setSelectedSegment: 0]; else [mouseBtnSelect setSelectedSegment: 1]; + } + else if ([target isKindOfClass: [TargetMouseScroll class]]) { + [radioButtons setState: 1 atRow: 5 column: 0]; + if ([(TargetMouseScroll *)target howMuch] < 0) + [scrollDirSelect setSelectedSegment: 0]; + else + [scrollDirSelect setSelectedSegment: 1]; + } + else if ([target isKindOfClass: [TargetToggleMouseScope class]]) { + [radioButtons setState: 1 atRow: 6 column: 0]; } else { [NSException raise:@"Unknown target subclass" format:@"Unknown target subclass"]; }