diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-04-07 13:37:37 +0100 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-04-07 13:37:37 +0100 |
commit | 4533d1b59b2e8fc534ad3de7a896aaa8514fe653 (patch) | |
tree | 38b4d2398d66a0e18cd8e4dcd47efba0ad5326a1 /indra/newview/llpaneloutfitsinventory.cpp | |
parent | 92f630871386bafc4548eb9beb45063e40b6139c (diff) | |
parent | adce2ecdf8f3a0efcd4907699d286012124ac496 (diff) |
merge from viewer-trunk
Diffstat (limited to 'indra/newview/llpaneloutfitsinventory.cpp')
-rw-r--r-- | indra/newview/llpaneloutfitsinventory.cpp | 540 |
1 files changed, 398 insertions, 142 deletions
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index c6a7bd88a0..7d8b1dea0e 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -2,25 +2,30 @@ * @file llpaneloutfitsinventory.cpp * @brief Outfits inventory panel * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -28,86 +33,74 @@ #include "llpaneloutfitsinventory.h" -#include "llnotificationsutil.h" -#include "lltabcontainer.h" +#include "llagent.h" +#include "llagentwearables.h" +#include "llappearancemgr.h" +#include "llbutton.h" +#include "llfloaterreg.h" +#include "llfloaterworldmap.h" +#include "llfloaterinventory.h" +#include "llfoldervieweventlistener.h" #include "llinventoryfunctions.h" #include "llinventorymodelbackgroundfetch.h" -#include "llagentwearables.h" -#include "llappearancemgr.h" -#include "lloutfitobserver.h" -#include "lloutfitslist.h" -#include "llpanelwearing.h" -#include "llsaveoutfitcombobtn.h" +#include "llinventorypanel.h" +#include "lllandmark.h" +#include "lllineeditor.h" +#include "llmodaldialog.h" +#include "llnotificationsutil.h" #include "llsidepanelappearance.h" #include "llsidetray.h" +#include "lltabcontainer.h" #include "llviewerfoldertype.h" +#include "llviewerjointattachment.h" +#include "llvoavatarself.h" + +// List Commands +#include "lldndbutton.h" +#include "llmenugl.h" +#include "llviewermenu.h" + +#include "llviewercontrol.h" static const std::string OUTFITS_TAB_NAME = "outfitslist_tab"; static const std::string COF_TAB_NAME = "cof_tab"; static LLRegisterPanelClassWrapper<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory"); +bool LLPanelOutfitsInventory::sShowDebugEditor = false; + LLPanelOutfitsInventory::LLPanelOutfitsInventory() : - mMyOutfitsPanel(NULL), - mCurrentOutfitPanel(NULL), mActivePanel(NULL), - mInitialized(false) + mParent(NULL) { - gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitsInventory::onWearablesLoaded, this)); - gAgentWearables.addLoadingStartedCallback(boost::bind(&LLPanelOutfitsInventory::onWearablesLoading, this)); - - LLOutfitObserver& observer = LLOutfitObserver::instance(); - observer.addBOFChangedCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this)); - observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this)); - observer.addOutfitLockChangedCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this)); + mSavedFolderState = new LLSaveFolderState(); + mSavedFolderState->setApply(FALSE); } LLPanelOutfitsInventory::~LLPanelOutfitsInventory() { + delete mSavedFolderState; } // virtual BOOL LLPanelOutfitsInventory::postBuild() { + sShowDebugEditor = gSavedSettings.getBOOL("ShowDebugAppearanceEditor"); initTabPanels(); initListCommandsHandlers(); - // Fetch your outfits folder so that the links are in memory. - // ( This is only necessary if we want to show a warning if a user deletes an item that has a - // a link in an outfit, see "ConfirmItemDeleteHasLinks". ) - const LLUUID &outfits_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTFIT, false); - if (outfits_cat.notNull()) - { - LLInventoryModelBackgroundFetch::instance().start(outfits_cat); - } - - mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this, true)); - return TRUE; } // virtual void LLPanelOutfitsInventory::onOpen(const LLSD& key) { - if (!mInitialized) - { - LLSidepanelAppearance* panel_appearance = getAppearanceSP(); - if (panel_appearance) - { - // *TODO: move these methods to LLPanelOutfitsInventory? - panel_appearance->fetchInventory(); - panel_appearance->refreshCurrentOutfitName(); - } - mInitialized = true; - } - // Make sure we know which tab is selected, update the filter, // and update verbs. onTabChange(); - // *TODO: Auto open the first outfit newly created so new users can see sample outfit contents - /* + // Auto open the first outfit newly created so new users can see sample outfit contents static bool should_open_outfit = true; if (should_open_outfit && gAgent.isFirstLogin()) { @@ -127,27 +120,41 @@ void LLPanelOutfitsInventory::onOpen(const LLSD& key) } } should_open_outfit = false; - */ } void LLPanelOutfitsInventory::updateVerbs() { + if (mParent) + { + mParent->updateVerbs(); + } + if (mListCommands) { + mListCommands->childSetVisible("edit_current_outfit_btn",sShowDebugEditor); updateListCommands(); } } +void LLPanelOutfitsInventory::setParent(LLSidepanelAppearance* parent) +{ + mParent = parent; +} + // virtual void LLPanelOutfitsInventory::onSearchEdit(const std::string& string) { - if (!mActivePanel) return; - mFilterSubString = string; - if (string == "") { mActivePanel->setFilterSubString(LLStringUtil::null); + + // re-open folders that were initially open + mSavedFolderState->setApply(TRUE); + getRootFolder()->applyFunctorRecursively(*mSavedFolderState); + LLOpenFoldersWithSelection opener; + getRootFolder()->applyFunctorRecursively(opener); + getRootFolder()->scrollToShowSelection(); } LLInventoryModelBackgroundFetch::instance().start(); @@ -158,22 +165,48 @@ void LLPanelOutfitsInventory::onSearchEdit(const std::string& string) return; } + // save current folder open state if no filter currently applied + if (getRootFolder()->getFilterSubString().empty()) + { + mSavedFolderState->setApply(FALSE); + getRootFolder()->applyFunctorRecursively(*mSavedFolderState); + } + // set new filter string mActivePanel->setFilterSubString(string); } void LLPanelOutfitsInventory::onWearButtonClick() { - if (mMyOutfitsPanel->hasItemSelected()) + LLFolderViewEventListener* listenerp = getCorrectListenerForAction(); + if (listenerp) { - mMyOutfitsPanel->wearSelectedItems(); + listenerp->performAction(NULL, "replaceoutfit"); } - else +} + +void LLPanelOutfitsInventory::onAdd() +{ + LLFolderViewEventListener* listenerp = getCorrectListenerForAction(); + if (listenerp) + { + listenerp->performAction(NULL, "addtooutfit"); + } +} + +void LLPanelOutfitsInventory::onRemove() +{ + LLFolderViewEventListener* listenerp = getCorrectListenerForAction(); + if (listenerp) { - mMyOutfitsPanel->performAction("replaceoutfit"); + listenerp->performAction(NULL, "removefromoutfit"); } } +void LLPanelOutfitsInventory::onEdit() +{ +} + bool LLPanelOutfitsInventory::onSaveCommit(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -183,13 +216,9 @@ bool LLPanelOutfitsInventory::onSaveCommit(const LLSD& notification, const LLSD& LLStringUtil::trim(outfit_name); if( !outfit_name.empty() ) { - LLUUID outfit_folder = LLAppearanceMgr::getInstance()->makeNewOutfitLinks(outfit_name); - - LLSidepanelAppearance* panel_appearance = getAppearanceSP(); - if (panel_appearance) - { - panel_appearance->showOutfitsInventoryPanel(); - } + LLUUID outfit_folder = gAgentWearables.makeNewOutfitLinks(outfit_name); + LLSD key; + LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key); if (mAppearanceTabs) { @@ -201,6 +230,8 @@ bool LLPanelOutfitsInventory::onSaveCommit(const LLSD& notification, const LLSD& return false; } + + void LLPanelOutfitsInventory::onSave() { std::string outfit_name; @@ -228,10 +259,54 @@ void LLPanelOutfitsInventory::onSave() }*/ } -//static -LLPanelOutfitsInventory* LLPanelOutfitsInventory::findInstance() +void LLPanelOutfitsInventory::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action) { - return dynamic_cast<LLPanelOutfitsInventory*>(LLSideTray::getInstance()->getPanel("panel_outfits_inventory")); + updateVerbs(); + if (getRootFolder()->needsAutoRename() && items.size()) + { + getRootFolder()->startRenamingSelectedItem(); + getRootFolder()->setNeedsAutoRename(FALSE); + } +} + +void LLPanelOutfitsInventory::showEditOutfitPanel() +{ + LLSD key; + key["type"] = "edit_outfit"; + + LLSideTray::getInstance()->showPanel("sidepanel_appearance", key); +} + +LLFolderViewEventListener *LLPanelOutfitsInventory::getCorrectListenerForAction() +{ + LLFolderViewItem* current_item = getRootFolder()->getCurSelectedItem(); + if (!current_item) + return NULL; + + LLFolderViewEventListener* listenerp = current_item->getListener(); + if (getIsCorrectType(listenerp)) + { + return listenerp; + } + return NULL; +} + +bool LLPanelOutfitsInventory::getIsCorrectType(const LLFolderViewEventListener *listenerp) const +{ + if (listenerp->getInventoryType() == LLInventoryType::IT_CATEGORY) + { + LLViewerInventoryCategory *cat = gInventory.getCategory(listenerp->getUUID()); + if (cat && cat->getPreferredType() == LLFolderType::FT_OUTFIT) + { + return true; + } + } + return false; +} + +LLFolderView *LLPanelOutfitsInventory::getRootFolder() +{ + return mActivePanel->getRootFolder(); } ////////////////////////////////////////////////////////////////////////////////// @@ -240,116 +315,297 @@ LLPanelOutfitsInventory* LLPanelOutfitsInventory::findInstance() void LLPanelOutfitsInventory::initListCommandsHandlers() { mListCommands = getChild<LLPanel>("bottom_panel"); + + mListCommands->childSetAction("options_gear_btn", boost::bind(&LLPanelOutfitsInventory::onGearButtonClick, this)); + mListCommands->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this)); + mListCommands->childSetAction("make_outfit_btn", boost::bind(&LLPanelOutfitsInventory::onAddButtonClick, this)); mListCommands->childSetAction("wear_btn", boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this)); - mMyOutfitsPanel->childSetAction("options_gear_btn", boost::bind(&LLPanelOutfitsInventory::showGearMenu, this)); - mMyOutfitsPanel->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this)); - mCurrentOutfitPanel->childSetAction("options_gear_btn", boost::bind(&LLPanelOutfitsInventory::showGearMenu, this)); + + mListCommands->childSetAction("edit_current_outfit_btn", boost::bind(&LLPanelOutfitsInventory::showEditOutfitPanel, this)); + + LLDragAndDropButton* trash_btn = mListCommands->getChild<LLDragAndDropButton>("trash_btn"); + trash_btn->setDragAndDropHandler(boost::bind(&LLPanelOutfitsInventory::handleDragAndDropToTrash, this + , _4 // BOOL drop + , _5 // EDragAndDropType cargo_type + , _7 // EAcceptance* accept + )); + + mCommitCallbackRegistrar.add("panel_outfits_inventory_gear_default.Custom.Action", + boost::bind(&LLPanelOutfitsInventory::onCustomAction, this, _2)); + mEnableCallbackRegistrar.add("panel_outfits_inventory_gear_default.Enable", + boost::bind(&LLPanelOutfitsInventory::isActionEnabled, this, _2)); + mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("panel_outfits_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); } void LLPanelOutfitsInventory::updateListCommands() { bool trash_enabled = isActionEnabled("delete"); - bool wear_enabled = isActionEnabled("wear"); - bool wear_visible = !isCOFPanelActive(); - bool make_outfit_enabled = isActionEnabled("save_outfit"); + bool wear_enabled = isActionEnabled("wear"); + bool make_outfit_enabled = isActionEnabled("make_outfit"); - mMyOutfitsPanel->childSetEnabled("trash_btn", trash_enabled); + mListCommands->childSetEnabled("trash_btn", trash_enabled); mListCommands->childSetEnabled("wear_btn", wear_enabled); - mListCommands->childSetVisible("wear_btn", wear_visible); - mSaveComboBtn->setMenuItemEnabled("save_outfit", make_outfit_enabled); - if (mMyOutfitsPanel->hasItemSelected()) - { - mListCommands->childSetToolTip("wear_btn", getString("wear_items_tooltip")); - } - else - { - mListCommands->childSetToolTip("wear_btn", getString("wear_outfit_tooltip")); - } + mListCommands->childSetVisible("wear_btn", wear_enabled); + mListCommands->childSetEnabled("make_outfit_btn", make_outfit_enabled); } -void LLPanelOutfitsInventory::showGearMenu() +void LLPanelOutfitsInventory::onGearButtonClick() { - if (!mActivePanel) return; + showActionMenu(mMenuGearDefault,"options_gear_btn"); +} - LLView* spawning_view = getChild<LLView>("options_gear_btn"); - mActivePanel->showGearMenu(spawning_view); +void LLPanelOutfitsInventory::onAddButtonClick() +{ + onSave(); } -void LLPanelOutfitsInventory::onTrashButtonClick() +void LLPanelOutfitsInventory::showActionMenu(LLMenuGL* menu, std::string spawning_view_name) { - LLNotificationsUtil::add("DeleteOutfits", LLSD(), LLSD(), boost::bind(&LLPanelOutfitsInventory::onOutfitsRemovalConfirmation, this, _1, _2)); + if (menu) + { + menu->buildDrawLabels(); + menu->updateParent(LLMenuGL::sMenuContainer); + LLView* spawning_view = getChild<LLView> (spawning_view_name); + S32 menu_x, menu_y; + //show menu in co-ordinates of panel + spawning_view->localPointToOtherView(0, spawning_view->getRect().getHeight(), &menu_x, &menu_y, this); + menu_y += menu->getRect().getHeight(); + LLMenuGL::showPopup(this, menu, menu_x, menu_y); + } } -void LLPanelOutfitsInventory::onOutfitsRemovalConfirmation(const LLSD& notification, const LLSD& response) +void LLPanelOutfitsInventory::onTrashButtonClick() { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option != 0) return; // canceled + onClipboardAction("delete"); +} - mMyOutfitsPanel->removeSelected(); +void LLPanelOutfitsInventory::onClipboardAction(const LLSD& userdata) +{ + std::string command_name = userdata.asString(); + getActivePanel()->getRootFolder()->doToSelected(getActivePanel()->getModel(),command_name); updateListCommands(); updateVerbs(); } -bool LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata) +void LLPanelOutfitsInventory::onCustomAction(const LLSD& userdata) { - return mActivePanel && mActivePanel->isActionEnabled(userdata); -} -// List Commands // -////////////////////////////////////////////////////////////////////////////////// + if (!isActionEnabled(userdata)) + return; -////////////////////////////////////////////////////////////////////////////////// -// Tab panels // + const std::string command_name = userdata.asString(); + if (command_name == "new") + { + onSave(); + } + if (command_name == "edit") + { + onEdit(); + } + if (command_name == "wear") + { + onWearButtonClick(); + } + // Note: This option has been removed from the gear menu. + if (command_name == "add") + { + onAdd(); + } + if (command_name == "remove") + { + onRemove(); + } + if (command_name == "rename") + { + onClipboardAction("rename"); + } + if (command_name == "remove_link") + { + onClipboardAction("delete"); + } + if (command_name == "delete") + { + onClipboardAction("delete"); + } + updateListCommands(); + updateVerbs(); +} -void LLPanelOutfitsInventory::initTabPanels() +BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata) { - mCurrentOutfitPanel = getChild<LLPanelWearing>(COF_TAB_NAME); - mCurrentOutfitPanel->setSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this)); - - mMyOutfitsPanel = getChild<LLOutfitsList>(OUTFITS_TAB_NAME); - mMyOutfitsPanel->setSelectionChangeCallback(boost::bind(&LLPanelOutfitsInventory::updateVerbs, this)); + const std::string command_name = userdata.asString(); + if (command_name == "delete" || command_name == "remove") + { + BOOL can_delete = FALSE; + LLFolderView* root = getActivePanel()->getRootFolder(); + if (root) + { + std::set<LLUUID> selection_set; + root->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 = root->getItemByID(item_id); + can_delete &= item->getListener()->isItemRemovable(); + } + return can_delete; + } + return FALSE; + } + if (command_name == "remove_link") + { + BOOL can_delete = FALSE; + LLFolderView* root = getActivePanel()->getRootFolder(); + if (root) + { + std::set<LLUUID> selection_set; + root->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; +} - mAppearanceTabs = getChild<LLTabContainer>("appearance_tabs"); - mAppearanceTabs->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::onTabChange, this)); +bool LLPanelOutfitsInventory::hasItemsSelected() +{ + bool has_items_selected = false; + LLFolderView* root = getActivePanel()->getRootFolder(); + if (root) + { + std::set<LLUUID> selection_set; + root->getSelectionList(selection_set); + has_items_selected = (selection_set.size() > 0); + } + return has_items_selected; } -void LLPanelOutfitsInventory::onTabChange() +bool LLPanelOutfitsInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept) { - mActivePanel = dynamic_cast<LLPanelAppearanceTab*>(mAppearanceTabs->getCurrentPanel()); - if (!mActivePanel) return; + *accept = ACCEPT_NO; - mActivePanel->setFilterSubString(mFilterSubString); - mActivePanel->onOpen(LLSD()); + const bool is_enabled = isActionEnabled("delete"); + if (is_enabled) *accept = ACCEPT_YES_MULTI; - updateVerbs(); + if (is_enabled && drop) + { + onClipboardAction("delete"); + } + return true; } -bool LLPanelOutfitsInventory::isCOFPanelActive() const +// List Commands // +//////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////////// +// Tab panels // + +void LLPanelOutfitsInventory::initTabPanels() { - if (!mActivePanel) return false; + LLInventoryPanel *cof_panel = getChild<LLInventoryPanel>(COF_TAB_NAME); + cof_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); + mTabPanels.push_back(cof_panel); + + LLInventoryPanel *myoutfits_panel = getChild<LLInventoryPanel>(OUTFITS_TAB_NAME); + myoutfits_panel->setFilterTypes(1LL << LLFolderType::FT_OUTFIT, LLInventoryFilter::FILTERTYPE_CATEGORY); + myoutfits_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); + mTabPanels.push_back(myoutfits_panel); + + for (tabpanels_vec_t::iterator iter = mTabPanels.begin(); + iter != mTabPanels.end(); + ++iter) + { + LLInventoryPanel *panel = (*iter); + panel->setSelectCallback(boost::bind(&LLPanelOutfitsInventory::onTabSelectionChange, this, panel, _1, _2)); + } - return mActivePanel->getName() == COF_TAB_NAME; + mAppearanceTabs = getChild<LLTabContainer>("appearance_tabs"); + mAppearanceTabs->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::onTabChange, this)); + mActivePanel = (LLInventoryPanel*)mAppearanceTabs->getCurrentPanel(); } -void LLPanelOutfitsInventory::setWearablesLoading(bool val) +void LLPanelOutfitsInventory::onTabSelectionChange(LLInventoryPanel* tab_panel, const std::deque<LLFolderViewItem*> &items, BOOL user_action) { - updateVerbs(); + if (user_action && items.size() > 0) + { + for (tabpanels_vec_t::iterator iter = mTabPanels.begin(); + iter != mTabPanels.end(); + ++iter) + { + LLInventoryPanel *panel = (*iter); + if (panel == tab_panel) + { + mActivePanel = panel; + } + else + { + panel->getRootFolder()->clearSelection(); + } + } + } + onSelectionChange(items, user_action); } -void LLPanelOutfitsInventory::onWearablesLoaded() +void LLPanelOutfitsInventory::onTabChange() { - setWearablesLoading(false); + mActivePanel = (LLInventoryPanel*)childGetVisibleTab("appearance_tabs"); + if (!mActivePanel) + { + return; + } + mActivePanel->setFilterSubString(mFilterSubString); + updateVerbs(); } -void LLPanelOutfitsInventory::onWearablesLoading() +BOOL LLPanelOutfitsInventory::isTabPanel(LLInventoryPanel *panel) const { - setWearablesLoading(true); + for(tabpanels_vec_t::const_iterator it = mTabPanels.begin(); + it != mTabPanels.end(); + ++it) + { + if (*it == panel) + return TRUE; + } + return FALSE; } -// static -LLSidepanelAppearance* LLPanelOutfitsInventory::getAppearanceSP() +BOOL LLPanelOutfitsInventory::isCOFPanelActive() const { - static LLSidepanelAppearance* panel_appearance = - dynamic_cast<LLSidepanelAppearance*> - (LLSideTray::getInstance()->getPanel("sidepanel_appearance")); - return panel_appearance; + return (getActivePanel()->getName() == COF_TAB_NAME); } |