[studio,nostalgia/studio] Make executing UndoCommands report errors
This commit is contained in:
@@ -79,13 +79,13 @@ void PaletteEditorImGui::drawColorsEditor() noexcept {
|
||||
if (ImGui::Button("Add", sz)) {
|
||||
auto const colorSz = static_cast<int>(colors(m_pal, m_page));
|
||||
constexpr Color16 c = 0;
|
||||
undoStack()->push(ox::make_unique<AddColorCommand>(&m_pal, c, m_page, colorSz));
|
||||
std::ignore = undoStack()->push(ox::make_unique<AddColorCommand>(&m_pal, c, m_page, colorSz));
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginDisabled(m_selectedColorRow >= colors(m_pal, m_page));
|
||||
{
|
||||
if (ImGui::Button("Remove", sz)) {
|
||||
undoStack()->push(
|
||||
std::ignore = undoStack()->push(
|
||||
ox::make_unique<RemoveColorCommand>(
|
||||
&m_pal,
|
||||
color(m_pal, m_page, static_cast<std::size_t>(m_selectedColorRow)),
|
||||
@@ -97,7 +97,7 @@ void PaletteEditorImGui::drawColorsEditor() noexcept {
|
||||
ImGui::BeginDisabled(m_selectedColorRow <= 0);
|
||||
{
|
||||
if (ImGui::Button("Move Up", sz)) {
|
||||
undoStack()->push(ox::make_unique<MoveColorCommand>(&m_pal, m_page, m_selectedColorRow, -1));
|
||||
std::ignore = undoStack()->push(ox::make_unique<MoveColorCommand>(&m_pal, m_page, m_selectedColorRow, -1));
|
||||
--m_selectedColorRow;
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@ void PaletteEditorImGui::drawColorsEditor() noexcept {
|
||||
ImGui::BeginDisabled(m_selectedColorRow >= colors(m_pal, m_page) - 1);
|
||||
{
|
||||
if (ImGui::Button("Move Down", sz)) {
|
||||
undoStack()->push(ox::make_unique<MoveColorCommand>(&m_pal, m_page, m_selectedColorRow, 1));
|
||||
std::ignore = undoStack()->push(ox::make_unique<MoveColorCommand>(&m_pal, m_page, m_selectedColorRow, 1));
|
||||
++m_selectedColorRow;
|
||||
}
|
||||
}
|
||||
@@ -155,17 +155,17 @@ void PaletteEditorImGui::drawPagesEditor() noexcept {
|
||||
constexpr auto toolbarHeight = 40;
|
||||
auto const btnSz = ImVec2(paneSz.x / 3 - 5.5f, 24);
|
||||
if (ImGui::Button("Add", btnSz)) {
|
||||
undoStack()->push(ox::make_unique<AddPageCommand>(m_pal));
|
||||
std::ignore = undoStack()->push(ox::make_unique<AddPageCommand>(m_pal));
|
||||
m_page = m_pal.pages.size() - 1;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Remove", btnSz)) {
|
||||
undoStack()->push(ox::make_unique<RemovePageCommand>(m_pal, m_page));
|
||||
std::ignore = undoStack()->push(ox::make_unique<RemovePageCommand>(m_pal, m_page));
|
||||
m_page = std::min(m_page, m_pal.pages.size() - 1);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Duplicate", btnSz)) {
|
||||
undoStack()->push(ox::make_unique<DuplicatePageCommand>(m_pal, m_page, m_pal.pages.size()));
|
||||
std::ignore = undoStack()->push(ox::make_unique<DuplicatePageCommand>(m_pal, m_page, m_pal.pages.size()));
|
||||
}
|
||||
ImGui::BeginTable("PageSelect", 2, tableFlags, ImVec2(paneSz.x, paneSz.y - (toolbarHeight + 5)));
|
||||
{
|
||||
@@ -198,7 +198,7 @@ void PaletteEditorImGui::drawColorEditor() noexcept {
|
||||
ImGui::InputInt("Blue", &b, 1, 5);
|
||||
auto const newColor = color16(r, g, b, a);
|
||||
if (c != newColor) {
|
||||
undoStack()->push(ox::make_unique<UpdateColorCommand>(
|
||||
std::ignore = undoStack()->push(ox::make_unique<UpdateColorCommand>(
|
||||
&m_pal, m_page, static_cast<int>(m_selectedColorRow), c, newColor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ void TileSheetEditorModel::getFillPixels(bool *pixels, ox::Point const&pt, int o
|
||||
}
|
||||
|
||||
void TileSheetEditorModel::pushCommand(studio::UndoCommand *cmd) noexcept {
|
||||
m_undoStack.push(ox::UPtr<studio::UndoCommand>(cmd));
|
||||
std::ignore = m_undoStack.push(ox::UPtr<studio::UndoCommand>(cmd));
|
||||
m_ongoingDrawCommand = dynamic_cast<DrawCommand*>(cmd);
|
||||
m_updated = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user