diff --git a/airspy_source/src/main.cpp b/airspy_source/src/main.cpp index 04f29ee7..f0534dad 100644 --- a/airspy_source/src/main.cpp +++ b/airspy_source/src/main.cpp @@ -412,8 +412,7 @@ private: // Gain menus if (_this->gainMode == 0) { - ImGui::Text("Gain"); - ImGui::SameLine(); + ImGui::LeftLabel("Gain"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderInt(CONCAT("##_airspy_sens_gain_", _this->name), &_this->sensitiveGain, 0, 21)) { if (_this->running) { @@ -427,8 +426,7 @@ private: } } else if (_this->gainMode == 1) { - ImGui::Text("Gain"); - ImGui::SameLine(); + ImGui::LeftLabel("Gain"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderInt(CONCAT("##_airspy_lin_gain_", _this->name), &_this->linearGain, 0, 21)) { if (_this->running) { @@ -446,8 +444,7 @@ private: float pos = ImGui::CalcTextSize("Mixer Gain").x + 10; if (_this->lnaAgc) { style::beginDisabled(); } - ImGui::Text("LNA Gain"); - ImGui::SameLine(); + ImGui::LeftLabel("LNA Gain"); ImGui::SetCursorPosX(pos); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderInt(CONCAT("##_airspy_lna_gain_", _this->name), &_this->lnaGain, 0, 15)) { @@ -463,8 +460,7 @@ private: if (_this->lnaAgc) { style::endDisabled(); } if (_this->mixerAgc) { style::beginDisabled(); } - ImGui::Text("Mixer Gain"); - ImGui::SameLine(); + ImGui::LeftLabel("Mixer Gain"); ImGui::SetCursorPosX(pos); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderInt(CONCAT("##_airspy_mix_gain_", _this->name), &_this->mixerGain, 0, 15)) { @@ -479,8 +475,7 @@ private: } if (_this->mixerAgc) { style::endDisabled(); } - ImGui::Text("VGA Gain"); - ImGui::SameLine(); + ImGui::LeftLabel("VGA Gain"); ImGui::SetCursorPosX(pos); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderInt(CONCAT("##_airspy_vga_gain_", _this->name), &_this->vgaGain, 0, 15)) { diff --git a/airspyhf_source/src/main.cpp b/airspyhf_source/src/main.cpp index 269e3403..bfa04dcb 100644 --- a/airspyhf_source/src/main.cpp +++ b/airspyhf_source/src/main.cpp @@ -303,8 +303,7 @@ private: if (_this->running) { style::endDisabled(); } - ImGui::Text("AGC Mode"); - ImGui::SameLine(); + ImGui::LeftLabel("AGC Mode"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##_airspyhf_agc_", _this->name), &_this->agcMode, AGG_MODES_STR)) { if (_this->running) { @@ -320,21 +319,7 @@ private: } } - ImGui::Text("HF LNA"); - ImGui::SameLine(); - if (ImGui::Checkbox(CONCAT("##_airspyhf_lna_", _this->name), &_this->hfLNA)) { - if (_this->running) { - airspyhf_set_hf_lna(_this->openDev, _this->hfLNA); - } - if (_this->selectedSerStr != "") { - config.acquire(); - config.conf["devices"][_this->selectedSerStr]["lna"] = _this->hfLNA; - config.release(true); - } - } - - ImGui::Text("Attenuation"); - ImGui::SameLine(); + ImGui::LeftLabel("Attenuation"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderFloatWithSteps(CONCAT("##_airspyhf_attn_", _this->name), &_this->atten, 0, 48, 6, "%.0f dB")) { if (_this->running) { @@ -345,7 +330,18 @@ private: config.conf["devices"][_this->selectedSerStr]["attenuation"] = _this->atten; config.release(true); } - } + } + + if (ImGui::Checkbox(CONCAT("HF LNA##_airspyhf_lna_", _this->name), &_this->hfLNA)) { + if (_this->running) { + airspyhf_set_hf_lna(_this->openDev, _this->hfLNA); + } + if (_this->selectedSerStr != "") { + config.acquire(); + config.conf["devices"][_this->selectedSerStr]["lna"] = _this->hfLNA; + config.release(true); + } + } } static int callback(airspyhf_transfer_t* transfer) { diff --git a/bladerf_source/src/main.cpp b/bladerf_source/src/main.cpp index 7600cfea..00e16964 100644 --- a/bladerf_source/src/main.cpp +++ b/bladerf_source/src/main.cpp @@ -424,8 +424,7 @@ private: // Channel selection (only show if more than one channel) if (_this->channelCount > 1) { - ImGui::Text("RX Channel"); - ImGui::SameLine(); + ImGui::LeftLabel("RX Channel"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); ImGui::Combo(CONCAT("##_balderf_ch_sel_", _this->name), &_this->chanId, _this->channelNamesTxt.c_str()); if (_this->selectedSerial != "") { @@ -437,8 +436,7 @@ private: if (_this->running) { style::endDisabled(); } - ImGui::Text("Bandwidth"); - ImGui::SameLine(); + ImGui::LeftLabel("Bandwidth"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##_balderf_bw_sel_", _this->name), &_this->bwId, _this->bandwidthsTxt.c_str())) { if (_this->running) { @@ -453,8 +451,7 @@ private: } // General config BS - ImGui::Text("Gain control mode"); - ImGui::SameLine(); + ImGui::LeftLabel("Gain control mode"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##_balderf_gm_sel_", _this->name), &_this->gainMode, _this->gainModesTxt.c_str()) && _this->selectedSerial != "") { if (_this->running) { @@ -472,8 +469,7 @@ private: } if (_this->selectedSerial != "") { if (_this->gainModes[_this->gainMode].mode != BLADERF_GAIN_MANUAL) { style::beginDisabled(); } } - ImGui::Text("Gain"); - ImGui::SameLine(); + ImGui::LeftLabel("Gain"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderInt("##_balderf_oag_sel_", &_this->overallGain, (_this->gainRange != NULL) ? _this->gainRange->min : 0, (_this->gainRange != NULL) ? _this->gainRange->max : 60)) { if (_this->running) { diff --git a/core/src/credits.cpp b/core/src/credits.cpp index f3a2130b..c2204f82 100644 --- a/core/src/credits.cpp +++ b/core/src/credits.cpp @@ -39,6 +39,7 @@ namespace sdrpp_credits { "Daniele D'Agnelli", "EB3FRN", "Eric Johnson", + "Flinger Films", "W4IPA", "Lee Donaghy", "ON4MU", diff --git a/core/src/gui/main_window.cpp b/core/src/gui/main_window.cpp index abece425..9f29fd0d 100644 --- a/core/src/gui/main_window.cpp +++ b/core/src/gui/main_window.cpp @@ -602,8 +602,9 @@ void MainWindow::draw() { double factor = (double)bw * (double)bw; // Map 0.0 -> 1.0 to 1000.0 -> bandwidth - double delta = gui::waterfall.getBandwidth() - 1000.0; - double finalBw = 1000.0 + (factor * delta); + double wfBw = gui::waterfall.getBandwidth(); + double delta = wfBw - 1000.0; + double finalBw = std::min(1000.0 + (factor * delta), wfBw); gui::waterfall.setViewBandwidth(finalBw); if (vfo != NULL) { diff --git a/core/src/gui/menus/bandplan.cpp b/core/src/gui/menus/bandplan.cpp index 3b3c6375..211557ae 100644 --- a/core/src/gui/menus/bandplan.cpp +++ b/core/src/gui/menus/bandplan.cpp @@ -2,6 +2,7 @@ #include #include #include +#include namespace bandplanmenu { int bandplanId; @@ -44,8 +45,7 @@ namespace bandplanmenu { } ImGui::PopItemWidth(); - ImGui::Text("Position"); - ImGui::SameLine(); + ImGui::LeftLabel("Position"); ImGui::SetNextItemWidth(menuColumnWidth - ImGui::GetCursorPosX()); if (ImGui::Combo("##_bandplan_pos_", &bandPlanPos, bandPlanPosTxt)) { gui::waterfall.setBandPlanPos(bandPlanPos); diff --git a/core/src/gui/menus/display.cpp b/core/src/gui/menus/display.cpp index 2f419e09..0000b79a 100644 --- a/core/src/gui/menus/display.cpp +++ b/core/src/gui/menus/display.cpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace displaymenu { bool showWaterfall; @@ -105,8 +106,7 @@ namespace displaymenu { core::configManager.release(true); } - ImGui::Text("FFT Framerate"); - ImGui::SameLine(); + ImGui::LeftLabel("FFT Framerate"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::InputInt("##sdrpp_fft_rate", &fftRate, 1, 10)) { fftRate = std::max(1, fftRate); @@ -116,8 +116,7 @@ namespace displaymenu { core::configManager.release(true); } - ImGui::Text("FFT Size"); - ImGui::SameLine(); + ImGui::LeftLabel("FFT Size"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo("##sdrpp_fft_size", &fftSizeId, FFTSizesStr)) { gui::mainWindow.setFFTSize(FFTSizes[fftSizeId]); @@ -126,8 +125,7 @@ namespace displaymenu { core::configManager.release(true); } - ImGui::Text("FFT Window"); - ImGui::SameLine(); + ImGui::LeftLabel("FFT Window"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo("##sdrpp_fft_window", &selectedWindow, "Rectangular\0Blackman\0")) { gui::mainWindow.setFFTWindow(selectedWindow); @@ -137,8 +135,7 @@ namespace displaymenu { } if (colorMapNames.size() > 0) { - ImGui::Text("Color Map"); - ImGui::SameLine(); + ImGui::LeftLabel("Color Map"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo("##_sdrpp_color_map_sel", &colorMapId, colorMapNamesTxt.c_str())) { colormaps::Map map = colormaps::maps[colorMapNames[colorMapId]]; diff --git a/core/src/gui/menus/source.cpp b/core/src/gui/menus/source.cpp index 43c8b957..eabc4c59 100644 --- a/core/src/gui/menus/source.cpp +++ b/core/src/gui/menus/source.cpp @@ -168,8 +168,7 @@ namespace sourecmenu { core::configManager.release(true); } - ImGui::Text("Offset mode"); - ImGui::SameLine(); + ImGui::LeftLabel("Offset mode"); ImGui::SetNextItemWidth(itemWidth - ImGui::GetCursorPosX()); if (ImGui::Combo("##_sdrpp_offset_mode", &offsetMode, offsetModesTxt)) { updateOffset(); @@ -178,8 +177,7 @@ namespace sourecmenu { core::configManager.release(true); } - ImGui::Text("Offset"); - ImGui::SameLine(); + ImGui::LeftLabel("Offset"); ImGui::SetNextItemWidth(itemWidth - ImGui::GetCursorPosX()); if (offsetMode == OFFSET_MODE_CUSTOM) { if (ImGui::InputDouble("##freq_offset", &customOffset, 1.0, 100.0)) { @@ -196,8 +194,7 @@ namespace sourecmenu { } if (running) { style::beginDisabled(); } - ImGui::Text("Decimation"); - ImGui::SameLine(); + ImGui::LeftLabel("Decimation"); ImGui::SetNextItemWidth(itemWidth - ImGui::GetCursorPosX()); if (ImGui::Combo("##source_decim", &decimationPower, decimationStages)) { sigpath::signalPath.setDecimation(decimationPower); diff --git a/core/src/gui/menus/theme.cpp b/core/src/gui/menus/theme.cpp index b0758f91..bdfb1d6f 100644 --- a/core/src/gui/menus/theme.cpp +++ b/core/src/gui/menus/theme.cpp @@ -2,6 +2,7 @@ #include #include #include +#include namespace thememenu { int themeId; @@ -34,8 +35,7 @@ namespace thememenu { void draw(void* ctx) { float menuWidth = ImGui::GetContentRegionAvailWidth(); - ImGui::Text("Theme"); - ImGui::SameLine(); + ImGui::LeftLabel("Theme"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo("##theme_select_combo", &themeId, themeNamesTxt.c_str())) { gui::themeManager.applyTheme(themeNames[themeId]); diff --git a/core/src/gui/style.cpp b/core/src/gui/style.cpp index febcbc38..b746f09a 100644 --- a/core/src/gui/style.cpp +++ b/core/src/gui/style.cpp @@ -43,4 +43,14 @@ namespace style { ImGui::PopItemFlag(); ImGui::PopStyleColor(3); } +} + +namespace ImGui { + void LeftLabel(char* text) { + float vpos = ImGui::GetCursorPosY(); + ImGui::SetCursorPosY(vpos + GImGui->Style.FramePadding.y); + ImGui::Text(text); + ImGui::SameLine(); + ImGui::SetCursorPosY(vpos); + } } \ No newline at end of file diff --git a/core/src/gui/style.h b/core/src/gui/style.h index 244e6a77..b4cec335 100644 --- a/core/src/gui/style.h +++ b/core/src/gui/style.h @@ -12,4 +12,8 @@ namespace style { void beginDisabled(); void endDisabled(); void testtt(); +} + +namespace ImGui { + void LeftLabel(char* text); } \ No newline at end of file diff --git a/frequency_manager/src/main.cpp b/frequency_manager/src/main.cpp index 48d00f1d..81bb0f38 100644 --- a/frequency_manager/src/main.cpp +++ b/frequency_manager/src/main.cpp @@ -167,7 +167,7 @@ private: ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); - ImGui::Text("Name"); + ImGui::LeftLabel("Name"); ImGui::TableSetColumnIndex(1); ImGui::SetNextItemWidth(200); if (ImGui::InputText(("##freq_manager_edit_name"+name).c_str(), nameBuf, 1023)) { @@ -176,21 +176,21 @@ private: ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); - ImGui::Text("Frequency"); + ImGui::LeftLabel("Frequency"); ImGui::TableSetColumnIndex(1); ImGui::SetNextItemWidth(200); ImGui::InputDouble(("##freq_manager_edit_freq"+name).c_str(), &editedBookmark.frequency); ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); - ImGui::Text("Bandwidth"); + ImGui::LeftLabel("Bandwidth"); ImGui::TableSetColumnIndex(1); ImGui::SetNextItemWidth(200); ImGui::InputDouble(("##freq_manager_edit_bw"+name).c_str(), &editedBookmark.bandwidth); ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); - ImGui::Text("Mode"); + ImGui::LeftLabel("Mode"); ImGui::TableSetColumnIndex(1); ImGui::SetNextItemWidth(200); @@ -234,7 +234,7 @@ private: strcpy(nameBuf, editedListName.c_str()); if (ImGui::BeginPopup(id.c_str(), ImGuiWindowFlags_NoResize)) { - ImGui::Text("Name"); + ImGui::LeftLabel("Name"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::InputText(("##freq_manager_edit_name"+name).c_str(), nameBuf, 1023)) { editedListName = nameBuf; @@ -569,8 +569,7 @@ private: _this->selectListsOpen = true; } - ImGui::Text("Bookmark display mode"); - ImGui::SameLine(); + ImGui::LeftLabel("Bookmark display mode"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(("##_freq_mgr_dms_" + _this->name).c_str(), &_this->bookmarkDisplayMode, bookmarkDisplayModesTxt)) { config.acquire(); diff --git a/hackrf_source/src/main.cpp b/hackrf_source/src/main.cpp index 40ba6ef7..20f6cf1b 100644 --- a/hackrf_source/src/main.cpp +++ b/hackrf_source/src/main.cpp @@ -305,8 +305,7 @@ private: if (_this->running) { style::endDisabled(); } - ImGui::Text("Bandwidth"); - ImGui::SameLine(); + ImGui::LeftLabel("Bandwidth"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##_hackrf_bw_sel_", _this->name), &_this->bwId, bandwidthsTxt)) { if (_this->running) { @@ -317,6 +316,28 @@ private: config.release(true); } + ImGui::LeftLabel("LNA Gain"); + ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); + if (ImGui::SliderFloatWithSteps(CONCAT("##_hackrf_lna_", _this->name), &_this->lna, 0, 40, 8, "%.0fdB")) { + if (_this->running) { + hackrf_set_lna_gain(_this->openDev, _this->lna); + } + config.acquire(); + config.conf["devices"][_this->selectedSerial]["lnaGain"] = (int)_this->lna; + config.release(true); + } + + ImGui::LeftLabel("VGA Gain"); + ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); + if (ImGui::SliderFloatWithSteps(CONCAT("##_hackrf_vga_", _this->name), &_this->vga, 0, 62, 2, "%.0fdB")) { + if (_this->running) { + hackrf_set_vga_gain(_this->openDev, _this->vga); + } + config.acquire(); + config.conf["devices"][_this->selectedSerial]["vgaGain"] = (int)_this->vga; + config.release(true); + } + if (ImGui::Checkbox(CONCAT("Bias-T##_hackrf_bt_", _this->name), &_this->biasT)) { if (_this->running) { hackrf_set_antenna_enable(_this->openDev, _this->biasT); @@ -333,31 +354,7 @@ private: config.acquire(); config.conf["devices"][_this->selectedSerial]["amp"] = _this->amp; config.release(true); - } - - ImGui::Text("LNA Gain"); - ImGui::SameLine(); - ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); - if (ImGui::SliderFloatWithSteps(CONCAT("##_hackrf_lna_", _this->name), &_this->lna, 0, 40, 8, "%.0fdB")) { - if (_this->running) { - hackrf_set_lna_gain(_this->openDev, _this->lna); - } - config.acquire(); - config.conf["devices"][_this->selectedSerial]["lnaGain"] = (int)_this->lna; - config.release(true); - } - - ImGui::Text("VGA Gain"); - ImGui::SameLine(); - ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); - if (ImGui::SliderFloatWithSteps(CONCAT("##_hackrf_vga_", _this->name), &_this->vga, 0, 62, 2, "%.0fdB")) { - if (_this->running) { - hackrf_set_vga_gain(_this->openDev, _this->vga); - } - config.acquire(); - config.conf["devices"][_this->selectedSerial]["vgaGain"] = (int)_this->vga; - config.release(true); - } + } } static int callback(hackrf_transfer* transfer) { diff --git a/limesdr_source/src/main.cpp b/limesdr_source/src/main.cpp index cd39116e..02b56c77 100644 --- a/limesdr_source/src/main.cpp +++ b/limesdr_source/src/main.cpp @@ -411,8 +411,7 @@ private: } if (_this->channelCount > 1) { - ImGui::Text("RX Channel"); - ImGui::SameLine(); + ImGui::LeftLabel("RX Channel"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo("##limesdr_ch_sel", &_this->chanId, _this->channelNamesTxt.c_str()) && _this->selectedDevName != "") { config.acquire(); @@ -423,8 +422,7 @@ private: if (_this->running) { style::endDisabled(); } - ImGui::Text("Antenna"); - ImGui::SameLine(); + ImGui::LeftLabel("Antenna"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo("##limesdr_ant_sel", &_this->antennaId, _this->antennaListTxt.c_str())) { if (_this->running) { @@ -437,8 +435,7 @@ private: } } - ImGui::Text("Bandwidth"); - ImGui::SameLine(); + ImGui::LeftLabel("Bandwidth"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo("##limesdr_bw_sel", &_this->bwId, _this->bandwidthsTxt.c_str())) { if (_this->running) { @@ -451,8 +448,7 @@ private: } } - ImGui::Text("Gain"); - ImGui::SameLine(); + ImGui::LeftLabel("Gain"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderInt("##limesdr_gain_sel", &_this->gain, 0, 73, "%ddB")) { if (_this->running) { diff --git a/network_sink/src/main.cpp b/network_sink/src/main.cpp index 86ddc36e..d8f14337 100644 --- a/network_sink/src/main.cpp +++ b/network_sink/src/main.cpp @@ -134,8 +134,7 @@ public: config.release(true); } - ImGui::Text("Protocol"); - ImGui::SameLine(); + ImGui::LeftLabel("Protocol"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##_network_sink_mode_", _streamName), &modeId, sinkModesTxt)) { config.acquire(); @@ -145,8 +144,7 @@ public: if (listening) { style::endDisabled(); } - ImGui::Text("Samplerate"); - ImGui::SameLine(); + ImGui::LeftLabel("Samplerate"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##_network_sink_sr_", _streamName), &srId, sampleRatesTxt.c_str())) { sampleRate = sampleRates[srId]; diff --git a/plutosdr_source/src/main.cpp b/plutosdr_source/src/main.cpp index d6f7fd8f..9f043ecb 100644 --- a/plutosdr_source/src/main.cpp +++ b/plutosdr_source/src/main.cpp @@ -188,8 +188,7 @@ private: float menuWidth = ImGui::GetContentRegionAvailWidth(); if (_this->running) { style::beginDisabled(); } - ImGui::Text("IP"); - ImGui::SameLine(); + ImGui::LeftLabel("IP"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::InputText(CONCAT("##_pluto_ip_", _this->name), &_this->ip[3], 16)) { config.acquire(); @@ -197,8 +196,7 @@ private: config.release(true); } - ImGui::Text("Samplerate"); - ImGui::SameLine(); + ImGui::LeftLabel("Samplerate"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##_pluto_sr_", _this->name), &_this->srId, _this->sampleRatesTxt.c_str())) { @@ -210,8 +208,7 @@ private: } if (_this->running) { style::endDisabled(); } - ImGui::Text("Gain Mode"); - ImGui::SameLine(); + ImGui::LeftLabel("Gain Mode"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##_gainmode_select_", _this->name), &_this->gainMode, gainModesTxt)) { if (_this->running) { @@ -222,8 +219,7 @@ private: config.release(true); } - ImGui::Text("PGA Gain"); - ImGui::SameLine(); + ImGui::LeftLabel("PGA Gain"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (_this->gainMode) { style::beginDisabled(); } if (ImGui::SliderFloat(CONCAT("##_gain_select_", _this->name), &_this->gain, 0, 76)) { diff --git a/radio/src/am_demod.h b/radio/src/am_demod.h index 56152e99..3d7b5398 100644 --- a/radio/src/am_demod.h +++ b/radio/src/am_demod.h @@ -137,8 +137,7 @@ public: _config->release(true); } - ImGui::Text("Snap Interval"); - ImGui::SameLine(); + ImGui::LeftLabel("Snap Interval"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::InputFloat(("##_radio_am_snap_" + uiPrefix).c_str(), &snapInterval, 1, 100, "%.0f", 0)) { if (snapInterval < 1) { snapInterval = 1; } @@ -148,8 +147,7 @@ public: _config->release(true); } - ImGui::Text("Squelch"); - ImGui::SameLine(); + ImGui::LeftLabel("Squelch"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderFloat(("##_radio_am_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) { squelch.setLevel(squelchLevel); diff --git a/radio/src/cw_demod.h b/radio/src/cw_demod.h index 79a01b05..e897c6e6 100644 --- a/radio/src/cw_demod.h +++ b/radio/src/cw_demod.h @@ -141,8 +141,7 @@ public: _config->release(true); } - ImGui::Text("Snap Interval"); - ImGui::SameLine(); + ImGui::LeftLabel("Snap Interval"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::InputFloat(("##_radio_cw_snap_" + uiPrefix).c_str(), &snapInterval, 1, 100, "%.0f", 0)) { if (snapInterval < 1) { snapInterval = 1; } @@ -152,8 +151,7 @@ public: _config->release(true); } - ImGui::Text("Squelch"); - ImGui::SameLine(); + ImGui::LeftLabel("Squelch"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderFloat(("##_radio_cw_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) { squelch.setLevel(squelchLevel); diff --git a/radio/src/dsb_demod.h b/radio/src/dsb_demod.h index bd9e880e..62fbaeaa 100644 --- a/radio/src/dsb_demod.h +++ b/radio/src/dsb_demod.h @@ -137,8 +137,7 @@ public: _config->release(true); } - ImGui::Text("Snap Interval"); - ImGui::SameLine(); + ImGui::LeftLabel("Snap Interval"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::InputFloat(("##_radio_dsb_snap_" + uiPrefix).c_str(), &snapInterval, 1, 100, "%.0f", 0)) { if (snapInterval < 1) { snapInterval = 1; } @@ -148,8 +147,7 @@ public: _config->release(true); } - ImGui::Text("Squelch"); - ImGui::SameLine(); + ImGui::LeftLabel("Squelch"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderFloat(("##_radio_dsb_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) { squelch.setLevel(squelchLevel); diff --git a/radio/src/fm_demod.h b/radio/src/fm_demod.h index 1bea3520..3a247ae6 100644 --- a/radio/src/fm_demod.h +++ b/radio/src/fm_demod.h @@ -129,8 +129,7 @@ public: _config->release(true); } - ImGui::Text("Snap Interval"); - ImGui::SameLine(); + ImGui::LeftLabel("Snap Interval"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::InputFloat(("##_radio_fm_snap_" + uiPrefix).c_str(), &snapInterval, 1, 100, "%.0f", 0)) { if (snapInterval < 1) { snapInterval = 1; } @@ -140,8 +139,7 @@ public: _config->release(true); } - ImGui::Text("Squelch"); - ImGui::SameLine(); + ImGui::LeftLabel("Squelch"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderFloat(("##_radio_fm_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) { squelch.setLevel(squelchLevel); diff --git a/radio/src/lsb_demod.h b/radio/src/lsb_demod.h index 563d0ef8..0dd688c5 100644 --- a/radio/src/lsb_demod.h +++ b/radio/src/lsb_demod.h @@ -137,8 +137,7 @@ public: _config->release(true); } - ImGui::Text("Snap Interval"); - ImGui::SameLine(); + ImGui::LeftLabel("Snap Interval"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::InputFloat(("##_radio_lsb_snap_" + uiPrefix).c_str(), &snapInterval, 1, 100, "%.0f", 0)) { if (snapInterval < 1) { snapInterval = 1; } @@ -148,8 +147,7 @@ public: _config->release(true); } - ImGui::Text("Squelch"); - ImGui::SameLine(); + ImGui::LeftLabel("Squelch"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderFloat(("##_radio_lsb_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) { squelch.setLevel(squelchLevel); diff --git a/radio/src/raw_demod.h b/radio/src/raw_demod.h index 53602df8..14b9d415 100644 --- a/radio/src/raw_demod.h +++ b/radio/src/raw_demod.h @@ -90,8 +90,7 @@ public: void showMenu() { float menuWidth = ImGui::GetContentRegionAvailWidth(); - ImGui::Text("Snap Interval"); - ImGui::SameLine(); + ImGui::LeftLabel("Snap Interval"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::InputFloat(("##_radio_raw_snap_" + uiPrefix).c_str(), &snapInterval, 1, 100, "%.0f", 0)) { if (snapInterval < 1) { snapInterval = 1; } @@ -101,8 +100,7 @@ public: _config->release(true); } - ImGui::Text("Squelch"); - ImGui::SameLine(); + ImGui::LeftLabel("Squelch"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderFloat(("##_radio_raw_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) { squelch.setLevel(squelchLevel); diff --git a/radio/src/usb_demod.h b/radio/src/usb_demod.h index 205ba845..1b199d4c 100644 --- a/radio/src/usb_demod.h +++ b/radio/src/usb_demod.h @@ -137,8 +137,7 @@ public: _config->release(true); } - ImGui::Text("Snap Interval"); - ImGui::SameLine(); + ImGui::LeftLabel("Snap Interval"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::InputFloat(("##_radio_usb_snap_" + uiPrefix).c_str(), &snapInterval, 1, 100, "%.0f", 0)) { if (snapInterval < 1) { snapInterval = 1; } @@ -148,8 +147,7 @@ public: _config->release(true); } - ImGui::Text("Squelch"); - ImGui::SameLine(); + ImGui::LeftLabel("Squelch"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderFloat(("##_radio_usb_squelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) { squelch.setLevel(squelchLevel); diff --git a/radio/src/wfm_demod.h b/radio/src/wfm_demod.h index bd5d67c7..36d09557 100644 --- a/radio/src/wfm_demod.h +++ b/radio/src/wfm_demod.h @@ -164,8 +164,7 @@ public: _config->release(true); } - ImGui::Text("Snap Interval"); - ImGui::SameLine(); + ImGui::LeftLabel("Snap Interval"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::InputFloat(("##_radio_wfm_snap_" + uiPrefix).c_str(), &snapInterval, 1, 100, "%.0f", 0)) { if (snapInterval < 1) { snapInterval = 1; } @@ -176,8 +175,7 @@ public: } - ImGui::Text("De-emphasis"); - ImGui::SameLine(); + ImGui::LeftLabel("De-emphasis"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(("##_radio_wfm_deemp_" + uiPrefix).c_str(), &deempId, deempModes)) { setDeempIndex(deempId); @@ -186,8 +184,7 @@ public: _config->release(true); } - ImGui::Text("Squelch"); - ImGui::SameLine(); + ImGui::LeftLabel("Squelch"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::SliderFloat(("##_radio_wfm_sqelch_" + uiPrefix).c_str(), &squelchLevel, -100.0f, 0.0f, "%.3fdB")) { squelch.setLevel(squelchLevel); diff --git a/readme.md b/readme.md index 1923dc93..be1bf679 100644 --- a/readme.md +++ b/readme.md @@ -353,17 +353,18 @@ I will soon publish a contributing.md listing the code style to use. ## Patrons -* [Croccydile](https://example.com/) +* Croccydile * [Daniele D'Agnelli](https://linkedin.com/in/dagnelli) * [EB3FRN](https://www.eb3frn.net/) -* [Eric Johnson](https://example.com/) +* Eric Johnson +* Flinger Films * [W4IPA](https://twitter.com/W4IPAstroke5) -* [Lee Donaghy](https://github.com/github) -* [ON4MU](https://github.com/) +* Lee Donaghy +* ON4MU * [Passion-Radio.com](https://passion-radio.com/) * [Scanner School](https://scannerschool.com/) * [SignalsEverywhere](https://signalseverywhere.com/) -* [Syne Ardwin (WI9SYN)](https://example.com/) +* Syne Ardwin (WI9SYN) ## Contributors diff --git a/rigctl_server/src/main.cpp b/rigctl_server/src/main.cpp index aa6218df..1a30454a 100644 --- a/rigctl_server/src/main.cpp +++ b/rigctl_server/src/main.cpp @@ -126,8 +126,7 @@ private: } if (listening) { style::endDisabled(); } - ImGui::Text("Controlled VFO"); - ImGui::SameLine(); + ImGui::LeftLabel("Controlled VFO"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); { std::lock_guard lck(_this->vfoMtx); @@ -141,8 +140,7 @@ private: } } - ImGui::Text("Controlled Recorder"); - ImGui::SameLine(); + ImGui::LeftLabel("Controlled Recorder"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); { std::lock_guard lck(_this->vfoMtx); diff --git a/rtl_sdr_source/src/main.cpp b/rtl_sdr_source/src/main.cpp index 1840bb36..605dd5f8 100644 --- a/rtl_sdr_source/src/main.cpp +++ b/rtl_sdr_source/src/main.cpp @@ -352,8 +352,7 @@ private: if (_this->running) { style::endDisabled(); } // Rest of rtlsdr config here - ImGui::Text("Direct Sampling"); - ImGui::SameLine(); + ImGui::LeftLabel("Direct Sampling"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##_rtlsdr_ds_", _this->name), &_this->directSamplingMode, directSamplingModesTxt)) { if (_this->running) { @@ -378,8 +377,7 @@ private: } } - ImGui::Text("PPM Correction"); - ImGui::SameLine(); + ImGui::LeftLabel("PPM Correction"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::InputInt(CONCAT("##_rtlsdr_ppm_", _this->name), &_this->ppm, 1, 10)) { _this->ppm = std::clamp(_this->ppm, -1000000, 1000000); @@ -393,6 +391,21 @@ private: } } + if (_this->tunerAgc || _this->gainList.size() == 0) { style::beginDisabled(); } + ImGui::SetNextItemWidth(menuWidth); + if (ImGui::SliderInt(CONCAT("##_rtlsdr_gain_", _this->name), &_this->gainId, 0, _this->gainList.size() - 1, _this->dbTxt)) { + _this->updateGainTxt(); + if (_this->running) { + rtlsdr_set_tuner_gain(_this->openDev, _this->gainList[_this->gainId]); + } + if (_this->selectedDevName != "") { + config.acquire(); + config.conf["devices"][_this->selectedDevName]["gain"] = _this->gainId; + config.release(true); + } + } + if (_this->tunerAgc || _this->gainList.size() == 0) { style::endDisabled(); } + if (ImGui::Checkbox(CONCAT("Bias T##_rtlsdr_rtl_biast_", _this->name), &_this->biasT)) { if (_this->running) { rtlsdr_set_bias_tee(_this->openDev, _this->biasT); @@ -442,21 +455,6 @@ private: config.release(true); } } - - if (_this->tunerAgc || _this->gainList.size() == 0) { style::beginDisabled(); } - ImGui::SetNextItemWidth(menuWidth); - if (ImGui::SliderInt(CONCAT("##_rtlsdr_gain_", _this->name), &_this->gainId, 0, _this->gainList.size() - 1, _this->dbTxt)) { - _this->updateGainTxt(); - if (_this->running) { - rtlsdr_set_tuner_gain(_this->openDev, _this->gainList[_this->gainId]); - } - if (_this->selectedDevName != "") { - config.acquire(); - config.conf["devices"][_this->selectedDevName]["gain"] = _this->gainId; - config.release(true); - } - } - if (_this->tunerAgc || _this->gainList.size() == 0) { style::endDisabled(); } } void worker() { diff --git a/rtl_tcp_source/src/main.cpp b/rtl_tcp_source/src/main.cpp index 0ab0b356..7ed3769e 100644 --- a/rtl_tcp_source/src/main.cpp +++ b/rtl_tcp_source/src/main.cpp @@ -218,8 +218,7 @@ private: if (_this->running) { style::endDisabled(); } - ImGui::Text("Direct Sampling"); - ImGui::SameLine(); + ImGui::LeftLabel("Direct Sampling"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##_rtltcp_ds_", _this->name), &_this->directSamplingMode, "Disabled\0I branch\0Q branch\0")) { if (_this->running) { @@ -231,8 +230,7 @@ private: config.release(true); } - ImGui::Text("PPM Correction"); - ImGui::SameLine(); + ImGui::LeftLabel("PPM Correction"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::InputInt(CONCAT("##_rtltcp_ppm_", _this->name), &_this->ppm, 1, 10)) { if (_this->running) { @@ -243,6 +241,18 @@ private: config.release(true); } + if (_this->tunerAGC) { style::beginDisabled(); } + ImGui::SetNextItemWidth(menuWidth); + if (ImGui::SliderInt(CONCAT("##_gain_select_", _this->name), &_this->gain, 0, 28, "")) { + if (_this->running) { + _this->client.setGainIndex(_this->gain); + } + config.acquire(); + config.conf["gainIndex"] = _this->gain; + config.release(true); + } + if (_this->tunerAGC) { style::endDisabled(); } + if (ImGui::Checkbox(CONCAT("Bias-T##_biast_select_", _this->name), &_this->biasTee)) { if (_this->running) { _this->client.setBiasTee(_this->biasTee); @@ -284,18 +294,6 @@ private: config.conf["tunerAGC"] = _this->tunerAGC; config.release(true); } - - if (_this->tunerAGC) { style::beginDisabled(); } - ImGui::SetNextItemWidth(menuWidth); - if (ImGui::SliderInt(CONCAT("##_gain_select_", _this->name), &_this->gain, 0, 28, "")) { - if (_this->running) { - _this->client.setGainIndex(_this->gain); - } - config.acquire(); - config.conf["gainIndex"] = _this->gain; - config.release(true); - } - if (_this->tunerAGC) { style::endDisabled(); } } static void worker(void* ctx) { diff --git a/sdrplay_source/src/main.cpp b/sdrplay_source/src/main.cpp index 338b575d..516e94cb 100644 --- a/sdrplay_source/src/main.cpp +++ b/sdrplay_source/src/main.cpp @@ -676,8 +676,7 @@ private: if (_this->selectedName != "") { ImGui::PushItemWidth(menuWidth - ImGui::CalcTextSize("LNA Gain").x - 10); - ImGui::Text("LNA Gain"); - ImGui::SameLine(); + ImGui::LeftLabel("LNA Gain"); float pos = ImGui::GetCursorPosX(); if (ImGui::SliderInt(CONCAT("##sdrplay_lna_gain", _this->name), &_this->lnaGain, _this->lnaSteps - 1, 0, "")) { if (_this->running) { @@ -690,8 +689,7 @@ private: } if (_this->agc > 0) { style::beginDisabled(); } - ImGui::Text("IF Gain"); - ImGui::SameLine(); + ImGui::LeftLabel("IF Gain"); ImGui::SetCursorPosX(pos); if (ImGui::SliderInt(CONCAT("##sdrplay_gain", _this->name), &_this->gain, 59, 20, "")) { if (_this->running) { @@ -705,8 +703,7 @@ private: ImGui::PopItemWidth(); if (_this->agc > 0) { style::endDisabled(); } - ImGui::Text("AGC"); - ImGui::SameLine(); + ImGui::LeftLabel("AGC"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##sdrplay_agc", _this->name), &_this->agc, agcModesTxt)) { if (_this->running) { @@ -784,8 +781,7 @@ private: } void RSP2Menu(float menuWidth) { - ImGui::Text("Antenna"); - ImGui::SameLine(); + ImGui::LeftLabel("Antenna"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##sdrplay_rsp2_ant", name), &rsp2_antennaPort, rsp2_antennaPortsTxt)) { if (running) { @@ -819,8 +815,7 @@ private: } void RSPduoMenu(float menuWidth) { - ImGui::Text("Antenna"); - ImGui::SameLine(); + ImGui::LeftLabel("Antenna"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##sdrplay_rspduo_ant", name), &rspduo_antennaPort, rspduo_antennaPortsTxt)) { @@ -870,8 +865,7 @@ private: } void RSPdxMenu(float menuWidth) { - ImGui::Text("Antenna"); - ImGui::SameLine(); + ImGui::LeftLabel("Antenna"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##sdrplay_rspdx_ant", name), &rspdx_antennaPort, rspdx_antennaPortsTxt)) { if (running) { diff --git a/soapy_source/src/main.cpp b/soapy_source/src/main.cpp index 646e775d..68788ef6 100644 --- a/soapy_source/src/main.cpp +++ b/soapy_source/src/main.cpp @@ -397,8 +397,7 @@ private: if (_this->running) { style::endDisabled(); } if (_this->antennaList.size() > 1) { - ImGui::Text("Antenna"); - ImGui::SameLine(); + ImGui::LeftLabel("Antenna"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##_antenna_select_", _this->name), &_this->uiAntennaId, _this->txtAntennaList.c_str())) { if (_this->running) @@ -433,9 +432,10 @@ private: } int i = 0; + char buf[128]; for (auto gain : _this->gainList) { - ImGui::Text("%s gain", gain.c_str()); - ImGui::SameLine(); + sprintf(buf, "%s gain", gain.c_str()); + ImGui::LeftLabel(buf); ImGui::SetCursorPosX(gainNameLen); ImGui::SetNextItemWidth(menuWidth - gainNameLen); float step = _this->gainRanges[i].step(); @@ -454,12 +454,8 @@ private: i++; } if(_this->bandwidthList.size() > 2) { - float bwLen = ImGui::CalcTextSize("Bandwidth").x + 5.0f; - ImGui::Text("Bandwidth"); - ImGui::SameLine(); - ImGui::SetCursorPosX(bwLen); - ImGui::SetNextItemWidth(menuWidth - bwLen); - + ImGui::LeftLabel("Bandwidth"); + ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo(CONCAT("##_bw_select_", _this->name), &_this->uiBandwidthId, _this->txtBwList.c_str())) { if(_this->running) { if(_this->bandwidthList[_this->uiBandwidthId] == -1) diff --git a/spyserver_source/src/main.cpp b/spyserver_source/src/main.cpp index 2fdc21b6..9ba05925 100644 --- a/spyserver_source/src/main.cpp +++ b/spyserver_source/src/main.cpp @@ -231,8 +231,7 @@ private: if (connected) { if (_this->running) { style::beginDisabled(); } - ImGui::Text("Samplerate"); - ImGui::SameLine(); + ImGui::LeftLabel("Samplerate"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo("##spyserver_source_sr", &_this->srId, _this->sampleRatesTxt.c_str())) { _this->sampleRate = _this->sampleRates[_this->srId]; @@ -243,8 +242,7 @@ private: } if (_this->running) { style::endDisabled(); } - ImGui::Text("Sample bit depth"); - ImGui::SameLine(); + ImGui::LeftLabel("Sample bit depth"); ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX()); if (ImGui::Combo("##spyserver_source_type", &_this->iqType, streamFormatStr)) { int srvBits = streamFormatsBitCount[_this->iqType];