More UI fixes

This commit is contained in:
AlexandreRouma 2022-03-21 21:35:05 +01:00
parent e82e89a87c
commit 842b23b2f4
4 changed files with 8 additions and 9 deletions

View File

@ -354,6 +354,7 @@ void MainWindow::draw() {
} }
// To Bar // To Bar
// ImGui::BeginChild("TopBarChild", ImVec2(0, 49.0f * style::uiScale), false, ImGuiWindowFlags_HorizontalScrollbar);
ImVec2 btnSize(30 * style::uiScale, 30 * style::uiScale); ImVec2 btnSize(30 * style::uiScale, 30 * style::uiScale);
ImGui::PushID(ImGui::GetID("sdrpp_menu_btn")); ImGui::PushID(ImGui::GetID("sdrpp_menu_btn"));
if (ImGui::ImageButton(icons::MENU, btnSize, ImVec2(0, 0), ImVec2(1, 1), 5) || ImGui::IsKeyPressed(ImGuiKey_Menu, false)) { if (ImGui::ImageButton(icons::MENU, btnSize, ImVec2(0, 0), ImVec2(1, 1), 5) || ImGui::IsKeyPressed(ImGuiKey_Menu, false)) {
@ -424,7 +425,7 @@ void MainWindow::draw() {
ImGui::SameLine(); ImGui::SameLine();
int snrOffset = 87.0f * style::uiScale; int snrOffset = 87.0f * style::uiScale;
int snrWidth = std::min<int>(300.0f * style::uiScale, ImGui::GetWindowSize().x - ImGui::GetCursorPosX() - snrOffset); int snrWidth = std::clamp<int>(ImGui::GetWindowSize().x - ImGui::GetCursorPosX() - snrOffset, 100.0f * style::uiScale, 300.0f * style::uiScale);
ImGui::SetCursorPosX(ImGui::GetWindowSize().x - (snrWidth + snrOffset)); ImGui::SetCursorPosX(ImGui::GetWindowSize().x - (snrWidth + snrOffset));
ImGui::SetCursorPosY(origY + (5.0f * style::uiScale)); ImGui::SetCursorPosY(origY + (5.0f * style::uiScale));
@ -435,7 +436,7 @@ void MainWindow::draw() {
// Logo button // Logo button
ImGui::SetCursorPosX(ImGui::GetWindowSize().x - (48 * style::uiScale)); ImGui::SetCursorPosX(ImGui::GetWindowSize().x - (48 * style::uiScale));
ImGui::SetCursorPosY(10 * style::uiScale); ImGui::SetCursorPosY(10.0f * style::uiScale);
if (ImGui::ImageButton(icons::LOGO, ImVec2(32 * style::uiScale, 32 * style::uiScale), ImVec2(0, 0), ImVec2(1, 1), 0)) { if (ImGui::ImageButton(icons::LOGO, ImVec2(32 * style::uiScale, 32 * style::uiScale), ImVec2(0, 0), ImVec2(1, 1), 0)) {
showCredits = true; showCredits = true;
} }
@ -446,6 +447,8 @@ void MainWindow::draw() {
showCredits = false; showCredits = false;
} }
// ImGui::EndChild();
// Handle menu resize // Handle menu resize
ImVec2 winSize = ImGui::GetWindowSize(); ImVec2 winSize = ImGui::GetWindowSize();
ImVec2 mousePos = ImGui::GetMousePos(); ImVec2 mousePos = ImGui::GetMousePos();

View File

@ -92,13 +92,9 @@ namespace displaymenu {
gui::mainWindow.setFFTWindow(selectedWindow); gui::mainWindow.setFFTWindow(selectedWindow);
// Define and load UI scales // Define and load UI scales
uiScales.define(0.5f, "50%", 0.5f);
uiScales.define(1.0f, "100%", 1.0f); uiScales.define(1.0f, "100%", 1.0f);
uiScales.define(1.5f, "150%", 1.5f);
uiScales.define(2.0f, "200%", 2.0f); uiScales.define(2.0f, "200%", 2.0f);
uiScales.define(2.5f, "250%", 2.5f);
uiScales.define(3.0f, "300%", 3.0f); uiScales.define(3.0f, "300%", 3.0f);
uiScales.define(3.5f, "350%", 3.5f);
uiScales.define(4.0f, "400%", 4.0f); uiScales.define(4.0f, "400%", 4.0f);
uiScaleId = uiScales.valueId(style::uiScale); uiScaleId = uiScales.valueId(style::uiScale);
} }

View File

@ -96,7 +96,7 @@ void FrequencySelect::draw() {
ImGui::PushFont(style::bigFont); ImGui::PushFont(style::bigFont);
ImVec2 digitSz = ImGui::CalcTextSize("0"); ImVec2 digitSz = ImGui::CalcTextSize("0");
ImVec2 commaSz = ImGui::CalcTextSize("."); ImVec2 commaSz = ImGui::CalcTextSize(".");
widgetPos.y = cursorPos.y - ((digitSz.y / 2.0f) - ceilf(15 * style::uiScale) - 5); widgetPos.y = window->Pos.y + cursorPos.y - ((digitSz.y / 2.0f) - ceilf(15 * style::uiScale) - 5);
if (widgetPos.x != lastWidgetPos.x || widgetPos.y != lastWidgetPos.y) { if (widgetPos.x != lastWidgetPos.x || widgetPos.y != lastWidgetPos.y) {
lastWidgetPos = widgetPos; lastWidgetPos = widgetPos;

View File

@ -928,13 +928,13 @@ private:
} }
SmGui::ForceSync(); SmGui::ForceSync();
if (SmGui::Button("Apply", ImVec2(100, 0))) { if (SmGui::Button(" Apply ")) {
open = false; open = false;
valid = true; valid = true;
} }
SmGui::SameLine(); SmGui::SameLine();
SmGui::ForceSync(); SmGui::ForceSync();
if (SmGui::Button("Cancel", ImVec2(100, 0))) { if (SmGui::Button("Cancel")) {
open = false; open = false;
valid = false; valid = false;
} }