summaryrefslogtreecommitdiff
path: root/indra/newview/llwearableitemslist.cpp
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-06-11 17:47:11 +0300
committerVadim Savchuk <vsavchuk@productengine.com>2010-06-11 17:47:11 +0300
commit680ef887a24dd8adb35514bcf10ca60671867fee (patch)
tree60f06aeb2fd47379d94ef9793bded4bb93e44913 /indra/newview/llwearableitemslist.cpp
parentb90f6f21375d0e76a9f478da5a4d43fa70ff8def (diff)
EXT-7625 FIXED Removed inappropriate items from the Add Wearables panel context menu.
We can now distinguish LLWearableItemsList instances used in My Outfits from the one used in the Add Wearable panels, and show/enable different menu items for them. Being limited in time, I implemented this via a XUI parameter called "standalone": the Add Wearable list is standalone, the others aren't. Although it would be of course more flexible to have separate subclasses. --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llwearableitemslist.cpp')
-rw-r--r--indra/newview/llwearableitemslist.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index 54695e9d40..2eb6bd0df2 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -452,15 +452,17 @@ static const LLWearableItemTypeNameComparator WEARABLE_TYPE_NAME_COMPARATOR;
static const LLDefaultChildRegistry::Register<LLWearableItemsList> r("wearable_items_list");
LLWearableItemsList::Params::Params()
-: use_internal_context_menu("use_internal_context_menu", true)
+: standalone("standalone", true)
{}
LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p)
: LLInventoryItemsList(p)
{
setComparator(&WEARABLE_TYPE_NAME_COMPARATOR);
- if (p.use_internal_context_menu)
+ mIsStandalone = p.standalone;
+ if (mIsStandalone)
{
+ // Use built-in context menu.
setRightMouseDownCallback(boost::bind(&LLWearableItemsList::onRightClick, this, _2, _3));
}
}
@@ -555,6 +557,18 @@ void LLWearableItemsList::onRightClick(S32 x, S32 y)
/// ContextMenu
//////////////////////////////////////////////////////////////////////////
+LLWearableItemsList::ContextMenu::ContextMenu()
+: mParent(NULL)
+{
+}
+
+void LLWearableItemsList::ContextMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y)
+{
+ mParent = dynamic_cast<LLWearableItemsList*>(spawning_view);
+ LLListContextMenu::show(spawning_view, uuids, x, y);
+ mParent = NULL; // to avoid dereferencing an invalid pointer
+}
+
// virtual
LLContextMenu* LLWearableItemsList::ContextMenu::createMenu()
{
@@ -642,17 +656,21 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
}
} // 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);
setMenuItemVisible(menu, "wear", n_worn == 0);
- setMenuItemVisible(menu, "edit", mask & (MASK_CLOTHING|MASK_BODYPART) && n_items == 1);
- setMenuItemEnabled(menu, "edit", n_editable == 1 && n_worn == 1);
+ setMenuItemVisible(menu, "edit", !standalone && mask & (MASK_CLOTHING|MASK_BODYPART));
+ setMenuItemEnabled(menu, "edit", n_editable == 1 && n_worn == 1 && n_items == 1);
setMenuItemVisible(menu, "create_new", mask & (MASK_CLOTHING|MASK_BODYPART) && n_items == 1);
+ setMenuItemVisible(menu, "show_original", !standalone);
setMenuItemEnabled(menu, "show_original", n_items == 1 && n_links == n_items);
setMenuItemVisible(menu, "take_off", mask == MASK_CLOTHING && n_worn == n_items);
setMenuItemVisible(menu, "detach", mask == MASK_ATTACHMENT && n_worn == n_items);
setMenuItemVisible(menu, "take_off_or_detach", mask == (MASK_ATTACHMENT|MASK_CLOTHING));
setMenuItemEnabled(menu, "take_off_or_detach", n_worn == n_items);
- setMenuItemVisible(menu, "object_profile", mask & (MASK_ATTACHMENT|MASK_CLOTHING));
+ setMenuItemVisible(menu, "object_profile", !standalone);
setMenuItemEnabled(menu, "object_profile", n_items == 1);
// Populate or hide the "Attach to..." / "Attach to HUD..." submenus.