From 941bc71348c3f3065847ba2ea22856f605b17deb Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Mon, 28 Oct 2024 20:56:02 -0500 Subject: [PATCH 1/2] [studio] Fix NewMenu name input --- src/olympic/studio/applib/src/newmenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/olympic/studio/applib/src/newmenu.cpp b/src/olympic/studio/applib/src/newmenu.cpp index 35b282b8..91480554 100644 --- a/src/olympic/studio/applib/src/newmenu.cpp +++ b/src/olympic/studio/applib/src/newmenu.cpp @@ -77,7 +77,7 @@ void NewMenu::drawNewItemName(studio::StudioContext &sctx) noexcept { drawWindow(sctx.tctx, &m_open, [this, &sctx] { auto const typeIdx = static_cast(m_selectedType); if (typeIdx < m_types.size()) { - ImGui::InputText("Name", m_itemName.data(), m_itemName.cap()); + ig::InputText("Name", m_itemName); } drawLastPageButtons(sctx); }); From 3c7652efc205cb3acdb993d7eeb1e2c2d894c2cb Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Mon, 28 Oct 2024 20:57:21 -0500 Subject: [PATCH 2/2] [nostalgia/core/studio] Fix PaletteEditor to handle Palettes with 0 pages --- .../paletteeditor/paletteeditor-imgui.cpp | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp index b782709f..5355da47 100644 --- a/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp +++ b/src/nostalgia/modules/core/src/studio/paletteeditor/paletteeditor-imgui.cpp @@ -154,22 +154,24 @@ void PaletteEditorImGui::drawColorsEditor() noexcept { ImGui::TableSetupColumn("Blue", ImGuiTableColumnFlags_WidthFixed, 40); ImGui::TableSetupColumn("Preview", ImGuiTableColumnFlags_NoHide); ImGui::TableHeadersRow(); - for (auto i = 0u; auto const&c : m_pal.pages[m_page].colors) { - ig::IDStackItem const idStackItem(static_cast(i)); - ImGui::TableNextRow(); - drawColumn(i + 1); - drawColumnLeftAlign(m_pal.colorNames[i]); - drawColumn(red16(c)); - drawColumn(green16(c)); - drawColumn(blue16(c)); - ImGui::TableNextColumn(); - auto const ic = ImGui::GetColorU32({redf(c), greenf(c), bluef(c), 1}); - ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, ic); - if (ImGui::Selectable( - "##ColorRow", i == m_selectedColorRow, ImGuiSelectableFlags_SpanAllColumns)) { - m_selectedColorRow = i; + if (m_page < m_pal.pages.size()) { + for (auto i = 0u; auto const &c: m_pal.pages[m_page].colors) { + ig::IDStackItem const idStackItem(static_cast(i)); + ImGui::TableNextRow(); + drawColumn(i + 1); + drawColumnLeftAlign(m_pal.colorNames[i]); + drawColumn(red16(c)); + drawColumn(green16(c)); + drawColumn(blue16(c)); + ImGui::TableNextColumn(); + auto const ic = ImGui::GetColorU32({redf(c), greenf(c), bluef(c), 1}); + ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, ic); + if (ImGui::Selectable( + "##ColorRow", i == m_selectedColorRow, ImGuiSelectableFlags_SpanAllColumns)) { + m_selectedColorRow = i; + } + ++i; } - ++i; } } ImGui::EndTable();