PageRenderTime 29ms CodeModel.GetById 12ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 1ms

/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
 27#ifndef LL_PANELPRIMMEDIACONTROLS_H
 28#define LL_PANELPRIMMEDIACONTROLS_H
 29
 30#include "llpanel.h"
 31#include "llviewermedia.h"
 32#include "llnotificationptr.h"
 33
 34class LLButton;
 35class LLCoordWindow;
 36class LLIconCtrl;
 37class LLLayoutStack;
 38class LLProgressBar;
 39class LLSliderCtrl;
 40class LLViewerMediaImpl;
 41class LLWindowShade;
 42
 43class LLPanelPrimMediaControls : public LLPanel
 44{
 45public:
 46	LLPanelPrimMediaControls();
 47	virtual ~LLPanelPrimMediaControls();
 48	/*virtual*/ BOOL postBuild();
 49	virtual void draw();
 50	virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
 51
 52	virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
 53	virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
 54	virtual BOOL handleKeyHere(KEY key, MASK mask);
 55	
 56	void updateShape();
 57	bool isMouseOver();
 58	
 59	void showNotification(LLNotificationPtr notify);
 60	void hideNotification();
 61
 62
 63	enum EZoomLevel
 64	{
 65		ZOOM_NONE = 0,
 66		ZOOM_FAR,
 67		ZOOM_MEDIUM,
 68		ZOOM_NEAR
 69	};
 70	
 71	EZoomLevel getZoomLevel() const { return mCurrentZoom; }
 72	void nextZoomLevel();
 73	void resetZoomLevel(bool reset_camera = true);
 74	void close();
 75
 76	LLHandle<LLPanelPrimMediaControls>	getHandle() const { return mPanelHandle; }
 77	void setMediaFace(LLPointer<LLViewerObject> objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero);
 78
 79
 80	static const EZoomLevel kZoomLevels[];
 81	static const int kNumZoomLevels;
 82	
 83	enum EScrollDir
 84	{
 85		SCROLL_UP = 0,
 86		SCROLL_DOWN,
 87		SCROLL_LEFT,
 88		SCROLL_RIGHT,
 89		SCROLL_NONE
 90	};
 91
 92private:
 93	void onClickClose();
 94	void onClickBack();
 95	void onClickForward();
 96	void onClickHome();
 97	void onClickOpen();
 98	void onClickReload();
 99	void onClickPlay();
100	void onClickPause();
101	void onClickStop();
102	void onClickZoom();
103	void onClickSkipBack();
104	void onClickSkipForward();
105	void onClickMediaStop();
106	void onCommitURL();
107	
108	void updateZoom();
109	void setCurrentURL();
110	void onCommitSlider();
111	
112	void onCommitVolumeUp();
113	void onCommitVolumeDown();
114	void onCommitVolumeSlider();
115	void onToggleMute();
116	void showVolumeSlider();
117	void hideVolumeSlider();
118	bool shouldVolumeSliderBeVisible();
119	
120	static void onScrollUp(void* user_data);
121	static void onScrollUpHeld(void* user_data);
122	static void onScrollLeft(void* user_data);
123	static void onScrollLeftHeld(void* user_data);
124	static void onScrollRight(void* user_data);
125	static void onScrollRightHeld(void* user_data);
126	static void onScrollDown(void* user_data);
127	static void onScrollDownHeld(void* user_data);
128	static void onScrollStop(void* user_data);
129	
130	static void onInputURL(LLFocusableElement* caller, void *userdata);
131	static bool hasControlsPermission(LLViewerObject *obj, const LLMediaEntry *media_entry);
132	
133	void focusOnTarget();
134	
135	LLViewerMediaImpl* getTargetMediaImpl();
136	LLViewerObject* getTargetObject();
137	LLPluginClassMedia* getTargetMediaPlugin();
138	
139private:
140
141	void clearFaceOnFade();
142
143	void onMouselookModeIn();
144
145	LLView *mMediaRegion;
146	LLUICtrl *mBackCtrl;
147	LLUICtrl *mFwdCtrl;
148	LLUICtrl *mReloadCtrl;
149	LLUICtrl *mPlayCtrl;
150	LLUICtrl *mPauseCtrl;
151	LLUICtrl *mStopCtrl;
152	LLUICtrl *mMediaStopCtrl;
153	LLUICtrl *mHomeCtrl;
154	LLUICtrl *mUnzoomCtrl;
155	LLUICtrl *mOpenCtrl;
156	LLUICtrl *mSkipBackCtrl;
157	LLUICtrl *mSkipFwdCtrl;
158	LLUICtrl *mZoomCtrl;
159	LLPanel  *mMediaProgressPanel;
160	LLProgressBar *mMediaProgressBar;
161	LLUICtrl *mMediaAddressCtrl;
162	LLUICtrl *mMediaAddress;
163	LLUICtrl *mMediaPlaySliderPanel;
164	LLUICtrl *mMediaPlaySliderCtrl;
165	LLUICtrl *mVolumeCtrl;
166	LLButton *mMuteBtn;
167	LLSliderCtrl *mVolumeSliderCtrl;
168	LLIconCtrl *mWhitelistIcon;
169	LLIconCtrl *mSecureLockIcon;
170	LLLayoutStack *mMediaControlsStack;
171	LLUICtrl *mLeftBookend;
172	LLUICtrl *mRightBookend;
173	LLUIImage* mBackgroundImage;
174	LLUIImage* mVolumeSliderBackgroundImage;
175	LLWindowShade* mWindowShade;
176	F32 mSkipStep;
177	S32 mMinWidth;
178	S32 mMinHeight;
179	F32 mZoomNearPadding;
180	F32 mZoomMediumPadding;
181	F32 mZoomFarPadding;
182	S32 mTopWorldViewAvoidZone;
183	
184	LLUICtrl *mMediaPanelScroll;
185	LLButton *mScrollUpCtrl;
186	LLButton *mScrollLeftCtrl;
187	LLButton *mScrollRightCtrl;
188	LLButton *mScrollDownCtrl;
189	
190	bool mPauseFadeout;
191	bool mUpdateSlider;
192	bool mClearFaceOnFade;
193	bool mHideImmediately;
194
195	LLMatrix4 mLastCameraMat;
196	EZoomLevel mCurrentZoom;
197	EScrollDir mScrollState;
198	LLCoordWindow mLastCursorPos;
199	LLFrameTimer mInactivityTimer;
200	LLFrameTimer mFadeTimer;
201	F32 mInactiveTimeout;
202	F32 mControlFadeTime;
203	LLRootHandle<LLPanelPrimMediaControls> mPanelHandle;
204	F32 mAlpha;
205	std::string mCurrentURL;
206	std::string mPreviousURL;
207	F64 mCurrentRate;
208	F64 mMovieDuration;
209	
210	LLUUID mTargetObjectID;
211	S32 mTargetObjectFace;
212	LLUUID mTargetImplID;
213	LLVector3 mTargetObjectNormal;
214	
215	LLUUID mZoomObjectID;
216	S32 mZoomObjectFace;
217	
218	S32 mVolumeSliderVisible;
219
220	LLNotificationPtr mActiveNotification;
221};
222
223#endif // LL_PANELPRIMMEDIACONTROLS_H