Move mute handler to global keys; now works with selected + hovered

This commit is contained in:
Charles J. Cliffe 2016-06-11 22:13:42 -04:00
parent c33a359153
commit 8f2ce9f6dc
2 changed files with 12 additions and 8 deletions

View File

@ -1916,6 +1916,7 @@ int AppFrame::OnGlobalKeyDown(wxKeyEvent &event) {
case 'U':
case 'S':
case 'P':
case 'M':
return 1;
case '0':
case '1':
@ -1966,6 +1967,7 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
return -1;
}
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getActiveDemodulator();
DemodulatorInstance *lastDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
#ifdef wxHAS_RAW_KEY_CODES
@ -1995,8 +1997,8 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
waterfallCanvas->OnKeyUp(event);
return 1;
case 'V':
if (wxGetApp().getDemodMgr().getActiveDemodulator()) {
lastDemod = wxGetApp().getDemodMgr().getActiveDemodulator();
if (activeDemod) {
lastDemod = activeDemod;
}
if (lastDemod && lastDemod->isDeltaLock()) {
lastDemod->setDeltaLock(false);
@ -2040,6 +2042,14 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
case ']':
case '[':
return 1;
case 'M':
if (activeDemod) {
lastDemod = activeDemod;
}
if (lastDemod) {
lastDemod->setMuted(!lastDemod->isMuted());
}
break;
default:
break;
}

View File

@ -437,12 +437,6 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
wxGetApp().removeDemodulator(activeDemod);
wxGetApp().getDemodMgr().deleteThread(activeDemod);
break;
case 'M':
if (!activeDemod) {
break;
}
activeDemod->setMuted(!activeDemod->isMuted());
break;
case 'B':
if (spectrumCanvas) {
spectrumCanvas->setShowDb(!spectrumCanvas->getShowDb());