From 991aa9770f6b3d5922ec7a7a3e2e2fc999de61ab Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Tue, 15 Jun 2010 01:03:29 -0700 Subject: Created toolbar remote for toggling AO on/off --- linden/indra/newview/CMakeLists.txt | 5 + linden/indra/newview/aoremotectrl.cpp | 122 +++++++++++++++++++++ linden/indra/newview/aoremotectrl.h | 54 +++++++++ linden/indra/newview/app_settings/settings.xml | 44 ++++++-- linden/indra/newview/lloverlaybar.cpp | 14 ++- linden/indra/newview/lloverlaybar.h | 3 + .../newview/skins/default/xui/en-us/floater_ao.xml | 41 ++++--- .../skins/default/xui/en-us/panel_ao_remote.xml | 7 ++ .../default/xui/en-us/panel_ao_remote_controls.xml | 11 ++ .../default/xui/en-us/panel_ao_remote_expanded.xml | 10 ++ .../skins/default/xui/en-us/panel_overlaybar.xml | 7 +- 11 files changed, 287 insertions(+), 31 deletions(-) create mode 100644 linden/indra/newview/aoremotectrl.cpp create mode 100644 linden/indra/newview/aoremotectrl.h create mode 100644 linden/indra/newview/skins/default/xui/en-us/panel_ao_remote.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_controls.xml create mode 100644 linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml (limited to 'linden') diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt index 796e98e..a3fc7d9 100644 --- a/linden/indra/newview/CMakeLists.txt +++ b/linden/indra/newview/CMakeLists.txt @@ -65,6 +65,7 @@ include_directories( ) set(viewer_SOURCE_FILES + aoremotectrl.cpp emeraldboobutils.cpp floaterao.cpp floaterbusy.cpp @@ -493,6 +494,7 @@ endif (LINUX) set(viewer_HEADER_FILES CMakeLists.txt ViewerInstall.cmake + aoremotectrl.h emeraldboobutils.h floaterao.h floaterbusy.h @@ -1225,6 +1227,9 @@ set(viewer_XUI_FILES skins/default/xui/en-us/mime_types.xml skins/default/xui/en-us/notifications.xml skins/default/xui/en-us/notify.xml + skins/default/xui/en-us/panel_ao_remote_controls.xml + skins/default/xui/en-us/panel_ao_remote.xml + skins/default/xui/en-us/panel_ao_remote_expanded.xml skins/default/xui/en-us/panel_audio_device.xml skins/default/xui/en-us/panel_audio.xml skins/default/xui/en-us/panel_avatar_classified.xml diff --git a/linden/indra/newview/aoremotectrl.cpp b/linden/indra/newview/aoremotectrl.cpp new file mode 100644 index 0000000..8cafdd9 --- /dev/null +++ b/linden/indra/newview/aoremotectrl.cpp @@ -0,0 +1,122 @@ +/** +* @file aoremotectrl.cpp +* @brief toolbar remote for toggling the viewer AO +* +* $LicenseInfo:firstyear=2009&license=viewergpl$ +* +* Copyright (c) 2010, McCabe Maxsted +* +* Imprudence Viewer Source Code +* The source code in this file ("Source Code") is provided to you +* under the terms of the GNU General Public License, version 2.0 +* ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in +* this distribution, or online at +* http://secondlifegrid.net/programs/open_source/licensing/gplv2 +* +* There are special exceptions to the terms and conditions of the GPL as +* it is applied to this Source Code. View the full text of the exception +* in the file doc/FLOSS-exception.txt in this software distribution, or +* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception +* +* By copying, modifying or distributing this software, you acknowledge +* that you have read and understood your obligations described above, +* and agree to abide by those obligations. +* +* ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO +* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +* COMPLETENESS OR PERFORMANCE. +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "aoremotectrl.h" + +#include "floaterao.h" +#include "llbutton.h" +#include "lloverlaybar.h" +#include "lluictrlfactory.h" +#include "llviewercontrol.h" + + +AORemoteCtrl::AORemoteCtrl() +{ + setIsChrome(TRUE); + build(); + setFocusRoot(TRUE); +} + +AORemoteCtrl::~AORemoteCtrl() +{ +} + +void AORemoteCtrl::draw() +{ + LLButton* expand_button = getChild("popup_btn"); + if (expand_button) + { + if (expand_button->getToggleState()) + { + expand_button->setImageOverlay("arrow_down.tga"); + } + else + { + expand_button->setImageOverlay("arrow_up.tga"); + } + } + + LLPanel::draw(); +} + +void AORemoteCtrl::build() +{ + if (gSavedSettings.getBOOL("ShowAOSitPopup")) + { + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_ao_remote_expanded.xml"); + } + else + { + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_ao_remote.xml"); + } +} + +BOOL AORemoteCtrl::postBuild() +{ + + childSetAction("ao_btn", onClickToggleAO, this); + childSetAction("ao_sit_btn", onClickToggleAOSit, this); + childSetAction("ao_show_btn", onClickShowAO, this); + childSetAction("popup_btn", onClickPopupBtn, this); + + return TRUE; +} + +// static +void AORemoteCtrl::onClickToggleAO(void* data) +{ + BOOL ao_enable = gSavedSettings.getBOOL("AOEnabled"); + gSavedSettings.setBOOL("AOEnabled", !ao_enable); +} + +//static +void AORemoteCtrl::onClickToggleAOSit(void* data) +{ + BOOL sit_enable = gSavedSettings.getBOOL("AOSitsEnabled"); + gSavedSettings.setBOOL("AOSitsEnabled", !sit_enable); +} + +//static +void AORemoteCtrl::onClickShowAO(void* data) +{ + LLFloaterAO::show(NULL); +} + +//static +void AORemoteCtrl::onClickPopupBtn(void* data) +{ + AORemoteCtrl* remotep = (AORemoteCtrl*)data; + + remotep->deleteAllChildren(); + remotep->build(); + gOverlayBar->layoutButtons(); +} diff --git a/linden/indra/newview/aoremotectrl.h b/linden/indra/newview/aoremotectrl.h new file mode 100644 index 0000000..ca74e0d --- /dev/null +++ b/linden/indra/newview/aoremotectrl.h @@ -0,0 +1,54 @@ +/** +* @file aoremotectrl.h +* @brief toolbar remote for toggling the viewer AO +* +* $LicenseInfo:firstyear=2009&license=viewergpl$ +* +* Copyright (c) 2010, McCabe Maxsted +* +* Imprudence Viewer Source Code +* The source code in this file ("Source Code") is provided to you +* under the terms of the GNU General Public License, version 2.0 +* ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in +* this distribution, or online at +* http://secondlifegrid.net/programs/open_source/licensing/gplv2 +* +* There are special exceptions to the terms and conditions of the GPL as +* it is applied to this Source Code. View the full text of the exception +* in the file doc/FLOSS-exception.txt in this software distribution, or +* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception +* +* By copying, modifying or distributing this software, you acknowledge +* that you have read and understood your obligations described above, +* and agree to abide by those obligations. +* +* ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO +* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +* COMPLETENESS OR PERFORMANCE. +* $/LicenseInfo$ +*/ + +#ifndef AOREMOTECTRL_H +#define AOREMOTECTRL_H + +#include "llpanel.h" + +class AORemoteCtrl : public LLPanel +{ +public: + AORemoteCtrl(); + virtual ~AORemoteCtrl(); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void draw(); + +private: + + void build(); + + static void onClickToggleAO(void* data); + static void onClickToggleAOSit(void* data); + static void onClickShowAO(void* data); + static void onClickPopupBtn(void* data); +}; + +#endif // AOREMOTECTRL_H diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index aa6b1fa..fa6e275 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -125,6 +125,17 @@ Value 0 + EnableWindlightRemote + + Comment + Enable windlight quick access remote in toolbar + Persist + 1 + Type + Boolean + Value + 1 + FloaterAnimationListRect Comment @@ -586,6 +597,17 @@ Value 0 + ShowAOSitPopup + + Comment + Show AO sit popup + Persist + 1 + Type + Boolean + Value + 0 + ShowMiniMapRadar Comment @@ -836,6 +858,17 @@ 100 + EnableAORemote + + Comment + Enable AO quick access remote in toolbar + Persist + 1 + Type + Boolean + Value + 0 + @@ -4342,17 +4375,6 @@ Value 1 - EnableWindlightRemote - - Comment - Enable windlight quick access remote in toolbar - Persist - 1 - Type - Boolean - Value - 1 - EnergyFromTop Comment diff --git a/linden/indra/newview/lloverlaybar.cpp b/linden/indra/newview/lloverlaybar.cpp index 9f3776f..6191a01 100644 --- a/linden/indra/newview/lloverlaybar.cpp +++ b/linden/indra/newview/lloverlaybar.cpp @@ -37,6 +37,7 @@ #include "lloverlaybar.h" +#include "aoremotectrl.h" #include "audioengine.h" #include "llrender.h" #include "llagent.h" @@ -148,6 +149,13 @@ void* LLOverlayBar::createWindlightRemote(void* userdata) return self->mWindlightRemote; } +void* LLOverlayBar::createAORemote(void* userdata) +{ + LLOverlayBar *self = (LLOverlayBar*)userdata; + self->mAORemote = new AORemoteCtrl(); + return self->mAORemote; +} + void* LLOverlayBar::createChatBar(void* userdata) { gChatBar = new LLChatBar(); @@ -159,6 +167,7 @@ LLOverlayBar::LLOverlayBar() mMediaRemote(NULL), mVoiceRemote(NULL), mWindlightRemote(NULL), + mAORemote(NULL), mMusicState(STOPPED), mOriginalIMLabel("") { @@ -171,6 +180,7 @@ LLOverlayBar::LLOverlayBar() factory_map["media_remote"] = LLCallbackMap(LLOverlayBar::createMediaRemote, this); factory_map["voice_remote"] = LLCallbackMap(LLOverlayBar::createVoiceRemote, this); factory_map["windlight_remote"] = LLCallbackMap(LLOverlayBar::createWindlightRemote, this); + factory_map["ao_remote"] = LLCallbackMap(LLOverlayBar::createAORemote, this); factory_map["chat_bar"] = LLCallbackMap(LLOverlayBar::createChatBar, this); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_overlaybar.xml", &factory_map); @@ -330,7 +340,7 @@ void LLOverlayBar::refresh() buttons_changed = TRUE; } - + moveChildToBackOfTabGroup(mAORemote); moveChildToBackOfTabGroup(mWindlightRemote); moveChildToBackOfTabGroup(mMediaRemote); moveChildToBackOfTabGroup(mVoiceRemote); @@ -341,6 +351,7 @@ void LLOverlayBar::refresh() childSetVisible("media_remote_container", FALSE); childSetVisible("voice_remote_container", FALSE); childSetVisible("windlight_remote_container", FALSE); + childSetVisible("ao_remote_container", FALSE); childSetVisible("state_buttons", FALSE); } else @@ -349,6 +360,7 @@ void LLOverlayBar::refresh() childSetVisible("media_remote_container", TRUE); childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled()); childSetVisible("windlight_remote_container", gSavedSettings.getBOOL("EnableWindlightRemote")); + childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote")); childSetVisible("state_buttons", TRUE); } diff --git a/linden/indra/newview/lloverlaybar.h b/linden/indra/newview/lloverlaybar.h index 50ad3d1..233f5c5 100644 --- a/linden/indra/newview/lloverlaybar.h +++ b/linden/indra/newview/lloverlaybar.h @@ -52,6 +52,7 @@ class LLStatGraph; class LLSlider; class LLVoiceRemoteCtrl; class LLWindlightRemoteCtrl; +class AORemoteCtrl; class LLOverlayBar : public LLPanel @@ -92,6 +93,7 @@ protected: static void* createMediaRemote(void* userdata); static void* createVoiceRemote(void* userdata); static void* createWindlightRemote(void* userdata); + static void* createAORemote(void* userdata); static void* createChatBar(void* userdata); void enableMediaButtons(); @@ -100,6 +102,7 @@ protected: LLMediaRemoteCtrl* mMediaRemote; LLVoiceRemoteCtrl* mVoiceRemote; LLWindlightRemoteCtrl* mWindlightRemote; + AORemoteCtrl* mAORemote; bool mBuilt; // dialog constructed yet? S32 mMusicState; std::string mOriginalIMLabel; diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_ao.xml b/linden/indra/newview/skins/default/xui/en-us/floater_ao.xml index 2bcc9d1..134bd13 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_ao.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_ao.xml @@ -35,7 +35,7 @@