summaryrefslogtreecommitdiff
path: root/indra/newview/lltoastscripttextbox.cpp
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2017-03-01 17:53:26 +0200
committerMnikolenko Productengine <mnikolenko@productengine.com>2017-03-01 17:53:26 +0200
commitb4c4a951c161e43bf66141248f0c94b97848ae98 (patch)
tree76a6443b27c9d4a6ef2837f37b01b7852c301fe9 /indra/newview/lltoastscripttextbox.cpp
parent9bd3a99f20ff6e73f5ea2245a21a94c5882ca673 (diff)
MAINT-3604 Extend llTextBox message lines according to it's length
Diffstat (limited to 'indra/newview/lltoastscripttextbox.cpp')
-rw-r--r--indra/newview/lltoastscripttextbox.cpp57
1 files changed, 33 insertions, 24 deletions
diff --git a/indra/newview/lltoastscripttextbox.cpp b/indra/newview/lltoastscripttextbox.cpp
index 78d9e92b5c..776ae2ece9 100644
--- a/indra/newview/lltoastscripttextbox.cpp
+++ b/indra/newview/lltoastscripttextbox.cpp
@@ -28,31 +28,21 @@
#include "lltoastscripttextbox.h"
-#include "llfocusmgr.h"
-
-#include "llbutton.h"
+#include "lllslconstants.h"
#include "llnotifications.h"
-#include "llviewertexteditor.h"
-
-#include "llavatarnamecache.h"
-#include "lluiconstants.h"
-#include "llui.h"
-#include "llviewercontrol.h"
-#include "lltrans.h"
#include "llstyle.h"
+#include "lluiconstants.h"
+#include "llviewertexteditor.h"
-#include "llglheaders.h"
-#include "llagent.h"
-
-const S32 LLToastScriptTextbox::DEFAULT_MESSAGE_MAX_LINE_COUNT= 7;
+const S32 LLToastScriptTextbox::DEFAULT_MESSAGE_MAX_LINE_COUNT= 14;
LLToastScriptTextbox::LLToastScriptTextbox(const LLNotificationPtr& notification)
: LLToastPanel(notification)
{
buildFromFile( "panel_notify_textbox.xml");
- LLTextEditor* text_editorp = getChild<LLTextEditor>("text_editor_box");
- text_editorp->setValue(notification->getMessage());
+ mInfoText = getChild<LLTextBox>("text_editor_box");
+ mInfoText->setValue(notification->getMessage());
getChild<LLButton>("ignore_btn")->setClickedCallback(boost::bind(&LLToastScriptTextbox::onClickIgnore, this));
@@ -73,13 +63,7 @@ LLToastScriptTextbox::LLToastScriptTextbox(const LLNotificationPtr& notification
pSubmitBtn->setClickedCallback((boost::bind(&LLToastScriptTextbox::onClickSubmit, this)));
setDefaultBtn(pSubmitBtn);
- S32 maxLinesCount;
- std::istringstream ss( getString("message_max_lines_count") );
- if (!(ss >> maxLinesCount))
- {
- maxLinesCount = DEFAULT_MESSAGE_MAX_LINE_COUNT;
- }
- //snapToMessageHeight(pMessageText, maxLinesCount);
+ snapToMessageHeight();
}
// virtual
@@ -92,7 +76,6 @@ void LLToastScriptTextbox::close()
die();
}
-#include "lllslconstants.h"
void LLToastScriptTextbox::onClickSubmit()
{
LLViewerTextEditor* pMessageText = getChild<LLViewerTextEditor>("message");
@@ -119,3 +102,29 @@ void LLToastScriptTextbox::onClickIgnore()
mNotification->respond(response);
close();
}
+
+void LLToastScriptTextbox::snapToMessageHeight()
+{
+ LLPanel* info_pan = getChild<LLPanel>("info_panel");
+ if (!info_pan)
+ {
+ return;
+ }
+
+ S32 maxLinesCount;
+ std::istringstream ss( getString("message_max_lines_count") );
+ if (!(ss >> maxLinesCount))
+ {
+ maxLinesCount = DEFAULT_MESSAGE_MAX_LINE_COUNT;
+ }
+
+
+ S32 maxTextHeight = (mInfoText->getFont()->getLineHeight() * maxLinesCount);
+ S32 oldTextHeight = mInfoText->getRect().getHeight();
+ S32 newTextHeight = llmin(mInfoText->getTextBoundingRect().getHeight(), maxTextHeight);
+
+ S32 heightDelta = newTextHeight - oldTextHeight;
+
+ reshape( getRect().getWidth(), llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT));
+ info_pan->reshape(info_pan->getRect().getWidth(),newTextHeight);
+}