From 81c2a084e3949f942af99c476a517e76251955b1 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sat, 19 Dec 2020 18:10:25 -0500 Subject: [PATCH] Allow automatically calculating both the width and height of a text label This fixes welcome dialog links triggering when you hit OK in the right place --- rsrc/dialogs/welcome.xml | 12 ++++++------ src/dialogxml/widgets/message.cpp | 10 ++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/rsrc/dialogs/welcome.xml b/rsrc/dialogs/welcome.xml index a8489426..bbc6f9e6 100644 --- a/rsrc/dialogs/welcome.xml +++ b/rsrc/dialogs/welcome.xml @@ -9,7 +9,7 @@ Blades of Exile game developed by Spiderweb Software in 1997 and released as Free Open-Source Software in 2005. - + http://www.spidweb.com/blades/opensource.html @@ -18,7 +18,7 @@ In addition to these, hundreds more written by community members, are available for download online! - + http://openboe.com/scenarios @@ -33,7 +33,7 @@ You can also find playing hints and related discussion at the Spiderweb Software game forums. - + http://spiderwebforums.ipbhost.com/ @@ -41,16 +41,16 @@ you can change animation speed, game difficulty, display options and special effects settings.

- Blades of Exile Game/Editor/Character Editor are released + Blades of Exile is released under the terms of the GNU General Public License V2. See the file LICENSE.txt for details.

The Open Blades of Exile team
- + http://openboe.com - + https://github.com/calref/cboe diff --git a/src/dialogxml/widgets/message.cpp b/src/dialogxml/widgets/message.cpp index 022e64d4..f151c3e1 100644 --- a/src/dialogxml/widgets/message.cpp +++ b/src/dialogxml/widgets/message.cpp @@ -123,10 +123,11 @@ void cTextMsg::recalcRect() { if(!fixedHeight) { // Fix the width and calculate the height calc_rect.height() = lines * style.lineHeight * 10; - } else if(!fixedWidth) { + } + if(!fixedWidth) { // Fix the height and calculate the width calc_rect.width() = 100 * max_line_chars; - } else return; // This case should be impossible, but just in case... + } sf::RenderTexture temp; temp.create(frame.width(), frame.height()); rectangle test_rect = calc_rect; @@ -140,8 +141,9 @@ void cTextMsg::recalcRect() { } if(!fixedHeight) { calc_rect.height() = combo.height() + 8; - } else if(!fixedWidth) { - calc_rect.width() = combo.width() + 8; + } + if(!fixedWidth) { + calc_rect.width() = combo.width() + 16; } frame = calc_rect; }