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;
|
||||
}
|
||||
|
||||
bool Scrubber::IsPaused() const
|
||||
{
|
||||
return !mScrubHasFocus;
|
||||
}
|
||||
|
||||
void Scrubber::OnActivateOrDeactivateApp(wxActivateEvent &event)
|
||||
{
|
||||
if (event.GetActive())
|
||||
|
@ -87,6 +87,7 @@ public:
|
||||
static std::vector<wxString> GetAllUntranslatedStatusStrings();
|
||||
|
||||
void Pause(bool paused);
|
||||
bool IsPaused() const;
|
||||
|
||||
private:
|
||||
void DoScrub(bool scroll, bool seek);
|
||||
|
@ -1814,8 +1814,9 @@ void QuickPlayRulerOverlay::Draw(OverlayPanel &panel, wxDC &dc)
|
||||
if (mOldQPIndicatorPos >= 0) {
|
||||
auto ruler = GetRuler();
|
||||
auto scrub =
|
||||
ruler->mPrevZone == AdornedRulerPanel::StatusChoice::EnteringScrubZone ||
|
||||
mPartner.mProject->GetScrubber().HasStartedScrubbing();
|
||||
ruler->mMouseEventState == AdornedRulerPanel::mesNone &&
|
||||
(ruler->mPrevZone == AdornedRulerPanel::StatusChoice::EnteringScrubZone ||
|
||||
(mPartner.mProject->GetScrubber().HasStartedScrubbing()));
|
||||
auto width = scrub ? IndicatorBigWidth() : IndicatorSmallWidth;
|
||||
ruler->DoDrawIndicator(&dc, mOldQPIndicatorPos, true, width, scrub);
|
||||
}
|
||||
@ -2402,22 +2403,16 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
||||
if (IsButton(zone) || evt.RightDown())
|
||||
// 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 {
|
||||
bool switchToQP = (zone == StatusChoice::EnteringQP && mQuickPlayEnabled);
|
||||
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.
|
||||
@ -2444,6 +2439,7 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store the initial play region state
|
||||
if(mMouseEventState == mesNone) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user