diff options
Diffstat (limited to 'indra/newview/llscreenchannel.cpp')
-rw-r--r-- | indra/newview/llscreenchannel.cpp | 79 |
1 files changed, 52 insertions, 27 deletions
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 4f0c873c61..64f57f24f9 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -125,6 +125,8 @@ LLScreenChannelBase(id) 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); } //-------------------------------------------------------------------------- @@ -136,7 +138,23 @@ LLScreenChannel::~LLScreenChannel() //-------------------------------------------------------------------------- void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect) { - LLScreenChannelBase::updatePositionAndSize(old_world_rect, new_world_rect); + S32 right_delta = old_world_rect.mRight - new_world_rect.mRight; + LLRect this_rect = getRect(); + + this_rect.mTop = (S32) (new_world_rect.getHeight() * getHeightRatio()); + 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()); + break; + case CA_RIGHT : + this_rect.mLeft -= right_delta; + this_rect.mRight -= right_delta; + } + setRect(this_rect); + redrawToasts(); } //-------------------------------------------------------------------------- @@ -169,6 +187,7 @@ void LLScreenChannel::addToast(const LLToast::Params& p) if(show_toast) { mToastList.push_back(new_toast_elem); + updateShowToastsState(); redrawToasts(); } else // store_toast @@ -405,26 +424,27 @@ void LLScreenChannel::showToastsBottom() { if( it != mToastList.rend()-1) { - stop_showing_toasts = ((*it).toast->getRect().mTop + gSavedSettings.getS32("OverflowToastHeight") + gSavedSettings.getS32("ToastGap")) > getRect().mTop; + S32 toast_top = (*it).toast->getRect().mTop + gSavedSettings.getS32("ToastGap"); + stop_showing_toasts = toast_top > getRect().mTop; } } + // at least one toast should be visible + if(it == mToastList.rbegin()) + { + stop_showing_toasts = false; + } + if(stop_showing_toasts) break; if( !(*it).toast->getVisible() ) { - if((*it).toast->isFirstLook()) - { - (*it).toast->setVisible(TRUE); - } - else - { - // HACK - // EXT-2653: it is necessary to prevent overlapping for secondary showed toasts - (*it).toast->setVisible(TRUE); - gFloaterView->sendChildToBack((*it).toast); - } + // HACK + // EXT-2653: it is necessary to prevent overlapping for secondary showed toasts + (*it).toast->setVisible(TRUE); + // Show toast behind floaters. (EXT-3089) + gFloaterView->sendChildToBack((*it).toast); } } @@ -566,6 +586,21 @@ void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer) mStartUpToastPanel->setVisible(TRUE); } +// static -------------------------------------------------------------------------- +F32 LLScreenChannel::getHeightRatio() +{ + F32 ratio = gSavedSettings.getF32("NotificationChannelHeightRatio"); + if(0.0f > ratio) + { + ratio = 0.0f; + } + else if(1.0f < ratio) + { + ratio = 1.0f; + } + return ratio; +} + //-------------------------------------------------------------------------- void LLScreenChannel::updateStartUpString(S32 num) { @@ -727,7 +762,7 @@ void LLScreenChannel::onToastHover(LLToast* toast, bool mouse_enter) //-------------------------------------------------------------------------- void LLScreenChannel::updateShowToastsState() { - LLFloater* floater = LLDockableFloater::getInstanceHandle().get(); + LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get()); if(!floater) { @@ -735,27 +770,17 @@ void LLScreenChannel::updateShowToastsState() return; } - // for IM floaters showed in a docked state - prohibit showing of ani toast - if(dynamic_cast<LLIMFloater*>(floater) - || dynamic_cast<LLScriptFloater*>(floater) ) - { - setShowToasts(!(floater->getVisible() && floater->isDocked())); - if (!getShowToasts()) - { - removeAndStoreAllStorableToasts(); - } - } - // *TODO: mantipov: what we have to do with derived classes: LLNotificationWellWindow & LLIMWelWindow? // See EXT-3081 for details // for Message Well floater showed in a docked state - adjust channel's height - if(dynamic_cast<LLSysWellWindow*>(floater)) + if(dynamic_cast<LLSysWellWindow*>(floater) || dynamic_cast<LLIMFloater*>(floater)) { S32 channel_bottom = gViewerWindow->getWorldViewRectScaled().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");; LLRect this_rect = getRect(); if(floater->getVisible() && floater->isDocked()) { - channel_bottom += (floater->getRect().getHeight() + gSavedSettings.getS32("ToastGap")); + channel_bottom += floater->getRect().getHeight(); + channel_bottom += floater->getDockControl()->getTongueHeight(); } if(channel_bottom != this_rect.mBottom) |