From 338914bd7d7e776d3ca5a4eb9a579fcbe53cf1b9 Mon Sep 17 00:00:00 2001
From: Paul ProductEngine <pguslisty@productengine.com>
Date: Mon, 24 Oct 2011 14:17:15 +0200
Subject: [PATCH] EXP-1400 FIXED (Call request docking icon overlays other
 toolbar buttons when speak button in side toolbar)

- LLDockableFloater::getDockTongue to init dock tongue with proper image depending on floater dock side, also added images for left and right tongues.

- Added proper call floater positioning relatively to the speak button
---
 indra/llui/lldockablefloater.cpp              |  15 +++++-
 indra/llui/lldockablefloater.h                |   2 +-
 indra/llui/lldockcontrol.cpp                  |  43 +++++++++++-------
 indra/llui/lldockcontrol.h                    |   1 +
 indra/newview/llimview.cpp                    |  19 +++++++-
 indra/newview/llimview.h                      |   5 +-
 .../default/textures/windows/Flyout_Left.png  | Bin 0 -> 271 bytes
 .../default/textures/windows/Flyout_Right.png | Bin 0 -> 280 bytes
 .../default/xui/en/floater_outgoing_call.xml  |   1 +
 9 files changed, 66 insertions(+), 20 deletions(-)
 create mode 100644 indra/newview/skins/default/textures/windows/Flyout_Left.png
 create mode 100644 indra/newview/skins/default/textures/windows/Flyout_Right.png

diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp
index aea58be12af..0fcd9373618 100644
--- a/indra/llui/lldockablefloater.cpp
+++ b/indra/llui/lldockablefloater.cpp
@@ -239,8 +239,21 @@ void LLDockableFloater::setDockControl(LLDockControl* dockControl)
 	setDocked(isDocked());
 }
 
-const LLUIImagePtr& LLDockableFloater::getDockTongue()
+const LLUIImagePtr& LLDockableFloater::getDockTongue(LLDockControl::DocAt dock_side)
 {
+	switch(dock_side)
+	{
+	case LLDockControl::LEFT:
+		mDockTongue = LLUI::getUIImage("windows/Flyout_Left.png");
+		break;
+	case LLDockControl::RIGHT:
+		mDockTongue = LLUI::getUIImage("windows/Flyout_Right.png");
+		break;
+	default:
+		mDockTongue = LLUI::getUIImage("windows/Flyout_Pointer.png");
+		break;
+	}
+
 	return mDockTongue;
 }
 
diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h
index 1484ea39784..89c9852f4af 100644
--- a/indra/llui/lldockablefloater.h
+++ b/indra/llui/lldockablefloater.h
@@ -124,7 +124,7 @@ class LLDockableFloater : public LLFloater
 
 protected:
 	void setDockControl(LLDockControl* dockControl);
-	const LLUIImagePtr& getDockTongue();
+	const LLUIImagePtr& getDockTongue(LLDockControl::DocAt dock_side = LLDockControl::TOP);
 
 	// Checks if docking should be forced.
 	// It may be useful e.g. if floater created in mouselook mode (see EXT-5609)
diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp
index 6397bbd0dec..8cb2e57b982 100644
--- a/indra/llui/lldockcontrol.cpp
+++ b/indra/llui/lldockcontrol.cpp
@@ -203,21 +203,33 @@ void LLDockControl::moveDockable()
 	switch (mDockAt)
 	{
 	case LEFT:
-		x = dockRect.mLeft;
-		y = dockRect.mTop + mDockTongue->getHeight() + dockableRect.getHeight();
-		// check is dockable inside root view rect
-		if (x < rootRect.mLeft)
+
+		x = dockRect.mLeft - dockableRect.getWidth();
+		y = dockRect.getCenterY() + dockableRect.getHeight() / 2;
+		
+		if (use_tongue)
 		{
-			x = rootRect.mLeft;
+			x -= mDockTongue->getWidth();
 		}
-		if (x + dockableRect.getWidth() > rootRect.mRight)
+
+		mDockTongueX = dockableRect.mRight;
+		mDockTongueY = dockableRect.getCenterY() - mDockTongue->getHeight() / 2;
+		
+		break;
+
+	case RIGHT:
+
+		x = dockRect.mRight;
+		y = dockRect.getCenterY() + dockableRect.getHeight() / 2;
+
+		if (use_tongue)
 		{
-			x = rootRect.mRight - dockableRect.getWidth();
+			x += mDockTongue->getWidth();
 		}
-		
-		mDockTongueX = x + dockableRect.getWidth()/2 - mDockTongue->getWidth() / 2;
-		
-		mDockTongueY = dockRect.mTop;
+
+		mDockTongueX = dockRect.mRight;
+		mDockTongueY = dockableRect.getCenterY() - mDockTongue->getHeight() / 2;
+
 		break;
 
 	case TOP:
@@ -315,13 +327,12 @@ void LLDockControl::moveDockable()
 		dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(),
 				dockableRect.getHeight());
 	}
+
 	LLRect localDocableParentRect;
-	mDockableFloater->getParent()->screenRectToLocal(dockableRect,
-			&localDocableParentRect);
-	mDockableFloater->setRect(localDocableParentRect);
 
-	mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY,
-			&mDockTongueX, &mDockTongueY);
+	mDockableFloater->getParent()->screenRectToLocal(dockableRect, &localDocableParentRect);
+	mDockableFloater->setRect(localDocableParentRect);
+	mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY, &mDockTongueX, &mDockTongueY);
 
 }
 
diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h
index 2e7359245f3..463223fafd5 100644
--- a/indra/llui/lldockcontrol.h
+++ b/indra/llui/lldockcontrol.h
@@ -43,6 +43,7 @@ class LLDockControl
 	{
 		TOP,
 		LEFT,
+		RIGHT,
 		BOTTOM
 	};
 
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 33c6b2218cc..c7513944553 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -1681,7 +1681,8 @@ BOOL LLCallDialog::postBuild()
 		return FALSE;
 
 	LLView *anchor_panel = gToolBarView->findChildView("speak");
-	setDockControl(new LLDockControl(anchor_panel, this, getDockTongue(), LLDockControl::TOP));
+	LLDockControl::DocAt dock_pos = getDockControlPos();
+	setDockControl(new LLDockControl(anchor_panel, this, getDockTongue(dock_pos), dock_pos));
 
 	setUseTongue(anchor_panel);
 
@@ -1751,6 +1752,22 @@ void LLCallDialog::setIcon(const LLSD& session_id, const LLSD& participant_id)
 	}
 }
 
+LLDockControl::DocAt LLCallDialog::getDockControlPos()
+{
+	LLToolBar* tool_bar = NULL;
+
+	if((tool_bar = gToolBarView->getChild<LLToolBar>("toolbar_left")) && tool_bar->hasChild("speak", true))
+	{
+		return LLDockControl::RIGHT; // Speak button in the left toolbar so the call floater should be to the right of the speak button
+	}
+	else if((tool_bar = gToolBarView->getChild<LLToolBar>("toolbar_right")) && tool_bar->hasChild("speak", true))
+	{
+		return LLDockControl::LEFT; // Speak button in the right toolbar so the call floater should be to the left of the speak button
+	}
+
+	return LLDockControl::TOP;
+}
+
 bool LLCallDialog::lifetimeHasExpired()
 {
 	if (mLifetimeTimer.getStarted())
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 93b604d36aa..33c7ae9e54e 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -491,7 +491,7 @@ class LLCallDialog : public LLDockableFloater
 {
 public:
 	LLCallDialog(const LLSD& payload);
-	~LLCallDialog();
+	virtual ~LLCallDialog();
 
 	virtual BOOL postBuild();
 
@@ -519,6 +519,9 @@ class LLCallDialog : public LLDockableFloater
 	void setIcon(const LLSD& session_id, const LLSD& participant_id);
 
 	LLSD mPayload;
+
+private:
+	LLDockControl::DocAt getDockControlPos();
 };
 
 class LLIncomingCallDialog : public LLCallDialog
diff --git a/indra/newview/skins/default/textures/windows/Flyout_Left.png b/indra/newview/skins/default/textures/windows/Flyout_Left.png
new file mode 100644
index 0000000000000000000000000000000000000000..6ac9fe2efd4bad4f71070826fd23b1a64eb5080a
GIT binary patch
literal 271
zcmeAS@N?(olHy`uVBq!ia0vp^JU}eY!3HGlQ`YSVQjEnx?oJHr&dIz4a@dl*-CY>|
zgW!U_%O?XxI14-?iy0WWg+Z8+Vb&Z8pdfpRr>`sfZ7vBO4uy$xi!6ac{hlt4Ar_~n
zUOvcsSb?YY;r#1`HSa_uSG^6GyC{9x34wD<CkAodP*80AYA2w;Fz>*#cPUnB&$K-l
z(!MdgTRNq8!AqHxiR&iw1VwjDs5&ZnDdV-^r8f<>OI}Dti!_NXJs`T&aqU;unk_<Q
z-?xVydbsfR2azv_oDI0j59<73U-W_hM9X>cm|vH-*WUNedYW&|uv&QC&xJRGwSi7!
N@O1TaS?83{1ORl+W{3a)

literal 0
HcmV?d00001

diff --git a/indra/newview/skins/default/textures/windows/Flyout_Right.png b/indra/newview/skins/default/textures/windows/Flyout_Right.png
new file mode 100644
index 0000000000000000000000000000000000000000..aa1f0625aadf1c81e5034f21eb66ecfa88a451ae
GIT binary patch
literal 280
zcmeAS@N?(olHy`uVBq!ia0vp^JU}eY!3HGlQ`YSVQjEnx?oJHr&dIz4a@dl*-CY>|
zgW!U_%O?XxI14-?iy0WWg+Z8+Vb&Z8pdfpRr>`sfZ7vBOcA<Nh?8|^cGdx`!Lo7~D
zowA$vumKNizu(L_?+t$Q?>VbVY6UL|dn#yh#Cx)Y!5V&5hr4q%I{J+~U8c=kdw|#T
zFz=cJm+x+M@h|(%e!z&iyjALsNK`@Si-YQkEb=WJd$<E74%GQ_9{kUhDDi+P##=Mm
z>!sW(g_pcFMd#MPm^x$PxAb1G_G7L~f=%3lOlxdcO1__VMRvg|6YI-nzq4x??>(K6
VKIcLARiGOgJYD@<);T3K0RWQ(Vp9MB

literal 0
HcmV?d00001

diff --git a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml
index 9db6568ee39..ffbb6aa28b4 100644
--- a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml
+++ b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml
@@ -8,6 +8,7 @@
  layout="topleft"
  name="outgoing call"
  help_topic="outgoing_call"
+ save_dock_state="true"
  title="CALLING"
  width="410">
     <floater.string
-- 
GitLab