summaryrefslogtreecommitdiff
path: root/indra/newview/lltoolpie.cpp
diff options
context:
space:
mode:
authorMonroe Linden <monroe@lindenlab.com>2009-10-15 18:42:30 -0700
committerMonroe Linden <monroe@lindenlab.com>2009-10-15 18:42:30 -0700
commit86787b58edf59997b68dca6a0927d24b2a24a2b5 (patch)
treeb6ad5b5a309e316f77f50b61cc042b988915eb5c /indra/newview/lltoolpie.cpp
parent217b1b1b6bf401cfb35c7725793bbbaa2264cfa2 (diff)
Major refactor of LLViewerMediaFocus and LLPanelMediaHUD.
LLViewerMediaFocus now tracks two separate objects: the currently focused media object, and the media object that's currently being hovered over. It no longer stores smart pointers to either the LLViewerObject or the LLViewerMediaImpl -- it now looks up both by UUID every time they're needed, and fails gracefully if either goes away. This will prevent it from keeping objects from being deleted. The poorly-understood "mouseOverFlag" has been expunged. LLViewerMediaFocus no longer uses LLSelectMgr at all. The object to focus on is explicitly passed between LLViewerMediaFocus and LLPanelMediaHUD instead of going indirectly through the selection manager. LLViewerMediaFocus also no longer interacts with the pick from LLToolPie -- the data it needs from the pick (the object and normal vector) is passed explicitly. LLViewerMediaFocus::setCameraZoom and LLViewerMediaFocus::getBBoxAspectRatio now have no dependencies on the LLViewerMediaFocus object -- all the data they need is passed in when they're called by the LLPanelMediaHUD. I made them static member functions, but they could be moved to LLPanelMediaHUD or even made into file-scoped static functions. The only reason I didn't do either of those is that it seems like they belong with the LLViewerMediaFocus code as opposed to the HUD.
Diffstat (limited to 'indra/newview/lltoolpie.cpp')
-rw-r--r--indra/newview/lltoolpie.cpp72
1 files changed, 30 insertions, 42 deletions
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index beb16c267e..d472626fab 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -518,11 +518,7 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
if(!object)
{
- // We need to clear media hover flag
- if (LLViewerMediaFocus::getInstance()->getMouseOverFlag())
- {
- LLViewerMediaFocus::getInstance()->setMouseOverFlag(false);
- }
+ LLViewerMediaFocus::getInstance()->clearHover();
}
}
@@ -1027,7 +1023,6 @@ bool LLToolPie::handleMediaClick(const LLPickInfo& pick)
pick.mObjectFace < 0 ||
pick.mObjectFace >= objectp->getNumTEs())
{
- LLSelectMgr::getInstance()->deselect();
LLViewerMediaFocus::getInstance()->clearFocus();
return false;
@@ -1035,11 +1030,7 @@ bool LLToolPie::handleMediaClick(const LLPickInfo& pick)
- // HACK: This is directly referencing an impl name. BAD!
- // This can be removed when we have a truly generic media browser that only
- // builds an impl based on the type of url it is passed.
-
- // is media playing on this face?
+ // Does this face have media?
const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace);
LLMediaEntry* mep = (tep->hasMedia()) ? tep->getMediaData() : NULL;
viewer_media_t media_impl = mep ? LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()) : NULL;
@@ -1049,11 +1040,9 @@ bool LLToolPie::handleMediaClick(const LLPickInfo& pick)
&& gSavedSettings.getBOOL("MediaOnAPrimUI")
&& media_impl.notNull())
{
- // LLObjectSelectionHandle selection = /*LLViewerMediaFocus::getInstance()->getSelection()*/ LLSelectMgr::getInstance()->getSelection();
- if (/*! selection->contains(pick.getObject(), pick.mObjectFace)*/
- ! LLViewerMediaFocus::getInstance()->isFocusedOnFace(pick.getObject(), pick.mObjectFace) )
+ if (!LLViewerMediaFocus::getInstance()->isFocusedOnFace(pick.getObject(), pick.mObjectFace) )
{
- LLViewerMediaFocus::getInstance()->setFocusFace(TRUE, pick.getObject(), pick.mObjectFace, media_impl);
+ LLViewerMediaFocus::getInstance()->setFocusFace(pick.getObject(), pick.mObjectFace, media_impl, pick.mNormal);
}
else
{
@@ -1065,7 +1054,6 @@ bool LLToolPie::handleMediaClick(const LLPickInfo& pick)
return true;
}
- LLSelectMgr::getInstance()->deselect();
LLViewerMediaFocus::getInstance()->clearFocus();
return false;
@@ -1079,50 +1067,50 @@ bool LLToolPie::handleMediaHover(const LLPickInfo& pick)
LLPointer<LLViewerObject> objectp = pick.getObject();
- // Early out cases. Must clear mouse over media focus flag
+ // Early out cases. Must clear media hover.
// did not hit an object or did not hit a valid face
if ( objectp.isNull() ||
pick.mObjectFace < 0 ||
pick.mObjectFace >= objectp->getNumTEs() )
{
- LLViewerMediaFocus::getInstance()->setMouseOverFlag(false);
+ LLViewerMediaFocus::getInstance()->clearHover();
return false;
}
-
- // HACK: This is directly referencing an impl name. BAD!
- // This can be removed when we have a truly generic media browser that only
- // builds an impl based on the type of url it is passed.
-
- // is media playing on this face?
+ // Does this face have media?
const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace);
const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
if (mep
&& gSavedSettings.getBOOL("MediaOnAPrimUI"))
{
viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID());
- if(LLViewerMediaFocus::getInstance()->getFocus() && media_impl.notNull())
- {
- media_impl->mouseMove(pick.mUVCoords);
-
- gViewerWindow->setCursor(media_impl->getLastSetCursor());
- }
- else
+
+ if(media_impl.notNull())
{
- gViewerWindow->setCursor(UI_CURSOR_ARROW);
- }
+ // Update media hover object
+ if (!LLViewerMediaFocus::getInstance()->isHoveringOverFace(objectp, pick.mObjectFace))
+ {
+ LLViewerMediaFocus::getInstance()->setHoverFace(objectp, pick.mObjectFace, media_impl, pick.mNormal);
+ }
+
+ // If this is the focused media face, send mouse move events.
+ if (LLViewerMediaFocus::getInstance()->isFocusedOnFace(objectp, pick.mObjectFace))
+ {
+ media_impl->mouseMove(pick.mUVCoords);
+ gViewerWindow->setCursor(media_impl->getLastSetCursor());
+ }
+ else
+ {
+ // This is not the focused face -- set the default cursor.
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
+ }
- // Set mouse over flag if unset
- if (! LLViewerMediaFocus::getInstance()->getMouseOverFlag())
- {
- LLSelectMgr::getInstance()->setHoverObject(objectp, pick.mObjectFace);
- LLViewerMediaFocus::getInstance()->setMouseOverFlag(true, media_impl);
- LLViewerMediaFocus::getInstance()->setPickInfo(pick);
+ return true;
}
-
- return true;
}
- LLViewerMediaFocus::getInstance()->setMouseOverFlag(false);
+
+ // In all other cases, clear media hover.
+ LLViewerMediaFocus::getInstance()->clearHover();
return false;
}