diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2023-06-01 09:57:57 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2023-06-01 09:57:57 -0400 |
commit | d844da2a6c5fc1a75e606150bb070fdb787698d3 (patch) | |
tree | 349ecda36a5a561d6e564e2cc3db39121fd8946b /indra/llui | |
parent | 8a74efa38ba631be5400c4912a6339310968c9d7 (diff) | |
parent | 7d05ade3f10563e8c202106e00cb3d273ab13338 (diff) |
SL-18330: Merge branch 'xcode-14.3' into fix-monterey
to pick up new merge from main.
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llfolderview.cpp | 30 | ||||
-rw-r--r-- | indra/llui/llfolderviewitem.h | 1 | ||||
-rw-r--r-- | indra/llui/llscrolllistcell.cpp | 72 | ||||
-rw-r--r-- | indra/llui/llscrolllistcell.h | 22 |
4 files changed, 116 insertions, 9 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index e1869e8125..62c311f522 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1672,7 +1672,8 @@ void LLFolderView::update() // Clear the modified setting on the filter only if the filter finished after running the filter process // Note: if the filter count has timed out, that means the filter halted before completing the entire set of items - if (filter_object.isModified() && (!filter_object.isTimedOut())) + bool filter_modified = filter_object.isModified(); + if (filter_modified && (!filter_object.isTimedOut())) { filter_object.clearModified(); } @@ -1706,7 +1707,7 @@ void LLFolderView::update() BOOL filter_finished = mViewModel->contentsReady() && (getViewModelItem()->passedFilter() || ( getViewModelItem()->getLastFilterGeneration() >= filter_object.getFirstSuccessGeneration() - && !filter_object.isModified())); + && !filter_modified)); if (filter_finished || gFocusMgr.childHasKeyboardFocus(mParentPanel.get()) || gFocusMgr.childHasMouseCapture(mParentPanel.get())) @@ -1794,13 +1795,26 @@ void LLFolderView::update() if (mSelectedItems.size() && mNeedsScroll) { - scrollToShowItem(mSelectedItems.back(), constraint_rect); + LLFolderViewItem* scroll_to_item = mSelectedItems.back(); + scrollToShowItem(scroll_to_item, constraint_rect); // continue scrolling until animated layout change is done - if (filter_finished - && (!needsArrange() || !is_visible)) - { - mNeedsScroll = FALSE; - } + bool selected_filter_finished = getRoot()->getViewModelItem()->getLastFilterGeneration() >= filter_object.getFirstSuccessGeneration(); + if (selected_filter_finished && scroll_to_item && scroll_to_item->getViewModelItem()) + { + selected_filter_finished = scroll_to_item->getViewModelItem()->getLastFilterGeneration() >= filter_object.getFirstSuccessGeneration(); + } + if (filter_finished && selected_filter_finished) + { + bool needs_arrange = needsArrange() || getRoot()->needsArrange(); + if (mParentFolder) + { + needs_arrange |= (bool)mParentFolder->needsArrange(); + } + if (!needs_arrange || !is_visible) + { + mNeedsScroll = FALSE; + } + } } if (mSignalSelectCallback) diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index ee20d048fd..a5157266c5 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -335,7 +335,6 @@ protected: F32 mAutoOpenCountdown; S32 mLastArrangeGeneration; S32 mLastCalculatedWidth; - bool mNeedsSort; bool mIsFolderComplete; // indicates that some children were not loaded/added yet bool mAreChildrenInited; // indicates that no children were initialized diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 8dd552d2ad..f73c9aa539 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -54,6 +54,10 @@ LLScrollListCell* LLScrollListCell::create(const LLScrollListCell::Params& cell_ { cell = new LLScrollListIconText(cell_p); } + else if (cell_p.type() == "bar") + { + cell = new LLScrollListBar(cell_p); + } else // default is "text" { cell = new LLScrollListText(cell_p); @@ -174,6 +178,74 @@ void LLScrollListIcon::draw(const LLColor4& color, const LLColor4& highlight_col } // +// LLScrollListBar +// +LLScrollListBar::LLScrollListBar(const LLScrollListCell::Params& p) + : LLScrollListCell(p), + mRatio(0), + mColor(p.color), + mBottom(1), + mLeftPad(1), + mRightPad(1) +{} + +LLScrollListBar::~LLScrollListBar() +{ +} + +/*virtual*/ +S32 LLScrollListBar::getHeight() const +{ + return LLScrollListCell::getHeight(); +} + +/*virtual*/ +const LLSD LLScrollListBar::getValue() const +{ + return LLStringUtil::null; +} + +void LLScrollListBar::setValue(const LLSD& value) +{ + if (value.has("ratio")) + { + mRatio = value["ratio"].asReal(); + } + if (value.has("bottom")) + { + mBottom = value["bottom"].asInteger(); + } + if (value.has("left_pad")) + { + mLeftPad = value["left_pad"].asInteger(); + } + if (value.has("right_pad")) + { + mRightPad = value["right_pad"].asInteger(); + } +} + +void LLScrollListBar::setColor(const LLColor4& color) +{ + mColor = color; +} + +S32 LLScrollListBar::getWidth() const +{ + return LLScrollListCell::getWidth(); +} + + +void LLScrollListBar::draw(const LLColor4& color, const LLColor4& highlight_color) const +{ + S32 bar_width = getWidth() - mLeftPad - mRightPad; + S32 left = bar_width - bar_width * mRatio; + left = llclamp(left, mLeftPad, getWidth() - mRightPad - 1); + + gl_rect_2d(left, mBottom, getWidth() - mRightPad, mBottom - 1, mColor); +} + +// // LLScrollListText // U32 LLScrollListText::sCount = 0; diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index ede8d847d9..2588da2331 100644 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h @@ -33,6 +33,7 @@ #include "lluistring.h" #include "v4color.h" #include "llui.h" +#include "llgltexture.h" class LLCheckBoxCtrl; class LLSD; @@ -159,6 +160,7 @@ public: void setText(const LLStringExplicit& text); void setFontStyle(const U8 font_style); + void setAlignment(LLFontGL::HAlign align) { mFontAlignment = align; } protected: LLUIString mText; @@ -199,6 +201,26 @@ private: LLFontGL::HAlign mAlignment; }; + +class LLScrollListBar : public LLScrollListCell +{ +public: + LLScrollListBar(const LLScrollListCell::Params& p); + /*virtual*/ ~LLScrollListBar(); + /*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const; + /*virtual*/ S32 getWidth() const; + /*virtual*/ S32 getHeight() const; + /*virtual*/ const LLSD getValue() const; + /*virtual*/ void setColor(const LLColor4&); + /*virtual*/ void setValue(const LLSD& value); + +private: + LLColor4 mColor; + F32 mRatio; + S32 mBottom; + S32 mRightPad; + S32 mLeftPad; +}; /* * An interactive cell containing a check box. */ |