From e6210e82d3e8794a55f7bd3d7ef01f1fbcdeea0e Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Tue, 8 Dec 2009 12:17:10 +0200
Subject: [PATCH] Update for normal task EXT-3089 - Notification toasts
 positioning, layering and stacking. Improved functionality, cleaned code.

--HG--
branch : product-engine
---
 indra/llui/lldockablefloater.h          |  3 ++-
 indra/llui/lldockcontrol.h              |  3 +++
 indra/newview/app_settings/settings.xml |  2 +-
 indra/newview/llimfloater.cpp           |  1 +
 indra/newview/llscreenchannel.cpp       | 27 ++++++++-----------------
 indra/newview/llscreenchannel.h         |  3 +++
 indra/newview/llsyswellwindow.cpp       |  1 +
 7 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h
index 46491d8a29e..2c339f4a3f5 100644
--- a/indra/llui/lldockablefloater.h
+++ b/indra/llui/lldockablefloater.h
@@ -83,6 +83,8 @@ class LLDockableFloater : public LLFloater
 	virtual void onDockHidden();
 	virtual void onDockShown();
 
+	LLDockControl* getDockControl();
+
 private:
 	/**
 	 * Provides unique of dockable floater.
@@ -92,7 +94,6 @@ class LLDockableFloater : public LLFloater
 
 protected:
 	void setDockControl(LLDockControl* dockControl);
-	LLDockControl* getDockControl();
 	const LLUIImagePtr& getDockTongue();
 
 private:
diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h
index 30a45bedc74..550955c4c53 100644
--- a/indra/llui/lldockcontrol.h
+++ b/indra/llui/lldockcontrol.h
@@ -76,6 +76,9 @@ class LLDockControl
 	// gets a rect that bounds possible positions for a dockable control (EXT-1111)
 	void getAllowedRect(LLRect& rect);
 
+	S32 getTongueWidth() { return mDockTongue->getWidth(); }
+	S32 getTongueHeight() { return mDockTongue->getHeight(); }
+
 private:
 	virtual void moveDockable();
 private:
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 20d81362fdb..08a65461b68 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -5033,7 +5033,7 @@
     <key>NotificationChannelHeightRatio</key>
     <map>
       <key>Comment</key>
-      <string>TODO</string>
+      <string>Notification channel and World View ratio(0.0 - always show 1 notification, 1.0 - max ratio).</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 36c40eb49b4..40ae112e4bb 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -415,6 +415,7 @@ void LLIMFloater::setDocked(bool docked, bool pop_on_undock)
 	if(channel)
 	{
 		channel->updateShowToastsState();
+		channel->redrawToasts();
 	}
 }
 
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index 87752e31f52..a1ea7aeb96e 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -375,12 +375,6 @@ void LLScreenChannel::modifyToastByNotificationID(LLUUID id, LLPanel* panel)
 	}
 }
 
-void LLScreenChannel::onVisibleChanged(LLUICtrl* ctrl, const LLSD& param)
-{
-	updateShowToastsState();
-	redrawToasts();
-}
-
 //--------------------------------------------------------------------------
 void LLScreenChannel::redrawToasts()
 {
@@ -446,17 +440,11 @@ void LLScreenChannel::showToastsBottom()
 
 		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);
 		}		
 	}
 
@@ -774,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)
 	{
@@ -791,7 +779,8 @@ void LLScreenChannel::updateShowToastsState()
 		LLRect this_rect = getRect();
 		if(floater->getVisible() && floater->isDocked())
 		{
-			channel_bottom = floater->getRect().mTop + gSavedSettings.getS32("ToastGap");
+			channel_bottom += floater->getRect().getHeight();
+			channel_bottom += floater->getDockControl()->getTongueHeight();
 		}
 
 		if(channel_bottom != this_rect.mBottom)
diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h
index e384b17a0cd..3b0ee2050cc 100644
--- a/indra/newview/llscreenchannel.h
+++ b/indra/newview/llscreenchannel.h
@@ -265,6 +265,9 @@ class LLScreenChannel : public LLScreenChannelBase
 	// create the StartUp Toast
 	void	createStartUpToast(S32 notif_num, F32 timer);
 
+	/**
+	 * Notification channel and World View ratio(0.0 - always show 1 notification, 1.0 - max ratio).
+	 */
 	static F32 getHeightRatio();
 
 	// Channel's flags
diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp
index 26caf0be694..28bdfbf2712 100644
--- a/indra/newview/llsyswellwindow.cpp
+++ b/indra/newview/llsyswellwindow.cpp
@@ -189,6 +189,7 @@ void LLSysWellWindow::setDocked(bool docked, bool pop_on_undock)
 	if(mChannel)
 	{
 		mChannel->updateShowToastsState();
+		mChannel->redrawToasts();
 	}
 }
 
-- 
GitLab