summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorMax Hilbrunner <mhilbrunner@users.noreply.github.com>2018-07-03 17:32:16 +0200
committerGitHub <noreply@github.com>2018-07-03 17:32:16 +0200
commitfb838bf1b4cf4ecb8e8e7d1039f1342b1d977ef2 (patch)
treeb91843c6318dbd122c976573e47f40b9f0588583 /core
parent6d0ade54c0f4216067cd421cae91ec1e4ac6725e (diff)
parente9db8964e39cdeae6ebbfd314f3e68b6954400c5 (diff)
Merge pull request #19192 from marcelofg55/undo_redo_msg
Add a message when there is nothing to Undo or Redo
Diffstat (limited to 'core')
-rw-r--r--core/undo_redo.cpp16
-rw-r--r--core/undo_redo.h4
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();