diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-05-31 19:28:48 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-05-31 21:26:06 +0300 |
commit | 23311903106293f29e22d21314bdab03bbd499f7 (patch) | |
tree | e2d2caf30ff4c390c487cf84111151aa8e21710d /indra/newview | |
parent | c3e200cef41a602c13d3115cfec777eff63d5028 (diff) |
Revert "SL-19795 Unified scroll"
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llinventorymodel.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 23 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.h | 3 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 132 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.h | 20 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_main_inventory.xml | 113 |
6 files changed, 98 insertions, 195 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index bc0d523bd2..59b34cc95c 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -914,7 +914,7 @@ const LLUUID LLInventoryModel::findCategoryUUIDForTypeInRoot( // if it does not exists, it should either be added // to createCommonSystemCategories or server should // have set it - llassert(false); + llassert(!isInventoryUsable()); LL_WARNS("Inventory") << "Tried to find folder, type " << preferred_type << " but category does not exist" << LL_ENDL; } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 9827fa8c5c..a76769d25a 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -2107,7 +2107,6 @@ static LLDefaultChildRegistry::Register<LLInventorySingleFolderPanel> t_single_f LLInventorySingleFolderPanel::LLInventorySingleFolderPanel(const Params& params) : LLInventoryPanel(params) - , mExternalScroller(NULL) { mBuildChildrenViews = false; getFilter().setSingleFolderMode(true); @@ -2132,15 +2131,6 @@ void LLInventorySingleFolderPanel::setSelectCallback(const boost::function<void( } } -void LLInventorySingleFolderPanel::setScroller(LLScrollContainer* scroller) -{ - mExternalScroller = scroller; - if (mFolderRoot.get()) - { - mFolderRoot.get()->setScrollContainer(mExternalScroller); - } -} - void LLInventorySingleFolderPanel::initFromParams(const Params& p) { mFolderID = gInventory.getRootFolderID(); @@ -2247,18 +2237,7 @@ void LLInventorySingleFolderPanel::updateSingleFolderRoot() mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params); addChild(mScroller); mScroller->addChild(mFolderRoot.get()); - if (!mExternalScroller) - { - mFolderRoot.get()->setScrollContainer(mScroller); - } - else - { - // Hack to use exteranl scroll in combination view - // Todo: find a way to avoid this - // ideally combination view should be own inventory panel - // instead of piggy backing on two different ones - mFolderRoot.get()->setScrollContainer(mExternalScroller); - } + mFolderRoot.get()->setScrollContainer(mScroller); mFolderRoot.get()->setFollowsAll(); mFolderRoot.get()->addChild(mFolderRoot.get()->mStatusTextBox); diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 8d3edebcb4..61d59e001e 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -214,7 +214,6 @@ public: LLUUID getRootFolderID(); LLScrollContainer* getScrollableContainer() { return mScroller; } bool getAllowDropOnRoot() { return mParams.allow_drop_on_root; } - bool areViewsInitialized() { return mViewsInitialized == VIEWS_INITIALIZED && !mFolderRoot.get()->needsArrange(); } void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action); @@ -422,7 +421,6 @@ public: std::list<LLUUID> getNavForwardList() { return mForwardFolders; } void setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb); - void setScroller(LLScrollContainer* scroller); typedef boost::function<void()> root_changed_callback_t; boost::signals2::connection setRootChangedCallback(root_changed_callback_t cb); @@ -438,7 +436,6 @@ protected: LLUUID mFolderID; std::list<LLUUID> mBackwardFolders; std::list<LLUUID> mForwardFolders; - LLScrollContainer* mExternalScroller; boost::signals2::signal<void()> mRootChangedSignal; }; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 16f7abee23..f3241c6e5e 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -120,7 +120,6 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p) mSingleFolderMode(false), mForceShowInvLayout(false), mViewMode(MODE_COMBINATION), - mCombinationShapeDirty(true), mListViewRootUpdatedConnection(), mGalleryRootUpdatedConnection(), mDelayedCombGalleryScroll(false), @@ -258,6 +257,7 @@ BOOL LLPanelMainInventory::postBuild() mDefaultViewPanel = getChild<LLPanel>("default_inventory_panel"); mListViewPanel = getChild<LLPanel>("single_folder_inventory"); mGalleryViewPanel = getChild<LLPanel>("gallery_view_inventory"); + mCombinationViewPanel = getChild<LLPanel>("combination_view_inventory"); mSingleFolderPanelInventory = getChild<LLInventorySingleFolderPanel>("single_folder_inv"); mListViewRootUpdatedConnection = mSingleFolderPanelInventory->setRootChangedCallback(boost::bind(&LLPanelMainInventory::updateTitle, this)); @@ -266,15 +266,12 @@ BOOL LLPanelMainInventory::postBuild() mInventoryGalleryPanel = getChild<LLInventoryGallery>("gallery_view_inv"); mGalleryRootUpdatedConnection = mInventoryGalleryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::updateTitle, this)); - mCombinationScrollPanel = getChild<LLScrollContainer>("combination_view_inventory"); - mCombinationInventoryPanel = getChild<LLInventorySingleFolderPanel>("comb_single_folder_inv"); LLInventoryFilter& comb_inv_filter = mCombinationInventoryPanel->getFilter(); comb_inv_filter.setFilterThumbnails(LLInventoryFilter::FILTER_EXCLUDE_THUMBNAILS); comb_inv_filter.markDefault(); mCombinationInventoryPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onCombinationInventorySelectionChanged, this, _1, _2)); mCombinationInventoryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::onCombinationRootChanged, this, false)); - mCombinationInventoryPanel->setScroller(mCombinationScrollPanel); mCombinationGalleryPanel = getChild<LLInventoryGallery>("comb_gallery_view_inv"); LLInventoryFilter& comb_gallery_filter = mCombinationGalleryPanel->getFilter(); @@ -283,8 +280,6 @@ BOOL LLPanelMainInventory::postBuild() mCombinationGalleryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::onCombinationRootChanged, this, true)); mCombinationGalleryPanel->setSelectionChangeCallback(boost::bind(&LLPanelMainInventory::onCombinationGallerySelectionChanged, this, _1)); - mCombinationScroller = getChild<LLView>("combination_scroller"); - initListCommandsHandlers(); const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()); @@ -301,7 +296,6 @@ BOOL LLPanelMainInventory::postBuild() // Trigger callback for focus received so we can deselect items in inbox/outbox LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMainInventory::onFocusReceived, this)); - mCombinationShapeDirty = true; return TRUE; } @@ -750,8 +744,6 @@ void LLPanelMainInventory::onClearSearch() inbox_panel->onClearSearch(); } } - - mCombinationShapeDirty = true; } void LLPanelMainInventory::onFilterEdit(const std::string& search_string ) @@ -809,8 +801,6 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string ) inbox_panel->onFilterEdit(search_string); } } - - mCombinationShapeDirty = true; } @@ -921,19 +911,9 @@ BOOL LLPanelMainInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, } // virtual -void LLPanelMainInventory::changed(U32 mask) +void LLPanelMainInventory::changed(U32) { updateItemcountText(); - if ((mask & LLInventoryObserver::REBUILD) - || (mask & LLInventoryObserver::STRUCTURE) - || (mask & LLInventoryObserver::REMOVE) - || (mask & LLInventoryObserver::ADD) - || (mask & LLInventoryObserver::INTERNAL) // Thumbnail - || (mask & LLInventoryObserver::LABEL)) - { - // todo: can be limited to just observed folder - mCombinationShapeDirty = true; - } } void LLPanelMainInventory::setFocusFilterEditor() @@ -944,14 +924,6 @@ void LLPanelMainInventory::setFocusFilterEditor() } } - -void LLPanelMainInventory::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - mCombinationShapeDirty = true; - LLPanel::reshape(width, height, called_from_parent); - updateCombinationVisibility(); -} - // virtual void LLPanelMainInventory::draw() { @@ -970,10 +942,9 @@ void LLPanelMainInventory::draw() mActivePanel->setSortOrder(order); mResortActivePanel = false; } - - updateCombinationVisibility(); LLPanel::draw(); updateItemcountText(); + updateCombinationVisibility(); } void LLPanelMainInventory::updateItemcountText() @@ -1545,7 +1516,6 @@ void LLPanelMainInventory::toggleViewMode() } mSingleFolderMode = !mSingleFolderMode; - mCombinationShapeDirty = true; if (mCombinationGalleryPanel->getRootFolder().isNull()) { @@ -1556,9 +1526,9 @@ void LLPanelMainInventory::toggleViewMode() mDefaultViewPanel->setVisible(!mSingleFolderMode); mListViewPanel->setVisible(mSingleFolderMode && isListViewMode()); mGalleryViewPanel->setVisible(mSingleFolderMode && isGalleryViewMode()); + mCombinationViewPanel->setVisible(mSingleFolderMode && isCombinationViewMode()); mNavigationBtnsPanel->setVisible(mSingleFolderMode); mViewModeBtn->setImageOverlay(mSingleFolderMode ? getString("default_mode_btn") : getString("single_folder_mode_btn")); - mCombinationScrollPanel->setVisible(mSingleFolderMode && isCombinationViewMode()); setActivePanel(); updateTitle(); @@ -1711,8 +1681,6 @@ void LLPanelMainInventory::setSingleFolderViewRoot(const LLUUID& folder_id, bool mCombinationInventoryPanel->changeFolderRoot(folder_id); } updateNavButtons(); - - mCombinationShapeDirty = true; } LLUUID LLPanelMainInventory::getSingleFolderViewRoot() @@ -1997,7 +1965,6 @@ void LLPanelMainInventory::onVisibilityChange( BOOL new_visibility ) } getActivePanel()->getRootFolder()->finishRenamingItem(); } - mCombinationShapeDirty = true; } bool LLPanelMainInventory::isSaveTextureEnabled(const LLSD& userdata) @@ -2313,10 +2280,6 @@ void LLPanelMainInventory::onCombinationRootChanged(bool gallery_clicked) } mForceShowInvLayout = false; updateTitle(); - - //force update scroll container - mCombinationShapeDirty = true; - mCombinationInventoryPanel->reshape(1, 1); } void LLPanelMainInventory::onCombinationGallerySelectionChanged(const LLUUID& category_id) @@ -2339,66 +2302,23 @@ void LLPanelMainInventory::onCombinationInventorySelectionChanged(const std::deq void LLPanelMainInventory::updateCombinationVisibility() { - if(mSingleFolderMode - && isCombinationViewMode() - && mCombinationShapeDirty) + if(mSingleFolderMode && isCombinationViewMode()) { - if (mCombinationInventoryPanel->areViewsInitialized()) + bool is_gallery_empty = !mCombinationGalleryPanel->hasVisibleItems(); + bool show_inv_pane = mCombinationInventoryPanel->hasVisibleItems() || is_gallery_empty || mForceShowInvLayout; + getChild<LLLayoutPanel>("comb_gallery_layout")->setVisible(!is_gallery_empty); + getChild<LLLayoutPanel>("comb_inventory_layout")->setVisible(show_inv_pane); + mCombinationInventoryPanel->getRootFolder()->setForceArrange(!show_inv_pane); + if(mCombinationInventoryPanel->hasVisibleItems()) { - mCombinationShapeDirty = false; - mCombinationInventoryPanel->reshape(1,1); // HACK: force reduce visible area - LLFolderView* root_folder = mCombinationInventoryPanel->getRootFolder(); - if (root_folder) - { - root_folder->arrangeAll(); - } + mForceShowInvLayout = false; } - if (!mCombinationGalleryPanel->hasVisibleItems()) + if(is_gallery_empty) { mCombinationGalleryPanel->handleModifiedFilter(); } - LLRect inv_rect = mCombinationInventoryPanel->getRect(); - LLRect inv_inner_rect = mCombinationInventoryPanel->getScrollableContainer()->getScrolledViewRect(); - LLRect galery_rect = mCombinationGalleryPanel->getRect(); - LLRect inner_galery_rect = mCombinationGalleryPanel->getScrollableContainer()->getScrolledViewRect(); - LLRect scroller_window_rect = mCombinationScrollPanel->getContentWindowRect(); - - inv_rect.mBottom = 0; - inv_rect.mRight = inv_rect.mLeft + inv_inner_rect.getWidth() + mCombinationInventoryPanel->getScrollableContainer()->getBorderWidth(); - if (!mCombinationGalleryPanel->hasVisibleItems() || mCombinationInventoryPanel->hasVisibleItems()) - { - inv_rect.mTop = inv_rect.mBottom + inv_inner_rect.getHeight() + mCombinationInventoryPanel->getScrollableContainer()->getBorderWidth(); - } - else - { - inv_rect.mTop = inv_rect.mBottom + mCombinationInventoryPanel->getScrollableContainer()->getBorderWidth(); - } - - galery_rect.mBottom = inv_rect.mTop; - galery_rect.mRight = galery_rect.mLeft + scroller_window_rect.getWidth(); - if (mCombinationGalleryPanel->hasVisibleItems()) - { - mCombinationGalleryPanel->setVisible(true); - galery_rect.mTop = galery_rect.mBottom + inner_galery_rect.getHeight() + mCombinationGalleryPanel->getScrollableContainer()->getBorderWidth(); - } - else - { - mCombinationGalleryPanel->setVisible(false); - galery_rect.mTop = galery_rect.mBottom + mCombinationGalleryPanel->getScrollableContainer()->getBorderWidth(); - } - - mCombinationScroller->reshape(scroller_window_rect.getWidth(), inv_rect.getHeight() + galery_rect.getHeight(), true); - mCombinationGalleryPanel->setShape(galery_rect, false); - mCombinationInventoryPanel->setShape(inv_rect, false); - - if(mDelayedCombGalleryScroll) - { - scrollToGallerySelection(); - } - else if(mDelayedCombInvPanelScroll) - { - scrollToInvPanelSelection(); - } + + getActivePanel()->getRootFolder(); } } @@ -2463,7 +2383,7 @@ void LLPanelMainInventory::setViewMode(EViewModeType mode) mListViewPanel->setVisible(mSingleFolderMode && isListViewMode()); mGalleryViewPanel->setVisible(mSingleFolderMode && isGalleryViewMode()); - mCombinationScrollPanel->setVisible(mSingleFolderMode && isCombinationViewMode()); + mCombinationViewPanel->setVisible(mSingleFolderMode && isCombinationViewMode()); if(isListViewMode()) { @@ -2573,28 +2493,12 @@ void LLPanelMainInventory::setGallerySelection(const LLUUID& item_id, bool new_w void LLPanelMainInventory::scrollToGallerySelection() { - LLInventoryGalleryItem* item = mCombinationGalleryPanel->getSelectedItem(); - LLScrollContainer* scroll_panel = getChild<LLScrollContainer>("combination_view_inventory"); - - if(item) - { - LLRect item_rect; - item->localRectToOtherView(item->getLocalRect(), &item_rect, mCombinationScroller); - scroll_panel->scrollToShowRect(item_rect); - } + mCombinationGalleryPanel->scrollToShowItem(mCombinationGalleryPanel->getSelectedItemID()); } void LLPanelMainInventory::scrollToInvPanelSelection() { - LLFolderViewItem* item = mCombinationInventoryPanel->getRootFolder()->getCurSelectedItem(); - LLScrollContainer* scroll_panel = getChild<LLScrollContainer>("combination_view_inventory"); - - if(item) - { - LLRect item_rect; - item->localRectToOtherView(item->getLocalRect(), &item_rect, mCombinationScroller); - scroll_panel->scrollToShowRect(item_rect); - } + mCombinationInventoryPanel->getRootFolder()->scrollToShowSelection(); } // List Commands // diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 056b26b6ec..cc36385e90 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -36,20 +36,19 @@ #include "llfolderview.h" class LLComboBox; +class LLFolderViewItem; class LLInventoryPanel; class LLInventoryGallery; +class LLSaveFolderState; class LLFilterEditor; -class LLFloater; +class LLTabContainer; class LLFloaterInventoryFinder; -class LLFloaterSidePanelContainer; -class LLFolderViewItem; class LLMenuButton; class LLMenuGL; -class LLSaveFolderState; -class LLScrollContainer; class LLSidepanelInventory; -class LLTabContainer; class LLToggleableMenu; +class LLFloater; +class LLFloaterSidePanelContainer; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLPanelMainInventory @@ -84,9 +83,8 @@ public: EAcceptance* accept, std::string& tooltip_msg); /*virtual*/ void changed(U32); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); /*virtual*/ void draw(); - /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); + /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); LLInventoryPanel* getPanel() { return mActivePanel; } LLInventoryPanel* getActivePanel() { return mActivePanel; } @@ -148,6 +146,8 @@ 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(); @@ -207,10 +207,9 @@ private: LLInventorySingleFolderPanel* mSingleFolderPanelInventory; LLInventoryGallery* mInventoryGalleryPanel; - LLScrollContainer* mCombinationScrollPanel; LLInventorySingleFolderPanel* mCombinationInventoryPanel; LLInventoryGallery* mCombinationGalleryPanel; - LLView* mCombinationScroller; + LLPanel* mCombinationViewPanel; boost::signals2::connection mListViewRootUpdatedConnection; boost::signals2::connection mGalleryRootUpdatedConnection; @@ -251,7 +250,6 @@ private: bool mNeedUploadCost; bool mForceShowInvLayout; - bool mCombinationShapeDirty; bool mDelayedCombGalleryScroll; bool mDelayedCombInvPanelScroll; // List Commands // 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 f772c1fde2..1a9816247b 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" /> </panel> - <scroll_container + <panel follows="all" halign="center" height="372" @@ -337,48 +337,73 @@ top_delta="0" visible="false" width="312"> - <panel - name="combination_scroller" - follows="all" - layout="topleft" - left="0" - top="0" - height="20" - width="291"> - <panel - class="inventory_gallery" - filename="panel_inventory_gallery.xml" - follows="left|right" - layout="topleft" - left="0" - top="0" - height="10" - width="290" - name="comb_gallery_view_inv" - background_visible="true"> - </panel> - <single_folder_inventory_panel - name="comb_single_folder_inv" - follows="left|right" - layout="topleft" - left="0" - top="200" - height="10" - width="290" - show_item_link_overlays="true" - bg_opaque_color="DkGray2" - bg_alpha_color="DkGray2" - background_visible="true" - border="false" - bevel_style="none" - scroll.reserve_scroll_corner="false"> - <item - single_folder_mode="true" - folder_indentation="-8"/> - <folder - single_folder_mode="true" - folder_indentation="-8"/> - </single_folder_inventory_panel> + <layout_stack + follows="all" + height="372" + width="312" + animate="false" + drag_handle_gap="13" + drag_handle_thickness="6" + drag_handle_first_indent="18" + drag_handle_second_indent="18" + drag_handle_shift="5" + show_drag_handle="true" + top="0" + left="0" + orientation="vertical"> + <layout_panel + border="false" + bevel_style="in" + user_resize="true" + auto_resize="true" + height="246" + width="312" + min_width="150" + name="comb_gallery_layout"> + <panel + class="inventory_gallery" + filename="panel_inventory_gallery.xml" + left="0" + top_pad="0" + height="246" + width="312" + name="comb_gallery_view_inv" + background_visible="true" + follows="all" + layout="topleft"> </panel> - </scroll_container> + </layout_panel> + <layout_panel + border="false" + bevel_style="in" + user_resize="true" + auto_resize="true" + height="126" + width="312" + name="comb_inventory_layout"> + <single_folder_inventory_panel + name="comb_single_folder_inv" + follows="all" + left="0" + top="1" + height="126" + width="312" + layout="topleft" + show_item_link_overlays="true" + bg_opaque_color="DkGray2" + bg_alpha_color="DkGray2" + background_visible="true" + border="false" + bevel_style="none" + scroll.reserve_scroll_corner="false"> + <item + single_folder_mode="true" + folder_indentation="-8"/> + <folder + single_folder_mode="true" + folder_indentation="-8"/> + </single_folder_inventory_panel> + </layout_panel> + </layout_stack> + </panel> </panel> |