From 0f04222acc13802d1b16dff49e17dc52c1cfae2a Mon Sep 17 00:00:00 2001
From: Ychebotarev ProductEngine <ychebotarev@productengine.com>
Date: Wed, 3 Mar 2010 11:43:48 +0200
Subject: [PATCH] fix for normal EXT-1391 Group Info: Avatar name should end
 with ellipsis if it doesn't fit free space

--HG--
branch : product-engine
---
 indra/llui/llscrolllistcell.cpp  |  4 +++-
 indra/llui/llscrolllistcell.h    |  5 +++++
 indra/llui/llscrolllistctrl.h    |  5 ++++-
 indra/newview/llnamelistctrl.cpp | 23 +++++++++++++++++++++++
 indra/newview/llnamelistctrl.h   |  2 ++
 5 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 3cc92baa8dc..d17be8b94a6 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -185,6 +185,8 @@ LLScrollListText::LLScrollListText(const LLScrollListCell::Params& p)
 {
 	sCount++;
 
+	mTextWidth = getWidth();
+
 	// initialize rounded rect image
 	if (!mRoundedRectImage)
 	{
@@ -340,7 +342,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
 					0,
 					LLFontGL::NO_SHADOW,
 					string_chars, 
-					getWidth(),
+					getTextWidth(),
 					&right_x, 
 					TRUE);
 }
diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h
index 5fecf5aade9..b1c8901fc45 100644
--- a/indra/llui/llscrolllistcell.h
+++ b/indra/llui/llscrolllistcell.h
@@ -151,11 +151,16 @@ class LLScrollListText : public LLScrollListCell
 	/*virtual*/ const std::string &	getToolTip() const;
 	/*virtual*/ BOOL	needsToolTip() const;
 
+	S32				getTextWidth() const { return mTextWidth;}
+	void			setTextWidth(S32 value) { mTextWidth = value;} 
+	virtual void	setWidth(S32 width) { LLScrollListCell::setWidth(width); mTextWidth = width; }
+
 	void			setText(const LLStringExplicit& text);
 	void			setFontStyle(const U8 font_style);
 
 private:
 	LLUIString		mText;
+	S32				mTextWidth;
 	const LLFontGL*	mFont;
 	LLColor4		mColor;
 	U8				mUseColor;
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index e819c5fdea2..ebdc82115f8 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -219,7 +219,10 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler,
 	void			deselectAllItems(BOOL no_commit_on_change = FALSE);	// by default, go ahead and commit on selection change
 
 	void			clearHighlightedItems();
-	void			mouseOverHighlightNthItem( S32 index );
+	
+	virtual void	mouseOverHighlightNthItem( S32 index );
+
+	S32				getHighlightedItemInx() const { return mHighlightedItem; } 
 	
 	void			setDoubleClickCallback( callback_t cb ) { mOnDoubleClickCallback = cb; }
 	void			setMaximumSelectCallback( callback_t cb) { mOnMaximumSelectCallback = cb; }
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index 114fef8712a..d6073aa0d8b 100644
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -138,6 +138,29 @@ void LLNameListCtrl::showInspector(const LLUUID& avatar_id, bool is_group)
 		LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", avatar_id));
 }
 
+void	LLNameListCtrl::mouseOverHighlightNthItem( S32 target_index )
+{
+	if (getHighlightedItemInx()!= target_index)
+	{
+		if(getHighlightedItemInx()!=-1)
+		{
+			LLScrollListItem* item = getItemList()[getHighlightedItemInx()];
+			LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex));
+			if(cell)
+				cell->setTextWidth(cell->getTextWidth() + 16);
+		}
+		if(target_index != -1)
+		{
+			LLScrollListItem* item = getItemList()[target_index];
+			LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex));
+			if(cell)
+				cell->setTextWidth(cell->getTextWidth() - 16);
+		}
+	}
+
+	LLScrollListCtrl::mouseOverHighlightNthItem(target_index);
+}
+
 //virtual
 BOOL LLNameListCtrl::handleToolTip(S32 x, S32 y, MASK mask)
 {
diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h
index 23b1cb68975..1c26ee5db4b 100644
--- a/indra/newview/llnamelistctrl.h
+++ b/indra/newview/llnamelistctrl.h
@@ -120,6 +120,8 @@ class LLNameListCtrl
 	void setAllowCallingCardDrop(BOOL b) { mAllowCallingCardDrop = b; }
 
 	/*virtual*/ void updateColumns();
+
+	/*virtual*/ void	mouseOverHighlightNthItem( S32 index );
 private:
 	void showInspector(const LLUUID& avatar_id, bool is_group);
 
-- 
GitLab