diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 88d6f3f120..d6f9d9026a 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -131,6 +131,7 @@ set(viewer_SOURCE_FILES fsfloaterprofile.cpp fsfloatersearch.cpp fsfloaterteleporthistory.cpp + fsfloatervolumecontrols.cpp fsfloaterwsassetblacklist.cpp fsgrouptitles.cpp fskeywords.cpp @@ -781,6 +782,7 @@ set(viewer_HEADER_FILES fsfloaterprofile.h fsfloatersearch.h fsfloaterteleporthistory.h + fsfloatervolumecontrols.h fsfloaterwsassetblacklist.h fsgridhandler.h fsgrouptitles.h diff --git a/indra/newview/fsfloatervolumecontrols.cpp b/indra/newview/fsfloatervolumecontrols.cpp new file mode 100644 index 0000000000..6b9a17c4c0 --- /dev/null +++ b/indra/newview/fsfloatervolumecontrols.cpp @@ -0,0 +1,99 @@ +/** + * @file fsfloatervolumecontrols.cpp + * @brief Class for the standalone volume controls floater in Firestorm + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Phoenix Firestorm Viewer Source Code + * Copyright (c) 2013 Ansariel Hiller @ Second Life + * + * 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 + * + * The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA + * http://www.firestormviewer.org + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "fsfloatervolumecontrols.h" + +#include "llcheckboxctrl.h" +#include "llfloaterreg.h" +#include "llpanel.h" +#include "lltabcontainer.h" + +#include "llfloaterpreference.h" +#include "utilitybar.h" +#include "llviewercontrol.h" + +FSFloaterVolumeControls::FSFloaterVolumeControls(const LLSD& key) +: LLFloater(key) +{ + mCommitCallbackRegistrar.add("Vol.GoAudioPrefs", boost::bind(&FSFloaterVolumeControls::onAudioPrefsButtonClicked, this)); + mCommitCallbackRegistrar.add("Vol.setControlFalse", boost::bind(&FSFloaterVolumeControls::setControlFalse, this, _2)); + mCommitCallbackRegistrar.add("Vol.SetSounds", boost::bind(&FSFloaterVolumeControls::setSounds, this)); +} + +FSFloaterVolumeControls::~FSFloaterVolumeControls() +{ +} + +BOOL FSFloaterVolumeControls::postBuild() +{ + return TRUE; +} + +// virtual +void FSFloaterVolumeControls::handleVisibilityChange(BOOL new_visibility) +{ + UtilityBar::instance().setVolumeControlsButtonExpanded(new_visibility); + LLFloater::handleVisibilityChange(new_visibility); +} + +void FSFloaterVolumeControls::onAudioPrefsButtonClicked() +{ + // bring up the prefs floater + LLFloaterPreference* prefsfloater = LLFloaterReg::showTypedInstance("preferences"); + if (prefsfloater) + { + // grab the 'audio' panel from the preferences floater and + // bring it the front! + LLTabContainer* tabcontainer = prefsfloater->getChild("pref core"); + LLPanel* audiopanel = prefsfloater->getChild("audio"); + if (tabcontainer && audiopanel) + { + tabcontainer->selectTabPanel(audiopanel); + } + } +} + +void FSFloaterVolumeControls::setControlFalse(const LLSD& user_data) +{ + std::string control_name = user_data.asString(); + LLControlVariable* control = findControl(control_name); + + if (control) + { + control->set(LLSD(FALSE)); + } +} + +void FSFloaterVolumeControls::setSounds() +{ + // Disable Enable gesture/collisions sounds checkbox if the master sound is disabled + // or if sound effects are disabled. + getChild("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds")); + getChild("collisions_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds")); +} diff --git a/indra/newview/fsfloatervolumecontrols.h b/indra/newview/fsfloatervolumecontrols.h new file mode 100644 index 0000000000..c1192b7d6c --- /dev/null +++ b/indra/newview/fsfloatervolumecontrols.h @@ -0,0 +1,49 @@ +/** + * @file fsfloatervolumecontrols.cpp + * @brief Class for the standalone volume controls floater in Firestorm + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Phoenix Firestorm Viewer Source Code + * Copyright (c) 2013 Ansariel Hiller @ Second Life + * + * 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 + * + * The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA + * http://www.firestormviewer.org + * $/LicenseInfo$ + */ + +#ifndef FS_FLOATERVOLUMECONTROLS_H +#define FS_FLOATERVOLUMECONTROLS_H + +#include "llfloater.h" + +class FSFloaterVolumeControls +: public LLFloater +{ +public: + FSFloaterVolumeControls(const LLSD& key); + BOOL postBuild(); + +private: + ~FSFloaterVolumeControls(); + + /*virtual*/ void handleVisibilityChange(BOOL new_visibility); + void onAudioPrefsButtonClicked(); + void setControlFalse(const LLSD& user_data); + void setSounds(); +}; + +#endif // FS_FLOATERVOLUMECONTROLS_H diff --git a/indra/newview/llpanelvolumepulldown.cpp b/indra/newview/llpanelvolumepulldown.cpp index 6f209ec8a7..f3c5656fa4 100644 --- a/indra/newview/llpanelvolumepulldown.cpp +++ b/indra/newview/llpanelvolumepulldown.cpp @@ -40,6 +40,9 @@ #include "llfloaterpreference.h" #include "llsliderctrl.h" +#include "llcheckboxctrl.h" +#include "llviewercontrol.h" + /* static */ const F32 LLPanelVolumePulldown::sAutoCloseFadeStartTimeSec = 4.0f; /* static */ const F32 LLPanelVolumePulldown::sAutoCloseTotalTimeSec = 5.0f; @@ -54,6 +57,9 @@ LLPanelVolumePulldown::LLPanelVolumePulldown() mCommitCallbackRegistrar.add("Vol.setControlFalse", boost::bind(&LLPanelVolumePulldown::setControlFalse, this, _2)); mCommitCallbackRegistrar.add("Vol.GoAudioPrefs", boost::bind(&LLPanelVolumePulldown::onAdvancedButtonClick, this, _2)); + // Missing callback function + mCommitCallbackRegistrar.add("Vol.SetSounds", boost::bind(&LLPanelVolumePulldown::setSounds, this)); + buildFromFile( "panel_volume_pulldown.xml"); } @@ -148,3 +154,12 @@ void LLPanelVolumePulldown::draw() } } +// Missing callback function +void LLPanelVolumePulldown::setSounds() +{ + // Disable Enable gesture/collisions sounds checkbox if the master sound is disabled + // or if sound effects are disabled. + getChild("gesture_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds")); + getChild("collisions_audio_play_btn")->setEnabled(!gSavedSettings.getBOOL("MuteSounds")); +} +// Missing callback function diff --git a/indra/newview/llpanelvolumepulldown.h b/indra/newview/llpanelvolumepulldown.h index 0d86e6bd28..f5dcd94581 100644 --- a/indra/newview/llpanelvolumepulldown.h +++ b/indra/newview/llpanelvolumepulldown.h @@ -48,6 +48,8 @@ class LLPanelVolumePulldown : public LLPanel private: void setControlFalse(const LLSD& user_data); void onAdvancedButtonClick(const LLSD& user_data); + // Missing callback function + void setSounds(); LLFrameTimer mHoverTimer; static const F32 sAutoCloseFadeStartTimeSec; diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 3abd4f52ad..3645ba76b9 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -155,6 +155,7 @@ #include "fsfloaterprofile.h" #include "fsfloatersearch.h" #include "fsfloaterteleporthistory.h" +#include "fsfloatervolumecontrols.h" #include "fsfloaterwsassetblacklist.h" #include "fsgrouptitles.h" #include "fsmoneytracker.h" @@ -375,6 +376,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("fs_posestand", "floater_fs_posestand.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("fs_placedetails", "floater_fs_placedetails.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("fs_teleporthistory", "floater_fs_teleporthistory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("fs_volume_controls", "floater_fs_volume_controls.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("group_titles", "floater_fs_group_titles.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("imcontacts", "floater_fs_contacts.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("lgg_beamcolormap", "floater_beamcolor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); @@ -390,7 +392,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("secondary_inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("script_recover", "floater_script_recover.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("sound_explorer", "floater_NACL_explore_sounds.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("volume_controls", "floater_volume_controls.xml", &LLFloaterReg::build); LLFloaterReg::add("ws_asset_blacklist", "floater_asset_blacklist.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::registerControlVariables(); // Make sure visibility and rect controls get preserved when saving diff --git a/indra/newview/skins/vintage/xui/de/floater_volume_controls.xml b/indra/newview/skins/default/xui/de/floater_fs_volume_controls.xml similarity index 100% rename from indra/newview/skins/vintage/xui/de/floater_volume_controls.xml rename to indra/newview/skins/default/xui/de/floater_fs_volume_controls.xml diff --git a/indra/newview/skins/default/xui/en/floater_volume_controls.xml b/indra/newview/skins/default/xui/en/floater_fs_volume_controls.xml similarity index 100% rename from indra/newview/skins/default/xui/en/floater_volume_controls.xml rename to indra/newview/skins/default/xui/en/floater_fs_volume_controls.xml diff --git a/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml b/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml index 5f46c9db21..985e41720c 100644 --- a/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml +++ b/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml @@ -43,7 +43,7 @@ top="10" volume="true"> diff --git a/indra/newview/skins/vintage/xui/pl/floater_volume_controls.xml b/indra/newview/skins/vintage/xui/pl/floater_fs_volume_controls.xml similarity index 100% rename from indra/newview/skins/vintage/xui/pl/floater_volume_controls.xml rename to indra/newview/skins/vintage/xui/pl/floater_fs_volume_controls.xml diff --git a/indra/newview/utilitybar.cpp b/indra/newview/utilitybar.cpp index 1ae6b7b295..70214be461 100644 --- a/indra/newview/utilitybar.cpp +++ b/indra/newview/utilitybar.cpp @@ -32,7 +32,6 @@ #include "lltabcontainer.h" #include "llagent.h" -#include "llfloaterpreference.h" #include "llstatusbar.h" #include "llviewercontrol.h" #include "llviewermedia.h" @@ -57,6 +56,7 @@ void UtilityBar::init() mParcelMediaPlayButton = rootView->findChild("utility_parcel_media_button"); mTalkButton = rootView->findChild("utility_talk_button"); mAOInterfaceButton = rootView->findChild("show_ao_interface_button"); + mVolumeControlsInterfaceButton = rootView->findChild("show_volume_controls_button"); if(mParcelStreamPlayButton) mParcelStreamPlayButton->setCommitCallback(boost::bind(&UtilityBar::onParcelStreamClicked,this)); @@ -69,8 +69,6 @@ void UtilityBar::init() mTalkButton->setMouseUpCallback(boost::bind(&LLAgent::releaseMicrophone, _2)); } - LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Vol.GoAudioPrefs", boost::bind(&UtilityBar::onAudioPrefsButtonClicked, this)); - mEventTimer.start(); } @@ -147,19 +145,17 @@ void UtilityBar::setAOInterfaceButtonExpanded(bool expanded) } } -void UtilityBar::onAudioPrefsButtonClicked() +void UtilityBar::setVolumeControlsButtonExpanded(bool expanded) { - // bring up the prefs floater - LLFloaterPreference* prefsfloater = LLFloaterReg::showTypedInstance("preferences"); - if (prefsfloater) + if (mVolumeControlsInterfaceButton) { - // grab the 'audio' panel from the preferences floater and - // bring it the front! - LLTabContainer* tabcontainer = prefsfloater->getChild("pref core"); - LLPanel* audiopanel = prefsfloater->getChild("audio"); - if (tabcontainer && audiopanel) + if (expanded) { - tabcontainer->selectTabPanel(audiopanel); + mVolumeControlsInterfaceButton->setImageOverlay("arrow_down.tga"); + } + else + { + mVolumeControlsInterfaceButton->setImageOverlay("arrow_up.tga"); } } -} \ No newline at end of file +} diff --git a/indra/newview/utilitybar.h b/indra/newview/utilitybar.h index 8f0bf80d50..123b5c2350 100644 --- a/indra/newview/utilitybar.h +++ b/indra/newview/utilitybar.h @@ -45,16 +45,17 @@ class UtilityBar void init(); virtual BOOL tick(); void setAOInterfaceButtonExpanded(bool expanded); + void setVolumeControlsButtonExpanded(bool expanded); protected: void onParcelStreamClicked(); void onParcelMediaClicked(); - void onAudioPrefsButtonClicked(); LLButton* mParcelStreamPlayButton; LLButton* mParcelMediaPlayButton; LLButton* mTalkButton; LLButton* mAOInterfaceButton; + LLButton* mVolumeControlsInterfaceButton; }; #endif // UTILITYBAR_H