From 86787b58edf59997b68dca6a0927d24b2a24a2b5 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Thu, 15 Oct 2009 18:42:30 -0700 Subject: 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. --- indra/newview/llviewermediafocus.h | 57 +++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 23 deletions(-) (limited to 'indra/newview/llviewermediafocus.h') diff --git a/indra/newview/llviewermediafocus.h b/indra/newview/llviewermediafocus.h index 2688a8b708..d5e3e6019c 100644 --- a/indra/newview/llviewermediafocus.h +++ b/indra/newview/llviewermediafocus.h @@ -50,44 +50,55 @@ public: LLViewerMediaFocus(); ~LLViewerMediaFocus(); - static void cleanupClass(); - - void setFocusFace(BOOL b, LLPointer objectp, S32 face, viewer_media_t media_impl); - void clearFocus() { setFocusFace(false, NULL, 0, NULL); } + // Set/clear the face that has media focus (takes keyboard input and has the full set of controls) + void setFocusFace(LLPointer objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3d::zero); + void clearFocus(); + + // Set/clear the face that has "media hover" (has the mimimal set of controls to zoom in or pop out into a media browser). + // If a media face has focus, the media hover will be ignored. + void setHoverFace(LLPointer objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3d::zero); + void clearHover(); + /*virtual*/ bool getFocus(); - /*virtual*/ // void onNavigateComplete( const EventType& event_in ); - /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - LLUUID getSelectedUUID(); - LLObjectSelectionHandle getSelection() { return mFocus; } - void update(); + + static void setCameraZoom(LLViewerObject* object, LLVector3 normal, F32 padding_factor); + static F32 getBBoxAspectRatio(const LLBBox& bbox, const LLVector3& normal, F32* height, F32* width, F32* depth); - void setCameraZoom(F32 padding_factor); - void setMouseOverFlag(bool b, viewer_media_t media_impl = NULL); - bool getMouseOverFlag() { return mMouseOverFlag; } - void setPickInfo(LLPickInfo pick_info) { mPickInfo = pick_info; } - F32 getBBoxAspectRatio(const LLBBox& bbox, const LLVector3& normal, F32* height, F32* width, F32* depth); - - // TODO: figure out why selection mgr hates me bool isFocusedOnFace(LLPointer objectp, S32 face); + bool isHoveringOverFace(LLPointer objectp, S32 face); + + // These look up (by uuid) and return the values that were set with setFocusFace. They will return null if the objects have been destroyed. + LLViewerMediaImpl* getFocusedMediaImpl(); + LLViewerObject* getFocusedObject(); + S32 getFocusedFace() { return mFocusedObjectFace; } + + // These look up (by uuid) and return the values that were set with setHoverFace. They will return null if the objects have been destroyed. + LLViewerMediaImpl* getHoverMediaImpl(); + LLViewerObject* getHoverObject(); + S32 getHoverFace() { return mHoverObjectFace; } protected: /*virtual*/ void onFocusReceived(); /*virtual*/ void onFocusLost(); private: - LLObjectSelectionHandle mFocus; - std::string mLastURL; - bool mMouseOverFlag; - LLPickInfo mPickInfo; + LLHandle mMediaHUD; - LLUUID mObjectID; - S32 mObjectFace; - viewer_media_t mMediaImpl; + + LLUUID mFocusedObjectID; + S32 mFocusedObjectFace; + LLUUID mFocusedImplID; + LLVector3 mFocusedObjectNormal; + + LLUUID mHoverObjectID; + S32 mHoverObjectFace; + LLUUID mHoverImplID; + LLVector3 mHoverObjectNormal; }; -- cgit v1.2.3