From 98d54377f9a793ffc0ed0aff31e828ec772a8d10 Mon Sep 17 00:00:00 2001
From: Rick Pasetto <rick@lindenlab.com>
Date: Thu, 19 Nov 2009 16:47:29 -0800
Subject: Make time-based media "forward" and "back" different from navigate
 forward and navigate back

---
 indra/newview/llpanelprimmediacontrols.cpp         | 46 +++++++++++++++++--
 indra/newview/llpanelprimmediacontrols.h           |  4 ++
 .../default/xui/en/panel_prim_media_controls.xml   | 53 +++++++++++++++++++++-
 3 files changed, 98 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index 12ad070efd..80d2a9425c 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -102,6 +102,8 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
 	mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeUp",	boost::bind(&LLPanelPrimMediaControls::onCommitVolumeUp, this));
 	mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeDown",	boost::bind(&LLPanelPrimMediaControls::onCommitVolumeDown, this));
 	mCommitCallbackRegistrar.add("MediaCtrl.ToggleMute",		boost::bind(&LLPanelPrimMediaControls::onToggleMute, this));
+	mCommitCallbackRegistrar.add("MediaCtrl.SkipBack",		boost::bind(&LLPanelPrimMediaControls::onClickSkipBack, this));
+	mCommitCallbackRegistrar.add("MediaCtrl.SkipForward",	boost::bind(&LLPanelPrimMediaControls::onClickSkipForward, this));
 	
 	LLUICtrlFactory::getInstance()->buildPanel(this, "panel_prim_media_controls.xml");
 	mInactivityTimer.reset();
@@ -135,6 +137,8 @@ BOOL LLPanelPrimMediaControls::postBuild()
 	mMediaAddress			= getChild<LLUICtrl>("media_address_url");
 	mMediaPlaySliderPanel	= getChild<LLUICtrl>("media_play_position");
 	mMediaPlaySliderCtrl	= getChild<LLUICtrl>("media_play_slider");
+	mSkipFwdCtrl			= getChild<LLUICtrl>("skip_forward");
+	mSkipBackCtrl			= getChild<LLUICtrl>("skip_back");
 	mVolumeCtrl				= getChild<LLUICtrl>("media_volume");
 	mVolumeBtn				= getChild<LLButton>("media_volume_button");
 	mVolumeUpCtrl			= getChild<LLUICtrl>("volume_up");
@@ -329,12 +333,17 @@ void LLPanelPrimMediaControls::updateShape()
 			mReloadCtrl->setVisible(FALSE);
 			mMediaStopCtrl->setVisible(has_focus);
 			mHomeCtrl->setVisible(FALSE);
-			mBackCtrl->setEnabled(has_focus);
-			mFwdCtrl->setEnabled(has_focus);
+			// No nav controls
+			mBackCtrl->setVisible(FALSE);
+			mFwdCtrl->setEnabled(FALSE);
 			mMediaAddressCtrl->setVisible(false);
 			mMediaAddressCtrl->setEnabled(false);
 			mMediaPlaySliderPanel->setVisible(has_focus && !mini_controls);
 			mMediaPlaySliderPanel->setEnabled(has_focus && !mini_controls);
+			mSkipFwdCtrl->setVisible(has_focus && !mini_controls);
+			mSkipFwdCtrl->setEnabled(has_focus && !mini_controls);
+			mSkipBackCtrl->setVisible(has_focus && !mini_controls);
+			mSkipBackCtrl->setEnabled(has_focus && !mini_controls);
 				
 			mVolumeCtrl->setVisible(has_focus);
 			mVolumeUpCtrl->setVisible(has_focus);
@@ -435,6 +444,10 @@ void LLPanelPrimMediaControls::updateShape()
 			mMediaAddressCtrl->setEnabled(has_focus && !mini_controls);
 			mMediaPlaySliderPanel->setVisible(FALSE);
 			mMediaPlaySliderPanel->setEnabled(FALSE);
+			mSkipFwdCtrl->setVisible(FALSE);
+			mSkipFwdCtrl->setEnabled(FALSE);
+			mSkipBackCtrl->setVisible(FALSE);
+			mSkipBackCtrl->setEnabled(FALSE);
 				
 			mVolumeCtrl->setVisible(FALSE);
 			mVolumeUpCtrl->setVisible(FALSE);
@@ -789,7 +802,7 @@ void LLPanelPrimMediaControls::onClickForward()
 	focusOnTarget();
 
 	LLViewerMediaImpl* impl = getTargetMediaImpl();
-	
+
 	if (impl)
 	{
 		impl->navigateForward();
@@ -866,12 +879,39 @@ void LLPanelPrimMediaControls::onClickStop()
 	}
 }
 
+void LLPanelPrimMediaControls::onClickSkipBack()
+{
+	focusOnTarget();
+
+	LLViewerMediaImpl* impl =getTargetMediaImpl();
+	
+	if (impl)
+	{
+		// XXX Oddly, the impl has the policy that "skipping" is really navigating
+		impl->navigateBack();
+	}
+}
+
+void LLPanelPrimMediaControls::onClickSkipForward()
+{
+	focusOnTarget();
+
+	LLViewerMediaImpl* impl = getTargetMediaImpl();
+
+	if (impl)
+	{
+		// XXX Oddly, the impl has the policy that "skipping" is really navigating
+		impl->navigateForward();
+	}
+}
+
 void LLPanelPrimMediaControls::onClickZoom()
 {
 	focusOnTarget();
 
 	nextZoomLevel();
 }
+
 void LLPanelPrimMediaControls::nextZoomLevel()
 {
 	int index = 0;
diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h
index 124fa9cce4..aeee3685ed 100644
--- a/indra/newview/llpanelprimmediacontrols.h
+++ b/indra/newview/llpanelprimmediacontrols.h
@@ -95,6 +95,8 @@ private:
 	void onClickPause();
 	void onClickStop();
 	void onClickZoom();
+	void onClickSkipBack();
+	void onClickSkipForward();
 	void onCommitURL();
 	
 	void updateZoom();
@@ -137,6 +139,8 @@ private:
 	LLUICtrl *mHomeCtrl;
 	LLUICtrl *mUnzoomCtrl;
 	LLUICtrl *mOpenCtrl;
+	LLUICtrl *mSkipBackCtrl;
+	LLUICtrl *mSkipFwdCtrl;
 	LLUICtrl *mZoomCtrl;
 	LLPanel  *mMediaProgressPanel;
 	LLProgressBar *mMediaProgressBar;
diff --git a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml
index 98025e28db..00e3116217 100644
--- a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml
+++ b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml
@@ -86,7 +86,7 @@
 		  auto_resize="false"
 		  height="22"
 		  layout="topleft"
-		  tool_tip="Step back"
+		  tool_tip="Navigate back"
 		  width="22"
 		  left="0"
 		  top_delta="4">
@@ -111,7 +111,7 @@
 		  hover_glow_amount="0.15"
 		  height="22"
 		  layout="topleft"
-		  tool_tip="Step forward"
+		  tool_tip="Navigate forward"
 		  top_delta="0"
 		  min_width="22"
 		  width="22">
@@ -359,6 +359,55 @@ function="MediaCtrl.CommitURL" />
 			function="MediaCtrl.JumpProgress" />
 	  </slider_bar>
 	</layout_panel>
+	<layout_panel
+		name="skip_back"
+		auto_resize="false"
+		user_resize="false"
+		layout="topleft"
+		min_width="22"
+		width="22">
+	  <button
+		  image_overlay="SkipBackward_Off"
+		  image_disabled="PushButton_Disabled"
+		  image_disabled_selected="PushButton_Disabled"
+		  image_selected="PushButton_Selected"
+		  image_unselected="PushButton_Off"
+		  hover_glow_amount="0.15"
+		  auto_resize="false"
+		  height="22"
+		  layout="topleft"
+		  tool_tip="Step back"
+		  top="-14"
+		  width="22"
+		  left="0">
+		<button.commit_callback
+			function="MediaCtrl.SkipBack" />
+	  </button>
+	</layout_panel>
+	<layout_panel
+		name="skip_forward"
+		auto_resize="false"
+		user_resize="false"
+		layout="topleft"
+		min_width="22"
+		width="22">
+	  <button
+		  image_overlay="SkipForward_Off"
+		  image_disabled="PushButton_Disabled"
+		  image_disabled_selected="PushButton_Disabled"
+		  image_selected="PushButton_Selected"
+		  image_unselected="PushButton_Off"
+		  hover_glow_amount="0.15"
+		  height="22"
+		  layout="topleft"
+		  tool_tip="Step forward"
+		  top="-14"
+		  min_width="22"
+		  width="22">
+		<button.commit_callback
+			function="MediaCtrl.SkipForward" />
+	  </button>
+	</layout_panel>
 	<layout_panel
 		name="media_volume"
 		auto_resize="false"
-- 
cgit v1.2.3