X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=NJOutputController.m;h=b4152e9a825d7b31341e93e62ad94d9a15a4f88e;hp=e60a83e742fda18539db22973520302cff303aae;hb=7509e2cc66447be620a3b2a7295e5273e8da6e01;hpb=4f449987e5296701d1da9963789c4817935ab6c8 diff --git a/NJOutputController.m b/NJOutputController.m index e60a83e..b4152e9 100644 --- a/NJOutputController.m +++ b/NJOutputController.m @@ -19,7 +19,6 @@ #import "NJOutputMouseButton.h" #import "NJOutputMouseMove.h" #import "NJOutputMouseScroll.h" -#import "NJOutputSwitchMouseMode.h" @implementation NJOutputController @@ -71,9 +70,19 @@ if (row != 5) { scrollDirSelect.selectedSegment = -1; + scrollSpeedSlider.floatValue = scrollSpeedSlider.minValue; [scrollDirSelect resignIfFirstResponder]; - } else if (scrollDirSelect.selectedSegment == -1) - scrollDirSelect.selectedSegment = 0; + } else { + if (scrollDirSelect.selectedSegment == -1) + scrollDirSelect.selectedSegment = 0; + if (scrollDirSelect.selectedSegment < 2 + && !scrollSpeedSlider.floatValue) + scrollSpeedSlider.floatValue = 15.f; + else if (scrollDirSelect.selectedSegment >= 2 + && scrollSpeedSlider.floatValue) + scrollSpeedSlider.floatValue = scrollSpeedSlider.minValue; + } + } - (IBAction)radioChanged:(NSView *)sender { @@ -124,6 +133,16 @@ [self commit]; } +- (void)scrollSpeedChanged:(NSSlider *)sender { + [radioButtons selectCellAtRow:5 column:0]; + [sender.window makeFirstResponder:sender]; + if (!sender.floatValue && scrollDirSelect.selectedSegment < 2) + scrollDirSelect.selectedSegment += 2; + else if (sender.floatValue && scrollDirSelect.selectedSegment >= 2) + scrollDirSelect.selectedSegment -= 2; + [self commit]; +} + - (NJOutput *)currentOutput { return mappingsController.currentMapping[inputController.selectedInput]; } @@ -159,13 +178,12 @@ } case 5: { NJOutputMouseScroll *ms = [[NJOutputMouseScroll alloc] init]; - ms.amount = scrollDirSelect.selectedSegment ? 1 : -1; + ms.direction = (scrollDirSelect.selectedSegment & 1) ? 1 : -1; + ms.speed = scrollDirSelect.selectedSegment < 2 + ? scrollSpeedSlider.floatValue + : 0.f; return ms; } - case 6: { - NJOutputSwitchMouseMode *tms = [[NJOutputSwitchMouseMode alloc] init]; - return tms; - } default: return nil; } @@ -225,10 +243,10 @@ } else if ([output isKindOfClass:NJOutputMouseScroll.class]) { [radioButtons selectCellAtRow:5 column:0]; - scrollDirSelect.selectedSegment = [(NJOutputMouseScroll *)output amount] > 0; - } - else if ([output isKindOfClass:NJOutputSwitchMouseMode.class]) { - [radioButtons selectCellAtRow:6 column:0]; + int direction = [(NJOutputMouseScroll *)output direction]; + float speed = [(NJOutputMouseScroll *)output speed]; + scrollDirSelect.selectedSegment = (direction > 0) + !speed * 2; + scrollSpeedSlider.floatValue = speed; } else { [radioButtons selectCellAtRow:self.enabled ? 0 : -1 column:0]; }