aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewercontrol.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewercontrol.cpp894
1 files changed, 464 insertions, 430 deletions
diff --git a/linden/indra/newview/llviewercontrol.cpp b/linden/indra/newview/llviewercontrol.cpp
index 3a82c05..203f9c7 100644
--- a/linden/indra/newview/llviewercontrol.cpp
+++ b/linden/indra/newview/llviewercontrol.cpp
@@ -36,490 +36,524 @@
36 36
37#include "indra_constants.h" 37#include "indra_constants.h"
38 38
39#include "v3math.h" 39// For Listeners
40#include "v3dmath.h" 40#include "audioengine.h"
41#include "llrect.h" 41#include "llagent.h"
42#include "v4color.h" 42#include "llconsole.h"
43#include "v4coloru.h" 43#include "lldrawpoolterrain.h"
44#include "v3color.h" 44#include "llflexibleobject.h"
45 45#include "llfeaturemanager.h"
46#include "llfloater.h" 46#include "llglslshader.h"
47#include "llvieweruictrlfactory.h" 47#include "llnetmap.h"
48#include "llfirstuse.h" 48#include "llpanelgeneral.h"
49#include "llcombobox.h" 49#include "llpanelinput.h"
50#include "llspinctrl.h" 50#include "llsky.h"
51#include "llcolorswatch.h" 51#include "llvieweraudio.h"
52#include "llviewerimagelist.h"
53#include "llviewerthrottle.h"
54#include "llviewerwindow.h"
55#include "llvoavatar.h"
56#include "llvoiceclient.h"
57#include "llvosky.h"
58#include "llvotree.h"
59#include "llvovolume.h"
60#include "llworld.h"
61#include "pipeline.h"
62#include "llviewerjoystick.h"
63#include "llviewerparcelmgr.h"
64#include "llparcel.h"
65#include "llnotify.h"
66#include "llkeyboard.h"
67#include "llerrorcontrol.h"
68#include "llversionviewer.h"
69#include "llappviewer.h"
70#include "llvosurfacepatch.h"
71#include "llvowlsky.h"
72#include "llglimmediate.h"
52 73
53#ifdef TOGGLE_HACKED_GODLIKE_VIEWER 74#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
54BOOL gHackGodmode = FALSE; 75BOOL gHackGodmode = FALSE;
55#endif 76#endif
56 77
57LLFloaterSettingsDebug* LLFloaterSettingsDebug::sInstance = NULL;
58 78
79std::map<LLString, LLControlGroup*> gSettings;
59LLControlGroup gSavedSettings; // saved at end of session 80LLControlGroup gSavedSettings; // saved at end of session
60LLControlGroup gSavedPerAccountSettings; // saved at end of session 81LLControlGroup gSavedPerAccountSettings; // saved at end of session
61LLControlGroup gViewerArt; // read-only
62LLControlGroup gColors; // read-only 82LLControlGroup gColors; // read-only
63LLControlGroup gCrashSettings; // saved at end of session 83LLControlGroup gCrashSettings; // saved at end of session
64 84
65LLString gLastRunVersion; 85LLString gLastRunVersion;
66LLString gCurrentVersion; 86LLString gCurrentVersion;
67 87
68LLString gSettingsFileName; 88extern BOOL gResizeScreenTexture;
69LLString gPerAccountSettingsFileName;
70 89
71LLFloaterSettingsDebug::LLFloaterSettingsDebug() : LLFloater("Configuration Editor") 90////////////////////////////////////////////////////////////////////////////
91// Listeners
92
93static bool handleRenderAvatarMouselookChanged(const LLSD& newvalue)
94{
95 LLVOAvatar::sVisibleInFirstPerson = newvalue.asBoolean();
96 return true;
97}
98
99static bool handleRenderFarClipChanged(const LLSD& newvalue)
72{ 100{
101 F32 draw_distance = (F32) newvalue.asReal();
102 gAgent.mDrawDistance = draw_distance;
103 LLWorld::getInstance()->setLandFarClip(draw_distance);
104 return true;
73} 105}
74 106
75LLFloaterSettingsDebug::~LLFloaterSettingsDebug() 107static bool handleTerrainDetailChanged(const LLSD& newvalue)
76{ 108{
77 sInstance = NULL; 109 LLDrawPoolTerrain::sDetailMode = newvalue.asInteger();
110 return true;
78} 111}
79 112
80BOOL LLFloaterSettingsDebug::postBuild() 113
114static bool handleSetShaderChanged(const LLSD& newvalue)
81{ 115{
82 LLComboBox* settings_combo = LLUICtrlFactory::getComboBoxByName(this, "settings_combo"); 116 LLShaderMgr::setShaders();
117 return true;
118}
83 119
84 LLControlGroup::ctrl_name_table_t::iterator name_it; 120static bool handleReleaseGLBufferChanged(const LLSD& newvalue)
85 for(name_it = gSavedSettings.mNameTable.begin(); name_it != gSavedSettings.mNameTable.end(); ++name_it) 121{
122 if (gPipeline.isInit())
86 { 123 {
87 settings_combo->add(name_it->first, (void*)name_it->second); 124 gPipeline.releaseGLBuffers();
125 gPipeline.createGLBuffers();
88 } 126 }
89 for(name_it = gSavedPerAccountSettings.mNameTable.begin(); name_it != gSavedPerAccountSettings.mNameTable.end(); ++name_it) 127 return true;
128}
129
130static bool handleVolumeLODChanged(const LLSD& newvalue)
131{
132 LLVOVolume::sLODFactor = (F32) newvalue.asReal();
133 LLVOVolume::sDistanceFactor = 1.f-LLVOVolume::sLODFactor * 0.1f;
134 return true;
135}
136
137static bool handleAvatarLODChanged(const LLSD& newvalue)
138{
139 LLVOAvatar::sLODFactor = (F32) newvalue.asReal();
140 return true;
141}
142
143static bool handleTerrainLODChanged(const LLSD& newvalue)
144{
145 LLVOSurfacePatch::sLODFactor = (F32)newvalue.asReal();
146 //sqaure lod factor to get exponential range of [0,4] and keep
147 //a value of 1 in the middle of the detail slider for consistency
148 //with other detail sliders (see panel_preferences_graphics1.xml)
149 LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor;
150 return true;
151}
152
153static bool handleTreeLODChanged(const LLSD& newvalue)
154{
155 LLVOTree::sTreeFactor = (F32) newvalue.asReal();
156 return true;
157}
158
159static bool handleFlexLODChanged(const LLSD& newvalue)
160{
161 LLVolumeImplFlexible::sUpdateFactor = (F32) newvalue.asReal();
162 return true;
163}
164
165static bool handleGammaChanged(const LLSD& newvalue)
166{
167 F32 gamma = (F32) newvalue.asReal();
168 if (gamma == 0.0f)
90 { 169 {
91 settings_combo->add(name_it->first, (void*)name_it->second); 170 gamma = 1.0f; // restore normal gamma
92 } 171 }
93 for(name_it = gColors.mNameTable.begin(); name_it != gColors.mNameTable.end(); ++name_it) 172 if (gViewerWindow && gViewerWindow->getWindow() && gamma != gViewerWindow->getWindow()->getGamma())
94 { 173 {
95 settings_combo->add(name_it->first, (void*)name_it->second); 174 // Only save it if it's changed
175 if (!gViewerWindow->getWindow()->setGamma(gamma))
176 {
177 llwarns << "setGamma failed!" << llendl;
178 }
96 } 179 }
97 settings_combo->sortByName();
98 settings_combo->setCommitCallback(onSettingSelect);
99 settings_combo->setCallbackUserData(this);
100 settings_combo->updateSelection();
101
102 childSetCommitCallback("val_spinner_1", onCommitSettings);
103 childSetUserData("val_spinner_1", this);
104 childSetCommitCallback("val_spinner_2", onCommitSettings);
105 childSetUserData("val_spinner_2", this);
106 childSetCommitCallback("val_spinner_3", onCommitSettings);
107 childSetUserData("val_spinner_3", this);
108 childSetCommitCallback("val_spinner_4", onCommitSettings);
109 childSetUserData("val_spinner_4", this);
110 childSetCommitCallback("val_text", onCommitSettings);
111 childSetUserData("val_text", this);
112 childSetCommitCallback("boolean_combo", onCommitSettings);
113 childSetUserData("boolean_combo", this);
114 childSetCommitCallback("color_swatch", onCommitSettings);
115 childSetUserData("color_swatch", this);
116 childSetAction("default_btn", onClickDefault, this);
117 mComment = getChild<LLTextEditor>("comment_text");
118 return TRUE;
119}
120
121void LLFloaterSettingsDebug::draw()
122{
123 LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo");
124 LLControlBase* controlp = (LLControlBase*)settings_combo->getCurrentUserdata();
125 updateControl(controlp);
126
127 LLFloater::draw();
128}
129
130//static
131void LLFloaterSettingsDebug::show(void*)
132{
133 if (sInstance == NULL)
134 {
135 sInstance = new LLFloaterSettingsDebug();
136 180
137 gUICtrlFactory->buildFloater(sInstance, "floater_settings_debug.xml"); 181 return true;
138 } 182}
139 183
140 sInstance->open(); /* Flawfinder: ignore */ 184const F32 MAX_USER_FOG_RATIO = 10.f;
141} 185const F32 MIN_USER_FOG_RATIO = 0.5f;
142 186
143//static 187static bool handleFogRatioChanged(const LLSD& newvalue)
144void LLFloaterSettingsDebug::onSettingSelect(LLUICtrl* ctrl, void* user_data) 188{
145{ 189 F32 fog_ratio = llmax(MIN_USER_FOG_RATIO, llmin((F32) newvalue.asReal(), MAX_USER_FOG_RATIO));
146 LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; 190 gSky.setFogRatio(fog_ratio);
147 LLComboBox* combo_box = (LLComboBox*)ctrl; 191 return true;
148 LLControlBase* controlp = (LLControlBase*)combo_box->getCurrentUserdata();
149
150 floaterp->updateControl(controlp);
151}
152
153//static
154void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data)
155{
156 LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data;
157
158 LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo");
159 LLControlBase* controlp = (LLControlBase*)settings_combo->getCurrentUserdata();
160
161 LLVector3 vector;
162 LLVector3d vectord;
163 LLRect rect;
164 LLColor4 col4;
165 LLColor3 col3;
166 LLColor4U col4U;
167 LLColor4 color_with_alpha;
168
169 switch(controlp->type())
170 {
171 case TYPE_U32:
172 controlp->set(floaterp->childGetValue("val_spinner_1"));
173 break;
174 case TYPE_S32:
175 controlp->set(floaterp->childGetValue("val_spinner_1"));
176 break;
177 case TYPE_F32:
178 controlp->set(LLSD(floaterp->childGetValue("val_spinner_1").asReal()));
179 break;
180 case TYPE_BOOLEAN:
181 controlp->set(floaterp->childGetValue("boolean_combo"));
182 break;
183 case TYPE_STRING:
184 controlp->set(LLSD(floaterp->childGetValue("val_text").asString()));
185 break;
186 case TYPE_VEC3:
187 vector.mV[VX] = (F32)floaterp->childGetValue("val_spinner_1").asReal();
188 vector.mV[VY] = (F32)floaterp->childGetValue("val_spinner_2").asReal();
189 vector.mV[VZ] = (F32)floaterp->childGetValue("val_spinner_3").asReal();
190 controlp->set(vector.getValue());
191 break;
192 case TYPE_VEC3D:
193 vectord.mdV[VX] = floaterp->childGetValue("val_spinner_1").asReal();
194 vectord.mdV[VY] = floaterp->childGetValue("val_spinner_2").asReal();
195 vectord.mdV[VZ] = floaterp->childGetValue("val_spinner_3").asReal();
196 controlp->set(vectord.getValue());
197 break;
198 case TYPE_RECT:
199 rect.mLeft = floaterp->childGetValue("val_spinner_1").asInteger();
200 rect.mRight = floaterp->childGetValue("val_spinner_2").asInteger();
201 rect.mBottom = floaterp->childGetValue("val_spinner_3").asInteger();
202 rect.mTop = floaterp->childGetValue("val_spinner_4").asInteger();
203 controlp->set(rect.getValue());
204 break;
205 case TYPE_COL4:
206 col3.setValue(floaterp->childGetValue("color_swatch"));
207 col4 = LLColor4(col3, (F32)floaterp->childGetValue("val_spinner_4").asReal());
208 controlp->set(col4.getValue());
209 break;
210 case TYPE_COL3:
211 controlp->set(floaterp->childGetValue("color_swatch"));
212 //col3.mV[VRED] = (F32)floaterp->childGetValue("val_spinner_1").asC();
213 //col3.mV[VGREEN] = (F32)floaterp->childGetValue("val_spinner_2").asReal();
214 //col3.mV[VBLUE] = (F32)floaterp->childGetValue("val_spinner_3").asReal();
215 //controlp->set(col3.getValue());
216 break;
217 case TYPE_COL4U:
218 col3.setValue(floaterp->childGetValue("color_swatch"));
219 col4U.setVecScaleClamp(col3);
220 col4U.mV[VALPHA] = floaterp->childGetValue("val_spinner_4").asInteger();
221 controlp->set(col4U.getValue());
222 break;
223 default:
224 break;
225 }
226} 192}
227 193
228// static 194static bool handleMaxPartCountChanged(const LLSD& newvalue)
229void LLFloaterSettingsDebug::onClickDefault(void* user_data)
230{ 195{
231 LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; 196 LLViewerPartSim::setMaxPartCount(newvalue.asInteger());
232 LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo"); 197 return true;
233 LLControlBase* controlp = (LLControlBase*)settings_combo->getCurrentUserdata(); 198}
199
200const S32 MAX_USER_COMPOSITE_LIMIT = 100;
201const S32 MIN_USER_COMPOSITE_LIMIT = 0;
202
203static bool handleCompositeLimitChanged(const LLSD& newvalue)
204{
205 S32 composite_limit = llmax(MIN_USER_COMPOSITE_LIMIT, llmin((S32)newvalue.asInteger(), MAX_USER_COMPOSITE_LIMIT));
206 LLVOAvatar::sMaxOtherAvatarsToComposite = composite_limit;
207 return true;
208}
209
210static bool handleVideoMemoryChanged(const LLSD& newvalue)
211{
212 gImageList.updateMaxResidentTexMem(newvalue.asInteger());
213 return true;
214}
215
216static bool handleBandwidthChanged(const LLSD& newvalue)
217{
218 gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal());
219 return true;
220}
234 221
235 if (controlp) 222static bool handleChatFontSizeChanged(const LLSD& newvalue)
223{
224 if(gConsole)
236 { 225 {
237 controlp->resetToDefault(); 226 gConsole->setFontSize(newvalue.asInteger());
238 floaterp->updateControl(controlp);
239 } 227 }
228 return true;
240} 229}
241 230
242// we've switched controls, or doing per-frame update, so update spinners, etc. 231static bool handleChatPersistTimeChanged(const LLSD& newvalue)
243void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp)
244{ 232{
245 LLSpinCtrl* spinner1 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_1"); 233 if(gConsole)
246 LLSpinCtrl* spinner2 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_2"); 234 {
247 LLSpinCtrl* spinner3 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_3"); 235 gConsole->setLinePersistTime((F32) newvalue.asReal());
248 LLSpinCtrl* spinner4 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_4"); 236 }
249 LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("color_swatch"); 237 return true;
238}
250 239
251 if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch) 240static bool handleConsoleMaxLinesChanged(const LLSD& newvalue)
241{
242 if(gConsole)
252 { 243 {
253 llwarns << "Could not find all desired controls by name" 244 gConsole->setMaxLines(newvalue.asInteger());
254 << llendl;
255 return;
256 } 245 }
246 return true;
247}
257 248
258 spinner1->setVisible(FALSE); 249static void handleAudioVolumeChanged(const LLSD& newvalue)
259 spinner2->setVisible(FALSE); 250{
260 spinner3->setVisible(FALSE); 251 audio_update_volume(true);
261 spinner4->setVisible(FALSE); 252}
262 color_swatch->setVisible(FALSE);
263 childSetVisible("val_text", FALSE);
264 mComment->setText(LLString::null);
265 253
266 if (controlp) 254static bool handleJoystickChanged(const LLSD& newvalue)
267 { 255{
268 eControlType type = controlp->type(); 256 LLViewerJoystick::getInstance()->setCameraNeedsUpdate(TRUE);
269 mComment->setText(controlp->getComment()); 257 return true;
270 spinner1->setMaxValue(F32_MAX); 258}
271 spinner2->setMaxValue(F32_MAX);
272 spinner3->setMaxValue(F32_MAX);
273 spinner4->setMaxValue(F32_MAX);
274 spinner1->setMinValue(-F32_MAX);
275 spinner2->setMinValue(-F32_MAX);
276 spinner3->setMinValue(-F32_MAX);
277 spinner4->setMinValue(-F32_MAX);
278 if (!spinner1->hasFocus())
279 {
280 spinner1->setIncrement(0.1f);
281 }
282 if (!spinner2->hasFocus())
283 {
284 spinner2->setIncrement(0.1f);
285 }
286 if (!spinner3->hasFocus())
287 {
288 spinner3->setIncrement(0.1f);
289 }
290 if (!spinner4->hasFocus())
291 {
292 spinner4->setIncrement(0.1f);
293 }
294 259
295 LLSD sd = controlp->get(); 260static bool handleAudioStreamMusicChanged(const LLSD& newvalue)
296 switch(type) 261{
262 if (gAudiop)
263 {
264 if ( newvalue.asBoolean() )
297 { 265 {
298 case TYPE_U32: 266 if (LLViewerParcelMgr::getInstance()->getAgentParcel()
299 spinner1->setVisible(TRUE); 267 && !LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL().empty())
300 spinner1->setLabel(LLString("value")); // Debug, don't translate
301 childSetVisible("boolean_combo", FALSE);
302 if (!spinner1->hasFocus())
303 {
304 spinner1->setValue(sd);
305 spinner1->setMinValue((F32)U32_MIN);
306 spinner1->setMaxValue((F32)U32_MAX);
307 spinner1->setIncrement(1.f);
308 spinner1->setPrecision(0);
309 }
310 break;
311 case TYPE_S32:
312 spinner1->setVisible(TRUE);
313 spinner1->setLabel(LLString("value")); // Debug, don't translate
314 childSetVisible("boolean_combo", FALSE);
315 if (!spinner1->hasFocus())
316 {
317 spinner1->setValue(sd);
318 spinner1->setMinValue((F32)S32_MIN);
319 spinner1->setMaxValue((F32)S32_MAX);
320 spinner1->setIncrement(1.f);
321 spinner1->setPrecision(0);
322 }
323 break;
324 case TYPE_F32:
325 spinner1->setVisible(TRUE);
326 spinner1->setLabel(LLString("value")); // Debug, don't translate
327 childSetVisible("boolean_combo", FALSE);
328 if (!spinner1->hasFocus())
329 { 268 {
330 spinner1->setPrecision(3); 269 // if stream is already playing, don't call this
331 spinner1->setValue(sd); 270 // otherwise music will briefly stop
332 } 271 if ( !gAudiop->isInternetStreamPlaying() )
333 break;
334 case TYPE_BOOLEAN:
335 childSetVisible("boolean_combo", TRUE);
336
337 if (!childHasFocus("boolean_combo"))
338 {
339 if (sd.asBoolean())
340 { 272 {
341 childSetValue("boolean_combo", LLSD("true")); 273 gAudiop->startInternetStream(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL().c_str());
342 } 274 }
343 else
344 {
345 childSetValue("boolean_combo", LLSD(""));
346 }
347 }
348 break;
349 case TYPE_STRING:
350 childSetVisible("val_text", TRUE);
351 childSetVisible("boolean_combo", FALSE);
352 if (!childHasFocus("val_text"))
353 {
354 childSetValue("val_text", sd);
355 }
356 break;
357 case TYPE_VEC3:
358 {
359 childSetVisible("boolean_combo", FALSE);
360 LLVector3 v;
361 v.setValue(sd);
362 spinner1->setVisible(TRUE);
363 spinner1->setLabel(LLString("X"));
364 spinner2->setVisible(TRUE);
365 spinner2->setLabel(LLString("Y"));
366 spinner3->setVisible(TRUE);
367 spinner3->setLabel(LLString("Z"));
368 if (!spinner1->hasFocus())
369 {
370 spinner1->setPrecision(3);
371 spinner1->setValue(v[VX]);
372 }
373 if (!spinner2->hasFocus())
374 {
375 spinner2->setPrecision(3);
376 spinner2->setValue(v[VY]);
377 }
378 if (!spinner3->hasFocus())
379 {
380 spinner3->setPrecision(3);
381 spinner3->setValue(v[VZ]);
382 }
383 break;
384 }
385 case TYPE_VEC3D:
386 {
387 childSetVisible("boolean_combo", FALSE);
388 LLVector3d v;
389 v.setValue(sd);
390 spinner1->setVisible(TRUE);
391 spinner1->setLabel(LLString("X"));
392 spinner2->setVisible(TRUE);
393 spinner2->setLabel(LLString("Y"));
394 spinner3->setVisible(TRUE);
395 spinner3->setLabel(LLString("Z"));
396 if (!spinner1->hasFocus())
397 {
398 spinner1->setPrecision(3);
399 spinner1->setValue(v[VX]);
400 }
401 if (!spinner2->hasFocus())
402 {
403 spinner2->setPrecision(3);
404 spinner2->setValue(v[VY]);
405 }
406 if (!spinner3->hasFocus())
407 {
408 spinner3->setPrecision(3);
409 spinner3->setValue(v[VZ]);
410 }
411 break;
412 }
413 case TYPE_RECT:
414 {
415 childSetVisible("boolean_combo", FALSE);
416 LLRect r;
417 r.setValue(sd);
418 spinner1->setVisible(TRUE);
419 spinner1->setLabel(LLString("Left"));
420 spinner2->setVisible(TRUE);
421 spinner2->setLabel(LLString("Right"));
422 spinner3->setVisible(TRUE);
423 spinner3->setLabel(LLString("Bottom"));
424 spinner4->setVisible(TRUE);
425 spinner4->setLabel(LLString("Top"));
426 if (!spinner1->hasFocus())
427 {
428 spinner1->setPrecision(0);
429 spinner1->setValue(r.mLeft);
430 }
431 if (!spinner2->hasFocus())
432 {
433 spinner2->setPrecision(0);
434 spinner2->setValue(r.mRight);
435 }
436 if (!spinner3->hasFocus())
437 {
438 spinner3->setPrecision(0);
439 spinner3->setValue(r.mBottom);
440 }
441 if (!spinner4->hasFocus())
442 {
443 spinner4->setPrecision(0);
444 spinner4->setValue(r.mTop);
445 } 275 }
276 }
277 else
278 {
279 gAudiop->stopInternetStream();
280 }
281 }
282 return true;
283}
446 284
447 spinner1->setMinValue((F32)S32_MIN); 285static bool handleUseOcclusionChanged(const LLSD& newvalue)
448 spinner1->setMaxValue((F32)S32_MAX); 286{
449 spinner1->setIncrement(1.f); 287 LLPipeline::sUseOcclusion = (newvalue.asBoolean() && gGLManager.mHasOcclusionQuery
450 288 && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") && !gUseWireframe) ? 2 : 0;
451 spinner2->setMinValue((F32)S32_MIN); 289 return true;
452 spinner2->setMaxValue((F32)S32_MAX); 290}
453 spinner2->setIncrement(1.f);
454
455 spinner3->setMinValue((F32)S32_MIN);
456 spinner3->setMaxValue((F32)S32_MAX);
457 spinner3->setIncrement(1.f);
458
459 spinner4->setMinValue((F32)S32_MIN);
460 spinner4->setMaxValue((F32)S32_MAX);
461 spinner4->setIncrement(1.f);
462 break;
463 }
464 case TYPE_COL4:
465 {
466 childSetVisible("boolean_combo", FALSE);
467 LLColor4 clr;
468 clr.setValue(sd);
469 color_swatch->setVisible(TRUE);
470 // only set if changed so color picker doesn't update
471 if(clr != LLColor4(color_swatch->getValue()))
472 {
473 color_swatch->set(LLColor4(sd), TRUE, FALSE);
474 }
475 spinner4->setVisible(TRUE);
476 spinner4->setLabel(LLString("Alpha"));
477 if (!spinner4->hasFocus())
478 {
479 spinner4->setPrecision(3);
480 spinner4->setMinValue(0.0);
481 spinner4->setMaxValue(1.f);
482 spinner4->setValue(clr.mV[VALPHA]);
483 }
484 break;
485 }
486 case TYPE_COL3:
487 {
488 childSetVisible("boolean_combo", FALSE);
489 LLColor3 clr;
490 clr.setValue(sd);
491 color_swatch->setVisible(TRUE);
492 color_swatch->setValue(sd);
493 break;
494 }
495 case TYPE_COL4U:
496 {
497 childSetVisible("boolean_combo", FALSE);
498 LLColor4U clr;
499 clr.setValue(sd);
500 color_swatch->setVisible(TRUE);
501 if(LLColor4(clr) != LLColor4(color_swatch->getValue()))
502 {
503 color_swatch->set(LLColor4(clr), TRUE, FALSE);
504 }
505 spinner4->setVisible(TRUE);
506 spinner4->setLabel(LLString("Alpha"));
507 if(!spinner4->hasFocus())
508 {
509 spinner4->setPrecision(0);
510 spinner4->setValue(clr.mV[VALPHA]);
511 }
512 291
513 spinner4->setMinValue(0); 292static bool handleNumpadControlChanged(const LLSD& newvalue)
514 spinner4->setMaxValue(255); 293{
515 spinner4->setIncrement(1.f); 294 if (gKeyboard)
295 {
296 gKeyboard->setNumpadDistinct(static_cast<LLKeyboard::e_numpad_distinct>(newvalue.asInteger()));
297 }
298 return true;
299}
516 300
517 break; 301static bool handleRenderUseVBOChanged(const LLSD& newvalue)
518 } 302{
519 default: 303 if (gPipeline.isInit())
520 mComment->setText(LLString("unknown")); 304 {
521 break; 305 gPipeline.setUseVBO(newvalue.asBoolean());
522 } 306 }
307 return true;
308}
309
310static bool handleWLSkyDetailChanged(const LLSD&)
311{
312 if (gSky.mVOWLSkyp.notNull())
313 {
314 gSky.mVOWLSkyp->updateGeometry(gSky.mVOWLSkyp->mDrawable);
315 }
316 return true;
317}
318
319static bool handleRenderLightingDetailChanged(const LLSD& newvalue)
320{
321 if (gPipeline.isInit())
322 {
323 gPipeline.setLightingDetail(newvalue.asInteger());
324 }
325 return true;
326}
327
328static bool handleResetVertexBuffersChanged(const LLSD&)
329{
330 if (gPipeline.isInit())
331 {
332 gPipeline.resetVertexBuffers();
523 } 333 }
334 return true;
335}
336
337static bool handleRenderDynamicLODChanged(const LLSD& newvalue)
338{
339 LLPipeline::sDynamicLOD = newvalue.asBoolean();
340 return true;
341}
342
343static bool handleRenderUseFBOChanged(const LLSD& newvalue)
344{
345 LLRenderTarget::sUseFBO = newvalue.asBoolean();
346 if (gPipeline.isInit())
347 {
348 gPipeline.releaseGLBuffers();
349 gPipeline.createGLBuffers();
350 }
351 return true;
352}
353
354static bool handleRenderUseImpostorsChanged(const LLSD& newvalue)
355{
356 LLVOAvatar::sUseImpostors = FALSE; //newvalue.asBoolean();
357 return true;
358}
359
360static bool handleRenderUseCleverUIChanged(const LLSD& newvalue)
361{
362 gGL.setClever(newvalue.asBoolean());
363 return true;
364}
365
366static bool handleRenderResolutionDivisorChanged(const LLSD&)
367{
368 gResizeScreenTexture = TRUE;
369 return true;
370}
371
372static bool handleDebugViewsChanged(const LLSD& newvalue)
373{
374 LLView::sDebugRects = newvalue.asBoolean();
375 return true;
376}
377
378static bool handleLogFileChanged(const LLSD& newvalue)
379{
380 std::string log_filename = newvalue.asString();
381 LLFile::remove(log_filename.c_str());
382 LLError::logToFile(log_filename);
383 return true;
384}
385
386bool handleHideGroupTitleChanged(const LLSD& newvalue)
387{
388 gAgent.setHideGroupTitle(newvalue);
389 return true;
390}
391
392bool handleEffectColorChanged(const LLSD& newvalue)
393{
394 gAgent.setEffectColor(LLColor4(newvalue));
395 return true;
396}
397
398bool handleRotateNetMapChanged(const LLSD& newvalue)
399{
400 LLNetMap::setRotateMap(newvalue.asBoolean());
401 return true;
402}
524 403
404bool handleVectorizeChanged(const LLSD& newvalue)
405{
406 LLViewerJointMesh::updateVectorize();
407 return true;
408}
409
410bool handleVoiceClientPrefsChanged(const LLSD& newvalue)
411{
412 if(gVoiceClient)
413 {
414 // Note: Ignore the specific event value, look up the ones we want
415
416 gVoiceClient->setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat"));
417 gVoiceClient->setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
418 std::string keyString = gSavedSettings.getString("PushToTalkButton");
419 gVoiceClient->setPTTKey(keyString);
420 gVoiceClient->setPTTIsToggle(gSavedSettings.getBOOL("PushToTalkToggle"));
421 gVoiceClient->setEarLocation(gSavedSettings.getS32("VoiceEarLocation"));
422 std::string serverName = gSavedSettings.getString("VivoxDebugServerName");
423 gVoiceClient->setVivoxDebugServerName(serverName);
424
425 std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
426 gVoiceClient->setCaptureDevice(inputDevice);
427 std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
428 gVoiceClient->setRenderDevice(outputDevice);
429 }
430 return true;
525} 431}
432
433////////////////////////////////////////////////////////////////////////////
434
435void settings_setup_listeners()
436{
437 gSavedSettings.getControl("FirstPersonAvatarVisible")->getSignal()->connect(boost::bind(&handleRenderAvatarMouselookChanged, _1));
438 gSavedSettings.getControl("RenderFarClip")->getSignal()->connect(boost::bind(&handleRenderFarClipChanged, _1));
439 gSavedSettings.getControl("RenderTerrainDetail")->getSignal()->connect(boost::bind(&handleTerrainDetailChanged, _1));
440 gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
441 gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
442 gSavedSettings.getControl("RenderDynamicReflections")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
443 gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1));
444 gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
445 gSavedSettings.getControl("EnableRippleWater")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
446 gSavedSettings.getControl("RenderGlowResolutionPow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1));
447 gSavedSettings.getControl("RenderAvatarCloth")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
448 gSavedSettings.getControl("WindLightUseAtmosShaders")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
449 gSavedSettings.getControl("RenderGammaFull")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
450 gSavedSettings.getControl("RenderVolumeLODFactor")->getSignal()->connect(boost::bind(&handleVolumeLODChanged, _1));
451 gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _1));
452 gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _1));
453 gSavedSettings.getControl("RenderTreeLODFactor")->getSignal()->connect(boost::bind(&handleTreeLODChanged, _1));
454 gSavedSettings.getControl("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _1));
455 gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&handleBandwidthChanged, _1));
456 gSavedSettings.getControl("RenderGamma")->getSignal()->connect(boost::bind(&handleGammaChanged, _1));
457 gSavedSettings.getControl("RenderFogRatio")->getSignal()->connect(boost::bind(&handleFogRatioChanged, _1));
458 gSavedSettings.getControl("RenderMaxPartCount")->getSignal()->connect(boost::bind(&handleMaxPartCountChanged, _1));
459 gSavedSettings.getControl("RenderDynamicLOD")->getSignal()->connect(boost::bind(&handleRenderDynamicLODChanged, _1));
460 gSavedSettings.getControl("RenderDebugTextureBind")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1));
461 gSavedSettings.getControl("RenderFastAlpha")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1));
462 gSavedSettings.getControl("RenderObjectBump")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1));
463 gSavedSettings.getControl("RenderMaxVBOSize")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1));
464 gSavedSettings.getControl("RenderUseFBO")->getSignal()->connect(boost::bind(&handleRenderUseFBOChanged, _1));
465 gSavedSettings.getControl("RenderUseImpostors")->getSignal()->connect(boost::bind(&handleRenderUseImpostorsChanged, _1));
466 gSavedSettings.getControl("RenderUseCleverUI")->getSignal()->connect(boost::bind(&handleRenderUseCleverUIChanged, _1));
467 gSavedSettings.getControl("RenderResolutionDivisor")->getSignal()->connect(boost::bind(&handleRenderResolutionDivisorChanged, _1));
468 gSavedSettings.getControl("RenderDeferred")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
469 gSavedSettings.getControl("AvatarCompositeLimit")->getSignal()->connect(boost::bind(&handleCompositeLimitChanged, _1));
470 gSavedSettings.getControl("TextureMemory")->getSignal()->connect(boost::bind(&handleVideoMemoryChanged, _1));
471 gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&handleChatFontSizeChanged, _1));
472 gSavedSettings.getControl("ChatPersistTime")->getSignal()->connect(boost::bind(&handleChatPersistTimeChanged, _1));
473 gSavedSettings.getControl("ConsoleMaxLines")->getSignal()->connect(boost::bind(&handleConsoleMaxLinesChanged, _1));
474 gSavedSettings.getControl("UseOcclusion")->getSignal()->connect(boost::bind(&handleUseOcclusionChanged, _1));
475 gSavedSettings.getControl("AudioLevelMaster")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
476 gSavedSettings.getControl("AudioLevelSFX")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
477 gSavedSettings.getControl("AudioLevelUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
478 gSavedSettings.getControl("AudioLevelAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
479 gSavedSettings.getControl("AudioLevelMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
480 gSavedSettings.getControl("AudioLevelMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
481 gSavedSettings.getControl("AudioLevelVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
482 gSavedSettings.getControl("AudioLevelDistance")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
483 gSavedSettings.getControl("AudioLevelDoppler")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
484 gSavedSettings.getControl("AudioLevelRolloff")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
485 gSavedSettings.getControl("AudioStreamingMusic")->getSignal()->connect(boost::bind(&handleAudioStreamMusicChanged, _1));
486 gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
487 gSavedSettings.getControl("MuteMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
488 gSavedSettings.getControl("MuteMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
489 gSavedSettings.getControl("MuteVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
490 gSavedSettings.getControl("MuteAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
491 gSavedSettings.getControl("MuteUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
492 gSavedSettings.getControl("RenderVBOEnable")->getSignal()->connect(boost::bind(&handleRenderUseVBOChanged, _1));
493 gSavedSettings.getControl("WLSkyDetail")->getSignal()->connect(boost::bind(&handleWLSkyDetailChanged, _1));
494 gSavedSettings.getControl("RenderLightingDetail")->getSignal()->connect(boost::bind(&handleRenderLightingDetailChanged, _1));
495 gSavedSettings.getControl("NumpadControl")->getSignal()->connect(boost::bind(&handleNumpadControlChanged, _1));
496 gSavedSettings.getControl("JoystickAxis0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
497 gSavedSettings.getControl("JoystickAxis1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
498 gSavedSettings.getControl("JoystickAxis2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
499 gSavedSettings.getControl("JoystickAxis3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
500 gSavedSettings.getControl("JoystickAxis4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
501 gSavedSettings.getControl("JoystickAxis5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
502 gSavedSettings.getControl("JoystickAxis6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
503 gSavedSettings.getControl("FlycamAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
504 gSavedSettings.getControl("FlycamAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
505 gSavedSettings.getControl("FlycamAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
506 gSavedSettings.getControl("FlycamAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
507 gSavedSettings.getControl("FlycamAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
508 gSavedSettings.getControl("FlycamAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
509 gSavedSettings.getControl("FlycamAxisScale6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
510 gSavedSettings.getControl("FlycamAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
511 gSavedSettings.getControl("FlycamAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
512 gSavedSettings.getControl("FlycamAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
513 gSavedSettings.getControl("FlycamAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
514 gSavedSettings.getControl("FlycamAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
515 gSavedSettings.getControl("FlycamAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
516 gSavedSettings.getControl("FlycamAxisDeadZone6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
517 gSavedSettings.getControl("AvatarAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
518 gSavedSettings.getControl("AvatarAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
519 gSavedSettings.getControl("AvatarAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
520 gSavedSettings.getControl("AvatarAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
521 gSavedSettings.getControl("AvatarAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
522 gSavedSettings.getControl("AvatarAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
523 gSavedSettings.getControl("AvatarAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
524 gSavedSettings.getControl("AvatarAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
525 gSavedSettings.getControl("AvatarAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
526 gSavedSettings.getControl("AvatarAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
527 gSavedSettings.getControl("AvatarAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
528 gSavedSettings.getControl("AvatarAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
529 gSavedSettings.getControl("BuildAxisScale0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
530 gSavedSettings.getControl("BuildAxisScale1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
531 gSavedSettings.getControl("BuildAxisScale2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
532 gSavedSettings.getControl("BuildAxisScale3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
533 gSavedSettings.getControl("BuildAxisScale4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
534 gSavedSettings.getControl("BuildAxisScale5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
535 gSavedSettings.getControl("BuildAxisDeadZone0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
536 gSavedSettings.getControl("BuildAxisDeadZone1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
537 gSavedSettings.getControl("BuildAxisDeadZone2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
538 gSavedSettings.getControl("BuildAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
539 gSavedSettings.getControl("BuildAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
540 gSavedSettings.getControl("BuildAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
541 gSavedSettings.getControl("DebugViews")->getSignal()->connect(boost::bind(&handleDebugViewsChanged, _1));
542 gSavedSettings.getControl("UserLogFile")->getSignal()->connect(boost::bind(&handleLogFileChanged, _1));
543 gSavedSettings.getControl("RenderHideGroupTitle")->getSignal()->connect(boost::bind(handleHideGroupTitleChanged, _1));
544 gSavedSettings.getControl("EffectColor")->getSignal()->connect(boost::bind(handleEffectColorChanged, _1));
545 gSavedSettings.getControl("MiniMapRotate")->getSignal()->connect(boost::bind(handleRotateNetMapChanged, _1));
546 gSavedSettings.getControl("VectorizePerfTest")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
547 gSavedSettings.getControl("VectorizeEnable")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
548 gSavedSettings.getControl("VectorizeProcessor")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
549 gSavedSettings.getControl("VectorizeSkin")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
550 gSavedSettings.getControl("EnableVoiceChat")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
551 gSavedSettings.getControl("PTTCurrentlyEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
552 gSavedSettings.getControl("PushToTalkButton")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
553 gSavedSettings.getControl("PushToTalkToggle")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
554 gSavedSettings.getControl("VoiceEarLocation")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
555 gSavedSettings.getControl("VivoxDebugServerName")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
556 gSavedSettings.getControl("VoiceInputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
557 gSavedSettings.getControl("VoiceOutputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
558}
559