1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 23:33:49 +01:00

Update Play button appearance in idle time...

... so most calls to ControlToolBar::SetPlay are removed.  One remains in
TransportMenus, which will not be problematic for untangling dependencies,
and one remains where the toolbar remakes its own buttons.

But the routines that start and stop the streams, importantly, don't use it.
This commit is contained in:
Paul Licameli
2019-07-01 10:30:54 -04:00
parent cac04e9fb8
commit 830f772625
5 changed files with 62 additions and 45 deletions

View File

@@ -42,8 +42,7 @@ namespace {
/// and pops the play button up. Then, if nothing is now
/// playing, it pushes the play button down and enables
/// the stop button.
bool MakeReadyToPlay(AudacityProject &project,
bool loop = false, bool cutpreview = false)
bool MakeReadyToPlay(AudacityProject &project)
{
auto &toolbar = ControlToolBar::Get( project );
wxCommandEvent evt;
@@ -53,6 +52,7 @@ bool MakeReadyToPlay(AudacityProject &project,
if (gAudioIO->IsStreamActive(
ProjectAudioIO::Get( project ).GetAudioIOToken()
)) {
// Make momentary changes of button appearances
toolbar.SetPlay(false); //Pops
toolbar.SetStop(true); //Pushes stop down
toolbar.OnStop(evt);
@@ -65,11 +65,6 @@ bool MakeReadyToPlay(AudacityProject &project,
if (gAudioIO->IsBusy())
return false;
ControlToolBar::PlayAppearance appearance =
cutpreview ? ControlToolBar::PlayAppearance::CutPreview
: loop ? ControlToolBar::PlayAppearance::Looped
: ControlToolBar::PlayAppearance::Straight;
toolbar.SetPlay(true, appearance);
toolbar.SetStop(false);
return true;
@@ -97,7 +92,6 @@ void DoPlayStop(const CommandContext &context)
//If this project is playing, stop playing, make sure everything is unpaused.
auto gAudioIO = AudioIOBase::Get();
if (gAudioIO->IsStreamActive(token)) {
toolbar.SetPlay(false); //Pops
toolbar.SetStop(true); //Pushes stop down
toolbar.StopPlaying();
}
@@ -116,7 +110,6 @@ void DoPlayStop(const CommandContext &context)
if(iter != finish) {
auto otherProject = *iter;
auto &otherToolbar = ControlToolBar::Get( *otherProject );
otherToolbar.SetPlay(false); //Pops
otherToolbar.SetStop(true); //Pushes stop down
otherToolbar.StopPlaying();
}
@@ -126,7 +119,6 @@ void DoPlayStop(const CommandContext &context)
//update the playing area
window.TP_DisplaySelection();
//Otherwise, start playing (assuming audio I/O isn't busy)
//toolbar->SetPlay(true); // Not needed as done in PlayPlayRegion.
toolbar.SetStop(false);
// Will automatically set mLastPlayMode
@@ -135,7 +127,6 @@ void DoPlayStop(const CommandContext &context)
}
else if (!gAudioIO->IsBusy()) {
//Otherwise, start playing (assuming audio I/O isn't busy)
//toolbar->SetPlay(true); // Not needed as done in PlayPlayRegion.
toolbar.SetStop(false);
// Will automatically set mLastPlayMode
@@ -223,7 +214,7 @@ void OnPlayLooped(const CommandContext &context)
{
auto &project = context.project;
if( !MakeReadyToPlay(project, true) )
if( !MakeReadyToPlay(project) )
return;
// Now play in a loop
@@ -790,7 +781,7 @@ void OnPlayCutPreview(const CommandContext &context)
{
auto &project = context.project;
if ( !MakeReadyToPlay(project, false, true) )
if ( !MakeReadyToPlay(project) )
return;
// Play with cut preview