void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& items, BOOL user_action) { // Schedule updating the folder view context menu when all selected items become complete (STORM-373). mCompletionObserver->reset(); for (std::deque<LLFolderViewItem*>::const_iterator it = items.begin(); it != items.end(); ++it) { LLUUID id = (*it)->getListener()->getUUID(); LLViewerInventoryItem* inv_item = mInventory->getItem(id); if (inv_item && !inv_item->isFinished()) { mCompletionObserver->watchItem(id); } } LLFolderView* fv = getRootFolder(); if (fv->needsAutoRename()) // auto-selecting a new user-created asset and preparing to rename { fv->setNeedsAutoRename(FALSE); if (items.size()) // new asset is visible and selected { fv->startRenamingSelectedItem(); } } }
void LLSidepanelAppearance::onOpenOutfitButtonClicked() { const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink(); if (!outfit_link) return; if (!outfit_link->getIsLinkType()) return; LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild<LLAccordionCtrlTab>("tab_outfits"); if (tab_outfits) { tab_outfits->changeOpenClose(FALSE); LLInventoryPanel *inventory_panel = tab_outfits->findChild<LLInventoryPanel>("outfitslist_tab"); if (inventory_panel) { LLFolderView* root = inventory_panel->getRootFolder(); LLFolderViewItem *outfit_folder = root->getItemByID(outfit_link->getLinkedUUID()); if (outfit_folder) { outfit_folder->setOpen(!outfit_folder->isOpen()); root->setSelectionFromRoot(outfit_folder,TRUE); root->scrollToShowSelection(); } } } }
LLFolderViewItem* LLLandmarksPanel::selectItemInAccordionTab(LLPlacesInventoryPanel* inventory_list, const std::string& tab_name, const LLUUID& obj_id, BOOL take_keyboard_focus) const { if (!inventory_list) return NULL; LLFolderView* root = inventory_list->getRootFolder(); LLFolderViewItem* item = inventory_list->getItemByID(obj_id); if (!item) return NULL; LLAccordionCtrlTab* tab = getChild<LLAccordionCtrlTab>(tab_name); if (!tab->isExpanded()) { tab->changeOpenClose(false); } root->setSelection(item, FALSE, take_keyboard_focus); LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("landmarks_accordion"); LLRect screen_rc; localRectToScreen(item->getRect(), &screen_rc); accordion->notifyParent(LLSD().with("scrollToShowRect", screen_rc.getValue())); return item; }
bool LLPanelOutfitsInventory::hasItemsSelected() { bool has_items_selected = false; LLFolderView *folder = getActivePanel()->getRootFolder(); if (folder) { std::set<LLUUID> selection_set; folder->getSelectionList(selection_set); has_items_selected = (selection_set.size() > 0); } return has_items_selected; }
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { LLInventoryPanel *panel = mPtr; LLFolderView* folder = panel->getRootFolder(); if(!folder) return true; std::set<LLUUID> selected_items = folder->getSelectionList(); LLUUID id = *selected_items.begin(); std::string joint_name = userdata.asString(); LLViewerJointAttachment* attachmentp = NULL; for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); iter != gAgentAvatarp->mAttachmentPoints.end(); ) { LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLViewerJointAttachment* attachment = curiter->second; if (attachment->getName() == joint_name) { attachmentp = attachment; break; } } if (!attachmentp) { return true; } if (LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getLinkedItem(id)) { if(gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID())) { rez_attachment(item, attachmentp); // don't replace if called from an "Attach To..." menu } else if(item->isFinished()) { // must be in library. copy it to our inventory and put it on. // LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(&rez_attachment_cb, _1, attachmentp)); // [SL:KB] - Patch: Appearance-DnDWear | Checked: 2013-02-04 (Catznip-3.4) LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(&rez_attachment_cb, _1, attachmentp, false)); // [/SL;KB] copy_inventory_item( gAgentID, item->getPermissions().getOwner(), item->getUUID(), LLUUID::null, std::string(), cb); } } gFocusMgr.setKeyboardFocus(NULL); return true; }
// static void LLInventoryView::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data) { LLInventoryPanel* panel = (LLInventoryPanel*)data; LLFolderView* fv = panel->getRootFolder(); if (fv->needsAutoRename()) // auto-selecting a new user-created asset and preparing to rename { fv->setNeedsAutoRename(FALSE); if (items.size()) // new asset is visible and selected { fv->startRenamingSelectedItem(); } } }
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) { LLInventoryPanel *panel = mPtr; LLFolderView* folder = panel->getRootFolder(); if(!folder) return true; std::set<LLUUID> selected_items; folder->getSelectionList(selected_items); LLUUID id = *selected_items.begin(); std::string joint_name = userdata.asString(); LLVOAvatar *avatarp = gAgent.getAvatarObject(); LLViewerJointAttachment* attachmentp = NULL; for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); iter != avatarp->mAttachmentPoints.end(); ) { LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLViewerJointAttachment* attachment = curiter->second; if (attachment->getName() == joint_name) { attachmentp = attachment; break; } } if (attachmentp == NULL) { return true; } LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(id); if(item && gInventory.isObjectDescendentOf(id, gAgent.getInventoryRootID())) { rez_attachment(item, attachmentp); } else if(item && item->isComplete()) { // must be in library. copy it to our inventory and put it on. LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(attachmentp); copy_inventory_item( gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(), LLUUID::null, std::string(), cb); } gFocusMgr.setKeyboardFocus(NULL); return true; }
LLFolderView * LLInventoryPanel::createFolderView(LLInvFVBridge * bridge, bool useLabelSuffix) { LLRect folder_rect(0, 0, getRect().getWidth(), 0); LLFolderView* ret = new LLFolderView( getName(), folder_rect, LLUUID::null, this, bridge); ret->setAllowMultiSelect(mAllowMultiSelect); return ret; }
void LLPanelOutfitEdit::saveListSelection() { if(mWearablesListViewPanel->getVisible()) { std::set<LLUUID> selected_ids = mInventoryItemsPanel->getRootFolder()->getSelectionList(); if(!selected_ids.size()) return; for (std::set<LLUUID>::const_iterator item_id = selected_ids.begin(); item_id != selected_ids.end(); ++item_id) { mWearableItemsList->selectItemByUUID(*item_id, true); } mWearableItemsList->scrollToShowFirstSelectedItem(); } else if(mInventoryItemsPanel->getVisible()) { std::vector<LLUUID> selected_ids; mWearableItemsList->getSelectedUUIDs(selected_ids); if(!selected_ids.size()) return; mInventoryItemsPanel->clearSelection(); LLFolderView* root = mInventoryItemsPanel->getRootFolder(); if(!root) return; for(std::vector<LLUUID>::const_iterator item_id = selected_ids.begin(); item_id != selected_ids.end(); ++item_id) { LLFolderViewItem* item = root->getItemByID(*item_id); if (!item) continue; LLFolderViewFolder* parent = item->getParentFolder(); if(parent) { parent->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); } mInventoryItemsPanel->getRootFolder()->changeSelection(item, TRUE); } mInventoryItemsPanel->getRootFolder()->scrollToShowSelection(); } }
BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) { const std::string command_name = userdata.asString(); if (command_name == "delete") { BOOL can_delete = FALSE; LLFolderView* root = getActivePanel()->getRootFolder(); if (root) { can_delete = TRUE; std::set<LLUUID> selection_set = root->getSelectionList(); if (selection_set.empty()) return FALSE; for (std::set<LLUUID>::iterator iter = selection_set.begin(); iter != selection_set.end(); ++iter) { const LLUUID &item_id = (*iter); LLFolderViewItem *item = root->getItemByID(item_id); const LLFolderViewEventListener *listener = item->getListener(); llassert(listener); if (!listener) return FALSE; can_delete &= listener->isItemRemovable(); can_delete &= !listener->isItemInTrash(); } return can_delete; } return FALSE; } if (command_name == "save_texture") { return isSaveTextureEnabled(userdata); } if (command_name == "find_original") { LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); if (!current_item) return FALSE; const LLUUID& item_id = current_item->getListener()->getUUID(); const LLViewerInventoryItem *item = gInventory.getItem(item_id); if (item && item->getIsLinkType() && !item->getIsBrokenLink()) { return TRUE; } return FALSE; } if (command_name == "find_links") { LLFolderView* root = getActivePanel()->getRootFolder(); std::set<LLUUID> selection_set = root->getSelectionList(); if (selection_set.size() != 1) return FALSE; LLFolderViewItem* current_item = root->getCurSelectedItem(); if (!current_item) return FALSE; const LLUUID& item_id = current_item->getListener()->getUUID(); const LLInventoryObject *obj = gInventory.getObject(item_id); if (obj && !obj->getIsLinkType() && LLAssetType::lookupCanLink(obj->getType())) { return TRUE; } return FALSE; } // This doesn't currently work, since the viewer can't change an assetID an item. if (command_name == "regenerate_link") { LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem(); if (!current_item) return FALSE; const LLUUID& item_id = current_item->getListener()->getUUID(); const LLViewerInventoryItem *item = gInventory.getItem(item_id); if (item && item->getIsBrokenLink()) { return TRUE; } return FALSE; } if (command_name == "share") { LLSidepanelInventory* parent = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); return parent ? parent->canShare() : FALSE; } return TRUE; }
BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata) { const std::string command_name = userdata.asString(); if (command_name == "delete" || command_name == "remove") { BOOL can_delete = FALSE; LLFolderView *folder = getActivePanel()->getRootFolder(); if (folder) { std::set<LLUUID> selection_set; folder->getSelectionList(selection_set); can_delete = (selection_set.size() > 0); for (std::set<LLUUID>::iterator iter = selection_set.begin(); iter != selection_set.end(); ++iter) { const LLUUID &item_id = (*iter); LLFolderViewItem *item = folder->getItemByID(item_id); can_delete &= item->getListener()->isItemRemovable(); } return can_delete; } return FALSE; } if (command_name == "remove_link") { BOOL can_delete = FALSE; LLFolderView *folder = getActivePanel()->getRootFolder(); if (folder) { std::set<LLUUID> selection_set; folder->getSelectionList(selection_set); can_delete = (selection_set.size() > 0); for (std::set<LLUUID>::iterator iter = selection_set.begin(); iter != selection_set.end(); ++iter) { const LLUUID &item_id = (*iter); LLViewerInventoryItem *item = gInventory.getItem(item_id); if (!item || !item->getIsLinkType()) return FALSE; } return can_delete; } return FALSE; } if (command_name == "rename" || command_name == "delete_outfit") { return (getCorrectListenerForAction() != NULL) && hasItemsSelected(); } if (command_name == "wear") { if (isCOFPanelActive()) { return FALSE; } } if (command_name == "make_outfit") { return TRUE; } if (command_name == "edit" || command_name == "add" ) { return (getCorrectListenerForAction() != NULL); } return TRUE; }