diff options
author | Vadim Savchuk <vsavchuk@productengine.com> | 2010-04-06 17:17:33 +0300 |
---|---|---|
committer | Vadim Savchuk <vsavchuk@productengine.com> | 2010-04-06 17:17:33 +0300 |
commit | 4a997e96271b6e01b90061bf0479601f68217153 (patch) | |
tree | c91c49927aa5f904d25957cffc09dc4106c357fd /indra/newview/llinventorypanel.cpp | |
parent | b658e4115d137713ab55bf73f517a528deffb534 (diff) | |
parent | 8ccffa6a1e0de0629e13934515158b26d303f18f (diff) |
Merge from default branch
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llinventorypanel.cpp')
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 109 |
1 files changed, 55 insertions, 54 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 83c2d62ee8..c6c2d23a4b 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -80,7 +80,7 @@ protected: LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : LLPanel(p), mInventoryObserver(NULL), - mFolders(NULL), + mFolderRoot(NULL), mScroller(NULL), mSortOrderSetting(p.sort_order_setting), mInventory(p.inventory), @@ -124,13 +124,13 @@ BOOL LLInventoryPanel::postBuild() p.rect = folder_rect; p.parent_panel = this; p.tool_tip = p.name; - mFolders = LLUICtrlFactory::create<LLFolderView>(p); - mFolders->setAllowMultiSelect(mAllowMultiSelect); + mFolderRoot = LLUICtrlFactory::create<LLFolderView>(p); + mFolderRoot->setAllowMultiSelect(mAllowMultiSelect); } mCommitCallbackRegistrar.popScope(); - mFolders->setCallbackRegistrar(&mCommitCallbackRegistrar); + mFolderRoot->setCallbackRegistrar(&mCommitCallbackRegistrar); // Scroller { @@ -144,9 +144,9 @@ BOOL LLInventoryPanel::postBuild() p.tab_stop(true); mScroller = LLUICtrlFactory::create<LLScrollContainer>(p); addChild(mScroller); - mScroller->addChild(mFolders); - mFolders->setScrollContainer(mScroller); - mFolders->addChild(mFolders->mStatusTextBox); + mScroller->addChild(mFolderRoot); + mFolderRoot->setScrollContainer(mScroller); + mFolderRoot->addChild(mFolderRoot->mStatusTextBox); } // Set up the callbacks from the inventory we're viewing, and then build everything. @@ -169,16 +169,16 @@ BOOL LLInventoryPanel::postBuild() { setSortOrder(gSavedSettings.getU32(DEFAULT_SORT_ORDER)); } - mFolders->setSortOrder(getFilter()->getSortOrder()); + mFolderRoot->setSortOrder(getFilter()->getSortOrder()); return TRUE; } LLInventoryPanel::~LLInventoryPanel() { - if (mFolders) + if (mFolderRoot) { - U32 sort_order = mFolders->getSortOrder(); + U32 sort_order = mFolderRoot->getSortOrder(); if (mSortOrderSetting != INHERIT_SORT_ORDER) { gSavedSettings.setU32(mSortOrderSetting, sort_order); @@ -194,15 +194,15 @@ LLInventoryPanel::~LLInventoryPanel() void LLInventoryPanel::draw() { // Select the desired item (in case it wasn't loaded when the selection was requested) - mFolders->updateSelection(); + mFolderRoot->updateSelection(); LLPanel::draw(); } LLInventoryFilter* LLInventoryPanel::getFilter() { - if (mFolders) + if (mFolderRoot) { - return mFolders->getFilter(); + return mFolderRoot->getFilter(); } return NULL; } @@ -230,9 +230,9 @@ void LLInventoryPanel::setSortOrder(U32 order) getFilter()->setSortOrder(order); if (getFilter()->isModified()) { - mFolders->setSortOrder(order); + mFolderRoot->setSortOrder(order); // try to keep selection onscreen, even if it wasn't to start with - mFolders->scrollToShowSelection(); + mFolderRoot->scrollToShowSelection(); } } @@ -277,8 +277,8 @@ void LLInventoryPanel::modelChanged(U32 mask) { const LLUUID& item_id = (*items_iter); const LLInventoryObject* model_item = model->getObject(item_id); - LLFolderViewItem* view_item = mFolders->getItemByID(item_id); - LLFolderViewFolder* view_folder = mFolders->getFolderByID(item_id); + LLFolderViewItem* view_item = mFolderRoot->getItemByID(item_id); + LLFolderViewFolder* view_folder = mFolderRoot->getFolderByID(item_id); ////////////////////////////// // LABEL Operation @@ -353,7 +353,7 @@ void LLInventoryPanel::modelChanged(U32 mask) // Add the UI element for this item. buildNewViews(item_id); // Select any newly created object that has the auto rename at top of folder root set. - if(mFolders->getRoot()->needsAutoRename()) + if(mFolderRoot->getRoot()->needsAutoRename()) { setSelection(item_id, FALSE); } @@ -368,7 +368,7 @@ void LLInventoryPanel::modelChanged(U32 mask) // model_item's parent will be NULL. if (view_item->getRoot() != view_item->getParent()) { - LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolders->getItemByID(model_item->getParentUUID()); + LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolderRoot->getItemByID(model_item->getParentUUID()); // Item has been moved. if (view_item->getParentFolder() != new_parent) { @@ -376,7 +376,7 @@ void LLInventoryPanel::modelChanged(U32 mask) { // Item is to be moved and we found its new parent in the panel's directory, so move the item's UI. view_item->getParentFolder()->extractItem(view_item); - view_item->addToFolder(new_parent, mFolders); + view_item->addToFolder(new_parent, mFolderRoot); } else { @@ -444,14 +444,14 @@ void LLInventoryPanel::initializeViews() if (gAgent.isFirstLogin()) { // Auto open the user's library - LLFolderViewFolder* lib_folder = mFolders->getFolderByID(gInventory.getLibraryRootFolderID()); + LLFolderViewFolder* lib_folder = mFolderRoot->getFolderByID(gInventory.getLibraryRootFolderID()); if (lib_folder) { lib_folder->setOpen(TRUE); } // Auto close the user's my inventory folder - LLFolderViewFolder* my_inv_folder = mFolders->getFolderByID(gInventory.getRootFolderID()); + LLFolderViewFolder* my_inv_folder = mFolderRoot->getFolderByID(gInventory.getRootFolderID()); if (my_inv_folder) { my_inv_folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); @@ -462,7 +462,7 @@ void LLInventoryPanel::initializeViews() void LLInventoryPanel::rebuildViewsFor(const LLUUID& id) { // Destroy the old view for this ID so we can rebuild it. - LLFolderViewItem* old_view = mFolders->getItemByID(id); + LLFolderViewItem* old_view = mFolderRoot->getItemByID(id); if (old_view && id.notNull()) { old_view->destroyView(); @@ -479,10 +479,10 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) if (objectp) { const LLUUID &parent_id = objectp->getParentUUID(); - LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)mFolders->getItemByID(parent_id); + LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)mFolderRoot->getItemByID(parent_id); if (id == mStartFolderID) { - parent_folder = mFolders; + parent_folder = mFolderRoot; } else if ((mStartFolderID != LLUUID::null) && (!gInventory.isObjectDescendentOf(id, mStartFolderID))) { @@ -506,19 +506,19 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) objectp->getType(), LLInventoryType::IT_CATEGORY, this, + mFolderRoot, objectp->getUUID()); - if (new_listener) { LLFolderViewFolder::Params params; params.name = new_listener->getDisplayName(); params.icon = new_listener->getIcon(); params.icon_open = new_listener->getOpenIcon(); - params.root = mFolders; + params.root = mFolderRoot; params.listener = new_listener; params.tool_tip = params.name; LLFolderViewFolder* folderp = LLUICtrlFactory::create<LLFolderViewFolder>(params); - folderp->setItemSortOrder(mFolders->getSortOrder()); + folderp->setItemSortOrder(mFolderRoot->getSortOrder()); itemp = folderp; // Hide the root folder, so we can show the contents of a folder flat @@ -542,6 +542,7 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) item->getActualType(), item->getInventoryType(), this, + mFolderRoot, item->getUUID(), item->getFlags()); @@ -552,7 +553,7 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) params.icon = new_listener->getIcon(); params.icon_open = new_listener->getOpenIcon(); params.creation_date = new_listener->getCreationDate(); - params.root = mFolders; + params.root = mFolderRoot; params.listener = new_listener; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; @@ -562,7 +563,7 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) if (itemp) { - itemp->addToFolder(parent_folder, mFolders); + itemp->addToFolder(parent_folder, mFolderRoot); // Don't add children of hidden folders unless this is the panel's root folder. if (itemp->getHidden() && (id != mStartFolderID)) @@ -611,19 +612,19 @@ void LLInventoryPanel::openStartFolderOrMyInventory() { if (mStartFolderString != "") { - mFolders->openFolder(mStartFolderString); + mFolderRoot->openFolder(mStartFolderString); } else { // Find My Inventory folder and open it up by name - for (LLView *child = mFolders->getFirstChild(); child; child = mFolders->findNextSibling(child)) + for (LLView *child = mFolderRoot->getFirstChild(); child; child = mFolderRoot->findNextSibling(child)) { LLFolderViewFolder *fchild = dynamic_cast<LLFolderViewFolder*>(child); if (fchild && fchild->getListener() && (fchild->getListener()->getUUID() == gInventory.getRootFolderID())) { const std::string& child_name = child->getName(); - mFolders->openFolder(child_name); + mFolderRoot->openFolder(child_name); break; } } @@ -632,7 +633,7 @@ void LLInventoryPanel::openStartFolderOrMyInventory() void LLInventoryPanel::openSelected() { - LLFolderViewItem* folder_item = mFolders->getCurSelectedItem(); + LLFolderViewItem* folder_item = mFolderRoot->getCurSelectedItem(); if(!folder_item) return; LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getListener(); if(!bridge) return; @@ -668,14 +669,14 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // If folder view is empty the (x, y) point won't be in its rect // so the handler must be called explicitly. - if (!mFolders->hasVisibleChildren()) + if (!mFolderRoot->hasVisibleChildren()) { - handled = mFolders->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + handled = mFolderRoot->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); } if (handled) { - mFolders->setDragAndDropThisFrame(); + mFolderRoot->setDragAndDropThisFrame(); } return handled; @@ -686,20 +687,20 @@ void LLInventoryPanel::onMouseEnter(S32 x, S32 y, MASK mask) { LLPanel::onMouseEnter(x, y, mask); // don't auto-scroll a list when cursor is over Inventory. See EXT-3981. - mFolders->setEnableScroll(false); + mFolderRoot->setEnableScroll(false); } // virtual void LLInventoryPanel::onMouseLeave(S32 x, S32 y, MASK mask) { LLPanel::onMouseLeave(x, y, mask); - mFolders->setEnableScroll(true); + mFolderRoot->setEnableScroll(true); } void LLInventoryPanel::onFocusLost() { // inventory no longer handles cut/copy/paste/delete - if (LLEditMenuHandler::gEditMenuHandler == mFolders) + if (LLEditMenuHandler::gEditMenuHandler == mFolderRoot) { LLEditMenuHandler::gEditMenuHandler = NULL; } @@ -710,15 +711,15 @@ void LLInventoryPanel::onFocusLost() void LLInventoryPanel::onFocusReceived() { // inventory now handles cut/copy/paste/delete - LLEditMenuHandler::gEditMenuHandler = mFolders; + LLEditMenuHandler::gEditMenuHandler = mFolderRoot; LLPanel::onFocusReceived(); } void LLInventoryPanel::openAllFolders() { - mFolders->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN); - mFolders->arrangeAll(); + mFolderRoot->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN); + mFolderRoot->arrangeAll(); } void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus) @@ -729,20 +730,20 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc { return; } - mFolders->setSelectionByID(obj_id, take_keyboard_focus); + mFolderRoot->setSelectionByID(obj_id, take_keyboard_focus); } void LLInventoryPanel::setSelectCallback(const LLFolderView::signal_t::slot_type& cb) { - if (mFolders) + if (mFolderRoot) { - mFolders->setSelectCallback(cb); + mFolderRoot->setSelectCallback(cb); } } void LLInventoryPanel::clearSelection() { - mFolders->clearSelection(); + mFolderRoot->clearSelection(); } void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& items, BOOL user_action) @@ -761,18 +762,18 @@ void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& it void LLInventoryPanel::doToSelected(const LLSD& userdata) { - mFolders->doToSelected(&gInventory, userdata); + mFolderRoot->doToSelected(&gInventory, userdata); } void LLInventoryPanel::doCreate(const LLSD& userdata) { - menu_create_inventory_item(mFolders, LLFolderBridge::sSelf, userdata); + menu_create_inventory_item(mFolderRoot, LLFolderBridge::sSelf, userdata); } bool LLInventoryPanel::beginIMSession() { std::set<LLUUID> selected_items; - mFolders->getSelectionList(selected_items); + mFolderRoot->getSelectionList(selected_items); std::string name; static int session_num = 1; @@ -785,7 +786,7 @@ bool LLInventoryPanel::beginIMSession() { LLUUID item = *iter; - LLFolderViewItem* folder_item = mFolders->getItemByID(item); + LLFolderViewItem* folder_item = mFolderRoot->getItemByID(item); if(folder_item) { @@ -827,7 +828,7 @@ bool LLInventoryPanel::beginIMSession() } else { - LLFolderViewItem* folder_item = mFolders->getItemByID(item); + LLFolderViewItem* folder_item = mFolderRoot->getItemByID(item); if(!folder_item) return true; LLInvFVBridge* listenerp = (LLInvFVBridge*)folder_item->getListener(); @@ -870,7 +871,7 @@ bool LLInventoryPanel::beginIMSession() bool LLInventoryPanel::attachObject(const LLSD& userdata) { std::set<LLUUID> selected_items; - mFolders->getSelectionList(selected_items); + mFolderRoot->getSelectionList(selected_items); std::string joint_name = userdata.asString(); LLViewerJointAttachment* attachmentp = NULL; @@ -927,7 +928,7 @@ BOOL LLInventoryPanel::getSinceLogoff() void LLInventoryPanel::dumpSelectionInformation(void* user_data) { LLInventoryPanel* iv = (LLInventoryPanel*)user_data; - iv->mFolders->dumpSelectionInformation(); + iv->mFolderRoot->dumpSelectionInformation(); } BOOL is_inventorysp_active() |