From 8f80020efd64ee5a051c595999d12376cf240ca2 Mon Sep 17 00:00:00 2001
From: Cinder <cinder@sdf.org>
Date: Tue, 23 Dec 2014 23:35:52 -0700
Subject: [PATCH] ALCH-161 - Make the Object Contents floater not disgusting

---
 indra/newview/llfloateropenobject.cpp         | 26 ++----
 indra/newview/llfloateropenobject.h           |  4 +-
 .../default/xui/en/floater_openobject.xml     | 82 +++++--------------
 3 files changed, 31 insertions(+), 81 deletions(-)

diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp
index ef746d308d..321478779c 100755
--- a/indra/newview/llfloateropenobject.cpp
+++ b/indra/newview/llfloateropenobject.cpp
@@ -56,9 +56,6 @@ LLFloaterOpenObject::LLFloaterOpenObject(const LLSD& key)
 	mPanelInventoryObject(NULL),
 	mDirty(TRUE)
 {
-	mCommitCallbackRegistrar.add("OpenObject.MoveToInventory",	boost::bind(&LLFloaterOpenObject::onClickMoveToInventory, this));
-	mCommitCallbackRegistrar.add("OpenObject.MoveAndWear",		boost::bind(&LLFloaterOpenObject::onClickMoveAndWear, this));
-	mCommitCallbackRegistrar.add("OpenObject.ReplaceOutfit",	boost::bind(&LLFloaterOpenObject::onClickReplace, this));
 	mCommitCallbackRegistrar.add("OpenObject.Cancel",			boost::bind(&LLFloaterOpenObject::onClickCancel, this));
 }
 
@@ -72,6 +69,7 @@ BOOL LLFloaterOpenObject::postBuild()
 {
 	getChild<LLUICtrl>("object_name")->setTextArg("[DESC]", std::string("Object") ); // *Note: probably do not want to translate this
 	mPanelInventoryObject = getChild<LLPanelObjectInventory>("object_contents");
+	getChild<LLUICtrl>("copy_flyout")->setCommitCallback(boost::bind(&LLFloaterOpenObject::onClickCopy, this, _1));
 	
 	refresh();
 	return TRUE;
@@ -238,21 +236,15 @@ void LLFloaterOpenObject::callbackMoveInventory(S32 result, void* data)
 	delete cat;
 }
 
-void LLFloaterOpenObject::onClickMoveToInventory()
+void LLFloaterOpenObject::onClickCopy(LLUICtrl* ctrl)
 {
-	moveToInventory(false);
-	closeFloater();
-}
-
-void LLFloaterOpenObject::onClickMoveAndWear()
-{
-	moveToInventory(true, false);
-	closeFloater();
-}
-
-void LLFloaterOpenObject::onClickReplace()
-{
-	moveToInventory(true, true);
+	const std::string& action = ctrl->getValue().asString();
+	if (action == "replace")
+		moveToInventory(true, true);
+	else if (action == "add")
+		moveToInventory(true, false);
+	else
+		moveToInventory(false);
 	closeFloater();
 }
 
diff --git a/indra/newview/llfloateropenobject.h b/indra/newview/llfloateropenobject.h
index 2e761f99bf..73d0dfbf58 100755
--- a/indra/newview/llfloateropenobject.h
+++ b/indra/newview/llfloateropenobject.h
@@ -62,9 +62,7 @@ protected:
 
 	void moveToInventory(bool wear, bool replace = false);
 
-	void onClickMoveToInventory();
-	void onClickMoveAndWear();
-	void onClickReplace();
+	void onClickCopy(LLUICtrl* ctrl);
 	void onClickCancel();
 	static void callbackCreateInventoryCategory(const LLUUID& category_id, LLUUID object_id, bool wear, bool replace = false);
 	static void callbackMoveInventory(S32 result, void* data);
diff --git a/indra/newview/skins/default/xui/en/floater_openobject.xml b/indra/newview/skins/default/xui/en/floater_openobject.xml
index 912db80bcc..e1fbb48a9a 100755
--- a/indra/newview/skins/default/xui/en/floater_openobject.xml
+++ b/indra/newview/skins/default/xui/en/floater_openobject.xml
@@ -3,9 +3,9 @@
  legacy_header_height="18"
  can_resize="true"
  default_tab_group="1"
- height="370"
+ height="322"
  layout="topleft"
- min_height="190"
+ min_height="160"
  min_width="285"
  name="objectcontents"
  help_topic="objectcontents"
@@ -31,80 +31,40 @@
      background_visible="false"
      draw_border="false"
      follows="all"
-     height="240"
+     height="250"
      layout="topleft"
      left="10"
      name="object_contents"
      top_pad="0"
      width="284" />
-  	<view_border
-     bevel_style="none"
-     follows="bottom|left"
-     height="50"
-     highlight_light_color="0.6 0.6 0.6"
+
+    <flyout_button
+     follows="left|right|bottom"
+     height="23"
+     label="Copy To Inventory"
      layout="topleft"
      left="10"
-     name="border"
+     name="copy_flyout"
      top_pad="5"
-     width="270"/> 
-  	<text
-  	 follows="bottom|left"
-  	 height="15"
-  	 layout="topleft"
-  	 left="15"
-  	 name="border_note"
-  	 text_color="White"
-  	 top_delta="5">
-  	 	Copy to inventory and wear
-    </text>  
- 	<button
-     follows="bottom|left"
-     height="23"
-     label="Add to outfit"
-     label_selected="Add to outfit"
-     layout="topleft"
- 	 left="15"    
-     name="copy_and_wear_button" 	
- 	 top_pad="3"	
-     width="135">
-        <button.commit_callback
-         function="OpenObject.MoveAndWear" />
-    </button>
-	<button
-     follows="bottom|left"
-     height="23"
-     label="Replace outfit"
-     label_selected="Replace outfit"
-     layout="topleft"
-     left_pad="5"
-     name="copy_and_replace_button"
-     width="120">
-        <button.commit_callback
-         function="OpenObject.ReplaceOutfit" />
-    </button>  
-    <button
-     follows="bottom|left"
-     height="23"
-     label="Only copy to inventory"
-     label_selected="Only copy to inventory"
-     layout="topleft"
-     left="15"
-     name="copy_to_inventory_button"
-     tab_group="1"
-     top_pad="9"
-     width="135">
-        <button.commit_callback
-         function="OpenObject.MoveToInventory" />
-    </button>
+     width="153">
+        <flyout_button.item
+         label="Replace outfit with contents"
+         name="replace"
+         value="replace" />
+        <flyout_button.item
+         label="Add contents to outfit"
+         name="add"
+         value="add" />
+    </flyout_button>
     <button
-     follows="bottom|left"
+     follows="bottom|right"
      height="23"
      label="Cancel"
      label_selected="Cancel"
      layout="topleft"
      left_pad="5"
      name="cancel_button"
-     width="120">
+     width="125">
         <button.commit_callback
          function="OpenObject.Cancel" />
     </button>
-- 
GitLab