summaryrefslogtreecommitdiff
path: root/indra/llui/llchatentry.cpp
diff options
context:
space:
mode:
authorprep@lindenlab.com <prep@lindenlab.com>2013-03-29 10:37:58 -0500
committerprep@lindenlab.com <prep@lindenlab.com>2013-03-29 10:37:58 -0500
commit0f24668b0a834e37a3a8767abc7b0ee51bf23fcd (patch)
tree4ae685f79c3964e1ac7246641fa9d957b25b5ee1 /indra/llui/llchatentry.cpp
parent8e6d2f8ddc3fe8a1eee3abe99eb5abd3575c5841 (diff)
parenta62a824efb89aff3056d0659ee2c23ad6d15eeaa (diff)
Merged in Chui beta6+ fixes
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);
+}