summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-06-07 18:48:04 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-06-07 18:48:04 +0300
commitf39b7cffc6d75a231d00c5bb17e450f21fe36ae0 (patch)
tree798cd367434bee130bdac24b963d745ebcaa4642 /indra
parentb68a4fdcd7f4f2f8599e9336714d2d0a2b8fd259 (diff)
STORM-1255 WIP When region environment changes, update the Edit Sky floater.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatereditsky.cpp51
-rw-r--r--indra/newview/llfloatereditsky.h2
2 files changed, 41 insertions, 12 deletions
diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp
index da3f684ba2..a35b7cb003 100644
--- a/indra/newview/llfloatereditsky.cpp
+++ b/indra/newview/llfloatereditsky.cpp
@@ -88,18 +88,7 @@ void LLFloaterEditSky::onOpen(const LLSD& key)
mSkyPresetCombo->setVisible(!new_preset);
mSkyPresetNameEditor->setVisible(new_preset);
- if (isNewPreset())
- {
- mSkyPresetNameEditor->setValue(LLSD());
- mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name
- }
- else
- {
- refreshSkyPresetsList();
-
- // Disable controls until a sky preset to edit is selected.
- enableEditing(false);
- }
+ reset();
}
// virtual
@@ -129,6 +118,7 @@ void LLFloaterEditSky::initCallbacks(void)
mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnSave, this));
getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnCancel, this));
+ LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLFloaterEditSky::onRegionSettingsChange, this));
LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEditSky::onSkyPresetListChange, this));
//-------------------------------------------------------------------------
@@ -712,6 +702,22 @@ void LLFloaterEditSky::onCloudScrollYToggled(LLUICtrl* ctrl)
//=================================================================================================
+void LLFloaterEditSky::reset()
+{
+ if (isNewPreset())
+ {
+ mSkyPresetNameEditor->setValue(LLSD());
+ mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name
+ }
+ else
+ {
+ refreshSkyPresetsList();
+
+ // Disable controls until a sky preset to edit is selected.
+ enableEditing(false);
+ }
+}
+
bool LLFloaterEditSky::isNewPreset() const
{
return mKey.asString() == "new";
@@ -922,3 +928,24 @@ void LLFloaterEditSky::onSkyPresetListChange()
refreshSkyPresetsList();
}
}
+
+void LLFloaterEditSky::onRegionSettingsChange()
+{
+ // If creating a new sky, don't bother.
+ if (isNewPreset())
+ {
+ return;
+ }
+
+ if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION) // if editing a region sky
+ {
+ // reset the floater to its initial state
+ reset();
+
+ // *TODO: Notify user?
+ }
+ else // editing a local sky
+ {
+ refreshSkyPresetsList();
+ }
+}
diff --git a/indra/newview/llfloatereditsky.h b/indra/newview/llfloatereditsky.h
index 89e7719270..85b4b250d5 100644
--- a/indra/newview/llfloatereditsky.h
+++ b/indra/newview/llfloatereditsky.h
@@ -82,6 +82,7 @@ private:
//-- WL stuff ends --------------------------------------------------------
+ void reset(); /// reset the floater to its initial state
bool isNewPreset() const;
void refreshSkyPresetsList();
void enableEditing(bool enable);
@@ -97,6 +98,7 @@ private:
void onBtnCancel();
void onSkyPresetListChange();
+ void onRegionSettingsChange();
LLLineEditor* mSkyPresetNameEditor;
LLComboBox* mSkyPresetCombo;