summaryrefslogtreecommitdiff
path: root/indra/newview/llscreenchannel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llscreenchannel.cpp')
-rw-r--r--indra/newview/llscreenchannel.cpp69
1 files changed, 38 insertions, 31 deletions
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index a3b0574bca..71b6c18d8f 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -48,29 +48,38 @@ using namespace LLNotificationsUI;
bool LLScreenChannel::mWasStartUpToastShown = false;
+
+LLRect get_channel_rect()
+{
+ LLRect channel_rect;
+ LLView* floater_snap_region = LLUI::getRootView()->getChildView("floater_snap_region");
+ floater_snap_region->localRectToScreen(floater_snap_region->getLocalRect(), &channel_rect);
+ return channel_rect;
+}
+
+
//--------------------------------------------------------------------------
//////////////////////
// LLScreenChannelBase
//////////////////////
-LLScreenChannelBase::LLScreenChannelBase(const LLUUID& id) :
- mToastAlignment(NA_BOTTOM)
- ,mCanStoreToasts(true)
- ,mHiddenToastsNum(0)
- ,mHoveredToast(NULL)
- ,mControlHovering(false)
- ,mShowToasts(true)
+LLScreenChannelBase::LLScreenChannelBase(const Params& p)
+: LLUICtrl(p),
+ mToastAlignment(p.toast_align),
+ mCanStoreToasts(true),
+ mHiddenToastsNum(0),
+ mHoveredToast(NULL),
+ mControlHovering(false),
+ mShowToasts(true),
+ mID(p.id),
+ mDisplayToastsAlways(p.display_toasts_always),
+ mChannelAlignment(p.channel_align)
{
- mID = id;
- mWorldViewRectConnection = gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLScreenChannelBase::updatePositionAndSize, this, _1, _2));
+ mID = p.id;
setMouseOpaque( false );
setVisible(FALSE);
}
-LLScreenChannelBase::~LLScreenChannelBase()
-{
- mWorldViewRectConnection.disconnect();
-}
bool LLScreenChannelBase::isHovering()
{
@@ -82,21 +91,20 @@ bool LLScreenChannelBase::isHovering()
return mHoveredToast->isHovered();
}
-void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect)
+void LLScreenChannelBase::updatePositionAndSize(LLRect rect)
{
- S32 top_delta = old_world_rect.mTop - new_world_rect.mTop;
LLRect this_rect = getRect();
- this_rect.mTop -= top_delta;
+ this_rect.mTop = rect.mTop;
switch(mChannelAlignment)
{
case CA_LEFT :
break;
case CA_CENTRE :
- this_rect.setCenterAndSize( (new_world_rect.getWidth()) / 2, new_world_rect.getHeight() / 2, this_rect.getWidth(), this_rect.getHeight());
+ this_rect.setCenterAndSize( (rect.getWidth()) / 2, rect.getHeight() / 2, this_rect.getWidth(), this_rect.getHeight());
break;
case CA_RIGHT :
- this_rect.setLeftTopAndSize(new_world_rect.mRight - this_rect.getWidth(),
+ this_rect.setLeftTopAndSize(rect.mRight - this_rect.getWidth(),
this_rect.mTop,
this_rect.getWidth(),
this_rect.getHeight());
@@ -116,31 +124,30 @@ void LLScreenChannelBase::init(S32 channel_left, S32 channel_right)
void LLScreenChannelBase::updateBottom()
{
- S32 channel_top = gViewerWindow->getWorldViewRectScaled().getHeight();
- S32 channel_bottom = gSavedSettings.getS32("ChannelBottomPanelMargin");
+ S32 channel_top = get_channel_rect().mTop;
+ S32 channel_bottom = get_channel_rect().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");
S32 channel_left = getRect().mLeft;
S32 channel_right = getRect().mRight;
setRect(LLRect(channel_left, channel_top, channel_right, channel_bottom));
}
-
//--------------------------------------------------------------------------
//////////////////////
// LLScreenChannel
//////////////////////
//--------------------------------------------------------------------------
-LLScreenChannel::LLScreenChannel(LLUUID& id):
-LLScreenChannelBase(id)
-,mStartUpToastPanel(NULL)
-{
+LLScreenChannel::LLScreenChannel(const Params& p)
+: LLScreenChannelBase(p),
+ mStartUpToastPanel(NULL)
+{
}
//--------------------------------------------------------------------------
void LLScreenChannel::init(S32 channel_left, S32 channel_right)
{
LLScreenChannelBase::init(channel_left, channel_right);
- LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
- updatePositionAndSize(world_rect, world_rect);
+ LLRect channel_rect = get_channel_rect();
+ updatePositionAndSize(channel_rect);
}
//--------------------------------------------------------------------------
@@ -177,7 +184,7 @@ std::list<LLToast*> LLScreenChannel::findToasts(const Matcher& matcher)
}
//--------------------------------------------------------------------------
-void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect)
+void LLScreenChannel::updatePositionAndSize(LLRect new_world_rect)
{
LLRect this_rect = getRect();
@@ -187,7 +194,7 @@ void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_wo
this_rect.mTop = (S32) (new_world_rect.getHeight() * getHeightRatio());
break;
case CA_CENTRE :
- LLScreenChannelBase::updatePositionAndSize(old_world_rect, new_world_rect);
+ LLScreenChannelBase::updatePositionAndSize(new_world_rect);
return;
case CA_RIGHT :
this_rect.mTop = (S32) (new_world_rect.getHeight() * getHeightRatio());
@@ -511,9 +518,9 @@ void LLScreenChannel::showToastsBottom()
(*it).toast->translate(0, shift);
}
- LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
+ LLRect channel_rect = get_channel_rect();
// don't show toasts if there is not enough space
- if(toast_rect.mTop > world_rect.mTop)
+ if(toast_rect.mTop > channel_rect.mTop)
{
break;
}