PageRenderTime 20ms CodeModel.GetById 1ms app.highlight 15ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llpanelnearbymedia.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 182 lines | 118 code | 29 blank | 35 comment | 0 complexity | 5276c43e1e03c1e1986efe88d5edb928 MD5 | raw file
  1/** 
  2 * @file llpanelnearbymedia.h
  3 * @brief Management interface for muting and controlling nearby media
  4 *
  5 * $LicenseInfo:firstyear=2005&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_LLPANELNEARBYMEDIA_H
 28#define LL_LLPANELNEARBYMEDIA_H
 29
 30#include "llpanel.h"
 31
 32class LLPanelNearbyMedia;
 33class LLButton;
 34class LLScrollListCtrl;
 35class LLSlider;
 36class LLSliderCtrl;
 37class LLCheckBoxCtrl;
 38class LLTextBox;
 39class LLComboBox;
 40class LLViewerMediaImpl;
 41
 42class LLPanelNearByMedia : public LLPanel
 43{
 44public:
 45	
 46	/*virtual*/ BOOL postBuild();
 47	/*virtual*/ void draw();
 48	/*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
 49	/*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
 50	/*virtual*/ void onTopLost();
 51	/*virtual*/ void handleVisibilityChange ( BOOL new_visibility );
 52	/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent);
 53	/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
 54
 55	// this is part of the nearby media *dialog* so we can track whether
 56	// the user *implicitly* wants audio on or off via their *explicit*
 57	// interaction with our buttons.
 58	bool getParcelAudioAutoStart();
 59
 60	// callback for when the auto play media preference changes
 61	// to update mParcelAudioAutoStart
 62	void handleMediaAutoPlayChanged(const LLSD& newvalue);
 63
 64	LLPanelNearByMedia();
 65	virtual ~LLPanelNearByMedia();
 66
 67private:
 68	
 69	enum ColumnIndex {
 70		CHECKBOX_COLUMN = 0,
 71		PROXIMITY_COLUMN = 1,
 72		VISIBILITY_COLUMN = 2,
 73		CLASS_COLUMN = 3,
 74		NAME_COLUMN = 4,
 75		DEBUG_COLUMN = 5
 76	};
 77	
 78	// Media "class" enumeration
 79	enum MediaClass {
 80		MEDIA_CLASS_ALL = 0,
 81		MEDIA_CLASS_FOCUSED = 1,
 82		MEDIA_CLASS_WITHIN_PARCEL = 2,
 83		MEDIA_CLASS_OUTSIDE_PARCEL = 3,
 84		MEDIA_CLASS_ON_OTHERS = 4
 85	};
 86		
 87	// Add/remove an LLViewerMediaImpl to/from the list
 88	LLScrollListItem* addListItem(const LLUUID &id);
 89	void updateListItem(LLScrollListItem* item, LLViewerMediaImpl* impl);
 90	void updateListItem(LLScrollListItem* item,
 91						const std::string &item_name,
 92						const std::string &item_tooltip,
 93						S32 proximity,
 94						bool is_disabled,
 95						bool has_media,
 96						bool is_time_based_and_playing,
 97						MediaClass media_class,
 98						const std::string &debug_str);
 99	void removeListItem(const LLUUID &id);
100	
101	// Refresh the list in the UI
102	void refreshList();
103	
104	void refreshParcelItems();
105
106	// UI Callbacks 
107	void onClickEnableAll();
108	void onClickDisableAll();
109	void onClickEnableParcelMedia();
110	void onClickDisableParcelMedia();
111	void onClickMuteParcelMedia();
112	void onParcelMediaVolumeSlider();
113	void onClickParcelMediaPlay();
114	void onClickParcelMediaStop();
115	void onClickParcelMediaPause();
116	void onClickParcelAudioPlay();
117	void onClickParcelAudioStop();
118	void onClickParcelAudioPause();
119	void onCheckAutoPlay();
120	void onAdvancedButtonClick();	
121	void onMoreLess();	
122	
123	void onCheckItem(LLUICtrl* ctrl, const LLUUID &row_id);
124	
125	static void onZoomMedia(void* user_data);
126	
127private:
128	bool setDisabled(const LLUUID &id, bool disabled);
129
130	static void getNameAndUrlHelper(LLViewerMediaImpl* impl, std::string& name, std::string & url, const std::string &defaultName);
131	
132	void updateColumns();
133	
134	bool shouldShow(LLViewerMediaImpl* impl);
135	
136	void showBasicControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume);
137	void showTimeBasedControls(bool playing, bool include_zoom, bool is_zoomed, bool muted, F32 volume);
138	void showDisabledControls();
139	void updateControls();
140	
141	void onClickSelectedMediaStop();
142	void onClickSelectedMediaPlay();
143	void onClickSelectedMediaPause();
144	void onClickSelectedMediaMute();
145	void onCommitSelectedMediaVolume();
146	void onClickSelectedMediaZoom();
147	void onClickSelectedMediaUnzoom();
148	
149	LLUICtrl*			mNearbyMediaPanel;
150	LLScrollListCtrl*		mMediaList;
151	LLUICtrl*			mEnableAllCtrl;
152	LLUICtrl*			mDisableAllCtrl;
153	LLComboBox*			mShowCtrl;
154	
155	// Dynamic (selection-dependent) controls
156	LLUICtrl*			mStopCtrl;
157	LLUICtrl*			mPlayCtrl;
158	LLUICtrl*			mPauseCtrl;
159	LLUICtrl*			mMuteCtrl;
160	LLUICtrl*			mVolumeSliderCtrl;
161	LLUICtrl*			mZoomCtrl;
162	LLUICtrl*			mUnzoomCtrl;
163	LLSlider*			mVolumeSlider;
164	LLButton*			mMuteBtn;
165	
166	bool				mAllMediaDisabled;
167	bool				mDebugInfoVisible;
168	bool				mParcelAudioAutoStart;
169	std::string			mEmptyNameString;
170	std::string			mPlayingString;
171	std::string			mParcelMediaName;
172	std::string			mParcelAudioName;
173	
174	LLRect				mMoreRect;
175	LLRect				mLessRect;
176	LLFrameTimer		mHoverTimer;
177	LLScrollListItem*	mParcelMediaItem;
178	LLScrollListItem*	mParcelAudioItem;
179};
180
181
182#endif // LL_LLPANELNEARBYMEDIA_H