1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-14 17:14:07 +01:00

Improve scrubbing speed control (2 finger swipe) on Mac

This commit is contained in:
Paul Licameli
2016-05-28 08:22:31 -04:00
parent af7a92c2ab
commit e4fadf4aaf
5 changed files with 38 additions and 8 deletions

View File

@@ -381,9 +381,7 @@ bool Scrubber::MaybeStartScrubbing(wxCoord xx)
mOptions.startClockTimeMillis = ::wxGetLocalTimeMillis();
if (IsScrubbing()) {
using Mode = AudacityProject::PlaybackScroller::Mode;
mProject->GetPlaybackScroller().Activate
(mSmoothScrollingScrub ? Mode::Centered : Mode::Off);
ActivateScroller();
mPaused = false;
mLastScrubPosition = xx;
@@ -561,6 +559,9 @@ void Scrubber::HandleScrollWheel(int steps)
// Not likely you would spin it with the left button down, but...
return;
if (steps == 0)
return;
const int newLogMaxScrubSpeed = mLogMaxScrubSpeed + steps;
static const double maxScrubSpeedBase =
pow(2.0, 1.0 / ScrubSpeedStepsPerOctave);
@@ -775,6 +776,24 @@ bool Scrubber::PollIsSeeking()
return mDragging || (mAlwaysSeeking || ::wxGetMouseState().LeftIsDown());
}
void Scrubber::ActivateScroller()
{
using Mode = AudacityProject::PlaybackScroller::Mode;
mProject->GetPlaybackScroller().Activate(mSmoothScrollingScrub
? Mode::Centered
:
#ifdef __WXMAC__
// PRL: cause many "unnecessary" refreshes. For reasons I don't understand,
// doing this causes wheel rotation events (mapped from the double finger vertical
// swipe) to be delivered more uniformly to the application, so that spped control
// works better.
Mode::Refresh
#else
Mode::Off
#endif
);
}
void Scrubber::DoScrub(bool scroll, bool seek)
{
const bool wasScrubbing = IsScrubbing();
@@ -793,9 +812,7 @@ void Scrubber::DoScrub(bool scroll, bool seek)
}
else if(!match) {
mSmoothScrollingScrub = scroll;
using Mode = AudacityProject::PlaybackScroller::Mode;
mProject->GetPlaybackScroller().Activate
(scroll ? Mode::Centered : Mode::Off);
ActivateScroller();
mAlwaysSeeking = seek;
UncheckAllMenuItems();
CheckMenuItem();

View File

@@ -128,6 +128,7 @@ public:
bool IsPaused() const;
private:
void ActivateScroller();
void DoScrub(bool scroll, bool seek);
void OnActivateOrDeactivateApp(wxActivateEvent & event);
void UncheckAllMenuItems();