From f305ddc7f773454826a09a8d52c33735eb7c95ea Mon Sep 17 00:00:00 2001
From: Paul Guslisty <pguslisty@productengine.com>
Date: Tue, 24 Aug 2010 12:39:11 +0300
Subject: [PATCH] EXT-7951 RESTORED IN VIEWER-DEVELOPMENT REPO (Mini-Location
 panel appearance design issues)

- Added callback on show\hide Mini Location Panel event. This callback sets proper initial minimized position depending on state (shown or hidded) Mini Location Panel. Also callback shifts vertically already minimized floaters so that they don't overlap Mini Location Panel

Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/851/

--HG--
branch : product-engine
---
 indra/llui/llfloater.cpp                      | 14 +++++++++++
 indra/llui/llfloater.h                        |  3 +++
 indra/newview/llpaneltopinfobar.cpp           | 23 +++++++++++++++++++
 indra/newview/llpaneltopinfobar.h             |  5 ++++
 .../default/xui/en/panel_topinfo_bar.xml      | 10 ++++----
 5 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 3cfb2c5d4a3..3fcb5f9f035 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2279,6 +2279,7 @@ void LLFloaterView::getMinimizePosition(S32 *left, S32 *bottom)
 	S32 floater_header_size = default_params.header_height;
 	static LLUICachedControl<S32> minimized_width ("UIMinimizedWidth", 0);
 	LLRect snap_rect_local = getLocalSnapRect();
+	snap_rect_local.mTop += mVMinimizePositionOffset;
 	for(S32 col = snap_rect_local.mLeft;
 		col < snap_rect_local.getWidth() - minimized_width;
 		col += minimized_width)
@@ -2376,6 +2377,19 @@ BOOL LLFloaterView::allChildrenClosed()
 	return true;
 }
 
+void LLFloaterView::shiftFloaters(S32 x_offset, S32 y_offset)
+{
+	for (child_list_const_iter_t it = getChildList()->begin(); it != getChildList()->end(); ++it)
+	{
+		LLFloater* floaterp = dynamic_cast<LLFloater*>(*it);
+
+		if (floaterp && floaterp->isMinimized())
+		{
+			floaterp->translate(x_offset, y_offset);
+		}
+	}
+}
+
 void LLFloaterView::refresh()
 {
 	// Constrain children to be entirely on the screen
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 2deae29607c..cd244713458 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -449,6 +449,7 @@ class LLFloaterView : public LLUICtrl
 	// Given a child of gFloaterView, make sure this view can fit entirely onscreen.
 	void			adjustToFitScreen(LLFloater* floater, BOOL allow_partial_outside);
 
+	void			setMinimizePositionVerticalOffset(S32 offset) { mVMinimizePositionOffset = offset; }
 	void			getMinimizePosition( S32 *left, S32 *bottom);
 	void			restoreAll();		// un-minimize all floaters
 	typedef std::set<LLView*> skip_list_t;
@@ -465,6 +466,7 @@ class LLFloaterView : public LLUICtrl
 	// attempt to close all floaters
 	void			closeAllChildren(bool app_quitting);
 	BOOL			allChildrenClosed();
+	void			shiftFloaters(S32 x_offset, S32 y_offset);
 
 	LLFloater* getFrontmost() const;
 	LLFloater* getBackmost() const;
@@ -484,6 +486,7 @@ class LLFloaterView : public LLUICtrl
 	BOOL			mFocusCycleMode;
 	S32				mSnapOffsetBottom;
 	S32				mSnapOffsetRight;
+	S32				mVMinimizePositionOffset;
 };
 
 //
diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp
index 15f7195b1a3..640ff9cae73 100644
--- a/indra/newview/llpaneltopinfobar.cpp
+++ b/indra/newview/llpaneltopinfobar.cpp
@@ -155,6 +155,8 @@ BOOL LLPanelTopInfoBar::postBuild()
 	mParcelMgrConnection = LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(
 			boost::bind(&LLPanelTopInfoBar::onAgentParcelChange, this));
 
+	setVisibleCallback(boost::bind(&LLPanelTopInfoBar::onShow, this, _2));
+
 	return TRUE;
 }
 
@@ -168,6 +170,27 @@ void LLPanelTopInfoBar::onNavBarShowParcelPropertiesCtrlChanged()
 	setParcelInfoText(new_text);
 }
 
+// when panel is shown, all minimized floaters should be shifted to prevent overlapping of
+// PanelTopInfoBar. See EXT-7951.
+void LLPanelTopInfoBar::onShow(const LLSD& show)
+{
+	// this height is used as a vertical offset for ALREADY MINIMIZED floaters
+	// when PanelTopInfoBar visibility changes
+	S32 height = getRect().getHeight();
+
+	// this vertical offset is used for a start minimize position of floaters that
+	// are NOT MIMIMIZED YET
+	S32 minimize_pos_offset = 0;
+
+	if (show.asBoolean())
+	{
+		height = minimize_pos_offset = -height;
+	}
+
+	gFloaterView->shiftFloaters(0, height);
+	gFloaterView->setMinimizePositionVerticalOffset(minimize_pos_offset);
+}
+
 void LLPanelTopInfoBar::draw()
 {
 	updateParcelInfoText();
diff --git a/indra/newview/llpaneltopinfobar.h b/indra/newview/llpaneltopinfobar.h
index cf608b88e15..5dbfc051183 100644
--- a/indra/newview/llpaneltopinfobar.h
+++ b/indra/newview/llpaneltopinfobar.h
@@ -52,6 +52,11 @@ class LLPanelTopInfoBar : public LLPanel, public LLSingleton<LLPanelTopInfoBar>,
 	 */
 	void handleLoginComplete();
 
+	/**
+	 * Called when show/hide panel top info bar.
+	 */
+	void onShow(const LLSD& show);
+
 private:
 	class LLParcelChangeObserver;
 
diff --git a/indra/newview/skins/default/xui/en/panel_topinfo_bar.xml b/indra/newview/skins/default/xui/en/panel_topinfo_bar.xml
index d8f4297e0cc..30d3064e143 100644
--- a/indra/newview/skins/default/xui/en/panel_topinfo_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_topinfo_bar.xml
@@ -36,7 +36,7 @@
     enabled="true"
     follows="right|top"
     height="18"
-    image_name="Parcel_VoiceNo_Light"
+    image_name="Parcel_VoiceNo_Dark"
     name="voice_icon"
     top="1"
     visible="false"
@@ -45,7 +45,7 @@
   <icon
     follows="right|top"
     height="18"
-    image_name="Parcel_FlyNo_Light"
+    image_name="Parcel_FlyNo_Dark"
     name="fly_icon"
     top="1"
     visible="false"
@@ -54,7 +54,7 @@
   <icon
     follows="right|top"
     height="18"
-    image_name="Parcel_PushNo_Light"
+    image_name="Parcel_PushNo_Dark"
     name="push_icon"
     top="1"
     visible="false"
@@ -63,7 +63,7 @@
   <icon
     follows="right|top"
     height="18"
-    image_name="Parcel_BuildNo_Light"
+    image_name="Parcel_BuildNo_Dark"
     name="build_icon"
     top="1"
     visible="false"
@@ -72,7 +72,7 @@
   <icon
     follows="right|top"
     height="18"
-    image_name="Parcel_ScriptsNo_Light"
+    image_name="Parcel_ScriptsNo_Dark"
     name="scripts_icon"
     top="1"
     visible="false"
-- 
GitLab