Refactor GraphicsEditor tab handling for improved readability and structure

This commit is contained in:
scawful
2024-11-10 16:58:34 -05:00
parent 011fa65b4d
commit 42db41ebae

View File

@@ -54,25 +54,24 @@ constexpr ImGuiTableFlags kGfxEditFlags = ImGuiTableFlags_Reorderable |
ImGuiTableFlags_SizingStretchSame;
absl::Status GraphicsEditor::Update() {
TAB_BAR("##TabBar")
if (ImGui::BeginTabBar("##TabBar")) {
status_ = UpdateGfxEdit();
TAB_ITEM("Sheet Browser")
if (asset_browser_.Initialized == false) {
asset_browser_.Initialize(rom()->gfx_sheets());
}
asset_browser_.Draw(rom()->gfx_sheets());
END_TAB_ITEM()
status_ = UpdateScadView();
status_ = UpdateLinkGfxView();
END_TAB_BAR()
ImGui::EndTabBar();
}
CLEAR_AND_RETURN_STATUS(status_)
return absl::OkStatus();
}
absl::Status GraphicsEditor::UpdateGfxEdit() {
TAB_ITEM("Sheet Editor")
if (ImGui::BeginTabItem("Sheet Editor")) {
if (ImGui::BeginTable("##GfxEditTable", 3, kGfxEditTableFlags,
ImVec2(0, 0))) {
for (const auto& name :
@@ -97,7 +96,8 @@ absl::Status GraphicsEditor::UpdateGfxEdit() {
}
ImGui::EndTable();
END_TAB_ITEM()
ImGui::EndTabItem();
}
return absl::OkStatus();
}