summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpaneloutfitedit.cpp1
-rw-r--r--indra/newview/llwearableitemslist.cpp58
-rw-r--r--indra/newview/llwearableitemslist.h7
-rw-r--r--indra/newview/skins/default/xui/en/menu_wearable_list_item.xml11
4 files changed, 74 insertions, 3 deletions
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index 1d87aa6f5d..dd1130aeba 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -1282,6 +1282,7 @@ void LLPanelOutfitEdit::showFilteredWearablesListView(LLWearableType::EType type
//e_list_view_item_type implicitly contains LLWearableType::EType starting from LVIT_SHAPE
applyListViewFilter(static_cast<EListViewItemType>(LVIT_SHAPE + type));
+ mWearableItemsList->setMenuWearableType(type);
}
static void update_status_widget_rect(LLView * widget, S32 right_border)
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index e7bbee5efd..3d1bc5249d 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -639,6 +639,7 @@ LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p)
: LLInventoryItemsList(p)
{
setSortOrder(E_SORT_BY_TYPE_LAYER, false);
+ mMenuWearableType = LLWearableType::WT_NONE;
mIsStandalone = p.standalone;
if (mIsStandalone)
{
@@ -730,10 +731,15 @@ void LLWearableItemsList::onRightClick(S32 x, S32 y)
getSelectedUUIDs(selected_uuids);
if (selected_uuids.empty())
{
- return;
+ if ((mMenuWearableType != LLWearableType::WT_NONE) && (size() == 0))
+ {
+ ContextMenu::instance().show(this, mMenuWearableType, x, y);
+ }
+ }
+ else
+ {
+ ContextMenu::instance().show(this, selected_uuids, x, y);
}
-
- ContextMenu::instance().show(this, selected_uuids, x, y);
}
void LLWearableItemsList::setSortOrder(ESortOrder sort_order, bool sort_now)
@@ -784,6 +790,46 @@ void LLWearableItemsList::ContextMenu::show(LLView* spawning_view, const uuid_ve
mParent = NULL; // to avoid dereferencing an invalid pointer
}
+void LLWearableItemsList::ContextMenu::show(LLView* spawning_view, LLWearableType::EType w_type, S32 x, S32 y)
+{
+ mParent = dynamic_cast<LLWearableItemsList*>(spawning_view);
+ LLContextMenu* menup = mMenuHandle.get();
+ if (menup)
+ {
+ //preventing parent (menu holder) from deleting already "dead" context menus on exit
+ LLView* parent = menup->getParent();
+ if (parent)
+ {
+ parent->removeChild(menup);
+ }
+ delete menup;
+ mUUIDs.clear();
+ }
+
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+ registrar.add("Wearable.CreateNew", boost::bind(createNewWearableByType, w_type));
+ menup = createFromFile("menu_wearable_list_item.xml");
+ if (!menup)
+ {
+ LL_WARNS() << "Context menu creation failed" << LL_ENDL;
+ return;
+ }
+ setMenuItemVisible(menup, "create_new", true);
+ setMenuItemEnabled(menup, "create_new", true);
+ setMenuItemVisible(menup, "wearable_attach_to", false);
+ setMenuItemVisible(menup, "wearable_attach_to_hud", false);
+
+ std::string new_label = LLTrans::getString("create_new_" + LLWearableType::getTypeName(w_type));
+ LLMenuItemGL* menu_item = menup->getChild<LLMenuItemGL>("create_new");
+ menu_item->setLabel(new_label);
+
+ mMenuHandle = menup->getHandle();
+ menup->show(x, y);
+ LLMenuGL::showPopup(spawning_view, menup, x, y);
+
+ mParent = NULL; // to avoid dereferencing an invalid pointer
+}
+
// virtual
LLContextMenu* LLWearableItemsList::ContextMenu::createMenu()
{
@@ -1004,4 +1050,10 @@ void LLWearableItemsList::ContextMenu::createNewWearable(const LLUUID& item_id)
LLAgentWearables::createWearable(item->getWearableType(), true);
}
+// static
+void LLWearableItemsList::ContextMenu::createNewWearableByType(LLWearableType::EType type)
+{
+ LLAgentWearables::createWearable(type, true);
+}
+
// EOF
diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h
index f3182ed163..ba8488b237 100644
--- a/indra/newview/llwearableitemslist.h
+++ b/indra/newview/llwearableitemslist.h
@@ -415,6 +415,8 @@ public:
public:
/*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
+ void show(LLView* spawning_view, LLWearableType::EType w_type, S32 x, S32 y);
+
protected:
enum {
MASK_CLOTHING = 0x01,
@@ -431,6 +433,7 @@ 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);
+ static void createNewWearableByType(LLWearableType::EType type);
LLWearableItemsList* mParent;
};
@@ -469,6 +472,8 @@ public:
void setSortOrder(ESortOrder sort_order, bool sort_now = true);
+ void setMenuWearableType(LLWearableType::EType type) { mMenuWearableType = type; }
+
protected:
friend class LLUICtrlFactory;
LLWearableItemsList(const LLWearableItemsList::Params& p);
@@ -479,6 +484,8 @@ protected:
bool mWornIndicationEnabled;
ESortOrder mSortOrder;
+
+ LLWearableType::EType mMenuWearableType;
};
#endif //LL_LLWEARABLEITEMSLIST_H
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 aa56b4ba63..7370dace7f 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,6 +4,7 @@
<menu_item_call
label="Replace"
layout="topleft"
+ visible="false"
name="wear_replace">
<on_click
function="Wearable.Wear" />
@@ -11,6 +12,7 @@
<menu_item_call
label="Wear"
layout="topleft"
+ visible="false"
name="wear_wear">
<on_click
function="Wearable.Wear" />
@@ -18,6 +20,7 @@
<menu_item_call
label="Add"
layout="topleft"
+ visible="false"
name="wear_add">
<on_click
function="Wearable.Add" />
@@ -25,6 +28,7 @@
<menu_item_call
label="Take Off / Detach"
layout="topleft"
+ visible="false"
name="take_off_or_detach">
<on_click
function="Wearable.TakeOffDetach" />
@@ -32,6 +36,7 @@
<menu_item_call
label="Detach"
layout="topleft"
+ visible="false"
name="detach">
<on_click
function="Attachment.Detach" />
@@ -47,6 +52,7 @@
<menu_item_call
label="Take Off"
layout="topleft"
+ visible="false"
name="take_off">
<on_click
function="Clothing.TakeOff" />
@@ -54,6 +60,7 @@
<menu_item_call
label="Edit"
layout="topleft"
+ visible="false"
name="edit">
<on_click
function="Wearable.Edit" />
@@ -61,6 +68,7 @@
<menu_item_call
label="Item Profile"
layout="topleft"
+ visible="false"
name="object_profile">
<on_click
function="Attachment.Profile" />
@@ -68,6 +76,7 @@
<menu_item_call
label="Show Original"
layout="topleft"
+ visible="false"
name="show_original">
<on_click
function="Wearable.ShowOriginal" />
@@ -75,6 +84,7 @@
<menu_item_call
label="Create New"
layout="topleft"
+ visible="false"
name="create_new"
translate="false">
<on_click
@@ -83,6 +93,7 @@
<menu_item_call
label="--no options--"
layout="topleft"
+ visible="false"
name="--no options--"
translate="false">
</menu_item_call>