diff --git a/doc/contributions.txt b/doc/contributions.txt
index cfea47c1d6f0851a9c2fda9f47c64b5f4b6ed12b..236d6bbd2083ec0af19b4d71f82d06952824cd7c 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -13,6 +13,8 @@ Able Whitman
 Adam Marker
 	VWR-2755
 Aimee Trescothick
+	VWR-1813
+	VWR-3321
 	VWR-3336
 	VWR-3903
 	VWR-4083
@@ -22,12 +24,13 @@ Aimee Trescothick
 	VWR-6550
 	VWR-6583
 	VWR-6482
-    VWR-7109
+  VWR-7109
 	VWR-7383
 	VWR-8341
 	VWR-8430
 	VWR-8482
 	VWR-9255
+	VWR-11844
 Alejandro Rosenthal
 	VWR-1184
 Aleric Inglewood
@@ -81,6 +84,7 @@ Argent Stonecutter
 	VWR-68
 Asuka Neely
 	VWR-3434
+	VWR-8179
 Balp Allen
 	VWR-4157
 Benja Kepler
@@ -248,6 +252,7 @@ Matthew Dowd
 	VWR-1736
 	VWR-1737
 	VWR-1761
+	VWR-2681
 McCabe Maxsted
 	VWR-1318
 	VWR-4065
@@ -458,6 +463,8 @@ Tue Torok
 	CT-72
 	CT-73
 	CT-74
+Vadim Bigbear
+	VWR-2681
 Whoops Babii
 	VWR-631
 	VWR-1640
diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt
index 72aa3715c088150c7f7f95fd54d863128bf2f1c7..0bdb55f9d091a6a932ff9fa665369ea02ece80a3 100644
--- a/indra/llrender/CMakeLists.txt
+++ b/indra/llrender/CMakeLists.txt
@@ -9,6 +9,8 @@ include(LLImage)
 include(LLMath)
 include(LLRender)
 include(LLWindow)
+include(LLXML)
+include(LLVFS)
 
 include_directories(
     ${FREETYPE_INCLUDE_DIRS}
@@ -17,12 +19,16 @@ include_directories(
     ${LLMATH_INCLUDE_DIRS}
     ${LLRENDER_INCLUDE_DIRS}
     ${LLWINDOW_INCLUDE_DIRS}
+    ${LLXML_INCLUDE_DIRS}
+    ${LLVFS_INCLUDE_DIRS}
     )
 
 set(llrender_SOURCE_FILES
     llcubemap.cpp
     llfont.cpp
     llfontgl.cpp
+    llfontbitmapcache.cpp
+    llfontregistry.cpp
     llgldbg.cpp
     llglslshader.cpp
     llimagegl.cpp
@@ -38,6 +44,8 @@ set(llrender_HEADER_FILES
     llcubemap.h
     llfontgl.h
     llfont.h
+    llfontbitmapcache.h
+    llfontregistry.h
     llgl.h
     llgldbg.h
     llglheaders.h
diff --git a/indra/llrender/llfontbitmapcache.cpp b/indra/llrender/llfontbitmapcache.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f6321b053496392fa3c1c207223c4b48f6e82cd3
--- /dev/null
+++ b/indra/llrender/llfontbitmapcache.cpp
@@ -0,0 +1,168 @@
+/** 
+ * @file llfontbitmapcache.cpp
+ * @brief Storage for previously rendered glyphs.
+ *
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ * 
+ * Copyright (c) 2008, 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://secondlife.com/developers/opensource/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://secondlife.com/developers/opensource/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 "llgl.h"
+#include "llfontbitmapcache.h"
+
+LLFontBitmapCache::LLFontBitmapCache():
+	mNumComponents(0),
+	mMaxCharWidth(0),
+	mMaxCharHeight(0),
+	mBitmapWidth(0),
+	mBitmapHeight(0),
+	mCurrentOffsetX(1),
+	mCurrentOffsetY(1),
+	mCurrentBitmapNum(-1)
+{
+}
+
+LLFontBitmapCache::~LLFontBitmapCache()
+{
+}
+
+void LLFontBitmapCache::init(S32 num_components,
+							 S32 max_char_width,
+							 S32 max_char_height)
+{
+	reset();
+	
+	mNumComponents = num_components;
+	mMaxCharWidth = max_char_width;
+	mMaxCharHeight = max_char_height;
+}
+
+LLImageRaw *LLFontBitmapCache::getImageRaw(U32 bitmap_num) const
+{
+	if ((bitmap_num < 0) || (bitmap_num >= mImageRawVec.size()))
+		return NULL;
+
+	return mImageRawVec[bitmap_num];
+}
+
+LLImageGL *LLFontBitmapCache::getImageGL(U32 bitmap_num) const
+{
+	if ((bitmap_num < 0) || (bitmap_num >= mImageGLVec.size()))
+		return NULL;
+
+	return mImageGLVec[bitmap_num];
+}
+
+
+BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32 &pos_x, S32 &pos_y, S32& bitmap_num)
+{
+	if ((mBitmapNum<0) || (mCurrentOffsetX + width + 1) > mBitmapWidth)
+	{
+		if ((mBitmapNum<0) || (mCurrentOffsetY + 2*mMaxCharHeight + 2) > mBitmapHeight)
+		{
+			// We're out of space in the current image, or no image
+			// has been allocated yet.  Make a new one.
+			mImageRawVec.push_back(new LLImageRaw);
+			mBitmapNum = mImageRawVec.size()-1;
+			LLImageRaw *image_raw = getImageRaw(mBitmapNum);
+
+			// Make corresponding GL image.
+			mImageGLVec.push_back(new LLImageGL(FALSE));
+			LLImageGL *image_gl = getImageGL(mBitmapNum);
+			
+			S32 image_width = mMaxCharWidth * 20;
+			S32 pow_iw = 2;
+			while (pow_iw < image_width)
+			{
+				pow_iw *= 2;
+			}
+			image_width = pow_iw;
+			image_width = llmin(512, image_width); // Don't make bigger than 512x512, ever.
+			S32 image_height = image_width;
+
+			image_raw->resize(image_width, image_height, mNumComponents);
+
+			mBitmapWidth = image_width;
+			mBitmapHeight = image_height;
+
+			switch (mNumComponents)
+			{
+				case 1:
+					image_raw->clear();
+				break;
+				case 2:
+					image_raw->clear(255, 0);
+				break;
+			}
+
+			// Start at beginning of the new image.
+			mCurrentOffsetX = 1;
+			mCurrentOffsetY = 1;
+
+			// Attach corresponding GL texture.
+			image_gl->createGLTexture(0, image_raw);
+			gGL.getTexUnit(0)->bind(image_gl);
+			image_gl->setFilteringOption(LLTexUnit::TFO_POINT); // was setMipFilterNearest(TRUE, TRUE);
+		}
+		else
+		{
+			// Move to next row in current image.
+			mCurrentOffsetX = 1;
+			mCurrentOffsetY += mMaxCharHeight + 1;
+		}
+	}
+
+	pos_x = mCurrentOffsetX;
+	pos_y = mCurrentOffsetY;
+	bitmap_num = mBitmapNum;
+
+	mCurrentOffsetX += width + 1;
+
+	return TRUE;
+}
+
+void LLFontBitmapCache::destroyGL()
+{
+	for (std::vector<LLPointer<LLImageGL> >::iterator it = mImageGLVec.begin();
+		 it != mImageGLVec.end(); ++it)
+	{
+		(*it)->destroyGLTexture();
+	}
+}
+
+void LLFontBitmapCache::reset()
+{
+	mImageRawVec.clear();
+	mImageGLVec.clear();
+	
+	mBitmapWidth = 0,
+	mBitmapHeight = 0,
+	mCurrentOffsetX = 0,
+	mCurrentOffsetY = 0,
+	mCurrentBitmapNum = -1;
+}
+
diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h
new file mode 100644
index 0000000000000000000000000000000000000000..e5c09f8826c4ae3c476fc5202fb3a8864422317e
--- /dev/null
+++ b/indra/llrender/llfontbitmapcache.h
@@ -0,0 +1,78 @@
+/** 
+ * @file llfontbitmapcache.h
+ * @brief Storage for previously rendered glyphs.
+ *
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ * 
+ * Copyright (c) 2008, 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://secondlife.com/developers/opensource/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://secondlife.com/developers/opensource/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$
+ */
+
+#ifndef LL_LLFONTBITMAPCACHE_H
+#define LL_LLFONTBITMAPCACHE_H
+
+#include <vector>
+
+// Maintain a collection of bitmaps containing rendered glyphs.
+// Generalizes the single-bitmap logic from LLFont and LLFontGL.
+class LLFontBitmapCache: public LLRefCount
+{
+public:
+	LLFontBitmapCache();
+	~LLFontBitmapCache();
+
+	// Need to call this once, before caching any glyphs.
+ 	void init(S32 num_components,
+			  S32 max_char_width,
+			  S32 max_char_height);
+
+	void reset();
+
+	BOOL nextOpenPos(S32 width, S32 &posX, S32 &posY, S32 &bitmapNum);
+	
+	void destroyGL();
+	
+ 	LLImageRaw *getImageRaw(U32 bitmapNum = 0) const;
+ 	LLImageGL *getImageGL(U32 bitmapNum = 0) const;
+	
+	S32 getMaxCharWidth() const { return mMaxCharWidth; }
+	S32 getNumComponents() const { return mNumComponents; }
+	S32 getBitmapWidth() const { return mBitmapWidth; }
+	S32 getBitmapHeight() const { return mBitmapHeight; }
+
+private:
+	S32 mNumComponents;
+	S32 mBitmapWidth;
+	S32 mBitmapHeight;
+	S32 mBitmapNum;
+	S32 mMaxCharWidth;
+	S32 mMaxCharHeight;
+	S32 mCurrentOffsetX;
+	S32 mCurrentOffsetY;
+	S32 mCurrentBitmapNum;
+	std::vector<LLPointer<LLImageRaw> >	mImageRawVec;
+	std::vector<LLPointer<LLImageGL> > mImageGLVec;
+};
+
+#endif //LL_LLFONTBITMAPCACHE_H
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index 3829306e25a075e6c5cafd9e649ebf87c599e8df..e0c3ec3c24c1b71a4058c14ee2166a95864cb857 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -36,6 +36,8 @@
 
 #include "llfont.h"
 #include "llfontgl.h"
+#include "llfontbitmapcache.h"
+#include "llfontregistry.h"
 #include "llgl.h"
 #include "llrender.h"
 #include "v4color.h"
@@ -51,25 +53,12 @@ F32 LLFontGL::sScaleY = 1.f;
 BOOL LLFontGL::sDisplayFont = TRUE ;
 std::string LLFontGL::sAppDir;
 
-LLFontGL* LLFontGL::sMonospace = NULL;
-LLFontGL* LLFontGL::sSansSerifSmall = NULL;
-LLFontGL* LLFontGL::sSansSerif = NULL;
-LLFontGL* LLFontGL::sSansSerifBig = NULL;
-LLFontGL* LLFontGL::sSansSerifHuge = NULL;
-LLFontGL* LLFontGL::sSansSerifBold = NULL;
-LLFontList*	LLFontGL::sMonospaceFallback = NULL;
-LLFontList*	LLFontGL::sSSFallback = NULL;
-LLFontList*	LLFontGL::sSSSmallFallback = NULL;
-LLFontList*	LLFontGL::sSSBigFallback = NULL;
-LLFontList*	LLFontGL::sSSHugeFallback = NULL;
-LLFontList*	LLFontGL::sSSBoldFallback = NULL;
 LLColor4 LLFontGL::sShadowColor(0.f, 0.f, 0.f, 1.f);
+LLFontRegistry* LLFontGL::sFontRegistry = NULL;
 
 LLCoordFont LLFontGL::sCurOrigin;
 std::vector<LLCoordFont> LLFontGL::sOriginStack;
 
-LLFontGL*& gExtCharFont = LLFontGL::sSansSerif;
-
 const F32 EXT_X_BEARING = 1.f;
 const F32 EXT_Y_BEARING = 0.f;
 const F32 EXT_KERNING = 1.f;
@@ -127,7 +116,6 @@ U8 LLFontGL::getStyleFromString(const std::string &style)
 LLFontGL::LLFontGL()
 	: LLFont()
 {
-	init();
 	clearEmbeddedChars();
 }
 
@@ -138,32 +126,30 @@ LLFontGL::LLFontGL(const LLFontGL &source)
 
 LLFontGL::~LLFontGL()
 {
-	mImageGLp = NULL;
-	mRawImageGLp = NULL;
 	clearEmbeddedChars();
 }
 
-void LLFontGL::init()
+void LLFontGL::reset()
 {
-	if (mImageGLp.isNull())
-	{
-		mImageGLp = new LLImageGL(FALSE);
-		//RN: use nearest mipmap filtering to obviate the need to do pixel-accurate positioning
-		gGL.getTexUnit(0)->bind(mImageGLp);
-		// we allow bilinear filtering to get sub-pixel positioning for drop shadows
-		//mImageGLp->setMipFilterNearest(TRUE, TRUE);
-	}
-	if (mRawImageGLp.isNull())
+	resetBitmapCache(); 
+	if (!mIsFallback)
 	{
-		mRawImageGLp = new LLImageRaw; // Note LLFontGL owns the image, not LLFont.
+		// This is the head of the list - need to rebuild ourself and all fallbacks.
+		loadFace(mName,mPointSize,sVertDPI,sHorizDPI,mFontBitmapCachep->getNumComponents(),mIsFallback);
+		if (mFallbackFontp==NULL)
+		{
+			llwarns << "LLFontGL::reset(), no fallback fonts present" << llendl;
+		}
+		else
+		{
+			for (LLFontList::iterator it = mFallbackFontp->begin();
+				 it != mFallbackFontp->end();
+				 ++it)
+			{
+				(*it)->reset();
+			}
+		}
 	}
-	setRawImage( mRawImageGLp );  
-}
-
-void LLFontGL::reset()
-{
-	init();
-	resetBitmap();
 }
 
 // static 
@@ -220,243 +206,48 @@ std::string LLFontGL::getFontPathLocal()
 	return local_path;
 }
 
-//static
-bool LLFontGL::loadFaceFallback(LLFontList *fontlistp, const std::string& fontname, const F32 point_size)
+bool findOrCreateFont(LLFontGL*& fontp, const LLFontDescriptor& desc)
 {
-	std::string local_path = getFontPathLocal();
-	std::string sys_path = getFontPathSystem();
-	
-	// The fontname string may contain multiple font file names separated by semicolons.
-	// Break it apart and try loading each one, in order.
-	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
-	boost::char_separator<char> sep(";");
-	tokenizer tokens(fontname, sep);
-	tokenizer::iterator token_iter;
-
-	for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
-	{
-		LLFont *fontp = new LLFont();
-		std::string font_path = local_path + *token_iter;
-		if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, TRUE))
-		{
-			font_path = sys_path + *token_iter;
-			if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, TRUE))
-			{
-				LL_INFOS_ONCE("ViewerImages") << "Couldn't load font " << *token_iter << LL_ENDL;
-				delete fontp;
-				fontp = NULL;
-			}
-		}
-		
-		if(fontp)
-		{
-			fontlistp->addAtEnd(fontp);
-		}
-	}
-	
-	// We want to return true if at least one fallback font loaded correctly.
-	return (fontlistp->size() > 0);
+	// Don't delete existing fonts, if any, here, because they've
+	// already been deleted by LLFontRegistry::clear()
+	fontp = LLFontGL::getFont(desc);
+	return (fontp != NULL);
 }
 
-//static
-bool LLFontGL::loadFace(LLFontGL *fontp, const std::string& fontname, const F32 point_size, LLFontList *fallback_fontp)
-{
-	std::string local_path = getFontPathLocal();
-	std::string font_path = local_path + fontname;
-	if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE))
-	{
-		std::string sys_path = getFontPathSystem();
-		font_path = sys_path + fontname;
-		if (!fontp->loadFace(font_path, point_size, sVertDPI, sHorizDPI, 2, FALSE))
-		{
-			LL_WARNS("ViewerImages") << "Couldn't load font " << fontname << LL_ENDL;
-			return false;
-		}
-	}
-
-	fontp->setFallbackFont(fallback_fontp);
-	return true;
-}
-
-
 // static
 BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale,
-				const std::string& monospace_file, F32 monospace_size,
-				const std::string& sansserif_file,
-				const std::string& sanserif_fallback_file, F32 ss_fallback_scale,
-				F32 small_size, F32 medium_size, F32 big_size, F32 huge_size,
-				const std::string& sansserif_bold_file, F32 bold_size,
-				const std::string& app_dir)
+								const std::string& app_dir,
+								const std::vector<std::string>& xui_paths)
 {
-	BOOL failed = FALSE;
+	bool succ = true;
 	sVertDPI = (F32)llfloor(screen_dpi * y_scale);
 	sHorizDPI = (F32)llfloor(screen_dpi * x_scale);
 	sScaleX = x_scale;
 	sScaleY = y_scale;
 	sAppDir = app_dir;
 
-	//
-	// Monospace font
-	//
-
-	if (!sMonospace)
-	{
-		sMonospace = new LLFontGL();
-	}
-	else
-	{
-		sMonospace->reset();
-	}
-
-	if (sMonospaceFallback)
+	// Font registry init
+	if (!sFontRegistry)
 	{
-		delete sMonospaceFallback;
-	}
-	sMonospaceFallback = new LLFontList();
-	if (!loadFaceFallback(
-			sMonospaceFallback,
-			sanserif_fallback_file,
-			monospace_size * ss_fallback_scale))
-	{
-		delete sMonospaceFallback;
-		sMonospaceFallback = NULL;
-	}
-
-	failed |= !loadFace(sMonospace, monospace_file, monospace_size, sMonospaceFallback);
-
-	//
-	// Sans-serif fonts
-	//
-	if(!sSansSerifHuge)
-	{
-		sSansSerifHuge = new LLFontGL();
+		sFontRegistry = new LLFontRegistry(xui_paths);
+		sFontRegistry->parseFontInfo("fonts.xml");
 	}
 	else
 	{
-		sSansSerifHuge->reset();
+		sFontRegistry->reset();
 	}
 
-	if (sSSHugeFallback)
-	{
-		delete sSSHugeFallback;
-	}
-	sSSHugeFallback = new LLFontList();
-	if (!loadFaceFallback(
-			sSSHugeFallback,
-			sanserif_fallback_file,
-			huge_size*ss_fallback_scale))
-	{
-		delete sSSHugeFallback;
-		sSSHugeFallback = NULL;
-	}
-
-	failed |= !loadFace(sSansSerifHuge, sansserif_file, huge_size, sSSHugeFallback);
-
-
-	if(!sSansSerifBig)
-	{
-		sSansSerifBig = new LLFontGL();
-	}
-	else
-	{
-		sSansSerifBig->reset();
-	}
-
-	if (sSSBigFallback)
-	{
-		delete sSSBigFallback;
-	}
-	sSSBigFallback = new LLFontList();
-	if (!loadFaceFallback(
-			sSSBigFallback,
-			sanserif_fallback_file,
-			big_size*ss_fallback_scale))
-	{
-		delete sSSBigFallback;
-		sSSBigFallback = NULL;
-	}
-
-	failed |= !loadFace(sSansSerifBig, sansserif_file, big_size, sSSBigFallback);
-
-
-	if(!sSansSerif)
-	{
-		sSansSerif = new LLFontGL();
-	}
-	else
-	{
-		sSansSerif->reset();
-	}
-
-	if (sSSFallback)
-	{
-		delete sSSFallback;
-	}
-	sSSFallback = new LLFontList();
-	if (!loadFaceFallback(
-			sSSFallback,
-			sanserif_fallback_file,
-			medium_size*ss_fallback_scale))
-	{
-		delete sSSFallback;
-		sSSFallback = NULL;
-	}
-	failed |= !loadFace(sSansSerif, sansserif_file, medium_size, sSSFallback);
-
-
-	if(!sSansSerifSmall)
-	{
-		sSansSerifSmall = new LLFontGL();
-	}
-	else
-	{
-		sSansSerifSmall->reset();
-	}
-
-	if(sSSSmallFallback)
-	{
-		delete sSSSmallFallback;
-	}
-	sSSSmallFallback = new LLFontList();
-	if (!loadFaceFallback(
-			sSSSmallFallback,
-			sanserif_fallback_file,
-			small_size*ss_fallback_scale))
-	{
-		delete sSSSmallFallback;
-		sSSSmallFallback = NULL;
-	}
-	failed |= !loadFace(sSansSerifSmall, sansserif_file, small_size, sSSSmallFallback);
-
-
-	//
-	// Sans-serif bold
-	//
-	if(!sSansSerifBold)
-	{
-		sSansSerifBold = new LLFontGL();
-	}
-	else
-	{
-		sSansSerifBold->reset();
-	}
-
-	if (sSSBoldFallback)
-	{
-		delete sSSBoldFallback;
-	}
-	sSSBoldFallback = new LLFontList();
-	if (!loadFaceFallback(
-			sSSBoldFallback,
-			sanserif_fallback_file,
-			medium_size*ss_fallback_scale))
-	{
-		delete sSSBoldFallback;
-		sSSBoldFallback = NULL;
-	}
-	failed |= !loadFace(sSansSerifBold, sansserif_bold_file, medium_size, sSSBoldFallback);
-
-	return !failed;
+	// Force standard fonts to get generated up front.
+	// This is primarily for error detection purposes.
+ 	succ &= (NULL != getFontSansSerifSmall());
+ 	succ &= (NULL != getFontSansSerif());
+ 	succ &= (NULL != getFontSansSerifBig());
+ 	succ &= (NULL != getFontSansSerifHuge());
+ 	succ &= (NULL != getFontSansSerifBold());
+ 	succ &= (NULL != getFontMonospace());
+	succ &= (NULL != getFontExtChar());
+	
+	return succ;
 }
 
 
@@ -464,57 +255,23 @@ BOOL LLFontGL::initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale,
 // static
 void LLFontGL::destroyDefaultFonts()
 {
-	delete sMonospace;
-	sMonospace = NULL;
-
-	delete sSansSerifHuge;
-	sSansSerifHuge = NULL;
-
-	delete sSansSerifBig;
-	sSansSerifBig = NULL;
-
-	delete sSansSerif;
-	sSansSerif = NULL;
-
-	delete sSansSerifSmall;
-	sSansSerifSmall = NULL;
-
-	delete sSansSerifBold;
-	sSansSerifBold = NULL;
-
-	delete sMonospaceFallback;
-	sMonospaceFallback = NULL;
-
-	delete sSSHugeFallback;
-	sSSHugeFallback = NULL;
-
-	delete sSSBigFallback;
-	sSSBigFallback = NULL;
-
-	delete sSSFallback;
-	sSSFallback = NULL;
-
-	delete sSSSmallFallback;
-	sSSSmallFallback = NULL;
-
-	delete sSSBoldFallback;
-	sSSBoldFallback = NULL;
+	// Remove the actual fonts.
+	delete sFontRegistry;
+	sFontRegistry = NULL;
 }
 
 //static 
-void LLFontGL::destroyGL()
+void LLFontGL::destroyAllGL()
 {
-	if (!sMonospace)
+	if (sFontRegistry)
 	{
-		// Already all destroyed.
-		return;
+		sFontRegistry->destroyGL();
 	}
-	sMonospace->mImageGLp->destroyGLTexture();
-	sSansSerifHuge->mImageGLp->destroyGLTexture();
-	sSansSerifSmall->mImageGLp->destroyGLTexture();
-	sSansSerif->mImageGLp->destroyGLTexture();
-	sSansSerifBig->mImageGLp->destroyGLTexture();
-	sSansSerifBold->mImageGLp->destroyGLTexture();
+}
+
+void LLFontGL::destroyGL()
+{
+	mFontBitmapCachep->destroyGL();
 }
 
 
@@ -533,13 +290,58 @@ BOOL LLFontGL::loadFace(const std::string& filename,
 	{
 		return FALSE;
 	}
-	mImageGLp->createGLTexture(0, mRawImageGLp);
-	gGL.getTexUnit(0)->bind(mImageGLp);
-	mImageGLp->setFilteringOption(LLTexUnit::TFO_POINT);
 	return TRUE;
 }
 
-BOOL LLFontGL::addChar(const llwchar wch)
+//static
+LLFontGL* LLFontGL::getFontMonospace()
+{
+	return getFont(LLFontDescriptor("Monospace","Monospace",0));
+}
+
+//static
+LLFontGL* LLFontGL::getFontSansSerifSmall()
+{
+	return getFont(LLFontDescriptor("SansSerif","Small",0));
+}
+
+//static
+LLFontGL* LLFontGL::getFontSansSerif()
+{
+	return getFont(LLFontDescriptor("SansSerif","Medium",0));
+}
+
+//static
+LLFontGL* LLFontGL::getFontSansSerifBig()
+{
+	return getFont(LLFontDescriptor("SansSerif","Large",0));
+}
+
+//static 
+LLFontGL* LLFontGL::getFontSansSerifHuge()
+{
+	return getFont(LLFontDescriptor("SansSerif","Huge",0));
+}
+
+//static 
+LLFontGL* LLFontGL::getFontSansSerifBold()
+{
+	return getFont(LLFontDescriptor("SansSerif","Medium",BOLD));
+}
+
+//static
+LLFontGL* LLFontGL::getFontExtChar()
+{
+	return getFontSansSerif();
+}
+
+//static 
+LLFontGL* LLFontGL::getFont(const LLFontDescriptor& desc)
+{
+	return sFontRegistry->getFont(desc);
+}
+
+BOOL LLFontGL::addChar(const llwchar wch) const
 {
 	if (!LLFont::addChar(wch))
 	{
@@ -547,10 +349,12 @@ BOOL LLFontGL::addChar(const llwchar wch)
 	}
 
 	stop_glerror();
-	mImageGLp->setSubImage(mRawImageGLp, 0, 0, mImageGLp->getWidth(), mImageGLp->getHeight());
-	gGL.getTexUnit(0)->bind(mImageGLp);
-	mImageGLp->setFilteringOption(LLTexUnit::TFO_POINT);
-	stop_glerror();
+
+	LLFontGlyphInfo *glyph_info = getGlyphInfo(wch);
+	U32 bitmap_num = glyph_info->mBitmapNum;
+	LLImageGL *image_gl = mFontBitmapCachep->getImageGL(bitmap_num);
+	LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num);
+	image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight());
 	return TRUE;
 }
 
@@ -584,30 +388,17 @@ S32 LLFontGL::render(const LLWString &wstr,
 		return wstr.length() ;
 	}
 
-	gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
-
 	if (wstr.empty())
 	{
 		return 0;
 	} 
 
+	gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+
 	S32 scaled_max_pixels = max_pixels == S32_MAX ? S32_MAX : llceil((F32)max_pixels * sScaleX);
 
-	// HACK for better bolding
-	if (style & BOLD)
-	{
-		if (this == LLFontGL::sSansSerif)
-		{
-			return LLFontGL::sSansSerifBold->render(
-				wstr, begin_offset,
-				x, y,
-				color,
-				halign, valign, 
-				(style & ~BOLD),
-				max_chars, max_pixels,
-				right_x, use_embedded);
-		}
-	}
+	// Strip off any style bits that are already accounted for by the font.
+	style = style & (~getFontDesc().getStyle());
 
 	F32 drop_shadow_strength = 0.f;
 	if (style & (DROP_SHADOW | DROP_SHADOW_SOFT))
@@ -649,10 +440,6 @@ S32 LLFontGL::render(const LLWString &wstr,
 
 	F32 cur_x, cur_y, cur_render_x, cur_render_y;
 
-	// Bind the font texture
-	
-	gGL.getTexUnit(0)->bind(mImageGLp);
-	
  	// Not guaranteed to be set correctly
 	gGL.setSceneBlendType(LLRender::BT_ALPHA);
 	
@@ -697,8 +484,8 @@ S32 LLFontGL::render(const LLWString &wstr,
 
 	F32 start_x = cur_x;
 
-	F32 inv_width = 1.f / mImageGLp->getWidth();
-	F32 inv_height = 1.f / mImageGLp->getHeight();
+	F32 inv_width = 1.f / mFontBitmapCachep->getBitmapWidth();
+	F32 inv_height = 1.f / mFontBitmapCachep->getBitmapHeight();
 
 	const S32 LAST_CHARACTER = LLFont::LAST_CHAR_FULL;
 
@@ -717,6 +504,9 @@ S32 LLFontGL::render(const LLWString &wstr,
 	}
 
 
+	// Remember last-used texture to avoid unnecesssary bind calls.
+	LLImageGL *last_bound_texture = NULL;
+
 	for (i = begin_offset; i < begin_offset + length; i++)
 	{
 		llwchar wch = wstr[i];
@@ -736,7 +526,7 @@ S32 LLFontGL::render(const LLWString &wstr,
 
 			if (!label.empty())
 			{
-				ext_advance += (EXT_X_BEARING + gExtCharFont->getWidthF32( label.c_str() )) * sScaleX;
+				ext_advance += (EXT_X_BEARING + getFontExtChar()->getWidthF32( label.c_str() )) * sScaleX;
 			}
 
 			if (start_x + scaled_max_pixels < cur_x + ext_advance)
@@ -745,7 +535,12 @@ S32 LLFontGL::render(const LLWString &wstr,
 				break;
 			}
 
-			gGL.getTexUnit(0)->bind(ext_image);
+			if (last_bound_texture != ext_image)
+			{
+				gGL.getTexUnit(0)->bind(ext_image);
+				last_bound_texture = ext_image;
+			}
+
 			// snap origin to whole screen pixel
 			const F32 ext_x = (F32)llround(cur_render_x + (EXT_X_BEARING * sScaleX));
 			const F32 ext_y = (F32)llround(cur_render_y + (EXT_Y_BEARING * sScaleY + mAscender - mLineHeight));
@@ -760,7 +555,7 @@ S32 LLFontGL::render(const LLWString &wstr,
 				//glLoadIdentity();
 				//gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f);
 				//glScalef(sScaleX, sScaleY, 1.f);
-				gExtCharFont->render(label, 0,
+				getFontExtChar()->render(label, 0,
 									 /*llfloor*/((ext_x + (F32)ext_image->getWidth() + EXT_X_BEARING) / sScaleX), 
 									 /*llfloor*/(cur_y / sScaleY),
 									 color,
@@ -778,15 +573,12 @@ S32 LLFontGL::render(const LLWString &wstr,
 				cur_x += EXT_KERNING * sScaleX;
 			}
 			cur_render_x = cur_x;
-
-			// Bind the font texture
-			gGL.getTexUnit(0)->bind(mImageGLp);
 		}
 		else
 		{
 			if (!hasGlyph(wch))
 			{
-				(const_cast<LLFontGL*>(this))->addChar(wch);
+				addChar(wch);
 			}
 
 			const LLFontGlyphInfo* fgi= getGlyphInfo(wch);
@@ -795,6 +587,14 @@ S32 LLFontGL::render(const LLWString &wstr,
 				llerrs << "Missing Glyph Info" << llendl;
 				break;
 			}
+			// Per-glyph bitmap texture.
+			LLImageGL *image_gl = mFontBitmapCachep->getImageGL(fgi->mBitmapNum);
+			if (last_bound_texture != image_gl)
+			{
+				gGL.getTexUnit(0)->bind(image_gl);
+				last_bound_texture = image_gl;
+			}
+
 			if ((start_x + scaled_max_pixels) < (cur_x + fgi->mXBearing + fgi->mWidth))
 			{
 				// Not enough room for this character.
@@ -825,7 +625,7 @@ S32 LLFontGL::render(const LLWString &wstr,
 				// Kern this puppy.
 				if (!hasGlyph(next_char))
 				{
-					(const_cast<LLFontGL*>(this))->addChar(next_char);
+					addChar(next_char);
 				}
 				cur_x += getXKerning(wch, next_char);
 			}
@@ -879,14 +679,11 @@ S32 LLFontGL::render(const LLWString &wstr,
 
 	gGL.popMatrix();
 
+	gGL.getTexUnit(0)->disable();
+
 	return chars_drawn;
 }
 
- 
-LLImageGL *LLFontGL::getImageGL() const
-{
-	return mImageGLp;
-}
 
 S32 LLFontGL::getWidth(const std::string& utf8text) const
 {
@@ -1258,7 +1055,7 @@ F32 LLFontGL::getEmbeddedCharAdvance(const embedded_data_t* ext_data) const
 	F32 ext_width = (F32)ext_image->getWidth();
 	if( !label.empty() )
 	{
-		ext_width += (EXT_X_BEARING + gExtCharFont->getWidthF32(label.c_str())) * sScaleX;
+		ext_width += (EXT_X_BEARING + getFontExtChar()->getWidthF32(label.c_str())) * sScaleX;
 	}
 
 	return (EXT_X_BEARING * sScaleX) + ext_width;
@@ -1271,19 +1068,19 @@ void LLFontGL::clearEmbeddedChars()
 	mEmbeddedChars.clear();
 }
 
-void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label )
+void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label ) const
 {
 	LLWString wlabel = utf8str_to_wstring(label);
 	addEmbeddedChar(wc, image, wlabel);
 }
 
-void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& wlabel )
+void LLFontGL::addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& wlabel ) const
 {
 	embedded_data_t* ext_data = new embedded_data_t(image, wlabel);
 	mEmbeddedChars[wc] = ext_data;
 }
 
-void LLFontGL::removeEmbeddedChar( llwchar wc )
+void LLFontGL::removeEmbeddedChar( llwchar wc ) const
 {
 	embedded_map_t::iterator iter = mEmbeddedChars.find(wc);
 	if (iter != mEmbeddedChars.end())
@@ -1387,68 +1184,9 @@ void LLFontGL::drawGlyph(const LLRectf& screen_rect, const LLRectf& uv_rect, con
 	gGL.end();
 }
 
-// static
 std::string LLFontGL::nameFromFont(const LLFontGL* fontp)
 {
-	if (fontp == sSansSerifHuge)
-	{
-		return std::string("SansSerifHuge");
-	}
-	else if (fontp == sSansSerifSmall)
-	{
-		return std::string("SansSerifSmall");
-	}
-	else if (fontp == sSansSerif)
-	{
-		return std::string("SansSerif");
-	}
-	else if (fontp == sSansSerifBig)
-	{
-		return std::string("SansSerifBig");
-	}
-	else if (fontp == sSansSerifBold)
-	{
-		return std::string("SansSerifBold");
-	}
-	else if (fontp == sMonospace)
-	{
-		return std::string("Monospace");
-	}
-	else
-	{
-		return std::string();
-	}
-}
-
-// static
-LLFontGL* LLFontGL::fontFromName(const std::string& font_name)
-{
-	LLFontGL* gl_font = NULL;
-	if (font_name == "SansSerifHuge")
-	{
-		gl_font = LLFontGL::sSansSerifHuge;
-	}
-	else if (font_name == "SansSerifSmall")
-	{
-		gl_font = LLFontGL::sSansSerifSmall;
-	}
-	else if (font_name == "SansSerif")
-	{
-		gl_font = LLFontGL::sSansSerif;
-	}
-	else if (font_name == "SansSerifBig")
-	{
-		gl_font = LLFontGL::sSansSerifBig;
-	}
-	else if (font_name == "SansSerifBold")
-	{
-		gl_font = LLFontGL::sSansSerifBold;
-	}
-	else if (font_name == "Monospace")
-	{
-		gl_font = LLFontGL::sMonospace;
-	}
-	return gl_font;
+	return fontp->getFontDesc().getName();
 }
 
 // static
diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h
index f8da460de2785389759c2cd1119e7a8c587f86cb..6cb1727ff4b5cc56ee568d4330a455271121359a 100644
--- a/indra/llrender/llfontgl.h
+++ b/indra/llrender/llfontgl.h
@@ -40,8 +40,16 @@
 #include "llcoord.h"
 #include "llrect.h"
 
+#include "llfontregistry.h"
+
 class LLColor4;
 
+// Key used to request a font.
+class LLFontDescriptor;
+
+// Structure used to store previously requested fonts.
+class LLFontRegistry;
+
 class LLFontGL : public LLFont
 {
 public:
@@ -86,18 +94,13 @@ public:
 	LLFontGL &operator=(const LLFontGL &source);
 
 	static BOOL initDefaultFonts(F32 screen_dpi, F32 x_scale, F32 y_scale,
-								 const std::string& monospace_file, F32 monospace_size,
-								 const std::string& sansserif_file,
-								 const std::string& sansserif_fallback_file, F32 ss_fallback_scale,
-								 F32 small_size, F32 medium_size, F32 large_size, F32 huge_size,
-								 const std::string& sansserif_bold_file, F32 bold_size,
-								 const std::string& app_dir = LLStringUtil::null);
+								 const std::string& app_dir,
+								 const std::vector<std::string>& xui_paths);
 
 	static void	destroyDefaultFonts();
-	static void destroyGL();
+	static void destroyAllGL();
+	void destroyGL();
 
-	static bool loadFaceFallback(LLFontList *fontp, const std::string& fontname, const F32 point_size);
-	static bool loadFace(LLFontGL *fontp, const std::string& fontname, const F32 point_size, LLFontList *fallback_fontp);
 	/* virtual*/ BOOL loadFace(const std::string& filename,
 							    const F32 point_size, const F32 vert_dpi, const F32 horz_dpi,
 							    const S32 components, BOOL is_fallback);
@@ -192,12 +195,11 @@ public:
 
 	LLImageGL *getImageGL() const;
 
-	void	   addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label);
-	void	   addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& label);
-	void	   removeEmbeddedChar( llwchar wc );
+	void	   addEmbeddedChar( llwchar wc, LLImageGL* image, const std::string& label) const;
+	void	   addEmbeddedChar( llwchar wc, LLImageGL* image, const LLWString& label) const;
+	void	   removeEmbeddedChar( llwchar wc ) const;
 
 	static std::string nameFromFont(const LLFontGL* fontp);
-	static LLFontGL* fontFromName(const std::string& name);
 
 	static std::string nameFromHAlign(LLFontGL::HAlign align);
 	static LLFontGL::HAlign hAlignFromName(const std::string& name);
@@ -228,20 +230,14 @@ public:
 	static BOOL     sDisplayFont ;
 	static std::string sAppDir;			// For loading fonts
 		
-	static LLFontGL*	sMonospace;		// medium
-	static LLFontList*	sMonospaceFallback;
-
-	static LLFontGL*	sSansSerifSmall;	// small
-	static LLFontList*	sSSSmallFallback;
-	static LLFontGL*	sSansSerif;		// medium
-	static LLFontList*	sSSFallback;
-	static LLFontGL*	sSansSerifBig;		// large
-	static LLFontList*	sSSBigFallback;
-	static LLFontGL*	sSansSerifHuge;	// very large
-	static LLFontList*	sSSHugeFallback;
-
-	static LLFontGL*	sSansSerifBold;	// medium, bolded
-	static LLFontList*	sSSBoldFallback;
+	static LLFontGL* getFontMonospace();
+	static LLFontGL* getFontSansSerifSmall();
+	static LLFontGL* getFontSansSerif();
+	static LLFontGL* getFontSansSerifBig();
+	static LLFontGL* getFontSansSerifHuge();
+	static LLFontGL* getFontSansSerifBold();
+	static LLFontGL* getFontExtChar();
+	static LLFontGL* getFont(const LLFontDescriptor& desc);
 
 	static LLColor4 sShadowColor;
 
@@ -249,19 +245,26 @@ public:
 	friend class LLHUDText;
 
 protected:
-	/*virtual*/ BOOL addChar(const llwchar wch);
-	static std::string getFontPathLocal();
-	static std::string getFontPathSystem();
+	/*virtual*/ BOOL addChar(const llwchar wch) const;
 
 protected:
-	LLPointer<LLImageRaw>	mRawImageGLp;
-	LLPointer<LLImageGL>	mImageGLp;
 	typedef std::map<llwchar,embedded_data_t*> embedded_map_t;
-	embedded_map_t mEmbeddedChars;
+	mutable embedded_map_t mEmbeddedChars;
 	
+	LLFontDescriptor mFontDesc;
+
+	// Registry holds all instantiated fonts.
+	static LLFontRegistry* sFontRegistry;
+
 public:
+	static std::string getFontPathLocal();
+	static std::string getFontPathSystem();
+
 	static LLCoordFont sCurOrigin;
 	static std::vector<LLCoordFont> sOriginStack;
+
+	const LLFontDescriptor &getFontDesc() const { return mFontDesc; }
+	void setFontDesc(const LLFontDescriptor& font_desc) { mFontDesc = font_desc; }
 };
 
 #endif
diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9b5bc5d0afc55894451df1cf6fc19ed1e9684b6c
--- /dev/null
+++ b/indra/llrender/llfontregistry.cpp
@@ -0,0 +1,650 @@
+/** 
+ * @file llfontregistry.cpp
+ * @author Brad Payne
+ * @brief Storage for fonts.
+ *
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ * 
+ * Copyright (c) 2008, 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://secondlife.com/developers/opensource/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://secondlife.com/developers/opensource/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 "llgl.h"
+#include "llfontregistry.h"
+#include "llfontgl.h"
+#include <boost/tokenizer.hpp>
+#include "llcontrol.h"
+#include "lldir.h"
+#include "llwindow.h"
+
+extern LLControlGroup gSavedSettings;
+
+using std::string;
+using std::map;
+
+bool fontDescInitFromXML(LLXMLNodePtr node, LLFontDescriptor& desc);
+
+LLFontDescriptor::LLFontDescriptor():
+	mStyle(0)
+{
+}
+
+LLFontDescriptor::LLFontDescriptor(const std::string& name,
+								   const std::string& size, 
+								   const U8 style,
+								   const string_vec_t& file_names):
+	mName(name),
+	mSize(size),
+	mStyle(style),
+	mFileNames(file_names)
+{
+}
+
+LLFontDescriptor::LLFontDescriptor(const std::string& name,
+								   const std::string& size, 
+								   const U8 style):
+	mName(name),
+	mSize(size),
+	mStyle(style)
+{
+}
+
+
+bool LLFontDescriptor::operator<(const LLFontDescriptor& b) const
+{
+	if (mName < b.mName)
+		return true;
+	else if (mName > b.mName)
+		return false;
+	
+	if (mStyle < b.mStyle)
+		return true;
+	else if (mStyle > b.mStyle)
+		return false;
+
+	if (mSize < b.mSize)
+		return true;
+	else 
+		return false;
+}
+
+static const std::string s_template_string("TEMPLATE");
+
+bool LLFontDescriptor::isTemplate() const
+{
+	return getSize() == s_template_string;
+}
+
+// Look for substring match and remove substring if matched.
+bool removeSubString(std::string& str, const std::string& substr)
+{
+	size_t pos = str.find(substr);
+	if (pos != string::npos)
+	{
+		str.replace(pos,substr.length(),(const char *)NULL, 0);
+		return true;
+	}
+	return false;
+}
+
+// Check for substring match without modifying the source string.
+bool findSubString(std::string& str, const std::string& substr)
+{
+	size_t pos = str.find(substr);
+	if (pos != string::npos)
+	{
+		return true;
+	}
+	return false;
+}
+
+
+// Normal form is
+// - raw name
+// - bold, italic style info reflected in both style and font name.
+// - other style info removed.
+// - size info moved to mSize, defaults to Medium
+// For example,
+// - "SansSerifHuge" would normalize to { "SansSerif", "Huge", 0 }
+// - "SansSerifBold" would normalize to { "SansSerifBold", "Medium", BOLD }
+LLFontDescriptor LLFontDescriptor::normalize() const
+{
+	std::string new_name(mName);
+	std::string new_size(mSize);
+	U8 new_style(mStyle);
+
+	// Only care about style to extent it can be picked up by font.
+	new_style &= (LLFontGL::BOLD | LLFontGL::ITALIC);
+
+	// All these transformations are to support old-style font specifications.
+	if (removeSubString(new_name,"Small"))
+		new_size = "Small";
+	if (removeSubString(new_name,"Big"))
+		new_size = "Large";
+	if (removeSubString(new_name,"Medium"))
+		new_size = "Medium";
+	if (removeSubString(new_name,"Large"))
+		new_size = "Large";
+	if (removeSubString(new_name,"Huge"))
+		new_size = "Huge";
+
+	// HACK - Monospace is the only one we don't remove, so
+	// name "Monospace" doesn't get taken down to ""
+	// For other fonts, there's no ambiguity between font name and size specifier.
+	if (new_size != s_template_string && new_size.empty() && findSubString(new_name,"Monospace"))
+		new_size = "Monospace";
+	if (new_size.empty())
+		new_size = "Medium";
+
+	if (removeSubString(new_name,"Bold"))
+		new_style |= LLFontGL::BOLD;
+
+	if (removeSubString(new_name,"Italic"))
+		new_style |= LLFontGL::ITALIC;
+
+	return LLFontDescriptor(new_name,new_size,new_style,getFileNames());
+}
+
+LLFontRegistry::LLFontRegistry(const string_vec_t& xui_paths)
+{
+	// Propagate this down from LLUICtrlFactory so LLRender doesn't
+	// need an upstream dependency on LLUI.
+	mXUIPaths = xui_paths;
+	
+	// This is potentially a slow directory traversal, so we want to
+	// cache the result.
+	mUltimateFallbackList = LLWindow::getDynamicFallbackFontList();
+}
+
+LLFontRegistry::~LLFontRegistry()
+{
+	clear();
+}
+
+bool LLFontRegistry::parseFontInfo(const std::string& xml_filename)
+{
+	bool success = false;  // Succeed if we find at least one XUI file
+	const string_vec_t& xml_paths = mXUIPaths;
+	for (string_vec_t::const_iterator path_it = xml_paths.begin();
+		 path_it != xml_paths.end();
+		 ++path_it)
+	{
+	
+		LLXMLNodePtr root;
+		std::string full_filename = gDirUtilp->findSkinnedFilename(*path_it, xml_filename);
+		bool parsed_file = LLXMLNode::parseFile(full_filename, root, NULL);
+
+		if (!parsed_file)
+			continue;
+		
+		if ( root.isNull() || ! root->hasName( "fonts" ) )
+		{
+			llwarns << "Bad font info file: "
+					<< full_filename << llendl;
+			continue;
+		}
+		
+		std::string root_name;
+		root->getAttributeString("name",root_name);
+		if (root->hasName("fonts"))
+		{
+			// Expect a collection of children consisting of "font" or "font_size" entries
+			bool init_succ = initFromXML(root);
+			success = success || init_succ;
+		}
+	}
+	if (success)
+		dump();
+	
+	return success;
+}
+
+std::string currentOsName()
+{
+#if LL_WINDOWS
+	return "Windows";
+#elif LL_DARWIN
+	return "Mac";
+#elif LL_SDL
+	return "Linux";
+#else
+	return "";
+#endif
+}
+
+bool fontDescInitFromXML(LLXMLNodePtr node, LLFontDescriptor& desc)
+{
+	if (node->hasName("font"))
+	{
+		std::string attr_name;
+		if (node->getAttributeString("name",attr_name))
+		{
+			desc.setName(attr_name);
+		}
+
+		std::string attr_style;
+		if (node->getAttributeString("font_style",attr_style))
+		{
+			desc.setStyle(LLFontGL::getStyleFromString(attr_style));
+		}
+
+		desc.setSize(s_template_string);
+	}
+
+	LLXMLNodePtr child;	
+	for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
+	{
+		std::string child_name;
+		child->getAttributeString("name",child_name);
+		if (child->hasName("file"))
+		{
+			std::string font_file_name = child->getTextContents();
+			desc.getFileNames().push_back(font_file_name);
+		}
+		else if (child->hasName("os"))
+		{
+			if (child_name == currentOsName())
+			{
+				fontDescInitFromXML(child, desc);
+			}
+		}
+	}
+	return true;
+}
+
+bool LLFontRegistry::initFromXML(LLXMLNodePtr node)
+{
+	LLXMLNodePtr child;
+	
+	for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
+	{
+		std::string child_name;
+		child->getAttributeString("name",child_name);
+		if (child->hasName("font"))
+		{
+			LLFontDescriptor desc;
+			bool font_succ = fontDescInitFromXML(child, desc);
+			LLFontDescriptor norm_desc = desc.normalize();
+			if (font_succ)
+			{
+				// if this is the first time we've seen this font name,
+				// create a new template map entry for it.
+				const LLFontDescriptor *match_desc = getMatchingFontDesc(desc);
+				if (match_desc == NULL)
+				{
+					// Create a new entry (with no corresponding font).
+					mFontMap[norm_desc] = NULL;
+				}
+				// otherwise, find the existing entry and combine data. 
+				else
+				{
+					// Prepend files from desc.
+					// A little roundabout because the map key is const,
+					// so we have to fetch it, make a new map key, and
+					// replace the old entry.
+					string_vec_t match_file_names = match_desc->getFileNames();
+					match_file_names.insert(match_file_names.begin(),
+											desc.getFileNames().begin(),
+											desc.getFileNames().end());
+					LLFontDescriptor new_desc = *match_desc;
+					new_desc.getFileNames() = match_file_names;
+					mFontMap.erase(*match_desc);
+					mFontMap[new_desc] = NULL;
+				}
+			}
+		}
+		else if (child->hasName("font_size"))
+		{
+			std::string size_name;
+			F32 size_value;
+			if (child->getAttributeString("name",size_name) &&
+				child->getAttributeF32("size",size_value))
+			{
+				mFontSizes[size_name] = size_value;
+			}
+
+		}
+	}
+	return true;
+}
+
+bool LLFontRegistry::nameToSize(const std::string& size_name, F32& size)
+{
+	font_size_map_t::iterator it = mFontSizes.find(size_name);
+	if (it != mFontSizes.end())
+	{
+		size = it->second;
+		return true;
+	}
+	return false;
+}
+
+
+LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc)
+{
+	// Name should hold a font name recognized as a setting; the value
+	// of the setting should be a list of font files.
+	// Size should be a recognized string value
+	// Style should be a set of flags including any implied by the font name.
+
+	// First decipher the requested size.
+	LLFontDescriptor norm_desc = desc.normalize();
+	F32 point_size;
+	bool found_size = nameToSize(norm_desc.getSize(),point_size);
+	if (!found_size)
+	{
+		llwarns << "createFont unrecognized size " << norm_desc.getSize() << llendl;
+		return NULL;
+	}
+	llinfos << "createFont " << norm_desc.getName() << " size " << norm_desc.getSize() << " style " << ((S32) norm_desc.getStyle()) << llendl;
+	F32 fallback_scale = 1.0;
+
+	// Find corresponding font template (based on same descriptor with no size specified)
+	LLFontDescriptor template_desc(norm_desc);
+	template_desc.setSize(s_template_string);
+	const LLFontDescriptor *match_desc = getClosestFontTemplate(template_desc);
+	if (!match_desc)
+	{
+		llwarns << "createFont failed, no template found for "
+				<< norm_desc.getName() << " style [" << ((S32)norm_desc.getStyle()) << "]" << llendl;
+		return NULL;
+	}
+
+	// See whether this best-match font has already been instantiated in the requested size.
+	LLFontDescriptor nearest_exact_desc = *match_desc;
+	nearest_exact_desc.setSize(norm_desc.getSize());
+	font_reg_map_t::iterator it = mFontMap.find(nearest_exact_desc);
+	if (it != mFontMap.end())
+	{
+		llinfos << "-- matching font exists: " << nearest_exact_desc.getName() << " size " << nearest_exact_desc.getSize() << " style " << ((S32) nearest_exact_desc.getStyle()) << llendl;
+		return it->second;
+	}
+
+	// Build list of font names to look for.
+	// Files specified for this font come first, followed by those from the default descriptor.
+	string_vec_t file_names = match_desc->getFileNames();
+	string_vec_t default_file_names;
+	LLFontDescriptor default_desc("default",s_template_string,0);
+	const LLFontDescriptor *match_default_desc = getMatchingFontDesc(default_desc);
+	if (match_default_desc)
+	{
+		file_names.insert(file_names.end(),
+						  match_default_desc->getFileNames().begin(),
+						  match_default_desc->getFileNames().end());
+	}
+
+	// Add ultimate fallback list - generated dynamically on linux,
+	// null elsewhere.
+	file_names.insert(file_names.end(),
+					  getUltimateFallbackList().begin(),
+					  getUltimateFallbackList().end());
+
+	// Load fonts based on names.
+	if (file_names.empty())
+	{
+		llwarns << "createFont failed, no file names specified" << llendl;
+		return NULL;
+	}
+	LLFontList *fontlistp = new LLFontList;
+	LLFontGL *result = NULL;
+
+	// Snarf all fonts we can into fontlistp.  First will get pulled
+	// off the list and become the "head" font, set to non-fallback.
+	// Rest will consitute the fallback list.
+	BOOL is_first_found = TRUE;
+	
+	std::string local_path = LLFontGL::getFontPathLocal();
+	std::string sys_path = LLFontGL::getFontPathSystem();
+	
+	// The fontname string may contain multiple font file names separated by semicolons.
+	// Break it apart and try loading each one, in order.
+	for(string_vec_t::iterator file_name_it = file_names.begin();
+		file_name_it != file_names.end(); 
+		++file_name_it)
+	{
+		LLFontGL *fontp = new LLFontGL;
+		std::string font_path = local_path + *file_name_it;
+		BOOL is_fallback = !is_first_found;
+		F32 extra_scale = (is_fallback)?fallback_scale:1.0;
+		if (!fontp->loadFace(font_path, extra_scale * point_size,
+							 LLFontGL::sVertDPI, LLFontGL::sHorizDPI, 2, is_fallback))
+		{
+			font_path = sys_path + *file_name_it;
+
+			if (!fontp->loadFace(font_path, extra_scale * point_size,
+								 LLFontGL::sVertDPI, LLFontGL::sHorizDPI, 2, is_fallback))
+			{
+				LL_INFOS_ONCE("LLFontRegistry") << "Couldn't load font " << *file_name_it << LL_ENDL;
+				delete fontp;
+				fontp = NULL;
+			}
+		}
+		
+		if(fontp)
+		{
+			if (is_first_found)
+			{
+				result = fontp;
+				is_first_found = false;
+			}
+			else
+				fontlistp->addAtEnd(fontp);
+		}
+	}
+	if (result && !fontlistp->empty())
+	{
+		result->setFallbackFont(fontlistp);
+	}
+
+	norm_desc.setStyle(match_desc->getStyle());
+	if (result)
+		result->setFontDesc(norm_desc);
+
+	if (!result)
+	{
+		llwarns << "createFont failed in some way" << llendl;
+	}
+	mFontMap[norm_desc] = result;
+	return result;
+}
+
+void LLFontRegistry::reset()
+{
+	for (font_reg_map_t::iterator it = mFontMap.begin();
+		 it != mFontMap.end();
+		 ++it)
+	{
+		// Reset the corresponding font but preserve the entry.
+		if (it->second)
+			it->second->reset();
+	}
+}
+
+void LLFontRegistry::clear()
+{
+	for (font_reg_map_t::iterator it = mFontMap.begin();
+		 it != mFontMap.end();
+		 ++it)
+	{
+		LLFontGL *fontp = it->second;
+		delete fontp;
+	}
+	mFontMap.clear();
+}
+
+void LLFontRegistry::destroyGL()
+{
+	for (font_reg_map_t::iterator it = mFontMap.begin();
+		 it != mFontMap.end();
+		 ++it)
+	{
+		// Reset the corresponding font but preserve the entry.
+		if (it->second)
+			it->second->destroyGL();
+	}
+}
+
+LLFontGL *LLFontRegistry::getFont(const LLFontDescriptor& orig_desc)
+{
+	LLFontDescriptor norm_desc = orig_desc.normalize();
+
+	font_reg_map_t::iterator it = mFontMap.find(norm_desc);
+	if (it != mFontMap.end())
+		return it->second;
+	else
+	{
+		LLFontGL *fontp = createFont(orig_desc);
+		if (!fontp)
+		{
+			llwarns << "getFont failed, name " << orig_desc.getName()
+					<<" style=[" << ((S32) orig_desc.getStyle()) << "]"
+					<< " size=[" << orig_desc.getSize() << "]" << llendl;
+		}
+		return fontp;
+	}
+}
+
+const LLFontDescriptor *LLFontRegistry::getMatchingFontDesc(const LLFontDescriptor& desc)
+{
+	LLFontDescriptor norm_desc = desc.normalize();
+
+	font_reg_map_t::iterator it = mFontMap.find(norm_desc);
+	if (it != mFontMap.end())
+		return &(it->first);
+	else
+		return NULL;
+}
+
+static U32 bitCount(U8 c)
+{
+	U32 count = 0;
+	if (c & 1) 
+		count++;
+	if (c & 2)
+		count++;
+	if (c & 4)
+		count++;
+	if (c & 8)
+		count++;
+	if (c & 16)
+		count++;
+	if (c & 32)
+		count++;
+	if (c & 64)
+		count++;
+	if (c & 128)
+		count++;
+	return count;
+}
+
+// Find nearest match for the requested descriptor.
+const LLFontDescriptor *LLFontRegistry::getClosestFontTemplate(const LLFontDescriptor& desc)
+{
+	const LLFontDescriptor *exact_match_desc = getMatchingFontDesc(desc);
+	if (exact_match_desc)
+	{
+		return exact_match_desc;
+	}
+
+	LLFontDescriptor norm_desc = desc.normalize();
+
+	const LLFontDescriptor *best_match_desc = NULL;
+	for (font_reg_map_t::iterator it = mFontMap.begin();
+		 it != mFontMap.end();
+		 ++it)
+	{
+		const LLFontDescriptor* curr_desc = &(it->first);
+
+		// Ignore if not a template.
+		if (!curr_desc->isTemplate())
+			continue;
+
+		// Ignore if font name is wrong.
+		if (curr_desc->getName() != norm_desc.getName())
+			continue;
+
+		// Reject font if it matches any bits we don't want
+		if (curr_desc->getStyle() & ~norm_desc.getStyle())
+		{
+			continue;
+		}
+
+		// Take if it's the first plausible candidate we've found.
+		if (!best_match_desc)
+		{
+			best_match_desc = curr_desc;
+			continue;
+		}
+
+		// Take if it matches more bits than anything before.
+		U8 best_style_match_bits =
+			norm_desc.getStyle() & best_match_desc->getStyle();
+		U8 curr_style_match_bits =
+			norm_desc.getStyle() & curr_desc->getStyle();
+		if (bitCount(curr_style_match_bits) > bitCount(best_style_match_bits))
+		{
+			best_match_desc = curr_desc;
+			continue;
+		}
+
+		// Tie-breaker: take if it matches bold.
+		if (curr_style_match_bits & LLFontGL::BOLD)  // Bold is requested and this descriptor matches it.
+		{
+			best_match_desc = curr_desc;
+			continue;
+		}
+	}
+
+	// Nothing matched.
+	return best_match_desc;
+}
+
+void LLFontRegistry::dump()
+{
+	llinfos << "LLFontRegistry dump: " << llendl;
+	for (font_size_map_t::iterator size_it = mFontSizes.begin();
+		 size_it != mFontSizes.end();
+		 ++size_it)
+	{
+		llinfos << "Size: " << size_it->first << " => " << size_it->second << llendl;
+	}
+	for (font_reg_map_t::iterator font_it = mFontMap.begin();
+		 font_it != mFontMap.end();
+		 ++font_it)
+	{
+		const LLFontDescriptor& desc = font_it->first;
+		llinfos << "Font: name=" << desc.getName()
+				<< " style=[" << ((S32)desc.getStyle()) << "]"
+				<< " size=[" << desc.getSize() << "]"
+				<< " fileNames="
+				<< llendl;
+		for (string_vec_t::const_iterator file_it=desc.getFileNames().begin();
+			 file_it != desc.getFileNames().end();
+			 ++file_it)
+		{
+			llinfos << "  file: " << *file_it <<llendl;
+		}
+	}
+}
diff --git a/indra/llrender/llfontregistry.h b/indra/llrender/llfontregistry.h
new file mode 100644
index 0000000000000000000000000000000000000000..ed775eeed0671850aa205201ba1eef52b70ba57c
--- /dev/null
+++ b/indra/llrender/llfontregistry.h
@@ -0,0 +1,113 @@
+/** 
+ * @file llfontregistry.h
+ * @author Brad Payne
+ * @brief Storage for fonts.
+ *
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ * 
+ * Copyright (c) 2008, 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://secondlife.com/developers/opensource/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://secondlife.com/developers/opensource/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$
+ */
+
+#ifndef LL_LLFONTREGISTRY_H
+#define LL_LLFONTREGISTRY_H
+
+#include "llxmlnode.h"
+
+class LLFontGL;
+
+typedef std::vector<std::string> string_vec_t;
+
+class LLFontDescriptor
+{
+public:
+	LLFontDescriptor();
+	LLFontDescriptor(const std::string& name, const std::string& size, const U8 style);
+	LLFontDescriptor(const std::string& name, const std::string& size, const U8 style, const string_vec_t& file_names);
+	LLFontDescriptor normalize() const;
+
+	bool operator<(const LLFontDescriptor& b) const;
+
+	bool isTemplate() const;
+	
+	const std::string& getName() const { return mName; }
+	void setName(const std::string& name) { mName = name; }
+	const std::string& getSize() const { return mSize; }
+	void setSize(const std::string& size) { mSize = size; }
+	const std::vector<std::string>& getFileNames() const { return mFileNames; }
+	std::vector<std::string>& getFileNames() { return mFileNames; }
+	const U8 getStyle() const { return mStyle; }
+	void setStyle(U8 style) { mStyle = style; }
+
+private:
+	std::string mName;
+	std::string mSize;
+	string_vec_t mFileNames;
+	U8 mStyle;
+};
+
+class LLFontRegistry
+{
+public:
+	LLFontRegistry(const string_vec_t& xui_paths);
+	~LLFontRegistry();
+
+	// Load standard font info from XML file(s).
+	bool parseFontInfo(const std::string& xml_filename); 
+	bool initFromXML(LLXMLNodePtr node);
+
+	// Clear cached glyphs for all fonts.
+	void reset();
+
+	// Destroy all fonts.
+	void clear();
+
+	// GL cleanup
+	void destroyGL();
+		
+	LLFontGL *getFont(const LLFontDescriptor& desc);
+	const LLFontDescriptor *getMatchingFontDesc(const LLFontDescriptor& desc);
+	const LLFontDescriptor *getClosestFontTemplate(const LLFontDescriptor& desc);
+
+	bool nameToSize(const std::string& size_name, F32& size);
+
+	void dump();
+	
+	const string_vec_t& getUltimateFallbackList() const { return mUltimateFallbackList; }
+
+private:
+	LLFontGL *createFont(const LLFontDescriptor& desc);
+	typedef std::map<LLFontDescriptor,LLFontGL*> font_reg_map_t;
+	typedef std::map<std::string,F32> font_size_map_t;
+
+	// Given a descriptor, look up specific font instantiation.
+	font_reg_map_t mFontMap;
+	// Given a size name, look up the point size.
+	font_size_map_t mFontSizes;
+
+	string_vec_t mUltimateFallbackList;
+	string_vec_t mXUIPaths;
+};
+
+#endif // LL_LLFONTREGISTRY_H
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index c784019cd9ebd322bb2d873d8d48befdfd64d482..cdf626e16f97b04f84a91aa5b3d4143f362bcec1 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1373,6 +1373,9 @@ void LLImageGL::analyzeAlpha(const void* data_in, S32 w, S32 h)
 	case GL_RGBA:
 		stride = 4;
 		break;
+	case GL_BGRA_EXT:
+		stride = 4;
+		break;
 	default:
 		llwarns << "Cannot analyze alpha of image with primary format " << std::hex << mFormatPrimary << std::dec << llendl;
 		return;
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt
index 8ae0137a5e2dbb77f603409585f56fe4cdb3a3c0..32118e8a691564b9503a8328f1620b450067de16 100644
--- a/indra/llui/CMakeLists.txt
+++ b/indra/llui/CMakeLists.txt
@@ -64,6 +64,7 @@ set(llui_SOURCE_FILES
     lltabcontainervertical.cpp
     lltextbox.cpp
     lltexteditor.cpp
+    lltextparser.cpp
     llui.cpp
     lluictrl.cpp
     lluictrlfactory.cpp
@@ -119,6 +120,7 @@ set(llui_HEADER_FILES
     lltabcontainervertical.h
     lltextbox.h
     lltexteditor.h
+    lltextparser.h
     lluiconstants.h
     lluictrlfactory.h
     lluictrl.h
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 309919b874375cd77e8fafce856874e16bcf0f12..2c2c1c25d8655331aa901d32724be339abc6cad7 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -188,7 +188,7 @@ LLButton::LLButton(const std::string& name, const LLRect& rect,
 
 void LLButton::init(void (*click_callback)(void*), void *callback_data, const LLFontGL* font, const std::string& control_name)
 {
-	mGLFont = ( font ? font : LLFontGL::sSansSerif);
+	mGLFont = ( font ? font : LLFontGL::getFontSansSerif());
 
 	// Hack to make sure there is space for at least one character
 	if (getRect().getWidth() - (mRightHPad + mLeftHPad) < mGLFont->getWidth(std::string(" ")))
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 285c55e63323fa377162aeea1e151ad0cd0d4591..724b77541afa6cf10630752bb9c2ea2bfd152e70 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -164,7 +164,7 @@ public:
 	void			setDisabledLabelColor( const LLColor4& c )		{ mDisabledLabelColor = c; }
 	
 	void			setFont(const LLFontGL *font)		
-		{ mGLFont = ( font ? font : LLFontGL::sSansSerif); }
+		{ mGLFont = ( font ? font : LLFontGL::getFontSansSerif()); }
 	void			setScaleImage(BOOL scale)			{ mScaleImage = scale; }
 	BOOL			getScaleImage() const				{ return mScaleImage; }
 
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp
index f351d3a7f26d84dab730c5c29755db3d3bebbb19..eda9467d870c753f0ac8dd7d9a96735bbf2d1824 100644
--- a/indra/llui/llcheckboxctrl.cpp
+++ b/indra/llui/llcheckboxctrl.cpp
@@ -73,7 +73,7 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const std::string& name, const LLRect& rect,
 	}
 	else
 	{
-		mFont = LLFontGL::sSansSerifSmall;
+		mFont = LLFontGL::getFontSansSerifSmall();
 	}
 
 	// must be big enough to hold all children
@@ -123,7 +123,7 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const std::string& name, const LLRect& rect,
 		inactive_false_id = "UIImgRadioInactiveUUID";
 		mButton = new LLButton(std::string("Radio control button"), btn_rect,
 							   active_false_id, active_true_id, control_which,
-							   &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::sSansSerif ); 
+							   &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::getFontSansSerif() ); 
 		mButton->setDisabledImages( inactive_false_id, inactive_true_id );
 		mButton->setHoverGlowStrength(0.35f);
 	}
@@ -135,7 +135,7 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const std::string& name, const LLRect& rect,
 		inactive_false_id = "UIImgCheckboxInactiveUUID";
 		mButton = new LLButton(std::string("Checkbox control button"), btn_rect,
 							   active_false_id, active_true_id, control_which,
-							   &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::sSansSerif ); 
+							   &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::getFontSansSerif() ); 
 		mButton->setDisabledImages( inactive_false_id, inactive_true_id );
 		mButton->setHoverGlowStrength(0.35f);
 	}
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index fd17a16a37cd9018a1ad8599e458b59fe9c375eb..28a05c13f5519f7a145715dffbe5e3bcf1ed1541 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -89,7 +89,7 @@ LLComboBox::LLComboBox(	const std::string& name, const LLRect &rect, const std::
 	mButton->setScaleImage(TRUE);
 
 	mButton->setMouseDownCallback(onButtonDown);
-	mButton->setFont(LLFontGL::sSansSerifSmall);
+	mButton->setFont(LLFontGL::getFontSansSerifSmall());
 	mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT);
 	mButton->setHAlign( LLFontGL::LEFT );
 	mButton->setRightHPad(2);
@@ -517,7 +517,7 @@ void LLComboBox::updateLayout()
 			mTextEntry = new LLLineEditor(std::string("combo_text_entry"),
 										text_entry_rect,
 										LLStringUtil::null,
-										LLFontGL::sSansSerifSmall,
+										LLFontGL::getFontSansSerifSmall(),
 										mMaxChars,
 										onTextCommit,
 										onTextEntry,
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 3d92280828f7ec102fd797903ba7c7a5dc76e2f9..94af1868bed169ce3e8aff9c8613e32732329b2e 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1703,7 +1703,7 @@ void LLFloater::buildButtons()
 			LLStringUtil::null,
 			sButtonCallbacks[i],
 			this,
-			LLFontGL::sSansSerif);
+			LLFontGL::getFontSansSerif());
 
 		buttonp->setTabStop(FALSE);
 		buttonp->setFollowsTop();
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 609763ce15520f90cdea074d58205bde32650a1a..6aa2aac48cb0637d0f0b88f340b0931a92c7c081 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -152,7 +152,7 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect,
 	}
 	else
 	{
-		mGLFont = LLFontGL::sSansSerifSmall;
+		mGLFont = LLFontGL::getFontSansSerifSmall();
 	}
 
 	setFocusLostCallback(focus_lost_callback);
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 64649b664c50804df79f784d046f84907870cbf6..f2f2aae38251bad56c57b733ee272b2b0b0b7e93 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -142,7 +142,7 @@ LLMenuItemGL::LLMenuItemGL( const std::string& name, const std::string& label, K
 	mHighlight( FALSE ),
 	mGotHover( FALSE ),
 	mBriefItem( FALSE ),
-	mFont( LLFontGL::sSansSerif ),
+	mFont( LLFontGL::getFontSansSerif() ),
 	mStyle(LLFontGL::NORMAL),
 	mDrawTextDisabled( FALSE )
 {
@@ -2168,8 +2168,8 @@ void LLMenuGL::arrange( void )
 		U32 max_width = getTornOff() ? U32_MAX : menu_region_rect.getWidth();
 		U32 max_height = getTornOff() ? U32_MAX : menu_region_rect.getHeight();
 		// *FIX: create the item first and then ask for its dimensions?
-		S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::sSansSerif->getWidth( std::string("More") );
-		S32 spillover_item_height = llround(LLFontGL::sSansSerif->getLineHeight()) + MENU_ITEM_PADDING;
+		S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::getFontSansSerif()->getWidth( std::string("More") );
+		S32 spillover_item_height = llround(LLFontGL::getFontSansSerif()->getLineHeight()) + MENU_ITEM_PADDING;
 
 		if (mHorizontalLayout)
 		{
@@ -3495,7 +3495,7 @@ void LLPieMenu::drawBackground(LLMenuItemGL* itemp, LLColor4& color)
 BOOL LLPieMenu::append(LLMenuItemGL *item)
 {
 	item->setBriefItem(TRUE);
-	item->setFont( LLFontGL::sSansSerifSmall );
+	item->setFont( LLFontGL::getFontSansSerifSmall() );
 	return LLMenuGL::append(item);
 }
 
@@ -3503,7 +3503,7 @@ BOOL LLPieMenu::append(LLMenuItemGL *item)
 BOOL LLPieMenu::appendSeparator(const std::string &separator_name)
 {
 	LLMenuItemGL* separator = new LLMenuItemBlankGL();
-	separator->setFont( LLFontGL::sSansSerifSmall );
+	separator->setFont( LLFontGL::getFontSansSerifSmall() );
 	return append( separator );
 }
 
@@ -3517,7 +3517,7 @@ BOOL LLPieMenu::appendPieMenu(LLPieMenu *menu)
 	LLPieMenuBranch *item;
 	item = new LLPieMenuBranch(menu->getName(), menu->getLabel(), menu);
 	getParent()->addChild(item->getBranch());
-	item->setFont( LLFontGL::sSansSerifSmall );
+	item->setFont( LLFontGL::getFontSansSerifSmall() );
 	return append( item );
 }
 
diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp
index bbbd138e26d61a99f8da81f88e0d5c8c95837852..8bcf9f9b764bd071eb8137b1bd2458c081884e7a 100644
--- a/indra/llui/llmultisliderctrl.cpp
+++ b/indra/llui/llmultisliderctrl.cpp
@@ -544,7 +544,7 @@ LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFa
 	// HACK: Font might not be specified.
 	if (!font)
 	{
-		font = LLFontGL::sSansSerifSmall;
+		font = LLFontGL::getFontSansSerifSmall();
 	}
 
 	S32 label_width = 0;
diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp
index b751c171f6f1bd0a26697875e99547ab98980964..32d3d1f7522ff515882fcc63972cc79e7b4c9b44 100644
--- a/indra/llui/llresmgr.cpp
+++ b/indra/llui/llresmgr.cpp
@@ -55,11 +55,11 @@ LLResMgr::LLResMgr()
 	{
 		mUSAFonts[i] = NULL;
 	}
-	mUSAFonts[ LLFONT_OCRA ]			= LLFontGL::sMonospace;
-	mUSAFonts[ LLFONT_SANSSERIF ]		= LLFontGL::sSansSerif;
-	mUSAFonts[ LLFONT_SANSSERIF_SMALL ]	= LLFontGL::sSansSerifSmall;
-	mUSAFonts[ LLFONT_SANSSERIF_BIG ]	= LLFontGL::sSansSerifBig;
-	mUSAFonts[ LLFONT_SMALL ]			= LLFontGL::sMonospace;
+	mUSAFonts[ LLFONT_OCRA ]			= LLFontGL::getFontMonospace();
+	mUSAFonts[ LLFONT_SANSSERIF ]		= LLFontGL::getFontSansSerif();
+	mUSAFonts[ LLFONT_SANSSERIF_SMALL ]	= LLFontGL::getFontSansSerifSmall();
+	mUSAFonts[ LLFONT_SANSSERIF_BIG ]	= LLFontGL::getFontSansSerifBig();
+	mUSAFonts[ LLFONT_SMALL ]			= LLFontGL::getFontMonospace();
 /*
 	// USA Strings
 	for( i=0; i<LLSTR_COUNT; i++ )
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp
index 3972c01831d80f6b986e0e5b473f83c36bf7ca64..65086d833d1cf3a8f35876a18e05a52b54c68c18 100644
--- a/indra/llui/llscrollbar.cpp
+++ b/indra/llui/llscrollbar.cpp
@@ -114,7 +114,7 @@ LLScrollbar::LLScrollbar(
 
 	LLButton* line_up_btn = new LLButton(std::string("Line Up"), line_up_rect,
 										 line_up_img, line_up_selected_img, LLStringUtil::null,
-										 &LLScrollbar::onLineUpBtnPressed, this, LLFontGL::sSansSerif );
+										 &LLScrollbar::onLineUpBtnPressed, this, LLFontGL::getFontSansSerif() );
 	if( LLScrollbar::VERTICAL == mOrientation )
 	{
 		line_up_btn->setFollowsRight();
@@ -134,7 +134,7 @@ LLScrollbar::LLScrollbar(
 
 	LLButton* line_down_btn = new LLButton(std::string("Line Down"), line_down_rect,
 										   line_down_img, line_down_selected_img, LLStringUtil::null,
-										   &LLScrollbar::onLineDownBtnPressed, this, LLFontGL::sSansSerif );
+										   &LLScrollbar::onLineDownBtnPressed, this, LLFontGL::getFontSansSerif() );
 	line_down_btn->setFollowsRight();
 	line_down_btn->setFollowsBottom();
 	line_down_btn->setHeldDownCallback( &LLScrollbar::onLineDownBtnPressed );
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 45ee78507e43149602ca331ad5c511b594e753a7..7b6c125eb10c2b6ae6305515812cbee791c8cba9 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -957,14 +957,14 @@ void LLScrollListCtrl::calcColumnWidths()
 		column->setWidth(new_width);
 
 		// update max content width for this column, by looking at all items
-		column->mMaxContentWidth = column->mHeader ? LLFontGL::sSansSerifSmall->getWidth(column->mLabel) + mColumnPadding + HEADING_TEXT_PADDING : 0;
+		column->mMaxContentWidth = column->mHeader ? LLFontGL::getFontSansSerifSmall()->getWidth(column->mLabel) + mColumnPadding + HEADING_TEXT_PADDING : 0;
 		item_list::iterator iter;
 		for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
 		{
 			LLScrollListCell* cellp = (*iter)->getColumn(column->mIndex);
 			if (!cellp) continue;
 
-			column->mMaxContentWidth = llmax(LLFontGL::sSansSerifSmall->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth);
+			column->mMaxContentWidth = llmax(LLFontGL::getFontSansSerifSmall()->getWidth(cellp->getValue().asString()) + mColumnPadding + COLUMN_TEXT_PADDING, column->mMaxContentWidth);
 		}
 
 		max_item_width += column->mMaxContentWidth;
@@ -3711,8 +3711,8 @@ void LLColumnHeader::showList()
 			descending_string = mDescendingText.getString();
 		}
 
-		S32 text_width = LLFontGL::sSansSerifSmall->getWidth(ascending_string);
-		text_width = llmax(text_width, LLFontGL::sSansSerifSmall->getWidth(descending_string)) + 10;
+		S32 text_width = LLFontGL::getFontSansSerifSmall()->getWidth(ascending_string);
+		text_width = llmax(text_width, LLFontGL::getFontSansSerifSmall()->getWidth(descending_string)) + 10;
 		text_width = llmax(text_width, getRect().getWidth() - 30);
 
 		mList->getColumn(0)->setWidth(text_width);
diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp
index f603fc5119c72539d6bee04459908f84ad81c1ef..31baddd7ccd3002eb5e380f426ee69b3c45bb557 100644
--- a/indra/llui/llsliderctrl.cpp
+++ b/indra/llui/llsliderctrl.cpp
@@ -464,7 +464,7 @@ LLView* LLSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
 	// HACK: Font might not be specified.
 	if (!font)
 	{
-		font = LLFontGL::sSansSerifSmall;
+		font = LLFontGL::getFontSansSerifSmall();
 	}
 
 	S32 label_width = 0;
diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index b0a52a1ed3aa79a7b6abca187759eb17b0ec8d79..c54a2cd1401f0b46b24d93d07496e3dfa309b2be 100644
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -99,7 +99,7 @@ LLSpinCtrl::LLSpinCtrl(	const std::string& name, const LLRect& rect, const std::
 								   out_id,
 								   in_id,
 								   LLStringUtil::null,
-								   &LLSpinCtrl::onUpBtn, this, LLFontGL::sSansSerif );
+								   &LLSpinCtrl::onUpBtn, this, LLFontGL::getFontSansSerif() );
 	mUpBtn->setFollowsLeft();
 	mUpBtn->setFollowsBottom();
 	mUpBtn->setHeldDownCallback( &LLSpinCtrl::onUpBtn );
@@ -113,7 +113,7 @@ LLSpinCtrl::LLSpinCtrl(	const std::string& name, const LLRect& rect, const std::
 							out_id,
 							in_id,
 							LLStringUtil::null,
-							&LLSpinCtrl::onDownBtn, this, LLFontGL::sSansSerif );
+							&LLSpinCtrl::onDownBtn, this, LLFontGL::getFontSansSerif() );
 	mDownBtn->setFollowsLeft();
 	mDownBtn->setFollowsBottom();
 	mDownBtn->setHeldDownCallback( &LLSpinCtrl::onDownBtn );
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index e3ebd0057dc0931955b5805157aff74c59a4c175..f4169488d4c0bad78da6d189dbd7db9317c754b7 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -1658,14 +1658,14 @@ void LLTabContainer::initButtons()
 		in_id = "UIImgBtnJumpLeftInUUID";
 		mJumpPrevArrowBtn = new LLButton(std::string("Jump Left Arrow"), jump_left_arrow_btn_rect,
 										 out_id, in_id, LLStringUtil::null,
-										 &LLTabContainer::onJumpFirstBtn, this, LLFontGL::sSansSerif );
+										 &LLTabContainer::onJumpFirstBtn, this, LLFontGL::getFontSansSerif() );
 		mJumpPrevArrowBtn->setFollowsLeft();
 
 		out_id = "UIImgBtnScrollLeftOutUUID";
 		in_id = "UIImgBtnScrollLeftInUUID";
 		mPrevArrowBtn = new LLButton(std::string("Left Arrow"), left_arrow_btn_rect,
 									 out_id, in_id, LLStringUtil::null,
-									 &LLTabContainer::onPrevBtn, this, LLFontGL::sSansSerif );
+									 &LLTabContainer::onPrevBtn, this, LLFontGL::getFontSansSerif() );
 		mPrevArrowBtn->setHeldDownCallback(onPrevBtnHeld);
 		mPrevArrowBtn->setFollowsLeft();
 	
@@ -1674,7 +1674,7 @@ void LLTabContainer::initButtons()
 		mJumpNextArrowBtn = new LLButton(std::string("Jump Right Arrow"), jump_right_arrow_btn_rect,
 										 out_id, in_id, LLStringUtil::null,
 										 &LLTabContainer::onJumpLastBtn, this,
-										 LLFontGL::sSansSerif);
+										 LLFontGL::getFontSansSerif());
 		mJumpNextArrowBtn->setFollowsRight();
 
 		out_id = "UIImgBtnScrollRightOutUUID";
@@ -1682,7 +1682,7 @@ void LLTabContainer::initButtons()
 		mNextArrowBtn = new LLButton(std::string("Right Arrow"), right_arrow_btn_rect,
 									 out_id, in_id, LLStringUtil::null,
 									 &LLTabContainer::onNextBtn, this,
-									 LLFontGL::sSansSerif);
+									 LLFontGL::getFontSansSerif());
 		mNextArrowBtn->setFollowsRight();
 
 		if( getTabPosition() == TOP )
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index ccaafab14dc7e3ea2f009cb057692a8974b07fc5..2348ef314c4362894c1919c4ff7b88f600fa096d 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -41,7 +41,7 @@ static LLRegisterWidget<LLTextBox> r("text");
 LLTextBox::LLTextBox(const std::string& name, const LLRect& rect, const std::string& text,
 					 const LLFontGL* font, BOOL mouse_opaque)
 :	LLUICtrl(name, rect, mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP ),
-	mFontGL(font ? font : LLFontGL::sSansSerifSmall)
+	mFontGL(font ? font : LLFontGL::getFontSansSerifSmall())
 {
 	initDefaults();
 	setText( text );
@@ -51,7 +51,7 @@ LLTextBox::LLTextBox(const std::string& name, const LLRect& rect, const std::str
 LLTextBox::LLTextBox(const std::string& name, const std::string& text, F32 max_width,
 					 const LLFontGL* font, BOOL mouse_opaque) :
 	LLUICtrl(name, LLRect(0, 0, 1, 1), mouse_opaque, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP),	
-	mFontGL(font ? font : LLFontGL::sSansSerifSmall)
+	mFontGL(font ? font : LLFontGL::getFontSansSerifSmall())
 {
 	initDefaults();
 	setWrappedText(text, max_width);
@@ -61,7 +61,7 @@ LLTextBox::LLTextBox(const std::string& name, const std::string& text, F32 max_w
 
 LLTextBox::LLTextBox(const std::string& name_and_label, const LLRect& rect) :
 	LLUICtrl(name_and_label, rect, TRUE, NULL, NULL, FOLLOWS_LEFT | FOLLOWS_TOP),	
-	mFontGL(LLFontGL::sSansSerifSmall)
+	mFontGL(LLFontGL::getFontSansSerifSmall())
 {
 	initDefaults();
 	setText( name_and_label );
@@ -431,7 +431,7 @@ LLView* LLTextBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f
 	std::string font_style;
 	if (node->getAttributeString("font-style", font_style))
 	{
-		text_box->mFontStyle = LLFontGL::getStyleFromString(font_style);
+		text_box->mFontStyle |= LLFontGL::getStyleFromString(font_style);
 	}
 	
 	BOOL mouse_opaque = text_box->getMouseOpaque();
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index a626a7a1bc11c4ac7e211b8cadc440b1409e232a..7928887d4b37316309eaffcc746b5b13389a43dd 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -57,6 +57,7 @@
 #include "llcontrol.h"
 #include "llimagegl.h"
 #include "llwindow.h"
+#include "lltextparser.h"
 #include <queue>
 
 // 
@@ -300,7 +301,7 @@ LLTextEditor::LLTextEditor(
 	}
 	else
 	{
-		mGLFont = LLFontGL::sSansSerif;
+		mGLFont = LLFontGL::getFontSansSerif();
 	}
 
 	updateTextRect();
@@ -383,7 +384,7 @@ void LLTextEditor::updateLineStartList(S32 startpos)
 {
 	updateSegments();
 	
-	bindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
+	bindEmbeddedChars(mGLFont);
 
 	S32 seg_num = mSegments.size();
 	S32 seg_idx = 0;
@@ -461,7 +462,7 @@ void LLTextEditor::updateLineStartList(S32 startpos)
 		}
 	}
 	
-	unbindEmbeddedChars(const_cast<LLFontGL*>(mGLFont));
+	unbindEmbeddedChars(mGLFont);
 
 	mScrollbar->setDocSize( getLineCount() );
 
@@ -852,13 +853,13 @@ S32 LLTextEditor::getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL rou
 		if (mAllowEmbeddedItems)
 		{
 			// Figure out which character we're nearest to.
-			bindEmbeddedChars(const_cast<LLFontGL*>(mGLFont));
+			bindEmbeddedChars(mGLFont);
 			pos = mGLFont->charFromPixelOffset(mWText.c_str(), line_start,
 											   (F32)(local_x - mTextRect.mLeft),
 											   (F32)(mTextRect.getWidth()),
 											   line_len,
 											   round, TRUE);
-			unbindEmbeddedChars(const_cast<LLFontGL*>(mGLFont));
+			unbindEmbeddedChars(mGLFont);
 		}
 		else
 		{
@@ -2931,7 +2932,7 @@ void LLTextEditor::drawText()
 		// draw the line numbers
 		if( mShowLineNumbers && !cur_line_is_continuation) 
 		{
-			const LLFontGL *num_font = LLFontGL::sMonospace;
+			const LLFontGL *num_font = LLFontGL::getFontMonospace();
 			F32 y_top = text_y + ((F32)llround(num_font->getLineHeight()) / 2);
 			const LLWString ltext = utf8str_to_wstring(llformat("%*d", UI_TEXTEDITOR_LINE_NUMBER_DIGITS, cur_line_num ));
 			BOOL is_cur_line = getCurrentLine() == cur_line_num;
@@ -3116,7 +3117,7 @@ void LLTextEditor::draw()
 	{
 		LLLocalClipRect clip(LLRect(0, getRect().getHeight(), getRect().getWidth() - (mScrollbar->getVisible() ? SCROLLBAR_SIZE : 0), 0));
 
-			bindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
+			bindEmbeddedChars(mGLFont);
 
 			drawBackground();
 			drawSelectionBackground();
@@ -3124,7 +3125,7 @@ void LLTextEditor::draw()
 			drawText();
 			drawCursor();
 
-			unbindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
+			unbindEmbeddedChars(mGLFont);
 
 		//RN: the decision was made to always show the orange border for keyboard focus but do not put an insertion caret
 		// when in readonly mode
@@ -3245,7 +3246,7 @@ void LLTextEditor::changePage( S32 delta )
 
 void LLTextEditor::changeLine( S32 delta )
 {
-	bindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
+	bindEmbeddedChars(mGLFont);
 
 	S32 line, offset;
 	getLineAndOffset( mCursorPos, &line, &offset );
@@ -3272,7 +3273,7 @@ void LLTextEditor::changeLine( S32 delta )
 	}
 	else
 	{
-		unbindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
+		unbindEmbeddedChars(mGLFont);
 		return;
 	}
 
@@ -3297,7 +3298,7 @@ void LLTextEditor::changeLine( S32 delta )
 
 	// put desired position into remember-buffer after setCursorPos()
 	mDesiredXPixel = desired_x_pixel;
-	unbindEmbeddedChars( const_cast<LLFontGL*>(mGLFont) );
+	unbindEmbeddedChars(mGLFont);
 }
 
 BOOL LLTextEditor::isScrolledToTop() 
@@ -3519,9 +3520,16 @@ void LLTextEditor::appendColoredText(const std::string &new_text,
 									 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);
 }
@@ -3529,8 +3537,9 @@ void LLTextEditor::appendColoredText(const std::string &new_text,
 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)
 	{
 
@@ -3547,27 +3556,73 @@ void LLTextEditor::appendStyledText(const std::string &new_text,
 			}
 			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 && stylep)
+		{
+			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)
@@ -4275,7 +4330,6 @@ S32 LLTextEditor::findHTMLToken(const std::string &line, S32 pos, BOOL reverse)
 	} 
 	else
 	{
-		
 		for (int index=pos; index<(S32)line.length(); index++)
 		{
 			char c = line[index];
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 72f673463e1b30ccd797bfc8d60bd523ad1175d4..56825e7bfef70f6c0c68b6ab18705e507268bc81 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -76,6 +76,7 @@ public:
 	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);
@@ -149,8 +150,11 @@ public:
 	// 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);
@@ -313,8 +317,8 @@ protected:
 	virtual BOOL	handleMouseUpOverSegment(S32 x, S32 y, MASK mask);
 
 	virtual llwchar	pasteEmbeddedItem(llwchar ext_char) { return ext_char; }
-	virtual void	bindEmbeddedChars(LLFontGL* font) const {}
-	virtual void	unbindEmbeddedChars(LLFontGL* font) const {}
+	virtual void	bindEmbeddedChars(const LLFontGL* font) const {}
+	virtual void	unbindEmbeddedChars(const LLFontGL* font) const {}
 	
 	S32				findHTMLToken(const std::string &line, S32 pos, BOOL reverse) const;
 	BOOL			findHTML(const std::string &line, S32 *begin, S32 *end) const;
@@ -402,6 +406,7 @@ protected:
 	S32				mLastSelectionY;
 
 	BOOL			mParseHTML;
+	BOOL			mParseHighlights;
 	std::string		mHTML;
 
 	typedef std::vector<LLTextSegment *> segment_list_t;
diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..cc3fcd4d84083db0e5063c544070fdd59f851b2f
--- /dev/null
+++ b/indra/llui/lltextparser.cpp
@@ -0,0 +1,298 @@
+/** 
+ * @file lltexteditor.cpp
+ * @brief LLTextEditor base class
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2007, 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://secondlife.com/developers/opensource/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://secondlife.com/developers/opensource/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; 
+	}
+	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;
+}
diff --git a/indra/llui/lltextparser.h b/indra/llui/lltextparser.h
new file mode 100644
index 0000000000000000000000000000000000000000..f6099b8f65ce0e86d4c0e514063494749314bcea
--- /dev/null
+++ b/indra/llui/lltextparser.h
@@ -0,0 +1,48 @@
+/** 
+ * @file llTextParser.h
+ * @brief GUI for user-defined highlights
+ *
+ * Copyright (c) 2002-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+#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
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index 1d37061ae8b0dc55b3aee3a0f6427c8b055b99d2..983cc53f69a437d65bd98f357d3df0c5d7cdd82d 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -149,7 +149,11 @@ void LLUICtrlFactory::setupPaths()
 	}
 }
 
-
+// static
+const std::vector<std::string>& LLUICtrlFactory::getXUIPaths()
+{
+	return sXUIPaths;
+}
 
 //-----------------------------------------------------------------------------
 // getLayeredXMLNode()
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index b5b1af0371daed72b05a037a851599e6f41e9407..5e7c24efc07df1e2b57137c8c4b5a36f2c8e812e 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -78,6 +78,8 @@ public:
 
 	static bool getLayeredXMLNode(const std::string &filename, LLXMLNodePtr& root);
 
+	static const std::vector<std::string>& getXUIPaths();
+
 private:
 	bool getLayeredXMLNodeImpl(const std::string &filename, LLXMLNodePtr& root);
 
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index d59155398f5cec6c73e80f7e206fe52a566102a2..a3db076b17eb9b85b6b50b1e39b57552f5bf9b7e 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -709,9 +709,11 @@ BOOL LLView::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_s
 		LLView* viewp = *child_it;
 		S32 local_x = x - viewp->mRect.mLeft;
 		S32 local_y = y - viewp->mRect.mBottom;
+		// Allow tooltips for disabled views so we can explain to the user why
+		// the view is disabled. JC
 		if( viewp->pointInView(local_x, local_y) 
 			&& viewp->getVisible() 
-			&& viewp->getEnabled()
+			// && viewp->getEnabled()
 			&& viewp->handleToolTip(local_x, local_y, msg, sticky_rect_screen ))
 		{
 			// child provided a tooltip, just return
@@ -1290,6 +1292,8 @@ void LLView::draw()
 	{
 		drawDebugRect();
 	}
+
+	gGL.getTexUnit(0)->disable();
 }
 
 //Draw a box for debugging.
@@ -1344,7 +1348,7 @@ void LLView::drawDebugRect()
 			y = debug_rect.getHeight()/2;
 			std::string debug_text = llformat("%s (%d x %d)", getName().c_str(),
 										debug_rect.getWidth(), debug_rect.getHeight());
-			LLFontGL::sSansSerifSmall->renderUTF8(debug_text, 0, (F32)x, (F32)y, border_color,
+			LLFontGL::getFontSansSerifSmall()->renderUTF8(debug_text, 0, (F32)x, (F32)y, border_color,
 												LLFontGL::HCENTER, LLFontGL::BASELINE, LLFontGL::NORMAL,
 												S32_MAX, S32_MAX, NULL, FALSE);
 		}
@@ -2607,19 +2611,40 @@ void LLView::parseFollowsFlags(LLXMLNodePtr node)
 	}
 }
 
-
 // static
 LLFontGL* LLView::selectFont(LLXMLNodePtr node)
 {
-	LLFontGL* gl_font = NULL;
-
+	std::string font_name, font_size, font_style;
+	U8 style = 0;
+	
 	if (node->hasAttribute("font"))
 	{
-		std::string font_name;
 		node->getAttributeString("font", font_name);
+	}
+	
+	if (node->hasAttribute("font_size"))
+	{
+		node->getAttributeString("font_size", font_size);
+	}
 
-		gl_font = LLFontGL::fontFromName(font_name);
+	if (node->hasAttribute("font_style"))
+	{
+		node->getAttributeString("font_style", font_style);
+		style = LLFontGL::getStyleFromString(font_style);
+	}
+
+	if (node->hasAttribute("font-style"))
+	{
+		node->getAttributeString("font-style", font_style);
+		style = LLFontGL::getStyleFromString(font_style);
 	}
+
+	if (font_name.empty())
+		return NULL;
+
+	LLFontDescriptor desc(font_name, font_size, style);
+	LLFontGL* gl_font = LLFontGL::getFont(desc);
+
 	return gl_font;
 }
 
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index bd7c4d8410112f323ad4e371db26604256f9e672..fb4770e8476849fe72672339c64e78e112dfe8a4 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -309,16 +309,16 @@ void *LLWindow::getMediaWindow()
 }
 
 // static
-std::string LLWindow::getFontListSans()
+std::vector<std::string> LLWindow::getDynamicFallbackFontList()
 {
 #if LL_WINDOWS
-	return LLWindowWin32::getFontListSans();
+	return LLWindowWin32::getDynamicFallbackFontList();
 #elif LL_DARWIN
-	return LLWindowMacOSX::getFontListSans();
+	return LLWindowMacOSX::getDynamicFallbackFontList();
 #elif LL_SDL
-	return LLWindowSDL::getFontListSans();
+	return LLWindowSDL::getDynamicFallbackFontList();
 #else
-	return "";
+	return std::vector<std::string>();
 #endif
 }
 
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index ae33c5a8146c61ed3dec50c555a7a6b72e9c3ade..9e01596b81bafcdc518ea06e865c4f1f6d8f6ba7 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -198,7 +198,7 @@ public:
 	virtual void interruptLanguageTextInput() {}
 	virtual void spawnWebBrowser(const std::string& escaped_url) {};
 
-	static std::string getFontListSans();
+	static std::vector<std::string> getDynamicFallbackFontList();
 
 protected:
 	LLWindow(BOOL fullscreen, U32 flags);
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 8d446f18f1b82d1aa9cb08b8cf963dfbaec3328b..4f6df0f1524bcb416f5251cc84365a2faa312d75 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -3358,10 +3358,9 @@ void LLWindowMacOSX::interruptLanguageTextInput()
 }
 
 //static
-std::string LLWindowMacOSX::getFontListSans()
+std::vector<std::string> LLWindowMacOSX::getDynamicFallbackFontList()
 {
-	// This is a fairly complete Japanese font that ships with Mac OS X.
-	// The first filename is in UTF8, but it shows up in the font menu as "Hiragino Kaku Gothic Pro W3".
-	// The third filename is in UTF8, but it shows up in the font menu as "STHeiti Light"
-	return "\xE3\x83\x92\xE3\x83\xA9\xE3\x82\xAD\xE3\x82\x99\xE3\x83\x8E\xE8\xA7\x92\xE3\x82\xB3\xE3\x82\x99 Pro W3.otf;\xE3\x83\x92\xE3\x83\xA9\xE3\x82\xAD\xE3\x82\x99\xE3\x83\x8E\xE8\xA7\x92\xE3\x82\xB3\xE3\x82\x99 ProN W3.otf;AppleGothic.dfont;AppleGothic.ttf;\xe5\x8d\x8e\xe6\x96\x87\xe7\xbb\x86\xe9\xbb\x91.ttf";
+	// Fonts previously in getFontListSans() have moved to fonts.xml.
+	return std::vector<std::string>();
 }
+
diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h
index 9135fb9ef670718f0cc95dbc6d369087ba2483b7..388678273269a29676fae95f262a98628ed6e81e 100644
--- a/indra/llwindow/llwindowmacosx.h
+++ b/indra/llwindow/llwindowmacosx.h
@@ -113,7 +113,7 @@ public:
 	/*virtual*/ void interruptLanguageTextInput();
 	/*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
 
-	static std::string getFontListSans();
+	static std::vector<std::string> getDynamicFallbackFontList();
 
 protected:
 	LLWindowMacOSX(
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index a85cbcf9b963bfd0f4145e687ed1d848e367f38c..d6ee7acbaa7b23366a0d63656771a9186e83329f 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -2353,7 +2353,7 @@ void LLWindowSDL::bringToFront()
 }
 
 //static
-std::string LLWindowSDL::getFontListSans()
+std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
 {
 	// Use libfontconfig to find us a nice ordered list of fallback fonts
 	// specific to this system.
@@ -2370,7 +2370,7 @@ std::string LLWindowSDL::getFontListSans()
 	// renderable range if for some reason our FreeType actually fails
 	// to use some of the fonts we want it to.
 	const bool elide_unicode_coverage = true;
-	std::string rtn;
+	std::vector<std::string> rtns;
 	FcFontSet *fs = NULL;
 	FcPattern *sortpat = NULL;
 	int font_count = 0;
@@ -2404,7 +2404,8 @@ std::string LLWindowSDL::getFontListSans()
 	if (!FcInit())
 	{
 		llwarns << "FontConfig failed to initialize." << llendl;
-		return final_fallback;
+		rtns.push_back(final_fallback);
+		return rtns;
 	}
 
 	sortpat = FcNameParse((FcChar8*) sort_order.c_str());
@@ -2429,17 +2430,24 @@ std::string LLWindowSDL::getFontListSans()
 								&filename)
 			    && filename)
 			{
-				rtn += std::string((const char*)filename)+";";
+				rtns.push_back(std::string((const char*)filename));
 				++font_count;
 			}
 		}
 		FcFontSetDestroy (fs);
 	}
 
-	lldebugs << "Using font list: " << rtn << llendl;
+	lldebugs << "Using font list: " << llendl;
+	for (std::vector<std::string>::iterator it = rtns.begin();
+		 it != rtns.end();
+		 ++it)
+	{
+		lldebugs << "  file: " << *it << llendl;
+	}
 	llinfos << "Using " << font_count << " system font(s)." << llendl;
 
-	return rtn + final_fallback;
+	rtns.push_back(final_fallback);
+	return rtns;
 }
 
 #endif // LL_SDL
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index 7ac3d980fcc7b0216c5e7eb07118e4d60ecc3449..cebb151764ecb5c7fb21901f61089c70fc45f956 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -119,7 +119,7 @@ public:
 
 	/*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
 	
-	static std::string getFontListSans();
+	static std::vector<std::string> getDynamicFallbackFontList();
 
 	// Not great that these are public, but they have to be accessible
 	// by non-class code and it's better than making them global.
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index b1eb4d93910b27ed354f602af1635d927edbc99d..6280868dfb4316be6ba8b6e1e4b3269995c69efa 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -3654,11 +3654,10 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
 }
 
 //static
-std::string LLWindowWin32::getFontListSans()
+std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList()
 {
-	// Lists Japanese, Korean, and Chinese sanserif fonts available in
-	// Windows XP and Vista, as well as "Arial Unicode MS".
-	return "MSGOTHIC.TTC;gulim.ttc;simhei.ttf;ArialUni.ttf";
+	// Fonts previously in getFontListSans() have moved to fonts.xml.
+	return std::vector<std::string>();
 }
 
 
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index 7495dcbf7ace6c8d40b59961e058ee42a38df158..237f834318ade1dba72ebf56e407932ee8662557 100644
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -112,7 +112,7 @@ public:
 	/*virtual*/ void interruptLanguageTextInput();
 	/*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
 
-	static std::string getFontListSans();
+	static std::vector<std::string> getDynamicFallbackFontList();
 
 protected:
 	LLWindowWin32(
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 76be212c9523b9553a4c918dbc555ae4128de231..1ca1b4f9153f210870a63cb46dbcadd692079c86 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -148,6 +148,7 @@ set(viewer_SOURCE_FILES
     llfloaterenvsettings.cpp
     llfloaterevent.cpp
     llfloaterfriends.cpp
+    llfloaterfonttest.cpp
     llfloatergesture.cpp
     llfloatergodtools.cpp
     llfloatergroupinfo.cpp
@@ -156,6 +157,7 @@ set(viewer_SOURCE_FILES
     llfloaterhandler.cpp
     llfloaterhardwaresettings.cpp
     llfloaterhtml.cpp
+    llfloaterhtmlcurrency.cpp
     llfloaterhtmlhelp.cpp
     llfloaterhtmlsimple.cpp
     llfloaterhud.cpp
@@ -549,6 +551,7 @@ set(viewer_HEADER_FILES
     llfloatereditui.h
     llfloaterenvsettings.h
     llfloaterevent.h
+    llfloaterfonttest.h
     llfloaterfriends.h
     llfloatergesture.h
     llfloatergodtools.h
@@ -558,6 +561,7 @@ set(viewer_HEADER_FILES
     llfloaterhandler.h
     llfloaterhardwaresettings.h
     llfloaterhtml.h
+    llfloaterhtmlcurrency.h
     llfloaterhtmlhelp.h
     llfloaterhtmlsimple.h
     llfloaterhud.h
@@ -1058,6 +1062,7 @@ set(viewer_XUI_FILES
     skins/default/xui/en-us/floater_device_settings.xml
     skins/default/xui/en-us/floater_directory.xml
     skins/default/xui/en-us/floater_env_settings.xml
+    skins/default/xui/en-us/floater_font_test.xml
     skins/default/xui/en-us/floater_gesture.xml
     skins/default/xui/en-us/floater_god_tools.xml
     skins/default/xui/en-us/floater_group_info.xml
@@ -1081,6 +1086,7 @@ set(viewer_XUI_FILES
     skins/default/xui/en-us/floater_live_lsleditor.xml
     skins/default/xui/en-us/floater_lsl_guide.xml
     skins/default/xui/en-us/floater_media_browser.xml
+    skins/default/xui/en-us/floater_mini_map.xml
     skins/default/xui/en-us/floater_moveview.xml
     skins/default/xui/en-us/floater_mute_object.xml
     skins/default/xui/en-us/floater_mute.xml
@@ -1126,6 +1132,7 @@ set(viewer_XUI_FILES
     skins/default/xui/en-us/floater_sim_release_message.xml
     skins/default/xui/en-us/floater_snapshot.xml
     skins/default/xui/en-us/floater_sound_preview.xml
+    skins/default/xui/en-us/floater_statistics.xml
     skins/default/xui/en-us/floater_telehub.xml
     skins/default/xui/en-us/floater_test.xml
     skins/default/xui/en-us/floater_texture_ctrl.xml
@@ -1138,11 +1145,13 @@ set(viewer_XUI_FILES
     skins/default/xui/en-us/floater_wearable_save_as.xml
     skins/default/xui/en-us/floater_windlight_options.xml
     skins/default/xui/en-us/floater_world_map.xml
+    skins/default/xui/en-us/fonts.xml
     skins/default/xui/en-us/menu_inventory.xml
     skins/default/xui/en-us/menu_login.xml
     skins/default/xui/en-us/menu_pie_attachment.xml
     skins/default/xui/en-us/menu_pie_avatar.xml
     skins/default/xui/en-us/menu_pie_land.xml
+    skins/default/xui/en-us/menu_mini_map.xml
     skins/default/xui/en-us/menu_pie_object.xml
     skins/default/xui/en-us/menu_pie_self.xml
     skins/default/xui/en-us/menu_slurl.xml
@@ -1177,6 +1186,7 @@ set(viewer_XUI_FILES
     skins/default/xui/en-us/panel_media_controls.xml
     skins/default/xui/en-us/panel_media_remote_expanded.xml
     skins/default/xui/en-us/panel_media_remote.xml
+    skins/default/xui/en-us/panel_mini_map.xml
     skins/default/xui/en-us/panel_notifications_channel.xml
     skins/default/xui/en-us/panel_overlaybar.xml
     skins/default/xui/en-us/panel_place_small.xml
@@ -1191,6 +1201,7 @@ set(viewer_XUI_FILES
     skins/default/xui/en-us/panel_preferences_popups.xml
     skins/default/xui/en-us/panel_preferences_voice.xml
     skins/default/xui/en-us/panel_preferences_web.xml
+    skins/default/xui/en-us/panel_progress.xml
     skins/default/xui/en-us/panel_region_covenant.xml
     skins/default/xui/en-us/panel_region_debug.xml
     skins/default/xui/en-us/panel_region_estate.xml
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 993033aa2c7fddda3dc3da253d6c3821881a23a4..41120522d5b768bc56fedac773c62ecf69f18710 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1255,6 +1255,17 @@
         <real>0.75</real>
       </array>
     </map>
+    <key>CameraOffsetScale</key>
+    <map>
+      <key>Comment</key>
+      <string>Scales the default offset</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>F32</string>
+      <key>Value</key>
+      <real>1.0</real>
+    </map>
     <key>CameraPosOnLogout</key>
     <map>
       <key>Comment</key>
@@ -1977,295 +1988,889 @@
         <real>1.0</real>
       </array>
     </map>
-    <key>ColorPaletteEntry31</key>
+    <key>ColorPaletteEntry31</key>
+    <map>
+      <key>Comment</key>
+      <string>Color picker palette entry</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Color4</string>
+      <key>Value</key>
+      <array>
+        <real>1.0</real>
+        <real>1.0</real>
+        <real>1.0</real>
+        <real>1.0</real>
+      </array>
+    </map>
+    <key>ColorPaletteEntry32</key>
+    <map>
+      <key>Comment</key>
+      <string>Color picker palette entry</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Color4</string>
+      <key>Value</key>
+      <array>
+        <real>1.0</real>
+        <real>1.0</real>
+        <real>1.0</real>
+        <real>1.0</real>
+      </array>
+    </map>
+    <key>ColumnHeaderDropDownDelay</key>
+    <map>
+      <key>Comment</key>
+      <string>Time in seconds of mouse click before column header shows sort options list</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>F32</string>
+      <key>Value</key>
+      <real>0.300000011921</real>
+    </map>
+    <key>CompileOutputRect</key>
+    <map>
+      <key>Comment</key>
+      <string>Rectangle for script Recompile Everything output window</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Rect</string>
+      <key>Value</key>
+      <array>
+        <integer>0</integer>
+        <integer>400</integer>
+        <integer>300</integer>
+        <integer>0</integer>
+      </array>
+    </map>
+    <key>ConnectAsGod</key>
+    <map>
+      <key>Comment</key>
+      <string>Log in a god if you have god access.</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>ConnectionPort</key>
+    <map>
+      <key>Comment</key>
+      <string>Custom connection port number</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>U32</string>
+      <key>Value</key>
+      <integer>13000</integer>
+    </map>
+    <key>ConnectionPortEnabled</key>
+    <map>
+      <key>Comment</key>
+      <string>Use the custom connection port?</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>ConsoleBackgroundOpacity</key>
+    <map>
+      <key>Comment</key>
+      <string>Opacity of chat console (0.0 = completely transparent, 1.0 = completely opaque)</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>F32</string>
+      <key>Value</key>
+      <real>0.700</real>
+    </map>
+    <key>ConsoleBufferSize</key>
+    <map>
+      <key>Comment</key>
+      <string>Size of chat console history (lines of chat)</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>40</integer>
+    </map>
+    <key>ConsoleMaxLines</key>
+    <map>
+      <key>Comment</key>
+      <string>Max number of lines of chat text visible in console.</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>40</integer>
+    </map>
+    <key>ContactsTornOff</key>
+    <map>
+      <key>Comment</key>
+      <string>Show contacts window separately from Communicate window.</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>CookiesEnabled</key>
+    <map>
+      <key>Comment</key>
+      <string>Accept cookies from Web sites?</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
+    <key>CreateToolCopyCenters</key>
+    <map>
+      <key>Comment</key>
+      <string />
+      <key>Persist</key>
+      <integer>0</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
+    <key>CreateToolCopyRotates</key>
+    <map>
+      <key>Comment</key>
+      <string />
+      <key>Persist</key>
+      <integer>0</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>CreateToolCopySelection</key>
+    <map>
+      <key>Comment</key>
+      <string />
+      <key>Persist</key>
+      <integer>0</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>CreateToolKeepSelected</key>
+    <map>
+      <key>Comment</key>
+      <string>After using create tool, keep the create tool active</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>Cursor3D</key>
+    <map>
+      <key>Comment</key>
+      <string>Tread Joystick values as absolute positions (not deltas).</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
+    <key>CustomServer</key>
+    <map>
+      <key>Comment</key>
+      <string>Specifies IP address or hostname of grid to which you connect</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>String</string>
+      <key>Value</key>
+      <string />
+    </map>
+    <key>DebugBeaconLineWidth</key>
+    <map>
+      <key>Comment</key>
+      <string>Size of lines for Debug Beacons</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
+    <key>DebugInventoryFilters</key>
+    <map>
+      <key>Comment</key>
+      <string>Turn on debugging display for inventory filtering</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>DebugPermissions</key>
+    <map>
+      <key>Comment</key>
+      <string>Log permissions for selected inventory items</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>DebugShowColor</key>
+    <map>
+      <key>Comment</key>
+      <string>Show color under cursor</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>DebugShowRenderInfo</key>
+    <map>
+      <key>Comment</key>
+      <string>Show depth buffer contents</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+  <key>DebugShowRenderMatrices</key>
+  <map>
+    <key>Comment</key>
+    <string>Display values of current view and projection matrices.</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>Boolean</string>
+    <key>Value</key>
+    <integer>0</integer>
+  </map>
+  <key>DebugShowTime</key>
+    <map>
+      <key>Comment</key>
+      <string>Show depth buffer contents</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>DebugStatModeFPS</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeBandwidth</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModePacketLoss</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatMode</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeKTrisDrawnFr</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeKTrisDrawnSec</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeTotalObjs</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeNewObjs</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeTextureCount</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeRawCount</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeGLMem</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeFormattedMem</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeRawMem</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeBoundMem</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModePacketsIn</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModePacketsOut</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeObjects</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeTexture</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeAsset</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeLayers</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeActualIn</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeActualOut</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeVFSPendingOps</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeTimeDialation</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeSimFPS</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModePhysicsFPS</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModePinnedObjects</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeLowLODObjects</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeMemoryAllocated</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeAgentUpdatesSec</key>
+    <map>
+      <key>Comment</key>
+      <string>Mode of stat in Statistics floater</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>-1</integer>
+    </map>
+    <key>DebugStatModeMainAgents</key>
     <map>
       <key>Comment</key>
-      <string>Color picker palette entry</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Color4</string>
+      <string>S32</string>
       <key>Value</key>
-      <array>
-        <real>1.0</real>
-        <real>1.0</real>
-        <real>1.0</real>
-        <real>1.0</real>
-      </array>
+      <integer>-1</integer>
     </map>
-    <key>ColorPaletteEntry32</key>
+    <key>DebugStatModeChildAgents</key>
     <map>
       <key>Comment</key>
-      <string>Color picker palette entry</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Color4</string>
+      <string>S32</string>
       <key>Value</key>
-      <array>
-        <real>1.0</real>
-        <real>1.0</real>
-        <real>1.0</real>
-        <real>1.0</real>
-      </array>
+      <integer>-1</integer>
     </map>
-    <key>ColumnHeaderDropDownDelay</key>
+    <key>DebugStatModeSimObjects</key>
     <map>
       <key>Comment</key>
-      <string>Time in seconds of mouse click before column header shows sort options list</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>F32</string>
+      <string>S32</string>
       <key>Value</key>
-      <real>0.300000011921</real>
+      <integer>-1</integer>
     </map>
-    <key>CompileOutputRect</key>
+    <key>DebugStatModeSimActiveObjects</key>
     <map>
       <key>Comment</key>
-      <string>Rectangle for script Recompile Everything output window</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Rect</string>
+      <string>S32</string>
       <key>Value</key>
-      <array>
-        <integer>0</integer>
-        <integer>400</integer>
-        <integer>300</integer>
-        <integer>0</integer>
-      </array>
+      <integer>-1</integer>
     </map>
-    <key>ConnectAsGod</key>
+    <key>DebugStatModeSimActiveScripts</key>
     <map>
       <key>Comment</key>
-      <string>Log in a god if you have god access.</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>-1</integer>
     </map>
-    <key>ConnectionPort</key>
+    <key>DebugStatModeSimScriptEvents</key>
     <map>
       <key>Comment</key>
-      <string>Custom connection port number</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>U32</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>13000</integer>
+      <integer>-1</integer>
     </map>
-    <key>ConnectionPortEnabled</key>
+    <key>DebugStatModeSimInPPS</key>
     <map>
       <key>Comment</key>
-      <string>Use the custom connection port?</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>-1</integer>
     </map>
-    <key>ConsoleBackgroundOpacity</key>
+    <key>DebugStatModeSimOutPPS</key>
     <map>
       <key>Comment</key>
-      <string>Opacity of chat console (0.0 = completely transparent, 1.0 = completely opaque)</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>F32</string>
+      <string>S32</string>
       <key>Value</key>
-      <real>0.700</real>
+      <integer>-1</integer>
     </map>
-    <key>ConsoleBufferSize</key>
+    <key>DebugStatModeSimPendingDownloads</key>
     <map>
       <key>Comment</key>
-      <string>Size of chat console history (lines of chat)</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
       <string>S32</string>
       <key>Value</key>
-      <integer>40</integer>
+      <integer>-1</integer>
     </map>
-    <key>ConsoleMaxLines</key>
+    <key>SimPendingUploads</key>
     <map>
       <key>Comment</key>
-      <string>Max number of lines of chat text visible in console.</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
       <string>S32</string>
       <key>Value</key>
-      <integer>40</integer>
+      <integer>-1</integer>
     </map>
-    <key>ContactsTornOff</key>
+    <key>DebugStatModeSimTotalUnackedBytes</key>
     <map>
       <key>Comment</key>
-      <string>Show contacts window separately from Communicate window.</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>-1</integer>
     </map>
-    <key>CookiesEnabled</key>
+    <key>DebugStatModeSimFrameMsec</key>
     <map>
       <key>Comment</key>
-      <string>Accept cookies from Web sites?</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>-1</integer>
     </map>
-    <key>CreateToolCopyCenters</key>
+    <key>DebugStatModeSimNetMsec</key>
     <map>
       <key>Comment</key>
-      <string />
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
-      <integer>0</integer>
+      <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>-1</integer>
     </map>
-    <key>CreateToolCopyRotates</key>
+    <key>DebugStatModeSimSimPhysicsMsec</key>
     <map>
       <key>Comment</key>
-      <string />
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
-      <integer>0</integer>
+      <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>-1</integer>
     </map>
-    <key>CreateToolCopySelection</key>
+    <key>DebugStatModeSimSimOtherMsec</key>
     <map>
       <key>Comment</key>
-      <string />
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
-      <integer>0</integer>
+      <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>-1</integer>
     </map>
-    <key>CreateToolKeepSelected</key>
+    <key>DebugStatModeSimAgentMsec</key>
     <map>
       <key>Comment</key>
-      <string>After using create tool, keep the create tool active</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>-1</integer>
     </map>
-    <key>Cursor3D</key>
+    <key>DebugStatModeSimImagesMsec</key>
     <map>
       <key>Comment</key>
-      <string>Tread Joystick values as absolute positions (not deltas).</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>-1</integer>
     </map>
-    <key>CustomServer</key>
+    <key>DebugStatModeSimScriptMsec</key>
     <map>
       <key>Comment</key>
-      <string>Specifies IP address or hostname of grid to which you connect</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>String</string>
+      <string>S32</string>
       <key>Value</key>
-      <string />
+      <integer>-1</integer>
     </map>
-    <key>DebugBeaconLineWidth</key>
+    <key>DebugStatModeSimSpareMsec</key>
     <map>
       <key>Comment</key>
-      <string>Size of lines for Debug Beacons</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
       <string>S32</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>-1</integer>
     </map>
-    <key>DebugInventoryFilters</key>
+    <key>DebugStatModeSimSimPhysicsStepMsec</key>
     <map>
       <key>Comment</key>
-      <string>Turn on debugging display for inventory filtering</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>-1</integer>
     </map>
-    <key>DebugPermissions</key>
+    <key>DebugStatModeSimSimPhysicsShapeUpdateMsec</key>
     <map>
       <key>Comment</key>
-      <string>Log permissions for selected inventory items</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>-1</integer>
     </map>
-    <key>DebugShowColor</key>
+    <key>DebugStatModeSimSimPhysicsOtherMsec</key>
     <map>
       <key>Comment</key>
-      <string>Show color under cursor</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>-1</integer>
     </map>
-    <key>DebugShowRenderInfo</key>
+    <key>DebugStatModeSimSleepMsec</key>
     <map>
       <key>Comment</key>
-      <string>Show depth buffer contents</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>-1</integer>
     </map>
-  <key>DebugShowRenderMatrices</key>
-  <map>
-    <key>Comment</key>
-    <string>Display values of current view and projection matrices.</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>Boolean</string>
-    <key>Value</key>
-    <integer>0</integer>
-  </map>
-  <key>DebugShowTime</key>
+    <key>DebugStatModeSimPumpIOMsec</key>
     <map>
       <key>Comment</key>
-      <string>Show depth buffer contents</string>
+      <string>Mode of stat in Statistics floater</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>-1</integer>
     </map>
     <key>DebugViews</key>
     <map>
@@ -3444,6 +4049,22 @@
         <integer>400</integer>
       </array>
     </map>
+    <key>FloaterStatisticsRect</key>
+    <map>
+      <key>Comment</key>
+      <string>Rectangle for chat history</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Rect</string>
+      <key>Value</key>
+      <array>
+        <integer>0</integer>
+        <integer>400</integer>
+        <integer>250</integer>
+        <integer>0</integer>
+      </array>
+    </map>
     <key>FloaterViewBottom</key>
     <map>
       <key>Comment</key>
@@ -4444,6 +5065,17 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>LandBrushSize</key>
+    <map>
+      <key>Comment</key>
+        <string>Size of affected region when using teraform tool</string>
+      <key>Persist</key>
+        <integer>1</integer>
+      <key>Type</key>
+        <string>F32</string>
+      <key>Value</key>
+        <real>2.0</real>
+    </map>
     <key>LCDDestination</key>
     <map>
       <key>Comment</key>
@@ -5241,6 +5873,17 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>NearMeRange</key>
+    <map>
+      <key>Comment</key>
+      <string>Search radius for nearby avatars</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>F32</string>
+      <key>Value</key>
+      <integer>20</integer>
+    </map>
     <key>NextOwnerCopy</key>
     <map>
       <key>Comment</key>
@@ -5504,6 +6147,50 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>OpenDebugStatTexture</key>
+    <map>
+      <key>Comment</key>
+      <string>Expand Texture performance stats display</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>OpenDebugStatPhysicsDetails</key>
+    <map>
+      <key>Comment</key>
+      <string>Expand Physics Details performance stats display</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>OpenDebugStatSimTime</key>
+    <map>
+      <key>Comment</key>
+      <string>Expand Simulator Time performance stats display</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>OpenDebugStatSimTimeDetails</key>
+    <map>
+      <key>Comment</key>
+      <string>Expand Simulator Time Details performance stats display</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
     <key>OutBandwidth</key>
     <map>
       <key>Comment</key>
@@ -7460,6 +8147,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>ShowBanLines</key>
+    <map>
+      <key>Comment</key>
+      <string>Show in-world ban/access borders</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
     <key>ShowCameraControls</key>
     <map>
       <key>Comment</key>
@@ -10264,6 +10962,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>AutoDisengageMic</key>
+    <map>
+      <key>Comment</key>
+      <string>Automatically turn off the microphone when ending IM calls.</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
     <key>VoiceEarLocation</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index d4978566da9b87ecbf85432e6cb3f01ef02da149..858855fe1870b043a2df86561c8eb8bcb4bab748 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -101,6 +101,7 @@
 #include "llstartup.h"
 #include "llimview.h"
 #include "lltool.h"
+#include "lltoolcomp.h"
 #include "lltoolfocus.h"
 #include "lltoolgrab.h"
 #include "lltoolmgr.h"
@@ -436,10 +437,8 @@ void LLAgent::init()
 
 	mCameraFocusOffsetTarget = LLVector4(gSavedSettings.getVector3("CameraOffsetBuild"));
 	mCameraOffsetDefault = gSavedSettings.getVector3("CameraOffsetDefault");
-//	mCameraOffsetNorm = mCameraOffsetDefault;
-//	mCameraOffsetNorm.normalize();
 	mCameraCollidePlane.clearVec();
-	mCurrentCameraDistance = mCameraOffsetDefault.magVec();
+	mCurrentCameraDistance = mCameraOffsetDefault.magVec() * gSavedSettings.getF32("CameraOffsetScale");
 	mTargetCameraDistance = mCurrentCameraDistance;
 	mCameraZoomFraction = 1.f;
 	mTrackFocusObject = gSavedSettings.getBOOL("TrackFocusObject");
@@ -1887,7 +1886,7 @@ void LLAgent::cameraOrbitIn(const F32 meters)
 {
 	if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON)
 	{
-		F32 camera_offset_dist = llmax(0.001f, mCameraOffsetDefault.magVec());
+		F32 camera_offset_dist = llmax(0.001f, mCameraOffsetDefault.magVec() * gSavedSettings.getF32("CameraOffsetScale"));
 		
 		mCameraZoomFraction = (mTargetCameraDistance - meters) / camera_offset_dist;
 
@@ -2814,7 +2813,7 @@ U8 LLAgent::getRenderState()
 static const LLFloaterView::skip_list_t& get_skip_list()
 {
 	static LLFloaterView::skip_list_t skip_list;
-	skip_list.insert(gFloaterMap);
+	skip_list.insert(LLFloaterMap::getInstance());
 	return skip_list;
 }
 
@@ -2892,7 +2891,7 @@ void LLAgent::endAnimationUpdateUI()
 		// let the mini-map go visible again. JC
         if (!LLAppViewer::instance()->quitRequested())
 		{
-			gFloaterMap->popVisible();
+			LLFloaterMap::getInstance()->popVisible();
 		}
 
 		if( gMorphView )
@@ -2989,7 +2988,7 @@ void LLAgent::endAnimationUpdateUI()
 	{
 		LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset);
 
-		gFloaterMap->pushVisible(FALSE);
+		LLFloaterMap::getInstance()->pushVisible(FALSE);
 		/*
 		LLView *view;
 		for (view = gFloaterView->getFirstChild(); view; view = gFloaterView->getNextChild())
@@ -3257,8 +3256,11 @@ void LLAgent::updateCamera()
 	{
 		LLVector3d agent_pos = getPositionGlobal();
 		LLVector3d camera_pos_agent = camera_pos_global - agent_pos;
+		// Sitting on what you're manipulating can cause camera jitter with smoothing. 
+		// This turns off smoothing while editing. -MG
+		mCameraSmoothingStop |= (BOOL)LLToolMgr::getInstance()->inBuildMode();
 		
-		if (cameraThirdPerson() && !mCameraSmoothingStop) // only smooth in third person mode
+		if (cameraThirdPerson() && !mCameraSmoothingStop)
 		{
 			const F32 SMOOTHING_HALF_LIFE = 0.02f;
 			
@@ -3684,7 +3686,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 		}
 		else
 		{
-			local_camera_offset = mCameraZoomFraction * mCameraOffsetDefault;
+			local_camera_offset = mCameraZoomFraction * mCameraOffsetDefault * gSavedSettings.getF32("CameraOffsetScale");
 			
 			// are we sitting down?
 			if (mAvatarObject.notNull() && mAvatarObject->getParent())
@@ -3915,10 +3917,10 @@ void LLAgent::handleScrollWheel(S32 clicks)
 		}
 		else if (mFocusOnAvatar && mCameraMode == CAMERA_MODE_THIRD_PERSON)
 		{
-			F32 current_zoom_fraction = mTargetCameraDistance / mCameraOffsetDefault.magVec();
+			F32 current_zoom_fraction = mTargetCameraDistance / (mCameraOffsetDefault.magVec() * gSavedSettings.getF32("CameraOffsetScale"));
 			current_zoom_fraction *= 1.f - pow(ROOT_ROOT_TWO, clicks);
 			
-			cameraOrbitIn(current_zoom_fraction * mCameraOffsetDefault.magVec());
+			cameraOrbitIn(current_zoom_fraction * mCameraOffsetDefault.magVec() * gSavedSettings.getF32("CameraOffsetScale"));
 		}
 		else
 		{
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index fc37c42f994763cc26078eaec1939ebfb21257dc..1e6d8fdf25886c5a2baf0f3b0c9e6840c959025e 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -242,7 +242,6 @@ BOOL				gDisconnected = FALSE;
 
 // Map scale in pixels per region
 F32 				gMapScale = 128.f;
-F32 				gMiniMapScale = 128.f;
 
 // used to restore texture state after a mode switch
 LLFrameTimer	gRestoreGLTimer;
@@ -399,7 +398,6 @@ static void settings_to_globals()
 	gAllowTapTapHoldRun = gSavedSettings.getBOOL("AllowTapTapHoldRun");
 	gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates");
 	gMapScale = gSavedSettings.getF32("MapScale");
-	gMiniMapScale = gSavedSettings.getF32("MiniMapScale");
 	LLHoverView::sShowHoverTips = gSavedSettings.getBOOL("ShowHoverTips");
 
 	LLCubeMap::sUseCubeMaps = LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap");
@@ -1747,9 +1745,6 @@ bool LLAppViewer::initConfiguration()
 	// - load overrides from user_settings 
 	loadSettingsFromDirectory("User");
 
-	gSavedSettings.setString("FontSansSerifFallback",
-				 gSavedSettings.getString("FontSansSerifBundledFallback") + ";" + LLWindow::getFontListSans() );
-
 	// - apply command line settings 
 	clp.notify(); 
 
@@ -2172,7 +2167,6 @@ void LLAppViewer::cleanupSavedSettings()
 		if (gDebugView)
 		{
 			gSavedSettings.setBOOL("ShowDebugConsole", gDebugView->mDebugConsolep->getVisible());
-			gSavedSettings.setBOOL("ShowDebugStats", gDebugView->mFloaterStatsp->getVisible());
 		}
 	}
 
@@ -2192,7 +2186,6 @@ void LLAppViewer::cleanupSavedSettings()
 	}
 
 	gSavedSettings.setF32("MapScale", gMapScale );
-	gSavedSettings.setF32("MiniMapScale", gMiniMapScale );
 	gSavedSettings.setBOOL("ShowHoverTips", LLHoverView::sShowHoverTips);
 
 	// Some things are cached in LLAgent.
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index cb10ad36617b4c7531b4d8a3d9188c7712e66d6b..6d7c3c857717ec72c7db0b0a5391cf043d1e3b96 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -304,7 +304,6 @@ extern BOOL		gDisconnected;
 
 // Map scale in pixels per region
 extern F32 gMapScale;
-extern F32 gMiniMapScale;
 
 extern LLFrameTimer	gRestoreGLTimer;
 extern BOOL			gRestoreGL;
diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp
index 481a6ceb26e4032e17c70760117b2190fa1ea6cd..5b04e241a181672f9554fb8de260efb5ecb49edb 100644
--- a/indra/newview/llassetuploadresponders.cpp
+++ b/indra/newview/llassetuploadresponders.cpp
@@ -34,12 +34,11 @@
 
 #include "llassetuploadresponders.h"
 
+// viewer includes
 #include "llagent.h"
 #include "llcompilequeue.h"
 #include "llfloaterbuycurrency.h"
-#include "lleconomy.h"
 #include "llfilepicker.h"
-#include "llfocusmgr.h"
 #include "llnotify.h"
 #include "llinventorymodel.h"
 #include "llinventoryview.h"
@@ -48,7 +47,7 @@
 #include "llpreviewscript.h"
 #include "llpreviewgesture.h"
 #include "llgesturemgr.h"
-#include "llscrolllistctrl.h"
+#include "llstatusbar.h"		// sendMoneyBalanceRequest()
 #include "llsdserialize.h"
 #include "lluploaddialog.h"
 #include "llviewerobject.h"
@@ -58,6 +57,12 @@
 #include "llviewerwindow.h"
 #include "lltexlayer.h"
 
+// library includes
+#include "lleconomy.h"
+#include "llfocusmgr.h"
+#include "llscrolllistctrl.h"
+#include "llsdserialize.h"
+
 // When uploading multiple files, don't display any of them when uploading more than this number.
 static const S32 FILE_COUNT_DISPLAY_THRESHOLD = 5;
 
@@ -216,13 +221,7 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
 		asset_type == LLAssetType::AT_SOUND ||
 		asset_type == LLAssetType::AT_ANIMATION)
 	{
-		gMessageSystem->newMessageFast(_PREHASH_MoneyBalanceRequest);
-		gMessageSystem->nextBlockFast(_PREHASH_AgentData);
-		gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
-		gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
-		gMessageSystem->nextBlockFast(_PREHASH_MoneyData);
-		gMessageSystem->addUUIDFast(_PREHASH_TransactionID, LLUUID::null );
-		gAgent.sendReliableMessage();
+		LLStatusBar::sendMoneyBalanceRequest();
 
 		LLSD args;
 		args["AMOUNT"] = llformat("%d", expected_upload_cost);
diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp
index 528fb9cff5d76ed1c20bbb04cab0095ff480708c..5f8d9ed27b90cba1a7ec0d6c7feaa8e60037d4f5 100644
--- a/indra/newview/llcolorswatch.cpp
+++ b/indra/newview/llcolorswatch.cpp
@@ -67,7 +67,7 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect
 	mCaption = new LLTextBox( name,
 		LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ),
 		name,
-		LLFontGL::sSansSerifSmall );
+		LLFontGL::getFontSansSerifSmall() );
 	mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM );
 	addChild( mCaption );
 
@@ -94,7 +94,7 @@ LLColorSwatchCtrl::LLColorSwatchCtrl(const std::string& name, const LLRect& rect
 	mCaption = new LLTextBox( label,
 		LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ),
 		label,
-		LLFontGL::sSansSerifSmall );
+		LLFontGL::getFontSansSerifSmall() );
 	mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM );
 	addChild( mCaption );
 
diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp
index 3ec6db3dadd16d516572ecaf04b848c83ed6d95f..40f5202067893d6146d35903ae04aba783bcd7e4 100644
--- a/indra/newview/lldebugview.cpp
+++ b/indra/newview/lldebugview.cpp
@@ -98,20 +98,6 @@ LLDebugView::LLDebugView(const std::string& name, const LLRect &rect)
 	addChild(gTextureView);
 	//gTextureView->reshape(r.getWidth(), r.getHeight(), TRUE);
 
-	//
-	// Debug statistics
-	//
-	r.set(rect.getWidth() - 250,
-		  rect.getHeight() - 50,
-		  rect.getWidth(),
-		  rect.getHeight() - 450);
-	mFloaterStatsp = new LLFloaterStats(r);
-
-	mFloaterStatsp->setFollowsTop();
-	mFloaterStatsp->setFollowsRight();
-	// since this is a floater, it belongs to LLFloaterView
-	//addChild(mFloaterStatsp);
-
 	const S32 VELOCITY_LEFT = 10; // 370;
 	const S32 VELOCITY_WIDTH = 500;
 	const S32 VELOCITY_TOP = 140;
diff --git a/indra/newview/lldebugview.h b/indra/newview/lldebugview.h
index 9db4723c8d944b5cc1d0595be25fc8cac41f8b00..189efd3a3fde0e04e2f3cb4c95e51978c6e64f50 100644
--- a/indra/newview/lldebugview.h
+++ b/indra/newview/lldebugview.h
@@ -59,7 +59,6 @@ public:
 	LLFastTimerView* mFastTimerView;
 	LLMemoryView*	 mMemoryView;
 	LLConsole*		 mDebugConsolep;
-	LLFloaterStats*  mFloaterStatsp;
 };
 
 extern LLDebugView* gDebugView;
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index 340254a909db7377d8e0c42799b4e3568c70a58c..c9037d0fbbe32ac8d0e4b46f4db06b8e0d0e4915 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -292,7 +292,7 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask)
 
 S32 LLFastTimerView::getLegendIndex(S32 y)
 {
-	S32 idx = (getRect().getHeight() - y) / ((S32) LLFontGL::sMonospace->getLineHeight()+2) - 5;
+	S32 idx = (getRect().getHeight() - y) / ((S32) LLFontGL::getFontMonospace()->getLineHeight()+2) - 5;
 	if (idx >= 0 && idx < FTV_DISPLAY_NUM)
 	{
 		return ft_display_idx[idx];
@@ -483,7 +483,7 @@ void LLFastTimerView::draw()
 		
 		x = xleft;
 		y = height - ytop;
-		texth = (S32)LLFontGL::sMonospace->getLineHeight();
+		texth = (S32)LLFontGL::getFontMonospace()->getLineHeight();
 
 		char modedesc[][32] = {
 			"2 x Average ",
@@ -498,16 +498,16 @@ void LLFastTimerView::draw()
 		};
 
 		tdesc = llformat("Full bar = %s [Click to pause/reset] [SHIFT-Click to toggle]",modedesc[mDisplayMode]);
-		LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
+		LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
 
-		textw = LLFontGL::sMonospace->getWidth(tdesc);
+		textw = LLFontGL::getFontMonospace()->getWidth(tdesc);
 
 		x = xleft, y -= (texth + 2);
 		tdesc = llformat("Justification = %s [CTRL-Click to toggle]",centerdesc[mDisplayCenter]);
-		LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
+		LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
 		y -= (texth + 2);
 
-		LLFontGL::sMonospace->renderUTF8(std::string("[Right-Click log selected] [ALT-Click toggle counts] [ALT-SHIFT-Click sub hidden]"),
+		LLFontGL::getFontMonospace()->renderUTF8(std::string("[Right-Click log selected] [ALT-Click toggle counts] [ALT-SHIFT-Click sub hidden]"),
 										 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
 		y -= (texth + 2);
 	}
@@ -632,15 +632,15 @@ void LLFastTimerView::draw()
 
 		if (is_child_of_hover_item)
 		{
-			LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::BOLD);
+			LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::BOLD);
 		}
 		else
 		{
-			LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, color, LLFontGL::LEFT, LLFontGL::TOP);
+			LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, color, LLFontGL::LEFT, LLFontGL::TOP);
 		}
 		y -= (texth + 2);
 
-		textw = dx + LLFontGL::sMonospace->getWidth(std::string(ft_display_table[i].desc)) + 40;
+		textw = dx + LLFontGL::getFontMonospace()->getWidth(std::string(ft_display_table[i].desc)) + 40;
 		if (textw > legendwidth)
 			legendwidth = textw;
 	}
@@ -654,7 +654,7 @@ void LLFastTimerView::draw()
 	// update rectangle that includes timer bars
 	mBarRect.mLeft = xleft;
 	mBarRect.mRight = getRect().mRight - xleft;
-	mBarRect.mTop = ytop - ((S32)LLFontGL::sMonospace->getLineHeight() + 4);
+	mBarRect.mTop = ytop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4);
 	mBarRect.mBottom = margin + LINE_GRAPH_HEIGHT;
 
 	y = ytop;
@@ -740,23 +740,23 @@ void LLFastTimerView::draw()
 			U32 ms = (U32)((F64)totalticks * iclock_freq) ;
 
 			tdesc = llformat("%.1f ms |", (F32)ms*.25f);
-			x = xleft + barw/4 - LLFontGL::sMonospace->getWidth(tdesc);
-			LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white,
+			x = xleft + barw/4 - LLFontGL::getFontMonospace()->getWidth(tdesc);
+			LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white,
 										 LLFontGL::LEFT, LLFontGL::TOP);
 			
 			tdesc = llformat("%.1f ms |", (F32)ms*.50f);
-			x = xleft + barw/2 - LLFontGL::sMonospace->getWidth(tdesc);
-			LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white,
+			x = xleft + barw/2 - LLFontGL::getFontMonospace()->getWidth(tdesc);
+			LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white,
 										 LLFontGL::LEFT, LLFontGL::TOP);
 			
 			tdesc = llformat("%.1f ms |", (F32)ms*.75f);
-			x = xleft + (barw*3)/4 - LLFontGL::sMonospace->getWidth(tdesc);
-			LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white,
+			x = xleft + (barw*3)/4 - LLFontGL::getFontMonospace()->getWidth(tdesc);
+			LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white,
 										 LLFontGL::LEFT, LLFontGL::TOP);
 			
 			tdesc = llformat( "%d ms |", ms);
-			x = xleft + barw - LLFontGL::sMonospace->getWidth(tdesc);
-			LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white,
+			x = xleft + barw - LLFontGL::getFontMonospace()->getWidth(tdesc);
+			LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white,
 										 LLFontGL::LEFT, LLFontGL::TOP);
 		}
 
@@ -768,7 +768,7 @@ void LLFastTimerView::draw()
 
 			S32 by = y + 2;
 			
-			y -= ((S32)LLFontGL::sMonospace->getLineHeight() + 4);
+			y -= ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4);
 
 			//heading
 			gl_rect_2d(xleft-5, by, getRect().getWidth()-5, y+5, FALSE);
@@ -962,10 +962,10 @@ void LLFastTimerView::draw()
 			else
 				tdesc = llformat("%4.2f ms", ms);
 							
-			x = graph_rect.mRight - LLFontGL::sMonospace->getWidth(tdesc)-5;
-			y = graph_rect.mTop - ((S32)LLFontGL::sMonospace->getLineHeight());
+			x = graph_rect.mRight - LLFontGL::getFontMonospace()->getWidth(tdesc)-5;
+			y = graph_rect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight());
  
-			LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white,
+			LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white,
 										 LLFontGL::LEFT, LLFontGL::TOP);
 
 			//highlight visible range
@@ -1073,7 +1073,7 @@ void LLFastTimerView::draw()
 				x = (graph_rect.mRight + graph_rect.mLeft)/2;
 				y = graph_rect.mBottom + 8;
 
-				LLFontGL::sMonospace->renderUTF8(std::string(ft_display_table[mHoverIndex].desc), 0, x, y, LLColor4::white,
+				LLFontGL::getFontMonospace()->renderUTF8(std::string(ft_display_table[mHoverIndex].desc), 0, x, y, LLColor4::white,
 					LLFontGL::LEFT, LLFontGL::BOTTOM);
 			}					
 		}
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp
index e9c0a7c26caa82fc3badb229308a47b6db8214dc..e382fefece6a723f46af1b286ebcd88f7667836e 100644
--- a/indra/newview/llfloateravatarpicker.cpp
+++ b/indra/newview/llfloateravatarpicker.cpp
@@ -35,6 +35,7 @@
 
 #include "message.h"
 
+#include "llagent.h"
 #include "llbutton.h"
 #include "llfocusmgr.h"
 #include "llinventoryview.h"
@@ -43,7 +44,8 @@
 #include "llscrolllistctrl.h"
 #include "lltextbox.h"
 #include "lluictrlfactory.h"
-#include "llagent.h"
+#include "llviewercontrol.h"
+#include "llworld.h"
 
 const S32 MIN_WIDTH = 200;
 const S32 MIN_HEIGHT = 340;
@@ -59,6 +61,8 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(callback_t callback,
 												   BOOL allow_multiple,
 												   BOOL closeOnSelect)
 {
+	// TODO: This class should not be a singleton as it's used in multiple places
+	// and therefore can't be used simultaneously. -MG
 	if (!sInstance)
 	{
 		sInstance = new LLFloaterAvatarPicker();
@@ -78,6 +82,7 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(callback_t callback,
 		sInstance->setAllowMultiple(allow_multiple);
 	}
 	
+	sInstance->mNearMeListComplete = FALSE;
 	sInstance->mCloseOnSelect = closeOnSelect;
 	return sInstance;
 }
@@ -98,39 +103,58 @@ BOOL LLFloaterAvatarPicker::postBuild()
 
 	childSetAction("Find", onBtnFind, this);
 	childDisable("Find");
+	childSetAction("Refresh", onBtnRefresh, this);
+	childSetCommitCallback("near_me_range", onRangeAdjust, this);
 
-	mListNames = getChild<LLScrollListCtrl>("Names");
-	childSetDoubleClickCallback("Names",onBtnAdd);
-	childSetCommitCallback("Names", onList, this);
-	childDisable("Names");
+	childSetDoubleClickCallback("SearchResults", onBtnSelect);
+	childSetDoubleClickCallback("NearMe", onBtnSelect);
+	childSetCommitCallback("SearchResults", onList, this);
+	childSetCommitCallback("NearMe", onList, this);
+	childDisable("SearchResults");
 
-	childSetAction("Select", onBtnAdd, this);
+	childSetAction("Select", onBtnSelect, this);
 	childDisable("Select");
 
-	childSetAction("Close", onBtnClose, this);
+	childSetAction("Cancel", onBtnClose, this);
 
 	childSetFocus("Edit");
 
-	if (mListNames)
+	LLPanel* search_panel = getChild<LLPanel>("SearchPanel");
+	if (search_panel)
 	{
-		mListNames->addCommentText(std::string("No results")); // *TODO: Translate
+		// Start searching when Return is pressed in the line editor.
+		search_panel->setDefaultBtn("Find");
 	}
 
-	mInventoryPanel = getChild<LLInventoryPanel>("Inventory Panel");
-	if(mInventoryPanel)
-	{
-		mInventoryPanel->setFilterTypes(0x1 << LLInventoryType::IT_CALLINGCARD);
-		mInventoryPanel->setFollowsAll();
-		mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
-		mInventoryPanel->openDefaultFolderForType(LLAssetType::AT_CALLINGCARD);
-		mInventoryPanel->setSelectCallback(LLFloaterAvatarPicker::onSelectionChange, this);
-	}
+	getChild<LLScrollListCtrl>("SearchResults")->addCommentText(getString("no_results"));
+
+	LLInventoryPanel* inventory_panel = getChild<LLInventoryPanel>("InventoryPanel");
+	inventory_panel->setFilterTypes(0x1 << LLInventoryType::IT_CALLINGCARD);
+	inventory_panel->setFollowsAll();
+	inventory_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+	inventory_panel->openDefaultFolderForType(LLAssetType::AT_CALLINGCARD);
+	inventory_panel->setSelectCallback(LLFloaterAvatarPicker::onCallingCardSelectionChange, this);
+
+	childSetTabChangeCallback("ResidentChooserTabs", "SearchPanel",			onTabChanged, this);
+	childSetTabChangeCallback("ResidentChooserTabs", "CallingCardsPanel",	onTabChanged, this);
+	childSetTabChangeCallback("ResidentChooserTabs", "NearMePanel",			onTabChanged, this);
 	
 	setAllowMultiple(FALSE);
 
 	return TRUE;
 }
 
+void LLFloaterAvatarPicker::onTabChanged(void* userdata, bool from_click)
+{
+	LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata;
+	if (!self)
+	{
+		return;
+	}
+	
+	self->childSetEnabled("Select", self->visibleItemsSelected());
+}
+
 // Destroys the object
 LLFloaterAvatarPicker::~LLFloaterAvatarPicker()
 {
@@ -145,22 +169,50 @@ void LLFloaterAvatarPicker::onBtnFind(void* userdata)
 	if(self) self->find();
 }
 
-void LLFloaterAvatarPicker::onBtnAdd(void* userdata)
+static void getSelectedAvatarData(const LLScrollListCtrl* from, std::vector<std::string>& avatar_names, std::vector<LLUUID>& avatar_ids)
+{
+	std::vector<LLScrollListItem*> items = from->getAllSelected();
+	for (std::vector<LLScrollListItem*>::iterator iter = items.begin(); iter != items.end(); ++iter)
+	{
+		LLScrollListItem* item = *iter;
+		if (item->getUUID().notNull())
+		{
+			avatar_names.push_back(item->getColumn(0)->getValue().asString());
+			avatar_ids.push_back(item->getUUID());
+		}
+	}
+}
+
+void LLFloaterAvatarPicker::onBtnSelect(void* userdata)
 {
 	LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata;
 
 	if(self->mCallback)
 	{
-		self->mCallback(self->mAvatarNames, self->mAvatarIDs, self->mCallbackUserdata);
-	}
-	if (self->mInventoryPanel)
-	{
-		self->mInventoryPanel->setSelection(LLUUID::null, FALSE);
-	}
-	if (self->mListNames)
-	{
-		self->mListNames->deselectAllItems(TRUE);
+		LLPanel* active_panel = self->childGetVisibleTab("ResidentChooserTabs");
+
+		if(active_panel == self->getChild<LLPanel>("CallingCardsPanel"))
+		{
+			self->mCallback(self->mSelectedInventoryAvatarNames, self->mSelectedInventoryAvatarIDs, self->mCallbackUserdata);
+		}
+		else if(active_panel == self->getChild<LLPanel>("SearchPanel"))
+		{
+			std::vector<std::string>	avatar_names;
+			std::vector<LLUUID>			avatar_ids;
+			getSelectedAvatarData(self->getChild<LLScrollListCtrl>("SearchResults"), avatar_names, avatar_ids);
+			self->mCallback(avatar_names, avatar_ids, self->mCallbackUserdata);
+		}
+		else if(active_panel == self->getChild<LLPanel>("NearMePanel"))
+		{
+			std::vector<std::string>	avatar_names;
+			std::vector<LLUUID>			avatar_ids;
+			getSelectedAvatarData(self->getChild<LLScrollListCtrl>("NearMe"), avatar_names, avatar_ids);
+			self->mCallback(avatar_names, avatar_ids, self->mCallbackUserdata);
+		}
 	}
+	self->getChild<LLInventoryPanel>("InventoryPanel")->setSelection(LLUUID::null, FALSE);
+	self->getChild<LLScrollListCtrl>("SearchResults")->deselectAllItems(TRUE);
+	self->getChild<LLScrollListCtrl>("NearMe")->deselectAllItems(TRUE);
 	if(self->mCloseOnSelect)
 	{
 		self->mCloseOnSelect = FALSE;
@@ -168,68 +220,61 @@ void LLFloaterAvatarPicker::onBtnAdd(void* userdata)
 	}
 }
 
+void LLFloaterAvatarPicker::onBtnRefresh(void* userdata)
+{
+	LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata;
+	if (!self)
+	{
+		return;
+	}
+	
+	self->getChild<LLScrollListCtrl>("NearMe")->deleteAllItems();
+	self->getChild<LLScrollListCtrl>("NearMe")->addCommentText(self->getString("searching"));
+	self->mNearMeListComplete = FALSE;
+}
+
 void LLFloaterAvatarPicker::onBtnClose(void* userdata)
 {
 	LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata;
 	if(self) self->close();
 }
 
+void LLFloaterAvatarPicker::onRangeAdjust(LLUICtrl* source, void* data)
+{
+	LLFloaterAvatarPicker::onBtnRefresh(data);
+}
+
 void LLFloaterAvatarPicker::onList(LLUICtrl* ctrl, void* userdata)
 {
 	LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata;
-	if (!self)
-	{
-		return;
-	}
-
-	self->mAvatarIDs.clear();
-	self->mAvatarNames.clear();
-
-	if (!self->mListNames)
-	{
-		return;
-	}
-	
-	std::vector<LLScrollListItem*> items =
-		self->mListNames->getAllSelected();
-	for (
-		std::vector<LLScrollListItem*>::iterator iter = items.begin();
-		iter != items.end();
-		++iter)
+	if (self)
 	{
-		LLScrollListItem* item = *iter;
-		self->mAvatarNames.push_back(item->getColumn(0)->getValue().asString());
-		self->mAvatarIDs.push_back(item->getUUID());
-		self->childSetEnabled("Select", TRUE);
+		self->childSetEnabled("Select", self->visibleItemsSelected());
 	}
 }
 
 // static callback for inventory picker (select from calling cards)
-void LLFloaterAvatarPicker::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data)
+void LLFloaterAvatarPicker::onCallingCardSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data)
 {
 	LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)data;
 	if (self)
 	{
-		self->doSelectionChange( items, user_action, data );
+		self->doCallingCardSelectionChange( items, user_action, data );
 	}
 }
 
 // Callback for inventory picker (select from calling cards)
-void LLFloaterAvatarPicker::doSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data)
+void LLFloaterAvatarPicker::doCallingCardSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data)
 {
-	if (!mListNames)
+	bool panel_active = (childGetVisibleTab("ResidentChooserTabs") == getChild<LLPanel>("CallingCardsPanel"));
+	
+	mSelectedInventoryAvatarIDs.clear();
+	mSelectedInventoryAvatarNames.clear();
+	
+	if (panel_active)
 	{
-		return;
-	}
-
-	std::vector<LLScrollListItem*> search_items = mListNames->getAllSelected();
-	if ( search_items.size() == 0 )
-	{	// Nothing selected in the search results
-		mAvatarIDs.clear();
-		mAvatarNames.clear();
 		childSetEnabled("Select", FALSE);
 	}
-	BOOL first_calling_card = TRUE;
 
 	std::deque<LLFolderViewItem*>::const_iterator item_it;
 	for (item_it = items.begin(); item_it != items.end(); ++item_it)
@@ -238,26 +283,97 @@ void LLFloaterAvatarPicker::doSelectionChange(const std::deque<LLFolderViewItem*
 		if (listenerp->getInventoryType() == LLInventoryType::IT_CALLINGCARD)
 		{
 			LLInventoryItem* item = gInventory.getItem(listenerp->getUUID());
-
 			if (item)
 			{
-				if ( first_calling_card )
-				{	// Have a calling card selected, so clear anything from the search panel
-					first_calling_card = FALSE;
-					mAvatarIDs.clear();
-					mAvatarNames.clear();
-					mListNames->deselectAllItems();
-				}
-
-				// Add calling card info to the selected avatars
-				mAvatarIDs.push_back(item->getCreatorUUID());
-				mAvatarNames.push_back(listenerp->getName());
-				childSetEnabled("Select", TRUE);
+				mSelectedInventoryAvatarIDs.push_back(item->getCreatorUUID());
+				mSelectedInventoryAvatarNames.push_back(listenerp->getName());
 			}
 		}
 	}
+
+	if (panel_active)
+	{
+		childSetEnabled("Select", visibleItemsSelected());
+	}
+}
+
+void LLFloaterAvatarPicker::populateNearMe()
+{
+	BOOL all_loaded = TRUE;
+	BOOL empty = TRUE;
+	LLScrollListCtrl* near_me_scroller = getChild<LLScrollListCtrl>("NearMe");
+	near_me_scroller->deleteAllItems();
+
+	std::vector<LLUUID> avatar_ids;
+	LLWorld::getInstance()->getAvatars(&avatar_ids, NULL, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange"));
+	for(U32 i=0; i<avatar_ids.size(); i++)
+	{
+		LLUUID& av = avatar_ids[i];
+		if(av == gAgent.getID()) continue;
+		LLSD element;
+		element["id"] = av; // value
+		std::string fullname;
+		if(!gCacheName->getFullName(av, fullname))
+		{
+			element["columns"][0]["value"] = LLCacheName::getDefaultName();
+			all_loaded = FALSE;
+		}			
+		else
+		{
+			element["columns"][0]["value"] = fullname;
+		}
+		near_me_scroller->addElement(element);
+		empty = FALSE;
+	}
+
+	if (empty)
+	{
+		childDisable("NearMe");
+		childDisable("Select");
+		near_me_scroller->addCommentText(getString("no_one_near"));
+	}
+	else 
+	{
+		childEnable("NearMe");
+		childEnable("Select");
+		near_me_scroller->selectFirstItem();
+		onList(near_me_scroller, this);
+		near_me_scroller->setFocus(TRUE);
+	}
+
+	if (all_loaded)
+	{
+		mNearMeListComplete = TRUE;
+	}
+}
+
+void LLFloaterAvatarPicker::draw()
+{
+	LLFloater::draw();
+	if (!mNearMeListComplete && childGetVisibleTab("ResidentChooserTabs") == getChild<LLPanel>("NearMePanel"))
+	{
+		populateNearMe();
+	}
 }
 
+BOOL LLFloaterAvatarPicker::visibleItemsSelected() const
+{
+	LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs");
+
+	if(active_panel == getChild<LLPanel>("SearchPanel"))
+	{
+		return getChild<LLScrollListCtrl>("SearchResults")->getFirstSelectedIndex() >= 0;
+	}
+	else if(active_panel == getChild<LLPanel>("CallingCardsPanel"))
+	{
+		return mSelectedInventoryAvatarIDs.size() > 0;
+	}
+	else if(active_panel == getChild<LLPanel>("NearMePanel"))
+	{
+		return getChild<LLScrollListCtrl>("NearMe")->getFirstSelectedIndex() >= 0;
+	}
+	return FALSE;
+}
 
 void LLFloaterAvatarPicker::find()
 {
@@ -277,11 +393,8 @@ void LLFloaterAvatarPicker::find()
 
 	gAgent.sendReliableMessage();
 
-	if (mListNames)
-	{
-		mListNames->deleteAllItems();	
-		mListNames->addCommentText(std::string("Searching..."));  // *TODO: Translate
-	}
+	getChild<LLScrollListCtrl>("SearchResults")->deleteAllItems();
+	getChild<LLScrollListCtrl>("SearchResults")->addCommentText(getString("searching"));
 	
 	childSetEnabled("Select", FALSE);
 	mResultsReturned = FALSE;
@@ -289,15 +402,9 @@ void LLFloaterAvatarPicker::find()
 
 void LLFloaterAvatarPicker::setAllowMultiple(BOOL allow_multiple)
 {
-	mAllowMultiple = allow_multiple;
-	if (mInventoryPanel)
-	{
-		mInventoryPanel->setAllowMultiSelect(mAllowMultiple);
-	}
-	if (mListNames)
-	{
-		mListNames->setAllowMultipleSelection(mAllowMultiple);
-	}
+	getChild<LLScrollListCtrl>("SearchResults")->setAllowMultipleSelection(allow_multiple);
+	getChild<LLInventoryPanel>("InventoryPanel")->setAllowMultiSelect(allow_multiple);
+	getChild<LLScrollListCtrl>("NearMe")->setAllowMultipleSelection(allow_multiple);
 }
 
 // static 
@@ -325,52 +432,48 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void*
 		return;
 	}
 
-	if (!self->mResultsReturned)
-	{
-		// clear "Searching" label on first results
-		if (self->mListNames)
-		{
-			self->mListNames->deleteAllItems();
-		}
-	}
+	LLScrollListCtrl* search_results = self->getChild<LLScrollListCtrl>("SearchResults");
+
+	// clear "Searching" label on first results
+	search_results->deleteAllItems();
+
 	self->mResultsReturned = TRUE;
 
-	if (self->mListNames)
-	{
-		BOOL found_one = FALSE;
-		S32 num_new_rows = msg->getNumberOfBlocks("Data");
-		for (S32 i = 0; i < num_new_rows; i++)
-		{			
-			msg->getUUIDFast(  _PREHASH_Data,_PREHASH_AvatarID,	avatar_id, i);
-			msg->getStringFast(_PREHASH_Data,_PREHASH_FirstName, first_name, i);
-			msg->getStringFast(_PREHASH_Data,_PREHASH_LastName,	last_name, i);
-		
-			std::string avatar_name;
-			if (avatar_id.isNull())
-			{
-				LLStringUtil::format_map_t map;
-				map["[TEXT]"] = self->childGetText("Edit");
-				avatar_name = self->getString("NotFound", map);
-				self->mListNames->setEnabled(FALSE);
-			}
-			else
-			{
-				avatar_name = first_name + " " + last_name;
-				self->mListNames->setEnabled(TRUE);
-				found_one = TRUE;
-			}
-			LLSD element;
-			element["id"] = avatar_id; // value
-			element["columns"][0]["value"] = avatar_name;
-			self->mListNames->addElement(element);
-		}
+	BOOL found_one = FALSE;
+	S32 num_new_rows = msg->getNumberOfBlocks("Data");
+	for (S32 i = 0; i < num_new_rows; i++)
+	{			
+		msg->getUUIDFast(  _PREHASH_Data,_PREHASH_AvatarID,	avatar_id, i);
+		msg->getStringFast(_PREHASH_Data,_PREHASH_FirstName, first_name, i);
+		msg->getStringFast(_PREHASH_Data,_PREHASH_LastName,	last_name, i);
 	
-		if (found_one)
+		std::string avatar_name;
+		if (avatar_id.isNull())
 		{
-			self->mListNames->selectFirstItem();
-			self->onList(self->mListNames, self);
-			self->mListNames->setFocus(TRUE);
+			LLStringUtil::format_map_t map;
+			map["[TEXT]"] = self->childGetText("Edit");
+			avatar_name = self->getString("not_found", map);
+			search_results->setEnabled(FALSE);
+			self->childDisable("Select");
 		}
+		else
+		{
+			avatar_name = first_name + " " + last_name;
+			search_results->setEnabled(TRUE);
+			found_one = TRUE;
+		}
+		LLSD element;
+		element["id"] = avatar_id; // value
+		element["columns"][0]["value"] = avatar_name;
+		search_results->addElement(element);
+	}
+
+	if (found_one)
+	{
+		self->childEnable("Select");
+		search_results->selectFirstItem();
+		self->onList(search_results, self);
+		search_results->setFocus(TRUE);
 	}
 }
 
@@ -378,32 +481,23 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void*
 void LLFloaterAvatarPicker::editKeystroke(LLLineEditor* caller, void* user_data)
 {
 	LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)user_data;
-	if (caller->getText().size() >= 3)
-	{
-		self->childSetEnabled("Find",TRUE);
-	}
-	else
-	{
-		self->childSetEnabled("Find",FALSE);
-	}
+	self->childSetEnabled("Find", caller->getText().size() >= 3);
 }
 
 // virtual
 BOOL LLFloaterAvatarPicker::handleKeyHere(KEY key, MASK mask)
 {
-	if (key == KEY_RETURN
-		&& mask == MASK_NONE)
+	if (key == KEY_RETURN && mask == MASK_NONE)
 	{
 		if (childHasFocus("Edit"))
 		{
 			onBtnFind(this);
-			return TRUE;
 		}
 		else
 		{
-			onBtnAdd(this);
-			return TRUE;
+			onBtnSelect(this);
 		}
+		return TRUE;
 	}
 	else if (key == KEY_ESCAPE && mask == MASK_NONE)
 	{
diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h
index 7d7ce2bd297b261181a74f2cfaa1a4e9fd2d395c..56bc387bcefd69533547e47466a82e4df4688e37 100644
--- a/indra/newview/llfloateravatarpicker.h
+++ b/indra/newview/llfloateravatarpicker.h
@@ -37,14 +37,6 @@
 
 #include <vector>
 
-class LLUICtrl;
-class LLTextBox;
-class LLLineEditor;
-class LLButton;
-class LLScrollListCtrl;
-class LLMessageSystem;
-class LLInventoryPanel;
-class LLFolderViewItem;
 
 class LLFloaterAvatarPicker : public LLFloater
 {
@@ -58,47 +50,47 @@ public:
 									   BOOL closeOnSelect = FALSE);
 	virtual	BOOL postBuild();
 
-	static void processAvatarPickerReply(LLMessageSystem* msg, void**);
-	static void editKeystroke(LLLineEditor* caller, void* user_data);
+	static void processAvatarPickerReply(class LLMessageSystem* msg, void**);
 
-protected:
-	static void* createInventoryPanel(void* userdata);
+private:
+
+	static void editKeystroke(class LLLineEditor* caller, void* user_data);
 
 	static void onBtnFind(void* userdata);
-	static void onBtnAdd(void* userdata);
+	static void onBtnSelect(void* userdata);
+	static void onBtnRefresh(void* userdata);
+	static void onRangeAdjust(LLUICtrl* source, void* data);
 	static void onBtnClose(void* userdata);
-	static void onList(LLUICtrl* ctrl, void* userdata);
+	static void onList(class LLUICtrl* ctrl, void* userdata);
+	static void onTabChanged(void* userdata, bool from_click);
 	
-		   void doSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data);
-	static void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data);
+		   void doCallingCardSelectionChange(const std::deque<class LLFolderViewItem*> &items, BOOL user_action, void* data);
+	static void onCallingCardSelectionChange(const std::deque<class LLFolderViewItem*> &items, BOOL user_action, void* data);
+
+	void populateNearMe();
+	BOOL visibleItemsSelected() const; // Returns true if any items in the current tab are selected.
 
 	void find();
 	void setAllowMultiple(BOOL allow_multiple);
 
+	virtual void draw();
 	virtual BOOL handleKeyHere(KEY key, MASK mask);
 
-protected:
-	LLScrollListCtrl*	mListNames;
-	LLInventoryPanel*	mInventoryPanel;
-	
-	std::vector<LLUUID>				mAvatarIDs;
-	std::vector<std::string>		mAvatarNames;
-	BOOL				mAllowMultiple;
+	std::vector<LLUUID>				mSelectedInventoryAvatarIDs;
+	std::vector<std::string>		mSelectedInventoryAvatarNames;
 	LLUUID				mQueryID;
 	BOOL				mResultsReturned;
+	BOOL				mNearMeListComplete;
 	BOOL				mCloseOnSelect;
 
 	void (*mCallback)(const std::vector<std::string>& name, const std::vector<LLUUID>& id, void* userdata);
 	void* mCallbackUserdata;
 
-protected:
 	static LLFloaterAvatarPicker* sInstance;
 
-protected:
 	// do not call these directly
 	LLFloaterAvatarPicker();
 	virtual ~LLFloaterAvatarPicker();
 };
 
-
 #endif
diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp
index 98468297d81cc6cfd3ba8c23667b1f09c6010a17..4697296e1665beaa6db6a801b9219fb1a4ab0329 100644
--- a/indra/newview/llfloaterbulkpermission.cpp
+++ b/indra/newview/llfloaterbulkpermission.cpp
@@ -145,26 +145,27 @@ void LLFloaterBulkPermission::inventoryChanged(LLViewerObject* viewer_object,
 
 void LLFloaterBulkPermission::onApplyBtn(void* user_data)
 {
-	LLFloaterBulkPermission* self = (LLFloaterBulkPermission*)user_data;
+	LLFloaterBulkPermission* self = static_cast<LLFloaterBulkPermission*>(user_data);
 	self->doApply();
 }
 
 void LLFloaterBulkPermission::onCloseBtn(void* user_data)
 {
-	LLFloaterBulkPermission* self = (LLFloaterBulkPermission*)user_data;
+	LLFloaterBulkPermission* self = static_cast<LLFloaterBulkPermission*>(user_data);
 	self->onClose(false);
 }
 
 //static 
 void LLFloaterBulkPermission::onCommitCopy(LLUICtrl* ctrl, void* data)
 {
+	LLFloaterBulkPermission* self = static_cast<LLFloaterBulkPermission*>(data);
 	// Implements fair use
 	BOOL copyable = gSavedSettings.getBOOL("BulkChangeNextOwnerCopy");
 	if(!copyable)
 	{
 		gSavedSettings.setBOOL("BulkChangeNextOwnerTransfer", TRUE);
 	}
-	LLCheckBoxCtrl* xfer = static_cast<LLFloaterPerms*>(data)->getChild<LLCheckBoxCtrl>("next_owner_transfer");
+	LLCheckBoxCtrl* xfer = self->getChild<LLCheckBoxCtrl>("next_owner_transfer");
 	xfer->setEnabled(copyable);
 }
 
diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp
index f57042eedb3b72098fdb79177c9cdb5073aff953..682ed8e26bbfe60530f66c4172a8c21531da295f 100644
--- a/indra/newview/llfloaterchat.cpp
+++ b/indra/newview/llfloaterchat.cpp
@@ -71,6 +71,7 @@
 #include "llchatbar.h"
 #include "lllogchat.h"
 #include "lltexteditor.h"
+#include "lltextparser.h"
 #include "llfloaterhtml.h"
 #include "llweb.h"
 #include "llstylemap.h"
@@ -263,6 +264,9 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file)
 	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);
@@ -405,7 +409,10 @@ void LLFloaterChat::addChat(const LLChat& chat,
 	
 	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);
 }
diff --git a/indra/newview/llfloaterfonttest.cpp b/indra/newview/llfloaterfonttest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4bb1d9605dad392e5a94eec5a4d1c234933736d2
--- /dev/null
+++ b/indra/newview/llfloaterfonttest.cpp
@@ -0,0 +1,65 @@
+/** 
+ * @file llfloaterfonttest.cpp
+ * @author Brad Payne
+ * @brief LLFloaterFontTest class implementation
+ *
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ * 
+ * Copyright (c) 2008 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://secondlife.com/developers/opensource/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://secondlife.com/developers/opensource/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$
+ */
+
+/**
+ * Floater that appears when buying an object, giving a preview
+ * of its contents and their permissions.
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloaterfonttest.h"
+#include "lluictrlfactory.h"
+
+
+LLFloaterFontTest* LLFloaterFontTest::sInstance = NULL;
+
+LLFloaterFontTest::LLFloaterFontTest()
+	:	LLFloater(std::string("floater_font_test"), LLRect(0,500,700,0), std::string("Font Test"))
+{
+	LLUICtrlFactory::getInstance()->buildFloater(this, "floater_font_test.xml");
+}
+
+LLFloaterFontTest::~LLFloaterFontTest()
+{
+	sInstance = NULL;
+}
+
+// static
+void LLFloaterFontTest::show(void *unused)
+{
+	if (!sInstance)
+		sInstance = new LLFloaterFontTest();
+
+	sInstance->open(); /*Flawfinder: ignore*/
+	sInstance->setFocus(TRUE);
+}
diff --git a/indra/newview/llfloaterfonttest.h b/indra/newview/llfloaterfonttest.h
new file mode 100644
index 0000000000000000000000000000000000000000..45ff890423cb6c36248fde1f32df793f5dabfef4
--- /dev/null
+++ b/indra/newview/llfloaterfonttest.h
@@ -0,0 +1,51 @@
+/** 
+ * @file llfloaterfonttest.h
+ * @author Brad Payne
+ * @brief floater to exercise standard fonts
+ *
+ * $LicenseInfo:firstyear=2008&license=viewergpl$
+ * 
+ * Copyright (c) 2008, 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://secondlife.com/developers/opensource/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://secondlife.com/developers/opensource/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$
+ */
+
+#ifndef LL_LLFLOATERFONTTEST_H
+#define LL_LLFLOATERFONTTEST_H
+
+#include "llfloater.h"
+
+class LLFloaterFontTest:
+	public LLFloater
+{
+public:
+	static void show(void* unused);
+
+private:
+	LLFloaterFontTest();
+	~LLFloaterFontTest();
+
+	static LLFloaterFontTest* sInstance;
+};
+
+#endif
diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp
index 9a31582c245335230e777fd7c0210d6b933ebbad..4959a2913eccbed83b11093459ca35c9a771326f 100644
--- a/indra/newview/llfloatergodtools.cpp
+++ b/indra/newview/llfloatergodtools.cpp
@@ -1351,8 +1351,8 @@ void LLPanelRequestTools::refresh()
 	list->operateOnAll(LLCtrlListInterface::OP_DELETE);
 	list->addSimpleElement(SELECTION);
 	list->addSimpleElement(AGENT_REGION);
-	for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin();
-		 iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter)
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+		 iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
 		LLViewerRegion* regionp = *iter;
 		std::string name = regionp->getName();
@@ -1412,8 +1412,8 @@ void LLPanelRequestTools::onClickRequest(void* data)
 	else
 	{
 		// find region by name
-		for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin();
-			 iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter)
+		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+			 iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 		{
 			LLViewerRegion* regionp = *iter;
 			if(dest == regionp->getName())
diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp
index 15f1e4852d84e3794afa63a258ff9ac830f2666c..91471ca2d0ad8c6256754edb96997904ba9c1222 100644
--- a/indra/newview/llfloaterlagmeter.cpp
+++ b/indra/newview/llfloaterlagmeter.cpp
@@ -99,19 +99,15 @@ LLFloaterLagMeter::LLFloaterLagMeter(const LLSD& key)
 	config_string = getString("min_width_px", mStringArgs);
 	mMinWidth = atoi( config_string.c_str() );
 
-	mStringArgs["[CLIENT_FRAME_RATE_CRITICAL]"] = getString("client_frame_rate_critical_fps");
 	mStringArgs["[CLIENT_FRAME_RATE_CRITICAL]"] = getString("client_frame_rate_critical_fps");
 	mStringArgs["[CLIENT_FRAME_RATE_WARNING]"] = getString("client_frame_rate_warning_fps");
 
-	mStringArgs["[NETWORK_PACKET_LOSS_CRITICAL]"] = getString("network_packet_loss_critical_pct");
 	mStringArgs["[NETWORK_PACKET_LOSS_CRITICAL]"] = getString("network_packet_loss_critical_pct");
 	mStringArgs["[NETWORK_PACKET_LOSS_WARNING]"] = getString("network_packet_loss_warning_pct");
 
-	mStringArgs["[NETWORK_PING_CRITICAL]"] = getString("network_ping_critical_ms");
 	mStringArgs["[NETWORK_PING_CRITICAL]"] = getString("network_ping_critical_ms");
 	mStringArgs["[NETWORK_PING_WARNING]"] = getString("network_ping_warning_ms");
 
-	mStringArgs["[SERVER_FRAME_RATE_CRITICAL]"] = getString("server_frame_rate_critical_fps");
 	mStringArgs["[SERVER_FRAME_RATE_CRITICAL]"] = getString("server_frame_rate_critical_fps");
 	mStringArgs["[SERVER_FRAME_RATE_WARNING]"] = getString("server_frame_rate_warning_fps");
 
@@ -202,6 +198,12 @@ void LLFloaterLagMeter::determineNetwork()
 	bool find_cause_loss = false;
 	bool find_cause_ping = false;
 
+	// *FIXME: We can't blame a large ping time on anything in
+	// particular if the frame rate is low, because a low frame
+	// rate is a sure recipe for crappy ping times right now until
+	// the network handlers are de-synched from the rendering.
+	F32 client_frame_time_ms = 1000.0f * LLViewerStats::getInstance()->mFPSStat.getMeanDuration();
+	
 	if(packet_loss >= mNetworkPacketLossCritical)
 	{
 		mNetworkButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME);
@@ -211,8 +213,11 @@ void LLFloaterLagMeter::determineNetwork()
 	else if(ping_time >= mNetworkPingCritical)
 	{
 		mNetworkButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME);
-		mNetworkText->setText( getString("network_ping_critical_msg", mStringArgs) );
-		find_cause_ping = true;
+		if (client_frame_time_ms < mNetworkPingCritical)
+		{
+			mNetworkText->setText( getString("network_ping_critical_msg", mStringArgs) );
+			find_cause_ping = true;
+		}
 	}
 	else if(packet_loss >= mNetworkPacketLossWarning)
 	{
@@ -223,8 +228,11 @@ void LLFloaterLagMeter::determineNetwork()
 	else if(ping_time >= mNetworkPingWarning)
 	{
 		mNetworkButton->setImageUnselected(LAG_WARNING_IMAGE_NAME);
-		mNetworkText->setText( getString("network_ping_warning_msg", mStringArgs) );
-		find_cause_ping = true;
+		if (client_frame_time_ms < mNetworkPingWarning)
+		{
+			mNetworkText->setText( getString("network_ping_warning_msg", mStringArgs) );
+			find_cause_ping = true;
+		}
 	}
 	else
 	{
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index ede2f3d47f05895731730097d84666901f85cf30..e0396e070c95581c54acb05b5b54ba27410fba94 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -65,6 +65,7 @@
 #include "lltexturectrl.h"
 #include "lluiconstants.h"
 #include "lluictrlfactory.h"
+#include "llviewerimagelist.h"		// LLUIImageList
 #include "llviewermessage.h"
 #include "llviewerparcelmgr.h"
 #include "llviewerregion.h"
@@ -193,8 +194,6 @@ void LLFloaterLand::onClose(bool app_quitting)
 LLFloaterLand::LLFloaterLand(const LLSD& seed)
 :	LLFloater(std::string("floaterland"), std::string("FloaterLandRect5"), std::string("About Land"))
 {
-
-
 	LLCallbackMap::map_t factory_map;
 	factory_map["land_general_panel"] = LLCallbackMap(createPanelLandGeneral, this);
 
@@ -305,7 +304,6 @@ LLPanelLandGeneral::LLPanelLandGeneral(LLParcelSelectionHandle& parcel)
 
 BOOL LLPanelLandGeneral::postBuild()
 {
-
 	mEditName = getChild<LLLineEditor>("Name");
 	mEditName->setCommitCallback(onCommitAny);	
 	childSetPrevalidate("Name", LLLineEditor::prevalidatePrintableNotPipe);
@@ -335,7 +333,6 @@ BOOL LLPanelLandGeneral::postBuild()
 	mBtnSetGroup->setClickedCallback(onClickSetGroup, this);
 
 	
-
 	mCheckDeedToGroup = getChild<LLCheckBoxCtrl>( "check deed");
 	childSetCommitCallback("check deed", onCommitAny, this);
 
@@ -615,9 +612,9 @@ void LLPanelLandGeneral::refresh()
 								 &dwell);
 
 		// Area
-		LLUIString price = childGetText("area_size_text");
+		LLUIString price = getString("area_size_text");
 		price.setArg("[AREA]", llformat("%d",area));    
-		mTextPriceLabel->setText(childGetText("area_text"));
+		mTextPriceLabel->setText(getString("area_text"));
 		mTextPrice->setText(price.getString());
 
 		mTextDwell->setText(llformat("%.0f", dwell));
@@ -1425,7 +1422,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo
 		return;
 	}
 	
-	const LLFontGL* FONT = LLFontGL::sSansSerif;
+	const LLFontGL* FONT = LLFontGL::getFontSansSerif();
 
 	// Extract all of the owners.
 	S32 rows = msg->getNumberOfBlocksFast(_PREHASH_Data);
@@ -1841,11 +1838,12 @@ LLPanelLandOptions::~LLPanelLandOptions()
 { }
 
 
-// public
+// virtual
 void LLPanelLandOptions::refresh()
 {
+	refreshSearch();
+
 	LLParcel *parcel = mParcel->getParcel();
-	
 	if (!parcel)
 	{
 		mCheckEditObjects	->set(FALSE);
@@ -1878,17 +1876,9 @@ void LLPanelLandOptions::refresh()
 		mCheckOtherScripts	->set(FALSE);
 		mCheckOtherScripts	->setEnabled(FALSE);
 
-		mCheckShowDirectory	->set(FALSE);
-		mCheckShowDirectory	->setEnabled(FALSE);
-
 		mPushRestrictionCtrl->set(FALSE);
 		mPushRestrictionCtrl->setEnabled(FALSE);
 
-		// *TODO:Translate
-		const std::string& none_string = LLParcel::getCategoryUIString(LLParcel::C_NONE);
-		mCategoryCombo->setSimple(none_string);
-		mCategoryCombo->setEnabled(FALSE);
-
 		mLandingTypeCombo->setCurrentByIndex(0);
 		mLandingTypeCombo->setEnabled(FALSE);
 
@@ -1952,20 +1942,14 @@ void LLPanelLandOptions::refresh()
 			mPushRestrictionCtrl->setEnabled(can_change_options);
 		}
 
-		BOOL can_change_identity = 
-			LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_IDENTITY);
-		// Set by string in case the order in UI doesn't match the order by index.
-		// *TODO:Translate
-		LLParcel::ECategory cat = parcel->getCategory();
-		const std::string& category_string = LLParcel::getCategoryUIString(cat);
-		mCategoryCombo->setSimple(category_string);
-		mCategoryCombo->setEnabled( can_change_identity );
-
 		BOOL can_change_landing_point = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, 
 														GP_LAND_SET_LANDING_POINT);
 		mLandingTypeCombo->setCurrentByIndex((S32)parcel->getLandingType());
 		mLandingTypeCombo->setEnabled( can_change_landing_point );
 
+		bool can_change_identity =
+				LLViewerParcelMgr::isParcelModifiableByAgent(
+					parcel, GP_LAND_CHANGE_IDENTITY);
 		mSnapshotCtrl->setImageAssetID(parcel->getSnapshotID());
 		mSnapshotCtrl->setEnabled( can_change_identity );
 
@@ -2003,36 +1987,109 @@ void LLPanelLandOptions::refresh()
 // virtual
 void LLPanelLandOptions::draw()
 {
-	LLParcel *parcel = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection()->getParcel();
-	
-	if(parcel)
+	refreshSearch();	// Is this necessary?  JC
+	LLPanel::draw();
+}
+
+
+// private
+void LLPanelLandOptions::refreshSearch()
+{
+	LLParcel *parcel = mParcel->getParcel();
+	if (!parcel)
 	{
-		LLViewerRegion* region;
-		region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
-		llassert(region); // Region should never be null.
+		mCheckShowDirectory->set(FALSE);
+		mCheckShowDirectory->setEnabled(FALSE);
 
-		BOOL can_change_identity = region ? 
-			LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_IDENTITY) &&
-			! (region->getRegionFlags() & REGION_FLAGS_BLOCK_PARCEL_SEARCH) : false;
+		// *TODO:Translate
+		const std::string& none_string = LLParcel::getCategoryUIString(LLParcel::C_NONE);
+		mCategoryCombo->setSimple(none_string);
+		mCategoryCombo->setEnabled(FALSE);
+		return;
+	}
+
+	LLViewerRegion* region =
+			LLViewerParcelMgr::getInstance()->getSelectionRegion();
+
+	bool can_change =
+			LLViewerParcelMgr::isParcelModifiableByAgent(
+				parcel, GP_LAND_CHANGE_IDENTITY)
+			&& region
+			&& !(region->getRegionFlags() & REGION_FLAGS_BLOCK_PARCEL_SEARCH);
+
+	// There is a bug with this panel whereby the Show Directory bit can be 
+	// slammed off by the Region based on an override.  Since this data is cached
+	// locally the change will not reflect in the panel, which could cause confusion
+	// A workaround for this is to flip the bit off in the locally cached version
+	// when we detect a mismatch case.
+	if(!can_change && parcel->getParcelFlag(PF_SHOW_DIRECTORY))
+	{
+		parcel->setParcelFlag(PF_SHOW_DIRECTORY, FALSE);
+	}
+	BOOL show_directory = parcel->getParcelFlag(PF_SHOW_DIRECTORY);
+	mCheckShowDirectory	->set(show_directory);
+
+	// Set by string in case the order in UI doesn't match the order by index.
+	// *TODO:Translate
+	LLParcel::ECategory cat = parcel->getCategory();
+	const std::string& category_string = LLParcel::getCategoryUIString(cat);
+	mCategoryCombo->setSimple(category_string);
 
-		// There is a bug with this panel whereby the Show Directory bit can be 
-		// slammed off by the Region based on an override.  Since this data is cached
-		// locally the change will not reflect in the panel, which could cause confusion
-		// A workaround for this is to flip the bit off in the locally cached version
-		// when we detect a mismatch case.
-		if(! can_change_identity && parcel->getParcelFlag(PF_SHOW_DIRECTORY))
+	std::string tooltip;
+	bool enable_show_directory = false;
+	// Parcels <= 128 square meters cannot be listed in search, in an
+	// effort to reduce search spam from small parcels.  See also
+	// the search crawler "grid-crawl.py" in secondlife.com/doc/app/search/ JC
+	const S32 MIN_PARCEL_AREA_FOR_SEARCH = 128;
+	bool large_enough = parcel->getArea() > MIN_PARCEL_AREA_FOR_SEARCH;
+	if (large_enough)
+	{
+		if (can_change)
+		{
+			tooltip = getString("search_enabled_tooltip");
+			enable_show_directory = true;
+		}
+		else
 		{
-			parcel->setParcelFlag(PF_SHOW_DIRECTORY, FALSE);
+			tooltip = getString("search_disabled_permissions_tooltip");
+			enable_show_directory = false;
 		}
-		mCheckShowDirectory	->set(parcel->getParcelFlag(PF_SHOW_DIRECTORY));
-		mCheckShowDirectory	->setEnabled(can_change_identity);
-		mCategoryCombo->setEnabled(can_change_identity);
 	}
-
-	LLPanel::draw();
+	else
+	{
+		// not large enough to include in search
+		if (can_change)
+		{
+			if (show_directory)
+			{
+				// parcels that are too small, but are still in search for
+				// legacy reasons, need to have the check box enabled so
+				// the owner can delist the parcel. JC
+				tooltip = getString("search_enabled_tooltip");
+				enable_show_directory = true;
+			}
+			else
+			{
+				tooltip = getString("search_disabled_small_tooltip");
+				enable_show_directory = false;
+			}
+		}
+		else
+		{
+			// both too small and don't have permission, so just
+			// show the permissions as the reason (which is probably
+			// the more common case) JC
+			tooltip = getString("search_disabled_permissions_tooltip");
+			enable_show_directory = false;
+		}
+	}
+	mCheckShowDirectory->setToolTip(tooltip);
+	mCategoryCombo->setToolTip(tooltip);
+	mCheckShowDirectory->setEnabled(enable_show_directory);
+	mCategoryCombo->setEnabled(enable_show_directory);
+}
 
 
-}
 // static
 void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata)
 {
diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h
index 7854b7d72c3bc3351dbe8b3975a7b6892eae8bfc..520ed4147ecb83ee8f699ddd84f340fcf6b2727c 100644
--- a/indra/newview/llfloaterland.h
+++ b/indra/newview/llfloaterland.h
@@ -38,7 +38,8 @@
 #include <vector>
 
 #include "llfloater.h"
-#include "llviewerimagelist.h"
+//#include "llviewerimagelist.h"
+#include "llmemory.h"	// LLPointer<>
 
 typedef std::set<LLUUID, lluuid_less> uuid_list_t;
 const F32 CACHE_REFRESH_TIME	= 2.5f;
@@ -56,6 +57,7 @@ class LLTabContainer;
 class LLTextBox;
 class LLTextEditor;
 class LLTextureCtrl;
+class LLUIImage;
 class LLViewerTextEditor;
 class LLParcelSelection;
 
@@ -90,8 +92,7 @@ protected:
 	LLFloaterLand(const LLSD& seed);
 	virtual ~LLFloaterLand();
 
-	void refresh();
-
+	/*virtual*/ void refresh();
 
 	static void* createPanelLandGeneral(void* data);
 	static void* createPanelLandCovenant(void* data);
@@ -131,7 +132,7 @@ class LLPanelLandGeneral
 public:
 	LLPanelLandGeneral(LLSafeHandle<LLParcelSelection>& parcelp);
 	virtual ~LLPanelLandGeneral();
-	void refresh();
+	/*virtual*/ void refresh();
 	void refreshNames();
 	virtual void draw();
 
@@ -231,7 +232,7 @@ class LLPanelLandObjects
 public:
 	LLPanelLandObjects(LLSafeHandle<LLParcelSelection>& parcelp);
 	virtual ~LLPanelLandObjects();
-	void refresh();
+	/*virtual*/ void refresh();
 	virtual void draw();
 
 	bool callbackReturnOwnerObjects(const LLSD& notification, const LLSD& response);
@@ -281,9 +282,9 @@ protected:
 	LLButton		*mBtnReturnOwnerList;
 	LLNameListCtrl	*mOwnerList;
 
-	LLUIImagePtr	mIconAvatarOnline;
-	LLUIImagePtr	mIconAvatarOffline;
-	LLUIImagePtr	mIconGroup;
+	LLPointer<LLUIImage>	mIconAvatarOnline;
+	LLPointer<LLUIImage>	mIconAvatarOffline;
+	LLPointer<LLUIImage>	mIconGroup;
 
 	BOOL			mFirstReply;
 
@@ -302,18 +303,20 @@ class LLPanelLandOptions
 public:
 	LLPanelLandOptions(LLSafeHandle<LLParcelSelection>& parcelp);
 	virtual ~LLPanelLandOptions();
-	void refresh();
+	/*virtual*/ BOOL postBuild();
+	/*virtual*/ void draw();
+	/*virtual*/ void refresh();
 
+private:
+	// Refresh the "show in search" checkbox and category selector.
+	void refreshSearch();
 
 	static void onCommitAny(LLUICtrl* ctrl, void *userdata);
 	static void onClickSet(void* userdata);
 	static void onClickClear(void* userdata);
 	static void onClickPublishHelp(void*);
 
-	virtual BOOL postBuild();
-	virtual void draw();
-
-protected:
+private:
 	LLCheckBoxCtrl*	mCheckEditObjects;
 	LLCheckBoxCtrl*	mCheckEditGroupObjects;
 	LLCheckBoxCtrl*	mCheckAllObjectEntry;
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp
index 6ad6e0c275cf8e25255264a65fc2b630556e6621..3b1e4c7ac753172c0b7127a403707ab0acef252e 100644
--- a/indra/newview/llfloatermap.cpp
+++ b/indra/newview/llfloatermap.cpp
@@ -32,120 +32,43 @@
 
 #include "llviewerprecompiledheaders.h"
 
-// self include
 #include "llfloatermap.h"
 
-// Library includes
-#include "llfontgl.h"
-#include "llinventory.h"
-#include "message.h"
-
-// Viewer includes
 #include "llagent.h"
 #include "llcolorscheme.h"
 #include "llviewercontrol.h"
 #include "lldraghandle.h"
-#include "lleconomy.h"
-#include "llfloaterworldmap.h"
-#include "llfocusmgr.h"
 #include "llnetmap.h"
 #include "llregionhandle.h"
 #include "llresizebar.h"
-#include "llresizehandle.h"
-#include "llresmgr.h"
-#include "llsky.h"
-#include "llsliderctrl.h"
-#include "llspinctrl.h"
-#include "llstatgraph.h"
-#include "llstatusbar.h"
-//#include "lltextbox.h"
-#include "llui.h"
-#include "llviewermenu.h"
-#include "llviewerparceloverlay.h"
-#include "llviewerregion.h"
-#include "llviewerstats.h"
-#include "llurlsimstring.h"
-
-#include "llglheaders.h"
-
-//
-// Constants
-//
-const S32 LEGEND_SIZE = 16;
-
-const S32 HPAD = 4;
-
-const S32 MAP_COMBOBOX_WIDTH = 128;
-const S32 MAP_COMBOBOX_HEIGHT = 20;
-const S32 GO_BTN_WIDTH = 20;
-const S32 SLIDER_WIDTH = LEGEND_SIZE + MAP_COMBOBOX_WIDTH + HPAD + GO_BTN_WIDTH - HPAD;
-const S32 SLIDER_HEIGHT = 16;
-
-const S32 SIM_STAT_WIDTH = 8;
-
-const S32 MAP_SCALE_MIN = 35;	// in pixels per sim
-const S32 MAP_SCALE_MAX = 180;	// in pixels per sim
-const S32 MAP_SCALE_INCREMENT = 5;
-
-const S32 NETMAP_MIN_WIDTH = 128;
-const S32 NETMAP_MIN_HEIGHT = 128;
-
-const S32 FLOATERMAP_MIN_WIDTH = 
-	SLIDER_WIDTH + 
-	2 * (HPAD + LLPANEL_BORDER_WIDTH);
-
-const S32 MORE_BTN_VPAD = 2;
-
-const S32 SPIN_VPAD = 4;
-  
-const S32 TRACKING_LABEL_HEIGHT = 16;
-
-const S32 FLOATERMAP_MIN_HEIGHT_LARGE = 60;
-
-//
-// Globals
-//
-LLFloaterMap *gFloaterMap = NULL;
-
+#include "lluictrlfactory.h"
 
+LLFloaterMap::LLFloaterMap(const LLSD& key)
+	:
+	LLFloater(std::string("minimap")),
+	mPanelMap(NULL)
+{
+	LLCallbackMap::map_t factory_map;
+	factory_map["mini_mapview"] = LLCallbackMap(createPanelMiniMap, this);
+	LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mini_map.xml", &factory_map, FALSE);
+}
 
 
-//
-// Member functions
-//
+// static
+void* LLFloaterMap::createPanelMiniMap(void* data)
+{
+	LLFloaterMap* self = (LLFloaterMap*)data;
+	self->mPanelMap = new LLNetMap("Mapview");
+	return self->mPanelMap;
+}
 
-LLFloaterMap::LLFloaterMap(const std::string& name)
-	:
-	LLFloater(name, 
-				std::string("FloaterMiniMapRect"), 
-			    LLStringUtil::null, 
-				TRUE, 
-				FLOATERMAP_MIN_WIDTH, 
-				FLOATERMAP_MIN_HEIGHT_LARGE, 
-				FALSE, 
-				FALSE, 
-				TRUE)	// close button
+BOOL LLFloaterMap::postBuild()
 {
-	const S32 LEFT = LLPANEL_BORDER_WIDTH;
-	const S32 TOP = getRect().getHeight();
-
-	S32 y = 0;
-
-	// Map itself
-	LLRect map_rect(
-		LEFT, 
-		TOP - LLPANEL_BORDER_WIDTH,
-		getRect().getWidth() - LLPANEL_BORDER_WIDTH,
-		y );
-	LLColor4 bg_color = gColors.getColor( "NetMapBackgroundColor" );
-	mMap = new LLNetMap("Net Map", map_rect, bg_color);
-	mMap->setFollowsAll();
-	addChildAtEnd(mMap);
-
-	// Get the drag handle all the way in back
+	// Send the drag handle to the back, but make sure close stays on top
 	sendChildToBack(getDragHandle());
-
+	sendChildToFront(getChild<LLButton>("llfloater_close_btn"));
 	setIsChrome(TRUE);
+	return TRUE;
 }
 
 
@@ -155,11 +78,11 @@ LLFloaterMap::~LLFloaterMap()
 
 
 // virtual 
-void LLFloaterMap::setVisible(BOOL visible)
+void LLFloaterMap::onOpen()
 {
-	LLFloater::setVisible(visible);
+	gFloaterView->adjustToFitScreen(this, FALSE);
 
-	gSavedSettings.setBOOL("ShowMiniMap", visible);
+	gSavedSettings.setBOOL("ShowMiniMap", TRUE);
 }
 
 
@@ -189,7 +112,7 @@ void LLFloaterMap::draw()
 		setMouseOpaque(FALSE);
 		getDragHandle()->setMouseOpaque(FALSE);
 
-		drawChild(mMap);
+		drawChild(mPanelMap);
 	}
 	else
 	{
@@ -200,18 +123,3 @@ void LLFloaterMap::draw()
 	}
 }
 
-// static
-void LLFloaterMap::toggle(void*)
-{
-	if( gFloaterMap )
-	{
-		if (gFloaterMap->getVisible())
-		{
-			gFloaterMap->close();
-		}
-		else
-		{
-			gFloaterMap->open();		/* Flawfinder: ignore */
-		}
-	}
-}
diff --git a/indra/newview/llfloatermap.h b/indra/newview/llfloatermap.h
index 9d7abaf2aecd4af8a0cf4cf715c5f685ee486ba8..ec2db27f7a18992870e57defa86b86029807d389 100644
--- a/indra/newview/llfloatermap.h
+++ b/indra/newview/llfloatermap.h
@@ -37,32 +37,26 @@
 
 class LLNetMap;
 
-//
-// Classes
-//
-class LLFloaterMap
-:	public LLFloater
+class LLFloaterMap :
+	public LLFloater,
+	public LLFloaterSingleton<LLFloaterMap>
 {
+	friend class LLUISingleton<LLFloaterMap, VisibilityPolicy<LLFloater> >;
 public:
-	LLFloaterMap(const std::string& name);
 	virtual ~LLFloaterMap();
 
-	static void		toggle(void*);
+	static void* createPanelMiniMap(void* data);
+
+	BOOL postBuild();
 
-	/*virtual*/ void	setVisible(BOOL visible);
 	/*virtual*/ void	draw();
+	/*virtual*/ void	onOpen();
 	/*virtual*/ void	onClose(bool app_quitting);
 	/*virtual*/ BOOL	canClose();
 
-protected:
-	LLNetMap*		mMap;
+private:
+	LLFloaterMap(const LLSD& key = LLSD());
+	LLNetMap*		mPanelMap;
 };
 
-
-//
-// Globals
-//
-
-extern LLFloaterMap *gFloaterMap;
-
 #endif  // LL_LLFLOATERMAP_H
diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp
index 08eb450b6d90d211990b9dd93c6491717155211e..52fba0aa202200a5f6be5ae03972d1ad87e40147 100644
--- a/indra/newview/llfloaterperms.cpp
+++ b/indra/newview/llfloaterperms.cpp
@@ -78,13 +78,14 @@ void LLFloaterPerms::onClickCancel(void* data)
 //static 
 void LLFloaterPerms::onCommitCopy(LLUICtrl* ctrl, void* data)
 {
+	LLFloaterPerms* self = static_cast<LLFloaterPerms*>(data);
 	// Implements fair use
 	BOOL copyable = gSavedSettings.getBOOL("NextOwnerCopy");
 	if(!copyable)
 	{
 		gSavedSettings.setBOOL("NextOwnerTransfer", TRUE);
 	}
-	LLCheckBoxCtrl* xfer = static_cast<LLFloaterPerms*>(data)->getChild<LLCheckBoxCtrl>("next_owner_transfer");
+	LLCheckBoxCtrl* xfer = self->getChild<LLCheckBoxCtrl>("next_owner_transfer");
 	xfer->setEnabled(copyable);
 }
 
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index 3f699fda99b599977efe4afaf8fa9352248407f3..412494eeb32a3b6c8dd7108a411ffc9aca4638ca 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -65,7 +65,6 @@
 #include "llviewerregion.h"
 #include "llcombobox.h"
 #include "lltooldraganddrop.h"
-#include "llfloatermap.h"
 #include "lluiconstants.h"
 #include "lluploaddialog.h"
 #include "llcallingcard.h"
diff --git a/indra/newview/llfloaterscriptdebug.cpp b/indra/newview/llfloaterscriptdebug.cpp
index cabf165cea43307dd4011cf20db2d7a08a482ff0..bc774e77ac978c4186e2c4bc346cebd5a8985c30 100644
--- a/indra/newview/llfloaterscriptdebug.cpp
+++ b/indra/newview/llfloaterscriptdebug.cpp
@@ -174,7 +174,7 @@ LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput(const LLUUID& object_id)
 		getRect().getWidth() - LLFLOATER_HPAD,
 				LLFLOATER_VPAD );
 	mHistoryEditor = new LLViewerTextEditor( std::string("Chat History Editor"), 
-										history_editor_rect, S32_MAX, LLStringUtil::null, LLFontGL::sSansSerif);
+										history_editor_rect, S32_MAX, LLStringUtil::null, LLFontGL::getFontSansSerif());
 	mHistoryEditor->setWordWrap( TRUE );
 	mHistoryEditor->setFollowsAll();
 	mHistoryEditor->setEnabled( FALSE );
@@ -197,7 +197,7 @@ void LLFloaterScriptDebugOutput::initFloater(const std::string& title, BOOL resi
 		getRect().getWidth() - LLFLOATER_HPAD,
 				LLFLOATER_VPAD );
 	mHistoryEditor = new LLViewerTextEditor( std::string("Chat History Editor"), 
-										history_editor_rect, S32_MAX, LLStringUtil::null, LLFontGL::sSansSerif);
+										history_editor_rect, S32_MAX, LLStringUtil::null, LLFontGL::getFontSansSerif());
 	mHistoryEditor->setWordWrap( TRUE );
 	mHistoryEditor->setFollowsAll();
 	mHistoryEditor->setEnabled( FALSE );
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 164c33b10d90244e00b5ff47772591aa7efbba71..e3b95e40587c0930f8a65f342e60a59c2a41c455 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -2076,6 +2076,8 @@ void LLFloaterSnapshot::draw()
 void LLFloaterSnapshot::onClose(bool app_quitting)
 {
 	gSnapshotFloaterView->setEnabled(FALSE);
+	// Set invisible so it doesn't eat tooltips. JC
+	gSnapshotFloaterView->setVisible(FALSE);
 	destroy();
 }
 
@@ -2104,6 +2106,7 @@ void LLFloaterSnapshot::show(void*)
 	sInstance->open();		/* Flawfinder: ignore */
 	sInstance->focusFirstItem(FALSE);
 	gSnapshotFloaterView->setEnabled(TRUE);
+	gSnapshotFloaterView->setVisible(TRUE);
 	gSnapshotFloaterView->adjustToFitScreen(sInstance, FALSE);
 }
 
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index 704b53e8164fff0848a0e9280f48572b04ee4685..a33b49563c4581bb62bf9294e5a19471a588a794 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -309,7 +309,7 @@ BOOL	LLFloaterTools::postBuild()
 
 	mSliderDozerSize = getChild<LLSlider>("slider brush size");
 	childSetCommitCallback("slider brush size", commit_slider_dozer_size,  (void*)0);
-	childSetValue( "slider brush size", gSavedSettings.getS32("RadioLandBrushSize"));
+	childSetValue( "slider brush size", gSavedSettings.getF32("LandBrushSize"));
 	
 	mSliderDozerForce = getChild<LLSlider>("slider force");
 	childSetCommitCallback("slider force",commit_slider_dozer_force,  (void*)0);
@@ -890,8 +890,8 @@ void click_popup_dozer_mode(LLUICtrl *, void *user)
 
 void commit_slider_dozer_size(LLUICtrl *ctrl, void*)
 {
-	S32 size = (S32)ctrl->getValue().asInteger();
-	gSavedSettings.setS32("RadioLandBrushSize", size);
+	F32 size = (F32)ctrl->getValue().asReal();
+	gSavedSettings.setF32("LandBrushSize", size);
 }
 
 void commit_slider_dozer_force(LLUICtrl *ctrl, void*)
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index f5969b67e551f8db7eb96ffd0f29656ea22c758f..91beb801ad472b7106888d69c184b3d2711074cf 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -272,7 +272,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
 	{
 		std::vector<LLDrawable*> potentials;
 				
-		for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 		{
 			LLViewerRegion* region = *iter;
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 6497821349995094aa75a5ac2785cdcd5b46f119..20140073f4bddfb64a23a5d50f9b84a6573d2237 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -93,8 +93,8 @@ LLHUDText::LLHUDText(const U8 type) :
 			mVisibleOffScreen(FALSE),
 			mWidth(0.f),
 			mHeight(0.f),
-			mFontp(LLFontGL::sSansSerifSmall),
-			mBoldFontp(LLFontGL::sSansSerifBold),
+			mFontp(LLFontGL::getFontSansSerifSmall()),
+			mBoldFontp(LLFontGL::getFontSansSerifBold()),
 			mMass(1.f),
 			mMaxLines(10),
 			mOffsetY(0),
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
index de9e92fcdd133c316f632aac0b3d2a54a8a373f7..f3943345c7b58854eb09808390f39f5242de0ee7 100644
--- a/indra/newview/llimpanel.cpp
+++ b/indra/newview/llimpanel.cpp
@@ -504,7 +504,13 @@ void LLVoiceChannel::deactivate()
 	if (callStarted())
 	{
 		setState(STATE_HUNG_UP);
+		// mute the microphone if required when returning to the proximal channel
+		if (gSavedSettings.getBOOL("AutoDisengageMic") && sCurrentVoiceChannel == this)
+		{
+			gSavedSettings.setBOOL("PTTCurrentlyEnabled", true);
+		}
 	}
+
 	if (sCurrentVoiceChannel == this)
 	{
 		// default channel is proximal channel
@@ -523,11 +529,14 @@ void LLVoiceChannel::activate()
 	// deactivate old channel and mark ourselves as the active one
 	if (sCurrentVoiceChannel != this)
 	{
-		if (sCurrentVoiceChannel)
+		// mark as current before deactivating the old channel to prevent
+		// activating the proximal channel between IM calls
+		LLVoiceChannel* old_channel = sCurrentVoiceChannel;
+		sCurrentVoiceChannel = this;
+		if (old_channel)
 		{
-			sCurrentVoiceChannel->deactivate();
+			old_channel->deactivate();
 		}
-		sCurrentVoiceChannel = this;
 	}
 
 	if (mState == STATE_NO_CHANNEL_INFO)
@@ -1282,6 +1291,7 @@ BOOL LLFloaterIMPanel::postBuild()
 
 		mHistoryEditor = getChild<LLViewerTextEditor>("im_history");
 		mHistoryEditor->setParseHTML(TRUE);
+		mHistoryEditor->setParseHighlights(TRUE);
 
 		if ( IM_SESSION_GROUP_START == mDialog )
 		{
@@ -1634,60 +1644,32 @@ BOOL LLFloaterIMPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 								  EAcceptance* accept,
 								  std::string& tooltip_msg)
 {
-	BOOL accepted = FALSE;
-	switch(cargo_type)
+
+	if (mDialog == IM_NOTHING_SPECIAL)
 	{
-		case DAD_CALLINGCARD:
-		{
-			accepted = dropCallingCard((LLInventoryItem*)cargo_data, drop);
-			break;
-		}
-		case DAD_CATEGORY:
+		LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionUUID, drop,
+												 cargo_type, cargo_data, accept);
+	}
+	
+	// handle case for dropping calling cards (and folders of calling cards) onto invitation panel for invites
+	else if (isInviteAllowed())
+	{
+		*accept = ACCEPT_NO;
+		
+		if (cargo_type == DAD_CALLINGCARD)
 		{
-			accepted = dropCategory((LLInventoryCategory*)cargo_data, drop);
-			break;
+			if (dropCallingCard((LLInventoryItem*)cargo_data, drop))
+			{
+				*accept = ACCEPT_YES_MULTI;
+			}
 		}
-
-		// See stdenums.h
-		case DAD_TEXTURE:
-		case DAD_SOUND:
-		// DAD_CALLINGCARD above
-		case DAD_LANDMARK:
-		case DAD_SCRIPT:
-		case DAD_CLOTHING:
-		case DAD_OBJECT:
-		case DAD_NOTECARD:
-		// DAD_CATEGORY above
-		case DAD_BODYPART:
-		case DAD_ANIMATION:
-		case DAD_GESTURE:
+		else if (cargo_type == DAD_CATEGORY)
 		{
-			if (mDialog == IM_NOTHING_SPECIAL)
+			if (dropCategory((LLInventoryCategory*)cargo_data, drop))
 			{
-				// See LLDropTarget for similar code.
-				LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
-				if(gInventory.getItem(inv_item->getUUID())
-				   && LLToolDragAndDrop::isInventoryGiveAcceptable(inv_item))
-				{
-					accepted = true;
-					if(drop)
-					{
-						LLToolDragAndDrop::giveInventory(mOtherParticipantUUID, inv_item, mSessionUUID);
-					}
-				}
+				*accept = ACCEPT_YES_MULTI;
 			}
-			break;
 		}
-	default:
-		break;
-	}
-	if (accepted)
-	{
-		*accept = ACCEPT_YES_MULTI;
-	}
-	else
-	{
-		*accept = ACCEPT_NO;
 	}
 	return TRUE;
 } 
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 0aa406dff13f7e45d5a62f01b4a5742b6e791445..69a403e3883f19b1384d053d6a20070da7e54923 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1846,15 +1846,23 @@ void LLFolderBridge::folderOptionsMenu()
 	
 	LLInventoryModel* model = mInventoryPanel->getModel();
 	if(!model) return;
+
+	const LLInventoryCategory* category = model->getCategory(mUUID);
+	bool is_default_folder = category &&
+		(LLAssetType::AT_NONE != category->getPreferredType());
 	
 	// calling card related functionality for folders.
 
-	LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
-	if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard))
+	// Only enable calling-card related options for non-default folders.
+	if (!is_default_folder)
 	{
-		mItems.push_back(std::string("Calling Card Separator"));
-		mItems.push_back(std::string("Conference Chat Folder"));
-		mItems.push_back(std::string("IM All Contacts In Folder"));
+		LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
+		if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard))
+		{
+			mItems.push_back(std::string("Calling Card Separator"));
+			mItems.push_back(std::string("Conference Chat Folder"));
+			mItems.push_back(std::string("IM All Contacts In Folder"));
+		}
 	}
 	
 	// wearables related functionality for folders.
@@ -1871,8 +1879,7 @@ void LLFolderBridge::folderOptionsMenu()
 		mItems.push_back(std::string("Folder Wearables Separator"));
 
 		// Only enable add/replace outfit for non-default folders.
-		const LLInventoryCategory* category = model->getCategory(mUUID);
-		if (!category || (LLAssetType::AT_NONE == category->getPreferredType()))
+		if (!is_default_folder)
 		{
 			mItems.push_back(std::string("Add To Outfit"));
 			mItems.push_back(std::string("Replace Outfit"));
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index dfc34f86dac7e910a8f478d63ebaa285e64fe4db..b1cdfe38867855a8779cbaa43f59a7e162b9ea8b 100644
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -1822,7 +1822,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
 				}
 
 				LLVector3 help_text_pos = selection_center_start + (mSnapRegimeOffset * 5.f * offset_dir);
-				const LLFontGL* big_fontp = LLFontGL::sSansSerif;
+				const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
 
 				std::string help_text = "Move mouse cursor over ruler";
 				LLColor4 help_text_color = LLColor4::white;
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index dfa624a59c1df544a6bedb585990e6f7bfe28cb2..f2585c85432d8156f61245ec9ccd94d81c3c2a91 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -1436,7 +1436,7 @@ void LLManipTranslate::renderSnapGuides()
 				LLVector3 selection_center_start = getSavedPivotPoint();//LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent();
 
 				LLVector3 help_text_pos = selection_center_start + (snap_offset_meters_up * 3.f * mSnapOffsetAxis);
-				const LLFontGL* big_fontp = LLFontGL::sSansSerif;
+				const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
 
 				std::string help_text = "Move mouse cursor over ruler to snap";
 				LLColor4 help_text_color = LLColor4::white;
diff --git a/indra/newview/llmemoryview.cpp b/indra/newview/llmemoryview.cpp
index 97dc373b07b44d1a6f4c0358bc3bcf4318203f70..215cc6940b5abce588907c0eb7da00cafb037fbd 100644
--- a/indra/newview/llmemoryview.cpp
+++ b/indra/newview/llmemoryview.cpp
@@ -156,7 +156,7 @@ void LLMemoryView::draw()
 	S32 x, y;
 
 	S32 margin = 10;
-	S32 texth = (S32)LLFontGL::sMonospace->getLineHeight();
+	S32 texth = (S32)LLFontGL::getFontMonospace()->getLineHeight();
 
 	S32 xleft = margin;
 	S32 ytop = height - margin;
@@ -204,11 +204,11 @@ void LLMemoryView::draw()
 			S32 mbytes = bytes >> 20;
 
 			tdesc = llformat("%s [%4d MB] in %06d NEWS",mtv_display_table[i].desc,mbytes, LLMemType::sNewCount[tidx]);
-			LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
+			LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
 			
 			y -= (texth + 2);
 
-			S32 textw = LLFontGL::sMonospace->getWidth(tdesc);
+			S32 textw = LLFontGL::getFontMonospace()->getWidth(tdesc);
 			if (textw > labelwidth)
 				labelwidth = textw;
 		}
@@ -230,7 +230,7 @@ void LLMemoryView::draw()
 		tdesc = llformat("Total Bytes: %d MB Overhead: %d KB Avs %d Motions:%d Loading:%d Loaded:%d Active:%d Dep:%d",
 						 LLMemType::sTotalMem >> 20, LLMemType::sOverheadMem >> 10,
 						 num_avatars, num_motions, num_loading_motions, num_loaded_motions, num_active_motions, num_deprecated_motions);
-		LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
+		LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP);
 	}
 
 	// Bars
diff --git a/indra/newview/llmenucommands.cpp b/indra/newview/llmenucommands.cpp
index fea610b92bafd78718ec239d8cca71460cd465e2..6775cbf29ede11eac1947855898bf599da867d38 100644
--- a/indra/newview/llmenucommands.cpp
+++ b/indra/newview/llmenucommands.cpp
@@ -96,7 +96,7 @@ void handle_map(void*)
 
 void handle_mini_map(void*)
 {
-	LLFloaterMap::toggle(NULL);
+	LLFloaterMap::toggleInstance();
 }
 
 
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index f0fde23535769b88e3e87010ab2c28cb37c1a783..2eee54df40fc092868fdc94eba9ef7d687db7401 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -47,21 +47,18 @@
 #include "llviewercontrol.h"
 #include "llfloateravatarinfo.h"
 #include "llfloaterworldmap.h"
-#include "llfloatermap.h"
 #include "llframetimer.h"
 #include "lltracker.h"
 #include "llmenugl.h"
-#include "llstatgraph.h"
 #include "llsurface.h"
 #include "lltextbox.h"
+#include "lluictrlfactory.h"
 #include "lluuid.h"
 #include "llviewercamera.h"
 #include "llviewerimage.h"
 #include "llviewerimagelist.h"
 #include "llviewermenu.h"
 #include "llviewerobjectlist.h"
-#include "llviewermenu.h"
-#include "llviewerparceloverlay.h"
 #include "llviewerregion.h"
 #include "llviewerwindow.h"
 #include "llvoavatar.h"
@@ -76,19 +73,13 @@ const F32 MAP_SCALE_MID = 172;
 const F32 MAP_SCALE_MAX = 512;
 const F32 MAP_SCALE_INCREMENT = 16;
 const F32 MAP_MIN_PICK_DIST = 4;
+const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f;
 
 const S32 TRACKING_RADIUS = 3;
 
-//static
-BOOL LLNetMap::sRotateMap = FALSE;
-LLNetMap* LLNetMap::sInstance = NULL;
-
-LLNetMap::LLNetMap(
-	const std::string& name,
-	const LLRect& rect,
-	const LLColor4& bg_color )
-	:
-	LLUICtrl(name, rect, FALSE, NULL, NULL), mBackgroundColor( bg_color ),
+LLNetMap::LLNetMap(const std::string& name) :
+	LLPanel(name),
+	mScale(128.f),
 	mObjectMapTPM(1.f),
 	mObjectMapPixels(255.f),
 	mTargetPanX( 0.f ),
@@ -97,107 +88,57 @@ LLNetMap::LLNetMap(
 	mCurPanY( 0.f ),
 	mUpdateNow( FALSE )
 {
-	mPixelsPerMeter = gMiniMapScale / REGION_WIDTH_METERS;
-
-	LLNetMap::sRotateMap = gSavedSettings.getBOOL( "MiniMapRotate" );
-	
-	// Surface texture is dynamically generated/updated.
-// 	createObjectImage();
+	mScale = gSavedSettings.getF32("MiniMapScale");
+	mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
 
 	mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal();
 	
-	// TODO: exteralize hardcoded constants.
-	const S32 DIR_WIDTH = 10;
-	const S32 DIR_HEIGHT = 10;
-	LLRect major_dir_rect(  0, DIR_HEIGHT, DIR_WIDTH, 0 );
-	const LLColor4 minor_color( 1.f, 1.f, 1.f, .7f );
-	const LLRect minor_dir_rect(  0, DIR_HEIGHT, DIR_WIDTH * 2, 0 );
-
-	// Note: removing special treatment for north compass point (DEV-10559). -MG
-	//mTextBoxNorth = new LLTextBox( "N", major_dir_rect );
-	//mTextBoxNorth->setFontStyle(LLFontGL::DROP_SHADOW_SOFT);
-	//addChild( mTextBoxNorth );
-	mTextBoxNorth =	new LLTextBox( std::string("N"), major_dir_rect );
-	mTextBoxNorth->setColor( minor_color );
-	addChild( mTextBoxNorth );
-	
-	mTextBoxEast =	new LLTextBox( std::string("E"), major_dir_rect );
-	mTextBoxEast->setColor( minor_color );
-	addChild( mTextBoxEast );
-	
-	major_dir_rect.mRight += 1 ;
-	mTextBoxWest =	new LLTextBox( std::string("W"), major_dir_rect );
-	mTextBoxWest->setColor( minor_color );
-	addChild( mTextBoxWest );
-	major_dir_rect.mRight -= 1 ;
-
-	mTextBoxSouth = new LLTextBox( std::string("S"), major_dir_rect );
-	mTextBoxSouth->setColor( minor_color );
-	addChild( mTextBoxSouth );
-
-	mTextBoxSouthEast =	new LLTextBox( std::string("SE"), minor_dir_rect );
-	mTextBoxSouthEast->setColor( minor_color );
-	addChild( mTextBoxSouthEast );
-	
-	mTextBoxNorthEast = new LLTextBox( std::string("NE"), minor_dir_rect );
-	mTextBoxNorthEast->setColor( minor_color );
-	addChild( mTextBoxNorthEast );
-	
-	mTextBoxSouthWest =	new LLTextBox( std::string("SW"), minor_dir_rect );
-	mTextBoxSouthWest->setColor( minor_color );
-	addChild( mTextBoxSouthWest );
-
-	mTextBoxNorthWest = new LLTextBox( std::string("NW"), minor_dir_rect );
-	mTextBoxNorthWest->setColor( minor_color );
-	addChild( mTextBoxNorthWest );
-
-	// Right-click menu
-	LLMenuGL* menu;
-	menu = new LLMenuGL(std::string("popup"));
-	menu->setCanTearOff(FALSE);
-	menu->append(new LLMenuItemCallGL(std::string("Zoom Close"), handleZoomLevel,
-										NULL, (void*)2) );
-	menu->append(new LLMenuItemCallGL(std::string("Zoom Medium"), handleZoomLevel,
-										NULL, (void*)1) );
-	menu->append(new LLMenuItemCallGL(std::string("Zoom Far"), handleZoomLevel,
-										NULL, (void*)0) );
-	menu->appendSeparator();
-	menu->append(new LLMenuItemCallGL(std::string("Stop Tracking"), &LLTracker::stopTracking,
-										&LLTracker::isTracking, NULL) );
-	menu->append(new LLMenuItemCallGL(std::string("Profile..."), &showAgentProfile,
-										&isAgentUnderCursor, NULL) );
+	// Register event listeners for popup menu
+	(new LLScaleMap())->registerListener(this, "MiniMap.ZoomLevel");
+	(new LLStopTracking())->registerListener(this, "MiniMap.StopTracking");
+	(new LLEnableTracking())->registerListener(this, "MiniMap.EnableTracking");
+	(new LLShowAgentProfile())->registerListener(this, "MiniMap.ShowProfile");
+	(new LLEnableProfile())->registerListener(this, "MiniMap.EnableProfile");
+
+	LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map.xml");
+
+	updateMinorDirections();
+
+	LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_mini_map.xml", this);
+	if (!menu)
+	{
+		menu = new LLMenuGL(LLStringUtil::null);
+	}
 	menu->setVisible(FALSE);
-	addChild(menu);
 	mPopupMenuHandle = menu->getHandle();
-	sInstance = this;
 }
 
 LLNetMap::~LLNetMap()
 {
-	sInstance = NULL;
 }
 
 void LLNetMap::setScale( F32 scale )
 {
-	gMiniMapScale = scale;
-	if (gMiniMapScale == 0.f)
+	mScale = scale;
+	if (mScale == 0.f)
 	{
-		gMiniMapScale = 0.1f;
+		mScale = 0.1f;
 	}
+	gSavedSettings.setF32("MiniMapScale", mScale);
 
 	if (mObjectImagep.notNull())
 	{
-		F32 half_width = (F32)(getRect().getWidth() / 2);
-		F32 half_height = (F32)(getRect().getHeight() / 2);
-		F32 radius = sqrt( half_width * half_width + half_height * half_height );
-		F32 region_widths = (2.f*radius)/gMiniMapScale;
+		F32 width = (F32)(getRect().getWidth());
+		F32 height = (F32)(getRect().getHeight());
+		F32 diameter = sqrt(width * width + height * height);
+		F32 region_widths = diameter / mScale;
 		F32 meters = region_widths * LLWorld::getInstance()->getRegionWidthInMeters();
 		F32 num_pixels = (F32)mObjectImagep->getWidth();
-		mObjectMapTPM = num_pixels/meters;
-		mObjectMapPixels = 2.f*radius;
+		mObjectMapTPM = num_pixels / meters;
+		mObjectMapPixels = diameter;
 	}
 
-	mPixelsPerMeter = gMiniMapScale / REGION_WIDTH_METERS;
+	mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
 
 	mUpdateNow = TRUE;
 }
@@ -219,16 +160,16 @@ void LLNetMap::draw()
 	{
 		createObjectImage();
 	}
-	
+
 	mCurPanX = lerp(mCurPanX, mTargetPanX, LLCriticalDamp::getInterpolant(0.1f));
 	mCurPanY = lerp(mCurPanY, mTargetPanY, LLCriticalDamp::getInterpolant(0.1f));
 
-	// Prepare a scissor region
 	F32 rotation = 0;
 
+	// Prepare a scissor region
 	{
 		LLGLEnable scissor(GL_SCISSOR_TEST);
-		
+
 		{
 			gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 			LLLocalClipRect clip(getLocalRect());
@@ -236,8 +177,11 @@ void LLNetMap::draw()
 			glMatrixMode(GL_MODELVIEW);
 
 			// Draw background rectangle
-			gGL.color4fv( mBackgroundColor.mV );
-			gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0);
+			if(isBackgroundVisible())
+			{
+				gGL.color4fv(isBackgroundOpaque() ? getBackgroundColor().mV : getTransparentColor().mV);
+				gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0);
+			}
 		}
 
 		// region 0,0 is in the middle
@@ -248,7 +192,8 @@ void LLNetMap::draw()
 
 		gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f);
 
-		if( LLNetMap::sRotateMap )
+		BOOL rotate_map = gSavedSettings.getBOOL( "MiniMapRotate" );
+		if( rotate_map )
 		{
 			// rotate subsequent draws to agent rotation
 			rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
@@ -257,35 +202,30 @@ void LLNetMap::draw()
 
 		// figure out where agent is
 		S32 region_width = llround(LLWorld::getInstance()->getRegionWidthInMeters());
+		LLColor4 this_region_color = gColors.getColor( "NetMapThisRegion" );
+		LLColor4 live_region_color = gColors.getColor( "NetMapLiveRegion" );
+		LLColor4 dead_region_color = gColors.getColor( "NetMapDeadRegion" );
 
-		for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin();
-			 iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter)
+		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+			 iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 		{
 			LLViewerRegion* regionp = *iter;
 			// Find x and y position relative to camera's center.
 			LLVector3 origin_agent = regionp->getOriginAgent();
 			LLVector3 rel_region_pos = origin_agent - gAgent.getCameraPositionAgent();
-			F32 relative_x = (rel_region_pos.mV[0] / region_width) * gMiniMapScale;
-			F32 relative_y = (rel_region_pos.mV[1] / region_width) * gMiniMapScale;
+			F32 relative_x = (rel_region_pos.mV[0] / region_width) * mScale;
+			F32 relative_y = (rel_region_pos.mV[1] / region_width) * mScale;
 
 			// background region rectangle
 			F32 bottom =	relative_y;
 			F32 left =		relative_x;
-			F32 top =		bottom + gMiniMapScale ;
-			F32 right =		left + gMiniMapScale ;
-
-			if (regionp == gAgent.getRegion())
-			{
-				gGL.color4f(1.f, 1.f, 1.f, 1.f);
-			}
-			else
-			{
-				gGL.color4f(0.8f, 0.8f, 0.8f, 1.f);
-			}
+			F32 top =		bottom + mScale ;
+			F32 right =		left + mScale ;
 
+			gGL.color4fv(regionp == gAgent.getRegion() ? this_region_color.mV : live_region_color.mV);
 			if (!regionp->isAlive())
 			{
-				gGL.color4f(1.f, 0.5f, 0.5f, 1.f);
+				gGL.color4fv(dead_region_color.mV);
 			}
 
 
@@ -351,8 +291,8 @@ void LLNetMap::draw()
 
 		LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal);
 		map_center_agent -= gAgent.getCameraPositionAgent();
-		map_center_agent.mV[VX] *= gMiniMapScale/region_width;
-		map_center_agent.mV[VY] *= gMiniMapScale/region_width;
+		map_center_agent.mV[VX] *= mScale/region_width;
+		map_center_agent.mV[VY] *= mScale/region_width;
 
 		gGL.getTexUnit(0)->bind(mObjectImagep);
 		F32 image_half_width = 0.5f*mObjectMapPixels;
@@ -377,93 +317,64 @@ void LLNetMap::draw()
 		// Mouse pointer in local coordinates
 		S32 local_mouse_x;
 		S32 local_mouse_y;
-		//localMouse(&local_mouse_x, &local_mouse_y);
 		LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y);
 		mClosestAgentToCursor.setNull();
 		F32 closest_dist = F32_MAX;
 
 		// Draw avatars
-		for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin();
-			 iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter)
+		LLColor4 avatar_color = gColors.getColor( "MapAvatar" );
+		LLColor4 friend_color = gColors.getColor( "MapFriend" );
+		std::vector<LLUUID> avatar_ids;
+		std::vector<LLVector3d> positions;
+		LLWorld::getInstance()->getAvatars(&avatar_ids, &positions);
+		for(U32 i=0; i<avatar_ids.size(); i++)
 		{
-			LLViewerRegion* regionp = *iter;
-			const LLVector3d& origin_global = regionp->getOriginGlobal();
-
-			S32 count = regionp->mMapAvatars.count();
-			S32 i;
-			LLVector3 pos_local;
-			U32 compact_local;
-			U8 bits;
 			// TODO: it'd be very cool to draw these in sorted order from lowest Z to highest.
 			// just be careful to sort the avatar IDs along with the positions. -MG
-			for (i = 0; i < count; i++)
-			{
-				compact_local = regionp->mMapAvatars.get(i);
-
-				bits = compact_local & 0xFF;
-				pos_local.mV[VZ] = F32(bits) * 4.f;
-				compact_local >>= 8;
-
-				bits = compact_local & 0xFF;
-				pos_local.mV[VY] = (F32)bits;
-				compact_local >>= 8;
-
-				bits = compact_local & 0xFF;
-				pos_local.mV[VX] = (F32)bits;
-
-				pos_global.setVec( pos_local );
-				pos_global += origin_global;
+			pos_map = globalPosToView(positions[i], rotate_map);
 
-				pos_map = globalPosToView(pos_global);
+			LLWorldMapView::drawAvatar(
+				pos_map.mV[VX], pos_map.mV[VY], 
+				is_agent_friend(avatar_ids[i]) ? friend_color : avatar_color, 
+				pos_map.mV[VZ]);
 
-				BOOL show_as_friend = FALSE;
-				if( i < regionp->mMapAvatarIDs.count())
-				{
-					show_as_friend = is_agent_friend(regionp->mMapAvatarIDs.get(i));
-				}
-				LLWorldMapView::drawAvatar(
-					pos_map.mV[VX], pos_map.mV[VY], 
-					show_as_friend ? gFriendMapColor : gAvatarMapColor, 
-					pos_map.mV[VZ]);
-
-				F32	dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x,local_mouse_y));
-				if(dist_to_cursor < MAP_MIN_PICK_DIST && dist_to_cursor < closest_dist)
-				{
-					closest_dist = dist_to_cursor;
-					mClosestAgentToCursor = regionp->mMapAvatarIDs.get(i);
-				}
+			F32	dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x,local_mouse_y));
+			if(dist_to_cursor < MAP_MIN_PICK_DIST && dist_to_cursor < closest_dist)
+			{
+				closest_dist = dist_to_cursor;
+				mClosestAgentToCursor = avatar_ids[i];
 			}
 		}
 
 		// Draw dot for autopilot target
 		if (gAgent.getAutoPilot())
 		{
-			drawTracking( gAgent.getAutoPilotTargetGlobal(), gTrackColor );
+			drawTracking( gAgent.getAutoPilotTargetGlobal(), rotate_map, gTrackColor );
 		}
 		else
 		{
 			LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
 			if (  LLTracker::TRACKING_AVATAR == tracking_status )
 			{
-				drawTracking( LLAvatarTracker::instance().getGlobalPos(), gTrackColor );
+				drawTracking( LLAvatarTracker::instance().getGlobalPos(), rotate_map, gTrackColor );
 			} 
 			else if ( LLTracker::TRACKING_LANDMARK == tracking_status 
 					|| LLTracker::TRACKING_LOCATION == tracking_status )
 			{
-				drawTracking( LLTracker::getTrackedPositionGlobal(), gTrackColor );
+				drawTracking( LLTracker::getTrackedPositionGlobal(), rotate_map, gTrackColor );
 			}
 		}
 
 		// Draw dot for self avatar position
 		pos_global = gAgent.getPositionGlobal();
-		pos_map = globalPosToView(pos_global);
+		pos_map = globalPosToView(pos_global, rotate_map);
 		LLUIImagePtr you = LLWorldMapView::sAvatarYouSmallImage;
 		you->draw(
 			llround(pos_map.mV[VX]) - you->getWidth()/2, 
 			llround(pos_map.mV[VY]) - you->getHeight()/2);
 
 		// Draw frustum
-		F32 meters_to_pixels = gMiniMapScale/ LLWorld::getInstance()->getRegionWidthInMeters();
+		F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters();
 
 		F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect();
 		F32 far_clip_meters = LLViewerCamera::getInstance()->getFar();
@@ -478,9 +389,9 @@ void LLNetMap::draw()
 
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 
-		if( LLNetMap::sRotateMap )
+		if( rotate_map )
 		{
-			gGL.color4fv(gFrustumMapColor.mV);
+			gGL.color4fv(gColors.getColor("NetMapFrustum").mV);
 
 			gGL.begin( LLRender::TRIANGLES  );
 				gGL.vertex2f( ctr_x, ctr_y );
@@ -490,7 +401,7 @@ void LLNetMap::draw()
 		}
 		else
 		{
-			gGL.color4fv(gRotatingFrustumMapColor.mV);
+			gGL.color4fv(gColors.getColor("NetMapFrustumRotating").mV);
 			
 			// If we don't rotate the map, we have to rotate the frustum.
 			gGL.pushMatrix();
@@ -506,21 +417,26 @@ void LLNetMap::draw()
 	}
 	
 	// Rotation of 0 means that North is up
-	setDirectionPos( mTextBoxEast,  rotation );
-	setDirectionPos( mTextBoxNorth, rotation + F_PI_BY_TWO );
-	setDirectionPos( mTextBoxWest,  rotation + F_PI );
-	setDirectionPos( mTextBoxSouth, rotation + F_PI + F_PI_BY_TWO );
+	setDirectionPos( getChild<LLTextBox>("e_label"), rotation);
+	setDirectionPos( getChild<LLTextBox>("n_label"), rotation + F_PI_BY_TWO);
+	setDirectionPos( getChild<LLTextBox>("w_label"), rotation + F_PI);
+	setDirectionPos( getChild<LLTextBox>("s_label"), rotation + F_PI + F_PI_BY_TWO);
 
-	setDirectionPos( mTextBoxNorthEast, rotation +						F_PI_BY_TWO / 2);
-	setDirectionPos( mTextBoxNorthWest, rotation + F_PI_BY_TWO +		F_PI_BY_TWO / 2);
-	setDirectionPos( mTextBoxSouthWest, rotation + F_PI +				F_PI_BY_TWO / 2);
-	setDirectionPos( mTextBoxSouthEast, rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2);
+	setDirectionPos( getChild<LLTextBox>("ne_label"), rotation + F_PI_BY_TWO / 2);
+	setDirectionPos( getChild<LLTextBox>("nw_label"), rotation + F_PI_BY_TWO + F_PI_BY_TWO / 2);
+	setDirectionPos( getChild<LLTextBox>("sw_label"), rotation + F_PI + F_PI_BY_TWO / 2);
+	setDirectionPos( getChild<LLTextBox>("se_label"), rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2);
 
-	LLUICtrl::draw();
+	LLView::draw();
 }
 
-LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos )
+void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent)
 {
+	LLPanel::reshape(width, height, called_from_parent);
+	updateMinorDirections();
+}
+
+LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos, BOOL rotated ){
 	LLVector3d relative_pos_global = global_pos - gAgent.getCameraPositionGlobal();
 	LLVector3 pos_local;
 	pos_local.setVec(relative_pos_global);  // convert to floats from doubles
@@ -529,7 +445,7 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos )
 	pos_local.mV[VY] *= mPixelsPerMeter;
 	// leave Z component in meters
 
-	if( LLNetMap::sRotateMap )
+	if( rotated )
 	{
 		F32 radians = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
 		LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f));
@@ -542,10 +458,10 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos )
 	return pos_local;
 }
 
-void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, 
-							BOOL draw_arrow )
+void LLNetMap::drawTracking(const LLVector3d& pos_global, BOOL rotated,
+							const LLColor4& color, BOOL draw_arrow )
 {
-	LLVector3 pos_local = globalPosToView( pos_global );
+	LLVector3 pos_local = globalPosToView( pos_global, rotated );
 	if( (pos_local.mV[VX] < 0) ||
 		(pos_local.mV[VY] < 0) ||
 		(pos_local.mV[VX] >= getRect().getWidth()) ||
@@ -568,22 +484,22 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color,
 	}
 }
 
-LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y )
+LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y, BOOL rotated )
 {
 	x -= llround(getRect().getWidth() / 2 + mCurPanX);
 	y -= llround(getRect().getHeight() / 2 + mCurPanY);
 
-	LLVector3 pos_local( (F32)x, (F32)y, 0 );
+	LLVector3 pos_local( (F32)x, (F32)y, 0.f );
 
 	F32 radians = - atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
 
-	if( LLNetMap::sRotateMap )
+	if( rotated )
 	{
 		LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f));
 		pos_local.rotVec( rot );
 	}
 
-	pos_local *= ( LLWorld::getInstance()->getRegionWidthInMeters() / gMiniMapScale );
+	pos_local *= ( LLWorld::getInstance()->getRegionWidthInMeters() / mScale );
 	
 	LLVector3d pos_global;
 	pos_global.setVec( pos_local );
@@ -595,7 +511,7 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y )
 BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
 {
 	// note that clicks are reversed from what you'd think
-	setScale(llclamp(gMiniMapScale - clicks*MAP_SCALE_INCREMENT, MAP_SCALE_MIN, MAP_SCALE_MAX));
+	setScale(llclamp(mScale - clicks*MAP_SCALE_INCREMENT, MAP_SCALE_MIN, MAP_SCALE_MAX));
 	return TRUE;
 }
 
@@ -606,7 +522,7 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec
 	{
 		return FALSE;
 	}
-	LLViewerRegion*	region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y ) );
+	LLViewerRegion*	region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y , gSavedSettings.getBOOL( "MiniMapRotate" )) );
 	if( region )
 	{
 		msg.assign("");
@@ -627,9 +543,8 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec
 		buffer = region->getHost().getString();
 		msg.append(buffer);
 #endif
-		// *TODO: put this under the control of XUI so it can be
-		// translated.
-		msg.append("\n(Double-click to open Map)");
+		msg.append("\n");
+		msg.append(getToolTip());
 
 		S32 SLOP = 4;
 		localPointToScreen( 
@@ -637,8 +552,12 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec
 			&(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
 		sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP;
 		sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP;
+		handled = TRUE;
+	}
+	if(!handled)
+	{
+		return LLPanel::handleToolTip(x, y, msg, sticky_rect_screen);
 	}
-	handled = TRUE;
 	return handled;
 }
 
@@ -648,19 +567,32 @@ void LLNetMap::setDirectionPos( LLTextBox* text_box, F32 rotation )
 	// Rotation is in radians.
 	// Rotation of 0 means x = 1, y = 0 on the unit circle.
 
-
-	F32 map_half_height = (F32)(getRect().getHeight() / 2);
-	F32 map_half_width = (F32)(getRect().getWidth() / 2);
-	F32 text_half_height = (F32)(text_box->getRect().getHeight() / 2);
-	F32 text_half_width = (F32)(text_box->getRect().getWidth() / 2);
-	F32 radius = llmin( map_half_height - text_half_height, map_half_width - text_half_width );
+	F32 half_height = (F32)( (getRect().getHeight() - text_box->getRect().getHeight()) / 2);
+	F32 half_width  = (F32)( (getRect().getWidth() - text_box->getRect().getWidth()) / 2);
+	F32 radius = llmin( half_height, half_width );
 
 	// Inset by a little to account for position display.
 	radius -= 8.f;
 
-	text_box->setOrigin( 
-		llround(map_half_width - text_half_width + radius * cos( rotation )),
-		llround(map_half_height - text_half_height + radius * sin( rotation )) );
+	text_box->setOrigin(llround(half_width  + radius * cos( rotation )),
+						llround(half_height + radius * sin( rotation )));
+}
+
+void LLNetMap::updateMinorDirections()
+{
+	if (getChild<LLTextBox>("ne_label") == NULL)
+	{
+		return;
+	}
+
+	// Hide minor directions if they cover too much of the map
+	bool show_minors = getChild<LLTextBox>("ne_label")->getRect().getHeight() < MAP_MINOR_DIR_THRESHOLD *
+			llmin(getRect().getWidth(), getRect().getHeight());
+
+	getChild<LLTextBox>("ne_label")->setVisible(show_minors);
+	getChild<LLTextBox>("nw_label")->setVisible(show_minors);
+	getChild<LLTextBox>("sw_label")->setVisible(show_minors);
+	getChild<LLTextBox>("se_label")->setVisible(show_minors);
 }
 
 void LLNetMap::renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius_meters )
@@ -765,10 +697,10 @@ void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color,
 void LLNetMap::createObjectImage()
 {
 	// Find the size of the side of a square that surrounds the circle that surrounds getRect().
-	F32 half_width = (F32)(getRect().getWidth() / 2);
-	F32 half_height = (F32)(getRect().getHeight() / 2);
-	F32 radius = sqrt( half_width * half_width + half_height * half_height );
-	S32 square_size = S32( 2 * radius );
+	// ... which is, the diagonal of the rect.
+	F32 width = getRect().getWidth();
+	F32 height = getRect().getHeight();
+	S32 square_size = llround( sqrt(width*width + height*height) );
 
 	// Find the least power of two >= the minimum size.
 	const S32 MIN_SIZE = 32;
@@ -787,7 +719,7 @@ void LLNetMap::createObjectImage()
 		U8* data = mObjectRawImagep->getData();
 		memset( data, 0, img_size * img_size * 4 );
 		mObjectImagep = new LLImageGL( mObjectRawImagep, FALSE);
-		setScale(gMiniMapScale);
+		setScale(mScale);
 	}
 	mUpdateNow = TRUE;
 }
@@ -813,28 +745,53 @@ BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask)
 
 
 // static
-void LLNetMap::handleZoomLevel(void* which)
+bool LLNetMap::LLScaleMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
 {
-	intptr_t level = (intptr_t)which;
+	LLNetMap *self = mPtr;
+
+	S32 level = userdata.asInteger();
 
 	switch(level)
 	{
 	case 0:
-		LLNetMap::sInstance->setScale(MAP_SCALE_MIN);
+		self->setScale(MAP_SCALE_MIN);
 		break;
 	case 1:
-		LLNetMap::sInstance->setScale(MAP_SCALE_MID);
+		self->setScale(MAP_SCALE_MID);
 		break;
 	case 2:
-		LLNetMap::sInstance->setScale(MAP_SCALE_MAX);
+		self->setScale(MAP_SCALE_MAX);
 		break;
 	default:
 		break;
 	}
+
+	return true;
 }
 
-// static
-void LLNetMap::showAgentProfile(void*) 
-{ 
-	LLFloaterAvatarInfo::show(sInstance->mClosestAgentAtLastRightClick); 
+bool LLNetMap::LLStopTracking::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
+{
+	LLTracker::stopTracking(NULL);
+	return true;
+}
+
+bool LLNetMap::LLEnableTracking::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
+{
+	LLNetMap *self = mPtr;
+	self->findControl(userdata["control"].asString())->setValue(LLTracker::isTracking(NULL));
+	return true;
+}
+
+bool LLNetMap::LLShowAgentProfile::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
+{
+	LLNetMap *self = mPtr;
+	LLFloaterAvatarInfo::show(self->mClosestAgentAtLastRightClick);
+	return true;
+}
+
+bool LLNetMap::LLEnableProfile::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
+{
+	LLNetMap *self = mPtr;
+	self->findControl(userdata["control"].asString())->setValue(self->isAgentUnderCursor());
+	return true;
 }
diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h
index fd6635cb4c8f77f2ff7b2086a9739bce5e384d20..a5bf9f0fb5ee1b0416728de79dfd301f9421a487 100644
--- a/indra/newview/llnetmap.h
+++ b/indra/newview/llnetmap.h
@@ -33,59 +33,55 @@
 #ifndef LL_LLNETMAP_H
 #define LL_LLNETMAP_H
 
-#include "llmath.h"
-#include "lluictrl.h"
+#include "llpanel.h"
+#include "llmemberlistener.h"
 #include "v3math.h"
 #include "v3dmath.h"
 #include "v4color.h"
 #include "llimage.h"
 #include "llimagegl.h"
 
-class LLColor4U;
-class LLCoordGL;
+
 class LLTextBox;
-class LLMenuGL;
 
-class LLNetMap : public LLUICtrl
+class LLNetMap : public LLPanel
 {
 public:
-	LLNetMap(const std::string& name, const LLRect& rect, const LLColor4& bg_color );
+	LLNetMap(const std::string& name);
 	virtual ~LLNetMap();
 
 	virtual void	draw();
+	virtual void	reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 	virtual BOOL	handleDoubleClick( S32 x, S32 y, MASK mask );
 	virtual BOOL	handleRightMouseDown( S32 x, S32 y, MASK mask );
 	virtual BOOL	handleScrollWheel(S32 x, S32 y, S32 clicks);
 	virtual BOOL	handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen );
 
+	void			renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius );
+
+private:
+
 	void			setScale( F32 scale );
+
+	// *TODO: Enable panning of the mini-map
 	void			translatePan( F32 delta_x, F32 delta_y );
 	void			setPan( F32 x, F32 y )			{ mTargetPanX = x; mTargetPanY = y; }
 
-	const LLVector3d& getObjectImageCenterGlobal()	{ return mObjectImageCenterGlobal; }
 	void renderPoint(const LLVector3 &pos, const LLColor4U &color, 
 					 S32 diameter, S32 relative_height = 0);
-	void			renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius );
-
-	LLVector3		globalPosToView(const LLVector3d& global_pos);
-	LLVector3d		viewPosToGlobal(S32 x,S32 y);
-
-	static void		setRotateMap( BOOL b ) { LLNetMap::sRotateMap = b; }
-	static void		handleZoomLevel(void* which);
+	LLVector3		globalPosToView(const LLVector3d& global_pos, BOOL rotated);
+	LLVector3d		viewPosToGlobal(S32 x,S32 y, BOOL rotated);
 
-	void			drawTracking( const LLVector3d& pos_global, 
-								  const LLColor4& color,
-								  BOOL draw_arrow = TRUE);
+	void			drawTracking( const LLVector3d& pos_global,
+							BOOL rotated,
+							const LLColor4& color,
+							BOOL draw_arrow = TRUE);
 
-protected:
 	void			setDirectionPos( LLTextBox* text_box, F32 rotation );
+	void			updateMinorDirections();
 	void			createObjectImage();
-	static void		teleport( const LLVector3d& destination );
-	static void		fly( const LLVector3d& destination );
 
-public:
 	LLHandle<LLView>	mPopupMenuHandle;
-	LLColor4		mBackgroundColor;
 
 	F32				mScale;					// Size of a region in pixels
 	F32				mPixelsPerMeter;		// world meters to map pixels
@@ -99,15 +95,6 @@ public:
 	LLVector3d		mObjectImageCenterGlobal;
 	LLPointer<LLImageRaw> mObjectRawImagep;
 	LLPointer<LLImageGL>	mObjectImagep;
-	LLTextBox*		mTextBoxEast;
-	LLTextBox*		mTextBoxNorth;
-	LLTextBox*		mTextBoxWest;
-	LLTextBox*		mTextBoxSouth;
-
-	LLTextBox*		mTextBoxSouthEast;
-	LLTextBox*		mTextBoxNorthEast;
-	LLTextBox*		mTextBoxNorthWest;
-	LLTextBox*		mTextBoxSouthWest;
 
 private:
 	LLUUID			mClosestAgentToCursor;
@@ -117,6 +104,37 @@ private:
 	static LLNetMap*	sInstance;
 	static BOOL isAgentUnderCursor(void*) { return sInstance && sInstance->mClosestAgentToCursor.notNull(); }
 	static void showAgentProfile(void*);
+	BOOL isAgentUnderCursor() { return mClosestAgentToCursor.notNull(); }
+
+	class LLScaleMap : public LLMemberListener<LLNetMap>
+	{
+	public:
+		/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
+	};
+
+	class LLStopTracking : public LLMemberListener<LLNetMap>
+	{
+	public:
+		/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
+	};
+
+	class LLEnableTracking : public LLMemberListener<LLNetMap>
+	{
+	public:
+		/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
+	};
+
+	class LLShowAgentProfile : public LLMemberListener<LLNetMap>
+	{
+	public:
+		/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
+	};
+
+	class LLEnableProfile : public LLMemberListener<LLNetMap>
+	{
+	public:
+		/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
+	};
 };
 
 
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index 41f8f3941a3b7ba1aa5ef6f19b38d46924dcad75..7253d758eabaf909f9e6a9b3a19fa28af4b202c6 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -138,79 +138,15 @@ BOOL LLDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 									 EAcceptance* accept,
 									 std::string& tooltip_msg)
 {
-	BOOL handled = FALSE;
 	if(getParent())
 	{
-		// check if inside
-		//LLRect parent_rect = mParentView->getRect();
-		//getRect().set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0);
-		handled = TRUE;
+		LLToolDragAndDrop::handleGiveDragAndDrop(mAgentID, LLUUID::null, drop,
+												 cargo_type, cargo_data, accept);
 
-		// check the type
-		switch(cargo_type)
-		{
-		case DAD_TEXTURE:
-		case DAD_SOUND:
-		case DAD_LANDMARK:
-		case DAD_SCRIPT:
-		case DAD_OBJECT:
-		case DAD_NOTECARD:
-		case DAD_CLOTHING:
-		case DAD_BODYPART:
-		case DAD_ANIMATION:
-		case DAD_GESTURE:
-		{
-			LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
-			if(gInventory.getItem(inv_item->getUUID())
-				&& LLToolDragAndDrop::isInventoryGiveAcceptable(inv_item))
-			{
-				// *TODO: get multiple object transfers working
-				*accept = ACCEPT_YES_COPY_SINGLE;
-				if(drop)
-				{
-					LLToolDragAndDrop::giveInventory(mAgentID, inv_item);
-				}
-			}
-			else
-			{
-				// It's not in the user's inventory (it's probably
-				// in an object's contents), so disallow dragging
-				// it here.  You can't give something you don't
-				// yet have.
-				*accept = ACCEPT_NO;
-			}
-			break;
-		}
-		case DAD_CATEGORY:
-		{
-			LLViewerInventoryCategory* inv_cat = (LLViewerInventoryCategory*)cargo_data;
-			if( gInventory.getCategory( inv_cat->getUUID() ) )
-			{
-				// *TODO: get multiple object transfers working
-				*accept = ACCEPT_YES_COPY_SINGLE;
-				if(drop)
-				{
-					LLToolDragAndDrop::giveInventoryCategory(mAgentID,
-																inv_cat);
-				}
-			}
-			else
-			{
-				// It's not in the user's inventory (it's probably
-				// in an object's contents), so disallow dragging
-				// it here.  You can't give something you don't
-				// yet have.
-				*accept = ACCEPT_NO;
-			}
-			break;
-		}
-		case DAD_CALLINGCARD:
-		default:
-			*accept = ACCEPT_NO;
-			break;
-		}
+		return TRUE;
 	}
-	return handled;
+
+	return FALSE;
 }
 
 
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index d18cfe85fbb61dd59f567611c1c3c314416f193d..13e7cca464ee881a95a5086d5c5766899ff5155c 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -242,7 +242,7 @@ void LLPreviewTexture::draw()
 			if( mLoadingFullImage )
 			{
 				// *TODO: Translate
-				LLFontGL::sSansSerif->renderUTF8(std::string("Receiving:"), 0,
+				LLFontGL::getFontSansSerif()->renderUTF8(std::string("Receiving:"), 0,
 					interior.mLeft + 4, 
 					interior.mBottom + 4,
 					LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM,
@@ -279,7 +279,7 @@ void LLPreviewTexture::draw()
 			if( !mSavedFileTimer.hasExpired() )
 			{
 				// *TODO: Translate
-				LLFontGL::sSansSerif->renderUTF8(std::string("File Saved"), 0,
+				LLFontGL::getFontSansSerif()->renderUTF8(std::string("File Saved"), 0,
 					interior.mLeft + 4,
 					interior.mBottom + 4,
 					LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM,
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 36304a71912ce3fe4a02cc4980fd103a4386246d..5f96fc7da06f177bba2fe61f9c56636b24a49176 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -135,6 +135,7 @@
 #include "llsrv.h"
 #include "llstatview.h"
 #include "lltrans.h"
+#include "llstatusbar.h"		// sendMoneyBalanceRequest(), owns L$ balance
 #include "llsurface.h"
 #include "lltexturecache.h"
 #include "lltexturefetch.h"
@@ -1676,11 +1677,14 @@ bool idle_startup()
 		gLoginMenuBarView->setVisible( FALSE );
 		gLoginMenuBarView->setEnabled( FALSE );
 
-		gFloaterMap->setVisible( gSavedSettings.getBOOL("ShowMiniMap") );
-
 		LLRect window(0, gViewerWindow->getWindowHeight(), gViewerWindow->getWindowWidth(), 0);
 		gViewerWindow->adjustControlRectanglesForFirstUse(window);
 
+		if(gSavedSettings.getBOOL("ShowMiniMap"))
+		{
+			LLFloaterMap::showInstance();
+		}
+
 		if (gSavedSettings.getBOOL("ShowCameraControls"))
 		{
 			LLFloaterCamera::showInstance();
@@ -1708,7 +1712,10 @@ bool idle_startup()
 			LLError::logToFixedBuffer(gDebugView->mDebugConsolep);
 			// set initial visibility of debug console
 			gDebugView->mDebugConsolep->setVisible(gSavedSettings.getBOOL("ShowDebugConsole"));
-			gDebugView->mFloaterStatsp->setVisible(gSavedSettings.getBOOL("ShowDebugStats"));
+			if (gSavedSettings.getBOOL("ShowDebugStats"))
+			{
+				LLFloaterStats::showInstance();
+			}
 		}
 
 		//
@@ -1774,9 +1781,8 @@ bool idle_startup()
 			gFrameIntervalSeconds = 0.f;
 		}
 
-		// Initialize FOV
-		LLViewerCamera::getInstance()->setView(gSavedSettings.getF32("CameraAngle")); 
 		// Make sure agent knows correct aspect ratio
+		// FOV limits depend upon aspect ratio so this needs to happen before initializing the FOV below
 		LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWindowDisplayHeight());
 		if (gViewerWindow->mWindow->getFullscreen())
 		{
@@ -1786,6 +1792,8 @@ bool idle_startup()
 		{
 			LLViewerCamera::getInstance()->setAspect( (F32) gViewerWindow->getWindowWidth() / (F32) gViewerWindow->getWindowHeight());
 		}
+		// Initialize FOV
+		LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("CameraAngle")); 
 
 		// Move agent to starting location. The position handed to us by
 		// the space server is in global coordinates, but the agent frame
@@ -2115,13 +2123,7 @@ bool idle_startup()
 
 		// Get L$ and ownership credit information
 		llinfos << "Requesting Money Balance" << llendl;
-		msg->newMessageFast(_PREHASH_MoneyBalanceRequest);
-		msg->nextBlockFast(_PREHASH_AgentData);
-		msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
-		msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
-		msg->nextBlockFast(_PREHASH_MoneyData);
-		msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null );
-		gAgent.sendReliableMessage();
+		LLStatusBar::sendMoneyBalanceRequest();
 
 		// request all group information
 		llinfos << "Requesting Agent Data" << llendl;
@@ -3185,570 +3187,6 @@ void init_stat_view()
 	LLFrameStatView *frameviewp = gDebugView->mFrameStatView;
 	frameviewp->setup(gFrameStats);
 	frameviewp->mShowPercent = FALSE;
-
-	LLRect rect;
-	LLStatBar *stat_barp;
-	rect = gDebugView->mFloaterStatsp->getRect();
-
-	//
-	// Viewer advanced stats
-	//
-	LLStatView *stat_viewp = NULL;
-
-	//
-	// Viewer Basic
-	//
-	stat_viewp = new LLStatView("basic stat view", "Basic",	"OpenDebugStatBasic", rect);
-	gDebugView->mFloaterStatsp->addStatView(stat_viewp);
-
-	stat_barp = stat_viewp->addStat("FPS", &(LLViewerStats::getInstance()->mFPSStat));
-	stat_barp->setUnitLabel(" fps");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 45.f;
-	stat_barp->mTickSpacing = 7.5f;
-	stat_barp->mLabelSpacing = 15.f;
-	stat_barp->mPrecision = 1;
-	stat_barp->mDisplayBar = TRUE;
-	stat_barp->mDisplayHistory = TRUE;
-
-	stat_barp = stat_viewp->addStat("Bandwidth", &(LLViewerStats::getInstance()->mKBitStat));
-	stat_barp->setUnitLabel(" kbps");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 900.f;
-	stat_barp->mTickSpacing = 100.f;
-	stat_barp->mLabelSpacing = 300.f;
-	stat_barp->mDisplayBar = TRUE;
-	stat_barp->mDisplayHistory = FALSE;
-
-	stat_barp = stat_viewp->addStat("Packet Loss", &(LLViewerStats::getInstance()->mPacketsLostPercentStat));
-	stat_barp->setUnitLabel(" %");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 5.f;
-	stat_barp->mTickSpacing = 1.f;
-	stat_barp->mLabelSpacing = 1.f;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayMean = TRUE;
-	stat_barp->mPrecision = 1;
-
-	stat_barp = stat_viewp->addStat("Ping Sim", &(LLViewerStats::getInstance()->mSimPingStat));
-	stat_barp->setUnitLabel(" msec");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 1000.f;
-	stat_barp->mTickSpacing = 100.f;
-	stat_barp->mLabelSpacing = 200.f;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-
-	stat_viewp = new LLStatView("advanced stat view", "Advanced", "OpenDebugStatAdvanced", rect);
-	gDebugView->mFloaterStatsp->addStatView(stat_viewp);
-
-
-	LLStatView *render_statviewp;
-	render_statviewp = new LLStatView("render stat view", "Render", "OpenDebugStatRender", rect);
-	stat_viewp->addChildAtEnd(render_statviewp);
-
-	stat_barp = render_statviewp->addStat("KTris Drawn", &(gPipeline.mTrianglesDrawnStat));
-	stat_barp->setUnitLabel("/fr");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 500.f;
-	stat_barp->mTickSpacing = 100.f;
-	stat_barp->mLabelSpacing = 500.f;
-	stat_barp->mPrecision = 1;
-	stat_barp->mPerSec = FALSE;
-
-	stat_barp = render_statviewp->addStat("KTris Drawn", &(gPipeline.mTrianglesDrawnStat));
-	stat_barp->setUnitLabel("/sec");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 3000.f;
-	stat_barp->mTickSpacing = 250.f;
-	stat_barp->mLabelSpacing = 1000.f;
-	stat_barp->mPrecision = 1;
-
-	stat_barp = render_statviewp->addStat("Total Objs", &(gObjectList.mNumObjectsStat));
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 10000.f;
-	stat_barp->mTickSpacing = 2500.f;
-	stat_barp->mLabelSpacing = 5000.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-
-	stat_barp = render_statviewp->addStat("New Objs", &(gObjectList.mNumNewObjectsStat));
-	stat_barp->setLabel("New Objs");
-	stat_barp->setUnitLabel("/sec");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 1000.f;
-	stat_barp->mTickSpacing = 100.f;
-	stat_barp->mLabelSpacing = 500.f;
-	stat_barp->mPerSec = TRUE;
-	stat_barp->mDisplayBar = FALSE;
-
-
-	// Texture statistics
-	LLStatView *texture_statviewp;
-	texture_statviewp = new LLStatView("texture stat view", "Texture", "", rect);
-	render_statviewp->addChildAtEnd(texture_statviewp);
-
-	stat_barp = texture_statviewp->addStat("Count", &(gImageList.sNumImagesStat));
-	stat_barp->setUnitLabel("");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 8000.f;
-	stat_barp->mTickSpacing = 2000.f;
-	stat_barp->mLabelSpacing = 4000.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-
-	stat_barp = texture_statviewp->addStat("Raw Count", &(gImageList.sNumRawImagesStat));
-	stat_barp->setUnitLabel("");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 8000.f;
-	stat_barp->mTickSpacing = 2000.f;
-	stat_barp->mLabelSpacing = 4000.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-
-	stat_barp = texture_statviewp->addStat("GL Mem", &(gImageList.sGLTexMemStat));
-	stat_barp->setUnitLabel("");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 400.f;
-	stat_barp->mTickSpacing = 100.f;
-	stat_barp->mLabelSpacing = 200.f;
-	stat_barp->mPrecision = 1;
-	stat_barp->mPerSec = FALSE;
-
-	stat_barp = texture_statviewp->addStat("Formatted Mem", &(gImageList.sFormattedMemStat));
-	stat_barp->setUnitLabel("");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 400.f;
-	stat_barp->mTickSpacing = 100.f;
-	stat_barp->mLabelSpacing = 200.f;
-	stat_barp->mPrecision = 1;
-	stat_barp->mPerSec = FALSE;
-
-	stat_barp = texture_statviewp->addStat("Raw Mem", &(gImageList.sRawMemStat));
-	stat_barp->setUnitLabel("");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 400.f;
-	stat_barp->mTickSpacing = 100.f;
-	stat_barp->mLabelSpacing = 200.f;
-	stat_barp->mPrecision = 1;
-	stat_barp->mPerSec = FALSE;
-
-	stat_barp = texture_statviewp->addStat("Bound Mem", &(gImageList.sGLBoundMemStat));
-	stat_barp->setUnitLabel("");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 400.f;
-	stat_barp->mTickSpacing = 100.f;
-	stat_barp->mLabelSpacing = 200.f;
-	stat_barp->mPrecision = 1;
-	stat_barp->mPerSec = FALSE;
-
-	
-	// Network statistics
-	LLStatView *net_statviewp;
-	net_statviewp = new LLStatView("network stat view", "Network", "OpenDebugStatNet", rect);
-	stat_viewp->addChildAtEnd(net_statviewp);
-
-	stat_barp = net_statviewp->addStat("Packets In", &(LLViewerStats::getInstance()->mPacketsInStat));
-	stat_barp->setUnitLabel("/sec");
-	stat_barp->mDisplayBar = FALSE;
-
-	stat_barp = net_statviewp->addStat("Packets Out", &(LLViewerStats::getInstance()->mPacketsOutStat));
-	stat_barp->setUnitLabel("/sec");
-	stat_barp->mDisplayBar = FALSE;
-
-	stat_barp = net_statviewp->addStat("Objects", &(LLViewerStats::getInstance()->mObjectKBitStat));
-	stat_barp->setUnitLabel(" kbps");
-	stat_barp->mDisplayBar = FALSE;
-
-	stat_barp = net_statviewp->addStat("Texture", &(LLViewerStats::getInstance()->mTextureKBitStat));
-	stat_barp->setUnitLabel(" kbps");
-	stat_barp->mDisplayBar = FALSE;
-
-	stat_barp = net_statviewp->addStat("Asset", &(LLViewerStats::getInstance()->mAssetKBitStat));
-	stat_barp->setUnitLabel(" kbps");
-	stat_barp->mDisplayBar = FALSE;
-
-	stat_barp = net_statviewp->addStat("Layers", &(LLViewerStats::getInstance()->mLayersKBitStat));
-	stat_barp->setUnitLabel(" kbps");
-	stat_barp->mDisplayBar = FALSE;
-
-	stat_barp = net_statviewp->addStat("Actual In", &(LLViewerStats::getInstance()->mActualInKBitStat));
-	stat_barp->setUnitLabel(" kbps");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 1024.f;
-	stat_barp->mTickSpacing = 128.f;
-	stat_barp->mLabelSpacing = 256.f;
-	stat_barp->mDisplayBar = TRUE;
-	stat_barp->mDisplayHistory = FALSE;
-
-	stat_barp = net_statviewp->addStat("Actual Out", &(LLViewerStats::getInstance()->mActualOutKBitStat));
-	stat_barp->setUnitLabel(" kbps");
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 512.f;
-	stat_barp->mTickSpacing = 128.f;
-	stat_barp->mLabelSpacing = 256.f;
-	stat_barp->mDisplayBar = TRUE;
-	stat_barp->mDisplayHistory = FALSE;
-
-	stat_barp = net_statviewp->addStat("VFS Pending Ops", &(LLViewerStats::getInstance()->mVFSPendingOperations));
-	stat_barp->setUnitLabel(" ");
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-
-
-	// Simulator stats
-	LLStatView *sim_statviewp = new LLStatView("sim stat view", "Simulator", "OpenDebugStatSim", rect);
-	gDebugView->mFloaterStatsp->addStatView(sim_statviewp);
-
-	stat_barp = sim_statviewp->addStat("Time Dilation", &(LLViewerStats::getInstance()->mSimTimeDilation));
-	stat_barp->mPrecision = 2;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 1.f;
-	stat_barp->mTickSpacing = 0.25f;
-	stat_barp->mLabelSpacing = 0.5f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Sim FPS", &(LLViewerStats::getInstance()->mSimFPS));
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 200.f;
-	stat_barp->mTickSpacing = 20.f;
-	stat_barp->mLabelSpacing = 100.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Physics FPS", &(LLViewerStats::getInstance()->mSimPhysicsFPS));
-	stat_barp->mPrecision = 1;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 66.f;
-	stat_barp->mTickSpacing = 33.f;
-	stat_barp->mLabelSpacing = 33.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	LLStatView *phys_details_viewp;
-	phys_details_viewp = new LLStatView("phys detail view", "Physics Details", "", rect);
-	sim_statviewp->addChildAtEnd(phys_details_viewp);
-
-	stat_barp = phys_details_viewp->addStat("Pinned Objects", &(LLViewerStats::getInstance()->mPhysicsPinnedTasks));
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 500.f;
-	stat_barp->mTickSpacing = 10.f;
-	stat_barp->mLabelSpacing = 40.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = phys_details_viewp->addStat("Low LOD Objects", &(LLViewerStats::getInstance()->mPhysicsLODTasks));
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 500.f;
-	stat_barp->mTickSpacing = 10.f;
-	stat_barp->mLabelSpacing = 40.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = phys_details_viewp->addStat("Memory Allocated", &(LLViewerStats::getInstance()->mPhysicsMemoryAllocated));
-	stat_barp->setUnitLabel(" MB");
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 1024.f;
-	stat_barp->mTickSpacing = 128.f;
-	stat_barp->mLabelSpacing = 256.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Agent Updates/Sec", &(LLViewerStats::getInstance()->mSimAgentUPS));
-	stat_barp->mPrecision = 1;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 100.f;
-	stat_barp->mTickSpacing = 25.f;
-	stat_barp->mLabelSpacing = 50.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Main Agents", &(LLViewerStats::getInstance()->mSimMainAgents));
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 80.f;
-	stat_barp->mTickSpacing = 10.f;
-	stat_barp->mLabelSpacing = 40.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Child Agents", &(LLViewerStats::getInstance()->mSimChildAgents));
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 40.f;
-	stat_barp->mTickSpacing = 5.f;
-	stat_barp->mLabelSpacing = 10.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Objects", &(LLViewerStats::getInstance()->mSimObjects));
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 30000.f;
-	stat_barp->mTickSpacing = 5000.f;
-	stat_barp->mLabelSpacing = 10000.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Active Objects", &(LLViewerStats::getInstance()->mSimActiveObjects));
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 800.f;
-	stat_barp->mTickSpacing = 100.f;
-	stat_barp->mLabelSpacing = 200.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Active Scripts", &(LLViewerStats::getInstance()->mSimActiveScripts));
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 800.f;
-	stat_barp->mTickSpacing = 100.f;
-	stat_barp->mLabelSpacing = 200.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Script Events", &(LLViewerStats::getInstance()->mSimScriptEPS));
-	stat_barp->setUnitLabel(" eps");
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 20000.f;
-	stat_barp->mTickSpacing = 2500.f;
-	stat_barp->mLabelSpacing = 5000.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Packets In", &(LLViewerStats::getInstance()->mSimInPPS));
-	stat_barp->setUnitLabel(" pps");
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 2000.f;
-	stat_barp->mTickSpacing = 250.f;
-	stat_barp->mLabelSpacing = 1000.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Packets Out", &(LLViewerStats::getInstance()->mSimOutPPS));
-	stat_barp->setUnitLabel(" pps");
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 2000.f;
-	stat_barp->mTickSpacing = 250.f;
-	stat_barp->mLabelSpacing = 1000.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Pending Downloads", &(LLViewerStats::getInstance()->mSimPendingDownloads));
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 800.f;
-	stat_barp->mTickSpacing = 100.f;
-	stat_barp->mLabelSpacing = 200.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Pending Uploads", &(LLViewerStats::getInstance()->mSimPendingUploads));
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 100.f;
-	stat_barp->mTickSpacing = 25.f;
-	stat_barp->mLabelSpacing = 50.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_statviewp->addStat("Total Unacked Bytes", &(LLViewerStats::getInstance()->mSimTotalUnackedBytes));
-	stat_barp->setUnitLabel(" kb");
-	stat_barp->mPrecision = 0;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 100000.f;
-	stat_barp->mTickSpacing = 25000.f;
-	stat_barp->mLabelSpacing = 50000.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	LLStatView *sim_time_viewp;
-	sim_time_viewp = new LLStatView("sim perf view", "Time (ms)", "", rect);
-	sim_statviewp->addChildAtEnd(sim_time_viewp);
-
-	stat_barp = sim_time_viewp->addStat("Total Frame Time", &(LLViewerStats::getInstance()->mSimFrameMsec));
-	stat_barp->setUnitLabel("ms");
-	stat_barp->mPrecision = 1;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 40.f;
-	stat_barp->mTickSpacing = 10.f;
-	stat_barp->mLabelSpacing = 20.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_time_viewp->addStat("Net Time", &(LLViewerStats::getInstance()->mSimNetMsec));
-	stat_barp->setUnitLabel("ms");
-	stat_barp->mPrecision = 1;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 40.f;
-	stat_barp->mTickSpacing = 10.f;
-	stat_barp->mLabelSpacing = 20.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_time_viewp->addStat("Physics Time", &(LLViewerStats::getInstance()->mSimSimPhysicsMsec));
-	stat_barp->setUnitLabel("ms");
-	stat_barp->mPrecision = 1;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 40.f;
-	stat_barp->mTickSpacing = 10.f;
-	stat_barp->mLabelSpacing = 20.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_time_viewp->addStat("Simulation Time", &(LLViewerStats::getInstance()->mSimSimOtherMsec));
-	stat_barp->setUnitLabel("ms");
-	stat_barp->mPrecision = 1;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 40.f;
-	stat_barp->mTickSpacing = 10.f;
-	stat_barp->mLabelSpacing = 20.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_time_viewp->addStat("Agent Time", &(LLViewerStats::getInstance()->mSimAgentMsec));
-	stat_barp->setUnitLabel("ms");
-	stat_barp->mPrecision = 1;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 40.f;
-	stat_barp->mTickSpacing = 10.f;
-	stat_barp->mLabelSpacing = 20.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_time_viewp->addStat("Images Time", &(LLViewerStats::getInstance()->mSimImagesMsec));
-	stat_barp->setUnitLabel("ms");
-	stat_barp->mPrecision = 1;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 40.f;
-	stat_barp->mTickSpacing = 10.f;
-	stat_barp->mLabelSpacing = 20.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_time_viewp->addStat("Script Time", &(LLViewerStats::getInstance()->mSimScriptMsec));
-	stat_barp->setUnitLabel("ms");
-	stat_barp->mPrecision = 1;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 40.f;
-	stat_barp->mTickSpacing = 10.f;
-	stat_barp->mLabelSpacing = 20.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	stat_barp = sim_time_viewp->addStat("Spare Time", &(LLViewerStats::getInstance()->mSimSpareMsec));
-	stat_barp->setUnitLabel("ms");
-	stat_barp->mPrecision = 1;
-	stat_barp->mMinBar = 0.f;
-	stat_barp->mMaxBar = 40.f;
-	stat_barp->mTickSpacing = 10.f;
-	stat_barp->mLabelSpacing = 20.f;
-	stat_barp->mPerSec = FALSE;
-	stat_barp->mDisplayBar = FALSE;
-	stat_barp->mDisplayMean = FALSE;
-
-	
-	// 2nd level time blocks under 'Details' second
-	LLStatView *detailed_time_viewp;
-	detailed_time_viewp = new LLStatView("sim perf view", "Time Details (ms)", "", rect);
-	sim_time_viewp->addChildAtEnd(detailed_time_viewp);
-	{
-		stat_barp = detailed_time_viewp->addStat("  Physics Step", &(LLViewerStats::getInstance()->mSimSimPhysicsStepMsec));
-		stat_barp->setUnitLabel("ms");
-		stat_barp->mPrecision = 1;
-		stat_barp->mMinBar = 0.f;
-		stat_barp->mMaxBar = 40.f;
-		stat_barp->mTickSpacing = 10.f;
-		stat_barp->mLabelSpacing = 20.f;
-		stat_barp->mPerSec = FALSE;
-		stat_barp->mDisplayBar = FALSE;
-		stat_barp->mDisplayMean = FALSE;
-
-		stat_barp = detailed_time_viewp->addStat("  Update Physics Shapes", &(LLViewerStats::getInstance()->mSimSimPhysicsShapeUpdateMsec));
-		stat_barp->setUnitLabel("ms");
-		stat_barp->mPrecision = 1;
-		stat_barp->mMinBar = 0.f;
-		stat_barp->mMaxBar = 40.f;
-		stat_barp->mTickSpacing = 10.f;
-		stat_barp->mLabelSpacing = 20.f;
-		stat_barp->mPerSec = FALSE;
-		stat_barp->mDisplayBar = FALSE;
-		stat_barp->mDisplayMean = FALSE;
-
-		stat_barp = detailed_time_viewp->addStat("  Physics Other", &(LLViewerStats::getInstance()->mSimSimPhysicsOtherMsec));
-		stat_barp->setUnitLabel("ms");
-		stat_barp->mPrecision = 1;
-		stat_barp->mMinBar = 0.f;
-		stat_barp->mMaxBar = 40.f;
-		stat_barp->mTickSpacing = 10.f;
-		stat_barp->mLabelSpacing = 20.f;
-		stat_barp->mPerSec = FALSE;
-		stat_barp->mDisplayBar = FALSE;
-		stat_barp->mDisplayMean = FALSE;
-
-		stat_barp = detailed_time_viewp->addStat("  Sleep Time", &(LLViewerStats::getInstance()->mSimSleepMsec));
-		stat_barp->setUnitLabel("ms");
-		stat_barp->mPrecision = 1;
-		stat_barp->mMinBar = 0.f;
-		stat_barp->mMaxBar = 40.f;
-		stat_barp->mTickSpacing = 10.f;
-		stat_barp->mLabelSpacing = 20.f;
-		stat_barp->mPerSec = FALSE;
-		stat_barp->mDisplayBar = FALSE;
-		stat_barp->mDisplayMean = FALSE;
-
-		stat_barp = detailed_time_viewp->addStat("  Pump IO", &(LLViewerStats::getInstance()->mSimPumpIOMsec));
-		stat_barp->setUnitLabel("ms");
-		stat_barp->mPrecision = 1;
-		stat_barp->mMinBar = 0.f;
-		stat_barp->mMaxBar = 40.f;
-		stat_barp->mTickSpacing = 10.f;
-		stat_barp->mLabelSpacing = 20.f;
-		stat_barp->mPerSec = FALSE;
-		stat_barp->mDisplayBar = FALSE;
-		stat_barp->mDisplayMean = FALSE;
-	}
-
-	LLRect r = gDebugView->mFloaterStatsp->getRect();
-
-	// Reshape based on the parameters we set.
-	gDebugView->mFloaterStatsp->reshape(r.getWidth(), r.getHeight());
 }
 
 void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S32)
@@ -3947,8 +3385,7 @@ void reset_login()
 	}
 
 	// Hide any other stuff
-	if ( gFloaterMap )
-		gFloaterMap->setVisible( FALSE );
+	LLFloaterMap::hideInstance();
 }
 
 //---------------------------------------------------------------------------
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 35e86c63502f32a984b2fdc178a259616182c9a3..971930d7eefcae507f50bad502bd7151a94d7df2 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -34,18 +34,10 @@
 
 #include "llstatusbar.h"
 
-#include <iomanip>
-
-#include "imageids.h"
-#include "llfontgl.h"
-#include "llrect.h"
-#include "llerror.h"
-#include "llparcel.h"
-#include "llstring.h"
-#include "message.h"
-
+// viewer includes
 #include "llagent.h"
 #include "llbutton.h"
+#include "llcommandhandler.h"
 #include "llviewercontrol.h"
 #include "llfloaterbuycurrency.h"
 #include "llfloaterchat.h"
@@ -82,7 +74,18 @@
 #include "llfocusmgr.h"
 #include "llappviewer.h"
 
-//#include "llfirstuse.h"
+// library includes
+#include "imageids.h"
+#include "llfontgl.h"
+#include "llrect.h"
+#include "llerror.h"
+#include "llparcel.h"
+#include "llstring.h"
+#include "message.h"
+
+// system includes
+#include <iomanip>
+
 
 //
 // Globals
@@ -349,7 +352,7 @@ void LLStatusBar::refresh()
 		childSetRect("health", r);
 		x += buttonRect.getWidth();
 
-		const S32 health_width = S32( LLFontGL::sSansSerifSmall->getWidth(std::string("100%")) );
+		const S32 health_width = S32( LLFontGL::getFontSansSerifSmall()->getWidth(std::string("100%")) );
 		r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y);
 		mTextHealth->setRect(r);
 		x += health_width;
@@ -678,6 +681,21 @@ void LLStatusBar::setBalance(S32 balance)
 	}
 }
 
+
+// static
+void LLStatusBar::sendMoneyBalanceRequest()
+{
+	LLMessageSystem* msg = gMessageSystem;
+	msg->newMessageFast(_PREHASH_MoneyBalanceRequest);
+	msg->nextBlockFast(_PREHASH_AgentData);
+	msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+	msg->nextBlockFast(_PREHASH_MoneyData);
+	msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null );
+	gAgent.sendReliableMessage();
+}
+
+
 void LLStatusBar::setHealth(S32 health)
 {
 	//llinfos << "Setting health to: " << buffer << llendl;
@@ -907,3 +925,25 @@ BOOL can_afford_transaction(S32 cost)
 {
 	return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost)));
 }
+
+
+// Implements secondlife:///app/balance/request to request a L$ balance
+// update via UDP message system. JC
+class LLBalanceHandler : public LLCommandHandler
+{
+public:
+	// Requires "trusted" browser/URL source
+	LLBalanceHandler() : LLCommandHandler("balance", true) { }
+	bool handle(const LLSD& tokens, const LLSD& query_map, LLWebBrowserCtrl* web)
+	{
+		if (tokens.size() == 1
+			&& tokens[0].asString() == "request")
+		{
+			LLStatusBar::sendMoneyBalanceRequest();
+			return true;
+		}
+		return false;
+	}
+};
+// register with command dispatch system
+LLBalanceHandler gBalanceHandler;
diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h
index c17e6fd1ec24fde4ffba101fe9c17f3b7fd24be2..c5b4be035ab5a18e6f050e41973fbed8ab5f6aba 100644
--- a/indra/newview/llstatusbar.h
+++ b/indra/newview/llstatusbar.h
@@ -96,6 +96,9 @@ public:
 	void		debitBalance(S32 debit);
 	void		creditBalance(S32 credit);
 
+	// Request the latest currency balance from the server
+	static void sendMoneyBalanceRequest();
+
 	void		setHealth(S32 percent);
 
 	void setLandCredit(S32 credit);
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 9820d20512b8d586c304cc97fbfd39b740ecb685..dc34c5ad37ed9c47547a878f218eb37839469a91 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -926,21 +926,21 @@ LLTextureCtrl::LLTextureCtrl(
 	mCaption = new LLTextBox( label, 
 		LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ),
 		label,
-		LLFontGL::sSansSerifSmall );
+		LLFontGL::getFontSansSerifSmall() );
 	mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM );
 	addChild( mCaption );
 
 	S32 image_top = getRect().getHeight();
 	S32 image_bottom = BTN_HEIGHT_SMALL;
 	S32 image_middle = (image_top + image_bottom) / 2;
-	S32 line_height = llround(LLFontGL::sSansSerifSmall->getLineHeight());
+	S32 line_height = llround(LLFontGL::getFontSansSerifSmall()->getLineHeight());
 
 	mTentativeLabel = new LLTextBox( std::string("Multiple"), 
 		LLRect( 
 			0, image_middle + line_height / 2,
 			getRect().getWidth(), image_middle - line_height / 2 ),
 		std::string("Multiple"),
-		LLFontGL::sSansSerifSmall );
+		LLFontGL::getFontSansSerifSmall() );
 	mTentativeLabel->setHAlign( LLFontGL::HCENTER );
 	mTentativeLabel->setFollowsAll();
 	addChild( mTentativeLabel );
@@ -1355,7 +1355,7 @@ void LLTextureCtrl::draw()
 		 (mTexturep->getDiscardLevel() != 1) &&
 		 (mTexturep->getDiscardLevel() != 0))
 	{
-		LLFontGL* font = LLFontGL::sSansSerifBig;
+		LLFontGL* font = LLFontGL::getFontSansSerifBig();
 		font->renderUTF8(
 			mLoadingPlaceholderString, 0,
 			llfloor(interior.mLeft+10), 
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
index ab7d70d20ed763f277458fabfa5975524e50ddef..f00d5e5b48d0a6dbb233516a8db4b6a0094a82ca 100644
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -209,7 +209,7 @@ void LLTextureBar::draw()
 						   mImagep->mFetchPriority);
 	}
 
-	LLFontGL::sMonospace->renderUTF8(tex_str, 0, title_x1, getRect().getHeight(),
+	LLFontGL::getFontMonospace()->renderUTF8(tex_str, 0, title_x1, getRect().getHeight(),
 									 color, LLFontGL::LEFT, LLFontGL::TOP);
 
 	// State
@@ -245,7 +245,7 @@ void LLTextureBar::draw()
 		mImagep->mFetchState;
 	state = llclamp(state,0,fetch_state_desc_size-1);
 
-	LLFontGL::sMonospace->renderUTF8(fetch_state_desc[state].desc, 0, title_x2, getRect().getHeight(),
+	LLFontGL::getFontMonospace()->renderUTF8(fetch_state_desc[state].desc, 0, title_x2, getRect().getHeight(),
 									 fetch_state_desc[state].color,
 									 LLFontGL::LEFT, LLFontGL::TOP);
 	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -327,7 +327,7 @@ void LLTextureBar::draw()
 		// draw the packet data
 // 		{
 // 			std::string num_str = llformat("%3d/%3d", mImagep->mLastPacket+1, mImagep->mPackets);
-// 			LLFontGL::sMonospace->renderUTF8(num_str, 0, bar_left + 100, getRect().getHeight(), color,
+// 			LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, bar_left + 100, getRect().getHeight(), color,
 // 											 LLFontGL::LEFT, LLFontGL::TOP);
 // 		}
 		
@@ -335,7 +335,7 @@ void LLTextureBar::draw()
 		{
 			std::string num_str = llformat("%3dx%3d (%d) %7d", mImagep->getWidth(), mImagep->getHeight(),
 										mImagep->getDiscardLevel(), mImagep->mTextureMemory);
-			LLFontGL::sMonospace->renderUTF8(num_str, 0, title_x4, getRect().getHeight(), color,
+			LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, title_x4, getRect().getHeight(), color,
 											LLFontGL::LEFT, LLFontGL::TOP);
 		}
 	}
@@ -370,7 +370,7 @@ public:
 		: LLView(name, FALSE),
 		  mTextureView(texview)
 	{
-		S32 line_height = (S32)(LLFontGL::sMonospace->getLineHeight() + .5f);
+		S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
 		setRect(LLRect(0,0,100,line_height * 4));
 	}
 
@@ -389,7 +389,7 @@ void LLGLTexMemBar::draw()
 	S32 total_mem = (LLViewerImage::sTotalTextureMemory >> 20);
 	S32 max_total_mem = LLViewerImage::sMaxTotalTextureMem;
 	F32 discard_bias = LLViewerImage::sDesiredDiscardBias;
-	S32 line_height = (S32)(LLFontGL::sMonospace->getLineHeight() + .5f);
+	S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
 	
 	//----------------------------------------------------------------------------
 	LLGLSUIDefault gls_ui;
@@ -403,7 +403,7 @@ void LLGLTexMemBar::draw()
 					max_bound_mem,
 					discard_bias);
 
-	LLFontGL::sMonospace->renderUTF8(text, 0, 0, line_height*3,
+	LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, line_height*3,
 									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
 
 	//----------------------------------------------------------------------------
@@ -470,40 +470,40 @@ void LLGLTexMemBar::draw()
 					LLImageRaw::sRawImageCount, LLViewerImage::sRawCount, LLViewerImage::sAuxCount,
 					gImageList.mCallbackList.size());
 
-	LLFontGL::sMonospace->renderUTF8(text, 0, 0, line_height*2,
+	LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, line_height*2,
 									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
 	
 	S32 dx1 = 0;
 	if (LLAppViewer::getTextureFetch()->mDebugPause)
 	{
-		LLFontGL::sMonospace->renderUTF8(std::string("!"), 0, title_x1, line_height,
+		LLFontGL::getFontMonospace()->renderUTF8(std::string("!"), 0, title_x1, line_height,
 										 text_color, LLFontGL::LEFT, LLFontGL::TOP);
 		dx1 += 8;
 	}
 	if (mTextureView->mFreezeView)
 	{
-		LLFontGL::sMonospace->renderUTF8(std::string("*"), 0, title_x1, line_height,
+		LLFontGL::getFontMonospace()->renderUTF8(std::string("*"), 0, title_x1, line_height,
 										 text_color, LLFontGL::LEFT, LLFontGL::TOP);
 		dx1 += 8;
 	}
 	if (mTextureView->mOrderFetch)
 	{
-		LLFontGL::sMonospace->renderUTF8(title_string1b, 0, title_x1+dx1, line_height,
+		LLFontGL::getFontMonospace()->renderUTF8(title_string1b, 0, title_x1+dx1, line_height,
 										 text_color, LLFontGL::LEFT, LLFontGL::TOP);
 	}
 	else
 	{	
-		LLFontGL::sMonospace->renderUTF8(title_string1a, 0, title_x1+dx1, line_height,
+		LLFontGL::getFontMonospace()->renderUTF8(title_string1a, 0, title_x1+dx1, line_height,
 										 text_color, LLFontGL::LEFT, LLFontGL::TOP);
 	}
 	
-	LLFontGL::sMonospace->renderUTF8(title_string2, 0, title_x2, line_height,
+	LLFontGL::getFontMonospace()->renderUTF8(title_string2, 0, title_x2, line_height,
 									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
 
-	LLFontGL::sMonospace->renderUTF8(title_string3, 0, title_x3, line_height,
+	LLFontGL::getFontMonospace()->renderUTF8(title_string3, 0, title_x3, line_height,
 									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
 
-	LLFontGL::sMonospace->renderUTF8(title_string4, 0, title_x4, line_height,
+	LLFontGL::getFontMonospace()->renderUTF8(title_string4, 0, title_x4, line_height,
 									 text_color, LLFontGL::LEFT, LLFontGL::TOP);
 }
 
diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp
index 015db69d1e4d68a29ca3a57c70048b7bdd9717b6..c42693d03fb56da80f19bd4e62e86618129fe3b3 100644
--- a/indra/newview/lltoolbrush.cpp
+++ b/indra/newview/lltoolbrush.cpp
@@ -97,7 +97,24 @@ LLToolBrushLand::LLToolBrushLand()
 	mGotHover(FALSE),
 	mBrushSelected(FALSE)
 {
-	mBrushIndex = gSavedSettings.getS32("RadioLandBrushSize");
+	mBrushSize = gSavedSettings.getF32("LandBrushSize");
+}
+
+
+U8 LLToolBrushLand::getBrushIndex()
+{
+	// find the best index for desired size
+	// (compatibility with old sims, brush_index is now depricated - DEV-8252)
+	U8 index = 0;
+	for (U8 i = 0; i < LAND_BRUSH_SIZE_COUNT; i++)
+	{
+		if (mBrushSize > LAND_BRUSH_SIZE[i])
+		{
+			index = i;
+		}
+	}
+
+	return index;
 }
 
 void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global,
@@ -158,7 +175,6 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global,
 		F32 seconds = (1.0f / gFPSClamped) * gSavedSettings.getF32("LandBrushForce");
 		F32 x_pos = (F32)pos_region.mV[VX];
 		F32 y_pos = (F32)pos_region.mV[VY];
-		U8 brush_size = (U8)mBrushIndex;
 		LLMessageSystem* msg = gMessageSystem;
 		msg->newMessageFast(_PREHASH_ModifyLand);
 		msg->nextBlockFast(_PREHASH_AgentData);
@@ -166,7 +182,7 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global,
 		msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
 		msg->nextBlockFast(_PREHASH_ModifyBlock);
 		msg->addU8Fast(_PREHASH_Action, (U8)action);
-		msg->addU8Fast(_PREHASH_BrushSize, brush_size);
+		msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex());
 		msg->addF32Fast(_PREHASH_Seconds, seconds);
 		msg->addF32Fast(_PREHASH_Height, mStartingZ);
 		msg->nextBlockFast(_PREHASH_ParcelData);
@@ -175,6 +191,8 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global,
 		msg->addF32Fast(_PREHASH_South, y_pos );
 		msg->addF32Fast(_PREHASH_East, x_pos );
 		msg->addF32Fast(_PREHASH_North, y_pos );
+		msg->nextBlock("ModifyBlockExtended");
+		msg->addF32("BrushSize", mBrushSize);
 		msg->sendMessage(regionp->getHost());
 	}
 }
@@ -295,7 +313,6 @@ void LLToolBrushLand::modifyLandInSelectionGlobal()
 		regionp->forceUpdate();
 
 		// tell the simulator what we've done
-		U8 brush_size = (U8)mBrushIndex;
 		LLMessageSystem* msg = gMessageSystem;
 		msg->newMessageFast(_PREHASH_ModifyLand);
 		msg->nextBlockFast(_PREHASH_AgentData);
@@ -303,7 +320,7 @@ void LLToolBrushLand::modifyLandInSelectionGlobal()
 		msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
 		msg->nextBlockFast(_PREHASH_ModifyBlock);
 		msg->addU8Fast(_PREHASH_Action, (U8)action);
-		msg->addU8Fast(_PREHASH_BrushSize, brush_size);
+		msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex());
 		msg->addF32Fast(_PREHASH_Seconds, seconds);
 		msg->addF32Fast(_PREHASH_Height, mStartingZ);
 
@@ -328,6 +345,9 @@ void LLToolBrushLand::modifyLandInSelectionGlobal()
 			msg->addF32Fast(_PREHASH_East,  max_region.mV[VX] );
 			msg->addF32Fast(_PREHASH_North, max_region.mV[VY] );
 		}
+		
+		msg->nextBlock("ModifyBlockExtended");
+		msg->addF32("BrushSize", mBrushSize);
 
 		msg->sendMessage(regionp->getHost());
 	}
@@ -448,7 +468,8 @@ void LLToolBrushLand::render()
 			spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 );
 			spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 );
 
-			mBrushIndex = gSavedSettings.getS32("RadioLandBrushSize");
+			mBrushSize = gSavedSettings.getF32("LandBrushSize");
+			
 			region_list_t regions;
 			determineAffectedRegions(regions, spot);
 
@@ -500,7 +521,7 @@ void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region
 	
 	S32 i = (S32) pos_region.mV[VX];
 	S32 j = (S32) pos_region.mV[VY];
-	S32 half_edge = llfloor(LAND_BRUSH_SIZE[mBrushIndex]);
+	S32 half_edge = llfloor(mBrushSize);
 	S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction");
 	F32 force = gSavedSettings.getF32("LandBrushForce"); // .1 to 100?
 	
@@ -557,27 +578,27 @@ void LLToolBrushLand::determineAffectedRegions(region_list_t& regions,
 											   const LLVector3d& spot ) const
 {
 	LLVector3d corner(spot);
-	corner.mdV[VX] -= (LAND_BRUSH_SIZE[mBrushIndex] / 2);
-	corner.mdV[VY] -= (LAND_BRUSH_SIZE[mBrushIndex] / 2);
+	corner.mdV[VX] -= (mBrushSize / 2);
+	corner.mdV[VY] -= (mBrushSize / 2);
 	LLViewerRegion* region = NULL;
 	region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
 	if(region && regions.find(region) == regions.end())
 	{
 		regions.insert(region);
 	}
-	corner.mdV[VY] += LAND_BRUSH_SIZE[mBrushIndex];
+	corner.mdV[VY] += mBrushSize;
 	region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
 	if(region && regions.find(region) == regions.end())
 	{
 		regions.insert(region);
 	}
-	corner.mdV[VX] += LAND_BRUSH_SIZE[mBrushIndex];
+	corner.mdV[VX] += mBrushSize;
 	region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
 	if(region && regions.find(region) == regions.end())
 	{
 		regions.insert(region);
 	}
-	corner.mdV[VY] -= LAND_BRUSH_SIZE[mBrushIndex];
+	corner.mdV[VY] -= mBrushSize;
 	region = LLWorld::getInstance()->getRegionFromPosGlobal(corner);
 	if(region && regions.find(region) == regions.end())
 	{
diff --git a/indra/newview/lltoolbrush.h b/indra/newview/lltoolbrush.h
index 3165753804be26fde13868f753858bd1cd1fb547..fca275aa4d1d081fd6bae77ce29b4879a97ae95d 100644
--- a/indra/newview/lltoolbrush.h
+++ b/indra/newview/lltoolbrush.h
@@ -96,11 +96,14 @@ protected:
 	F32 mStartingZ;
 	S32 mMouseX;
 	S32 mMouseY;
-	S32 mBrushIndex;
+	F32 mBrushSize;
 	BOOL mGotHover;
 	BOOL mBrushSelected;
 	// Order doesn't matter and we do check for existance of regions, so use a set
 	region_list_t mLastAffectedRegions;
+
+private:
+	U8 getBrushIndex();
 };
 
 
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index fcad86e498e1327d2ad4f8fdd0f4789eb3592c14..156093a21a49fb7e67fc5b7d9d921890483a509b 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1547,7 +1547,7 @@ bool LLToolDragAndDrop::handleCopyProtectedItem(const LLSD& notification, const
 // static
 void LLToolDragAndDrop::commitGiveInventoryItem(const LLUUID& to_agent,
 												LLInventoryItem* item,
-												const LLUUID &im_session_id)
+												const LLUUID& im_session_id)
 {
 	if(!item) return;
 	std::string name;
@@ -1597,7 +1597,9 @@ void LLToolDragAndDrop::commitGiveInventoryItem(const LLUUID& to_agent,
 }
 
 void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent,
-											  LLInventoryCategory* cat)
+											  LLInventoryCategory* cat,
+											  const LLUUID& im_session_id)
+
 {
 	if(!cat) return;
 	llinfos << "LLToolDragAndDrop::giveInventoryCategory() - "
@@ -1648,12 +1650,12 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent,
 	{
 		if(0 == giveable.countNoCopy())
 		{
-			LLToolDragAndDrop::commitGiveInventoryCategory(to_agent, cat);
+			LLToolDragAndDrop::commitGiveInventoryCategory(to_agent, cat, im_session_id);
 		}
 		else 
 		{
 			LLGiveInventoryInfo* info = NULL;
-			info = new LLGiveInventoryInfo(to_agent, cat->getUUID());
+			info = new LLGiveInventoryInfo(to_agent, cat->getUUID(), im_session_id);
 			LLSD args;
 			args["COUNT"] = llformat("%d",giveable.countNoCopy());
 			LLSD payload;
@@ -1708,7 +1710,9 @@ bool LLToolDragAndDrop::handleCopyProtectedCategory(const LLSD& notification, co
 
 // static
 void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
-													LLInventoryCategory* cat)
+													LLInventoryCategory* cat,
+													const LLUUID& im_session_id)
+
 {
 	if(!cat) return;
 	llinfos << "LLToolDragAndDrop::commitGiveInventoryCategory() - "
@@ -1799,6 +1803,13 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
 		gFloaterTools->dirty();
 
 		LLMuteList::getInstance()->autoRemove(to_agent, LLMuteList::AR_INVENTORY);
+
+		// If this item was given by drag-and-drop into an IM panel, log this action in the IM panel chat.
+		if (im_session_id != LLUUID::null)
+		{
+			LLSD args;
+			gIMMgr->addSystemMessage(im_session_id, "inventory_item_offered", args);
+		}
 	}
 }
 
@@ -1959,6 +1970,82 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
 	return ACCEPT_NO;
 }
 
+
+// function used as drag-and-drop handler for simple agent give inventory requests
+//static
+bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_id, BOOL drop,
+											  EDragAndDropType cargo_type,
+											  void* cargo_data,
+											  EAcceptance* accept)
+{
+	// check the type
+	switch(cargo_type)
+	{
+	case DAD_TEXTURE:
+	case DAD_SOUND:
+	case DAD_LANDMARK:
+	case DAD_SCRIPT:
+	case DAD_OBJECT:
+	case DAD_NOTECARD:
+	case DAD_CLOTHING:
+	case DAD_BODYPART:
+	case DAD_ANIMATION:
+	case DAD_GESTURE:
+	{
+		LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
+		if(gInventory.getItem(inv_item->getUUID())
+		   && LLToolDragAndDrop::isInventoryGiveAcceptable(inv_item))
+		{
+			// *TODO: get multiple object transfers working
+			*accept = ACCEPT_YES_COPY_SINGLE;
+			if(drop)
+			{
+				LLToolDragAndDrop::giveInventory(dest_agent, inv_item, session_id);
+			}
+		}
+		else
+		{
+			// It's not in the user's inventory (it's probably
+			// in an object's contents), so disallow dragging
+			// it here.  You can't give something you don't
+			// yet have.
+			*accept = ACCEPT_NO;
+		}
+		break;
+	}
+	case DAD_CATEGORY:
+	{
+		LLViewerInventoryCategory* inv_cat = (LLViewerInventoryCategory*)cargo_data;
+		if( gInventory.getCategory( inv_cat->getUUID() ) )
+		{
+			// *TODO: get multiple object transfers working
+			*accept = ACCEPT_YES_COPY_SINGLE;
+			if(drop)
+			{
+				LLToolDragAndDrop::giveInventoryCategory(dest_agent, inv_cat, session_id);
+			}
+		}
+		else
+		{
+			// It's not in the user's inventory (it's probably
+			// in an object's contents), so disallow dragging
+			// it here.  You can't give something you don't
+			// yet have.
+			*accept = ACCEPT_NO;
+		}
+		break;
+	}
+	case DAD_CALLINGCARD:
+	default:
+		*accept = ACCEPT_NO;
+		break;
+	}
+
+	return TRUE;
+}
+
+
+
 ///
 /// Methods called in the drag & drop array
 ///
diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h
index 83e1dc79051fd8a3517426fc26866873d565b2ca..f9e5bec143d1e9ee844a1c6937b3cc3dd5e334a4 100644
--- a/indra/newview/lltooldraganddrop.h
+++ b/indra/newview/lltooldraganddrop.h
@@ -218,7 +218,9 @@ protected:
 	// give inventory category functionality
 	static bool handleCopyProtectedCategory(const LLSD& notification, const LLSD& response);
 	static void commitGiveInventoryCategory(const LLUUID& to_agent,
-						LLInventoryCategory* cat);
+											LLInventoryCategory* cat,
+											const LLUUID &im_session_id = LLUUID::null);
+
 public:
 	// helper functions
 	static BOOL isInventoryDropAcceptable(LLViewerObject* obj, LLInventoryItem* item) { return (ACCEPT_YES_COPY_SINGLE <= willObjectAcceptInventory(obj, item)); }
@@ -257,7 +259,13 @@ public:
 							  LLInventoryItem* item,
 							  const LLUUID &session_id = LLUUID::null);
 	static void giveInventoryCategory(const LLUUID& to_agent,
-									  LLInventoryCategory* item);
+									  LLInventoryCategory* item,
+									  const LLUUID &session_id = LLUUID::null);
+
+	static bool handleGiveDragAndDrop(LLUUID agent, LLUUID session, BOOL drop,
+									  EDragAndDropType cargo_type,
+									  void* cargo_data,
+									  EAcceptance* accept);
 };
 
 // utility functions
diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp
index 7640972d42160d2a6ce0e9afa4c1e21368d1b1ec..88fddd93361c0be276bdd917252c46831fe7b92b 100644
--- a/indra/newview/lltoolplacer.cpp
+++ b/indra/newview/lltoolplacer.cpp
@@ -608,7 +608,7 @@ void LLToolPlacerPanel::addButton( const std::string& up_state, const std::strin
 		down_state,
 		LLStringUtil::null, &LLToolPlacerPanel::setObjectType,
 		pcode,
-		LLFontGL::sSansSerif);
+		LLFontGL::getFontSansSerif());
 	btn->setFollowsBottom();
 	btn->setFollowsLeft();
 	addChild(btn);
diff --git a/indra/newview/lltoolview.cpp b/indra/newview/lltoolview.cpp
index efa6dde6c82fd2988ec9f047618418bed952caea..9f6a77d245a3c4b1d395ff551e8d464db8499b57 100644
--- a/indra/newview/lltoolview.cpp
+++ b/indra/newview/lltoolview.cpp
@@ -93,7 +93,7 @@ LLToolView::~LLToolView()
 // 		"",
 // 		&LLToolView::onClickToolButton,
 // 		contain,
-// 		LLFontGL::sSansSerif);
+// 		LLFontGL::getFontSansSerif());
 
 // 	contain->mPanel = panel;
 // 	contain->mTool = tool;
diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp
index 63ce14229b631039a601a28d7e2a0ef22c386224..8e81152a8920254105c0533a3699fce17320142f 100644
--- a/indra/newview/lltracker.cpp
+++ b/indra/newview/lltracker.cpp
@@ -567,7 +567,7 @@ void LLTracker::renderBeacon(LLVector3d pos_global,
 	wstr += '\n';
 	wstr += utf8str_to_wstring(text);
 
-	hud_textp->setFont(LLFontGL::sSansSerif);
+	hud_textp->setFont(LLFontGL::getFontSansSerif());
 	hud_textp->setZCompare(FALSE);
 	hud_textp->setColor(LLColor4(1.f, 1.f, 1.f, llmax(0.2f, llmin(1.f,(dist-FADE_DIST)/FADE_DIST))));
 
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index c0d3466fabbccd5d92b64dfa6e99248d932b9b24..2c487665d22968fa0a9407a2e8390cc224350e01 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -45,7 +45,6 @@
 #include "llflexibleobject.h"
 #include "llfeaturemanager.h"
 #include "llviewershadermgr.h"
-#include "llnetmap.h"
 #include "llpanelgeneral.h"
 #include "llpanelinput.h"
 #include "llsky.h"
@@ -417,12 +416,6 @@ bool handleEffectColorChanged(const LLSD& newvalue)
 	return true;
 }
 
-bool handleRotateNetMapChanged(const LLSD& newvalue)
-{
-	LLNetMap::setRotateMap(newvalue.asBoolean());
-	return true;
-}
-
 bool handleVectorizeChanged(const LLSD& newvalue)
 {
 	LLViewerJointMesh::updateVectorize();
@@ -485,8 +478,8 @@ void settings_setup_listeners()
 	gSavedSettings.getControl("UploadBakedTexOld")->getSignal()->connect(boost::bind(&handleUploadBakedTexOldChanged, _1));
 	gSavedSettings.getControl("UseOcclusion")->getSignal()->connect(boost::bind(&handleUseOcclusionChanged, _1));
 	gSavedSettings.getControl("AudioLevelMaster")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
- 	gSavedSettings.getControl("AudioLevelSFX")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
- 	gSavedSettings.getControl("AudioLevelUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
+	gSavedSettings.getControl("AudioLevelSFX")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
+	gSavedSettings.getControl("AudioLevelUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
 	gSavedSettings.getControl("AudioLevelAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
 	gSavedSettings.getControl("AudioLevelMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
 	gSavedSettings.getControl("AudioLevelMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
@@ -550,11 +543,10 @@ void settings_setup_listeners()
 	gSavedSettings.getControl("BuildAxisDeadZone3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
 	gSavedSettings.getControl("BuildAxisDeadZone4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
 	gSavedSettings.getControl("BuildAxisDeadZone5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
-    gSavedSettings.getControl("DebugViews")->getSignal()->connect(boost::bind(&handleDebugViewsChanged, _1));
-    gSavedSettings.getControl("UserLogFile")->getSignal()->connect(boost::bind(&handleLogFileChanged, _1));
+	gSavedSettings.getControl("DebugViews")->getSignal()->connect(boost::bind(&handleDebugViewsChanged, _1));
+	gSavedSettings.getControl("UserLogFile")->getSignal()->connect(boost::bind(&handleLogFileChanged, _1));
 	gSavedSettings.getControl("RenderHideGroupTitle")->getSignal()->connect(boost::bind(handleHideGroupTitleChanged, _1));
 	gSavedSettings.getControl("EffectColor")->getSignal()->connect(boost::bind(handleEffectColorChanged, _1));
-	gSavedSettings.getControl("MiniMapRotate")->getSignal()->connect(boost::bind(handleRotateNetMapChanged, _1));
 	gSavedSettings.getControl("VectorizePerfTest")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
 	gSavedSettings.getControl("VectorizeEnable")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
 	gSavedSettings.getControl("VectorizeProcessor")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 47a887e909c5b6b7a8ed0450e56ef109088e80b0..50e5b4e90cc6146ac4c06c977d5a96ae5ec51e20 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -102,13 +102,15 @@
 #include "llfloatereditui.h"
 #include "llfloaterchatterbox.h"
 #include "llfloaterfriends.h"
+#include "llfloaterfonttest.h"
 #include "llfloatergesture.h"
 #include "llfloatergodtools.h"
 #include "llfloatergroupinfo.h"
 #include "llfloatergroupinvite.h"
 #include "llfloatergroups.h"
 #include "llfloaterhtml.h"
-#include "llfloaterhtmlhelp.h"
+#include "llfloaterhtmlcurrency.h"
+#include "llfloaterhtmlhelp.h"			// gViewerHtmlHelp
 #include "llfloaterhtmlsimple.h"
 #include "llfloaterhud.h"
 #include "llfloaterinspect.h"
@@ -186,6 +188,7 @@
 #include "llviewercamera.h"
 #include "llviewergenericmessage.h"
 #include "llviewergesture.h"
+#include "llviewerimagelist.h"	// gImageList
 #include "llviewerinventory.h"
 #include "llviewermenufile.h"	// init_menu_file()
 #include "llviewermessage.h"
@@ -418,7 +421,6 @@ void handle_force_delete(void*);
 void print_object_info(void*);
 void print_agent_nvpairs(void*);
 void toggle_debug_menus(void*);
-void toggle_map( void* user_data );
 void export_info_callback(LLAssetInfo *info, void **user_data, S32 result);
 void export_data_callback(LLVFS *vfs, const LLUUID& uuid, LLAssetType::EType type, void **user_data, S32 result);
 void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status);
@@ -1057,6 +1059,7 @@ void init_debug_ui_menu(LLMenuGL* menu)
 void init_debug_xui_menu(LLMenuGL* menu)
 {
 	menu->append(new LLMenuItemCallGL("Floater Test...", LLFloaterTest::show));
+	menu->append(new LLMenuItemCallGL("Font Test...", LLFloaterFontTest::show));
 	menu->append(new LLMenuItemCallGL("Export Menus to XML...", handle_export_menus_to_xml));
 	menu->append(new LLMenuItemCallGL("Edit UI...", LLFloaterEditUI::show));	
 	menu->append(new LLMenuItemCallGL("Load from XML...", handle_load_from_xml));
@@ -4580,22 +4583,6 @@ void toggle_debug_menus(void*)
 }
 
 
-void toggle_map( void* user_data )
-{
-	// Toggle the item
-	BOOL checked = gSavedSettings.getBOOL( static_cast<char*>(user_data) );
-	gSavedSettings.setBOOL( static_cast<char*>(user_data), !checked );
-	if (checked)
-	{
-		gFloaterMap->close();
-	}
-	else
-	{
-		gFloaterMap->open();		/* Flawfinder: ignore */	
-	}
-}
-
-
 // LLUUID gExporterRequestID;
 // std::string gExportDirectory;
 
@@ -5112,11 +5099,11 @@ class LLShowFloater : public view_listener_t
 		}
 		else if (floater_name == "mini map")
 		{
-			LLFloaterMap::toggle(NULL);
+			LLFloaterMap::toggleInstance();
 		}
 		else if (floater_name == "stat bar")
 		{
-			gDebugView->mFloaterStatsp->setVisible(!gDebugView->mFloaterStatsp->getVisible());
+			LLFloaterStats::toggleInstance();
 		}
 		else if (floater_name == "my land")
 		{
@@ -5248,7 +5235,7 @@ class LLFloaterVisible : public view_listener_t
 		}
 		else if (floater_name == "stat bar")
 		{
-			new_value = gDebugView->mFloaterStatsp->getVisible();
+			new_value = LLFloaterStats::instanceVisible();
 		}
 		else if (floater_name == "active speakers")
 		{
@@ -7046,7 +7033,7 @@ void handle_buy_currency_test(void*)
 
 	llinfos << "buy currency url " << url << llendl;
 
-	LLFloaterHtmlSimple* floater = LLFloaterHtmlSimple::showInstance(url);
+	LLFloaterHtmlCurrency* floater = LLFloaterHtmlCurrency::showInstance(url);
 	// Needed so we can use secondlife:///app/floater/self/close SLURLs
 	floater->setTrusted(true);
 	floater->center();
@@ -7440,6 +7427,19 @@ void initialize_menus()
 		F32 mVal;
 		bool mMult;
 	};
+	
+	class LLAvatarReportAbuse : public view_listener_t
+	{
+		bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
+		{
+			LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
+			if(avatar)
+			{
+				LLFloaterReporter::showFromObject(avatar->getID());
+			}
+			return true;
+		}
+	};
 
 	// File menu
 	init_menu_file();
@@ -7574,6 +7574,7 @@ void initialize_menus()
 	addMenu(new LLAvatarGiveCard(), "Avatar.GiveCard");
 	addMenu(new LLAvatarEject(), "Avatar.Eject");
 	addMenu(new LLAvatarSendIM(), "Avatar.SendIM");
+	addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse");
 	
 	addMenu(new LLObjectEnableMute(), "Avatar.EnableMute");
 	addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend");
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 77b69d0ad41a9d42a62c096586868a92e142c384..dae352931971c08a2d77baa3a44d2d806337bb46 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -82,7 +82,6 @@
 #include "llfloaterland.h"
 #include "llfloaterregioninfo.h"
 #include "llfloaterlandholdings.h"
-#include "llfloatermap.h"
 #include "llurldispatcher.h"
 #include "llfloatermute.h"
 #include "llfloaterpostcard.h"
@@ -97,7 +96,6 @@
 #include "llinventoryview.h"
 #include "llmenugl.h"
 #include "llmutelist.h"
-#include "llnetmap.h"
 #include "llnotifications.h"
 #include "llnotify.h"
 #include "llpanelgrouplandmoney.h"
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 4a81c06efbdab8a3d444e4c557eb85077692cb99..d7313c1653343463c7f29a001d0a6026211f6b54 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -66,7 +66,6 @@
 #include "llface.h"
 #include "llfloaterproperties.h"
 #include "llfollowcam.h"
-#include "llnetmap.h"
 #include "llselectmgr.h"
 #include "llrendersphere.h"
 #include "lltooldraganddrop.h"
@@ -991,7 +990,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
 					if (!mText)
 					{
 						mText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
-						mText->setFont(LLFontGL::sSansSerif);
+						mText->setFont(LLFontGL::getFontSansSerif());
 						mText->setVertAlignment(LLHUDText::ALIGN_VERT_TOP);
 						mText->setMaxLines(-1);
 						mText->setSourceObject(this);
@@ -1409,7 +1408,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
 				if (!mText && (value & 0x4))
 				{
 					mText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
-					mText->setFont(LLFontGL::sSansSerif);
+					mText->setFont(LLFontGL::getFontSansSerif());
 					mText->setVertAlignment(LLHUDText::ALIGN_VERT_TOP);
 					mText->setMaxLines(-1); // Set to match current agni behavior.
 					mText->setSourceObject(this);
@@ -4057,7 +4056,7 @@ void LLViewerObject::setDebugText(const std::string &utf8text)
 	if (!mText)
 	{
 		mText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
-		mText->setFont(LLFontGL::sSansSerif);
+		mText->setFont(LLFontGL::getFontSansSerif());
 		mText->setVertAlignment(LLHUDText::ALIGN_VERT_TOP);
 		mText->setMaxLines(-1);
 		mText->setSourceObject(this);
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 2560ad95d8e7cca9f2969c8a4b28b606e1a0f453..e0741e72335cc597162f177611c56e9587a02236 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -1112,7 +1112,7 @@ void LLViewerObjectList::generatePickList(LLCamera &camera)
 
 		std::vector<LLDrawable*> pick_drawables;
 
-		for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 		{
 			LLViewerRegion* region = *iter;
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 1ee651ba37f8af5980bc1ef29eeefc0d5e3b32e8..194029398d72751321b7fb67356b6baac4b9d677 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -833,7 +833,7 @@ void LLViewerParcelMgr::renderParcelCollision()
 		mRenderCollision = FALSE;
 	}
 
-	if (mRenderCollision)
+	if (mRenderCollision && gSavedSettings.getBOOL("ShowBanLines"))
 	{
 		LLViewerRegion* regionp = gAgent.getRegion();
 		BOOL use_pass = mCollisionParcel->getParcelFlag(PF_USE_PASS_LIST);
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index e822c81500af553ee73df50bb668dc71d1c57401..87b6652056283b783e4f176d7e8b5db40bf501ce 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -54,7 +54,6 @@
 #include "llfloaterreporter.h"
 #include "llfloaterregioninfo.h"
 #include "llhttpnode.h"
-#include "llnetmap.h"
 #include "llsdutil.h"
 #include "llstartup.h"
 #include "llviewerobjectlist.h"
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index 587fa11de890c164f14be74f1eca39818e90dd8b..1fd31a013abf766282af8e9c8a52b07e943b586e 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -148,8 +148,8 @@ public:
 	// return true if there are no embedded items.
 	bool empty();
 	
-	void	bindEmbeddedChars(LLFontGL* font) const;
-	void	unbindEmbeddedChars(LLFontGL* font) const;
+	void	bindEmbeddedChars(const LLFontGL* font) const;
+	void	unbindEmbeddedChars(const LLFontGL* font) const;
 
 	BOOL	insertEmbeddedItem(LLInventoryItem* item, llwchar* value, bool is_new);
 	BOOL	removeEmbeddedItem( llwchar ext_char );
@@ -369,7 +369,7 @@ BOOL LLEmbeddedItems::hasEmbeddedItem(llwchar ext_char)
 	return FALSE;
 }
 
-void LLEmbeddedItems::bindEmbeddedChars( LLFontGL* font ) const
+void LLEmbeddedItems::bindEmbeddedChars( const LLFontGL* font ) const
 {
 	if( sEntries.empty() )
 	{
@@ -439,7 +439,7 @@ void LLEmbeddedItems::bindEmbeddedChars( LLFontGL* font ) const
 	}
 }
 
-void LLEmbeddedItems::unbindEmbeddedChars( LLFontGL* font ) const
+void LLEmbeddedItems::unbindEmbeddedChars( const LLFontGL* font ) const
 {
 	if( sEntries.empty() )
 	{
@@ -1286,12 +1286,12 @@ llwchar LLViewerTextEditor::pasteEmbeddedItem(llwchar ext_char)
 	return LL_UNKNOWN_CHAR; // item not found or list full
 }
 
-void LLViewerTextEditor::bindEmbeddedChars(LLFontGL* font) const
+void LLViewerTextEditor::bindEmbeddedChars(const LLFontGL* font) const
 {
 	mEmbeddedItemList->bindEmbeddedChars( font );
 }
 
-void LLViewerTextEditor::unbindEmbeddedChars(LLFontGL* font) const
+void LLViewerTextEditor::unbindEmbeddedChars(const LLFontGL* font) const
 {
 	mEmbeddedItemList->unbindEmbeddedChars( font );
 }
@@ -1589,6 +1589,7 @@ LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlF
 	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);
 
diff --git a/indra/newview/llviewertexteditor.h b/indra/newview/llviewertexteditor.h
index 3aa47da580ce829593217bead4412b0c36b1c791..0aa9164c90f582bb52a4244db20b547360b1b438 100644
--- a/indra/newview/llviewertexteditor.h
+++ b/indra/newview/llviewertexteditor.h
@@ -98,8 +98,8 @@ public:
 private:
 	// Embedded object operations
 	virtual llwchar	pasteEmbeddedItem(llwchar ext_char);
-	virtual void	bindEmbeddedChars(LLFontGL* font) const;
-	virtual void	unbindEmbeddedChars(LLFontGL* font) const;
+	virtual void	bindEmbeddedChars(const LLFontGL* font) const;
+	virtual void	unbindEmbeddedChars(const LLFontGL* font) const;
 
 	BOOL			getEmbeddedItemToolTipAtPos(S32 pos, LLWString &wmsg) const;
 	BOOL			openEmbeddedItemAtPos( S32 pos );
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index cddca662205e738e063f7cedd32039983b681f4e..44d9a7286823d8c962505a92239e0af204cedc6c 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -101,7 +101,6 @@
 #include "llfloatereditui.h" // HACK JAMESDEBUG for ui editor
 #include "llfloaterland.h"
 #include "llfloaterinspect.h"
-#include "llfloatermap.h"
 #include "llfloaternamedesc.h"
 #include "llfloaterpreference.h"
 #include "llfloatersnapshot.h"
@@ -556,7 +555,7 @@ public:
 			 iter != mLineList.end(); ++iter)
 		{
 			const Line& line = *iter;
-			LLFontGL::sMonospace->renderUTF8(line.text, 0, (F32)line.x, (F32)line.y, mTextColor,
+			LLFontGL::getFontMonospace()->renderUTF8(line.text, 0, (F32)line.x, (F32)line.y, mTextColor,
 											 LLFontGL::LEFT, LLFontGL::TOP,
 											 LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE);
 		}
@@ -1664,7 +1663,9 @@ void LLViewerWindow::initBase()
 	gFloaterView->setVisible(TRUE);
 
 	gSnapshotFloaterView = new LLSnapshotFloaterView("Snapshot Floater View", full_window);
-	gSnapshotFloaterView->setVisible(TRUE);
+	// Snapshot floater must start invisible otherwise it eats all
+	// the tooltips. JC
+	gSnapshotFloaterView->setVisible(FALSE);
 
 	// Console
 	llassert( !gConsole );
@@ -1860,6 +1861,8 @@ void LLViewerWindow::adjustRectanglesForFirstUse(const LLRect& window)
 
 	adjust_rect_bottom_left("FloaterDayCycleRect", window);
 
+	adjust_rect_top_right("FloaterStatisticsRect", window);
+
 
 	// bottom-right
 	r = gSavedSettings.getRect("FloaterInventoryRect");
@@ -1914,16 +1917,6 @@ void LLViewerWindow::initWorldUI()
 		gHoverView = new LLHoverView(std::string("gHoverView"), full_window);
 		gHoverView->setVisible(TRUE);
 		mRootView->addChild(gHoverView);
-
-		//
-		// Map
-		//
-		// TODO: Move instance management into class
-		gFloaterMap = new LLFloaterMap(std::string("Map"));
-		gFloaterMap->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
-
-		// keep onscreen
-		gFloaterView->adjustToFitScreen(gFloaterMap, FALSE);
 		
 		gIMMgr = LLIMMgr::getInstance();
 
@@ -2006,7 +1999,6 @@ void LLViewerWindow::shutdownViews()
 	gFloaterView		= NULL;
 	gMorphView			= NULL;
 
-	gFloaterMap	= NULL;
 	gHUDView = NULL;
 
 	gNotifyBoxView = NULL;
@@ -2383,7 +2375,7 @@ void LLViewerWindow::draw()
 		{
 			// Used for special titles such as "Second Life - Special E3 2003 Beta"
 			const S32 DIST_FROM_TOP = 20;
-			LLFontGL::sSansSerifBig->renderUTF8(
+			LLFontGL::getFontSansSerifBig()->renderUTF8(
 				mOverlayTitle, 0,
 				llround( getWindowWidth() * 0.5f),
 				getWindowHeight() - DIST_FROM_TOP,
@@ -4645,7 +4637,7 @@ void LLViewerWindow::stopGL(BOOL save_state)
 		gBumpImageList.destroyGL();
 		stop_glerror();
 
-		LLFontGL::destroyGL();
+		LLFontGL::destroyAllGL();
 		stop_glerror();
 
 		LLVOAvatar::destroyGL();
@@ -4732,23 +4724,12 @@ void LLViewerWindow::restoreGL(const std::string& progress_message)
 
 void LLViewerWindow::initFonts(F32 zoom_factor)
 {
-	LLFontGL::destroyGL();
+	LLFontGL::destroyAllGL();
 	LLFontGL::initDefaultFonts( gSavedSettings.getF32("FontScreenDPI"),
-				    mDisplayScale.mV[VX] * zoom_factor,
-				    mDisplayScale.mV[VY] * zoom_factor,
-				    gSavedSettings.getString("FontMonospace"),
-				    gSavedSettings.getF32("FontSizeMonospace"),
-				    gSavedSettings.getString("FontSansSerif"), 
-				    gSavedSettings.getString("FontSansSerifFallback"),
-				    gSavedSettings.getF32("FontSansSerifFallbackScale"),
-				    gSavedSettings.getF32("FontSizeSmall"),	
-				    gSavedSettings.getF32("FontSizeMedium"), 
-				    gSavedSettings.getF32("FontSizeLarge"),			 
-				    gSavedSettings.getF32("FontSizeHuge"),			 
-				    gSavedSettings.getString("FontSansSerifBold"),
-				    gSavedSettings.getF32("FontSizeMedium"),
-				    gDirUtilp->getAppRODataDir()
-				    );
+								mDisplayScale.mV[VX] * zoom_factor,
+								mDisplayScale.mV[VY] * zoom_factor,
+								gDirUtilp->getAppRODataDir(),
+								LLUICtrlFactory::getXUIPaths());
 }
 void LLViewerWindow::toggleFullscreen(BOOL show_progress)
 {
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 8d20e4e91c0270569fd59a7f950e8ae4f9312502..e5507dfacb4e08273481ab331be816004231400e 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -55,6 +55,10 @@
 #include "llkeyframestandmotion.h"
 #include "llkeyframewalkmotion.h"
 #include "llmutelist.h"
+#include "llnotify.h"
+#include "llquantize.h"
+#include "llregionhandle.h"
+#include "llresmgr.h"
 #include "llselectmgr.h"
 #include "llsprite.h"
 #include "lltargetingmotion.h"
@@ -3125,7 +3129,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
 			if (visible_chat)
 			{
 				mNameText->setDropShadow(TRUE);
-				mNameText->setFont(LLFontGL::sSansSerif);
+				mNameText->setFont(LLFontGL::getFontSansSerif());
 				mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_LEFT);
 				mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f);
 				if (new_name)
@@ -3202,11 +3206,11 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
 			{
 				if (gSavedSettings.getBOOL("SmallAvatarNames"))
 				{
-					mNameText->setFont(LLFontGL::sSansSerif);
+					mNameText->setFont(LLFontGL::getFontSansSerif());
 				}
 				else
 				{
-					mNameText->setFont(LLFontGL::sSansSerifBig);
+					mNameText->setFont(LLFontGL::getFontSansSerifBig());
 				}
 				mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_CENTER);
 				mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f);
diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp
index 6dfe23ba98651cafdb6d80203ecd0368cc5ea91b..82003daaf46a4a95d9ba6a8064706a5435e5959a 100644
--- a/indra/newview/llvopartgroup.cpp
+++ b/indra/newview/llvopartgroup.cpp
@@ -186,12 +186,13 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable)
 	S32 count=0;
 	mDepth = 0.f;
 	S32 i = 0 ;
+	LLVector3 camera_agent = getCameraPosition();
 	for (i = 0 ; i < (S32)mViewerPartGroupp->mParticles.size(); i++)
 	{
 		const LLViewerPart *part = mViewerPartGroupp->mParticles[i];
 
 		LLVector3 part_pos_agent(part->mPosAgent);
-		LLVector3 at(part_pos_agent - LLViewerCamera::getInstance()->getOrigin());
+		LLVector3 at(part_pos_agent - camera_agent);
 
 		F32 camera_dist_squared = at.lengthSquared();
 		F32 inv_camera_dist_squared;
@@ -314,7 +315,7 @@ void LLVOPartGroup::getGeometry(S32 idx,
 	up *= 0.5f*part.mScale.mV[1];
 
 
-	const LLVector3& normal = -LLViewerCamera::getInstance()->getXAxis();
+	LLVector3 normal = -LLViewerCamera::getInstance()->getXAxis();
 		
 	*verticesp++ = part_pos_agent + up - right;
 	*verticesp++ = part_pos_agent - up - right;
@@ -500,12 +501,8 @@ F32 LLParticlePartition::calcPixelArea(LLSpatialGroup* group, LLCamera& camera)
 }
 
 U32 LLVOHUDPartGroup::getPartitionType() const
-{ 
-	// Commenting out and returning PARTITION_NONE because DEV-16909 
-	// (SVC-2396: Particles not handled properly as hud) didn't work completely 
-	// so this disables HUD particles until they can be fixed properly. -MG
-	//return LLViewerRegion::PARTITION_HUD_PARTICLE; 
-	return LLViewerRegion::PARTITION_NONE;
+{
+	return LLViewerRegion::PARTITION_HUD_PARTICLE; 
 }
 
 LLDrawable* LLVOHUDPartGroup::createDrawable(LLPipeline *pipeline)
@@ -520,3 +517,4 @@ LLVector3 LLVOHUDPartGroup::getCameraPosition() const
 {
 	return LLVector3(-1,0,0);
 }
+
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index f11ef97b55bd111cf82df04a8dd1917314f9d23d..c9cc86bbbce595c3edfc5569e8e76ef9d79cc19c 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -947,7 +947,7 @@ void LLWorld::updateWaterObjects()
 
 void LLWorld::shiftRegions(const LLVector3& offset)
 {
-	for (region_list_t::iterator i = getRegionList().begin(); i != getRegionList().end(); ++i)
+	for (region_list_t::const_iterator i = getRegionList().begin(); i != getRegionList().end(); ++i)
 	{
 		LLViewerRegion* region = *i;
 		region->updateRenderMatrix();
@@ -1133,8 +1133,8 @@ void send_agent_pause()
 	gAgentPauseSerialNum++;
 	gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum);
 
-	for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin();
-		 iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter)
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+		 iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
 		LLViewerRegion* regionp = *iter;
 		gMessageSystem->sendReliable(regionp->getHost());
@@ -1163,8 +1163,8 @@ void send_agent_resume()
 	gMessageSystem->addU32Fast(_PREHASH_SerialNum, gAgentPauseSerialNum);
 	
 
-	for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->mActiveRegionList.begin();
-		 iter != LLWorld::getInstance()->mActiveRegionList.end(); ++iter)
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+		 iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
 		LLViewerRegion* regionp = *iter;
 		gMessageSystem->sendReliable(regionp->getHost());
@@ -1176,6 +1176,62 @@ void send_agent_resume()
 	LLAppViewer::instance()->resumeMainloopTimeout();
 }
 
+static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3d& region_origin)
+{
+	LLVector3d pos_global;
+	LLVector3 pos_local;
+	U8 bits;
+
+	bits = compact_local & 0xFF;
+	pos_local.mV[VZ] = F32(bits) * 4.f;
+	compact_local >>= 8;
+
+	bits = compact_local & 0xFF;
+	pos_local.mV[VY] = (F32)bits;
+	compact_local >>= 8;
+
+	bits = compact_local & 0xFF;
+	pos_local.mV[VX] = (F32)bits;
+
+	pos_global.setVec( pos_local );
+	pos_global += region_origin;
+	return pos_global;
+}
+
+void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const
+{
+	if(avatar_ids != NULL)
+	{
+		avatar_ids->clear();
+	}
+	if(positions != NULL)
+	{
+		positions->clear();
+	}
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
+		iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+	{
+		LLViewerRegion* regionp = *iter;
+		const LLVector3d& origin_global = regionp->getOriginGlobal();
+		S32 count = regionp->mMapAvatars.count();
+		for (S32 i = 0; i < count; i++)
+		{
+			LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global);
+			if(dist_vec(pos_global, relative_to) <= radius)
+			{
+				if(positions != NULL)
+				{
+					positions->push_back(pos_global);
+				}
+				if(avatar_ids != NULL)
+				{
+					avatar_ids->push_back(regionp->mMapAvatarIDs.get(i));
+				}
+			}
+		}
+	}
+}
+
 
 LLHTTPRegistration<LLEstablishAgentCommunication>
 	gHTTPRegistrationEstablishAgentCommunication(
diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h
index 52188dd66eeea2029530e886fcb2405c89ae6ae9..ce83cbd97c60f15fed549bd262aa6ee203d9e45f 100644
--- a/indra/newview/llworld.h
+++ b/indra/newview/llworld.h
@@ -1,6 +1,11 @@
 /** 
  * @file llworld.h
- * @brief Initial test structure to organize viewer regions
+ * @brief Collection of viewer regions in the vacinity of the user.
+ *
+ * Represents the whole world, so far as 3D functionality is conserned.
+ * Always contains the region that the user's avatar is in along with
+ * neighboring regions. As the user crosses region boundaries, new
+ * regions are added to the world and distant ones are rolled up.
  *
  * $LicenseInfo:firstyear=2001&license=viewergpl$
  * 
@@ -147,12 +152,18 @@ public:
 
 public:
 	typedef std::list<LLViewerRegion*> region_list_t;
-	
-	region_list_t	mActiveRegionList;
+	const region_list_t& getRegionList() const { return mActiveRegionList; }
 
-	region_list_t& getRegionList() { return mActiveRegionList; }
+	// Returns lists of avatar IDs and their world-space positions within a given distance of a point.
+	// All arguments are optional. Given containers will be emptied and then filled.
+	// Not supplying origin or radius input returns data on all avatars in the known regions.
+	void getAvatars(
+		std::vector<LLUUID>* avatar_ids = NULL,
+		std::vector<LLVector3d>* positions = NULL, 
+		const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const;
 
 private:
+	region_list_t	mActiveRegionList;
 	region_list_t	mRegionList;
 	region_list_t	mVisibleRegionList;
 	region_list_t	mCulledRegionList;
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index db36fa0ffeeda50f531c68de724992b9758953d3..9ff94751d07d984d7960383fe76060aaf8d984a8 100644
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -651,7 +651,7 @@ void LLWorldMapView::draw()
 		}
 
 		// Draw the region name in the lower left corner
-		LLFontGL* font = LLFontGL::sSansSerifSmall;
+		LLFontGL* font = LLFontGL::getFontSansSerifSmall();
 
 		std::string mesg;
 		if (gMapScale < sThresholdA)
@@ -763,7 +763,7 @@ void LLWorldMapView::draw()
 			TRUE, 
 			"You are here", 
 			"", 
-			llround(LLFontGL::sSansSerifSmall->getLineHeight())); // offset vertically by one line, to avoid overlap with target tracking
+			llround(LLFontGL::getFontSansSerifSmall()->getLineHeight())); // offset vertically by one line, to avoid overlap with target tracking
 	}
 
 	// Show your viewing angle
@@ -893,6 +893,9 @@ void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr i
 void LLWorldMapView::drawAgents()
 {
 	F32 agents_scale = (gMapScale * 0.9f) / 256.f;
+	
+	LLColor4 avatar_color = gColors.getColor( "MapAvatar" );
+	//	LLColor4 friend_color = gColors.getColor( "MapFriend" );
 
 	for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter)
 	{
@@ -915,8 +918,8 @@ void LLWorldMapView::drawAgents()
 				S32 agent_count = info.mExtra;
 				sim_agent_count += info.mExtra;
 				// Here's how we'd choose the color if info.mID were available but it's not being sent:
-				//LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? gFriendMapColor : gAvatarMapColor;
-				drawImageStack(info.mPosGlobal, sAvatarSmallImage, agent_count, 3.f, gAvatarMapColor);
+				//LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? friend_color : avatar_color;
+				drawImageStack(info.mPosGlobal, sAvatarSmallImage, agent_count, 3.f, avatar_color);
 			}
 			LLWorldMap::getInstance()->mNumAgents[handle] = sim_agent_count; // override mNumAgents for this sim
 		}
@@ -931,7 +934,7 @@ void LLWorldMapView::drawAgents()
 				region_center[VY] += REGION_WIDTH_METERS / 2;
 				// Reduce the stack size as you zoom out - always display at lease one agent where there is one or more
 				S32 agent_count = (S32)(((num_agents-1) * agents_scale + (num_agents-1) * 0.1f)+.1f) + 1;
-				drawImageStack(region_center, sAvatarSmallImage, agent_count, 3.f, gAvatarMapColor);
+				drawImageStack(region_center, sAvatarSmallImage, agent_count, 3.f, avatar_color);
 			}
 		}
 	}
@@ -1045,7 +1048,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4&
 	LLVector3 pos_local = globalPosToView( pos_global );
 	S32 x = llround( pos_local.mV[VX] );
 	S32 y = llround( pos_local.mV[VY] );
-	LLFontGL* font = LLFontGL::sSansSerifSmall;
+	LLFontGL* font = LLFontGL::getFontSansSerifSmall();
 	S32 text_x = x;
 	S32 text_y = (S32)(y - sTrackCircleImage->getHeight()/2 - font->getLineHeight());
 
@@ -1278,7 +1281,7 @@ void LLWorldMapView::drawIconName(F32 x_pixels,
 						 - VERT_PAD);
 
 	// render text
-	LLFontGL::sSansSerif->renderUTF8(first_line, 0,
+	LLFontGL::getFontSansSerif()->renderUTF8(first_line, 0,
 		text_x,
 		text_y,
 		color,
@@ -1286,10 +1289,10 @@ void LLWorldMapView::drawIconName(F32 x_pixels,
 		LLFontGL::TOP,
 		LLFontGL::DROP_SHADOW);
 
-	text_y -= llround(LLFontGL::sSansSerif->getLineHeight());
+	text_y -= llround(LLFontGL::getFontSansSerif()->getLineHeight());
 
 	// render text
-	LLFontGL::sSansSerif->renderUTF8(second_line, 0,
+	LLFontGL::getFontSansSerif()->renderUTF8(second_line, 0,
 		text_x,
 		text_y,
 		color,
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index d90eaa9d9b40c3bf1f5f8c2d9b83da9c01363dd2..8dec9b9ba86bb1ece8f6107769b89ceb2a40702f 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -646,7 +646,7 @@ void LLPipeline::restoreGL()
 		LLViewerShaderMgr::instance()->setShaders();
 	}
 
-	for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
 		LLViewerRegion* region = *iter;
@@ -797,7 +797,7 @@ void LLPipeline::dirtyPoolObjectTextures(const std::set<LLViewerImage*>& texture
 	}
 	
 	LLOctreeDirtyTexture dirty(textures);
-	for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
 		LLViewerRegion* region = *iter;
@@ -1245,7 +1245,7 @@ void LLPipeline::updateMove()
 	{
  		LLFastTimer ot(LLFastTimer::FTM_OCTREE_BALANCE);
 
-		for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 		{
 			LLViewerRegion* region = *iter;
@@ -1292,7 +1292,7 @@ void LLPipeline::grabReferences(LLCullResult& result)
 
 BOOL LLPipeline::visibleObjectsInFrustum(LLCamera& camera)
 {
-	for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
 		LLViewerRegion* region = *iter;
@@ -1324,7 +1324,7 @@ BOOL LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3&
 
 	BOOL res = TRUE;
 
-	for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
 		LLViewerRegion* region = *iter;
@@ -1387,7 +1387,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
 
 	LLGLDepthTest depth(GL_TRUE, GL_FALSE);
 
-	for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
 		LLViewerRegion* region = *iter;
@@ -1775,7 +1775,7 @@ void LLPipeline::shiftObjects(const LLVector3 &offset)
 	}
 	mShiftList.resize(0);
 
-	for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
 		LLViewerRegion* region = *iter;
@@ -3050,7 +3050,7 @@ void LLPipeline::renderDebug()
 	gGL.setColorMask(true, false);
 
 	// Debug stuff.
-	for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
 		LLViewerRegion* region = *iter;
@@ -3067,7 +3067,7 @@ void LLPipeline::renderDebug()
 		}
 	}
 
-	for (LLCullResult::bridge_list_t::iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
+	for (LLCullResult::bridge_list_t::const_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
 	{
 		LLSpatialBridge* bridge = *i;
 		if (!bridge->isDead() && !bridge->isState(LLSpatialGroup::OCCLUDED) && hasRenderType(bridge->mDrawableType))
@@ -3153,7 +3153,7 @@ void LLPipeline::renderDebug()
 
 			gGL.end();
 			
-			for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+			for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 					iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 			{
 				LLViewerRegion* region = *iter;
@@ -4628,7 +4628,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector3& start,
 
 	sPickAvatar = FALSE; //LLToolMgr::getInstance()->inBuildMode() ? FALSE : TRUE;
 	
-	for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
 		LLViewerRegion* region = *iter;
@@ -4685,7 +4685,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector3& start,
 
 		//check against avatars
 		sPickAvatar = TRUE;
-		for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 				iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 		{
 			LLViewerRegion* region = *iter;
@@ -4762,7 +4762,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInHUD(const LLVector3& start, co
 {
 	LLDrawable* drawable = NULL;
 
-	for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
 		LLViewerRegion* region = *iter;
@@ -4825,7 +4825,7 @@ void LLPipeline::resetVertexBuffers()
 {
 	sRenderBump = gSavedSettings.getBOOL("RenderObjectBump");
 
-	for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
 			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
 		LLViewerRegion* region = *iter;
diff --git a/indra/newview/skins/default/xui/fr/floater_font_test.xml b/indra/newview/skins/default/xui/fr/floater_font_test.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b469e08c8137c79e9af3a05a4e3839017bf2a010
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/floater_font_test.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true"
+     height="800" min_height="175" min_width="154" name="contents"
+     title="Font Test" width="500">
+
+<text name="linea" font="OverrideTest" follows="left|top|right" bottom_delta="-20" left="16" height="16">
+OverrideTest, should be timesbd, from default/xui/fr
+</text>
+
+</floater>
diff --git a/indra/newview/skins/default/xui/fr/fonts.xml b/indra/newview/skins/default/xui/fr/fonts.xml
new file mode 100644
index 0000000000000000000000000000000000000000..021372d6f201b4f1b7d2e11d6d754dd791fe4ca3
--- /dev/null
+++ b/indra/newview/skins/default/xui/fr/fonts.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<fonts>
+
+  <font name="OverrideTest"
+	comment="Name of font to test overriding">
+    <file>timesbd.ttf</file>
+  </font>
+
+</fonts>
diff --git a/scripts/messages/message_template.msg b/scripts/messages/message_template.msg
index c958fceae9fddf4fa4066fc65a3517d0afbb0cba..c6d42cf8828e6bab5e81049ae69bc064221b0bf2 100644
--- a/scripts/messages/message_template.msg
+++ b/scripts/messages/message_template.msg
@@ -2589,6 +2589,10 @@ version 2.0
 		{	East			F32		}
 		{	North			F32		}
 	}
+	{
+		ModifyBlockExtended Variable
+		{   BrushSize       F32 }
+	}
 }