diff options
Diffstat (limited to 'scene/gui/label.cpp')
-rw-r--r-- | scene/gui/label.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 874156821e..5fe3dd0129 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -63,7 +63,7 @@ void Label::_notification(int p_what) { if (p_what == NOTIFICATION_TRANSLATION_CHANGED) { - String new_text = XL_MESSAGE(text); + String new_text = tr(text); if (new_text == xl_text) return; //nothing new xl_text = new_text; @@ -493,7 +493,10 @@ void Label::regenerate_word_cache() { minsize.height = (font->get_height() * line_count) + (line_spacing * (line_count - 1)); } - minimum_size_changed(); + if (!autowrap || !clip) { + //helps speed up some labels that may change a lot, as no resizing is requested. Do not change. + minimum_size_changed(); + } word_cache_dirty = false; } @@ -526,7 +529,7 @@ void Label::set_text(const String &p_string) { if (text == p_string) return; text = p_string; - xl_text = XL_MESSAGE(p_string); + xl_text = tr(p_string); word_cache_dirty = true; if (percent_visible < 1) visible_chars = get_total_character_count() * percent_visible; @@ -641,15 +644,15 @@ void Label::_bind_methods() { ClassDB::bind_method(D_METHOD("set_max_lines_visible", "lines_visible"), &Label::set_max_lines_visible); ClassDB::bind_method(D_METHOD("get_max_lines_visible"), &Label::get_max_lines_visible); - BIND_CONSTANT(ALIGN_LEFT); - BIND_CONSTANT(ALIGN_CENTER); - BIND_CONSTANT(ALIGN_RIGHT); - BIND_CONSTANT(ALIGN_FILL); + BIND_ENUM_CONSTANT(ALIGN_LEFT); + BIND_ENUM_CONSTANT(ALIGN_CENTER); + BIND_ENUM_CONSTANT(ALIGN_RIGHT); + BIND_ENUM_CONSTANT(ALIGN_FILL); - BIND_CONSTANT(VALIGN_TOP); - BIND_CONSTANT(VALIGN_CENTER); - BIND_CONSTANT(VALIGN_BOTTOM); - BIND_CONSTANT(VALIGN_FILL); + BIND_ENUM_CONSTANT(VALIGN_TOP); + BIND_ENUM_CONSTANT(VALIGN_CENTER); + BIND_ENUM_CONSTANT(VALIGN_BOTTOM); + BIND_ENUM_CONSTANT(VALIGN_FILL); ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT, "", PROPERTY_USAGE_DEFAULT_INTL), "set_text", "get_text"); ADD_PROPERTYNZ(PropertyInfo(Variant::INT, "align", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_align", "get_align"); |