From e67bc887377c7a2eecaa2135c3e6c0f27724f3b5 Mon Sep 17 00:00:00 2001
From: Vadim ProductEngine <vsavchuk@productengine.com>
Date: Fri, 22 Jul 2011 17:35:05 +0300
Subject: [PATCH] STORM-1311 FIXED Provide more space for parcel description in
 the Place Profile when coming from search.

This also affects the way teleport history items look.

In the first place I tried to make the description occupy all available space
and follow viewer window shape. However that triggered numerous bugs in the
text widgets, which spoiled the whole fix.
So I'm coming up with a temporary hacky solution that should fit
the ticket requirements.
---
 indra/newview/llexpandabletextbox.cpp |  9 +++++++++
 indra/newview/llexpandabletextbox.h   |  4 ++++
 indra/newview/llpanelplaceprofile.cpp | 29 +++++++++++++++++++++++++++
 3 files changed, 42 insertions(+)

diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp
index 5501b8c2ac2..2abfbf37ca9 100644
--- a/indra/newview/llexpandabletextbox.cpp
+++ b/indra/newview/llexpandabletextbox.cpp
@@ -415,6 +415,15 @@ void LLExpandableTextBox::onTopLost()
 	LLUICtrl::onTopLost();
 }
 
+void LLExpandableTextBox::updateTextShape()
+{
+	// I guess this should be done on every reshape(),
+	// but adding this code to reshape() currently triggers bug VWR-26455,
+	// which makes the text virtually unreadable.
+	llassert(!mExpanded);
+	updateTextBoxRect();
+}
+
 void LLExpandableTextBox::setValue(const LLSD& value)
 {
 	collapseTextBox();
diff --git a/indra/newview/llexpandabletextbox.h b/indra/newview/llexpandabletextbox.h
index f75ef954ffa..399e48bea2b 100644
--- a/indra/newview/llexpandabletextbox.h
+++ b/indra/newview/llexpandabletextbox.h
@@ -143,6 +143,10 @@ class LLExpandableTextBox : public LLUICtrl
 	 */
 	/*virtual*/ void onTopLost();
 
+	/**
+	 * *HACK: Update the inner textbox shape.
+	 */
+	void updateTextShape();
 
 	/**
 	 * Draws text box, collapses text box if its expanded and its parent's position changed
diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp
index 1e9ce582373..f82e86ef08a 100644
--- a/indra/newview/llpanelplaceprofile.cpp
+++ b/indra/newview/llpanelplaceprofile.cpp
@@ -32,6 +32,7 @@
 #include "llparcel.h"
 #include "message.h"
 
+#include "llexpandabletextbox.h"
 #include "lliconctrl.h"
 #include "lllineeditor.h"
 #include "lltextbox.h"
@@ -227,6 +228,34 @@ void LLPanelPlaceProfile::setInfoType(EInfoType type)
 
 	getChild<LLAccordionCtrl>("advanced_info_accordion")->setVisible(is_info_type_agent);
 
+	// If we came from search we want larger description area, approx. 10 lines (see STORM-1311).
+	// Don't use the maximum available space because that leads to nasty artifacts
+	// in text editor and expandable text box.
+	{
+		const S32 SEARCH_DESC_HEIGHT = 150;
+
+		// Remember original geometry (once).
+		static const S32 sOrigDescVPad = getChildView("parcel_title")->getRect().mBottom - mDescEditor->getRect().mTop;
+		static const S32 sOrigDescHeight = mDescEditor->getRect().getHeight();
+		static const S32 sOrigMRIconVPad = mDescEditor->getRect().mBottom - mMaturityRatingIcon->getRect().mTop;
+		static const S32 sOrigMRTextVPad = mDescEditor->getRect().mBottom - mMaturityRatingText->getRect().mTop;
+
+		// Resize the description.
+		const S32 desc_height = is_info_type_agent ? sOrigDescHeight : SEARCH_DESC_HEIGHT;
+		const S32 desc_top = getChildView("parcel_title")->getRect().mBottom - sOrigDescVPad;
+		LLRect desc_rect = mDescEditor->getRect();
+		desc_rect.setOriginAndSize(desc_rect.mLeft, desc_top - desc_height, desc_rect.getWidth(), desc_height);
+		mDescEditor->reshape(desc_rect.getWidth(), desc_rect.getHeight());
+		mDescEditor->setRect(desc_rect);
+		mDescEditor->updateTextShape();
+
+		// Move the maturity rating icon/text accordingly.
+		const S32 mr_icon_bottom = mDescEditor->getRect().mBottom - sOrigMRIconVPad - mMaturityRatingIcon->getRect().getHeight();
+		const S32 mr_text_bottom = mDescEditor->getRect().mBottom - sOrigMRTextVPad - mMaturityRatingText->getRect().getHeight();
+		mMaturityRatingIcon->setOrigin(mMaturityRatingIcon->getRect().mLeft, mr_icon_bottom);
+		mMaturityRatingText->setOrigin(mMaturityRatingText->getRect().mLeft, mr_text_bottom);
+	}
+
 	switch(type)
 	{
 		case AGENT:
-- 
GitLab