From 5a2b0c9d79fa8eb43fd60d34d63589b0ed1cf7a7 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Sun, 12 Sep 2021 19:12:23 +0200 Subject: [PATCH 1/6] Added new patron to the readme and fixed radio remove/disable bug --- core/src/credits.cpp | 1 + core/src/dsp/vfo.h | 2 ++ readme.md | 1 + rpi_install.sh | 22 ++++++++++++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 rpi_install.sh diff --git a/core/src/credits.cpp b/core/src/credits.cpp index c2204f82..1384f9cc 100644 --- a/core/src/credits.cpp +++ b/core/src/credits.cpp @@ -35,6 +35,7 @@ namespace sdrpp_credits { }; const char* patrons[] = { + "Bob Logan", "Croccydile", "Daniele D'Agnelli", "EB3FRN", diff --git a/core/src/dsp/vfo.h b/core/src/dsp/vfo.h index 4edb56bd..63190b3e 100644 --- a/core/src/dsp/vfo.h +++ b/core/src/dsp/vfo.h @@ -46,6 +46,7 @@ namespace dsp { if (running) { return; } xlator.start(); resamp.start(); + running = true; } void stop() { @@ -53,6 +54,7 @@ namespace dsp { if (!running) { return; } xlator.stop(); resamp.stop(); + running = false; } void setInSampleRate(float inSampleRate) { diff --git a/readme.md b/readme.md index be1bf679..ab7d2b0d 100644 --- a/readme.md +++ b/readme.md @@ -353,6 +353,7 @@ I will soon publish a contributing.md listing the code style to use. ## Patrons +* Bob Logan * Croccydile * [Daniele D'Agnelli](https://linkedin.com/in/dagnelli) * [EB3FRN](https://www.eb3frn.net/) diff --git a/rpi_install.sh b/rpi_install.sh new file mode 100644 index 00000000..584e13b9 --- /dev/null +++ b/rpi_install.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -e + +[ $(id -u) = 0 ] && echo "Please do not run this script as root" && exit 100 + +echo "Installing dependencies" +sudo apt update +sudo apt install -y build-essential cmake git libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev libsoapysdr-dev libairspyhf-dev libairspy-dev \ + libiio-dev libad9361-dev librtaudio-dev libhackrf-dev librtlsdr-dev libbladerf-dev liblimesuite-dev p7zip-full wget + +echo "Preparing build" +mkdir -p build +cd build +cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON + +echo "Building" +make + +echo "Installing" +sudo make install + +echo "Done!" \ No newline at end of file From bd427d23b3625d7e7f7dc20275e66c25ad25a178 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 13 Sep 2021 19:22:32 +0200 Subject: [PATCH 2/6] Fixed typo in the readme + Fixed bandwidth and NFM and AM demodulators --- radio/src/am_demod.h | 2 +- radio/src/fm_demod.h | 2 +- readme.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/radio/src/am_demod.h b/radio/src/am_demod.h index 3d7b5398..0135ea4f 100644 --- a/radio/src/am_demod.h +++ b/radio/src/am_demod.h @@ -194,7 +194,7 @@ private: } const float bwMax = 15000; - const float bwMin = 6000; + const float bwMin = 1000; const float bbSampRate = 15000; std::string uiPrefix; diff --git a/radio/src/fm_demod.h b/radio/src/fm_demod.h index 3a247ae6..36258807 100644 --- a/radio/src/fm_demod.h +++ b/radio/src/fm_demod.h @@ -183,7 +183,7 @@ private: } const float bwMax = 50000; - const float bwMin = 6000; + const float bwMin = 1000; const float bbSampRate = 50000; std::string uiPrefix; diff --git a/readme.md b/readme.md index ab7d2b0d..aa6b60dd 100644 --- a/readme.md +++ b/readme.md @@ -338,7 +338,7 @@ To solve, this, simply downgrade to libusb1.3 If you also have the SoapySDR module loaded (not necessarily enabled), this is a bug in libhackrf. It's caused by libhackrf not checking if it's already initialized. The solution until a fixed libhackrf version is released is to completely remove the soapy_source module from SDR++. To do this, delete `modules/soapy_source.dll` on windows -or `/usr/share/sdrpp/plugins/soapy_source.so` on linux. +or `/usr/lib/sdrpp/plugins/soapy_source.so` on linux. ## Issue not listed here? From 2184e15e443916ef1907830270ceaf8f0c104a5b Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 13 Sep 2021 19:37:38 +0200 Subject: [PATCH 3/6] Added rtaudio to the base dependencies --- docker_builds/debian_bullseye/do_build.sh | 2 +- docker_builds/debian_buster/do_build.sh | 2 +- docker_builds/debian_sid/do_build.sh | 2 +- docker_builds/ubuntu_bionic/do_build.sh | 2 +- docker_builds/ubuntu_focal/do_build.sh | 2 +- docker_builds/ubuntu_groovy/do_build.sh | 2 +- docker_builds/ubuntu_hirsute/do_build.sh | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docker_builds/debian_bullseye/do_build.sh b/docker_builds/debian_bullseye/do_build.sh index b980347a..71464b75 100644 --- a/docker_builds/debian_bullseye/do_build.sh +++ b/docker_builds/debian_bullseye/do_build.sh @@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD make -j2 cd .. -sh make_debian_package.sh ./build libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev librtaudio-dev' \ No newline at end of file diff --git a/docker_builds/debian_buster/do_build.sh b/docker_builds/debian_buster/do_build.sh index a0b294a0..8364a2c1 100644 --- a/docker_builds/debian_buster/do_build.sh +++ b/docker_builds/debian_buster/do_build.sh @@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=OFF -DOPT_BUIL make -j2 cd .. -sh make_debian_package.sh ./build libfftw3-dev libglfw3-dev libglew-dev libvolk1-dev \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk1-dev librtaudio-dev' \ No newline at end of file diff --git a/docker_builds/debian_sid/do_build.sh b/docker_builds/debian_sid/do_build.sh index b980347a..71464b75 100644 --- a/docker_builds/debian_sid/do_build.sh +++ b/docker_builds/debian_sid/do_build.sh @@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD make -j2 cd .. -sh make_debian_package.sh ./build libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev librtaudio-dev' \ No newline at end of file diff --git a/docker_builds/ubuntu_bionic/do_build.sh b/docker_builds/ubuntu_bionic/do_build.sh index c1243d54..c97690b5 100644 --- a/docker_builds/ubuntu_bionic/do_build.sh +++ b/docker_builds/ubuntu_bionic/do_build.sh @@ -40,4 +40,4 @@ make -j2 # Generate package cd .. -sh make_debian_package.sh ./build libfftw3-dev libglfw3-dev libglew-dev libvolk1-dev \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk1-dev librtaudio-dev' \ No newline at end of file diff --git a/docker_builds/ubuntu_focal/do_build.sh b/docker_builds/ubuntu_focal/do_build.sh index b980347a..71464b75 100644 --- a/docker_builds/ubuntu_focal/do_build.sh +++ b/docker_builds/ubuntu_focal/do_build.sh @@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD make -j2 cd .. -sh make_debian_package.sh ./build libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev librtaudio-dev' \ No newline at end of file diff --git a/docker_builds/ubuntu_groovy/do_build.sh b/docker_builds/ubuntu_groovy/do_build.sh index b980347a..71464b75 100644 --- a/docker_builds/ubuntu_groovy/do_build.sh +++ b/docker_builds/ubuntu_groovy/do_build.sh @@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD make -j2 cd .. -sh make_debian_package.sh ./build libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev librtaudio-dev' \ No newline at end of file diff --git a/docker_builds/ubuntu_hirsute/do_build.sh b/docker_builds/ubuntu_hirsute/do_build.sh index b980347a..71464b75 100644 --- a/docker_builds/ubuntu_hirsute/do_build.sh +++ b/docker_builds/ubuntu_hirsute/do_build.sh @@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD make -j2 cd .. -sh make_debian_package.sh ./build libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev librtaudio-dev' \ No newline at end of file From 9d34c6a8c1f0b2f8723c030df493050ee4a61ab8 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 13 Sep 2021 20:07:40 +0200 Subject: [PATCH 4/6] Fixed wonky center tuning behavior --- core/src/gui/main_window.cpp | 5 +++++ core/src/gui/widgets/waterfall.cpp | 2 +- core/src/gui/widgets/waterfall.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index 9f29fd0d..954dbd6d 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -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(); } diff --git a/core/src/gui/widgets/waterfall.cpp b/core/src/gui/widgets/waterfall.cpp index 970388ef..8d5eb8b2 100644 --- a/core/src/gui/widgets/waterfall.cpp +++ b/core/src/gui/widgets/waterfall.cpp @@ -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) { diff --git a/core/src/gui/widgets/waterfall.h b/core/src/gui/widgets/waterfall.h index 55e4c798..957d821d 100644 --- a/core/src/gui/widgets/waterfall.h +++ b/core/src/gui/widgets/waterfall.h @@ -175,6 +175,7 @@ namespace ImGui { }; bool inputHandled = false; + bool VFOMoveSingleClick = false; Event onInputProcess; enum { From b74e2d37a59679a200a0115eba808c298328b944 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 13 Sep 2021 20:42:13 +0200 Subject: [PATCH 5/6] fixed dependencies in deb files --- docker_builds/debian_bullseye/do_build.sh | 2 +- docker_builds/debian_buster/do_build.sh | 2 +- docker_builds/debian_sid/do_build.sh | 2 +- docker_builds/ubuntu_bionic/do_build.sh | 2 +- docker_builds/ubuntu_focal/do_build.sh | 2 +- docker_builds/ubuntu_groovy/do_build.sh | 2 +- docker_builds/ubuntu_hirsute/do_build.sh | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docker_builds/debian_bullseye/do_build.sh b/docker_builds/debian_bullseye/do_build.sh index 71464b75..84bcb26f 100644 --- a/docker_builds/debian_bullseye/do_build.sh +++ b/docker_builds/debian_bullseye/do_build.sh @@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD make -j2 cd .. -sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev librtaudio-dev' \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libglew-dev, libvolk2-dev, librtaudio-dev' \ No newline at end of file diff --git a/docker_builds/debian_buster/do_build.sh b/docker_builds/debian_buster/do_build.sh index 8364a2c1..6f144428 100644 --- a/docker_builds/debian_buster/do_build.sh +++ b/docker_builds/debian_buster/do_build.sh @@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=OFF -DOPT_BUIL make -j2 cd .. -sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk1-dev librtaudio-dev' \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libglew-dev, libvolk1-dev, librtaudio-dev' \ No newline at end of file diff --git a/docker_builds/debian_sid/do_build.sh b/docker_builds/debian_sid/do_build.sh index 71464b75..84bcb26f 100644 --- a/docker_builds/debian_sid/do_build.sh +++ b/docker_builds/debian_sid/do_build.sh @@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD make -j2 cd .. -sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev librtaudio-dev' \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libglew-dev, libvolk2-dev, librtaudio-dev' \ No newline at end of file diff --git a/docker_builds/ubuntu_bionic/do_build.sh b/docker_builds/ubuntu_bionic/do_build.sh index c97690b5..db1b4a59 100644 --- a/docker_builds/ubuntu_bionic/do_build.sh +++ b/docker_builds/ubuntu_bionic/do_build.sh @@ -40,4 +40,4 @@ make -j2 # Generate package cd .. -sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk1-dev librtaudio-dev' \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libglew-dev, libvolk1-dev, librtaudio-dev' \ No newline at end of file diff --git a/docker_builds/ubuntu_focal/do_build.sh b/docker_builds/ubuntu_focal/do_build.sh index 71464b75..84bcb26f 100644 --- a/docker_builds/ubuntu_focal/do_build.sh +++ b/docker_builds/ubuntu_focal/do_build.sh @@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD make -j2 cd .. -sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev librtaudio-dev' \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libglew-dev, libvolk2-dev, librtaudio-dev' \ No newline at end of file diff --git a/docker_builds/ubuntu_groovy/do_build.sh b/docker_builds/ubuntu_groovy/do_build.sh index 71464b75..84bcb26f 100644 --- a/docker_builds/ubuntu_groovy/do_build.sh +++ b/docker_builds/ubuntu_groovy/do_build.sh @@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD make -j2 cd .. -sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev librtaudio-dev' \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libglew-dev, libvolk2-dev, librtaudio-dev' \ No newline at end of file diff --git a/docker_builds/ubuntu_hirsute/do_build.sh b/docker_builds/ubuntu_hirsute/do_build.sh index 71464b75..84bcb26f 100644 --- a/docker_builds/ubuntu_hirsute/do_build.sh +++ b/docker_builds/ubuntu_hirsute/do_build.sh @@ -21,4 +21,4 @@ cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD make -j2 cd .. -sh make_debian_package.sh ./build 'libfftw3-dev libglfw3-dev libglew-dev libvolk2-dev librtaudio-dev' \ No newline at end of file +sh make_debian_package.sh ./build 'libfftw3-dev, libglfw3-dev, libglew-dev, libvolk2-dev, librtaudio-dev' \ No newline at end of file From 318e57dc3dbff756051fe9c90c001afdcb0553b2 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Mon, 13 Sep 2021 23:31:01 +0200 Subject: [PATCH 6/6] Fixed wonky fft resize behavior --- core/src/gui/widgets/waterfall.cpp | 60 +++++++++++++++--------------- core/src/gui/widgets/waterfall.h | 2 + 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/core/src/gui/widgets/waterfall.cpp b/core/src/gui/widgets/waterfall.cpp index 8d5eb8b2..f0269fed 100644 --- a/core/src/gui/widgets/waterfall.cpp +++ b/core/src/gui/widgets/waterfall.cpp @@ -246,6 +246,7 @@ namespace ImGui { ImGuiButtonFlags_MouseButtonLeft | ImGuiButtonFlags_PressedOnClick); bool draging = ImGui::IsMouseDragging(ImGuiMouseButton_Left) && ImGui::IsWindowFocused(); + mouseInFFTResize = (dragOrigin.x > widgetPos.x && dragOrigin.x < widgetPos.x + widgetSize.x && dragOrigin.y >= widgetPos.y + newFFTAreaHeight - 2 && dragOrigin.y <= widgetPos.y + newFFTAreaHeight + 2); mouseInFreq = IS_IN_AREA(dragOrigin, freqAreaMin, freqAreaMax); mouseInFFT = IS_IN_AREA(dragOrigin, fftAreaMin, fftAreaMax); mouseInWaterfall = IS_IN_AREA(dragOrigin, wfMin, wfMax); @@ -266,15 +267,31 @@ namespace ImGui { // Deselect everything if the mouse is released if (!ImGui::IsMouseDown(ImGuiMouseButton_Left)) { + if (fftResizeSelect) { + FFTAreaHeight = newFFTAreaHeight; + onResize(); + } + + fftResizeSelect = false; freqScaleSelect = false; vfoSelect = false; vfoBorderSelect = false; lastDrag = 0; } - // If mouse was clicked, check what was clicked - if (mouseClicked) { - bool targetFound = false; + bool targetFound = false; + + // If the mouse was clicked anywhere in the waterfall, check if the resize was clicked + if (mouseInFFTResize) { + ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeNS); + if (ImGui::IsMouseClicked(ImGuiMouseButton_Left)) { + fftResizeSelect = true; + targetFound = true; + } + } + + // If mouse was clicked inside the central part, check what was clicked + if (mouseClicked && !targetFound) { mouseDownPos = mousePos; // First, check if a VFO border was selected @@ -311,6 +328,16 @@ namespace ImGui { } } + // If the FFT resize bar was selected, resize FFT accordingly + if (fftResizeSelect) { + ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeNS); + newFFTAreaHeight = mousePos.y - widgetPos.y; + newFFTAreaHeight = std::clamp(newFFTAreaHeight, 150, widgetSize.y - 50); + ImGui::GetForegroundDrawList()->AddLine(ImVec2(widgetPos.x, newFFTAreaHeight + widgetPos.y), ImVec2(widgetEndPos.x, newFFTAreaHeight + widgetPos.y), + ImGui::GetColorU32(ImGuiCol_SeparatorActive)); + return; + } + // If a vfo border is selected, resize VFO accordingly if (vfoBorderSelect) { ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW); @@ -808,33 +835,6 @@ namespace ImGui { return; } - // Handle fft resize - if (!gui::mainWindow.lockWaterfallControls && !inputHandled) { - ImVec2 winSize = ImGui::GetWindowSize(); - ImVec2 mousePos = ImGui::GetMousePos(); - mousePos.x -= widgetPos.x; - mousePos.y -= widgetPos.y; - bool click = ImGui::IsMouseClicked(ImGuiMouseButton_Left); - bool down = ImGui::IsMouseDown(ImGuiMouseButton_Left); - if (draggingFW) { - newFFTAreaHeight = mousePos.y; - newFFTAreaHeight = std::clamp(newFFTAreaHeight, 150, widgetSize.y - 50); - ImGui::GetForegroundDrawList()->AddLine(ImVec2(widgetPos.x, newFFTAreaHeight + widgetPos.y), ImVec2(widgetEndPos.x, newFFTAreaHeight + widgetPos.y), - ImGui::GetColorU32(ImGuiCol_SeparatorActive)); - } - if (mousePos.y >= newFFTAreaHeight - 2 && mousePos.y <= newFFTAreaHeight + 2 && mousePos.x > 0 && mousePos.x < widgetSize.x) { - ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeNS); - if (click) { - draggingFW = true; - } - } - if(!down && draggingFW) { - draggingFW = false; - FFTAreaHeight = newFFTAreaHeight; - onResize(); - } - } - buf_mtx.unlock(); } diff --git a/core/src/gui/widgets/waterfall.h b/core/src/gui/widgets/waterfall.h index 957d821d..42ccf58e 100644 --- a/core/src/gui/widgets/waterfall.h +++ b/core/src/gui/widgets/waterfall.h @@ -137,6 +137,7 @@ namespace ImGui { bool bandplanEnabled = false; bandplan::BandPlan_t* bandplan = NULL; + bool mouseInFFTResize = false; bool mouseInFreq = false; bool mouseInFFT = false; bool mouseInWaterfall = false; @@ -280,6 +281,7 @@ namespace ImGui { int bandPlanPos = BANDPLAN_POS_BOTTOM; // UI Select elements + bool fftResizeSelect = false; bool freqScaleSelect = false; bool vfoSelect = false; bool vfoBorderSelect = false;