diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index e3a856be5cd7cde30109888f3b8dbdb00c1044bc..a2116817a245c69bbb31000b5d5e249773d14339 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -46,8 +46,6 @@ const S32 BOTTOM_PAD = VPAD * 3; const S32 IGNORE_BTN_TOP_DELTA = 3*VPAD;//additional ignore_btn padding S32 BUTTON_WIDTH = 90; -// *TODO: magic numbers - copied from llnotify.cpp(250) -const S32 MAX_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE; //static @@ -319,7 +317,7 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) mTextBox = getChild<LLTextEditor>("text_editor_box"); } - mTextBox->setMaxTextLength(MAX_LENGTH); + mTextBox->setMaxTextLength(LLToastPanel::MAX_TEXT_LENGTH); mTextBox->setVisible(TRUE); mTextBox->setPlainText(!show_images); mTextBox->setContentTrusted(is_content_trusted); @@ -411,7 +409,7 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) //.xml file intially makes info panel only follow left/right/top. This is so that when control buttons are added the info panel //can shift upward making room for the buttons inside mControlPanel. After the buttons are added, the info panel can then be set to follow 'all'. mInfoPanel->setFollowsAll(); - snapToMessageHeight(mTextBox, MAX_LENGTH); + snapToMessageHeight(mTextBox, LLToastPanel::MAX_TEXT_LENGTH); // reshape the panel to its previous size if (current_rect.notEmpty()) @@ -472,7 +470,7 @@ void LLIMToastNotifyPanel::snapToMessageHeight() //Add message height if it is visible if (mTextBox->getVisible()) { - S32 new_panel_height = computeSnappedToMessageHeight(mTextBox, MAX_LENGTH); + S32 new_panel_height = computeSnappedToMessageHeight(mTextBox, LLToastPanel::MAX_TEXT_LENGTH); //reshape the panel with new height if (new_panel_height != getRect().getHeight()) diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp index e1b764a9438c541f142126bf9c2dd04fde1b0cab..7c624d5b50566518267ef5dd91aa9acf78b615e4 100644 --- a/indra/newview/lltoastpanel.cpp +++ b/indra/newview/lltoastpanel.cpp @@ -26,6 +26,7 @@ #include "llviewerprecompiledheaders.h" +#include "lldbstrings.h" #include "llpanelgenerictip.h" #include "llpanelonlinestatus.h" #include "llnotifications.h" @@ -35,6 +36,8 @@ //static const S32 LLToastPanel::MIN_PANEL_HEIGHT = 40; // VPAD(4)*2 + ICON_HEIGHT(32) +// 'magic numbers', consider initializing (512+20) part from xml/notifications +const S32 LLToastPanel::MAX_TEXT_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE; LLToastPanel::LLToastPanel(const LLNotificationPtr& notification) { diff --git a/indra/newview/lltoastpanel.h b/indra/newview/lltoastpanel.h index 51630381f2118ff899b298484a1cc80d21df40d4..6a9b72a5ae56e915417c784991659d80aaac037e 100644 --- a/indra/newview/lltoastpanel.h +++ b/indra/newview/lltoastpanel.h @@ -49,6 +49,7 @@ class LLToastPanel : public LLPanel { virtual const LLUUID& getID(); static const S32 MIN_PANEL_HEIGHT; + static const S32 MAX_TEXT_LENGTH; /** * Builder method for constructing notification specific panels. diff --git a/indra/newview/lltoastscripttextbox.cpp b/indra/newview/lltoastscripttextbox.cpp index 518c6c0ee4ded9f9ae1b812e391dd3930fd06b85..eb86a44055ce99199be30b54b6b50e99f610e1c3 100644 --- a/indra/newview/lltoastscripttextbox.cpp +++ b/indra/newview/lltoastscripttextbox.cpp @@ -36,8 +36,6 @@ #include "llviewertexteditor.h" const S32 LLToastScriptTextbox::DEFAULT_MESSAGE_MAX_LINE_COUNT= 14; -// *TODO: magic numbers - copied from lltoastnotifypanel.cpp(50) which was copied from llnotify.cpp(250) -const S32 MAX_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE; LLToastScriptTextbox::LLToastScriptTextbox(const LLNotificationPtr& notification) : LLToastPanel(notification) @@ -45,7 +43,7 @@ LLToastScriptTextbox::LLToastScriptTextbox(const LLNotificationPtr& notification buildFromFile( "panel_notify_textbox.xml"); mInfoText = getChild<LLTextEditor>("text_editor_box"); - mInfoText->setMaxTextLength(MAX_LENGTH); + mInfoText->setMaxTextLength(LLToastPanel::MAX_TEXT_LENGTH); mInfoText->setValue(notification->getMessage()); getChild<LLButton>("ignore_btn")->setClickedCallback(boost::bind(&LLToastScriptTextbox::onClickIgnore, this));