aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterwindlight.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llfloaterwindlight.cpp')
-rw-r--r--linden/indra/newview/llfloaterwindlight.cpp86
1 files changed, 43 insertions, 43 deletions
diff --git a/linden/indra/newview/llfloaterwindlight.cpp b/linden/indra/newview/llfloaterwindlight.cpp
index 26e2184..8ed95da 100644
--- a/linden/indra/newview/llfloaterwindlight.cpp
+++ b/linden/indra/newview/llfloaterwindlight.cpp
@@ -66,7 +66,7 @@ std::set<std::string> LLFloaterWindLight::sDefaultPresets;
66 66
67static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f; 67static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f;
68 68
69LLFloaterWindLight::LLFloaterWindLight() : LLFloater("windlight floater") 69LLFloaterWindLight::LLFloaterWindLight() : LLFloater(std::string("windlight floater"))
70{ 70{
71 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_windlight_options.xml"); 71 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_windlight_options.xml");
72 72
@@ -83,21 +83,21 @@ LLFloaterWindLight::LLFloaterWindLight() : LLFloater("windlight floater")
83 } 83 }
84 84
85 // entry for when we're in estate time 85 // entry for when we're in estate time
86 comboBox->add(""); 86 comboBox->add(LLStringUtil::null);
87 87
88 // set defaults on combo boxes 88 // set defaults on combo boxes
89 comboBox->selectByValue(LLSD("Default")); 89 comboBox->selectByValue(LLSD("Default"));
90 } 90 }
91 91
92 // add the list of presets 92 // add the list of presets
93 LLString def_days = getString("WLDefaultSkyNames"); 93 std::string def_days = getString("WLDefaultSkyNames");
94 94
95 // no editing or deleting of the blank string 95 // no editing or deleting of the blank string
96 sDefaultPresets.insert(""); 96 sDefaultPresets.insert("");
97 boost_tokenizer tokens(def_days, boost::char_separator<char>(":")); 97 boost_tokenizer tokens(def_days, boost::char_separator<char>(":"));
98 for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) 98 for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
99 { 99 {
100 LLString tok(*token_iter); 100 std::string tok(*token_iter);
101 sDefaultPresets.insert(tok); 101 sDefaultPresets.insert(tok);
102 } 102 }
103 103
@@ -233,8 +233,8 @@ void LLFloaterWindLight::onClickHelp(void* data)
233{ 233{
234 LLFloaterWindLight* self = LLFloaterWindLight::instance(); 234 LLFloaterWindLight* self = LLFloaterWindLight::instance();
235 235
236 const char* xml_alert = (const char*) data; 236 const std::string* xml_alert = (std::string*)data;
237 LLAlertDialog* dialogp = gViewerWindow->alertXml(xml_alert); 237 LLAlertDialog* dialogp = gViewerWindow->alertXml(*xml_alert);
238 if (dialogp) 238 if (dialogp)
239 { 239 {
240 LLFloater* root_floater = gFloaterView->getParentFloater(self); 240 LLFloater* root_floater = gFloaterView->getParentFloater(self);
@@ -243,15 +243,15 @@ void LLFloaterWindLight::onClickHelp(void* data)
243 root_floater->addDependentFloater(dialogp); 243 root_floater->addDependentFloater(dialogp);
244 } 244 }
245 } 245 }
246 246 delete xml_alert;
247} 247}
248 248
249void LLFloaterWindLight::initHelpBtn(const char* name, const char* xml_alert) 249void LLFloaterWindLight::initHelpBtn(const std::string& name, const std::string& xml_alert)
250{ 250{
251 childSetAction(name, onClickHelp, (void*)xml_alert); 251 childSetAction(name, onClickHelp, new std::string(xml_alert));
252} 252}
253 253
254void LLFloaterWindLight::newPromptCallback(S32 option, const LLString& text, void* userData) 254void LLFloaterWindLight::newPromptCallback(S32 option, const std::string& text, void* userData)
255{ 255{
256 if(text == "") 256 if(text == "")
257 { 257 {
@@ -274,12 +274,12 @@ void LLFloaterWindLight::newPromptCallback(S32 option, const LLString& text, voi
274 // add the current parameters to the list 274 // add the current parameters to the list
275 // see if it's there first 275 // see if it's there first
276 std::map<std::string, LLWLParamSet>::iterator mIt = 276 std::map<std::string, LLWLParamSet>::iterator mIt =
277 LLWLParamManager::instance()->mParamList.find(text.c_str()); 277 LLWLParamManager::instance()->mParamList.find(text);
278 278
279 // if not there, add a new one 279 // if not there, add a new one
280 if(mIt == LLWLParamManager::instance()->mParamList.end()) 280 if(mIt == LLWLParamManager::instance()->mParamList.end())
281 { 281 {
282 LLWLParamManager::instance()->addParamSet(text.c_str(), 282 LLWLParamManager::instance()->addParamSet(text,
283 LLWLParamManager::instance()->mCurParams); 283 LLWLParamManager::instance()->mCurParams);
284 comboBox->add(text); 284 comboBox->add(text);
285 comboBox->sortByName(); 285 comboBox->sortByName();
@@ -290,7 +290,7 @@ void LLFloaterWindLight::newPromptCallback(S32 option, const LLString& text, voi
290 { 290 {
291 comboBox->remove(0); 291 comboBox->remove(0);
292 } 292 }
293 comboBox->add(""); 293 comboBox->add(LLStringUtil::null);
294 294
295 comboBox->setSelectedByValue(text, true); 295 comboBox->setSelectedByValue(text, true);
296 if(LLFloaterDayCycle::isOpen()) 296 if(LLFloaterDayCycle::isOpen())
@@ -319,7 +319,7 @@ void LLFloaterWindLight::syncMenu()
319 //std::map<std::string, LLVector4> & currentParams = param_mgr->mCurParams.mParamValues; 319 //std::map<std::string, LLVector4> & currentParams = param_mgr->mCurParams.mParamValues;
320 320
321 // blue horizon 321 // blue horizon
322 param_mgr->mBlueHorizon = currentParams.getVector(param_mgr->mBlueHorizon.name, err); 322 param_mgr->mBlueHorizon = currentParams.getVector(param_mgr->mBlueHorizon.mName, err);
323 childSetValue("WLBlueHorizonR", param_mgr->mBlueHorizon.r / 2.0); 323 childSetValue("WLBlueHorizonR", param_mgr->mBlueHorizon.r / 2.0);
324 childSetValue("WLBlueHorizonG", param_mgr->mBlueHorizon.g / 2.0); 324 childSetValue("WLBlueHorizonG", param_mgr->mBlueHorizon.g / 2.0);
325 childSetValue("WLBlueHorizonB", param_mgr->mBlueHorizon.b / 2.0); 325 childSetValue("WLBlueHorizonB", param_mgr->mBlueHorizon.b / 2.0);
@@ -329,18 +329,18 @@ void LLFloaterWindLight::syncMenu()
329 param_mgr->mBlueHorizon.b / 2.0))); 329 param_mgr->mBlueHorizon.b / 2.0)));
330 330
331 // haze density, horizon, mult, and altitude 331 // haze density, horizon, mult, and altitude
332 param_mgr->mHazeDensity = currentParams.getVector(param_mgr->mHazeDensity.name, err); 332 param_mgr->mHazeDensity = currentParams.getVector(param_mgr->mHazeDensity.mName, err);
333 childSetValue("WLHazeDensity", param_mgr->mHazeDensity.r); 333 childSetValue("WLHazeDensity", param_mgr->mHazeDensity.r);
334 param_mgr->mHazeHorizon = currentParams.getVector(param_mgr->mHazeHorizon.name, err); 334 param_mgr->mHazeHorizon = currentParams.getVector(param_mgr->mHazeHorizon.mName, err);
335 childSetValue("WLHazeHorizon", param_mgr->mHazeHorizon.r); 335 childSetValue("WLHazeHorizon", param_mgr->mHazeHorizon.r);
336 param_mgr->mDensityMult = currentParams.getVector(param_mgr->mDensityMult.name, err); 336 param_mgr->mDensityMult = currentParams.getVector(param_mgr->mDensityMult.mName, err);
337 childSetValue("WLDensityMult", param_mgr->mDensityMult.x * 337 childSetValue("WLDensityMult", param_mgr->mDensityMult.x *
338 param_mgr->mDensityMult.mult); 338 param_mgr->mDensityMult.mult);
339 param_mgr->mMaxAlt = currentParams.getVector(param_mgr->mMaxAlt.name, err); 339 param_mgr->mMaxAlt = currentParams.getVector(param_mgr->mMaxAlt.mName, err);
340 childSetValue("WLMaxAltitude", param_mgr->mMaxAlt.x); 340 childSetValue("WLMaxAltitude", param_mgr->mMaxAlt.x);
341 341
342 // blue density 342 // blue density
343 param_mgr->mBlueDensity = currentParams.getVector(param_mgr->mBlueDensity.name, err); 343 param_mgr->mBlueDensity = currentParams.getVector(param_mgr->mBlueDensity.mName, err);
344 childSetValue("WLBlueDensityR", param_mgr->mBlueDensity.r / 2.0); 344 childSetValue("WLBlueDensityR", param_mgr->mBlueDensity.r / 2.0);
345 childSetValue("WLBlueDensityG", param_mgr->mBlueDensity.g / 2.0); 345 childSetValue("WLBlueDensityG", param_mgr->mBlueDensity.g / 2.0);
346 childSetValue("WLBlueDensityB", param_mgr->mBlueDensity.b / 2.0); 346 childSetValue("WLBlueDensityB", param_mgr->mBlueDensity.b / 2.0);
@@ -351,7 +351,7 @@ void LLFloaterWindLight::syncMenu()
351 // Lighting 351 // Lighting
352 352
353 // sunlight 353 // sunlight
354 param_mgr->mSunlight = currentParams.getVector(param_mgr->mSunlight.name, err); 354 param_mgr->mSunlight = currentParams.getVector(param_mgr->mSunlight.mName, err);
355 childSetValue("WLSunlightR", param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE); 355 childSetValue("WLSunlightR", param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE);
356 childSetValue("WLSunlightG", param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE); 356 childSetValue("WLSunlightG", param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE);
357 childSetValue("WLSunlightB", param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE); 357 childSetValue("WLSunlightB", param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE);
@@ -360,12 +360,12 @@ void LLFloaterWindLight::syncMenu()
360 std::max(param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE, param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE))); 360 std::max(param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE, param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE)));
361 361
362 // glow 362 // glow
363 param_mgr->mGlow = currentParams.getVector(param_mgr->mGlow.name, err); 363 param_mgr->mGlow = currentParams.getVector(param_mgr->mGlow.mName, err);
364 childSetValue("WLGlowR", 2 - param_mgr->mGlow.r / 20.0f); 364 childSetValue("WLGlowR", 2 - param_mgr->mGlow.r / 20.0f);
365 childSetValue("WLGlowB", -param_mgr->mGlow.b / 5.0f); 365 childSetValue("WLGlowB", -param_mgr->mGlow.b / 5.0f);
366 366
367 // ambient 367 // ambient
368 param_mgr->mAmbient = currentParams.getVector(param_mgr->mAmbient.name, err); 368 param_mgr->mAmbient = currentParams.getVector(param_mgr->mAmbient.mName, err);
369 childSetValue("WLAmbientR", param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE); 369 childSetValue("WLAmbientR", param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE);
370 childSetValue("WLAmbientG", param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE); 370 childSetValue("WLAmbientG", param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE);
371 childSetValue("WLAmbientB", param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE); 371 childSetValue("WLAmbientB", param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE);
@@ -379,7 +379,7 @@ void LLFloaterWindLight::syncMenu()
379 // Clouds 379 // Clouds
380 380
381 // Cloud Color 381 // Cloud Color
382 param_mgr->mCloudColor = currentParams.getVector(param_mgr->mCloudColor.name, err); 382 param_mgr->mCloudColor = currentParams.getVector(param_mgr->mCloudColor.mName, err);
383 childSetValue("WLCloudColorR", param_mgr->mCloudColor.r); 383 childSetValue("WLCloudColorR", param_mgr->mCloudColor.r);
384 childSetValue("WLCloudColorG", param_mgr->mCloudColor.g); 384 childSetValue("WLCloudColorG", param_mgr->mCloudColor.g);
385 childSetValue("WLCloudColorB", param_mgr->mCloudColor.b); 385 childSetValue("WLCloudColorB", param_mgr->mCloudColor.b);
@@ -388,20 +388,20 @@ void LLFloaterWindLight::syncMenu()
388 std::max(param_mgr->mCloudColor.g, param_mgr->mCloudColor.b))); 388 std::max(param_mgr->mCloudColor.g, param_mgr->mCloudColor.b)));
389 389
390 // Cloud 390 // Cloud
391 param_mgr->mCloudMain = currentParams.getVector(param_mgr->mCloudMain.name, err); 391 param_mgr->mCloudMain = currentParams.getVector(param_mgr->mCloudMain.mName, err);
392 childSetValue("WLCloudX", param_mgr->mCloudMain.r); 392 childSetValue("WLCloudX", param_mgr->mCloudMain.r);
393 childSetValue("WLCloudY", param_mgr->mCloudMain.g); 393 childSetValue("WLCloudY", param_mgr->mCloudMain.g);
394 childSetValue("WLCloudDensity", param_mgr->mCloudMain.b); 394 childSetValue("WLCloudDensity", param_mgr->mCloudMain.b);
395 395
396 // Cloud Detail 396 // Cloud Detail
397 param_mgr->mCloudDetail = currentParams.getVector(param_mgr->mCloudDetail.name, err); 397 param_mgr->mCloudDetail = currentParams.getVector(param_mgr->mCloudDetail.mName, err);
398 childSetValue("WLCloudDetailX", param_mgr->mCloudDetail.r); 398 childSetValue("WLCloudDetailX", param_mgr->mCloudDetail.r);
399 childSetValue("WLCloudDetailY", param_mgr->mCloudDetail.g); 399 childSetValue("WLCloudDetailY", param_mgr->mCloudDetail.g);
400 childSetValue("WLCloudDetailDensity", param_mgr->mCloudDetail.b); 400 childSetValue("WLCloudDetailDensity", param_mgr->mCloudDetail.b);
401 401
402 // Cloud extras 402 // Cloud extras
403 param_mgr->mCloudCoverage = currentParams.getVector(param_mgr->mCloudCoverage.name, err); 403 param_mgr->mCloudCoverage = currentParams.getVector(param_mgr->mCloudCoverage.mName, err);
404 param_mgr->mCloudScale = currentParams.getVector(param_mgr->mCloudScale.name, err); 404 param_mgr->mCloudScale = currentParams.getVector(param_mgr->mCloudScale.mName, err);
405 childSetValue("WLCloudCoverage", param_mgr->mCloudCoverage.x); 405 childSetValue("WLCloudCoverage", param_mgr->mCloudCoverage.x);
406 childSetValue("WLCloudScale", param_mgr->mCloudScale.x); 406 childSetValue("WLCloudScale", param_mgr->mCloudScale.x);
407 407
@@ -430,12 +430,12 @@ void LLFloaterWindLight::syncMenu()
430 childSetValue("WLCloudScrollX", param_mgr->mCurParams.getCloudScrollX() - 10.0f); 430 childSetValue("WLCloudScrollX", param_mgr->mCurParams.getCloudScrollX() - 10.0f);
431 childSetValue("WLCloudScrollY", param_mgr->mCurParams.getCloudScrollY() - 10.0f); 431 childSetValue("WLCloudScrollY", param_mgr->mCurParams.getCloudScrollY() - 10.0f);
432 432
433 param_mgr->mDistanceMult = currentParams.getVector(param_mgr->mDistanceMult.name, err); 433 param_mgr->mDistanceMult = currentParams.getVector(param_mgr->mDistanceMult.mName, err);
434 childSetValue("WLDistanceMult", param_mgr->mDistanceMult.x); 434 childSetValue("WLDistanceMult", param_mgr->mDistanceMult.x);
435 435
436 // Tweak extras 436 // Tweak extras
437 437
438 param_mgr->mWLGamma = currentParams.getVector(param_mgr->mWLGamma.name, err); 438 param_mgr->mWLGamma = currentParams.getVector(param_mgr->mWLGamma.mName, err);
439 childSetValue("WLGamma", param_mgr->mWLGamma.x); 439 childSetValue("WLGamma", param_mgr->mWLGamma.x);
440 440
441 childSetValue("WLStarAlpha", param_mgr->mCurParams.getStarBrightness()); 441 childSetValue("WLStarAlpha", param_mgr->mCurParams.getStarBrightness());
@@ -653,24 +653,24 @@ void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData)
653 // divide sun color vals by three 653 // divide sun color vals by three
654 if(colorControl->isSunOrAmbientColor) 654 if(colorControl->isSunOrAmbientColor)
655 { 655 {
656 sWindLight->childSetValue(rName.c_str(), colorControl->r/3); 656 sWindLight->childSetValue(rName, colorControl->r/3);
657 sWindLight->childSetValue(gName.c_str(), colorControl->g/3); 657 sWindLight->childSetValue(gName, colorControl->g/3);
658 sWindLight->childSetValue(bName.c_str(), colorControl->b/3); 658 sWindLight->childSetValue(bName, colorControl->b/3);
659 659
660 } 660 }
661 else if(colorControl->isBlueHorizonOrDensity) 661 else if(colorControl->isBlueHorizonOrDensity)
662 { 662 {
663 sWindLight->childSetValue(rName.c_str(), colorControl->r/2); 663 sWindLight->childSetValue(rName, colorControl->r/2);
664 sWindLight->childSetValue(gName.c_str(), colorControl->g/2); 664 sWindLight->childSetValue(gName, colorControl->g/2);
665 sWindLight->childSetValue(bName.c_str(), colorControl->b/2); 665 sWindLight->childSetValue(bName, colorControl->b/2);
666 666
667 } 667 }
668 else 668 else
669 { 669 {
670 // set the sliders to the new vals 670 // set the sliders to the new vals
671 sWindLight->childSetValue(rName.c_str(), colorControl->r); 671 sWindLight->childSetValue(rName, colorControl->r);
672 sWindLight->childSetValue(gName.c_str(), colorControl->g); 672 sWindLight->childSetValue(gName, colorControl->g);
673 sWindLight->childSetValue(bName.c_str(), colorControl->b); 673 sWindLight->childSetValue(bName, colorControl->b);
674 } 674 }
675 } 675 }
676 676
@@ -785,7 +785,7 @@ void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl, void* userData)
785 785
786void LLFloaterWindLight::onNewPreset(void* userData) 786void LLFloaterWindLight::onNewPreset(void* userData)
787{ 787{
788 gViewerWindow->alertXmlEditText("NewSkyPreset", LLString::format_map_t(), 788 gViewerWindow->alertXmlEditText("NewSkyPreset", LLStringUtil::format_map_t(),
789 NULL, NULL, newPromptCallback, NULL); 789 NULL, NULL, newPromptCallback, NULL);
790} 790}
791 791
@@ -803,7 +803,7 @@ void LLFloaterWindLight::onSavePreset(void* userData)
803 803
804 // check to see if it's a default and shouldn't be overwritten 804 // check to see if it's a default and shouldn't be overwritten
805 std::set<std::string>::iterator sIt = sDefaultPresets.find( 805 std::set<std::string>::iterator sIt = sDefaultPresets.find(
806 comboBox->getSelectedItemLabel().c_str()); 806 comboBox->getSelectedItemLabel());
807 if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("SkyEditPresets")) 807 if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("SkyEditPresets"))
808 { 808 {
809 gViewerWindow->alertXml("WLNoEditDefault"); 809 gViewerWindow->alertXml("WLNoEditDefault");
@@ -841,7 +841,7 @@ void LLFloaterWindLight::onDeletePreset(void* userData)
841 return; 841 return;
842 } 842 }
843 843
844 LLString::format_map_t args; 844 LLStringUtil::format_map_t args;
845 args["[SKY]"] = combo_box->getSelectedValue().asString(); 845 args["[SKY]"] = combo_box->getSelectedValue().asString();
846 gViewerWindow->alertXml("WLDeletePresetAlert", args, deleteAlertCallback, sWindLight); 846 gViewerWindow->alertXml("WLDeletePresetAlert", args, deleteAlertCallback, sWindLight);
847} 847}
@@ -865,10 +865,10 @@ void LLFloaterWindLight::deleteAlertCallback(S32 option, void* userdata)
865 mult_sldr = day_cycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); 865 mult_sldr = day_cycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
866 } 866 }
867 867
868 LLString name(combo_box->getSelectedValue().asString()); 868 std::string name(combo_box->getSelectedValue().asString());
869 869
870 // check to see if it's a default and shouldn't be deleted 870 // check to see if it's a default and shouldn't be deleted
871 std::set<std::string>::iterator sIt = sDefaultPresets.find(name.c_str()); 871 std::set<std::string>::iterator sIt = sDefaultPresets.find(name);
872 if(sIt != sDefaultPresets.end()) 872 if(sIt != sDefaultPresets.end())
873 { 873 {
874 gViewerWindow->alertXml("WLNoEditDefault"); 874 gViewerWindow->alertXml("WLNoEditDefault");