Refactor undo_do_undo/redo -> Undo::doUndo/Redo.

This commit is contained in:
David Capello 2010-09-19 16:25:18 -03:00
parent b3546cda94
commit 85766ea915
6 changed files with 12 additions and 14 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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)