diff --git a/core/src/gui/widgets/frequency_select.cpp b/core/src/gui/widgets/frequency_select.cpp index 5113976e..1fbec67e 100644 --- a/core/src/gui/widgets/frequency_select.cpp +++ b/core/src/gui/widgets/frequency_select.cpp @@ -232,7 +232,8 @@ void FrequencySelect::draw() { //ImGui::NewLine(); } -void FrequencySelect::setFrequency(uint64_t freq) { +void FrequencySelect::setFrequency(int64_t freq) { + freq = std::max(0, freq); int i = 11; for (uint64_t f = freq; i >= 0; i--) { digits[i] = f % 10; diff --git a/core/src/gui/widgets/frequency_select.h b/core/src/gui/widgets/frequency_select.h index 362ea102..7f53965d 100644 --- a/core/src/gui/widgets/frequency_select.h +++ b/core/src/gui/widgets/frequency_select.h @@ -8,7 +8,7 @@ public: FrequencySelect(); void init(); void draw(); - void setFrequency(uint64_t freq); + void setFrequency(int64_t freq); uint64_t frequency; bool frequencyChanged = false; diff --git a/frequency_manager/src/main.cpp b/frequency_manager/src/main.cpp index 1c7880c8..48d00f1d 100644 --- a/frequency_manager/src/main.cpp +++ b/frequency_manager/src/main.cpp @@ -510,7 +510,16 @@ private: ImGui::TableSetColumnIndex(0); ImVec2 min = ImGui::GetCursorPos(); - ImGui::Selectable((name + "##_freq_mgr_bkm_name_" + _this->name).c_str(), &bm.selected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_SelectOnClick); + if (ImGui::Selectable((name + "##_freq_mgr_bkm_name_" + _this->name).c_str(), &bm.selected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_SelectOnClick)) { + // if shift or control isn't pressed, deselect all others + if (!ImGui::IsKeyDown(GLFW_KEY_LEFT_SHIFT) && !ImGui::IsKeyDown(GLFW_KEY_RIGHT_SHIFT) && + !ImGui::IsKeyDown(GLFW_KEY_LEFT_CONTROL) && !ImGui::IsKeyDown(GLFW_KEY_RIGHT_CONTROL)) { + for (auto& [_name, _bm] : _this->bookmarks) { + if (name == _name) { continue; } + _bm.selected = false; + } + } + } if (ImGui::TableGetHoveredColumn() >= 0 && ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) { applyBookmark(bm, gui::waterfall.selectedVFO); } diff --git a/sdrplay_source/src/main.cpp b/sdrplay_source/src/main.cpp index 29c32e31..338b575d 100644 --- a/sdrplay_source/src/main.cpp +++ b/sdrplay_source/src/main.cpp @@ -156,11 +156,13 @@ public: // core::setInputSampleRate(sampleRate); sigpath::sourceManager.registerSource("SDRplay", &handler); + + initOk = true; } ~SDRPlaySourceModule() { stop(this); - sdrplay_api_Close(); + if (initOk) { sdrplay_api_Close(); } sigpath::sourceManager.unregisterSource("SDRplay"); } @@ -943,6 +945,7 @@ private: SourceManager::SourceHandler handler; bool running = false; double freq; + bool initOk = false; sdrplay_api_CallbackFnsT cbFuncs;