summaryrefslogtreecommitdiff
path: root/indra/newview/lloverlaybar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lloverlaybar.cpp')
-rw-r--r--indra/newview/lloverlaybar.cpp150
1 files changed, 58 insertions, 92 deletions
diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp
index 237826cb7a..c2bbec0470 100644
--- a/indra/newview/lloverlaybar.cpp
+++ b/indra/newview/lloverlaybar.cpp
@@ -2,30 +2,25 @@
* @file lloverlaybar.cpp
* @brief LLOverlayBar class implementation
*
- * $LicenseInfo:firstyear=2002&license=viewergpl$
- *
- * Copyright (c) 2002-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, 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.
*
- * 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://secondlife.com/developers/opensource/flossexception
+ * 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.
*
- * 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.
+ * 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
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,31 +31,31 @@
#include "lloverlaybar.h"
-#include "audioengine.h"
-#include "llglimmediate.h"
+#include "llaudioengine.h"
+#include "llrender.h"
#include "llagent.h"
#include "llbutton.h"
-#include "llchatbar.h"
#include "llfocusmgr.h"
#include "llimview.h"
#include "llmediaremotectrl.h"
-#include "llpanelaudiovolume.h"
#include "llparcel.h"
#include "lltextbox.h"
#include "llui.h"
#include "llviewercontrol.h"
-#include "llviewerimagelist.h"
+#include "llviewertexturelist.h"
+#include "llviewerjoystick.h"
#include "llviewermedia.h"
#include "llviewermenu.h" // handle_reset_view()
#include "llviewermedia.h"
#include "llviewerparcelmedia.h"
#include "llviewerparcelmgr.h"
-#include "llvieweruictrlfactory.h"
+#include "lluictrlfactory.h"
#include "llviewerwindow.h"
#include "llvoiceclient.h"
-#include "llvoavatar.h"
+#include "llvoavatarself.h"
#include "llvoiceremotectrl.h"
-#include "llwebbrowserctrl.h"
+#include "llmediactrl.h"
+#include "llselectmgr.h"
//
// Globals
@@ -86,16 +81,10 @@ void* LLOverlayBar::createMediaRemote(void* userdata)
void* LLOverlayBar::createVoiceRemote(void* userdata)
{
LLOverlayBar *self = (LLOverlayBar*)userdata;
- self->mVoiceRemote = new LLVoiceRemoteCtrl("voice_remote");
+ self->mVoiceRemote = new LLVoiceRemoteCtrl();
return self->mVoiceRemote;
}
-void* LLOverlayBar::createChatBar(void* userdata)
-{
- gChatBar = new LLChatBar();
- return gChatBar;
-}
-
LLOverlayBar::LLOverlayBar()
: LLPanel(),
mMediaRemote(NULL),
@@ -107,23 +96,23 @@ LLOverlayBar::LLOverlayBar()
mBuilt = false;
- LLCallbackMap::map_t factory_map;
- factory_map["media_remote"] = LLCallbackMap(LLOverlayBar::createMediaRemote, this);
- factory_map["voice_remote"] = LLCallbackMap(LLOverlayBar::createVoiceRemote, this);
- factory_map["chat_bar"] = LLCallbackMap(LLOverlayBar::createChatBar, this);
+ mFactoryMap["media_remote"] = LLCallbackMap(LLOverlayBar::createMediaRemote, this);
+ mFactoryMap["voice_remote"] = LLCallbackMap(LLOverlayBar::createVoiceRemote, this);
- gUICtrlFactory->buildPanel(this, "panel_overlaybar.xml", &factory_map);
+ LLUICtrlFactory::getInstance()->buildPanel(this, "panel_overlaybar.xml");
}
BOOL LLOverlayBar::postBuild()
{
- childSetAction("IM Received",onClickIMReceived,this);
childSetAction("Set Not Busy",onClickSetNotBusy,this);
- childSetAction("Release Keys",onClickReleaseKeys,this);
childSetAction("Mouselook",onClickMouselook,this);
childSetAction("Stand Up",onClickStandUp,this);
+ childSetAction("Flycam",onClickFlycam,this);
childSetVisible("chat_bar", gSavedSettings.getBOOL("ChatVisible"));
+ mVoiceRemote->expandOrCollapse();
+ mMediaRemote->expandOrCollapse();
+
setFocusRoot(TRUE);
mBuilt = true;
@@ -136,16 +125,6 @@ LLOverlayBar::~LLOverlayBar()
// LLView destructor cleans up children
}
-EWidgetType LLOverlayBar::getWidgetType() const
-{
- return WIDGET_TYPE_OVERLAY_BAR;
-}
-
-LLString LLOverlayBar::getWidgetTag() const
-{
- return LL_OVERLAY_BAR_TAG;
-}
-
// virtual
void LLOverlayBar::reshape(S32 width, S32 height, BOOL called_from_parent)
{
@@ -159,12 +138,12 @@ void LLOverlayBar::reshape(S32 width, S32 height, BOOL called_from_parent)
void LLOverlayBar::layoutButtons()
{
- LLView* state_buttons_panel = getChildByName("state_buttons", TRUE);
+ LLView* state_buttons_panel = getChildView("state_buttons");
- if (state_buttons_panel && state_buttons_panel->getVisible())
+ if (state_buttons_panel->getVisible())
{
LLViewQuery query;
- LLWidgetTypeFilter widget_filter(WIDGET_TYPE_BUTTON);
+ LLWidgetTypeFilter<LLButton> widget_filter;
query.addPreFilter(LLEnabledFilter::getInstance());
query.addPreFilter(&widget_filter);
@@ -175,8 +154,9 @@ void LLOverlayBar::layoutButtons()
// calculate button widths
const S32 MAX_BUTTON_WIDTH = 150;
+ const S32 STATUS_BAR_PAD = 10;
S32 segment_width = llclamp(lltrunc((F32)(bar_width) / (F32)button_list.size()), 0, MAX_BUTTON_WIDTH);
- S32 btn_width = segment_width - gSavedSettings.getS32("StatusBarPad");
+ S32 btn_width = segment_width - STATUS_BAR_PAD;
// Evenly space all buttons, starting from left
S32 left = 0;
@@ -200,7 +180,7 @@ void LLOverlayBar::refresh()
BOOL buttons_changed = FALSE;
BOOL im_received = gIMMgr->getIMReceived();
- LLButton* button = LLUICtrlFactory::getButtonByName(this, "IM Received");
+ LLButton* button = getChild<LLButton>("IM Received");
if (button && button->getVisible() != im_received)
{
button->setVisible(im_received);
@@ -210,7 +190,7 @@ void LLOverlayBar::refresh()
}
BOOL busy = gAgent.getBusy();
- button = LLUICtrlFactory::getButtonByName(this, "Set Not Busy");
+ button = getChild<LLButton>("Set Not Busy");
if (button && button->getVisible() != busy)
{
button->setVisible(busy);
@@ -219,21 +199,20 @@ void LLOverlayBar::refresh()
buttons_changed = TRUE;
}
- BOOL controls_grabbed = gAgent.anyControlGrabbed();
- button = LLUICtrlFactory::getButtonByName(this, "Release Keys");
-
- if (button && button->getVisible() != controls_grabbed)
+ BOOL flycam = LLViewerJoystick::getInstance()->getOverrideCamera();
+ button = getChild<LLButton>("Flycam");
+ if (button && button->getVisible() != flycam)
{
- button->setVisible(controls_grabbed);
+ button->setVisible(flycam);
sendChildToFront(button);
moveChildToBackOfTabGroup(button);
buttons_changed = TRUE;
- }
+ }
BOOL mouselook_grabbed;
mouselook_grabbed = gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX)
|| gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX);
- button = LLUICtrlFactory::getButtonByName(this, "Mouselook");
+ button = getChild<LLButton>("Mouselook");
if (button && button->getVisible() != mouselook_grabbed)
{
@@ -246,9 +225,9 @@ void LLOverlayBar::refresh()
BOOL sitting = FALSE;
if (gAgent.getAvatarObject())
{
- sitting = gAgent.getAvatarObject()->mIsSitting;
+ sitting = gAgent.getAvatarObject()->isSitting();
}
- button = LLUICtrlFactory::getButtonByName(this, "Stand Up");
+ button = getChild<LLButton>("Stand Up");
if (button && button->getVisible() != sitting)
{
@@ -273,7 +252,7 @@ void LLOverlayBar::refresh()
{
// update "remotes"
childSetVisible("media_remote_container", TRUE);
- childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled());
+ childSetVisible("voice_remote_container", LLVoiceClient::getInstance()->voiceEnabled());
childSetVisible("state_buttons", TRUE);
}
@@ -291,13 +270,6 @@ void LLOverlayBar::refresh()
//-----------------------------------------------------------------------
// static
-void LLOverlayBar::onClickIMReceived(void*)
-{
- gIMMgr->setFloaterOpen(TRUE);
-}
-
-
-// static
void LLOverlayBar::onClickSetNotBusy(void*)
{
gAgent.clearBusy();
@@ -305,9 +277,9 @@ void LLOverlayBar::onClickSetNotBusy(void*)
// static
-void LLOverlayBar::onClickReleaseKeys(void*)
+void LLOverlayBar::onClickFlycam(void*)
{
- gAgent.forceReleaseControls();
+ LLViewerJoystick::getInstance()->toggleFlycam();
}
// static
@@ -325,6 +297,7 @@ void LLOverlayBar::onClickMouselook(void*)
//static
void LLOverlayBar::onClickStandUp(void*)
{
+ LLSelectMgr::getInstance()->deselectAllForStandingUp();
gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);
}
@@ -336,7 +309,7 @@ void LLOverlayBar::mediaStop(void*)
{
if (!gOverlayBar)
{
- return;
+ // return;
}
LLViewerParcelMedia::stop();
}
@@ -345,21 +318,21 @@ void LLOverlayBar::toggleMediaPlay(void*)
{
if (!gOverlayBar)
{
- return;
+ // return;
}
- if (LLViewerMedia::isMediaPaused())
+ if (LLViewerParcelMedia::getStatus() == LLViewerMediaImpl::MEDIA_PAUSED)
{
LLViewerParcelMedia::start();
}
- else if(LLViewerMedia::isMediaPlaying())
+ else if(LLViewerParcelMedia::getStatus() == LLViewerMediaImpl::MEDIA_PLAYING)
{
LLViewerParcelMedia::pause();
}
else
{
- LLParcel* parcel = gParcelMgr->getAgentParcel();
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (parcel)
{
LLViewerParcelMedia::play(parcel);
@@ -370,24 +343,18 @@ void LLOverlayBar::toggleMediaPlay(void*)
//static
void LLOverlayBar::toggleMusicPlay(void*)
{
- if (!gOverlayBar)
- {
- return;
- }
-
- if (gOverlayBar->mMusicState != PLAYING)
+ if (gAudiop->isInternetStreamPlaying() != 1)
{
- gOverlayBar->mMusicState = PLAYING; // desired state
if (gAudiop)
{
- LLParcel* parcel = gParcelMgr->getAgentParcel();
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if ( parcel )
{
// this doesn't work properly when crossing parcel boundaries - even when the
// stream is stopped, it doesn't return the right thing - commenting out for now.
// if ( gAudiop->isInternetStreamPlaying() == 0 )
{
- gAudiop->startInternetStream(parcel->getMusicURL().c_str());
+ gAudiop->startInternetStream(parcel->getMusicURL());
}
}
}
@@ -402,7 +369,6 @@ void LLOverlayBar::toggleMusicPlay(void*)
//}
else
{
- gOverlayBar->mMusicState = STOPPED; // desired state
if (gAudiop)
{
gAudiop->stopInternetStream();