diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index 064dfdf6..dc7d0ee6 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -379,6 +379,7 @@ void drawWindow() { vfo = gui::waterfall.vfos[gui::waterfall.selectedVFO]; } + // Handke VFO movement if (vfo != NULL) { if (vfo->centerOffsetChanged) { if (centerTuning) { @@ -394,12 +395,14 @@ void drawWindow() { sigpath::vfoManager.updateFromWaterfall(&gui::waterfall); + // Handle selection of another VFO if (gui::waterfall.selectedVFOChanged && vfo != NULL) { gui::waterfall.selectedVFOChanged = false; gui::freqSelect.setFrequency(vfo->generalOffset + gui::waterfall.getCenterFrequency()); gui::freqSelect.frequencyChanged = false; } + // Handle change in selected frequency if (gui::freqSelect.frequencyChanged) { gui::freqSelect.frequencyChanged = false; setVFO(gui::freqSelect.frequency); @@ -416,6 +419,7 @@ void drawWindow() { core::configManager.release(true); } + // Handle dragging the frequency scale if (gui::waterfall.centerFreqMoved) { gui::waterfall.centerFreqMoved = false; sigpath::sourceManager.tune(gui::waterfall.getCenterFrequency()); @@ -430,6 +434,22 @@ void drawWindow() { core::configManager.release(true); } + // Handle arrow keys + if (vfo != NULL) { + if (ImGui::IsKeyPressed(GLFW_KEY_LEFT)) { + setVFO(gui::waterfall.getCenterFrequency() + vfo->generalOffset - vfo->snapInterval); + } + if (ImGui::IsKeyPressed(GLFW_KEY_RIGHT)) { + setVFO(gui::waterfall.getCenterFrequency() + vfo->generalOffset + vfo->snapInterval); + } + core::configManager.aquire(); + core::configManager.conf["frequency"] = gui::waterfall.getCenterFrequency(); + if (vfo != NULL) { + core::configManager.conf["vfoOffsets"][gui::waterfall.selectedVFO] = vfo->generalOffset; + } + core::configManager.release(true); + } + int _fftHeight = gui::waterfall.getFFTHeight(); if (fftHeight != _fftHeight) { fftHeight = _fftHeight; diff --git a/core/src/gui/widgets/frequency_select.cpp b/core/src/gui/widgets/frequency_select.cpp index 2982a8b3..e10b5ed0 100644 --- a/core/src/gui/widgets/frequency_select.cpp +++ b/core/src/gui/widgets/frequency_select.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS @@ -150,6 +151,12 @@ void FrequencySelect::draw() { } frequencyChanged = true; } + if (ImGui::IsKeyPressed(GLFW_KEY_UP)) { + incrementDigit(i); + } + if (ImGui::IsKeyPressed(GLFW_KEY_DOWN)) { + decrementDigit(i); + } if (mw != 0) { int count = abs(mw); for (int j = 0; j < count; j++) {