From cea6eeeede9f687ca195cc9b9e778fd6784afbe2 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 25 Apr 2024 04:46:42 +0300 Subject: viewer#1300 'Star' favorites in inventory image is WIP --- indra/llui/llfolderviewitem.cpp | 35 +++++++++++++++++++++++++++++++++++ indra/llui/llfolderviewitem.h | 13 ++++++++++++- indra/llui/llfolderviewmodel.h | 5 ++++- 3 files changed, 51 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 2bd14f6f6a..84146e5829 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -99,6 +99,8 @@ void LLFolderViewItem::cleanupClass() LLFolderViewItem::Params::Params() : root(), listener(), + favorite_image("favorite_image"), + favorite_content_image("favorite_content_image"), folder_arrow_image("folder_arrow_image"), folder_indentation("folder_indentation"), selection_image("selection_image"), @@ -125,6 +127,8 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) : LLView(p), mLabelWidth(0), mLabelWidthDirty(false), + mIsFavorite(false), + mHasFavorites(false), mSuffixNeedsRefresh(false), mLabelPaddingRight(DEFAULT_LABEL_PADDING_RIGHT), mParentFolder( NULL ), @@ -194,6 +198,8 @@ BOOL LLFolderViewItem::postBuild() // getDisplayName() is expensive (due to internal getLabelSuffix() and name building) // it also sets search strings so it requires a filter reset mLabel = vmi->getDisplayName(); + mIsFavorite = vmi->isFavorite(); + mHasFavorites = vmi->hasFavorites(); setToolTip(vmi->getName()); // Dirty the filter flag of the model from the view (CHUI-849) @@ -307,6 +313,8 @@ void LLFolderViewItem::refresh() LLFolderViewModelItem& vmi = *getViewModelItem(); mLabel = vmi.getDisplayName(); + mIsFavorite = vmi.isFavorite(); + mHasFavorites = vmi.hasFavorites(); setToolTip(vmi.getName()); // icons are slightly expensive to get, can be optimized // see LLInventoryIcon::getIcon() @@ -339,6 +347,9 @@ void LLFolderViewItem::refreshSuffix() mIconOpen = vmi->getIconOpen(); mIconOverlay = vmi->getIconOverlay(); + mIsFavorite = vmi->isFavorite(); + mHasFavorites = vmi->hasFavorites(); + if (mRoot->useLabelSuffix()) { // Very Expensive! @@ -754,6 +765,29 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L } } +void LLFolderViewItem::drawFavoriteIcon(const Params& default_params, const LLUIColor& fg_color) +{ + LLUIImage* favorite_image = NULL; + if (mIsFavorite) + { + favorite_image = default_params.favorite_image; + } + else if (mHasFavorites) + { + favorite_image = default_params.favorite_content_image; + } + + if (favorite_image) + { + const S32 PAD = 2; + const S32 image_size = 30; + + gl_draw_scaled_image( + getRect().getWidth() - image_size - PAD, getRect().getHeight() - mItemHeight + PAD, + image_size, image_size, favorite_image->getImage(), fg_color); + } +} + /*virtual*/ bool LLFolderViewItem::isHighlightAllowed() { return mIsSelected; @@ -913,6 +947,7 @@ void LLFolderViewItem::draw() { drawOpenFolderArrow(default_params, sFgColor); } + drawFavoriteIcon(default_params, sFgColor); drawHighlight(show_context, filled, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor); diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 5c2a1ecff0..eba3cf4f83 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -49,7 +49,9 @@ class LLFolderViewItem : public LLView public: struct Params : public LLInitParam::Block { - Optional folder_arrow_image, + Optional favorite_image, + favorite_content_image, + folder_arrow_image, selection_image; Mandatory root; Mandatory listener; @@ -92,6 +94,8 @@ protected: std::string mLabel; S32 mLabelWidth; bool mLabelWidthDirty; + bool mIsFavorite; + bool mHasFavorites; S32 mLabelPaddingRight; LLFolderViewFolder* mParentFolder; LLPointer mViewModelItem; @@ -207,6 +211,8 @@ public: // Returns true is this object and all of its children can be moved virtual BOOL isMovable(); + bool isFavorite() const { return mIsFavorite; } + // destroys this item recursively virtual void destroyView(); @@ -297,6 +303,7 @@ public: // virtual void handleDropped(); virtual void draw(); void drawOpenFolderArrow(const Params& default_params, const LLUIColor& fg_color); + void drawFavoriteIcon(const Params& default_params, const LLUIColor& fg_color); void drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, const LLUIColor &outlineColor, const LLUIColor &mouseOverColor); void drawLabel(const LLFontGL * font, const F32 x, const F32 y, const LLColor4& color, F32 &right_x); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, @@ -391,6 +398,10 @@ public: // Returns true is this object and all of its children can be moved virtual BOOL isMovable(); + bool isFavorite() const { return mIsFavorite; } + bool hasFavorites() const { return mHasFavorites; } + void setHasFavorites(bool val) { mHasFavorites = val; } + // destroys this folder, and all children virtual void destroyView(); void destroyRoot(); diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 551a60e097..9d46334fc4 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -161,7 +161,10 @@ public: virtual void selectItem(void) = 0; virtual void navigateToFolder(bool new_window = false, bool change_mode = false) = 0; - + + virtual bool isFavorite() const = 0; + virtual bool hasFavorites() const = 0; + virtual void setHasFavorites(bool val) = 0; virtual BOOL isItemWearable() const { return FALSE; } virtual BOOL isItemRenameable() const = 0; -- cgit v1.2.3 From a0c4d81080fbc4b5326e6b598e5df27e01631d48 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 27 Apr 2024 05:01:36 +0300 Subject: viewer#1300 'Star' favorites in inventory #2 --- indra/llui/llfolderviewitem.cpp | 58 +++++++++++++++++++++++++++++++++++++++++ indra/llui/llfolderviewitem.h | 1 + 2 files changed, 59 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 84146e5829..be703a1e9a 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -1783,6 +1783,64 @@ BOOL LLFolderViewFolder::isMovable() return TRUE; } +void LLFolderViewFolder::updateHasFavorites(bool new_childs_value) +{ + if (mHasFavorites != new_childs_value) + { + if (new_childs_value) + { + mHasFavorites = new_childs_value; + // propagate up to root + LLFolderViewFolder* parent = getParentFolder(); + while (parent && !parent->hasFavorites()) + { + parent->setHasFavorites(true); + parent = parent->getParentFolder(); + } + } + else + { + LLFolderViewFolder* parent = this; + while (parent) + { + bool has_favorites = false; + for (items_t::iterator iter = parent->mItems.begin(); + iter != parent->mItems.end();) + { + items_t::iterator iit = iter++; + if ((*iit)->isFavorite()) + { + has_favorites = true; + break; + } + } + + for (folders_t::iterator iter = parent->mFolders.begin(); + iter != parent->mFolders.end() && !has_favorites;) + { + folders_t::iterator fit = iter++; + if ((*fit)->isFavorite() || (*fit)->hasFavorites()) + { + has_favorites = true; + break; + } + } + + if (!has_favorites) + { + parent->mHasFavorites = false; + parent->setHasFavorites(false); + } + else + { + break; + } + parent = parent->getParentFolder(); + } + } + } +} + BOOL LLFolderViewFolder::isRemovable() { diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index eba3cf4f83..5905516023 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -401,6 +401,7 @@ public: bool isFavorite() const { return mIsFavorite; } bool hasFavorites() const { return mHasFavorites; } void setHasFavorites(bool val) { mHasFavorites = val; } + void updateHasFavorites(bool new_childs_value); // destroys this folder, and all children virtual void destroyView(); -- cgit v1.2.3 From 2add3b49537fb041b880752dc5302ac6b317e601 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 29 Apr 2024 22:07:12 +0300 Subject: viewer#1300 'Star' favorites in inventory #3 --- indra/llui/llfolderviewitem.cpp | 118 +++++++++++++++++++++++++++++----------- indra/llui/llfolderviewitem.h | 7 +++ indra/llui/llfolderviewmodel.h | 3 +- 3 files changed, 93 insertions(+), 35 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index be703a1e9a..2accec7a68 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -199,7 +199,6 @@ BOOL LLFolderViewItem::postBuild() // it also sets search strings so it requires a filter reset mLabel = vmi->getDisplayName(); mIsFavorite = vmi->isFavorite(); - mHasFavorites = vmi->hasFavorites(); setToolTip(vmi->getName()); // Dirty the filter flag of the model from the view (CHUI-849) @@ -314,7 +313,6 @@ void LLFolderViewItem::refresh() mLabel = vmi.getDisplayName(); mIsFavorite = vmi.isFavorite(); - mHasFavorites = vmi.hasFavorites(); setToolTip(vmi.getName()); // icons are slightly expensive to get, can be optimized // see LLInventoryIcon::getIcon() @@ -348,7 +346,6 @@ void LLFolderViewItem::refreshSuffix() mIconOverlay = vmi->getIconOverlay(); mIsFavorite = vmi->isFavorite(); - mHasFavorites = vmi->hasFavorites(); if (mRoot->useLabelSuffix()) { @@ -1116,7 +1113,8 @@ LLFolderViewFolder::LLFolderViewFolder( const LLFolderViewItem::Params& p ): mIsFolderComplete(false), // folder might have children that are not loaded yet. mAreChildrenInited(false), // folder might have children that are not built yet. mLastArrangeGeneration( -1 ), - mLastCalculatedWidth(0) + mLastCalculatedWidth(0), + mFavoritesDirtyFlags(0) { } @@ -1142,6 +1140,11 @@ LLFolderViewFolder::~LLFolderViewFolder( void ) // The LLView base class takes care of object destruction. make sure that we // don't have mouse or keyboard focus gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() + + if (mFavoritesDirtyFlags) + { + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, this); + } } // addToFolder() returns TRUE if it succeeds. FALSE otherwise @@ -1785,60 +1788,109 @@ BOOL LLFolderViewFolder::isMovable() void LLFolderViewFolder::updateHasFavorites(bool new_childs_value) { - if (mHasFavorites != new_childs_value) + if (mFavoritesDirtyFlags == 0) + { + gIdleCallbacks.addFunction(&LLFolderViewFolder::onIdleUpdateFavorites, this); + } + if (new_childs_value) + { + mFavoritesDirtyFlags |= FAVORITE_ADDED; + } + else + { + mFavoritesDirtyFlags |= FAVORITE_REMOVED; + } +} + +void LLFolderViewFolder::onIdleUpdateFavorites(void* data) +{ + LLFolderViewFolder* self = reinterpret_cast(data); + if (self->mFavoritesDirtyFlags == 0) { - if (new_childs_value) + LL_WARNS() << "Called onIdleUpdateFavorites without dirty flags set" << LL_ENDL; + gIdleCallbacks.addFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); + return; + } + + if (self->getViewModelItem()->isItemInTrash()) + { + // do not display favorite-stars in trash + self->mFavoritesDirtyFlags = 0; + gIdleCallbacks.addFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); + return; + } + + LLFolderViewFolder* root_folder = self->getRoot(); + if (self->mFavoritesDirtyFlags == FAVORITE_ADDED) + { + if (!self->mHasFavorites) { - mHasFavorites = new_childs_value; - // propagate up to root - LLFolderViewFolder* parent = getParentFolder(); - while (parent && !parent->hasFavorites()) + // propagate up, exclude root + LLFolderViewFolder* parent = self; + while (parent && !parent->hasFavorites() && root_folder != parent) { parent->setHasFavorites(true); parent = parent->getParentFolder(); } } - else + } + else if (self->mFavoritesDirtyFlags > FAVORITE_ADDED) + { + // full check + LLFolderViewFolder* parent = self; + while (parent && root_folder != parent) { - LLFolderViewFolder* parent = this; - while (parent) + bool has_favorites = false; + for (items_t::iterator iter = parent->mItems.begin(); + iter != parent->mItems.end();) { - bool has_favorites = false; - for (items_t::iterator iter = parent->mItems.begin(); - iter != parent->mItems.end();) + items_t::iterator iit = iter++; + if ((*iit)->isFavorite()) { - items_t::iterator iit = iter++; - if ((*iit)->isFavorite()) - { - has_favorites = true; - break; - } + has_favorites = true; + break; } + } - for (folders_t::iterator iter = parent->mFolders.begin(); - iter != parent->mFolders.end() && !has_favorites;) + for (folders_t::iterator iter = parent->mFolders.begin(); + iter != parent->mFolders.end() && !has_favorites;) + { + folders_t::iterator fit = iter++; + if ((*fit)->isFavorite() || (*fit)->hasFavorites()) { - folders_t::iterator fit = iter++; - if ((*fit)->isFavorite() || (*fit)->hasFavorites()) - { - has_favorites = true; - break; - } + has_favorites = true; + break; } + } - if (!has_favorites) + if (!has_favorites) + { + if (parent->hasFavorites()) { - parent->mHasFavorites = false; parent->setHasFavorites(false); } else { + // Nothing changed break; } - parent = parent->getParentFolder(); } + else + { + // propagate up, exclude root + while (parent && !parent->hasFavorites() && root_folder != parent) + { + parent->setHasFavorites(true); + parent = parent->getParentFolder(); + } + break; + } + parent = parent->getParentFolder(); } } + + self->mFavoritesDirtyFlags = 0; + gIdleCallbacks.addFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); } diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 5905516023..fc19514615 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -402,6 +402,13 @@ public: bool hasFavorites() const { return mHasFavorites; } void setHasFavorites(bool val) { mHasFavorites = val; } void updateHasFavorites(bool new_childs_value); +private: + static void onIdleUpdateFavorites(void* data); + + constexpr static S32 FAVORITE_ADDED = 1; + constexpr static S32 FAVORITE_REMOVED = 2; + S32 mFavoritesDirtyFlags { 0 }; +public: // destroys this folder, and all children virtual void destroyView(); diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 9d46334fc4..152801ec69 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -163,8 +163,6 @@ public: virtual void navigateToFolder(bool new_window = false, bool change_mode = false) = 0; virtual bool isFavorite() const = 0; - virtual bool hasFavorites() const = 0; - virtual void setHasFavorites(bool val) = 0; virtual BOOL isItemWearable() const { return FALSE; } virtual BOOL isItemRenameable() const = 0; @@ -174,6 +172,7 @@ public: virtual void move( LLFolderViewModelItem* parent_listener ) = 0; virtual BOOL isItemRemovable( void ) const = 0; // Can be destroyed + virtual BOOL isItemInTrash(void) const = 0; virtual BOOL removeItem() = 0; virtual void removeBatch(std::vector& batch) = 0; -- cgit v1.2.3 From 1e7dc04644367dd7eb1469b36848aac265eb7050 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 29 Apr 2024 22:07:12 +0300 Subject: viewer#1300 'Star' favorites in inventory #4 --- indra/llui/llfolderviewitem.cpp | 39 +++++++++++++++++++++++++++------------ indra/llui/llfolderviewmodel.h | 3 +++ 2 files changed, 30 insertions(+), 12 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 2accec7a68..682da226bd 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -198,7 +198,7 @@ BOOL LLFolderViewItem::postBuild() // getDisplayName() is expensive (due to internal getLabelSuffix() and name building) // it also sets search strings so it requires a filter reset mLabel = vmi->getDisplayName(); - mIsFavorite = vmi->isFavorite(); + mIsFavorite = vmi->isFavorite() && !vmi->isItemInTrash(); setToolTip(vmi->getName()); // Dirty the filter flag of the model from the view (CHUI-849) @@ -312,7 +312,7 @@ void LLFolderViewItem::refresh() LLFolderViewModelItem& vmi = *getViewModelItem(); mLabel = vmi.getDisplayName(); - mIsFavorite = vmi.isFavorite(); + mIsFavorite = vmi.isFavorite() && !vmi.isItemInTrash(); setToolTip(vmi.getName()); // icons are slightly expensive to get, can be optimized // see LLInventoryIcon::getIcon() @@ -345,7 +345,7 @@ void LLFolderViewItem::refreshSuffix() mIconOpen = vmi->getIconOpen(); mIconOverlay = vmi->getIconOverlay(); - mIsFavorite = vmi->isFavorite(); + mIsFavorite = vmi->isFavorite() && !vmi->isItemInTrash(); if (mRoot->useLabelSuffix()) { @@ -1808,7 +1808,7 @@ void LLFolderViewFolder::onIdleUpdateFavorites(void* data) if (self->mFavoritesDirtyFlags == 0) { LL_WARNS() << "Called onIdleUpdateFavorites without dirty flags set" << LL_ENDL; - gIdleCallbacks.addFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); return; } @@ -1816,20 +1816,26 @@ void LLFolderViewFolder::onIdleUpdateFavorites(void* data) { // do not display favorite-stars in trash self->mFavoritesDirtyFlags = 0; - gIdleCallbacks.addFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); return; } - LLFolderViewFolder* root_folder = self->getRoot(); if (self->mFavoritesDirtyFlags == FAVORITE_ADDED) { if (!self->mHasFavorites) { // propagate up, exclude root LLFolderViewFolder* parent = self; - while (parent && !parent->hasFavorites() && root_folder != parent) + while (parent + && (!parent->hasFavorites() || parent->mFavoritesDirtyFlags) + && !parent->getViewModelItem()->isAgentInventoryRoot()) { parent->setHasFavorites(true); + if (parent->mFavoritesDirtyFlags) + { + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, parent); + parent->mFavoritesDirtyFlags = 0; + } parent = parent->getParentFolder(); } } @@ -1838,7 +1844,7 @@ void LLFolderViewFolder::onIdleUpdateFavorites(void* data) { // full check LLFolderViewFolder* parent = self; - while (parent && root_folder != parent) + while (parent && !parent->getViewModelItem()->isAgentInventoryRoot()) { bool has_favorites = false; for (items_t::iterator iter = parent->mItems.begin(); @@ -1878,19 +1884,28 @@ void LLFolderViewFolder::onIdleUpdateFavorites(void* data) else { // propagate up, exclude root - while (parent && !parent->hasFavorites() && root_folder != parent) + while (parent + && (!parent->hasFavorites() || parent->mFavoritesDirtyFlags) + && !parent->getViewModelItem()->isAgentInventoryRoot()) { parent->setHasFavorites(true); + if (parent->mFavoritesDirtyFlags) + { + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, parent); + parent->mFavoritesDirtyFlags = 0; + } parent = parent->getParentFolder(); } break; } + if (parent->mFavoritesDirtyFlags) + { + parent->mFavoritesDirtyFlags = 0; + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, parent); + } parent = parent->getParentFolder(); } } - - self->mFavoritesDirtyFlags = 0; - gIdleCallbacks.addFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); } diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 152801ec69..b7afdb6aec 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -185,6 +185,9 @@ public: virtual void pasteFromClipboard() = 0; virtual void pasteLinkFromClipboard() = 0; + virtual bool isAgentInventory() const = 0; + virtual bool isAgentInventoryRoot() const = 0; + virtual void buildContextMenu(LLMenuGL& menu, U32 flags) = 0; virtual bool potentiallyVisible() = 0; // is the item definitely visible or we haven't made up our minds yet? -- cgit v1.2.3 From 1c170381aea21cfd75d7b8789374f04f3a46d408 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 4 May 2024 01:50:50 +0300 Subject: viewer#1300 Update Inventory Settings --- indra/llui/llfolderviewitem.cpp | 23 ++++++++++++++++++++++- indra/llui/llfolderviewitem.h | 2 ++ 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 682da226bd..b473b3b395 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -58,6 +58,7 @@ LLUIColor LLFolderViewItem::sFilterBGColor; LLUIColor LLFolderViewItem::sFilterTextColor; LLUIColor LLFolderViewItem::sSuffixColor; LLUIColor LLFolderViewItem::sSearchStatusColor; +LLUIColor LLFolderViewItem::sFavoriteColor; // only integers can be initialized in header const F32 LLFolderViewItem::FOLDER_CLOSE_TIME_CONSTANT = 0.02f; @@ -173,6 +174,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE); sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE); sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE); + sFavoriteColor = LLUIColorTable::instance().getColor("InventoryFavoriteColor", DEFAULT_WHITE); sColorSetInitialized = true; } @@ -764,6 +766,12 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L void LLFolderViewItem::drawFavoriteIcon(const Params& default_params, const LLUIColor& fg_color) { + static LLUICachedControl draw_star("InventoryFavoritesUseStar", true); + if (!draw_star) + { + return; + } + LLUIImage* favorite_image = NULL; if (mIsFavorite) { @@ -1019,7 +1027,20 @@ void LLFolderViewItem::draw() } } - LLColor4 color = (mIsSelected && filled) ? mFontHighlightColor : mFontColor; + static LLUICachedControl highlight_color("InventoryFavoritesColorText", true); + LLColor4 color; + if (mIsSelected && filled) + { + color = mFontHighlightColor; + } + else if (mIsFavorite && highlight_color) + { + color = sFavoriteColor; + } + else + { + color = mFontColor; + } if (isFadeItem()) { diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index fc19514615..462f703a9c 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -149,6 +149,8 @@ protected: static LLUIColor sFilterTextColor; static LLUIColor sSuffixColor; static LLUIColor sSearchStatusColor; + static LLUIColor sFavoriteColor; + // this is an internal method used for adding items to folders. A // no-op at this level, but reimplemented in derived classes. -- cgit v1.2.3 From 5c78396b64c985a7e58d045ff3f343bccc81c8d3 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 9 May 2024 00:40:30 +0300 Subject: viewer#1424 Favorites in Appearance floater #1 --- indra/llui/llfolderviewitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index b473b3b395..59be1444d9 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -785,7 +785,7 @@ void LLFolderViewItem::drawFavoriteIcon(const Params& default_params, const LLUI if (favorite_image) { const S32 PAD = 2; - const S32 image_size = 30; + const S32 image_size = 18; gl_draw_scaled_image( getRect().getWidth() - image_size - PAD, getRect().getHeight() - mItemHeight + PAD, -- cgit v1.2.3 From a420e84f4822d19388241f99a916dacc4d1eab61 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 9 May 2024 23:22:26 +0300 Subject: viewer#1424 Favorites in Appearance floater #2 --- indra/llui/llaccordionctrltab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index 496c34c38b..c2ddd6f7d1 100644 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -140,7 +140,7 @@ public: S32 notify(const LLSD& info); bool notifyChildren(const LLSD& info); - void draw(); + virtual void draw(); void storeOpenCloseState(); void restoreOpenCloseState(); -- cgit v1.2.3 From 7d1597fc98868c73d6de0b95f3c1af4c459a30c8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 13 May 2024 22:16:20 +0300 Subject: viewer#1424 Favorites in Appearance floater #4 --- indra/llui/llfolderviewitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 59be1444d9..7be8db4777 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -777,7 +777,7 @@ void LLFolderViewItem::drawFavoriteIcon(const Params& default_params, const LLUI { favorite_image = default_params.favorite_image; } - else if (mHasFavorites) + else if (mHasFavorites && !hasVisibleChildren()) { favorite_image = default_params.favorite_content_image; } -- cgit v1.2.3 From 1eeecfa1a8bf43a8980217ce34e3b5f4458483e0 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 14 May 2024 15:11:45 +0300 Subject: viewer#1425 Sorting in Appearance floater --- indra/llui/llflatlistview.cpp | 13 +++++++++++-- indra/llui/llflatlistview.h | 6 +++++- indra/llui/llfolderviewitem.cpp | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index fd4c33df30..18500b891f 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -1356,9 +1356,17 @@ bool LLFlatListViewEx::getForceShowingUnmatchedItems() return mForceShowingUnmatchedItems; } -void LLFlatListViewEx::setForceShowingUnmatchedItems(bool show) +void LLFlatListViewEx::setForceShowingUnmatchedItems(bool show, bool notify_parent) { - mForceShowingUnmatchedItems = show; + if (mForceShowingUnmatchedItems != show) + { + mForceShowingUnmatchedItems = show; + if (!mFilterSubString.empty()) + { + updateNoItemsMessage(mFilterSubString); + filterItems(false, true); + } + } } void LLFlatListViewEx::setFilterSubString(const std::string& filter_str, bool notify_parent) @@ -1427,6 +1435,7 @@ void LLFlatListViewEx::filterItems(bool re_sort, bool notify_parent) if (visibility_changed && notify_parent) { + rearrangeItems(); notifyParentItemsRectChanged(); } } diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index adb0e3e553..e42cae8985 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -480,7 +480,11 @@ public: bool getForceShowingUnmatchedItems(); - void setForceShowingUnmatchedItems(bool show); + /** + * Sets filtered out items to stay visible. Can result in rect changes, + * so can notify_parent if rect changes + */ + void setForceShowingUnmatchedItems(bool show, bool notify_parent); /** * Sets up new filter string and filters the list. diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 7be8db4777..7a78540510 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -777,7 +777,7 @@ void LLFolderViewItem::drawFavoriteIcon(const Params& default_params, const LLUI { favorite_image = default_params.favorite_image; } - else if (mHasFavorites && !hasVisibleChildren()) + else if (mHasFavorites && !isOpen()) { favorite_image = default_params.favorite_content_image; } -- cgit v1.2.3 From 50b93bd83af7cc4ddbd5b8b68f20099dac5f5ed2 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 14 May 2024 17:28:00 +0300 Subject: viewer#1424 Favorite support in galleries --- indra/llui/llfolderviewitem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 7a78540510..0131ab1085 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -784,8 +784,8 @@ void LLFolderViewItem::drawFavoriteIcon(const Params& default_params, const LLUI if (favorite_image) { - const S32 PAD = 2; - const S32 image_size = 18; + const S32 PAD = 3; + const S32 image_size = 14; gl_draw_scaled_image( getRect().getWidth() - image_size - PAD, getRect().getHeight() - mItemHeight + PAD, -- cgit v1.2.3 From 4c676acedd3c99234e599b77bcfdec6ad3274efb Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 17 May 2024 20:47:19 +0300 Subject: viewer#1300 More favorite settings --- indra/llui/llfolderviewitem.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 0131ab1085..03e3c84ca1 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -767,17 +767,14 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L void LLFolderViewItem::drawFavoriteIcon(const Params& default_params, const LLUIColor& fg_color) { static LLUICachedControl draw_star("InventoryFavoritesUseStar", true); - if (!draw_star) - { - return; - } + static LLUICachedControl draw_hollow_star("InventoryFavoritesUseHollowStar", true); LLUIImage* favorite_image = NULL; - if (mIsFavorite) + if (draw_star && mIsFavorite) { favorite_image = default_params.favorite_image; } - else if (mHasFavorites && !isOpen()) + else if (draw_hollow_star && mHasFavorites && !isOpen()) { favorite_image = default_params.favorite_content_image; } -- cgit v1.2.3