summaryrefslogtreecommitdiff
path: root/indra/newview/llstatusbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llstatusbar.cpp')
-rw-r--r--indra/newview/llstatusbar.cpp53
1 files changed, 22 insertions, 31 deletions
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 732c23982b..9206b4a43a 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -239,20 +239,16 @@ BOOL LLStatusBar::postBuild()
childSetActionTextbox("stat_btn", onClickStatGraph);
- LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder");
-
mPanelVolumePulldown = new LLPanelVolumePulldown();
- popup_holder->addChild(mPanelVolumePulldown);
+ addChild(mPanelVolumePulldown);
+ mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
+ mPanelVolumePulldown->setVisible(FALSE);
mPanelNearByMedia = new LLPanelNearByMedia();
- popup_holder->addChild(mPanelNearByMedia);
- gViewerWindow->getRootView()->addMouseDownCallback(boost::bind(&LLStatusBar::onClickScreen, this, _1, _2));
+ addChild(mPanelNearByMedia);
mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
mPanelNearByMedia->setVisible(FALSE);
- mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
- mPanelVolumePulldown->setVisible(FALSE);
-
return TRUE;
}
@@ -360,12 +356,14 @@ void LLStatusBar::refresh()
// Disable media toggle if there's no media, parcel media, and no parcel audio
// (or if media is disabled)
- mMediaToggle->setEnabled(gSavedSettings.getBOOL("AudioStreamingMedia") &&
- (LLViewerMedia::hasInWorldMedia() || LLViewerMedia::hasParcelMedia() || LLViewerMedia::hasParcelAudio()));
+ bool button_enabled = (gSavedSettings.getBOOL("AudioStreamingMusic")||gSavedSettings.getBOOL("AudioStreamingMedia")) &&
+ (LLViewerMedia::hasInWorldMedia() || LLViewerMedia::hasParcelMedia() || LLViewerMedia::hasParcelAudio());
+ mMediaToggle->setEnabled(button_enabled);
// Note the "sense" of the toggle is opposite whether media is playing or not
- mMediaToggle->setValue(! (LLViewerMedia::isAnyMediaShowing() ||
+ bool any_media_playing = (LLViewerMedia::isAnyMediaShowing() ||
LLViewerMedia::isParcelMediaPlaying() ||
- LLViewerMedia::isParcelAudioPlaying()));
+ LLViewerMedia::isParcelAudioPlaying());
+ mMediaToggle->setValue(!any_media_playing);
}
void LLStatusBar::setVisibleForMouselook(bool visible)
@@ -526,11 +524,11 @@ static void onClickScriptDebug(void*)
void LLStatusBar::onMouseEnterVolume()
{
LLButton* volbtn = getChild<LLButton>( "volume_btn" );
- LLRect vol_btn_screen_rect = volbtn->calcScreenRect();
+ LLRect vol_btn_rect = volbtn->getRect();
LLRect volume_pulldown_rect = mPanelVolumePulldown->getRect();
- volume_pulldown_rect.setLeftTopAndSize(vol_btn_screen_rect.mLeft -
- (volume_pulldown_rect.getWidth() - vol_btn_screen_rect.getWidth())/2,
- vol_btn_screen_rect.mBottom,
+ volume_pulldown_rect.setLeftTopAndSize(vol_btn_rect.mLeft -
+ (volume_pulldown_rect.getWidth() - vol_btn_rect.getWidth())/2,
+ vol_btn_rect.mBottom,
volume_pulldown_rect.getWidth(),
volume_pulldown_rect.getHeight());
@@ -538,8 +536,10 @@ void LLStatusBar::onMouseEnterVolume()
// show the master volume pull-down
- mPanelVolumePulldown->setVisible(TRUE);
+ LLUI::clearPopups();
+ LLUI::addPopup(mPanelVolumePulldown);
mPanelNearByMedia->setVisible(FALSE);
+ mPanelVolumePulldown->setVisible(TRUE);
}
void LLStatusBar::onMouseEnterNearbyMedia()
@@ -547,7 +547,7 @@ void LLStatusBar::onMouseEnterNearbyMedia()
LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder");
LLRect nearby_media_rect = mPanelNearByMedia->getRect();
LLButton* nearby_media_btn = getChild<LLButton>( "media_toggle_btn" );
- LLRect nearby_media_btn_rect = nearby_media_btn->calcScreenRect();
+ LLRect nearby_media_btn_rect = nearby_media_btn->getRect();
nearby_media_rect.setLeftTopAndSize(nearby_media_btn_rect.mLeft -
(nearby_media_rect.getWidth() - nearby_media_btn_rect.getWidth())/2,
nearby_media_btn_rect.mBottom,
@@ -558,8 +558,11 @@ void LLStatusBar::onMouseEnterNearbyMedia()
// show the master volume pull-down
mPanelNearByMedia->setShape(nearby_media_rect);
- mPanelNearByMedia->setVisible(TRUE);
+ LLUI::clearPopups();
+ LLUI::addPopup(mPanelNearByMedia);
+
mPanelVolumePulldown->setVisible(FALSE);
+ mPanelNearByMedia->setVisible(TRUE);
}
@@ -648,18 +651,6 @@ void LLStatusBar::onClickStatGraph(void* data)
LLFloaterReg::showInstance("lagmeter");
}
-void LLStatusBar::onClickScreen(S32 x, S32 y)
-{
- if (mPanelNearByMedia->getVisible())
- {
- LLRect screen_rect = mPanelNearByMedia->calcScreenRect();
- if (!screen_rect.pointInRect(x, y))
- {
- mPanelNearByMedia->setVisible(FALSE);
- }
- }
-}
-
BOOL can_afford_transaction(S32 cost)
{
return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost)));