From 0297f55c6d4be505fe6831a593ed2630d565e14a Mon Sep 17 00:00:00 2001
From: Seth ProductEngine <slitovchuk@productengine.com>
Date: Fri, 21 Oct 2011 17:26:47 +0200
Subject: EXP-1416 FIXED "Speak" and "Voice controls" buttons added as control
 views in LLTransientFloaterMgr to prevent hiding the transient IM floater.

---
 indra/llui/lltoolbar.cpp                | 14 +++++++++++++-
 indra/llui/lltoolbar.h                  |  5 +++++
 indra/newview/lltoolbarview.cpp         | 20 +++++++++++++++++++
 indra/newview/lltoolbarview.h           |  2 ++
 indra/newview/lltransientfloatermgr.cpp | 34 +++++++++++++++++++++++----------
 indra/newview/lltransientfloatermgr.h   |  9 +++++----
 6 files changed, 69 insertions(+), 15 deletions(-)

diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 515605200e..b0a072c00e 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -112,6 +112,7 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
 	mStartDragItemCallback(NULL),
 	mHandleDragItemCallback(NULL),
 	mHandleDropCallback(NULL),
+	mButtonAddSignal(NULL),
 	mDragAndDropTarget(false)
 {
 	mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text;
@@ -121,6 +122,7 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
 LLToolBar::~LLToolBar()
 {
 	delete mPopupMenuHandle.get();
+	delete mButtonAddSignal;
 }
 
 void LLToolBar::createContextMenu()
@@ -212,7 +214,6 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank)
 	mButtonPanel->addChild(button);
 	mButtonMap.insert(std::make_pair(commandId.uuid(), button));
 
-
 	// Insert the command and button in the right place in their respective lists
 	if ((rank >= mButtonCommands.size()) || (rank == RANK_NONE))
 	{
@@ -236,6 +237,11 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank)
 		mButtons.insert(it_button,button);
 	}
 
+	if (mButtonAddSignal)
+	{
+		(*mButtonAddSignal)(button);
+	}
+
 	mNeedsLayout = true;
 
 	return true;
@@ -898,6 +904,12 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
 	return button;
 }
 
+boost::signals2::connection LLToolBar::setButtonAddCallback(const button_add_signal_t::slot_type& cb)
+{
+	if (!mButtonAddSignal) mButtonAddSignal = new button_add_signal_t();
+	return mButtonAddSignal->connect(cb);
+}
+
 BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 										EDragAndDropType cargo_type,
 										void* cargo_data,
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index e634e57f93..68fc44ee8e 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -195,6 +195,9 @@ public:
 
 	LLToolBarButton* createButton(const LLCommandId& id);
 
+	typedef boost::signals2::signal<void (LLView* button)> button_add_signal_t;
+	boost::signals2::connection setButtonAddCallback(const button_add_signal_t::slot_type& cb);
+
 	bool hasButtons() const { return !mButtons.empty(); }
 	bool isModified() const { return mModified; }
 
@@ -255,6 +258,8 @@ private:
 	LLToolBarButton::Params			mButtonParams[LLToolBarEnums::BTNTYPE_COUNT];
 
 	LLHandle<class LLContextMenu>			mPopupMenuHandle;
+
+	button_add_signal_t*			mButtonAddSignal;
 };
 
 
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index 619d17efad..affa7241d1 100644
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -35,6 +35,7 @@
 #include "lltoolbar.h"
 #include "llbutton.h"
 #include "lltooldraganddrop.h"
+#include "lltransientfloatermgr.h"
 #include "llclipboard.h"
 
 #include "llagent.h"  // HACK for destinations guide on startup
@@ -96,14 +97,17 @@ BOOL LLToolBarView::postBuild()
 	mToolbarLeft->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
 	mToolbarLeft->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
 	mToolbarLeft->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
+	mToolbarLeft->setButtonAddCallback(boost::bind(LLToolBarView::onToolBarButtonAdded, _1));
 	
 	mToolbarRight->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
 	mToolbarRight->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
 	mToolbarRight->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
+	mToolbarRight->setButtonAddCallback(boost::bind(LLToolBarView::onToolBarButtonAdded, _1));
 	
 	mToolbarBottom->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
 	mToolbarBottom->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
 	mToolbarBottom->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
+	mToolbarBottom->setButtonAddCallback(boost::bind(LLToolBarView::onToolBarButtonAdded, _1));
 
 	LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&handleLoginToolbarSetup));
 	
@@ -314,6 +318,22 @@ void LLToolBarView::addToToolset(command_id_list_t& command_list, Toolbar& toolb
 	}
 }
 
+void LLToolBarView::onToolBarButtonAdded(LLView* button)
+{
+	if (button && button->getName() == "speak")
+	{
+		// Add the "Speak" button as a control view in LLTransientFloaterMgr
+		// to prevent hiding the transient IM floater upon pressing "Speak".
+		LLTransientFloaterMgr::getInstance()->addControlView(button);
+	}
+	else if (button && button->getName() == "voice")
+	{
+		// Add the "Voice controls" button as a control view in LLTransientFloaterMgr
+		// to prevent hiding the transient IM floater upon pressing "Voice controls".
+		LLTransientFloaterMgr::getInstance()->addControlView(button);
+	}
+}
+
 void LLToolBarView::draw()
 {
 	//LLPanel* sizer_left = getChild<LLPanel>("sizer_left");
diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h
index 60ad6316f8..8cafbc9308 100644
--- a/indra/newview/lltoolbarview.h
+++ b/indra/newview/lltoolbarview.h
@@ -94,6 +94,8 @@ private:
 	bool	addCommand(const LLCommandId& commandId, LLToolBar*	toolbar);
 	void	addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const;
 
+	static void	onToolBarButtonAdded(LLView* button);
+
 	// Pointers to the toolbars handled by the toolbar view
 	LLToolBar*	mToolbarLeft;
 	LLToolBar*	mToolbarRight;
diff --git a/indra/newview/lltransientfloatermgr.cpp b/indra/newview/lltransientfloatermgr.cpp
index c648a6a28a..d15efb048b 100644
--- a/indra/newview/lltransientfloatermgr.cpp
+++ b/indra/newview/lltransientfloatermgr.cpp
@@ -42,9 +42,9 @@ LLTransientFloaterMgr::LLTransientFloaterMgr()
 			&LLTransientFloaterMgr::leftMouseClickCallback, this, _2, _3, _4));
 	}
 
-	mGroupControls.insert(std::pair<ETransientGroup, std::set<LLView*> >(GLOBAL, std::set<LLView*>()));
-	mGroupControls.insert(std::pair<ETransientGroup, std::set<LLView*> >(DOCKED, std::set<LLView*>()));
-	mGroupControls.insert(std::pair<ETransientGroup, std::set<LLView*> >(IM, std::set<LLView*>()));
+	mGroupControls.insert(std::pair<ETransientGroup, controls_set_t >(GLOBAL, controls_set_t()));
+	mGroupControls.insert(std::pair<ETransientGroup, controls_set_t >(DOCKED, controls_set_t()));
+	mGroupControls.insert(std::pair<ETransientGroup, controls_set_t >(IM, controls_set_t()));
 }
 
 void LLTransientFloaterMgr::registerTransientFloater(LLTransientFloater* floater)
@@ -59,12 +59,16 @@ void LLTransientFloaterMgr::unregisterTransientFloater(LLTransientFloater* float
 
 void LLTransientFloaterMgr::addControlView(ETransientGroup group, LLView* view)
 {
-	mGroupControls.find(group)->second.insert(view);
+	if (!view) return;
+
+	mGroupControls.find(group)->second.insert(view->getHandle());
 }
 
 void LLTransientFloaterMgr::removeControlView(ETransientGroup group, LLView* view)
 {
-	mGroupControls.find(group)->second.erase(view);
+	if (!view) return;
+
+	mGroupControls.find(group)->second.erase(view->getHandle());
 }
 
 void LLTransientFloaterMgr::addControlView(LLView* view)
@@ -89,7 +93,7 @@ void LLTransientFloaterMgr::hideTransientFloaters(S32 x, S32 y)
 		{
 			ETransientGroup group = floater->getGroup();
 
-			bool hide = isControlClicked(mGroupControls.find(group)->second, x, y);
+			bool hide = isControlClicked(group, mGroupControls.find(group)->second, x, y);
 			if (hide)
 			{
 				floater->setTransientVisible(FALSE);
@@ -98,13 +102,23 @@ void LLTransientFloaterMgr::hideTransientFloaters(S32 x, S32 y)
 	}
 }
 
-bool LLTransientFloaterMgr::isControlClicked(std::set<LLView*>& set, S32 x, S32 y)
+bool LLTransientFloaterMgr::isControlClicked(ETransientGroup group, controls_set_t& set, S32 x, S32 y)
 {
 	bool res = true;
 	for (controls_set_t::iterator it = set.begin(); it
 			!= set.end(); it++)
 	{
-		LLView* control_view = *it;
+		LLView* control_view = NULL;
+
+		LLHandle<LLView> handle = *it;
+		if (handle.isDead())
+		{
+			mGroupControls.find(group)->second.erase(handle);
+			continue;
+		}
+
+		control_view = handle.get();
+
 		if (!control_view->getVisible())
 		{
 			continue;
@@ -130,8 +144,8 @@ void LLTransientFloaterMgr::leftMouseClickCallback(S32 x, S32 y,
 		return;
 	}
 
-	bool hide = isControlClicked(mGroupControls.find(DOCKED)->second, x, y)
-			&& isControlClicked(mGroupControls.find(GLOBAL)->second, x, y);
+	bool hide = isControlClicked(DOCKED, mGroupControls.find(DOCKED)->second, x, y)
+			&& isControlClicked(GLOBAL, mGroupControls.find(GLOBAL)->second, x, y);
 	if (hide)
 	{
 		hideTransientFloaters(x, y);
diff --git a/indra/newview/lltransientfloatermgr.h b/indra/newview/lltransientfloatermgr.h
index 2919244121..b4611c8c87 100644
--- a/indra/newview/lltransientfloatermgr.h
+++ b/indra/newview/lltransientfloatermgr.h
@@ -56,14 +56,15 @@ public:
 	void removeControlView(LLView* view);
 
 private:
+	typedef std::set<LLHandle<LLView> > controls_set_t;
+	typedef std::map<ETransientGroup, controls_set_t > group_controls_t;
+
 	void hideTransientFloaters(S32 x, S32 y);
 	void leftMouseClickCallback(S32 x, S32 y, MASK mask);
-	bool isControlClicked(std::set<LLView*>& set, S32 x, S32 y);
-private:
+	bool isControlClicked(ETransientGroup group, controls_set_t& set, S32 x, S32 y);
+
 	std::set<LLTransientFloater*> mTransSet;
 
-	typedef std::set<LLView*> controls_set_t;
-	typedef std::map<ETransientGroup, std::set<LLView*> > group_controls_t;
 	group_controls_t mGroupControls;
 };
 
-- 
cgit v1.2.3


From 2456573925567ed91d4cc227d7fc97b90248a1fa Mon Sep 17 00:00:00 2001
From: Paul ProductEngine <pguslisty@productengine.com>
Date: Fri, 21 Oct 2011 19:14:10 +0200
Subject: EXP-1404 FIXED (Dock icon shown in lower left corner of call dialog
 when user has speak icon hidden)

- Don't draw tongue of dockable call dialog floater in case speak button is not present in any tool bar.
---
 indra/llui/lldockablefloater.h | 2 ++
 indra/newview/llimview.cpp     | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h
index 8deb6c1159..1484ea3978 100644
--- a/indra/llui/lldockablefloater.h
+++ b/indra/llui/lldockablefloater.h
@@ -113,6 +113,8 @@ public:
 
 	bool getUniqueDocking() { return mUniqueDocking;	}
 	bool getUseTongue() { return mUseTongue; }
+
+	void setUseTongue(bool use_tongue) { mUseTongue = use_tongue;}
 private:
 	/**
 	 * Provides unique of dockable floater.
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 6e9baed5f2..33c6b2218c 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -1683,6 +1683,8 @@ BOOL LLCallDialog::postBuild()
 	LLView *anchor_panel = gToolBarView->findChildView("speak");
 	setDockControl(new LLDockControl(anchor_panel, this, getDockTongue(), LLDockControl::TOP));
 
+	setUseTongue(anchor_panel);
+
 	return TRUE;
 }
 
-- 
cgit v1.2.3


From f19ee13c0450e0e16e7c8c9d7f700e11c36886ef Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Fri, 21 Oct 2011 14:43:16 -0700
Subject: EXP-1430 FIX -- Minimizing voice settings floater corrupts layout
 throughout rest of session

* Added minimum size for layout panel that holds voice morphing and removed
  user resizability.

Reviewed by Richard.
---
 indra/newview/skins/default/xui/en/floater_voice_controls.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/indra/newview/skins/default/xui/en/floater_voice_controls.xml b/indra/newview/skins/default/xui/en/floater_voice_controls.xml
index 93a04050b6..6807b01fa3 100644
--- a/indra/newview/skins/default/xui/en/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/en/floater_voice_controls.xml
@@ -89,7 +89,7 @@
              visible="true"
              width="20" />
         </layout_panel>
-        <layout_panel name="leave_call_panel" height="26" auto_resize="false">
+        <layout_panel name="leave_call_panel" height="26" min_height="26" user_resize="false" auto_resize="false">
         <layout_stack
          clip="true"
          follows="left|top|right"
-- 
cgit v1.2.3


From 92fd54c6c6c337b5b7d46f038075a5a28ebb03b3 Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Fri, 21 Oct 2011 16:29:36 -0700
Subject: EXP-1434 FIX -- Mini-location bar disappears after
 maximizing/restoring viewer window

* The topinfo bar no longer follows the right edge of the window so it doesn't
  scale down and disappear.
---
 indra/newview/skins/default/xui/en/panel_topinfo_bar.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/indra/newview/skins/default/xui/en/panel_topinfo_bar.xml b/indra/newview/skins/default/xui/en/panel_topinfo_bar.xml
index 79f29777ce..fc527f5f9d 100644
--- a/indra/newview/skins/default/xui/en/panel_topinfo_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_topinfo_bar.xml
@@ -4,7 +4,7 @@
  background_opaque="false"
  bg_opaque_color="Black_50"
  bg_alpha_color="Black_50"
- follows="left|top|right"
+ follows="left|top"
  height="19"
  layout="topleft"
  name="topinfo_bar"
-- 
cgit v1.2.3


From 5676e4a62efd2636840395a0667e3df3a48f1989 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Fri, 21 Oct 2011 18:36:06 -0700
Subject: EXP-1439 : Modify DaD on the Favorite toolbar so that reordering
 visible landmarks don't send any back to the end of the list

---
 indra/newview/llfavoritesbar.cpp   | 65 ++++++++++++++++++++++++--------------
 indra/newview/llfavoritesbar.h     |  2 +-
 indra/newview/llinventorymodel.cpp | 50 +++++++++++++++++++++--------
 indra/newview/llinventorymodel.h   | 11 +++++--
 4 files changed, 86 insertions(+), 42 deletions(-)

diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 98de418878..4e0c838454 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -504,20 +504,29 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 
 void LLFavoritesBarCtrl::handleExistingFavoriteDragAndDrop(S32 x, S32 y)
 {
+	// Identify the button hovered and the side to drop
 	LLFavoriteLandmarkButton* dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLandingTab);
+	bool insert_before = true;	
+	if (!dest)
+	{
+		insert_before = false;
+		dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLastTab);
+	}
 
-	// there is no need to handle if an item was dragged onto itself
+	// There is no need to handle if an item was dragged onto itself
 	if (dest && dest->getLandmarkId() == mDragItemId)
 	{
 		return;
 	}
 
+	// Insert the dragged item in the right place
 	if (dest)
 	{
-		LLInventoryModel::updateItemsOrder(mItems, mDragItemId, dest->getLandmarkId());
+		LLInventoryModel::updateItemsOrder(mItems, mDragItemId, dest->getLandmarkId(), insert_before);
 	}
 	else
 	{
+		// This can happen when the item list is empty
 		mItems.push_back(gInventory.getItem(mDragItemId));
 	}
 
@@ -534,22 +543,31 @@ void LLFavoritesBarCtrl::handleExistingFavoriteDragAndDrop(S32 x, S32 y)
 
 void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, const LLUUID& favorites_id, S32 x, S32 y)
 {
+	// Identify the button hovered and the side to drop
 	LLFavoriteLandmarkButton* dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLandingTab);
-
-	// there is no need to handle if an item was dragged onto itself
+	bool insert_before = true;	
+	if (!dest)
+	{
+		insert_before = false;
+		dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLastTab);
+	}
+	
+	// There is no need to handle if an item was dragged onto itself
 	if (dest && dest->getLandmarkId() == mDragItemId)
 	{
 		return;
 	}
-
+	
 	LLPointer<LLViewerInventoryItem> viewer_item = new LLViewerInventoryItem(item);
 
+	// Insert the dragged item in the right place
 	if (dest)
 	{
-		insertBeforeItem(mItems, dest->getLandmarkId(), viewer_item);
+		insertItem(mItems, dest->getLandmarkId(), viewer_item, insert_before);
 	}
 	else
 	{
+		// This can happen when the item list is empty
 		mItems.push_back(viewer_item);
 	}
 
@@ -1337,29 +1355,28 @@ BOOL LLFavoritesBarCtrl::needToSaveItemsOrder(const LLInventoryModel::item_array
 	return result;
 }
 
-LLInventoryModel::item_array_t::iterator LLFavoritesBarCtrl::findItemByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id)
+void LLFavoritesBarCtrl::insertItem(LLInventoryModel::item_array_t& items, const LLUUID& dest_item_id, LLViewerInventoryItem* insertedItem, bool insert_before)
 {
-	LLInventoryModel::item_array_t::iterator result = items.end();
+	// Get the iterator to the destination item
+	LLInventoryModel::item_array_t::iterator it_dest = LLInventoryModel::findItemIterByUUID(items, dest_item_id);
+	if (it_dest == items.end())
+		return;
 
-	for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
+	// Go to the next element if one wishes to insert after the dest element
+	if (!insert_before)
 	{
-		if ((*i)->getUUID() == id)
-		{
-			result = i;
-			break;
-		}
+		++it_dest;
 	}
-
-	return result;
-}
-
-void LLFavoritesBarCtrl::insertBeforeItem(LLInventoryModel::item_array_t& items, const LLUUID& beforeItemId, LLViewerInventoryItem* insertedItem)
-{
-	LLViewerInventoryItem* beforeItem = gInventory.getItem(beforeItemId);
-	llassert(beforeItem);
-	if (beforeItem)
+	
+	// Insert the source item in the right place
+	if (it_dest != items.end())
+	{
+		items.insert(it_dest, insertedItem);
+	}
+	else 
 	{
-		items.insert(findItemByUUID(items, beforeItem->getUUID()), insertedItem);
+		// Append to the list if it_dest reached the end
+		items.push_back(insertedItem);
 	}
 }
 
diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h
index 1b11d6196e..2f75b3bb0e 100644
--- a/indra/newview/llfavoritesbar.h
+++ b/indra/newview/llfavoritesbar.h
@@ -130,7 +130,7 @@ private:
 	 * inserts an item identified by insertedItemId BEFORE an item identified by beforeItemId.
 	 * this function assumes that an item identified by insertedItemId doesn't exist in items array.
 	 */
-	void insertBeforeItem(LLInventoryModel::item_array_t& items, const LLUUID& beforeItemId, LLViewerInventoryItem* insertedItem);
+	void insertItem(LLInventoryModel::item_array_t& items, const LLUUID& dest_item_id, LLViewerInventoryItem* insertedItem, bool insert_before);
 
 	// finds an item by it's UUID in the items array
 	LLInventoryModel::item_array_t::iterator findItemByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id);
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index e86c427ae2..fb02fe0ff7 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -2879,40 +2879,62 @@ BOOL LLInventoryModel::getIsFirstTimeInViewer2()
 	return sFirstTimeInViewer2;
 }
 
-static LLInventoryModel::item_array_t::iterator find_item_iter_by_uuid(LLInventoryModel::item_array_t& items, const LLUUID& id)
+LLInventoryModel::item_array_t::iterator LLInventoryModel::findItemIterByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id)
 {
-	LLInventoryModel::item_array_t::iterator result = items.end();
+	LLInventoryModel::item_array_t::iterator curr_item = items.begin();
 
-	for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
+	while (curr_item != items.end())
 	{
-		if ((*i)->getUUID() == id)
+		if ((*curr_item)->getUUID() == id)
 		{
-			result = i;
 			break;
 		}
+		++curr_item;
 	}
 
-	return result;
+	return curr_item;
 }
 
 // static
 // * @param[in, out] items - vector with items to be updated. It should be sorted in a right way
 // * before calling this method.
 // * @param src_item_id - LLUUID of inventory item to be moved in new position
-// * @param dest_item_id - LLUUID of inventory item before which source item should be placed.
-void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& src_item_id, const LLUUID& dest_item_id)
+// * @param dest_item_id - LLUUID of inventory item before (or after) which source item should 
+// * be placed.
+// * @param insert_before - bool indicating if src_item_id should be placed before or after 
+// * dest_item_id. Default is true.
+void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& src_item_id, const LLUUID& dest_item_id, bool insert_before)
 {
-	LLInventoryModel::item_array_t::iterator it_src = find_item_iter_by_uuid(items, src_item_id);
-	LLInventoryModel::item_array_t::iterator it_dest = find_item_iter_by_uuid(items, dest_item_id);
+	LLInventoryModel::item_array_t::iterator it_src = findItemIterByUUID(items, src_item_id);
+	LLInventoryModel::item_array_t::iterator it_dest = findItemIterByUUID(items, dest_item_id);
 
-	if (it_src == items.end() || it_dest == items.end()) return;
+	// If one of the passed UUID is not in the item list, bail out
+	if ((it_src == items.end()) || (it_dest == items.end())) 
+		return;
 
+	// Erase the source element from the list, keep a copy before erasing.
 	LLViewerInventoryItem* src_item = *it_src;
 	items.erase(it_src);
 	
-	// target iterator can not be valid because the container was changed, so update it.
-	it_dest = find_item_iter_by_uuid(items, dest_item_id);
-	items.insert(it_dest, src_item);
+	// Note: Target iterator is not valid anymore because the container was changed, so update it.
+	it_dest = findItemIterByUUID(items, dest_item_id);
+	
+	// Go to the next element if one wishes to insert after the dest element
+	if (!insert_before)
+	{
+		++it_dest;
+	}
+	
+	// Reinsert the source item in the right place
+	if (it_dest != items.end())
+	{
+		items.insert(it_dest, src_item);
+	}
+	else 
+	{
+		// Append to the list if it_dest reached the end
+		items.push_back(src_item);
+	}
 }
 
 //* @param[in] items vector of items in order to be saved.
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index e0e81f1006..a0fd455cf3 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -332,11 +332,16 @@ protected:
 	//--------------------------------------------------------------------
 public:
 	// Changes items order by insertion of the item identified by src_item_id
-	// before the item identified by dest_item_id. Both items must exist in items array.
-	// Sorting is stored after method is finished. Only src_item_id is moved before dest_item_id.
+	// before (or after) the item identified by dest_item_id. Both items must exist in items array.
+	// Sorting is stored after method is finished. Only src_item_id is moved before (or after) dest_item_id.
+	// The parameter "insert_before" controls on which side of dest_item_id src_item_id gets rensinserted.
 	static void updateItemsOrder(LLInventoryModel::item_array_t& items, 
 								 const LLUUID& src_item_id, 
-								 const LLUUID& dest_item_id);
+								 const LLUUID& dest_item_id,
+								 bool insert_before = true);
+	// Gets an iterator on an item vector knowing only the item UUID.
+	// Returns end() of the vector if not found.
+	static LLInventoryModel::item_array_t::iterator findItemIterByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id);
 
 	// Saves current order of the passed items using inventory item sort field.
 	// Resets 'items' sort fields and saves them on server.
-- 
cgit v1.2.3


From 443d1b08b22262566dc4d476ca0bdef665518721 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Fri, 21 Oct 2011 18:51:39 -0700
Subject: EXP-1439 : Fix potential crash when the favorites bar is empty

---
 indra/newview/llfavoritesbar.cpp | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 4e0c838454..c48b809114 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -544,12 +544,16 @@ void LLFavoritesBarCtrl::handleExistingFavoriteDragAndDrop(S32 x, S32 y)
 void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, const LLUUID& favorites_id, S32 x, S32 y)
 {
 	// Identify the button hovered and the side to drop
-	LLFavoriteLandmarkButton* dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLandingTab);
-	bool insert_before = true;	
-	if (!dest)
+	LLFavoriteLandmarkButton* dest = NULL;
+	bool insert_before = true;
+	if (!mItems.empty())
 	{
-		insert_before = false;
-		dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLastTab);
+		dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLandingTab);
+		if (!dest)
+		{
+			insert_before = false;
+			dest = dynamic_cast<LLFavoriteLandmarkButton*>(mLastTab);
+		}
 	}
 	
 	// There is no need to handle if an item was dragged onto itself
-- 
cgit v1.2.3


From 338914bd7d7e776d3ca5a4eb9a579fcbe53cf1b9 Mon Sep 17 00:00:00 2001
From: Paul ProductEngine <pguslisty@productengine.com>
Date: Mon, 24 Oct 2011 14:17:15 +0200
Subject: EXP-1400 FIXED (Call request docking icon overlays other toolbar
 buttons when speak button in side toolbar)

- LLDockableFloater::getDockTongue to init dock tongue with proper image depending on floater dock side, also added images for left and right tongues.

- Added proper call floater positioning relatively to the speak button
---
 indra/llui/lldockablefloater.cpp                   |  15 ++++++-
 indra/llui/lldockablefloater.h                     |   2 +-
 indra/llui/lldockcontrol.cpp                       |  43 +++++++++++++--------
 indra/llui/lldockcontrol.h                         |   1 +
 indra/newview/llimview.cpp                         |  19 ++++++++-
 indra/newview/llimview.h                           |   5 ++-
 .../skins/default/textures/windows/Flyout_Left.png | Bin 0 -> 271 bytes
 .../default/textures/windows/Flyout_Right.png      | Bin 0 -> 280 bytes
 .../skins/default/xui/en/floater_outgoing_call.xml |   1 +
 9 files changed, 66 insertions(+), 20 deletions(-)
 create mode 100644 indra/newview/skins/default/textures/windows/Flyout_Left.png
 create mode 100644 indra/newview/skins/default/textures/windows/Flyout_Right.png

diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp
index aea58be12a..0fcd937361 100644
--- a/indra/llui/lldockablefloater.cpp
+++ b/indra/llui/lldockablefloater.cpp
@@ -239,8 +239,21 @@ void LLDockableFloater::setDockControl(LLDockControl* dockControl)
 	setDocked(isDocked());
 }
 
-const LLUIImagePtr& LLDockableFloater::getDockTongue()
+const LLUIImagePtr& LLDockableFloater::getDockTongue(LLDockControl::DocAt dock_side)
 {
+	switch(dock_side)
+	{
+	case LLDockControl::LEFT:
+		mDockTongue = LLUI::getUIImage("windows/Flyout_Left.png");
+		break;
+	case LLDockControl::RIGHT:
+		mDockTongue = LLUI::getUIImage("windows/Flyout_Right.png");
+		break;
+	default:
+		mDockTongue = LLUI::getUIImage("windows/Flyout_Pointer.png");
+		break;
+	}
+
 	return mDockTongue;
 }
 
diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h
index 1484ea3978..89c9852f4a 100644
--- a/indra/llui/lldockablefloater.h
+++ b/indra/llui/lldockablefloater.h
@@ -124,7 +124,7 @@ private:
 
 protected:
 	void setDockControl(LLDockControl* dockControl);
-	const LLUIImagePtr& getDockTongue();
+	const LLUIImagePtr& getDockTongue(LLDockControl::DocAt dock_side = LLDockControl::TOP);
 
 	// Checks if docking should be forced.
 	// It may be useful e.g. if floater created in mouselook mode (see EXT-5609)
diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp
index 6397bbd0de..8cb2e57b98 100644
--- a/indra/llui/lldockcontrol.cpp
+++ b/indra/llui/lldockcontrol.cpp
@@ -203,21 +203,33 @@ void LLDockControl::moveDockable()
 	switch (mDockAt)
 	{
 	case LEFT:
-		x = dockRect.mLeft;
-		y = dockRect.mTop + mDockTongue->getHeight() + dockableRect.getHeight();
-		// check is dockable inside root view rect
-		if (x < rootRect.mLeft)
+
+		x = dockRect.mLeft - dockableRect.getWidth();
+		y = dockRect.getCenterY() + dockableRect.getHeight() / 2;
+		
+		if (use_tongue)
 		{
-			x = rootRect.mLeft;
+			x -= mDockTongue->getWidth();
 		}
-		if (x + dockableRect.getWidth() > rootRect.mRight)
+
+		mDockTongueX = dockableRect.mRight;
+		mDockTongueY = dockableRect.getCenterY() - mDockTongue->getHeight() / 2;
+		
+		break;
+
+	case RIGHT:
+
+		x = dockRect.mRight;
+		y = dockRect.getCenterY() + dockableRect.getHeight() / 2;
+
+		if (use_tongue)
 		{
-			x = rootRect.mRight - dockableRect.getWidth();
+			x += mDockTongue->getWidth();
 		}
-		
-		mDockTongueX = x + dockableRect.getWidth()/2 - mDockTongue->getWidth() / 2;
-		
-		mDockTongueY = dockRect.mTop;
+
+		mDockTongueX = dockRect.mRight;
+		mDockTongueY = dockableRect.getCenterY() - mDockTongue->getHeight() / 2;
+
 		break;
 
 	case TOP:
@@ -315,13 +327,12 @@ void LLDockControl::moveDockable()
 		dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(),
 				dockableRect.getHeight());
 	}
+
 	LLRect localDocableParentRect;
-	mDockableFloater->getParent()->screenRectToLocal(dockableRect,
-			&localDocableParentRect);
-	mDockableFloater->setRect(localDocableParentRect);
 
-	mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY,
-			&mDockTongueX, &mDockTongueY);
+	mDockableFloater->getParent()->screenRectToLocal(dockableRect, &localDocableParentRect);
+	mDockableFloater->setRect(localDocableParentRect);
+	mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY, &mDockTongueX, &mDockTongueY);
 
 }
 
diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h
index 2e7359245f..463223fafd 100644
--- a/indra/llui/lldockcontrol.h
+++ b/indra/llui/lldockcontrol.h
@@ -43,6 +43,7 @@ public:
 	{
 		TOP,
 		LEFT,
+		RIGHT,
 		BOTTOM
 	};
 
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 33c6b2218c..c751394455 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -1681,7 +1681,8 @@ BOOL LLCallDialog::postBuild()
 		return FALSE;
 
 	LLView *anchor_panel = gToolBarView->findChildView("speak");
-	setDockControl(new LLDockControl(anchor_panel, this, getDockTongue(), LLDockControl::TOP));
+	LLDockControl::DocAt dock_pos = getDockControlPos();
+	setDockControl(new LLDockControl(anchor_panel, this, getDockTongue(dock_pos), dock_pos));
 
 	setUseTongue(anchor_panel);
 
@@ -1751,6 +1752,22 @@ void LLCallDialog::setIcon(const LLSD& session_id, const LLSD& participant_id)
 	}
 }
 
+LLDockControl::DocAt LLCallDialog::getDockControlPos()
+{
+	LLToolBar* tool_bar = NULL;
+
+	if((tool_bar = gToolBarView->getChild<LLToolBar>("toolbar_left")) && tool_bar->hasChild("speak", true))
+	{
+		return LLDockControl::RIGHT; // Speak button in the left toolbar so the call floater should be to the right of the speak button
+	}
+	else if((tool_bar = gToolBarView->getChild<LLToolBar>("toolbar_right")) && tool_bar->hasChild("speak", true))
+	{
+		return LLDockControl::LEFT; // Speak button in the right toolbar so the call floater should be to the left of the speak button
+	}
+
+	return LLDockControl::TOP;
+}
+
 bool LLCallDialog::lifetimeHasExpired()
 {
 	if (mLifetimeTimer.getStarted())
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 93b604d36a..33c7ae9e54 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -491,7 +491,7 @@ class LLCallDialog : public LLDockableFloater
 {
 public:
 	LLCallDialog(const LLSD& payload);
-	~LLCallDialog();
+	virtual ~LLCallDialog();
 
 	virtual BOOL postBuild();
 
@@ -519,6 +519,9 @@ protected:
 	void setIcon(const LLSD& session_id, const LLSD& participant_id);
 
 	LLSD mPayload;
+
+private:
+	LLDockControl::DocAt getDockControlPos();
 };
 
 class LLIncomingCallDialog : public LLCallDialog
diff --git a/indra/newview/skins/default/textures/windows/Flyout_Left.png b/indra/newview/skins/default/textures/windows/Flyout_Left.png
new file mode 100644
index 0000000000..6ac9fe2efd
Binary files /dev/null and b/indra/newview/skins/default/textures/windows/Flyout_Left.png differ
diff --git a/indra/newview/skins/default/textures/windows/Flyout_Right.png b/indra/newview/skins/default/textures/windows/Flyout_Right.png
new file mode 100644
index 0000000000..aa1f0625aa
Binary files /dev/null and b/indra/newview/skins/default/textures/windows/Flyout_Right.png differ
diff --git a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml
index 9db6568ee3..ffbb6aa28b 100644
--- a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml
+++ b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml
@@ -8,6 +8,7 @@
  layout="topleft"
  name="outgoing call"
  help_topic="outgoing_call"
+ save_dock_state="true"
  title="CALLING"
  width="410">
     <floater.string
-- 
cgit v1.2.3


From 08ee54158fe71feebaa11ebade18d45be4caf90b Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Mon, 24 Oct 2011 13:56:14 -0700
Subject: EXP-1458 FIX Chat text entry bar does not have focus when chat
 floater is opened while chat history is toggled open made expando-button
 chrome, so it doesn't steal focus

---
 indra/newview/skins/default/xui/en/floater_chat_bar.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/indra/newview/skins/default/xui/en/floater_chat_bar.xml b/indra/newview/skins/default/xui/en/floater_chat_bar.xml
index 989b4a0580..86191b789c 100644
--- a/indra/newview/skins/default/xui/en/floater_chat_bar.xml
+++ b/indra/newview/skins/default/xui/en/floater_chat_bar.xml
@@ -68,6 +68,7 @@
      image_pressed="ComboButton_UpSelected"
      image_pressed_selected="ComboButton_Selected"
      height="23"
+     chrome="true"
      name="show_nearby_chat"
      tool_tip="Shows/hides nearby chat log">
     </button>
-- 
cgit v1.2.3


From cd13933b0942ef4fdf2d4ec8f558d0ec2312b691 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Mon, 24 Oct 2011 14:14:55 -0700
Subject: EXP-1354 : Fixed. Toolbars now saved whenever changing their config
 and only if initialized correctly.

---
 indra/newview/lltoolbarview.cpp | 14 +++++++++++++-
 indra/newview/lltoolbarview.h   |  1 +
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index affa7241d1..f481455834 100644
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -73,7 +73,8 @@ LLToolBarView::LLToolBarView(const LLToolBarView::Params& p)
 	mToolbarRight(NULL),
 	mToolbarBottom(NULL),
 	mDragStarted(false),
-	mDragToolbarButton(NULL)
+	mDragToolbarButton(NULL),
+	mToolbarsLoaded(false)
 {
 }
 
@@ -244,6 +245,7 @@ bool LLToolBarView::loadToolbars(bool force_default)
 			}
 		}
 	}
+	mToolbarsLoaded = true;
 	return true;
 }
 
@@ -255,6 +257,10 @@ bool LLToolBarView::loadDefaultToolbars()
 	if (gToolBarView)
 	{
 		retval = gToolBarView->loadToolbars(true);
+		if (retval)
+		{
+			gToolBarView->saveToolbars();
+		}
 	}
 
 	return retval;
@@ -262,6 +268,9 @@ bool LLToolBarView::loadDefaultToolbars()
 
 void LLToolBarView::saveToolbars() const
 {
+	if (!mToolbarsLoaded)
+		return;
+	
 	// Build the parameter tree from the toolbar data
 	LLToolBarView::ToolbarSet toolbar_set;
 	if (mToolbarLeft)
@@ -460,6 +469,9 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t
 				int new_rank = toolbar->getRankFromPosition(x,y);
 				toolbar->addCommand(command_id, new_rank);
 			}
+			
+			// Save the new toolbars configuration
+			gToolBarView->saveToolbars();
 		}
 		else
 		{
diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h
index 8cafbc9308..ea14e471cd 100644
--- a/indra/newview/lltoolbarview.h
+++ b/indra/newview/lltoolbarview.h
@@ -100,6 +100,7 @@ private:
 	LLToolBar*	mToolbarLeft;
 	LLToolBar*	mToolbarRight;
 	LLToolBar*	mToolbarBottom;
+	bool		mToolbarsLoaded;
 	
 	bool				mDragStarted;
 	LLToolBarButton*	mDragToolbarButton;
-- 
cgit v1.2.3


From 399de4f345eb0bf43e84bf0a65b3251798f59a13 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Mon, 24 Oct 2011 14:28:09 -0700
Subject: EXP-1454 FIX People floater 'cascades' as if opening a new window
 while looking at group profiles

---
 indra/llui/llfloater.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 7100ea13a7..2c707afa8f 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -935,7 +935,7 @@ void LLFloater::applyPositioning(LLFloater* other)
 
 	case LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP:
 	case LLFloaterEnums::OPEN_POSITIONING_CASCADING:
-		if (other != NULL)
+		if (other != NULL && other != this)
 		{
 			stackWith(*other);
 		}
-- 
cgit v1.2.3


From b3c1e967ee9aa1b19622fe7b40e73417ac931b1d Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Mon, 24 Oct 2011 15:42:07 -0700
Subject: EXP-1354 : FIX. Force loading the default toolbars if the user
 toolbar loading fails somewhat.

---
 indra/newview/lltoolbarview.cpp | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index f481455834..9eea49914f 100644
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -151,6 +151,7 @@ bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar)
 bool LLToolBarView::loadToolbars(bool force_default)
 {
 	LLToolBarView::ToolbarSet toolbar_set;
+	bool err = false;
 	
 	// Load the toolbars.xml file
 	std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml");
@@ -165,24 +166,39 @@ bool LLToolBarView::loadToolbars(bool force_default)
 	}
 	
 	LLXMLNodePtr root;
-	if(!LLXMLNode::parseFile(toolbar_file, root, NULL))
+	if (!LLXMLNode::parseFile(toolbar_file, root, NULL))
 	{
 		llwarns << "Unable to load toolbars from file: " << toolbar_file << llendl;
-		return false;
+		err = true;
 	}
-	if(!root->hasName("toolbars"))
+	
+	if (!err && !root->hasName("toolbars"))
 	{
 		llwarns << toolbar_file << " is not a valid toolbars definition file" << llendl;
-		return false;
+		err = true;
 	}
 	
 	// Parse the toolbar settings
 	LLXUIParser parser;
-	parser.readXUI(root, toolbar_set, toolbar_file);
-	if (!toolbar_set.validateBlock())
+	if (!err)
 	{
-		llerrs << "Unable to validate toolbars from file: " << toolbar_file << llendl;
-		return false;
+		parser.readXUI(root, toolbar_set, toolbar_file);
+	}
+	if (!err && !toolbar_set.validateBlock())
+	{
+		llwarns << "Unable to validate toolbars from file: " << toolbar_file << llendl;
+		err = true;
+	}
+	
+	if (err)
+	{
+		if (force_default)
+		{
+			llerrs << "Unable to load toolbars from default file : " << toolbar_file << llendl;
+			return false;
+		}
+		// Try to load the default toolbars
+		return loadToolbars(true);
 	}
 	
 	// Clear the toolbars now before adding the loaded commands and settings
-- 
cgit v1.2.3


From 4af2cc2e743a79944df6aef6d209ea8b8a1c33e2 Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Mon, 24 Oct 2011 15:52:50 -0700
Subject: EXP-1421 FIX -- Linden Dollars Still visually looks like a button.

* L$ background color now matches the menu bar.  The tooltip and click behavior
  have been left untouched, per design.
---
 indra/newview/skins/default/xui/en/panel_status_bar.xml | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml
index 422bbada7f..b321e0162e 100644
--- a/indra/newview/skins/default/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml
@@ -2,7 +2,7 @@
 <panel
  background_opaque="true"
  background_visible="true"
- bg_opaque_color="MouseGray"
+ bg_opaque_color="DkGray"
  chrome="true"
  follows="top|right"
  height="19"
@@ -38,23 +38,20 @@
     left="-370"
     width="160"
     top="1"
-    follows="right|top" 
-    name="balance_bg" 
-    bg_visible="true"
-    background_opaque="true" 
-    bg_opaque_image="bevel_background">
+    follows="right|top"
+    name="balance_bg">
     <text
      halign="center"
      font="SansSerifSmall"
      follows="all"
      height="18"
-     left="0" 
+     left="0"
      name="balance"
      tool_tip="Click to refresh your L$ balance"
      v_pad="4"
      top="0"
-     wrap="false" 
-     value="L$20" 
+     wrap="false"
+     value="L$20"
      width="40" />
     <button
      halign="center"
-- 
cgit v1.2.3


From 28fc98dea3b65e986c0fd8ffa71a81d2db7fb700 Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Mon, 24 Oct 2011 15:53:50 -0700
Subject: EXP-1453 FIX -- Toybox labels differ in menus and titles

* All text updated to read "Toolbar buttons" in the appropriate ways.
---
 indra/newview/skins/default/xui/en/floater_toybox.xml | 2 +-
 indra/newview/skins/default/xui/en/menu_toolbars.xml  | 2 +-
 indra/newview/skins/default/xui/en/menu_viewer.xml    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml
index c7e09bf45e..ef3951a1cd 100644
--- a/indra/newview/skins/default/xui/en/floater_toybox.xml
+++ b/indra/newview/skins/default/xui/en/floater_toybox.xml
@@ -13,7 +13,7 @@
   open_positioning="centered"
   save_rect="true"
   single_instance="true"
-  title="CUSTOMIZE TOOLBARS"
+  title="TOOLBAR BUTTONS"
   width="650">
   <text
     follows="left|top"
diff --git a/indra/newview/skins/default/xui/en/menu_toolbars.xml b/indra/newview/skins/default/xui/en/menu_toolbars.xml
index 59912b5503..7384114d7d 100644
--- a/indra/newview/skins/default/xui/en/menu_toolbars.xml
+++ b/indra/newview/skins/default/xui/en/menu_toolbars.xml
@@ -3,7 +3,7 @@
       layout="topleft"
       name="Toolbars Popup"
       visible="false">
-  <menu_item_call label="Choose buttons..."
+  <menu_item_call label="Toolbar buttons..."
                   layout="topleft"
                   name="Chose Buttons">
     <menu_item_call.on_click function="Floater.Show"
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 63e50b0b9f..58f6a3251f 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -166,7 +166,7 @@
              parameter="preferences" />
         </menu_item_call>
          <menu_item_call
-         label="Toolbars..."
+         label="Toolbar buttons..."
          name="Toolbars"
          shortcut="control|T">
             <menu_item_call.on_click
-- 
cgit v1.2.3


From 54b16e06a649808cc3bbc94cbe9e9b74211c99f6 Mon Sep 17 00:00:00 2001
From: callum <none@none>
Date: Mon, 24 Oct 2011 16:26:17 -0700
Subject: EXP-1455 Ctrl-Shift-I no longer opens a second inventory window

---
 indra/newview/llpanelmaininventory.cpp             | 2 +-
 indra/newview/llviewermenu.cpp                     | 5 +++++
 indra/newview/skins/default/xui/en/menu_viewer.xml | 9 +++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index d6c407d548..9944b51902 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -111,7 +111,7 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p)
 	mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH));
 	mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND));
 	mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&LLPanelMainInventory::doCreate, this, _2));
- 	mCommitCallbackRegistrar.add("Inventory.NewWindow", boost::bind(&LLPanelMainInventory::newWindow, this));
+ 	//mCommitCallbackRegistrar.add("Inventory.NewWindow", boost::bind(&LLPanelMainInventory::newWindow, this));
 	mCommitCallbackRegistrar.add("Inventory.ShowFilters", boost::bind(&LLPanelMainInventory::toggleFindOptions, this));
 	mCommitCallbackRegistrar.add("Inventory.ResetFilters", boost::bind(&LLPanelMainInventory::resetFilters, this));
 	mCommitCallbackRegistrar.add("Inventory.SetSortBy", boost::bind(&LLPanelMainInventory::setSortBy, this, _2));
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 2345fbfd6a..e32716eca4 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -7962,6 +7962,9 @@ void initialize_menus()
 
 	view_listener_t::addEnable(new LLUploadCostCalculator(), "Upload.CalculateCosts");
 
+
+	commit.add("Inventory.NewWindow", boost::bind(&LLFloaterInventory::showAgentInventory));
+
 	// Agent
 	commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying));
 	enable.add("Agent.enableFlying", boost::bind(&LLAgent::enableFlying));
@@ -8337,6 +8340,8 @@ void initialize_menus()
 	view_listener_t::addMenu(new LLGoToObject(), "GoToObject");
 	commit.add("PayObject", boost::bind(&handle_give_money_dialog));
 
+	commit.add("Inventory.NewWindow", boost::bind(&LLFloaterInventory::showAgentInventory));
+
 	enable.add("EnablePayObject", boost::bind(&enable_pay_object));
 	enable.add("EnablePayAvatar", boost::bind(&enable_pay_avatar));
 	enable.add("EnableEdit", boost::bind(&enable_object_edit));
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 63e50b0b9f..9afe791372 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -43,6 +43,15 @@
          function="Floater.Toggle"
          parameter="inventory" />
       </menu_item_check>
+      <menu_item_call
+       label="New Inventory Window"
+       name="NewInventoryWindow"
+       shortcut="control|shift|I"
+       visible="false">
+        <menu_item_call.on_click
+         function="Inventory.NewWindow"
+         parameter="" />
+      </menu_item_call>
       <menu_item_check
        label="Gestures..."
        name="Gestures"
-- 
cgit v1.2.3


From 8d6e7fa02c0d5cd18f91ac6862079ff4fa0719d4 Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Mon, 24 Oct 2011 16:49:00 -0700
Subject: * Fixed destination guide floater to display on login based on per
 account   "DisplayDestinationsOnInitialRun" setting or initial agent SL
 login. * Added toolbar enumeration for toolbar view so queries for commands
 can now   indicate where the command currently is on the left, right or
 bottom toolbars. * Updated toybox toolbar button tooltips to indicate where
 the command currently   resides in the view. * Added unused function to allow
 toolbar buttons to be changed to flash   indefinitely.

Reviewed by Richard.
---
 indra/llui/lltoolbar.cpp                           |  61 +++--
 indra/llui/lltoolbar.h                             |  19 +-
 .../newview/app_settings/settings_per_account.xml  |  11 +
 indra/newview/llfloatertoybox.cpp                  |  30 ++-
 indra/newview/llfloatertoybox.h                    |   2 +
 indra/newview/lltoolbarview.cpp                    | 264 ++++++++++++---------
 indra/newview/lltoolbarview.h                      |  36 ++-
 indra/newview/skins/default/xui/en/strings.xml     |   6 +-
 .../skins/default/xui/en/widgets/toolbar.xml       |   4 +
 9 files changed, 295 insertions(+), 138 deletions(-)

diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index b0a072c00e..97dc1e3316 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -113,6 +113,7 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
 	mHandleDragItemCallback(NULL),
 	mHandleDropCallback(NULL),
 	mButtonAddSignal(NULL),
+	mButtonEnterSignal(NULL),
 	mDragAndDropTarget(false)
 {
 	mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text;
@@ -123,6 +124,7 @@ LLToolBar::~LLToolBar()
 {
 	delete mPopupMenuHandle.get();
 	delete mButtonAddSignal;
+	delete mButtonEnterSignal;
 }
 
 void LLToolBar::createContextMenu()
@@ -358,6 +360,23 @@ bool LLToolBar::stopCommandInProgress(const LLCommandId& commandId)
 	return (command_button != NULL);
 }
 
+bool LLToolBar::flashCommand(const LLCommandId& commandId, bool flash)
+{
+	LLButton * command_button = NULL;
+
+	if (commandId != LLCommandId::null)
+	{
+		command_id_map::iterator it = mButtonMap.find(commandId.uuid());
+		if (it != mButtonMap.end())
+		{
+			command_button = it->second;
+			command_button->setFlashing(flash ? TRUE : FALSE);
+		}
+	}
+
+	return (command_button != NULL);
+}
+
 BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
 {
 	LLRect button_panel_rect;
@@ -876,8 +895,7 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
 			button->setCommitCallback(executeParam);
 		}
 
-
-
+		// Set up "is running" query callback
 		const std::string& isRunningFunction = commandp->isRunningFunctionName();
 		if (isRunningFunction.length() > 0)
 		{
@@ -904,12 +922,18 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
 	return button;
 }
 
-boost::signals2::connection LLToolBar::setButtonAddCallback(const button_add_signal_t::slot_type& cb)
+boost::signals2::connection LLToolBar::setButtonAddCallback(const button_signal_t::slot_type& cb)
 {
-	if (!mButtonAddSignal) mButtonAddSignal = new button_add_signal_t();
+	if (!mButtonAddSignal) mButtonAddSignal = new button_signal_t();
 	return mButtonAddSignal->connect(cb);
 }
 
+boost::signals2::connection LLToolBar::setButtonEnterCallback(const button_signal_t::slot_type& cb)
+{
+	if (!mButtonEnterSignal) mButtonEnterSignal = new button_signal_t();
+	return mButtonEnterSignal->connect(cb);
+}
+
 BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 										EDragAndDropType cargo_type,
 										void* cargo_data,
@@ -981,8 +1005,6 @@ LLToolBarButton::LLToolBarButton(const Params& p)
 	mOriginalImageOverlayColor(p.image_overlay_color),
 	mOriginalImageOverlaySelectedColor(p.image_overlay_selected_color)
 {
-	mButtonFlashRate = 0.0;
-	mButtonFlashCount = 0;
 }
 
 LLToolBarButton::~LLToolBarButton()
@@ -1024,6 +1046,7 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask)
 	{
 		handled = LLButton::handleHover(x, y, mask);
 	}
+
 	return handled;
 }
 
@@ -1036,6 +1059,12 @@ void LLToolBarButton::onMouseEnter(S32 x, S32 y, MASK mask)
 	{
 		mNeedsHighlight = TRUE;
 	}
+
+	LLToolBar* parent_toolbar = getParentByType<LLToolBar>();
+	if (parent_toolbar && parent_toolbar->mButtonEnterSignal)
+	{
+		(*(parent_toolbar->mButtonEnterSignal))(this);
+	}
 }
 
 void LLToolBarButton::onMouseCaptureLost()
@@ -1084,25 +1113,25 @@ void LLToolBarButton::setEnabled(BOOL enabled)
 	}
 }
 
-
 const std::string LLToolBarButton::getToolTip() const	
 { 
 	std::string tooltip;
+
 	if (labelIsTruncated() || getCurrentLabel().empty())
 	{
-		return LLTrans::getString(LLCommandManager::instance().getCommand(mId)->labelRef()) + " -- " + LLView::getToolTip();
+		tooltip = LLTrans::getString(LLCommandManager::instance().getCommand(mId)->labelRef()) + " -- " + LLView::getToolTip();
 	}
 	else
 	{
-		return LLView::getToolTip();
+		tooltip = LLView::getToolTip();
 	}
-}
-
-
-
-
-
-
 
+	LLToolBar* parent_toolbar = getParentByType<LLToolBar>();
+	if (parent_toolbar && parent_toolbar->mButtonTooltipSuffix.length() > 0)
+	{
+		tooltip = tooltip + "\n(" + parent_toolbar->mButtonTooltipSuffix + ")";
+	}
 
+	return tooltip;
+}
 
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index 68fc44ee8e..7ceb75aeed 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -120,6 +120,8 @@ namespace LLToolBarEnums
 		SIDE_RIGHT,
 		SIDE_TOP,
 	};
+
+	LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType);
 }
 
 // NOTE: This needs to occur before Param block declaration for proper compilation.
@@ -142,6 +144,7 @@ namespace LLInitParam
 class LLToolBar
 :	public LLUICtrl
 {
+	friend class LLToolBarButton;
 public:
 	struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
 	{
@@ -187,6 +190,7 @@ public:
 	bool hasCommand(const LLCommandId& commandId) const;
 	bool enableCommand(const LLCommandId& commandId, bool enabled);
 	bool stopCommandInProgress(const LLCommandId& commandId);
+	bool flashCommand(const LLCommandId& commandId, bool flash);
 
 	void setStartDragCallback(tool_startdrag_callback_t cb)   { mStartDragItemCallback  = cb; }
 	void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
@@ -195,9 +199,13 @@ public:
 
 	LLToolBarButton* createButton(const LLCommandId& id);
 
-	typedef boost::signals2::signal<void (LLView* button)> button_add_signal_t;
-	boost::signals2::connection setButtonAddCallback(const button_add_signal_t::slot_type& cb);
+	typedef boost::signals2::signal<void (LLView* button)> button_signal_t;
+	boost::signals2::connection setButtonAddCallback(const button_signal_t::slot_type& cb);
+	boost::signals2::connection setButtonEnterCallback(const button_signal_t::slot_type& cb);
+
+	void setTooltipButtonSuffix(const std::string& suffix) { mButtonTooltipSuffix = suffix; }
 
+	LLToolBarEnums::SideType getSideType() const { return mSideType; }
 	bool hasButtons() const { return !mButtons.empty(); }
 	bool isModified() const { return mModified; }
 
@@ -257,9 +265,12 @@ private:
 
 	LLToolBarButton::Params			mButtonParams[LLToolBarEnums::BTNTYPE_COUNT];
 
-	LLHandle<class LLContextMenu>			mPopupMenuHandle;
+	LLHandle<class LLContextMenu>	mPopupMenuHandle;
+
+	button_signal_t*				mButtonAddSignal;
+	button_signal_t*				mButtonEnterSignal;
 
-	button_add_signal_t*			mButtonAddSignal;
+	std::string						mButtonTooltipSuffix;
 };
 
 
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index d8295ddb87..6ed4480cb1 100644
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -33,6 +33,17 @@
         <key>Value</key>
             <string />
         </map>
+    <key>DisplayDestinationsOnInitialRun</key>
+        <map>
+        <key>Comment</key>
+          <string>Display the destinations guide when a user first launches FUI.</string>
+        <key>Persist</key>
+          <integer>1</integer>
+        <key>Type</key>
+          <string>Boolean</string>
+        <key>Value</key>
+          <integer>1</integer>
+        </map>
     <key>LastInventoryInboxActivity</key>
         <map>
         <key>Comment</key>
diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp
index 66f644748e..f527937e8f 100644
--- a/indra/newview/llfloatertoybox.cpp
+++ b/indra/newview/llfloatertoybox.cpp
@@ -63,6 +63,7 @@ BOOL LLFloaterToybox::postBuild()
 	mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
 	mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
 	mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
+	mToolBar->setButtonEnterCallback(boost::bind(&LLFloaterToybox::onToolBarButtonEnter,this,_1));
 	
 	//
 	// Sort commands by localized labels so they will appear alphabetized in all languages
@@ -105,8 +106,8 @@ void LLFloaterToybox::draw()
 	{
 		const LLCommandId& id = *it;
 
-		const bool commandOnToolbar = gToolBarView->hasCommand(id);
-		mToolBar->enableCommand(id, !commandOnToolbar);
+		const bool command_not_present = (gToolBarView->hasCommand(id) == LLToolBarView::TOOLBAR_NONE);
+		mToolBar->enableCommand(id, command_not_present);
 	}
 
 	LLFloater::draw();
@@ -140,5 +141,30 @@ BOOL LLFloaterToybox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 	return mToolBar->handleDragAndDrop(local_x, local_y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
 }
 
+void LLFloaterToybox::onToolBarButtonEnter(LLView* button)
+{
+	std::string suffix = "";
+
+	LLCommandId commandId(button->getName());
+	LLCommand* command = LLCommandManager::instance().getCommand(commandId);
+
+	if (command)
+	{
+		S32 command_loc = gToolBarView->hasCommand(commandId);
+
+		switch(command_loc)
+		{
+		case LLToolBarView::TOOLBAR_BOTTOM:	suffix = LLTrans::getString("Toolbar_Bottom_Tooltip");	break;
+		case LLToolBarView::TOOLBAR_LEFT:	suffix = LLTrans::getString("Toolbar_Left_Tooltip");	break;
+		case LLToolBarView::TOOLBAR_RIGHT:	suffix = LLTrans::getString("Toolbar_Right_Tooltip");	break;
+
+		default:
+			break;
+		}
+	}
+
+	mToolBar->setTooltipButtonSuffix(suffix);
+}
+
 
 // eof
diff --git a/indra/newview/llfloatertoybox.h b/indra/newview/llfloatertoybox.h
index 62bf68680d..6f0275b8fe 100644
--- a/indra/newview/llfloatertoybox.h
+++ b/indra/newview/llfloatertoybox.h
@@ -52,6 +52,8 @@ public:
 protected:
 	void onBtnRestoreDefaults();
 
+	void onToolBarButtonEnter(LLView* button);
+
 public:
 	LLToolBar *	mToolBar;
 };
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index 9eea49914f..8f4f7d405f 100644
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -69,13 +69,14 @@ LLToolBarView::ToolbarSet::ToolbarSet()
 
 LLToolBarView::LLToolBarView(const LLToolBarView::Params& p)
 :	LLUICtrl(p),
-	mToolbarLeft(NULL),
-	mToolbarRight(NULL),
-	mToolbarBottom(NULL),
 	mDragStarted(false),
 	mDragToolbarButton(NULL),
 	mToolbarsLoaded(false)
 {
+	for (S32 i = 0; i < TOOLBAR_COUNT; i++)
+	{
+		mToolbars[i] = NULL;
+	}
 }
 
 void LLToolBarView::initFromParams(const LLToolBarView::Params& p)
@@ -91,49 +92,99 @@ LLToolBarView::~LLToolBarView()
 
 BOOL LLToolBarView::postBuild()
 {
-	mToolbarLeft   = getChild<LLToolBar>("toolbar_left");
-	mToolbarRight  = getChild<LLToolBar>("toolbar_right");
-	mToolbarBottom = getChild<LLToolBar>("toolbar_bottom");
-
-	mToolbarLeft->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
-	mToolbarLeft->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
-	mToolbarLeft->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
-	mToolbarLeft->setButtonAddCallback(boost::bind(LLToolBarView::onToolBarButtonAdded, _1));
-	
-	mToolbarRight->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
-	mToolbarRight->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
-	mToolbarRight->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
-	mToolbarRight->setButtonAddCallback(boost::bind(LLToolBarView::onToolBarButtonAdded, _1));
-	
-	mToolbarBottom->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
-	mToolbarBottom->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
-	mToolbarBottom->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
-	mToolbarBottom->setButtonAddCallback(boost::bind(LLToolBarView::onToolBarButtonAdded, _1));
+	mToolbars[TOOLBAR_LEFT]   = getChild<LLToolBar>("toolbar_left");
+	mToolbars[TOOLBAR_RIGHT]  = getChild<LLToolBar>("toolbar_right");
+	mToolbars[TOOLBAR_BOTTOM] = getChild<LLToolBar>("toolbar_bottom");
+
+	for (int i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+	{
+		mToolbars[i]->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3));
+		mToolbars[i]->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
+		mToolbars[i]->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
+		mToolbars[i]->setButtonAddCallback(boost::bind(LLToolBarView::onToolBarButtonAdded,_1));
+	}
 
 	LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&handleLoginToolbarSetup));
 	
 	return TRUE;
 }
 
-bool LLToolBarView::hasCommand(const LLCommandId& commandId) const
+S32 LLToolBarView::hasCommand(const LLCommandId& commandId) const
 {
-	bool has_command = false;
-	if (mToolbarLeft && !has_command)
+	S32 command_location = TOOLBAR_NONE;
+
+	for (S32 loc = TOOLBAR_FIRST; loc <= TOOLBAR_LAST; loc++)
 	{
-		has_command = mToolbarLeft->hasCommand(commandId);
+		if (mToolbars[loc]->hasCommand(commandId))
+		{
+			command_location = loc;
+			break;
+		}
 	}
-	if (mToolbarRight && !has_command)
+
+	return command_location;
+}
+
+S32 LLToolBarView::addCommand(const LLCommandId& commandId, EToolBarLocation toolbar, int rank)
+{
+	int old_rank;
+	removeCommand(commandId, old_rank);
+
+	S32 command_location = mToolbars[toolbar]->addCommand(commandId, rank);
+
+	return command_location;
+}
+
+S32 LLToolBarView::removeCommand(const LLCommandId& commandId, int& rank)
+{
+	S32 command_location = hasCommand(commandId);
+	rank = LLToolBar::RANK_NONE;
+
+	if (command_location != TOOLBAR_NONE)
+	{
+		rank = mToolbars[command_location]->removeCommand(commandId);
+	}
+
+	return command_location;
+}
+
+S32 LLToolBarView::enableCommand(const LLCommandId& commandId, bool enabled)
+{
+	S32 command_location = hasCommand(commandId);
+
+	if (command_location != TOOLBAR_NONE)
 	{
-		has_command = mToolbarRight->hasCommand(commandId);
+		mToolbars[command_location]->enableCommand(commandId, enabled);
 	}
-	if (mToolbarBottom && !has_command)
+
+	return command_location;
+}
+
+S32 LLToolBarView::stopCommandInProgress(const LLCommandId& commandId)
+{
+	S32 command_location = hasCommand(commandId);
+
+	if (command_location != TOOLBAR_NONE)
+	{
+		mToolbars[command_location]->stopCommandInProgress(commandId);
+	}
+
+	return command_location;
+}
+
+S32 LLToolBarView::flashCommand(const LLCommandId& commandId, bool flash)
+{
+	S32 command_location = hasCommand(commandId);
+
+	if (command_location != TOOLBAR_NONE)
 	{
-		has_command = mToolbarBottom->hasCommand(commandId);
+		mToolbars[command_location]->flashCommand(commandId, flash);
 	}
-	return has_command;
+
+	return command_location;
 }
 
-bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar)
+bool LLToolBarView::addCommandInternal(const LLCommandId& command, LLToolBar* toolbar)
 {
 	LLCommandManager& mgr = LLCommandManager::instance();
 	if (mgr.getCommand(command))
@@ -166,7 +217,7 @@ bool LLToolBarView::loadToolbars(bool force_default)
 	}
 	
 	LLXMLNodePtr root;
-	if (!LLXMLNode::parseFile(toolbar_file, root, NULL))
+	if(!LLXMLNode::parseFile(toolbar_file, root, NULL))
 	{
 		llwarns << "Unable to load toolbars from file: " << toolbar_file << llendl;
 		err = true;
@@ -182,7 +233,7 @@ bool LLToolBarView::loadToolbars(bool force_default)
 	LLXUIParser parser;
 	if (!err)
 	{
-		parser.readXUI(root, toolbar_set, toolbar_file);
+	parser.readXUI(root, toolbar_set, toolbar_file);
 	}
 	if (!err && !toolbar_set.validateBlock())
 	{
@@ -195,69 +246,64 @@ bool LLToolBarView::loadToolbars(bool force_default)
 		if (force_default)
 		{
 			llerrs << "Unable to load toolbars from default file : " << toolbar_file << llendl;
-			return false;
-		}
+		return false;
+	}
 		// Try to load the default toolbars
 		return loadToolbars(true);
 	}
 	
 	// Clear the toolbars now before adding the loaded commands and settings
-	if (mToolbarLeft)
-	{
-		mToolbarLeft->clearCommandsList();
-	}
-	if (mToolbarRight)
-	{
-		mToolbarRight->clearCommandsList();
-	}
-	if (mToolbarBottom)
+	for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
 	{
-		mToolbarBottom->clearCommandsList();
+		if (mToolbars[i])
+		{
+			mToolbars[i]->clearCommandsList();
+		}
 	}
 	
 	// Add commands to each toolbar
-	if (toolbar_set.left_toolbar.isProvided() && mToolbarLeft)
+	if (toolbar_set.left_toolbar.isProvided() && mToolbars[TOOLBAR_LEFT])
 	{
 		if (toolbar_set.left_toolbar.button_display_mode.isProvided())
 		{
 			LLToolBarEnums::ButtonType button_type = toolbar_set.left_toolbar.button_display_mode;
-			mToolbarLeft->setButtonType(button_type);
+			mToolbars[TOOLBAR_LEFT]->setButtonType(button_type);
 		}
-		BOOST_FOREACH(const LLCommandId::Params& command_name_param, toolbar_set.left_toolbar.commands)
+		BOOST_FOREACH(const LLCommandId::Params& command_params, toolbar_set.left_toolbar.commands)
 		{
-			if (addCommand(LLCommandId(command_name_param), mToolbarLeft) == false)
+			if (addCommandInternal(LLCommandId(command_params), mToolbars[TOOLBAR_LEFT]))
 			{
-				llwarns << "Error adding command '" << command_name_param.name() << "' to left toolbar." << llendl;
+				llwarns << "Error adding command '" << command_params.name() << "' to left toolbar." << llendl;
 			}
 		}
 	}
-	if (toolbar_set.right_toolbar.isProvided() && mToolbarRight)
+	if (toolbar_set.right_toolbar.isProvided() && mToolbars[TOOLBAR_RIGHT])
 	{
 		if (toolbar_set.right_toolbar.button_display_mode.isProvided())
 		{
 			LLToolBarEnums::ButtonType button_type = toolbar_set.right_toolbar.button_display_mode;
-			mToolbarRight->setButtonType(button_type);
+			mToolbars[TOOLBAR_RIGHT]->setButtonType(button_type);
 		}
-		BOOST_FOREACH(const LLCommandId::Params& command_name_param, toolbar_set.right_toolbar.commands)
+		BOOST_FOREACH(const LLCommandId::Params& command_params, toolbar_set.right_toolbar.commands)
 		{
-			if (addCommand(LLCommandId(command_name_param), mToolbarRight) == false)
+			if (addCommandInternal(LLCommandId(command_params), mToolbars[TOOLBAR_RIGHT]))
 			{
-				llwarns << "Error adding command '" << command_name_param.name() << "' to right toolbar." << llendl;
+				llwarns << "Error adding command '" << command_params.name() << "' to right toolbar." << llendl;
 			}
 		}
 	}
-	if (toolbar_set.bottom_toolbar.isProvided() && mToolbarBottom)
+	if (toolbar_set.bottom_toolbar.isProvided() && mToolbars[TOOLBAR_BOTTOM])
 	{
 		if (toolbar_set.bottom_toolbar.button_display_mode.isProvided())
 		{
 			LLToolBarEnums::ButtonType button_type = toolbar_set.bottom_toolbar.button_display_mode;
-			mToolbarBottom->setButtonType(button_type);
+			mToolbars[TOOLBAR_BOTTOM]->setButtonType(button_type);
 		}
-		BOOST_FOREACH(const LLCommandId::Params& command_name_param, toolbar_set.bottom_toolbar.commands)
+		BOOST_FOREACH(const LLCommandId::Params& command_params, toolbar_set.bottom_toolbar.commands)
 		{
-			if (addCommand(LLCommandId(command_name_param), mToolbarBottom) == false)
+			if (addCommandInternal(LLCommandId(command_params), mToolbars[TOOLBAR_BOTTOM]))
 			{
-				llwarns << "Error adding command '" << command_name_param.name() << "' to bottom toolbar." << llendl;
+				llwarns << "Error adding command '" << command_params.name() << "' to bottom toolbar." << llendl;
 			}
 		}
 	}
@@ -289,20 +335,20 @@ void LLToolBarView::saveToolbars() const
 	
 	// Build the parameter tree from the toolbar data
 	LLToolBarView::ToolbarSet toolbar_set;
-	if (mToolbarLeft)
+	if (mToolbars[TOOLBAR_LEFT])
 	{
-		toolbar_set.left_toolbar.button_display_mode = mToolbarLeft->getButtonType();
-		addToToolset(mToolbarLeft->getCommandsList(),toolbar_set.left_toolbar);
+		toolbar_set.left_toolbar.button_display_mode = mToolbars[TOOLBAR_LEFT]->getButtonType();
+		addToToolset(mToolbars[TOOLBAR_LEFT]->getCommandsList(), toolbar_set.left_toolbar);
 	}
-	if (mToolbarRight)
+	if (mToolbars[TOOLBAR_RIGHT])
 	{
-		toolbar_set.right_toolbar.button_display_mode = mToolbarRight->getButtonType();
-		addToToolset(mToolbarRight->getCommandsList(),toolbar_set.right_toolbar);
+		toolbar_set.right_toolbar.button_display_mode = mToolbars[TOOLBAR_RIGHT]->getButtonType();
+		addToToolset(mToolbars[TOOLBAR_RIGHT]->getCommandsList(), toolbar_set.right_toolbar);
 	}
-	if (mToolbarBottom)
+	if (mToolbars[TOOLBAR_BOTTOM])
 	{
-		toolbar_set.bottom_toolbar.button_display_mode = mToolbarBottom->getButtonType();
-		addToToolset(mToolbarBottom->getCommandsList(),toolbar_set.bottom_toolbar);
+		toolbar_set.bottom_toolbar.button_display_mode = mToolbars[TOOLBAR_BOTTOM]->getButtonType();
+		addToToolset(mToolbars[TOOLBAR_BOTTOM]->getCommandsList(), toolbar_set.bottom_toolbar);
 	}
 	
 	// Serialize the parameter tree
@@ -361,33 +407,36 @@ void LLToolBarView::onToolBarButtonAdded(LLView* button)
 
 void LLToolBarView::draw()
 {
-	//LLPanel* sizer_left = getChild<LLPanel>("sizer_left");
+	LLRect toolbar_rects[TOOLBAR_COUNT];
 	
-	LLRect bottom_rect, left_rect, right_rect;
-
-	if (mToolbarBottom) 
-	{
-		mToolbarBottom->getParent()->reshape(mToolbarBottom->getParent()->getRect().getWidth(), mToolbarBottom->getRect().getHeight());
-		mToolbarBottom->localRectToOtherView(mToolbarBottom->getLocalRect(), &bottom_rect, this);
-	}
-	if (mToolbarLeft)   
+	for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
 	{
-		mToolbarLeft->getParent()->reshape(mToolbarLeft->getRect().getWidth(), mToolbarLeft->getParent()->getRect().getHeight());
-		mToolbarLeft->localRectToOtherView(mToolbarLeft->getLocalRect(), &left_rect, this);
-	}
-	if (mToolbarRight)  
-	{
-		mToolbarRight->getParent()->reshape(mToolbarRight->getRect().getWidth(), mToolbarRight->getParent()->getRect().getHeight());
-		mToolbarRight->localRectToOtherView(mToolbarRight->getLocalRect(), &right_rect, this);
+		if (mToolbars[i])
+		{
+			LLLayoutStack::ELayoutOrientation orientation = LLToolBarEnums::getOrientation(mToolbars[i]->getSideType());
+
+			if (orientation == LLLayoutStack::HORIZONTAL)
+			{
+				mToolbars[i]->getParent()->reshape(mToolbars[i]->getParent()->getRect().getWidth(), mToolbars[i]->getRect().getHeight());
+			}
+			else
+			{
+				mToolbars[i]->getParent()->reshape(mToolbars[i]->getRect().getWidth(), mToolbars[i]->getParent()->getRect().getHeight());
+			}
+
+			mToolbars[i]->localRectToOtherView(mToolbars[i]->getLocalRect(), &toolbar_rects[i], this);
+		}
 	}
 	
 	// Draw drop zones if drop of a tool is active
 	if (isToolDragged())
 	{
 		LLColor4 drop_color = LLUIColorTable::instance().getColor( "ToolbarDropZoneColor" );
-		gl_rect_2d(bottom_rect, drop_color, TRUE);
-		gl_rect_2d(left_rect, drop_color, TRUE);
-		gl_rect_2d(right_rect, drop_color, TRUE);
+
+		for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+		{
+			gl_rect_2d(toolbar_rects[i], drop_color, TRUE);
+		}
 	}
 	
 	LLUICtrl::draw();
@@ -399,9 +448,9 @@ void LLToolBarView::draw()
 // ----------------------------------------
 
 
-void LLToolBarView::startDragTool(S32 x, S32 y, LLToolBarButton* button)
+void LLToolBarView::startDragTool(S32 x, S32 y, LLToolBarButton* toolbarButton)
 {
-	resetDragTool(button);
+	resetDragTool(toolbarButton);
 
 	// Flag the tool dragging but don't start it yet
 	LLToolDragAndDrop::getInstance()->setDragStart( x, y );
@@ -427,9 +476,7 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp
 
 			// Second, stop the command if it is in progress and requires stopping!
 			LLCommandId command_id = LLCommandId(uuid);
-			gToolBarView->mToolbarLeft->stopCommandInProgress(command_id);
-			gToolBarView->mToolbarRight->stopCommandInProgress(command_id);
-			gToolBarView->mToolbarBottom->stopCommandInProgress(command_id);
+			gToolBarView->stopCommandInProgress(command_id);
 
 			gToolBarView->mDragStarted = true;
 			return TRUE;
@@ -460,10 +507,10 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t
 		{
 			// Suppress the command from the toolbars (including the one it's dropped in, 
 			// this will handle move position).
-			bool command_present = gToolBarView->hasCommand(command_id);
+			S32 old_toolbar_loc = gToolBarView->hasCommand(command_id);
 			LLToolBar* old_toolbar = NULL;
 
-			if (command_present)
+			if (old_toolbar_loc != TOOLBAR_NONE)
 			{
 				llassert(gToolBarView->mDragToolbarButton);
 				old_toolbar = gToolBarView->mDragToolbarButton->getParentByType<LLToolBar>();
@@ -473,9 +520,8 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t
 				}
 				else
 				{
-					gToolBarView->mToolbarBottom->removeCommand(command_id);
-					gToolBarView->mToolbarLeft->removeCommand(command_id);
-					gToolBarView->mToolbarRight->removeCommand(command_id);
+					int old_rank = LLToolBar::RANK_NONE;
+					gToolBarView->removeCommand(command_id, old_rank);
 				}
 			}
 
@@ -499,27 +545,29 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t
 	return handled;
 }
 
-void LLToolBarView::resetDragTool(LLToolBarButton* button)
+void LLToolBarView::resetDragTool(LLToolBarButton* toolbarButton)
 {
 	// Clear the saved command, toolbar and rank
 	gToolBarView->mDragStarted = false;
-	gToolBarView->mDragToolbarButton = button;
+	gToolBarView->mDragToolbarButton = toolbarButton;
 }
 
 void LLToolBarView::setToolBarsVisible(bool visible)
 {
-	mToolbarBottom->getParent()->setVisible(visible);
-	mToolbarLeft->getParent()->setVisible(visible);
-	mToolbarRight->getParent()->setVisible(visible);
+	for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+	{
+		mToolbars[i]->getParent()->setVisible(visible);
+	}
 }
 
 bool LLToolBarView::isModified() const
 {
 	bool modified = false;
 
-	modified |= mToolbarBottom->isModified();
-	modified |= mToolbarLeft->isModified();
-	modified |= mToolbarRight->isModified();
+	for (S32 i = TOOLBAR_FIRST; i <= TOOLBAR_LAST; i++)
+	{
+		modified |= mToolbars[i]->isModified();
+	}
 
 	return modified;
 }
@@ -532,9 +580,11 @@ bool LLToolBarView::isModified() const
 void handleLoginToolbarSetup()
 {
 	// Open the destinations guide by default on first login, per Rhett
-	if (gSavedSettings.getBOOL("FirstLoginThisInstall") || gAgent.isFirstLogin())
+	if (gSavedPerAccountSettings.getBOOL("DisplayDestinationsOnInitialRun") || gAgent.isFirstLogin())
 	{
 		LLFloaterReg::showInstance("destinations");
+
+		gSavedPerAccountSettings.setBOOL("DisplayDestinationsOnInitialRun", FALSE);
 	}
 }
 
diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h
index ea14e471cd..3dc8954abe 100644
--- a/indra/newview/lltoolbarview.h
+++ b/indra/newview/lltoolbarview.h
@@ -39,6 +39,19 @@ class LLUICtrlFactory;
 class LLToolBarView : public LLUICtrl
 {
 public:
+	typedef enum
+	{
+		TOOLBAR_NONE = 0,
+		TOOLBAR_LEFT,
+		TOOLBAR_RIGHT,
+		TOOLBAR_BOTTOM,
+
+		TOOLBAR_COUNT,
+
+		TOOLBAR_FIRST = TOOLBAR_LEFT,
+		TOOLBAR_LAST = TOOLBAR_BOTTOM,
+	} EToolBarLocation;
+
 	// Xui structure of the toolbar panel
 	struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> {};
 
@@ -52,6 +65,7 @@ public:
 	{
 		Mandatory<LLToolBarEnums::ButtonType>	button_display_mode;
 		Multiple<LLCommandId::Params>	commands;
+
 		Toolbar();
 	};
 	struct ToolbarSet : public LLInitParam::Block<ToolbarSet>
@@ -59,6 +73,7 @@ public:
 		Optional<Toolbar>	left_toolbar,
 							right_toolbar,
 							bottom_toolbar;
+
 		ToolbarSet();
 	};
 
@@ -66,9 +81,16 @@ public:
 	virtual ~LLToolBarView();
 	virtual BOOL postBuild();
 	virtual void draw();
+
 	// Toolbar view interface with the rest of the world
-	// Checks if the commandId is being used somewhere in one of the toolbars
-	bool hasCommand(const LLCommandId& commandId) const;
+	// Checks if the commandId is being used somewhere in one of the toolbars, returns EToolBarLocation
+	S32 hasCommand(const LLCommandId& commandId) const;
+	S32 addCommand(const LLCommandId& commandId, EToolBarLocation toolbar, int rank = LLToolBar::RANK_NONE);
+	S32 removeCommand(const LLCommandId& commandId, int& rank);	// Sets the rank the removed command was at, RANK_NONE if not found
+	S32 enableCommand(const LLCommandId& commandId, bool enabled);
+	S32 stopCommandInProgress(const LLCommandId& commandId);
+	S32 flashCommand(const LLCommandId& commandId, bool flash);
+
 	// Loads the toolbars from the existing user or default settings
 	bool loadToolbars(bool force_default = false);	// return false if load fails
 	
@@ -76,10 +98,10 @@ public:
 
 	static bool loadDefaultToolbars();
 	
-	static void startDragTool(S32 x, S32 y, LLToolBarButton* button);
+	static void startDragTool(S32 x, S32 y, LLToolBarButton* toolbarButton);
 	static BOOL handleDragTool(S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type);
 	static BOOL handleDropTool(void* cargo_data, S32 x, S32 y, LLToolBar* toolbar);
-	static void resetDragTool(LLToolBarButton* button);
+	static void resetDragTool(LLToolBarButton* toolbarButton);
 
 	bool isModified() const;
 	
@@ -91,15 +113,13 @@ protected:
 
 private:
 	void	saveToolbars() const;
-	bool	addCommand(const LLCommandId& commandId, LLToolBar*	toolbar);
+	bool	addCommandInternal(const LLCommandId& commandId, LLToolBar*	toolbar);
 	void	addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const;
 
 	static void	onToolBarButtonAdded(LLView* button);
 
 	// Pointers to the toolbars handled by the toolbar view
-	LLToolBar*	mToolbarLeft;
-	LLToolBar*	mToolbarRight;
-	LLToolBar*	mToolbarBottom;
+	LLToolBar*  mToolbars[TOOLBAR_COUNT];
 	bool		mToolbarsLoaded;
 	
 	bool				mDragStarted;
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 308208869d..5e5bc0bde0 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -3705,7 +3705,11 @@ Try enclosing path to the editor with double quotes.
   <string name="Command_View_Tooltip">Changing camera angle</string>
   <string name="Command_Voice_Tooltip">Volume controls for calls and people near you in world</string>
 
- <!-- Mesh UI terms -->
+  <string name="Toolbar_Bottom_Tooltip">currently in your bottom toolbar</string>
+  <string name="Toolbar_Left_Tooltip"  >currently in your left toolbar</string>
+  <string name="Toolbar_Right_Tooltip" >currently in your right toolbar</string>
+
+  <!-- Mesh UI terms -->
   <string name="Retain%">Retain%</string>
   <string name="Detail">Detail</string>
   <string name="Better Detail">Better Detail</string>
diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml
index 7e7a9c61cf..0aa478ace9 100644
--- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml
+++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml
@@ -30,6 +30,8 @@
                         image_overlay_alignment="left"
                         use_ellipses="true"
                         auto_resize="true"
+                        button_flash_count="99999"
+                        button_flash_rate="1.0"
                         flash_color="EmphasisColor"/>
   <button_icon pad_left="10"
                pad_right="10"
@@ -49,5 +51,7 @@
                chrome="true"
                use_ellipses="true"
                auto_resize="true"
+               button_flash_count="99999"
+               button_flash_rate="1.0"
                flash_color="EmphasisColor"/>
 </toolbar>
-- 
cgit v1.2.3


From 8874ac39c1928bcb70c4f63cd3cfaeb75712d00e Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Mon, 24 Oct 2011 17:06:48 -0700
Subject: EXP-1462 FIX -- Moving speak button or voice settings button between
 toolbars can cause viewer to crash on Mac

* Updated iterator code to not erase stuff while we're iterating through it!

Reviewed by Richard.
---
 indra/newview/lltransientfloatermgr.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/indra/newview/lltransientfloatermgr.cpp b/indra/newview/lltransientfloatermgr.cpp
index d15efb048b..3d68c10489 100644
--- a/indra/newview/lltransientfloatermgr.cpp
+++ b/indra/newview/lltransientfloatermgr.cpp
@@ -104,6 +104,8 @@ void LLTransientFloaterMgr::hideTransientFloaters(S32 x, S32 y)
 
 bool LLTransientFloaterMgr::isControlClicked(ETransientGroup group, controls_set_t& set, S32 x, S32 y)
 {
+	std::list< LLHandle<LLView> > dead_handles;
+	
 	bool res = true;
 	for (controls_set_t::iterator it = set.begin(); it
 			!= set.end(); it++)
@@ -113,7 +115,7 @@ bool LLTransientFloaterMgr::isControlClicked(ETransientGroup group, controls_set
 		LLHandle<LLView> handle = *it;
 		if (handle.isDead())
 		{
-			mGroupControls.find(group)->second.erase(handle);
+			dead_handles.push_back(handle);
 			continue;
 		}
 
@@ -132,6 +134,13 @@ bool LLTransientFloaterMgr::isControlClicked(ETransientGroup group, controls_set
 			break;
 		}
 	}
+
+	for (std::list< LLHandle<LLView> >::iterator it = dead_handles.begin(); it != dead_handles.end(); ++it)
+	{
+		LLHandle<LLView> handle = *it;
+		mGroupControls.find(group)->second.erase(handle);
+	}
+	
 	return res;
 }
 
-- 
cgit v1.2.3


From e356f5c0dce81aff113d562485721305d21ece77 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Mon, 24 Oct 2011 17:30:27 -0700
Subject: EXP-1456 FIX NEARBY CHAT window sometimes opens at the top of the
 screen.

---
 indra/llui/llfloater.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 2c707afa8f..432397d3e9 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1070,7 +1070,7 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user)
 	const LLRect old_rect = getRect();
 	LLView::handleReshape(new_rect, by_user);
 
-	if (by_user)
+	if (by_user && !isMinimized())
 	{
 		storeRectControl();
 		mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE;
-- 
cgit v1.2.3


From 5b0a1ac026e0ca06526cc0c03325b223a051ea63 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Mon, 24 Oct 2011 19:24:58 -0700
Subject: EXP-1460 : Make the caret in favorites toolbar display more
 consistently and with less finicky hit testing

---
 indra/newview/llfavoritesbar.cpp | 58 +++++++++++++++++++---------------------
 1 file changed, 28 insertions(+), 30 deletions(-)

diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index c48b809114..6c9058caf1 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -443,17 +443,17 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 			{
 				setLandingTab(dest);
 			}
-			/*
-			 * the condition dest == NULL can be satisfied not only in the case
-			 * of dragging to the right from the last tab of the favbar. there is a
-			 * small gap between each tab. if the user drags something exactly there
-			 * then mLandingTab will be set to NULL and the dragged item will be pushed
-			 * to the end of the favorites bar. this is incorrect behavior. that's why
-			 * we need an additional check which excludes the case described previously
-			 * making sure that the mouse pointer is beyond the last tab.
-			 */
-			else if (mLastTab && x >= mLastTab->getRect().mRight)
+			else if (mLastTab && (x >= mLastTab->getRect().mRight))
 			{
+				/*
+				 * the condition dest == NULL can be satisfied not only in the case
+				 * of dragging to the right from the last tab of the favbar. there is a
+				 * small gap between each tab. if the user drags something exactly there
+				 * then mLandingTab will be set to NULL and the dragged item will be pushed
+				 * to the end of the favorites bar. this is incorrect behavior. that's why
+				 * we need an additional check which excludes the case described previously
+				 * making sure that the mouse pointer is beyond the last tab.
+				 */
 				setLandingTab(NULL);
 			}
 
@@ -467,7 +467,6 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 				if (drop)
 				{
 					handleExistingFavoriteDragAndDrop(x, y);
-					showDragMarker(FALSE);
 				}
 			}
 			else
@@ -490,7 +489,6 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 						setLandingTab(NULL);
 					}
 					handleNewFavoriteDragAndDrop(item, favorites_id, x, y);
-					showDragMarker(FALSE);
 				}
 			}
 		}
@@ -664,7 +662,7 @@ void LLFavoritesBarCtrl::draw()
 		{
 			// mouse pointer hovers over an existing tab
 			LLRect rect = mLandingTab->getRect();
-			mImageDragIndication->draw(rect.mLeft - w/2, rect.getHeight(), w, h);
+			mImageDragIndication->draw(rect.mLeft, rect.getHeight(), w, h);
 		}
 		else if (mLastTab)
 		{
@@ -672,6 +670,8 @@ void LLFavoritesBarCtrl::draw()
 			LLRect rect = mLastTab->getRect();
 			mImageDragIndication->draw(rect.mRight, rect.getHeight(), w, h);
 		}
+		// Once drawn, mark this false so we won't draw it again (unless we hit the favorite bar again)
+		mShowDragMarker = FALSE;
 	}
 }
 
@@ -743,7 +743,7 @@ void LLFavoritesBarCtrl::updateButtons()
 	if (first_changed_item_index <= mItems.count())
 	{
 		// Rebuild the buttons only
-		// child_list_t is a linked list, so safe to erase from the middle if we pre-incrament the iterator
+		// child_list_t is a linked list, so safe to erase from the middle if we pre-increment the iterator
 
 		while (child_it != childs->end())
 		{
@@ -832,9 +832,9 @@ LLButton* LLFavoritesBarCtrl::createButton(const LLPointer<LLViewerInventoryItem
 
 	/**
 	 * WORKAROUND:
-	 * there are some problem with displaying of fonts in buttons. 
-	 * Empty space (or ...) is displaying instead of last symbols, even though the width of the button is enough.
-	 * Problem will gone, if we  stretch out the button. For that reason I have to put additional  20 pixels.
+	 * There are some problem with displaying of fonts in buttons. 
+	 * Empty space or ellipsis might be displayed instead of last symbols, even though the width of the button is enough.
+	 * The problem disappears if we pad the button with 20 pixels.
 	 */
 	int required_width = mFont->getWidth(item->getName()) + 20;
 	int width = required_width > def_button_width? def_button_width : required_width;
@@ -862,7 +862,6 @@ LLButton* LLFavoritesBarCtrl::createButton(const LLPointer<LLViewerInventoryItem
 	fav_btn->setRect(butt_rect);
 	// change only left and save bottom
 	fav_btn->setFont(mFont);
-	fav_btn->setName(item->getName());
 	fav_btn->setLabel(item->getName());
 	fav_btn->setToolTip(item->getName());
 	fav_btn->setCommitCallback(boost::bind(&LLFavoritesBarCtrl::onButtonClick, this, item->getUUID()));
@@ -1320,25 +1319,24 @@ BOOL LLFavoritesBarCtrl::handleHover(S32 x, S32 y, MASK mask)
 
 LLUICtrl* LLFavoritesBarCtrl::findChildByLocalCoords(S32 x, S32 y)
 {
-	LLUICtrl* ctrl = 0;
-	S32 screenX, screenY;
+	LLUICtrl* ctrl = NULL;
 	const child_list_t* list = getChildList();
 
-	localPointToScreen(x, y, &screenX, &screenY);
-
-	// look for a child which contains the point (screenX, screenY) in it's rectangle
 	for (child_list_const_iter_t i = list->begin(); i != list->end(); ++i)
 	{
-		LLRect rect;
-		localRectToScreen((*i)->getRect(), &rect);
-
-		if (rect.pointInRect(screenX, screenY))
+		// Look only for children that are favorite buttons
+		if ((*i)->getName() == "favorites_bar_btn")
 		{
-			ctrl = dynamic_cast<LLUICtrl*>(*i);
-			break;
+			LLRect rect = (*i)->getRect();
+			// We consider a button hit if the cursor is left of the right side
+			// This makes the hit a bit less finicky than hitting directly on the button itself
+			if (x <= rect.mRight)
+			{
+				ctrl = dynamic_cast<LLUICtrl*>(*i);
+				break;
+			}
 		}
 	}
-
 	return ctrl;
 }
 
-- 
cgit v1.2.3


From 35b8f7b15ccd1f7a9efd7f5e71b2481ff5245693 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Tue, 25 Oct 2011 12:44:04 -0700
Subject: EXP-1452 FIX minimum height of NEARBY CHAT window can be circumvented
 by minimizing it.

---
 indra/newview/llnearbychatbar.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index a811332261..e7f3daa1a3 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -147,12 +147,12 @@ LLNearbyChatBar* LLNearbyChatBar::getInstance()
 
 void LLNearbyChatBar::showHistory()
 {
+	openFloater();
+
 	if (!getChildView("nearby_chat")->getVisible())
 	{
 		onToggleNearbyChatPanel();
 	}
-	
-	openFloater();
 }
 
 void LLNearbyChatBar::draw()
@@ -379,7 +379,10 @@ void LLNearbyChatBar::onToggleNearbyChatPanel()
 
 	if (nearby_chat->getVisible())
 	{
-		mExpandedHeight = getRect().getHeight();
+		if (!isMinimized())
+		{
+			mExpandedHeight = getRect().getHeight();
+		}
 		setResizeLimits(getMinWidth(), COLLAPSED_HEIGHT);
 		nearby_chat->setVisible(FALSE);
 		reshape(getRect().getWidth(), COLLAPSED_HEIGHT);
-- 
cgit v1.2.3


From d0695ee11e3a4843b6022c0b0c9b781ade4b51da Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Tue, 25 Oct 2011 12:48:40 -0700
Subject: EXP-1465 FIX Crash in IM panel destructor

---
 indra/newview/llimfloatercontainer.cpp | 3 ++-
 indra/newview/llimfloatercontainer.h   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 33cb3a54a7..c8e48b0d42 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -47,12 +47,13 @@ LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed)
 
 LLIMFloaterContainer::~LLIMFloaterContainer()
 {
+	mNewMessageConnection.disconnect();
 	LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this);
 }
 
 BOOL LLIMFloaterContainer::postBuild()
 {
-	LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLIMFloaterContainer::onNewMessageReceived, this, _1));
+	mNewMessageConnection = LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLIMFloaterContainer::onNewMessageReceived, this, _1));
 	// Do not call base postBuild to not connect to mCloseSignal to not close all floaters via Close button
 	// mTabContainer will be initialized in LLMultiFloater::addChild()
 	return TRUE;
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index 53dfcd78ff..892ecef48d 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -62,7 +62,7 @@ public:
 private:
 	typedef std::map<LLUUID,LLFloater*> avatarID_panel_map_t;
 	avatarID_panel_map_t mSessions;
-
+	boost::signals2::connection mNewMessageConnection;
 
 	void onNewMessageReceived(const LLSD& data);
 };
-- 
cgit v1.2.3


From 8e4c3dc14f3c5e8220f7b88bceaa5d1ccbb0a2f0 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Tue, 25 Oct 2011 12:59:59 -0700
Subject: EXP-1466 FIX Viewer reloads default settings.xml file during launch
 (under some conditions) made sessionsettings pref not persistent

---
 indra/newview/app_settings/settings.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 75bd396449..94b8fe22a7 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -13350,7 +13350,7 @@
       <key>Comment</key>
       <string>Settings that are a applied per session (not saved).</string>
       <key>Persist</key>
-      <integer>1</integer>
+      <integer>0</integer>
       <key>Type</key>
       <string>String</string>
       <key>Value</key>
@@ -13361,7 +13361,7 @@
       <key>Comment</key>
       <string>User settings that are a applied per session (not saved).</string>
       <key>Persist</key>
-      <integer>1</integer>
+      <integer>0</integer>
       <key>Type</key>
       <string>String</string>
       <key>Value</key>
-- 
cgit v1.2.3


From 8448e3b86e9ed94a29a6d1e0bdc8b8f78ff84091 Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Tue, 25 Oct 2011 14:14:46 -0700
Subject: EXP-1398 FIX -- Viewer Crash when moving Speak button from bottom
 toolbar to side toolbar with call request dialog active on Mac

* Added "on button removed" callback for toolbars.
* Changed docking on incoming and outgoing call floaters to be undocked when "speak" button removed.

Reviewed by Leyla.
---
 indra/llui/lltoolbar.cpp        | 46 ++++++++++++++++++++--
 indra/llui/lltoolbar.h          |  5 +++
 indra/newview/llimview.cpp      | 52 +++++++++++++++----------
 indra/newview/llimview.h        |  6 ++-
 indra/newview/lltoolbarview.cpp | 84 ++++++++++++++++++++++++++++++++++++++---
 indra/newview/lltoolbarview.h   |  1 +
 6 files changed, 162 insertions(+), 32 deletions(-)

diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 97dc1e3316..ea11750e38 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -114,6 +114,8 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
 	mHandleDropCallback(NULL),
 	mButtonAddSignal(NULL),
 	mButtonEnterSignal(NULL),
+	mButtonLeaveSignal(NULL),
+	mButtonRemoveSignal(NULL),
 	mDragAndDropTarget(false)
 {
 	mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text;
@@ -125,6 +127,8 @@ LLToolBar::~LLToolBar()
 	delete mPopupMenuHandle.get();
 	delete mButtonAddSignal;
 	delete mButtonEnterSignal;
+	delete mButtonLeaveSignal;
+	delete mButtonRemoveSignal;
 }
 
 void LLToolBar::createContextMenu()
@@ -272,6 +276,11 @@ int LLToolBar::removeCommand(const LLCommandId& commandId)
 		++rank;
 	}
 	
+	if (mButtonRemoveSignal)
+	{
+		(*mButtonRemoveSignal)(*it_button);
+	}
+	
 	// Delete the button and erase the command and button records
 	delete (*it_button);
 	mButtonCommands.erase(it_command);
@@ -922,16 +931,34 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
 	return button;
 }
 
+boost::signals2::connection connectSignal(LLToolBar::button_signal_t*& signal, const LLToolBar::button_signal_t::slot_type& cb)
+{
+	if (!signal)
+	{
+		signal = new LLToolBar::button_signal_t();
+	}
+
+	return signal->connect(cb);
+}
+
 boost::signals2::connection LLToolBar::setButtonAddCallback(const button_signal_t::slot_type& cb)
 {
-	if (!mButtonAddSignal) mButtonAddSignal = new button_signal_t();
-	return mButtonAddSignal->connect(cb);
+	return connectSignal(mButtonAddSignal, cb);
 }
 
 boost::signals2::connection LLToolBar::setButtonEnterCallback(const button_signal_t::slot_type& cb)
 {
-	if (!mButtonEnterSignal) mButtonEnterSignal = new button_signal_t();
-	return mButtonEnterSignal->connect(cb);
+	return connectSignal(mButtonEnterSignal, cb);
+}
+
+boost::signals2::connection LLToolBar::setButtonLeaveCallback(const button_signal_t::slot_type& cb)
+{
+	return connectSignal(mButtonLeaveSignal, cb);
+}
+
+boost::signals2::connection LLToolBar::setButtonRemoveCallback(const button_signal_t::slot_type& cb)
+{
+	return connectSignal(mButtonRemoveSignal, cb);
 }
 
 BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
@@ -1067,6 +1094,17 @@ void LLToolBarButton::onMouseEnter(S32 x, S32 y, MASK mask)
 	}
 }
 
+void LLToolBarButton::onMouseLeave(S32 x, S32 y, MASK mask)
+{
+	LLButton::onMouseLeave(x, y, mask);
+	
+	LLToolBar* parent_toolbar = getParentByType<LLToolBar>();
+	if (parent_toolbar && parent_toolbar->mButtonLeaveSignal)
+	{
+		(*(parent_toolbar->mButtonLeaveSignal))(this);
+	}	
+}
+
 void LLToolBarButton::onMouseCaptureLost()
 {
 	mIsDragged = false;
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index 7ceb75aeed..f10f39adc3 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -71,6 +71,7 @@ public:
 	void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
 
 	void onMouseEnter(S32 x, S32 y, MASK mask);
+	void onMouseLeave(S32 x, S32 y, MASK mask);
 	void onMouseCaptureLost();
 
 	void onCommit();
@@ -202,6 +203,8 @@ public:
 	typedef boost::signals2::signal<void (LLView* button)> button_signal_t;
 	boost::signals2::connection setButtonAddCallback(const button_signal_t::slot_type& cb);
 	boost::signals2::connection setButtonEnterCallback(const button_signal_t::slot_type& cb);
+	boost::signals2::connection setButtonLeaveCallback(const button_signal_t::slot_type& cb);
+	boost::signals2::connection setButtonRemoveCallback(const button_signal_t::slot_type& cb);
 
 	void setTooltipButtonSuffix(const std::string& suffix) { mButtonTooltipSuffix = suffix; }
 
@@ -269,6 +272,8 @@ private:
 
 	button_signal_t*				mButtonAddSignal;
 	button_signal_t*				mButtonEnterSignal;
+	button_signal_t*				mButtonLeaveSignal;
+	button_signal_t*				mButtonRemoveSignal;
 
 	std::string						mButtonTooltipSuffix;
 };
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index c751394455..ed4bb727cd 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -1679,16 +1679,44 @@ BOOL LLCallDialog::postBuild()
 {
 	if (!LLDockableFloater::postBuild() || !gToolBarView)
 		return FALSE;
+	
+	dockToToolbarButton("speak");
+	
+	return TRUE;
+}
 
-	LLView *anchor_panel = gToolBarView->findChildView("speak");
-	LLDockControl::DocAt dock_pos = getDockControlPos();
-	setDockControl(new LLDockControl(anchor_panel, this, getDockTongue(dock_pos), dock_pos));
+void LLCallDialog::dockToToolbarButton(const std::string& toolbarButtonName)
+{
+	LLDockControl::DocAt dock_pos = getDockControlPos(toolbarButtonName);
+	LLView *anchor_panel = gToolBarView->findChildView(toolbarButtonName);
 
 	setUseTongue(anchor_panel);
 
-	return TRUE;
+	setDockControl(new LLDockControl(anchor_panel, this, getDockTongue(dock_pos), dock_pos));
 }
 
+LLDockControl::DocAt LLCallDialog::getDockControlPos(const std::string& toolbarButtonName)
+{
+	LLCommandId command_id(toolbarButtonName);
+	S32 toolbar_loc = gToolBarView->hasCommand(command_id);
+	
+	LLDockControl::DocAt doc_at = LLDockControl::TOP;
+	
+	switch (toolbar_loc)
+	{
+		case LLToolBarView::TOOLBAR_LEFT:
+			doc_at = LLDockControl::RIGHT;
+			break;
+			
+		case LLToolBarView::TOOLBAR_RIGHT:
+			doc_at = LLDockControl::LEFT;
+			break;
+	}
+	
+	return doc_at;
+}
+
+
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLOutgoingCallDialog
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1752,22 +1780,6 @@ void LLCallDialog::setIcon(const LLSD& session_id, const LLSD& participant_id)
 	}
 }
 
-LLDockControl::DocAt LLCallDialog::getDockControlPos()
-{
-	LLToolBar* tool_bar = NULL;
-
-	if((tool_bar = gToolBarView->getChild<LLToolBar>("toolbar_left")) && tool_bar->hasChild("speak", true))
-	{
-		return LLDockControl::RIGHT; // Speak button in the left toolbar so the call floater should be to the right of the speak button
-	}
-	else if((tool_bar = gToolBarView->getChild<LLToolBar>("toolbar_right")) && tool_bar->hasChild("speak", true))
-	{
-		return LLDockControl::LEFT; // Speak button in the right toolbar so the call floater should be to the left of the speak button
-	}
-
-	return LLDockControl::TOP;
-}
-
 bool LLCallDialog::lifetimeHasExpired()
 {
 	if (mLifetimeTimer.getStarted())
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 33c7ae9e54..b1be26a169 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -495,10 +495,12 @@ public:
 
 	virtual BOOL postBuild();
 
+	void dockToToolbarButton(const std::string& toolbarButtonName);
+	
 	// check timer state
 	/*virtual*/ void draw();
 	/*virtual*/ void onOpen(const LLSD& key);
-
+	
 protected:
 	// lifetime timer for a notification
 	LLTimer	mLifetimeTimer;
@@ -521,7 +523,7 @@ protected:
 	LLSD mPayload;
 
 private:
-	LLDockControl::DocAt getDockControlPos();
+	LLDockControl::DocAt getDockControlPos(const std::string& toolbarButtonName);
 };
 
 class LLIncomingCallDialog : public LLCallDialog
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index 8f4f7d405f..ed1dfbb8cd 100644
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -30,13 +30,16 @@
 #include "lltoolbarview.h"
 
 #include "llappviewer.h"
+#include "llbutton.h"
+#include "llclipboard.h"
 #include "lldir.h"
-#include "llxmlnode.h"
+#include "lldockablefloater.h"
+#include "lldockcontrol.h"
+#include "llimview.h"
+#include "lltransientfloatermgr.h"
 #include "lltoolbar.h"
-#include "llbutton.h"
 #include "lltooldraganddrop.h"
-#include "lltransientfloatermgr.h"
-#include "llclipboard.h"
+#include "llxmlnode.h"
 
 #include "llagent.h"  // HACK for destinations guide on startup
 #include "llfloaterreg.h"  // HACK for destinations guide on startup
@@ -102,6 +105,7 @@ BOOL LLToolBarView::postBuild()
 		mToolbars[i]->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4));
 		mToolbars[i]->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4));
 		mToolbars[i]->setButtonAddCallback(boost::bind(LLToolBarView::onToolBarButtonAdded,_1));
+		mToolbars[i]->setButtonRemoveCallback(boost::bind(LLToolBarView::onToolBarButtonRemoved,_1));
 	}
 
 	LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&handleLoginToolbarSetup));
@@ -391,13 +395,44 @@ void LLToolBarView::addToToolset(command_id_list_t& command_list, Toolbar& toolb
 
 void LLToolBarView::onToolBarButtonAdded(LLView* button)
 {
-	if (button && button->getName() == "speak")
+	llassert(button);
+	
+	if (button->getName() == "speak")
 	{
 		// Add the "Speak" button as a control view in LLTransientFloaterMgr
 		// to prevent hiding the transient IM floater upon pressing "Speak".
 		LLTransientFloaterMgr::getInstance()->addControlView(button);
+		
+		// Redock incoming and/or outgoing call windows, if applicable
+		
+		LLFloater* incoming_floater = LLFloaterReg::getLastFloaterInGroup("incoming_call");
+		LLFloater* outgoing_floater = LLFloaterReg::getLastFloaterInGroup("outgoing_call");
+		
+		if (incoming_floater && incoming_floater->isShown())
+		{
+			LLCallDialog* incoming = dynamic_cast<LLCallDialog *>(incoming_floater);
+			llassert(incoming);
+			
+			LLDockControl* dock_control = incoming->getDockControl();
+			if (dock_control->getDock() == NULL)
+			{
+				incoming->dockToToolbarButton("speak");
+			}
+		}
+		
+		if (outgoing_floater && outgoing_floater->isShown())
+		{
+			LLCallDialog* outgoing = dynamic_cast<LLCallDialog *>(outgoing_floater);
+			llassert(outgoing);
+			
+			LLDockControl* dock_control = outgoing->getDockControl();
+			if (dock_control->getDock() == NULL)
+			{
+				outgoing->dockToToolbarButton("speak");
+			}
+		}
 	}
-	else if (button && button->getName() == "voice")
+	else if (button->getName() == "voice")
 	{
 		// Add the "Voice controls" button as a control view in LLTransientFloaterMgr
 		// to prevent hiding the transient IM floater upon pressing "Voice controls".
@@ -405,6 +440,43 @@ void LLToolBarView::onToolBarButtonAdded(LLView* button)
 	}
 }
 
+void LLToolBarView::onToolBarButtonRemoved(LLView* button)
+{
+	llassert(button);
+
+	if (button->getName() == "speak")
+	{
+		LLTransientFloaterMgr::getInstance()->removeControlView(button);
+		
+		// Undock incoming and/or outgoing call windows
+		
+		LLFloater* incoming_floater = LLFloaterReg::getLastFloaterInGroup("incoming_call");
+		LLFloater* outgoing_floater = LLFloaterReg::getLastFloaterInGroup("outgoing_call");
+		
+		if (incoming_floater && incoming_floater->isShown())
+		{
+			LLDockableFloater* incoming = dynamic_cast<LLDockableFloater *>(incoming_floater);
+			llassert(incoming);
+
+			LLDockControl* dock_control = incoming->getDockControl();
+			dock_control->setDock(NULL);
+		}
+		
+		if (outgoing_floater && outgoing_floater->isShown())
+		{
+			LLDockableFloater* outgoing = dynamic_cast<LLDockableFloater *>(outgoing_floater);
+			llassert(outgoing);
+
+			LLDockControl* dock_control = outgoing->getDockControl();
+			dock_control->setDock(NULL);
+		}
+	}
+	else if (button->getName() == "voice")
+	{
+		LLTransientFloaterMgr::getInstance()->removeControlView(button);
+	}
+}
+
 void LLToolBarView::draw()
 {
 	LLRect toolbar_rects[TOOLBAR_COUNT];
diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h
index 3dc8954abe..4307d10258 100644
--- a/indra/newview/lltoolbarview.h
+++ b/indra/newview/lltoolbarview.h
@@ -117,6 +117,7 @@ private:
 	void	addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const;
 
 	static void	onToolBarButtonAdded(LLView* button);
+	static void onToolBarButtonRemoved(LLView* button);
 
 	// Pointers to the toolbars handled by the toolbar view
 	LLToolBar*  mToolbars[TOOLBAR_COUNT];
-- 
cgit v1.2.3


From a5f3c70eeff4aeeb3c5fd463bed5be7cfb2cf60e Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Tue, 25 Oct 2011 15:52:08 -0700
Subject: EXP-1469 FIX -- Changing toolbar from "icons only" to "icons with
 text" while incoming/outgoing call floater is open causes crash on mac

* Updated LLToolBar to call remove and add on all buttons when rebuilding the toolbar.
---
 indra/llui/lltoolbar.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index ea11750e38..2d96bf2fc6 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -824,6 +824,11 @@ void LLToolBar::createButtons()
 {
 	BOOST_FOREACH(LLToolBarButton* button, mButtons)
 	{
+		if (mButtonRemoveSignal)
+		{
+			(*mButtonRemoveSignal)(button);
+		}
+		
 		delete button;
 	}
 	mButtons.clear();
@@ -835,6 +840,11 @@ void LLToolBar::createButtons()
 		mButtons.push_back(button);
 		mButtonPanel->addChild(button);
 		mButtonMap.insert(std::make_pair(command_id.uuid(), button));
+		
+		if (mButtonAddSignal)
+		{
+			(*mButtonAddSignal)(button);
+		}
 	}
 	mNeedsLayout = true;
 }
-- 
cgit v1.2.3


From a64f7e1c7b6c60e2f43b75d150cf5e4ee5a5afcd Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Tue, 25 Oct 2011 17:32:40 -0700
Subject: EXP-1468 Incoming/outgoing call floater tongue position doesn't
 follow floater

---
 indra/llui/lltoolbar.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index ea11750e38..19dc688504 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -243,13 +243,16 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank)
 		mButtons.insert(it_button,button);
 	}
 
+	mNeedsLayout = true;
+
+	updateLayoutAsNeeded();
+
+
 	if (mButtonAddSignal)
 	{
 		(*mButtonAddSignal)(button);
 	}
 
-	mNeedsLayout = true;
-
 	return true;
 }
 
-- 
cgit v1.2.3


From 06cb4e86027ab90ab5960649beb342d3c85c41ba Mon Sep 17 00:00:00 2001
From: Paul ProductEngine <pguslisty@productengine.com>
Date: Wed, 26 Oct 2011 16:58:28 +0200
Subject: EXP-1417 FIXED (Docked Notifications window tears off from the dock
 icon when deleting notifications one by one)

- Changed LLSysWellWindow::reshapeWindow() so that the floater decreases from bottom to top, without changing top coordinate.

- Force dock control repositioning in case floater rect changed.
---
 indra/llui/lldockcontrol.cpp      | 19 ++++++++++++-------
 indra/llui/lldockcontrol.h        |  3 ++-
 indra/newview/llsyswellwindow.cpp |  7 +++----
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp
index 8cb2e57b98..af39e41fa6 100644
--- a/indra/llui/lldockcontrol.cpp
+++ b/indra/llui/lldockcontrol.cpp
@@ -100,12 +100,16 @@ void LLDockControl::repositionDockable()
 	if (!mDockWidget) return;
 	LLRect dockRect = mDockWidget->calcScreenRect();
 	LLRect rootRect;
+	LLRect floater_rect = mDockableFloater->calcScreenRect();
 	mGetAllowedRectCallback(rootRect);
 
-	// recalculate dockable position if dock position changed, dock visibility changed,
-	// root view rect changed or recalculation is forced
-	if (mPrevDockRect != dockRect  || mDockWidgetVisible != isDockVisible()
-			|| mRootRect != rootRect || mRecalculateDocablePosition)
+	// recalculate dockable position if:
+	if (mPrevDockRect != dockRect					//dock position   changed
+		|| mDockWidgetVisible != isDockVisible()	//dock visibility changed
+		|| mRootRect != rootRect					//root view rect  changed
+		|| mFloaterRect != floater_rect				//floater rect    changed
+		|| mRecalculateDockablePosition				//recalculation is forced
+	)
 	{
 		// undock dockable and off() if dock not visible
 		if (!isDockVisible())
@@ -136,7 +140,8 @@ void LLDockControl::repositionDockable()
 
 		mPrevDockRect = dockRect;
 		mRootRect = rootRect;
-		mRecalculateDocablePosition = false;
+		mFloaterRect = floater_rect;
+		mRecalculateDockablePosition = false;
 		mDockWidgetVisible = isDockVisible();
 	}
 }
@@ -341,7 +346,7 @@ void LLDockControl::on()
 	 if (isDockVisible())
 	{
 		mEnabled = true;
-		mRecalculateDocablePosition = true;
+		mRecalculateDockablePosition = true;
 	}
 }
 
@@ -352,7 +357,7 @@ void LLDockControl::off()
 
 void LLDockControl::forceRecalculatePosition()
 {
-	mRecalculateDocablePosition = true;
+	mRecalculateDockablePosition = true;
 }
 
 void LLDockControl::drawToungue()
diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h
index 463223fafd..c9602011f6 100644
--- a/indra/llui/lldockcontrol.h
+++ b/indra/llui/lldockcontrol.h
@@ -80,12 +80,13 @@ private:
 private:
 	get_allowed_rect_callback_t mGetAllowedRectCallback;
 	bool mEnabled;
-	bool mRecalculateDocablePosition;
+	bool mRecalculateDockablePosition;
 	bool mDockWidgetVisible;
 	DocAt mDockAt;
 	LLView* mDockWidget;
 	LLRect mPrevDockRect;
 	LLRect mRootRect;
+	LLRect mFloaterRect;
 	LLFloater* mDockableFloater;
 	LLUIImagePtr mDockTongue;
 	S32 mDockTongueX;
diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp
index ffe864e220..3aa6a3b7e5 100644
--- a/indra/newview/llsyswellwindow.cpp
+++ b/indra/newview/llsyswellwindow.cpp
@@ -203,10 +203,9 @@ void LLSysWellWindow::reshapeWindow()
 		{
 			new_window_height = MAX_WINDOW_HEIGHT;
 		}
-		S32 newY = curRect.mTop + new_window_height - curRect.getHeight();
-		S32 newWidth = curRect.getWidth() < MIN_WINDOW_WIDTH ? MIN_WINDOW_WIDTH
-			: curRect.getWidth();
-		curRect.setLeftTopAndSize(curRect.mLeft, newY, newWidth, new_window_height);
+		S32 newWidth = curRect.getWidth() < MIN_WINDOW_WIDTH ? MIN_WINDOW_WIDTH	: curRect.getWidth();
+
+		curRect.setLeftTopAndSize(curRect.mLeft, curRect.mTop, newWidth, new_window_height);
 		reshape(curRect.getWidth(), curRect.getHeight(), TRUE);
 		setRect(curRect);
 	}
-- 
cgit v1.2.3


From 17194cab5db3a956d9768f89238e63bc30b0a9a6 Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Wed, 26 Oct 2011 09:55:57 -0700
Subject: Removed text spam about range of spatial partition, per davep.

---
 indra/llmath/lloctree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h
index e5ca47da69..3c1ae45d68 100644
--- a/indra/llmath/lloctree.h
+++ b/indra/llmath/lloctree.h
@@ -681,7 +681,7 @@ public:
 
 		if (lt != 0x7)
 		{
-			OCT_ERRS << "!!! ELEMENT EXCEEDS RANGE OF SPATIAL PARTITION !!!" << llendl;
+			//OCT_ERRS << "!!! ELEMENT EXCEEDS RANGE OF SPATIAL PARTITION !!!" << llendl;
 			return false;
 		}
 
-- 
cgit v1.2.3


From 9d988f4454556dd911b8cb131b38a7f39023fa0f Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Wed, 26 Oct 2011 10:10:05 -0700
Subject: EXP-1461 FIX Incoming Nearby chat not visible in chat toasts/bubbles
 to user when chat window is minimized with chat history opened

---
 indra/newview/llnearbychathandler.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index 330a21ef65..c43c95a366 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -568,7 +568,8 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg,		// WARNING - not
 	sChatWatcher->post(notification);
 
 
-	if( chat_bar->getVisible() && nearby_chat->getVisible() 
+	if( !chat_bar->isMinimized()
+		&& nearby_chat->isInVisibleChain() 
 		|| ( chat_msg.mSourceType == CHAT_SOURCE_AGENT
 			&& gSavedSettings.getBOOL("UseChatBubbles") )
 		|| !mChannel->getShowToasts() ) // to prevent toasts in Busy mode
-- 
cgit v1.2.3


From b0df4f12040152afe0813875eddfe83a078079a2 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Wed, 26 Oct 2011 11:51:52 -0700
Subject: EXP-1461 FIX Incoming Nearby chat not visible in chat toasts/bubbles
 to user when chat window is minimized with chat history opened made
 minimizing and unminimizing nearby chat floater do the right thing

---
 indra/newview/llnearbychatbar.cpp | 9 +++++++++
 indra/newview/llnearbychatbar.h   | 1 +
 2 files changed, 10 insertions(+)

diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index e7f3daa1a3..4674c85324 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -399,6 +399,15 @@ void LLNearbyChatBar::onToggleNearbyChatPanel()
 	}
 }
 
+void LLNearbyChatBar::setMinimized(BOOL b)
+{
+	if (b != LLFloater::isMinimized())
+	{
+		LLFloater::setMinimized(b);
+		getChildView("nearby_chat")->setVisible(!b);
+	}
+}
+
 void LLNearbyChatBar::onChatBoxCommit()
 {
 	if (mChatBox->getText().length() > 0)
diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h
index bc00c1b9fc..e9734899b3 100644
--- a/indra/newview/llnearbychatbar.h
+++ b/indra/newview/llnearbychatbar.h
@@ -60,6 +60,7 @@ public:
 	static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate);
 
 	void showHistory();
+	/*virtual*/void setMinimized(BOOL b);
 
 protected:
 	static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str);
-- 
cgit v1.2.3


From b82d0abb7e885d339dd37d05d6181d8fd632ee41 Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Wed, 26 Oct 2011 16:39:03 -0700
Subject: Disabling display of inbox unless the Received Items folder exists
 already.

---
 indra/newview/app_settings/settings.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index b98a40beaf..3771222455 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -4257,7 +4257,7 @@
         <key>Type</key>
         <string>Boolean</string>
         <key>Value</key>
-        <integer>1</integer>
+        <integer>0</integer>
     </map>
     <key>InventoryDisplayOutbox</key>
     <map>
-- 
cgit v1.2.3


From a556fcf2784907ee3d7e9e6e6a3ae1f89dcf5aa0 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Wed, 26 Oct 2011 17:38:44 -0700
Subject: EXP-1458 FIX Chat text entry bar does not have focus when chat
 floater is opened while chat history is toggled open

---
 .../skins/default/xui/en/floater_chat_bar.xml      | 100 +++++++++++----------
 1 file changed, 53 insertions(+), 47 deletions(-)

diff --git a/indra/newview/skins/default/xui/en/floater_chat_bar.xml b/indra/newview/skins/default/xui/en/floater_chat_bar.xml
index 86191b789c..e7eb7652c7 100644
--- a/indra/newview/skins/default/xui/en/floater_chat_bar.xml
+++ b/indra/newview/skins/default/xui/en/floater_chat_bar.xml
@@ -15,6 +15,7 @@
  min_height="60"
  min_width="150"
  can_resize="true"
+ default_tab_group="1"
  name="chat_bar"
  width="380">
     <panel
@@ -23,54 +24,59 @@
         follow="all"
         width="380"
         height="0"
-        visible="false"
+        visible="true"
         filename="panel_nearby_chat.xml"
         name="nearby_chat" />
-    <panel width="380" height="31" left="0" bottom="-1" follows="left|right|bottom">
-    <line_editor
-     border_style="line"
-     border_thickness="1"
-     follows="left|right"
-     height="23"
-     label="Click here to chat."
-     layout="topleft"
-     left_delta="7"
-     left="0"
-     max_length_bytes="1023"
-     name="chat_box"
-     text_pad_left="5"
-     text_pad_right="25"
-     tool_tip="Press Enter to say, Ctrl+Enter to shout"
-     top="2"
-     width="335" />
-    <output_monitor
-     auto_update="true"
-     follows="right"
-     draw_border="false"
-     height="16"
-     layout="topleft"
-     left_pad="-24"
-     mouse_opaque="true"
-     name="chat_zone_indicator"
-     top="6"
-     visible="true"
-     width="20" />
-    <button
-     follows="right"
-     is_toggle="true"
-     width="20"
-     top="2"
-     layout="topleft"
-     left_pad="12"
-     image_disabled="ComboButton_UpOff"
-     image_unselected="ComboButton_UpOff"
-     image_selected="ComboButton_On"
-     image_pressed="ComboButton_UpSelected"
-     image_pressed_selected="ComboButton_Selected"
-     height="23"
-     chrome="true"
-     name="show_nearby_chat"
-     tool_tip="Shows/hides nearby chat log">
-    </button>
+    <panel width="380" 
+           height="31" 
+           left="0" 
+           bottom="-1" 
+           follows="left|right|bottom" 
+           tab_group="1">
+      <line_editor
+        border_style="line"
+        border_thickness="1"
+        follows="left|right"
+        height="23"
+        label="Click here to chat."
+        layout="topleft"
+        left_delta="7"
+        left="0"
+        max_length_bytes="1023"
+        name="chat_box"
+        text_pad_left="5"
+        text_pad_right="25"
+        tool_tip="Press Enter to say, Ctrl+Enter to shout"
+        top="2"
+        width="335" />
+      <output_monitor
+        auto_update="true"
+        follows="right"
+        draw_border="false"
+        height="16"
+        layout="topleft"
+        left_pad="-24"
+        mouse_opaque="true"
+        name="chat_zone_indicator"
+        top="6"
+        visible="true"
+        width="20" />
+      <button
+        follows="right"
+        is_toggle="true"
+        width="20"
+        top="2"
+        layout="topleft"
+        left_pad="12"
+        image_disabled="ComboButton_UpOff"
+        image_unselected="ComboButton_UpOff"
+        image_selected="ComboButton_On"
+        image_pressed="ComboButton_UpSelected"
+        image_pressed_selected="ComboButton_Selected"
+        height="23"
+        chrome="true"
+        name="show_nearby_chat"
+        tool_tip="Shows/hides nearby chat log">
+      </button>
     </panel>
 </floater>
-- 
cgit v1.2.3


From e86adb53f4df0cb0b9d8ea9b6cc805782d9fcf71 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 27 Oct 2011 17:20:12 -0700
Subject: EXP-1479 FIX Chat history does not open when selecting toggle on chat
 floater and issue with minimizing and opening chat floater

---
 indra/newview/skins/default/xui/en/floater_chat_bar.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/indra/newview/skins/default/xui/en/floater_chat_bar.xml b/indra/newview/skins/default/xui/en/floater_chat_bar.xml
index e7eb7652c7..87606c1a2a 100644
--- a/indra/newview/skins/default/xui/en/floater_chat_bar.xml
+++ b/indra/newview/skins/default/xui/en/floater_chat_bar.xml
@@ -24,7 +24,7 @@
         follow="all"
         width="380"
         height="0"
-        visible="true"
+        visible="false"
         filename="panel_nearby_chat.xml"
         name="nearby_chat" />
     <panel width="380" 
-- 
cgit v1.2.3