diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index 63faf44f9dc62fd5511436084e56add29f18280a..6a5b475134be8401fdb0d4391a591277a52f0833 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -54,6 +54,7 @@ void LLDockableFloater::init(LLDockableFloater* thiz) LLDockableFloater::LLDockableFloater(LLDockControl* dockControl, const LLSD& key, const Params& params) : LLFloater(key, params), mDockControl(dockControl), mUniqueDocking(true) + , mOverlapsScreenChannel(false) { init(this); } diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index 2c339f4a3f508ef10975f5fdf43a5144dc8c392a..2c0a484cc88a9838e55779b11066290b73873506 100644 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h @@ -85,6 +85,14 @@ class LLDockableFloater : public LLFloater LLDockControl* getDockControl(); + /** + * Returns true if screen channel should consider floater's size when drawing toasts. + * + * By default returns false. + */ + virtual bool overlapsScreenChannel() { return mOverlapsScreenChannel && getVisible() && isDocked(); } + virtual void setOverlapsScreenChannel(bool overlaps) { mOverlapsScreenChannel = overlaps; } + private: /** * Provides unique of dockable floater. @@ -105,6 +113,8 @@ class LLDockableFloater : public LLFloater * non exclusively. */ bool mUniqueDocking; + + bool mOverlapsScreenChannel; }; #endif /* LL_DOCKABLEFLOATER_H */ diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 0ce8d4b7cdf892ca2442d910a98f275abc08919d..259f629bdd343a40bf8f1523c5b114a872c5eb08 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -109,6 +109,7 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) default: break; } } + setOverlapsScreenChannel(true); } void LLIMFloater::onFocusLost() diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index c18fe8ad7e92a3dd64fc96500c92186a2d1bcfed..8c3f3dc5fb8229907e5068c2b725685e775c589a 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -462,6 +462,8 @@ void LLScreenChannel::showToastsBottom() S32 toast_margin = 0; std::vector<ToastElem>::reverse_iterator it; + LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get()); + for(it = mToastList.rbegin(); it != mToastList.rend(); ++it) { if(it != mToastList.rbegin()) @@ -474,6 +476,16 @@ void LLScreenChannel::showToastsBottom() toast_rect.setOriginAndSize(getRect().mLeft, bottom + toast_margin, toast_rect.getWidth() ,toast_rect.getHeight()); (*it).toast->setRect(toast_rect); + // don't show toasts if there is not enough space + if(floater && floater->overlapsScreenChannel()) + { + LLRect world_rect = gViewerWindow->getWorldViewRectScaled(); + if(toast_rect.mTop + getOverflowToastHeight() + toast_margin > world_rect.mTop) + { + break; + } + } + bool stop_showing_toasts = (*it).toast->getRect().mTop > getRect().mTop; if(!stop_showing_toasts) @@ -575,6 +587,18 @@ void LLScreenChannel::createOverflowToast(S32 bottom, F32 timer) toast_rect.setLeftTopAndSize(getRect().mLeft, bottom + toast_rect.getHeight()+gSavedSettings.getS32("ToastGap"), getRect().getWidth(), toast_rect.getHeight()); mOverflowToastPanel->setRect(toast_rect); + // don't show overflow toast if there is not enough space for it. + LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get()); + if(floater && floater->overlapsScreenChannel()) + { + LLRect world_rect = gViewerWindow->getWorldViewRectScaled(); + if(toast_rect.mTop > world_rect.mTop) + { + closeOverflowToastPanel(); + return; + } + } + text_box->setValue(text); text_box->setVisible(TRUE); @@ -664,6 +688,24 @@ F32 LLScreenChannel::getHeightRatio() return ratio; } +S32 LLScreenChannel::getOverflowToastHeight() +{ + if(mOverflowToastPanel) + { + return mOverflowToastPanel->getRect().getHeight(); + } + + static S32 height = 0; + if(0 == height) + { + LLToast::Params p; + LLToast* toast = new LLToast(p); + height = toast->getRect().getHeight(); + delete toast; + } + return height; +} + //-------------------------------------------------------------------------- void LLScreenChannel::updateStartUpString(S32 num) { @@ -822,25 +864,22 @@ void LLScreenChannel::updateShowToastsState() return; } - // for Message Well floater showed in a docked state - adjust channel's height - if(dynamic_cast<LLSysWellWindow*>(floater) || dynamic_cast<LLIMFloater*>(floater) - || dynamic_cast<LLScriptFloater*>(floater)) + S32 channel_bottom = gViewerWindow->getWorldViewRectScaled().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");; + LLRect this_rect = getRect(); + + // adjust channel's height + if(floater->overlapsScreenChannel()) { - S32 channel_bottom = gViewerWindow->getWorldViewRectScaled().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");; - LLRect this_rect = getRect(); - if(floater->getVisible() && floater->isDocked()) + channel_bottom += floater->getRect().getHeight(); + if(floater->getDockControl()) { - channel_bottom += floater->getRect().getHeight(); - if(floater->getDockControl()) - { - channel_bottom += floater->getDockControl()->getTongueHeight(); - } + channel_bottom += floater->getDockControl()->getTongueHeight(); } + } - if(channel_bottom != this_rect.mBottom) - { - setRect(LLRect(this_rect.mLeft, this_rect.mTop, this_rect.mRight, channel_bottom)); - } + if(channel_bottom != this_rect.mBottom) + { + setRect(LLRect(this_rect.mLeft, this_rect.mTop, this_rect.mRight, channel_bottom)); } } diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h index 321fb244a1bdf209a8a7376c5e65689674d283eb..38f27f756b6e1269709a75ee490610bbfba5d33b 100644 --- a/indra/newview/llscreenchannel.h +++ b/indra/newview/llscreenchannel.h @@ -281,6 +281,8 @@ class LLScreenChannel : public LLScreenChannelBase */ static F32 getHeightRatio(); + S32 getOverflowToastHeight(); + // Channel's flags static bool mWasStartUpToastShown; diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index 1962d871a6bdc0d5795b112bfef00e9d5a7e7a21..cf62d473620a6598235d34a079f82b6d828762f3 100644 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -67,6 +67,7 @@ LLScriptFloater::LLScriptFloater(const LLSD& key) , mScriptForm(NULL) { setMouseDownCallback(boost::bind(&LLScriptFloater::onMouseDown, this)); + setOverlapsScreenChannel(true); } bool LLScriptFloater::toggle(const LLUUID& object_id) diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 3cddf6d902cd542a77055ffaf070ef6c8a4dfb28..bcaefc3690908623bcda5522e50be87583cc14f2 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -63,6 +63,7 @@ LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLDockableFloater(NULL, key) { mTypedItemsCount[IT_NOTIFICATION] = 0; mTypedItemsCount[IT_INSTANT_MESSAGE] = 0; + setOverlapsScreenChannel(true); } //---------------------------------------------------------------------------------