Updated to ImGui 1.87 to cleanup UI code

This commit is contained in:
AlexandreRouma
2022-02-14 23:33:52 +01:00
parent 04e54a2d57
commit 51c940acd4
47 changed files with 2018 additions and 1069 deletions

View File

@@ -35,7 +35,7 @@ namespace bandplanmenu {
}
void draw(void* ctx) {
float menuColumnWidth = ImGui::GetContentRegionAvailWidth();
float menuColumnWidth = ImGui::GetContentRegionAvail().x;
ImGui::PushItemWidth(menuColumnWidth);
if (ImGui::Combo("##_bandplan_name_", &bandplanId, bandplan::bandplanNameTxt.c_str())) {
gui::waterfall.bandplan = &bandplan::bandplans[bandplan::bandplanNames[bandplanId]];

View File

@@ -7,7 +7,6 @@
#include <gui/main_window.h>
#include <signal_path/signal_path.h>
#include <gui/style.h>
#include <keybinds.h>
namespace displaymenu {
bool showWaterfall;
@@ -89,8 +88,8 @@ namespace displaymenu {
}
void draw(void* ctx) {
float menuWidth = ImGui::GetContentRegionAvailWidth();
bool homePressed = ImGui::IsKeyPressed(KB_KEY_HOME, false);
float menuWidth = ImGui::GetContentRegionAvail().x;
bool homePressed = ImGui::IsKeyPressed(ImGuiKey_Home, false);
if (ImGui::Checkbox("Show Waterfall##_sdrpp", &showWaterfall) || homePressed) {
if (homePressed) { showWaterfall = !showWaterfall; }
showWaterfall ? gui::waterfall.showWaterfall() : gui::waterfall.hideWaterfall();

View File

@@ -80,11 +80,11 @@ namespace module_manager_menu {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvailWidth());
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
ImGui::InputText("##module_mod_name", modName, 1000);
ImGui::TableSetColumnIndex(1);
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvailWidth());
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
ImGui::Combo("##module_mgr_type", &modTypeId, modTypesTxt.c_str());
ImGui::TableSetColumnIndex(2);

View File

@@ -156,7 +156,7 @@ namespace sourcemenu {
}
void draw(void* ctx) {
float itemWidth = ImGui::GetContentRegionAvailWidth();
float itemWidth = ImGui::GetContentRegionAvail().x;
bool running = gui::mainWindow.sdrIsRunning();
if (running) { style::beginDisabled(); }

View File

@@ -41,7 +41,7 @@ namespace thememenu {
}
void draw(void* ctx) {
float menuWidth = ImGui::GetContentRegionAvailWidth();
float menuWidth = ImGui::GetContentRegionAvail().x;
ImGui::LeftLabel("Theme");
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::Combo("##theme_select_combo", &themeId, themeNamesTxt.c_str())) {

View File

@@ -81,7 +81,7 @@ namespace vfo_color_menu {
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
if (ImGui::Button("Auto Color##vfo_color", ImVec2(ImGui::GetContentRegionAvailWidth(), 0))) {
if (ImGui::Button("Auto Color##vfo_color", ImVec2(ImGui::GetContentRegionAvail().x, 0))) {
float delta = 1.0f / (float)gui::waterfall.vfos.size();
float hue = 0;
for (auto& [name, vfo] : gui::waterfall.vfos) {
@@ -99,7 +99,7 @@ namespace vfo_color_menu {
}
ImGui::TableSetColumnIndex(1);
if (ImGui::Button("Clear All##vfo_color", ImVec2(ImGui::GetContentRegionAvailWidth(), 0))) {
if (ImGui::Button("Clear All##vfo_color", ImVec2(ImGui::GetContentRegionAvail().x, 0))) {
for (auto& [name, vfo] : gui::waterfall.vfos) {
vfoColors[name] = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);
vfo->color = IM_COL32(255, 255, 255, 50);