summaryrefslogtreecommitdiff
path: root/indra/llui/llchatentry.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2013-04-01 09:34:41 -0400
committerOz Linden <oz@lindenlab.com>2013-04-01 09:34:41 -0400
commit90b56ee9fa95ca8cc15e3abc81977f504eb32c5b (patch)
tree581e4ba644ebf770dbdab292ea9f10d4b9404cb6 /indra/llui/llchatentry.cpp
parent130e4e510198147664a2377b62b22d8e42f00f04 (diff)
parent49bef4e122e3ab4c82962e25f4ec1803c4e0c600 (diff)
merge changes for 3.5.0-beta7
Diffstat (limited to 'indra/llui/llchatentry.cpp')
-rw-r--r--indra/llui/llchatentry.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp
index 9e48dcde7e..6a1b48a08a 100644
--- a/indra/llui/llchatentry.cpp
+++ b/indra/llui/llchatentry.cpp
@@ -25,6 +25,7 @@
*/
#include "linden_common.h"
+#include "llscrollcontainer.h"
#include "llchatentry.h"
@@ -42,7 +43,9 @@ LLChatEntry::LLChatEntry(const Params& p)
mHasHistory(p.has_history),
mIsExpandable(p.is_expandable),
mExpandLinesCount(p.expand_lines_count),
- mPrevLinesCount(0)
+ mPrevLinesCount(0),
+ mSingleLineMode(false),
+ mPrevExpandedLineCount(S32_MAX)
{
// Initialize current history line iterator
mCurrentHistoryLine = mLineHistory.begin();
@@ -82,20 +85,23 @@ boost::signals2::connection LLChatEntry::setTextExpandedCallback(const commit_si
void LLChatEntry::expandText()
{
+ S32 line_count = mSingleLineMode ? 1 : mExpandLinesCount;
+
int visible_lines_count = llabs(getVisibleLines(true).first - getVisibleLines(true).second);
- bool can_expand = getLineCount() <= mExpandLinesCount;
+ bool can_changed = getLineCount() <= line_count || line_count < mPrevExpandedLineCount ;
+ mPrevExpandedLineCount = line_count;
// true if pasted text has more lines than expand height limit and expand limit is not reached yet
- bool text_pasted = (getLineCount() > mExpandLinesCount) && (visible_lines_count < mExpandLinesCount);
+ bool text_pasted = (getLineCount() > line_count) && (visible_lines_count < line_count);
- if (mIsExpandable && (can_expand || text_pasted) && getLineCount() != mPrevLinesCount)
+ if (mIsExpandable && (can_changed || text_pasted || mSingleLineMode) && getLineCount() != mPrevLinesCount)
{
int lines_height = 0;
if (text_pasted)
{
// text is pasted and now mLineInfoList.size() > mExpandLineCounts and mLineInfoList is not empty,
- // so lines_height is the sum of the last 'mExpandLinesCount' lines height
- lines_height = (mLineInfoList.end() - mExpandLinesCount)->mRect.mTop - mLineInfoList.back().mRect.mBottom;
+ // so lines_height is the sum of the last 'expanded_line_count' lines height
+ lines_height = (mLineInfoList.end() - line_count)->mRect.mTop - mLineInfoList.back().mRect.mBottom;
}
else
{
@@ -114,6 +120,8 @@ void LLChatEntry::expandText()
{
(*mTextExpandedSignal)(this, LLSD() );
}
+
+ needsReflow();
}
}
@@ -235,3 +243,15 @@ BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask)
return handled;
}
+
+void LLChatEntry::enableSingleLineMode(bool single_line_mode)
+{
+ if (mScroller)
+ {
+ mScroller->setSize(single_line_mode ? 0 : -1);
+ }
+
+ mSingleLineMode = single_line_mode;
+ mPrevLinesCount = -1;
+ setWordWrap(!single_line_mode);
+}