summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-05-26 23:06:41 +0300
committerVadim ProductEngine <vsavchuk@productengine.com>2011-05-26 23:06:41 +0300
commitebfbf2a561a98e5af4dde319edb49a663e27de26 (patch)
treead532b6d84ed227d4595d511591a61dad1b15ed0 /indra
parent4f8098344e45aac1c177ba258e866c32d5287565 (diff)
STORM-1285 WIP Connected "Delete Water / Sky / Day Cycle" floaters (not functional) to the main menu.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/llfloaterdeleteenvpreset.cpp139
-rw-r--r--indra/newview/llfloaterdeleteenvpreset.h55
-rw-r--r--indra/newview/llfloaterenvironmentsettings.cpp1
-rw-r--r--indra/newview/llviewerfloaterreg.cpp2
-rw-r--r--indra/newview/llviewermenu.cpp46
-rw-r--r--indra/newview/skins/default/xui/en/floater_delete_env_preset.xml19
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml36
8 files changed, 277 insertions, 23 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index b87f3bf3d4..097151d058 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -174,6 +174,7 @@ set(viewer_SOURCE_FILES
llfloatercamera.cpp
llfloatercolorpicker.cpp
llfloaterdaycycle.cpp
+ llfloaterdeleteenvpreset.cpp
llfloaterdisplayname.cpp
llfloaterenvsettings.cpp
llfloaterenvironmentsettings.cpp
@@ -723,6 +724,7 @@ set(viewer_HEADER_FILES
llfloatercamera.h
llfloatercolorpicker.h
llfloaterdaycycle.h
+ llfloaterdeleteenvpreset.h
llfloaterdisplayname.h
llfloaterenvsettings.h
llfloaterenvironmentsettings.h
diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp
new file mode 100644
index 0000000000..e014eedeb1
--- /dev/null
+++ b/indra/newview/llfloaterdeleteenvpreset.cpp
@@ -0,0 +1,139 @@
+/**
+ * @file llfloaterdeleteenvpreset.cpp
+ * @brief Floater to delete a water / sky / day cycle preset.
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloaterdeleteenvpreset.h"
+
+// libs
+#include "llbutton.h"
+#include "llcombobox.h"
+
+// newview
+#include "lldaycyclemanager.h"
+#include "llwaterparammanager.h"
+
+LLFloaterDeleteEnvPreset::LLFloaterDeleteEnvPreset(const LLSD &key)
+: LLFloater(key)
+, mPresetCombo(NULL)
+{
+}
+
+// virtual
+BOOL LLFloaterDeleteEnvPreset::postBuild()
+{
+ mPresetCombo = getChild<LLComboBox>("preset_combo");
+
+ getChild<LLButton>("delete")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnDelete, this));
+ getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterDeleteEnvPreset::onBtnCancel, this));
+
+ // Deletion is not implemented yet, so disable the button for now.
+ getChild<LLButton>("delete")->setEnabled(FALSE);
+
+ return TRUE;
+}
+
+// virtual
+void LLFloaterDeleteEnvPreset::onOpen(const LLSD& key)
+{
+ std::string param = key.asString();
+ std::string floater_title = getString(std::string("title_") + param);
+ std::string combo_label = getString(std::string("label_" + param));
+
+ // Update floater title.
+ setTitle(floater_title);
+
+ // Update the combobox label.
+ getChild<LLUICtrl>("label")->setValue(combo_label);
+
+ // Populate the combobox.
+ mPresetCombo->removeall();
+ if (param == "water")
+ {
+ populateWaterPresetsList();
+ }
+ else if (param == "sky")
+ {
+ populateSkyPresetsList();
+ }
+ else if (param == "day_cycle")
+ {
+ populateDayCyclesList();
+ }
+ else
+ {
+ llwarns << "Unrecognized key" << llendl;
+ }
+}
+
+void LLFloaterDeleteEnvPreset::onBtnDelete()
+{
+ closeFloater();
+}
+
+void LLFloaterDeleteEnvPreset::onBtnCancel()
+{
+ closeFloater();
+}
+
+void LLFloaterDeleteEnvPreset::populateWaterPresetsList()
+{
+ // *TODO: Reload the list when user preferences change.
+ LLWaterParamManager& water_mgr = LLWaterParamManager::instance();
+ LL_DEBUGS("Windlight") << "Current water preset: " << water_mgr.mCurParams.mName << LL_ENDL;
+
+ const std::map<std::string, LLWaterParamSet> &water_params_map = water_mgr.mParamList;
+ for (std::map<std::string, LLWaterParamSet>::const_iterator it = water_params_map.begin(); it != water_params_map.end(); it++)
+ {
+ std::string name = it->first;
+ bool enabled = (name != water_mgr.mCurParams.mName); // don't allow deleting current preset
+ mPresetCombo->add(name, ADD_BOTTOM, enabled);
+ }
+}
+
+void LLFloaterDeleteEnvPreset::populateSkyPresetsList()
+{
+ LLWLParamManager& sky_mgr = LLWLParamManager::instance();
+ LL_DEBUGS("Windlight") << "Current sky preset: " << sky_mgr.mCurParams.mName << LL_ENDL;
+
+ const std::map<LLWLParamKey, LLWLParamSet> &sky_params_map = sky_mgr.mParamList;
+ for (std::map<LLWLParamKey, LLWLParamSet>::const_iterator it = sky_params_map.begin(); it != sky_params_map.end(); it++)
+ {
+ if (it->first.scope == LLEnvKey::SCOPE_REGION) continue; // list only local presets
+ bool enabled = (it->first.name != sky_mgr.mCurParams.mName);
+ mPresetCombo->add(it->first.name, ADD_BOTTOM, enabled);
+ }
+}
+
+void LLFloaterDeleteEnvPreset::populateDayCyclesList()
+{
+ // *TODO: Disable current day cycle.
+ const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets();
+ for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it)
+ {
+ mPresetCombo->add(it->first);
+ }
+}
diff --git a/indra/newview/llfloaterdeleteenvpreset.h b/indra/newview/llfloaterdeleteenvpreset.h
new file mode 100644
index 0000000000..08fd11a16d
--- /dev/null
+++ b/indra/newview/llfloaterdeleteenvpreset.h
@@ -0,0 +1,55 @@
+/**
+ * @file llfloaterdeleteenvpreset.h
+ * @brief Floater to delete a water / sky / day cycle preset.
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLFLOATERDELETEENVPRESET_H
+#define LL_LLFLOATERDELETEENVPRESET_H
+
+#include "llfloater.h"
+
+class LLComboBox;
+
+class LLFloaterDeleteEnvPreset : public LLFloater
+{
+ LOG_CLASS(LLFloaterDeleteEnvPreset);
+
+public:
+ LLFloaterDeleteEnvPreset(const LLSD &key);
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
+ void onBtnDelete();
+ void onBtnCancel();
+
+private:
+ void populateWaterPresetsList();
+ void populateSkyPresetsList();
+ void populateDayCyclesList();
+
+ LLComboBox* mPresetCombo;
+};
+
+#endif // LL_LLFLOATERDELETEENVPRESET_H
diff --git a/indra/newview/llfloaterenvironmentsettings.cpp b/indra/newview/llfloaterenvironmentsettings.cpp
index f097f70143..2149103792 100644
--- a/indra/newview/llfloaterenvironmentsettings.cpp
+++ b/indra/newview/llfloaterenvironmentsettings.cpp
@@ -197,6 +197,7 @@ void LLFloaterEnvironmentSettings::populateSkyPresetsList()
const std::map<LLWLParamKey, LLWLParamSet> &sky_params_map = LLWLParamManager::getInstance()->mParamList;
for (std::map<LLWLParamKey, LLWLParamSet>::const_iterator it = sky_params_map.begin(); it != sky_params_map.end(); it++)
{
+ if (it->first.scope == LLEnvKey::SCOPE_REGION) continue; // list only local presets
mSkyPresetCombo->add(it->first.name);
}
}
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index a6dee5a553..dfa6e2e5c8 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -49,6 +49,7 @@
#include "llfloaterbump.h"
#include "llfloatercamera.h"
#include "llfloaterdaycycle.h"
+#include "llfloaterdeleteenvpreset.h"
#include "llfloaterdisplayname.h"
#include "llfloaterenvironmentsettings.h"
#include "llfloaterevent.h"
@@ -159,6 +160,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("env_settings", "floater_environment_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEnvironmentSettings>);
LLFloaterReg::add("env_water", "floater_water.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWater>);
LLFloaterReg::add("env_windlight", "floater_windlight_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWindLight>);
+ LLFloaterReg::add("env_delete_preset", "floater_delete_env_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDeleteEnvPreset>);
LLFloaterReg::add("event", "floater_event.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEvent>);
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 4d0d663e0c..437bc4c598 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -7619,6 +7619,51 @@ class LLWorldEnvSettings : public view_listener_t
}
};
+class LLWorldEnvPreset : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string item = userdata.asString();
+
+ if (item == "new_water")
+ {
+ }
+ else if (item == "edit_water")
+ {
+ }
+ else if (item == "delete_water")
+ {
+ LLFloaterReg::showInstance("env_delete_preset", "water");
+ }
+ else if (item == "new_sky")
+ {
+ }
+ else if (item == "edit_sky")
+ {
+ }
+ else if (item == "delete_sky")
+ {
+ LLFloaterReg::showInstance("env_delete_preset", "sky");
+ }
+ else if (item == "new_day_cycle")
+ {
+ }
+ else if (item == "edit_day_cycle")
+ {
+ }
+ else if (item == "delete_day_cycle")
+ {
+ LLFloaterReg::showInstance("env_delete_preset", "day_cycle");
+ }
+ else
+ {
+ llwarns << "Unknown item selected" << llendl;
+ }
+
+ return true;
+ }
+};
+
/// Post-Process callbacks
class LLWorldPostProcess : public view_listener_t
{
@@ -7867,6 +7912,7 @@ void initialize_menus()
view_listener_t::addMenu(new LLWorldCheckAlwaysRun(), "World.CheckAlwaysRun");
view_listener_t::addMenu(new LLWorldEnvSettings(), "World.EnvSettings");
+ view_listener_t::addMenu(new LLWorldEnvPreset(), "World.EnvPreset");
view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess");
view_listener_t::addMenu(new LLWorldDayCycle(), "World.DayCycle");
diff --git a/indra/newview/skins/default/xui/en/floater_delete_env_preset.xml b/indra/newview/skins/default/xui/en/floater_delete_env_preset.xml
index a7ab5abf38..1539c6448e 100644
--- a/indra/newview/skins/default/xui/en/floater_delete_env_preset.xml
+++ b/indra/newview/skins/default/xui/en/floater_delete_env_preset.xml
@@ -2,22 +2,31 @@
<floater
legacy_header_height="18"
height="130"
- help_topic="environment_editor_floater"
+ help_topic=""
layout="topleft"
- name="Environment Editor Floater"
+ name="Delete Env Preset"
save_rect="true"
- title="DELETE PRESETS"
+ title="DELETE ENV PRESET"
width="550">
+
+ <string name="title_water">Delete Water Preset</string>
+ <string name="title_sky">Delete Sky Preset</string>
+ <string name="title_day_cycle">Delete Day Cycle</string>
+
+ <string name="label_water">Preset:</string>
+ <string name="label_sky">Preset:</string>
+ <string name="label_day_cycle">Day cycle:</string>
+
<text
follows="top|left|right"
font="SansSerif"
height="10"
layout="topleft"
left="50"
- name="delete_preset"
+ name="label"
top="60"
width="60">
- Setting:
+ Preset:
</text>
<combo_box
follows="top|left"
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 38bffd04ed..d5d41b981f 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -539,22 +539,22 @@
label="New preset..."
name="new_water_preset">
<menu_item_call.on_click
- function="stub"
- parameter="stub"/>
+ function="World.EnvPreset"
+ parameter="new_water"/>
</menu_item_call>
<menu_item_call
label="Edit preset..."
name="edit_water_preset">
<menu_item_call.on_click
- function="stub"
- parameter="stub"/>
+ function="World.EnvPreset"
+ parameter="edit_water"/>
</menu_item_call>
<menu_item_call
label="Delete preset..."
name="delete_water_preset">
<menu_item_call.on_click
- function="stub"
- parameter="stub"/>
+ function="World.EnvPreset"
+ parameter="delete_water"/>
</menu_item_call>
</menu>
@@ -565,22 +565,22 @@
label="New preset..."
name="new_sky_preset">
<menu_item_call.on_click
- function="stub"
- parameter="stub"/>
+ function="World.EnvPreset"
+ parameter="new_sky"/>
</menu_item_call>
<menu_item_call
label="Edit preset..."
name="edit_sky_preset">
<menu_item_call.on_click
- function="stub"
- parameter="stub"/>
+ function="World.EnvPreset"
+ parameter="edit_sky"/>
</menu_item_call>
<menu_item_call
label="Delete preset..."
name="delete_sky_preset">
<menu_item_call.on_click
- function="stub"
- parameter="stub"/>
+ function="World.EnvPreset"
+ parameter="delete_sky"/>
</menu_item_call>
</menu>
@@ -591,22 +591,22 @@
label="New preset..."
name="new_day_preset">
<menu_item_call.on_click
- function="stub"
- parameter="stub"/>
+ function="World.EnvPreset"
+ parameter="new_day_cycle"/>
</menu_item_call>
<menu_item_call
label="Edit preset..."
name="edit_day_preset">
<menu_item_call.on_click
- function="stub"
- parameter="stub"/>
+ function="World.EnvPreset"
+ parameter="edit_day_cycle"/>
</menu_item_call>
<menu_item_call
label="Delete preset..."
name="delete_day_preset">
<menu_item_call.on_click
- function="stub"
- parameter="stub"/>
+ function="World.EnvPreset"
+ parameter="delete_day_cycle"/>
</menu_item_call>
</menu>
</menu>