/indra/newview/llpanelprimmediacontrols.h

https://bitbucket.org/lindenlab/viewer-beta/ · C Header · 223 lines · 165 code · 33 blank · 25 comment · 0 complexity · dd8e524835245aa7ed6bbb093ccc35f9 MD5 · raw file

  1. /**
  2. * @file llpanelprimmediacontrols.h
  3. * @brief Pop-up media controls panel
  4. *
  5. * $LicenseInfo:firstyear=2003&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_PANELPRIMMEDIACONTROLS_H
  27. #define LL_PANELPRIMMEDIACONTROLS_H
  28. #include "llpanel.h"
  29. #include "llviewermedia.h"
  30. #include "llnotificationptr.h"
  31. class LLButton;
  32. class LLCoordWindow;
  33. class LLIconCtrl;
  34. class LLLayoutStack;
  35. class LLProgressBar;
  36. class LLSliderCtrl;
  37. class LLViewerMediaImpl;
  38. class LLWindowShade;
  39. class LLPanelPrimMediaControls : public LLPanel
  40. {
  41. public:
  42. LLPanelPrimMediaControls();
  43. virtual ~LLPanelPrimMediaControls();
  44. /*virtual*/ BOOL postBuild();
  45. virtual void draw();
  46. virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
  47. virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
  48. virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
  49. virtual BOOL handleKeyHere(KEY key, MASK mask);
  50. void updateShape();
  51. bool isMouseOver();
  52. void showNotification(LLNotificationPtr notify);
  53. void hideNotification();
  54. enum EZoomLevel
  55. {
  56. ZOOM_NONE = 0,
  57. ZOOM_FAR,
  58. ZOOM_MEDIUM,
  59. ZOOM_NEAR
  60. };
  61. EZoomLevel getZoomLevel() const { return mCurrentZoom; }
  62. void nextZoomLevel();
  63. void resetZoomLevel(bool reset_camera = true);
  64. void close();
  65. LLHandle<LLPanelPrimMediaControls> getHandle() const { return mPanelHandle; }
  66. void setMediaFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero);
  67. static const EZoomLevel kZoomLevels[];
  68. static const int kNumZoomLevels;
  69. enum EScrollDir
  70. {
  71. SCROLL_UP = 0,
  72. SCROLL_DOWN,
  73. SCROLL_LEFT,
  74. SCROLL_RIGHT,
  75. SCROLL_NONE
  76. };
  77. private:
  78. void onClickClose();
  79. void onClickBack();
  80. void onClickForward();
  81. void onClickHome();
  82. void onClickOpen();
  83. void onClickReload();
  84. void onClickPlay();
  85. void onClickPause();
  86. void onClickStop();
  87. void onClickZoom();
  88. void onClickSkipBack();
  89. void onClickSkipForward();
  90. void onClickMediaStop();
  91. void onCommitURL();
  92. void updateZoom();
  93. void setCurrentURL();
  94. void onCommitSlider();
  95. void onCommitVolumeUp();
  96. void onCommitVolumeDown();
  97. void onCommitVolumeSlider();
  98. void onToggleMute();
  99. void showVolumeSlider();
  100. void hideVolumeSlider();
  101. bool shouldVolumeSliderBeVisible();
  102. static void onScrollUp(void* user_data);
  103. static void onScrollUpHeld(void* user_data);
  104. static void onScrollLeft(void* user_data);
  105. static void onScrollLeftHeld(void* user_data);
  106. static void onScrollRight(void* user_data);
  107. static void onScrollRightHeld(void* user_data);
  108. static void onScrollDown(void* user_data);
  109. static void onScrollDownHeld(void* user_data);
  110. static void onScrollStop(void* user_data);
  111. static void onInputURL(LLFocusableElement* caller, void *userdata);
  112. static bool hasControlsPermission(LLViewerObject *obj, const LLMediaEntry *media_entry);
  113. void focusOnTarget();
  114. LLViewerMediaImpl* getTargetMediaImpl();
  115. LLViewerObject* getTargetObject();
  116. LLPluginClassMedia* getTargetMediaPlugin();
  117. private:
  118. void clearFaceOnFade();
  119. void onMouselookModeIn();
  120. LLView *mMediaRegion;
  121. LLUICtrl *mBackCtrl;
  122. LLUICtrl *mFwdCtrl;
  123. LLUICtrl *mReloadCtrl;
  124. LLUICtrl *mPlayCtrl;
  125. LLUICtrl *mPauseCtrl;
  126. LLUICtrl *mStopCtrl;
  127. LLUICtrl *mMediaStopCtrl;
  128. LLUICtrl *mHomeCtrl;
  129. LLUICtrl *mUnzoomCtrl;
  130. LLUICtrl *mOpenCtrl;
  131. LLUICtrl *mSkipBackCtrl;
  132. LLUICtrl *mSkipFwdCtrl;
  133. LLUICtrl *mZoomCtrl;
  134. LLPanel *mMediaProgressPanel;
  135. LLProgressBar *mMediaProgressBar;
  136. LLUICtrl *mMediaAddressCtrl;
  137. LLUICtrl *mMediaAddress;
  138. LLUICtrl *mMediaPlaySliderPanel;
  139. LLUICtrl *mMediaPlaySliderCtrl;
  140. LLUICtrl *mVolumeCtrl;
  141. LLButton *mMuteBtn;
  142. LLSliderCtrl *mVolumeSliderCtrl;
  143. LLIconCtrl *mWhitelistIcon;
  144. LLIconCtrl *mSecureLockIcon;
  145. LLLayoutStack *mMediaControlsStack;
  146. LLUICtrl *mLeftBookend;
  147. LLUICtrl *mRightBookend;
  148. LLUIImage* mBackgroundImage;
  149. LLUIImage* mVolumeSliderBackgroundImage;
  150. LLWindowShade* mWindowShade;
  151. F32 mSkipStep;
  152. S32 mMinWidth;
  153. S32 mMinHeight;
  154. F32 mZoomNearPadding;
  155. F32 mZoomMediumPadding;
  156. F32 mZoomFarPadding;
  157. S32 mTopWorldViewAvoidZone;
  158. LLUICtrl *mMediaPanelScroll;
  159. LLButton *mScrollUpCtrl;
  160. LLButton *mScrollLeftCtrl;
  161. LLButton *mScrollRightCtrl;
  162. LLButton *mScrollDownCtrl;
  163. bool mPauseFadeout;
  164. bool mUpdateSlider;
  165. bool mClearFaceOnFade;
  166. bool mHideImmediately;
  167. LLMatrix4 mLastCameraMat;
  168. EZoomLevel mCurrentZoom;
  169. EScrollDir mScrollState;
  170. LLCoordWindow mLastCursorPos;
  171. LLFrameTimer mInactivityTimer;
  172. LLFrameTimer mFadeTimer;
  173. F32 mInactiveTimeout;
  174. F32 mControlFadeTime;
  175. LLRootHandle<LLPanelPrimMediaControls> mPanelHandle;
  176. F32 mAlpha;
  177. std::string mCurrentURL;
  178. std::string mPreviousURL;
  179. F64 mCurrentRate;
  180. F64 mMovieDuration;
  181. LLUUID mTargetObjectID;
  182. S32 mTargetObjectFace;
  183. LLUUID mTargetImplID;
  184. LLVector3 mTargetObjectNormal;
  185. LLUUID mZoomObjectID;
  186. S32 mZoomObjectFace;
  187. S32 mVolumeSliderVisible;
  188. LLNotificationPtr mActiveNotification;
  189. };
  190. #endif // LL_PANELPRIMMEDIACONTROLS_H