diff --git a/src/commands/cmd_redo.cpp b/src/commands/cmd_redo.cpp index fa00ad014..2a886ce85 100644 --- a/src/commands/cmd_redo.cpp +++ b/src/commands/cmd_redo.cpp @@ -60,7 +60,7 @@ void RedoCommand::onExecute(Context* context) ->showTip(1000, "Redid %s", undo_get_next_redo_label(sprite->getUndo())); - undo_do_redo(sprite->getUndo()); + sprite->getUndo()->doRedo(); sprite->generateMaskBoundaries(); update_screen_for_sprite(sprite); } diff --git a/src/commands/cmd_undo.cpp b/src/commands/cmd_undo.cpp index cc8c13559..dcea6c519 100644 --- a/src/commands/cmd_undo.cpp +++ b/src/commands/cmd_undo.cpp @@ -60,7 +60,7 @@ void UndoCommand::onExecute(Context* context) ->showTip(1000, "Undid %s", undo_get_next_undo_label(sprite->getUndo())); - undo_do_undo(sprite->getUndo()); + sprite->getUndo()->doUndo(); sprite->generateMaskBoundaries(); update_screen_for_sprite(sprite); } diff --git a/src/dialogs/aniedit.cpp b/src/dialogs/aniedit.cpp index 2b01c9de3..b99157a12 100644 --- a/src/dialogs/aniedit.cpp +++ b/src/dialogs/aniedit.cpp @@ -702,7 +702,7 @@ static bool anieditor_msg_proc(JWidget widget, JMessage msg) const SpriteReader sprite((Sprite*)anieditor->sprite); if (sprite->getUndo()->canUndo()) { SpriteWriter sprite_writer(sprite); - undo_do_undo(sprite_writer->getUndo()); + sprite_writer->getUndo()->doUndo(); destroy_thumbnails(); anieditor_regenerate_layers(widget); @@ -717,7 +717,7 @@ static bool anieditor_msg_proc(JWidget widget, JMessage msg) const SpriteReader sprite((Sprite*)anieditor->sprite); if (sprite->getUndo()->canRedo()) { SpriteWriter sprite_writer(sprite); - undo_do_redo(sprite_writer->getUndo()); + sprite_writer->getUndo()->doRedo(); destroy_thumbnails(); anieditor_regenerate_layers(widget); diff --git a/src/raster/undo.cpp b/src/raster/undo.cpp index b1bc6891a..8586850e7 100644 --- a/src/raster/undo.cpp +++ b/src/raster/undo.cpp @@ -327,16 +327,14 @@ bool Undo::canRedo() const ////////////////////////////////////////////////////////////////////// // General undo routines -void undo_do_undo(Undo* undo) +void Undo::doUndo() { - ASSERT(undo); - run_undo(undo, DO_UNDO); + run_undo(this, DO_UNDO); } -void undo_do_redo(Undo* undo) +void Undo::doRedo() { - ASSERT(undo); - run_undo(undo, DO_REDO); + run_undo(this, DO_REDO); } void undo_clear_redo(Undo* undo) diff --git a/src/raster/undo.h b/src/raster/undo.h index 3eab2e9d8..1ffbc2b83 100644 --- a/src/raster/undo.h +++ b/src/raster/undo.h @@ -63,10 +63,10 @@ public: bool canUndo() const; bool canRedo() const; -}; + void doUndo(); + void doRedo(); -void undo_do_undo(Undo* undo); -void undo_do_redo(Undo* undo); +}; void undo_clear_redo(Undo* undo); diff --git a/src/undoable.cpp b/src/undoable.cpp index b640d1a97..72578fc31 100644 --- a/src/undoable.cpp +++ b/src/undoable.cpp @@ -65,7 +65,7 @@ Undoable::~Undoable() // if it isn't committed, we have to rollback all changes if (!m_committed) { // undo the group of operations - undo_do_undo(m_sprite->getUndo()); + m_sprite->getUndo()->doUndo(); // clear the redo (sorry to the user, here we lost the old redo // information)