summaryrefslogtreecommitdiff
path: root/indra/newview/llwearableitemslist.cpp
diff options
context:
space:
mode:
authorDessie Linden <dessie@lindenlab.com>2010-07-02 07:07:23 -0700
committerDessie Linden <dessie@lindenlab.com>2010-07-02 07:07:23 -0700
commit3de5be44adb91d3a7e1ff3ca8b415964a722ce49 (patch)
tree12a993fde38848529cdcdbadbce2d58cc383d7d2 /indra/newview/llwearableitemslist.cpp
parent4ffcfe0a5fe21dcb49d79851eb43bd5d80623e0d (diff)
parent1417bd3985f339915f259bf5971ef21e47e30163 (diff)
Merged from viewer-release
Diffstat (limited to 'indra/newview/llwearableitemslist.cpp')
-rw-r--r--indra/newview/llwearableitemslist.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index cf165f8f66..868322699e 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -621,6 +621,7 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
U32 mask = 0; // mask of selected items' types
U32 n_items = ids.size(); // number of selected items
U32 n_worn = 0; // number of worn items among the selected ones
+ U32 n_already_worn = 0; // number of items worn of same type as selected items
U32 n_links = 0; // number of links among the selected items
U32 n_editable = 0; // number of editable items among the selected ones
@@ -638,10 +639,11 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
updateMask(mask, item->getType());
- bool is_link = item->getIsLinkType();
- bool is_worn = get_is_item_worn(id);
- bool is_editable = gAgentWearables.isWearableModifiable(id);
-
+ const LLWearableType::EType wearable_type = item->getWearableType();
+ const bool is_link = item->getIsLinkType();
+ const bool is_worn = get_is_item_worn(id);
+ const bool is_editable = gAgentWearables.isWearableModifiable(id);
+ const bool is_already_worn = gAgentWearables.selfHasWearable(wearable_type);
if (is_worn)
{
++n_worn;
@@ -654,14 +656,20 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
{
++n_links;
}
+ if (is_already_worn)
+ {
+ ++n_already_worn;
+ }
} // for
bool standalone = mParent ? mParent->isStandalone() : false;
// *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, "wear_wear", n_already_worn == 0);
+ setMenuItemEnabled(menu, "wear_wear", n_already_worn == 0);
+ setMenuItemVisible(menu, "wear_add", mask == MASK_CLOTHING && n_worn == 0 && n_already_worn != 0);
+ setMenuItemEnabled(menu, "wear_add", n_items == 1 && canAddWearable(ids.front()) && n_already_worn != 0);
+ setMenuItemVisible(menu, "wear_replace", n_worn == 0 && n_already_worn != 0);
//visible only when one item selected and this item is worn
setMenuItemVisible(menu, "edit", !standalone && mask & (MASK_CLOTHING|MASK_BODYPART) && n_worn == n_items && n_worn == 1);
setMenuItemEnabled(menu, "edit", n_editable == 1 && n_worn == 1 && n_items == 1);