summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelprimmediacontrols.cpp48
-rw-r--r--indra/newview/llviewermedia.cpp31
-rw-r--r--indra/newview/llviewermedia.h5
3 files changed, 55 insertions, 29 deletions
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index cbff13a20f..4c552ee815 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -127,7 +127,7 @@ BOOL LLPanelPrimMediaControls::postBuild()
scroll_left_ctrl->setMouseUpCallback(onScrollStop, this);
LLButton* scroll_right_ctrl = getChild<LLButton>("scrollright");
scroll_right_ctrl->setClickedCallback(onScrollRight, this);
- scroll_right_ctrl->setHeldDownCallback(onScrollLeftHeld, this);
+ scroll_right_ctrl->setHeldDownCallback(onScrollRightHeld, this);
scroll_right_ctrl->setMouseUpCallback(onScrollStop, this);
LLButton* scroll_down_ctrl = getChild<LLButton>("scrolldown");
scroll_down_ctrl->setClickedCallback(onScrollDown, this);
@@ -291,7 +291,7 @@ void LLPanelPrimMediaControls::updateShape()
// Disable zoom if HUD
zoom_ctrl->setEnabled(!objectp->isHUDAttachment());
secure_lock_icon->setVisible(false);
- mCurrentURL = media_impl->getMediaURL();
+ 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);
@@ -472,7 +472,7 @@ void LLPanelPrimMediaControls::updateShape()
}
}
- if(media_plugin)
+ if(media_impl)
{
//
// Handle Scrolling
@@ -480,16 +480,18 @@ void LLPanelPrimMediaControls::updateShape()
switch (mScrollState)
{
case SCROLL_UP:
- media_plugin->scrollEvent(0, -1, MASK_NONE);
+ media_impl->scrollWheel(0, -1, MASK_NONE);
break;
case SCROLL_DOWN:
- media_plugin->scrollEvent(0, 1, MASK_NONE);
+ media_impl->scrollWheel(0, 1, MASK_NONE);
break;
case SCROLL_LEFT:
- media_impl->handleKeyHere(KEY_LEFT, MASK_NONE);
+ media_impl->scrollWheel(1, 0, MASK_NONE);
+// media_impl->handleKeyHere(KEY_LEFT, MASK_NONE);
break;
case SCROLL_RIGHT:
- media_impl->handleKeyHere(KEY_RIGHT, MASK_NONE);
+ media_impl->scrollWheel(-1, 0, MASK_NONE);
+// media_impl->handleKeyHere(KEY_RIGHT, MASK_NONE);
break;
case SCROLL_NONE:
default:
@@ -758,20 +760,10 @@ void LLPanelPrimMediaControls::onClickHome()
void LLPanelPrimMediaControls::onClickOpen()
{
- LLViewerMediaImpl* impl =getTargetMediaImpl();
+ LLViewerMediaImpl* impl = getTargetMediaImpl();
if(impl)
{
- if(impl->getMediaPlugin())
- {
- if(impl->getMediaPlugin()->getLocation().empty())
- {
- LLWeb::loadURL(impl->getMediaURL());
- }
- else
- {
- LLWeb::loadURL( impl->getMediaPlugin()->getLocation());
- }
- }
+ LLWeb::loadURL(impl->getCurrentMediaURL());
}
}
@@ -895,11 +887,11 @@ void LLPanelPrimMediaControls::onScrollUp(void* user_data)
LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
this_panel->focusOnTarget();
- LLPluginClassMedia* plugin = this_panel->getTargetMediaPlugin();
+ LLViewerMediaImpl* impl = this_panel->getTargetMediaImpl();
- if(plugin)
+ if(impl)
{
- plugin->scrollEvent(0, -1, MASK_NONE);
+ impl->scrollWheel(0, -1, MASK_NONE);
}
}
void LLPanelPrimMediaControls::onScrollUpHeld(void* user_data)
@@ -916,7 +908,8 @@ void LLPanelPrimMediaControls::onScrollRight(void* user_data)
if(impl)
{
- impl->handleKeyHere(KEY_RIGHT, MASK_NONE);
+ impl->scrollWheel(-1, 0, MASK_NONE);
+// impl->handleKeyHere(KEY_RIGHT, MASK_NONE);
}
}
void LLPanelPrimMediaControls::onScrollRightHeld(void* user_data)
@@ -934,7 +927,8 @@ void LLPanelPrimMediaControls::onScrollLeft(void* user_data)
if(impl)
{
- impl->handleKeyHere(KEY_LEFT, MASK_NONE);
+ impl->scrollWheel(1, 0, MASK_NONE);
+// impl->handleKeyHere(KEY_LEFT, MASK_NONE);
}
}
void LLPanelPrimMediaControls::onScrollLeftHeld(void* user_data)
@@ -948,11 +942,11 @@ void LLPanelPrimMediaControls::onScrollDown(void* user_data)
LLPanelPrimMediaControls* this_panel = static_cast<LLPanelPrimMediaControls*> (user_data);
this_panel->focusOnTarget();
- LLPluginClassMedia* plugin = this_panel->getTargetMediaPlugin();
+ LLViewerMediaImpl* impl = this_panel->getTargetMediaImpl();
- if(plugin)
+ if(impl)
{
- plugin->scrollEvent(0, 1, MASK_NONE);
+ impl->scrollWheel(0, 1, MASK_NONE);
}
}
void LLPanelPrimMediaControls::onScrollDownHeld(void* user_data)
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 8bd74dcb04..e2d9f5a2c9 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1023,6 +1023,16 @@ bool LLViewerMediaImpl::hasFocus() const
return mHasFocus;
}
+std::string LLViewerMediaImpl::getCurrentMediaURL()
+{
+ if(!mCurrentMediaURL.empty())
+ {
+ return mCurrentMediaURL;
+ }
+
+ return mMediaURL;
+}
+
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::mouseDown(S32 x, S32 y, MASK mask, S32 button)
{
@@ -1109,6 +1119,18 @@ void LLViewerMediaImpl::mouseDoubleClick(S32 x, S32 y, MASK mask, S32 button)
}
//////////////////////////////////////////////////////////////////////////////////////////
+void LLViewerMediaImpl::scrollWheel(S32 x, S32 y, MASK mask)
+{
+ scaleMouse(&x, &y);
+ mLastMouseX = x;
+ mLastMouseY = y;
+ if (mMediaSource)
+ {
+ mMediaSource->scrollEvent(x, y, mask);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::onMouseCaptureLost()
{
if (mMediaSource)
@@ -1181,7 +1203,7 @@ void LLViewerMediaImpl::navigateForward()
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::navigateReload()
{
- navigateTo(mMediaURL, "", true, false);
+ navigateTo(getCurrentMediaURL(), "", true, false);
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -1203,6 +1225,9 @@ void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mi
mMediaURL = url;
mMimeType = mime_type;
+ // Clear the current media URL, since it will no longer be correct.
+ mCurrentMediaURL.clear();
+
// if mime type discovery was requested, we'll need to do it when the media loads
mNavigateRediscoverType = rediscover_type;
@@ -1702,10 +1727,12 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
if(getNavState() == MEDIANAVSTATE_BEGUN)
{
+ mCurrentMediaURL = plugin->getNavigateURI();
setNavState(MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED);
}
else if(getNavState() == MEDIANAVSTATE_SERVER_BEGUN)
{
+ mCurrentMediaURL = plugin->getNavigateURI();
setNavState(MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED);
}
else
@@ -1721,10 +1748,12 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
if(getNavState() == MEDIANAVSTATE_BEGUN)
{
+ mCurrentMediaURL = plugin->getLocation();
setNavState(MEDIANAVSTATE_FIRST_LOCATION_CHANGED);
}
else if(getNavState() == MEDIANAVSTATE_SERVER_BEGUN)
{
+ mCurrentMediaURL = plugin->getLocation();
setNavState(MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED);
}
else
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index 4f0d39dd80..5444abf854 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -145,6 +145,7 @@ public:
void mouseUp(const LLVector2& texture_coords, MASK mask, S32 button = 0);
void mouseMove(const LLVector2& texture_coords, MASK mask);
void mouseDoubleClick(S32 x,S32 y, MASK mask, S32 button = 0);
+ void scrollWheel(S32 x, S32 y, MASK mask);
void mouseCapture();
void navigateBack();
@@ -159,6 +160,7 @@ public:
bool canNavigateForward();
bool canNavigateBack();
std::string getMediaURL() { return mMediaURL; }
+ std::string getCurrentMediaURL();
std::string getHomeURL() { return mHomeURL; }
void setHomeURL(const std::string& home_url) { mHomeURL = home_url; };
std::string getMimeType() { return mMimeType; }
@@ -272,9 +274,10 @@ public:
LLPluginClassMedia* mMediaSource;
LLUUID mTextureId;
bool mMovieImageHasMips;
- std::string mMediaURL;
+ std::string mMediaURL; // The last media url set with NavigateTo
std::string mHomeURL;
std::string mMimeType;
+ std::string mCurrentMediaURL; // The most current media url from the plugin (via the "location changed" or "navigate complete" events).
S32 mLastMouseX; // save the last mouse coord we get, so when we lose capture we can simulate a mouseup at that point.
S32 mLastMouseY;
S32 mMediaWidth;