summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneloutfitedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpaneloutfitedit.cpp')
-rw-r--r--indra/newview/llpaneloutfitedit.cpp101
1 files changed, 59 insertions, 42 deletions
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index ae4b288588..78de384cdc 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -36,6 +36,7 @@
// *TODO: reorder includes to match the coding standard
#include "llagent.h"
+#include "llagentcamera.h"
#include "llagentwearables.h"
#include "llappearancemgr.h"
#include "llcofwearables.h"
@@ -60,6 +61,7 @@
#include "llinventorymodelbackgroundfetch.h"
#include "llpaneloutfitsinventory.h"
#include "lluiconstants.h"
+#include "llsaveoutfitcombobtn.h"
#include "llscrolllistctrl.h"
#include "lltextbox.h"
#include "lluictrlfactory.h"
@@ -67,6 +69,7 @@
#include "llsidepanelappearance.h"
#include "lltoggleablemenu.h"
#include "llwearablelist.h"
+#include "llwearableitemslist.h"
static LLRegisterPanelClassWrapper<LLPanelOutfitEdit> t_outfit_edit("panel_outfit_edit");
@@ -74,7 +77,6 @@ const U64 WEARABLE_MASK = (1LL << LLInventoryType::IT_WEARABLE);
const U64 ATTACHMENT_MASK = (1LL << LLInventoryType::IT_ATTACHMENT) | (1LL << LLInventoryType::IT_OBJECT);
const U64 ALL_ITEMS_MASK = WEARABLE_MASK | ATTACHMENT_MASK;
-static const std::string SAVE_BTN("save_btn");
static const std::string REVERT_BTN("revert_btn");
class LLCOFObserver : public LLInventoryObserver
@@ -214,7 +216,10 @@ LLPanelOutfitEdit::LLPanelOutfitEdit()
mCOFObserver(NULL),
mGearMenu(NULL),
mCOFDragAndDropObserver(NULL),
- mInitialized(false)
+ mInitialized(false),
+ mAddWearablesPanel(NULL),
+ mWearableListMaskCollector(NULL),
+ mWearableListTypeCollector(NULL)
{
mSavedFolderState = new LLSaveFolderState();
mSavedFolderState->setApply(FALSE);
@@ -236,6 +241,9 @@ LLPanelOutfitEdit::~LLPanelOutfitEdit()
delete mCOFObserver;
delete mCOFDragAndDropObserver;
+
+ delete mWearableListMaskCollector;
+ delete mWearableListTypeCollector;
}
BOOL LLPanelOutfitEdit::postBuild()
@@ -251,16 +259,17 @@ BOOL LLPanelOutfitEdit::postBuild()
mFolderViewBtn = getChild<LLButton>("folder_view_btn");
mListViewBtn = getChild<LLButton>("list_view_btn");
+ mAddToOutfitBtn = getChild<LLButton>("add_to_outfit_btn");
childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL);
childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::showFilteredFolderWearablesPanel, this), NULL);
childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showFilteredWearablesPanel, this), NULL);
- childSetCommitCallback("gear_menu_btn", boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1), NULL);
childSetCommitCallback("wearables_gear_menu_btn", boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1), NULL);
mCOFWearables = getChild<LLCOFWearables>("cof_wearables_list");
mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onOutfitItemSelectionChange, this));
+ mCOFWearables->getCOFCallbacks().mAddWearable = boost::bind(&LLPanelOutfitEdit::onAddWearableClicked, this);
mCOFWearables->getCOFCallbacks().mEditWearable = boost::bind(&LLPanelOutfitEdit::onEditWearableClicked, this);
mCOFWearables->getCOFCallbacks().mDeleteWearable = boost::bind(&LLPanelOutfitEdit::onRemoveFromOutfitClicked, this);
mCOFWearables->getCOFCallbacks().mMoveWearableCloser = boost::bind(&LLPanelOutfitEdit::moveWearable, this, true);
@@ -268,6 +277,7 @@ BOOL LLPanelOutfitEdit::postBuild()
mCOFWearables->childSetAction("add_btn", boost::bind(&LLPanelOutfitEdit::toggleAddWearablesPanel, this));
+ mAddWearablesPanel = getChild<LLPanel>("add_wearables_panel");
mInventoryItemsPanel = getChild<LLInventoryPanel>("inventory_items");
mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK);
@@ -298,18 +308,14 @@ BOOL LLPanelOutfitEdit::postBuild()
childSetAction(REVERT_BTN, boost::bind(&LLAppearanceMgr::wearBaseOutfit, LLAppearanceMgr::getInstance()));
- childSetAction(SAVE_BTN, boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false));
- childSetAction("save_flyout_btn", boost::bind(&LLPanelOutfitEdit::showSaveMenu, this));
-
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar;
- save_registar.add("Outfit.Save.Action", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false));
- save_registar.add("Outfit.SaveAsNew.Action", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true));
- mSaveMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_save_outfit.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ mWearableListMaskCollector = new LLFindNonLinksByMask(ALL_ITEMS_MASK);
+ mWearableListTypeCollector = new LLFindWearablesOfType(LLWearableType::WT_NONE);
mWearableItemsPanel = getChild<LLPanel>("filtered_wearables_panel");
mWearableItemsList = getChild<LLInventoryItemsList>("filtered_wearables_list");
- mWearableListManager = new LLFilteredWearableListManager(mWearableItemsList, ALL_ITEMS_MASK);
+ mWearableListManager = new LLFilteredWearableListManager(mWearableItemsList, mWearableListMaskCollector);
+ mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this));
return TRUE;
}
@@ -334,7 +340,16 @@ void LLPanelOutfitEdit::moveWearable(bool closer_to_body)
void LLPanelOutfitEdit::toggleAddWearablesPanel()
{
- childSetVisible("add_wearables_panel", !childIsVisible("add_wearables_panel"));
+ BOOL current_visibility = mAddWearablesPanel->getVisible();
+ mAddWearablesPanel->setVisible(!current_visibility);
+
+ mFolderViewBtn->setVisible(!current_visibility);
+ mListViewBtn->setVisible(!current_visibility);
+ mAddToOutfitBtn->setVisible(!current_visibility);
+
+ // Change right dummy icon to fill the toggled buttons space.
+ childSetVisible("add_wearables_dummy_icon", !current_visibility);
+ childSetVisible("dummy_right_icon", current_visibility);
}
void LLPanelOutfitEdit::showWearablesFilter()
@@ -372,33 +387,6 @@ void LLPanelOutfitEdit::showFilteredFolderWearablesPanel()
mFolderViewBtn->setToggleState(TRUE);
}
-void LLPanelOutfitEdit::saveOutfit(bool as_new)
-{
- if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit())
- {
- // we don't need to ask for an outfit name, and updateBaseOutfit() successfully saved.
- // If updateBaseOutfit fails, ask for an outfit name anyways
- return;
- }
-
- LLPanelOutfitsInventory* panel_outfits_inventory = LLPanelOutfitsInventory::findInstance();
- if (panel_outfits_inventory)
- {
- panel_outfits_inventory->onSave();
- }
-
- //*TODO how to get to know when base outfit is updated or new outfit is created?
-}
-
-void LLPanelOutfitEdit::showSaveMenu()
-{
- S32 x, y;
- LLUI::getMousePositionLocal(this, &x, &y);
-
- mSaveMenu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(this, mSaveMenu, x, y);
-}
-
void LLPanelOutfitEdit::onTypeFilterChanged(LLUICtrl* ctrl)
{
LLComboBox* type_filter = dynamic_cast<LLComboBox*>(ctrl);
@@ -407,7 +395,9 @@ void LLPanelOutfitEdit::onTypeFilterChanged(LLUICtrl* ctrl)
{
U32 curr_filter_type = type_filter->getCurrentIndex();
mInventoryItemsPanel->setFilterTypes(mLookItemTypes[curr_filter_type].inventoryMask);
- mWearableListManager->setFilterMask(mLookItemTypes[curr_filter_type].inventoryMask);
+
+ mWearableListMaskCollector->setFilterMask(mLookItemTypes[curr_filter_type].inventoryMask);
+ mWearableListManager->setFilterCollector(mWearableListMaskCollector);
}
mSavedFolderState->setApply(TRUE);
@@ -487,6 +477,25 @@ void LLPanelOutfitEdit::onAddToOutfitClicked(void)
LLAppearanceMgr::getInstance()->wearItemOnAvatar(selected_id);
}
+void LLPanelOutfitEdit::onAddWearableClicked(void)
+{
+ LLPanelDummyClothingListItem* item = dynamic_cast<LLPanelDummyClothingListItem*>(mCOFWearables->getSelectedItem());
+
+ if(item)
+ {
+ showFilteredWearableItemsList(item->getWearableType());
+ }
+}
+
+void LLPanelOutfitEdit::onReplaceBodyPartMenuItemClicked(LLUUID selected_item_id)
+{
+ LLViewerInventoryItem* item = gInventory.getLinkedItem(selected_item_id);
+
+ if (item && item->getType() == LLAssetType::AT_BODYPART)
+ {
+ showFilteredWearableItemsList(item->getWearableType());
+ }
+}
void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void)
{
@@ -675,10 +684,10 @@ void LLPanelOutfitEdit::updateVerbs()
bool outfit_is_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();
bool has_baseoutfit = LLAppearanceMgr::getInstance()->getBaseOutfitUUID().notNull();
- childSetEnabled(SAVE_BTN, outfit_is_dirty);
+ mSaveComboBtn->setSaveBtnEnabled(outfit_is_dirty);
childSetEnabled(REVERT_BTN, outfit_is_dirty && has_baseoutfit);
- mSaveMenu->setItemEnabled("save_outfit", outfit_is_dirty);
+ mSaveComboBtn->setMenuItemEnabled("save_outfit", outfit_is_dirty);
mStatus->setText(outfit_is_dirty ? getString("unsaved_changes") : getString("now_editing"));
@@ -722,4 +731,12 @@ void LLPanelOutfitEdit::onGearMenuItemClick(const LLSD& data)
}
}
+void LLPanelOutfitEdit::showFilteredWearableItemsList(LLWearableType::EType type)
+{
+ mWearableListTypeCollector->setType(type);
+ mWearableListManager->setFilterCollector(mWearableListTypeCollector);
+ mAddWearablesPanel->setVisible(TRUE);
+ showFilteredWearablesPanel();
+}
+
// EOF