[nostalgia/core/studio] Add Name to colors table in PaletteEditor
All checks were successful
Build / build (push) Successful in 2m31s

This commit is contained in:
Gary Talent 2024-05-30 23:05:37 -05:00
parent bfd4bc3c41
commit ababc2a736
2 changed files with 14 additions and 5 deletions

View File

@ -65,6 +65,11 @@ ox::Error PaletteEditorImGui::saveItem() noexcept {
return m_sctx.project->writeObj(itemPath(), m_pal, ox::ClawFormat::Organic);
}
void PaletteEditorImGui::drawColumnLeftAlign(ox::CStringView txt) noexcept {
ImGui::TableNextColumn();
ImGui::Text("%s", txt.c_str());
}
void PaletteEditorImGui::drawColumn(ox::CStringView txt) noexcept {
ImGui::TableNextColumn();
ImGui::SetCursorPosX(
@ -119,20 +124,22 @@ void PaletteEditorImGui::drawColorsEditor() noexcept {
* static_cast<float>(colorEditor);
ImGui::BeginTable(
"Colors",
5,
6,
tableFlags,
ImVec2(tblWidth, colorsSz.y - (toolbarHeight + 5)));
{
ImGui::TableSetupColumn("Idx", ImGuiTableColumnFlags_WidthFixed, 25);
ImGui::TableSetupColumn("Red", ImGuiTableColumnFlags_WidthFixed, 50);
ImGui::TableSetupColumn("Green", ImGuiTableColumnFlags_WidthFixed, 50);
ImGui::TableSetupColumn("Blue", ImGuiTableColumnFlags_WidthFixed, 50);
ImGui::TableSetupColumn("Color Preview", ImGuiTableColumnFlags_NoHide);
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, 100);
ImGui::TableSetupColumn("Red", ImGuiTableColumnFlags_WidthFixed, 40);
ImGui::TableSetupColumn("Green", ImGuiTableColumnFlags_WidthFixed, 40);
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]) {
ImGui::PushID(static_cast<int>(i));
ImGui::TableNextRow();
drawColumn(i + 1);
drawColumnLeftAlign(m_pal.colorInfo[i].name);
drawColumn(red16(c));
drawColumn(green16(c));
drawColumn(blue16(c));

View File

@ -31,6 +31,8 @@ class PaletteEditorImGui: public studio::Editor {
ox::Error saveItem() noexcept final;
private:
static void drawColumnLeftAlign(ox::CStringView txt) noexcept;
static void drawColumn(ox::CStringView txt) noexcept;
static void drawColumn(ox::Integer_c auto i) noexcept {