From 25dac76b3500c23bf13cce359a59ea184f9cbeeb Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 10 Oct 2010 08:13:26 +0000 Subject: GUI: Ensure that the message dialog is wide enough The Hugo engine currently uses the message dialog. Make sure that the dialog is always at least wide enough to hold the "Ok" button. svn-id: r53107 --- gui/message.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gui/message.cpp') diff --git a/gui/message.cpp b/gui/message.cpp index 6406976569..198a34eb0d 100644 --- a/gui/message.cpp +++ b/gui/message.cpp @@ -58,7 +58,10 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines); // Calculate the desired dialog size (maxing out at 300*180 for now) - _w = maxlineWidth + 20; + if (maxlineWidth > buttonWidth) + _w = maxlineWidth + 20; + else + _w = buttonWidth + 20; lineCount = lines.size(); _h = 16; -- cgit v1.2.3 From bcf3b352853a268afba25a0bdfccefd27191f5c6 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 10 Oct 2010 10:11:33 +0000 Subject: GUI: Clean up my previous commit. svn-id: r53112 --- gui/message.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'gui/message.cpp') diff --git a/gui/message.cpp b/gui/message.cpp index 198a34eb0d..6f5d7d9e77 100644 --- a/gui/message.cpp +++ b/gui/message.cpp @@ -58,10 +58,7 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines); // Calculate the desired dialog size (maxing out at 300*180 for now) - if (maxlineWidth > buttonWidth) - _w = maxlineWidth + 20; - else - _w = buttonWidth + 20; + _w = MAX(maxlineWidth, buttonWidth) + 20; lineCount = lines.size(); _h = 16; -- cgit v1.2.3 From af6ffafe5fd6549b5dfce516a6c255cba515f54a Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Sun, 10 Oct 2010 10:32:58 +0000 Subject: GUI: Message dialog width Ensure the message dialog is wide enough when it contains 2 buttons. This is used by Hugo's engine, e.g. when Exiting the DOS versions. svn-id: r53114 --- gui/message.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gui/message.cpp') diff --git a/gui/message.cpp b/gui/message.cpp index 6f5d7d9e77..06b4524eab 100644 --- a/gui/message.cpp +++ b/gui/message.cpp @@ -58,7 +58,11 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines); // Calculate the desired dialog size (maxing out at 300*180 for now) - _w = MAX(maxlineWidth, buttonWidth) + 20; + if (altButton) + _w = MAX(maxlineWidth, (2 * buttonWidth) + 10) + 20; + else + _w = MAX(maxlineWidth, buttonWidth) + 20; + lineCount = lines.size(); _h = 16; -- cgit v1.2.3