summaryrefslogtreecommitdiff
path: root/indra/newview/llavatarlistitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llavatarlistitem.cpp')
-rw-r--r--indra/newview/llavatarlistitem.cpp58
1 files changed, 45 insertions, 13 deletions
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index 072eebdf2d..c8544bc3fb 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -43,6 +43,12 @@
#include "lltextutil.h"
#include "llbutton.h"
+bool LLAvatarListItem::sStaticInitialized = false;
+S32 LLAvatarListItem::sIconWidth = 0;
+S32 LLAvatarListItem::sInfoBtnWidth = 0;
+S32 LLAvatarListItem::sProfileBtnWidth = 0;
+S32 LLAvatarListItem::sSpeakingIndicatorWidth = 0;
+
LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/)
: LLPanel(),
mAvatarIcon(NULL),
@@ -51,7 +57,6 @@ LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/)
mSpeakingIndicator(NULL),
mInfoBtn(NULL),
mProfileBtn(NULL),
- mContextMenu(NULL),
mOnlineStatus(E_UNKNOWN),
mShowInfoBtn(true),
mShowProfileBtn(true)
@@ -88,10 +93,15 @@ BOOL LLAvatarListItem::postBuild()
// Remember avatar icon width including its padding from the name text box,
// so that we can hide and show the icon again later.
- mIconWidth = mAvatarName->getRect().mLeft - mAvatarIcon->getRect().mLeft;
- mInfoBtnWidth = mInfoBtn->getRect().mRight - mSpeakingIndicator->getRect().mRight;
- mProfileBtnWidth = mProfileBtn->getRect().mRight - mInfoBtn->getRect().mRight;
- mSpeakingIndicatorWidth = mSpeakingIndicator->getRect().mRight - mAvatarName->getRect().mRight;
+ if (!sStaticInitialized)
+ {
+ sIconWidth = mAvatarName->getRect().mLeft - mAvatarIcon->getRect().mLeft;
+ sInfoBtnWidth = mInfoBtn->getRect().mRight - mSpeakingIndicator->getRect().mRight;
+ sProfileBtnWidth = mProfileBtn->getRect().mRight - mInfoBtn->getRect().mRight;
+ sSpeakingIndicatorWidth = mSpeakingIndicator->getRect().mRight - mAvatarName->getRect().mRight;
+
+ sStaticInitialized = true;
+ }
/*
if(!p.buttons.profile)
@@ -173,6 +183,28 @@ void LLAvatarListItem::setHighlight(const std::string& highlight)
setNameInternal(mAvatarName->getText(), mHighlihtSubstring = highlight);
}
+void LLAvatarListItem::setStyle(const LLStyle::Params& new_style)
+{
+// LLTextUtil::textboxSetHighlightedVal(mAvatarName, mAvatarNameStyle = new_style);
+
+ // Active group should be bold.
+ LLFontDescriptor new_desc(mAvatarName->getDefaultFont()->getFontDesc());
+
+ new_desc.setStyle(new_style.font()->getFontDesc().getStyle());
+ // *NOTE dzaporozhan
+ // On Windows LLFontGL::NORMAL will not remove LLFontGL::BOLD if font
+ // is predefined as bold (SansSerifSmallBold, for example)
+// new_desc.setStyle(active ? LLFontGL::BOLD : LLFontGL::NORMAL);
+ LLFontGL* new_font = LLFontGL::getFont(new_desc);
+
+//
+ mAvatarNameStyle.font = new_font;
+
+ // *NOTE: You cannot set the style on a text box anymore, you must
+ // rebuild the text. This will cause problems if the text contains
+ // hyperlinks, as their styles will be wrong.
+ mAvatarName->setText(mAvatarName->getText(), mAvatarNameStyle/* = new_style*/);
+}
void LLAvatarListItem::setAvatarId(const LLUUID& id, bool ignore_status_changes)
{
if (mAvatarId.notNull())
@@ -214,7 +246,7 @@ void LLAvatarListItem::setShowInfoBtn(bool show)
if(mShowInfoBtn == show)
return;
mShowInfoBtn = show;
- S32 width_delta = show ? - mInfoBtnWidth : mInfoBtnWidth;
+ S32 width_delta = show ? - sInfoBtnWidth : sInfoBtnWidth;
//Translating speaking indicator
mSpeakingIndicator->translate(width_delta, 0);
@@ -228,7 +260,7 @@ void LLAvatarListItem::setShowProfileBtn(bool show)
if(mShowProfileBtn == show)
return;
mShowProfileBtn = show;
- S32 width_delta = show ? - mProfileBtnWidth : mProfileBtnWidth;
+ S32 width_delta = show ? - sProfileBtnWidth : sProfileBtnWidth;
//Translating speaking indicator
mSpeakingIndicator->translate(width_delta, 0);
@@ -242,7 +274,7 @@ void LLAvatarListItem::setSpeakingIndicatorVisible(bool visible)
if (mSpeakingIndicator->getVisible() == (BOOL)visible)
return;
mSpeakingIndicator->setVisible(visible);
- S32 width_delta = visible ? - mSpeakingIndicatorWidth : mSpeakingIndicatorWidth;
+ S32 width_delta = visible ? - sSpeakingIndicatorWidth : sSpeakingIndicatorWidth;
//Reshaping avatar name
mAvatarName->reshape(mAvatarName->getRect().getWidth() + width_delta, mAvatarName->getRect().getHeight());
@@ -259,7 +291,7 @@ void LLAvatarListItem::setAvatarIconVisible(bool visible)
// Move the avatar name horizontally by icon size + its distance from the avatar name.
LLRect name_rect = mAvatarName->getRect();
- name_rect.mLeft += visible ? mIconWidth : -mIconWidth;
+ name_rect.mLeft += visible ? sIconWidth : -sIconWidth;
mAvatarName->setRect(name_rect);
}
@@ -327,10 +359,10 @@ void LLAvatarListItem::onNameCache(const std::string& first_name, const std::str
void LLAvatarListItem::reshapeAvatarName()
{
S32 width_delta = 0;
- width_delta += mShowProfileBtn ? mProfileBtnWidth : 0;
- width_delta += mSpeakingIndicator->getVisible() ? mSpeakingIndicatorWidth : 0;
- width_delta += mAvatarIcon->getVisible() ? mIconWidth : 0;
- width_delta += mShowInfoBtn ? mInfoBtnWidth : 0;
+ width_delta += mShowProfileBtn ? sProfileBtnWidth : 0;
+ width_delta += mSpeakingIndicator->getVisible() ? sSpeakingIndicatorWidth : 0;
+ width_delta += mAvatarIcon->getVisible() ? sIconWidth : 0;
+ width_delta += mShowInfoBtn ? sInfoBtnWidth : 0;
width_delta += mLastInteractionTime->getVisible() ? mLastInteractionTime->getRect().getWidth() : 0;
S32 height = mAvatarName->getRect().getHeight();