1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-22 15:20:15 +02:00

Uncheck scrubbing menu items whenever scrub stops (ESC key, Stop button, other)

This commit is contained in:
Paul Licameli 2016-04-24 12:00:03 -04:00
commit 5d7438cc70
4 changed files with 18 additions and 19 deletions

View File

@ -113,8 +113,6 @@ It handles initialization and termination by subclassing wxApp.
#include "effects/ScoreAlignDialog.h" #include "effects/ScoreAlignDialog.h"
#endif #endif
#include "tracks/ui/Scrubbing.h"
#if 0 #if 0
#ifdef _DEBUG #ifdef _DEBUG
#ifdef _MSC_VER #ifdef _MSC_VER
@ -1530,11 +1528,7 @@ void AudacityApp::OnKeyDown(wxKeyEvent &event)
// Stop play, including scrub, but not record // Stop play, including scrub, but not record
auto project = ::GetActiveProject(); auto project = ::GetActiveProject();
auto token = project->GetAudioIOToken(); auto token = project->GetAudioIOToken();
auto &scrubber = project->GetScrubber(); if(token > 0 &&
if(scrubber.HasStartedScrubbing())
// ESC out of scrubbing
scrubber.StopScrubbing();
else if(token > 0 &&
gAudioIO->IsAudioTokenActive(token) && gAudioIO->IsAudioTokenActive(token) &&
gAudioIO->GetNumCaptureChannels() == 0) gAudioIO->GetNumCaptureChannels() == 0)
// ESC out of other play (but not record) // ESC out of other play (but not record)

View File

@ -773,6 +773,12 @@ void ControlToolBar::PlayDefault()
void ControlToolBar::StopPlaying(bool stopStream /* = true*/) void ControlToolBar::StopPlaying(bool stopStream /* = true*/)
{ {
AudacityProject *project = GetActiveProject();
if(project)
// Let scrubbing code do some appearance change
project->GetScrubber().StopScrubbing();
if (!CanStopAudioStream()) if (!CanStopAudioStream())
return; return;
@ -798,7 +804,6 @@ void ControlToolBar::StopPlaying(bool stopStream /* = true*/)
mBusyProject = NULL; mBusyProject = NULL;
// So that we continue monitoring after playing or recording. // So that we continue monitoring after playing or recording.
// also clean the MeterQueues // also clean the MeterQueues
AudacityProject *project = GetActiveProject();
if( project ) { if( project ) {
project->MayStartMonitoring(); project->MayStartMonitoring();

View File

@ -342,16 +342,12 @@ void Scrubber::StopScrubbing()
mScrubStartPosition = -1; mScrubStartPosition = -1;
mSmoothScrollingScrub = false; mSmoothScrollingScrub = false;
const auto ctb = mProject->GetControlToolBar();
if (IsScrubbing()) if (!IsScrubbing())
{ {
if (gAudioIO->IsBusy()) { // Marked scrub start, but
ctb->StopPlaying(); // didn't really play, but did change button apperance
} const auto ctb = mProject->GetControlToolBar();
}
else {
// Didn't really play, but did change button apperance
ctb->SetPlay(false, ControlToolBar::PlayAppearance::Straight); ctb->SetPlay(false, ControlToolBar::PlayAppearance::Straight);
} }
} }
@ -596,9 +592,11 @@ void Scrubber::DoScrub(bool scroll, bool seek)
UncheckAllMenuItems(); UncheckAllMenuItems();
CheckMenuItem(); CheckMenuItem();
} }
else else {
// unchecks items // This will call back to Scrubber::StopScrubbing
StopScrubbing(); const auto ctb = mProject->GetControlToolBar();
ctb->StopPlaying();
}
} }
void Scrubber::OnScrub() void Scrubber::OnScrub()

View File

@ -37,6 +37,8 @@ public:
// Returns true iff the event should be considered consumed by this: // Returns true iff the event should be considered consumed by this:
bool MaybeStartScrubbing(const wxMouseEvent &event); bool MaybeStartScrubbing(const wxMouseEvent &event);
void ContinueScrubbing(); void ContinueScrubbing();
// This is meant to be called only from ControlToolBar
void StopScrubbing(); void StopScrubbing();
wxCoord GetScrubStartPosition() const wxCoord GetScrubStartPosition() const