1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-06 07:09:39 +02:00

Bug 1487 - Scrub and Seek are enabled when there is no audio to operate on

I added a new flag, HasWaveDataFlag that checks not only for the presence  of a WaveTrack but also for audio actually in it.  This is now applied to the Scrub and Seek menu items, with the result that they grey out in the menu, and their buttons are dulled on the toolbar, if there is no audio.
This commit is contained in:
James Crook 2016-08-22 13:25:05 +01:00
parent f9d269bcee
commit 8886d1ba41
3 changed files with 7 additions and 2 deletions

View File

@ -97,6 +97,7 @@ enum CommandFlag : unsigned long long
NotMinimizedFlag = 0x100000000ULL, // prl
PausedFlag = 0x200000000ULL, // jkc
NotPausedFlag = 0x400000000ULL, // jkc
HasWaveDataFlag = 0x800000000ULL, // jkc
NoFlagsSpecifed = ~0ULL
};

View File

@ -1736,6 +1736,8 @@ CommandFlag AudacityProject::GetUpdateFlags()
flags |= WaveTracksSelectedFlag;
}
}
if( t->GetEndTime() > t->GetStartTime() )
flags |= HasWaveDataFlag;
}
#if defined(USE_MIDI)
else if (t->GetKind() == Track::Note) {

View File

@ -233,12 +233,12 @@ namespace {
"Seeking" is normal speed playback but with skips, ...
*/
{ wxT("Scrub"), XO("&Scrub"), XO("Scrubbing"),
CaptureNotBusyFlag,
CaptureNotBusyFlag | HasWaveDataFlag,
&Scrubber::OnScrub, false, &Scrubber::Scrubs,
},
{ wxT("Seek"), XO("See&k"), XO("Seeking"),
CaptureNotBusyFlag,
CaptureNotBusyFlag | HasWaveDataFlag,
&Scrubber::OnSeek, true, &Scrubber::Seeks,
},
@ -859,6 +859,8 @@ Scrubber &ScrubbingOverlay::GetScrubber()
void Scrubber::DoScrub(bool seek)
{
if( !CanScrub() )
return;
const bool wasScrubbing = HasStartedScrubbing() || IsScrubbing();
const bool scroll = TracksPrefs::GetPinnedHeadPreference();
if (!wasScrubbing) {