diff options
Diffstat (limited to 'indra/newview/llinventorygallery.cpp')
-rw-r--r-- | indra/newview/llinventorygallery.cpp | 506 |
1 files changed, 277 insertions, 229 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 329c0d751a..b99dbd9eb7 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -61,18 +61,18 @@ const S32 GALLERY_ITEMS_PER_ROW_MIN = 2; const S32 FAST_LOAD_THUMBNAIL_TRSHOLD = 50; // load folders below this value immediately // Helper dnd functions -BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, BOOL drop, std::string& tooltip_msg, BOOL is_link); -BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg, BOOL user_confirm); +bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, bool drop, std::string& tooltip_msg, bool is_link); +bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, std::string& tooltip_msg, bool user_confirm); void dropToMyOutfits(LLInventoryCategory* inv_cat); class LLGalleryPanel: public LLPanel { public: - BOOL canFocusChildren() const override + bool canFocusChildren() const override { // Tell Tab to not focus children - return FALSE; + return false; } protected: @@ -144,7 +144,7 @@ const LLInventoryGallery::Params& LLInventoryGallery::getDefaultParams() return LLUICtrlFactory::getDefaultParams<LLInventoryGallery>(); } -BOOL LLInventoryGallery::postBuild() +bool LLInventoryGallery::postBuild() { mScrollPanel = getChild<LLScrollContainer>("gallery_scroll_panel"); LLPanel::Params params = LLPanel::getDefaultParams(); @@ -153,7 +153,7 @@ BOOL LLInventoryGallery::postBuild() mInventoryGalleryMenu = new LLInventoryGalleryContextMenu(this); mRootGalleryMenu = new LLInventoryGalleryContextMenu(this); mRootGalleryMenu->setRootFolder(true); - return TRUE; + return true; } LLInventoryGallery::~LLInventoryGallery() @@ -187,7 +187,7 @@ LLInventoryGallery::~LLInventoryGallery() mHiddenItems.pop_back(); panelp->die(); } - + if (gInventory.containsObserver(mCategoriesObserver)) { @@ -200,7 +200,7 @@ LLInventoryGallery::~LLInventoryGallery() gInventory.removeObserver(mThumbnailsObserver); } delete mThumbnailsObserver; - + LLGestureMgr::instance().removeObserver(mGestureObserver); delete mGestureObserver; } @@ -221,9 +221,10 @@ void LLInventoryGallery::setRootFolder(const LLUUID cat_id) for (const LLUUID& id : mSelectedItemIDs) { - if (mItemMap[id]) + LLInventoryGalleryItem* item = getItem(id); + if (item) { - mItemMap[id]->setSelected(FALSE); + item->setSelected(false); } } @@ -257,13 +258,13 @@ void LLInventoryGallery::updateRootFolder() { updateRemovedItem(mItems[i]->getUUID()); } - S32 hidden_count = mHiddenItems.size(); + S32 hidden_count = static_cast<S32>(mHiddenItems.size()); for (S32 i = hidden_count - 1; i >= 0; i--) { updateRemovedItem(mHiddenItems[i]->getUUID()); } mItemBuildQuery.clear(); - + if (gInventory.containsObserver(mCategoriesObserver)) { gInventory.removeObserver(mCategoriesObserver); @@ -284,7 +285,7 @@ void LLInventoryGallery::updateRootFolder() mRootChangedSignal(); gInventory.addObserver(mCategoriesObserver); - + // Start observing changes in selected category. mCategoriesObserver->addCategory(mFolderID, boost::bind(&LLInventoryGallery::refreshList, this, mFolderID)); @@ -294,7 +295,7 @@ void LLInventoryGallery::updateRootFolder() // the observer will refresh the list as soon as the new items // arrive. category->fetch(); - + //refreshList(cat_id); LLInventoryModel::cat_array_t* cat_array; LLInventoryModel::item_array_t* item_array; @@ -308,7 +309,7 @@ void LLInventoryGallery::updateRootFolder() { mItemBuildQuery.insert((*iter)->getUUID()); } - + for (LLInventoryModel::item_array_t::const_iterator iter = item_array->begin(); iter != item_array->end(); iter++) @@ -343,12 +344,12 @@ void LLInventoryGallery::initGallery() { uuid_vec_t cats; getCurrentCategories(cats); - int n = cats.size(); + int n = static_cast<int>(cats.size()); buildGalleryPanel(n); mScrollPanel->addChild(mGalleryPanel); for (int i = 0; i < n; i++) { - addToGallery(mItemMap[cats[i]]); + addToGallery(getItem(cats[i])); } reArrangeRows(); mGalleryCreated = true; @@ -367,7 +368,7 @@ void LLInventoryGallery::draw() } } -void LLInventoryGallery::onVisibilityChange(BOOL new_visibility) +void LLInventoryGallery::onVisibilityChange(bool new_visibility) { if (new_visibility) { @@ -448,7 +449,7 @@ void LLInventoryGallery::reArrangeRows(S32 row_diff) buf_items.push_back(*it); } mHiddenItems.clear(); - + mItemsInRow+= row_diff; updateGalleryWidth(); @@ -458,7 +459,7 @@ void LLInventoryGallery::reArrangeRows(S32 row_diff) { return compareGalleryItem(item1, item2, sort_by_date, sort_folders_by_name); }); - + for (std::vector<LLInventoryGalleryItem*>::const_iterator it = buf_items.begin(); it != buf_items.end(); ++it) { (*it)->setHidden(false); @@ -619,8 +620,8 @@ void LLInventoryGallery::removeFromGalleryMiddle(LLInventoryGalleryItem* item) removeFromGalleryLast(mItems[i]); } removeFromGalleryLast(mItems[n]); - int saved_count = saved.size(); - for (int i = 0; i < saved_count; i++) + size_t saved_count = saved.size(); + for (size_t i = 0; i < saved_count; i++) { addToGallery(saved.back()); saved.pop_back(); @@ -656,6 +657,16 @@ LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, L return gitem; } +LLInventoryGalleryItem* LLInventoryGallery::getItem(const LLUUID& id) const +{ + auto it = mItemMap.find(id); + if (it != mItemMap.end()) + { + return it->second; + } + return nullptr; +} + void LLInventoryGallery::buildGalleryPanel(int row_count) { LLPanel::Params params; @@ -735,7 +746,7 @@ void LLInventoryGallery::setFilterSubString(const std::string& string) { mFilterSubString = string; mFilter->setFilterSubString(string); - + //reArrangeRows(); } @@ -763,7 +774,7 @@ bool LLInventoryGallery::checkAgainstFilters(LLInventoryGalleryItem* item, const { return false; } - + bool hidden = false; if(mFilter->getFilterCreatorType() == LLInventoryFilter::FILTERCREATOR_SELF) @@ -806,7 +817,7 @@ bool LLInventoryGallery::checkAgainstFilters(LLInventoryGalleryItem* item, const desc = item->getItemName() + item->getItemNameSuffix(); break; } - + LLStringUtil::toUpper(desc); std::string cur_filter = filter_substring; @@ -1006,21 +1017,22 @@ void LLInventoryGallery::updateItemThumbnail(LLUUID item_id) thumbnail_id = getOutfitImageID(item_id); } - if (mItemMap[item_id]) + LLInventoryGalleryItem* item = getItem(item_id); + if (item) { - mItemMap[item_id]->setLoadImmediately(mLoadThumbnailsImmediately); - mItemMap[item_id]->setThumbnail(thumbnail_id); + item->setLoadImmediately(mLoadThumbnailsImmediately); + item->setThumbnail(thumbnail_id); - bool passes_filter = checkAgainstFilters(mItemMap[item_id], mFilterSubString); - if((mItemMap[item_id]->isHidden() && passes_filter) - || (!mItemMap[item_id]->isHidden() && !passes_filter)) + bool passes_filter = checkAgainstFilters(item, mFilterSubString); + if((item->isHidden() && passes_filter) + || (!item->isHidden() && !passes_filter)) { reArrangeRows(); } } } -BOOL LLInventoryGallery::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLInventoryGallery::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (mSelectedItemIDs.size() > 0) { @@ -1029,7 +1041,7 @@ BOOL LLInventoryGallery::handleRightMouseDown(S32 x, S32 y, MASK mask) mLastInteractedUUID = LLUUID::null; // Scroll is going to always return true - BOOL res = LLPanel::handleRightMouseDown(x, y, mask); + bool res = LLPanel::handleRightMouseDown(x, y, mask); if (mLastInteractedUUID.isNull()) // no child were hit { @@ -1039,16 +1051,16 @@ BOOL LLInventoryGallery::handleRightMouseDown(S32 x, S32 y, MASK mask) uuid_vec_t selected_uuids; selected_uuids.push_back(mFolderID); mRootGalleryMenu->show(this, selected_uuids, x, y); - return TRUE; + return true; } } return res; } -BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) +bool LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { - BOOL handled = FALSE; + bool handled = false; switch (key) { case KEY_RETURN: @@ -1060,7 +1072,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) if (category) { setRootFolder(*iter); - handled = TRUE; + handled = true; } else { @@ -1071,7 +1083,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) } } } - handled = TRUE; + handled = true; break; case KEY_DELETE: #if LL_DARWIN @@ -1083,7 +1095,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { deleteSelection(); } - handled = TRUE; + handled = true; break; case KEY_F2: @@ -1092,7 +1104,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mInventoryGalleryMenu->rename(mSelectedItemIDs.front()); } - handled = TRUE; + handled = true; break; case KEY_PAGE_UP: @@ -1101,7 +1113,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->pageUp(30); } - handled = TRUE; + handled = true; break; case KEY_PAGE_DOWN: @@ -1110,7 +1122,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->pageDown(30); } - handled = TRUE; + handled = true; break; case KEY_HOME: @@ -1119,7 +1131,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->goToTop(); } - handled = TRUE; + handled = true; break; case KEY_END: @@ -1128,27 +1140,27 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->goToBottom(); } - handled = TRUE; + handled = true; break; case KEY_LEFT: moveLeft(mask); - handled = TRUE; + handled = true; break; case KEY_RIGHT: moveRight(mask); - handled = TRUE; + handled = true; break; case KEY_UP: moveUp(mask); - handled = TRUE; + handled = true; break; case KEY_DOWN: moveDown(mask); - handled = TRUE; + handled = true; break; default: @@ -1169,7 +1181,7 @@ void LLInventoryGallery::moveUp(MASK mask) if (mInventoryGalleryMenu && mSelectedItemIDs.size() > 0 && mItemsAddedCount > 1) { - LLInventoryGalleryItem* item = mItemMap[mLastInteractedUUID]; + LLInventoryGalleryItem* item = getItem(mLastInteractedUUID); if (item) { if (mask == MASK_NONE || mask == MASK_CONTROL) @@ -1188,7 +1200,7 @@ void LLInventoryGallery::moveUp(MASK mask) { changeItemSelection(item_id, true); } - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1200,7 +1212,7 @@ void LLInventoryGallery::moveUp(MASK mask) { item = mIndexToItemMap[target]; toggleSelectionRangeFromLast(item->getUUID()); - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1214,7 +1226,7 @@ void LLInventoryGallery::moveDown(MASK mask) if (mInventoryGalleryMenu && mSelectedItemIDs.size() > 0 && mItemsAddedCount > 1) { - LLInventoryGalleryItem* item = mItemMap[mLastInteractedUUID]; + LLInventoryGalleryItem* item = getItem(mLastInteractedUUID); if (item) { if (mask == MASK_NONE || mask == MASK_CONTROL) @@ -1233,7 +1245,7 @@ void LLInventoryGallery::moveDown(MASK mask) { changeItemSelection(item_id, true); } - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1245,7 +1257,7 @@ void LLInventoryGallery::moveDown(MASK mask) { item = mIndexToItemMap[target]; toggleSelectionRangeFromLast(item->getUUID()); - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1259,11 +1271,7 @@ void LLInventoryGallery::moveLeft(MASK mask) if (mInventoryGalleryMenu && mSelectedItemIDs.size() > 0 && mItemsAddedCount > 1) { - LLInventoryGalleryItem* item = mItemMap[mLastInteractedUUID]; - if (mask == MASK_SHIFT) - { - item = mItemMap[mLastInteractedUUID]; - } + LLInventoryGalleryItem* item = getItem(mLastInteractedUUID); if (item) { // Might be better to get item from panel @@ -1295,7 +1303,7 @@ void LLInventoryGallery::moveLeft(MASK mask) { changeItemSelection(item_id, true); } - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1307,7 +1315,7 @@ void LLInventoryGallery::moveRight(MASK mask) if (mInventoryGalleryMenu && mSelectedItemIDs.size() > 0 && mItemsAddedCount > 1) { - LLInventoryGalleryItem* item = mItemMap[mLastInteractedUUID]; + LLInventoryGalleryItem* item = getItem(mLastInteractedUUID); if (item) { S32 n = mItemIndexMap[item]; @@ -1338,7 +1346,7 @@ void LLInventoryGallery::moveRight(MASK mask) { changeItemSelection(item_id, true); } - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1373,8 +1381,8 @@ void LLInventoryGallery::toggleSelectionRangeFromLast(const LLUUID target) { return; } - LLInventoryGalleryItem* last_item = mItemMap[mLastInteractedUUID]; - LLInventoryGalleryItem* next_item = mItemMap[target]; + LLInventoryGalleryItem* last_item = getItem(mLastInteractedUUID); + LLInventoryGalleryItem* next_item = getItem(target); if (last_item && next_item) { S32 last_idx = mItemIndexMap[last_item]; @@ -1417,9 +1425,10 @@ void LLInventoryGallery::onFocusLost() for (const LLUUID& id : mSelectedItemIDs) { - if (mItemMap[id]) + LLInventoryGalleryItem* item = getItem(id); + if (item) { - mItemMap[id]->setSelected(false); + item->setSelected(false); } } } @@ -1435,15 +1444,16 @@ void LLInventoryGallery::onFocusReceived() LLInventoryGalleryItem* focus_item = NULL; for (const LLUUID& id : mSelectedItemIDs) { - if (mItemMap[id] && !mItemMap[id]->isHidden()) + LLInventoryGalleryItem* item = getItem(id); + if (item && !item->isHidden()) { - focus_item = mItemMap[id]; + focus_item = item; focus_item->setSelected(true); } } if (focus_item) { - focus_item->setFocus(TRUE); + focus_item->setFocus(true); } } else if (mIndexToItemMap.size() > 0 && mItemsToSelect.empty()) @@ -1455,7 +1465,7 @@ void LLInventoryGallery::onFocusReceived() LLInventoryGalleryItem* focus_item = mIndexToItemMap[n]; changeItemSelection(focus_item->getUUID(), true); - focus_item->setFocus(TRUE); + focus_item->setFocus(true); } LLPanel::onFocusReceived(); @@ -1478,9 +1488,10 @@ void LLInventoryGallery::changeItemSelection(const LLUUID& item_id, bool scroll_ { for (const LLUUID& id : mSelectedItemIDs) { - if (mItemMap[id]) + LLInventoryGalleryItem* item = getItem(id); + if (item) { - mItemMap[id]->setSelected(FALSE); + item->setSelected(false); } } mSelectedItemIDs.clear(); @@ -1499,9 +1510,10 @@ void LLInventoryGallery::changeItemSelection(const LLUUID& item_id, bool scroll_ return; } - if (mItemMap[item_id]) + LLInventoryGalleryItem* item = getItem(item_id); + if (item) { - mItemMap[item_id]->setSelected(TRUE); + item->setSelected(true); } mSelectedItemIDs.push_back(item_id); signalSelectionItemID(item_id); @@ -1527,9 +1539,10 @@ void LLInventoryGallery::addItemSelection(const LLUUID& item_id, bool scroll_to_ return; } - if (mItemMap[item_id]) + LLInventoryGalleryItem* item = getItem(item_id); + if (item) { - mItemMap[item_id]->setSelected(TRUE); + item->setSelected(true); } mSelectedItemIDs.push_back(item_id); signalSelectionItemID(item_id); @@ -1552,18 +1565,20 @@ bool LLInventoryGallery::toggleItemSelection(const LLUUID& item_id, bool scroll_ selection_deque::iterator found = std::find(mSelectedItemIDs.begin(), mSelectedItemIDs.end(), item_id); if (found != mSelectedItemIDs.end()) { - if (mItemMap[item_id]) + LLInventoryGalleryItem* item = getItem(item_id); + if (item) { - mItemMap[item_id]->setSelected(FALSE); + item->setSelected(false); } mSelectedItemIDs.erase(found); result = false; } else { - if (mItemMap[item_id]) + LLInventoryGalleryItem* item = getItem(item_id); + if (item) { - mItemMap[item_id]->setSelected(TRUE); + item->setSelected(true); } mSelectedItemIDs.push_back(item_id); signalSelectionItemID(item_id); @@ -1580,7 +1595,7 @@ bool LLInventoryGallery::toggleItemSelection(const LLUUID& item_id, bool scroll_ void LLInventoryGallery::scrollToShowItem(const LLUUID& item_id) { - LLInventoryGalleryItem* item = mItemMap[item_id]; + LLInventoryGalleryItem* item = getItem(item_id); if(item) { const LLRect visible_content_rect = mScrollPanel->getVisibleContentRect(); @@ -1610,7 +1625,7 @@ LLInventoryGalleryItem* LLInventoryGallery::getFirstSelectedItem() if (mSelectedItemIDs.size() > 0) { selection_deque::iterator iter = mSelectedItemIDs.begin(); - return mItemMap[*iter]; + return getItem(*iter); } return NULL; } @@ -1631,22 +1646,22 @@ void LLInventoryGallery::copy() mFilterSubString.clear(); } -BOOL LLInventoryGallery::canCopy() const +bool LLInventoryGallery::canCopy() const { if (!getVisible() || !getEnabled() || mSelectedItemIDs.empty()) { - return FALSE; + return false; } for (const LLUUID& id : mSelectedItemIDs) { if (!isItemCopyable(id)) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLInventoryGallery::cut() @@ -1707,11 +1722,11 @@ bool is_category_removable(const LLUUID& folder_id, bool check_worn) return true; } -BOOL LLInventoryGallery::canCut() const +bool LLInventoryGallery::canCut() const { if (!getVisible() || !getEnabled() || mSelectedItemIDs.empty()) { - return FALSE; + return false; } for (const LLUUID& id : mSelectedItemIDs) @@ -1721,16 +1736,16 @@ BOOL LLInventoryGallery::canCut() const { if (!get_is_category_and_children_removable(&gInventory, id, true)) { - return FALSE; + return false; } } else if (!get_is_item_removable(&gInventory, id, true)) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLInventoryGallery::paste() @@ -1768,9 +1783,10 @@ void LLInventoryGallery::paste() { for (const LLUUID& id : mSelectedItemIDs) { - if (mItemMap[id]) + LLInventoryGalleryItem* item = getItem(id); + if (item) { - mItemMap[id]->setSelected(FALSE); + item->setSelected(false); } } mSelectedItemIDs.clear(); @@ -1867,35 +1883,32 @@ void LLInventoryGallery::paste(const LLUUID& dest, LLClipboard::instance().setCutMode(false); } -BOOL LLInventoryGallery::canPaste() const +bool LLInventoryGallery::canPaste() const { - // Return FALSE on degenerated cases: empty clipboard, no inventory, no agent + // Return false on degenerated cases: empty clipboard, no inventory, no agent if (!LLClipboard::instance().hasContents()) { - return FALSE; + return false; } // In cut mode, whatever is on the clipboard is always pastable if (LLClipboard::instance().isCutMode()) { - return TRUE; + return true; } // In normal mode, we need to check each element of the clipboard to know if we can paste or not - std::vector<LLUUID> objects; + uuid_vec_t objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.size(); - for (S32 i = 0; i < count; i++) + for (const auto& item_id : objects) { - const LLUUID& item_id = objects.at(i); - // Each item must be copyable to be pastable if (!isItemCopyable(item_id)) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLInventoryGallery::onDelete(const LLSD& notification, const LLSD& response, const selection_deque selected_ids) @@ -1918,7 +1931,7 @@ void LLInventoryGallery::onDelete(const LLSD& notification, const LLSD& response LLInventoryModel::cat_array_t categories; LLInventoryModel::item_array_t items; - gInventory.collectDescendents(obj_id, categories, items, FALSE); + gInventory.collectDescendents(obj_id, categories, items, false); for (LLInventoryModel::item_array_t::value_type& item : items) { @@ -1984,7 +1997,7 @@ void LLInventoryGallery::deleteSelection() LLInventoryModel::cat_array_t categories; LLInventoryModel::item_array_t items; - gInventory.collectDescendents(id, categories, items, FALSE); + gInventory.collectDescendents(id, categories, items, false); for (LLInventoryModel::item_array_t::value_type& item : items) { @@ -2012,7 +2025,7 @@ void LLInventoryGallery::deleteSelection() if (item && get_is_item_worn(item)) { has_worn = true; - LLWearableType::EType type = item->getWearableType(); + LLWearableType::EType type = item->getWearableType(); if (type == LLWearableType::WT_SHAPE || type == LLWearableType::WT_SKIN || type == LLWearableType::WT_HAIR @@ -2111,9 +2124,10 @@ void LLInventoryGallery::pasteAsLink() { for (const LLUUID& id : mSelectedItemIDs) { - if (mItemMap[id]) + LLInventoryGalleryItem* item = getItem(id); + if (item) { - mItemMap[id]->setSelected(FALSE); + item->setSelected(false); } } mSelectedItemIDs.clear(); @@ -2130,9 +2144,9 @@ void LLInventoryGallery::pasteAsLink(const LLUUID& dest, const LLUUID& marketplacelistings_id, const LLUUID& my_outifts_id) { - const BOOL move_is_into_current_outfit = (dest == current_outfit_id); - const BOOL move_is_into_my_outfits = (dest == my_outifts_id) || gInventory.isObjectDescendentOf(dest, my_outifts_id); - const BOOL move_is_into_marketplacelistings = gInventory.isObjectDescendentOf(dest, marketplacelistings_id); + const bool move_is_into_current_outfit = (dest == current_outfit_id); + const bool move_is_into_my_outfits = (dest == my_outifts_id) || gInventory.isObjectDescendentOf(dest, my_outifts_id); + const bool move_is_into_marketplacelistings = gInventory.isObjectDescendentOf(dest, marketplacelistings_id); if (move_is_into_marketplacelistings || move_is_into_current_outfit || move_is_into_my_outfits) { @@ -2168,6 +2182,39 @@ void LLInventoryGallery::pasteAsLink(const LLUUID& dest, } } +void LLInventoryGallery::doCreate(const LLUUID& dest, const LLSD& userdata) +{ + + LLViewerInventoryCategory* cat = gInventory.getCategory(dest); + if (cat && mFolderID != dest) + { + menu_create_inventory_item(NULL, dest, userdata, LLUUID::null); + } + else + { + // todo: needs to reset current floater's filter, + // like reset_inventory_filter() + + LLHandle<LLPanel> handle = getHandle(); + std::function<void(const LLUUID&)> callback_cat_created = + [handle](const LLUUID& new_id) + { + gInventory.notifyObservers(); + LLInventoryGallery* panel = static_cast<LLInventoryGallery*>(handle.get()); + if (panel && new_id.notNull()) + { + panel->clearSelection(); + if (panel->mItemMap.count(new_id) != 0) + { + panel->addItemSelection(new_id, true); + } + } + }; + + menu_create_inventory_item(NULL, mFolderID, userdata, LLUUID::null, callback_cat_created); + } +} + void LLInventoryGallery::claimEditHandler() { gEditMenuHandler = this; @@ -2355,7 +2402,7 @@ void LLInventoryGallery::onCOFChanged() LLCommonUtils::computeDifference(vnew, mCOFLinkedItems, vadded, vremoved); mCOFLinkedItems = vnew; - + for (uuid_vec_t::const_iterator iter = vadded.begin(); iter != vadded.end(); ++iter) @@ -2386,7 +2433,7 @@ void LLInventoryGallery::onGesturesChanged() LLCommonUtils::computeDifference(vnew, mActiveGestures, vadded, vremoved); mActiveGestures = vnew; - + for (uuid_vec_t::const_iterator iter = vadded.begin(); iter != vadded.end(); ++iter) @@ -2403,10 +2450,10 @@ void LLInventoryGallery::onGesturesChanged() void LLInventoryGallery::deselectItem(const LLUUID& category_id) { // Reset selection if the item is selected. - LLInventoryGalleryItem* item = mItemMap[category_id]; + LLInventoryGalleryItem* item = getItem(category_id); if (item && item->isSelected()) { - mItemMap[category_id]->setSelected(FALSE); + item->setSelected(false); setFocus(true); // Todo: support multiselect // signalSelectionItemID(LLUUID::null); @@ -2423,9 +2470,10 @@ void LLInventoryGallery::clearSelection() { for (const LLUUID& id: mSelectedItemIDs) { - if (mItemMap[id]) + LLInventoryGalleryItem* item = getItem(id); + if (item) { - mItemMap[id]->setSelected(FALSE); + item->setSelected(false); } } if (!mSelectedItemIDs.empty()) @@ -2527,12 +2575,12 @@ bool LLInventoryGallery::isForwardAvailable() return (!mForwardFolders.empty() && (mFolderID != mForwardFolders.back())); } -BOOL LLInventoryGallery::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLInventoryGallery::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { // have children handle it first - BOOL handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, + bool handled = LLView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); // when drop is not handled by child, it should be handled by the root folder . @@ -2564,7 +2612,7 @@ void LLInventoryGallery::startDrag() ids.push_back(selected_id); } - const LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id); + const LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id); if (cat) { if (gInventory.isObjectDescendentOf(selected_id, gInventory.getLibraryRootFolderID())) @@ -2642,7 +2690,7 @@ bool LLInventoryGallery::checkAgainstFilterType(const LLUUID& object_id) break; } } - + if (filterTypes & LLInventoryFilter::FILTERTYPE_DATE) { const U16 HOURS_TO_SECONDS = 3600; @@ -2727,13 +2775,13 @@ LLInventoryGalleryItem::~LLInventoryGalleryItem() { } -BOOL LLInventoryGalleryItem::postBuild() +bool LLInventoryGalleryItem::postBuild() { mNameText = getChild<LLTextBox>("item_name"); mTextBgPanel = getChild<LLPanel>("text_bg_panel"); mThumbnailCtrl = getChild<LLThumbnailCtrl>("preview_thumbnail"); - return TRUE; + return true; } void LLInventoryGalleryItem::setType(LLAssetType::EType type, LLInventoryType::EType inventory_type, U32 flags, bool is_link) @@ -2837,7 +2885,7 @@ void LLInventoryGalleryItem::draw() LLRect border = mThumbnailCtrl->getRect(); border.mRight = border.mRight + 1; border.mTop = border.mTop + 1; - gl_rect_2d(border, border_color.get(), FALSE); + gl_rect_2d(border, border_color.get(), false); } } @@ -2862,7 +2910,7 @@ void LLInventoryGalleryItem::setSelected(bool value) } } -BOOL LLInventoryGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask) +bool LLInventoryGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask) { // call changeItemSelection directly, before setFocus // to avoid autoscroll from LLInventoryGallery::onFocusReceived() @@ -2878,7 +2926,7 @@ BOOL LLInventoryGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask) { mGallery->changeItemSelection(mUUID, false); } - setFocus(TRUE); + setFocus(true); mGallery->claimEditHandler(); gFocusMgr.setMouseCapture(this); @@ -2886,10 +2934,10 @@ BOOL LLInventoryGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask) S32 screen_y; localPointToScreen(x, y, &screen_x, &screen_y ); LLToolDragAndDrop::getInstance()->setDragStart(screen_x, screen_y); - return TRUE; + return true; } -BOOL LLInventoryGalleryItem::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLInventoryGalleryItem::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (!isSelected()) { @@ -2900,25 +2948,25 @@ BOOL LLInventoryGalleryItem::handleRightMouseDown(S32 x, S32 y, MASK mask) // refresh last interacted mGallery->addItemSelection(mUUID, false); } - setFocus(TRUE); + setFocus(true); mGallery->claimEditHandler(); mGallery->showContextMenu(this, x, y, mUUID); LLUICtrl::handleRightMouseDown(x, y, mask); - return TRUE; + return true; } -BOOL LLInventoryGalleryItem::handleMouseUp(S32 x, S32 y, MASK mask) +bool LLInventoryGalleryItem::handleMouseUp(S32 x, S32 y, MASK mask) { if(hasMouseCapture()) { gFocusMgr.setMouseCapture(NULL); - return TRUE; + return true; } return LLPanel::handleMouseUp(x, y, mask); } -BOOL LLInventoryGalleryItem::handleHover(S32 x, S32 y, MASK mask) +bool LLInventoryGalleryItem::handleHover(S32 x, S32 y, MASK mask) { if(hasMouseCapture()) { @@ -2935,7 +2983,7 @@ BOOL LLInventoryGalleryItem::handleHover(S32 x, S32 y, MASK mask) return LLUICtrl::handleHover(x,y,mask); } -BOOL LLInventoryGalleryItem::handleDoubleClick(S32 x, S32 y, MASK mask) +bool LLInventoryGalleryItem::handleDoubleClick(S32 x, S32 y, MASK mask) { if (mIsFolder && mGallery) { @@ -2958,10 +3006,10 @@ BOOL LLInventoryGalleryItem::handleDoubleClick(S32 x, S32 y, MASK mask) LLInvFVBridgeAction::doAction(mUUID, &gInventory); } - return TRUE; + return true; } -BOOL LLInventoryGalleryItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLInventoryGalleryItem::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -2969,19 +3017,19 @@ BOOL LLInventoryGalleryItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL dro { if (!mIsFolder) { - return FALSE; + return false; } return mGallery->baseHandleDragAndDrop(mUUID, drop, cargo_type, cargo_data, accept, tooltip_msg); } -BOOL LLInventoryGalleryItem::handleKeyHere(KEY key, MASK mask) +bool LLInventoryGalleryItem::handleKeyHere(KEY key, MASK mask) { if (!mGallery) { - return FALSE; + return false; } - BOOL handled = FALSE; + bool handled = false; switch (key) { case KEY_LEFT: @@ -3085,7 +3133,7 @@ void LLThumbnailsObserver::changed(U32 mask) { const LLUUID& obj_id = (*iter).first; LLItemData& data = (*iter).second; - + LLInventoryObject* obj = gInventory.getObject(obj_id); if (!obj) { @@ -3128,7 +3176,7 @@ void LLThumbnailsObserver::removeItem(const LLUUID& obj_id) // Helper drag&drop functions //----------------------------- -BOOL LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, BOOL drop, +bool LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, @@ -3141,7 +3189,7 @@ BOOL LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, BOOL drop, clearSelection(); } - BOOL accepted = FALSE; + bool accepted = false; switch(cargo_type) { case DAD_TEXTURE: @@ -3173,12 +3221,12 @@ BOOL LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, BOOL drop, LLInventoryCategory* linked_category = gInventory.getCategory(inv_item->getLinkedUUID()); if (linked_category) { - accepted = dragCategoryIntoFolder(dest_id, (LLInventoryCategory*)linked_category, drop, tooltip_msg, TRUE); + accepted = dragCategoryIntoFolder(dest_id, (LLInventoryCategory*)linked_category, drop, tooltip_msg, true); } } else { - accepted = dragItemIntoFolder(dest_id, inv_item, drop, tooltip_msg, TRUE); + accepted = dragItemIntoFolder(dest_id, inv_item, drop, tooltip_msg, true); } if (accepted && drop && inv_item) { @@ -3188,12 +3236,12 @@ BOOL LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, BOOL drop, case DAD_CATEGORY: if (LLFriendCardsManager::instance().isAnyFriendCategory(dest_id)) { - accepted = FALSE; + accepted = false; } else { LLInventoryCategory* cat_ptr = (LLInventoryCategory*)cargo_data; - accepted = dragCategoryIntoFolder(dest_id, cat_ptr, drop, tooltip_msg, FALSE); + accepted = dragCategoryIntoFolder(dest_id, cat_ptr, drop, tooltip_msg, false); if (accepted && drop) { mItemsToSelect.push_back(cat_ptr->getUUID()); @@ -3219,23 +3267,23 @@ BOOL LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, BOOL drop, } // copy of LLFolderBridge::dragItemIntoFolder -BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg, BOOL user_confirm) +bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, std::string& tooltip_msg, bool user_confirm) { LLViewerInventoryCategory * cat = gInventory.getCategory(folder_id); if (!cat) { - return FALSE; + return false; } LLInventoryModel* model = &gInventory; - if (!model || !inv_item) return FALSE; + if (!model || !inv_item) return false; // cannot drag into library if((gInventory.getRootFolderID() != folder_id) && !model->isObjectDescendentOf(folder_id, gInventory.getRootFolderID())) { - return FALSE; + return false; } - if (!isAgentAvatarValid()) return FALSE; + if (!isAgentAvatarValid()) return false; const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE); @@ -3243,29 +3291,29 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - const BOOL move_is_into_current_outfit = (folder_id == current_outfit_id); - const BOOL move_is_into_favorites = (folder_id == favorites_id); - const BOOL move_is_into_my_outfits = (folder_id == my_outifts_id) || model->isObjectDescendentOf(folder_id, my_outifts_id); - const BOOL move_is_into_outfit = move_is_into_my_outfits || (cat && cat->getPreferredType()==LLFolderType::FT_OUTFIT); - const BOOL move_is_into_landmarks = (folder_id == landmarks_id) || model->isObjectDescendentOf(folder_id, landmarks_id); - const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(folder_id, marketplacelistings_id); - const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(inv_item->getUUID(), marketplacelistings_id); + const bool move_is_into_current_outfit = (folder_id == current_outfit_id); + const bool move_is_into_favorites = (folder_id == favorites_id); + const bool move_is_into_my_outfits = (folder_id == my_outifts_id) || model->isObjectDescendentOf(folder_id, my_outifts_id); + const bool move_is_into_outfit = move_is_into_my_outfits || (cat && cat->getPreferredType()==LLFolderType::FT_OUTFIT); + const bool move_is_into_landmarks = (folder_id == landmarks_id) || model->isObjectDescendentOf(folder_id, landmarks_id); + const bool move_is_into_marketplacelistings = model->isObjectDescendentOf(folder_id, marketplacelistings_id); + const bool move_is_from_marketplacelistings = model->isObjectDescendentOf(inv_item->getUUID(), marketplacelistings_id); LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); - BOOL accept = FALSE; + bool accept = false; LLViewerObject* object = NULL; if(LLToolDragAndDrop::SOURCE_AGENT == source) { const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - const BOOL move_is_into_trash = (folder_id == trash_id) || model->isObjectDescendentOf(folder_id, trash_id); - const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID()); + const bool move_is_into_trash = (folder_id == trash_id) || model->isObjectDescendentOf(folder_id, trash_id); + const bool move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID()); //-------------------------------------------------------------------------------- // Determine if item can be moved. // - BOOL is_movable = TRUE; + bool is_movable = true; switch (inv_item->getActualType()) { @@ -3278,7 +3326,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, // Can't explicitly drag things out of the COF. if (move_is_outof_current_outfit) { - is_movable = FALSE; + is_movable = false; } if (move_is_into_trash) { @@ -3296,20 +3344,20 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, // //-------------------------------------------------------------------------------- - + //-------------------------------------------------------------------------------- // Determine if item can be moved & dropped // Note: if user_confirm is false, we already went through those accept logic test and can skip them - accept = TRUE; + accept = true; if (user_confirm && !is_movable) { - accept = FALSE; + accept = false; } else if (user_confirm && (folder_id == inv_item->getParentUUID()) && !move_is_into_favorites) { - accept = FALSE; + accept = false; } else if (user_confirm && (move_is_into_current_outfit || move_is_into_outfit)) { @@ -3322,8 +3370,8 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, else if (user_confirm && move_is_into_marketplacelistings) { //disable dropping in or out of marketplace for now - return FALSE; - + return false; + /*const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(marketplacelistings_id, folder_id); LLViewerInventoryCategory * dest_folder = cat; accept = can_move_item_to_marketplace(master_folder, dest_folder, inv_item, tooltip_msg, LLToolDragAndDrop::instance().getCargoCount() - LLToolDragAndDrop::instance().getCargoIndex());*/ @@ -3335,8 +3383,9 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, LLViewerInventoryCategory * dest_folder = cat; accept = dest_folder->acceptItem(inv_item); } - - LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); + + LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(false); + if (accept && drop) { @@ -3357,7 +3406,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, if (user_confirm && (move_is_from_marketplacelistings || move_is_into_marketplacelistings)) { //disable dropping in or out of marketplace for now - return FALSE; + return false; } //-------------------------------------------------------------------------------- @@ -3395,7 +3444,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, else if (move_is_into_marketplacelistings) { //move_item_to_marketplacelistings(inv_item, mUUID); - return FALSE; + return false; } // NORMAL or TRASH folder // (move the item, restamp if into trash) @@ -3409,7 +3458,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, gInventory.changeItemParent((LLViewerInventoryItem*)inv_item, folder_id, move_is_into_trash); } - + if (move_is_from_marketplacelistings) { // If we move from an active (listed) listing, checks that it's still valid, if not, unlist @@ -3426,7 +3475,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, } }); }*/ - return FALSE; + return false; } // @@ -3442,7 +3491,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, if (!object) { LL_INFOS() << "Object not found for drop." << LL_ENDL; - return FALSE; + return false; } // coming from a task. Need to figure out if the person can @@ -3453,7 +3502,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, && perm.allowTransferTo(gAgent.getID()))) // || gAgent.isGodlike()) { - accept = TRUE; + accept = true; } else if(object->permYouOwner()) { @@ -3461,26 +3510,26 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, // inventory is owned by the agent, then the item can be // moved from the task to agent inventory. is_move = true; - accept = TRUE; + accept = true; } // Don't allow placing an original item into Current Outfit or an outfit folder // because they must contain only links to wearable items. if (move_is_into_current_outfit || move_is_into_outfit) { - accept = FALSE; + accept = false; } // Don't allow to move a single item to Favorites or Landmarks // if it is not a landmark or a link to a landmark. else if ((move_is_into_favorites || move_is_into_landmarks) && !can_move_to_landmarks(inv_item)) { - accept = FALSE; + accept = false; } else if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } if (accept && drop) @@ -3511,12 +3560,12 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else if ((inv_item->getActualType() == LLAssetType::AT_SETTINGS) && !LLEnvironment::instance().isInventoryEnabled()) { tooltip_msg = LLTrans::getString("NoEnvironmentSettings"); - accept = FALSE; + accept = false; } else { @@ -3538,12 +3587,12 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_item; if(item && item->isFinished()) { - accept = TRUE; + accept = true; if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else if (move_is_into_current_outfit || move_is_into_outfit) { @@ -3605,41 +3654,40 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, } // copy of LLFolderBridge::dragCategoryIntoFolder -BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, - BOOL drop, std::string& tooltip_msg, BOOL is_link) +bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, + bool drop, std::string& tooltip_msg, bool is_link) { - BOOL user_confirm = TRUE; + bool user_confirm = true; LLInventoryModel* model = &gInventory; LLViewerInventoryCategory * dest_cat = gInventory.getCategory(dest_id); if (!dest_cat) { - return FALSE; + return false; } - if (!inv_cat) return FALSE; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL + if (!inv_cat) return false; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL - if (!isAgentAvatarValid()) return FALSE; + if (!isAgentAvatarValid()) return false; // cannot drag into library if((gInventory.getRootFolderID() != dest_id) && !model->isObjectDescendentOf(dest_id, gInventory.getRootFolderID())) { - return FALSE; + return false; } const LLUUID &cat_id = inv_cat->getUUID(); const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); //const LLUUID from_folder_uuid = inv_cat->getParentUUID(); - - const BOOL move_is_into_current_outfit = (dest_id == current_outfit_id); - const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(dest_id, marketplacelistings_id); - const BOOL move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id); + const bool move_is_into_current_outfit = (dest_id == current_outfit_id); + const bool move_is_into_marketplacelistings = model->isObjectDescendentOf(dest_id, marketplacelistings_id); + const bool move_is_from_marketplacelistings = model->isObjectDescendentOf(cat_id, marketplacelistings_id); // check to make sure source is agent inventory, and is represented there. LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); - const BOOL is_agent_inventory = (model->getCategory(cat_id) != NULL) + const bool is_agent_inventory = (model->getCategory(cat_id) != NULL) && (LLToolDragAndDrop::SOURCE_AGENT == source); - BOOL accept = FALSE; + bool accept = false; if (is_agent_inventory) { @@ -3648,22 +3696,22 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, const LLUUID &my_outifts_id = model->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); const LLUUID &lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); - const BOOL move_is_into_trash = (dest_id == trash_id) || model->isObjectDescendentOf(dest_id, trash_id); - const BOOL move_is_into_my_outfits = (dest_id == my_outifts_id) || model->isObjectDescendentOf(dest_id, my_outifts_id); - const BOOL move_is_into_outfit = move_is_into_my_outfits || (dest_cat && dest_cat->getPreferredType()==LLFolderType::FT_OUTFIT); - const BOOL move_is_into_current_outfit = (dest_cat && dest_cat->getPreferredType()==LLFolderType::FT_CURRENT_OUTFIT); - const BOOL move_is_into_landmarks = (dest_id == landmarks_id) || model->isObjectDescendentOf(dest_id, landmarks_id); - const BOOL move_is_into_lost_and_found = model->isObjectDescendentOf(dest_id, lost_and_found_id); + const bool move_is_into_trash = (dest_id == trash_id) || model->isObjectDescendentOf(dest_id, trash_id); + const bool move_is_into_my_outfits = (dest_id == my_outifts_id) || model->isObjectDescendentOf(dest_id, my_outifts_id); + const bool move_is_into_outfit = move_is_into_my_outfits || (dest_cat && dest_cat->getPreferredType()==LLFolderType::FT_OUTFIT); + const bool move_is_into_current_outfit = (dest_cat && dest_cat->getPreferredType()==LLFolderType::FT_CURRENT_OUTFIT); + const bool move_is_into_landmarks = (dest_id == landmarks_id) || model->isObjectDescendentOf(dest_id, landmarks_id); + const bool move_is_into_lost_and_found = model->isObjectDescendentOf(dest_id, lost_and_found_id); //-------------------------------------------------------------------------------- // Determine if folder can be moved. // - BOOL is_movable = TRUE; + bool is_movable = true; if (is_movable && (marketplacelistings_id == cat_id)) { - is_movable = FALSE; + is_movable = false; tooltip_msg = LLTrans::getString("TooltipOutboxCannotMoveRoot"); } if (is_movable && move_is_from_marketplacelistings) @@ -3671,22 +3719,22 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, { // If the incoming folder is listed and active (and is therefore either the listing or the version folder), // then moving is *not* allowed - is_movable = FALSE; + is_movable = false; tooltip_msg = LLTrans::getString("TooltipOutboxDragActive"); } if (is_movable && (dest_id == cat_id)) { - is_movable = FALSE; + is_movable = false; tooltip_msg = LLTrans::getString("TooltipDragOntoSelf"); } if (is_movable && (model->isObjectDescendentOf(dest_id, cat_id))) { - is_movable = FALSE; + is_movable = false; tooltip_msg = LLTrans::getString("TooltipDragOntoOwnChild"); } if (is_movable && LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType())) { - is_movable = FALSE; + is_movable = false; // tooltip? } @@ -3721,36 +3769,36 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, } if(is_movable && move_is_into_current_outfit && is_link) { - is_movable = FALSE; + is_movable = false; } if (is_movable && move_is_into_lost_and_found) { - is_movable = FALSE; + is_movable = false; } if (is_movable && (dest_id == model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE))) { - is_movable = FALSE; + is_movable = false; // tooltip? } if (is_movable && (dest_cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_STOCK)) { // One cannot move a folder into a stock folder - is_movable = FALSE; + is_movable = false; // tooltip? } - + LLInventoryModel::cat_array_t descendent_categories; LLInventoryModel::item_array_t descendent_items; if (is_movable) { - model->collectDescendents(cat_id, descendent_categories, descendent_items, FALSE); + model->collectDescendents(cat_id, descendent_categories, descendent_items, false); for (S32 i=0; i < descendent_categories.size(); ++i) { LLInventoryCategory* category = descendent_categories[i]; if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) { // Can't move "special folders" (e.g. Textures Folder). - is_movable = FALSE; + is_movable = false; break; } } @@ -3771,7 +3819,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, if (items.size() > max_items_to_wear) { // Can't move 'large' folders into current outfit: MAINT-4086 - is_movable = FALSE; + is_movable = false; LLStringUtil::format_map_t args; args["AMOUNT"] = llformat("%d", max_items_to_wear); tooltip_msg = LLTrans::getString("TooltipTooManyWearables",args); @@ -3784,7 +3832,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, LLInventoryItem* item = descendent_items[i]; if (get_is_item_worn(item->getUUID())) { - is_movable = FALSE; + is_movable = false; break; // It's generally movable, but not into the trash. } } @@ -3799,12 +3847,12 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, // We use getType() instead of getActua;Type() to allow links to landmarks and folders. if (LLAssetType::AT_LANDMARK != item->getType() && LLAssetType::AT_CATEGORY != item->getType()) { - is_movable = FALSE; + is_movable = false; break; // It's generally movable, but not into Landmarks. } } } - + if (is_movable && move_is_into_marketplacelistings) { const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(marketplacelistings_id, dest_id); @@ -3824,7 +3872,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, if (user_confirm && (move_is_from_marketplacelistings || move_is_into_marketplacelistings)) { //disable dropping in or out of marketplace for now - return FALSE; + return false; } // Look for any gestures and deactivate them if (move_is_into_trash) @@ -3852,7 +3900,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT)) { // traverse category and add all contents to currently worn. - BOOL append = true; + bool append = true; LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, false, append); } else if (move_is_into_marketplacelistings) @@ -3876,8 +3924,8 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, if (move_is_from_marketplacelistings) { //disable dropping in or out of marketplace for now - return FALSE; - + return false; + // If we are moving a folder at the listing folder level (i.e. its parent is the marketplace listings folder) /*if (from_folder_uuid == marketplacelistings_id) { @@ -3915,7 +3963,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else { @@ -3927,7 +3975,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else { |