diff options
Diffstat (limited to 'linden/indra/newview/llfloaterdaycycle.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterdaycycle.cpp | 92 |
1 files changed, 38 insertions, 54 deletions
diff --git a/linden/indra/newview/llfloaterdaycycle.cpp b/linden/indra/newview/llfloaterdaycycle.cpp index 29e4c37..f517439 100644 --- a/linden/indra/newview/llfloaterdaycycle.cpp +++ b/linden/indra/newview/llfloaterdaycycle.cpp | |||
@@ -41,7 +41,7 @@ | |||
41 | #include "llmultisliderctrl.h" | 41 | #include "llmultisliderctrl.h" |
42 | #include "llspinctrl.h" | 42 | #include "llspinctrl.h" |
43 | #include "llcheckboxctrl.h" | 43 | #include "llcheckboxctrl.h" |
44 | #include "llvieweruictrlfactory.h" | 44 | #include "lluictrlfactory.h" |
45 | #include "llviewercamera.h" | 45 | #include "llviewercamera.h" |
46 | #include "llcombobox.h" | 46 | #include "llcombobox.h" |
47 | #include "lllineeditor.h" | 47 | #include "lllineeditor.h" |
@@ -64,10 +64,10 @@ const F32 LLFloaterDayCycle::sHoursPerDay = 24.0f; | |||
64 | 64 | ||
65 | LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater("Day Cycle Floater") | 65 | LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater("Day Cycle Floater") |
66 | { | 66 | { |
67 | gUICtrlFactory->buildFloater(this, "floater_day_cycle_options.xml"); | 67 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml"); |
68 | 68 | ||
69 | // add the combo boxes | 69 | // add the combo boxes |
70 | LLComboBox* keyCombo = LLUICtrlFactory::getComboBoxByName(this, "WLKeyPresets"); | 70 | LLComboBox* keyCombo = getChild<LLComboBox>("WLKeyPresets"); |
71 | 71 | ||
72 | if(keyCombo != NULL) | 72 | if(keyCombo != NULL) |
73 | { | 73 | { |
@@ -83,8 +83,7 @@ LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater("Day Cycle Floater") | |||
83 | } | 83 | } |
84 | 84 | ||
85 | // add the time slider | 85 | // add the time slider |
86 | LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName(this, | 86 | LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLTimeSlider"); |
87 | "WLTimeSlider"); | ||
88 | 87 | ||
89 | sldr->addSlider(); | 88 | sldr->addSlider(); |
90 | 89 | ||
@@ -148,16 +147,12 @@ void LLFloaterDayCycle::syncMenu() | |||
148 | // std::map<std::string, LLVector4> & currentParams = LLWLParamManager::instance()->mCurParams.mParamValues; | 147 | // std::map<std::string, LLVector4> & currentParams = LLWLParamManager::instance()->mCurParams.mParamValues; |
149 | 148 | ||
150 | // set time | 149 | // set time |
151 | LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName(LLFloaterDayCycle::sDayCycle, | 150 | LLMultiSliderCtrl* sldr = LLFloaterDayCycle::sDayCycle->getChild<LLMultiSliderCtrl>("WLTimeSlider"); |
152 | "WLTimeSlider"); | ||
153 | sldr->setCurSliderValue((F32)LLWLParamManager::instance()->mAnimator.getDayTime() * sHoursPerDay); | 151 | sldr->setCurSliderValue((F32)LLWLParamManager::instance()->mAnimator.getDayTime() * sHoursPerDay); |
154 | 152 | ||
155 | LLSpinCtrl* secSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, | 153 | LLSpinCtrl* secSpin = sDayCycle->getChild<LLSpinCtrl>("WLLengthOfDaySec"); |
156 | "WLLengthOfDaySec"); | 154 | LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLLengthOfDayMin"); |
157 | LLSpinCtrl* minSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, | 155 | LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLLengthOfDayHour"); |
158 | "WLLengthOfDayMin"); | ||
159 | LLSpinCtrl* hourSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, | ||
160 | "WLLengthOfDayHour"); | ||
161 | 156 | ||
162 | F32 curRate; | 157 | F32 curRate; |
163 | F32 hours, min, sec; | 158 | F32 hours, min, sec; |
@@ -188,8 +183,7 @@ void LLFloaterDayCycle::syncMenu() | |||
188 | void LLFloaterDayCycle::syncSliderTrack() | 183 | void LLFloaterDayCycle::syncSliderTrack() |
189 | { | 184 | { |
190 | // clear the slider | 185 | // clear the slider |
191 | LLMultiSliderCtrl* kSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, | 186 | LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); |
192 | "WLDayCycleKeys"); | ||
193 | 187 | ||
194 | kSldr->clear(); | 188 | kSldr->clear(); |
195 | sSliderToKey.clear(); | 189 | sSliderToKey.clear(); |
@@ -212,12 +206,12 @@ void LLFloaterDayCycle::syncTrack() | |||
212 | } | 206 | } |
213 | 207 | ||
214 | LLMultiSliderCtrl* sldr; | 208 | LLMultiSliderCtrl* sldr; |
215 | sldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, | 209 | sldr = sDayCycle->getChild<LLMultiSliderCtrl>( |
216 | "WLDayCycleKeys"); | 210 | "WLDayCycleKeys"); |
217 | llassert_always(sSliderToKey.size() == sldr->getValue().size()); | 211 | llassert_always(sSliderToKey.size() == sldr->getValue().size()); |
218 | 212 | ||
219 | LLMultiSliderCtrl* tSldr; | 213 | LLMultiSliderCtrl* tSldr; |
220 | tSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, | 214 | tSldr = sDayCycle->getChild<LLMultiSliderCtrl>( |
221 | "WLTimeSlider"); | 215 | "WLTimeSlider"); |
222 | 216 | ||
223 | // create a new animation track | 217 | // create a new animation track |
@@ -267,7 +261,7 @@ void LLFloaterDayCycle::show() | |||
267 | syncSliderTrack(); | 261 | syncSliderTrack(); |
268 | 262 | ||
269 | // comment in if you want the menu to rebuild each time | 263 | // comment in if you want the menu to rebuild each time |
270 | //gUICtrlFactory->buildFloater(dayCycle, "floater_day_cycle_options.xml"); | 264 | //LLUICtrlFactory::getInstance()->buildFloater(dayCycle, "floater_day_cycle_options.xml"); |
271 | //dayCycle->initCallbacks(); | 265 | //dayCycle->initCallbacks(); |
272 | 266 | ||
273 | dayCycle->open(); | 267 | dayCycle->open(); |
@@ -291,13 +285,11 @@ void LLFloaterDayCycle::onRunAnimSky(void* userData) | |||
291 | } | 285 | } |
292 | 286 | ||
293 | LLMultiSliderCtrl* sldr; | 287 | LLMultiSliderCtrl* sldr; |
294 | sldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, | 288 | sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); |
295 | "WLDayCycleKeys"); | ||
296 | llassert_always(sSliderToKey.size() == sldr->getValue().size()); | 289 | llassert_always(sSliderToKey.size() == sldr->getValue().size()); |
297 | 290 | ||
298 | LLMultiSliderCtrl* tSldr; | 291 | LLMultiSliderCtrl* tSldr; |
299 | tSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, | 292 | tSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLTimeSlider"); |
300 | "WLTimeSlider"); | ||
301 | 293 | ||
302 | // turn off linden time | 294 | // turn off linden time |
303 | LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; | 295 | LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; |
@@ -324,7 +316,7 @@ void LLFloaterDayCycle::onStopAnimSky(void* userData) | |||
324 | void LLFloaterDayCycle::onUseLindenTime(void* userData) | 316 | void LLFloaterDayCycle::onUseLindenTime(void* userData) |
325 | { | 317 | { |
326 | LLFloaterWindLight* wl = LLFloaterWindLight::instance(); | 318 | LLFloaterWindLight* wl = LLFloaterWindLight::instance(); |
327 | LLComboBox* box = LLUICtrlFactory::getComboBoxByName(wl, "WLPresetsCombo"); | 319 | LLComboBox* box = wl->getChild<LLComboBox>("WLPresetsCombo"); |
328 | box->selectByValue(""); | 320 | box->selectByValue(""); |
329 | 321 | ||
330 | LLWLParamManager::instance()->mAnimator.mIsRunning = true; | 322 | LLWLParamManager::instance()->mAnimator.mIsRunning = true; |
@@ -341,7 +333,7 @@ void LLFloaterDayCycle::onLoadDayCycle(void* userData) | |||
341 | 333 | ||
342 | // set the param manager's track to the new one | 334 | // set the param manager's track to the new one |
343 | LLMultiSliderCtrl* tSldr; | 335 | LLMultiSliderCtrl* tSldr; |
344 | tSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, | 336 | tSldr = sDayCycle->getChild<LLMultiSliderCtrl>( |
345 | "WLTimeSlider"); | 337 | "WLTimeSlider"); |
346 | LLWLParamManager::instance()->resetAnimator( | 338 | LLWLParamManager::instance()->resetAnimator( |
347 | tSldr->getCurSliderValue() / sHoursPerDay, false); | 339 | tSldr->getCurSliderValue() / sHoursPerDay, false); |
@@ -359,7 +351,7 @@ void LLFloaterDayCycle::onSaveDayCycle(void* userData) | |||
359 | 351 | ||
360 | void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData) | 352 | void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData) |
361 | { | 353 | { |
362 | LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, | 354 | LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>( |
363 | "WLTimeSlider"); | 355 | "WLTimeSlider"); |
364 | 356 | ||
365 | /// get the slider value | 357 | /// get the slider value |
@@ -377,14 +369,10 @@ void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData) | |||
377 | 369 | ||
378 | void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData) | 370 | void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData) |
379 | { | 371 | { |
380 | LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(sDayCycle, | 372 | LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>("WLKeyPresets"); |
381 | "WLKeyPresets"); | 373 | LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); |
382 | LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, | 374 | LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyHour"); |
383 | "WLDayCycleKeys"); | 375 | LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyMin"); |
384 | LLSpinCtrl* hourSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, | ||
385 | "WLCurKeyHour"); | ||
386 | LLSpinCtrl* minSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, | ||
387 | "WLCurKeyMin"); | ||
388 | 376 | ||
389 | if(sldr->getValue().size() == 0) { | 377 | if(sldr->getValue().size() == 0) { |
390 | return; | 378 | return; |
@@ -429,11 +417,11 @@ void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData) | |||
429 | return; | 417 | return; |
430 | } | 418 | } |
431 | 419 | ||
432 | LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, | 420 | LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>( |
433 | "WLDayCycleKeys"); | 421 | "WLDayCycleKeys"); |
434 | LLSpinCtrl* hourSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, | 422 | LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>( |
435 | "WLCurKeyHour"); | 423 | "WLCurKeyHour"); |
436 | LLSpinCtrl* minSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, | 424 | LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>( |
437 | "WLCurKeyMin"); | 425 | "WLCurKeyMin"); |
438 | 426 | ||
439 | F32 hour = hourSpin->get(); | 427 | F32 hour = hourSpin->get(); |
@@ -454,9 +442,9 @@ void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData) | |||
454 | void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData) | 442 | void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData) |
455 | { | 443 | { |
456 | // get the time | 444 | // get the time |
457 | LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(sDayCycle, | 445 | LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>( |
458 | "WLKeyPresets"); | 446 | "WLKeyPresets"); |
459 | LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, | 447 | LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>( |
460 | "WLDayCycleKeys"); | 448 | "WLDayCycleKeys"); |
461 | 449 | ||
462 | // do nothing if no sliders | 450 | // do nothing if no sliders |
@@ -481,13 +469,13 @@ void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData) | |||
481 | void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl, void* userData) | 469 | void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl, void* userData) |
482 | { | 470 | { |
483 | // get the time | 471 | // get the time |
484 | LLSpinCtrl* secSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, | 472 | LLSpinCtrl* secSpin = sDayCycle->getChild<LLSpinCtrl>( |
485 | "WLLengthOfDaySec"); | 473 | "WLLengthOfDaySec"); |
486 | 474 | ||
487 | LLSpinCtrl* minSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, | 475 | LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>( |
488 | "WLLengthOfDayMin"); | 476 | "WLLengthOfDayMin"); |
489 | 477 | ||
490 | LLSpinCtrl* hourSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, | 478 | LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>( |
491 | "WLLengthOfDayHour"); | 479 | "WLLengthOfDayHour"); |
492 | 480 | ||
493 | F32 hour; | 481 | F32 hour; |
@@ -508,11 +496,11 @@ void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl, void* userData) | |||
508 | 496 | ||
509 | void LLFloaterDayCycle::onAddKey(void* userData) | 497 | void LLFloaterDayCycle::onAddKey(void* userData) |
510 | { | 498 | { |
511 | LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(sDayCycle, | 499 | LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>( |
512 | "WLKeyPresets"); | 500 | "WLKeyPresets"); |
513 | LLMultiSliderCtrl* kSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, | 501 | LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>( |
514 | "WLDayCycleKeys"); | 502 | "WLDayCycleKeys"); |
515 | LLMultiSliderCtrl* tSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, | 503 | LLMultiSliderCtrl* tSldr = sDayCycle->getChild<LLMultiSliderCtrl>( |
516 | "WLTimeSlider"); | 504 | "WLTimeSlider"); |
517 | 505 | ||
518 | llassert_always(sSliderToKey.size() == kSldr->getValue().size()); | 506 | llassert_always(sSliderToKey.size() == kSldr->getValue().size()); |
@@ -528,7 +516,7 @@ void LLFloaterDayCycle::onAddKey(void* userData) | |||
528 | 516 | ||
529 | void LLFloaterDayCycle::addSliderKey(F32 time, const LLString & presetName) | 517 | void LLFloaterDayCycle::addSliderKey(F32 time, const LLString & presetName) |
530 | { | 518 | { |
531 | LLMultiSliderCtrl* kSldr = LLUICtrlFactory::getMultiSliderByName(sDayCycle, | 519 | LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>( |
532 | "WLDayCycleKeys"); | 520 | "WLDayCycleKeys"); |
533 | 521 | ||
534 | // make a slider | 522 | // make a slider |
@@ -553,8 +541,7 @@ void LLFloaterDayCycle::addSliderKey(F32 time, const LLString & presetName) | |||
553 | 541 | ||
554 | void LLFloaterDayCycle::deletePreset(LLString& presetName) | 542 | void LLFloaterDayCycle::deletePreset(LLString& presetName) |
555 | { | 543 | { |
556 | LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName( | 544 | LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); |
557 | sDayCycle, "WLDayCycleKeys"); | ||
558 | 545 | ||
559 | /// delete any reference | 546 | /// delete any reference |
560 | std::map<LLString, LLWLSkyKey>::iterator curr_preset, next_preset; | 547 | std::map<LLString, LLWLSkyKey>::iterator curr_preset, next_preset; |
@@ -576,10 +563,9 @@ void LLFloaterDayCycle::onDeleteKey(void* userData) | |||
576 | return; | 563 | return; |
577 | } | 564 | } |
578 | 565 | ||
579 | LLComboBox* comboBox = LLUICtrlFactory::getComboBoxByName(sDayCycle, | 566 | LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>( |
580 | "WLKeyPresets"); | 567 | "WLKeyPresets"); |
581 | LLMultiSliderCtrl* sldr = LLUICtrlFactory::getMultiSliderByName( | 568 | LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); |
582 | sDayCycle, "WLDayCycleKeys"); | ||
583 | 569 | ||
584 | // delete from map | 570 | // delete from map |
585 | const LLString& sldrName = sldr->getCurSlider(); | 571 | const LLString& sldrName = sldr->getCurSlider(); |
@@ -596,10 +582,8 @@ void LLFloaterDayCycle::onDeleteKey(void* userData) | |||
596 | comboBox->selectByValue(sSliderToKey[name].presetName); | 582 | comboBox->selectByValue(sSliderToKey[name].presetName); |
597 | F32 time = sSliderToKey[name].time; | 583 | F32 time = sSliderToKey[name].time; |
598 | 584 | ||
599 | LLSpinCtrl* hourSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, | 585 | LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyHour"); |
600 | "WLCurKeyHour"); | 586 | LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyMin"); |
601 | LLSpinCtrl* minSpin = LLUICtrlFactory::getSpinnerByName(sDayCycle, | ||
602 | "WLCurKeyMin"); | ||
603 | 587 | ||
604 | // now set the spinners | 588 | // now set the spinners |
605 | F32 hour = (F32)((S32)time); | 589 | F32 hour = (F32)((S32)time); |