MCPcopy Create free account
hub / github.com/cjcliffe/CubicSDR / OnKeyDown

Method OnKeyDown

src/visual/WaterfallCanvas.cpp:391–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389}
390
391void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
392 InteractiveCanvas::OnKeyDown(event);
393
394 auto activeDemod = wxGetApp().getDemodMgr().getActiveContextModem();
395
396 long long originalFreq = getCenterFrequency();
397 long long freq = originalFreq;
398
399 switch (event.GetKeyCode()) {
400 case WXK_UP:
401 case WXK_NUMPAD_UP:
402 if (!shiftDown) {
403 mouseZoom = 1.0;
404 zoom = 0.95f;
405 } else {
406 scaleMove = 1.0;
407 }
408 break;
409 case WXK_DOWN:
410 case WXK_NUMPAD_DOWN:
411 if (!shiftDown) {
412 mouseZoom = 1.0;
413 zoom = 1.05f;
414 } else {
415 scaleMove = -1.0;
416 }
417 break;
418 case WXK_RIGHT:
419 case WXK_NUMPAD_RIGHT:
420 if (isView) {
421 freqMove = shiftDown?5.0:1.0;
422 freqMoving = true;
423 } else {
424 freq += shiftDown?(getBandwidth() * 10):(getBandwidth() / 2);
425 }
426 break;
427 case WXK_LEFT:
428 case WXK_NUMPAD_LEFT:
429 if (isView) {
430 freqMove = shiftDown?-5.0:-1.0;
431 freqMoving = true;
432 } else {
433 freq -= shiftDown?(getBandwidth() * 10):(getBandwidth() / 2);
434 }
435 break;
436 case 'D':
437 case WXK_DELETE:
438 if (!activeDemod) {
439 break;
440 }
441 wxGetApp().removeDemodulator(activeDemod);
442 wxGetApp().getDemodMgr().deleteThread(activeDemod);
443 break;
444 case WXK_SPACE:
445 wxGetApp().showFrequencyInput();
446 break;
447 case 'E': //E is for 'Edit the label' of the active demodulator.
448 wxGetApp().showLabelInput();

Callers

nothing calls this directly

Calls 14

getActiveContextModemMethod · 0.80
removeDemodulatorMethod · 0.80
deleteThreadMethod · 0.80
showFrequencyInputMethod · 0.80
showLabelInputMethod · 0.80
mouseInViewMethod · 0.80
getMouseXMethod · 0.80
getFrequencySnapMethod · 0.80
rigIsActiveMethod · 0.80
getControlModeMethod · 0.80
getRigThreadMethod · 0.80
getCenterLockMethod · 0.80

Tested by

no test coverage detected