summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelwearing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelwearing.cpp')
-rw-r--r--indra/newview/llpanelwearing.cpp48
1 files changed, 41 insertions, 7 deletions
diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp
index 89cb495db9..3347c40687 100644
--- a/indra/newview/llpanelwearing.cpp
+++ b/indra/newview/llpanelwearing.cpp
@@ -64,7 +64,9 @@ public:
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
- registrar.add("Gear.Edit", boost::bind(&edit_outfit));
+ registrar.add("Gear.TouchAttach", boost::bind(&LLWearingGearMenu::handleMultiple, this, handle_attachment_touch));
+ registrar.add("Gear.EditItem", boost::bind(&LLWearingGearMenu::handleMultiple, this, handle_item_edit));
+ registrar.add("Gear.EditOutfit", boost::bind(&edit_outfit));
registrar.add("Gear.TakeOff", boost::bind(&LLPanelWearing::onRemoveItem, mPanelWearing));
registrar.add("Gear.Copy", boost::bind(&LLPanelWearing::copyToClipboard, mPanelWearing));
@@ -78,6 +80,16 @@ public:
LLToggleableMenu* getMenu() { return mMenu; }
private:
+ void handleMultiple(std::function<void(const LLUUID& id)> functor)
+ {
+ uuid_vec_t selected_item_ids;
+ mPanelWearing->getSelectedItemsUUIDs(selected_item_ids);
+
+ for (const LLUUID& item_id : selected_item_ids)
+ {
+ functor(item_id);
+ }
+ }
LLToggleableMenu* mMenu;
LLPanelWearing* mPanelWearing;
@@ -92,7 +104,9 @@ protected:
{
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- registrar.add("Wearing.Edit", boost::bind(&edit_outfit));
+ registrar.add("Wearing.TouchAttach", boost::bind(handleMultiple, handle_attachment_touch, mUUIDs));
+ registrar.add("Wearing.EditItem", boost::bind(handleMultiple, handle_item_edit, mUUIDs));
+ registrar.add("Wearing.EditOutfit", boost::bind(&edit_outfit));
registrar.add("Wearing.ShowOriginal", boost::bind(show_item_original, mUUIDs.front()));
registrar.add("Wearing.TakeOff",
boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs));
@@ -138,14 +152,19 @@ protected:
}
// Enable/disable some menu items depending on the selection.
+ bool show_touch = !bp_selected && !clothes_selected && attachments_selected;
+ bool show_edit = bp_selected || clothes_selected || attachments_selected;
bool allow_detach = !bp_selected && !clothes_selected && attachments_selected;
bool allow_take_off = !bp_selected && clothes_selected && !attachments_selected;
+ menu->setItemVisible("touch_attach", show_touch);
+ menu->setItemEnabled("touch_attach", 1 == mUUIDs.size() && enable_attachment_touch(mUUIDs.front()));
+ menu->setItemVisible("edit_item", show_edit);
+ menu->setItemEnabled("edit_item", 1 == mUUIDs.size() && get_is_item_editable(mUUIDs.front()));
menu->setItemVisible("take_off", allow_take_off);
menu->setItemVisible("detach", allow_detach);
- menu->setItemVisible("edit_outfit_separator", allow_take_off || allow_detach);
+ menu->setItemVisible("edit_outfit_separator", show_touch | show_edit | allow_take_off || allow_detach);
menu->setItemVisible("show_original", mUUIDs.size() == 1);
- menu->setItemVisible("edit_item", FALSE);
}
};
@@ -173,12 +192,15 @@ protected:
void updateMenuItemsVisibility(LLContextMenu* menu)
{
+ menu->setItemVisible("touch_attach", TRUE);
+ menu->setItemEnabled("touch_attach", 1 == mUUIDs.size());
+ menu->setItemVisible("edit_item", TRUE);
+ menu->setItemEnabled("edit_item", 1 == mUUIDs.size());
menu->setItemVisible("take_off", FALSE);
menu->setItemVisible("detach", TRUE);
- menu->setItemVisible("edit_outfit_separator", TRUE);
+ menu->setItemVisible("edit_outfit_separator", FALSE);
menu->setItemVisible("show_original", FALSE);
- menu->setItemVisible("edit_item", TRUE);
- menu->setItemVisible("edit", FALSE);
+ menu->setItemVisible("edit_outfit", FALSE);
}
LLPanelWearing* mPanelWearing;
@@ -350,6 +372,18 @@ bool LLPanelWearing::isActionEnabled(const LLSD& userdata)
}
}
+ uuid_vec_t selected_uuids;
+ getSelectedItemsUUIDs(selected_uuids);
+
+ if (command_name == "touch_attach")
+ {
+ return (1 == selected_uuids.size()) && (enable_attachment_touch(selected_uuids.front()));
+ }
+ else if (command_name == "edit_item")
+ {
+ return (1 == selected_uuids.size()) && (get_is_item_editable(selected_uuids.front()));
+ }
+
return false;
}