MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / undo

Method undo

radiantcore/undo/UndoSystem.cpp:74–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74void UndoSystem::undo()
75{
76 if (_undoStack.empty())
77 {
78 rMessage() << "Undo: no undo available" << std::endl;
79 return;
80 }
81
82 if (operationStarted())
83 {
84 rWarning() << "Undo not available while an operation is still in progress" << std::endl;
85 return;
86 }
87
88 const auto& operation = _undoStack.back();
89 auto operationName = operation->getName(); // copy this name, we need it after op destruction
90 rMessage() << "Undo: " << operationName << std::endl;
91
92 startRedo();
93 operation->restoreSnapshot();
94 finishRedo(operationName);
95 _undoStack.pop_back();
96 _eventSignal.emit(EventType::OperationUndone, operationName);
97}
98
99void UndoSystem::redo()
100{

Callers 4

TEST_FFunction · 0.80
TEST_FFunction · 0.80
TEST_FFunction · 0.80
undoCmdMethod · 0.80

Calls 7

rMessageFunction · 0.85
rWarningFunction · 0.85
backMethod · 0.80
restoreSnapshotMethod · 0.80
emptyMethod · 0.45
getNameMethod · 0.45
pop_backMethod · 0.45

Tested by 1

TEST_FFunction · 0.64