From e8b8a12b7365c17cf0326be365b78bcb1da1bfac Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Tue, 12 Mar 2013 10:48:05 -0700 Subject: Mods to make compile on gcc 4.6.3 work mo betta --- indra/llui/lltextbase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui/lltextbase.cpp') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 3815eec447..ec66b6df56 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -351,7 +351,6 @@ void LLTextBase::drawSelectionBackground() S32 selection_left = llmin( mSelectionStart, mSelectionEnd ); S32 selection_right = llmax( mSelectionStart, mSelectionEnd ); - LLRect selection_rect = mVisibleTextRect; // Skip through the lines we aren't drawing. LLRect content_display_rect = getVisibleDocumentRect(); @@ -2241,6 +2240,8 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, // Figure out which line we're nearest to. LLRect visible_region = getVisibleDocumentRect(); LLRect doc_rect = mDocumentView->getRect(); + (void)visible_region; + (void)doc_rect; S32 doc_y = local_y - doc_rect.mBottom; -- cgit v1.2.3 From 3c2c897cac98e39dcc0447c2d7d458ba313a8cd6 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Fri, 12 Apr 2013 20:27:28 +0300 Subject: CHUI-916 FIXED Clear mMisspellRanges if spell check is not needed. --- indra/llui/lltextbase.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llui/lltextbase.cpp') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index a815cfc176..def1277ba7 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -652,6 +652,10 @@ void LLTextBase::drawText() mSpellCheckEnd = end; } } + else + { + mMisspellRanges.clear(); + } LLTextSegmentPtr cur_segment = *seg_iter; -- cgit v1.2.3 From 5cf1c9bfe1e4285929f41adda84f8a7208fe1805 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 24 Apr 2013 17:26:09 -0700 Subject: CHUI-845 : Make changeLine() a bit more resistant to unforseen line count values (i.e. 0) and a bit more general --- indra/llui/lltextbase.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'indra/llui/lltextbase.cpp') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index def1277ba7..5e1ed81097 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2606,21 +2606,18 @@ void LLTextBase::setCursorAtLocalPos( S32 local_x, S32 local_y, bool round, bool void LLTextBase::changeLine( S32 delta ) { S32 line = getLineNumFromDocIndex(mCursorPos); - - S32 new_line = line; - if( (delta < 0) && (line > 0 ) ) - { - new_line = line - 1; - } - else if( (delta > 0) && (line < (getLineCount() - 1)) ) - { - new_line = line + 1; - } - - LLRect visible_region = getVisibleDocumentRect(); - - S32 new_cursor_pos = getDocIndexFromLocalCoord(mDesiredXPixel, mLineInfoList[new_line].mRect.mBottom + mVisibleTextRect.mBottom - visible_region.mBottom, TRUE); - setCursorPos(new_cursor_pos, true); + S32 max_line_nb = getLineCount() - 1; + max_line_nb = (max_line_nb < 0 ? 0 : max_line_nb); + + S32 new_line = llclamp(line + delta, 0, max_line_nb); + + if (new_line != line) + { + LLRect visible_region = getVisibleDocumentRect(); + S32 new_cursor_pos = getDocIndexFromLocalCoord(mDesiredXPixel, + mLineInfoList[new_line].mRect.mBottom + mVisibleTextRect.mBottom - visible_region.mBottom, TRUE); + setCursorPos(new_cursor_pos, true); + } } bool LLTextBase::scrolledToStart() -- cgit v1.2.3 From 3bbab5bb46b034b87eef88466d4cf84d841bb087 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Tue, 4 Jun 2013 14:45:19 +0300 Subject: CHUI-957 FIXED Missing line was added. --- indra/llui/lltextbase.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui/lltextbase.cpp') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index c2ab01de3a..bf216b32d4 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1923,6 +1923,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) registrar.add("Url.Teleport", boost::bind(&LLUrlAction::teleportToLocation, url)); registrar.add("Url.ShowProfile", boost::bind(&LLUrlAction::showProfile, url)); registrar.add("Url.AddFriend", boost::bind(&LLUrlAction::addFriend, url)); + registrar.add("Url.SendIM", boost::bind(&LLUrlAction::sendIM, url)); registrar.add("Url.ShowOnMap", boost::bind(&LLUrlAction::showLocationOnMap, url)); registrar.add("Url.CopyLabel", boost::bind(&LLUrlAction::copyLabelToClipboard, url)); registrar.add("Url.CopyUrl", boost::bind(&LLUrlAction::copyURLToClipboard, url)); -- cgit v1.2.3 From 0ada8944ee7427c2ea175602b6a139f2fa23cf73 Mon Sep 17 00:00:00 2001 From: PavelK ProductEngine Date: Wed, 5 Jun 2013 19:40:06 +0300 Subject: CHUI-964 ADD FIX Oversized "To" input field hides actual IM text --- indra/llui/lltextbase.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'indra/llui/lltextbase.cpp') 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 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 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(); } -- cgit v1.2.3 From 882ab04ef3e412716f0f034e348007b5f3016f3c Mon Sep 17 00:00:00 2001 From: mberezhnoy Date: Thu, 13 Jun 2013 20:21:24 +0300 Subject: CHUI-809 (Right-click menu on user name in compat chat mode doesn't have "IM") Added callback for friendship checking --- indra/llui/lltextbase.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'indra/llui/lltextbase.cpp') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index a53a38124c..e2a39d89e4 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -180,6 +180,7 @@ LLTextBase::Params::Params() LLTextBase::LLTextBase(const LLTextBase::Params &p) : LLUICtrl(p, LLTextViewModelPtr(new LLTextViewModel)), mURLClickSignal(NULL), + mIsFriendSignal(NULL), mMaxTextByteLength( p.max_text_length ), mFont(p.font), mFontShadow(p.font_shadow), @@ -1943,6 +1944,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) registrar.add("Url.Teleport", boost::bind(&LLUrlAction::teleportToLocation, url)); registrar.add("Url.ShowProfile", boost::bind(&LLUrlAction::showProfile, url)); registrar.add("Url.AddFriend", boost::bind(&LLUrlAction::addFriend, url)); + registrar.add("Url.RemoveFriend", boost::bind(&LLUrlAction::removeFriend, url)); registrar.add("Url.SendIM", boost::bind(&LLUrlAction::sendIM, url)); registrar.add("Url.ShowOnMap", boost::bind(&LLUrlAction::showLocationOnMap, url)); registrar.add("Url.CopyLabel", boost::bind(&LLUrlAction::copyLabelToClipboard, url)); @@ -1952,6 +1954,19 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) delete mPopupMenu; mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile(xui_file, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); + if (mIsFriendSignal) + { + bool isFriend = (*mIsFriendSignal)(LLUUID(LLUrlAction::getUserID(url))); + LLView* addFriendButton = mPopupMenu->getChild("add_friend"); + LLView* removeFriendButton = mPopupMenu->getChild("remove_friend"); + + if (addFriendButton && removeFriendButton) + { + addFriendButton->setEnabled(!isFriend); + removeFriendButton->setEnabled(isFriend); + } + } + if (mPopupMenu) { mPopupMenu->show(x, y); @@ -2932,6 +2947,15 @@ boost::signals2::connection LLTextBase::setURLClickedCallback(const commit_signa return mURLClickSignal->connect(cb); } +boost::signals2::connection LLTextBase::setIsFriendCallback(const is_friend_signal_t::slot_type& cb) +{ + if (!mIsFriendSignal) + { + mIsFriendSignal = new is_friend_signal_t(); + } + return mIsFriendSignal->connect(cb); +} + // // LLTextSegment // -- cgit v1.2.3 From 2b8beeeff1485682e2b47f330dc8b3c24e966961 Mon Sep 17 00:00:00 2001 From: mberezhnoy Date: Thu, 20 Jun 2013 12:45:22 +0300 Subject: CHUI-809 (Right-click menu on user name in compat chat mode doesn't have "IM") Fixed "Add friend" option always being greyed out, add ability to block object via context menu in compact chat mode. --- indra/llui/lltextbase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui/lltextbase.cpp') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index e2a39d89e4..0276ade3e1 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1941,6 +1941,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) registrar.add("Url.OpenInternal", boost::bind(&LLUrlAction::openURLInternal, url)); registrar.add("Url.OpenExternal", boost::bind(&LLUrlAction::openURLExternal, url)); registrar.add("Url.Execute", boost::bind(&LLUrlAction::executeSLURL, url)); + registrar.add("Url.Block", boost::bind(&LLUrlAction::blockObject, url)); registrar.add("Url.Teleport", boost::bind(&LLUrlAction::teleportToLocation, url)); registrar.add("Url.ShowProfile", boost::bind(&LLUrlAction::showProfile, url)); registrar.add("Url.AddFriend", boost::bind(&LLUrlAction::addFriend, url)); @@ -1956,7 +1957,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) LLMenuHolderGL::child_registry_t::instance()); if (mIsFriendSignal) { - bool isFriend = (*mIsFriendSignal)(LLUUID(LLUrlAction::getUserID(url))); + bool isFriend = *(*mIsFriendSignal)(LLUUID(LLUrlAction::getUserID(url))); LLView* addFriendButton = mPopupMenu->getChild("add_friend"); LLView* removeFriendButton = mPopupMenu->getChild("remove_friend"); -- cgit v1.2.3 From e7bc0e6e6388481db1ef98407021f83870dc6351 Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 14 Aug 2013 01:00:41 +0200 Subject: BUG-3605 / CHUIBUG-197 Don't create excessive amounts of string objects in LLNormalTextSegment::getNumChars. --- indra/llui/lltextbase.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llui/lltextbase.cpp') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 0276ade3e1..3c284b3f03 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -3250,7 +3250,7 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin : LLFontGL::ONLY_WORD_BOUNDARIES; - LLWString offsetString(text.c_str() + segment_offset + mStart); + S32 offsetLength = text.length() - (segment_offset + mStart); if(getLength() < segment_offset + mStart) { @@ -3258,13 +3258,13 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin << segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << "\tmax_chars\t" << max_chars << llendl; } - if(offsetString.length() + 1 < max_chars) + if( (offsetLength + 1) < max_chars) { - llinfos << "offsetString.length() + 1 < max_chars\t max_chars:\t" << max_chars << "\toffsetString.length():\t" << offsetString.length() << " getLength() : " + llinfos << "offsetString.length() + 1 < max_chars\t max_chars:\t" << max_chars << "\toffsetLength:\t" << offsetLength << " getLength() : " << getLength() << "\tsegment_offset:\t" << segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << llendl; } - S32 num_chars = mStyle->getFont()->maxDrawableChars(offsetString.c_str(), + S32 num_chars = mStyle->getFont()->maxDrawableChars( text.c_str() + (segment_offset + mStart), (F32)num_pixels, max_chars, word_wrap_style); -- cgit v1.2.3