1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-07 07:57:43 +02:00

ControlToolBar.cpp doesn't depend directly on TranscriptionToolBar...

... TranscriptionToolBar updates its own button, doesn't need a push from the
ControlToolBar
This commit is contained in:
Paul Licameli 2019-06-12 20:46:37 -04:00
parent f179de7a82
commit 5751ddba4f
2 changed files with 13 additions and 9 deletions

View File

@ -56,8 +56,6 @@
#include <wx/tooltip.h>
#include <wx/datetime.h>
#include "TranscriptionToolBar.h"
#include "../AColor.h"
#include "../AdornedRulerPanel.h"
#include "../AllThemeResources.h"
@ -487,12 +485,6 @@ void ControlToolBar::EnableDisableButtons()
// Only interested in audio type tracks
bool tracks = p && TrackList::Get( *p ).Any<AudioTrack>(); // PRL: PlayableTrack ?
if (p) {
const auto playAtSpeedTB = &TranscriptionToolBar::Get( *p );
if (playAtSpeedTB)
playAtSpeedTB->SetEnabled(CanStopAudioStream() && tracks && !recording);
}
mPlay->SetEnabled(CanStopAudioStream() && tracks && !recording);
mRecord->SetEnabled(
CanStopAudioStream() &&

View File

@ -35,7 +35,7 @@
#include "ControlToolBar.h"
#include "../AllThemeResources.h"
#include "../AudioIOBase.h"
#include "../AudioIO.h"
#include "../ImageManipulation.h"
#include "../KeyboardCapture.h"
#include "../Project.h"
@ -288,6 +288,18 @@ void TranscriptionToolBar::Populate()
void TranscriptionToolBar::EnableDisableButtons()
{
AudacityProject *p = GetActiveProject();
auto gAudioIO = AudioIO::Get();
bool canStopAudioStream = (!gAudioIO->IsStreamActive() ||
gAudioIO->IsMonitoring() ||
gAudioIO->GetOwningProject() == p );
bool recording = gAudioIO->GetNumCaptureChannels() > 0;
// Only interested in audio type tracks
bool tracks = p && TrackList::Get( *p ).Any<AudioTrack>(); // PRL: PlayableTrack ?
SetEnabled( canStopAudioStream && tracks && !recording );
#ifdef EXPERIMENTAL_VOICE_DETECTION
AudacityProject *p = GetActiveProject();
if (!p) return;