SaveTool: reorganise some code.

This commit is contained in:
Guillaume Jacquemin 2021-06-20 23:48:23 +02:00
parent 9fb654c89d
commit 057185cb65

View file

@ -69,17 +69,50 @@ void SaveTool::drawManager() {
ImGui::BeginGroup(); 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}); 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::EndGroup();
ImGui::SameLine(); 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(); ImGui::End();
} }
@ -163,19 +196,6 @@ void SaveTool::drawGeneralInfo() {
return; 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()); ImGui::Text("Credits: %i", _currentProfile->credits());
auto it = std::find_if(story_progress.begin(), story_progress.end(), auto it = std::find_if(story_progress.begin(), story_progress.end(),
@ -277,8 +297,6 @@ void SaveTool::drawGeneralInfo() {
} }
ImGui::EndPopup(); ImGui::EndPopup();
} }
ImGui::EndChild();
} }
void SaveTool::drawResearchInventory() { void SaveTool::drawResearchInventory() {
@ -286,19 +304,6 @@ void SaveTool::drawResearchInventory() {
return; 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) \ #define unavRow(name) \
ImGui::TableNextRow(); \ ImGui::TableNextRow(); \
ImGui::TableSetColumnIndex(0); \ ImGui::TableSetColumnIndex(0); \
@ -392,8 +397,6 @@ void SaveTool::drawResearchInventory() {
#undef unavRow #undef unavRow
#undef matRow #undef matRow
ImGui::EndChild();
} }
void SaveTool::drawMassManager() { void SaveTool::drawMassManager() {
@ -401,19 +404,6 @@ void SaveTool::drawMassManager() {
return; 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 int mass_to_delete = 0;
static ImGuiID mass_deletion_popup_ID = drawDeleteMassPopup(mass_to_delete); static ImGuiID mass_deletion_popup_ID = drawDeleteMassPopup(mass_to_delete);
@ -593,8 +583,6 @@ void SaveTool::drawMassManager() {
} }
drawDeleteStagedMassPopup(staged_mass_to_delete.get()); drawDeleteStagedMassPopup(staged_mass_to_delete.get());
ImGui::EndChild();
} }
auto SaveTool::drawDeleteMassPopup(int mass_index) -> ImGuiID { auto SaveTool::drawDeleteMassPopup(int mass_index) -> ImGuiID {