diff options
author | Loren Shih <seraph@lindenlab.com> | 2009-12-15 11:52:44 -0500 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2009-12-15 11:52:44 -0500 |
commit | 871e64726a147623f52776993ddced97bbf0e065 (patch) | |
tree | d8941e09de552e354ad8b04a77f5f77fb71a4a6d /indra/newview/llpanelprimmediacontrols.cpp | |
parent | 045e3e06579d533619208fb415399e68714244e3 (diff) | |
parent | f125039abcb566eaa7bdf33ce9c8c550cc25783a (diff) |
automated merge avp->avp
--HG--
branch : avatar-pipeline
Diffstat (limited to 'indra/newview/llpanelprimmediacontrols.cpp')
-rw-r--r-- | indra/newview/llpanelprimmediacontrols.cpp | 145 |
1 files changed, 73 insertions, 72 deletions
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index aa2b7d4554..3fe51106e4 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -150,7 +150,7 @@ BOOL LLPanelPrimMediaControls::postBuild() mSkipFwdCtrl = getChild<LLUICtrl>("skip_forward"); mSkipBackCtrl = getChild<LLUICtrl>("skip_back"); mVolumeCtrl = getChild<LLUICtrl>("media_volume"); - mVolumeBtn = getChild<LLButton>("media_volume_button"); + mMuteBtn = getChild<LLButton>("media_mute_button"); mVolumeUpCtrl = getChild<LLUICtrl>("volume_up"); mVolumeDownCtrl = getChild<LLUICtrl>("volume_down"); mVolumeSliderCtrl = getChild<LLSliderCtrl>("volume_slider"); @@ -200,7 +200,7 @@ BOOL LLPanelPrimMediaControls::postBuild() mScrollDownCtrl->setHeldDownCallback(onScrollDownHeld, this); mScrollDownCtrl->setMouseUpCallback(onScrollStop, this); } - + mMediaAddress->setFocusReceivedCallback(boost::bind(&LLPanelPrimMediaControls::onInputURL, _1, this )); mInactiveTimeout = gSavedSettings.getF32("MediaControlTimeout"); mControlFadeTime = gSavedSettings.getF32("MediaControlFadeTime"); @@ -215,11 +215,15 @@ void LLPanelPrimMediaControls::setMediaFace(LLPointer<LLViewerObject> objectp, S { if (media_impl.notNull() && objectp.notNull()) { + LLUUID prev_id = mTargetImplID; mTargetImplID = media_impl->getMediaTextureID(); mTargetObjectID = objectp->getID(); mTargetObjectFace = face; mTargetObjectNormal = pick_normal; mClearFaceOnFade = false; + + if (prev_id != mTargetImplID) + mVolumeSliderCtrl->setValue(media_impl->getVolume()); } else { @@ -308,13 +312,12 @@ void LLPanelPrimMediaControls::updateShape() 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 // - + // XXX RSP: TODO: FIXME: clean this up so that it is clearer what mode we are in, // and that only the proper controls get made visible/enabled according to that mode. mBackCtrl->setVisible(has_focus); @@ -343,7 +346,7 @@ void LLPanelPrimMediaControls::updateShape() mStopCtrl->setEnabled(has_focus && can_navigate); mHomeCtrl->setEnabled(has_focus && can_navigate); LLPluginClassMediaOwner::EMediaStatus result = ((media_impl != NULL) && media_impl->hasMedia()) ? media_plugin->getStatus() : LLPluginClassMediaOwner::MEDIA_NONE; - + if(media_plugin && media_plugin->pluginSupportsMediaTime()) { mReloadCtrl->setEnabled(false); @@ -360,14 +363,14 @@ void LLPanelPrimMediaControls::updateShape() 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); mVolumeDownCtrl->setVisible(has_focus); mVolumeCtrl->setEnabled(has_focus); mVolumeSliderCtrl->setEnabled(has_focus && mVolumeSliderVisible); mVolumeSliderCtrl->setVisible(has_focus && mVolumeSliderVisible); - + mWhitelistIcon->setVisible(false); mSecureLockIcon->setVisible(false); if (mMediaPanelScroll) @@ -378,7 +381,7 @@ void LLPanelPrimMediaControls::updateShape() mScrollRightCtrl->setVisible(false); mScrollDownCtrl->setVisible(false); } - + F32 volume = media_impl->getVolume(); // movie's url changed if(mCurrentURL!=mPreviousURL) @@ -386,7 +389,7 @@ void LLPanelPrimMediaControls::updateShape() mMovieDuration = media_plugin->getDuration(); mPreviousURL = mCurrentURL; } - + if(mMovieDuration == 0) { mMovieDuration = media_plugin->getDuration(); @@ -394,7 +397,7 @@ void LLPanelPrimMediaControls::updateShape() mMediaPlaySliderCtrl->setEnabled(false); } // TODO: What if it's not fully loaded - + if(mUpdateSlider && mMovieDuration!= 0) { F64 current_time = media_plugin->getCurrentTime(); @@ -402,29 +405,27 @@ void LLPanelPrimMediaControls::updateShape() mMediaPlaySliderCtrl->setValue(percent); mMediaPlaySliderCtrl->setEnabled(true); } - + // video vloume if(volume <= 0.0) { mVolumeUpCtrl->setEnabled(TRUE); mVolumeDownCtrl->setEnabled(FALSE); - media_impl->setVolume(0.0); - mVolumeBtn->setToggleState(true); + mMuteBtn->setToggleState(true); } else if (volume >= 1.0) { mVolumeUpCtrl->setEnabled(FALSE); mVolumeDownCtrl->setEnabled(TRUE); - media_impl->setVolume(1.0); - mVolumeBtn->setToggleState(false); + mMuteBtn->setToggleState(false); } else { + mMuteBtn->setToggleState(false); mVolumeUpCtrl->setEnabled(TRUE); mVolumeDownCtrl->setEnabled(TRUE); } - mVolumeSliderCtrl->setValue(volume); - + switch(result) { case LLPluginClassMediaOwner::MEDIA_PLAYING: @@ -453,7 +454,7 @@ void LLPanelPrimMediaControls::updateShape() { mCurrentURL.clear(); } - + mPlayCtrl->setVisible(FALSE); mPauseCtrl->setVisible(FALSE); mMediaStopCtrl->setVisible(FALSE); @@ -465,7 +466,7 @@ void LLPanelPrimMediaControls::updateShape() mSkipFwdCtrl->setEnabled(FALSE); mSkipBackCtrl->setVisible(FALSE); mSkipBackCtrl->setEnabled(FALSE); - + mVolumeCtrl->setVisible(FALSE); mVolumeUpCtrl->setVisible(FALSE); mVolumeDownCtrl->setVisible(FALSE); @@ -491,13 +492,13 @@ void LLPanelPrimMediaControls::updateShape() { mSecureLockIcon->setVisible(has_focus); } - + if(mCurrentURL!=mPreviousURL) { setCurrentURL(); mPreviousURL = mCurrentURL; } - + if(result == LLPluginClassMediaOwner::MEDIA_LOADING) { mReloadCtrl->setEnabled(FALSE); @@ -513,7 +514,7 @@ void LLPanelPrimMediaControls::updateShape() mStopCtrl->setVisible(FALSE); } } - + if(media_plugin) { @@ -530,7 +531,7 @@ void LLPanelPrimMediaControls::updateShape() mMediaProgressPanel->setVisible(false); } } - + if(media_impl) { // @@ -538,28 +539,28 @@ void LLPanelPrimMediaControls::updateShape() // switch (mScrollState) { - case SCROLL_UP: - media_impl->scrollWheel(0, -1, MASK_NONE); - break; - case SCROLL_DOWN: - media_impl->scrollWheel(0, 1, MASK_NONE); - break; - case SCROLL_LEFT: - media_impl->scrollWheel(1, 0, MASK_NONE); -// media_impl->handleKeyHere(KEY_LEFT, MASK_NONE); - break; - case SCROLL_RIGHT: - media_impl->scrollWheel(-1, 0, MASK_NONE); -// media_impl->handleKeyHere(KEY_RIGHT, MASK_NONE); - break; - case SCROLL_NONE: - default: - break; + case SCROLL_UP: + media_impl->scrollWheel(0, -1, MASK_NONE); + break; + case SCROLL_DOWN: + media_impl->scrollWheel(0, 1, MASK_NONE); + break; + case SCROLL_LEFT: + media_impl->scrollWheel(1, 0, MASK_NONE); + // media_impl->handleKeyHere(KEY_LEFT, MASK_NONE); + break; + case SCROLL_RIGHT: + media_impl->scrollWheel(-1, 0, MASK_NONE); + // media_impl->handleKeyHere(KEY_RIGHT, MASK_NONE); + break; + case SCROLL_NONE: + default: + break; } } setVisible(enabled); - + // // Calculate position and shape of the controls // @@ -569,31 +570,31 @@ void LLPanelPrimMediaControls::updateShape() 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])); @@ -601,7 +602,7 @@ void LLPanelPrimMediaControls::updateShape() } vert_it = vect_face.begin(); vert_end = vect_face.end(); - + min = LLVector3(1,1,1); max = LLVector3(-1,-1,-1); for(; vert_it != vert_end; ++vert_it) @@ -609,19 +610,19 @@ void LLPanelPrimMediaControls::updateShape() // 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; 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); - + LLCoordGL screen_max; screen_max.mX = llround((F32)gViewerWindow->getWorldViewWidthScaled() * (max.mV[VX] + 1.f) * 0.5f); screen_max.mY = llround((F32)gViewerWindow->getWorldViewHeightScaled() * (max.mV[VY] + 1.f) * 0.5f); - + // 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; @@ -636,19 +637,19 @@ void LLPanelPrimMediaControls::updateShape() // 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())); - + llmax(mMinWidth, media_controls_rect.getWidth()), llmax(mMinHeight, media_controls_rect.getHeight())); + setShape(media_controls_rect, true); - + // Test mouse position to see if the cursor is stationary LLCoordWindow cursor_pos_window; getWindow()->getCursorPosition(&cursor_pos_window); - + // If last pos is not equal to current pos, the mouse has moved // We need to reset the timer, and make sure the panel is visible if(cursor_pos_window.mX != mLastCursorPos.mX || - cursor_pos_window.mY != mLastCursorPos.mY || - mScrollState != SCROLL_NONE) + cursor_pos_window.mY != mLastCursorPos.mY || + mScrollState != SCROLL_NONE) { mInactivityTimer.start(); mLastCursorPos = cursor_pos_window; @@ -673,7 +674,7 @@ void LLPanelPrimMediaControls::updateShape() else { // I don't think this is correct anymore. This is done in draw() after the fade has completed. -// setVisible(FALSE); + // setVisible(FALSE); } } } @@ -1193,7 +1194,7 @@ void LLPanelPrimMediaControls::onCommitVolumeUp() } media_impl->setVolume(volume); - mVolumeBtn->setToggleState(false); + mMuteBtn->setToggleState(false); } } @@ -1213,7 +1214,7 @@ void LLPanelPrimMediaControls::onCommitVolumeDown() } media_impl->setVolume(volume); - mVolumeBtn->setToggleState(false); + mMuteBtn->setToggleState(false); } } @@ -1243,7 +1244,7 @@ void LLPanelPrimMediaControls::onToggleMute() } else { - media_impl->setVolume(0.5); + media_impl->setVolume(mVolumeSliderCtrl->getValueF32()); } } } |