summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2021-08-17 11:41:46 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2021-08-17 21:11:10 +0800
commit16c2d4ef22a2928489934833bab06d5ea33bd90e (patch)
treefd4bc91870e0684e1fa668eaeed24c55a733e870 /core
parentca6c5cf7e6252558d8791d41b8b757929ac3819c (diff)
Improve Undo/Redo menu items
* Make Undo/Redo menu items disabled when clicking it does nothing. * Context menu of `TextEdit` * Context menu of `LineEdit` * Editor's Scene menu * Script editor's Edit menu and context menu (for Script and Text) * Make editor undo/redo log messages translatable. * Mark `UndoRedo`'s `has_{un,re}do()` methods as `const`. * Expose `TextEdit`'s `has_{un,re}do()` to scripts since `{un,re}do()` are already available.
Diffstat (limited to 'core')
-rw-r--r--core/object/undo_redo.cpp4
-rw-r--r--core/object/undo_redo.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/core/object/undo_redo.cpp b/core/object/undo_redo.cpp
index adf068eb2f..b7d2bac96d 100644
--- a/core/object/undo_redo.cpp
+++ b/core/object/undo_redo.cpp
@@ -405,11 +405,11 @@ String UndoRedo::get_current_action_name() const {
return actions[current_action].name;
}
-bool UndoRedo::has_undo() {
+bool UndoRedo::has_undo() const {
return current_action >= 0;
}
-bool UndoRedo::has_redo() {
+bool UndoRedo::has_redo() const {
return (current_action + 1) < actions.size();
}
diff --git a/core/object/undo_redo.h b/core/object/undo_redo.h
index 8f009830e3..d1ce252d86 100644
--- a/core/object/undo_redo.h
+++ b/core/object/undo_redo.h
@@ -121,8 +121,8 @@ public:
String get_action_name(int p_id);
void clear_history(bool p_increase_version = true);
- bool has_undo();
- bool has_redo();
+ bool has_undo() const;
+ bool has_redo() const;
uint64_t get_version() const;