diff options
Diffstat (limited to 'scene/gui')
| -rw-r--r-- | scene/gui/code_edit.cpp | 7 | ||||
| -rw-r--r-- | scene/gui/color_picker.cpp | 12 | ||||
| -rw-r--r-- | scene/gui/rich_text_label.cpp | 26 | ||||
| -rw-r--r-- | scene/gui/rich_text_label.h | 1 |
4 files changed, 23 insertions, 23 deletions
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp index 0c9b6ffeaf..443f633969 100644 --- a/scene/gui/code_edit.cpp +++ b/scene/gui/code_edit.cpp @@ -451,11 +451,8 @@ void CodeEdit::gui_input(const Ref<InputEvent> &p_gui_input) { } /* Ctrl + Hover symbols */ -#ifdef MACOS_ENABLED - if (k->get_keycode() == Key::META) { -#else - if (k->get_keycode() == Key::CTRL) { -#endif + bool mac_keys = OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios"); + if ((mac_keys && k->get_keycode() == Key::META) || (!mac_keys && k->get_keycode() == Key::CTRL)) { if (symbol_lookup_on_click_enabled) { if (k->is_pressed() && !is_dragging_cursor()) { symbol_lookup_new_word = get_word_at_pos(get_local_mouse_pos()); diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 23b5bb2c7b..7f9095c2a2 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -543,8 +543,9 @@ void ColorPicker::_html_submitted(const String &p_html) { return; } - Color previous_color = color; - color = Color::html(p_html); + const Color previous_color = color; + color = Color::from_string(p_html, previous_color); + if (!is_editing_alpha()) { color.a = previous_color.a; } @@ -644,13 +645,13 @@ void ColorPicker::_text_type_toggled() { text_type->set_icon(get_theme_icon(SNAME("Script"), SNAME("EditorIcons"))); c_text->set_editable(false); - c_text->set_h_size_flags(SIZE_EXPAND_FILL); + c_text->set_tooltip_text(RTR("Copy this constructor in a script.")); } else { text_type->set_text("#"); text_type->set_icon(nullptr); c_text->set_editable(true); - c_text->set_h_size_flags(SIZE_FILL); + c_text->set_tooltip_text(RTR("Enter a hex code (\"#ff0000\") or named color (\"red\").")); } _update_color(); } @@ -1793,7 +1794,10 @@ ColorPicker::ColorPicker() { c_text = memnew(LineEdit); hex_hbc->add_child(c_text); + c_text->set_h_size_flags(SIZE_EXPAND_FILL); c_text->set_select_all_on_focus(true); + c_text->set_tooltip_text(RTR("Enter a hex code (\"#ff0000\") or named color (\"red\").")); + c_text->set_placeholder(RTR("Hex code or named color")); c_text->connect("text_submitted", callable_mp(this, &ColorPicker::_html_submitted)); c_text->connect("text_changed", callable_mp(this, &ColorPicker::_text_changed)); c_text->connect("focus_exited", callable_mp(this, &ColorPicker::_html_focus_exit)); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index c2bbae9c38..1ae24b6d70 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -34,6 +34,7 @@ #include "core/math/math_defs.h" #include "core/os/keyboard.h" #include "core/os/os.h" +#include "core/string/translation.h" #include "label.h" #include "scene/scene_string_names.h" #include "servers/display_server.h" @@ -1799,8 +1800,7 @@ void RichTextLabel::_notification(int p_what) { case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: case NOTIFICATION_TRANSLATION_CHANGED: { - _stop_thread(); - main->first_invalid_line.store(0); //invalidate ALL + _apply_translation(); queue_redraw(); } break; @@ -5123,13 +5123,17 @@ void RichTextLabel::set_text(const String &p_bbcode) { if (text == p_bbcode) { return; } - text = p_bbcode; + _apply_translation(); +} + +void RichTextLabel::_apply_translation() { + String xl_text = atr(text); if (use_bbcode) { - parse_bbcode(p_bbcode); + parse_bbcode(xl_text); } else { // raw text clear(); - add_text(p_bbcode); + add_text(xl_text); } } @@ -5144,13 +5148,7 @@ void RichTextLabel::set_use_bbcode(bool p_enable) { use_bbcode = p_enable; notify_property_list_changed(); - const String current_text = text; - if (use_bbcode) { - parse_bbcode(current_text); - } else { // raw text - clear(); - add_text(current_text); - } + _apply_translation(); } bool RichTextLabel::is_using_bbcode() const { @@ -5285,7 +5283,7 @@ float RichTextLabel::get_visible_ratio() const { void RichTextLabel::set_effects(Array p_effects) { custom_effects = p_effects; if ((!text.is_empty()) && use_bbcode) { - parse_bbcode(text); + parse_bbcode(atr(text)); } } @@ -5300,7 +5298,7 @@ void RichTextLabel::install_effect(const Variant effect) { ERR_FAIL_COND_MSG(rteffect.is_null(), "Invalid RichTextEffect resource."); custom_effects.push_back(effect); if ((!text.is_empty()) && use_bbcode) { - parse_bbcode(text); + parse_bbcode(atr(text)); } } diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index e3f1e11e71..fef34f7260 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -527,6 +527,7 @@ private: #endif bool use_bbcode = false; String text; + void _apply_translation(); bool fit_content = false; |
