[nostalgia/core/studio] Remove unnecessary netsting level in PaletteEditor

This commit is contained in:
Gary Talent 2023-07-15 13:16:05 -05:00
parent ddcb53a535
commit 9ceb1df49e

View File

@ -42,13 +42,10 @@ const ox::String &PaletteEditorImGui::itemDisplayName() const noexcept {
void PaletteEditorImGui::draw(turbine::Context*) noexcept {
static constexpr auto flags = ImGuiTableFlags_RowBg;
const auto paneSize = ImGui::GetContentRegionAvail();
ImGui::BeginChild("PaletteEditor");
{
ImGui::BeginChild("Colors", ImVec2(paneSize.x - 200, paneSize.y), false);
ImGui::BeginChild("Colors", ImVec2(paneSize.x - 208, paneSize.y), true);
{
const auto colorsSz = ImGui::GetContentRegionAvail();
static constexpr auto toolbarHeight = 40;
ImGui::BeginChild("Toolbar", ImVec2(colorsSz.x, toolbarHeight), true);
{
const auto sz = ImVec2(70, 24);
if (ImGui::Button("Add", sz)) {
@ -60,7 +57,11 @@ void PaletteEditorImGui::draw(turbine::Context*) noexcept {
ImGui::BeginDisabled(m_selectedRow >= m_pal.colors.size());
{
if (ImGui::Button("Remove", sz)) {
undoStack()->push(ox::make<RemoveColorCommand>(&m_pal, m_pal.colors[static_cast<std::size_t>(m_selectedRow)], static_cast<int>(m_selectedRow)));
undoStack()->push(
ox::make<RemoveColorCommand>(
&m_pal,
m_pal.colors[static_cast<std::size_t>(m_selectedRow)],
static_cast<int>(m_selectedRow)));
m_selectedRow = ox::min(m_pal.colors.size() - 1, m_selectedRow);
}
ImGui::SameLine();
@ -84,7 +85,6 @@ void PaletteEditorImGui::draw(turbine::Context*) noexcept {
}
ImGui::EndDisabled();
}
ImGui::EndChild();
ImGui::BeginTable("Colors", 5, flags, ImVec2(colorsSz.x, colorsSz.y - (toolbarHeight + 5)));
{
ImGui::TableSetupColumn("Idx", ImGuiTableColumnFlags_WidthFixed, 25);
@ -141,8 +141,6 @@ void PaletteEditorImGui::draw(turbine::Context*) noexcept {
}
ImGui::EndChild();
}
}
ImGui::EndChild();
}
ox::Error PaletteEditorImGui::saveItem() noexcept {