41 return !undoStack->empty();
46 return !redoStack->empty();
51 std::shared_ptr<std::vector<controller::OperationPtr> > toUndo;
55 toUndo = undoStack->back()->undo();
56 redoStack->push_back(undoStack->back());
57 undoStack->pop_back();
62 toUndo.reset(
new std::vector<controller::OperationPtr>());
70 std::shared_ptr<std::vector<controller::OperationPtr> > toRedo;
74 toRedo = redoStack->back()->redo();
75 undoStack->push_back(redoStack->back());
76 redoStack->pop_back();
80 toRedo.reset(
new std::vector<controller::OperationPtr>());
89 undoStack->push_back(action);
93 redoStack.reset(
new std::vector<UndoActionPtr>());
99 for (
auto it = undoStack->begin(); it != undoStack->end(); it++)
101 for (
auto ito = it->get()->getOperations()->begin(); ito != it->get()->getOperations()->end(); ito++)
103 if (ito->get()->getObjectId() == oldId)
105 ito->get()->setObjectId(
newId);
107 else if (ito->get()->getObjectId() ==
newId)
109 ito->get()->setObjectId(oldId);
114 for (
auto it = redoStack->begin(); it != redoStack->end(); it++)
116 for (
auto ito = it->get()->getOperations()->begin(); ito != it->get()->getOperations()->end(); ito++)
118 if (ito->get()->getObjectId() == oldId)
120 ito->get()->setObjectId(
newId);
122 else if (ito->get()->getObjectId() ==
newId)
124 ito->get()->setObjectId(oldId);
132 redoStack.reset(
new std::vector<UndoActionPtr>());
133 undoStack.reset(
new std::vector<UndoActionPtr>());