aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden
diff options
context:
space:
mode:
Diffstat (limited to 'linden')
-rw-r--r--linden/indra/newview/CMakeLists.txt5
-rw-r--r--linden/indra/newview/app_settings/settings.xml22
-rw-r--r--linden/indra/newview/llfloaterwindlight.cpp1
-rw-r--r--linden/indra/newview/lloverlaybar.cpp13
-rw-r--r--linden/indra/newview/lloverlaybar.h8
-rw-r--r--linden/indra/newview/llpaneldisplay.cpp7
-rw-r--r--linden/indra/newview/llpaneldisplay.h2
-rw-r--r--linden/indra/newview/llwindlightremotectrl.cpp262
-rw-r--r--linden/indra/newview/llwindlightremotectrl.h60
-rw-r--r--linden/indra/newview/llwlparammanager.cpp40
-rw-r--r--linden/indra/newview/llwlparammanager.h14
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml17
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml4
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_windlight_controls.xml14
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_windlight_remote.xml22
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_windlight_remote_expanded.xml12
16 files changed, 495 insertions, 8 deletions
diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt
index ad044a9..2f2bdd1 100644
--- a/linden/indra/newview/CMakeLists.txt
+++ b/linden/indra/newview/CMakeLists.txt
@@ -422,6 +422,7 @@ set(viewer_SOURCE_FILES
422 llwearablelist.cpp 422 llwearablelist.cpp
423 llweb.cpp 423 llweb.cpp
424 llwebbrowserctrl.cpp 424 llwebbrowserctrl.cpp
425 llwindlightremotectrl.cpp
425 llwind.cpp 426 llwind.cpp
426 llwlanimator.cpp 427 llwlanimator.cpp
427 llwldaycycle.cpp 428 llwldaycycle.cpp
@@ -824,6 +825,7 @@ set(viewer_HEADER_FILES
824 llwebbrowserctrl.h 825 llwebbrowserctrl.h
825 llwind.h 826 llwind.h
826 llwindebug.h 827 llwindebug.h
828 llwindlightremotectrl.h
827 llwlanimator.h 829 llwlanimator.h
828 llwldaycycle.h 830 llwldaycycle.h
829 llwlparammanager.h 831 llwlparammanager.h
@@ -1200,6 +1202,9 @@ set(viewer_XUI_FILES
1200 skins/default/xui/en-us/panel_voice_options.xml 1202 skins/default/xui/en-us/panel_voice_options.xml
1201 skins/default/xui/en-us/panel_voice_remote_expanded.xml 1203 skins/default/xui/en-us/panel_voice_remote_expanded.xml
1202 skins/default/xui/en-us/panel_voice_remote.xml 1204 skins/default/xui/en-us/panel_voice_remote.xml
1205 skins/default/xui/en-us/panel_windlight_controls.xml
1206 skins/default/xui/en-us/panel_windlight_remote.xml
1207 skins/default/xui/en-us/panel_windlight_remote_expanded.xml
1203 skins/default/xui/en-us/role_actions.xml 1208 skins/default/xui/en-us/role_actions.xml
1204 skins/default/xui/en-us/strings.xml 1209 skins/default/xui/en-us/strings.xml
1205 skins/default/xui/en-us/teleport_strings.xml 1210 skins/default/xui/en-us/teleport_strings.xml
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index 56d65f4..39b482b 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -2393,6 +2393,17 @@
2393 <key>Value</key> 2393 <key>Value</key>
2394 <integer>1</integer> 2394 <integer>1</integer>
2395 </map> 2395 </map>
2396 <key>EnableWindlightRemote</key>
2397 <map>
2398 <key>Comment</key>
2399 <string>Enable windlight quick access remote in toolbar</string>
2400 <key>Persist</key>
2401 <integer>1</integer>
2402 <key>Type</key>
2403 <string>Boolean</string>
2404 <key>Value</key>
2405 <integer>1</integer>
2406 </map>
2396 <key>EnergyFromTop</key> 2407 <key>EnergyFromTop</key>
2397 <map> 2408 <map>
2398 <key>Comment</key> 2409 <key>Comment</key>
@@ -7425,6 +7436,17 @@
7425 <key>Value</key> 7436 <key>Value</key>
7426 <integer>0</integer> 7437 <integer>0</integer>
7427 </map> 7438 </map>
7439 <key>ShowWindlightSettingsPopup</key>
7440 <map>
7441 <key>Comment</key>
7442 <string>Show environment settings popup</string>
7443 <key>Persist</key>
7444 <integer>1</integer>
7445 <key>Type</key>
7446 <string>Boolean</string>
7447 <key>Value</key>
7448 <integer>0</integer>
7449 </map>
7428 <key>ShowWorldMap</key> 7450 <key>ShowWorldMap</key>
7429 <map> 7451 <map>
7430 <key>Comment</key> 7452 <key>Comment</key>
diff --git a/linden/indra/newview/llfloaterwindlight.cpp b/linden/indra/newview/llfloaterwindlight.cpp
index 37cd4ef..43e8e1e 100644
--- a/linden/indra/newview/llfloaterwindlight.cpp
+++ b/linden/indra/newview/llfloaterwindlight.cpp
@@ -60,6 +60,7 @@
60 60
61#undef max 61#undef max
62 62
63
63LLFloaterWindLight* LLFloaterWindLight::sWindLight = NULL; 64LLFloaterWindLight* LLFloaterWindLight::sWindLight = NULL;
64 65
65std::set<std::string> LLFloaterWindLight::sDefaultPresets; 66std::set<std::string> LLFloaterWindLight::sDefaultPresets;
diff --git a/linden/indra/newview/lloverlaybar.cpp b/linden/indra/newview/lloverlaybar.cpp
index 91a7375..6b51b3a 100644
--- a/linden/indra/newview/lloverlaybar.cpp
+++ b/linden/indra/newview/lloverlaybar.cpp
@@ -62,6 +62,7 @@
62#include "llvoavatar.h" 62#include "llvoavatar.h"
63#include "llvoiceremotectrl.h" 63#include "llvoiceremotectrl.h"
64#include "llwebbrowserctrl.h" 64#include "llwebbrowserctrl.h"
65#include "llwindlightremotectrl.h"
65#include "llselectmgr.h" 66#include "llselectmgr.h"
66 67
67// 68//
@@ -92,6 +93,13 @@ void* LLOverlayBar::createVoiceRemote(void* userdata)
92 return self->mVoiceRemote; 93 return self->mVoiceRemote;
93} 94}
94 95
96void* LLOverlayBar::createWindlightRemote(void* userdata)
97{
98 LLOverlayBar *self = (LLOverlayBar*)userdata;
99 self->mWindlightRemote = new LLWindlightRemoteCtrl();
100 return self->mWindlightRemote;
101}
102
95void* LLOverlayBar::createChatBar(void* userdata) 103void* LLOverlayBar::createChatBar(void* userdata)
96{ 104{
97 gChatBar = new LLChatBar(); 105 gChatBar = new LLChatBar();
@@ -102,6 +110,7 @@ LLOverlayBar::LLOverlayBar()
102 : LLPanel(), 110 : LLPanel(),
103 mMediaRemote(NULL), 111 mMediaRemote(NULL),
104 mVoiceRemote(NULL), 112 mVoiceRemote(NULL),
113 mWindlightRemote(NULL),
105 mMusicState(STOPPED), 114 mMusicState(STOPPED),
106 mOriginalIMLabel("") 115 mOriginalIMLabel("")
107{ 116{
@@ -113,6 +122,7 @@ LLOverlayBar::LLOverlayBar()
113 LLCallbackMap::map_t factory_map; 122 LLCallbackMap::map_t factory_map;
114 factory_map["media_remote"] = LLCallbackMap(LLOverlayBar::createMediaRemote, this); 123 factory_map["media_remote"] = LLCallbackMap(LLOverlayBar::createMediaRemote, this);
115 factory_map["voice_remote"] = LLCallbackMap(LLOverlayBar::createVoiceRemote, this); 124 factory_map["voice_remote"] = LLCallbackMap(LLOverlayBar::createVoiceRemote, this);
125 factory_map["windlight_remote"] = LLCallbackMap(LLOverlayBar::createWindlightRemote, this);
116 factory_map["chat_bar"] = LLCallbackMap(LLOverlayBar::createChatBar, this); 126 factory_map["chat_bar"] = LLCallbackMap(LLOverlayBar::createChatBar, this);
117 127
118 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_overlaybar.xml", &factory_map); 128 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_overlaybar.xml", &factory_map);
@@ -269,6 +279,7 @@ void LLOverlayBar::refresh()
269 } 279 }
270 280
271 281
282 moveChildToBackOfTabGroup(mWindlightRemote);
272 moveChildToBackOfTabGroup(mMediaRemote); 283 moveChildToBackOfTabGroup(mMediaRemote);
273 moveChildToBackOfTabGroup(mVoiceRemote); 284 moveChildToBackOfTabGroup(mVoiceRemote);
274 285
@@ -277,6 +288,7 @@ void LLOverlayBar::refresh()
277 { 288 {
278 childSetVisible("media_remote_container", FALSE); 289 childSetVisible("media_remote_container", FALSE);
279 childSetVisible("voice_remote_container", FALSE); 290 childSetVisible("voice_remote_container", FALSE);
291 childSetVisible("windlight_remote_container", FALSE);
280 childSetVisible("state_buttons", FALSE); 292 childSetVisible("state_buttons", FALSE);
281 } 293 }
282 else 294 else
@@ -284,6 +296,7 @@ void LLOverlayBar::refresh()
284 // update "remotes" 296 // update "remotes"
285 childSetVisible("media_remote_container", TRUE); 297 childSetVisible("media_remote_container", TRUE);
286 childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled()); 298 childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled());
299 childSetVisible("windlight_remote_container", gSavedSettings.getBOOL("EnableWindlightRemote"));
287 childSetVisible("state_buttons", TRUE); 300 childSetVisible("state_buttons", TRUE);
288 } 301 }
289 302
diff --git a/linden/indra/newview/lloverlaybar.h b/linden/indra/newview/lloverlaybar.h
index 52a469a..140fabf 100644
--- a/linden/indra/newview/lloverlaybar.h
+++ b/linden/indra/newview/lloverlaybar.h
@@ -40,6 +40,7 @@ extern S32 STATUS_BAR_HEIGHT;
40class LLButton; 40class LLButton;
41class LLLineEditor; 41class LLLineEditor;
42class LLMediaRemoteCtrl; 42class LLMediaRemoteCtrl;
43
43class LLMessageSystem; 44class LLMessageSystem;
44class LLTextBox; 45class LLTextBox;
45class LLTextEditor; 46class LLTextEditor;
@@ -49,6 +50,7 @@ class LLFrameTimer;
49class LLStatGraph; 50class LLStatGraph;
50class LLSlider; 51class LLSlider;
51class LLVoiceRemoteCtrl; 52class LLVoiceRemoteCtrl;
53class LLWindlightRemoteCtrl;
52 54
53class LLOverlayBar 55class LLOverlayBar
54: public LLPanel 56: public LLPanel
@@ -88,13 +90,15 @@ public:
88protected: 90protected:
89 static void* createMediaRemote(void* userdata); 91 static void* createMediaRemote(void* userdata);
90 static void* createVoiceRemote(void* userdata); 92 static void* createVoiceRemote(void* userdata);
93 static void* createWindlightRemote(void* userdata);
91 static void* createChatBar(void* userdata); 94 static void* createChatBar(void* userdata);
92 95
93 void enableMediaButtons(); 96 void enableMediaButtons();
94 97
95protected: 98protected:
96 LLMediaRemoteCtrl* mMediaRemote; 99 LLMediaRemoteCtrl* mMediaRemote;
97 LLVoiceRemoteCtrl* mVoiceRemote; 100 LLVoiceRemoteCtrl* mVoiceRemote;
101 LLWindlightRemoteCtrl* mWindlightRemote;
98 bool mBuilt; // dialog constructed yet? 102 bool mBuilt; // dialog constructed yet?
99 S32 mMusicState; 103 S32 mMusicState;
100 std::string mOriginalIMLabel; 104 std::string mOriginalIMLabel;
diff --git a/linden/indra/newview/llpaneldisplay.cpp b/linden/indra/newview/llpaneldisplay.cpp
index d510775..308f3df 100644
--- a/linden/indra/newview/llpaneldisplay.cpp
+++ b/linden/indra/newview/llpaneldisplay.cpp
@@ -318,6 +318,9 @@ BOOL LLPanelDisplay::postBuild()
318 mLightingText = getChild<LLTextBox>("LightingDetailText"); 318 mLightingText = getChild<LLTextBox>("LightingDetailText");
319 mMeshDetailText = getChild<LLTextBox>("MeshDetailText"); 319 mMeshDetailText = getChild<LLTextBox>("MeshDetailText");
320 320
321 childSetValue("toggle_windlight_control", gSavedSettings.getBOOL("EnableWindlightRemote"));
322 mWLControl = gSavedSettings.getBOOL("EnableWindlightRemote");
323
321 refresh(); 324 refresh();
322 325
323 return TRUE; 326 return TRUE;
@@ -690,6 +693,8 @@ void LLPanelDisplay::cancel()
690 gSavedSettings.setU32("WLSkyDetail", mSkyLOD); 693 gSavedSettings.setU32("WLSkyDetail", mSkyLOD);
691 gSavedSettings.setS32("RenderMaxPartCount", mParticleCount); 694 gSavedSettings.setS32("RenderMaxPartCount", mParticleCount);
692 gSavedSettings.setS32("RenderGlowResolutionPow", mPostProcess); 695 gSavedSettings.setS32("RenderGlowResolutionPow", mPostProcess);
696
697 gSavedSettings.setBOOL("EnableWindlightRemote", mWLControl);
693} 698}
694 699
695void LLPanelDisplay::apply() 700void LLPanelDisplay::apply()
@@ -701,6 +706,8 @@ void LLPanelDisplay::apply()
701 { 706 {
702 applyWindowSize(); 707 applyWindowSize();
703 } 708 }
709
710 gSavedSettings.setBOOL("EnableWindlightRemote", childGetValue("toggle_windlight_control").asBoolean());
704} 711}
705 712
706void LLPanelDisplay::onChangeQuality(LLUICtrl *ctrl, void *data) 713void LLPanelDisplay::onChangeQuality(LLUICtrl *ctrl, void *data)
diff --git a/linden/indra/newview/llpaneldisplay.h b/linden/indra/newview/llpaneldisplay.h
index f98e94e..80ef5cb 100644
--- a/linden/indra/newview/llpaneldisplay.h
+++ b/linden/indra/newview/llpaneldisplay.h
@@ -170,6 +170,8 @@ protected:
170 S32 mParticleCount; 170 S32 mParticleCount;
171 S32 mPostProcess; 171 S32 mPostProcess;
172 172
173 BOOL mWLControl;
174
173 static void setGraphicsSettings(LLControlGroup& group); 175 static void setGraphicsSettings(LLControlGroup& group);
174 static void createGroup(); 176 static void createGroup();
175 177
diff --git a/linden/indra/newview/llwindlightremotectrl.cpp b/linden/indra/newview/llwindlightremotectrl.cpp
new file mode 100644
index 0000000..e47eef7
--- /dev/null
+++ b/linden/indra/newview/llwindlightremotectrl.cpp
@@ -0,0 +1,262 @@
1/**
2* @file llwindlightremotectrl.cpp
3* @brief toolbar remote for windlight options and presets
4*
5* $LicenseInfo:firstyear=2009&license=viewergpl$
6*
7* Copyright (c) 2009, McCabe Maxsted
8*
9* Imprudence Viewer Source Code
10* The source code in this file ("Source Code") is provided to you
11* under the terms of the GNU General Public License, version 2.0
12* ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in
13* this distribution, or online at
14* http://secondlifegrid.net/programs/open_source/licensing/gplv2
15*
16* There are special exceptions to the terms and conditions of the GPL as
17* it is applied to this Source Code. View the full text of the exception
18* in the file doc/FLOSS-exception.txt in this software distribution, or
19* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
20*
21* By copying, modifying or distributing this software, you acknowledge
22* that you have read and understood your obligations described above,
23* and agree to abide by those obligations.
24*
25* ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO
26* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
27* COMPLETENESS OR PERFORMANCE.
28* $/LicenseInfo$
29*/
30
31#include "llviewerprecompiledheaders.h"
32
33#include "llwindlightremotectrl.h"
34
35#include "llbutton.h"
36#include "llcombobox.h"
37#include "llfloaterenvsettings.h"
38#include "llfloaterwindlight.h"
39#include "lloverlaybar.h"
40#include "lluictrlfactory.h"
41#include "llwlparammanager.h"
42#include "llviewercontrol.h"
43
44
45class LLWindlightRemoteObserver : public LLWLPresetsObserver
46{
47public:
48 LLWindlightRemoteObserver(LLWindlightRemoteCtrl* wind_rem) : mWindlightRemote(wind_rem){}
49 virtual ~LLWindlightRemoteObserver() {}
50 virtual void changed() { mWindlightRemote->refreshPresets(); }
51private:
52 LLWindlightRemoteCtrl* mWindlightRemote;
53};
54
55
56LLWindlightRemoteCtrl::LLWindlightRemoteCtrl()
57{
58 mPresetsCombo = NULL;
59 mObserver = NULL;
60 setIsChrome(TRUE);
61
62 build();
63
64 setFocusRoot(TRUE);
65}
66
67LLWindlightRemoteCtrl::~LLWindlightRemoteCtrl()
68{
69 delete mObserver;
70 mObserver = NULL;
71}
72
73void LLWindlightRemoteCtrl::draw()
74{
75 LLButton* expand_button = getChild<LLButton>("Popup");
76 if (expand_button)
77 {
78 if (expand_button->getToggleState())
79 {
80 expand_button->setImageOverlay("arrow_down.tga");
81 }
82 else
83 {
84 expand_button->setImageOverlay("arrow_up.tga");
85 }
86 }
87
88 LLPanel::draw();
89}
90
91void LLWindlightRemoteCtrl::build()
92{
93 if (gSavedSettings.getBOOL("ShowWindlightSettingsPopup"))
94 {
95 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_windlight_remote_expanded.xml"/*, &getFactoryMap()*/);
96 }
97 else
98 {
99 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_windlight_remote.xml"/*, &getFactoryMap()*/);
100 }
101}
102
103BOOL LLWindlightRemoteCtrl::postBuild()
104{
105
106 childSetAction("Environment", onClickToggleEnvironment, this);
107 childSetAction("Popup", onClickPopupBtn, this);
108
109 mPresetsCombo = getChild<LLComboBox>("Presets");
110 if (mPresetsCombo)
111 {
112 mPresetsCombo->setCommitCallback(onCommitPreset);
113 mPresetsCombo->setCallbackUserData(this);
114
115 // set up observer to follow changes
116 mObserver = new LLWindlightRemoteObserver(this);
117 LLWLParamManager::addObserver(mObserver);
118
119 // refresh list from current presets
120 refreshPresets();
121 }
122
123 return TRUE;
124}
125
126void LLWindlightRemoteCtrl::refreshPresets()
127{
128 if (mPresetsCombo)
129 {
130 //store current preset
131 std::string cur_preset = mPresetsCombo->getValue().asString();
132
133 mPresetsCombo->clearRows();
134
135 std::map<std::string, LLWLParamSet>::iterator mIt =
136 LLWLParamManager::instance()->mParamList.begin();
137 for(; mIt != LLWLParamManager::instance()->mParamList.end(); mIt++)
138 {
139 mPresetsCombo->add(mIt->first);
140 }
141
142 // Insert label after sorting, at top, with separator below it
143 mPresetsCombo->addSeparator(ADD_BOTTOM);
144 mPresetsCombo->addSimpleElement(getString("sunrise"), ADD_BOTTOM);
145 mPresetsCombo->addSimpleElement(getString("noon"), ADD_BOTTOM);
146 mPresetsCombo->addSimpleElement(getString("sunset"), ADD_BOTTOM);
147 mPresetsCombo->addSimpleElement(getString("midnight"), ADD_BOTTOM);
148 mPresetsCombo->addSimpleElement(getString("revert_region"), ADD_BOTTOM);
149
150 if (!cur_preset.empty())
151 {
152 mPresetsCombo->selectByValue(LLSD(cur_preset));
153 }
154 else
155 {
156 mPresetsCombo->selectByValue(LLSD("Default"));
157 }
158 }
159}
160
161// static
162void LLWindlightRemoteCtrl::onCommitPreset(LLUICtrl* ctrl, void* data)
163{
164 LLWindlightRemoteCtrl* self = (LLWindlightRemoteCtrl*)data;
165
166 LLCtrlListInterface* presets = self->mPresetsCombo ? self->mPresetsCombo->getListInterface() : NULL;
167 if (presets)
168 {
169 S32 index = presets->getFirstSelectedIndex();
170 if (index <= 0)
171 {
172 // Open Advanced Sky
173 LLFloaterWindLight::show();
174 return;
175 }
176
177 // check for World menu options; if none, apply preset
178 std::string selected = self->mPresetsCombo->getSelectedValue().asString();
179
180 if (selected == self->getString("sunrise"))
181 {
182 // set the value, turn off animation
183 LLWLParamManager::instance()->mAnimator.setDayTime(0.25);
184 LLWLParamManager::instance()->mAnimator.mIsRunning = false;
185 LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
186
187 // then call update once
188 LLWLParamManager::instance()->mAnimator.update(
189 LLWLParamManager::instance()->mCurParams);
190 }
191 else if (selected == self->getString("noon"))
192 {
193 // set the value, turn off animation
194 LLWLParamManager::instance()->mAnimator.setDayTime(0.567);
195 LLWLParamManager::instance()->mAnimator.mIsRunning = false;
196 LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
197
198 // then call update once
199 LLWLParamManager::instance()->mAnimator.update(
200 LLWLParamManager::instance()->mCurParams);
201 }
202 else if (selected == self->getString("sunset"))
203 {
204 // set the value, turn off animation
205 LLWLParamManager::instance()->mAnimator.setDayTime(0.75);
206 LLWLParamManager::instance()->mAnimator.mIsRunning = false;
207 LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
208
209 // then call update once
210 LLWLParamManager::instance()->mAnimator.update(
211 LLWLParamManager::instance()->mCurParams);
212 }
213 else if (selected == self->getString("midnight"))
214 {
215 // set the value, turn off animation
216 LLWLParamManager::instance()->mAnimator.setDayTime(0.0);
217 LLWLParamManager::instance()->mAnimator.mIsRunning = false;
218 LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
219
220 // then call update once
221 LLWLParamManager::instance()->mAnimator.update(
222 LLWLParamManager::instance()->mCurParams);
223 }
224 else if (selected == self->getString("revert_region"))
225 {
226 LLWLParamManager::instance()->mAnimator.mIsRunning = true;
227 LLWLParamManager::instance()->mAnimator.mUseLindenTime = true;
228 }
229 else
230 {
231 // Apply preset
232 LLWLParamManager::instance()->loadPreset(selected);
233 }
234 }
235}
236
237// static
238void LLWindlightRemoteCtrl::onClickToggleEnvironment(void* data)
239{
240 // if evn settings not there or is hidden, show it
241 if( !LLFloaterEnvSettings::isOpen() ||
242 !LLFloaterEnvSettings::instance()->getVisible())
243 {
244 LLFloaterEnvSettings::show();
245
246 // otherwise, close it button acts like a toggle
247 }
248 else
249 {
250 LLFloaterEnvSettings::instance()->close();
251 }
252}
253
254//static
255void LLWindlightRemoteCtrl::onClickPopupBtn(void* data)
256{
257 LLWindlightRemoteCtrl* remotep = (LLWindlightRemoteCtrl*)data;
258
259 remotep->deleteAllChildren();
260 remotep->build();
261 gOverlayBar->layoutButtons();
262}
diff --git a/linden/indra/newview/llwindlightremotectrl.h b/linden/indra/newview/llwindlightremotectrl.h
new file mode 100644
index 0000000..e4ad2d5
--- /dev/null
+++ b/linden/indra/newview/llwindlightremotectrl.h
@@ -0,0 +1,60 @@
1/**
2* @file llwindlightremotectrl.h
3* @brief toolbar remote for windlight options and presets
4*
5* $LicenseInfo:firstyear=2009&license=viewergpl$
6*
7* Copyright (c) 2009, McCabe Maxsted
8*
9* Imprudence Viewer Source Code
10* The source code in this file ("Source Code") is provided to you
11* under the terms of the GNU General Public License, version 2.0
12* ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in
13* this distribution, or online at
14* http://secondlifegrid.net/programs/open_source/licensing/gplv2
15*
16* There are special exceptions to the terms and conditions of the GPL as
17* it is applied to this Source Code. View the full text of the exception
18* in the file doc/FLOSS-exception.txt in this software distribution, or
19* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
20*
21* By copying, modifying or distributing this software, you acknowledge
22* that you have read and understood your obligations described above,
23* and agree to abide by those obligations.
24*
25* ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO
26* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
27* COMPLETENESS OR PERFORMANCE.
28* $/LicenseInfo$
29*/
30
31#ifndef LL_LLWINDLIGHTREMOTECTRL_H
32#define LL_LLWINDLIGHTREMOTECTRL_H
33
34#include "llpanel.h"
35
36class LLComboBox;
37class LLWLPresetsObserver;
38
39class LLWindlightRemoteCtrl : public LLPanel
40{
41public:
42 LLWindlightRemoteCtrl();
43 virtual ~LLWindlightRemoteCtrl();
44 /*virtual*/ BOOL postBuild();
45 /*virtual*/ void draw();
46
47 void refreshPresets();
48
49private:
50 LLComboBox* mPresetsCombo;
51 LLWLPresetsObserver* mObserver;
52
53 void build();
54
55 static void onCommitPreset(LLUICtrl* ctrl, void* data);
56 static void onClickToggleEnvironment(void* data);
57 static void onClickPopupBtn(void* data);
58};
59
60#endif
diff --git a/linden/indra/newview/llwlparammanager.cpp b/linden/indra/newview/llwlparammanager.cpp
index c1723f7..ba3d070 100644
--- a/linden/indra/newview/llwlparammanager.cpp
+++ b/linden/indra/newview/llwlparammanager.cpp
@@ -62,6 +62,7 @@
62#include "curl/curl.h" 62#include "curl/curl.h"
63 63
64LLWLParamManager * LLWLParamManager::sInstance = NULL; 64LLWLParamManager * LLWLParamManager::sInstance = NULL;
65std::vector<LLWLPresetsObserver*> LLWLParamManager::sObservers;
65 66
66LLWLParamManager::LLWLParamManager() : 67LLWLParamManager::LLWLParamManager() :
67 68
@@ -238,6 +239,8 @@ void LLWLParamManager::loadPreset(const std::string & name,bool propagate)
238 getParamSet(name, mCurParams); 239 getParamSet(name, mCurParams);
239 propagateParameters(); 240 propagateParameters();
240 } 241 }
242
243 notifyObservers();
241} 244}
242 245
243void LLWLParamManager::savePreset(const std::string & name) 246void LLWLParamManager::savePreset(const std::string & name)
@@ -264,6 +267,7 @@ void LLWLParamManager::savePreset(const std::string & name)
264 presetsXML.close(); 267 presetsXML.close();
265 268
266 propagateParameters(); 269 propagateParameters();
270 notifyObservers();
267} 271}
268 272
269void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader) 273void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader)
@@ -538,6 +542,8 @@ bool LLWLParamManager::removeParamSet(const std::string& name, bool delete_from_
538 gDirUtilp->deleteFilesInDir(path_name, escaped_name + ".xml"); 542 gDirUtilp->deleteFilesInDir(path_name, escaped_name + ".xml");
539 } 543 }
540 544
545 notifyObservers();
546
541 return true; 547 return true;
542} 548}
543 549
@@ -566,3 +572,37 @@ LLWLParamManager * LLWLParamManager::instance()
566 572
567 return sInstance; 573 return sInstance;
568} 574}
575
576// static
577void LLWLParamManager::addObserver(LLWLPresetsObserver* observer)
578{
579 sObservers.push_back(observer);
580}
581
582// static
583void LLWLParamManager::removeObserver(LLWLPresetsObserver* observer)
584{
585 std::vector<LLWLPresetsObserver*>::iterator it;
586 it = std::find(sObservers.begin(), sObservers.end(), observer);
587 if (it != sObservers.end())
588 {
589 sObservers.erase(it);
590 }
591}
592
593// Call this method when it's time to update everyone on a new state.
594// Copy the list because an observer could respond by removing itself
595// from the list. Static
596void LLWLParamManager::notifyObservers()
597{
598 lldebugs << "LLWLPresetsObserver::notifyObservers" << llendl;
599
600 std::vector<LLWLPresetsObserver*> observers = sObservers;
601
602 std::vector<LLWLPresetsObserver*>::iterator it;
603 for (it = observers.begin(); it != observers.end(); ++it)
604 {
605 LLWLPresetsObserver* observer = *it;
606 observer->changed();
607 }
608}
diff --git a/linden/indra/newview/llwlparammanager.h b/linden/indra/newview/llwlparammanager.h
index 1d9291c..9895e91 100644
--- a/linden/indra/newview/llwlparammanager.h
+++ b/linden/indra/newview/llwlparammanager.h
@@ -40,6 +40,13 @@
40#include "llviewercamera.h" 40#include "llviewercamera.h"
41 41
42class LLGLSLShader; 42class LLGLSLShader;
43
44class LLWLPresetsObserver
45{
46public:
47 virtual ~LLWLPresetsObserver() { };
48 virtual void changed() = 0;
49};
43 50
44// color control 51// color control
45struct WLColorControl { 52struct WLColorControl {
@@ -195,6 +202,11 @@ public:
195 // singleton pattern implementation 202 // singleton pattern implementation
196 static LLWLParamManager * instance(); 203 static LLWLParamManager * instance();
197 204
205 // manage observers
206 static void addObserver(LLWLPresetsObserver* observer);
207 static void removeObserver(LLWLPresetsObserver* observer);
208 static void notifyObservers();
209
198public: 210public:
199 211
200 // helper variables 212 // helper variables
@@ -255,6 +267,8 @@ public:
255private: 267private:
256 // our parameter manager singleton instance 268 // our parameter manager singleton instance
257 static LLWLParamManager * sInstance; 269 static LLWLParamManager * sInstance;
270
271 static std::vector<LLWLPresetsObserver*> sObservers;
258 272
259}; 273};
260 274
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml b/linden/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml
index e785909..21a7664 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml
@@ -45,16 +45,21 @@
45 use_bounding_rect="true" width="395" /> 45 use_bounding_rect="true" width="395" />
46 </layout_stack> 46 </layout_stack>
47 </layout_panel> 47 </layout_panel>
48 <layout_panel auto_resize="false" bottom="0" left="0" min_width="220" mouse_opaque="false" 48 <layout_panel auto_resize="false" bottom="0" left="0" min_width="202" mouse_opaque="false"
49 name="windlight_remote_container" use_bounding_rect="true" user_resize="false"
50 width="200">
51 <panel background_visible="false" border="false" bottom="0" name="windlight_remote" />
52 </layout_panel>
53 <layout_panel auto_resize="false" bottom="0" left="0" min_width="220" mouse_opaque="false"
49 name="media_remote_container" use_bounding_rect="true" user_resize="false" 54 name="media_remote_container" use_bounding_rect="true" user_resize="false"
50 width="220"> 55 width="220">
51 <panel background_visible="false" border="false" bottom="0" name="media_remote" /> 56 <panel background_visible="false" border="false" bottom="0" name="media_remote" />
52 </layout_panel> 57 </layout_panel>
53 <layout_panel auto_resize="false" bottom="0" left="0" min_width="130" mouse_opaque="false" 58 <layout_panel auto_resize="false" bottom="0" left="0" min_width="130" mouse_opaque="false"
54 name="voice_remote_container" use_bounding_rect="true" user_resize="false" 59 name="voice_remote_container" use_bounding_rect="true" user_resize="false"
55 width="128"> 60 width="128">
56 <panel background_visible="false" border="false" bottom="0" name="voice_remote" /> 61 <panel background_visible="false" border="false" bottom="0" name="voice_remote" />
57 </layout_panel> 62 </layout_panel>
58 </layout_stack> 63 </layout_stack>
59 <string name="unread_count_string_plural"> 64 <string name="unread_count_string_plural">
60 New IMs 65 New IMs
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml
index 527309e..d5d43b1 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_graphics1.xml
@@ -8,6 +8,10 @@
8 height="16" initial_value="false" 8 height="16" initial_value="false"
9 label="Run Second Life in a window" left="10" mouse_opaque="true" 9 label="Run Second Life in a window" left="10" mouse_opaque="true"
10 name="windowed mode" radio_style="false" width="100" /> 10 name="windowed mode" radio_style="false" width="100" />
11 <check_box bottom_delta="0" enabled="true" follows="left|top"
12 font="SansSerifSmall" height="16" initial_value="false"
13 label="Show environment control in toolbar" left="248" mouse_opaque="true"
14 name="toggle_windlight_control" radio_style="false" width="237" />
11 <text_editor type="string" length="1" allow_html="false" bg_readonly_color="0 0 0 0" bottom="-43" 15 <text_editor type="string" length="1" allow_html="false" bg_readonly_color="0 0 0 0" bottom="-43"
12 embedded_items="false" enabled="false" follows="left|top" 16 embedded_items="false" enabled="false" follows="left|top"
13 font="SansSerifSmall" height="20" hide_border="true" 17 font="SansSerifSmall" height="20" hide_border="true"
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_windlight_controls.xml b/linden/indra/newview/skins/default/xui/en-us/panel_windlight_controls.xml
new file mode 100644
index 0000000..e282c3c
--- /dev/null
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_windlight_controls.xml
@@ -0,0 +1,14 @@
1<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
2<panel bg_visible="false" border="false" border_visible="false" bottom="1"
3 enabled="true" follows="right|bottom" height="20" left="0"
4 name="windlight_controls" width="200">
5 <button bottom="-21" follows="left|bottom" font="SansSerif" halign="center" height="20"
6 label="Editor" left="4" name="Environment"
7 tool_tip="Click here to adjust world environment" width="80" />
8 <flyout_button bottom="-21" follows="left|bottom" height="20" label="Presets" left_delta="82" width="86"
9 list_position="above" mouse_opaque="true" name="Presets" tool_tip="Windlight presets">
10 </flyout_button>
11 <button bottom="-22" follows="left|bottom" font="SansSerif" halign="center" height="22" toggle="true"
12 label="" left_delta="88" name="Popup" scale_image="true" control_name="ShowWindlightSettingsPopup"
13 tool_tip="Click here to adjust world environment" width="22" />
14</panel>
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_windlight_remote.xml b/linden/indra/newview/skins/default/xui/en-us/panel_windlight_remote.xml
new file mode 100644
index 0000000..89ae7ce
--- /dev/null
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_windlight_remote.xml
@@ -0,0 +1,22 @@
1<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
2<panel bg_visible="false" border="false" border_visible="false" bottom="0"
3 enabled="true" follows="right|bottom" height="20" left="0" mouse_opaque="true"
4 name="windlight_remote" use_bounding_rect="true" width="200">
5 <panel bottom="1" filename="panel_bg_tab.xml" name="panel_bg_tab" height="22" left="0" width="200" />
6 <panel bottom="3" filename="panel_windlight_controls.xml" name="panel_windlight_controls" height="20" left="0" width="200" />
7 <string name="sunrise">
8 Sunrise
9 </string>
10 <string name="sunset">
11 Midday
12 </string>
13 <string name="noon">
14 Noon
15 </string>
16 <string name="midnight">
17 Midnight
18 </string>
19 <string name="revert_region">
20 Revert to Region Default
21 </string>
22</panel>
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_windlight_remote_expanded.xml b/linden/indra/newview/skins/default/xui/en-us/panel_windlight_remote_expanded.xml
new file mode 100644
index 0000000..31a3dc2
--- /dev/null
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_windlight_remote_expanded.xml
@@ -0,0 +1,12 @@
1<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
2<panel bg_visible="false" border="false" border_visible="false" bottom="0"
3 follows="right|bottom" height="47" left="0" mouse_opaque="true"
4 name="windlight_remote" use_bounding_rect="true" width="200">
5 <panel bottom="1" filename="panel_bg_tab.xml" name="panel_bg_tab" height="47" left="0" width="200" />
6 <slider bottom="-20" can_edit_text="false" control_name="RenderFarClip"
7 decimal_digits="0" enabled="true" height="18"
8 increment="8" initial_val="160" label="Draw Distance:"
9 label_width="80" left="6" max_val="512" min_val="64" mouse_opaque="true"
10 name="DrawDistance" show_text="true" width="195" />
11 <panel bottom="13" filename="panel_windlight_controls.xml" left="0" width="200" />
12</panel>