more bugfix

This commit is contained in:
Ryzerth 2021-07-29 20:22:16 +02:00
parent 5d08f1018d
commit a487c0aaea
4 changed files with 17 additions and 4 deletions

View File

@ -232,7 +232,8 @@ void FrequencySelect::draw() {
//ImGui::NewLine(); //ImGui::NewLine();
} }
void FrequencySelect::setFrequency(uint64_t freq) { void FrequencySelect::setFrequency(int64_t freq) {
freq = std::max<int64_t>(0, freq);
int i = 11; int i = 11;
for (uint64_t f = freq; i >= 0; i--) { for (uint64_t f = freq; i >= 0; i--) {
digits[i] = f % 10; digits[i] = f % 10;

View File

@ -8,7 +8,7 @@ public:
FrequencySelect(); FrequencySelect();
void init(); void init();
void draw(); void draw();
void setFrequency(uint64_t freq); void setFrequency(int64_t freq);
uint64_t frequency; uint64_t frequency;
bool frequencyChanged = false; bool frequencyChanged = false;

View File

@ -510,7 +510,16 @@ private:
ImGui::TableSetColumnIndex(0); ImGui::TableSetColumnIndex(0);
ImVec2 min = ImGui::GetCursorPos(); 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)) { if (ImGui::TableGetHoveredColumn() >= 0 && ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
applyBookmark(bm, gui::waterfall.selectedVFO); applyBookmark(bm, gui::waterfall.selectedVFO);
} }

View File

@ -156,11 +156,13 @@ public:
// core::setInputSampleRate(sampleRate); // core::setInputSampleRate(sampleRate);
sigpath::sourceManager.registerSource("SDRplay", &handler); sigpath::sourceManager.registerSource("SDRplay", &handler);
initOk = true;
} }
~SDRPlaySourceModule() { ~SDRPlaySourceModule() {
stop(this); stop(this);
sdrplay_api_Close(); if (initOk) { sdrplay_api_Close(); }
sigpath::sourceManager.unregisterSource("SDRplay"); sigpath::sourceManager.unregisterSource("SDRplay");
} }
@ -943,6 +945,7 @@ private:
SourceManager::SourceHandler handler; SourceManager::SourceHandler handler;
bool running = false; bool running = false;
double freq; double freq;
bool initOk = false;
sdrplay_api_CallbackFnsT cbFuncs; sdrplay_api_CallbackFnsT cbFuncs;