From dc8cd05082e4d82a578d4a20278725cdf5e0450f Mon Sep 17 00:00:00 2001 From: Andrew Polunin Date: Sat, 19 Dec 2009 18:35:38 +0200 Subject: implemented minor task EXT-3455 Code Improvements: Improve LLAvatarListItem not to calculate constant values in each constructing --HG-- branch : product-engine --- indra/newview/llavatarlistitem.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'indra/newview/llavatarlistitem.cpp') diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 072eebdf2d..08b359d26e 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -43,6 +43,12 @@ #include "lltextutil.h" #include "llbutton.h" +bool LLAvatarListItem::mStaticInitialized = false; +S32 LLAvatarListItem::mIconWidth = 0; +S32 LLAvatarListItem::mInfoBtnWidth = 0; +S32 LLAvatarListItem::mProfileBtnWidth = 0; +S32 LLAvatarListItem::mSpeakingIndicatorWidth = 0; + LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/) : LLPanel(), mAvatarIcon(NULL), @@ -88,10 +94,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 (!mStaticInitialized) + { + 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; + + mStaticInitialized = true; + } /* if(!p.buttons.profile) -- cgit v1.2.3 From 368c75ccd367320c650dbfdb62fdb3334e888f8a Mon Sep 17 00:00:00 2001 From: Andrew Polunin Date: Sat, 19 Dec 2009 18:52:14 +0200 Subject: no ticket. static variables renamed according to convention. --HG-- branch : product-engine --- indra/newview/llavatarlistitem.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'indra/newview/llavatarlistitem.cpp') diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 08b359d26e..bbe5cdcc4a 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -43,11 +43,11 @@ #include "lltextutil.h" #include "llbutton.h" -bool LLAvatarListItem::mStaticInitialized = false; -S32 LLAvatarListItem::mIconWidth = 0; -S32 LLAvatarListItem::mInfoBtnWidth = 0; -S32 LLAvatarListItem::mProfileBtnWidth = 0; -S32 LLAvatarListItem::mSpeakingIndicatorWidth = 0; +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(), @@ -94,14 +94,14 @@ 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. - if (!mStaticInitialized) + if (!sStaticInitialized) { - 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; + 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; - mStaticInitialized = true; + sStaticInitialized = true; } /* @@ -225,7 +225,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); @@ -239,7 +239,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); @@ -253,7 +253,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()); @@ -270,7 +270,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); } @@ -338,10 +338,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(); -- cgit v1.2.3 From 7bfb8ec0503d7c31d9241b2e95f103fa66b14e1e Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Mon, 21 Dec 2009 20:42:34 +0200 Subject: Work on normal bug EXT-3434 There is no difference between invited and left participants in a Group call (Voice Controls) -- implemented decorating of left participants in voice chat via italic font style (draft, harcoded) --HG-- branch : product-engine --- indra/newview/llavatarlistitem.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'indra/newview/llavatarlistitem.cpp') diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index bbe5cdcc4a..76dce622ed 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -184,6 +184,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()) -- cgit v1.2.3 From 7d308294e93c7d2a0ffb3f1b88386b96fcb7b42d Mon Sep 17 00:00:00 2001 From: Vadim Savchuk Date: Mon, 21 Dec 2009 20:45:27 +0200 Subject: Removed unused code (context menu handling in LLAvatarListItem). --HG-- branch : product-engine --- indra/newview/llavatarlistitem.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llavatarlistitem.cpp') diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 76dce622ed..c8544bc3fb 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -57,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) -- cgit v1.2.3