[nostalgia,studio] Cleanup

This commit is contained in:
2023-12-10 17:03:51 -06:00
parent 8c9ebbedae
commit 3ac3b7b5e6
35 changed files with 98 additions and 102 deletions

View File

@@ -30,7 +30,7 @@ ox::CStringView PaletteEditorImGui::itemDisplayName() const noexcept {
return m_itemName;
}
void PaletteEditorImGui::draw(turbine::Context*) noexcept {
void PaletteEditorImGui::draw(turbine::Context&) noexcept {
static constexpr auto flags = ImGuiTableFlags_RowBg;
const auto paneSize = ImGui::GetContentRegionAvail();
ImGui::BeginChild("Colors", ImVec2(paneSize.x - 208, paneSize.y), true);
@@ -42,14 +42,14 @@ void PaletteEditorImGui::draw(turbine::Context*) noexcept {
if (ImGui::Button("Add", sz)) {
const auto colorSz = static_cast<int>(m_pal.colors.size());
constexpr Color16 c = 0;
undoStack()->push(ox::make<AddColorCommand>(&m_pal, c, colorSz));
undoStack()->push(ox::make_unique<AddColorCommand>(&m_pal, c, colorSz));
}
ImGui::SameLine();
ImGui::BeginDisabled(m_selectedRow >= m_pal.colors.size());
{
if (ImGui::Button("Remove", sz)) {
undoStack()->push(
ox::make<RemoveColorCommand>(
ox::make_unique<RemoveColorCommand>(
&m_pal,
m_pal.colors[static_cast<std::size_t>(m_selectedRow)],
static_cast<int>(m_selectedRow)));
@@ -59,7 +59,7 @@ void PaletteEditorImGui::draw(turbine::Context*) noexcept {
ImGui::BeginDisabled(m_selectedRow <= 0);
{
if (ImGui::Button("Move Up", sz)) {
undoStack()->push(ox::make<MoveColorCommand>(&m_pal, m_selectedRow, -1));
undoStack()->push(ox::make_unique<MoveColorCommand>(&m_pal, m_selectedRow, -1));
--m_selectedRow;
}
}
@@ -68,7 +68,7 @@ void PaletteEditorImGui::draw(turbine::Context*) noexcept {
ImGui::BeginDisabled(m_selectedRow >= m_pal.colors.size() - 1);
{
if (ImGui::Button("Move Down", sz)) {
undoStack()->push(ox::make<MoveColorCommand>(&m_pal, m_selectedRow, 1));
undoStack()->push(ox::make_unique<MoveColorCommand>(&m_pal, m_selectedRow, 1));
++m_selectedRow;
}
}
@@ -131,7 +131,7 @@ void PaletteEditorImGui::draw(turbine::Context*) noexcept {
ImGui::InputInt("Blue", &b, 1, 5);
const auto newColor = color16(r, g, b, a);
if (c != newColor) {
undoStack()->push(ox::make<UpdateColorCommand>(&m_pal, static_cast<int>(m_selectedRow), c, newColor));
undoStack()->push(ox::make_unique<UpdateColorCommand>(&m_pal, static_cast<int>(m_selectedRow), c, newColor));
}
}
ImGui::EndChild();

View File

@@ -30,7 +30,7 @@ class PaletteEditorImGui: public studio::Editor {
ox::CStringView itemDisplayName() const noexcept final;
void draw(turbine::Context*) noexcept final;
void draw(turbine::Context&) noexcept final;
protected:
ox::Error saveItem() noexcept final;

View File

@@ -106,7 +106,7 @@ void TileSheetEditorImGui::keyStateChanged(turbine::Key key, bool down) {
}
}
void TileSheetEditorImGui::draw(turbine::Context*) noexcept {
void TileSheetEditorImGui::draw(turbine::Context&) noexcept {
const auto paneSize = ImGui::GetContentRegionAvail();
const auto tileSheetParentSize = ImVec2(paneSize.x - m_palViewWidth, paneSize.y);
const auto fbSize = ox::Vec2(tileSheetParentSize.x - 16, tileSheetParentSize.y - 16);

View File

@@ -73,7 +73,7 @@ class TileSheetEditorImGui: public studio::BaseEditor {
void keyStateChanged(turbine::Key key, bool down) override;
void draw(turbine::Context*) noexcept override;
void draw(turbine::Context&) noexcept override;
void drawSubsheetSelector(TileSheet::SubSheet*, TileSheet::SubSheetIdx *path);

View File

@@ -281,7 +281,7 @@ void TileSheetEditorModel::getFillPixels(bool *pixels, ox::Point const&pt, int o
}
void TileSheetEditorModel::pushCommand(studio::UndoCommand *cmd) noexcept {
m_undoStack.push(cmd);
m_undoStack.push(ox::UPtr<studio::UndoCommand>(cmd));
m_ongoingDrawCommand = dynamic_cast<DrawCommand*>(cmd);
m_updated = true;
}