summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2010-06-30 16:42:09 -0400
committerLoren Shih <seraph@lindenlab.com>2010-06-30 16:42:09 -0400
commit651bc81ffcad1b1dee60a05f5fa4ea26a7bb0871 (patch)
tree83656b5341a83ee85b0c08dfe2dfa4cca86b7c88 /indra
parent1c05b8cc3269531f781f1e97260868509b757327 (diff)
EXT-8128 FIXED Right click menu should offer "wear" if no item of type is worn
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llwearableitemslist.cpp22
-rw-r--r--indra/newview/skins/default/xui/en/menu_wearable_list_item.xml9
2 files changed, 23 insertions, 8 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);
diff --git a/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml
index 23eb89e448..c3adbb7904 100644
--- a/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml
+++ b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml
@@ -4,11 +4,18 @@
<menu_item_call
label="Replace"
layout="topleft"
- name="wear">
+ name="wear_replace">
<on_click
function="Wearable.Wear" />
</menu_item_call>
<menu_item_call
+ label="Wear"
+ layout="topleft"
+ name="wear_wear">
+ <on_click
+ function="Wearable.Add" />
+ </menu_item_call>
+ <menu_item_call
label="Add"
layout="topleft"
name="wear_add">