From 057185cb65bc01aaa296870fd4447ecb64572b45 Mon Sep 17 00:00:00 2001 From: William JCM Date: Sun, 20 Jun 2021 23:48:23 +0200 Subject: [PATCH] SaveTool: reorganise some code. --- src/SaveTool/SaveTool_MainManager.cpp | 84 ++++++++++++--------------- 1 file changed, 36 insertions(+), 48 deletions(-) diff --git a/src/SaveTool/SaveTool_MainManager.cpp b/src/SaveTool/SaveTool_MainManager.cpp index 6066a08..3da25e1 100644 --- a/src/SaveTool/SaveTool_MainManager.cpp +++ b/src/SaveTool/SaveTool_MainManager.cpp @@ -69,17 +69,50 @@ void SaveTool::drawManager() { ImGui::BeginGroup(); - drawGeneralInfo(); + if(ImGui::BeginChild("##GeneralProfileInfo", + {ImGui::GetContentRegionAvailWidth() * 0.60f, (ImGui::GetContentRegionAvail().y - ImGui::GetStyle().ItemSpacing.x) / 2.0f}, + true, ImGuiWindowFlags_MenuBar)) + { + if(ImGui::BeginMenuBar()) { + ImGui::TextUnformatted("General profile information"); + ImGui::EndMenuBar(); + } + + drawGeneralInfo(); + } + ImGui::EndChild(); ImGui::Dummy({0.0f, 0.0f}); - drawResearchInventory(); + if(ImGui::BeginChild("##ResearchInventory", + {ImGui::GetContentRegionAvailWidth() * 0.60f, 0.0f}, + true, ImGuiWindowFlags_MenuBar)) + { + if(ImGui::BeginMenuBar()) { + ImGui::TextUnformatted("Research inventory"); + ImGui::EndMenuBar(); + } + + drawResearchInventory(); + } + ImGui::EndChild(); ImGui::EndGroup(); ImGui::SameLine(); - drawMassManager(); + if(ImGui::BeginChild("##MASSManager", {0.0f, 0.0f}, + true, ImGuiWindowFlags_MenuBar)) + { + if(ImGui::BeginMenuBar()) { + ImGui::TextUnformatted("M.A.S.S. management"); + drawHelpMarker("To move, import, or export builds, drag-and-drop them."); + ImGui::EndMenuBar(); + } + + drawMassManager(); + } + ImGui::EndChild(); ImGui::End(); } @@ -163,19 +196,6 @@ void SaveTool::drawGeneralInfo() { return; } - if(!ImGui::BeginChild("##GeneralProfileInfo", - {ImGui::GetContentRegionAvailWidth() * 0.60f, (ImGui::GetContentRegionAvail().y - ImGui::GetStyle().ItemSpacing.x) / 2.0f}, - true, ImGuiWindowFlags_MenuBar)) - { - ImGui::EndChild(); - return; - } - - if(ImGui::BeginMenuBar()) { - ImGui::TextUnformatted("General profile information"); - ImGui::EndMenuBar(); - } - ImGui::Text("Credits: %i", _currentProfile->credits()); auto it = std::find_if(story_progress.begin(), story_progress.end(), @@ -277,8 +297,6 @@ void SaveTool::drawGeneralInfo() { } ImGui::EndPopup(); } - - ImGui::EndChild(); } void SaveTool::drawResearchInventory() { @@ -286,19 +304,6 @@ void SaveTool::drawResearchInventory() { return; } - if(!ImGui::BeginChild("##ResearchInventory", - {ImGui::GetContentRegionAvailWidth() * 0.60f, 0.0f}, - true, ImGuiWindowFlags_MenuBar)) - { - ImGui::EndChild(); - return; - } - - if(ImGui::BeginMenuBar()) { - ImGui::TextUnformatted("Research inventory"); - ImGui::EndMenuBar(); - } - #define unavRow(name) \ ImGui::TableNextRow(); \ ImGui::TableSetColumnIndex(0); \ @@ -392,8 +397,6 @@ void SaveTool::drawResearchInventory() { #undef unavRow #undef matRow - - ImGui::EndChild(); } void SaveTool::drawMassManager() { @@ -401,19 +404,6 @@ void SaveTool::drawMassManager() { return; } - if(!ImGui::BeginChild("##MASSManager", {0.0f, 0.0f}, - true, ImGuiWindowFlags_MenuBar)) - { - ImGui::EndChild(); - return; - } - - if(ImGui::BeginMenuBar()) { - ImGui::TextUnformatted("M.A.S.S. management"); - drawHelpMarker("To move, import, or export builds, drag-and-drop them."); - ImGui::EndMenuBar(); - } - static int mass_to_delete = 0; static ImGuiID mass_deletion_popup_ID = drawDeleteMassPopup(mass_to_delete); @@ -593,8 +583,6 @@ void SaveTool::drawMassManager() { } drawDeleteStagedMassPopup(staged_mass_to_delete.get()); - - ImGui::EndChild(); } auto SaveTool::drawDeleteMassPopup(int mass_index) -> ImGuiID {