PageRenderTime 62ms CodeModel.GetById 2ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llfloatereditdaycycle.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 137 lines | 73 code | 28 blank | 36 comment | 0 complexity | f68e7981fd1092eed49a739cc885f9b6 MD5 | raw file
  1/** 
  2 * @file llfloatereditdaycycle.h
  3 * @brief Floater to create or edit a day cycle
  4 *
  5 * $LicenseInfo:firstyear=2011&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2011, 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_LLFLOATEREDITDAYCYCLE_H
 28#define LL_LLFLOATEREDITDAYCYCLE_H
 29
 30#include "llfloater.h"
 31
 32#include "llwlparammanager.h" // for LLWLParamKey
 33
 34class LLCheckBoxCtrl;
 35class LLComboBox;
 36class LLLineEditor;
 37class LLMultiSliderCtrl;
 38class LLTimeCtrl;
 39
 40/**
 41 * Floater for creating or editing a day cycle.
 42 */
 43class LLFloaterEditDayCycle : public LLFloater
 44{
 45	LOG_CLASS(LLFloaterEditDayCycle);
 46
 47public:
 48	LLFloaterEditDayCycle(const LLSD &key);
 49
 50	/*virtual*/	BOOL	postBuild();
 51	/*virtual*/ void	onOpen(const LLSD& key);
 52	/*virtual*/ void	onClose(bool app_quitting);
 53	/*virtual*/ void	draw();
 54
 55private:
 56
 57	/// sync the time slider with day cycle structure
 58	void syncTimeSlider();
 59
 60	// 	makes sure key slider has what's in day cycle
 61	void loadTrack();
 62
 63	/// makes sure day cycle data structure has what's in menu
 64	void applyTrack();
 65
 66	/// refresh the sky presets combobox
 67	void refreshSkyPresetsList();
 68
 69	/// refresh the day cycle combobox
 70	void refreshDayCyclesList();
 71
 72	/// add a slider to the track
 73	void addSliderKey(F32 time, LLWLParamKey keyframe);
 74
 75	void initCallbacks();
 76	LLWLParamKey getSelectedDayCycle();
 77	bool isNewDay() const;
 78	void dumpTrack();
 79	void enableEditing(bool enable);
 80	void reset();
 81	void saveRegionDayCycle();
 82
 83	void setApplyProgress(bool started);
 84	bool getApplyProgress() const;
 85
 86	void onTimeSliderMoved();	/// time slider moved
 87	void onKeyTimeMoved();		/// a key frame moved
 88	void onKeyTimeChanged();	/// a key frame's time changed
 89	void onKeyPresetChanged();	/// sky preset selected
 90	void onAddKey();			/// new key added on slider
 91	void onDeleteKey();			/// a key frame deleted
 92
 93	void onRegionSettingsChange();
 94	void onRegionChange();
 95	void onRegionSettingsApplied(bool success);
 96	void onRegionInfoUpdate();
 97
 98	void onDayCycleNameEdited();
 99	void onDayCycleSelected();
100	void onBtnSave();
101	void onBtnCancel();
102
103	bool onSaveAnswer(const LLSD& notification, const LLSD& response);
104	void onSaveConfirmed();
105
106	void onDayCycleListChange();
107	void onSkyPresetListChange();
108
109	static std::string getRegionName();
110
111	/// convenience class for holding keyframes mapped to sliders
112	struct SliderKey
113	{
114	public:
115		SliderKey(LLWLParamKey kf, F32 t) : keyframe(kf), time(t) {}
116		SliderKey() : keyframe(), time(0.f) {} // Don't use this default constructor
117
118		LLWLParamKey keyframe;
119		F32 time;
120	};
121
122	static const F32 sHoursPerDay;
123
124	LLLineEditor*		mDayCycleNameEditor;
125	LLComboBox*			mDayCyclesCombo;
126	LLMultiSliderCtrl*	mTimeSlider;
127	LLMultiSliderCtrl*	mKeysSlider;
128	LLComboBox*			mSkyPresetsCombo;
129	LLTimeCtrl*			mTimeCtrl;
130	LLCheckBoxCtrl*		mMakeDefaultCheckBox;
131	LLButton*			mSaveButton;
132
133	// map of sliders to parameters
134	std::map<std::string, SliderKey> mSliderToKey;
135};
136
137#endif // LL_LLFLOATEREDITDAYCYCLE_H