From 0091fa0cbaba034da09d42d49f68c63f2cc7df14 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 26 Apr 2023 03:53:05 +0300 Subject: SL-19583 Uniform risizing for combination inventory view --- indra/newview/llaisapi.cpp | 21 ++-- indra/newview/llaisapi.h | 1 + indra/newview/llinventorygallery.h | 1 + indra/newview/llpanelmaininventory.cpp | 47 +++++++-- indra/newview/llpanelmaininventory.h | 3 +- .../skins/default/xui/en/panel_main_inventory.xml | 114 ++++++++------------- 6 files changed, 98 insertions(+), 89 deletions(-) diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index e16029f063..6d13a06c54 100644 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -924,6 +924,16 @@ void AISUpdate::clearParseResults() mCategoryIds.clear(); } +void AISUpdate::checkTimeout() +{ + if (mTimer.hasExpired()) + { + llcoro::suspend(); + LLCoros::checkStop(); + mTimer.setTimerExpirySec(debugLoggingEnabled("Inventory") ? EXPIRY_SECONDS_DEBUG : EXPIRY_SECONDS_LIVE); + } +} + void AISUpdate::parseUpdate(const LLSD& update) { clearParseResults(); @@ -1281,12 +1291,7 @@ void AISUpdate::parseDescendentCount(const LLUUID& category_id, const LLSD& embe void AISUpdate::parseEmbedded(const LLSD& embedded, S32 depth) { - if (mTimer.hasExpired()) - { - llcoro::suspend(); - LLCoros::checkStop(); - mTimer.setTimerExpirySec(debugLoggingEnabled("Inventory") ? EXPIRY_SECONDS_DEBUG : EXPIRY_SECONDS_LIVE); - } + checkTimeout(); if (embedded.has("links")) // _embedded in a category { @@ -1408,6 +1413,8 @@ void AISUpdate::parseEmbeddedCategories(const LLSD& categories, S32 depth) void AISUpdate::doUpdate() { + checkTimeout(); + // Do version/descendant accounting. for (std::map::const_iterator catit = mCatDescendentDeltas.begin(); catit != mCatDescendentDeltas.end(); ++catit) @@ -1571,6 +1578,8 @@ void AISUpdate::doUpdate() } } + checkTimeout(); + gInventory.notifyObservers(); } diff --git a/indra/newview/llaisapi.h b/indra/newview/llaisapi.h index 1969448627..6afbbbd16e 100644 --- a/indra/newview/llaisapi.h +++ b/indra/newview/llaisapi.h @@ -123,6 +123,7 @@ public: void doUpdate(); private: void clearParseResults(); + void checkTimeout(); // Debug is very log-heavy, give it more time or it will take forever to process // Todo: find a way to make throttle static isntead of per-request diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h index 1760535524..2cf038b7d8 100644 --- a/indra/newview/llinventorygallery.h +++ b/indra/newview/llinventorygallery.h @@ -128,6 +128,7 @@ public: bool hasDescendents(const LLUUID& cat_id); bool hasVisibleItems(); void handleModifiedFilter(); + LLScrollContainer* getScrollableContainer() { return mScrollPanel; } protected: diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 98099dd407..7cd6d7cb82 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -266,6 +266,8 @@ BOOL LLPanelMainInventory::postBuild() comb_gallery_filter.markDefault(); mCombinationGalleryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::onCombinationRootChanged, this, true)); + mCombinationScroller = getChild("combination_scroller"); + initListCommandsHandlers(); const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()); @@ -928,6 +930,7 @@ void LLPanelMainInventory::draw() mActivePanel->setSortOrder(order); mResortActivePanel = false; } + LLPanel::draw(); updateItemcountText(); updateCombinationVisibility(); @@ -1503,7 +1506,7 @@ void LLPanelMainInventory::toggleViewMode() getChild("default_inventory_panel")->setVisible(!mSingleFolderMode); getChild("single_folder_inventory")->setVisible(mSingleFolderMode && isListViewMode()); getChild("gallery_view_inventory")->setVisible(mSingleFolderMode && isGalleryViewMode()); - getChild("combination_view_inventory")->setVisible(mSingleFolderMode && isCombinationViewMode()); + getChild("combination_view_inventory")->setVisible(mSingleFolderMode && isCombinationViewMode()); getChild("nav_buttons")->setVisible(mSingleFolderMode); getChild("view_mode_btn")->setImageOverlay(mSingleFolderMode ? getString("default_mode_btn") : getString("single_folder_mode_btn")); @@ -2214,19 +2217,41 @@ void LLPanelMainInventory::updateCombinationVisibility() { if(mSingleFolderMode && isCombinationViewMode()) { - bool is_gallery_empty = !mCombinationGalleryPanel->hasVisibleItems(); - bool show_inv_pane = mCombinationInventoryPanel->hasVisibleItems() || is_gallery_empty || mForceShowInvLayout; - getChild("comb_gallery_layout")->setVisible(!is_gallery_empty); - getChild("comb_inventory_layout")->setVisible(show_inv_pane); - mCombinationInventoryPanel->getRootFolder()->setForceArrange(!show_inv_pane); - if(mCombinationInventoryPanel->hasVisibleItems()) + LLRect inner_rect = mCombinationInventoryPanel->getScrollableContainer()->getScrolledViewRect(); + LLRect inv_rect = mCombinationInventoryPanel->getRect(); + inv_rect.mBottom = 0; + inv_rect.mRight = inv_rect.mLeft + inner_rect.getWidth(); + if (!mCombinationGalleryPanel->hasVisibleItems() || mCombinationInventoryPanel->hasVisibleItems()) + { + inv_rect.mTop = inv_rect.mBottom + inner_rect.getHeight(); + } + else { - mForceShowInvLayout = false; + inv_rect.mTop = inv_rect.mBottom; } - if(is_gallery_empty) + + inner_rect = mCombinationGalleryPanel->getScrollableContainer()->getScrolledViewRect(); + LLRect galery_rect = mCombinationGalleryPanel->getRect(); + galery_rect.mBottom = inv_rect.mTop; + if (mCombinationGalleryPanel->hasVisibleItems()) { - mCombinationGalleryPanel->handleModifiedFilter(); + mCombinationGalleryPanel->setVisible(true); + galery_rect.mTop = galery_rect.mBottom + inner_rect.getHeight(); } + else + { + mCombinationGalleryPanel->setVisible(false); + galery_rect.mTop = galery_rect.mBottom; + } + + LLRect scroller_rect = mCombinationScroller->getRect(); + scroller_rect.mBottom = 0; + scroller_rect.mTop = scroller_rect.mBottom + inv_rect.getHeight() + galery_rect.getHeight(); + scroller_rect.mRight = scroller_rect.mLeft + llmax(inv_rect.getWidth(), galery_rect.getWidth()); + + mCombinationScroller->setRect(scroller_rect); + mCombinationGalleryPanel->handleReshape(galery_rect, false); + mCombinationInventoryPanel->handleReshape(inv_rect, false); getActivePanel()->getRootFolder(); } @@ -2293,7 +2318,7 @@ void LLPanelMainInventory::setViewMode(EViewModeType mode) getChild("single_folder_inventory")->setVisible(mSingleFolderMode && isListViewMode()); getChild("gallery_view_inventory")->setVisible(mSingleFolderMode && isGalleryViewMode()); - getChild("combination_view_inventory")->setVisible(mSingleFolderMode && isCombinationViewMode()); + getChild("combination_view_inventory")->setVisible(mSingleFolderMode && isCombinationViewMode()); if(isListViewMode()) { diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index e5b9ba929d..8e7ad776b0 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -143,8 +143,6 @@ protected: static BOOL filtersVisible(void* user_data); void onClearSearch(); - static void onFoldersByName(void *user_data); - static BOOL checkFoldersByName(void *user_data); static BOOL incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward); void onFilterSelected(); @@ -196,6 +194,7 @@ private: LLInventorySingleFolderPanel* mCombinationInventoryPanel; LLInventoryGallery* mCombinationGalleryPanel; + LLView* mCombinationScroller; boost::signals2::connection mListViewRootUpdatedConnection; boost::signals2::connection mGalleryRootUpdatedConnection; diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml index 5bc0113367..f772c1fde2 100644 --- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml @@ -327,7 +327,7 @@ follows="all" layout="topleft" /> - - - - + + + + + + + - - - - - - - - - + -- cgit v1.2.3