From 324338559397632eab64058b0ec2d3c9f0c43d2e Mon Sep 17 00:00:00 2001 From: Morny Date: Sat, 9 Sep 2023 19:48:07 +0100 Subject: [PATCH] Cleanup layout manager --- include/zest/ui/layout_manager.h | 3 ++- src/ui/layout_manager.cpp | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/zest/ui/layout_manager.h b/include/zest/ui/layout_manager.h index 465e15e..5ec4b3c 100644 --- a/include/zest/ui/layout_manager.h +++ b/include/zest/ui/layout_manager.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include @@ -45,7 +46,7 @@ void layout_manager_save(); // Called to display the menu, after the menu is finished drawing to show any popups, and once per frame outside of the ImGui::NewFrame void layout_manager_do_menu(); -void layout_manager_do_menu_popups(); +bool layout_manager_do_menu_popups(); void layout_manager_update(); }; // namespace Zest \ No newline at end of file diff --git a/src/ui/layout_manager.cpp b/src/ui/layout_manager.cpp index 15864a3..407383f 100644 --- a/src/ui/layout_manager.cpp +++ b/src/ui/layout_manager.cpp @@ -203,7 +203,6 @@ void layout_manager_register_window(const std::string& key, const std::string& n void layout_manager_do_menu() { - if (ImGui::BeginMenu("Layout")) { if (ImGui::MenuItem("Restore Default")) { @@ -230,7 +229,7 @@ void layout_manager_do_menu() { LayoutData.popupLayoutSaveRequest = true; } -#ifdef __DEBUG +#ifdef ___DEBUG if (ImGui::MenuItem("Save Layout File (DEBUG)")) { igfd::ImGuiFileDialog::Instance()->OpenDialog("SaveLayoutFileKey", "Choose File", ".ini", (runtree_path() / "settings").string(), "layout.ini"); @@ -243,12 +242,10 @@ void layout_manager_do_menu() { ImGui::MenuItem(state.name.c_str(), nullptr, state.pVisible); } - - ImGui::EndMenu(); } } -void layout_manager_do_menu_popups() +bool layout_manager_do_menu_popups() { if (LayoutData.popupLayoutSaveRequest == true) { @@ -267,7 +264,9 @@ void layout_manager_do_menu_popups() } ImGui::EndPopup(); + return true; } + return false; } // We call this outside of ImGui NewFrame to load any pending layouts