From e159873eec4137b041fc8045f6d79ac6c21d2101 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 12 Feb 2010 16:54:47 -0800 Subject: added popup panel to hold nearby media popup and stopped using top view --- indra/llui/lltooltip.cpp | 6 --- indra/llui/lltooltip.h | 2 - indra/newview/llpanelnearbymedia.cpp | 23 +++++++++--- indra/newview/llrootview.h | 1 + indra/newview/llstatusbar.cpp | 47 ++++++++++++++++-------- indra/newview/llstatusbar.h | 1 + indra/newview/llviewerwindow.cpp | 1 + indra/newview/skins/default/xui/en/main_view.xml | 6 +++ 8 files changed, 57 insertions(+), 30 deletions(-) diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 173fde8e76..ed7fd02e14 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -129,12 +129,6 @@ BOOL LLToolTipView::handleScrollWheel( S32 x, S32 y, S32 clicks ) return FALSE; } -void LLToolTipView::onMouseLeave(S32 x, S32 y, MASK mask) -{ - LLToolTipMgr::instance().blockToolTips(); -} - - void LLToolTipView::drawStickyRect() { gl_rect_2d(LLToolTipMgr::instance().getMouseNearRect(), LLColor4::white, false); diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index c0811c56c3..24e32b9b24 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -56,8 +56,6 @@ public: /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); - /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - void drawStickyRect(); /*virtual*/ void draw(); diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index 3480abcf40..9753fd9b54 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -184,22 +184,26 @@ void LLPanelNearByMedia::handleVisibilityChange ( BOOL new_visibility ) if (new_visibility) { mHoverTimer.start(); // timer will be stopped when mouse hovers over panel - gFocusMgr.setTopCtrl(this); + //gFocusMgr.setTopCtrl(this); } else { mHoverTimer.stop(); - if (gFocusMgr.getTopCtrl() == this) - { - gFocusMgr.setTopCtrl(NULL); - } + //if (gFocusMgr.getTopCtrl() == this) + //{ + // gFocusMgr.setTopCtrl(NULL); + //} } } /*virtual*/ void LLPanelNearByMedia::onTopLost () { - setVisible(FALSE); + //LLUICtrl* new_top = gFocusMgr.getTopCtrl(); + //if (!new_top || !new_top->hasAncestor(this)) + //{ + // setVisible(FALSE); + //} } /*virtual*/ @@ -220,6 +224,13 @@ const F32 AUTO_CLOSE_FADE_TIME_END = 5.0f; void LLPanelNearByMedia::draw() { + //LLUICtrl* new_top = gFocusMgr.getTopCtrl(); + //if (new_top != this) + //{ + // // reassert top ctrl + // gFocusMgr.setTopCtrl(this); + //} + // keep bottom of panel on screen LLRect screen_rect = calcScreenRect(); if (screen_rect.mBottom < 0) diff --git a/indra/newview/llrootview.h b/indra/newview/llrootview.h index 760b1a7a4c..38029e3a9d 100644 --- a/indra/newview/llrootview.h +++ b/indra/newview/llrootview.h @@ -35,6 +35,7 @@ #include "llview.h" #include "lluictrlfactory.h" +#include "lltooltip.h" class LLRootViewRegistry : public LLChildRegistry {}; diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 025f03dc5a..5423b3e99f 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -50,6 +50,7 @@ #include "llkeyboard.h" #include "lllineeditor.h" #include "llmenugl.h" +#include "llrootview.h" #include "llsd.h" #include "lltextbox.h" #include "llui.h" @@ -242,7 +243,11 @@ BOOL LLStatusBar::postBuild() addChild(mPanelVolumePulldown); mPanelNearByMedia = new LLPanelNearByMedia(); - addChild(mPanelNearByMedia); + LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); + popup_holder->addChild(mPanelNearByMedia); + gViewerWindow->getRootView()->addMouseDownCallback(boost::bind(&LLStatusBar::onClickScreen, this, _1, _2)); + mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); + mPanelNearByMedia->setVisible(FALSE); LLRect volume_pulldown_rect = mPanelVolumePulldown->getRect(); LLButton* volbtn = getChild( "volume_btn" ); @@ -256,21 +261,6 @@ BOOL LLStatusBar::postBuild() mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); mPanelVolumePulldown->setVisible(FALSE); - LLRect nearby_media_rect = mPanelNearByMedia->getRect(); - LLButton* nearby_media_btn = getChild( "media_toggle_btn" ); - nearby_media_rect.setLeftTopAndSize(nearby_media_btn->getRect().mLeft - - (volume_pulldown_rect.getWidth() - nearby_media_btn->getRect().getWidth())/2, - nearby_media_btn->calcScreenRect().mBottom, - nearby_media_rect.getWidth(), - nearby_media_rect.getHeight()); - // force onscreen - nearby_media_rect.translate(getRect().getWidth() - nearby_media_rect.mRight, 0); - - mPanelNearByMedia->setShape(nearby_media_rect); - mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); - mPanelNearByMedia->setVisible(FALSE); - - return TRUE; } @@ -542,7 +532,20 @@ void LLStatusBar::onMouseEnterVolume() void LLStatusBar::onMouseEnterNearbyMedia() { + LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); + LLRect nearby_media_rect = mPanelNearByMedia->getRect(); + LLButton* nearby_media_btn = getChild( "media_toggle_btn" ); + LLRect nearby_media_btn_rect = nearby_media_btn->calcScreenRect(); + nearby_media_rect.setLeftTopAndSize(nearby_media_btn_rect.mLeft - + (nearby_media_rect.getWidth() - nearby_media_btn_rect.getWidth())/2, + nearby_media_btn_rect.mBottom, + nearby_media_rect.getWidth(), + nearby_media_rect.getHeight()); + // force onscreen + nearby_media_rect.translate(popup_holder->getRect().getWidth() - nearby_media_rect.mRight, 0); + // show the master volume pull-down + mPanelNearByMedia->setShape(nearby_media_rect); mPanelNearByMedia->setVisible(TRUE); } @@ -631,6 +634,18 @@ 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))); diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index c37c27299f..e5240fcc3e 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -99,6 +99,7 @@ private: void onMouseEnterVolume(); void onMouseEnterNearbyMedia(); + void onClickScreen(S32 x, S32 y); static void onClickStatGraph(void* data); static void onClickMediaToggle(void* data); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index b76a2e150f..f258be0397 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -982,6 +982,7 @@ void LLViewerWindow::handleMouseLeave(LLWindow *window) // Note: we won't get this if we have captured the mouse. llassert( gFocusMgr.getMouseCapture() == NULL ); mMouseInWindow = FALSE; + LLToolTipMgr::instance().blockToolTips(); } BOOL LLViewerWindow::handleCloseRequest(LLWindow *window) diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index 1d4377e339..7b6081d7be 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -162,6 +162,12 @@ mouse_opaque="false" name="Menu Holder" width="1024"/> +