diff options
author | mberezhnoy <mberezhnoy@productengine.com> | 2013-06-07 20:06:20 +0300 |
---|---|---|
committer | mberezhnoy <mberezhnoy@productengine.com> | 2013-06-07 20:06:20 +0300 |
commit | 42f2f419e5717a541956ef12afa1d55e4c142440 (patch) | |
tree | c629002a61544c8fdbd6e0b3196a1b4b6135b431 /indra/llui | |
parent | 0b458690ceb8d7cbb9b1b8b5620def2a08af2524 (diff) | |
parent | ab37c8b8f5d830af7155bf63c084dad76070cb42 (diff) |
merge
Diffstat (limited to 'indra/llui')
-rwxr-xr-x | indra/llui/llchatentry.cpp | 2 | ||||
-rwxr-xr-x | indra/llui/llchatentry.h | 2 | ||||
-rwxr-xr-x | indra/llui/lltextbase.cpp | 26 | ||||
-rwxr-xr-x | indra/llui/lltextbase.h | 2 |
4 files changed, 26 insertions, 6 deletions
diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp index c7e732e0c9..c04b70eb64 100755 --- a/indra/llui/llchatentry.cpp +++ b/indra/llui/llchatentry.cpp @@ -158,7 +158,7 @@ void LLChatEntry::onValueChange(S32 start, S32 end) resetLabel(); } -bool LLChatEntry::useLabel() +bool LLChatEntry::useLabel() const { return !getLength() && !mLabel.empty(); } diff --git a/indra/llui/llchatentry.h b/indra/llui/llchatentry.h index 3a5e87e8c8..e67f39b21b 100755 --- a/indra/llui/llchatentry.h +++ b/indra/llui/llchatentry.h @@ -56,7 +56,7 @@ protected: LLChatEntry(const Params& p); /*virtual*/ void beforeValueChange(); /*virtual*/ void onValueChange(S32 start, S32 end); - /*virtual*/ bool useLabel(); + /*virtual*/ bool useLabel() const; public: diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index bf216b32d4..a53a38124c 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1854,7 +1854,17 @@ LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index) static LLPointer<LLIndexSegment> index_segment = new LLIndexSegment(); - if (index > getLength()) { return mSegments.end(); } + S32 text_len = 0; + if (!useLabel()) + { + text_len = getLength(); + } + else + { + text_len = mLabel.getWString().length(); + } + + if (index > text_len) { return mSegments.end(); } // when there are no segments, we return the end iterator, which must be checked by caller if (mSegments.size() <= 1) { return mSegments.begin(); } @@ -1870,7 +1880,17 @@ LLTextBase::segment_set_t::const_iterator LLTextBase::getSegIterContaining(S32 i { static LLPointer<LLIndexSegment> index_segment = new LLIndexSegment(); - if (index > getLength()) { return mSegments.end(); } + S32 text_len = 0; + if (!useLabel()) + { + text_len = getLength(); + } + else + { + text_len = mLabel.getWString().length(); + } + + if (index > text_len) { return mSegments.end(); } // when there are no segments, we return the end iterator, which must be checked by caller if (mSegments.size() <= 1) { return mSegments.begin(); } @@ -2101,7 +2121,7 @@ void LLTextBase::resetLabel() } } -bool LLTextBase::useLabel() +bool LLTextBase::useLabel() const { return !getLength() && !mLabel.empty() && !hasFocus(); } diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 20a73387b5..2fb58d468a 100755 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -507,7 +507,7 @@ protected: void initFromParams(const Params& p); virtual void beforeValueChange(); virtual void onValueChange(S32 start, S32 end); - virtual bool useLabel(); + virtual bool useLabel() const; // draw methods void drawSelectionBackground(); // draws the black box behind the selected text |