From 884e08b5093453eeb8697ab2bdb242b4b3ab9135 Mon Sep 17 00:00:00 2001
From: Yuri Chebotarev <ychebotarev@productengine.com>
Date: Fri, 18 Jun 2010 10:47:49 +0300
Subject: [PATCH] EXT-6527 FIX Introduce new plain_text flag in LLTextBase and
 prevent image segment from being created if this flag is set.

reviewed by Richard Nelson at https://codereview.productengine.com/secondlife/r/587/

--HG--
branch : product-engine
---
 indra/llui/lltextbase.cpp       | 6 ++++++
 indra/llui/lltextbase.h         | 5 +++++
 indra/newview/llchathistory.cpp | 5 +++++
 3 files changed, 16 insertions(+)

diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 3c6c7d3e829..826ac3b9405 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -152,6 +152,7 @@ LLTextBase::Params::Params()
 	bg_writeable_color("bg_writeable_color"),
 	bg_focus_color("bg_focus_color"),
 	allow_scroll("allow_scroll", true),
+	plain_text("plain_text",false),
 	track_end("track_end", false),
 	read_only("read_only", false),
 	v_pad("v_pad", 0),
@@ -200,6 +201,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
 	mSelectionStart( 0 ),
 	mSelectionEnd( 0 ),
 	mIsSelecting( FALSE ),
+	mPlainText ( p.plain_text ),
 	mWordWrap(p.wrap),
 	mUseEllipses( p.use_ellipses ),
 	mParseHTML(p.allow_html),
@@ -1718,6 +1720,10 @@ void LLTextBase::appendLineBreakSegment(const LLStyle::Params& style_params)
 
 void LLTextBase::appendImageSegment(S32 highlight_part, const LLStyle::Params& style_params)
 {
+	if(getPlainText())
+	{
+		return;
+	}
 	segment_vec_t segments;
 	LLStyleConstSP sp(new LLStyle(style_params));
 	segments.push_back(new LLImageTextSegment(sp, getLength(),*this));
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 89ce5cdc8e1..0a1b7f9ec10 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -86,6 +86,7 @@ class LLTextBase
 								track_end,
 								read_only,
 								allow_scroll,
+								plain_text,
 								wrap,
 								use_ellipses,
 								allow_html,
@@ -177,6 +178,9 @@ class LLTextBase
 	void					setReadOnly(bool read_only) { mReadOnly = read_only; }
 	bool					getReadOnly() { return mReadOnly; }
 
+	void					setPlainText(bool value) { mPlainText = value;}
+	bool					getPlainText() const { return mPlainText; }
+
 	// cursor manipulation
 	bool					setCursor(S32 row, S32 column);
 	bool					setCursorPos(S32 cursor_pos, bool keep_cursor_offset = false);
@@ -366,6 +370,7 @@ class LLTextBase
 	bool						mReadOnly;
 	bool						mBGVisible;			// render background?
 	bool						mClipPartial;		// false if we show lines that are partially inside bounding rect
+	bool						mPlainText;			// didn't use Image or Icon segments
 	S32							mMaxTextByteLength;	// Maximum length mText is allowed to be in bytes
 
 	// support widgets
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 18c69b5130c..ab97dbb6953 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -557,6 +557,11 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 {
 	bool use_plain_text_chat_history = args["use_plain_text_chat_history"].asBoolean();
 
+	if(mEditor)
+	{
+		mEditor->setPlainText(use_plain_text_chat_history);
+	}
+
 	if (!mEditor->scrolledToEnd() && chat.mFromID != gAgent.getID() && !chat.mFromName.empty())
 	{
 		mUnreadChatSources.insert(chat.mFromName);
-- 
GitLab