summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorskolb <none@none>2009-12-03 11:40:18 -0800
committerskolb <none@none>2009-12-03 11:40:18 -0800
commitec34503e0193514ffbb1ccb1249013adb0a9e320 (patch)
treea3107a4073eda3b2ae14f74fdd0c8920aac65ec4 /indra
parent1de537d1bd0532269960490e859259ebe9391834 (diff)
parent8752f020fc4dc3e605e361f824fcfd4eae4b2ab0 (diff)
local merge
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpanelprimmediacontrols.cpp112
-rw-r--r--indra/newview/llpanelprimmediacontrols.h7
-rw-r--r--indra/newview/skins/default/xui/en/panel_prim_media_controls.xml175
3 files changed, 113 insertions, 181 deletions
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index e86123d565..aa2b7d4554 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -54,6 +54,7 @@
#include "llpanelprimmediacontrols.h"
#include "llpluginclassmedia.h"
#include "llprogressbar.h"
+#include "llsliderctrl.h"
#include "llstring.h"
#include "llviewercontrol.h"
#include "llviewerparcelmgr.h"
@@ -63,6 +64,8 @@
#include "llweb.h"
#include "llwindow.h"
+#include "llfloatertools.h" // to enable hide if build tools are up
+
glh::matrix4f glh_get_current_modelview();
glh::matrix4f glh_get_current_projection();
@@ -88,7 +91,8 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
mTargetImplID(LLUUID::null),
mTargetObjectNormal(LLVector3::zero),
mZoomObjectID(LLUUID::null),
- mZoomObjectFace(0)
+ mZoomObjectFace(0),
+ mVolumeSliderVisible(false)
{
mCommitCallbackRegistrar.add("MediaCtrl.Close", boost::bind(&LLPanelPrimMediaControls::onClickClose, this));
mCommitCallbackRegistrar.add("MediaCtrl.Back", boost::bind(&LLPanelPrimMediaControls::onClickBack, this));
@@ -105,7 +109,9 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
mCommitCallbackRegistrar.add("MediaCtrl.JumpProgress", boost::bind(&LLPanelPrimMediaControls::onCommitSlider, this));
mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeUp", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeUp, this));
mCommitCallbackRegistrar.add("MediaCtrl.CommitVolumeDown", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeDown, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.Volume", boost::bind(&LLPanelPrimMediaControls::onCommitVolumeSlider, this));
mCommitCallbackRegistrar.add("MediaCtrl.ToggleMute", boost::bind(&LLPanelPrimMediaControls::onToggleMute, this));
+ mCommitCallbackRegistrar.add("MediaCtrl.ShowVolumeSlider", boost::bind(&LLPanelPrimMediaControls::showVolumeSlider, this));
mCommitCallbackRegistrar.add("MediaCtrl.SkipBack", boost::bind(&LLPanelPrimMediaControls::onClickSkipBack, this));
mCommitCallbackRegistrar.add("MediaCtrl.SkipForward", boost::bind(&LLPanelPrimMediaControls::onClickSkipForward, this));
@@ -147,12 +153,14 @@ BOOL LLPanelPrimMediaControls::postBuild()
mVolumeBtn = getChild<LLButton>("media_volume_button");
mVolumeUpCtrl = getChild<LLUICtrl>("volume_up");
mVolumeDownCtrl = getChild<LLUICtrl>("volume_down");
+ mVolumeSliderCtrl = getChild<LLSliderCtrl>("volume_slider");
mWhitelistIcon = getChild<LLIconCtrl>("media_whitelist_flag");
mSecureLockIcon = getChild<LLIconCtrl>("media_secure_lock_flag");
mMediaControlsStack = getChild<LLLayoutStack>("media_controls");
mLeftBookend = getChild<LLUICtrl>("left_bookend");
mRightBookend = getChild<LLUICtrl>("right_bookend");
mBackgroundImage = LLUI::getUIImage(getString("control_background_image_name"));
+ mVolumeSliderBackgroundImage = LLUI::getUIImage(getString("control_background_image_name"));
LLStringUtil::convertToF32(getString("skip_step"), mSkipStep);
LLStringUtil::convertToS32(getString("min_width"), mMinWidth);
LLStringUtil::convertToS32(getString("min_height"), mMinHeight);
@@ -267,7 +275,7 @@ void LLPanelPrimMediaControls::updateShape()
LLViewerMediaImpl* media_impl = getTargetMediaImpl();
LLViewerObject* objectp = getTargetObject();
- if(!media_impl)
+ if(!media_impl || gFloaterTools->getVisible())
{
setVisible(FALSE);
return;
@@ -296,11 +304,13 @@ void LLPanelPrimMediaControls::updateShape()
LLMediaEntry *media_data = objectp->getTE(mTargetObjectFace)->getMediaData();
if (media_data && NULL != dynamic_cast<LLVOVolume*>(objectp))
{
- // Don't show the media HUD if we do not have permissions
+ // Don't show the media controls if we do not have permissions
enabled = dynamic_cast<LLVOVolume*>(objectp)->hasMediaPermission(media_data, LLVOVolume::MEDIA_PERM_CONTROL);
mini_controls = (LLMediaEntry::MINI == media_data->getControls());
}
+ const bool is_hud = objectp->isHUDAttachment();
+
//
// Set the state of the buttons
//
@@ -323,8 +333,8 @@ void LLPanelPrimMediaControls::updateShape()
mWhitelistIcon->setVisible(!mini_controls && (media_data)?media_data->getWhiteListEnable():false);
// Disable zoom if HUD
- mZoomCtrl->setEnabled(!objectp->isHUDAttachment());
- mUnzoomCtrl->setEnabled(!objectp->isHUDAttachment());
+ mZoomCtrl->setEnabled(!is_hud);
+ mUnzoomCtrl->setEnabled(!is_hud);
mSecureLockIcon->setVisible(false);
mCurrentURL = media_impl->getCurrentMediaURL();
@@ -355,6 +365,8 @@ void LLPanelPrimMediaControls::updateShape()
mVolumeUpCtrl->setVisible(has_focus);
mVolumeDownCtrl->setVisible(has_focus);
mVolumeCtrl->setEnabled(has_focus);
+ mVolumeSliderCtrl->setEnabled(has_focus && mVolumeSliderVisible);
+ mVolumeSliderCtrl->setVisible(has_focus && mVolumeSliderVisible);
mWhitelistIcon->setVisible(false);
mSecureLockIcon->setVisible(false);
@@ -411,6 +423,7 @@ void LLPanelPrimMediaControls::updateShape()
mVolumeUpCtrl->setEnabled(TRUE);
mVolumeDownCtrl->setEnabled(TRUE);
}
+ mVolumeSliderCtrl->setValue(volume);
switch(result)
{
@@ -456,9 +469,11 @@ void LLPanelPrimMediaControls::updateShape()
mVolumeCtrl->setVisible(FALSE);
mVolumeUpCtrl->setVisible(FALSE);
mVolumeDownCtrl->setVisible(FALSE);
+ mVolumeSliderCtrl->setVisible(FALSE);
mVolumeCtrl->setEnabled(FALSE);
mVolumeUpCtrl->setEnabled(FALSE);
mVolumeDownCtrl->setEnabled(FALSE);
+ mVolumeSliderCtrl->setEnabled(FALSE);
if (mMediaPanelScroll)
{
@@ -548,56 +563,58 @@ void LLPanelPrimMediaControls::updateShape()
//
// Calculate position and shape of the controls
//
+ LLVector3 min, max;
+
glh::matrix4f mat = glh_get_current_projection()*glh_get_current_modelview();
std::vector<LLVector3>::iterator vert_it;
std::vector<LLVector3>::iterator vert_end;
std::vector<LLVector3> vect_face;
-
+
LLVolume* volume = objectp->getVolume();
-
+
if (volume)
{
const LLVolumeFace& vf = volume->getVolumeFace(mTargetObjectFace);
-
+
const LLVector3* ext = vf.mExtents;
-
+
LLVector3 center = (ext[0]+ext[1])*0.5f;
LLVector3 size = (ext[1]-ext[0])*0.5f;
LLVector3 vert[] =
- {
- center + size.scaledVec(LLVector3(1,1,1)),
- center + size.scaledVec(LLVector3(-1,1,1)),
- center + size.scaledVec(LLVector3(1,-1,1)),
- center + size.scaledVec(LLVector3(-1,-1,1)),
- center + size.scaledVec(LLVector3(1,1,-1)),
- center + size.scaledVec(LLVector3(-1,1,-1)),
- center + size.scaledVec(LLVector3(1,-1,-1)),
- center + size.scaledVec(LLVector3(-1,-1,-1)),
- };
-
+ {
+ center + size.scaledVec(LLVector3(1,1,1)),
+ center + size.scaledVec(LLVector3(-1,1,1)),
+ center + size.scaledVec(LLVector3(1,-1,1)),
+ center + size.scaledVec(LLVector3(-1,-1,1)),
+ center + size.scaledVec(LLVector3(1,1,-1)),
+ center + size.scaledVec(LLVector3(-1,1,-1)),
+ center + size.scaledVec(LLVector3(1,-1,-1)),
+ center + size.scaledVec(LLVector3(-1,-1,-1)),
+ };
+
LLVOVolume* vo = (LLVOVolume*) objectp;
-
+
for (U32 i = 0; i < 8; i++)
{
- vect_face.push_back(vo->volumePositionToAgent(vert[i]));
+ vect_face.push_back(vo->volumePositionToAgent(vert[i]));
}
}
vert_it = vect_face.begin();
vert_end = vect_face.end();
-
- LLVector3 min = LLVector3(1,1,1);
- LLVector3 max = LLVector3(-1,-1,-1);
+
+ min = LLVector3(1,1,1);
+ max = LLVector3(-1,-1,-1);
for(; vert_it != vert_end; ++vert_it)
{
// project silhouette vertices into screen space
glh::vec3f screen_vert = glh::vec3f(vert_it->mV);
mat.mult_matrix_vec(screen_vert);
-
+
// add to screenspace bounding box
update_min_max(min, max, LLVector3(screen_vert.v));
}
-
- LLCoordGL screen_min;
+
+ LLCoordGL screen_min;
screen_min.mX = llround((F32)gViewerWindow->getWorldViewWidthScaled() * (min.mV[VX] + 1.f) * 0.5f);
screen_min.mY = llround((F32)gViewerWindow->getWorldViewHeightScaled() * (min.mV[VY] + 1.f) * 0.5f);
@@ -607,17 +624,16 @@ void LLPanelPrimMediaControls::updateShape()
// grow panel so that screenspace bounding box fits inside "media_region" element of HUD
LLRect media_controls_rect;
+ S32 volume_slider_height = mVolumeSliderCtrl->getRect().getHeight() - /*fudge*/ 2;
getParent()->screenRectToLocal(LLRect(screen_min.mX, screen_max.mY, screen_max.mX, screen_min.mY), &media_controls_rect);
media_controls_rect.mLeft -= mMediaRegion->getRect().mLeft;
- media_controls_rect.mBottom -= mMediaRegion->getRect().mBottom;
+ media_controls_rect.mBottom -= mMediaRegion->getRect().mBottom - volume_slider_height;
media_controls_rect.mTop += getRect().getHeight() - mMediaRegion->getRect().mTop;
media_controls_rect.mRight += getRect().getWidth() - mMediaRegion->getRect().mRight;
// keep all parts of HUD on-screen
media_controls_rect.intersectWith(getParent()->getLocalRect());
- if (mCurrentZoom != ZOOM_NONE)
- media_controls_rect.mBottom -= mMediaControlsStack->getRect().getHeight() + mMediaProgressPanel->getRect().getHeight();
-
+
// clamp to minimum size, keeping centered
media_controls_rect.setCenterAndSize(media_controls_rect.getCenterX(), media_controls_rect.getCenterY(),
llmax(mMinWidth, media_controls_rect.getWidth()), llmax(mMinHeight, media_controls_rect.getHeight()));
@@ -681,6 +697,7 @@ void LLPanelPrimMediaControls::draw()
setVisible(FALSE);
mClearFaceOnFade = false;
+ mVolumeSliderVisible = false;
mTargetImplID = LLUUID::null;
mTargetObjectID = LLUUID::null;
mTargetObjectFace = 0;
@@ -692,16 +709,29 @@ void LLPanelPrimMediaControls::draw()
// Assumes layout_stack is a direct child of this panel
mMediaControlsStack->updateLayout();
LLRect icon_area = mMediaControlsStack->getRect();
+
+ // adjust to ignore space from volume slider
+ icon_area.mTop -= mVolumeSliderCtrl->getRect().getHeight();
// adjust to ignore space from left bookend padding
icon_area.mLeft += mLeftBookend->getRect().getWidth();
// ignore space from right bookend padding
icon_area.mRight -= mRightBookend->getRect().getWidth();
-
- // get UI image
+
+ // draw control background UI image
mBackgroundImage->draw( icon_area, UI_VERTEX_COLOR % alpha);
+ // draw volume slider background UI image
+ if (mVolumeSliderCtrl->getVisible())
+ {
+ LLRect volume_slider_rect = mVolumeSliderCtrl->getRect();
+ // For some reason the rect is not in the right place (??)
+ // This translates the bg to under the slider
+ volume_slider_rect.translate(mVolumeSliderCtrl->getParent()->getRect().mLeft, icon_area.getHeight());
+ mVolumeSliderBackgroundImage->draw(volume_slider_rect, UI_VERTEX_COLOR % alpha);
+ }
+
{
LLViewDrawContext context(alpha);
LLPanel::draw();
@@ -1187,6 +1217,16 @@ void LLPanelPrimMediaControls::onCommitVolumeDown()
}
}
+void LLPanelPrimMediaControls::onCommitVolumeSlider()
+{
+ focusOnTarget();
+
+ LLViewerMediaImpl* media_impl = getTargetMediaImpl();
+ if (media_impl)
+ {
+ media_impl->setVolume(mVolumeSliderCtrl->getValueF32());
+ }
+}
void LLPanelPrimMediaControls::onToggleMute()
{
@@ -1208,3 +1248,7 @@ void LLPanelPrimMediaControls::onToggleMute()
}
}
+void LLPanelPrimMediaControls::showVolumeSlider()
+{
+ mVolumeSliderVisible = true;
+}
diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h
index fe8f100abe..06163051a5 100644
--- a/indra/newview/llpanelprimmediacontrols.h
+++ b/indra/newview/llpanelprimmediacontrols.h
@@ -40,6 +40,7 @@ class LLCoordWindow;
class LLIconCtrl;
class LLLayoutStack;
class LLProgressBar;
+class LLSliderCtrl;
class LLViewerMediaImpl;
class LLPanelPrimMediaControls : public LLPanel
@@ -106,7 +107,9 @@ private:
void onCommitVolumeUp();
void onCommitVolumeDown();
+ void onCommitVolumeSlider();
void onToggleMute();
+ void showVolumeSlider();
static void onScrollUp(void* user_data);
static void onScrollUpHeld(void* user_data);
@@ -153,12 +156,14 @@ private:
LLButton *mVolumeBtn;
LLUICtrl *mVolumeUpCtrl;
LLUICtrl *mVolumeDownCtrl;
+ LLSliderCtrl *mVolumeSliderCtrl;
LLIconCtrl *mWhitelistIcon;
LLIconCtrl *mSecureLockIcon;
LLLayoutStack *mMediaControlsStack;
LLUICtrl *mLeftBookend;
LLUICtrl *mRightBookend;
LLUIImage* mBackgroundImage;
+ LLUIImage* mVolumeSliderBackgroundImage;
F32 mSkipStep;
S32 mMinWidth;
S32 mMinHeight;
@@ -198,6 +203,8 @@ private:
LLUUID mZoomObjectID;
S32 mZoomObjectFace;
+
+ bool mVolumeSliderVisible;
};
#endif // LL_PANELPRIMMEDIACONTROLS_H
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 8b86067b03..e21de31498 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
@@ -3,7 +3,7 @@
follows="left|right|top|bottom"
name="MediaControls"
background_visible="false"
- height="192"
+ height="200"
layout="topleft"
mouse_opaque="false"
width="800">
@@ -16,20 +16,20 @@
<string name="zoom_far_padding">1.5</string>
<panel
name="media_region"
- bottom="125"
+ height="100"
follows="left|right|top|bottom"
layout="topleft"
mouse_opaque="false"
- top="20" />
+ top="0" />
<layout_stack
name="media_controls"
follows="left|right"
animate="false"
- height="26"
+ height="75"
layout="topleft"
left="0"
orientation="horizontal"
- top="128">
+ top="100">
<!-- outer layout_panels center the inner one -->
<layout_panel
name="left_bookend"
@@ -239,19 +239,6 @@
layout="topleft"
width="190"
min_width="90">
- <!--
- RE-ENABLE THIS WHEN WE HAVE A HISTORY DROP-DOWN AGAIN
- <combo_box
- name="media_address_url"
- allow_text_entry="true"
- height="22"
- layout="topleft"
- max_chars="1024"
- tool_tip = "Media URL">
- <combo_box.commit_callback
- function="MediaCtrl.CommitURL" />
- </combo_box>
- -->
<line_editor
name="media_address_url"
follows="left|right"
@@ -314,8 +301,9 @@
<slider_bar
name="media_play_slider"
follows="left|right|top"
- height="16"
- increment="0.05"
+ height="20"
+ bottom="88"
+ increment="0.01"
initial_value="0.5"
layout="topleft"
tool_tip="Movie play progress"
@@ -379,7 +367,8 @@
auto_resize="false"
user_resize="false"
layout="topleft"
- height="22"
+ top="-50"
+ height="72"
min_width="22"
width="22">
<!-- Note: this is not quite right either...the mute button is not the -->
@@ -397,138 +386,30 @@
layout="topleft"
scale_image="false"
tool_tip="Mute This Media"
- top_delta="18"
+ top="118"
min_width="22"
width="22" >
<button.commit_callback
function="MediaCtrl.ToggleMute" />
+ <button.mouseenter_callback
+ function="MediaCtrl.ShowVolumeSlider" />
</button>
- </layout_panel>
- <!-- We do not have a design yet for "volume", so this is a temporary -->
- <!-- solution. See DEV-42827. -->
- <layout_panel
- name="volume_up"
- auto_resize="false"
- user_resize="false"
- layout="topleft"
- min_width="14"
- height="14"
- width="14">
- <button
- image_overlay="media_btn_scrollup.png"
- image_disabled="PushButton_Disabled"
- image_disabled_selected="PushButton_Disabled"
- image_selected="PushButton_Selected"
- image_unselected="PushButton_Off"
- hover_glow_amount="0.15"
- top="-5"
- height="14"
- layout="topleft"
- tool_tip="Volume up"
- scale_image="true"
- min_width="14"
- width="14" >
- <button.commit_callback
- function="MediaCtrl.CommitVolumeUp" />
- </button>
- </layout_panel>
- <layout_panel
- name="volume_down"
- auto_resize="false"
- user_resize="false"
- layout="topleft"
- min_width="14"
- height="14"
- width="14">
- <button
- image_overlay="media_btn_scrolldown.png"
- image_disabled="PushButton_Disabled"
- image_disabled_selected="PushButton_Disabled"
- image_selected="PushButton_Selected"
- image_unselected="PushButton_Off"
- hover_glow_amount="0.15"
- layout="topleft"
- tool_tip="Volume down"
- scale_image="true"
- top="-5"
- height="14"
- min_width="14"
- width="14">
- <button.commit_callback
- function="MediaCtrl.CommitVolumeDown" />
- </button>
- </layout_panel>
- <!-- Scroll pad -->
- <!-- This was removed from the design, but is still here because it is -->
- <!-- complex, and recreating it would be hard. In case the design -->
- <!-- changes, here it lies: -->
- <!--
- <layout_panel
- name="media_panel_scroll"
- auto_resize="false"
- user_resize="false"
- height="32"
- follows="left|right|top|bottom"
- layout="topleft"
- min_width="32"
- width="32">
- <icon
- height="32"
- image_name="media_panel_scrollbg.png"
- layout="topleft"
- top="0"
- min_width="32"
- width="32" />
- <button
- name="scrollup"
- height="8"
- image_selected="media_btn_scrollup.png"
- image_unselected="media_btn_scrollup.png"
- layout="topleft"
- tool_tip="Scroll up"
- scale_image="false"
- left="12"
- top_delta="4"
- min_width="8"
- width="8" />
- <button
- name="scrollleft"
- height="8"
- image_selected="media_btn_scrollleft.png"
- image_unselected="media_btn_scrollleft.png"
- layout="topleft"
- left="3"
- tool_tip="Scroll left"
- scale_image="false"
- top="12"
- min_width="8"
- width="8" />
- <button
- name="scrollright"
- height="8"
- image_selected="media_btn_scrollright.png"
- image_unselected="media_btn_scrollright.png"
- layout="topleft"
- left_pad="9"
- tool_tip="Scroll right"
- scale_image="false"
- top_delta="0"
- min_width="8"
- width="8" />
- <button
- name="scrolldown"
- height="8"
- image_selected="media_btn_scrolldown.png"
- image_unselected="media_btn_scrolldown.png"
+ <slider
+ orientation="vertical"
+ left="0"
+ top="-2"
+ height="50"
layout="topleft"
- left="12"
- tool_tip="Scroll down"
- scale_image="false"
- top="20"
- min_width="8"
- width="8" />
+ increment="0.01"
+ initial_value="0.5"
+ name="volume_slider"
+ tool_tip="Media Volume"
+ show_text="false"
+ volume="true">
+ <slider.commit_callback
+ function="MediaCtrl.Volume"/>
+ </slider>
</layout_panel>
- -->
<panel
height="28"
layout="topleft"
@@ -628,7 +509,7 @@
animate="false"
left="0"
orientation="horizontal"
- top="150">
+ top="170">
<!-- outer layout_panels center the inner one -->
<layout_panel
width="0"