[nostalgia/core/studio] Cleanup

This commit is contained in:
2022-12-17 14:05:35 -06:00
parent 9b36381b00
commit 716b3d6022
2 changed files with 14 additions and 15 deletions
@@ -20,7 +20,7 @@ ox::Result<PaletteEditorImGui*> PaletteEditorImGui::make(Context *ctx, const ox:
const auto lastSlash = std::find(out->m_itemPath.rbegin(), out->m_itemPath.rend(), '/').offset();
out->m_itemName = out->m_itemPath.substr(lastSlash + 1);
oxRequire(pal, core::readObj<Palette>(out->m_ctx, out->m_itemPath));
out->m_pal = *pal.get();
out->m_pal = *pal;
return out.release();
}
@@ -45,20 +45,20 @@ void PaletteEditorImGui::draw(core::Context*) noexcept {
{
const auto sz = ImVec2(70, 24);
if (ImGui::Button("Add", sz)) {
undoStack()->push(new AddColorCommand(&m_pal, 0, m_pal.colors.size()));
undoStack()->push(ox::make<AddColorCommand>(&m_pal, 0, m_pal.colors.size()));
}
ImGui::SameLine();
ImGui::BeginDisabled(m_selectedRow >= m_pal.colors.size());
{
if (ImGui::Button("Remove", sz)) {
undoStack()->push(new RemoveColorCommand(&m_pal, m_pal.colors[static_cast<std::size_t>(m_selectedRow)], m_selectedRow));
undoStack()->push(ox::make<RemoveColorCommand>(&m_pal, m_pal.colors[static_cast<std::size_t>(m_selectedRow)], m_selectedRow));
m_selectedRow = ox::min(m_pal.colors.size() - 1, m_selectedRow);
}
ImGui::SameLine();
ImGui::BeginDisabled(m_selectedRow <= 0);
{
if (ImGui::Button("Move Up", sz)) {
undoStack()->push(new MoveColorCommand(&m_pal, m_selectedRow, -1));
undoStack()->push(ox::make<MoveColorCommand>(&m_pal, m_selectedRow, -1));
--m_selectedRow;
}
}
@@ -67,7 +67,7 @@ void PaletteEditorImGui::draw(core::Context*) noexcept {
ImGui::BeginDisabled(m_selectedRow >= m_pal.colors.size() - 1);
{
if (ImGui::Button("Move Down", sz)) {
undoStack()->push(new MoveColorCommand(&m_pal, m_selectedRow, 1));
undoStack()->push(ox::make<MoveColorCommand>(&m_pal, m_selectedRow, 1));
++m_selectedRow;
}
}
@@ -127,7 +127,7 @@ void PaletteEditorImGui::draw(core::Context*) noexcept {
ImGui::InputInt("Blue", &b, 1, 5);
const auto newColor = color16(r, g, b, a);
if (c != newColor) {
undoStack()->push(new UpdateColorCommand(&m_pal, m_selectedRow, c, newColor));
undoStack()->push(ox::make<UpdateColorCommand>(&m_pal, m_selectedRow, c, newColor));
}
}
ImGui::EndChild();