Commits

Anonymous committed 9a01435

EXT-7914 FIXED (Update context menu for worn clothing in the Edit Outfit panel)

- Removed the following menu items: Move Up a Layer, Move Down a Layer.
- Added 'Replace' menu item.
- Implemented method replaceWearable() - handler for the 'Replace' menu item.

Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/642/

Comments (0)

Files changed (2)

indra/newview/llcofwearables.cpp

 	}
 
 protected:
+	static void replaceWearable()
+	{
+		static LLButton* show_add_wearables_btn =
+				LLSideTray::getInstance()->getChild<LLButton>("show_add_wearables_btn");
+
+		show_add_wearables_btn->onCommit();
+	}
+
 	/*virtual*/ LLContextMenu* createMenu()
 	{
 		LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
 		functor_t take_off = boost::bind(&LLAppearanceMgr::removeItemFromAvatar, LLAppearanceMgr::getInstance(), _1);
 
 		registrar.add("Clothing.TakeOff", boost::bind(handleMultiple, take_off, mUUIDs));
-		registrar.add("Clothing.MoveUp", boost::bind(moveWearable, selected_id, false));
-		registrar.add("Clothing.MoveDown", boost::bind(moveWearable, selected_id, true));
+		registrar.add("Clothing.Replace", boost::bind(replaceWearable));
 		registrar.add("Clothing.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));
 		registrar.add("Clothing.Create", boost::bind(&CofClothingContextMenu::createNew, this, selected_id));
 
 		std::string param = data.asString();
 		LLUUID selected_id = mUUIDs.back();
 
-		if ("move_up" == param)
-		{
-			return gAgentWearables.canMoveWearable(selected_id, false);
-		}
-		else if ("move_down" == param)
-		{
-			return gAgentWearables.canMoveWearable(selected_id, true);
-		}
-		else if ("take_off" == param)
+		if ("take_off" == param)
 		{
 			return get_is_item_worn(selected_id);
 		}
 		{
 			return mUUIDs.size() == 1 && gAgentWearables.isWearableModifiable(selected_id);
 		}
+		else if ("replace" == param)
+		{
+			return get_is_item_worn(selected_id) && mUUIDs.size() == 1;
+		}
+
 		return true;
 	}
-
-	// We don't use LLAppearanceMgr::moveWearable() directly because
-	// the item may be invalidated between setting the callback and calling it.
-	static bool moveWearable(const LLUUID& item_id, bool closer_to_body)
-	{
-		LLViewerInventoryItem* item = gInventory.getItem(item_id);
-		return LLAppearanceMgr::instance().moveWearable(item, closer_to_body);
-	}
 };
 
 //////////////////////////////////////////////////////////////////////////

indra/newview/skins/default/xui/en/menu_cof_clothing.xml

          parameter="take_off" />
     </menu_item_call>
     <menu_item_call
-     label="Move Up a Layer"
-     layout="topleft"
-     name="move_up">
-        <on_click
-         function="Clothing.MoveUp" />
-        <on_enable
-         function="Clothing.OnEnable"
-         parameter="move_up" />
-    </menu_item_call>
-    <menu_item_call
-     label="Move Down a Layer"
-     layout="topleft"
-     name="move_down">
-        <on_click
-         function="Clothing.MoveDown" />
-        <on_enable
-         function="Clothing.OnEnable"
-         parameter="move_down" />
-    </menu_item_call>
-    <menu_item_call
      label="Edit"
      layout="topleft"
      name="edit">
          parameter="edit" />
     </menu_item_call>
     <menu_item_call
+     label="Replace"
+     layout="topleft"
+     name="replace">
+        <on_click
+         function="Clothing.Replace" />
+        <on_enable
+         function="Clothing.OnEnable"
+         parameter="replace" />
+    </menu_item_call>
+    <menu_item_call
      label="Create New"
      layout="topleft"
      name="create_new"