X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=NJOutputController.m;h=bcafe0d3a96f207feb1b5207a636ed0593db8863;hp=e60a83e742fda18539db22973520302cff303aae;hb=72a9fcd1e832a4e22f02018b855feaa414ae8c5c;hpb=4f449987e5296701d1da9963789c4817935ab6c8 diff --git a/NJOutputController.m b/NJOutputController.m index e60a83e..bcafe0d 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; } @@ -189,6 +207,7 @@ [mouseSpeedSlider setEnabled:enabled]; [mouseBtnSelect setEnabled:enabled]; [scrollDirSelect setEnabled:enabled]; + [scrollSpeedSlider setEnabled:enabled]; } - (void)loadOutput:(NJOutput *)output forInput:(NJInput *)input { @@ -225,10 +244,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]; }