diff options
author | Marcelo Fernandez <marcelofg55@gmail.com> | 2018-05-26 23:41:19 -0300 |
---|---|---|
committer | Marcelo Fernandez <marcelofg55@gmail.com> | 2018-05-27 12:53:52 -0300 |
commit | e9db8964e39cdeae6ebbfd314f3e68b6954400c5 (patch) | |
tree | 0f41c6af6e412ffc3584b4bee74d9e462bd47605 /core | |
parent | 130fd6bcb88d7b297b13c3ed20a715b5ab9cce47 (diff) |
Add a message when there is nothing to Undo or Redo
Diffstat (limited to 'core')
-rw-r--r-- | core/undo_redo.cpp | 16 | ||||
-rw-r--r-- | core/undo_redo.h | 4 |
2 files changed, 12 insertions, 8 deletions
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index b3f9dd818d..b9a2fdd0ac 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -299,26 +299,30 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) { } } -void UndoRedo::redo() { +bool UndoRedo::redo() { - ERR_FAIL_COND(action_level > 0); + ERR_FAIL_COND_V(action_level > 0, false); if ((current_action + 1) >= actions.size()) - return; //nothing to redo + return false; //nothing to redo current_action++; _process_operation_list(actions[current_action].do_ops.front()); version++; + + return true; } -void UndoRedo::undo() { +bool UndoRedo::undo() { - ERR_FAIL_COND(action_level > 0); + ERR_FAIL_COND_V(action_level > 0, false); if (current_action < 0) - return; //nothing to redo + return false; //nothing to redo _process_operation_list(actions[current_action].undo_ops.front()); current_action--; version--; + + return true; } void UndoRedo::clear_history() { diff --git a/core/undo_redo.h b/core/undo_redo.h index a373296b73..3a17c78851 100644 --- a/core/undo_redo.h +++ b/core/undo_redo.h @@ -109,8 +109,8 @@ public: void commit_action(); - void redo(); - void undo(); + bool redo(); + bool undo(); String get_current_action_name() const; void clear_history(); |