summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/container.cpp2
-rw-r--r--scene/gui/option_button.cpp21
-rw-r--r--scene/gui/range.cpp8
-rw-r--r--scene/gui/text_edit.cpp2
4 files changed, 11 insertions, 22 deletions
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index 1f9bfb9936..c9cf5f8308 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -177,7 +177,7 @@ String Container::get_configuration_warning() const {
if (warning != String()) {
warning += "\n";
}
- warning += TTR("Container by itself serves no purpose unless a script configures it's children placement behavior.\nIf you don't intend to add a script, then please use a plain 'Control' node instead.");
+ warning += TTR("Container by itself serves no purpose unless a script configures its children placement behavior.\nIf you don't intend to add a script, then please use a plain 'Control' node instead.");
}
return warning;
}
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 7027fceb84..872402e9e1 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -86,24 +86,7 @@ void OptionButton::_focused(int p_which) {
void OptionButton::_selected(int p_which) {
- int selid = -1;
- for (int i = 0; i < popup->get_item_count(); i++) {
-
- bool is_clicked = popup->get_item_id(i) == p_which;
- if (is_clicked) {
- selid = i;
- break;
- }
- }
-
- if (selid == -1 && p_which >= 0 && p_which < popup->get_item_count()) {
- _select(p_which, true);
- } else {
-
- ERR_FAIL_COND(selid == -1);
-
- _select(selid, true);
- }
+ _select(p_which, true);
}
void OptionButton::pressed() {
@@ -355,7 +338,7 @@ OptionButton::OptionButton() {
popup->set_pass_on_modal_close_click(false);
popup->set_notify_transform(true);
popup->set_allow_search(true);
- popup->connect("id_pressed", this, "_selected");
+ popup->connect("index_pressed", this, "_selected");
popup->connect("id_focused", this, "_focused");
popup->connect("popup_hide", this, "set_pressed", varray(false));
}
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index c24e62c8cb..d00acaf08a 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -63,7 +63,7 @@ void Range::Shared::emit_value_changed() {
void Range::_changed_notify(const char *p_what) {
- emit_signal("changed", shared->val);
+ emit_signal("changed");
update();
_change_notify(p_what);
}
@@ -79,6 +79,7 @@ void Range::Shared::emit_changed(const char *p_what) {
}
void Range::set_value(double p_val) {
+
if (shared->step > 0)
p_val = Math::round(p_val / shared->step) * shared->step;
@@ -303,22 +304,27 @@ bool Range::is_ratio_exp() const {
}
void Range::set_allow_greater(bool p_allow) {
+
shared->allow_greater = p_allow;
}
bool Range::is_greater_allowed() const {
+
return shared->allow_greater;
}
void Range::set_allow_lesser(bool p_allow) {
+
shared->allow_lesser = p_allow;
}
bool Range::is_lesser_allowed() const {
+
return shared->allow_lesser;
}
Range::Range() {
+
shared = memnew(Shared);
shared->min = 0;
shared->max = 100;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 83ce71e959..36d7dad1d3 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -5613,7 +5613,7 @@ void TextEdit::undo() {
TextOperation op = undo_stack_pos->get();
_do_text_op(op, true);
- if (op.from_line != op.to_line || op.to_column != op.from_column + 1)
+ if (op.type != TextOperation::TYPE_INSERT && (op.from_line != op.to_line || op.to_column != op.from_column + 1))
select(op.from_line, op.from_column, op.to_line, op.to_column);
current_op.version = op.prev_version;