From a27706ad2e42718ad107e25fe7c29f1c0513fabc Mon Sep 17 00:00:00 2001
From: Sergei Litovchuk <slitovchuk@productengine.com>
Date: Wed, 18 Nov 2009 19:49:49 +0200
Subject: [PATCH] Fixed normal bug EXT-2461 "Edit Landmark panel isn't
 resized": - Added vertical scroll appearing for Place Profile and Landmark
 info panels. - Added horizontal reshaping to avoid redundant horizontal
 scroll.

--HG--
branch : product-engine
---
 indra/newview/llpanelplaceinfo.cpp            | 33 ++++++++++++++++++-
 indra/newview/llpanelplaceinfo.h              |  6 ++++
 .../default/xui/en/panel_landmark_info.xml    |  6 ++--
 .../default/xui/en/panel_place_profile.xml    |  6 ++--
 4 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp
index 963d39de8aa..6ba3790fe22 100644
--- a/indra/newview/llpanelplaceinfo.cpp
+++ b/indra/newview/llpanelplaceinfo.cpp
@@ -57,7 +57,11 @@ LLPanelPlaceInfo::LLPanelPlaceInfo()
 :	LLPanel(),
 	mParcelID(),
 	mRequestedID(),
-	mPosRegion()
+	mPosRegion(),
+	mScrollingPanelMinHeight(0),
+	mScrollingPanelWidth(0),
+	mScrollingPanel(NULL),
+	mScrollContainer(NULL)
 {}
 
 //virtual
@@ -83,6 +87,12 @@ BOOL LLPanelPlaceInfo::postBuild()
 	mMaturityRatingIcon = getChild<LLIconCtrl>("maturity_icon");
 	mMaturityRatingText = getChild<LLTextBox>("maturity_value");
 
+	mScrollingPanel = getChild<LLPanel>("scrolling_panel");
+	mScrollContainer = getChild<LLScrollContainer>("place_scroll");
+
+	mScrollingPanelMinHeight = mScrollContainer->getScrolledViewRect().getHeight();
+	mScrollingPanelWidth = mScrollingPanel->getRect().getWidth();
+
 	return TRUE;
 }
 
@@ -230,6 +240,27 @@ void LLPanelPlaceInfo::processParcelInfo(const LLParcelData& parcel_data)
 	}
 }
 
+// virtual
+void LLPanelPlaceInfo::reshape(S32 width, S32 height, BOOL called_from_parent)
+{
+	LLPanel::reshape(width, height, called_from_parent);
+
+	if (!mScrollContainer || !mScrollingPanel)
+		return;
+
+	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
+
+	S32 scroll_height = mScrollContainer->getRect().getHeight();
+	if (mScrollingPanelMinHeight >= scroll_height)
+	{
+		mScrollingPanel->reshape(mScrollingPanelWidth, mScrollingPanelMinHeight);
+	}
+	else
+	{
+		mScrollingPanel->reshape(mScrollingPanelWidth + scrollbar_size, scroll_height);
+	}
+}
+
 // virtual
 void LLPanelPlaceInfo::handleVisibilityChange(BOOL new_visibility)
 {
diff --git a/indra/newview/llpanelplaceinfo.h b/indra/newview/llpanelplaceinfo.h
index 133933a880d..b9bf92b534c 100644
--- a/indra/newview/llpanelplaceinfo.h
+++ b/indra/newview/llpanelplaceinfo.h
@@ -45,6 +45,7 @@ class LLIconCtrl;
 class LLInventoryItem;
 class LLPanelPickEdit;
 class LLParcel;
+class LLScrollContainer;
 class LLTextBox;
 class LLTextureCtrl;
 class LLViewerRegion;
@@ -92,6 +93,7 @@ class LLPanelPlaceInfo : public LLPanel, LLRemoteParcelInfoObserver
 
 	/*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
 
+	/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 	/*virtual*/ void handleVisibilityChange (BOOL new_visibility);
 
 	// Create a pick for the location specified
@@ -110,8 +112,12 @@ class LLPanelPlaceInfo : public LLPanel, LLRemoteParcelInfoObserver
 	LLUUID					mRequestedID;
 	LLVector3				mPosRegion;
 	std::string				mCurrentTitle;
+	S32						mScrollingPanelMinHeight;
+	S32						mScrollingPanelWidth;
 	INFO_TYPE 				mInfoType;
 
+	LLScrollContainer*		mScrollContainer;
+	LLPanel*				mScrollingPanel;
 	LLTextBox*				mTitle;
 	LLTextureCtrl*			mSnapshotCtrl;
 	LLTextBox*				mRegionName;
diff --git a/indra/newview/skins/default/xui/en/panel_landmark_info.xml b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
index b01ddbf75aa..a219e30b8bc 100644
--- a/indra/newview/skins/default/xui/en/panel_landmark_info.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
@@ -87,8 +87,8 @@
      width="313">
         <panel
          bg_alpha_color="DkGray2"
-         follows="all"
-         height="533"
+         follows="left|top|right"
+         height="610"
          layout="topleft"
          left="0"
          min_height="300"
@@ -145,7 +145,7 @@
              top_pad="10"
              width="18" />
             <text
-             follows="right|top"
+             follows="left|top|right"
              height="16"
              layout="topleft"
              left_pad="8"
diff --git a/indra/newview/skins/default/xui/en/panel_place_profile.xml b/indra/newview/skins/default/xui/en/panel_place_profile.xml
index e6084202d7c..9ab5c6b4f74 100644
--- a/indra/newview/skins/default/xui/en/panel_place_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_place_profile.xml
@@ -172,7 +172,7 @@
      width="313">
         <panel
          bg_alpha_color="DkGray2"
-         follows="all"
+         follows="left|top|right"
          height="533"
          layout="topleft"
          left="0"
@@ -192,7 +192,7 @@
             <layout_stack
              border_size="0"
              clip="false"
-             follows="all"
+             follows="left|top|right"
              height="50"
              layout="topleft"
              mouse_opaque="false"
@@ -305,7 +305,7 @@
              top_delta="0"
              width="18" />
             <text
-             follows="right|top"
+             follows="left|top|right"
              height="16"
              layout="topleft"
              left_pad="8"
-- 
GitLab