From a6429a6a14a2e40eae9ae623f3efb9244fa0748a Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Tue, 19 Jan 2010 08:15:50 +0200 Subject: Fixed low bug EXT - 3703 (Startup toast message doesn't fit toast width) --HG-- branch : product-engine --- indra/newview/llscreenchannel.cpp | 21 ++++++++++++++++++++- indra/newview/skins/default/xui/en/panel_toast.xml | 3 ++- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 0adc9fc258..a00b6a9288 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -47,6 +47,7 @@ #include "llsyswellwindow.h" #include "llimfloater.h" #include "llscriptfloater.h" +#include "llfontgl.h" #include @@ -568,6 +569,7 @@ void LLScreenChannel::showToastsTop() void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer) { LLRect toast_rect; + LLRect tbox_rect; LLToast::Params p; p.lifetime_secs = timer; p.enable_hide_btn = false; @@ -582,9 +584,26 @@ void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer) std::string text = LLTrans::getString("StartUpNotifications"); + tbox_rect = text_box->getRect(); + S32 tbox_width = tbox_rect.getWidth(); + S32 tbox_vpad = text_box->getVPad(); + S32 text_width = text_box->getDefaultFont()->getWidth(text); + S32 text_height = text_box->getTextPixelHeight(); + + // EXT - 3703 (Startup toast message doesn't fit toast width) + // Calculating TextBox HEIGHT needed to include the whole string according to the given WIDTH of the TextBox. + S32 new_tbox_height = (text_width/tbox_width + 1) * text_height; + // Calculating TOP position of TextBox + S32 new_tbox_top = new_tbox_height + tbox_vpad + gSavedSettings.getS32("ToastGap"); + // Calculating toast HEIGHT according to the new TextBox size + S32 toast_height = new_tbox_height + tbox_vpad * 2; + + tbox_rect.setLeftTopAndSize(tbox_rect.mLeft, new_tbox_top, tbox_rect.getWidth(), new_tbox_height); + text_box->setRect(tbox_rect); + toast_rect = mStartUpToastPanel->getRect(); mStartUpToastPanel->reshape(getRect().getWidth(), toast_rect.getHeight(), true); - toast_rect.setLeftTopAndSize(0, toast_rect.getHeight()+gSavedSettings.getS32("ToastGap"), getRect().getWidth(), toast_rect.getHeight()); + toast_rect.setLeftTopAndSize(0, toast_height + gSavedSettings.getS32("ToastGap"), getRect().getWidth(), toast_height); mStartUpToastPanel->setRect(toast_rect); text_box->setValue(text); diff --git a/indra/newview/skins/default/xui/en/panel_toast.xml b/indra/newview/skins/default/xui/en/panel_toast.xml index ba2d61afb7..d198237e5d 100644 --- a/indra/newview/skins/default/xui/en/panel_toast.xml +++ b/indra/newview/skins/default/xui/en/panel_toast.xml @@ -39,7 +39,8 @@ name="toast_text" word_wrap="true" text_color="white" - top="5" + top="5" + v_pad="5" use_ellipses="true" width="260"> Toast text; -- cgit v1.2.3