diff options
-rw-r--r-- | indra/newview/llfloatercamera.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llfloatercamera.h | 3 | ||||
-rw-r--r-- | indra/newview/llfloaterdeleteprefpreset.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llfloatersaveprefpreset.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llpresetsmanager.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llpresetsmanager.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 11 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml | 12 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_save_pref_preset.xml | 17 |
9 files changed, 81 insertions, 30 deletions
diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 933e758653..8502b5685d 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -361,11 +361,13 @@ BOOL LLFloaterCamera::postBuild() mRotate = getChild<LLJoystickCameraRotate>(ORBIT); mZoom = findChild<LLPanelCameraZoom>(ZOOM); mTrack = getChild<LLJoystickCameraTrack>(PAN); + mPresetCombo = getChild<LLComboBox>("preset_combo"); getChild<LLTextBox>("precise_ctrs_label")->setShowCursorHand(false); getChild<LLTextBox>("precise_ctrs_label")->setSoundFlags(LLView::MOUSE_UP); getChild<LLTextBox>("precise_ctrs_label")->setClickedCallback(boost::bind(&LLFloaterReg::showInstance, "prefs_view_advanced", LLSD(), FALSE)); - getChild<LLComboBox>("preset_combo")->setCommitCallback(boost::bind(&LLFloaterCamera::onCustomPresetSelected, this)); + + mPresetCombo->setCommitCallback(boost::bind(&LLFloaterCamera::onCustomPresetSelected, this)); LLPresetsManager::getInstance()->setPresetListChangeCameraCallback(boost::bind(&LLFloaterCamera::populatePresetCombo, this)); update(); @@ -571,15 +573,21 @@ void LLFloaterCamera::fromFreeToPresets() void LLFloaterCamera::populatePresetCombo() { - LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, getChild<LLComboBox>("preset_combo"), EDefaultOptions::DEFAULT_VIEWS_HIDE); - if ((ECameraPreset)gSavedSettings.getU32("CameraPreset") == CAMERA_PRESET_CUSTOM) + LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_CAMERA, mPresetCombo, EDefaultOptions::DEFAULT_VIEWS_HIDE); + std::string active_preset_name = gSavedSettings.getString("PresetCameraActive"); + if (active_preset_name.empty()) { - getChild<LLComboBox>("preset_combo")->selectByValue(gSavedSettings.getString("PresetCameraActive")); + gSavedSettings.setU32("CameraPreset", CAMERA_PRESET_CUSTOM); + updateItemsSelection(); + mPresetCombo->setLabel(getString("inactive_combo_text")); + } + else if ((ECameraPreset)gSavedSettings.getU32("CameraPreset") == CAMERA_PRESET_CUSTOM) + { + mPresetCombo->selectByValue(active_preset_name); } else { - std::string inactive_text = getString("inactive_combo_text"); - getChild<LLComboBox>("preset_combo")->setLabel(inactive_text);// add(inactive_text, inactive_text, ADD_TOP); + mPresetCombo->setLabel(getString("inactive_combo_text")); } } @@ -587,12 +595,18 @@ void LLFloaterCamera::onSavePreset() { LLFloaterReg::hideInstance("delete_pref_preset", PRESETS_CAMERA); LLFloaterReg::hideInstance("load_pref_preset", PRESETS_CAMERA); - LLFloaterReg::showInstance("save_pref_preset", PRESETS_CAMERA); + + LLSD key; + key["subdirectory"] = PRESETS_CAMERA; + std::string current_preset = gSavedSettings.getString("PresetCameraActive"); + bool is_custom_preset = current_preset != "" && !LLPresetsManager::getInstance()->isDefaultPreset(current_preset); + key["index"] = is_custom_preset ? 1 : 0; + LLFloaterReg::showInstance("save_pref_preset", key); } void LLFloaterCamera::onCustomPresetSelected() { - std::string selected_preset = getChild<LLComboBox>("preset_combo")->getSelectedItemLabel(); + std::string selected_preset = mPresetCombo->getSelectedItemLabel(); if (gSavedSettings.getString("PresetCameraActive") != selected_preset && getString("inactive_combo_text") != selected_preset) { gAgentCamera.switchCameraPreset(CAMERA_PRESET_CUSTOM); diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index b1e0c83ce0..9440f50c3f 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -36,6 +36,7 @@ class LLJoystickCameraRotate; class LLJoystickCameraTrack; class LLFloaterReg; class LLPanelCameraZoom; +class LLComboBox; enum ECameraControlMode { @@ -128,6 +129,8 @@ private: ECameraControlMode mPrevMode; ECameraControlMode mCurrMode; std::map<ECameraControlMode, LLButton*> mMode2Button; + + LLComboBox* mPresetCombo; }; /** diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index bd62849b42..0765756b43 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -82,6 +82,13 @@ void LLFloaterDeletePrefPreset::onBtnDelete() args["NAME"] = name; LLNotificationsUtil::add("PresetNotDeleted", args); } + else if (mSubdirectory == PRESETS_CAMERA) + { + if (gSavedSettings.getString("PresetCameraActive") == name) + { + gSavedSettings.setString("PresetCameraActive", ""); + } + } closeFloater(); } diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index 10fad347bf..c8d6513f4d 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -53,7 +53,6 @@ BOOL LLFloaterSavePrefPreset::postBuild() } mPresetCombo = getChild<LLComboBox>("preset_combo"); - //mPresetCombo->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); mNameEditor = getChild<LLLineEditor>("preset_txt_editor"); mNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this), NULL); @@ -84,7 +83,19 @@ void LLFloaterSavePrefPreset::onPresetNameEdited() void LLFloaterSavePrefPreset::onOpen(const LLSD& key) { LLModalDialog::onOpen(key); - mSubdirectory = key.asString(); + S32 index = 0; + if (key.has("subdirectory")) + { + mSubdirectory = key["subdirectory"].asString(); + if (key.has("index")) + { + index = key["index"].asInteger(); + } + } + else + { + mSubdirectory = key.asString(); + } std::string floater_title = getString(std::string("title_") + mSubdirectory); @@ -93,7 +104,7 @@ void LLFloaterSavePrefPreset::onOpen(const LLSD& key) EDefaultOptions option = DEFAULT_HIDE; LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); - mSaveRadioGroup->setSelectedIndex(0); + mSaveRadioGroup->setSelectedIndex(index); onPresetNameEdited(); onSwitchSaveReplace(); } diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 94e6e64754..ea4850bdb0 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -164,7 +164,7 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam if (default_option == DEFAULT_VIEWS_HIDE) { - if (name == PRESETS_REAR || name == PRESETS_SIDE || name == PRESETS_FRONT) + if (isDefaultPreset(name)) { continue; } @@ -300,7 +300,7 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n { name_list.push_back(gAgentCamera.getCameraOffsetCtrlName()); name_list.push_back(gAgentCamera.getFocusOffsetCtrlName()); - custom_camera_offsets = (name != PRESETS_REAR && name != PRESETS_SIDE && name != PRESETS_FRONT); + custom_camera_offsets = !isDefaultPreset(name); } for (std::vector<std::string>::iterator it = name_list.begin(); it != name_list.end(); ++it) { @@ -378,7 +378,7 @@ bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, bool sts = true; combo->clearRows(); - + combo->setEnabled(TRUE); std::string presets_dir = getPresetsDir(subdirectory); @@ -400,6 +400,7 @@ bool LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, else { combo->setLabel(LLTrans::getString("preset_combo_label")); + combo->setEnabled(FALSE); sts = false; } } @@ -488,6 +489,11 @@ bool LLPresetsManager::deletePreset(const std::string& subdirectory, std::string return sts; } +bool LLPresetsManager::isDefaultPreset(std::string preset_name) +{ + return (preset_name == PRESETS_REAR || preset_name == PRESETS_SIDE || preset_name == PRESETS_FRONT); +} + boost::signals2::connection LLPresetsManager::setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb) { return mPresetListChangeCameraSignal.connect(cb); diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index cb32b58fc4..e865fe2512 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -71,6 +71,8 @@ public: bool isCameraDirty(); static void setCameraDirty(bool dirty); + bool isDefaultPreset(std::string preset_name); + // Emitted when a preset gets loaded, deleted, or saved. boost::signals2::connection setPresetListChangeCameraCallback(const preset_list_signal_t::slot_type& cb); boost::signals2::connection setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 52b2c631fa..c18d63d72b 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4109,8 +4109,15 @@ void handle_reset_view() // switching to outfit selector should automagically save any currently edited wearable LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits")); } - - gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); + if ((ECameraPreset)gSavedSettings.getU32("CameraPreset") == CAMERA_PRESET_CUSTOM) + { + gAgentCamera.switchCameraPreset(CAMERA_PRESET_CUSTOM); + } + else + { + gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); + } + reset_view_final( TRUE ); LLFloaterCamera::resetCameraMode(); } diff --git a/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml index 3826ead5c2..77e36f0b09 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_view_advanced.xml @@ -22,7 +22,7 @@ height="20" label="X" label_width="12" - follows="topl|eft" + follows="top|left" left="10" name="camera_x" top_pad="5" @@ -37,7 +37,7 @@ height="20" label="Y" label_width="12" - follows="topl|eft" + follows="top|left" name="camera_y" left_pad="20" min_val="-1e+007" @@ -51,7 +51,7 @@ height="20" label="Z" label_width="12" - follows="topl|eft" + follows="top|left" name="camera_z" left_pad="20" min_val="-1e+007" @@ -75,7 +75,7 @@ height="20" label="X" label_width="12" - follows="topl|eft" + follows="top|left" left="10" name="focus_x" top_pad="5" @@ -90,7 +90,7 @@ height="20" label="Y" label_width="12" - follows="topl|eft" + follows="top|left" name="focus_y" left_pad="20" min_val="-1e+007" @@ -104,7 +104,7 @@ height="20" label="Z" label_width="12" - follows="topl|eft" + follows="top|left" name="focus_z" left_pad="20" min_val="-1e+007" diff --git a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml index 178ecad0f3..3a5838e846 100644 --- a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml +++ b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml @@ -44,19 +44,12 @@ name="preset_txt_editor" width="200" top="45"/> - <combo_box - follows="top|left" - layout="topleft" - left="41" - name="preset_combo" - top_pad="35" - width="200"/> <button follows="top|left" height="25" label="Save" layout="topleft" - top_delta="40" + top="145" left="25" name="save" width="110"/> @@ -68,4 +61,12 @@ left_pad="20" name="cancel" width="110"/> +<!-- *HACK to correctly draw drop-down list over the buttons--> + <combo_box + follows="top|left" + layout="topleft" + left="41" + name="preset_combo" + top_delta="-40" + width="200"/> </floater> |