summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloatercamerapresets.cpp18
-rw-r--r--indra/newview/llfloatercamerapresets.h3
2 files changed, 20 insertions, 1 deletions
diff --git a/indra/newview/llfloatercamerapresets.cpp b/indra/newview/llfloatercamerapresets.cpp
index 300c945a85..a1cbffd094 100644
--- a/indra/newview/llfloatercamerapresets.cpp
+++ b/indra/newview/llfloatercamerapresets.cpp
@@ -24,6 +24,7 @@
*/
#include "llviewerprecompiledheaders.h"
+#include "llfloatercamera.h"
#include "llfloatercamerapresets.h"
#include "llfloaterreg.h"
#include "llnotificationsutil.h"
@@ -40,7 +41,8 @@ LLFloaterCameraPresets::~LLFloaterCameraPresets()
BOOL LLFloaterCameraPresets::postBuild()
{
mPresetList = getChild<LLFlatListView>("preset_list");
-
+ mPresetList->setCommitCallback(boost::bind(&LLFloaterCameraPresets::onSelectionChange, this));
+ mPresetList->setCommitOnSelectionChange(true);
LLPresetsManager::getInstance()->setPresetListChangeCameraCallback(boost::bind(&LLFloaterCameraPresets::populateList, this));
return TRUE;
@@ -58,6 +60,7 @@ void LLFloaterCameraPresets::populateList()
std::list<std::string> preset_names;
presetsMgr->loadPresetNamesFromDir(PRESETS_CAMERA, preset_names, DEFAULT_BOTTOM);
+ std::string active_preset = gSavedSettings.getString("PresetCameraActive");
for (std::list<std::string>::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it)
{
@@ -66,6 +69,19 @@ void LLFloaterCameraPresets::populateList()
LLCameraPresetFlatItem* item = new LLCameraPresetFlatItem(name, is_default);
item->postBuild();
mPresetList->addItem(item);
+ if(name == active_preset)
+ {
+ mPresetList->selectItem(item);
+ }
+ }
+}
+
+void LLFloaterCameraPresets::onSelectionChange()
+{
+ LLCameraPresetFlatItem* selected_preset = dynamic_cast<LLCameraPresetFlatItem*>(mPresetList->getSelectedItem());
+ if(selected_preset)
+ {
+ LLFloaterCamera::switchToPreset(selected_preset->getPresetName());
}
}
diff --git a/indra/newview/llfloatercamerapresets.h b/indra/newview/llfloatercamerapresets.h
index 66430fa399..4430a4209e 100644
--- a/indra/newview/llfloatercamerapresets.h
+++ b/indra/newview/llfloatercamerapresets.h
@@ -38,6 +38,7 @@ class LLFloaterCameraPresets : public LLFloater
virtual void onOpen(const LLSD& key);
void populateList();
+ void onSelectionChange();
private:
LLFloaterCameraPresets(const LLSD& key);
@@ -58,6 +59,8 @@ public:
virtual void onMouseEnter(S32 x, S32 y, MASK mask);
virtual void onMouseLeave(S32 x, S32 y, MASK mask);
+ std::string getPresetName() { return mPresetName; }
+
private:
void onDeleteBtnClick();
void onResetBtnClick();