[sldev-commits] r1619 - in branches/featurettes: doc indra/llcommon indra/llui indra/newview indra/newview/English.lproj indra/newview/res

cg.linden at svn.secondlife.com cg.linden at svn.secondlife.com
Sun Jan 4 06:03:10 PST 2009


Author: cg.linden
Date: 2009-01-04 08:03:09 -0600 (Sun, 04 Jan 2009)
New Revision: 1619

Added:
   branches/featurettes/indra/llui/lltextparser.cpp
   branches/featurettes/indra/llui/lltextparser.h
Modified:
   branches/featurettes/doc/asset_urls.txt
   branches/featurettes/indra/llcommon/llversionserver.h
   branches/featurettes/indra/llcommon/llversionviewer.h
   branches/featurettes/indra/llui/CMakeLists.txt
   branches/featurettes/indra/llui/lltexteditor.cpp
   branches/featurettes/indra/llui/lltexteditor.h
   branches/featurettes/indra/newview/English.lproj/InfoPlist.strings
   branches/featurettes/indra/newview/Info-SecondLife.plist
   branches/featurettes/indra/newview/llconsole.cpp
   branches/featurettes/indra/newview/llfloaterchat.cpp
   branches/featurettes/indra/newview/llimpanel.cpp
   branches/featurettes/indra/newview/llviewertexteditor.cpp
   branches/featurettes/indra/newview/res/viewerRes.rc
Trac: http://svn.secondlife.com/trac/linden/changeset/1619
Log:
Snapshot of internal branch featurettes
Internal URL: http://svn.lindenlab.com/svn/linden/branches/featurettes/featurettes-9
Revision Range: 107050 to 107051

Supplementary files:
  http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-darwin-libs-featurettes-1.22.0.107051.tar.gz
  http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-linux-libs-featurettes-1.22.0.107051.tar.gz
  http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-win32-libs-featurettes-1.22.0.107051.zip
  http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-artwork-featurettes-1.22.0.107051.zip
  http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/md5sums-featurettes-1.22.0.107051.txt
Source tarballs - redundant to this svn:
  http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-src-featurettes-1.22.0.107051.tar.gz
  http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-src-featurettes-1.22.0.107051.zip


Modified: branches/featurettes/doc/asset_urls.txt
===================================================================
--- branches/featurettes/doc/asset_urls.txt	2009-01-03 04:52:04 UTC (rev 1618)
+++ branches/featurettes/doc/asset_urls.txt	2009-01-04 14:03:09 UTC (rev 1619)
@@ -1,5 +1,5 @@
-SLASSET_LIBS_DARWIN=http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-darwin-libs-featurettes-1.22.0.107026.tar.gz
-SLASSET_LIBS_LINUXI386=http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-linux-libs-featurettes-1.22.0.107026.tar.gz
-SLASSET_LIBS_WIN32=http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-win32-libs-featurettes-1.22.0.107026.zip
-SLASSET_ART=http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-artwork-featurettes-1.22.0.107026.zip
-SLASSET_MD5=http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/md5sums-featurettes-1.22.0.107026.txt
+SLASSET_LIBS_DARWIN=http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-darwin-libs-featurettes-1.22.0.107051.tar.gz
+SLASSET_LIBS_LINUXI386=http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-linux-libs-featurettes-1.22.0.107051.tar.gz
+SLASSET_LIBS_WIN32=http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-win32-libs-featurettes-1.22.0.107051.zip
+SLASSET_ART=http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/slviewer-artwork-featurettes-1.22.0.107051.zip
+SLASSET_MD5=http://secondlife.com/developers/opensource/downloads/2009/01/featurettes/md5sums-featurettes-1.22.0.107051.txt

Modified: branches/featurettes/indra/llcommon/llversionserver.h
===================================================================
--- branches/featurettes/indra/llcommon/llversionserver.h	2009-01-03 04:52:04 UTC (rev 1618)
+++ branches/featurettes/indra/llcommon/llversionserver.h	2009-01-04 14:03:09 UTC (rev 1619)
@@ -35,7 +35,7 @@
 const S32 LL_VERSION_MAJOR = 1;
 const S32 LL_VERSION_MINOR = 26;
 const S32 LL_VERSION_PATCH = 0;
-const S32 LL_VERSION_BUILD = 107026;
+const S32 LL_VERSION_BUILD = 107051;
 
 const char * const LL_CHANNEL = "Second Life Server";
 

Modified: branches/featurettes/indra/llcommon/llversionviewer.h
===================================================================
--- branches/featurettes/indra/llcommon/llversionviewer.h	2009-01-03 04:52:04 UTC (rev 1618)
+++ branches/featurettes/indra/llcommon/llversionviewer.h	2009-01-04 14:03:09 UTC (rev 1619)
@@ -35,7 +35,7 @@
 const S32 LL_VERSION_MAJOR = 1;
 const S32 LL_VERSION_MINOR = 22;
 const S32 LL_VERSION_PATCH = 0;
-const S32 LL_VERSION_BUILD = 107026;
+const S32 LL_VERSION_BUILD = 107051;
 
 const char * const LL_CHANNEL = "Second Life Release";
 

Modified: branches/featurettes/indra/llui/CMakeLists.txt
===================================================================
--- branches/featurettes/indra/llui/CMakeLists.txt	2009-01-03 04:52:04 UTC (rev 1618)
+++ branches/featurettes/indra/llui/CMakeLists.txt	2009-01-04 14:03:09 UTC (rev 1619)
@@ -62,6 +62,7 @@
     lltabcontainervertical.cpp
     lltextbox.cpp
     lltexteditor.cpp
+    lltextparser.cpp
     llui.cpp
     lluictrl.cpp
     lluictrlfactory.cpp
@@ -114,6 +115,7 @@
     lltabcontainervertical.h
     lltextbox.h
     lltexteditor.h
+    lltextparser.h
     lluiconstants.h
     lluictrlfactory.h
     lluictrl.h

Modified: branches/featurettes/indra/llui/lltexteditor.cpp
===================================================================
--- branches/featurettes/indra/llui/lltexteditor.cpp	2009-01-03 04:52:04 UTC (rev 1618)
+++ branches/featurettes/indra/llui/lltexteditor.cpp	2009-01-04 14:03:09 UTC (rev 1619)
@@ -56,6 +56,7 @@
 #include "llcontrol.h"
 #include "llimagegl.h"
 #include "llwindow.h"
+#include "lltextparser.h"
 #include <queue>
 
 // 
@@ -3516,9 +3517,16 @@
 									 const LLColor4 &color,
 									 const std::string& font_name)
 {
+	LLColor4 lcolor=color;
+	if (mParseHighlights)
+	{
+		LLTextParser* highlight = LLTextParser::getInstance();
+		highlight->parseFullLineHighlights(new_text, &lcolor);
+	}
+	
 	LLStyleSP style(new LLStyle);
 	style->setVisible(true);
-	style->setColor(color);
+	style->setColor(lcolor);
 	style->setFontName(font_name);
 	appendStyledText(new_text, allow_undo, prepend_newline, style);
 }
@@ -3526,8 +3534,9 @@
 void LLTextEditor::appendStyledText(const std::string &new_text, 
 									 bool allow_undo, 
 									 bool prepend_newline,
-									 const LLStyleSP stylep)
+									 LLStyleSP stylep)
 {
+	S32 part = (S32)LLTextParser::WHOLE;
 	if(mParseHTML)
 	{
 
@@ -3544,27 +3553,73 @@
 			}
 			html->mUnderline = TRUE;
 
-			if (start > 0) appendText(text.substr(0,start),allow_undo, prepend_newline, stylep);
+			if (start > 0)
+			{
+				if (part == (S32)LLTextParser::WHOLE ||
+					part == (S32)LLTextParser::START)
+				{
+					part = (S32)LLTextParser::START;
+				}
+				else
+				{
+					part = (S32)LLTextParser::MIDDLE;
+				}
+				std::string subtext=text.substr(0,start);
+				appendHighlightedText(subtext,allow_undo, prepend_newline, part, stylep); 
+			}
+			
 			html->setLinkHREF(text.substr(start,end-start));
 			appendText(text.substr(start, end-start),allow_undo, prepend_newline, html);
 			if (end < (S32)text.length()) 
 			{
 				text = text.substr(end,text.length() - end);
 				end=0;
+				part=(S32)LLTextParser::END;
 			}
 			else
 			{
 				break;
 			}
 		}
-		if (end < (S32)text.length()) appendText(text,allow_undo, prepend_newline, stylep);
+		if (part != (S32)LLTextParser::WHOLE) part=(S32)LLTextParser::END;
+		if (end < (S32)text.length()) appendHighlightedText(text,allow_undo, prepend_newline, part, stylep);		
 	}
 	else
 	{
-		appendText(new_text, allow_undo, prepend_newline, stylep);
+		appendHighlightedText(new_text, allow_undo, prepend_newline, part, stylep);
 	}
 }
 
+void LLTextEditor::appendHighlightedText(const std::string &new_text, 
+										 bool allow_undo, 
+										 bool prepend_newline,
+										 S32  highlight_part,
+										 LLStyleSP stylep)
+{
+	if (mParseHighlights) 
+	{
+		LLTextParser* highlight = LLTextParser::getInstance();
+		
+		if (highlight)
+		{
+			LLSD pieces = highlight->parsePartialLineHighlights(new_text, stylep->getColor(), highlight_part);
+			bool lprepend=prepend_newline;
+			for (S32 i=0;i<pieces.size();i++)
+			{
+				LLSD color_llsd = pieces[i]["color"];
+				LLColor4 lcolor;
+				lcolor.setValue(color_llsd);
+				LLStyleSP lstylep(new LLStyle(*stylep));
+				lstylep->setColor(lcolor);
+				if (i != 0 && (pieces.size() > 1) ) lprepend=FALSE;
+				appendText((std::string)pieces[i]["text"], allow_undo, lprepend, lstylep);
+			}
+			return;
+		}
+	}
+	appendText(new_text, allow_undo, prepend_newline, stylep);
+}
+
 // Appends new text to end of document
 void LLTextEditor::appendText(const std::string &new_text, bool allow_undo, bool prepend_newline,
 							  const LLStyleSP stylep)

Modified: branches/featurettes/indra/llui/lltexteditor.h
===================================================================
--- branches/featurettes/indra/llui/lltexteditor.h	2009-01-03 04:52:04 UTC (rev 1618)
+++ branches/featurettes/indra/llui/lltexteditor.h	2009-01-04 14:03:09 UTC (rev 1619)
@@ -75,6 +75,7 @@
 	static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory);
 	void    setTextEditorParameters(LLXMLNodePtr node);
 	void	setParseHTML(BOOL parsing) {mParseHTML=parsing;}
+	void	setParseHighlights(BOOL parsing) {mParseHighlights=parsing;}
 
 	// mousehandler overrides
 	virtual BOOL	handleMouseDown(S32 x, S32 y, MASK mask);
@@ -148,8 +149,11 @@
 	// if styled text starts a line, you need to prepend a newline.
 	void 			appendStyledText(const std::string &new_text, bool allow_undo, 
 									 bool prepend_newline,
-									 const LLStyleSP stylep = NULL);
-
+									 LLStyleSP stylep = NULL);
+	void			appendHighlightedText(const std::string &new_text,  bool allow_undo, 
+										  bool prepend_newline,	 S32  highlight_part,
+										  LLStyleSP stylep);
+	
 	// Removes text from the end of document
 	// Does not change highlight or cursor position.
 	void 			removeTextFromEnd(S32 num_chars);
@@ -401,6 +405,7 @@
 	S32				mLastSelectionY;
 
 	BOOL			mParseHTML;
+	BOOL			mParseHighlights;
 	std::string		mHTML;
 
 	typedef std::vector<LLTextSegment *> segment_list_t;

Added: branches/featurettes/indra/llui/lltextparser.cpp
===================================================================
--- branches/featurettes/indra/llui/lltextparser.cpp	                        (rev 0)
+++ branches/featurettes/indra/llui/lltextparser.cpp	2009-01-04 14:03:09 UTC (rev 1619)
@@ -0,0 +1,299 @@
+/** 
+ * @file lltexteditor.cpp
+ * @brief LLTextEditor base class
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+
+#include "llsd.h"
+#include "llsdserialize.h"
+#include "llerror.h"
+#include "lluuid.h"
+#include "llstring.h"
+#include "message.h"
+#include "llmath.h"
+#include "v4color.h"
+#include "audioengine.h"
+#include "llwindow.h"
+#include "lldir.h"
+
+#include "lltextparser.h"
+//#include "lltexttospeech.h"
+
+// Routines used for parsing text for TextParsers and html
+
+LLTextParser* LLTextParser::sInstance = NULL;
+
+//
+// Constants
+//
+const F32 SOUND_GAIN = 1.0f;
+
+//
+// Member Functions
+//
+
+LLTextParser::~LLTextParser()
+{
+	sInstance=NULL;
+}
+
+// static
+LLTextParser* LLTextParser::getInstance()
+{
+	if (!sInstance)
+	{
+		sInstance = new LLTextParser();
+		sInstance->loadFromDisk();
+	}
+	return sInstance;
+}
+
+void LLTextParser::triggerAlerts(LLUUID agent_id, LLVector3d position, std::string text, LLWindow* viewer_window)
+{
+//    bool spoken=FALSE;
+	for (S32 i=0;i<mHighlights.size();i++)
+	{
+		if (findPattern(text,mHighlights[i]) >= 0 )
+		{
+			if(gAudiop)
+			{
+				if ((std::string)mHighlights[i]["sound_lluuid"] != LLUUID::null.asString())
+				{
+					gAudiop->triggerSound(mHighlights[i]["sound_lluuid"].asUUID(), agent_id, SOUND_GAIN, LLAudioEngine::AUDIO_TYPE_UI, position);
+				}
+/*				
+				if (!spoken) 
+				{
+					LLTextToSpeech* text_to_speech = NULL;
+					text_to_speech = LLTextToSpeech::getInstance();
+					spoken = text_to_speech->speak((LLString)mHighlights[i]["voice"],text); 
+				}
+ */
+			}
+			if (mHighlights[i]["flash"])
+			{
+				if (viewer_window && viewer_window->getMinimized())
+				{
+					viewer_window->flashIcon(5.f);
+				}
+			}
+		}
+	}
+}
+
+S32 LLTextParser::findPattern(const std::string &text, LLSD highlight)
+{
+	if (!highlight.has("pattern")) return -1;
+	
+	std::string pattern=std::string(highlight["pattern"]);
+	std::string ltext=text;
+	
+	if (!(bool)highlight["case_sensitive"])
+	{
+		ltext   = utf8str_tolower(text);
+		pattern= utf8str_tolower(pattern);
+	}
+
+	S32 found=std::string::npos;
+	
+	switch ((S32)highlight["condition"])
+	{
+		case CONTAINS:
+			found = ltext.find(pattern); 
+			break;
+		case MATCHES:
+		    found = (! ltext.compare(pattern) ? 0 : std::string::npos);
+			break;
+		case STARTS_WITH:
+			found = (! ltext.find(pattern) ? 0 : std::string::npos);
+			break;
+		case ENDS_WITH:
+			S32 pos = ltext.rfind(pattern); 
+			if (pos >= 0 && (ltext.length()-pattern.length()==pos)) found = pos;
+			break;
+	}
+	return found;
+}
+
+LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLColor4 &color, S32 part, S32 index)
+{
+	//evil recursive string atomizer.
+	LLSD ret_llsd, start_llsd, middle_llsd, end_llsd;
+
+	for (S32 i=index;i<mHighlights.size();i++)
+	{
+		S32 condition = mHighlights[i]["condition"];
+		if ((S32)mHighlights[i]["highlight"]==PART && condition!=MATCHES)
+		{
+			if ( (condition==STARTS_WITH && part==START) ||
+			     (condition==ENDS_WITH   && part==END)   ||
+				  condition==CONTAINS    || part==WHOLE )
+			{
+				S32 start = findPattern(text,mHighlights[i]);
+				if (start >= 0 )
+				{
+					S32 end =  std::string(mHighlights[i]["pattern"]).length();
+					S32 len = text.length();
+					S32 newpart;
+					if (start==0)
+					{
+						start_llsd[0]["text"] =text.substr(0,end);
+						start_llsd[0]["color"]=mHighlights[i]["color"];
+						
+						if (end < len)
+						{
+							if (part==END   || part==WHOLE) newpart=END; else newpart=MIDDLE;
+							end_llsd=parsePartialLineHighlights(text.substr( end ),color,newpart,i);
+						}
+					}
+					else
+					{
+						if (part==START || part==WHOLE) newpart=START; else newpart=MIDDLE;
+
+						start_llsd=parsePartialLineHighlights(text.substr(0,start),color,newpart,i+1);
+						
+						if (end < len)
+						{
+							middle_llsd[0]["text"] =text.substr(start,end);
+							middle_llsd[0]["color"]=mHighlights[i]["color"];
+						
+							if (part==END   || part==WHOLE) newpart=END; else newpart=MIDDLE;
+
+							end_llsd=parsePartialLineHighlights(text.substr( (start+end) ),color,newpart,i);
+						}
+						else
+						{
+							end_llsd[0]["text"] =text.substr(start,end);
+							end_llsd[0]["color"]=mHighlights[i]["color"];
+						}
+					}
+						
+					S32 retcount=0;
+					
+					//FIXME These loops should be wrapped into a subroutine.
+					for (LLSD::array_iterator iter = start_llsd.beginArray();
+						 iter != start_llsd.endArray();++iter)
+					{
+						LLSD highlight = *iter;
+						ret_llsd[retcount++]=highlight;
+					}
+						   
+					for (LLSD::array_iterator iter = middle_llsd.beginArray();
+						 iter != middle_llsd.endArray();++iter)
+					{
+						LLSD highlight = *iter;
+						ret_llsd[retcount++]=highlight;
+					}
+						   
+					for (LLSD::array_iterator iter = end_llsd.beginArray();
+						 iter != end_llsd.endArray();++iter)
+					{
+						LLSD highlight = *iter;
+						ret_llsd[retcount++]=highlight;
+					}
+						   
+					return ret_llsd;
+				}
+			}
+		}
+	}
+	
+	//No patterns found.  Just send back what was passed in.
+	ret_llsd[0]["text"] =text;
+	LLSD color_sd = color.getValue();
+	ret_llsd[0]["color"]=color_sd;
+	return ret_llsd;
+}
+
+bool LLTextParser::parseFullLineHighlights(const std::string &text, LLColor4 *color)
+{
+	for (S32 i=0;i<mHighlights.size();i++)
+	{
+		if ((S32)mHighlights[i]["highlight"]==ALL || (S32)mHighlights[i]["condition"]==MATCHES)
+		{
+			if (findPattern(text,mHighlights[i]) >= 0 )
+			{
+				LLSD color_llsd = mHighlights[i]["color"];
+				color->setValue(color_llsd);
+				return TRUE;
+			}
+		}
+	}
+	return FALSE;	//No matches found.
+}
+
+std::string LLTextParser::getFileName()
+{
+	std::string path=gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "");
+	
+	if (!path.empty())
+	{
+		path = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "highlights.xml");
+	}
+	return path;  
+}
+
+LLSD LLTextParser::loadFromDisk()
+{
+	std::string filename=getFileName();
+	if (filename.empty())
+	{
+		llwarns << "LLTextParser::loadFromDisk() no valid user directory." << llendl; 
+		delete sInstance;
+	}
+	else
+	{
+		llifstream file;
+		file.open(filename.c_str());
+		if (file.is_open())
+		{
+			LLSDSerialize::fromXML(mHighlights, file);
+		}
+		file.close();
+	}
+
+	return mHighlights;
+}
+
+bool LLTextParser::saveToDisk(LLSD highlights)
+{
+	mHighlights=highlights;
+	std::string filename=getFileName();
+	if (filename.empty())
+	{
+		llwarns << "LLTextParser::saveToDisk() no valid user directory." << llendl; 
+		return FALSE;
+	}	
+	llofstream file;
+	file.open(filename.c_str());
+	LLSDSerialize::toPrettyXML(mHighlights, file);
+	file.close();
+	return TRUE;
+}

Added: branches/featurettes/indra/llui/lltextparser.h
===================================================================
--- branches/featurettes/indra/llui/lltextparser.h	                        (rev 0)
+++ branches/featurettes/indra/llui/lltextparser.h	2009-01-04 14:03:09 UTC (rev 1619)
@@ -0,0 +1,61 @@
+/** 
+ * @file llTextParser.h
+ * @brief GUI for user-defined highlights
+ *
+ * $LicenseInfo:firstyear=2002&license=internal$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
+ * 
+ * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of
+ * this source code is governed by the Linden Lab Source Code Disclosure
+ * Agreement ("Agreement") previously entered between you and Linden
+ * Lab. By accessing, using, copying, modifying or distributing this
+ * software, you acknowledge that you have been informed of your
+ * obligations under the Agreement and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLTEXTPARSER_H
+#define LL_LLTEXTPARSER_H
+
+#include <vector>
+#include "linden_common.h"
+
+#include "lltextparser.h"
+
+class LLSD;
+class LLUUID;
+class LLVector3d;
+class LLColor4;
+
+class LLTextParser
+{
+public:
+	enum ConditionType { CONTAINS, MATCHES, STARTS_WITH, ENDS_WITH };
+	enum HighlightType { PART, ALL };
+	enum HighlightPosition { WHOLE, START, MIDDLE, END };
+	enum DialogAction  { ACTION_NONE, ACTION_CLOSE, ACTION_ADD, ACTION_COPY, ACTION_UPDATE };
+
+	static LLTextParser* getInstance();
+	LLTextParser(){};
+	~LLTextParser();
+
+	S32  findPattern(const std::string &text, LLSD highlight);
+	LLSD parsePartialLineHighlights(const std::string &text,const LLColor4 &color,S32 part=WHOLE, S32 index=0);
+	bool parseFullLineHighlights(const std::string &text, LLColor4 *color);
+	void triggerAlerts(LLUUID agent_id, LLVector3d position, std::string text, LLWindow* viewer_window);
+
+	std::string getFileName();
+	LLSD loadFromDisk();
+	bool saveToDisk(LLSD highlights);
+public:
+		LLSD	mHighlights;
+private:
+	static LLTextParser* sInstance;
+};
+
+#endif

Modified: branches/featurettes/indra/newview/English.lproj/InfoPlist.strings
===================================================================
--- branches/featurettes/indra/newview/English.lproj/InfoPlist.strings	2009-01-03 04:52:04 UTC (rev 1618)
+++ branches/featurettes/indra/newview/English.lproj/InfoPlist.strings	2009-01-04 14:03:09 UTC (rev 1619)
@@ -1,6 +1,6 @@
 /* Localized versions of Info.plist keys */
 
 CFBundleName = "Second Life";
-CFBundleShortVersionString = "Second Life version 1.22.0.107026";
-CFBundleGetInfoString = "Second Life version 1.22.0.107026, Copyright 2004-2008 Linden Research, Inc.";
+CFBundleShortVersionString = "Second Life version 1.22.0.107051";
+CFBundleGetInfoString = "Second Life version 1.22.0.107051, Copyright 2004-2008 Linden Research, Inc.";
 

Modified: branches/featurettes/indra/newview/Info-SecondLife.plist
===================================================================
--- branches/featurettes/indra/newview/Info-SecondLife.plist	2009-01-03 04:52:04 UTC (rev 1618)
+++ branches/featurettes/indra/newview/Info-SecondLife.plist	2009-01-04 14:03:09 UTC (rev 1619)
@@ -32,7 +32,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>1.22.0.107026</string>
+	<string>1.22.0.107051</string>
 	<key>CSResourcesFileMapped</key>
 	<true/>
 </dict>

Modified: branches/featurettes/indra/newview/llconsole.cpp
===================================================================
--- branches/featurettes/indra/newview/llconsole.cpp	2009-01-03 04:52:04 UTC (rev 1618)
+++ branches/featurettes/indra/newview/llconsole.cpp	2009-01-04 14:03:09 UTC (rev 1619)
@@ -43,6 +43,7 @@
 #include "llviewerimage.h"
 #include "llviewerimagelist.h"
 #include "llviewerwindow.h"
+#include "lltextparser.h"
 #include "llsd.h"
 #include "llfontgl.h"
 #include "llmath.h"
@@ -279,13 +280,15 @@
 //Generate highlight color segments for this paragraph.  Pass in default color of paragraph.
 void LLConsole::Paragraph::makeParagraphColorSegments (const LLColor4 &color) 
 {
+	LLTextParser* highlight = LLTextParser::getInstance();
 	LLSD paragraph_color_segments;
 	LLColor4 lcolor=color;
 	
-	paragraph_color_segments[0]["text"] =wstring_to_utf8str(mParagraphText);
-	LLSD color_sd = color.getValue();
-	paragraph_color_segments[0]["color"]=color_sd;
-
+	highlight->parseFullLineHighlights(wstring_to_utf8str(mParagraphText), &lcolor);
+	paragraph_color_segments = highlight->parsePartialLineHighlights(
+											wstring_to_utf8str(mParagraphText), 
+											lcolor);
+	
 	for(LLSD::array_const_iterator color_segment_it = paragraph_color_segments.beginArray();
 		color_segment_it != paragraph_color_segments.endArray();
 		++color_segment_it)

Modified: branches/featurettes/indra/newview/llfloaterchat.cpp
===================================================================
--- branches/featurettes/indra/newview/llfloaterchat.cpp	2009-01-03 04:52:04 UTC (rev 1618)
+++ branches/featurettes/indra/newview/llfloaterchat.cpp	2009-01-04 14:03:09 UTC (rev 1619)
@@ -70,6 +70,7 @@
 #include "llchatbar.h"
 #include "lllogchat.h"
 #include "lltexteditor.h"
+#include "lltextparser.h"
 #include "llfloaterhtml.h"
 #include "llweb.h"
 #include "llstylemap.h"
@@ -262,6 +263,9 @@
 	history_editor->setParseHTML(TRUE);
 	history_editor_with_mute->setParseHTML(TRUE);
 	
+	history_editor->setParseHighlights(TRUE);
+	history_editor_with_mute->setParseHighlights(TRUE);
+	
 	if (!chat.mMuted)
 	{
 		add_timestamped_line(history_editor, chat, color);
@@ -400,7 +404,10 @@
 	
 	if(from_instant_message && gSavedSettings.getBOOL("IMInChatHistory"))
 		addChatHistory(chat,false);
-	
+
+	LLTextParser* highlight = LLTextParser::getInstance();
+	highlight->triggerAlerts(gAgent.getID(), gAgent.getPositionGlobal(), chat.mText, gViewerWindow->getWindow());
+
 	if(!from_instant_message)
 		addChatHistory(chat);
 }

Modified: branches/featurettes/indra/newview/llimpanel.cpp
===================================================================
--- branches/featurettes/indra/newview/llimpanel.cpp	2009-01-03 04:52:04 UTC (rev 1618)
+++ branches/featurettes/indra/newview/llimpanel.cpp	2009-01-04 14:03:09 UTC (rev 1619)
@@ -1254,6 +1254,7 @@
 
 		mHistoryEditor = getChild<LLViewerTextEditor>("im_history");
 		mHistoryEditor->setParseHTML(TRUE);
+		mHistoryEditor->setParseHighlights(TRUE);
 
 		if ( IM_SESSION_GROUP_START == mDialog )
 		{

Modified: branches/featurettes/indra/newview/llviewertexteditor.cpp
===================================================================
--- branches/featurettes/indra/newview/llviewertexteditor.cpp	2009-01-03 04:52:04 UTC (rev 1618)
+++ branches/featurettes/indra/newview/llviewertexteditor.cpp	2009-01-04 14:03:09 UTC (rev 1619)
@@ -1593,6 +1593,7 @@
 	BOOL parse_html = text_editor->mParseHTML;
 	node->getAttributeBOOL("allow_html", parse_html);
 	text_editor->setParseHTML(parse_html);
+	text_editor->setParseHighlights(TRUE);
 
 	text_editor->initFromXML(node, parent);
 

Modified: branches/featurettes/indra/newview/res/viewerRes.rc
===================================================================
--- branches/featurettes/indra/newview/res/viewerRes.rc	2009-01-03 04:52:04 UTC (rev 1618)
+++ branches/featurettes/indra/newview/res/viewerRes.rc	2009-01-04 14:03:09 UTC (rev 1619)
@@ -231,8 +231,8 @@
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,22,0,107026
- PRODUCTVERSION 1,22,0,107026
+ FILEVERSION 1,22,0,107051
+ PRODUCTVERSION 1,22,0,107051
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -249,12 +249,12 @@
         BEGIN
             VALUE "CompanyName", "Linden Lab"
             VALUE "FileDescription", "Second Life"
-            VALUE "FileVersion", "1.22.0.107026"
+            VALUE "FileVersion", "1.22.0.107051"
             VALUE "InternalName", "Second Life"
             VALUE "LegalCopyright", "Copyright © 2001-2008, Linden Research, Inc."
             VALUE "OriginalFilename", "SecondLife.exe"
             VALUE "ProductName", "Second Life"
-            VALUE "ProductVersion", "1.22.0.107026"
+            VALUE "ProductVersion", "1.22.0.107051"
         END
     END
     BLOCK "VarFileInfo"



More information about the sldev-commits mailing list