From 3f15a65307c0a3c2c4769af964356996ed367c35 Mon Sep 17 00:00:00 2001 From: volzhs Date: Mon, 31 Oct 2016 03:40:52 +0900 Subject: Revert "Place child control under label in AcceptDialog." This reverts commit 3ef272290460670b82621727ba2e876fa0a5a01e. --- scene/gui/dialogs.cpp | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) (limited to 'scene/gui/dialogs.cpp') diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index b8c5f227c6..15ff334c92 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -232,8 +232,6 @@ String AcceptDialog::get_text() const { void AcceptDialog::set_text(String p_text) { label->set_text(p_text); - minimum_size_changed(); - _update_child_rect(); } void AcceptDialog::set_hide_on_ok(bool p_hide) { @@ -255,51 +253,38 @@ void AcceptDialog::register_text_enter(Node *p_line_edit) { void AcceptDialog::_update_child_rect() { - const int margin = get_constant("margin","Dialogs"); - const Size2 size = get_size(); + int margin = get_constant("margin","Dialogs"); + Size2 size = get_size(); Size2 hminsize = hbc->get_combined_minimum_size(); - const Size2 max_csize( - size.width - margin * 2, - size.height - margin * 3 - hminsize.height); - hminsize.width = max_csize.width; - - Point2 cpos(margin, margin); - Size2 csize = label->get_combined_minimum_size(); - if(label->get_text().empty()) - csize.y = 0; - csize.x = MIN(csize.width, max_csize.width); - csize.y = MIN(csize.height, max_csize.height); + Vector2 cpos(margin,margin); + Vector2 csize(size.x-margin*2,size.y-margin*3-hminsize.y); label->set_pos(cpos); label->set_size(csize); - if(child) { - const float child_y_offset = csize.height + (csize.height > 0 ? margin : 0); - cpos.y += child_y_offset; - csize = max_csize; - csize.height -= child_y_offset; + if (child) { child->set_pos(cpos); child->set_size(csize); } - cpos.y += csize.height + margin; + cpos.y+=csize.y+margin; + csize.y=hminsize.y; hbc->set_pos(cpos); - hbc->set_size(hminsize); + hbc->set_size(csize); + } Size2 AcceptDialog::get_minimum_size() const { int margin = get_constant("margin","Dialogs"); Size2 minsize = label->get_combined_minimum_size(); - if(label->get_text().empty()) - minsize.y = 0; if (child) { Size2 cminsize = child->get_combined_minimum_size(); minsize.x=MAX(cminsize.x,minsize.x); - minsize.y += cminsize.y + (minsize.y > 0 ? margin : 0); + minsize.y=MAX(cminsize.y,minsize.y); } Size2 hminsize = hbc->get_combined_minimum_size(); -- cgit v1.2.3 From 8d5644c4b217636994440f698b09ef395e5dfa55 Mon Sep 17 00:00:00 2001 From: volzhs Date: Mon, 31 Oct 2016 03:42:30 +0900 Subject: Fix Accept/ConfirmationDialog UI broken --- scene/gui/dialogs.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'scene/gui/dialogs.cpp') diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 15ff334c92..49782bcb75 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -232,6 +232,8 @@ String AcceptDialog::get_text() const { void AcceptDialog::set_text(String p_text) { label->set_text(p_text); + minimum_size_changed(); + _update_child_rect(); } void AcceptDialog::set_hide_on_ok(bool p_hide) { @@ -252,15 +254,16 @@ void AcceptDialog::register_text_enter(Node *p_line_edit) { } void AcceptDialog::_update_child_rect() { - + Size2 label_size=label->get_minimum_size(); + if (label->get_text().empty()) { + label_size.height = 0; + } int margin = get_constant("margin","Dialogs"); Size2 size = get_size(); Size2 hminsize = hbc->get_combined_minimum_size(); - Vector2 cpos(margin,margin); - Vector2 csize(size.x-margin*2,size.y-margin*3-hminsize.y); - label->set_pos(cpos); - label->set_size(csize); + Vector2 cpos(margin,margin+label_size.height); + Vector2 csize(size.x-margin*2,size.y-margin*3-hminsize.y-label_size.height); if (child) { -- cgit v1.2.3 From c7bc44d5ad9aae4902280012f7654e2318cd910e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 1 Jan 2017 22:01:57 +0100 Subject: Welcome in 2017, dear changelog reader! That year should bring the long-awaited OpenGL ES 3.0 compatible renderer with state-of-the-art rendering techniques tuned to work as low as middle end handheld devices - without compromising with the possibilities given for higher end desktop games of course. Great times ahead for the Godot community and the gamers that will play our games! --- scene/gui/dialogs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scene/gui/dialogs.cpp') diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 49782bcb75..ae5a51c3c5 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ -- cgit v1.2.3