summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llavatarlistitem.cpp19
-rw-r--r--indra/newview/llavatarlistitem.h10
2 files changed, 21 insertions, 8 deletions
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)
diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h
index aa1b7593f5..1272bdf7a9 100644
--- a/indra/newview/llavatarlistitem.h
+++ b/indra/newview/llavatarlistitem.h
@@ -135,10 +135,12 @@ private:
//Speaker indicator and avatar name coords are translated accordingly
bool mShowInfoBtn;
bool mShowProfileBtn;
- S32 mIconWidth; // icon width + padding
- S32 mInfoBtnWidth; //info btn width + padding
- S32 mProfileBtnWidth; //profile btn width + padding
- S32 mSpeakingIndicatorWidth; //speaking indicator width + padding
+
+ static bool mStaticInitialized; // this variable is introduced to improve code readability
+ static S32 mIconWidth; // icon width + padding
+ static S32 mInfoBtnWidth; //info btn width + padding
+ static S32 mProfileBtnWidth; //profile btn width + padding
+ static S32 mSpeakingIndicatorWidth; //speaking indicator width + padding
};
#endif //LL_LLAVATARLISTITEM_H