mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-17 09:07:41 +02:00
Bug 1552 - Record button greyed out while playback paused
This commit is contained in:
parent
83d3864738
commit
4be26f5bae
@ -435,6 +435,7 @@ void ControlToolBar::EnableDisableButtons()
|
|||||||
AudacityProject *p = GetActiveProject();
|
AudacityProject *p = GetActiveProject();
|
||||||
bool tracks = false;
|
bool tracks = false;
|
||||||
|
|
||||||
|
bool paused = mPause->IsDown();
|
||||||
bool playing = mPlay->IsDown();
|
bool playing = mPlay->IsDown();
|
||||||
bool recording = mRecord->IsDown();
|
bool recording = mRecord->IsDown();
|
||||||
bool busy = gAudioIO->IsBusy();
|
bool busy = gAudioIO->IsBusy();
|
||||||
@ -459,8 +460,8 @@ void ControlToolBar::EnableDisableButtons()
|
|||||||
mPlay->SetEnabled(CanStopAudioStream() && tracks && !recording);
|
mPlay->SetEnabled(CanStopAudioStream() && tracks && !recording);
|
||||||
mRecord->SetEnabled(
|
mRecord->SetEnabled(
|
||||||
CanStopAudioStream() &&
|
CanStopAudioStream() &&
|
||||||
!(busy && !recording) &&
|
!(busy && !recording && !paused) &&
|
||||||
!playing
|
!(playing && !paused)
|
||||||
);
|
);
|
||||||
mStop->SetEnabled(CanStopAudioStream() && (playing || recording));
|
mStop->SetEnabled(CanStopAudioStream() && (playing || recording));
|
||||||
mRewind->SetEnabled(IsPauseDown() || (!playing && !recording));
|
mRewind->SetEnabled(IsPauseDown() || (!playing && !recording));
|
||||||
@ -876,6 +877,29 @@ void ControlToolBar::Pause()
|
|||||||
void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
||||||
// STRONG-GUARANTEE (for state of current project's tracks)
|
// STRONG-GUARANTEE (for state of current project's tracks)
|
||||||
{
|
{
|
||||||
|
// TODO: It would be neater if Menu items and Toolbar buttons used the same code for
|
||||||
|
// enabling/disabling, and all fell into the same action routines.
|
||||||
|
// Here instead we reduplicate some logic (from CommandHandler) because it isn't
|
||||||
|
// normally used for buttons.
|
||||||
|
|
||||||
|
// Code from CommandHandler start...
|
||||||
|
AudacityProject * proj = GetActiveProject();
|
||||||
|
wxASSERT( proj );
|
||||||
|
if( !proj )
|
||||||
|
return;
|
||||||
|
|
||||||
|
CommandFlag flags = AlwaysEnabledFlag; // 0 means recalc flags.
|
||||||
|
|
||||||
|
// NB: The call may have the side effect of changing flags.
|
||||||
|
bool allowed = proj->TryToMakeActionAllowed(
|
||||||
|
flags,
|
||||||
|
AudioIONotBusyFlag | CanStopAudioStreamFlag,
|
||||||
|
AudioIONotBusyFlag | CanStopAudioStreamFlag);
|
||||||
|
|
||||||
|
if( !allowed )
|
||||||
|
return;
|
||||||
|
// ...end of code from CommandHandler.
|
||||||
|
|
||||||
if (gAudioIO->IsBusy()) {
|
if (gAudioIO->IsBusy()) {
|
||||||
if (!CanStopAudioStream() || 0 == gAudioIO->GetNumCaptureChannels())
|
if (!CanStopAudioStream() || 0 == gAudioIO->GetNumCaptureChannels())
|
||||||
mRecord->PopUp();
|
mRecord->PopUp();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user