1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 23:33:49 +01: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

@@ -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;