diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2017-07-28 08:17:19 +0300 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2017-07-28 08:17:19 +0300 |
commit | 7e746e9221bf90466644999364b3c3cc16c0af98 (patch) | |
tree | b7eb3b1220bdd0412cfc88b8491a68f24ebce7eb | |
parent | 8265464260d109b335249fce18c09e1a31096c60 (diff) |
MAINT-7356 Improved multiline label support for the notification toast checkbox
-rw-r--r-- | indra/newview/lltoastalertpanel.cpp | 11 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp index dbf0893e43..495c9c1f44 100644 --- a/indra/newview/lltoastalertpanel.cpp +++ b/indra/newview/lltoastalertpanel.cpp @@ -46,6 +46,8 @@ #include "lltransientfloatermgr.h" #include "llviewercontrol.h" // for gSavedSettings +#include <boost/algorithm/string.hpp> + const S32 MAX_ALLOWED_MSG_WIDTH = 400; const F32 DEFAULT_BUTTON_DELAY = 0.5f; @@ -389,15 +391,18 @@ bool LLToastAlertPanel::setCheckBox( const std::string& check_title, const std:: const LLFontGL* font = mCheck->getFont(); const S32 LINE_HEIGHT = font->getLineHeight(); + + std::vector<std::string> lines; + boost::split(lines, check_title, boost::is_any_of("\n")); // Extend dialog for "check next time" S32 max_msg_width = LLToastPanel::getRect().getWidth() - 2 * HPAD; - S32 check_width = S32(font->getWidth(check_title) + 0.99f) + 16; + S32 check_width = S32(font->getWidth(lines[0]) + 0.99f) + 16; // use width of the first line max_msg_width = llmax(max_msg_width, check_width); S32 dialog_width = max_msg_width + 2 * HPAD; S32 dialog_height = LLToastPanel::getRect().getHeight(); - dialog_height += LINE_HEIGHT; + dialog_height += LINE_HEIGHT * lines.size(); dialog_height += LINE_HEIGHT / 2; LLToastPanel::reshape( dialog_width, dialog_height, FALSE ); @@ -406,7 +411,7 @@ bool LLToastAlertPanel::setCheckBox( const std::string& check_title, const std:: // set check_box's attributes LLRect check_rect; - mCheck->setRect(check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2, max_msg_width, LINE_HEIGHT)); + mCheck->setRect(check_rect.setOriginAndSize(msg_x, VPAD+BTN_HEIGHT+LINE_HEIGHT/2, max_msg_width, LINE_HEIGHT*lines.size())); mCheck->setLabel(check_title); mCheck->setCommitCallback(boost::bind(&LLToastAlertPanel::onClickIgnore, this, _1)); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 3ca7feae17..e21674a085 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -5,8 +5,8 @@ </global> <global name="skipnexttimesessiononly"> - - Don't show me this again (for this session only) +Don't show me this again +(for current session) </global> <global name="alwayschoose"> |