diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp index b010d581..9d2ff656 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditor-imgui.cpp @@ -191,7 +191,7 @@ void TileSheetEditorImGui::draw(turbine::Context&) noexcept { ImGui::SameLine(); if (ImGui::Button("-", btnSize)) { const auto &activeSubsheetIdx = m_model.activeSubSheetIdx(); - if (activeSubsheetIdx.size() > 0) { + if (!activeSubsheetIdx.empty()) { m_model.rmSubsheet(activeSubsheetIdx); } } @@ -207,9 +207,9 @@ void TileSheetEditorImGui::draw(turbine::Context&) noexcept { static constexpr auto flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_NoBordersInBody; if (ImGui::BeginTable("Subsheets", 4, flags)) { ImGui::TableSetupColumn("Subsheet", ImGuiTableColumnFlags_NoHide); + ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_WidthFixed, 25); ImGui::TableSetupColumn("Columns", ImGuiTableColumnFlags_WidthFixed, 50); ImGui::TableSetupColumn("Rows", ImGuiTableColumnFlags_WidthFixed, 50); - ImGui::TableSetupColumn("ID", ImGuiTableColumnFlags_NoHide); ImGui::TableHeadersRow(); drawSubsheetSelector(m_view.img().subsheet, path); ImGui::EndTable(); @@ -223,6 +223,7 @@ void TileSheetEditorImGui::draw(turbine::Context&) noexcept { } void TileSheetEditorImGui::drawSubsheetSelector(TileSheet::SubSheet &subsheet, TileSheet::SubSheetIdx &path) { + constexpr auto indentReduce = 14; ImGui::TableNextRow(0, 5); using Str = ox::BasicString<100>; auto pathStr = ox::join("##", path).value; @@ -242,6 +243,8 @@ void TileSheetEditorImGui::drawSubsheetSelector(TileSheet::SubSheet &subsheet, T if (ImGui::IsMouseDoubleClicked(0) && ImGui::IsItemHovered()) { showSubsheetEditor(); } + ImGui::TableNextColumn(); + ImGui::Text("%d", subsheet.id); if (subsheet.subsheets.empty()) { ImGui::TableNextColumn(); ImGui::Text("%d", subsheet.columns); @@ -253,13 +256,13 @@ void TileSheetEditorImGui::drawSubsheetSelector(TileSheet::SubSheet &subsheet, T ImGui::TableNextColumn(); ImGui::Text("--"); } - ImGui::TableNextColumn(); - ImGui::Text("%d", subsheet.id); if (open) { for (auto i = 0ul; auto &child : subsheet.subsheets) { path.push_back(i); ImGui::PushID(static_cast(i)); + ImGui::Indent(-indentReduce); drawSubsheetSelector(child, path); + ImGui::Indent(indentReduce); ImGui::PopID(); path.pop_back(); ++i; diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.cpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.cpp index b0f4d8e7..414ef3aa 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.cpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.cpp @@ -213,7 +213,7 @@ bool TileSheetEditorModel::updated() const noexcept { return m_updated; } -ox::Error TileSheetEditorModel::markUpdatedCmdId(const studio::UndoCommand *cmd) noexcept { +ox::Error TileSheetEditorModel::markUpdatedCmdId(studio::UndoCommand const*cmd) noexcept { m_updated = true; const auto cmdId = cmd->commandId(); if (static_cast(cmdId) == CommandId::PaletteChange) { diff --git a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.hpp b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.hpp index 11bb0159..903398e5 100644 --- a/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.hpp +++ b/src/nostalgia/modules/core/src/studio/tilesheeteditor/tilesheeteditormodel.hpp @@ -105,7 +105,7 @@ class TileSheetEditorModel: public ox::SignalHandler { [[nodiscard]] bool updated() const noexcept; - ox::Error markUpdatedCmdId(const studio::UndoCommand *cmd) noexcept; + ox::Error markUpdatedCmdId(studio::UndoCommand const*cmd) noexcept; ox::Error markUpdated() noexcept; @@ -118,10 +118,9 @@ class TileSheetEditorModel: public ox::SignalHandler { bool pixelSelected(std::size_t idx) const noexcept; - protected: + private: void getFillPixels(bool *pixels, ox::Point const&pt, int oldColor) const noexcept; - private: void pushCommand(studio::UndoCommand *cmd) noexcept; };