From f3a4a48d8ed20b4bbd65d7cdb9b191c9faf2544b Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Wed, 19 Oct 2011 17:33:10 -0700
Subject: * Fixed issue where dragging disabled buttons from the toybox to the
 toybox   would remove them from the surrounding toolbars. * Removed dead drag
 & drop code * Fixed issue where saving didn't necessarily work because
 toolbar populated   with command id's that didn't have associated names.

---
 indra/llui/lltoolbar.cpp | 10 +++++-----
 indra/llui/lltoolbar.h   |  3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)

(limited to 'indra/llui')

diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index c559a2bf1d..bceda9bf54 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -217,7 +217,7 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank)
 	if ((rank >= mButtonCommands.size()) || (rank == RANK_NONE))
 	{
 		// In that case, back load
-		mButtonCommands.push_back(commandId);
+		mButtonCommands.push_back(command->id());
 		mButtons.push_back(button);
 	}
 	else 
@@ -232,7 +232,7 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank)
 			rank--;
 		}
 		// ...then insert
-		mButtonCommands.insert(it_command,commandId);
+		mButtonCommands.insert(it_command, command->id());
 		mButtons.insert(it_button,button);
 	}
 
@@ -821,7 +821,7 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
 	if (!commandp) return NULL;
 
 	LLToolBarButton::Params button_p;
-	button_p.name = id.name();
+	button_p.name = commandp->id().name();  // Make sure to retrieve the name from the command itself, not the passed in id
 	button_p.label = LLTrans::getString(commandp->labelRef());
 	button_p.tool_tip = LLTrans::getString(commandp->tooltipRef());
 	button_p.image_overlay = LLUI::getUIImage(commandp->icon());
@@ -999,13 +999,13 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask)
 	{
 		if (!mIsDragged)
 		{
-			mStartDragItemCallback(x,y,mId.uuid());
+			mStartDragItemCallback(x, y, this);
 			mIsDragged = true;
 			handled = TRUE;
 		}
 		else 
 		{
-			handled = mHandleDragItemCallback(x,y,mId.uuid(),LLAssetType::AT_WIDGET);
+			handled = mHandleDragItemCallback(x, y, mId.uuid(), LLAssetType::AT_WIDGET);
 		}
 	}
 	else
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index ad42d1fa35..e634e57f93 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -36,8 +36,9 @@
 #include "llassettype.h"
 
 class LLToolBar;
+class LLToolBarButton;
 
-typedef boost::function<void (S32 x, S32 y, const LLUUID& uuid)> tool_startdrag_callback_t;
+typedef boost::function<void (S32 x, S32 y, LLToolBarButton* button)> tool_startdrag_callback_t;
 typedef boost::function<BOOL (S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type)> tool_handledrag_callback_t;
 typedef boost::function<BOOL (void* data, S32 x, S32 y, LLToolBar* toolbar)> tool_handledrop_callback_t;
 
-- 
cgit v1.2.3