diff --git a/indra/llcommon/llcallbacklist.cpp b/indra/llcommon/llcallbacklist.cpp index 93d0a035da..9f23ce5317 100644 --- a/indra/llcommon/llcallbacklist.cpp +++ b/indra/llcommon/llcallbacklist.cpp @@ -55,7 +55,7 @@ void LLCallbackList::addFunction( callback_t func, void *data) // only add one callback per func/data pair // - if (containsFunction(func)) + if (containsFunction(func, data)) { return; } diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index e2787f6162..4d5661f843 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -724,6 +724,7 @@ void LLFolderView::draw() { // renamer is not connected to the item we are renaming in any form so manage it manually // TODO: consider stopping on any scroll action instead of when out of visible area + LL_DEBUGS("Inventory") << "Renamer out of bounds, hiding" << LL_ENDL; finishRenamingItem(); } @@ -1085,6 +1086,8 @@ void LLFolderView::paste() // public rename functionality - can only start the process void LLFolderView::startRenamingSelectedItem( void ) { + LL_DEBUGS("Inventory") << "Starting inventory renamer" << LL_ENDL; + // make sure selection is visible scrollToShowSelection(); @@ -1568,10 +1571,10 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) } } - bool item_clicked = false; + BOOL item_clicked = FALSE; for (selected_items_t::iterator item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) { - item_clicked |= (bool)(*item_it)->getRect().pointInRect(x, y); + item_clicked |= (*item_it)->getRect().pointInRect(x, y); } if(!item_clicked && mSingleFolderMode) { diff --git a/indra/newview/llfloaterchangeitemthumbnail.cpp b/indra/newview/llfloaterchangeitemthumbnail.cpp index b005939827..58161b92e9 100644 --- a/indra/newview/llfloaterchangeitemthumbnail.cpp +++ b/indra/newview/llfloaterchangeitemthumbnail.cpp @@ -296,8 +296,8 @@ void LLFloaterChangeItemThumbnail::refreshFromInventory() if (obj) { const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - bool in_trash = (obj->getUUID() == trash_id) || gInventory.isObjectDescendentOf(obj->getUUID(), trash_id); - if (in_trash) + bool in_trash = gInventory.isObjectDescendentOf(obj->getUUID(), trash_id); + if (in_trash && obj->getUUID() != trash_id) { // Close properties when moving to trash // Aren't supposed to view properties from trash diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index ef2098852d..b2f502ae40 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -988,8 +988,8 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, // Don't offer "Show in Main View" for folders opened in separate inventory views // as there are no tabs to switch to - //if (!isPanelActive("All Items") && !isPanelActive("single_folder_inv") && !isPanelActive("comb_single_folder_inv")) - if (!isPanelActive("All Items") && !isPanelActive("single_folder_inv") && !isPanelActive("comb_single_folder_inv") && !isPanelActive("inv_panel")) + //if (!isPanelActive("All Items") && !isPanelActive("comb_single_folder_inv")) + if (!isPanelActive("All Items") && !isPanelActive("comb_single_folder_inv") && !isPanelActive("inv_panel")) // { items.push_back(std::string("Show in Main Panel")); @@ -4639,6 +4639,8 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items { disabled_items.push_back(std::string("Empty Trash")); } + + items.push_back(std::string("thumbnail")); } else if(isItemInTrash()) { @@ -4705,6 +4707,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items if (model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT) == mUUID) { items.push_back(std::string("Copy outfit list to clipboard")); + addOpenFolderMenuOptions(flags, items); } //Added by aura to force inventory pull on right-click to display folder options correctly. 07-17-06 @@ -4857,9 +4860,12 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& if(!category) return; const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - if (trash_id == mUUID) return; - if (isItemInTrash()) return; - + if ((trash_id == mUUID) || isItemInTrash()) + { + addOpenFolderMenuOptions(flags, items); + return; + } + if (!isItemRemovable()) { disabled_items.push_back(std::string("Delete")); @@ -4901,15 +4907,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& return; } - if ((flags & ITEM_IN_MULTI_SELECTION) == 0) - { - items.push_back(std::string("open_in_new_window")); - items.push_back(std::string("Open Folder Separator")); - if(isPanelActive("single_folder_inv")) - { - items.push_back(std::string("open_in_current_window")); - } - } + addOpenFolderMenuOptions(flags, items); #ifndef LL_RELEASE_FOR_DOWNLOAD if (LLFolderType::lookupIsProtectedType(type) && is_agent_inventory) @@ -5006,6 +5004,20 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) menu.arrangeAndClear(); } +void LLFolderBridge::addOpenFolderMenuOptions(U32 flags, menuentry_vec_t& items) +{ + if ((flags & ITEM_IN_MULTI_SELECTION) == 0) + { + items.push_back(std::string("open_in_new_window")); + items.push_back(std::string("Open Folder Separator")); + items.push_back(std::string("Copy Separator")); + if(isPanelActive("comb_single_folder_inv")) + { + items.push_back(std::string("open_in_current_window")); + } + } +} + bool LLFolderBridge::hasChildren() const { LLInventoryModel* model = getInventoryModel(); diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 19c1d0b823..cc0e58b892 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -366,6 +366,7 @@ public: protected: void buildContextMenuOptions(U32 flags, menuentry_vec_t& items, menuentry_vec_t& disabled_items); void buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& items, menuentry_vec_t& disabled_items); + void addOpenFolderMenuOptions(U32 flags, menuentry_vec_t& items); //-------------------------------------------------------------------- // Menu callbacks diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 817c46f3a0..6b59437cb6 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -85,6 +85,7 @@ LLInventoryGallery::LLInventoryGallery(const LLInventoryGallery::Params& p) mRowPanWidthFactor(p.row_panel_width_factor), mGalleryWidthFactor(p.gallery_width_factor), mIsInitialized(false), + mRootDirty(false), mNeedsArrange(false), mSearchType(LLInventoryFilter::SEARCHTYPE_NAME) { @@ -142,8 +143,8 @@ LLInventoryGallery::~LLInventoryGallery() delete mInventoryGalleryMenu; delete mRootGalleryMenu; delete mFilter; - - gIdleCallbacks.deleteFunction(onIdle, this); + + gIdleCallbacks.deleteFunction(onIdle, (void*)this); while (!mUnusedRowPanels.empty()) { @@ -157,6 +158,13 @@ LLInventoryGallery::~LLInventoryGallery() mUnusedItemPanels.pop_back(); panelp->die(); } + while (!mHiddenItems.empty()) + { + LLPanel* panelp = mHiddenItems.back(); + mHiddenItems.pop_back(); + panelp->die(); + } + if (gInventory.containsObserver(mCategoriesObserver)) { @@ -176,8 +184,6 @@ LLInventoryGallery::~LLInventoryGallery() void LLInventoryGallery::setRootFolder(const LLUUID cat_id) { - gIdleCallbacks.deleteFunction(onIdle, this); - LLViewerInventoryCategory* category = gInventory.getCategory(cat_id); if(!category || (mFolderID == cat_id)) { @@ -187,8 +193,26 @@ void LLInventoryGallery::setRootFolder(const LLUUID cat_id) { mBackwardFolders.push_back(mFolderID); } + + gIdleCallbacks.deleteFunction(onIdle, (void*)this); + mFolderID = cat_id; - updateRootFolder(); + mItemToSelect.setNull(); + mItemBuildQuery.clear(); + mNeedsArrange = false; + dirtyRootFolder(); +} + +void LLInventoryGallery::dirtyRootFolder() +{ + if (getVisible()) + { + updateRootFolder(); + } + else + { + mRootDirty = true; + } } void LLInventoryGallery::updateRootFolder() @@ -206,6 +230,7 @@ void LLInventoryGallery::updateRootFolder() { updateRemovedItem(mHiddenItems[i]->getUUID()); } + mItemBuildQuery.clear(); if (gInventory.containsObserver(mCategoriesObserver)) { @@ -249,17 +274,17 @@ void LLInventoryGallery::updateRootFolder() iter != cat_array->end(); iter++) { - updateAddedItem((*iter)->getUUID()); + mItemBuildQuery.insert((*iter)->getUUID()); } for (LLInventoryModel::item_array_t::const_iterator iter = item_array->begin(); iter != item_array->end(); iter++) { - updateAddedItem((*iter)->getUUID()); + mItemBuildQuery.insert((*iter)->getUUID()); } - reArrangeRows(); mIsInitialized = true; + mRootDirty = false; if (mScrollPanel) { @@ -273,6 +298,11 @@ void LLInventoryGallery::updateRootFolder() { initGallery(); } + + if (!mItemBuildQuery.empty()) + { + gIdleCallbacks.addFunction(onIdle, (void*)this); + } } void LLInventoryGallery::initGallery() @@ -305,14 +335,26 @@ void LLInventoryGallery::draw() } } +void LLInventoryGallery::onVisibilityChange(BOOL new_visibility) +{ + if (new_visibility && mRootDirty) + { + updateRootFolder(); + } + LLPanel::onVisibilityChange(new_visibility); +} + bool LLInventoryGallery::updateRowsIfNeeded() { - if(((getRect().getWidth() - mRowPanelWidth) > mItemWidth) && mRowCount > 1) + S32 scroll_content_width = mScrollPanel ? mScrollPanel->getVisibleContentRect().getWidth() : getRect().getWidth(); + if(((scroll_content_width - mRowPanelWidth) > mItemWidth) + && mRowCount > 1) { reArrangeRows(1); return true; } - else if((mRowPanelWidth > (getRect().getWidth() + mItemHorizontalGap)) && mItemsInRow > GALLERY_ITEMS_PER_ROW_MIN) + else if((mRowPanelWidth > (scroll_content_width + mItemHorizontalGap)) + && mItemsInRow > GALLERY_ITEMS_PER_ROW_MIN) { reArrangeRows(-1); return true; @@ -344,7 +386,7 @@ void LLInventoryGallery::reArrangeRows(S32 row_diff) std::vector buf_items = mItems; for (std::vector::const_reverse_iterator it = buf_items.rbegin(); it != buf_items.rend(); ++it) { - removeFromGalleryLast(*it); + removeFromGalleryLast(*it, false); } for (std::vector::const_reverse_iterator it = mHiddenItems.rbegin(); it != mHiddenItems.rend(); ++it) { @@ -457,11 +499,12 @@ void LLInventoryGallery::addToGallery(LLInventoryGalleryItem* item) } -void LLInventoryGallery::removeFromGalleryLast(LLInventoryGalleryItem* item) +void LLInventoryGallery::removeFromGalleryLast(LLInventoryGalleryItem* item, bool needs_reshape) { if(item->isHidden()) { mHiddenItems.pop_back(); + // Note: item still exists!!! return; } int n_prev = mItemsAddedCount; @@ -482,7 +525,10 @@ void LLInventoryGallery::removeFromGalleryLast(LLInventoryGalleryItem* item) } removeLastRow(); } - reshapeGalleryPanel(row_count); + if (needs_reshape) + { + reshapeGalleryPanel(row_count); + } } @@ -491,6 +537,7 @@ void LLInventoryGallery::removeFromGalleryMiddle(LLInventoryGalleryItem* item) if(item->isHidden()) { mHiddenItems.erase(std::remove(mHiddenItems.begin(), mHiddenItems.end(), item), mHiddenItems.end()); + // item still exists and needs to be deleted or used!!! return; } int n = mItemIndexMap[item]; @@ -522,12 +569,11 @@ void LLInventoryGallery::removeFromLastRow(LLInventoryGalleryItem* item) LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, bool is_link, bool is_worn) { LLInventoryGalleryItem::Params giparams; + giparams.visible = true; + giparams.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP); + giparams.rect(LLRect(0,mItemHeight, mItemWidth, 0)); LLInventoryGalleryItem* gitem = LLUICtrlFactory::create(giparams); - gitem->reshape(mItemWidth, mItemHeight); - gitem->setVisible(true); - gitem->setFollowsLeft(); - gitem->setFollowsTop(); - gitem->setName(name); + gitem->setItemName(name); gitem->setUUID(item_id); gitem->setGallery(this); gitem->setType(type, inventory_type, flags, is_link); @@ -542,6 +588,9 @@ LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, L void LLInventoryGallery::buildGalleryPanel(int row_count) { LLPanel::Params params; + params.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP); + params.visible = true; + params.use_bounding_rect = false; mGalleryPanel = LLUICtrlFactory::create(params); reshapeGalleryPanel(row_count); } @@ -554,40 +603,41 @@ void LLInventoryGallery::reshapeGalleryPanel(int row_count) LLRect rect = LLRect(left, bottom + height, left + mGalleryWidth, bottom); mGalleryPanel->setRect(rect); mGalleryPanel->reshape(mGalleryWidth, height); - mGalleryPanel->setVisible(true); - mGalleryPanel->setFollowsLeft(); - mGalleryPanel->setFollowsTop(); } LLPanel* LLInventoryGallery::buildItemPanel(int left) { - LLPanel::Params lpparams; int top = 0; LLPanel* lpanel = NULL; if(mUnusedItemPanels.empty()) { + LLPanel::Params lpparams; + lpparams.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP); + lpparams.visible = true; + lpparams.rect(LLRect(left, top + mItemHeight, left + mItemWidth + mItemHorizontalGap, top)); + lpparams.use_bounding_rect = false; lpanel = LLUICtrlFactory::create(lpparams); } else { lpanel = mUnusedItemPanels.back(); mUnusedItemPanels.pop_back(); + + LLRect rect = LLRect(left, top + mItemHeight, left + mItemWidth + mItemHorizontalGap, top); + lpanel->setShape(rect, false); } - LLRect rect = LLRect(left, top + mItemHeight, left + mItemWidth + mItemHorizontalGap, top); - lpanel->setRect(rect); - lpanel->reshape(mItemWidth + mItemHorizontalGap, mItemHeight); - lpanel->setVisible(true); - lpanel->setFollowsLeft(); - lpanel->setFollowsTop(); return lpanel; } LLPanel* LLInventoryGallery::buildRowPanel(int left, int bottom) { - LLPanel::Params sparams; LLPanel* stack = NULL; if(mUnusedRowPanels.empty()) { + LLPanel::Params sparams; + sparams.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP); + sparams.use_bounding_rect = false; + sparams.visible = true; stack = LLUICtrlFactory::create(sparams); } else @@ -604,9 +654,6 @@ void LLInventoryGallery::moveRowPanel(LLPanel* stack, int left, int bottom) LLRect rect = LLRect(left, bottom + mRowPanelHeight, left + mRowPanelWidth, bottom); stack->setRect(rect); stack->reshape(mRowPanelWidth, mRowPanelHeight); - stack->setVisible(true); - stack->setFollowsLeft(); - stack->setFollowsTop(); } void LLInventoryGallery::setFilterSubString(const std::string& string) @@ -617,12 +664,15 @@ void LLInventoryGallery::setFilterSubString(const std::string& string) //reArrangeRows(); } -void LLInventoryGallery::applyFilter(LLInventoryGalleryItem* item, const std::string& filter_substring) +bool LLInventoryGallery::applyFilter(LLInventoryGalleryItem* item, const std::string& filter_substring) { if(item) { - item->setHidden(!checkAgainstFilters(item, filter_substring)); + bool visible = checkAgainstFilters(item, filter_substring); + item->setHidden(!visible); + return visible; } + return false; } bool LLInventoryGallery::checkAgainstFilters(LLInventoryGalleryItem* item, const std::string& filter_substring) @@ -701,10 +751,26 @@ void LLInventoryGallery::onIdle(void* userdata) return; } + const F64 MAX_TIME_VISIBLE = 0.020f; + const F64 MAX_TIME_HIDDEN = 0.001f; // take it slow + const F64 max_time = self->getVisible() ? MAX_TIME_VISIBLE : MAX_TIME_HIDDEN; + F64 curent_time = LLTimer::getTotalSeconds(); + const F64 end_time = curent_time + max_time; + + while (!self->mItemBuildQuery.empty() && end_time > curent_time) + { + uuid_set_t::iterator iter = self->mItemBuildQuery.begin(); + LLUUID item_id = *iter; + self->mNeedsArrange |= self->updateAddedItem(item_id); + self->mItemBuildQuery.erase(iter); + curent_time = LLTimer::getTotalSeconds(); + } + if (self->mNeedsArrange) { self->mNeedsArrange = false; self->reArrangeRows(); + self->updateMessageVisibility(); } if (self->mItemToSelect.notNull()) @@ -714,7 +780,7 @@ void LLInventoryGallery::onIdle(void* userdata) self->changeItemSelection(item_to_select, true); } - if (self->mItemToSelect.isNull()) + if (self->mItemToSelect.isNull() && self->mItemBuildQuery.empty()) { gIdleCallbacks.deleteFunction(onIdle, (void*)self); } @@ -745,13 +811,13 @@ void LLInventoryGallery::getCurrentCategories(uuid_vec_t& vcur) } } -void LLInventoryGallery::updateAddedItem(LLUUID item_id) +bool LLInventoryGallery::updateAddedItem(LLUUID item_id) { LLInventoryObject* obj = gInventory.getObject(item_id); if (!obj) { LL_WARNS("InventoryGallery") << "Failed to find item: " << item_id << LL_ENDL; - return; + return false; } std::string name = obj->getName(); @@ -782,18 +848,20 @@ void LLInventoryGallery::updateAddedItem(LLUUID item_id) } } + bool res = false; LLInventoryGalleryItem* item = buildGalleryItem(name, item_id, obj->getType(), thumbnail_id, inventory_type, misc_flags, obj->getIsLinkType(), is_worn); mItemMap.insert(LLInventoryGallery::gallery_item_map_t::value_type(item_id, item)); item->setRightMouseDownCallback(boost::bind(&LLInventoryGallery::showContextMenu, this, _1, _2, _3, item_id)); item->setFocusReceivedCallback(boost::bind(&LLInventoryGallery::changeItemSelection, this, item_id, false)); if (mGalleryCreated) { - applyFilter(item, mFilterSubString); + res = applyFilter(item, mFilterSubString); addToGallery(item); } mThumbnailsObserver->addItem(item_id, boost::bind(&LLInventoryGallery::updateItemThumbnail, this, item_id)); + return res; } void LLInventoryGallery::updateRemovedItem(LLUUID item_id) @@ -812,9 +880,12 @@ void LLInventoryGallery::updateRemovedItem(LLUUID item_id) // kill removed item if (item != NULL) { + // Todo: instead of deleting, store somewhere to reuse later item->die(); } } + + mItemBuildQuery.erase(item_id); } void LLInventoryGallery::updateChangedItemName(LLUUID item_id, std::string name) @@ -825,7 +896,7 @@ void LLInventoryGallery::updateChangedItemName(LLUUID item_id, std::string name) LLInventoryGalleryItem* item = iter->second; if (item) { - item->setName(name); + item->setItemName(name); } } } @@ -870,24 +941,15 @@ void LLInventoryGallery::updateItemThumbnail(LLUUID item_id) } } -void LLInventoryGallery::onThumbnailAdded(LLUUID item_id) -{ - if((mItemMap.count(item_id) == 0) && mFilter->checkAgainstFilterThumbnails(item_id)) - { - updateAddedItem(item_id); - reArrangeRows(); - } -} - BOOL LLInventoryGallery::handleRightMouseDown(S32 x, S32 y, MASK mask) { - LLUUID old_selection = mSelectedItemID; - BOOL res = LLPanel::handleRightMouseDown(x, y, mask); - if (!res) + if(mItemMap[mSelectedItemID]) { - clearSelection(); - mItemMap[old_selection]->setFocus(false); + mItemMap[mSelectedItemID]->setFocus(false); + setFocus(true); } + clearSelection(); + BOOL res = LLPanel::handleRightMouseDown(x, y, mask); if (mSelectedItemID.isNull()) { @@ -1257,7 +1319,7 @@ void LLInventoryGallery::paste() } const LLUUID& marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); - if (gInventory.isObjectDescendentOf(mSelectedItemID, marketplacelistings_id)) + if (!mSelectedItemID.isNull() && gInventory.isObjectDescendentOf(mSelectedItemID, marketplacelistings_id)) { return; } @@ -1649,6 +1711,7 @@ void LLInventoryGallery::computeDifference( uuid_vec_t vcur; getCurrentCategories(vcur); + std::copy(mItemBuildQuery.begin(), mItemBuildQuery.end(), std::back_inserter(vcur)); LLCommonUtils::computeDifference(vnew, vcur, vadded, vremoved); } @@ -1793,7 +1856,7 @@ void LLInventoryGallery::onForwardFolder() mBackwardFolders.push_back(mFolderID); mFolderID = mForwardFolders.back(); mForwardFolders.pop_back(); - updateRootFolder(); + dirtyRootFolder(); } } @@ -1804,7 +1867,7 @@ void LLInventoryGallery::onBackwardFolder() mForwardFolders.push_back(mFolderID); mFolderID = mBackwardFolders.back(); mBackwardFolders.pop_back(); - updateRootFolder(); + dirtyRootFolder(); } } @@ -1841,6 +1904,11 @@ BOOL LLInventoryGallery::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, return handled; } +bool LLInventoryGallery::areViewsInitialized() +{ + return mGalleryCreated && mItemBuildQuery.empty(); +} + bool LLInventoryGallery::hasDescendents(const LLUUID& cat_id) { LLInventoryModel::cat_array_t* cats; @@ -1946,7 +2014,7 @@ LLInventoryGalleryItem::LLInventoryGalleryItem(const Params& p) : LLPanel(p), mSelected(false), mDefaultImage(true), - mName(""), + mItemName(""), mWornSuffix(""), mPermSuffix(""), mUUID(LLUUID()), @@ -2062,9 +2130,9 @@ void LLInventoryGalleryItem::draw() gl_rect_2d(border, border_color.get(), FALSE); } -void LLInventoryGalleryItem::setName(std::string name) +void LLInventoryGalleryItem::setItemName(std::string name) { - mName = name; + mItemName = name; updateNameText(); } @@ -2232,9 +2300,9 @@ LLFontGL* LLInventoryGalleryItem::getTextFont() void LLInventoryGalleryItem::updateNameText() { mNameText->setFont(getTextFont()); - mNameText->setText(mName + mPermSuffix + mWornSuffix); - mNameText->setToolTip(mName + mPermSuffix + mWornSuffix); - getChild("preview_thumbnail")->setToolTip(mName + mPermSuffix + mWornSuffix); + mNameText->setText(mItemName + mPermSuffix + mWornSuffix); + mNameText->setToolTip(mItemName + mPermSuffix + mWornSuffix); + getChild("preview_thumbnail")->setToolTip(mItemName + mPermSuffix + mWornSuffix); } //----------------------------- @@ -2244,33 +2312,6 @@ void LLInventoryGalleryItem::updateNameText() void LLThumbnailsObserver::changed(U32 mask) { std::vector deleted_ids; - for (item_map_t::iterator iter = mSkippedItems.begin(); - iter != mSkippedItems.end(); - ++iter) - { - const LLUUID& obj_id = (*iter).first; - LLItemData& data = (*iter).second; - - LLInventoryObject* obj = gInventory.getObject(obj_id); - if (!obj) - { - deleted_ids.push_back(obj_id); - continue; - } - - const LLUUID thumbnail_id = obj->getThumbnailUUID(); - if (data.mThumbnailID != thumbnail_id) - { - data.mThumbnailID = thumbnail_id; - data.mCallback(); - } - } - for (std::vector::iterator deleted_id = deleted_ids.begin(); deleted_id != deleted_ids.end(); ++deleted_id) - { - removeSkippedItem(*deleted_id); - } - deleted_ids.clear(); - for (item_map_t::iterator iter = mItemMap.begin(); iter != mItemMap.end(); ++iter) @@ -2311,25 +2352,11 @@ bool LLThumbnailsObserver::addItem(const LLUUID& obj_id, callback_t cb) return false; } -void LLThumbnailsObserver::addSkippedItem(const LLUUID& obj_id, callback_t cb) -{ - LLInventoryObject* obj = gInventory.getObject(obj_id); - if (obj) - { - mSkippedItems.insert(item_map_value_t(obj_id, LLItemData(obj_id, obj->getThumbnailUUID(), cb))); - } -} - void LLThumbnailsObserver::removeItem(const LLUUID& obj_id) { mItemMap.erase(obj_id); } -void LLThumbnailsObserver::removeSkippedItem(const LLUUID& obj_id) -{ - mSkippedItems.erase(obj_id); -} - //----------------------------- // Helper drag&drop functions //----------------------------- diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h index 6fbd1556e5..cb95f61255 100644 --- a/indra/newview/llinventorygallery.h +++ b/indra/newview/llinventorygallery.h @@ -76,6 +76,7 @@ public: BOOL postBuild() override; void initGallery(); void draw() override; + void onVisibilityChange(BOOL new_visibility) override; BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) override; BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; @@ -91,11 +92,10 @@ public: bool checkAgainstFilterType(const LLUUID& object_id); void getCurrentCategories(uuid_vec_t& vcur); - void updateAddedItem(LLUUID item_id); + bool updateAddedItem(LLUUID item_id); // returns true if added item is visible void updateRemovedItem(LLUUID item_id); void updateChangedItemName(LLUUID item_id, std::string name); void updateItemThumbnail(LLUUID item_id); - void onThumbnailAdded(LLUUID item_id); void updateWornItem(LLUUID item_id, bool is_worn); void updateMessageVisibility(); @@ -103,6 +103,7 @@ public: void setRootFolder(const LLUUID cat_id); void updateRootFolder(); LLUUID getRootFolder() { return mFolderID; } + bool isRootDirty() { return mRootDirty; } boost::signals2::connection setRootChangedCallback(callback_t cb); void onForwardFolder(); void onBackwardFolder(); @@ -133,6 +134,7 @@ public: void setSearchType(LLInventoryFilter::ESearchType type); LLInventoryFilter::ESearchType getSearchType() { return mSearchType; } + bool areViewsInitialized(); bool hasDescendents(const LLUUID& cat_id); bool hasVisibleItems(); void handleModifiedFilter(); @@ -165,9 +167,10 @@ protected: void showContextMenu(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& item_id); - void applyFilter(LLInventoryGalleryItem* item, const std::string& filter_substring); + bool applyFilter(LLInventoryGalleryItem* item, const std::string& filter_substring); bool checkAgainstFilters(LLInventoryGalleryItem* item, const std::string& filter_substring); static void onIdle(void* userdata); + void dirtyRootFolder(); LLInventoryCategoriesObserver* mCategoriesObserver; LLThumbnailsObserver* mThumbnailsObserver; @@ -176,6 +179,7 @@ protected: LLUUID mSelectedItemID; LLUUID mItemToSelect; bool mIsInitialized; + bool mRootDirty; selection_change_signal_t mSelectionChangeSignal; boost::signals2::signal mRootChangedSignal; @@ -185,7 +189,7 @@ protected: private: void addToGallery(LLInventoryGalleryItem* item); - void removeFromGalleryLast(LLInventoryGalleryItem* item); + void removeFromGalleryLast(LLInventoryGalleryItem* item, bool needs_reshape = true); void removeFromGalleryMiddle(LLInventoryGalleryItem* item); LLPanel* addLastRow(); void removeLastRow(); @@ -243,6 +247,7 @@ private: gallery_item_map_t mItemMap; uuid_vec_t mCOFLinkedItems; uuid_vec_t mActiveGestures; + uuid_set_t mItemBuildQuery; std::map mItemIndexMap; std::map mIndexToItemMap; @@ -283,7 +288,7 @@ public: LLFontGL* getTextFont(); - void setName(std::string name); + void setItemName(std::string name); void setSelected(bool value); void setWorn(bool value); void setUUID(LLUUID id) {mUUID = id;} @@ -296,7 +301,7 @@ public: void setCreatorName(std::string name) {mCreatorName = name;} std::string getCreatorName() { return mCreatorName;} - std::string getItemName() {return mName;} + std::string getItemName() {return mItemName;} std::string getItemNameSuffix() {return mPermSuffix + mWornSuffix;} bool isDefaultImage() {return mDefaultImage;} @@ -330,7 +335,7 @@ private: EInventorySortGroup mSortGroup; LLAssetType::EType mType; - std::string mName; + std::string mItemName; std::string mWornSuffix; std::string mPermSuffix; LLInventoryGallery* mGallery; @@ -343,9 +348,7 @@ public: virtual void changed(U32 mask); bool addItem(const LLUUID& obj_id, callback_t cb); - void addSkippedItem(const LLUUID& obj_id, callback_t cb); void removeItem(const LLUUID& obj_id); - void removeSkippedItem(const LLUUID& obj_id); protected: @@ -365,7 +368,6 @@ protected: typedef std::map item_map_t; typedef item_map_t::value_type item_map_value_t; item_map_t mItemMap; - item_map_t mSkippedItems; }; class LLGalleryGestureObserver : public LLGestureManagerObserver diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp index 68ead64839..e30883d564 100644 --- a/indra/newview/llinventorygallerymenu.cpp +++ b/indra/newview/llinventorygallerymenu.cpp @@ -334,7 +334,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men if(!is_link) { items.push_back(std::string("thumbnail")); - if (!is_agent_inventory) + if (!is_agent_inventory || (is_in_trash && !is_trash)) { disabled_items.push_back(std::string("thumbnail")); } diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 4115d9477f..5b6fa89d52 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1121,13 +1121,14 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, { if (new_category.isNull()) { - if (callback) + if (callback && !callback.empty()) { callback(new_category); } return; } + // todo: not needed since AIS does the accounting? LLViewerInventoryCategory* folderp = gInventory.getCategory(new_category); if (!folderp) { @@ -1147,7 +1148,7 @@ void LLInventoryModel::createNewCategory(const LLUUID& parent_id, updateCategory(cat); } - if (callback) + if (callback && !callback.empty()) { callback(new_category); } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index a35a50f4fb..92c9cb0038 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -170,7 +170,8 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : mInventoryViewModel(p.name), mGroupedItemBridge(new LLFolderViewGroupedItemBridge), mFocusSelection(false), - mBuildChildrenViews(true) + mBuildChildrenViews(true), + mRootInited(false) { mInvFVBridgeBuilder = &INVENTORY_BRIDGE_BUILDER; @@ -311,6 +312,7 @@ void LLInventoryPanel::initFolderRoot() // build the views starting with that folder. LLFolderView* folder_view = createFolderRoot(root_id); mFolderRoot = folder_view->getHandle(); + mRootInited = true; addItemID(root_id, mFolderRoot.get()); } @@ -347,22 +349,9 @@ void LLInventoryPanel::initFolderRoot() mCompletionObserver = new LLInvPanelComplObserver(boost::bind(&LLInventoryPanel::onItemsCompletion, this)); mInventory->addObserver(mCompletionObserver); - if (mBuildViewsOnInit && mViewsInitialized == VIEWS_UNINITIALIZED) + if (mBuildViewsOnInit) { - // Build view of inventory if we need default full hierarchy and inventory is ready, otherwise do in onIdle. - // Initializing views takes a while so always do it onIdle if viewer already loaded. - if (mInventory->isInventoryUsable() - && LLStartUp::getStartupState() <= STATE_WEARABLES_WAIT) - { - // Usually this happens on login, so we have less time constraits, but too long and we can cause a disconnect - const F64 max_time = 20.f; - initializeViews(max_time); - } - else - { - mViewsInitialized = VIEWS_INITIALIZING; - gIdleCallbacks.addFunction(onIdle, (void*)this); - } + initializeViewBuilding(); } if (mSortOrderSetting != INHERIT_SORT_ORDER) @@ -407,13 +396,38 @@ void LLInventoryPanel::initFolderRoot() mClipboardState = LLClipboard::instance().getGeneration(); } +void LLInventoryPanel::initializeViewBuilding() +{ + if (mViewsInitialized == VIEWS_UNINITIALIZED) + { + LL_DEBUGS("Inventory") << "Setting views for " << getName() << " to initialize" << LL_ENDL; + // Build view of inventory if we need default full hierarchy and inventory is ready, otherwise do in onIdle. + // Initializing views takes a while so always do it onIdle if viewer already loaded. + if (mInventory->isInventoryUsable() + && LLStartUp::getStartupState() <= STATE_WEARABLES_WAIT) + { + // Usually this happens on login, so we have less time constraits, but too long and we can cause a disconnect + const F64 max_time = 20.f; + initializeViews(max_time); + } + else + { + mViewsInitialized = VIEWS_INITIALIZING; + gIdleCallbacks.addFunction(onIdle, (void*)this); + } + } +} + /*virtual*/ void LLInventoryPanel::onVisibilityChange(BOOL new_visibility) { if (new_visibility && mViewsInitialized == VIEWS_UNINITIALIZED) { - mViewsInitialized = VIEWS_INITIALIZING; - gIdleCallbacks.addFunction(onIdle, (void*)this); + // first call can be from tab initialization + if (gFloaterView->getParentFloater(this) != NULL) + { + initializeViewBuilding(); + } } LLPanel::onVisibilityChange(new_visibility); } @@ -965,6 +979,7 @@ void LLInventoryPanel::idle(void* user_data) void LLInventoryPanel::initializeViews(F64 max_time) { if (!gInventory.isInventoryUsable()) return; + if (!mRootInited) return; mViewsInitialized = VIEWS_BUILDING; @@ -1153,7 +1168,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, if (objectp->getType() >= LLAssetType::AT_COUNT) { // Example: Happens when we add assets of new, not yet supported type to library - LL_DEBUGS() << "LLInventoryPanel::buildViewsTree called with unknown objectp->mType : " + LL_DEBUGS("Inventory") << "LLInventoryPanel::buildViewsTree called with unknown objectp->mType : " << ((S32) objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID() << LL_ENDL; @@ -1252,7 +1267,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, else { create_children = true; - folder_view_item->setChildrenInited(true); + folder_view_item->setChildrenInited(mBuildChildrenViews); } break; } @@ -1293,6 +1308,11 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, LLViewerInventoryItem::item_array_t* items; mInventory->lockDirectDescendentArrays(id, categories, items); + // Make sure panel won't lock in a loop over existing items if + // folder is enormous and at least some work gets done + const S32 MIN_ITEMS_PER_CALL = 500; + const S32 starting_item_count = mItemMap.size(); + LLFolderViewFolder *parentp = dynamic_cast(folder_view_item); if(categories) @@ -1318,6 +1338,22 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, buildViewsTree(cat->getUUID(), id, cat, NULL, parentp, (mode == BUILD_ONE_FOLDER ? BUILD_NO_CHILDREN : mode), depth); } } + + if (!mBuildChildrenViews + && mode == BUILD_TIMELIMIT + && MIN_ITEMS_PER_CALL + starting_item_count < mItemMap.size()) + { + // Single folder view, check if we still have time + // + // Todo: make sure this causes no dupplciates, breaks nothing, + // especially filters and arrange + F64 curent_time = LLTimer::getTotalSeconds(); + if (mBuildViewsEndTime < curent_time) + { + mBuildViewsQueue.push_back(id); + break; + } + } } } @@ -1337,8 +1373,30 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, LLFolderViewItem* view_itemp = getItemByID(item->getUUID()); buildViewsTree(item->getUUID(), id, item, view_itemp, parentp, mode, depth); } + + if (!mBuildChildrenViews + && mode == BUILD_TIMELIMIT + && MIN_ITEMS_PER_CALL + starting_item_count < mItemMap.size()) + { + // Single folder view, check if we still have time + // + // Todo: make sure this causes no dupplciates, breaks nothing, + // especially filters and arrange + F64 curent_time = LLTimer::getTotalSeconds(); + if (mBuildViewsEndTime < curent_time) + { + mBuildViewsQueue.push_back(id); + break; + } + } } } + + if (!mBuildChildrenViews) + { + // flat list is done initializing folder + folder_view_item->setChildrenInited(true); + } mInventory->unlockDirectDescendentArrays(id); } @@ -1597,6 +1655,10 @@ void LLInventoryPanel::onSelectionChange(const std::deque& it { fv->startRenamingSelectedItem(); } + else + { + LL_DEBUGS("Inventory") << "Failed to start renemr, no items selected" << LL_ENDL; + } } std::set selected_items = mFolderRoot.get()->getSelectionList(); @@ -2065,6 +2127,7 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const L LLPanelMainInventory* main_panel = inventory_panel->getMainInventoryPanel(); if(main_panel->isSingleFolderMode() && main_panel->isGalleryViewMode()) { + LL_DEBUGS("Inventory") << "Opening gallery panel for item" << obj_id << LL_ENDL; main_panel->setGallerySelection(obj_id); return; } @@ -2078,6 +2141,7 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const L // const LLInventoryObject *obj = gInventory.getObject(obj_id); // if (obj) // { + // LL_DEBUGS("Inventory") << "Opening main inventory panel for item" << obj_id << LL_ENDL; // main_inventory->setSingleFolderViewRoot(obj->getParentUUID(), false); // main_inventory->setGallerySelection(obj_id); // return; @@ -2108,7 +2172,7 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(BOOL auto_open, const L if (active_panel) { - LL_DEBUGS("Messaging") << "Highlighting" << obj_id << LL_ENDL; + LL_DEBUGS("Messaging", "Inventory") << "Highlighting" << obj_id << LL_ENDL; if (reset_filter) { @@ -2401,12 +2465,11 @@ LLInventorySingleFolderPanel::LLInventorySingleFolderPanel(const Params& params) : LLInventoryPanel(params) { mBuildChildrenViews = false; - mRootInited = false; getFilter().setSingleFolderMode(true); getFilter().setEmptyLookupMessage("InventorySingleFolderNoMatches"); getFilter().setDefaultEmptyLookupMessage("InventorySingleFolderEmpty"); - mCommitCallbackRegistrar.add("Inventory.OpenSelectedFolder", boost::bind(&LLInventorySingleFolderPanel::openInCurrentWindow, this, _2)); + mCommitCallbackRegistrar.replace("Inventory.DoToSelected", boost::bind(&LLInventorySingleFolderPanel::doToSelected, this, _2)); mCommitCallbackRegistrar.replace("Inventory.DoCreate", boost::bind(&LLInventorySingleFolderPanel::doCreate, this, _2)); mCommitCallbackRegistrar.replace("Inventory.Share", boost::bind(&LLInventorySingleFolderPanel::doShare, this)); } @@ -2440,11 +2503,6 @@ void LLInventorySingleFolderPanel::initFolderRoot(const LLUUID& start_folder_id) mFolderRoot.get()->setSingleFolderMode(true); } -void LLInventorySingleFolderPanel::openInCurrentWindow(const LLSD& userdata) -{ - changeFolderRoot(LLFolderBridge::sSelf.get()->getUUID()); -} - void LLInventorySingleFolderPanel::changeFolderRoot(const LLUUID& new_id) { if (mFolderID != new_id) @@ -2575,6 +2633,16 @@ void LLInventorySingleFolderPanel::doCreate(const LLSD& userdata) menu_create_inventory_item(this, dest_id, userdata); } +void LLInventorySingleFolderPanel::doToSelected(const LLSD& userdata) +{ + if (("open_in_current_window" == userdata.asString())) + { + changeFolderRoot(LLFolderBridge::sSelf.get()->getUUID()); + return; + } + LLInventoryPanel::doToSelected(userdata); +} + void LLInventorySingleFolderPanel::doShare() { LLAvatarActions::shareWithAvatars(this); diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index a56d83d36c..31587abc5c 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -285,6 +285,7 @@ public: void changeFolderRoot(const LLUUID& new_id) {}; void initFolderRoot(); + void initializeViewBuilding(); protected: void openStartFolderOrMyInventory(); // open the first level of inventory @@ -322,7 +323,7 @@ protected: */ const LLInventoryFolderViewModelBuilder* mInvFVBridgeBuilder; - bool mBuildChildrenViews; + bool mBuildChildrenViews; // build root and children bool mRootInited; @@ -424,7 +425,6 @@ public: void initFolderRoot(const LLUUID& start_folder_id = LLUUID::null); - void openInCurrentWindow(const LLSD& userdata); void changeFolderRoot(const LLUUID& new_id); void onForwardFolder(); void onBackwardFolder(); @@ -432,6 +432,7 @@ public: LLUUID getSingleFolderRoot() { return mFolderID; } void doCreate(const LLSD& userdata); + void doToSelected(const LLSD& userdata); void doShare(); bool isBackwardAvailable(); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index e88558e01b..045f273523 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -301,7 +301,7 @@ BOOL LLPanelMainInventory::postBuild() } // Now load the stored settings from disk, if available. std::string filterSaveName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME)); - LL_INFOS() << "LLPanelMainInventory::init: reading from " << filterSaveName << LL_ENDL; + LL_INFOS("Inventory") << "LLPanelMainInventory::init: reading from " << filterSaveName << LL_ENDL; llifstream file(filterSaveName.c_str()); LLSD savedFilterState; if (file.is_open()) @@ -576,7 +576,10 @@ LLFloaterSidePanelContainer* LLPanelMainInventory::newWindow() if (!gAgentCamera.cameraMouselook()) { - return LLFloaterReg::showTypedInstance("inventory", LLSD(instance_num)); + LLFloaterSidePanelContainer* floater = LLFloaterReg::showTypedInstance("inventory", LLSD(instance_num)); + LLSidepanelInventory* sidepanel_inventory = floater->findChild("main_panel"); + sidepanel_inventory->initInventoryViews(); + return floater; } return NULL; } @@ -648,8 +651,6 @@ void LLPanelMainInventory::doCreate(const LLSD& userdata) { if(isCombinationViewMode()) { - //show layout and inventory panel before adding the item - //to avoid wrong position of the 'renamer' mForceShowInvLayout = true; } @@ -662,6 +663,13 @@ void LLPanelMainInventory::doCreate(const LLSD& userdata) { // might need to refresh visibility, delay rename panel->mCombInvUUIDNeedsRename = new_id; + + if (panel->isCombinationViewMode()) + { + panel->mForceShowInvLayout = true; + } + + LL_DEBUGS("Inventory") << "Done creating inventory: " << new_id << LL_ENDL; } }; menu_create_inventory_item(NULL, getCurrentSFVRoot(), userdata, LLUUID::null, callback_created); @@ -679,6 +687,7 @@ void LLPanelMainInventory::doCreate(const LLSD& userdata) if (panel) { panel->setGallerySelection(new_id); + LL_DEBUGS("Inventory") << "Done creating inventory: " << new_id << LL_ENDL; } } }; @@ -1982,9 +1991,10 @@ void LLPanelMainInventory::onAddButtonClick() void LLPanelMainInventory::setActivePanel() { + // Todo: should cover gallery mode in some way if(mSingleFolderMode && isListViewMode()) { - mActivePanel = getChild("single_folder_inv"); + mActivePanel = getChild("comb_single_folder_inv"); } else if(mSingleFolderMode && isCombinationViewMode()) { @@ -2002,6 +2012,16 @@ void LLPanelMainInventory::initSingleFolderRoot(const LLUUID& start_folder_id) mCombinationInventoryPanel->initFolderRoot(start_folder_id); } +void LLPanelMainInventory::initInventoryViews() +{ + LLInventoryPanel* all_item = getChild(ALL_ITEMS); + all_item->initializeViewBuilding(); + LLInventoryPanel* recent_item = getChild(RECENT_ITEMS); + recent_item->initializeViewBuilding(); + LLInventoryPanel* worn_item = getChild(WORN_ITEMS); + worn_item->initializeViewBuilding(); +} + void LLPanelMainInventory::toggleViewMode() { if(mSingleFolderMode && isCombinationViewMode()) @@ -3036,6 +3056,7 @@ void LLPanelMainInventory::updatePanelVisibility() // visibility will be controled by updateCombinationVisibility() mCombinationGalleryLayoutPanel->setVisible(true); + mCombinationGalleryPanel->setVisible(true); mCombinationListLayoutPanel->setVisible(true); } else @@ -3049,12 +3070,14 @@ void LLPanelMainInventory::updatePanelVisibility() comb_gallery_filter.markDefault(); mCombinationGalleryLayoutPanel->setVisible(mSingleFolderMode && isGalleryViewMode()); + mCombinationGalleryPanel->setVisible(mSingleFolderMode && isGalleryViewMode()); // to prevent or process updates mCombinationListLayoutPanel->setVisible(mSingleFolderMode && isListViewMode()); } } else { mCombinationGalleryLayoutPanel->setVisible(false); + mCombinationGalleryPanel->setVisible(false); // to prevent updates mCombinationListLayoutPanel->setVisible(false); } } @@ -3081,7 +3104,7 @@ void LLPanelMainInventory::updateCombinationVisibility() if (mReshapeInvLayout && show_inv_pane - && mCombinationGalleryPanel->hasVisibleItems() + && (mCombinationGalleryPanel->hasVisibleItems() || mCombinationGalleryPanel->areViewsInitialized()) && mCombinationInventoryPanel->areViewsInitialized()) { mReshapeInvLayout = false; @@ -3127,14 +3150,17 @@ void LLPanelMainInventory::updateCombinationVisibility() mCombinationListLayoutPanel->setShape(list_latout, true /*tell stack to account for new shape*/); } } + } - if (mCombInvUUIDNeedsRename.notNull() && mCombinationInventoryPanel->areViewsInitialized()) - { - mCombinationInventoryPanel->setSelectionByID(mCombInvUUIDNeedsRename, TRUE); - mCombinationInventoryPanel->getRootFolder()->scrollToShowSelection(); - mCombinationInventoryPanel->getRootFolder()->setNeedsAutoRename(TRUE); - mCombInvUUIDNeedsRename.setNull(); - } + if (mSingleFolderMode + && !isGalleryViewMode() + && mCombInvUUIDNeedsRename.notNull() + && mCombinationInventoryPanel->areViewsInitialized()) + { + mCombinationInventoryPanel->setSelectionByID(mCombInvUUIDNeedsRename, TRUE); + mCombinationInventoryPanel->getRootFolder()->scrollToShowSelection(); + mCombinationInventoryPanel->getRootFolder()->setNeedsAutoRename(TRUE); + mCombInvUUIDNeedsRename.setNull(); } } diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 609ffc1ece..b1c225a655 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -123,6 +123,7 @@ public: void onViewModeClick(); void toggleViewMode(); void initSingleFolderRoot(const LLUUID& start_folder_id = LLUUID::null); + void initInventoryViews(); void onUpFolderClicked(); void onBackFolderClicked(); void onForwardFolderClicked(); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 4cfa6f2f85..0cfdf67ed5 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -97,10 +97,15 @@ namespace //========================================================================= void LLSettingsVOBase::createNewInventoryItem(LLSettingsType::type_e stype, const LLUUID& parent_id, std::function created_cb) { - inventory_result_fn cb = [created_cb](LLUUID asset_id, LLUUID inventory_id, LLUUID object_id, LLSD results) + inventory_result_fn cb = NULL; + + if (created_cb != NULL) { - created_cb(inventory_id); - }; + cb = [created_cb](LLUUID asset_id, LLUUID inventory_id, LLUUID object_id, LLSD results) + { + created_cb(inventory_id); + }; + } createNewInventoryItem(stype, parent_id, cb); } diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 09613374c4..ae0977ec9e 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -252,6 +252,17 @@ BOOL LLSidepanelInventory::postBuild() // Optional hiding of Received Items folder aka Inbox //gSavedSettings.getControl("InventoryDisplayInbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayInboxChanged)); + LLFloater *floater = dynamic_cast(getParent()); + if (floater && floater->getKey().isUndefined() && !sLoginCompleted) + { + // Prefill inventory for primary inventory floater + // Other floaters should fill on visibility change + // + // see get_instance_num(); + // Primary inventory floater will have undefined key + initInventoryViews(); + } + return TRUE; } @@ -489,6 +500,11 @@ void LLSidepanelInventory::showInventoryPanel() mInventoryPanel->setVisible(TRUE); } +void LLSidepanelInventory::initInventoryViews() +{ + mPanelMainInventory->initInventoryViews(); +} + bool LLSidepanelInventory::canShare() { LLInventoryPanel* inbox = mInventoryPanelInbox.get(); diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index 2766f721f9..8122c1018b 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -67,6 +67,7 @@ public: std::set getInboxSelectionList(); void showInventoryPanel(); + void initInventoryViews(); // checks can share selected item(s) bool canShare(); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index b197c1c4d6..801f3b6a3a 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -2204,7 +2204,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLUUID dest_id, const L if (panel) { LLHandle handle = panel->getHandle(); - std::function callback_cat_created = [handle](const LLUUID& new_category_id) + callback_cat_created = [handle](const LLUUID& new_category_id) { gInventory.notifyObservers(); LLInventoryPanel* panel = static_cast(handle.get()); @@ -2212,6 +2212,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLUUID dest_id, const L { panel->setSelectionByID(new_category_id, TRUE); } + LL_DEBUGS(LOG_INV) << "Done creating inventory: " << new_category_id << LL_ENDL; }; } else if (created_cb != NULL) diff --git a/indra/newview/skins/ansastorm/xui/en/panel_main_inventory.xml b/indra/newview/skins/ansastorm/xui/en/panel_main_inventory.xml index ae76c49e05..b3ace8139b 100644 --- a/indra/newview/skins/ansastorm/xui/en/panel_main_inventory.xml +++ b/indra/newview/skins/ansastorm/xui/en/panel_main_inventory.xml @@ -808,6 +808,7 @@ name="All Items" sort_order_setting="InventorySortOrder" show_item_link_overlays="true" + preinitialize_views="false" top="16" width="288" scroll.reserve_scroll_corner="false"> @@ -825,6 +826,7 @@ left_delta="0" name="Recent Items" show_item_link_overlays="true" + preinitialize_views="false" width="288" scroll.reserve_scroll_corner="false"> @@ -840,6 +842,7 @@ left_delta="0" name="Worn Items" show_item_link_overlays="true" + preinitialize_views="false" width="288" scroll.reserve_scroll_corner="false"> diff --git a/indra/newview/skins/default/xui/de/menu_gallery_inventory.xml b/indra/newview/skins/default/xui/de/menu_gallery_inventory.xml index cf675da5fb..6f0da3e2bf 100644 --- a/indra/newview/skins/default/xui/de/menu_gallery_inventory.xml +++ b/indra/newview/skins/default/xui/de/menu_gallery_inventory.xml @@ -3,8 +3,6 @@ - - @@ -37,7 +35,6 @@ - diff --git a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml index 15466e8f32..46afa3821b 100644 --- a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml @@ -23,22 +23,6 @@ - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index 6a9fe99465..a0df13a0dd 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -684,7 +684,8 @@ layout="topleft" name="open_in_current_window"> + function="Inventory.DoToSelected" + parameter="open_in_current_window" /> @@ -251,6 +252,7 @@ left_delta="0" name="Recent Items" show_item_link_overlays="true" + preinitialize_views="false" width="290" > @@ -265,6 +267,7 @@ left_delta="0" name="Worn Items" show_item_link_overlays="true" + preinitialize_views="false" width="290" >