Fix keyboard input error system response (auditory beep in most cases)

This commit is contained in:
Charles J. Cliffe 2016-02-08 23:40:09 -05:00
parent 393cd5f635
commit e962ad4a56
2 changed files with 7 additions and 13 deletions

View File

@ -1592,12 +1592,12 @@ int AppFrame::OnGlobalKeyDown(wxKeyEvent &event) {
case WXK_RIGHT: case WXK_RIGHT:
case WXK_NUMPAD_RIGHT: case WXK_NUMPAD_RIGHT:
waterfallCanvas->OnKeyDown(event); waterfallCanvas->OnKeyDown(event);
return 0; return 1;
case 'A': case 'A':
case 'F': case 'F':
case 'L': case 'L':
case 'U': case 'U':
return 0; return 1;
case '0': case '0':
case '1': case '1':
case '2': case '2':
@ -1609,7 +1609,7 @@ int AppFrame::OnGlobalKeyDown(wxKeyEvent &event) {
case '8': case '8':
case '9': case '9':
wxGetApp().showFrequencyInput(getFrequencyDialogTarget(), std::to_string(event.GetKeyCode() - '0')); wxGetApp().showFrequencyInput(getFrequencyDialogTarget(), std::to_string(event.GetKeyCode() - '0'));
return 0; return 1;
break; break;
default: default:
break; break;
@ -1617,13 +1617,11 @@ int AppFrame::OnGlobalKeyDown(wxKeyEvent &event) {
if (demodTuner->getMouseTracker()->mouseInView()) { if (demodTuner->getMouseTracker()->mouseInView()) {
demodTuner->OnKeyDown(event); demodTuner->OnKeyDown(event);
return 0;
} else if (waterfallCanvas->getMouseTracker()->mouseInView()) { } else if (waterfallCanvas->getMouseTracker()->mouseInView()) {
waterfallCanvas->OnKeyDown(event); waterfallCanvas->OnKeyDown(event);
return 0;
} }
return 0; return 1;
} }
int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) { int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
@ -1635,7 +1633,7 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
case WXK_SPACE: case WXK_SPACE:
if (!demodTuner->getMouseTracker()->mouseInView()) { if (!demodTuner->getMouseTracker()->mouseInView()) {
wxGetApp().showFrequencyInput(getFrequencyDialogTarget()); wxGetApp().showFrequencyInput(getFrequencyDialogTarget());
return 0; return 1;
} }
break; break;
case WXK_UP: case WXK_UP:
@ -1647,7 +1645,7 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
case WXK_RIGHT: case WXK_RIGHT:
case WXK_NUMPAD_RIGHT: case WXK_NUMPAD_RIGHT:
waterfallCanvas->OnKeyUp(event); waterfallCanvas->OnKeyUp(event);
return 0; return 1;
case 'A': case 'A':
demodModeSelector->setSelection("AM"); demodModeSelector->setSelection("AM");
break; break;
@ -1670,16 +1668,14 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
if (demodTuner->getMouseTracker()->mouseInView()) { if (demodTuner->getMouseTracker()->mouseInView()) {
demodTuner->OnKeyUp(event); demodTuner->OnKeyUp(event);
return 0;
} else if (waterfallCanvas->getMouseTracker()->mouseInView()) { } else if (waterfallCanvas->getMouseTracker()->mouseInView()) {
waterfallCanvas->OnKeyUp(event); waterfallCanvas->OnKeyUp(event);
return 0;
} }
// TODO: Catch key-ups outside of original target // TODO: Catch key-ups outside of original target
return 0; return 1;
} }

View File

@ -19,8 +19,6 @@
wxBEGIN_EVENT_TABLE(WaterfallCanvas, wxGLCanvas) wxBEGIN_EVENT_TABLE(WaterfallCanvas, wxGLCanvas)
EVT_PAINT(WaterfallCanvas::OnPaint) EVT_PAINT(WaterfallCanvas::OnPaint)
//EVT_KEY_DOWN(WaterfallCanvas::OnKeyDown)
//EVT_KEY_UP(WaterfallCanvas::OnKeyUp)
EVT_IDLE(WaterfallCanvas::OnIdle) EVT_IDLE(WaterfallCanvas::OnIdle)
EVT_MOTION(WaterfallCanvas::OnMouseMoved) EVT_MOTION(WaterfallCanvas::OnMouseMoved)
EVT_LEFT_DOWN(WaterfallCanvas::OnMouseDown) EVT_LEFT_DOWN(WaterfallCanvas::OnMouseDown)