From 80f8a465eb2885246b0a1daca66077ecd1dcc61d Mon Sep 17 00:00:00 2001
From: Gilbert Gonzales <gilbert@lindenlab.com>
Date: Wed, 28 Nov 2012 11:35:59 -0800
Subject: [PATCH] CHUI-548: Now a p2p conversation is aligned with the nearby
 chat arrow. Just had to check for a p2p conversation type and then adjust
 then decrease the indentation. Also made
 LLFolderViewItem::drawOpenFolderArrow() a non-virtual function and adjusted
 code accordingly.

---
 indra/llui/llfolderviewitem.h          |  2 +-
 indra/newview/llconversationview.cpp   | 27 ++++++++++++--------------
 indra/newview/llconversationview.h     |  3 +--
 indra/newview/llfloaterimcontainer.cpp |  6 ++++++
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h
index c5d6d26e843..2e633a39e5c 100755
--- a/indra/llui/llfolderviewitem.h
+++ b/indra/llui/llfolderviewitem.h
@@ -264,7 +264,7 @@ class LLFolderViewItem : public LLView
 
 	//	virtual void handleDropped();
 	virtual void draw();
-	virtual void drawOpenFolderArrow(const Params& default_params, const LLUIColor& fg_color);
+	void drawOpenFolderArrow(const Params& default_params, const LLUIColor& fg_color);
     void drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &bgColor, const LLUIColor &outlineColor, const LLUIColor &mouseOverColor);
     void drawLabel(const LLFontGL * font, const F32 x, const F32 y, const LLColor4& color, F32 &right_x);
 	virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp
index e40d57c3187..3aadc2986f1 100755
--- a/indra/newview/llconversationview.cpp
+++ b/indra/newview/llconversationview.cpp
@@ -80,7 +80,8 @@ LLConversationViewSession::LLConversationViewSession(const LLConversationViewSes
 	mSessionTitle(NULL),
 	mSpeakingIndicator(NULL),
 	mVoiceClientObserver(NULL),
-	mMinimizedMode(false)
+	mMinimizedMode(false),
+    mHasArrow(true)
 {
 	mFlashTimer = new LLFlashTimer();
 }
@@ -135,6 +136,7 @@ BOOL LLConversationViewSession::postBuild()
 				icon->setVisible(true);
 				icon->setValue(session->mOtherParticipantID);
 				mSpeakingIndicator->setSpeakerId(gAgentID, session->mSessionID, true);
+                mHasArrow = false;
 			}
 			break;
 		}
@@ -183,11 +185,10 @@ void LLConversationViewSession::draw()
 	const BOOL show_context = (getRoot() ? getRoot()->getShowSelectionContext() : FALSE);
 
 	// we don't draw the open folder arrow in minimized mode
-	if (!mMinimizedMode)
+	if (mHasArrow && !mMinimizedMode)
 	{
 		// update the rotation angle of open folder arrow
 		updateLabelRotation();
-
 		drawOpenFolderArrow(default_params, sFgColor);
 	}
 
@@ -227,14 +228,18 @@ BOOL LLConversationViewSession::handleMouseDown( S32 x, S32 y, MASK mask )
 // virtual
 S32 LLConversationViewSession::arrange(S32* width, S32* height)
 {
-	S32 h_pad = getIndentation() + mArrowSize;
+    //LLFolderViewFolder::arrange computes value for getIndentation() function below
+    S32 arranged = LLFolderViewFolder::arrange(width, height);
+
+    S32 h_pad = mHasArrow ? getIndentation() + mArrowSize : getIndentation();
+	
 	LLRect rect(mMinimizedMode ? getLocalRect().mLeft : h_pad,
 				getLocalRect().mTop,
 				getLocalRect().mRight,
 				getLocalRect().mTop - getItemHeight());
 	mItemPanel->setShape(rect);
 
-	return LLFolderViewFolder::arrange(width, height);
+	return arranged;
 }
 
 // virtual
@@ -262,7 +267,8 @@ void LLConversationViewSession::toggleMinimizedMode(bool is_minimized)
 	// except for the icon which we display in minimized mode
 	getChild<LLView>("conversation_item_stack")->setVisible(!mMinimizedMode);
 
-	S32 h_pad = getIndentation() + mArrowSize;
+    S32 h_pad = mHasArrow ? getIndentation() + mArrowSize : getIndentation();
+
 	mItemPanel->translate(mMinimizedMode ? -h_pad : h_pad, 0);
 }
 
@@ -340,15 +346,6 @@ void LLConversationViewSession::onCurrentVoiceSessionChanged(const LLUUID& sessi
 	}
 }
 
-void LLConversationViewSession::drawOpenFolderArrow(const LLFolderViewItem::Params& default_params, const LLUIColor& fg_color)
-{
-	LLConversationItem * itemp = dynamic_cast<LLConversationItem*>(getViewModelItem());
-	if (itemp && itemp->getType() != LLConversationItem::CONV_SESSION_1_ON_1)
-	{
-		LLFolderViewFolder::drawOpenFolderArrow(default_params, fg_color);
-	}
-}
-
 //
 // Implementation of conversations list participant (avatar) widgets
 //
diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h
index acd7128b7d7..c6cb5023558 100755
--- a/indra/newview/llconversationview.h
+++ b/indra/newview/llconversationview.h
@@ -74,8 +74,6 @@ class LLConversationViewSession : public LLFolderViewFolder
 
 	/*virtual*/	bool isMinimized() { return mMinimizedMode; }
 
-	/*virtual*/ void drawOpenFolderArrow(const LLFolderViewItem::Params& default_params, const LLUIColor& fg_color);
-
 	void toggleMinimizedMode(bool is_minimized);
 
 	void setVisibleIfDetached(BOOL visible);
@@ -98,6 +96,7 @@ class LLConversationViewSession : public LLFolderViewFolder
 	LLFlashTimer*			mFlashTimer;
 
 	bool					mMinimizedMode;
+    bool                    mHasArrow;
 
 	LLVoiceClientStatusObserver* mVoiceClientObserver;
 	
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index 016a7723b6f..5fbbfd12830 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -1383,6 +1383,12 @@ LLConversationViewSession* LLFloaterIMContainer::createConversationItemWidget(LL
 	params.tool_tip = params.name;
 	params.container = this;
 	
+    //Indentation for aligning the p2p converstation image with the nearby chat arrow
+    if(item->getType() == LLConversationItem::CONV_SESSION_1_ON_1)
+    {
+        params.folder_indentation = 3;
+    }
+
 	return LLUICtrlFactory::create<LLConversationViewSession>(params);
 }
 
-- 
GitLab