UI Cleanup + Fixed waterfall zoom bug

This commit is contained in:
Ryzerth
2021-08-31 18:39:48 +02:00
parent ec6a258958
commit 22acf33c01
31 changed files with 163 additions and 214 deletions

View File

@ -39,6 +39,7 @@ namespace sdrpp_credits {
"Daniele D'Agnelli",
"EB3FRN",
"Eric Johnson",
"Flinger Films",
"W4IPA",
"Lee Donaghy",
"ON4MU",

View File

@ -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<double>(1000.0 + (factor * delta), wfBw);
gui::waterfall.setViewBandwidth(finalBw);
if (vfo != NULL) {

View File

@ -2,6 +2,7 @@
#include <gui/widgets/bandplan.h>
#include <gui/gui.h>
#include <core.h>
#include <gui/style.h>
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);

View File

@ -6,6 +6,7 @@
#include <gui/gui.h>
#include <gui/main_window.h>
#include <signal_path/signal_path.h>
#include <gui/style.h>
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<int>(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]];

View File

@ -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);

View File

@ -2,6 +2,7 @@
#include <gui/gui.h>
#include <options.h>
#include <core.h>
#include <gui/style.h>
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]);

View File

@ -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);
}
}

View File

@ -12,4 +12,8 @@ namespace style {
void beginDisabled();
void endDisabled();
void testtt();
}
namespace ImGui {
void LeftLabel(char* text);
}