diff options
Diffstat (limited to 'indra/newview/llinventorygallery.cpp')
-rw-r--r-- | indra/newview/llinventorygallery.cpp | 353 |
1 files changed, 193 insertions, 160 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index d4ca58f778..aa3d45b7d2 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() @@ -223,7 +223,7 @@ void LLInventoryGallery::setRootFolder(const LLUUID cat_id) { if (mItemMap[id]) { - mItemMap[id]->setSelected(FALSE); + mItemMap[id]->setSelected(false); } } @@ -367,7 +367,7 @@ void LLInventoryGallery::draw() } } -void LLInventoryGallery::onVisibilityChange(BOOL new_visibility) +void LLInventoryGallery::onVisibilityChange(bool new_visibility) { if (new_visibility) { @@ -1020,7 +1020,7 @@ void LLInventoryGallery::updateItemThumbnail(LLUUID item_id) } } -BOOL LLInventoryGallery::handleRightMouseDown(S32 x, S32 y, MASK mask) +bool LLInventoryGallery::handleRightMouseDown(S32 x, S32 y, MASK mask) { if (mSelectedItemIDs.size() > 0) { @@ -1029,7 +1029,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 +1039,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 +1060,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) if (category) { setRootFolder(*iter); - handled = TRUE; + handled = true; } else { @@ -1071,7 +1071,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) } } } - handled = TRUE; + handled = true; break; case KEY_DELETE: #if LL_DARWIN @@ -1083,7 +1083,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { deleteSelection(); } - handled = TRUE; + handled = true; break; case KEY_F2: @@ -1092,7 +1092,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mInventoryGalleryMenu->rename(mSelectedItemIDs.front()); } - handled = TRUE; + handled = true; break; case KEY_PAGE_UP: @@ -1101,7 +1101,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->pageUp(30); } - handled = TRUE; + handled = true; break; case KEY_PAGE_DOWN: @@ -1110,7 +1110,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->pageDown(30); } - handled = TRUE; + handled = true; break; case KEY_HOME: @@ -1119,7 +1119,7 @@ BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask) { mScrollPanel->goToTop(); } - handled = TRUE; + handled = true; break; case KEY_END: @@ -1128,27 +1128,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: @@ -1188,7 +1188,7 @@ void LLInventoryGallery::moveUp(MASK mask) { changeItemSelection(item_id, true); } - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1200,7 +1200,7 @@ void LLInventoryGallery::moveUp(MASK mask) { item = mIndexToItemMap[target]; toggleSelectionRangeFromLast(item->getUUID()); - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1233,7 +1233,7 @@ void LLInventoryGallery::moveDown(MASK mask) { changeItemSelection(item_id, true); } - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1245,7 +1245,7 @@ void LLInventoryGallery::moveDown(MASK mask) { item = mIndexToItemMap[target]; toggleSelectionRangeFromLast(item->getUUID()); - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1295,7 +1295,7 @@ void LLInventoryGallery::moveLeft(MASK mask) { changeItemSelection(item_id, true); } - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1338,7 +1338,7 @@ void LLInventoryGallery::moveRight(MASK mask) { changeItemSelection(item_id, true); } - item->setFocus(TRUE); + item->setFocus(true); claimEditHandler(); } } @@ -1443,7 +1443,7 @@ void LLInventoryGallery::onFocusReceived() } if (focus_item) { - focus_item->setFocus(TRUE); + focus_item->setFocus(true); } } else if (mIndexToItemMap.size() > 0 && mItemsToSelect.empty()) @@ -1455,7 +1455,7 @@ void LLInventoryGallery::onFocusReceived() LLInventoryGalleryItem* focus_item = mIndexToItemMap[n]; changeItemSelection(focus_item->getUUID(), true); - focus_item->setFocus(TRUE); + focus_item->setFocus(true); } LLPanel::onFocusReceived(); @@ -1480,7 +1480,7 @@ void LLInventoryGallery::changeItemSelection(const LLUUID& item_id, bool scroll_ { if (mItemMap[id]) { - mItemMap[id]->setSelected(FALSE); + mItemMap[id]->setSelected(false); } } mSelectedItemIDs.clear(); @@ -1501,7 +1501,7 @@ void LLInventoryGallery::changeItemSelection(const LLUUID& item_id, bool scroll_ if (mItemMap[item_id]) { - mItemMap[item_id]->setSelected(TRUE); + mItemMap[item_id]->setSelected(true); } mSelectedItemIDs.push_back(item_id); signalSelectionItemID(item_id); @@ -1529,7 +1529,7 @@ void LLInventoryGallery::addItemSelection(const LLUUID& item_id, bool scroll_to_ if (mItemMap[item_id]) { - mItemMap[item_id]->setSelected(TRUE); + mItemMap[item_id]->setSelected(true); } mSelectedItemIDs.push_back(item_id); signalSelectionItemID(item_id); @@ -1554,7 +1554,7 @@ bool LLInventoryGallery::toggleItemSelection(const LLUUID& item_id, bool scroll_ { if (mItemMap[item_id]) { - mItemMap[item_id]->setSelected(FALSE); + mItemMap[item_id]->setSelected(false); } mSelectedItemIDs.erase(found); result = false; @@ -1563,7 +1563,7 @@ bool LLInventoryGallery::toggleItemSelection(const LLUUID& item_id, bool scroll_ { if (mItemMap[item_id]) { - mItemMap[item_id]->setSelected(TRUE); + mItemMap[item_id]->setSelected(true); } mSelectedItemIDs.push_back(item_id); signalSelectionItemID(item_id); @@ -1631,22 +1631,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() @@ -1668,11 +1668,11 @@ void LLInventoryGallery::cut() mFilterSubString.clear(); } -BOOL LLInventoryGallery::canCut() const +bool LLInventoryGallery::canCut() const { if (!getVisible() || !getEnabled() || mSelectedItemIDs.empty()) { - return FALSE; + return false; } for (const LLUUID& id : mSelectedItemIDs) @@ -1682,16 +1682,16 @@ BOOL LLInventoryGallery::canCut() const { if (!get_is_category_removable(&gInventory, id)) { - return FALSE; + return false; } } else if (!get_is_item_removable(&gInventory, id)) { - return FALSE; + return false; } } - return TRUE; + return true; } void LLInventoryGallery::paste() @@ -1731,7 +1731,7 @@ void LLInventoryGallery::paste() { if (mItemMap[id]) { - mItemMap[id]->setSelected(FALSE); + mItemMap[id]->setSelected(false); } } mSelectedItemIDs.clear(); @@ -1828,18 +1828,18 @@ 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 @@ -1853,10 +1853,10 @@ BOOL LLInventoryGallery::canPaste() const // 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) @@ -1967,7 +1967,7 @@ void LLInventoryGallery::pasteAsLink() { if (mItemMap[id]) { - mItemMap[id]->setSelected(FALSE); + mItemMap[id]->setSelected(false); } } mSelectedItemIDs.clear(); @@ -1984,9 +1984,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) { @@ -2022,6 +2022,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; @@ -2260,7 +2293,7 @@ void LLInventoryGallery::deselectItem(const LLUUID& category_id) LLInventoryGalleryItem* item = mItemMap[category_id]; if (item && item->isSelected()) { - mItemMap[category_id]->setSelected(FALSE); + mItemMap[category_id]->setSelected(false); setFocus(true); // Todo: support multiselect // signalSelectionItemID(LLUUID::null); @@ -2279,7 +2312,7 @@ void LLInventoryGallery::clearSelection() { if (mItemMap[id]) { - mItemMap[id]->setSelected(FALSE); + mItemMap[id]->setSelected(false); } } if (!mSelectedItemIDs.empty()) @@ -2381,12 +2414,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 . @@ -2576,13 +2609,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) @@ -2686,7 +2719,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); } } @@ -2711,7 +2744,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() @@ -2727,7 +2760,7 @@ BOOL LLInventoryGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask) { mGallery->changeItemSelection(mUUID, false); } - setFocus(TRUE); + setFocus(true); mGallery->claimEditHandler(); gFocusMgr.setMouseCapture(this); @@ -2735,10 +2768,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()) { @@ -2749,25 +2782,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()) { @@ -2784,7 +2817,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) { @@ -2807,10 +2840,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, @@ -2818,19 +2851,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: @@ -2977,7 +3010,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, @@ -2990,7 +3023,7 @@ BOOL LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, BOOL drop, clearSelection(); } - BOOL accepted = FALSE; + bool accepted = false; switch(cargo_type) { case DAD_TEXTURE: @@ -3022,12 +3055,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) { @@ -3037,12 +3070,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()); @@ -3068,23 +3101,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); @@ -3092,29 +3125,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()) { @@ -3127,7 +3160,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) { @@ -3150,15 +3183,15 @@ 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)) { @@ -3171,7 +3204,7 @@ 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; @@ -3185,7 +3218,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, accept = dest_folder->acceptItem(inv_item); } - LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE); + LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(false); if (accept && drop) { @@ -3206,7 +3239,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; } //-------------------------------------------------------------------------------- @@ -3244,7 +3277,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) @@ -3275,7 +3308,7 @@ BOOL dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, BOOL drop, } }); }*/ - return FALSE; + return false; } // @@ -3291,7 +3324,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 @@ -3302,7 +3335,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()) { @@ -3310,26 +3343,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) @@ -3360,12 +3393,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 { @@ -3387,12 +3420,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) { @@ -3454,24 +3487,24 @@ 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(); @@ -3479,16 +3512,16 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, 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) { @@ -3497,22 +3530,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) @@ -3520,22 +3553,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? } @@ -3570,21 +3603,21 @@ 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? } @@ -3592,14 +3625,14 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, 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; } } @@ -3620,7 +3653,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); @@ -3633,7 +3666,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. } } @@ -3648,7 +3681,7 @@ 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. } } @@ -3673,7 +3706,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) @@ -3701,7 +3734,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) @@ -3725,7 +3758,7 @@ 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) @@ -3764,7 +3797,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else { @@ -3776,7 +3809,7 @@ BOOL dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, if (move_is_into_marketplacelistings) { tooltip_msg = LLTrans::getString("TooltipOutboxNotInInventory"); - accept = FALSE; + accept = false; } else { |