Esempio n. 1
0
    void redo() {
        if (_redoStack.empty()) {
            rMessage() << "Redo: no redo available" << std::endl;
        }
        else {
            Operation* operation = _redoStack.back();
            rMessage() << "Redo: " << operation->_command << std::endl;

            startUndo();
            trackersRedo();
            operation->_snapshot.restore();
            finishUndo(operation->_command);
            _redoStack.pop_back();

            for (Observers::iterator i = _observers.begin(); i != _observers.end(); /* in-loop */) {
                Observer* observer = *(i++);
                observer->postRedo();
            }

            // Trigger the onPostUndo event on all scene nodes
            PostRedoWalker walker;
            GlobalSceneGraph().root()->traverse(walker);

            GlobalSceneGraph().sceneChanged();
        }
    }
Esempio n. 2
0
 // greebo: This finishes the current operation and
 // removes it instantly from the stack
 void cancel() {
     // Try to add the last operation as "temp"
     if (finishUndo("$TEMPORARY")) {
         // Instantly remove the added operation
         _undoStack.pop_back();
     }
 }