1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-17 08:40:27 +02:00

Pop up the Stop button in idle time...

... This also causes a momentary push-down of the stop button, which happens
in ControlToolBar::StopPlaying, really to be visible, as was apparently the
intent.

For instance, when playing, then clicking in the quick-play ruler to restart
the play elsewhere.
This commit is contained in:
Paul Licameli 2019-07-01 08:53:53 -04:00
parent 830f772625
commit 5ab3986261
4 changed files with 11 additions and 31 deletions

View File

@ -277,7 +277,7 @@ bool DoPlayStopSelect
//If busy, stop playing, make sure everything is unpaused.
if (scrubber.HasMark() ||
gAudioIO->IsStreamActive(token)) {
toolbar.SetStop(true); //Pushes stop down
toolbar.SetStop(); //Pushes stop down
// change the selection
auto time = gAudioIO->GetStreamTime();
@ -332,7 +332,6 @@ void DoPlayStopSelect(AudacityProject &project)
toolbar.OnStop(evt);
else if (!gAudioIO->IsBusy()) {
//Otherwise, start playing (assuming audio I/O isn't busy)
toolbar.SetStop(false);
// Will automatically set mLastPlayMode
toolbar.PlayCurrentRegion(false);

View File

@ -54,7 +54,7 @@ bool MakeReadyToPlay(AudacityProject &project)
)) {
// Make momentary changes of button appearances
toolbar.SetPlay(false); //Pops
toolbar.SetStop(true); //Pushes stop down
toolbar.SetStop(); //Pushes stop down
toolbar.OnStop(evt);
::wxMilliSleep(100);
@ -65,8 +65,6 @@ bool MakeReadyToPlay(AudacityProject &project)
if (gAudioIO->IsBusy())
return false;
toolbar.SetStop(false);
return true;
}
@ -92,7 +90,7 @@ 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.SetStop(true); //Pushes stop down
toolbar.SetStop(); //Pushes stop down
toolbar.StopPlaying();
}
else if (gAudioIO->IsStreamActive()) {
@ -110,7 +108,7 @@ void DoPlayStop(const CommandContext &context)
if(iter != finish) {
auto otherProject = *iter;
auto &otherToolbar = ControlToolBar::Get( *otherProject );
otherToolbar.SetStop(true); //Pushes stop down
otherToolbar.SetStop(); //Pushes stop down
otherToolbar.StopPlaying();
}
@ -119,7 +117,6 @@ void DoPlayStop(const CommandContext &context)
//update the playing area
window.TP_DisplaySelection();
//Otherwise, start playing (assuming audio I/O isn't busy)
toolbar.SetStop(false);
// Will automatically set mLastPlayMode
toolbar.PlayCurrentRegion(false);
@ -127,7 +124,6 @@ void DoPlayStop(const CommandContext &context)
}
else if (!gAudioIO->IsBusy()) {
//Otherwise, start playing (assuming audio I/O isn't busy)
toolbar.SetStop(false);
// Will automatically set mLastPlayMode
toolbar.PlayCurrentRegion(false);

View File

@ -516,15 +516,9 @@ void ControlToolBar::SetPlay(bool down, PlayAppearance appearance)
EnableDisableButtons();
}
void ControlToolBar::SetStop(bool down)
void ControlToolBar::SetStop()
{
if (down)
mStop->PushDown();
else {
if(FindFocus() == mStop)
mPlay->SetFocus();
mStop->PopUp();
}
mStop->PushDown();
EnableDisableButtons();
}
@ -562,11 +556,6 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
projectAudioManager.SetCutting( mode == PlayMode::cutPreviewPlay );
bool success = false;
auto cleanup = finally( [&] {
if (!success) {
SetStop(false);
}
} );
auto gAudioIO = AudioIO::Get();
if (gAudioIO->IsBusy())
@ -753,11 +742,10 @@ void ControlToolBar::OnKeyEvent(wxKeyEvent & event)
// If so, "!CanStopAudioStream()" should probably apply.
if (event.GetKeyCode() == WXK_SPACE) {
if ( projectAudioManager.Playing() || projectAudioManager.Recording() ) {
SetStop(true);
SetStop();
StopPlaying();
}
else if (!gAudioIO->IsBusy()) {
SetStop(false);
PlayCurrentRegion();
}
return;
@ -824,7 +812,6 @@ void ControlToolBar::StopPlaying(bool stopStream /* = true*/)
auto gAudioIO = AudioIO::Get();
SetStop(false);
if(stopStream)
gAudioIO->StopStream();
@ -1062,11 +1049,6 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
projectAudioManager.SetAppending( !altAppearance );
bool success = false;
auto cleanup = finally([&] {
if (!success) {
SetStop(false);
}
});
auto transportTracks = tracks;
@ -1313,6 +1295,9 @@ void ControlToolBar::OnIdle(wxIdleEvent & event)
: 0
);
}
// push-downs of the stop button are only momentary and always pop up now
mStop->PopUp();
UpdateStatusBar();
EnableDisableButtons();

View File

@ -94,7 +94,7 @@ class ControlToolBar final : public ToolBar {
//These allow buttons to be controlled externally:
void SetPlay(bool down, PlayAppearance appearance = PlayAppearance::Straight);
void SetStop(bool down);
void SetStop();
// A project is only allowed to stop an audio stream that it owns.
bool CanStopAudioStream () const;