summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llwearableitemslist.cpp28
-rw-r--r--indra/newview/llwearableitemslist.h12
-rw-r--r--indra/newview/skins/default/xui/en/outfit_accordion_tab.xml2
3 files changed, 35 insertions, 7 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.
diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h
index dd0ceb99e4..e0d1bf9476 100644
--- a/indra/newview/llwearableitemslist.h
+++ b/indra/newview/llwearableitemslist.h
@@ -325,6 +325,10 @@ public:
*/
class ContextMenu : public LLListContextMenu, public LLSingleton<ContextMenu>
{
+ public:
+ ContextMenu();
+ /*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
+
protected:
enum {
MASK_CLOTHING = 0x01,
@@ -340,11 +344,13 @@ public:
static void setMenuItemEnabled(LLContextMenu* menu, const std::string& name, bool val);
static void updateMask(U32& mask, LLAssetType::EType at);
static void createNewWearable(const LLUUID& item_id);
+
+ LLWearableItemsList* mParent;
};
struct Params : public LLInitParam::Block<Params, LLInventoryItemsList::Params>
{
- Optional<bool> use_internal_context_menu;
+ Optional<bool> standalone;
Params();
};
@@ -361,11 +367,15 @@ public:
*/
void updateChangedItems(const LLInventoryModel::changed_items_t& changed_items_uuids);
+ bool isStandalone() const { return mIsStandalone; }
+
protected:
friend class LLUICtrlFactory;
LLWearableItemsList(const LLWearableItemsList::Params& p);
void onRightClick(S32 x, S32 y);
+
+ bool mIsStandalone;
};
#endif //LL_LLWEARABLEITEMSLIST_H
diff --git a/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml b/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml
index 44437d01eb..bdfa928b1d 100644
--- a/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml
+++ b/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml
@@ -19,6 +19,6 @@
multi_select="true"
name="wearable_items_list"
translate="false"
- use_internal_context_menu="false"
+ standalone="false"
/>
</accordion_tab>