diff options
author | McCabe Maxsted | 2009-09-10 21:43:11 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-09-10 21:43:11 -0700 |
commit | f332eaa4a69a4546e0b9b2ba3719e3c038731fd3 (patch) | |
tree | 69a2c79196b7a7cffa49b861329e65b2c5ba7ddf /linden/indra/newview/llwlparammanager.cpp | |
parent | Admin options now only show for other people's profiles (diff) | |
download | meta-impy-f332eaa4a69a4546e0b9b2ba3719e3c038731fd3.zip meta-impy-f332eaa4a69a4546e0b9b2ba3719e3c038731fd3.tar.gz meta-impy-f332eaa4a69a4546e0b9b2ba3719e3c038731fd3.tar.bz2 meta-impy-f332eaa4a69a4546e0b9b2ba3719e3c038731fd3.tar.xz |
Created new toolbar control for windlight presets and options
Diffstat (limited to 'linden/indra/newview/llwlparammanager.cpp')
-rw-r--r-- | linden/indra/newview/llwlparammanager.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
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 | ||
64 | LLWLParamManager * LLWLParamManager::sInstance = NULL; | 64 | LLWLParamManager * LLWLParamManager::sInstance = NULL; |
65 | std::vector<LLWLPresetsObserver*> LLWLParamManager::sObservers; | ||
65 | 66 | ||
66 | LLWLParamManager::LLWLParamManager() : | 67 | LLWLParamManager::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 | ||
243 | void LLWLParamManager::savePreset(const std::string & name) | 246 | void 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 | ||
269 | void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader) | 273 | void 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 | ||
577 | void LLWLParamManager::addObserver(LLWLPresetsObserver* observer) | ||
578 | { | ||
579 | sObservers.push_back(observer); | ||
580 | } | ||
581 | |||
582 | // static | ||
583 | void 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 | ||
596 | void 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 | } | ||