From 276e80ce367dd89d7f3b2882ff669d6b59b78c0c Mon Sep 17 00:00:00 2001
From: Steven Bennetts <steve@lindenlab.com>
Date: Mon, 12 Oct 2009 08:20:00 +0000
Subject: merge
 https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1967
 https://svn.aws.productengine.com/secondlife/pe/stable-2@1971 ->
 viewer-2.0.0-3 * Bugs: EXT-1431 EXT-1237 EXT-1151 EXT-1165 EXT-1410 EXT-1419
 * Dev: EXT-1232

---
 indra/newview/llchatitemscontainerctrl.cpp |  5 ++-
 indra/newview/llnearbychathandler.cpp      | 19 ++++++--
 indra/newview/llpanelplaceinfo.cpp         | 25 +++++++----
 indra/newview/llpanelplaceinfo.h           |  4 +-
 indra/newview/llpanelplaces.cpp            | 22 ++++++----
 indra/newview/llpanelplaces.h              |  2 +-
 indra/newview/llpanelteleporthistory.cpp   |  8 ++++
 indra/newview/lltoastgroupnotifypanel.cpp  | 13 +++++-
 indra/newview/llviewerinventory.cpp        | 70 +++++++++++++++---------------
 indra/newview/llviewerinventory.h          |  4 +-
 10 files changed, 109 insertions(+), 63 deletions(-)

diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp
index 25620c2aed..63b9fd8e66 100644
--- a/indra/newview/llchatitemscontainerctrl.cpp
+++ b/indra/newview/llchatitemscontainerctrl.cpp
@@ -59,6 +59,7 @@ static const F32 AUTO_SCROLL_RATE_ACCEL = 120.f;
 
 static const S32 msg_left_offset = 30;
 static const S32 msg_right_offset = 10;
+static const S32 msg_height_pad = 2;
 
 //static LLDefaultChildRegistry::Register<LLChatItemsContainerCtrl>	t2("chat_items_container");
 
@@ -178,14 +179,14 @@ void	LLNearbyChatToastPanel::setMessage	(const LLChat& chat_msg)
 void	LLNearbyChatToastPanel::snapToMessageHeight	()
 {
 	LLChatMsgBox* text_box = getChild<LLChatMsgBox>("msg_text", false);
-	S32 new_height = text_box->getTextPixelHeight();
+	S32 new_height = text_box->getTextPixelHeight() + msg_height_pad;
 	LLRect panel_rect = getRect();
 
 	S32 caption_height = 0;
 	LLPanel* caption = getChild<LLPanel>("msg_caption", false);
 	caption_height = caption->getRect().getHeight();
 
-	panel_rect.setLeftTopAndSize( panel_rect.mLeft, panel_rect.mTop, panel_rect.getWidth()	, caption_height + new_height);
+	panel_rect.setLeftTopAndSize( panel_rect.mLeft, panel_rect.mTop, panel_rect.getWidth(), caption_height + new_height);
 	
 	reshape( getRect().getWidth(), caption_height + new_height, 1);
 	
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index 3c5e588128..59b19b6dcb 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -61,7 +61,7 @@ LLToastPanelBase* createToastPanel()
 class LLNearbyChatScreenChannel: public LLScreenChannelBase
 {
 public:
-	LLNearbyChatScreenChannel(const LLUUID& id):LLScreenChannelBase(id) { mActiveMessages = 0;};
+	LLNearbyChatScreenChannel(const LLUUID& id):LLScreenChannelBase(id) { mStopProcessing = false;};
 
 	void init				(S32 channel_left, S32 channel_right);
 
@@ -100,6 +100,13 @@ public:
 		m_active_toasts.clear();
 	};
 
+	virtual void deleteAllChildren()
+	{
+		m_toast_pool.clear();
+		m_active_toasts.clear();
+		LLScreenChannelBase::deleteAllChildren();
+	}
+
 protected:
 	void	createOverflowToast(S32 bottom, F32 timer);
 
@@ -110,7 +117,7 @@ protected:
 	std::vector<LLToast*> m_active_toasts;
 	std::list<LLToast*> m_toast_pool;
 
-	S32 mActiveMessages;
+	bool	mStopProcessing;
 };
 
 void LLNearbyChatScreenChannel::init(S32 channel_left, S32 channel_right)
@@ -129,6 +136,7 @@ void	LLNearbyChatScreenChannel::createOverflowToast(S32 bottom, F32 timer)
 
 void LLNearbyChatScreenChannel::onToastDestroyed(LLToast* toast)
 {	
+	mStopProcessing = true;
 }
 
 void LLNearbyChatScreenChannel::onToastFade(LLToast* toast)
@@ -168,7 +176,8 @@ bool	LLNearbyChatScreenChannel::createPoolToast()
 void LLNearbyChatScreenChannel::addNotification(LLSD& notification)
 {
 	//look in pool. if there is any message
-
+	if(mStopProcessing)
+		return;
 	
 	if(m_toast_pool.empty())
 	{
@@ -211,6 +220,9 @@ void LLNearbyChatScreenChannel::arrangeToasts()
 
 void LLNearbyChatScreenChannel::showToastsBottom()
 {
+	if(mStopProcessing)
+		return;
+
 	LLRect	toast_rect;	
 	S32		bottom = getRect().mBottom;
 	S32		margin = gSavedSettings.getS32("ToastMargin");
@@ -239,7 +251,6 @@ void LLNearbyChatScreenChannel::showToastsBottom()
 			toast->setRect(toast_rect);
 			
 			toast->setVisible(TRUE);
-			toast->stopTimer();
 			bottom = toast->getRect().mTop;
 		}		
 	}
diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp
index 64c7f659dd..39055e4732 100644
--- a/indra/newview/llpanelplaceinfo.cpp
+++ b/indra/newview/llpanelplaceinfo.cpp
@@ -567,7 +567,8 @@ void LLPanelPlaceInfo::displayParcelInfo(const LLUUID& region_id,
 
 void LLPanelPlaceInfo::displaySelectedParcelInfo(LLParcel* parcel,
 											  LLViewerRegion* region,
-											  const LLVector3d& pos_global)
+											  const LLVector3d& pos_global,
+											  bool is_current_parcel)
 {
 	if (!region || !parcel)
 		return;
@@ -798,6 +799,9 @@ void LLPanelPlaceInfo::displaySelectedParcelInfo(LLParcel* parcel,
 
 	processParcelInfo(parcel_data);
 
+	// TODO: If agent is in currently within the selected parcel
+	// show the "You Are Here" banner.
+
 	getChild<LLAccordionCtrlTab>("sales_tab")->setVisible(for_sale);
 }
 
@@ -845,14 +849,17 @@ void LLPanelPlaceInfo::toggleLandmarkEditMode(BOOL enabled)
 		mTitle->setText(mCurrentTitle);
 	}
 
-	mTitleEditor->setEnabled(enabled);
-	mNotesEditor->setReadOnly(!enabled);
-	mFolderCombo->setVisible(enabled);
-	getChild<LLTextBox>("folder_lable")->setVisible(enabled);
-
-	// HACK: To change the text color in a text editor
-	// when it was enabled/disabled we set the text once again.
-	mNotesEditor->setText(mNotesEditor->getText());
+	if (mNotesEditor->getReadOnly() ==  (enabled == TRUE))
+	{
+		mTitleEditor->setEnabled(enabled);
+		mNotesEditor->setReadOnly(!enabled);
+		mFolderCombo->setVisible(enabled);
+		getChild<LLTextBox>("folder_lable")->setVisible(enabled);
+
+		// HACK: To change the text color in a text editor
+		// when it was enabled/disabled we set the text once again.
+		mNotesEditor->setText(mNotesEditor->getText());
+	}
 }
 
 const std::string& LLPanelPlaceInfo::getLandmarkTitle() const
diff --git a/indra/newview/llpanelplaceinfo.h b/indra/newview/llpanelplaceinfo.h
index 4926f81b60..3e8344ff12 100644
--- a/indra/newview/llpanelplaceinfo.h
+++ b/indra/newview/llpanelplaceinfo.h
@@ -105,9 +105,11 @@ public:
 
 	// Displays information about the currently selected parcel
 	// without sending a request to the server.
+	// If is_current_parcel true shows "You Are Here" banner.
 	void displaySelectedParcelInfo(LLParcel* parcel,
 								LLViewerRegion* region,
-								const LLVector3d& pos_global);
+								const LLVector3d& pos_global,
+								bool is_current_parcel);
 
 	void updateEstateName(const std::string& name);
 	void updateEstateOwnerName(const std::string& name);
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index d16847de0f..d415b17538 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -200,7 +200,7 @@ BOOL LLPanelPlaces::postBuild()
 	mFilterEditor = getChild<LLFilterEditor>("Filter");
 	if (mFilterEditor)
 	{
-		mFilterEditor->setCommitCallback(boost::bind(&LLPanelPlaces::onFilterEdit, this, _2));
+		mFilterEditor->setCommitCallback(boost::bind(&LLPanelPlaces::onFilterEdit, this, _2, false));
 	}
 
 	mPlaceInfo = getChild<LLPanelPlaceInfo>("panel_place_info");
@@ -225,11 +225,12 @@ void LLPanelPlaces::onOpen(const LLSD& key)
 		return;
 
 	mFilterEditor->clear();
-	onFilterEdit("");
+	onFilterEdit("", false);
 
 	mPlaceInfoType = key["type"].asString();
 	mPosGlobal.setZero();
 	mItem = NULL;
+	isLandmarkEditModeOn = false;
 	togglePlaceInfoPanel(TRUE);
 	updateVerbs();
 
@@ -371,9 +372,9 @@ void LLPanelPlaces::onLandmarkLoaded(LLLandmark* landmark)
 	mPlaceInfo->displayParcelInfo(region_id, mPosGlobal);
 }
 
-void LLPanelPlaces::onFilterEdit(const std::string& search_string)
+void LLPanelPlaces::onFilterEdit(const std::string& search_string, bool force_filter)
 {
-	if (mFilterSubString != search_string)
+	if (force_filter || mFilterSubString != search_string)
 	{
 		mFilterSubString = search_string;
 
@@ -392,7 +393,7 @@ void LLPanelPlaces::onTabSelected()
 	if (!mActivePanel)
 		return;
 
-	onFilterEdit(mFilterSubString);	
+	onFilterEdit(mFilterSubString, true);
 	mActivePanel->updateVerbs();
 }
 
@@ -550,6 +551,8 @@ void LLPanelPlaces::onCancelButtonClicked()
 	else
 	{
 		mPlaceInfo->toggleLandmarkEditMode(FALSE);
+		isLandmarkEditModeOn = false;
+
 		updateVerbs();
 
 		// Reload the landmark properties.
@@ -664,6 +667,8 @@ void LLPanelPlaces::onBackButtonClicked()
 
 		// Resetting mPlaceInfoType when Place Info panel is closed.
 		mPlaceInfoType = LLStringUtil::null;
+
+		isLandmarkEditModeOn = false;
 	}
 
 	updateVerbs();
@@ -723,7 +728,8 @@ void LLPanelPlaces::changedParcelSelection()
 
 	// If agent is inside the selected parcel show agent's region<X, Y, Z>,
 	// otherwise show region<X, Y, Z> of agent's selection point.
-	if (is_agent_in_selected_parcel(parcel))
+	bool is_current_parcel = is_agent_in_selected_parcel(parcel);
+	if (is_current_parcel)
 	{
 		mPosGlobal = gAgent.getPositionGlobal();
 	}
@@ -737,7 +743,7 @@ void LLPanelPlaces::changedParcelSelection()
 	}
 
 	mPlaceInfo->resetLocation();
-	mPlaceInfo->displaySelectedParcelInfo(parcel, region, mPosGlobal);
+	mPlaceInfo->displaySelectedParcelInfo(parcel, region, mPosGlobal, is_current_parcel);
 
 	updateVerbs();
 }
@@ -842,8 +848,6 @@ void LLPanelPlaces::updateVerbs()
 		if (mActivePanel)
 			mActivePanel->updateVerbs();
 	}
-
-	isLandmarkEditModeOn = false;
 }
 
 static bool is_agent_in_selected_parcel(LLParcel* parcel)
diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h
index 0b3b3b5fc3..ce20ffdc91 100644
--- a/indra/newview/llpanelplaces.h
+++ b/indra/newview/llpanelplaces.h
@@ -66,7 +66,7 @@ public:
 
 private:
 	void onLandmarkLoaded(LLLandmark* landmark);
-	void onFilterEdit(const std::string& search_string);
+	void onFilterEdit(const std::string& search_string, bool force_filter);
 	void onTabSelected();
 
 	//void onShareButtonClicked();
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index bed15df1ee..e71ddfb283 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -243,6 +243,7 @@ BOOL LLTeleportHistoryPanel::postBuild()
 			{
 				LLAccordionCtrlTab* tab = (LLAccordionCtrlTab*)*iter;
 				tab->setRightMouseDownCallback(boost::bind(&LLTeleportHistoryPanel::onAccordionTabRightClick, this, _1, _2, _3, _4));
+				tab->setDisplayChildren(false);
 
 				mItemContainers.put(tab);
 
@@ -255,6 +256,13 @@ BOOL LLTeleportHistoryPanel::postBuild()
 				}
 			}
 		}
+
+		// Open first 2 accordion tabs
+		if (mItemContainers.size() > 1)
+			mItemContainers.get(mItemContainers.size() - 1)->setDisplayChildren(true);
+
+		if (mItemContainers.size() > 2)
+			mItemContainers.get(mItemContainers.size() - 2)->setDisplayChildren(true);
 	}
 
 	getChild<LLPanel>("bottom_panel")->childSetAction("gear_btn",boost::bind(&LLTeleportHistoryPanel::onGearButtonClicked, this));
diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp
index 6f373a74bd..e26a0776ff 100644
--- a/indra/newview/lltoastgroupnotifypanel.cpp
+++ b/indra/newview/lltoastgroupnotifypanel.cpp
@@ -128,7 +128,18 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(LLNotificationPtr& notification
 	pAttachLink->setVisible(hasInventory);
 	pAttachIcon->setVisible(hasInventory);
 	if (hasInventory) {
-		pAttachLink->setValue(payload["inventory_name"]);
+		std::string dis_name;
+		std::string inv_name = payload["inventory_name"];
+
+		if (LLViewerInventoryItem::extractSortFieldAndDisplayName(inv_name, NULL, &dis_name))
+		{
+			pAttachLink->setValue(dis_name);
+		}
+		else
+		{
+			pAttachLink->setValue(inv_name);
+		}
+
 		mInventoryOffer = new LLOfferInfo(payload["inventory_offer"]);
 		childSetActionTextbox("attachment", boost::bind(
 				&LLToastGroupNotifyPanel::onClickAttachment, this));
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 176e1b5499..dc53358311 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -121,41 +121,6 @@ LLViewerInventoryItem::~LLViewerInventoryItem()
 {
 }
 
-BOOL LLViewerInventoryItem::extractSortFieldAndDisplayName(S32* sortField, std::string* displayName) const
-{
-	using std::string;
-	using std::stringstream;
-
-	const char separator = getSeparator();
-	const string::size_type separatorPos = mName.find(separator, 0);
-
-	BOOL result = FALSE;
-
-	if (separatorPos < string::npos)
-	{
-		if (sortField)
-		{
-			/*
-			 * The conversion from string to S32 is made this way instead of old plain
-			 * atoi() to ensure portability. If on some other platform S32 will not be
-			 * defined to be signed int, this conversion will still work because of
-			 * operators overloading, but atoi() may fail.
-			 */
-			stringstream ss(mName.substr(0, separatorPos));
-			ss >> *sortField;
-		}
-
-		if (displayName)
-		{
-			*displayName = mName.substr(separatorPos + 1, string::npos);
-		}
-
-		result = TRUE;
-	}
-
-	return result;
-}
-
 void LLViewerInventoryItem::copyViewerItem(const LLViewerInventoryItem* other)
 {
 	LLInventoryItem::copyItem(other);
@@ -1314,6 +1279,41 @@ U32 LLViewerInventoryItem::getCRC32() const
 	return LLInventoryItem::getCRC32();	
 }
 
+BOOL LLViewerInventoryItem::extractSortFieldAndDisplayName(const std::string& name, S32* sortField, std::string* displayName)
+{
+	using std::string;
+	using std::stringstream;
+
+	const char separator = getSeparator();
+	const string::size_type separatorPos = name.find(separator, 0);
+
+	BOOL result = FALSE;
+
+	if (separatorPos < string::npos)
+	{
+		if (sortField)
+		{
+			/*
+			 * The conversion from string to S32 is made this way instead of old plain
+			 * atoi() to ensure portability. If on some other platform S32 will not be
+			 * defined to be signed int, this conversion will still work because of
+			 * operators overloading, but atoi() may fail.
+			 */
+			stringstream ss(name.substr(0, separatorPos));
+			ss >> *sortField;
+		}
+
+		if (displayName)
+		{
+			*displayName = name.substr(separatorPos + 1, string::npos);
+		}
+
+		result = TRUE;
+	}
+
+	return result;
+}
+
 // This returns true if the item that this item points to 
 // doesn't exist in memory (i.e. LLInventoryModel).  The baseitem
 // might still be in the database but just not loaded yet.
diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h
index d5b99ac160..5692875ec6 100644
--- a/indra/newview/llviewerinventory.h
+++ b/indra/newview/llviewerinventory.h
@@ -57,7 +57,7 @@ public:
 	
 protected:
 	~LLViewerInventoryItem( void ); // ref counted
-	BOOL extractSortFieldAndDisplayName(S32* sortField, std::string* displayName) const;
+	BOOL extractSortFieldAndDisplayName(S32* sortField, std::string* displayName) const { return extractSortFieldAndDisplayName(mName, sortField, displayName); }
 	static char getSeparator() { return '@'; }
 	mutable std::string mDisplayName;
 	
@@ -78,6 +78,8 @@ public:
 	virtual time_t getCreationDate() const;
 	virtual U32 getCRC32() const; // really more of a checksum.
 
+	static BOOL extractSortFieldAndDisplayName(const std::string& name, S32* sortField, std::string* displayName);
+
 	// construct a complete viewer inventory item
 	LLViewerInventoryItem(const LLUUID& uuid, const LLUUID& parent_uuid,
 						  const LLPermissions& permissions,
-- 
cgit v1.2.3