diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-05-17 18:27:15 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-05-17 18:28:44 -0300 |
commit | c195c0df6b36debc870216dd42e49fbda70fa861 (patch) | |
tree | 194a26e39ace86d7a471f3e86159c2aed6be261c /scene/gui | |
parent | 3a26e14a2bab777c9ba6aedceff6e4ef2666faf0 (diff) |
-Added configuration warning system for nodes
-Added a new "add" and "instance" buttons for scene tree
-Added a vformat() function to ease translation work
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/label.cpp | 8 | ||||
-rw-r--r-- | scene/gui/popup.cpp | 10 | ||||
-rw-r--r-- | scene/gui/popup.h | 1 |
3 files changed, 16 insertions, 3 deletions
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index e8097c79a4..09c6a77b42 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -87,10 +87,11 @@ void Label::_notification(int p_what) { Color font_color_shadow = get_color("font_color_shadow"); bool use_outlinde = get_constant("shadow_as_outline"); Point2 shadow_ofs(get_constant("shadow_offset_x"),get_constant("shadow_offset_y")); + int line_spacing = get_constant("line_spacing"); VisualServer::get_singleton()->canvas_item_set_distance_field_mode(get_canvas_item(),font.is_valid() && font->is_distance_field_hint()); - int font_h = font->get_height(); + int font_h = font->get_height()+line_spacing; int lines_visible = size.y/font_h; int space_w=font->get_char_size(' ').width; int chars_total=0; @@ -372,6 +373,7 @@ void Label::regenerate_word_cache() { int line_width=0; int space_count=0; int space_width=font->get_char_size(' ').width; + int line_spacing = get_constant("line_spacing"); line_count=1; total_char_cache=0; @@ -486,9 +488,9 @@ void Label::regenerate_word_cache() { if (!autowrap) { minsize.width=width; if (max_lines_visible > 0 && line_count > max_lines_visible) { - minsize.height=font->get_height()*max_lines_visible; + minsize.height=(font->get_height()+line_spacing)*max_lines_visible; } else { - minsize.height=font->get_height()*line_count; + minsize.height=(font->get_height()+line_spacing)*line_count; } } diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 0d9a76937c..8d02d0e4e5 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -44,6 +44,8 @@ void Popup::_notification(int p_what) { notification(NOTIFICATION_POPUP_HIDE); emit_signal("popup_hide"); } + + update_configuration_warning(); } if (p_what==NOTIFICATION_ENTER_TREE) { @@ -282,6 +284,14 @@ Popup::Popup() { hide(); } +String Popup::get_configuration_warning() const { + + if (is_visible()) { + return TTR("Popups will hide by default unless you call popup() or any of the popup*() functions. Making them visible for editing is fine though, but they will hide upon running."); + } + + return String(); +} Popup::~Popup() { diff --git a/scene/gui/popup.h b/scene/gui/popup.h index 8afcdc01db..dccaf2ae69 100644 --- a/scene/gui/popup.h +++ b/scene/gui/popup.h @@ -65,6 +65,7 @@ public: void set_as_minsize(); virtual void popup(); + virtual String get_configuration_warning() const; Popup(); ~Popup(); |