From 0f6242d9fd948cda1abf18885eef320b22d310c5 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 10 Nov 2009 14:00:38 -0800 Subject: Sanitize naming of getWindowRect (scaled vs. raw pixels) and getWorldViewRect (scaled vs. raw) Reduces chance of future UI bugs related to UI size. Discussed with Richard. --- indra/newview/llpanelprimmediacontrols.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelprimmediacontrols.cpp') diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 73e19b3b2a..53493b71b2 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -561,12 +561,12 @@ void LLPanelPrimMediaControls::updateShape() } LLCoordGL screen_min; - screen_min.mX = llround((F32)gViewerWindow->getWorldViewWidth() * (min.mV[VX] + 1.f) * 0.5f); - screen_min.mY = llround((F32)gViewerWindow->getWorldViewHeight() * (min.mV[VY] + 1.f) * 0.5f); + screen_min.mX = llround((F32)gViewerWindow->getWorldViewWidthRaw() * (min.mV[VX] + 1.f) * 0.5f); + screen_min.mY = llround((F32)gViewerWindow->getWorldViewHeightRaw() * (min.mV[VY] + 1.f) * 0.5f); LLCoordGL screen_max; - screen_max.mX = llround((F32)gViewerWindow->getWorldViewWidth() * (max.mV[VX] + 1.f) * 0.5f); - screen_max.mY = llround((F32)gViewerWindow->getWorldViewHeight() * (max.mV[VY] + 1.f) * 0.5f); + screen_max.mX = llround((F32)gViewerWindow->getWorldViewWidthRaw() * (max.mV[VX] + 1.f) * 0.5f); + screen_max.mY = llround((F32)gViewerWindow->getWorldViewHeightRaw() * (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; -- cgit v1.2.3 From eda34b82ee20ce43362b3fb20e809f97cc8c0081 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Wed, 11 Nov 2009 15:50:43 -0800 Subject: Remove references to media_panel_scroll in LLPanelPrimMediaControls::updateShape(), as it was removed from the XUI file. --- indra/newview/llpanelprimmediacontrols.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelprimmediacontrols.cpp') diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 5c3c260549..bb2ded7ca5 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -271,7 +271,7 @@ void LLPanelPrimMediaControls::updateShape() LLIconCtrl* whitelist_icon = getChild("media_whitelist_flag"); LLIconCtrl* secure_lock_icon = getChild("media_secure_lock_flag"); - LLUICtrl* media_panel_scroll = getChild("media_panel_scroll"); +// LLUICtrl* media_panel_scroll = getChild("media_panel_scroll"); LLUICtrl* scroll_up_ctrl = getChild("scrollup"); LLUICtrl* scroll_left_ctrl = getChild("scrollleft"); LLUICtrl* scroll_right_ctrl = getChild("scrollright"); @@ -330,7 +330,7 @@ void LLPanelPrimMediaControls::updateShape() scroll_left_ctrl->setVisible(false); scroll_right_ctrl->setVisible(false); scroll_down_ctrl->setVisible(false); - media_panel_scroll->setVisible(false); +// media_panel_scroll->setVisible(false); F32 volume = media_impl->getVolume(); // movie's url changed @@ -427,7 +427,7 @@ void LLPanelPrimMediaControls::updateShape() scroll_left_ctrl->setVisible(has_focus); scroll_right_ctrl->setVisible(has_focus); scroll_down_ctrl->setVisible(has_focus); - media_panel_scroll->setVisible(has_focus); +// media_panel_scroll->setVisible(has_focus); // TODO: get the secure lock bool from media plug in std::string prefix = std::string("https://"); std::string test_prefix = mCurrentURL.substr(0, prefix.length()); -- cgit v1.2.3 From bea3b937d9907e4491caaec909cd404d401694ac Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Wed, 11 Nov 2009 16:12:25 -0800 Subject: Fix a potential crash if scroll button is not there --- indra/newview/llpanelprimmediacontrols.cpp | 64 +++++++++++++++++++----------- 1 file changed, 41 insertions(+), 23 deletions(-) (limited to 'indra/newview/llpanelprimmediacontrols.cpp') diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 5c3c260549..24de2dcdfc 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -118,21 +118,33 @@ LLPanelPrimMediaControls::~LLPanelPrimMediaControls() BOOL LLPanelPrimMediaControls::postBuild() { LLButton* scroll_up_ctrl = getChild("scrollup"); - scroll_up_ctrl->setClickedCallback(onScrollUp, this); - scroll_up_ctrl->setHeldDownCallback(onScrollUpHeld, this); - scroll_up_ctrl->setMouseUpCallback(onScrollStop, this); + if (scroll_up_ctrl) + { + scroll_up_ctrl->setClickedCallback(onScrollUp, this); + scroll_up_ctrl->setHeldDownCallback(onScrollUpHeld, this); + scroll_up_ctrl->setMouseUpCallback(onScrollStop, this); + } LLButton* scroll_left_ctrl = getChild("scrollleft"); - scroll_left_ctrl->setClickedCallback(onScrollLeft, this); - scroll_left_ctrl->setHeldDownCallback(onScrollLeftHeld, this); - scroll_left_ctrl->setMouseUpCallback(onScrollStop, this); + if (scroll_left_ctrl) + { + scroll_left_ctrl->setClickedCallback(onScrollLeft, this); + scroll_left_ctrl->setHeldDownCallback(onScrollLeftHeld, this); + scroll_left_ctrl->setMouseUpCallback(onScrollStop, this); + } LLButton* scroll_right_ctrl = getChild("scrollright"); - scroll_right_ctrl->setClickedCallback(onScrollRight, this); - scroll_right_ctrl->setHeldDownCallback(onScrollRightHeld, this); - scroll_right_ctrl->setMouseUpCallback(onScrollStop, this); + if (scroll_right_ctrl) + { + scroll_right_ctrl->setClickedCallback(onScrollRight, this); + scroll_right_ctrl->setHeldDownCallback(onScrollRightHeld, this); + scroll_right_ctrl->setMouseUpCallback(onScrollStop, this); + } LLButton* scroll_down_ctrl = getChild("scrolldown"); - scroll_down_ctrl->setClickedCallback(onScrollDown, this); - scroll_down_ctrl->setHeldDownCallback(onScrollDownHeld, this); - scroll_down_ctrl->setMouseUpCallback(onScrollStop, this); + if (scroll_down_ctrl) + { + scroll_down_ctrl->setClickedCallback(onScrollDown, this); + scroll_down_ctrl->setHeldDownCallback(onScrollDownHeld, this); + scroll_down_ctrl->setMouseUpCallback(onScrollStop, this); + } LLUICtrl* media_address = getChild("media_address"); media_address->setFocusReceivedCallback(boost::bind(&LLPanelPrimMediaControls::onInputURL, _1, this )); @@ -326,11 +338,14 @@ void LLPanelPrimMediaControls::updateShape() whitelist_icon->setVisible(false); secure_lock_icon->setVisible(false); - scroll_up_ctrl->setVisible(false); - scroll_left_ctrl->setVisible(false); - scroll_right_ctrl->setVisible(false); - scroll_down_ctrl->setVisible(false); - media_panel_scroll->setVisible(false); + if (media_panel_scroll) + { + media_panel_scroll->setVisible(false); + scroll_up_ctrl->setVisible(false); + scroll_left_ctrl->setVisible(false); + scroll_right_ctrl->setVisible(false); + scroll_down_ctrl->setVisible(false); + } F32 volume = media_impl->getVolume(); // movie's url changed @@ -422,12 +437,15 @@ void LLPanelPrimMediaControls::updateShape() volume_ctrl->setEnabled(FALSE); volume_up_ctrl->setEnabled(FALSE); volume_down_ctrl->setEnabled(FALSE); - - scroll_up_ctrl->setVisible(has_focus); - scroll_left_ctrl->setVisible(has_focus); - scroll_right_ctrl->setVisible(has_focus); - scroll_down_ctrl->setVisible(has_focus); - media_panel_scroll->setVisible(has_focus); + + if (media_panel_scroll) + { + media_panel_scroll->setVisible(has_focus); + scroll_up_ctrl->setVisible(has_focus); + scroll_left_ctrl->setVisible(has_focus); + scroll_right_ctrl->setVisible(has_focus); + scroll_down_ctrl->setVisible(has_focus); + } // TODO: get the secure lock bool from media plug in std::string prefix = std::string("https://"); std::string test_prefix = mCurrentURL.substr(0, prefix.length()); -- cgit v1.2.3 From 6a3e8353a7c0e80e2a4558e3a3a345646788981e Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Wed, 11 Nov 2009 16:32:54 -0800 Subject: Fix merge error (and hence build breakage :( ) --- indra/newview/llpanelprimmediacontrols.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelprimmediacontrols.cpp') diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index c2c8c6c48e..24de2dcdfc 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -283,7 +283,7 @@ void LLPanelPrimMediaControls::updateShape() LLIconCtrl* whitelist_icon = getChild("media_whitelist_flag"); LLIconCtrl* secure_lock_icon = getChild("media_secure_lock_flag"); -// LLUICtrl* media_panel_scroll = getChild("media_panel_scroll"); + LLUICtrl* media_panel_scroll = getChild("media_panel_scroll"); LLUICtrl* scroll_up_ctrl = getChild("scrollup"); LLUICtrl* scroll_left_ctrl = getChild("scrollleft"); LLUICtrl* scroll_right_ctrl = getChild("scrollright"); -- cgit v1.2.3 From ca630bf6bb1c7c8e04f5ed1e7d649d29d504a6e1 Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Fri, 13 Nov 2009 11:52:12 -0800 Subject: Add background to media controls This actually required some help from James and Richard. Thanks, guys! This adds custom-drawing of a background image underneath the icons that make up the media controls in the layout stack. In order to have this work, we had to publicize API in lllayoutstack to force relayout to calculate the size. I also did another cleanup pass ("Boy Scout Rule") that squirreled away all pertinent controls into membed variables, instead of doing a getChild() every time updateShape() is called. Readjusted a bunch of components as well. --- indra/newview/llpanelprimmediacontrols.cpp | 373 +++++++++++++++-------------- 1 file changed, 192 insertions(+), 181 deletions(-) (limited to 'indra/newview/llpanelprimmediacontrols.cpp') diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 24de2dcdfc..9744d9ac0d 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -44,6 +44,7 @@ #include "llbutton.h" #include "llface.h" #include "llcombobox.h" +#include "lllayoutstack.h" #include "llslider.h" #include "llhudview.h" #include "lliconctrl.h" @@ -84,8 +85,7 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() : mUpdateSlider(true), mClearFaceOnFade(false), mCurrentRate(0.0), - mMovieDuration(0.0), - mUpdatePercent(0) + mMovieDuration(0.0) { mCommitCallbackRegistrar.add("MediaCtrl.Close", boost::bind(&LLPanelPrimMediaControls::onClickClose, this)); mCommitCallbackRegistrar.add("MediaCtrl.Back", boost::bind(&LLPanelPrimMediaControls::onClickBack, this)); @@ -117,37 +117,69 @@ LLPanelPrimMediaControls::~LLPanelPrimMediaControls() BOOL LLPanelPrimMediaControls::postBuild() { - LLButton* scroll_up_ctrl = getChild("scrollup"); - if (scroll_up_ctrl) + mMediaRegion = getChild("media_region"); assert(mMediaRegion); + mBackCtrl = getChild("back"); assert(mBackCtrl); + mFwdCtrl = getChild("fwd"); assert(mFwdCtrl); + mReloadCtrl = getChild("reload"); assert(mReloadCtrl); + mPlayCtrl = getChild("play"); assert(mPlayCtrl); + mPauseCtrl = getChild("pause"); assert(mPauseCtrl); + mStopCtrl = getChild("stop"); assert(mStopCtrl); + mMediaStopCtrl = getChild("media_stop"); assert(mMediaStopCtrl); + mHomeCtrl = getChild("home"); assert(mHomeCtrl); + mUnzoomCtrl = getChild("close"); assert(mUnzoomCtrl); // This is actually "unzoom" + mOpenCtrl = getChild("new_window"); assert(mOpenCtrl); + mZoomCtrl = getChild("zoom_frame"); assert(mZoomCtrl); + mMediaProgressPanel = getChild("media_progress_indicator"); assert(mMediaProgressPanel); + mMediaProgressBar = getChild("media_progress_bar"); assert(mMediaProgressBar); + mMediaAddressCtrl = getChild("media_address"); assert(mMediaAddressCtrl); + mMediaAddress = getChild("media_address_url"); assert(mMediaAddress); + mMediaPlaySliderPanel = getChild("media_play_position"); assert(mMediaPlaySliderPanel); + mMediaPlaySliderCtrl = getChild("media_play_slider"); assert(mMediaPlaySliderCtrl); + mVolumeCtrl = getChild("media_volume"); assert(mVolumeCtrl); + mVolumeBtn = getChild("media_volume_button"); assert(mVolumeBtn); + mVolumeUpCtrl = getChild("volume_up"); assert(mVolumeUpCtrl); + mVolumeDownCtrl = getChild("volume_down"); assert(mVolumeDownCtrl); + mWhitelistIcon = getChild("media_whitelist_flag"); assert(mWhitelistIcon); + mSecureLockIcon = getChild("media_secure_lock_flag"); assert(mSecureLockIcon); + mMediaControlsStack = getChild("media_controls"); assert(mMediaControlsStack); + mLeftBookend = getChild("left_bookend"); assert(mLeftBookend); + mRightBookend = getChild("right_bookend"); assert(mRightBookend); + mBackgroundImage = LLUI::getUIImage(getString("control_background_image_name")); assert(mBackgroundImage); + + // These are currently removed...but getChild creates a "dummy" widget. + // This class handles them missing. + mMediaPanelScroll = findChild("media_panel_scroll"); + mScrollUpCtrl = findChild("scrollup"); + mScrollLeftCtrl = findChild("scrollleft"); + mScrollRightCtrl = findChild("scrollright"); + mScrollDownCtrl = findChild("scrolldown"); + + if (mScrollUpCtrl) { - scroll_up_ctrl->setClickedCallback(onScrollUp, this); - scroll_up_ctrl->setHeldDownCallback(onScrollUpHeld, this); - scroll_up_ctrl->setMouseUpCallback(onScrollStop, this); + mScrollUpCtrl->setClickedCallback(onScrollUp, this); + mScrollUpCtrl->setHeldDownCallback(onScrollUpHeld, this); + mScrollUpCtrl->setMouseUpCallback(onScrollStop, this); } - LLButton* scroll_left_ctrl = getChild("scrollleft"); - if (scroll_left_ctrl) + if (mScrollLeftCtrl) { - scroll_left_ctrl->setClickedCallback(onScrollLeft, this); - scroll_left_ctrl->setHeldDownCallback(onScrollLeftHeld, this); - scroll_left_ctrl->setMouseUpCallback(onScrollStop, this); + mScrollLeftCtrl->setClickedCallback(onScrollLeft, this); + mScrollLeftCtrl->setHeldDownCallback(onScrollLeftHeld, this); + mScrollLeftCtrl->setMouseUpCallback(onScrollStop, this); } - LLButton* scroll_right_ctrl = getChild("scrollright"); - if (scroll_right_ctrl) + if (mScrollRightCtrl) { - scroll_right_ctrl->setClickedCallback(onScrollRight, this); - scroll_right_ctrl->setHeldDownCallback(onScrollRightHeld, this); - scroll_right_ctrl->setMouseUpCallback(onScrollStop, this); + mScrollRightCtrl->setClickedCallback(onScrollRight, this); + mScrollRightCtrl->setHeldDownCallback(onScrollRightHeld, this); + mScrollRightCtrl->setMouseUpCallback(onScrollStop, this); } - LLButton* scroll_down_ctrl = getChild("scrolldown"); - if (scroll_down_ctrl) + if (mScrollDownCtrl) { - scroll_down_ctrl->setClickedCallback(onScrollDown, this); - scroll_down_ctrl->setHeldDownCallback(onScrollDownHeld, this); - scroll_down_ctrl->setMouseUpCallback(onScrollStop, this); + mScrollDownCtrl->setClickedCallback(onScrollDown, this); + mScrollDownCtrl->setHeldDownCallback(onScrollDownHeld, this); + mScrollDownCtrl->setMouseUpCallback(onScrollStop, this); } - LLUICtrl* media_address = getChild("media_address"); - media_address->setFocusReceivedCallback(boost::bind(&LLPanelPrimMediaControls::onInputURL, _1, this )); + mMediaAddress->setFocusReceivedCallback(boost::bind(&LLPanelPrimMediaControls::onInputURL, _1, this )); mInactiveTimeout = gSavedSettings.getF32("MediaControlTimeout"); mControlFadeTime = gSavedSettings.getF32("MediaControlFadeTime"); @@ -261,90 +293,63 @@ void LLPanelPrimMediaControls::updateShape() // // Set the state of the buttons // - LLUICtrl* back_ctrl = getChild("back"); - LLUICtrl* fwd_ctrl = getChild("fwd"); - LLUICtrl* reload_ctrl = getChild("reload"); - LLUICtrl* play_ctrl = getChild("play"); - LLUICtrl* pause_ctrl = getChild("pause"); - LLUICtrl* stop_ctrl = getChild("stop"); - LLUICtrl* media_stop_ctrl = getChild("media_stop"); - LLUICtrl* home_ctrl = getChild("home"); - LLUICtrl* unzoom_ctrl = getChild("close"); // This is actually "unzoom" - LLUICtrl* open_ctrl = getChild("new_window"); - LLUICtrl* zoom_ctrl = getChild("zoom_frame"); - LLPanel* media_loading_panel = getChild("media_progress_indicator"); - LLUICtrl* media_address_ctrl = getChild("media_address"); - LLUICtrl* media_play_slider_panel = getChild("media_play_position"); - LLUICtrl* media_play_slider_ctrl = getChild("media_play_slider"); - LLUICtrl* volume_ctrl = getChild("media_volume"); - LLButton* volume_btn = getChild("media_volume_button"); - LLUICtrl* volume_up_ctrl = getChild("volume_up"); - LLUICtrl* volume_down_ctrl = getChild("volume_down"); - LLIconCtrl* whitelist_icon = getChild("media_whitelist_flag"); - LLIconCtrl* secure_lock_icon = getChild("media_secure_lock_flag"); - - LLUICtrl* media_panel_scroll = getChild("media_panel_scroll"); - LLUICtrl* scroll_up_ctrl = getChild("scrollup"); - LLUICtrl* scroll_left_ctrl = getChild("scrollleft"); - LLUICtrl* scroll_right_ctrl = getChild("scrollright"); - LLUICtrl* scroll_down_ctrl = getChild("scrolldown"); // 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. - back_ctrl->setVisible(has_focus); - fwd_ctrl->setVisible(has_focus); - reload_ctrl->setVisible(has_focus); - stop_ctrl->setVisible(false); - home_ctrl->setVisible(has_focus); - zoom_ctrl->setVisible(!is_zoomed); - unzoom_ctrl->setVisible(has_focus && is_zoomed); - open_ctrl->setVisible(true); - media_address_ctrl->setVisible(has_focus && !mini_controls); - media_play_slider_panel->setVisible(has_focus && !mini_controls); - volume_ctrl->setVisible(false); - volume_up_ctrl->setVisible(false); - volume_down_ctrl->setVisible(false); + mBackCtrl->setVisible(has_focus); + mFwdCtrl->setVisible(has_focus); + mReloadCtrl->setVisible(has_focus); + mStopCtrl->setVisible(false); + mHomeCtrl->setVisible(has_focus); + mZoomCtrl->setVisible(!is_zoomed); + mUnzoomCtrl->setVisible(has_focus && is_zoomed); + mOpenCtrl->setVisible(true); + mMediaAddressCtrl->setVisible(has_focus && !mini_controls); + mMediaPlaySliderPanel->setVisible(has_focus && !mini_controls); + mVolumeCtrl->setVisible(false); + mVolumeUpCtrl->setVisible(false); + mVolumeDownCtrl->setVisible(false); - whitelist_icon->setVisible(!mini_controls && (media_data)?media_data->getWhiteListEnable():false); + mWhitelistIcon->setVisible(!mini_controls && (media_data)?media_data->getWhiteListEnable():false); // Disable zoom if HUD - zoom_ctrl->setEnabled(!objectp->isHUDAttachment()); - unzoom_ctrl->setEnabled(!objectp->isHUDAttachment()); - secure_lock_icon->setVisible(false); + mZoomCtrl->setEnabled(!objectp->isHUDAttachment()); + mUnzoomCtrl->setEnabled(!objectp->isHUDAttachment()); + mSecureLockIcon->setVisible(false); mCurrentURL = media_impl->getCurrentMediaURL(); - back_ctrl->setEnabled((media_impl != NULL) && media_impl->canNavigateBack() && can_navigate); - fwd_ctrl->setEnabled((media_impl != NULL) && media_impl->canNavigateForward() && can_navigate); - stop_ctrl->setEnabled(has_focus && can_navigate); - home_ctrl->setEnabled(has_focus && can_navigate); + mBackCtrl->setEnabled((media_impl != NULL) && media_impl->canNavigateBack() && can_navigate); + mFwdCtrl->setEnabled((media_impl != NULL) && media_impl->canNavigateForward() && can_navigate); + 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()) { - reload_ctrl->setEnabled(FALSE); - reload_ctrl->setVisible(FALSE); - media_stop_ctrl->setVisible(has_focus); - home_ctrl->setVisible(FALSE); - back_ctrl->setEnabled(has_focus); - fwd_ctrl->setEnabled(has_focus); - media_address_ctrl->setVisible(false); - media_address_ctrl->setEnabled(false); - media_play_slider_panel->setVisible(has_focus && !mini_controls); - media_play_slider_panel->setEnabled(has_focus && !mini_controls); + mReloadCtrl->setEnabled(FALSE); + mReloadCtrl->setVisible(FALSE); + mMediaStopCtrl->setVisible(has_focus); + mHomeCtrl->setVisible(FALSE); + mBackCtrl->setEnabled(has_focus); + mFwdCtrl->setEnabled(has_focus); + mMediaAddressCtrl->setVisible(false); + mMediaAddressCtrl->setEnabled(false); + mMediaPlaySliderPanel->setVisible(has_focus && !mini_controls); + mMediaPlaySliderPanel->setEnabled(has_focus && !mini_controls); - volume_ctrl->setVisible(has_focus); - volume_up_ctrl->setVisible(has_focus); - volume_down_ctrl->setVisible(has_focus); - volume_ctrl->setEnabled(has_focus); - - whitelist_icon->setVisible(false); - secure_lock_icon->setVisible(false); - if (media_panel_scroll) + mVolumeCtrl->setVisible(has_focus); + mVolumeUpCtrl->setVisible(has_focus); + mVolumeDownCtrl->setVisible(has_focus); + mVolumeCtrl->setEnabled(has_focus); + + mWhitelistIcon->setVisible(false); + mSecureLockIcon->setVisible(false); + if (mMediaPanelScroll) { - media_panel_scroll->setVisible(false); - scroll_up_ctrl->setVisible(false); - scroll_left_ctrl->setVisible(false); - scroll_right_ctrl->setVisible(false); - scroll_down_ctrl->setVisible(false); + mMediaPanelScroll->setVisible(false); + mScrollUpCtrl->setVisible(false); + mScrollDownCtrl->setVisible(false); + mScrollRightCtrl->setVisible(false); + mScrollDownCtrl->setVisible(false); } F32 volume = media_impl->getVolume(); @@ -358,8 +363,8 @@ void LLPanelPrimMediaControls::updateShape() if(mMovieDuration == 0) { mMovieDuration = media_plugin->getDuration(); - media_play_slider_ctrl->setValue(0); - media_play_slider_ctrl->setEnabled(false); + mMediaPlaySliderCtrl->setValue(0); + mMediaPlaySliderCtrl->setEnabled(false); } // TODO: What if it's not fully loaded @@ -367,48 +372,48 @@ void LLPanelPrimMediaControls::updateShape() { F64 current_time = media_plugin->getCurrentTime(); F32 percent = current_time / mMovieDuration; - media_play_slider_ctrl->setValue(percent); - media_play_slider_ctrl->setEnabled(true); + mMediaPlaySliderCtrl->setValue(percent); + mMediaPlaySliderCtrl->setEnabled(true); } // video vloume if(volume <= 0.0) { - volume_up_ctrl->setEnabled(TRUE); - volume_down_ctrl->setEnabled(FALSE); + mVolumeUpCtrl->setEnabled(TRUE); + mVolumeDownCtrl->setEnabled(FALSE); media_impl->setVolume(0.0); - volume_btn->setToggleState(true); + mVolumeBtn->setToggleState(true); } else if (volume >= 1.0) { - volume_up_ctrl->setEnabled(FALSE); - volume_down_ctrl->setEnabled(TRUE); + mVolumeUpCtrl->setEnabled(FALSE); + mVolumeDownCtrl->setEnabled(TRUE); media_impl->setVolume(1.0); - volume_btn->setToggleState(false); + mVolumeBtn->setToggleState(false); } else { - volume_up_ctrl->setEnabled(TRUE); - volume_down_ctrl->setEnabled(TRUE); + mVolumeUpCtrl->setEnabled(TRUE); + mVolumeDownCtrl->setEnabled(TRUE); } switch(result) { case LLPluginClassMediaOwner::MEDIA_PLAYING: - play_ctrl->setEnabled(FALSE); - play_ctrl->setVisible(FALSE); - pause_ctrl->setEnabled(TRUE); - pause_ctrl->setVisible(has_focus); - media_stop_ctrl->setEnabled(TRUE); + mPlayCtrl->setEnabled(FALSE); + mPlayCtrl->setVisible(FALSE); + mPauseCtrl->setEnabled(TRUE); + mPauseCtrl->setVisible(has_focus); + mMediaStopCtrl->setEnabled(TRUE); break; case LLPluginClassMediaOwner::MEDIA_PAUSED: default: - pause_ctrl->setEnabled(FALSE); - pause_ctrl->setVisible(FALSE); - play_ctrl->setEnabled(TRUE); - play_ctrl->setVisible(has_focus); - media_stop_ctrl->setEnabled(FALSE); + mPauseCtrl->setEnabled(FALSE); + mPauseCtrl->setVisible(FALSE); + mPlayCtrl->setEnabled(TRUE); + mPlayCtrl->setVisible(has_focus); + mMediaStopCtrl->setEnabled(FALSE); break; } } @@ -423,28 +428,28 @@ void LLPanelPrimMediaControls::updateShape() mCurrentURL.clear(); } - play_ctrl->setVisible(FALSE); - pause_ctrl->setVisible(FALSE); - media_stop_ctrl->setVisible(FALSE); - media_address_ctrl->setVisible(has_focus && !mini_controls); - media_address_ctrl->setEnabled(has_focus && !mini_controls); - media_play_slider_panel->setVisible(FALSE); - media_play_slider_panel->setEnabled(FALSE); + mPlayCtrl->setVisible(FALSE); + mPauseCtrl->setVisible(FALSE); + mMediaStopCtrl->setVisible(FALSE); + mMediaAddressCtrl->setVisible(has_focus && !mini_controls); + mMediaAddressCtrl->setEnabled(has_focus && !mini_controls); + mMediaPlaySliderPanel->setVisible(FALSE); + mMediaPlaySliderPanel->setEnabled(FALSE); - volume_ctrl->setVisible(FALSE); - volume_up_ctrl->setVisible(FALSE); - volume_down_ctrl->setVisible(FALSE); - volume_ctrl->setEnabled(FALSE); - volume_up_ctrl->setEnabled(FALSE); - volume_down_ctrl->setEnabled(FALSE); + mVolumeCtrl->setVisible(FALSE); + mVolumeUpCtrl->setVisible(FALSE); + mVolumeDownCtrl->setVisible(FALSE); + mVolumeCtrl->setEnabled(FALSE); + mVolumeUpCtrl->setEnabled(FALSE); + mVolumeDownCtrl->setEnabled(FALSE); - if (media_panel_scroll) + if (mMediaPanelScroll) { - media_panel_scroll->setVisible(has_focus); - scroll_up_ctrl->setVisible(has_focus); - scroll_left_ctrl->setVisible(has_focus); - scroll_right_ctrl->setVisible(has_focus); - scroll_down_ctrl->setVisible(has_focus); + mMediaPanelScroll->setVisible(has_focus); + mScrollUpCtrl->setVisible(has_focus); + mScrollDownCtrl->setVisible(has_focus); + mScrollRightCtrl->setVisible(has_focus); + mScrollDownCtrl->setVisible(has_focus); } // TODO: get the secure lock bool from media plug in std::string prefix = std::string("https://"); @@ -452,7 +457,7 @@ void LLPanelPrimMediaControls::updateShape() LLStringUtil::toLower(test_prefix); if(test_prefix == prefix) { - secure_lock_icon->setVisible(has_focus); + mSecureLockIcon->setVisible(has_focus); } if(mCurrentURL!=mPreviousURL) @@ -463,17 +468,17 @@ void LLPanelPrimMediaControls::updateShape() if(result == LLPluginClassMediaOwner::MEDIA_LOADING) { - reload_ctrl->setEnabled(FALSE); - reload_ctrl->setVisible(FALSE); - stop_ctrl->setEnabled(TRUE); - stop_ctrl->setVisible(has_focus); + mReloadCtrl->setEnabled(FALSE); + mReloadCtrl->setVisible(FALSE); + mStopCtrl->setEnabled(TRUE); + mStopCtrl->setVisible(has_focus); } else { - reload_ctrl->setEnabled(TRUE); - reload_ctrl->setVisible(has_focus); - stop_ctrl->setEnabled(FALSE); - stop_ctrl->setVisible(FALSE); + mReloadCtrl->setEnabled(TRUE); + mReloadCtrl->setVisible(has_focus); + mStopCtrl->setEnabled(FALSE); + mStopCtrl->setVisible(FALSE); } } @@ -483,16 +488,15 @@ void LLPanelPrimMediaControls::updateShape() // // Handle progress bar // - mUpdatePercent = media_plugin->getProgressPercent(); - if(mUpdatePercent<100.0f) - { - media_loading_panel->setVisible(true); - getChild("media_progress_bar")->setPercent(mUpdatePercent); - gFocusMgr.setTopCtrl(media_loading_panel); + if(LLPluginClassMediaOwner::MEDIA_LOADING == media_plugin->getStatus()) + { + mMediaProgressPanel->setVisible(true); + mMediaProgressBar->setPercent(media_plugin->getProgressPercent()); + gFocusMgr.setTopCtrl(mMediaProgressPanel); } else { - media_loading_panel->setVisible(false); + mMediaProgressPanel->setVisible(false); gFocusMgr.setTopCtrl(NULL); } } @@ -589,11 +593,10 @@ void LLPanelPrimMediaControls::updateShape() // grow panel so that screenspace bounding box fits inside "media_region" element of HUD LLRect media_controls_rect; getParent()->screenRectToLocal(LLRect(screen_min.mX, screen_max.mY, screen_max.mX, screen_min.mY), &media_controls_rect); - LLView* media_region = getChild("media_region"); - media_controls_rect.mLeft -= media_region->getRect().mLeft; - media_controls_rect.mBottom -= media_region->getRect().mBottom; - media_controls_rect.mTop += getRect().getHeight() - media_region->getRect().mTop; - media_controls_rect.mRight += getRect().getWidth() - media_region->getRect().mRight; + media_controls_rect.mLeft -= mMediaRegion->getRect().mLeft; + media_controls_rect.mBottom -= mMediaRegion->getRect().mBottom; + media_controls_rect.mTop += getRect().getHeight() - mMediaRegion->getRect().mTop; + media_controls_rect.mRight += getRect().getWidth() - mMediaRegion->getRect().mRight; LLRect old_hud_rect = media_controls_rect; // keep all parts of HUD on-screen @@ -669,6 +672,20 @@ void LLPanelPrimMediaControls::draw() } } + // Build rect for icon area in coord system of this panel + // Assumes layout_stack is a direct child of this panel + mMediaControlsStack->updateLayout(); + LLRect icon_area = mMediaControlsStack->getRect(); + + // 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 + mBackgroundImage->draw( icon_area, UI_VERTEX_COLOR % alpha); + { LLViewDrawContext context(alpha); LLPanel::draw(); @@ -711,16 +728,13 @@ bool LLPanelPrimMediaControls::isMouseOver() S32 x, y; getWindow()->getCursorPosition(&cursor_pos_window); getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl); - - LLView* controls_view = NULL; - controls_view = getChild("media_controls"); - + //FIXME: rewrite as LLViewQuery or get hover set from LLViewerWindow? - if(controls_view && controls_view->getVisible()) + if(mMediaControlsStack && mMediaControlsStack->getVisible()) { - controls_view->screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &x, &y); + mMediaControlsStack->screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &x, &y); - LLView *hit_child = controls_view->childFromPoint(x, y); + LLView *hit_child = mMediaControlsStack->childFromPoint(x, y); if(hit_child && hit_child->getVisible()) { // This was useful for debugging both coordinate translation and view hieararchy problems... @@ -1002,8 +1016,7 @@ void LLPanelPrimMediaControls::onCommitURL() { focusOnTarget(); - LLUICtrl *media_address_ctrl = getChild("media_address_url"); - std::string url = media_address_ctrl->getValue().asString(); + std::string url = mMediaAddress->getValue().asString(); if(getTargetMediaImpl() && !url.empty()) { getTargetMediaImpl()->navigateTo( url, "", true); @@ -1032,19 +1045,18 @@ void LLPanelPrimMediaControls::onInputURL(LLFocusableElement* caller, void *user void LLPanelPrimMediaControls::setCurrentURL() { #ifdef USE_COMBO_BOX_FOR_MEDIA_URL - LLComboBox* media_address_combo = getChild("media_address_combo"); - // redirects will navigate momentarily to about:blank, don't add to history - if (media_address_combo && mCurrentURL != "about:blank") - { - media_address_combo->remove(mCurrentURL); - media_address_combo->add(mCurrentURL, ADD_SORTED); - media_address_combo->selectByValue(mCurrentURL); - } +// LLComboBox* media_address_combo = getChild("media_address_combo"); +// // redirects will navigate momentarily to about:blank, don't add to history +// if (media_address_combo && mCurrentURL != "about:blank") +// { +// media_address_combo->remove(mCurrentURL); +// media_address_combo->add(mCurrentURL, ADD_SORTED); +// media_address_combo->selectByValue(mCurrentURL); +// } #else // USE_COMBO_BOX_FOR_MEDIA_URL - LLLineEditor* media_address_url = getChild("media_address_url"); - if (media_address_url && mCurrentURL != "about:blank") + if (mMediaAddress && mCurrentURL != "about:blank") { - media_address_url->setValue(mCurrentURL); + mMediaAddress->setValue(mCurrentURL); } #endif // USE_COMBO_BOX_FOR_MEDIA_URL } @@ -1053,12 +1065,11 @@ void LLPanelPrimMediaControls::onCommitSlider() { focusOnTarget(); - LLSlider* media_play_slider_ctrl = getChild("media_play_slider"); LLViewerMediaImpl* media_impl = getTargetMediaImpl(); if (media_impl) { // get slider value - F64 slider_value = media_play_slider_ctrl->getValue().asReal(); + F64 slider_value = mMediaPlaySliderCtrl->getValue().asReal(); if(slider_value <= 0.0) { media_impl->stop(); @@ -1087,7 +1098,7 @@ void LLPanelPrimMediaControls::onCommitVolumeUp() } media_impl->setVolume(volume); - getChild("media_volume")->setToggleState(false); + mVolumeBtn->setToggleState(false); } } @@ -1107,7 +1118,7 @@ void LLPanelPrimMediaControls::onCommitVolumeDown() } media_impl->setVolume(volume); - getChild("media_volume")->setToggleState(false); + mVolumeBtn->setToggleState(false); } } -- cgit v1.2.3 From a4addf39e5293e008b534c9c1cfcad14956afe1a Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Fri, 13 Nov 2009 15:09:59 -0800 Subject: Small mods based on code review feedback from James --- indra/newview/llpanelprimmediacontrols.cpp | 59 +++++++++++++++--------------- 1 file changed, 29 insertions(+), 30 deletions(-) (limited to 'indra/newview/llpanelprimmediacontrols.cpp') diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 9744d9ac0d..12ad070efd 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -117,34 +117,34 @@ LLPanelPrimMediaControls::~LLPanelPrimMediaControls() BOOL LLPanelPrimMediaControls::postBuild() { - mMediaRegion = getChild("media_region"); assert(mMediaRegion); - mBackCtrl = getChild("back"); assert(mBackCtrl); - mFwdCtrl = getChild("fwd"); assert(mFwdCtrl); - mReloadCtrl = getChild("reload"); assert(mReloadCtrl); - mPlayCtrl = getChild("play"); assert(mPlayCtrl); - mPauseCtrl = getChild("pause"); assert(mPauseCtrl); - mStopCtrl = getChild("stop"); assert(mStopCtrl); - mMediaStopCtrl = getChild("media_stop"); assert(mMediaStopCtrl); - mHomeCtrl = getChild("home"); assert(mHomeCtrl); - mUnzoomCtrl = getChild("close"); assert(mUnzoomCtrl); // This is actually "unzoom" - mOpenCtrl = getChild("new_window"); assert(mOpenCtrl); - mZoomCtrl = getChild("zoom_frame"); assert(mZoomCtrl); - mMediaProgressPanel = getChild("media_progress_indicator"); assert(mMediaProgressPanel); - mMediaProgressBar = getChild("media_progress_bar"); assert(mMediaProgressBar); - mMediaAddressCtrl = getChild("media_address"); assert(mMediaAddressCtrl); - mMediaAddress = getChild("media_address_url"); assert(mMediaAddress); - mMediaPlaySliderPanel = getChild("media_play_position"); assert(mMediaPlaySliderPanel); - mMediaPlaySliderCtrl = getChild("media_play_slider"); assert(mMediaPlaySliderCtrl); - mVolumeCtrl = getChild("media_volume"); assert(mVolumeCtrl); - mVolumeBtn = getChild("media_volume_button"); assert(mVolumeBtn); - mVolumeUpCtrl = getChild("volume_up"); assert(mVolumeUpCtrl); - mVolumeDownCtrl = getChild("volume_down"); assert(mVolumeDownCtrl); - mWhitelistIcon = getChild("media_whitelist_flag"); assert(mWhitelistIcon); - mSecureLockIcon = getChild("media_secure_lock_flag"); assert(mSecureLockIcon); - mMediaControlsStack = getChild("media_controls"); assert(mMediaControlsStack); - mLeftBookend = getChild("left_bookend"); assert(mLeftBookend); - mRightBookend = getChild("right_bookend"); assert(mRightBookend); - mBackgroundImage = LLUI::getUIImage(getString("control_background_image_name")); assert(mBackgroundImage); + mMediaRegion = getChild("media_region"); + mBackCtrl = getChild("back"); + mFwdCtrl = getChild("fwd"); + mReloadCtrl = getChild("reload"); + mPlayCtrl = getChild("play"); + mPauseCtrl = getChild("pause"); + mStopCtrl = getChild("stop"); + mMediaStopCtrl = getChild("media_stop"); + mHomeCtrl = getChild("home"); + mUnzoomCtrl = getChild("close"); // This is actually "unzoom" + mOpenCtrl = getChild("new_window"); + mZoomCtrl = getChild("zoom_frame"); + mMediaProgressPanel = getChild("media_progress_indicator"); + mMediaProgressBar = getChild("media_progress_bar"); + mMediaAddressCtrl = getChild("media_address"); + mMediaAddress = getChild("media_address_url"); + mMediaPlaySliderPanel = getChild("media_play_position"); + mMediaPlaySliderCtrl = getChild("media_play_slider"); + mVolumeCtrl = getChild("media_volume"); + mVolumeBtn = getChild("media_volume_button"); + mVolumeUpCtrl = getChild("volume_up"); + mVolumeDownCtrl = getChild("volume_down"); + mWhitelistIcon = getChild("media_whitelist_flag"); + mSecureLockIcon = getChild("media_secure_lock_flag"); + mMediaControlsStack = getChild("media_controls"); + mLeftBookend = getChild("left_bookend"); + mRightBookend = getChild("right_bookend"); + mBackgroundImage = LLUI::getUIImage(getString("control_background_image_name")); // These are currently removed...but getChild creates a "dummy" widget. // This class handles them missing. @@ -729,8 +729,7 @@ bool LLPanelPrimMediaControls::isMouseOver() getWindow()->getCursorPosition(&cursor_pos_window); getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl); - //FIXME: rewrite as LLViewQuery or get hover set from LLViewerWindow? - if(mMediaControlsStack && mMediaControlsStack->getVisible()) + if(mMediaControlsStack->getVisible()) { mMediaControlsStack->screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &x, &y); -- cgit v1.2.3 From 98d54377f9a793ffc0ed0aff31e828ec772a8d10 Mon Sep 17 00:00:00 2001 From: Rick Pasetto 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 ++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelprimmediacontrols.cpp') 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("media_address_url"); mMediaPlaySliderPanel = getChild("media_play_position"); mMediaPlaySliderCtrl = getChild("media_play_slider"); + mSkipFwdCtrl = getChild("skip_forward"); + mSkipBackCtrl = getChild("skip_back"); mVolumeCtrl = getChild("media_volume"); mVolumeBtn = getChild("media_volume_button"); mVolumeUpCtrl = getChild("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; -- cgit v1.2.3 From a8b603f33ef71ab8afae66236579d41a09b2fce1 Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Thu, 19 Nov 2009 18:34:37 -0800 Subject: Push the policy that "back", "forward" and "stop" do different things out of LLViewerMedia. Now, LLViewerMedia has explicit skipBack() and skipForward() functions, and the buttons in LLPanelPrimMediaControls now map onto those functions neatly. --- indra/newview/llpanelprimmediacontrols.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelprimmediacontrols.cpp') diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 80d2a9425c..aca0e1d5c7 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 "llstring.h" #include "llviewercontrol.h" #include "llviewerparcelmgr.h" #include "llviewermedia.h" @@ -92,6 +93,7 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() : mCommitCallbackRegistrar.add("MediaCtrl.Forward", boost::bind(&LLPanelPrimMediaControls::onClickForward, this)); mCommitCallbackRegistrar.add("MediaCtrl.Home", boost::bind(&LLPanelPrimMediaControls::onClickHome, this)); mCommitCallbackRegistrar.add("MediaCtrl.Stop", boost::bind(&LLPanelPrimMediaControls::onClickStop, this)); + mCommitCallbackRegistrar.add("MediaCtrl.MediaStop", boost::bind(&LLPanelPrimMediaControls::onClickMediaStop, this)); mCommitCallbackRegistrar.add("MediaCtrl.Reload", boost::bind(&LLPanelPrimMediaControls::onClickReload, this)); mCommitCallbackRegistrar.add("MediaCtrl.Play", boost::bind(&LLPanelPrimMediaControls::onClickPlay, this)); mCommitCallbackRegistrar.add("MediaCtrl.Pause", boost::bind(&LLPanelPrimMediaControls::onClickPause, this)); @@ -149,6 +151,7 @@ BOOL LLPanelPrimMediaControls::postBuild() mLeftBookend = getChild("left_bookend"); mRightBookend = getChild("right_bookend"); mBackgroundImage = LLUI::getUIImage(getString("control_background_image_name")); + LLStringUtil::convertToF32(getString("skip_step"), mSkipStep); // These are currently removed...but getChild creates a "dummy" widget. // This class handles them missing. @@ -873,6 +876,18 @@ void LLPanelPrimMediaControls::onClickStop() LLViewerMediaImpl* impl = getTargetMediaImpl(); + if(impl) + { + impl->navigateStop(); + } +} + +void LLPanelPrimMediaControls::onClickMediaStop() +{ + focusOnTarget(); + + LLViewerMediaImpl* impl = getTargetMediaImpl(); + if(impl) { impl->stop(); @@ -887,8 +902,7 @@ void LLPanelPrimMediaControls::onClickSkipBack() if (impl) { - // XXX Oddly, the impl has the policy that "skipping" is really navigating - impl->navigateBack(); + impl->skipBack(mSkipStep); } } @@ -900,8 +914,7 @@ void LLPanelPrimMediaControls::onClickSkipForward() if (impl) { - // XXX Oddly, the impl has the policy that "skipping" is really navigating - impl->navigateForward(); + impl->skipForward(mSkipStep); } } -- cgit v1.2.3 From 1b07c1d7fb5b6d3ce15083bc3dbb65a3f0ac8006 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Fri, 20 Nov 2009 17:49:52 -0800 Subject: Fix for DEV-43040 (Change media focus rules to be the same as alt-zoom). Added an optional reset_camera parameter to LLPanelPrimMediaControls ::resetZoomLevel(). Default is true, but if false it prevents the reset from moving the camera, and just resets the internal state for zoom tracking. Fixed zoom-related bugs in LLPanelPrimMediaControls::close() and LLPanelPrimMediaControls::onClickZoom(). Changed the zooming behavior in LLViewerMediaFocus to match the desired behavior. --- indra/newview/llpanelprimmediacontrols.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanelprimmediacontrols.cpp') diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index aca0e1d5c7..529912929d 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -782,8 +782,8 @@ void LLPanelPrimMediaControls::onClickClose() void LLPanelPrimMediaControls::close() { + resetZoomLevel(true); LLViewerMediaFocus::getInstance()->clearFocus(); - resetZoomLevel(); setVisible(FALSE); } @@ -921,8 +921,11 @@ void LLPanelPrimMediaControls::onClickSkipForward() void LLPanelPrimMediaControls::onClickZoom() { focusOnTarget(); - - nextZoomLevel(); + + if(mCurrentZoom == ZOOM_NONE) + { + nextZoomLevel(); + } } void LLPanelPrimMediaControls::nextZoomLevel() @@ -941,12 +944,15 @@ void LLPanelPrimMediaControls::nextZoomLevel() updateZoom(); } -void LLPanelPrimMediaControls::resetZoomLevel() +void LLPanelPrimMediaControls::resetZoomLevel(bool reset_camera) { if(mCurrentZoom != ZOOM_NONE) { mCurrentZoom = ZOOM_NONE; - updateZoom(); + if(reset_camera) + { + updateZoom(); + } } } -- cgit v1.2.3