mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-14 09:03:54 +01:00
Add transport menu items for scrubbing and seeking...
... This includes new always-seeking modes unlike scrubbing which can switch to seeking and back according to the left mouse button state. The reason for this is that visually impaired users should not be required to click with the mouse in the track panel window to signal seeking. But mouse movements can still control scrubbing, because we poll the global mouse position in the timer, not relying on events from any window object.
This commit is contained in:
@@ -34,11 +34,6 @@ enum {
|
||||
};
|
||||
|
||||
namespace {
|
||||
bool PollIsSeeking()
|
||||
{
|
||||
return ::wxGetMouseState().LeftIsDown();
|
||||
}
|
||||
|
||||
double FindScrubbingSpeed(const ViewInfo &viewInfo, double maxScrubSpeed, double screen, double timeAtMouse)
|
||||
{
|
||||
// Map a time (which was mapped from a mouse position)
|
||||
@@ -144,6 +139,7 @@ void Scrubber::MarkScrubStart(
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
||||
, bool smoothScrolling
|
||||
#endif
|
||||
, bool alwaysSeeking
|
||||
)
|
||||
{
|
||||
const wxCoord xx = event.m_x;
|
||||
@@ -154,6 +150,7 @@ void Scrubber::MarkScrubStart(
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
||||
mSmoothScrollingScrub = smoothScrolling;
|
||||
#endif
|
||||
mAlwaysSeeking = alwaysSeeking;
|
||||
mScrubStartPosition = xx;
|
||||
mScrubStartClockTimeMillis = ::wxGetLocalTimeMillis();
|
||||
|
||||
@@ -202,10 +199,12 @@ bool Scrubber::MaybeStartScrubbing(const wxMouseEvent &event)
|
||||
options.scrubStartClockTimeMillis = mScrubStartClockTimeMillis;
|
||||
options.minScrubStutter = 0.2;
|
||||
#if 0
|
||||
// Take the starting speed limit from the transcription toolbar,
|
||||
// but it may be varied during the scrub.
|
||||
mMaxScrubSpeed = options.maxScrubSpeed =
|
||||
if (!mAlwaysSeeking) {
|
||||
// Take the starting speed limit from the transcription toolbar,
|
||||
// but it may be varied during the scrub.
|
||||
mMaxScrubSpeed = options.maxScrubSpeed =
|
||||
p->GetTranscriptionToolBar()->GetPlaySpeed();
|
||||
}
|
||||
#else
|
||||
// That idea seems unpopular... just make it one
|
||||
mMaxScrubSpeed = options.maxScrubSpeed = 1.0;
|
||||
@@ -488,7 +487,7 @@ void ScrubbingOverlay::OnTimer(wxCommandEvent &event)
|
||||
::wxGetMousePosition(&xx, &yy);
|
||||
trackPanel->ScreenToClient(&xx, &yy);
|
||||
|
||||
const bool seeking = PollIsSeeking();
|
||||
const bool seeking = scrubber.PollIsSeeking();
|
||||
|
||||
// Find the text
|
||||
const double maxScrubSpeed = GetScrubber().GetMaxScrubSpeed();
|
||||
@@ -543,4 +542,10 @@ Scrubber &ScrubbingOverlay::GetScrubber()
|
||||
{
|
||||
return mProject->GetScrubber();
|
||||
}
|
||||
|
||||
bool Scrubber::PollIsSeeking()
|
||||
{
|
||||
return mAlwaysSeeking || ::wxGetMouseState().LeftIsDown();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,6 +31,8 @@ public:
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_SMOOTH_SCROLL
|
||||
, bool smoothScrolling
|
||||
#endif
|
||||
, bool alwaysSeeking // if false, can switch seeking or scrubbing
|
||||
// by mouse button state
|
||||
);
|
||||
// Returns true iff the event should be considered consumed by this:
|
||||
bool MaybeStartScrubbing(const wxMouseEvent &event);
|
||||
@@ -55,6 +57,10 @@ public:
|
||||
void HandleScrollWheel(int steps);
|
||||
|
||||
void SetSeeking() { mScrubSeekPress = true; }
|
||||
bool PollIsSeeking();
|
||||
|
||||
private:
|
||||
void OnActivateOrDeactivateApp(wxActivateEvent & event);
|
||||
|
||||
private:
|
||||
int mScrubToken;
|
||||
@@ -65,14 +71,12 @@ private:
|
||||
double mMaxScrubSpeed;
|
||||
bool mScrubSeekPress;
|
||||
bool mSmoothScrollingScrub;
|
||||
bool mAlwaysSeeking{};
|
||||
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
|
||||
int mLogMaxScrubSpeed;
|
||||
#endif
|
||||
|
||||
private:
|
||||
void OnActivateOrDeactivateApp(wxActivateEvent & event);
|
||||
|
||||
AudacityProject *mProject;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user