diff options
author | Richard Linden <none@none> | 2012-08-01 01:27:38 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2012-08-01 01:27:38 -0700 |
commit | 997812c7b04f9edc119006baeb261cf602631978 (patch) | |
tree | ec470bc9af3cb207d9e9a504728bda679be673fe | |
parent | a204059d2e69fb33cb1a3c8d2fbed35d3967297c (diff) | |
parent | 2855e8bf8e91454e814cdd00985056830d8a8f5b (diff) |
merge with ssh://hg.lindenlab.com/richard/viewer-chui
-rw-r--r-- | indra/llui/llfolderviewitem.cpp | 47 | ||||
-rw-r--r-- | indra/llui/llfolderviewitem.h | 2 | ||||
-rw-r--r-- | indra/llui/llfolderviewmodel.h | 19 | ||||
-rw-r--r-- | indra/newview/llfolderviewmodelinventory.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llfolderviewmodelinventory.h | 2 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.h | 4 | ||||
-rw-r--r-- | indra/newview/llinventoryfilter.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llinventoryfilter.h | 6 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 316 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 6 |
10 files changed, 224 insertions, 204 deletions
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 167c8123a1..9b802157f2 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -106,8 +106,6 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mHasVisibleChildren(FALSE), mIndentation(0), mItemHeight(p.item_height), - //TODO RN: create interface for string highlighting - //mStringMatchOffset(std::string::npos), mControlLabelRotation(0.f), mDragAndDropTarget(FALSE), mLabel(p.name), @@ -778,29 +776,28 @@ void LLFolderViewItem::draw() //--------------------------------------------------------------------------------// // Highlight string match // - //TODO RN: expose interface for highlighting - //if (mStringMatchOffset != std::string::npos) - //{ - // // don't draw backgrounds for zero-length strings - // S32 filter_string_length = getRoot()->getFilterSubString().size(); - // if (filter_string_length > 0) - // { - // std::string combined_string = mLabel + mLabelSuffix; - // S32 left = llround(text_left) + font->getWidth(combined_string, 0, mStringMatchOffset) - 1; - // S32 right = left + font->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2; - // S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD); - // S32 top = getRect().getHeight() - TOP_PAD; - // - // LLUIImage* box_image = default_params.selection_image; - // LLRect box_rect(left, top, right, bottom); - // box_image->draw(box_rect, sFilterBGColor); - // F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, mStringMatchOffset); - // F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; - // font->renderUTF8( combined_string, mStringMatchOffset, match_string_left, yy, - // sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - // filter_string_length, S32_MAX, &right_x, FALSE ); - // } - //} + if (mViewModelItem->hasFilterStringMatch()) + { + // don't draw backgrounds for zero-length strings + std::string::size_type filter_string_length = mViewModelItem->getFilterStringSize(); + if (filter_string_length > 0) + { + std::string combined_string = mLabel + mLabelSuffix; + S32 left = llround(text_left) + font->getWidth(combined_string, 0, mViewModelItem->getFilterStringOffset()) - 1; + S32 right = left + font->getWidth(combined_string, mViewModelItem->getFilterStringOffset(), filter_string_length) + 2; + S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD); + S32 top = getRect().getHeight() - TOP_PAD; + + LLUIImage* box_image = default_params.selection_image; + LLRect box_rect(left, top, right, bottom); + box_image->draw(box_rect, sFilterBGColor); + F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, mViewModelItem->getFilterStringOffset()); + F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD; + font->renderUTF8( combined_string, mViewModelItem->getFilterStringOffset(), match_string_left, yy, + sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, + filter_string_length, S32_MAX, &right_x, FALSE ); + } + } } const LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) const diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index baa12b38f3..19caa7f020 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -103,8 +103,6 @@ protected: S32 mDragStartX, mDragStartY; - //TODO RN: create interface for string highlighting - //std::string::size_type mStringMatchOffset; F32 mControlLabelRotation; LLFolderView* mRoot; bool mHasVisibleChildren; diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 81de15923a..3f825a8670 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -73,6 +73,8 @@ public: virtual bool showAllResults() const = 0; + virtual std::string::size_type getStringMatchOffset(LLFolderViewModelItem* item) const = 0; + virtual std::string::size_type getFilterStringSize() const = 0; // +-------------------------------------------------------------------+ // + Status // +-------------------------------------------------------------------+ @@ -173,8 +175,11 @@ public: virtual void filter( LLFolderViewFilter& filter) = 0; virtual bool passedFilter(S32 filter_generation = -1) = 0; virtual bool descendantsPassedFilter(S32 filter_generation = -1) = 0; - virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) = 0; + virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) = 0; virtual void dirtyFilter() = 0; + virtual bool hasFilterStringMatch() = 0; + virtual std::string::size_type getFilterStringOffset() = 0; + virtual std::string::size_type getFilterStringSize() = 0; virtual S32 getLastFilterGeneration() const = 0; @@ -210,6 +215,8 @@ public: : mSortVersion(-1), mPassedFilter(true), mPassedFolderFilter(true), + mStringMatchOffsetFilter(std::string::npos), + mStringFilterSize(0), mFolderViewItem(NULL), mLastFilterGeneration(-1), mMostFilteredDescendantGeneration(-1), @@ -234,6 +241,10 @@ public: mParent->dirtyFilter(); } } + bool hasFilterStringMatch() { return mStringMatchOffsetFilter != std::string::npos; } + std::string::size_type getFilterStringOffset() { return mStringMatchOffsetFilter; } + std::string::size_type getFilterStringSize() { return mStringFilterSize; } + virtual void addChild(LLFolderViewModelItem* child) { mChildren.push_back(child); @@ -248,11 +259,13 @@ public: dirtyFilter(); } - void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) + void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size) { mPassedFilter = passed; mPassedFolderFilter = passed_folder; mLastFilterGeneration = filter_generation; + mStringMatchOffsetFilter = string_offset; + mStringFilterSize = string_size; } virtual bool potentiallyVisible() @@ -287,6 +300,8 @@ protected: S32 mSortVersion; bool mPassedFilter; bool mPassedFolderFilter; + std::string::size_type mStringMatchOffsetFilter; + std::string::size_type mStringFilterSize; S32 mLastFilterGeneration; S32 mMostFilteredDescendantGeneration; diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 21218850a6..e2376b18d5 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -125,9 +125,9 @@ void LLFolderViewModelItemInventory::requestSort() } } -void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) +void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_folder, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size) { - LLFolderViewModelItemCommon::setPassedFilter(passed, passed_folder, filter_generation); + LLFolderViewModelItemCommon::setPassedFilter(passed, passed_folder, filter_generation, string_offset, string_size); bool passed_filter_before = mPrevPassedAllFilters; mPrevPassedAllFilters = passedFilter(filter_generation); @@ -205,9 +205,7 @@ void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) ? filter.checkFolder(this) : true; - setPassedFilter(passed_filter, passed_filter_folder, filter_generation); - //TODO RN: create interface for string highlighting - //mStringMatchOffset = filter.getStringMatchOffset(this); + setPassedFilter(passed_filter, passed_filter_folder, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize()); } } diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h index 5b0ad5e46e..664addf336 100644 --- a/indra/newview/llfolderviewmodelinventory.h +++ b/indra/newview/llfolderviewmodelinventory.h @@ -53,7 +53,7 @@ public: virtual EInventorySortGroup getSortGroup() const = 0; virtual LLInventoryObject* getInventoryObject() const = 0; virtual void requestSort(); - virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation); + virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0); virtual void filter( LLFolderViewFilter& filter); virtual void filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 7005ab7b6a..9b487dd652 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -91,7 +91,7 @@ public: virtual bool potentiallyVisible() { return true; } virtual void filter( LLFolderViewFilter& filter) { } virtual bool descendantsPassedFilter(S32 filter_generation = -1) { return true; } - virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) { } + virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) { } virtual bool passedFilter(S32 filter_generation = -1) { return true; } // The action callbacks @@ -142,6 +142,8 @@ public: void setEmptyLookupMessage(const std::string& message) { } std::string getEmptyLookupMessage() const { return mEmpty; } bool showAllResults() const { return true; } + std::string::size_type getStringMatchOffset(LLFolderViewModelItem* item) const { return std::string::npos; } + std::string::size_type getFilterStringSize() const { return 0; } bool isActive() const { return false; } bool isModified() const { return false; } diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 7993dd04c5..c913269aad 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -94,9 +94,9 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) return passed_clipboard; } - std::string::size_type string_offset = mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : 0; + std::string::size_type string_offset = mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : std::string::npos; - BOOL passed = string_offset != std::string::npos; + BOOL passed = (mFilterSubString.size() == 0 || string_offset != std::string::npos); passed = passed && checkAgainstFilterType(listener); passed = passed && checkAgainstPermissions(listener); passed = passed && checkAgainstFilterLinks(listener); @@ -107,7 +107,7 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) bool LLInventoryFilter::check(const LLInventoryItem* item) { - std::string::size_type string_offset = mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos; + std::string::size_type string_offset = mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos; const bool passed_filtertype = checkAgainstFilterType(item); const bool passed_permissions = checkAgainstPermissions(item); @@ -115,7 +115,7 @@ bool LLInventoryFilter::check(const LLInventoryItem* item) const bool passed = (passed_filtertype && passed_permissions && passed_clipboard - && (mFilterSubString.size() == 0 || string_offset != std::string::npos)); + && (mFilterSubString.size() == 0 || string_offset != std::string::npos)); return passed; } @@ -382,9 +382,10 @@ const std::string& LLInventoryFilter::getFilterSubString(BOOL trim) const return mFilterSubString; } -std::string::size_type LLInventoryFilter::getStringMatchOffset(LLFolderViewItem* item) const +std::string::size_type LLInventoryFilter::getStringMatchOffset(LLFolderViewModelItem* item) const { - return mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos; + const LLFolderViewModelItemInventory* listener = static_cast<const LLFolderViewModelItemInventory*>(item); + return mFilterSubString.size() ? listener->getSearchableName().find(mFilterSubString) : std::string::npos; } bool LLInventoryFilter::isDefault() const @@ -991,6 +992,11 @@ bool LLInventoryFilter::hasFilterString() const return mFilterSubString.size() > 0; } +std::string::size_type LLInventoryFilter::getFilterStringSize() const +{ + return mFilterSubString.size(); +} + PermissionMask LLInventoryFilter::getFilterPermissions() const { return mFilterOps.mPermissions; diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index b560730873..4912b5ca91 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -191,10 +191,8 @@ public: bool showAllResults() const; - - std::string::size_type getStringMatchOffset() const; - - std::string::size_type getStringMatchOffset(LLFolderViewItem* item) const; + std::string::size_type getStringMatchOffset(LLFolderViewModelItem* item) const; + std::string::size_type getFilterStringSize() const; // +-------------------------------------------------------------------+ // + Presentation // +-------------------------------------------------------------------+ diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e5362261cf..2871b7b018 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3124,191 +3124,191 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) { debugAvatarRezTime("AvatarRezLeftAppearanceNotification","left appearance mode"); } + } - // Rebuild name tag if state change detected - if (mNameString.empty() - || new_name - || (!title && !mTitle.empty()) - || (title && mTitle != title->getString()) - || is_away != mNameAway - || is_busy != mNameBusy - || is_muted != mNameMute - || is_appearance != mNameAppearance - || is_friend != mNameFriend - || is_cloud != mNameCloud) - { - LLColor4 name_tag_color = getNameTagColor(is_friend); + // Rebuild name tag if state change detected + if (mNameString.empty() + || new_name + || (!title && !mTitle.empty()) + || (title && mTitle != title->getString()) + || is_away != mNameAway + || is_busy != mNameBusy + || is_muted != mNameMute + || is_appearance != mNameAppearance + || is_friend != mNameFriend + || is_cloud != mNameCloud) + { + LLColor4 name_tag_color = getNameTagColor(is_friend); - clearNameTag(); + clearNameTag(); - if (is_away || is_muted || is_busy || is_appearance) + if (is_away || is_muted || is_busy || is_appearance) + { + std::string line; + if (is_away) { - std::string line; - if (is_away) - { - line += LLTrans::getString("AvatarAway"); - line += ", "; - } - if (is_busy) - { - line += LLTrans::getString("AvatarBusy"); - line += ", "; - } - if (is_muted) - { - line += LLTrans::getString("AvatarMuted"); - line += ", "; - } - if (is_appearance) - { - line += LLTrans::getString("AvatarEditingAppearance"); - line += ", "; - } - if (is_cloud) - { - line += LLTrans::getString("LoadingData"); - line += ", "; - } - // trim last ", " - line.resize( line.length() - 2 ); - addNameTagLine(line, name_tag_color, LLFontGL::NORMAL, - LLFontGL::getFontSansSerifSmall()); + line += LLTrans::getString("AvatarAway"); + line += ", "; } - - if (sRenderGroupTitles - && title && title->getString() && title->getString()[0] != '\0') + if (is_busy) { - std::string title_str = title->getString(); - LLStringFn::replace_ascii_controlchars(title_str,LL_UNKNOWN_CHAR); - addNameTagLine(title_str, name_tag_color, LLFontGL::NORMAL, - LLFontGL::getFontSansSerifSmall()); + line += LLTrans::getString("AvatarBusy"); + line += ", "; } - - static LLUICachedControl<bool> show_display_names("NameTagShowDisplayNames"); - static LLUICachedControl<bool> show_usernames("NameTagShowUsernames"); - - if (LLAvatarNameCache::useDisplayNames()) + if (is_muted) { - LLAvatarName av_name; - if (!LLAvatarNameCache::get(getID(), &av_name)) - { - // ...call this function back when the name arrives - // and force a rebuild - LLAvatarNameCache::get(getID(), - boost::bind(&LLVOAvatar::clearNameTag, this)); - } - - // Might be blank if name not available yet, that's OK - if (show_display_names) - { - addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, - LLFontGL::getFontSansSerif()); - } - // Suppress SLID display if display name matches exactly (ugh) - if (show_usernames && !av_name.mIsDisplayNameDefault) - { - // *HACK: Desaturate the color - LLColor4 username_color = name_tag_color * 0.83f; - addNameTagLine(av_name.mUsername, username_color, LLFontGL::NORMAL, - LLFontGL::getFontSansSerifSmall()); - } + line += LLTrans::getString("AvatarMuted"); + line += ", "; } - else + if (is_appearance) { - const LLFontGL* font = LLFontGL::getFontSansSerif(); - std::string full_name = LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); - addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font); + line += LLTrans::getString("AvatarEditingAppearance"); + line += ", "; } - - mNameAway = is_away; - mNameBusy = is_busy; - mNameMute = is_muted; - mNameAppearance = is_appearance; - mNameFriend = is_friend; - mNameCloud = is_cloud; - mTitle = title ? title->getString() : ""; - LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); - new_name = TRUE; + if (is_cloud) + { + line += LLTrans::getString("LoadingData"); + line += ", "; + } + // trim last ", " + line.resize( line.length() - 2 ); + addNameTagLine(line, name_tag_color, LLFontGL::NORMAL, + LLFontGL::getFontSansSerifSmall()); } - if (mVisibleChat) + if (sRenderGroupTitles + && title && title->getString() && title->getString()[0] != '\0') { - mNameText->setFont(LLFontGL::getFontSansSerif()); - mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT); - mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); + std::string title_str = title->getString(); + LLStringFn::replace_ascii_controlchars(title_str,LL_UNKNOWN_CHAR); + addNameTagLine(title_str, name_tag_color, LLFontGL::NORMAL, + LLFontGL::getFontSansSerifSmall()); + } - char line[MAX_STRING]; /* Flawfinder: ignore */ - line[0] = '\0'; - std::deque<LLChat>::iterator chat_iter = mChats.begin(); - mNameText->clearString(); + static LLUICachedControl<bool> show_display_names("NameTagShowDisplayNames"); + static LLUICachedControl<bool> show_usernames("NameTagShowUsernames"); - LLColor4 new_chat = LLUIColorTable::instance().getColor( isSelf() ? "UserChatColor" : "AgentChatColor" ); - LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f); - LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f); - if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES) + if (LLAvatarNameCache::useDisplayNames()) + { + LLAvatarName av_name; + if (!LLAvatarNameCache::get(getID(), &av_name)) { - ++chat_iter; + // ...call this function back when the name arrives + // and force a rebuild + LLAvatarNameCache::get(getID(), + boost::bind(&LLVOAvatar::clearNameTag, this)); } - for(; chat_iter != mChats.end(); ++chat_iter) + // Might be blank if name not available yet, that's OK + if (show_display_names) { - F32 chat_fade_amt = llclamp((F32)((LLFrameTimer::getElapsedSeconds() - chat_iter->mTime) / CHAT_FADE_TIME), 0.f, 4.f); - LLFontGL::StyleFlags style; - switch(chat_iter->mChatType) - { - case CHAT_TYPE_WHISPER: - style = LLFontGL::ITALIC; - break; - case CHAT_TYPE_SHOUT: - style = LLFontGL::BOLD; - break; - default: - style = LLFontGL::NORMAL; - break; - } - if (chat_fade_amt < 1.f) - { - F32 u = clamp_rescale(chat_fade_amt, 0.9f, 1.f, 0.f, 1.f); - mNameText->addLine(chat_iter->mText, lerp(new_chat, normal_chat, u), style); - } - else if (chat_fade_amt < 2.f) - { - F32 u = clamp_rescale(chat_fade_amt, 1.9f, 2.f, 0.f, 1.f); - mNameText->addLine(chat_iter->mText, lerp(normal_chat, old_chat, u), style); - } - else if (chat_fade_amt < 3.f) - { - // *NOTE: only remove lines down to minimum number - mNameText->addLine(chat_iter->mText, old_chat, style); - } + addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, + LLFontGL::getFontSansSerif()); } - mNameText->setVisibleOffScreen(TRUE); - - if (mTyping) + // Suppress SLID display if display name matches exactly (ugh) + if (show_usernames && !av_name.mIsDisplayNameDefault) { - S32 dot_count = (llfloor(mTypingTimer.getElapsedTimeF32() * 3.f) + 2) % 3 + 1; - switch(dot_count) - { - case 1: - mNameText->addLine(".", new_chat); - break; - case 2: - mNameText->addLine("..", new_chat); - break; - case 3: - mNameText->addLine("...", new_chat); - break; - } - + // *HACK: Desaturate the color + LLColor4 username_color = name_tag_color * 0.83f; + addNameTagLine(av_name.mUsername, username_color, LLFontGL::NORMAL, + LLFontGL::getFontSansSerifSmall()); } } else { - // ...not using chat bubbles, just names - mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_CENTER); - mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); - mNameText->setVisibleOffScreen(FALSE); + const LLFontGL* font = LLFontGL::getFontSansSerif(); + std::string full_name = LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); + addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font); + } + + mNameAway = is_away; + mNameBusy = is_busy; + mNameMute = is_muted; + mNameAppearance = is_appearance; + mNameFriend = is_friend; + mNameCloud = is_cloud; + mTitle = title ? title->getString() : ""; + LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); + new_name = TRUE; + } + + if (mVisibleChat) + { + mNameText->setFont(LLFontGL::getFontSansSerif()); + mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT); + mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); + + char line[MAX_STRING]; /* Flawfinder: ignore */ + line[0] = '\0'; + std::deque<LLChat>::iterator chat_iter = mChats.begin(); + mNameText->clearString(); + + LLColor4 new_chat = LLUIColorTable::instance().getColor( isSelf() ? "UserChatColor" : "AgentChatColor" ); + LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f); + LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f); + if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES) + { + ++chat_iter; } + + for(; chat_iter != mChats.end(); ++chat_iter) + { + F32 chat_fade_amt = llclamp((F32)((LLFrameTimer::getElapsedSeconds() - chat_iter->mTime) / CHAT_FADE_TIME), 0.f, 4.f); + LLFontGL::StyleFlags style; + switch(chat_iter->mChatType) + { + case CHAT_TYPE_WHISPER: + style = LLFontGL::ITALIC; + break; + case CHAT_TYPE_SHOUT: + style = LLFontGL::BOLD; + break; + default: + style = LLFontGL::NORMAL; + break; + } + if (chat_fade_amt < 1.f) + { + F32 u = clamp_rescale(chat_fade_amt, 0.9f, 1.f, 0.f, 1.f); + mNameText->addLine(chat_iter->mText, lerp(new_chat, normal_chat, u), style); + } + else if (chat_fade_amt < 2.f) + { + F32 u = clamp_rescale(chat_fade_amt, 1.9f, 2.f, 0.f, 1.f); + mNameText->addLine(chat_iter->mText, lerp(normal_chat, old_chat, u), style); + } + else if (chat_fade_amt < 3.f) + { + // *NOTE: only remove lines down to minimum number + mNameText->addLine(chat_iter->mText, old_chat, style); + } + } + mNameText->setVisibleOffScreen(TRUE); + + if (mTyping) + { + S32 dot_count = (llfloor(mTypingTimer.getElapsedTimeF32() * 3.f) + 2) % 3 + 1; + switch(dot_count) + { + case 1: + mNameText->addLine(".", new_chat); + break; + case 2: + mNameText->addLine("..", new_chat); + break; + case 3: + mNameText->addLine("...", new_chat); + break; + } + + } + } + else + { + // ...not using chat bubbles, just names + mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_CENTER); + mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); + mNameText->setVisibleOffScreen(FALSE); } } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index f3d2762d3f..e85637826d 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6413,6 +6413,7 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th icon="notify.tga" name="TeleportOffered" log_to_im="true" + log_to_chat="false" type="offer"> [NAME_SLURL] has offered to teleport you to their location: @@ -6434,6 +6435,8 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th <notification icon="notify.tga" name="TeleportOffered_MaturityExceeded" + log_to_im="true" + log_to_chat="false" type="offer"> [NAME_SLURL] has offered to teleport you to their location: @@ -6457,6 +6460,8 @@ This region contains [REGION_CONTENT_MATURITY] content, but your current prefere <notification icon="notify.tga" name="TeleportOffered_MaturityBlocked" + log_to_im="true" + log_to_chat="false" type="notifytip"> [NAME_SLURL] has offered to teleport you to their location: @@ -6471,6 +6476,7 @@ However, this region contains content accessible to adults only. icon="notify.tga" name="TeleportOfferSent" log_to_im="true" + log_to_chat="false" show_toast="false" type="offer"> Teleport offer sent to [TO_NAME] |