summaryrefslogtreecommitdiff
path: root/indra/newview/llwearableitemslist.cpp
diff options
context:
space:
mode:
authorDessie Linden <dessie@lindenlab.com>2010-06-17 07:42:08 -0700
committerDessie Linden <dessie@lindenlab.com>2010-06-17 07:42:08 -0700
commit74817f151f3e5c2c0c179d13d1100974ed78fbd4 (patch)
treeb198a5df57d362bfbd6c0617d14f5f7803ee5d6d /indra/newview/llwearableitemslist.cpp
parent1c15d18175782f5afee9377af3f0b4ca9e2a4db8 (diff)
parent7cc006347822a70f36175dc2627814a0eaeb9c0a (diff)
Merged from q/viewer-release
Diffstat (limited to 'indra/newview/llwearableitemslist.cpp')
-rw-r--r--indra/newview/llwearableitemslist.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index f86838194e..ea0c5f1d0f 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -106,24 +106,9 @@ LLPanelWearableOutfitItem* LLPanelWearableOutfitItem::create(LLViewerInventoryIt
return list_item;
}
-BOOL LLPanelWearableOutfitItem::handleDoubleClick(S32 x, S32 y, MASK mask)
+LLPanelWearableOutfitItem::LLPanelWearableOutfitItem(LLViewerInventoryItem* item)
+: LLPanelInventoryListItemBase(item)
{
- LLViewerInventoryItem* item = getItem();
- if (item)
- {
- LLUUID id = item->getUUID();
-
- if (get_is_item_worn(id))
- {
- LLAppearanceMgr::getInstance()->removeItemFromAvatar(id);
- }
- else
- {
- LLAppearanceMgr::getInstance()->wearItemOnAvatar(id, true, false);
- }
- }
-
- return LLUICtrl::handleDoubleClick(x, y, mask);
}
// virtual
@@ -139,11 +124,6 @@ void LLPanelWearableOutfitItem::updateItem(const std::string& name)
LLPanelInventoryListItemBase::updateItem(search_label);
}
-LLPanelWearableOutfitItem::LLPanelWearableOutfitItem(LLViewerInventoryItem* item)
-: LLPanelInventoryListItemBase(item)
-{
-}
-
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@@ -667,6 +647,7 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
// *TODO: eliminate multiple traversals over the menu items
setMenuItemVisible(menu, "wear_add", mask == MASK_CLOTHING && n_worn == 0);
+ setMenuItemEnabled(menu, "wear_add", n_items == 1 && canAddWearable(ids.front()));
setMenuItemVisible(menu, "wear", n_worn == 0);
setMenuItemVisible(menu, "edit", !standalone && mask & (MASK_CLOTHING|MASK_BODYPART));
setMenuItemEnabled(menu, "edit", n_editable == 1 && n_worn == 1 && n_items == 1);
@@ -760,4 +741,23 @@ void LLWearableItemsList::ContextMenu::createNewWearable(const LLUUID& item_id)
LLAgentWearables::createWearable(item->getWearableType(), true);
}
+// Can we wear another wearable of the given item's wearable type?
+// static
+bool LLWearableItemsList::ContextMenu::canAddWearable(const LLUUID& item_id)
+{
+ if (!gAgentWearables.areWearablesLoaded())
+ {
+ return false;
+ }
+
+ LLViewerInventoryItem* item = gInventory.getItem(item_id);
+ if (!item || item->getType() != LLAssetType::AT_CLOTHING)
+ {
+ return false;
+ }
+
+ U32 wearable_count = gAgentWearables.getWearableCount(item->getWearableType());
+ return wearable_count < LLAgentWearables::MAX_CLOTHING_PER_TYPE;
+}
+
// EOF