Added scroll control to sliders in radio

This commit is contained in:
Ryzerth 2021-02-07 14:20:10 +01:00
parent 9def1843b2
commit 49ec3d68d2
8 changed files with 16 additions and 8 deletions

View File

@ -7,6 +7,7 @@
#include <string>
#include <config.h>
#include <imgui.h>
#include <gui/widgets/scroll_behavior.h>
class AMDemodulator : public Demodulator {
public:
@ -139,7 +140,7 @@ public:
ImGui::Text("Squelch");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::SliderFloat(("##_radio_am_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
if (ImGui::SliderFloat(("##_radio_am_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB") || ImGui::AllowScrollwheel<float>(squelchLevel, 20, -100, 0)) {
squelch.setLevel(squelchLevel);
_config->aquire();
_config->conf[uiPrefix]["AM"]["squelchLevel"] = squelchLevel;

View File

@ -10,6 +10,7 @@
#include <string>
#include <config.h>
#include <imgui.h>
#include <gui/widgets/scroll_behavior.h>
class CWDemodulator : public Demodulator {
public:
@ -147,7 +148,7 @@ public:
ImGui::Text("Squelch");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::SliderFloat(("##_radio_cw_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
if (ImGui::SliderFloat(("##_radio_cw_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB") || ImGui::AllowScrollwheel<float>(squelchLevel, 20, -100, 0)) {
squelch.setLevel(squelchLevel);
_config->aquire();
_config->conf[uiPrefix]["CW"]["squelchLevel"] = squelchLevel;

View File

@ -7,6 +7,7 @@
#include <string>
#include <config.h>
#include <imgui.h>
#include <gui/widgets/scroll_behavior.h>
class DSBDemodulator : public Demodulator {
public:
@ -139,7 +140,7 @@ public:
ImGui::Text("Squelch");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::SliderFloat(("##_radio_dsb_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
if (ImGui::SliderFloat(("##_radio_dsb_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB") || ImGui::AllowScrollwheel<float>(squelchLevel, 20, -100, 0)) {
squelch.setLevel(squelchLevel);
_config->aquire();
_config->conf[uiPrefix]["DSB"]["squelchLevel"] = squelchLevel;

View File

@ -7,6 +7,7 @@
#include <string>
#include <config.h>
#include <imgui.h>
#include <gui/widgets/scroll_behavior.h>
class FMDemodulator : public Demodulator {
public:
@ -135,7 +136,7 @@ public:
ImGui::Text("Squelch");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::SliderFloat(("##_radio_fm_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
if (ImGui::SliderFloat(("##_radio_fm_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB") || ImGui::AllowScrollwheel<float>(squelchLevel, 20, -100, 0)) {
squelch.setLevel(squelchLevel);
_config->aquire();
_config->conf[uiPrefix]["FM"]["squelchLevel"] = squelchLevel;

View File

@ -7,6 +7,7 @@
#include <string>
#include <config.h>
#include <imgui.h>
#include <gui/widgets/scroll_behavior.h>
class LSBDemodulator : public Demodulator {
public:
@ -139,7 +140,7 @@ public:
ImGui::Text("Squelch");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::SliderFloat(("##_radio_lsb_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
if (ImGui::SliderFloat(("##_radio_lsb_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB") || ImGui::AllowScrollwheel<float>(squelchLevel, 20, -100, 0)) {
squelch.setLevel(squelchLevel);
_config->aquire();
_config->conf[uiPrefix]["LSB"]["squelchLevel"] = squelchLevel;

View File

@ -7,6 +7,7 @@
#include <string>
#include <config.h>
#include <imgui.h>
#include <gui/widgets/scroll_behavior.h>
class RAWDemodulator : public Demodulator {
public:
@ -102,7 +103,7 @@ public:
ImGui::Text("Squelch");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::SliderFloat(("##_radio_raw_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
if (ImGui::SliderFloat(("##_radio_raw_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB") || ImGui::AllowScrollwheel<float>(squelchLevel, 20, -100, 0)) {
squelch.setLevel(squelchLevel);
_config->aquire();
_config->conf[uiPrefix]["RAW"]["squelchLevel"] = squelchLevel;

View File

@ -7,6 +7,7 @@
#include <string>
#include <config.h>
#include <imgui.h>
#include <gui/widgets/scroll_behavior.h>
class USBDemodulator : public Demodulator {
public:
@ -139,7 +140,7 @@ public:
ImGui::Text("Squelch");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::SliderFloat(("##_radio_usb_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
if (ImGui::SliderFloat(("##_radio_usb_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB") || ImGui::AllowScrollwheel<float>(squelchLevel, 20, -100, 0)) {
squelch.setLevel(squelchLevel);
_config->aquire();
_config->conf[uiPrefix]["USB"]["squelchLevel"] = squelchLevel;

View File

@ -7,6 +7,7 @@
#include <string>
#include <config.h>
#include <imgui.h>
#include <gui/widgets/scroll_behavior.h>
class WFMDemodulator : public Demodulator {
public:
@ -159,7 +160,7 @@ public:
ImGui::Text("Squelch");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::SliderFloat(("##_radio_wfm_sqelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) {
if (ImGui::SliderFloat(("##_radio_wfm_sqelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB") || ImGui::AllowScrollwheel<float>(squelchLevel, 20, -100, 0)) {
squelch.setLevel(squelchLevel);
_config->aquire();
_config->conf[uiPrefix]["WFM"]["squelchLevel"] = squelchLevel;