Fixed wonky center tuning behavior

This commit is contained in:
AlexandreRouma 2021-09-13 20:07:40 +02:00
parent 2184e15e44
commit 9d34c6a8c1
3 changed files with 7 additions and 1 deletions

View File

@ -188,6 +188,7 @@ void MainWindow::init() {
gui::waterfall.setFFTHeight(fftHeight);
tuningMode = core::configManager.conf["centerTuning"] ? tuner::TUNER_MODE_CENTER : tuner::TUNER_MODE_NORMAL;
gui::waterfall.VFOMoveSingleClick = (tuningMode == tuner::TUNER_MODE_CENTER);
core::configManager.release();
@ -397,6 +398,7 @@ void MainWindow::draw() {
ImGui::PushID(ImGui::GetID("sdrpp_ena_st_btn"));
if (ImGui::ImageButton(icons::CENTER_TUNING, ImVec2(30, 30), ImVec2(0, 0), ImVec2(1, 1), 5)) {
tuningMode = tuner::TUNER_MODE_NORMAL;
gui::waterfall.VFOMoveSingleClick = false;
core::configManager.acquire();
core::configManager.conf["centerTuning"] = false;
core::configManager.release(true);
@ -407,6 +409,7 @@ void MainWindow::draw() {
ImGui::PushID(ImGui::GetID("sdrpp_dis_st_btn"));
if (ImGui::ImageButton(icons::NORMAL_TUNING, ImVec2(30, 30), ImVec2(0, 0), ImVec2(1, 1), 5)) {
tuningMode = tuner::TUNER_MODE_CENTER;
gui::waterfall.VFOMoveSingleClick = true;
tuner::tune(tuner::TUNER_MODE_CENTER, gui::waterfall.selectedVFO, gui::freqSelect.frequency);
core::configManager.acquire();
core::configManager.conf["centerTuning"] = true;
@ -525,6 +528,8 @@ void MainWindow::draw() {
firstMenuRender = true;
}
ImGui::Checkbox("WF Single Click", &gui::waterfall.VFOMoveSingleClick);
ImGui::Spacing();
}

View File

@ -418,7 +418,7 @@ namespace ImGui {
}
// Finally, if nothing else was selected, just move the VFO
if (ImGui::IsMouseDown(ImGuiMouseButton_Left) && (mouseInFFT|mouseInWaterfall) && (mouseMoved || hoveredVFOName == "")) {
if ((VFOMoveSingleClick ? ImGui::IsMouseClicked(ImGuiMouseButton_Left) : ImGui::IsMouseDown(ImGuiMouseButton_Left)) && (mouseInFFT|mouseInWaterfall) && (mouseMoved || hoveredVFOName == "")) {
if (selVfo != NULL) {
int refCenter = mousePos.x - (widgetPos.x + 50);
if (refCenter >= 0 && refCenter < dataWidth) {

View File

@ -175,6 +175,7 @@ namespace ImGui {
};
bool inputHandled = false;
bool VFOMoveSingleClick = false;
Event<InputHandlerArgs> onInputProcess;
enum {