From c658e891345fd98dcededa5c21efc17993805522 Mon Sep 17 00:00:00 2001
From: andreykproductengine <andreykproductengine@lindenlab.com>
Date: Wed, 12 Dec 2018 15:24:26 +0200
Subject: [PATCH] SL-9512 Move constant to common place

---
 indra/newview/lltoastnotifypanel.cpp   | 8 +++-----
 indra/newview/lltoastpanel.cpp         | 3 +++
 indra/newview/lltoastpanel.h           | 1 +
 indra/newview/lltoastscripttextbox.cpp | 4 +---
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index e3a856be5cd..a2116817a24 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 e1b764a9438..7c624d5b505 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 51630381f21..6a9b72a5ae5 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 518c6c0ee4d..eb86a44055c 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));
-- 
GitLab