1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 16:49:41 +02:00

Bug 350 (P2) - Restore focus to TrackPanel when play/rec is hit and the focus is in the device toolbar.

This commit is contained in:
mchinen 2011-04-13 00:58:15 +00:00
parent f190f7f4c6
commit 35e371878d

View File

@ -324,6 +324,18 @@ void DeviceToolBar::EnableDisableButtons()
if (gAudioIO) {
// we allow changes when monitoring, but not when recording
bool audioStreamActive = gAudioIO->IsStreamActive() && !gAudioIO->IsMonitoring();
// Here we should relinquish focus
if (audioStreamActive) {
wxWindow *focus = wxWindow::FindFocus();
if (focus == mHost || focus == mInput || focus == mOutput || focus == mInputChannels) {
AudacityProject *activeProject = GetActiveProject();
if (activeProject) {
activeProject->GetTrackPanel()->SetFocus();
}
}
}
mHost->Enable(!audioStreamActive);
mInput->Enable(!audioStreamActive);
mOutput->Enable(!audioStreamActive);