From 8ca06e7bf37f7e5391e14f74d8404bdc05d683d4 Mon Sep 17 00:00:00 2001
From: richard <none@none>
Date: Mon, 8 Feb 2010 08:19:32 -0800
Subject: nearby media pops up on hover

---
 indra/llui/lldockcontrol.cpp                       | 41 ++++++++++++
 indra/llui/lldockcontrol.h                         |  5 +-
 indra/newview/llappviewer.cpp                      |  3 -
 indra/newview/llstatusbar.cpp                      | 72 +++++++++++-----------
 .../skins/default/xui/en/panel_status_bar.xml      | 23 ++++++-
 5 files changed, 99 insertions(+), 45 deletions(-)

diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp
index d836a5f4cd..f91c07184d 100644
--- a/indra/llui/lldockcontrol.cpp
+++ b/indra/llui/lldockcontrol.cpp
@@ -162,7 +162,9 @@ bool LLDockControl::isDockVisible()
 			{
 			case LEFT: // to keep compiler happy
 				break;
+			case BOTTOM:
 			case TOP:
+			{
 				// check is dock inside parent rect
 				LLRect dockParentRect =
 						mDockWidget->getParent()->calcScreenRect();
@@ -173,6 +175,9 @@ bool LLDockControl::isDockVisible()
 				}
 				break;
 			}
+			default:
+				break;
+			}
 		}
 	}
 
@@ -254,6 +259,42 @@ void LLDockControl::moveDockable()
 		}
 		mDockTongueY = dockRect.mTop;
 
+		break;
+	case BOTTOM:
+		x = dockRect.getCenterX() - dockableRect.getWidth() / 2;
+		y = dockRect.mBottom;
+		// unique docking used with dock tongue, so add tongue height o the Y coordinate
+		if (use_tongue)
+		{
+			y -= mDockTongue->getHeight();
+		}
+
+		// check is dockable inside root view rect
+		if (x < rootRect.mLeft)
+		{
+			x = rootRect.mLeft;
+		}
+		if (x + dockableRect.getWidth() > rootRect.mRight)
+		{
+			x = rootRect.mRight - dockableRect.getWidth();
+		}
+
+		// calculate dock tongue position
+		dockParentRect = mDockWidget->getParent()->calcScreenRect();
+		if (dockRect.getCenterX() < dockParentRect.mLeft)
+		{
+			mDockTongueX = dockParentRect.mLeft - mDockTongue->getWidth() / 2;
+		}
+		else if (dockRect.getCenterX() > dockParentRect.mRight)
+		{
+			mDockTongueX = dockParentRect.mRight - mDockTongue->getWidth() / 2;;
+		}
+		else
+		{
+			mDockTongueX = dockRect.getCenterX() - mDockTongue->getWidth() / 2;
+		}
+		mDockTongueY = dockRect.mTop + mDockTongue->getHeight();
+
 		break;
 	}
 
diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h
index 550955c4c5..a5caf68001 100644
--- a/indra/llui/lldockcontrol.h
+++ b/indra/llui/lldockcontrol.h
@@ -47,8 +47,9 @@ class LLDockControl
 public:
 	enum DocAt
 	{
-		TOP
-		,LEFT
+		TOP,
+		LEFT,
+		BOTTOM
 	};
 
 public:
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 2d694eefd3..5a2152e1e7 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1353,9 +1353,6 @@ bool LLAppViewer::cleanup()
 
 	llinfos << "Cache files removed" << llendflush;
 
-
-	cleanup_menus();
-
 	// Wait for any pending VFS IO
 	while (1)
 	{
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index bff32af228..a2648e4c3a 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -130,7 +130,6 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
 	
 	// status bar can possible overlay menus?
 	setMouseOpaque(FALSE);
-	setIsChrome(TRUE);
 
 	// size of day of the weeks and year
 	sDays.reserve(7);
@@ -140,9 +139,39 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
 	mHealthTimer = new LLFrameTimer();
 
 	LLUICtrlFactory::getInstance()->buildPanel(this,"panel_status_bar.xml");
+}
 
-	// status bar can never get a tab
-	setFocusRoot(FALSE);
+LLStatusBar::~LLStatusBar()
+{
+	delete mBalanceTimer;
+	mBalanceTimer = NULL;
+
+	delete mHealthTimer;
+	mHealthTimer = NULL;
+
+	// LLView destructor cleans up children
+}
+
+//-----------------------------------------------------------------------
+// Overrides
+//-----------------------------------------------------------------------
+
+// virtual
+void LLStatusBar::draw()
+{
+	refresh();
+	LLPanel::draw();
+}
+
+BOOL LLStatusBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
+{
+	show_navbar_context_menu(this,x,y);
+	return TRUE;
+}
+
+BOOL LLStatusBar::postBuild()
+{
+	gMenuBarView->setRightMouseDownCallback(boost::bind(&show_navbar_context_menu, _1, _2, _3));
 
 	// build date necessary data (must do after panel built)
 	setupDate();
@@ -158,7 +187,9 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
 	mBtnVolume = getChild<LLButton>( "volume_btn" );
 	mBtnVolume->setClickedCallback( onClickVolume, this );
 	mBtnVolume->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterVolume, this));
-	mBtnVolume->setIsChrome(TRUE);
+
+	LLButton* media_toggle = getChild<LLButton>("media_toggle_btn");
+	media_toggle->setMouseEnterCallback(boost::bind(&LLFloaterReg::showInstance, "nearby_media", LLSD(), true));
 
 	gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&LLStatusBar::onVolumeChanged, this, _2));
 
@@ -218,39 +249,6 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
 	mPanelVolumePulldown->setShape(volume_pulldown_rect);
 	mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
 	mPanelVolumePulldown->setVisible(FALSE);
-}
-
-LLStatusBar::~LLStatusBar()
-{
-	delete mBalanceTimer;
-	mBalanceTimer = NULL;
-
-	delete mHealthTimer;
-	mHealthTimer = NULL;
-
-	// LLView destructor cleans up children
-}
-
-//-----------------------------------------------------------------------
-// Overrides
-//-----------------------------------------------------------------------
-
-// virtual
-void LLStatusBar::draw()
-{
-	refresh();
-	LLPanel::draw();
-}
-
-BOOL LLStatusBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
-{
-	show_navbar_context_menu(this,x,y);
-	return TRUE;
-}
-
-BOOL LLStatusBar::postBuild()
-{
-	gMenuBarView->setRightMouseDownCallback(boost::bind(&show_navbar_context_menu, _1, _2, _3));
 
 	return TRUE;
 }
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 5754f67045..77eb9f2a75 100644
--- a/indra/newview/skins/default/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml
@@ -3,6 +3,7 @@
  background_opaque="true"
  background_visible="true"
  bg_opaque_color="MouseGray"
+ chrome="true" 
  follows="top|right"
  height="19"
  layout="topleft"
@@ -10,6 +11,7 @@
  mouse_opaque="false"
  name="status"
  top="19"
+ tab_stop="false" 
  width="1000">
     <panel.string
      name="StatBarDaysOfWeek">
@@ -73,7 +75,7 @@
      pad_bottom="2"
      tool_tip="Click to buy more L$"
      top="2"
-     width="71" />
+     width="45" />
     <text
      type="string"
      font="SansSerifSmall"
@@ -86,9 +88,24 @@
      left_pad="0"
      name="TimeText"
      tool_tip="Current time (Pacific)"
-     width="89">
+     width="80">
         24:00 AM PST
     </text>
+    <button
+     follows="right|top"
+     height="15"
+     image_selected="button_anim_play.tga"
+     image_unselected="button_anim_pause.tga"
+     image_pressed="button_anim_pause_selected.tga"
+     image_pressed_selected="button_anim_play_selected.tga"
+     is_toggle="true"
+     left_pad="15"
+     top="2"
+     name="media_toggle_btn"
+     tool_tip="Click to toggle media"
+     width="16" >
+    </button>
+
     <button
      follows="right|top"
      height="15"
@@ -96,7 +113,7 @@
      image_pressed="Audio_Press"
      image_unselected="Audio_Off"
      is_toggle="true"
-     left_pad="18"
+     left_pad="5"
      top="2"
      name="volume_btn"
      tool_tip="Global Volume Control"
-- 
cgit v1.2.3