Skip to content

Commit

Permalink
Cleanup layout manager
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaughan committed Sep 9, 2023
1 parent d8dc919 commit 3243385
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion include/zest/ui/layout_manager.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <map>
#include <string>
#include <zest/file/file.h>

Expand Down Expand Up @@ -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
9 changes: 4 additions & 5 deletions src/ui/layout_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
{
Expand All @@ -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");
Expand All @@ -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)
{
Expand All @@ -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
Expand Down

0 comments on commit 3243385

Please sign in to comment.