mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-27 09:38:39 +02:00
Better implementation of switch from scrub to quick play; ...
This commit is contained in:
commit
54c6493df6
@ -501,6 +501,11 @@ void Scrubber::Pause( bool paused )
|
|||||||
mScrubHasFocus = !paused;
|
mScrubHasFocus = !paused;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Scrubber::IsPaused() const
|
||||||
|
{
|
||||||
|
return !mScrubHasFocus;
|
||||||
|
}
|
||||||
|
|
||||||
void Scrubber::OnActivateOrDeactivateApp(wxActivateEvent &event)
|
void Scrubber::OnActivateOrDeactivateApp(wxActivateEvent &event)
|
||||||
{
|
{
|
||||||
if (event.GetActive())
|
if (event.GetActive())
|
||||||
|
@ -87,6 +87,7 @@ public:
|
|||||||
static std::vector<wxString> GetAllUntranslatedStatusStrings();
|
static std::vector<wxString> GetAllUntranslatedStatusStrings();
|
||||||
|
|
||||||
void Pause(bool paused);
|
void Pause(bool paused);
|
||||||
|
bool IsPaused() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DoScrub(bool scroll, bool seek);
|
void DoScrub(bool scroll, bool seek);
|
||||||
|
@ -1814,8 +1814,9 @@ void QuickPlayRulerOverlay::Draw(OverlayPanel &panel, wxDC &dc)
|
|||||||
if (mOldQPIndicatorPos >= 0) {
|
if (mOldQPIndicatorPos >= 0) {
|
||||||
auto ruler = GetRuler();
|
auto ruler = GetRuler();
|
||||||
auto scrub =
|
auto scrub =
|
||||||
ruler->mPrevZone == AdornedRulerPanel::StatusChoice::EnteringScrubZone ||
|
ruler->mMouseEventState == AdornedRulerPanel::mesNone &&
|
||||||
mPartner.mProject->GetScrubber().HasStartedScrubbing();
|
(ruler->mPrevZone == AdornedRulerPanel::StatusChoice::EnteringScrubZone ||
|
||||||
|
(mPartner.mProject->GetScrubber().HasStartedScrubbing()));
|
||||||
auto width = scrub ? IndicatorBigWidth() : IndicatorSmallWidth;
|
auto width = scrub ? IndicatorBigWidth() : IndicatorSmallWidth;
|
||||||
ruler->DoDrawIndicator(&dc, mOldQPIndicatorPos, true, width, scrub);
|
ruler->DoDrawIndicator(&dc, mOldQPIndicatorPos, true, width, scrub);
|
||||||
}
|
}
|
||||||
@ -2402,46 +2403,41 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
|||||||
if (IsButton(zone) || evt.RightDown())
|
if (IsButton(zone) || evt.RightDown())
|
||||||
// Fall through to pushbutton handling
|
// Fall through to pushbutton handling
|
||||||
;
|
;
|
||||||
else if (zone == StatusChoice::EnteringQP &&
|
|
||||||
mQuickPlayEnabled &&
|
|
||||||
evt.LeftUp()) {
|
|
||||||
// Stop scrubbing
|
|
||||||
if (HasCapture())
|
|
||||||
ReleaseMouse();
|
|
||||||
mProject->OnStop();
|
|
||||||
|
|
||||||
// Simulate a new click in the same place
|
|
||||||
evt.SetEventType(wxEVT_LEFT_DOWN);
|
|
||||||
this->AddPendingEvent(evt);
|
|
||||||
evt.SetEventType(wxEVT_LEFT_UP);
|
|
||||||
this->AddPendingEvent(evt);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
// If already clicked for scrub, preempt the usual event handling,
|
bool switchToQP = (zone == StatusChoice::EnteringQP && mQuickPlayEnabled);
|
||||||
// no matter what the y coordinate.
|
if (switchToQP && evt.LeftDown()) {
|
||||||
|
// We can't stop scrubbing yet (see comments in Bug 1391), but we can pause it.
|
||||||
|
mProject->OnPause();
|
||||||
|
// Don't return, fall through
|
||||||
|
}
|
||||||
|
else if (scrubber.IsPaused())
|
||||||
|
// Just fall through
|
||||||
|
;
|
||||||
|
else {
|
||||||
|
// If already clicked for scrub, preempt the usual event handling,
|
||||||
|
// no matter what the y coordinate.
|
||||||
|
|
||||||
// Do this hack so scrubber can detect mouse drags anywhere
|
// Do this hack so scrubber can detect mouse drags anywhere
|
||||||
evt.ResumePropagation(wxEVENT_PROPAGATE_MAX);
|
evt.ResumePropagation(wxEVENT_PROPAGATE_MAX);
|
||||||
|
|
||||||
if (scrubber.IsScrubbing())
|
if (scrubber.IsScrubbing())
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
else if (evt.LeftDClick())
|
else if (evt.LeftDClick())
|
||||||
// On the second button down, switch the pending scrub to scrolling
|
// On the second button down, switch the pending scrub to scrolling
|
||||||
scrubber.MarkScrubStart(evt.m_x, true, false);
|
scrubber.MarkScrubStart(evt.m_x, true, false);
|
||||||
else
|
else
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
|
|
||||||
// Don't do this, it slows down drag-scrub on Mac.
|
// Don't do this, it slows down drag-scrub on Mac.
|
||||||
// Timer updates of display elsewhere make it unnecessary.
|
// Timer updates of display elsewhere make it unnecessary.
|
||||||
// Done here, it's too frequent.
|
// Done here, it's too frequent.
|
||||||
// ShowQuickPlayIndicator();
|
// ShowQuickPlayIndicator();
|
||||||
|
|
||||||
if (HasCapture())
|
if (HasCapture())
|
||||||
ReleaseMouse();
|
ReleaseMouse();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user