summaryrefslogtreecommitdiffstats
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/code_edit.cpp7
-rw-r--r--scene/gui/color_picker.cpp12
-rw-r--r--scene/gui/rich_text_label.cpp26
-rw-r--r--scene/gui/rich_text_label.h1
-rw-r--r--scene/main/scene_tree.cpp2
-rw-r--r--scene/resources/default_theme/default_theme.cpp18
6 files changed, 33 insertions, 33 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;
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 790600bc49..a232354fae 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -1518,7 +1518,7 @@ SceneTree::SceneTree() {
ProjectSettings::get_singleton()->set("rendering/environment/defaults/default_environment", "");
} else {
// File was erased, notify user.
- ERR_PRINT(RTR("Default Environment as specified in Project Settings (Rendering -> Environment -> Default Environment) could not be loaded."));
+ ERR_PRINT(RTR("Default Environment as specified in the project setting \"rendering/environment/defaults/default_environment\" could not be loaded."));
}
}
}
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 16b1ed0703..8addcea215 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -162,7 +162,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_font("font", "Button", Ref<Font>());
theme->set_font_size("font_size", "Button", -1);
- theme->set_constant("outline_size", "Button", 0 * scale);
+ theme->set_constant("outline_size", "Button", 0);
theme->set_color("font_color", "Button", control_font_color);
theme->set_color("font_pressed_color", "Button", control_font_pressed_color);
@@ -191,7 +191,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_font("font", "MenuBar", Ref<Font>());
theme->set_font_size("font_size", "MenuBar", -1);
- theme->set_constant("outline_size", "MenuBar", 0 * scale);
+ theme->set_constant("outline_size", "MenuBar", 0);
theme->set_color("font_color", "MenuBar", control_font_color);
theme->set_color("font_pressed_color", "MenuBar", control_font_pressed_color);
@@ -316,7 +316,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_color("font_outline_color", "CheckBox", Color(1, 1, 1));
theme->set_constant("h_separation", "CheckBox", 4 * scale);
- theme->set_constant("check_v_offset", "CheckBox", 0 * scale);
+ theme->set_constant("check_v_offset", "CheckBox", 0);
theme->set_constant("outline_size", "CheckBox", 0);
// CheckButton
@@ -353,7 +353,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_color("font_outline_color", "CheckButton", Color(1, 1, 1));
theme->set_constant("h_separation", "CheckButton", 4 * scale);
- theme->set_constant("check_v_offset", "CheckButton", 0 * scale);
+ theme->set_constant("check_v_offset", "CheckButton", 0);
theme->set_constant("outline_size", "CheckButton", 0);
// Label
@@ -1045,7 +1045,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("shadow_offset_y", "RichTextLabel", 1 * scale);
theme->set_constant("shadow_outline_size", "RichTextLabel", 1 * scale);
- theme->set_constant("line_separation", "RichTextLabel", 0 * scale);
+ theme->set_constant("line_separation", "RichTextLabel", 0);
theme->set_constant("table_h_separation", "RichTextLabel", 3 * scale);
theme->set_constant("table_v_separation", "RichTextLabel", 3 * scale);
@@ -1068,10 +1068,10 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_constant("separation", "BoxContainer", 4 * scale);
theme->set_constant("separation", "HBoxContainer", 4 * scale);
theme->set_constant("separation", "VBoxContainer", 4 * scale);
- theme->set_constant("margin_left", "MarginContainer", 0 * scale);
- theme->set_constant("margin_top", "MarginContainer", 0 * scale);
- theme->set_constant("margin_right", "MarginContainer", 0 * scale);
- theme->set_constant("margin_bottom", "MarginContainer", 0 * scale);
+ theme->set_constant("margin_left", "MarginContainer", 0);
+ theme->set_constant("margin_top", "MarginContainer", 0);
+ theme->set_constant("margin_right", "MarginContainer", 0);
+ theme->set_constant("margin_bottom", "MarginContainer", 0);
theme->set_constant("h_separation", "GridContainer", 4 * scale);
theme->set_constant("v_separation", "GridContainer", 4 * scale);
theme->set_constant("separation", "SplitContainer", 12 * scale);