コード例 #1
0
ファイル: UndoSystem.cpp プロジェクト: stiffsen/DarkRadiant
    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();
        }
    }
コード例 #2
0
ファイル: UndoSystem.cpp プロジェクト: stiffsen/DarkRadiant
 // 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();
     }
 }