diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llfolderviewitem.cpp | 24 | ||||
-rw-r--r-- | indra/llui/llfolderviewitem.h | 4 |
2 files changed, 23 insertions, 5 deletions
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 9a1f7de73b..9754192b06 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -122,6 +122,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) : LLView(p), mLabelWidth(0), mLabelWidthDirty(false), + mLabelNeedsRefresh(false), mLabelPaddingRight(DEFAULT_LABEL_PADDING_RIGHT), mParentFolder( NULL ), mIsSelected( FALSE ), @@ -181,11 +182,16 @@ LLFolderViewItem::~LLFolderViewItem() BOOL LLFolderViewItem::postBuild() { - refresh(); + LLFolderViewModelItem& vmi = *getViewModelItem(); + mLabel = vmi.getDisplayName(); // slightly expensive, but only first time + setToolTip(vmi.getName()); + + // Dirty the filter flag of the model from the view (CHUI-849) + mLabelNeedsRefresh = true; + mLabelWidthDirty = true; return TRUE; } - LLFolderView* LLFolderViewItem::getRoot() { return mRoot; @@ -282,22 +288,28 @@ void LLFolderViewItem::refresh() { LLFolderViewModelItem& vmi = *getViewModelItem(); + // getDisplayName() is slightly expensive on first run mLabel = vmi.getDisplayName(); - setToolTip(vmi.getName()); + + // icons are slightly expensive to get, can be optimized + // see LLInventoryIcon::getIcon() mIcon = vmi.getIcon(); mIconOpen = vmi.getIconOpen(); mIconOverlay = vmi.getIconOverlay(); if (mRoot->useLabelSuffix()) { + // Very Expensive! + // Can do a number of expensive checks, like checking active motions, wearables or friend list mLabelStyle = vmi.getLabelStyle(); mLabelSuffix = vmi.getLabelSuffix(); } - mLabelWidthDirty = true; // Dirty the filter flag of the model from the view (CHUI-849) vmi.dirtyFilter(); + mLabelWidthDirty = true; + mLabelNeedsRefresh = false; } // Utility function for LLFolderView @@ -348,6 +360,10 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height ) : 0; if (mLabelWidthDirty) { + if (mLabelNeedsRefresh) + { + refresh(); + } mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + mLabelPaddingRight; mLabelWidthDirty = false; } diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 61c39e0175..f37125adb3 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -90,6 +90,7 @@ protected: std::string mLabel; S32 mLabelWidth; bool mLabelWidthDirty; + bool mLabelNeedsRefresh; S32 mLabelPaddingRight; LLFolderViewFolder* mParentFolder; LLPointer<LLFolderViewModelItem> mViewModelItem; @@ -266,7 +267,8 @@ public: virtual BOOL passedFilter(S32 filter_generation = -1); virtual BOOL isPotentiallyVisible(S32 filter_generation = -1); - // refresh information from the object being viewed. + // refresh information from the object being viewed. + // refreshes, label, sufixes and sets icons. Expensive! virtual void refresh(); // LLView functionality |