diff --git a/.hgignore b/.hgignore
index 403b73df6d28a41d669ab8abd0236a1c3df808d0..bc3020eee4758fe74905091c141492698899e542 100644
--- a/.hgignore
+++ b/.hgignore
@@ -67,3 +67,4 @@ glob:indra/newview/filters.xml
 glob:indra/newview/avatar_icons_cache.txt
 glob:indra/newview/avatar_lad.log
 glob:*.diff
+*.rej
diff --git a/autobuild.xml b/autobuild.xml
index 9914be68678a06e049e85f7a5fe424102645eb94..0e4b81324a8ccd1fb116b2cc01d9cf793a5f766d 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -1206,9 +1206,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>26aa7c367ffadd573f61a6a96f820f80</string>
+              <string>4a98d727561cd1f4ac5ee02907411df1</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/245988/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20111201.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/250147/arch/Darwin/installer/llqtwebkit-4.7.1-darwin-20120228.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin</string>
@@ -1218,9 +1218,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>c05a33ee8b6f253b5a744596dfc3707d</string>
+              <string>f50e5f0cc880c55b3f0f7e67dc8f7221</string>
               <key>url</key>
-              <string>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-linux-qt4.6-20101013.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/250147/arch/Linux/installer/llqtwebkit-4.7.1-linux-20120228.tar.bz2</string>
             </map>
             <key>name</key>
             <string>linux</string>
@@ -1230,9 +1230,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>270db8568a0c4bab266d98e1a820aec4</string>
+              <string>5e3cd6af397e853a963a6de40d440ff4</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/245988/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20111201.tar.bz2</string>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llqtwebkit/rev/250147/arch/CYGWIN/installer/llqtwebkit-4.7.1-windows-20120228.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows</string>
diff --git a/indra/cmake/VisualLeakDetector.cmake b/indra/cmake/VisualLeakDetector.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..d3ba554e462621cbc6bff6d0d670f0a89055f01e
--- /dev/null
+++ b/indra/cmake/VisualLeakDetector.cmake
@@ -0,0 +1,15 @@
+# -*- cmake -*-
+
+if (VIEWER)
+
+  set(INCLUDE_VLD_CMAKE OFF CACHE BOOL "Build the Windows viewer with Visual Leak Detector turned on or off")
+
+  if (INCLUDE_VLD_CMAKE)
+
+    if (WINDOWS)
+      add_definitions(-DINCLUDE_VLD=1)
+    endif (WINDOWS)
+
+  endif (INCLUDE_VLD_CMAKE)
+
+endif (VIEWER)
diff --git a/indra/cmake/WebKitLibPlugin.cmake b/indra/cmake/WebKitLibPlugin.cmake
index 91b49e75d737973b81bed22728f15e63685acef3..d9df78bfc8fdec62c4261b6c74208c047e999e51 100644
--- a/indra/cmake/WebKitLibPlugin.cmake
+++ b/indra/cmake/WebKitLibPlugin.cmake
@@ -70,9 +70,10 @@ elseif (LINUX)
         QtNetwork
         QtGui
         QtCore
-        qgif
-        qjpeg
-        jpeg
+        jscore
+#        qgif
+#        qjpeg
+#        jpeg
         fontconfig
         X11
         Xrender
diff --git a/indra/edit-me-to-trigger-new-build.txt b/indra/edit-me-to-trigger-new-build.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp
index f0b44f97d28b0d15f3728a4546c77f32e4464b77..7f747c2eca7423591d4ad2eae87cc50c40e6ec7c 100644
--- a/indra/llaudio/llaudiodecodemgr.cpp
+++ b/indra/llaudio/llaudiodecodemgr.cpp
@@ -215,7 +215,7 @@ BOOL LLVorbisDecodeState::initDecode()
 		return(FALSE);
 	}
 	
-	S32 sample_count = ov_pcm_total(&mVF, -1);
+	S32 sample_count = (S32)ov_pcm_total(&mVF, -1);
 	size_t size_guess = (size_t)sample_count;
 	vorbis_info* vi = ov_info(&mVF, -1);
 	size_guess *= (vi? vi->channels : 1);
diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h
index a47ee7ca7ca692053b86f72dec6efee2cd81fa17..28b69e19739bfda0550fb6ed433144bb0007c21f 100644
--- a/indra/llaudio/llaudioengine.h
+++ b/indra/llaudio/llaudioengine.h
@@ -37,6 +37,7 @@
 #include "lluuid.h"
 #include "llframetimer.h"
 #include "llassettype.h"
+#include "llextendedstatus.h"
 
 #include "lllistener.h"
 
diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp
index f3cf950afae70deffcafc7a07adabcb4878f415e..2a0df2638491978cfd4e7556f39b9d95383437c7 100644
--- a/indra/llcharacter/llbvhloader.cpp
+++ b/indra/llcharacter/llbvhloader.cpp
@@ -1570,7 +1570,7 @@ BOOL LLBVHLoader::serialize(LLDataPacker& dp)
 		constraint_it++)
 		{
 			U8 byte = constraint_it->mChainLength;
-			dp.packU8(byte, "chain_lenght");
+			dp.packU8(byte, "chain_length");
 			
 			byte = constraint_it->mConstraintType;
 			dp.packU8(byte, "constraint_type");
diff --git a/indra/llcommon/linden_common.h b/indra/llcommon/linden_common.h
index bdcc98e40208d7cd47ff2c39b383613348c4d460..5cfcdab41cd331c43df806e628e0ace851492b89 100644
--- a/indra/llcommon/linden_common.h
+++ b/indra/llcommon/linden_common.h
@@ -52,34 +52,11 @@
 #include <ctime>
 #include <iosfwd>
 
-// Work around Microsoft compiler warnings in STL headers
-#ifdef LL_WINDOWS
-#pragma warning (disable : 4702) // unreachable code
-#pragma warning (disable : 4244) // conversion from time_t to S32
-#endif	//	LL_WINDOWS
-
-// *TODO: Eliminate these, most library .cpp files don't need them.
-// Add them to llviewerprecompiledheaders.h if necessary.
-#include <list>
-#include <map>
-#include <vector>
-#include <string>
-
-#ifdef LL_WINDOWS
-// Reenable warnings we disabled above
-#pragma warning (3 : 4702) // unreachable code, we like level 3, not 4
-// moved msvc warnings to llpreprocessor.h  *TODO - delete this comment after merge conflicts are unlikely -brad
-#endif	//	LL_WINDOWS
-
 // Linden only libs in alpha-order other than stdtypes.h
 // *NOTE: Please keep includes here to a minimum, see above.
 #include "stdtypes.h"
 #include "lldefs.h"
 #include "llerror.h"
-#include "llextendedstatus.h"
-// Don't do this, adds 15K lines of header code to every library file.
-//#include "llfasttimer.h"
 #include "llfile.h"
-#include "llformat.h"
 
 #endif
diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp
index ba3dd6d6b4c0c7e86325e3627668d1cf54360f95..3206843bf4a95e76f875d7e8b9f8c95dfd7d2f25 100644
--- a/indra/llcommon/llavatarname.cpp
+++ b/indra/llcommon/llavatarname.cpp
@@ -106,6 +106,11 @@ std::string LLAvatarName::getCompleteName() const
 
 std::string LLAvatarName::getLegacyName() const
 {
+	if (mLegacyFirstName.empty() && mLegacyLastName.empty()) // display names disabled?
+	{
+		return mDisplayName;
+	}
+
 	std::string name;
 	name.reserve( mLegacyFirstName.size() + 1 + mLegacyLastName.size() );
 	name = mLegacyFirstName;
diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp
index db1ea4792b32546971a14e2c0cd30b7eae50802c..0855180dcd66956a39048907311097a7c6b6abb1 100644
--- a/indra/llcommon/llevents.cpp
+++ b/indra/llcommon/llevents.cpp
@@ -430,13 +430,13 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL
     {
         // The new node isn't last. Place it between the previous node and
         // the successor.
-        newNode = (myprev + mydmi->second)/2.0;
+        newNode = (myprev + mydmi->second)/2.f;
     }
     else
     {
         // The new node is last. Bump myprev up to the next integer, add
         // 1.0 and use that.
-        newNode = std::ceil(myprev) + 1.0;
+        newNode = std::ceil(myprev) + 1.f;
     }
     // Now that newNode has a value that places it appropriately in mSignal,
     // connect it.
diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp
index 75fde8e5bae17f1666a3c9f32893ca6e25382004..1409c55d1c5080265eb93ffcfb670bad90917d3f 100644
--- a/indra/llcommon/llmd5.cpp
+++ b/indra/llcommon/llmd5.cpp
@@ -175,7 +175,7 @@ void LLMD5::update(std::istream& stream){
 
   while (stream.good()){
     stream.read( (char*)buffer, BLOCK_LEN); 	/* Flawfinder: ignore */		// note that return value of read is unusable.
-    len=stream.gcount();
+    len=(int)stream.gcount();
     update(buffer, len);
   }
 
diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h
index 31d5f3d2c7e8c06fe01009c58b788c95eb98e667..7fdb537ab526b30ba693e0046d9102de0ff76fcb 100644
--- a/indra/llcommon/llpreprocessor.h
+++ b/indra/llcommon/llpreprocessor.h
@@ -132,7 +132,7 @@
 #pragma warning( 3       : 4265 )	// "class has virtual functions, but destructor is not virtual"
 #pragma warning( 3      :  4266 )	// 'function' : no override available for virtual member function from base 'type'; function is hidden
 #pragma warning (disable : 4180)	// qualifier applied to function type has no meaning; ignored
-#pragma warning( disable : 4284 )	// silly MS warning deep inside their <map> include file
+//#pragma warning( disable : 4284 )	// silly MS warning deep inside their <map> include file
 #pragma warning( disable : 4503 )	// 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation.
 #pragma warning( disable : 4800 )	// 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
 #pragma warning( disable : 4996 )	// warning: deprecated
@@ -152,6 +152,7 @@
 #pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class
 #pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class
 #pragma warning (disable : 4018) // '<' : signed/unsigned mismatch	
+
 #endif	//	LL_MSVC
 
 #if LL_WINDOWS
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index bf626005143565b67d42fdf45ddec516cc743067..b419101b7e59b9c9adee29b12e12187381cb7867 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -110,7 +110,7 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, S32 max_bytes)
 	if (!strncasecmp(LEGACY_NON_HEADER, hdr_buf, strlen(LEGACY_NON_HEADER))) /* Flawfinder: ignore */
 	{
 		legacy_no_header = true;
-		inbuf = str.gcount();
+		inbuf = (int)str.gcount();
 	}
 	else
 	{
@@ -343,7 +343,7 @@ std::istream& LLSDParser::get(
 	char delim) const
 {
 	istr.get(s, n, delim);
-	if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
+	if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
 	return istr;
 }
 
@@ -353,7 +353,7 @@ std::istream& LLSDParser::get(
 		char delim) const		
 {
 	istr.get(sb, delim);
-	if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
+	if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
 	return istr;
 }
 
@@ -377,7 +377,7 @@ std::istream& LLSDParser::read(
 	std::streamsize n) const
 {
 	istr.read(s, n);
-	if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
+	if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
 	return istr;
 }
 
@@ -789,7 +789,7 @@ bool LLSDNotationParser::parseBinary(std::istream& istr, LLSD& data) const
 		if(len)
 		{
 			value.resize(len);
-			account(fullread(istr, (char *)&value[0], len));
+			account((int)fullread(istr, (char *)&value[0], len));
 		}
 		c = get(istr); // strip off the trailing double-quote
 		data = value;
@@ -1069,7 +1069,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const
 			if(size > 0)
 			{
 				value.resize(size);
-				account(fullread(istr, (char*)&value[0], size));
+				account((int)fullread(istr, (char*)&value[0], size));
 			}
 			data = value;
 		}
@@ -1200,7 +1200,7 @@ bool LLSDBinaryParser::parseString(
 	if(size)
 	{
 		buf.resize(size);
-		account(fullread(istr, &buf[0], size));
+		account((int)fullread(istr, &buf[0], size));
 		value.assign(buf.begin(), buf.end());
 	}
 	return true;
@@ -1642,7 +1642,7 @@ int deserialize_string_raw(
 	const S32 BUF_LEN = 20;
 	char buf[BUF_LEN];		/* Flawfinder: ignore */
 	istr.get(buf, BUF_LEN - 1, ')');
-	count += istr.gcount();
+	count += (int)istr.gcount();
 	int c = istr.get();
 	c = istr.get();
 	count += 2;
@@ -1657,7 +1657,7 @@ int deserialize_string_raw(
 		if(len)
 		{
 			buf.resize(len);
-			count += fullread(istr, (char *)&buf[0], len);
+			count += (int)fullread(istr, (char *)&buf[0], len);
 			value.assign(buf.begin(), buf.end());
 		}
 		c = istr.get();
diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp
index be9db539068a20fadf519c98fb447def08369553..34b3dbb99a3ff05dd5de91a06879b69ce5bcc5a6 100644
--- a/indra/llcommon/llsdserialize_xml.cpp
+++ b/indra/llcommon/llsdserialize_xml.cpp
@@ -464,7 +464,7 @@ S32 LLSDXMLParser::Impl::parseLines(std::istream& input, LLSD& data)
 			}
 		}
 
-		status = XML_ParseBuffer(mParser, num_read, false);
+		status = XML_ParseBuffer(mParser, (int)num_read, false);
 		if (status == XML_STATUS_ERROR)
 		{
 			break;
diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h
index 65c7297cbf8a7151db93f6d20935717b05e62bb8..532d3f934139c5542617d163204d5727e47464aa 100644
--- a/indra/llcommon/llsdutil.h
+++ b/indra/llcommon/llsdutil.h
@@ -308,7 +308,7 @@ class LLSDParam<T>                              \
 {                                               \
 public:                                         \
     LLSDParam(const LLSD& value):               \
-        _value(value.AS())                      \
+        _value((T)value.AS())                      \
     {}                                          \
                                                 \
     operator T() const { return _value; }       \
diff --git a/indra/llcommon/llstat.cpp b/indra/llcommon/llstat.cpp
index b2c495d093ebdbcb3fab98262f91ad0fd4114761..057257057f58a35a7de69099e4233367107394de 100644
--- a/indra/llcommon/llstat.cpp
+++ b/indra/llcommon/llstat.cpp
@@ -593,7 +593,7 @@ void LLStatTime::stop()
 {
     if ( LLStatAccum::SCALE_PER_FRAME == scale )
     {
-        return mTotalTimeInFrame;
+        return (F32)mTotalTimeInFrame;
     }
     else
     {
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp
index 38054b636ea03b3305c252879b8d01e624fc7904..9ebc6de7f40826a4829cdc0603fc371c405957e1 100644
--- a/indra/llcommon/lltimer.cpp
+++ b/indra/llcommon/lltimer.cpp
@@ -83,7 +83,7 @@ U32 micro_sleep(U64 us, U32 max_yields)
 {
     // max_yields is unused; just fiddle with it to avoid warnings.
     max_yields = 0;
-    ms_sleep(us / 1000);
+	ms_sleep((U32)(us / 1000));
     return 0;
 }
 #elif LL_LINUX || LL_SOLARIS || LL_DARWIN
diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp
index 3461aa3e6ccdc4b18dcc8a8a37d8b12f003a15a3..d6dcde4b9fa26be5f298f602fc04321b9cd454fa 100644
--- a/indra/llcrashlogger/llcrashlogger.cpp
+++ b/indra/llcrashlogger/llcrashlogger.cpp
@@ -250,7 +250,7 @@ void LLCrashLogger::gatherFiles()
 		if(minidump_stream.is_open())
 		{
 			minidump_stream.seekg(0, std::ios::end);
-			size_t length = minidump_stream.tellg();
+			size_t length = (size_t)minidump_stream.tellg();
 			minidump_stream.seekg(0, std::ios::beg);
 			
 			LLSD::Binary data;
diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp
index cc8cb66d7390802f2e41297367ab90b0886f5f70..8241746a74561b514bbe762ba9331a7b1ab6e37c 100644
--- a/indra/llimage/llimagej2c.cpp
+++ b/indra/llimage/llimagej2c.cpp
@@ -501,10 +501,10 @@ void LLImageCompressionTester::outputTestRecord(LLSD *sd)
 	F32 decompressionRate = 0.0f;
 	F32 compressionRate   = 0.0f;
 
-	F32 totalkBInDecompression  = (F32)(mTotalBytesInDecompression)  / 1000.0;
-	F32 totalkBOutDecompression = (F32)(mTotalBytesOutDecompression) / 1000.0;
-	F32 totalkBInCompression    = (F32)(mTotalBytesInCompression)    / 1000.0;
-	F32 totalkBOutCompression   = (F32)(mTotalBytesOutCompression)   / 1000.0;
+	F32 totalkBInDecompression  = (F32)(mTotalBytesInDecompression)  / 1000.f;
+	F32 totalkBOutDecompression = (F32)(mTotalBytesOutDecompression) / 1000.f;
+	F32 totalkBInCompression    = (F32)(mTotalBytesInCompression)    / 1000.f;
+	F32 totalkBOutCompression   = (F32)(mTotalBytesOutCompression)   / 1000.f;
 	
 	if (!is_approx_zero(mTotalTimeDecompression))
 	{
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 76760aa414375d6fe2b1e96bb9863833b0975348..fbf23bc3f09a760eee88c85f29cf41df9a1a5352 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -405,7 +405,7 @@ U32 LLInventoryItem::getCRC32() const
 	//lldebugs << "7 crc: " << std::hex << crc << std::dec << llendl;
 	crc += mSaleInfo.getCRC32();
 	//lldebugs << "8 crc: " << std::hex << crc << std::dec << llendl;
-	crc += mCreationDate;
+	crc += (U32)mCreationDate;
 	//lldebugs << "9 crc: " << std::hex << crc << std::dec << llendl;
 	return crc;
 }
@@ -521,7 +521,7 @@ void LLInventoryItem::packMessage(LLMessageSystem* msg) const
 	mSaleInfo.packMessage(msg);
 	msg->addStringFast(_PREHASH_Name, mName);
 	msg->addStringFast(_PREHASH_Description, mDescription);
-	msg->addS32Fast(_PREHASH_CreationDate, mCreationDate);
+	msg->addS32Fast(_PREHASH_CreationDate, (S32)mCreationDate);
 	U32 crc = getCRC32();
 	msg->addU32Fast(_PREHASH_CRC, crc);
 }
diff --git a/indra/llmath/llcalcparser.h b/indra/llmath/llcalcparser.h
index bd9c8c251917918818eed83fcfc79e78ce4dc55d..e0ad270266eb2b742697344d4d25976f53f580b2 100644
--- a/indra/llmath/llcalcparser.h
+++ b/indra/llmath/llcalcparser.h
@@ -174,7 +174,7 @@ struct LLCalcParser : grammar<LLCalcParser>
 	F32 _log(const F32& a) const { return log(a); }
 	F32 _exp(const F32& a) const { return exp(a); }
 	F32 _fabs(const F32& a) const { return fabs(a); }
-	F32 _floor(const F32& a) const { return llfloor(a); }
+	F32 _floor(const F32& a) const { return (F32)llfloor(a); }
 	F32 _ceil(const F32& a) const { return llceil(a); }
 
 	F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); }
diff --git a/indra/llmath/llcoord.h b/indra/llmath/llcoord.h
index 706ad9278705facf7e618e824b720622fd5ace41..9b76268afde6986ee08651cb129f301db31fc29a 100644
--- a/indra/llmath/llcoord.h
+++ b/indra/llmath/llcoord.h
@@ -26,80 +26,87 @@
 #ifndef LL_LLCOORD_H
 #define LL_LLCOORD_H
 
+template<typename> class LLCoord;
+struct LL_COORD_TYPE_GL;
+struct LL_COORD_TYPE_WINDOW;
+struct LL_COORD_TYPE_SCREEN;
+
+typedef LLCoord<LL_COORD_TYPE_GL> LLCoordGL;
+typedef LLCoord<LL_COORD_TYPE_WINDOW> LLCoordWindow;
+typedef LLCoord<LL_COORD_TYPE_SCREEN> LLCoordScreen;
+
+struct LLCoordCommon
+{
+	LLCoordCommon(S32 x, S32 y) : mX(x), mY(y) {}
+	LLCoordCommon() : mX(0), mY(0) {}
+	S32 mX;
+	S32 mY;
+};
+
 // A two-dimensional pixel value
-class LLCoord
+template<typename COORD_FRAME>
+class LLCoord : protected COORD_FRAME
 {
 public:
-	S32		mX;
-	S32		mY;
+	typedef LLCoord<COORD_FRAME> self_t;
+	typename COORD_FRAME::value_t	mX;
+	typename COORD_FRAME::value_t	mY;
 
 	LLCoord():	mX(0), mY(0)
 	{}
-	LLCoord(S32 x, S32 y): mX(x), mY(y)
-	{}
-	virtual ~LLCoord()
+	LLCoord(typename COORD_FRAME::value_t x, typename COORD_FRAME::value_t y): mX(x), mY(y)
 	{}
 
-	virtual void set(S32 x, S32 y)		{ mX = x; mY = y; }
-};
+	LLCoord(const LLCoordCommon& other)
+	{
+		COORD_FRAME::convertFromCommon(other);
+	}
 
+	LLCoordCommon convert() const
+	{
+		return COORD_FRAME::convertToCommon();
+	}
 
-// GL coordinates start in the client region of a window,
-// with left, bottom = 0, 0
-class LLCoordGL : public LLCoord
-{
-public:
-	LLCoordGL() : LLCoord()
-	{}
-	LLCoordGL(S32 x, S32 y) : LLCoord(x, y)
-	{}
-	bool operator==(const LLCoordGL& other) const { return mX == other.mX && mY == other.mY; }
-	bool operator!=(const LLCoordGL& other) const { return !(*this == other); }
-};
+	void set(typename COORD_FRAME::value_t x, typename COORD_FRAME::value_t y) { mX = x; mY = y;}
+	bool operator==(const self_t& other) const { return mX == other.mX && mY == other.mY; }
+	bool operator!=(const self_t& other) const { return !(*this == other); }
 
-//bool operator ==(const LLCoordGL& a, const LLCoordGL& b);
+	static const self_t& getTypedCoords(const COORD_FRAME& self) { return static_cast<const self_t&>(self); }
+	static self_t& getTypedCoords(COORD_FRAME& self) { return static_cast<self_t&>(self); }
+};
 
-// Window coords include things like window borders,
-// menu regions, etc.
-class LLCoordWindow : public LLCoord
+struct LL_COORD_TYPE_GL 
 {
-public:
-	LLCoordWindow() : LLCoord()
-	{}
-	LLCoordWindow(S32 x, S32 y) : LLCoord(x, y)
-	{}
-	bool operator==(const LLCoordWindow& other) const { return mX == other.mX && mY == other.mY; }
-	bool operator!=(const LLCoordWindow& other) const { return !(*this == other); }
-};
+	typedef S32 value_t;
 
+	LLCoordCommon convertToCommon() const
+	{
+		const LLCoordGL& self = LLCoordGL::getTypedCoords(*this);
+		return LLCoordCommon(self.mX, self.mY);
+	}
 
-// Screen coords start at left, top = 0, 0
-class LLCoordScreen : public LLCoord
+	void convertFromCommon(const LLCoordCommon& from)
+	{
+		LLCoordGL& self = LLCoordGL::getTypedCoords(*this);
+		self.mX = from.mX;
+		self.mY = from.mY;
+	}
+};
+
+struct LL_COORD_TYPE_WINDOW 
 {
-public:
-	LLCoordScreen() : LLCoord()
-	{}
-	LLCoordScreen(S32 x, S32 y) : LLCoord(x, y)
-	{}
-	bool operator==(const LLCoordScreen& other) const { return mX == other.mX && mY == other.mY; }
-	bool operator!=(const LLCoordScreen& other) const { return !(*this == other); }
+	typedef S32 value_t;
+
+	LLCoordCommon convertToCommon() const;
+	void convertFromCommon(const LLCoordCommon& from);
 };
 
-class LLCoordFont : public LLCoord
+struct LL_COORD_TYPE_SCREEN 
 {
-public:
-	F32 mZ;
-	
-	LLCoordFont() : LLCoord(), mZ(0.f)
-	{}
-	LLCoordFont(S32 x, S32 y, F32 z = 0) : LLCoord(x,y), mZ(z)
-	{}
-	
-	void set(S32 x, S32 y) { LLCoord::set(x,y); mZ = 0.f; }
-	void set(S32 x, S32 y, F32 z) { mX = x; mY = y; mZ = z; }
-	bool operator==(const LLCoordFont& other) const { return mX == other.mX && mY == other.mY; }
-	bool operator!=(const LLCoordFont& other) const { return !(*this == other); }
+	typedef S32 value_t;
+
+	LLCoordCommon convertToCommon() const;
+	void convertFromCommon(const LLCoordCommon& from);
 };
-	
 
 #endif
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 761fc171c466784d1cb5561d97a2e2814e46af3d..cc9744756fd4d4ba19ffb11c83229f9b3f4a0d1a 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -2904,7 +2904,7 @@ F32 LLVolume::sculptGetSurfaceArea()
 			// compute the area of the quad by taking the length of the cross product of the two triangles
 			LLVector3 cross1 = (p1 - p2) % (p1 - p3);
 			LLVector3 cross2 = (p4 - p2) % (p4 - p3);
-			area += (cross1.magVec() + cross2.magVec()) / 2.0;
+			area += (cross1.magVec() + cross2.magVec()) / 2.f;
 		}
 	}
 
@@ -5890,7 +5890,7 @@ F32 find_vertex_score(LLVCacheVertexData& data)
 	}
 
 	//bonus points for having low valence
-	F32 valence_boost = powf(data.mActiveTriangles, -FindVertexScore_ValenceBoostPower);
+	F32 valence_boost = powf((F32)data.mActiveTriangles, -FindVertexScore_ValenceBoostPower);
 	score += FindVertexScore_ValenceBoostScale * valence_boost;
 
 	return score;
diff --git a/indra/llmath/m4math.cpp b/indra/llmath/m4math.cpp
index bad4deb4dee87498382345aa2b8da3578c80d667..6a1b4143cfd64e9474f51e94645d54e2c7cda146 100644
--- a/indra/llmath/m4math.cpp
+++ b/indra/llmath/m4math.cpp
@@ -858,25 +858,25 @@ LLSD LLMatrix4::getValue() const
 
 void LLMatrix4::setValue(const LLSD& data) 
 {
-	mMatrix[0][0] = data[0].asReal();
-	mMatrix[0][1] = data[1].asReal();
-	mMatrix[0][2] = data[2].asReal();
-	mMatrix[0][3] = data[3].asReal();
-
-	mMatrix[1][0] = data[4].asReal();
-	mMatrix[1][1] = data[5].asReal();
-	mMatrix[1][2] = data[6].asReal();
-	mMatrix[1][3] = data[7].asReal();
-
-	mMatrix[2][0] = data[8].asReal();
-	mMatrix[2][1] = data[9].asReal();
-	mMatrix[2][2] = data[10].asReal();
-	mMatrix[2][3] = data[11].asReal();
-
-	mMatrix[3][0] = data[12].asReal();
-	mMatrix[3][1] = data[13].asReal();
-	mMatrix[3][2] = data[14].asReal();
-	mMatrix[3][3] = data[15].asReal();
+	mMatrix[0][0] = (F32)data[0].asReal();
+	mMatrix[0][1] = (F32)data[1].asReal();
+	mMatrix[0][2] = (F32)data[2].asReal();
+	mMatrix[0][3] = (F32)data[3].asReal();
+
+	mMatrix[1][0] = (F32)data[4].asReal();
+	mMatrix[1][1] = (F32)data[5].asReal();
+	mMatrix[1][2] = (F32)data[6].asReal();
+	mMatrix[1][3] = (F32)data[7].asReal();
+
+	mMatrix[2][0] = (F32)data[8].asReal();
+	mMatrix[2][1] = (F32)data[9].asReal();
+	mMatrix[2][2] = (F32)data[10].asReal();
+	mMatrix[2][3] = (F32)data[11].asReal();
+
+	mMatrix[3][0] = (F32)data[12].asReal();
+	mMatrix[3][1] = (F32)data[13].asReal();
+	mMatrix[3][2] = (F32)data[14].asReal();
+	mMatrix[3][3] = (F32)data[15].asReal();
 }
 
 
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 3bcaffc27586ed162a3fdd33582cc3bd64d6bdcb..b93d429feb492070221bf85168214b38c439f92b 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -271,10 +271,10 @@ void LLCurl::Easy::releaseEasyHandle(CURL* handle)
 
 		if(sFreeHandles.size() < MAX_NUM_FREE_HANDLES)
 		{
-			sFreeHandles.insert(handle);
-		}
-		else
-		{
+		sFreeHandles.insert(handle);
+	}
+	else
+	{
 			LLCurl::deleteEasyHandle(handle) ;
 		}
 	}
@@ -453,9 +453,9 @@ size_t curlReadCallback(char* data, size_t size, size_t nmemb, void* user_data)
 	LLCurl::Easy* easy = (LLCurl::Easy*)user_data;
 	
 	S32 n = size * nmemb;
-	S32 startpos = easy->getInput().tellg();
+	S32 startpos = (S32)easy->getInput().tellg();
 	easy->getInput().seekg(0, std::ios::end);
-	S32 endpos = easy->getInput().tellg();
+	S32 endpos = (S32)easy->getInput().tellg();
 	easy->getInput().seekg(startpos, std::ios::beg);
 	S32 maxn = endpos - startpos;
 	n = llmin(n, maxn);
@@ -560,16 +560,16 @@ LLCurl::Multi::Multi(F32 idle_time_out)
 	}
 	
 	//llassert_always(mCurlMultiHandle);	
-	
+
 	if(mCurlMultiHandle)
 	{
-		if(LLCurl::getCurlThread()->getThreaded())
-		{
-			mMutexp = new LLMutex(NULL) ;
-			mDeletionMutexp = new LLMutex(NULL) ;
-			mEasyMutexp = new LLMutex(NULL) ;
-		}
-		LLCurl::getCurlThread()->addMulti(this) ;
+	if(LLCurl::getCurlThread()->getThreaded())
+	{
+		mMutexp = new LLMutex(NULL) ;
+		mDeletionMutexp = new LLMutex(NULL) ;
+		mEasyMutexp = new LLMutex(NULL) ;
+	}
+	LLCurl::getCurlThread()->addMulti(this) ;
 
 		mIdleTimeOut = idle_time_out ;
 		if(mIdleTimeOut < LLCurl::sCurlRequestTimeOut)
@@ -577,8 +577,8 @@ LLCurl::Multi::Multi(F32 idle_time_out)
 			mIdleTimeOut = LLCurl::sCurlRequestTimeOut ;
 		}
 
-		++gCurlMultiCount;
-	}
+	++gCurlMultiCount;
+}
 }
 
 LLCurl::Multi::~Multi()
@@ -617,7 +617,7 @@ void LLCurl::Multi::cleanup()
 	mDeletionMutexp = NULL ;
 	delete mEasyMutexp ;
 	mEasyMutexp = NULL ;
-	
+
 	mQueued = 0 ;
 	mState = STATE_COMPLETED;
 	
@@ -738,7 +738,7 @@ bool LLCurl::Multi::doPerform()
 		}
 
 		mQueued = q;	
-		setState(STATE_COMPLETED) ;		
+		setState(STATE_COMPLETED) ;
 		mIdleTimer.reset() ;
 	}
 	else if(mIdleTimer.getElapsedTimeF32() > mIdleTimeOut) //idle for too long, remove it.
@@ -911,8 +911,8 @@ bool LLCurlThread::CurlRequest::processRequest()
 
 		if(!completed)
 		{
-			setPriority(LLQueuedThread::PRIORITY_LOW) ;
-		}
+		setPriority(LLQueuedThread::PRIORITY_LOW) ;
+	}
 	}
 
 	return completed ;
@@ -922,7 +922,7 @@ void LLCurlThread::CurlRequest::finishRequest(bool completed)
 {
 	if(mMulti->isDead())
 	{
-		mCurlThread->deleteMulti(mMulti) ;
+	mCurlThread->deleteMulti(mMulti) ;
 	}
 	else
 	{
@@ -968,8 +968,8 @@ void LLCurlThread::killMulti(LLCurl::Multi* multi)
 
 	if(multi->isValid())
 	{
-		multi->markDead() ;
-	}
+	multi->markDead() ;
+}
 	else
 	{
 		deleteMulti(multi) ;
@@ -1033,7 +1033,7 @@ void LLCurlRequest::addMulti()
 		mActiveRequestCount = 0 ;
 		return;
 	}
-
+	
 	mMultiSet.insert(multi);
 	mActiveMulti = multi;
 	mActiveRequestCount = 0;
@@ -1229,15 +1229,15 @@ LLCurlEasyRequest::LLCurlEasyRequest()
 	
 	if(mMulti->isValid())
 	{
-		mEasy = mMulti->allocEasy();
-		if (mEasy)
-		{
-			mEasy->setErrorBuffer();
-			mEasy->setCA();
-			// Set proxy settings if configured to do so.
-			LLProxy::getInstance()->applyProxySettings(mEasy);
-		}
+	mEasy = mMulti->allocEasy();
+	if (mEasy)
+	{
+		mEasy->setErrorBuffer();
+		mEasy->setCA();
+		// Set proxy settings if configured to do so.
+		LLProxy::getInstance()->applyProxySettings(mEasy);
 	}
+}
 	else
 	{
 		LLCurl::getCurlThread()->killMulti(mMulti) ;
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 231cb7ca8f61f67883ea5b406fcf690424f74738..0c325a68aaed740a04a71019a4163b86b64ad999 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -158,7 +158,7 @@ namespace
 			if(fstream.is_open())
 			{
 				fstream.seekg(0, std::ios::end);
-				U32 fileSize = fstream.tellg();
+				U32 fileSize = (U32)fstream.tellg();
 				fstream.seekg(0, std::ios::beg);
 				std::vector<char> fileBuffer(fileSize);
 				fstream.read(&fileBuffer[0], fileSize);
diff --git a/indra/llmessage/llmime.cpp b/indra/llmessage/llmime.cpp
index 943a734927b933268917d38ed6ad8e2b49a65ffa..9d9c4ebd6899f8eb0c4292ae5b9d8bb3ad94f649 100644
--- a/indra/llmessage/llmime.cpp
+++ b/indra/llmessage/llmime.cpp
@@ -388,7 +388,7 @@ bool LLMimeParser::Impl::parseHeaders(
 		// not to read past limit when we get() the newline.
 		S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
 		istr.getline(mBuffer, max_get, '\r');
-		mScanCount += istr.gcount();
+		mScanCount += (S32)istr.gcount();
 		int c = istr.get();
 		if(EOF == c)
 		{
@@ -496,7 +496,7 @@ void LLMimeParser::Impl::scanPastSeparator(
 		// past limit when we get() the newline.
 		S32 max_get = llmin((S32)LINE_BUFFER_LENGTH, limit - mScanCount - 1);
 		istr.getline(mBuffer, max_get, '\r');
-		mScanCount += istr.gcount();
+		mScanCount += (S32)istr.gcount();
 		if(istr.gcount() >= LINE_BUFFER_LENGTH - 1)
 		{
 			// that's way too long to be a separator, so ignore it.
diff --git a/indra/llmessage/llsdmessage.cpp b/indra/llmessage/llsdmessage.cpp
index 9148c9dd150fd5d27bd37b2914f91b57e06ece1d..1c93c12d990a35ca97e9ae2d4b97db73f0c0ba4d 100644
--- a/indra/llmessage/llsdmessage.cpp
+++ b/indra/llmessage/llsdmessage.cpp
@@ -88,7 +88,7 @@ bool LLSDMessage::httpListener(const LLSD& request)
                                                        request,
                                                        url, "POST", reply, error),
                        LLSD(),      // headers
-                       timeout);
+                       (F32)timeout);
     return false;
 }
 
diff --git a/indra/llmessage/llsdmessagebuilder.cpp b/indra/llmessage/llsdmessagebuilder.cpp
index 2698a271ee972e4c58266b892f840e3e7bebd4b0..615221e0ad086c54288c030fc24144f8836ebca5 100644
--- a/indra/llmessage/llsdmessagebuilder.cpp
+++ b/indra/llmessage/llsdmessagebuilder.cpp
@@ -317,7 +317,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data)
 
 			// S64 not supported in LLSD so we just truncate it
 			case MVT_S64:
-				addS32(varname, *(S64*)mvci.getData());
+				addS32(varname, (S32)*(S64*)mvci.getData());
 				break;
 
 			case MVT_F32:
diff --git a/indra/llmessage/llxfer.h b/indra/llmessage/llxfer.h
index 989e8b2cab1bb8be75b41ba8a6b3c505997159a7..f9348eb11f100cd9e11ade66cdb27625dd8858b0 100644
--- a/indra/llmessage/llxfer.h
+++ b/indra/llmessage/llxfer.h
@@ -29,6 +29,7 @@
 
 #include "message.h"
 #include "lltimer.h"
+#include "llextendedstatus.h"
 
 const S32 LL_XFER_LARGE_PAYLOAD = 7680;
 
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index d0b0e178b83625400f790737d0f45eb1d5aba00a..6a425cfe98a1c7d8a4545365393f526d4237aea4 100644
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -3147,7 +3147,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi
 		LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl;
 	}
 
-	U32 now = time(NULL);
+	U32 now = (U32)time(NULL);
 
 	now /= window;
 
@@ -3167,7 +3167,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons
 	}
 	
 	char our_digest[MD5HEX_STR_SIZE];	/* Flawfinder: ignore */
-	U32 now = time(NULL);
+	U32 now = (U32)time(NULL);
 
 	now /= window;
 
@@ -3213,7 +3213,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co
 		LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl;
 	}
 
-	U32 now = time(NULL);
+	U32 now = (U32)time(NULL);
 
 	now /= window;
 
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index 82e8227ffe593060ae06b86fbca4dd783ac28863..fccbf37a8dd407f0a37c093ab931f977ef106d88 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -56,8 +56,9 @@ std::string LLFontGL::sAppDir;
 LLColor4 LLFontGL::sShadowColor(0.f, 0.f, 0.f, 1.f);
 LLFontRegistry* LLFontGL::sFontRegistry = NULL;
 
-LLCoordFont LLFontGL::sCurOrigin;
-std::vector<LLCoordFont> LLFontGL::sOriginStack;
+LLCoordGL LLFontGL::sCurOrigin;
+F32 LLFontGL::sCurDepth;
+std::vector<std::pair<LLCoordGL, F32> > LLFontGL::sOriginStack;
 
 const F32 EXT_X_BEARING = 1.f;
 const F32 EXT_Y_BEARING = 0.f;
@@ -68,20 +69,6 @@ const F32 PIXEL_CORRECTION_DISTANCE = 0.01f;
 const F32 PAD_UVY = 0.5f; // half of vertical padding between glyphs in the glyph texture
 const F32 DROP_SHADOW_SOFT_STRENGTH = 0.3f;
 
-static F32 llfont_round_x(F32 x)
-{
-	//return llfloor((x-LLFontGL::sCurOrigin.mX)/LLFontGL::sScaleX+0.5f)*LLFontGL::sScaleX+LLFontGL::sCurOrigin.mX;
-	//return llfloor(x/LLFontGL::sScaleX+0.5f)*LLFontGL::sScaleY;
-	return x;
-}
-
-static F32 llfont_round_y(F32 y)
-{
-	//return llfloor((y-LLFontGL::sCurOrigin.mY)/LLFontGL::sScaleY+0.5f)*LLFontGL::sScaleY+LLFontGL::sCurOrigin.mY;
-	//return llfloor(y+0.5f);
-	return y;
-}
-
 LLFontGL::LLFontGL()
 {
 }
@@ -115,23 +102,23 @@ static LLFastTimer::DeclareTimer FTM_RENDER_FONTS("Fonts");
 S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, 
 					 ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_ellipses) const
 {
-	F32 x = rect.mLeft;
+	F32 x = (F32)rect.mLeft;
 	F32 y = 0.f;
 
 	switch(valign)
 	{
 	case TOP:
-		y = rect.mTop;
+		y = (F32)rect.mTop;
 		break;
 	case VCENTER:
-		y = rect.getCenterY();
+		y = (F32)rect.getCenterY();
 		break;
 	case BASELINE:
 	case BOTTOM:
-		y = rect.mBottom;
+		y = (F32)rect.mBottom;
 		break;
 	default:
-		y = rect.mBottom;
+		y = (F32)rect.mBottom;
 		break;
 	}
 	return render(wstr, begin_offset, x, y, color, halign, valign, style, shadow, max_chars, rect.getWidth(), right_x, use_ellipses);
@@ -177,21 +164,11 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 
 	gGL.loadUIIdentity();
 	
-	//gGL.translateUI(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ);
-
-	// this code snaps the text origin to a pixel grid to start with
-	//F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX);
-	//F32 pixel_offset_y = llround((F32)sCurOrigin.mY) - (sCurOrigin.mY);
-	//gGL.translateUI(-pixel_offset_x, -pixel_offset_y, 0.f);
-
 	LLVector2 origin(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY));
-	// snap the text origin to a pixel grid to start with
-	origin.mV[VX] -= llround((F32)sCurOrigin.mX) - (sCurOrigin.mX);
-	origin.mV[VY] -= llround((F32)sCurOrigin.mY) - (sCurOrigin.mY);
 
-	// Depth translation, so that floating text appears 'inworld'
-	// and is correclty occluded.
-	gGL.translatef(0.f,0.f,sCurOrigin.mZ);
+	// Depth translation, so that floating text appears 'in-world'
+	// and is correctly occluded.
+	gGL.translatef(0.f,0.f,sCurDepth);
 
 	S32 chars_drawn = 0;
 	S32 i;
@@ -215,16 +192,17 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 	cur_y = ((F32)y * sScaleY) + origin.mV[VY];
 
 	// Offset y by vertical alignment.
+	// use unscaled font metrics here
 	switch (valign)
 	{
 	case TOP:
-		cur_y -= mFontFreetype->getAscenderHeight();
+		cur_y -= llceil(mFontFreetype->getAscenderHeight());
 		break;
 	case BOTTOM:
-		cur_y += mFontFreetype->getDescenderHeight();
+		cur_y += llceil(mFontFreetype->getDescenderHeight());
 		break;
 	case VCENTER:
-		cur_y -= (mFontFreetype->getAscenderHeight() - mFontFreetype->getDescenderHeight()) / 2.f;
+		cur_y -= llceil((llceil(mFontFreetype->getAscenderHeight()) - llceil(mFontFreetype->getDescenderHeight())) / 2.f);
 		break;
 	case BASELINE:
 		// Baseline, do nothing.
@@ -250,7 +228,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 	cur_render_y = cur_y;
 	cur_render_x = cur_x;
 
-	F32 start_x = llround(cur_x);
+	F32 start_x = (F32)llround(cur_x);
 
 	const LLFontBitmapCache* font_bitmap_cache = mFontFreetype->getFontBitmapCache();
 
@@ -334,10 +312,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 				(fgi->mXBitmapOffset + fgi->mWidth) * inv_width,
 				(fgi->mYBitmapOffset - PAD_UVY) * inv_height);
 		// snap glyph origin to whole screen pixel
-		LLRectf screen_rect(llround(cur_render_x + (F32)fgi->mXBearing),
-				    llround(cur_render_y + (F32)fgi->mYBearing),
-				    llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth,
-				    llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight);
+		LLRectf screen_rect((F32)llround(cur_render_x + (F32)fgi->mXBearing),
+				    (F32)llround(cur_render_y + (F32)fgi->mYBearing),
+				    (F32)llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth,
+				    (F32)llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight);
 		
 		if (glyph_count >= GLYPH_BATCH_SIZE)
 		{
@@ -390,12 +368,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
 	//FIXME: add underline as glyph?
 	if (style_to_add & UNDERLINE)
 	{
-		F32 descender = mFontFreetype->getDescenderHeight();
+		F32 descender = (F32)llfloor(mFontFreetype->getDescenderHeight());
 
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		gGL.begin(LLRender::LINES);
-		gGL.vertex2f(start_x, cur_y - (descender));
-		gGL.vertex2f(cur_x, cur_y - (descender));
+		gGL.vertex2f(start_x, cur_y - descender);
+		gGL.vertex2f(cur_x, cur_y - descender);
 		gGL.end();
 	}
 
@@ -444,19 +422,9 @@ S32 LLFontGL::renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y
 }
 
 // font metrics - override for LLFontFreetype that returns units of virtual pixels
-F32 LLFontGL::getLineHeight() const
+S32 LLFontGL::getLineHeight() const
 { 
-	return (F32)llround(mFontFreetype->getLineHeight() / sScaleY); 
-}
-
-F32 LLFontGL::getAscenderHeight() const
-{ 
-	return (F32)llround(mFontFreetype->getAscenderHeight() / sScaleY); 
-}
-
-F32 LLFontGL::getDescenderHeight() const
-{ 
-	return (F32)llround(mFontFreetype->getDescenderHeight() / sScaleY); 
+	return llceil(mFontFreetype->getAscenderHeight() / sScaleY) + llceil(mFontFreetype->getDescenderHeight() / sScaleY);
 }
 
 S32 LLFontGL::getWidth(const std::string& utf8text) const
@@ -645,7 +613,7 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch
 		}
 
 		// Round after kerning.
-		cur_x = llround(cur_x);
+		cur_x = (F32)llround(cur_x);
 		drawn_x = cur_x;
 	}
 
@@ -716,7 +684,7 @@ S32	LLFontGL::firstDrawableChar(const llwchar* wchars, F32 max_pixels, S32 text_
 		}
 
 		// Round after kerning.
-		total_width = llround(total_width);
+		total_width = (F32)llround(total_width);
 	}
 
 	if (drawable_chars == 0)
@@ -799,7 +767,7 @@ S32 LLFontGL::charFromPixelOffset(const llwchar* wchars, S32 begin_offset, F32 t
 
 
 		// Round after kerning.
-		cur_x = llround(cur_x);
+		cur_x = (F32)llround(cur_x);
 	}
 
 	return llmin(max_chars, pos - begin_offset);
@@ -1146,22 +1114,22 @@ void LLFontGL::renderQuad(LLVector3* vertex_out, LLVector2* uv_out, LLColor4U* c
 {
 	S32 index = 0;
 
-	vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mRight), llfont_round_y(screen_rect.mTop), 0.f);
+	vertex_out[index] = LLVector3(screen_rect.mRight, screen_rect.mTop, 0.f);
 	uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
 	colors_out[index] = color;
 	index++;
 
-	vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mLeft), llfont_round_y(screen_rect.mTop), 0.f);
+	vertex_out[index] = LLVector3(screen_rect.mLeft, screen_rect.mTop, 0.f);
 	uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
 	colors_out[index] = color;
 	index++;
 
-	vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mLeft), llfont_round_y(screen_rect.mBottom), 0.f);
+	vertex_out[index] = LLVector3(screen_rect.mLeft, screen_rect.mBottom, 0.f);
 	uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom);
 	colors_out[index] = color;
 	index++;
 
-	vertex_out[index] = LLVector3(llfont_round_x(screen_rect.mRight), llfont_round_y(screen_rect.mBottom), 0.f);
+	vertex_out[index] = LLVector3(screen_rect.mRight, screen_rect.mBottom, 0.f);
 	uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom);
 	colors_out[index] = color;
 }
diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h
index dc8d848ed25a11ba7a8589f17835d7f8e5937a38..74bdbb43e7424497820c08353b7125e81295ba3f 100644
--- a/indra/llrender/llfontgl.h
+++ b/indra/llrender/llfontgl.h
@@ -115,9 +115,7 @@ class LLFontGL
 	S32 renderUTF8(const std::string &text, S32 begin_offset, S32 x, S32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style = NORMAL, ShadowType shadow = NO_SHADOW) const;
 
 	// font metrics - override for LLFontFreetype that returns units of virtual pixels
-	F32 getLineHeight() const;
-	F32 getAscenderHeight() const;
-	F32 getDescenderHeight() const;
+	S32 getLineHeight() const;
 
 	S32 getWidth(const std::string& utf8text) const;
 	S32 getWidth(const llwchar* wchars) const;
@@ -188,8 +186,9 @@ class LLFontGL
 	static std::string getFontPathLocal();
 	static std::string getFontPathSystem();
 
-	static LLCoordFont sCurOrigin;
-	static std::vector<LLCoordFont> sOriginStack;
+	static LLCoordGL sCurOrigin;
+	static F32			sCurDepth;
+	static std::vector<std::pair<LLCoordGL, F32> > sOriginStack;
 
 	static LLColor4 sShadowColor;
 
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index 7a5f9f9fd6c924686d7ef14e8331f42058ff9e3a..c025cd7939e5443cd6581d24be2821d0fd199b80 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -976,7 +976,7 @@ void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child)
 			gGL.matrixMode(LLRender::MM_MODELVIEW);
 			LLUI::pushMatrix();
 			{
-				LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom, 0.f);
+				LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom);
 				child->draw();
 
 			}
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index f0d92d597a7fd987d0ff8ba327ababfc4f79a8b7..705fe165593111289a16243100e002db8c138b2c 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -908,9 +908,9 @@ void LLButton::draw()
 		// Not sure if it is really needed. Probably S32_MAX should be always passed as max_chars.
 		mLastDrawCharsCount = mGLFont->render(label, 0,
 			(F32)x,
-			(F32)(mBottomVPad + y_offset),
+			(F32)(getRect().getHeight() / 2 + mBottomVPad),
 			label_color % alpha,
-			mHAlign, LLFontGL::BOTTOM,
+			mHAlign, LLFontGL::VCENTER,
 			LLFontGL::NORMAL,
 			mDropShadowedText ? LLFontGL::DROP_SHADOW_SOFT : LLFontGL::NO_SHADOW,
 			S32_MAX, text_width,
diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp
index 6910b962a1932ce09c9e31bc5f120a3e460ece1b..14173fdbb0a6f9fdbb228896fd113b411875f50a 100644
--- a/indra/llui/llclipboard.cpp
+++ b/indra/llui/llclipboard.cpp
@@ -34,109 +34,113 @@
 #include "llview.h"
 #include "llwindow.h"
 
-// Global singleton
-LLClipboard gClipboard;
-
-
-LLClipboard::LLClipboard()
+LLClipboard::LLClipboard() :
+	mGeneration(0)
 {
-	mSourceItem = NULL;
+	reset();
 }
 
-
 LLClipboard::~LLClipboard()
 {
+	reset();
 }
 
-
-void LLClipboard::copyFromSubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id )
+void LLClipboard::reset()
 {
-	mSourceID = source_id;
-	mString = src.substr(pos, len);
-	LLView::getWindow()->copyTextToClipboard( mString );
+	// Increment the clipboard count
+	mGeneration++;
+	// Clear the clipboard
+	mObjects.clear();
+	mCutMode = false;
+	mString = LLWString();
 }
 
-void LLClipboard::copyFromString(const LLWString &src, const LLUUID& source_id )
+// Copy the input uuid to the LL clipboard
+bool LLClipboard::copyToClipboard(const LLUUID& src, const LLAssetType::EType type)
 {
-	mSourceID = source_id;
-	mString = src;
-	LLView::getWindow()->copyTextToClipboard( mString );
+	reset();
+	return addToClipboard(src, type);
 }
 
-const LLWString& LLClipboard::getPasteWString( LLUUID* source_id )
+// Add the input uuid to the LL clipboard
+// Convert the uuid to string and concatenate that string to the system clipboard if legit
+bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType type)
 {
-	if( mSourceID.notNull() )
+	bool res = false;
+	if (src.notNull())
 	{
-		LLWString temp_string;
-		LLView::getWindow()->pasteTextFromClipboard(temp_string);
-
-		if( temp_string != mString )
+		res = true;
+		if (LLAssetType::lookupIsAssetIDKnowable(type))
 		{
-			mSourceID.setNull();
-			mString = temp_string;
+			LLWString source = utf8str_to_wstring(src.asString());
+			res = addToClipboard(source, 0, source.size());
+		}
+		if (res)
+		{
+			mObjects.push_back(src);
+			mGeneration++;
 		}
 	}
-	else
-	{
-		LLView::getWindow()->pasteTextFromClipboard(mString);
-	}
+	return res;
+}
 
-	if( source_id )
+bool LLClipboard::pasteFromClipboard(std::vector<LLUUID>& inv_objects) const
+{
+	bool res = false;
+	S32 count = mObjects.size();
+	if (count > 0)
 	{
-		*source_id = mSourceID;
+		res = true;
+		inv_objects.clear();
+		for (S32 i = 0; i < count; i++)
+		{
+			inv_objects.push_back(mObjects[i]);
+		}
 	}
-
-	return mString;
+	return res;
 }
 
+// Returns true if the LL Clipboard has pasteable items in it
+bool LLClipboard::hasContents() const
+{
+	return (mObjects.size() > 0);
+}
 
-BOOL LLClipboard::canPasteString() const
+// Returns true if the input uuid is in the list of clipboard objects
+bool LLClipboard::isOnClipboard(const LLUUID& object) const
 {
-	return LLView::getWindow()->isClipboardTextAvailable();
+	std::vector<LLUUID>::const_iterator iter = std::find(mObjects.begin(), mObjects.end(), object);
+	return (iter != mObjects.end());
 }
 
+// Copy the input string to the LL and the system clipboard
+bool LLClipboard::copyToClipboard(const LLWString &src, S32 pos, S32 len, bool use_primary)
+{
+	return addToClipboard(src, pos, len, use_primary);
+}
 
-void LLClipboard::copyFromPrimarySubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id )
+// Concatenate the input string to the LL and the system clipboard
+bool LLClipboard::addToClipboard(const LLWString &src, S32 pos, S32 len, bool use_primary)
 {
-	mSourceID = source_id;
 	mString = src.substr(pos, len);
-	LLView::getWindow()->copyTextToPrimary( mString );
+	return (use_primary ? LLView::getWindow()->copyTextToPrimary(mString) : LLView::getWindow()->copyTextToClipboard(mString));
 }
 
-
-const LLWString& LLClipboard::getPastePrimaryWString( LLUUID* source_id )
+// Copy the System clipboard to the output string.
+// Manage the LL Clipboard / System clipboard consistency
+bool LLClipboard::pasteFromClipboard(LLWString &dst, bool use_primary)
 {
-	if( mSourceID.notNull() )
-	{
-		LLWString temp_string;
-		LLView::getWindow()->pasteTextFromPrimary(temp_string);
-
-		if( temp_string != mString )
-		{
-			mSourceID.setNull();
-			mString = temp_string;
-		}
-	}
-	else
-	{
-		LLView::getWindow()->pasteTextFromPrimary(mString);
-	}
-
-	if( source_id )
+	bool res = (use_primary ? LLView::getWindow()->pasteTextFromPrimary(dst) : LLView::getWindow()->pasteTextFromClipboard(dst));
+	if (res)
 	{
-		*source_id = mSourceID;
+		mString = dst;
 	}
-
-	return mString;
+	return res;
 }
 
-
-BOOL LLClipboard::canPastePrimaryString() const
+// Return true if there's something on the System clipboard
+bool LLClipboard::isTextAvailable(bool use_primary) const
 {
-	return LLView::getWindow()->isPrimaryTextAvailable();
+	return (use_primary ? LLView::getWindow()->isPrimaryTextAvailable() : LLView::getWindow()->isClipboardTextAvailable());
 }
 
-void LLClipboard::setSourceObject(const LLUUID& source_id, LLAssetType::EType type) 
-{
-	mSourceItem = new LLInventoryObject (source_id, LLUUID::null, type, "");
-}
diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h
index 9371b9428447ae2c8deb3ba3238d726dca41a7cb..fd2e7610df4bda53d4809748478a2479fa2b84a8 100644
--- a/indra/llui/llclipboard.h
+++ b/indra/llui/llclipboard.h
@@ -27,46 +27,68 @@
 #ifndef LL_LLCLIPBOARD_H
 #define LL_LLCLIPBOARD_H
 
+#include <boost/function.hpp>
 
 #include "llstring.h"
 #include "lluuid.h"
 #include "stdenums.h"
+#include "llsingleton.h"
+#include "llassettype.h"
 #include "llinventory.h"
 
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLClipboard
+//
+// This class is used to cut/copy/paste text strings and inventory items around 
+// the world. Use LLClipboard::instance().method() to use its methods.
+// Note that the text and UUIDs are loosely coupled only. There are few cases
+// where the viewer does offer a serialized version of the UUID on the clipboard.
+// In those case, the text is overridden when copying/cutting the item. 
+// In all other cases, the text and the UUIDs are very much independent.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-class LLClipboard
+class LLClipboard : public LLSingleton<LLClipboard>
 {
 public:
 	LLClipboard();
 	~LLClipboard();
+	
+	// Clears the clipboard
+	void reset();
+	// Returns the state of the clipboard so client can know if it has been modified (comparing with tracked state)
+	int	getGeneration() const { return mGeneration; }
 
-	/* We support two flavors of clipboard.  The default is the explicitly
-	   copy-and-pasted clipboard.  The second is the so-called 'primary' clipboard
-	   which is implicitly copied upon selection on platforms which expect this
-	   (i.e. X11/Linux). */
-
-	void		copyFromSubstring(const LLWString &copy_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null );
-	void		copyFromString(const LLWString &copy_from, const LLUUID& source_id = LLUUID::null );
-	BOOL		canPasteString() const;
-	const LLWString&	getPasteWString(LLUUID* source_id = NULL);
+	// Text strings management:
+	// ------------------------
+	// We support two flavors of text clipboards. The default is the explicitly
+	// copy-and-pasted clipboard. The second is the so-called 'primary' clipboard
+	// which is implicitly copied upon selection on platforms which expect this
+	// (i.e. X11/Linux, Mac).
+	bool copyToClipboard(const LLWString& src, S32 pos, S32 len, bool use_primary = false);
+	bool addToClipboard(const LLWString& src, S32 pos, S32 len, bool use_primary = false);
+	bool pasteFromClipboard(LLWString& dst, bool use_primary = false);
+	bool isTextAvailable(bool use_primary = false) const;
+	
+	// Object list management:
+	// -----------------------
+	// Clears and adds one single object to the clipboard
+	bool copyToClipboard(const LLUUID& src, const LLAssetType::EType type = LLAssetType::AT_NONE);
+	// Adds one object to the current list of objects on the clipboard
+	bool addToClipboard(const LLUUID& src, const LLAssetType::EType type = LLAssetType::AT_NONE);
+	// Gets a copy of the objects on the clipboard
+	bool pasteFromClipboard(std::vector<LLUUID>& inventory_objects) const;
+	
+	bool hasContents() const;										// True if the clipboard has pasteable objects
+	bool isOnClipboard(const LLUUID& object) const;					// True if the input object uuid is on the clipboard
 
-	void		copyFromPrimarySubstring(const LLWString &copy_from, S32 pos, S32 len, const LLUUID& source_id = LLUUID::null );
-	BOOL		canPastePrimaryString() const;
-	const LLWString&	getPastePrimaryWString(LLUUID* source_id = NULL);	
+	bool isCutMode() const { return mCutMode; }
+	void setCutMode(bool mode) { mCutMode = mode; mGeneration++; }
 
-	// Support clipboard for object known only by their uuid and asset type
-	void		  setSourceObject(const LLUUID& source_id, LLAssetType::EType type);
-	const LLInventoryObject* getSourceObject() { return mSourceItem; }
-	
 private:
-	LLUUID      mSourceID;
-	LLWString	mString;
-	LLInventoryObject* mSourceItem;
+	std::vector<LLUUID> mObjects;		// Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat)
+	LLWString mString;					// The text string. If mObjects is not empty, this string is reflecting them (UUIDs for the moment) if the asset type is knowable.
+	bool mCutMode;						// This is a convenience flag for the viewer.
+	int mGeneration;					// Incremented when the clipboard changes so that interested parties can check for changes on the clipboard.	
 };
 
-
-// Global singleton
-extern LLClipboard gClipboard;
-
-
 #endif  // LL_LLCLIPBOARD_H
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 89d8842393be9247c54273ad7ea40589fd0635eb..806d2ef3f65d6b1e0aa6993e537fc2e42eaa8414 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -613,7 +613,7 @@ void LLComboBox::showList()
 	}
 	mList->setOrigin(rect.mLeft, rect.mBottom);
 	mList->reshape(rect.getWidth(), rect.getHeight());
-	mList->translateIntoRect(root_view_local, FALSE);
+	mList->translateIntoRect(root_view_local);
 
 	// Make sure we didn't go off bottom of screen
 	S32 x, y;
diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp
index 42e6c3c78621fd5c73bec8dfba5d02a92cb72472..5f69c6af31581b1024312c947e7abe332afbfb47 100644
--- a/indra/llui/lldraghandle.cpp
+++ b/indra/llui/lldraghandle.cpp
@@ -244,7 +244,7 @@ void LLDragHandleTop::reshapeTitleBox()
 	const LLFontGL* font = LLFontGL::getFontSansSerif();
 	S32 title_width = getRect().getWidth();
 	title_width -= LEFT_PAD + 2 * BORDER_PAD + getButtonsRect().getWidth();
-	S32 title_height = llround(font->getLineHeight());
+	S32 title_height = font->getLineHeight();
 	LLRect title_rect;
 	title_rect.setLeftTopAndSize( 
 		LEFT_PAD, 
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 33548151fd88401012497a3802c505d745ecaf6c..f6d4daba4ec75e5d0afaba5502180906e3403be2 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -68,10 +68,10 @@ namespace LLInitParam
 {
 	void TypeValues<LLFloaterEnums::EOpenPositioning>::declareValues()
 	{
-		declare("none",       LLFloaterEnums::OPEN_POSITIONING_NONE);
-		declare("cascading",  LLFloaterEnums::OPEN_POSITIONING_CASCADING);
-		declare("centered",   LLFloaterEnums::OPEN_POSITIONING_CENTERED);
-		declare("specified",  LLFloaterEnums::OPEN_POSITIONING_SPECIFIED);
+		declare("relative",   LLFloaterEnums::POSITIONING_RELATIVE);
+		declare("cascading",  LLFloaterEnums::POSITIONING_CASCADING);
+		declare("centered",   LLFloaterEnums::POSITIONING_CENTERED);
+		declare("specified",  LLFloaterEnums::POSITIONING_SPECIFIED);
 	}
 }
 
@@ -177,9 +177,7 @@ LLFloater::Params::Params()
 	save_visibility("save_visibility", false),
 	can_dock("can_dock", false),
 	show_title("show_title", true),
-	open_positioning("open_positioning", LLFloaterEnums::OPEN_POSITIONING_NONE),
-	specified_left("specified_left"),
-	specified_bottom("specified_bottom"),
+	positioning("positioning", LLFloaterEnums::POSITIONING_RELATIVE),
 	header_height("header_height", 0),
 	legacy_header_height("legacy_header_height", 0),
 	close_image("close_image"),
@@ -249,9 +247,7 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
 	mCanClose(p.can_close),
 	mDragOnLeft(p.can_drag_on_left),
 	mResizable(p.can_resize),
-	mOpenPositioning(p.open_positioning),
-	mSpecifiedLeft(p.specified_left),
-	mSpecifiedBottom(p.specified_bottom),
+	mPositioning(p.positioning),
 	mMinWidth(p.min_width),
 	mMinHeight(p.min_height),
 	mHeaderHeight(p.header_height),
@@ -270,6 +266,7 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
 	mMinimizeSignal(NULL)
 //	mNotificationContext(NULL)
 {
+	mPosition.setFloater(*this);
 //	mNotificationContext = new LLFloaterNotificationContext(getHandle());
 
 	// Clicks stop here.
@@ -546,10 +543,18 @@ LLFloater::~LLFloater()
 
 void LLFloater::storeRectControl()
 {
-	if( mRectControl.size() > 1 )
+	if (!mRectControl.empty())
 	{
 		getControlGroup()->setRect( mRectControl, getRect() );
 	}
+	if (!mPosXControl.empty() && mPositioning == LLFloaterEnums::POSITIONING_RELATIVE)
+	{
+		getControlGroup()->setF32( mPosXControl, mPosition.mX );
+	}
+	if (!mPosYControl.empty() && mPositioning == LLFloaterEnums::POSITIONING_RELATIVE)
+	{
+		getControlGroup()->setF32( mPosYControl, mPosition.mY );
+	}
 }
 
 void LLFloater::storeVisibilityControl()
@@ -568,23 +573,6 @@ void LLFloater::storeDockStateControl()
 	}
 }
 
-LLRect LLFloater::getSavedRect() const
-{
-	LLRect rect;
-
-	if (mRectControl.size() > 1)
-	{
-		rect = getControlGroup()->getRect(mRectControl);
-	}
-
-	return rect;
-}
-
-bool LLFloater::hasSavedRect() const
-{
-	return !getSavedRect().isEmpty();
-}
-
 // static
 std::string LLFloater::getControlName(const std::string& name, const LLSD& key)
 {
@@ -862,7 +850,7 @@ void LLFloater::applyControlsAndPosition(LLFloater* other)
 	{
 		if (!applyRectControl())
 		{
-			applyPositioning(other);
+			applyPositioning(other, true);
 		}
 	}
 }
@@ -876,22 +864,51 @@ bool LLFloater::applyRectControl()
 	{
 		// other floaters in our group, position ourselves relative to them and don't save the rect
 		mRectControl.clear();
-		mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP;
+		mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP;
 	}
-	else if (mRectControl.size() > 1)
+	else
 	{
-		// If we have a saved rect, use it
-		const LLRect& rect = getControlGroup()->getRect(mRectControl);
-		saved_rect = rect.notEmpty();
-		if (saved_rect)
+		bool rect_specified = false;
+		if (!mRectControl.empty())
 		{
-			setOrigin(rect.mLeft, rect.mBottom);
-
-			if (mResizable)
+			// If we have a saved rect, use it
+			const LLRect& rect = getControlGroup()->getRect(mRectControl);
+			if (rect.notEmpty()) saved_rect = true;
+			if (saved_rect)
 			{
-				reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight()));
+				setOrigin(rect.mLeft, rect.mBottom);
+
+				if (mResizable)
+				{
+					reshape(llmax(mMinWidth, rect.getWidth()), llmax(mMinHeight, rect.getHeight()));
+				}
+				mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
+				LLRect screen_rect = calcScreenRect();
+				mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert();
+				rect_specified = true;
 			}
 		}
+
+		LLControlVariablePtr x_control = getControlGroup()->getControl(mPosXControl);
+		LLControlVariablePtr y_control = getControlGroup()->getControl(mPosYControl);
+		if (x_control.notNull() 
+			&& y_control.notNull()
+			&& !x_control->isDefault()
+			&& !y_control->isDefault())
+		{
+			mPosition.mX = x_control->getValue().asReal();
+			mPosition.mY = y_control->getValue().asReal();
+			mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
+			applyRelativePosition();
+
+			saved_rect = true;
+		}
+
+		// remember updated position
+		if (rect_specified)
+		{
+			storeRectControl();
+		}
 	}
 
 	return saved_rect;
@@ -910,50 +927,56 @@ bool LLFloater::applyDockState()
 	return docked;
 }
 
-void LLFloater::applyPositioning(LLFloater* other)
+void LLFloater::applyPositioning(LLFloater* other, bool on_open)
 {
 	// Otherwise position according to the positioning code
-	switch (mOpenPositioning)
+	switch (mPositioning)
 	{
-	case LLFloaterEnums::OPEN_POSITIONING_CENTERED:
+	case LLFloaterEnums::POSITIONING_CENTERED:
 		center();
 		break;
 
-	case LLFloaterEnums::OPEN_POSITIONING_SPECIFIED:
-		{
-			// Translate relative to snap rect
-			setOrigin(mSpecifiedLeft, mSpecifiedBottom);
-			const LLRect& snap_rect = gFloaterView->getSnapRect();
-			translate(snap_rect.mLeft, snap_rect.mBottom);
-			translateIntoRect(snap_rect, FALSE);
-		}
+	case LLFloaterEnums::POSITIONING_SPECIFIED:
 		break;
 
-	case LLFloaterEnums::OPEN_POSITIONING_CASCADE_GROUP:
-	case LLFloaterEnums::OPEN_POSITIONING_CASCADING:
-		if (other != NULL && other != this)
+	case LLFloaterEnums::POSITIONING_CASCADING:
+		if (!on_open)
 		{
-			stackWith(*other);
+			applyRelativePosition();
 		}
-		else
+		// fall through
+	case LLFloaterEnums::POSITIONING_CASCADE_GROUP:
+		if (on_open)
 		{
-			static const U32 CASCADING_FLOATER_HOFFSET = 0;
-			static const U32 CASCADING_FLOATER_VOFFSET = 0;
+			if (other != NULL && other != this)
+			{
+				stackWith(*other);
+			}
+			else
+			{
+				static const U32 CASCADING_FLOATER_HOFFSET = 0;
+				static const U32 CASCADING_FLOATER_VOFFSET = 0;
 			
-			const LLRect& snap_rect = gFloaterView->getSnapRect();
+				const LLRect& snap_rect = gFloaterView->getSnapRect();
 
-			const S32 horizontal_offset = CASCADING_FLOATER_HOFFSET;
-			const S32 vertical_offset = snap_rect.getHeight() - CASCADING_FLOATER_VOFFSET;
+				const S32 horizontal_offset = CASCADING_FLOATER_HOFFSET;
+				const S32 vertical_offset = snap_rect.getHeight() - CASCADING_FLOATER_VOFFSET;
 
-			S32 rect_height = getRect().getHeight();
-			setOrigin(horizontal_offset, vertical_offset - rect_height);
+				S32 rect_height = getRect().getHeight();
+				setOrigin(horizontal_offset, vertical_offset - rect_height);
 
-			translate(snap_rect.mLeft, snap_rect.mBottom);
-			translateIntoRect(snap_rect, FALSE);
+				translate(snap_rect.mLeft, snap_rect.mBottom);
+			}
+			setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
 		}
 		break;
 
-	case LLFloaterEnums::OPEN_POSITIONING_NONE:
+	case LLFloaterEnums::POSITIONING_RELATIVE:
+		{
+			applyRelativePosition();
+
+			break;
+		}
 	default:
 		// Do nothing
 		break;
@@ -1071,7 +1094,9 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user)
 	if (by_user && !isMinimized())
 	{
 		storeRectControl();
-		mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE;
+		mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
+		LLRect screen_rect = calcScreenRect();
+		mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert();
 	}
 
 	// if not minimized, adjust all snapped dependents to new shape
@@ -1249,6 +1274,7 @@ void LLFloater::setMinimized(BOOL minimize)
 
 		// Reshape *after* setting mMinimized
 		reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE );
+		applyPositioning(NULL, false);
 	}
 
 	make_ui_sound("UISndWindowClose");
@@ -1589,7 +1615,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock)
 		if (mDocked)
 		{
 			setMinimized(FALSE);
-			mOpenPositioning = LLFloaterEnums::OPEN_POSITIONING_NONE;
+			mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
 		}
 
 		updateTitleButtons();
@@ -1623,7 +1649,7 @@ void LLFloater::onClickTearOff(LLFloater* self)
 		self->openFloater(self->getKey());
 		
 		// only force position for floaters that don't have that data saved
-		if (self->mRectControl.size() <= 1)
+		if (self->mRectControl.empty())
 		{
 			new_rect.setLeftTopAndSize(host_floater->getRect().mLeft + 5, host_floater->getRect().mTop - floater_header_size - 5, self->getRect().getWidth(), self->getRect().getHeight());
 			self->setRect(new_rect);
@@ -1681,6 +1707,8 @@ LLFloater* LLFloater::getClosableFloaterFromFocus()
 	{
 		if (it->hasFocus())
 		{
+			LLFloater& floater = *it;
+			focused_floater = &floater;
 			break;
 		}
 	}
@@ -1800,7 +1828,7 @@ void LLFloater::draw()
 				
 				const LLFontGL* font = LLFontGL::getFontSansSerif();
 				LLRect r = getRect();
-				gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - (S32)font->getLineHeight() - 1, 
+				gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - font->getLineHeight() - 1, 
 					titlebar_focus_color % alpha, 0, TRUE);
 			}
 		}
@@ -2161,19 +2189,14 @@ LLFloaterView::LLFloaterView (const Params& p)
 	mSnapOffsetBottom(0),
 	mSnapOffsetRight(0)
 {
+	mSnapView = getHandle();
 }
 
 // By default, adjust vertical.
 void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent)
 {
-	S32 old_right = mLastSnapRect.mRight;
-	S32 old_top = mLastSnapRect.mTop;
-
 	LLView::reshape(width, height, called_from_parent);
 
-	S32 new_right = getSnapRect().mRight;
-	S32 new_top = getSnapRect().mTop;
-
 	mLastSnapRect = getSnapRect();
 
 	for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
@@ -2186,35 +2209,39 @@ void LLFloaterView::reshape(S32 width, S32 height, BOOL called_from_parent)
 			continue;
 		}
 
-		if (!floaterp->isMinimized())
+		if (!floaterp->isMinimized() && floaterp->getCanDrag())
 		{
-			LLRect r = floaterp->getRect();
+			LLRect old_rect = floaterp->getRect();
+			floaterp->applyPositioning(NULL, false);
+			LLRect new_rect = floaterp->getRect();
 
-			// Compute absolute distance from each edge of screen
-			S32 left_offset = llabs(r.mLeft - 0);
-			S32 right_offset = llabs(old_right - r.mRight);
+			//LLRect r = floaterp->getRect();
 
-			S32 top_offset = llabs(old_top - r.mTop);
-			S32 bottom_offset = llabs(r.mBottom - 0);
+			//// Compute absolute distance from each edge of screen
+			//S32 left_offset = llabs(r.mLeft - 0);
+			//S32 right_offset = llabs(old_right - r.mRight);
 
-			S32 translate_x = 0;
-			S32 translate_y = 0;
+			//S32 top_offset = llabs(old_top - r.mTop);
+			//S32 bottom_offset = llabs(r.mBottom - 0);
 
-			if (left_offset > right_offset)
-			{
-				translate_x = new_right - old_right;
-			}
+			S32 translate_x = new_rect.mLeft - old_rect.mLeft;
+			S32 translate_y = new_rect.mBottom - old_rect.mBottom;
 
-			if (top_offset < bottom_offset)
-			{
-				translate_y = new_top - old_top;
-			}
+			//if (left_offset > right_offset)
+			//{
+			//	translate_x = new_right - old_right;
+			//}
+
+			//if (top_offset < bottom_offset)
+			//{
+			//	translate_y = new_top - old_top;
+			//}
 
 			// don't reposition immovable floaters
-			if (floaterp->getCanDrag())
-			{
-				floaterp->translate(translate_x, translate_y);
-			}
+			//if (floaterp->getCanDrag())
+			//{
+			//	floaterp->translate(translate_x, translate_y);
+			//}
 			BOOST_FOREACH(LLHandle<LLFloater> dependent_floater, floaterp->mDependents)
 			{
 				if (dependent_floater.get())
@@ -2641,6 +2668,8 @@ void LLFloaterView::refresh()
 	}
 }
 
+const S32 FLOATER_MIN_VISIBLE_PIXELS = 16;
+
 void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_outside)
 {
 	if (floater->getParent() != this)
@@ -2694,7 +2723,7 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
 	}
 
 	// move window fully onscreen
-	if (floater->translateIntoRect( getSnapRect(), allow_partial_outside ))
+	if (floater->translateIntoRect( getSnapRect(), allow_partial_outside ? FLOATER_MIN_VISIBLE_PIXELS : S32_MAX ))
 	{
 		floater->clearSnapTarget();
 	}
@@ -2908,9 +2937,11 @@ void LLFloater::setInstanceName(const std::string& name)
 		std::string ctrl_name = getControlName(mInstanceName, mKey);
 
 		// save_rect and save_visibility only apply to registered floaters
-		if (!mRectControl.empty())
+		if (mSaveRect)
 		{
 			mRectControl = LLFloaterReg::declareRectControl(ctrl_name);
+			mPosXControl = LLFloaterReg::declarePosXControl(ctrl_name);
+			mPosYControl = LLFloaterReg::declarePosYControl(ctrl_name);
 		}
 		if (!mVisibilityControl.empty())
 		{
@@ -2967,7 +2998,10 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
 	LLPanel::initFromParams(p);
 
 	// override any follows flags
-	setFollows(FOLLOWS_NONE);
+	if (mPositioning != LLFloaterEnums::POSITIONING_SPECIFIED)
+	{
+		setFollows(FOLLOWS_NONE);
+	}
 
 	mTitle = p.title;
 	mShortTitle = p.short_title;
@@ -2986,14 +3020,9 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
 	mSingleInstance = p.single_instance;
 	mReuseInstance = p.reuse_instance.isProvided() ? p.reuse_instance : p.single_instance;
 
-	mOpenPositioning = p.open_positioning;
-	mSpecifiedLeft = p.specified_left;
-	mSpecifiedBottom = p.specified_bottom;
+	mPositioning = p.positioning;
 
-	if (p.save_rect && mRectControl.empty())
-	{
-		mRectControl = "t"; // flag to build mRectControl name once mInstanceName is set
-	}
+	mSaveRect = p.save_rect;
 	if (p.save_visibility)
 	{
 		mVisibilityControl = "t"; // flag to build mVisibilityControl name once mInstanceName is set
@@ -3108,7 +3137,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str
 		params.rect.left.set(0);
 	}
 	params.from_xui = true;
-	applyXUILayout(params, parent);
+	applyXUILayout(params, parent, parent == gFloaterView ? gFloaterView->getSnapRect() : parent->getLocalRect());
  	initFromParams(params);
 
 	initFloater(params);
@@ -3267,5 +3296,137 @@ void LLFloater::stackWith(LLFloater& other)
 	next_rect.setLeftTopAndSize(next_rect.mLeft, next_rect.mTop, getRect().getWidth(), getRect().getHeight());
 	
 	setShape(next_rect);
+
+	other.mPositioning = LLFloaterEnums::POSITIONING_CASCADE_GROUP;
+	other.setFollows(FOLLOWS_LEFT | FOLLOWS_TOP);
+}
+
+void LLFloater::applyRelativePosition()
+{
+	LLRect snap_rect = gFloaterView->getSnapRect();
+	LLRect floater_view_screen_rect = gFloaterView->calcScreenRect();
+	snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom);
+	LLRect floater_screen_rect = calcScreenRect();
+
+	LLCoordGL new_center = mPosition.convert();
+	LLCoordGL cur_center(floater_screen_rect.getCenterX(), floater_screen_rect.getCenterY());
+	translate(new_center.mX - cur_center.mX, new_center.mY - cur_center.mY);
 }
 
+
+LLCoordFloater::LLCoordFloater(F32 x, F32 y, LLFloater& floater)
+:	coord_t(x, y)
+{
+	mFloater = floater.getHandle();
+}
+
+
+LLCoordFloater::LLCoordFloater(const LLCoordCommon& other, LLFloater& floater)
+{
+	mFloater = floater.getHandle();
+	convertFromCommon(other);
+}
+
+LLCoordFloater& LLCoordFloater::operator=(const LLCoordFloater& other)
+{
+	mFloater = other.mFloater;
+	coord_t::operator =(other);
+	return *this;
+}
+
+void LLCoordFloater::setFloater(LLFloater& floater)
+{
+	mFloater = floater.getHandle();
+}
+
+bool LLCoordFloater::operator==(const LLCoordFloater& other) const 
+{ 
+	return mX == other.mX && mY == other.mY && mFloater == other.mFloater; 
+}
+
+LLCoordCommon LL_COORD_FLOATER::convertToCommon() const
+{
+	const LLCoordFloater& self = static_cast<const LLCoordFloater&>(LLCoordFloater::getTypedCoords(*this));
+
+	LLRect snap_rect = gFloaterView->getSnapRect();
+	LLRect floater_view_screen_rect = gFloaterView->calcScreenRect();
+	snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom);
+
+	LLFloater* floaterp = mFloater.get();
+	S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0;
+	S32 floater_height = floaterp ? floaterp->getRect().getHeight() : 0;
+	LLCoordCommon out;
+	if (self.mX < -0.5f)
+	{
+		out.mX = llround(rescale(self.mX, -1.f, -0.5f, snap_rect.mLeft - (floater_width - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mLeft));
+	}
+	else if (self.mX > 0.5f)
+	{
+		out.mX = llround(rescale(self.mX, 0.5f, 1.f, snap_rect.mRight - floater_width, snap_rect.mRight - FLOATER_MIN_VISIBLE_PIXELS));
+	}
+	else
+	{
+		out.mX = llround(rescale(self.mX, -0.5f, 0.5f, snap_rect.mLeft, snap_rect.mRight - floater_width));
+	}
+
+	if (self.mY < -0.5f)
+	{
+		out.mY = llround(rescale(self.mY, -1.f, -0.5f, snap_rect.mBottom - (floater_height - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mBottom));
+	}
+	else if (self.mY > 0.5f)
+	{
+		out.mY = llround(rescale(self.mY, 0.5f, 1.f, snap_rect.mTop - floater_height, snap_rect.mTop - FLOATER_MIN_VISIBLE_PIXELS));
+	}
+	else
+	{
+		out.mY = llround(rescale(self.mY, -0.5f, 0.5f, snap_rect.mBottom, snap_rect.mTop - floater_height));
+	}
+
+	// return center point instead of lower left
+	out.mX += floater_width / 2;
+	out.mY += floater_height / 2;
+
+	return out;
+}
+
+void LL_COORD_FLOATER::convertFromCommon(const LLCoordCommon& from)
+{
+	LLCoordFloater& self = static_cast<LLCoordFloater&>(LLCoordFloater::getTypedCoords(*this));
+	LLRect snap_rect = gFloaterView->getSnapRect();
+	LLRect floater_view_screen_rect = gFloaterView->calcScreenRect();
+	snap_rect.translate(floater_view_screen_rect.mLeft, floater_view_screen_rect.mBottom);
+
+
+	LLFloater* floaterp = mFloater.get();
+	S32 floater_width = floaterp ? floaterp->getRect().getWidth() : 0;
+	S32 floater_height = floaterp ? floaterp->getRect().getHeight() : 0;
+
+	S32 from_x = from.mX - floater_width / 2;
+	S32 from_y = from.mY - floater_height / 2;
+
+	if (from_x < snap_rect.mLeft)
+	{
+		self.mX = rescale(from_x, snap_rect.mLeft - (floater_width - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mLeft, -1.f, -0.5f);
+	}
+	else if (from_x + floater_width > snap_rect.mRight)
+	{
+		self.mX = rescale(from_x, snap_rect.mRight - floater_width, snap_rect.mRight - FLOATER_MIN_VISIBLE_PIXELS, 0.5f, 1.f);
+	}
+	else
+	{
+		self.mX = rescale(from_x, snap_rect.mLeft, snap_rect.mRight - floater_width, -0.5f, 0.5f);
+	}
+
+	if (from_y < snap_rect.mBottom)
+	{
+		self.mY = rescale(from_y, snap_rect.mBottom - (floater_height - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mBottom, -1.f, -0.5f);
+	}
+	else if (from_y + floater_height > snap_rect.mTop)
+	{
+		self.mY = rescale(from_y, snap_rect.mTop - floater_height, snap_rect.mTop - FLOATER_MIN_VISIBLE_PIXELS, 0.5f, 1.f);
+	}
+	else
+	{
+		self.mY = rescale(from_y, snap_rect.mBottom, snap_rect.mTop - floater_height, -0.5f, 0.5f);
+	}
+}
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 59b35d206f265024dd0e85e0e4802d0cb45f6331..64d6dcea0444afeffcd7de5758e1a40fe3953884 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -64,12 +64,12 @@ namespace LLFloaterEnums
 {
 	enum EOpenPositioning
 	{
-		OPEN_POSITIONING_NONE,
-		OPEN_POSITIONING_CASCADING,
-		OPEN_POSITIONING_CASCADE_GROUP,
-		OPEN_POSITIONING_CENTERED,
-		OPEN_POSITIONING_SPECIFIED,
-		OPEN_POSITIONING_COUNT
+		POSITIONING_RELATIVE,
+		POSITIONING_CASCADING,
+		POSITIONING_CASCADE_GROUP,
+		POSITIONING_CENTERED,
+		POSITIONING_SPECIFIED,
+		POSITIONING_COUNT
 	};
 }
 
@@ -82,6 +82,37 @@ namespace LLInitParam
 	};
 }
 
+struct LL_COORD_FLOATER
+{
+	typedef F32 value_t;
+
+	LLCoordCommon convertToCommon() const;
+	void convertFromCommon(const LLCoordCommon& from);
+protected:
+	LLHandle<LLFloater> mFloater;
+};
+
+struct LLCoordFloater : LLCoord<LL_COORD_FLOATER>
+{
+	typedef LLCoord<LL_COORD_FLOATER> coord_t;
+
+	LLCoordFloater() {}
+	LLCoordFloater(F32 x, F32 y, LLFloater& floater);
+	LLCoordFloater(const LLCoordCommon& other, LLFloater& floater);
+
+	LLCoordFloater& operator=(const LLCoordCommon& other)
+	{
+		convertFromCommon(other);
+		return *this;
+	}
+
+	LLCoordFloater& operator=(const LLCoordFloater& other);
+
+	bool operator==(const LLCoordFloater& other) const;
+	bool operator!=(const LLCoordFloater& other) const { return !(*this == other); }
+
+	void setFloater(LLFloater& floater);
+};
 
 class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
 {
@@ -132,10 +163,7 @@ class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
 								can_dock,
 								show_title;
 		
-		Optional<LLFloaterEnums::EOpenPositioning>	open_positioning;
-		Optional<S32>								specified_left;
-		Optional<S32>								specified_bottom;
-
+		Optional<LLFloaterEnums::EOpenPositioning>	positioning;
 		
 		Optional<S32>			header_height,
 								legacy_header_height; // HACK see initFromXML()
@@ -184,7 +212,7 @@ class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
 	bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL);
 
 	/*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
-	/*virtual*/ BOOL canSnapTo(const LLView* other_view);
+	/*virtual*/ BOOL canSnapTo(const LLView* other_view); 
 	/*virtual*/ void setSnappedTo(const LLView* snap_view);
 	/*virtual*/ void setFocus( BOOL b );
 	/*virtual*/ void setIsChrome(BOOL is_chrome);
@@ -241,8 +269,6 @@ class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
 	BOOL			isResizable() const				{ return mResizable; }
 	void			setResizeLimits( S32 min_width, S32 min_height );
 	void			getResizeLimits( S32* min_width, S32* min_height ) { *min_width = mMinWidth; *min_height = mMinHeight; }
-	LLRect			getSavedRect() const;
-	bool			hasSavedRect() const;
 
 	static std::string		getControlName(const std::string& name, const LLSD& key);
 	static LLControlGroup*	getControlGroup();
@@ -324,7 +350,7 @@ class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
 		
 	void			enableResizeCtrls(bool enable, bool width = true, bool height = true);
 
-	bool			isPositioning(LLFloaterEnums::EOpenPositioning p) const { return (p == mOpenPositioning); }
+	bool			isPositioning(LLFloaterEnums::EOpenPositioning p) const { return (p == mPositioning); }
 protected:
 	void			applyControlsAndPosition(LLFloater* other);
 
@@ -332,7 +358,9 @@ class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
 
 	virtual bool	applyRectControl();
 	bool			applyDockState();
-	void			applyPositioning(LLFloater* other);
+	void			applyPositioning(LLFloater* other, bool on_open);
+	void			applyRelativePosition();
+
 	void			storeRectControl();
 	void			storeVisibilityControl();
 	void			storeDockStateControl();
@@ -396,7 +424,10 @@ class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
 	commit_signal_t* mMinimizeSignal;
 
 protected:
+	bool			mSaveRect;
 	std::string		mRectControl;
+	std::string		mPosXControl;
+	std::string		mPosYControl;
 	std::string		mVisibilityControl;
 	std::string		mDocStateControl;
 	LLSD			mKey;				// Key used for retrieving instances; set (for now) by LLFLoaterReg
@@ -422,9 +453,8 @@ class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
 	BOOL			mDragOnLeft;
 	BOOL			mResizable;
 
-	LLFloaterEnums::EOpenPositioning	mOpenPositioning;
-	S32									mSpecifiedLeft;
-	S32									mSpecifiedBottom;
+	LLFloaterEnums::EOpenPositioning	mPositioning;
+	LLCoordFloater	mPosition;
 	
 	S32				mMinWidth;
 	S32				mMinHeight;
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index e144b68f5ebb00ae3df2316233d359ff0092f8f9..9115eb71740760af6522fb80f6170b31f46b595a 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -96,7 +96,9 @@ LLFloater* LLFloaterReg::getLastFloaterCascading()
 		{
 			LLFloater* inst = *iter;
 
-			if (inst->getVisible() && inst->isPositioning(LLFloaterEnums::OPEN_POSITIONING_CASCADING))
+			if (inst->getVisible() 
+				&& (inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADING)
+					|| inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADE_GROUP)))
 			{
 				if (candidate_rect.mTop > inst->getRect().mTop)
 				{
@@ -358,9 +360,7 @@ void LLFloaterReg::restoreVisibleInstances()
 //static
 std::string LLFloaterReg::getRectControlName(const std::string& name)
 {
-	std::string res = std::string("floater_rect_") + name;
-	LLStringUtil::replaceChar( res, ' ', '_' );
-	return res;
+	return std::string("floater_rect_") + getBaseControlName(name);
 }
 
 //static
@@ -368,19 +368,48 @@ std::string LLFloaterReg::declareRectControl(const std::string& name)
 {
 	std::string controlname = getRectControlName(name);
 	LLFloater::getControlGroup()->declareRect(controlname, LLRect(),
-												 llformat("Window Position and Size for %s", name.c_str()),
+												 llformat("Window Size for %s", name.c_str()),
 												 TRUE);
 	return controlname;
 }
 
+std::string LLFloaterReg::declarePosXControl(const std::string& name)
+{
+	std::string controlname = std::string("floater_pos_") + getBaseControlName(name) + "_x";
+	LLFloater::getControlGroup()->declareF32(controlname, 
+											10.f,
+											llformat("Window X Position for %s", name.c_str()),
+											TRUE);
+	return controlname;
+}
+
+std::string LLFloaterReg::declarePosYControl(const std::string& name)
+{
+	std::string controlname = std::string("floater_pos_") + getBaseControlName(name) + "_y";
+	LLFloater::getControlGroup()->declareF32(controlname,
+											10.f,
+											llformat("Window Y Position for %s", name.c_str()),
+											TRUE);
+
+	return controlname;
+}
+
+
 //static
 std::string LLFloaterReg::getVisibilityControlName(const std::string& name)
 {
-	std::string res = std::string("floater_vis_") + name;
+	return std::string("floater_vis_") + getBaseControlName(name);
+}
+
+//static 
+std::string LLFloaterReg::getBaseControlName(const std::string& name)
+{
+	std::string res(name);
 	LLStringUtil::replaceChar( res, ' ', '_' );
 	return res;
 }
 
+
 //static
 std::string LLFloaterReg::declareVisibilityControl(const std::string& name)
 {
diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h
index 534cf8b40ab882a85629aa155af26b1b2031672b..a1e1f8a98835ffa6bd8fd257a8a5799268b5e6ce 100644
--- a/indra/llui/llfloaterreg.h
+++ b/indra/llui/llfloaterreg.h
@@ -115,9 +115,11 @@ class LLFloaterReg
 	// Control Variables
 	static std::string getRectControlName(const std::string& name);
 	static std::string declareRectControl(const std::string& name);
+	static std::string declarePosXControl(const std::string& name);
+	static std::string declarePosYControl(const std::string& name);
 	static std::string getVisibilityControlName(const std::string& name);
 	static std::string declareVisibilityControl(const std::string& name);
-
+	static std::string getBaseControlName(const std::string& name);
 	static std::string declareDockStateControl(const std::string& name);
 	static std::string getDockStateControlName(const std::string& name);
 
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 2f1c2a47c98742999095d98c3e8b931efa0fd10c..4c730286da86a6b0a6dbbfca12216aa211db5f75 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -36,7 +36,7 @@
 #include "llcriticaldamp.h"
 #include "boost/foreach.hpp"
 
-static const F32 MIN_FRACTIONAL_SIZE = 0.0001f;
+static const F32 MIN_FRACTIONAL_SIZE = 0.0f;
 static const F32 MAX_FRACTIONAL_SIZE = 1.f;
 
 static LLDefaultChildRegistry::Register<LLLayoutStack> register_layout_stack("layout_stack");
@@ -113,7 +113,26 @@ S32 LLLayoutPanel::getLayoutDim() const
 					? getRect().getWidth()
 					: getRect().getHeight()));
 }
- 
+
+S32 LLLayoutPanel::getTargetDim() const
+{
+	return mTargetDim;
+}
+
+void LLLayoutPanel::setTargetDim(S32 value)
+{
+	LLRect new_rect(getRect());
+	if (mOrientation == LLLayoutStack::HORIZONTAL)
+	{
+		new_rect.mRight = new_rect.mLeft + value;
+	}
+	else
+	{
+		new_rect.mTop = new_rect.mBottom + value;
+	}
+	setShape(new_rect, true);
+}
+
 S32 LLLayoutPanel::getVisibleDim() const
 {
 	F32 min_dim = getRelevantMinDim();
@@ -129,6 +148,12 @@ void LLLayoutPanel::setOrientation( LLLayoutStack::ELayoutOrientation orientatio
 		? getRect().getWidth()
 		: getRect().getHeight()));
 
+	if (mAutoResize == FALSE 
+		&& mUserResize == TRUE 
+		&& mMinDim == -1 )
+	{
+		setMinDim(layout_dim);
+	}
 	mTargetDim = llmax(layout_dim, getMinDim());
 }
  
@@ -166,12 +191,15 @@ void LLLayoutPanel::handleReshape(const LLRect& new_rect, bool by_user)
 	LLLayoutStack* stackp = dynamic_cast<LLLayoutStack*>(getParent());
 	if (stackp)
 	{
-		stackp->mNeedsLayout = true;
 		if (by_user)
-		{
-			// tell layout stack to account for new shape
+		{	// tell layout stack to account for new shape
+			
+			// make sure that panels have already been auto resized
+			stackp->updateLayout();
+			// now apply requested size to panel
 			stackp->updatePanelRect(this, new_rect);
 		}
+		stackp->mNeedsLayout = true;
 	}
 	LLPanel::handleReshape(new_rect, by_user);
 }
@@ -235,7 +263,6 @@ void LLLayoutStack::draw()
 			drawChild(panelp, 0, 0, !clip_rect.isEmpty());
 		}
 	}
-	mAnimatedThisFrame = false;
 }
 
 void LLLayoutStack::removeChild(LLView* view)
@@ -304,9 +331,8 @@ void LLLayoutStack::updateLayout()
 
 	if (!mNeedsLayout) return;
 
-	bool animation_in_progress = animatePanels();
+	bool continue_animating = animatePanels();
 	F32 total_visible_fraction = 0.f;
-	F32 total_open_fraction = 0.f;
 	S32 space_to_distribute = (mOrientation == HORIZONTAL)
 							? getRect().getWidth()
 							: getRect().getHeight();
@@ -318,20 +344,17 @@ void LLLayoutStack::updateLayout()
 		if (panelp->mAutoResize)
 		{
 			panelp->mTargetDim = panelp->getRelevantMinDim();
-			if (!panelp->mCollapsed && panelp->getVisible())
-			{
-				total_open_fraction += panelp->mFractionalSize;
-			}
 		}
 		space_to_distribute -= panelp->getVisibleDim() + llround((F32)mPanelSpacing * panelp->getVisibleAmount());
-		total_visible_fraction += panelp->mFractionalSize;
+		total_visible_fraction += panelp->mFractionalSize * panelp->getAutoResizeFactor();
 	}
 
-	llassert(total_visible_fraction < 1.01f);
+	llassert(total_visible_fraction < 1.05f);
 
 	// don't need spacing after last panel
 	space_to_distribute += panelp ? llround((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0;
 
+	S32 remaining_space = space_to_distribute;
 	F32 fraction_distributed = 0.f;
 	if (space_to_distribute > 0 && total_visible_fraction > 0.f)
 	{	// give space proportionally to visible auto resize panels
@@ -343,26 +366,23 @@ void LLLayoutStack::updateLayout()
 				S32 delta = llround((F32)space_to_distribute * fraction_to_distribute);
 				fraction_distributed += fraction_to_distribute;
 				panelp->mTargetDim += delta;
+				remaining_space -= delta;
 			}
 		}
 	}
 
-	if (fraction_distributed < total_visible_fraction)
-	{	// distribute any left over pixels to non-collapsed, visible panels
-		F32 fraction_left = total_visible_fraction - fraction_distributed;
-		S32 space_left = llround((F32)space_to_distribute * (fraction_left / total_visible_fraction));
+	// distribute any left over pixels to non-collapsed, visible panels
+	BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+	{
+		if (remaining_space == 0) break;
 
-		BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+		if (panelp->mAutoResize 
+			&& !panelp->mCollapsed 
+			&& panelp->getVisible())
 		{
-			if (panelp->mAutoResize 
-				&& !panelp->mCollapsed 
-				&& panelp->getVisible())
-			{
-				S32 space_for_panel = llmax(0, llround((F32)space_left * (panelp->mFractionalSize / total_open_fraction)));
-				panelp->mTargetDim += space_for_panel;
-				space_left -= space_for_panel;
-				total_open_fraction -= panelp->mFractionalSize;
-			}
+			S32 space_for_panel = remaining_space > 0 ? 1 : -1;
+			panelp->mTargetDim += space_for_panel;
+			remaining_space -= space_for_panel;
 		}
 	}
 
@@ -416,7 +436,7 @@ void LLLayoutStack::updateLayout()
 
 	// clear animation flag at end, since panel resizes will set it
 	// and leave it set if there is any animation in progress
-	mNeedsLayout = animation_in_progress;
+	mNeedsLayout = continue_animating;
 } // end LLLayoutStack::updateLayout
 
 LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
@@ -489,38 +509,52 @@ void LLLayoutStack::updateClass()
 	for (instance_iter it = beginInstances(); it != endInstances(); ++it)
 	{
 		it->updateLayout();
+		it->mAnimatedThisFrame = false;
 	}
 }
 
 void LLLayoutStack::updateFractionalSizes()
 {
-	F32 total_resizable_dim = 0;
-	S32 num_auto_resize_panels = 0;
+	F32 total_resizable_dim = 0.f;
 
 	BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
 	{
 		if (panelp->mAutoResize)
 		{
 			total_resizable_dim += llmax(0, panelp->getLayoutDim() - panelp->getRelevantMinDim());
-			num_auto_resize_panels++;
 		}
 	}
 
-	F32 total_fractional_size = 0.f;
-	
 	BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
 	{
 		if (panelp->mAutoResize)
 		{
 			F32 panel_resizable_dim = llmax(MIN_FRACTIONAL_SIZE, (F32)(panelp->getLayoutDim() - panelp->getRelevantMinDim()));
 			panelp->mFractionalSize = panel_resizable_dim > 0.f 
-										? llclamp(panel_resizable_dim / total_resizable_dim, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE)
-										: MIN_FRACTIONAL_SIZE;
-			total_fractional_size += panelp->mFractionalSize;
+				? llclamp(panel_resizable_dim / total_resizable_dim, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE)
+				: MIN_FRACTIONAL_SIZE;
 			llassert(!llisnan(panelp->mFractionalSize));
 		}
 	}
 
+	normalizeFractionalSizes();
+}
+
+
+void LLLayoutStack::normalizeFractionalSizes()
+{
+	S32 num_auto_resize_panels = 0;
+	F32 total_fractional_size = 0.f;
+	
+	BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+	{
+		if (panelp->mAutoResize)
+		{
+			total_fractional_size += panelp->mFractionalSize;
+			num_auto_resize_panels++;
+		}
+	}
+
 	if (total_fractional_size == 0.f)
 	{ // equal distribution
 		BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
@@ -545,7 +579,7 @@ void LLLayoutStack::updateFractionalSizes()
 
 bool LLLayoutStack::animatePanels()
 {
-	bool animation_in_progress = false;
+	bool continue_animating = false;
 	
 	//
 	// animate visibility
@@ -565,14 +599,15 @@ bool LLLayoutStack::animatePanels()
 					}
 				}
 				
-				animation_in_progress = true;
+				mAnimatedThisFrame = true;
+				continue_animating = true;
 			}
 			else
 			{
 				if (panelp->mVisibleAmt != 1.f)
 				{
 					panelp->mVisibleAmt = 1.f;
-					animation_in_progress = true;
+					mAnimatedThisFrame = true;
 				}
 			}
 		}
@@ -589,14 +624,15 @@ bool LLLayoutStack::animatePanels()
 					}
 				}
 
-				animation_in_progress = true;
+				continue_animating = true;
+				mAnimatedThisFrame = true;
 			}
 			else
 			{
 				if (panelp->mVisibleAmt != 0.f)
 				{
 					panelp->mVisibleAmt = 0.f;
-					animation_in_progress = true;
+					mAnimatedThisFrame = true;
 				}
 			}
 		}
@@ -604,22 +640,31 @@ bool LLLayoutStack::animatePanels()
 		F32 collapse_state = panelp->mCollapsed ? 1.f : 0.f;
 		if (panelp->mCollapseAmt != collapse_state)
 		{
-			if (!mAnimatedThisFrame)
+			if (mAnimate)
 			{
-				panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
-			}
-			animation_in_progress = true;
+				if (!mAnimatedThisFrame)
+				{
+					panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
+				}
 			
-			if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f)
+				if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f)
+				{
+					panelp->mCollapseAmt = collapse_state;
+				}
+
+				mAnimatedThisFrame = true;
+				continue_animating = true;
+			}
+			else
 			{
 				panelp->mCollapseAmt = collapse_state;
+				mAnimatedThisFrame = true;
 			}
 		}
 	}
 
-	mAnimatedThisFrame = true;
-
-	return animation_in_progress;
+	if (mAnimatedThisFrame) mNeedsLayout = true;
+	return continue_animating;
 }
 
 void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& new_rect )
@@ -632,7 +677,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
 
 	F32 total_visible_fraction = 0.f;
 	F32 delta_auto_resize_headroom = 0.f;
-	F32 total_auto_resize_headroom = 0.f;
+	F32 original_auto_resize_headroom = 0.f;
 
 	LLLayoutPanel* other_resize_panel = NULL;
 	LLLayoutPanel* following_panel = NULL;
@@ -641,8 +686,11 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
 	{
 		if (panelp->mAutoResize)
 		{
-			total_auto_resize_headroom += (F32)(panelp->mTargetDim - panelp->getRelevantMinDim());
-			total_visible_fraction += panelp->mFractionalSize * panelp->getAutoResizeFactor();
+			original_auto_resize_headroom += (F32)(panelp->mTargetDim - panelp->getRelevantMinDim());
+			if (panelp->getVisible() && !panelp->mCollapsed)
+			{
+				total_visible_fraction += panelp->mFractionalSize;
+			}
 		}
 
 		if (panelp == resized_panel)
@@ -656,18 +704,25 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
 		}
 	}
 
-	if (resized_panel->mAutoResize == FALSE)
+
+	if (resized_panel->mAutoResize)
 	{
-		delta_auto_resize_headroom += -delta_dim;
+		if (!other_resize_panel || !other_resize_panel->mAutoResize)
+		{
+			delta_auto_resize_headroom += delta_dim;	
+		}
 	}
-	if (other_resize_panel && other_resize_panel->mAutoResize == FALSE)
+	else 
 	{
-		delta_auto_resize_headroom += delta_dim;
+		if (!other_resize_panel || other_resize_panel->mAutoResize)
+		{
+			delta_auto_resize_headroom -= delta_dim;
+		}
 	}
 
 	F32 fraction_given_up = 0.f;
 	F32 fraction_remaining = 1.f;
-	F32 updated_auto_resize_headroom = total_auto_resize_headroom + delta_auto_resize_headroom;
+	F32 updated_auto_resize_headroom = original_auto_resize_headroom + delta_auto_resize_headroom;
 
 	enum
 	{
@@ -691,14 +746,15 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
 		case BEFORE_RESIZED_PANEL:
 			if (panelp->mAutoResize)
 			{	// freeze current size as fraction of overall auto_resize space
-				F32 fractional_adjustment_factor = total_auto_resize_headroom / updated_auto_resize_headroom;
+				F32 fractional_adjustment_factor = updated_auto_resize_headroom == 0.f
+													? 1.f
+													: original_auto_resize_headroom / updated_auto_resize_headroom;
 				F32 new_fractional_size = llclamp(panelp->mFractionalSize * fractional_adjustment_factor,
 													MIN_FRACTIONAL_SIZE,
 													MAX_FRACTIONAL_SIZE);
-				F32 fraction_delta = (new_fractional_size - panelp->mFractionalSize);
-				fraction_given_up -= fraction_delta;
+				fraction_given_up -= new_fractional_size - panelp->mFractionalSize;
 				fraction_remaining -= panelp->mFractionalSize;
-				panelp->mFractionalSize += fraction_delta;
+				panelp->mFractionalSize = new_fractional_size;
 				llassert(!llisnan(panelp->mFractionalSize));
 			}
 			else
@@ -711,7 +767,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
 			{	// freeze new size as fraction
 				F32 new_fractional_size = (updated_auto_resize_headroom == 0.f)
 					? MAX_FRACTIONAL_SIZE
-					: llclamp((F32)(new_dim - panelp->getRelevantMinDim()) / updated_auto_resize_headroom, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE);
+					: llclamp(total_visible_fraction * (F32)(new_dim - panelp->getRelevantMinDim()) / updated_auto_resize_headroom, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE);
 				fraction_given_up -= new_fractional_size - panelp->mFractionalSize;
 				fraction_remaining -= panelp->mFractionalSize;
 				panelp->mFractionalSize = new_fractional_size;
@@ -720,7 +776,6 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
 			else
 			{	// freeze new size as original size
 				panelp->mTargetDim = new_dim;
-				fraction_remaining -= fraction_given_up;
 			}
 			which_panel = NEXT_PANEL;
 			break;
@@ -728,14 +783,14 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
 			if (panelp->mAutoResize)
 			{
 				fraction_remaining -= panelp->mFractionalSize;
-				if (fraction_given_up != 0.f)
+				if (resized_panel->mAutoResize)
 				{
 					panelp->mFractionalSize = llclamp(panelp->mFractionalSize + fraction_given_up, MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE);
 					fraction_given_up = 0.f;
 				}
 				else
 				{
-					F32 new_fractional_size = llclamp((F32)(panelp->mTargetDim - panelp->getRelevantMinDim() + delta_auto_resize_headroom) 
+					F32 new_fractional_size = llclamp(total_visible_fraction * (F32)(panelp->mTargetDim - panelp->getRelevantMinDim() + delta_auto_resize_headroom) 
 														/ updated_auto_resize_headroom,
 													MIN_FRACTIONAL_SIZE,
 													MAX_FRACTIONAL_SIZE);
@@ -750,7 +805,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
 			which_panel = AFTER_RESIZED_PANEL;
 			break;
 		case AFTER_RESIZED_PANEL:
-			if (panelp->mAutoResize)
+			if (panelp->mAutoResize && fraction_given_up != 0.f)
 			{
 				panelp->mFractionalSize = llclamp(panelp->mFractionalSize + (panelp->mFractionalSize / fraction_remaining) * fraction_given_up,
 												MIN_FRACTIONAL_SIZE,
@@ -760,6 +815,8 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
 			break;
 		}
 	}
+	updateLayout();
+	normalizeFractionalSizes();
 }
 
 void LLLayoutStack::reshape(S32 width, S32 height, BOOL called_from_parent)
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index efe93f6def1ff65ec7d5f26928afc5c002fc3dc9..648cd5fdce202d209758295b4f72da4228ff1569 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -72,7 +72,7 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
 	/*virtual*/ void draw();
 	/*virtual*/ void removeChild(LLView*);
 	/*virtual*/ BOOL postBuild();
-	/*virtual*/ bool addChild(LLView* child, S32 tab_group = 0);
+	/*virtual*/ bool addChild(LLView* child, S32 tab_groupdatefractuiona = 0);
 	/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 
 
@@ -112,6 +112,7 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
 	LLLayoutPanel* findEmbeddedPanel(LLPanel* panelp) const;
 	LLLayoutPanel* findEmbeddedPanelByName(const std::string& name) const;
 	void updateFractionalSizes();
+	void normalizeFractionalSizes();
 	void updatePanelRect( LLLayoutPanel* param1, const LLRect& new_rect );
 
 	S32 mPanelSpacing;
@@ -154,10 +155,12 @@ friend class LLUICtrlFactory;
 	void setVisible(BOOL visible);
 
 	S32 getLayoutDim() const;
-	S32 getMinDim() const { return (mMinDim >= 0 || mAutoResize) ? llmax(0, mMinDim) : getLayoutDim(); }
+	S32 getTargetDim() const;
+	void setTargetDim(S32 value);
+	S32 getMinDim() const { return llmax(0, mMinDim); }
 	void setMinDim(S32 value) { mMinDim = value; }
 
-	S32 getExpandedMinDim() const { return mExpandedMinDim >= 0 ? mExpandedMinDim : mMinDim; }
+	S32 getExpandedMinDim() const { return mExpandedMinDim >= 0 ? mExpandedMinDim : getMinDim(); }
 	void setExpandedMinDim(S32 value) { mExpandedMinDim = value; }
 	
 	S32 getRelevantMinDim() const
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 06dfc90d83ba51ca21dba130e00683383727dc87..d0fbf4b91370d6c7f46c2e3addb9306cca2cbaa5 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -1047,7 +1047,7 @@ void LLLineEditor::cut()
 		// Prepare for possible rollback
 		LLLineEditorRollback rollback( this );
 
-		gClipboard.copyFromSubstring( mText.getWString(), left_pos, length );
+		LLClipboard::instance().copyToClipboard( mText.getWString(), left_pos, length );
 		deleteSelection();
 
 		// Validate new string and rollback the if needed.
@@ -1078,13 +1078,13 @@ void LLLineEditor::copy()
 	{
 		S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
 		S32 length = llabs( mSelectionStart - mSelectionEnd );
-		gClipboard.copyFromSubstring( mText.getWString(), left_pos, length );
+		LLClipboard::instance().copyToClipboard( mText.getWString(), left_pos, length );
 	}
 }
 
 BOOL LLLineEditor::canPaste() const
 {
-	return !mReadOnly && gClipboard.canPasteString(); 
+	return !mReadOnly && LLClipboard::instance().isTextAvailable(); 
 }
 
 void LLLineEditor::paste()
@@ -1115,14 +1115,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
 	if (can_paste_it)
 	{
 		LLWString paste;
-		if (is_primary)
-		{
-			paste = gClipboard.getPastePrimaryWString();
-		}
-		else 
-		{
-			paste = gClipboard.getPasteWString();
-		}
+		LLClipboard::instance().pasteFromClipboard(paste, is_primary);
 
 		if (!paste.empty())
 		{
@@ -1209,13 +1202,13 @@ void LLLineEditor::copyPrimary()
 	{
 		S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
 		S32 length = llabs( mSelectionStart - mSelectionEnd );
-		gClipboard.copyFromPrimarySubstring( mText.getWString(), left_pos, length );
+		LLClipboard::instance().copyToClipboard( mText.getWString(), left_pos, length, true);
 	}
 }
 
 BOOL LLLineEditor::canPastePrimary() const
 {
-	return !mReadOnly && gClipboard.canPastePrimaryString(); 
+	return !mReadOnly && LLClipboard::instance().isTextAvailable(true); 
 }
 
 void LLLineEditor::updatePrimary()
@@ -1630,7 +1623,7 @@ void LLLineEditor::draw()
 	LLRect background( 0, getRect().getHeight(), getRect().getWidth(), 0 );
 	background.stretch( -mBorderThickness );
 
-	S32 lineeditor_v_pad = llround((background.getHeight() - mGLFont->getLineHeight())/2);
+	S32 lineeditor_v_pad = (background.getHeight() - mGLFont->getLineHeight()) / 2;
 
 	drawBackground();
 	
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 95ecbb1c9479cb9a885ce9c10c448ace5e29e9ab..ff6928ffda10b9ebf2188483c286338a736d97ba 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -317,7 +317,7 @@ void LLMenuItemGL::setJumpKey(KEY key)
 // virtual 
 U32 LLMenuItemGL::getNominalHeight( void ) const 
 { 
-	return llround(mFont->getLineHeight()) + MENU_ITEM_PADDING; 
+	return mFont->getLineHeight() + MENU_ITEM_PADDING;
 }
 
 //virtual
@@ -508,19 +508,19 @@ void LLMenuItemGL::draw( void )
 	{
 		if( !mDrawBoolLabel.empty() )
 		{
-			mFont->render( mDrawBoolLabel.getWString(), 0, (F32)LEFT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
+			mFont->render( mDrawBoolLabel.getWString(), 0, (F32)LEFT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color,
 						   LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 		}
-		mFont->render( mLabel.getWString(), 0, (F32)LEFT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
+		mFont->render( mLabel.getWString(), 0, (F32)LEFT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color,
 					   LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 		if( !mDrawAccelLabel.empty() )
 		{
-			mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
+			mFont->render( mDrawAccelLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PLAIN_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color,
 						   LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 		}
 		if( !mDrawBranchLabel.empty() )
 		{
-			mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f) + 1.f, color,
+			mFont->render( mDrawBranchLabel.getWString(), 0, (F32)getRect().mRight - (F32)RIGHT_PAD_PIXELS, ((F32)MENU_ITEM_PADDING / 2.f), color,
 						   LLFontGL::RIGHT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 		}
 	}
@@ -1966,7 +1966,7 @@ void LLMenuGL::arrange( void )
 
 		// *FIX: create the item first and then ask for its dimensions?
 		S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::getFontSansSerif()->getWidth( std::string("More") ); // *TODO: Translate
-		S32 spillover_item_height = llround(LLFontGL::getFontSansSerif()->getLineHeight()) + MENU_ITEM_PADDING;
+		S32 spillover_item_height = LLFontGL::getFontSansSerif()->getLineHeight() + MENU_ITEM_PADDING;
 
 		// Scrolling support
 		item_list_t::iterator first_visible_item_iter;
@@ -3082,7 +3082,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
 		mouse_y + MOUSE_CURSOR_PADDING, 
 		CURSOR_WIDTH + MOUSE_CURSOR_PADDING * 2, 
 		CURSOR_HEIGHT + MOUSE_CURSOR_PADDING * 2);
-	menu->translateIntoRectWithExclusion( menu_region_rect, mouse_rect, FALSE );
+	menu->translateIntoRectWithExclusion( menu_region_rect, mouse_rect );
 	menu->getParent()->sendChildToFront(menu);
 }
 
@@ -3425,7 +3425,7 @@ void LLMenuHolderGL::draw()
 		
 		LLUI::pushMatrix();
 		{
-			LLUI::translate((F32)item_rect.mLeft, (F32)item_rect.mBottom, 0.f);
+			LLUI::translate((F32)item_rect.mLeft, (F32)item_rect.mBottom);
 			selecteditem->getMenu()->drawBackground(selecteditem, interpolant);
 			selecteditem->draw();
 		}
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index d232e27ef230afe3deaa0757f9149f6a4cb181fe..8aa548b9749f4446e7c68f072f93583346fef815 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -1412,6 +1412,7 @@ void addPathIfExists(const std::string& new_path, std::vector<std::string>& path
 
 bool LLNotifications::loadTemplates()
 {
+	llinfos << "Reading notifications template" << llendl;
 	std::vector<std::string> search_paths;
 	
 	std::string skin_relative_path = gDirUtilp->getDirDelimiter() + LLUI::getSkinPath() + gDirUtilp->getDirDelimiter() + "notifications.xml";
@@ -1484,6 +1485,8 @@ bool LLNotifications::loadTemplates()
 		mTemplates[notification.name] = LLNotificationTemplatePtr(new LLNotificationTemplate(notification));
 	}
 
+	llinfos << "...done" << llendl;
+
 	return true;
 }
 
diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index ad4cc20d9a5c2cf2327c19b1b6560a711000b2e3..9b7e30bb048733ce8e8b193dc40918a1571f1c36 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -378,19 +378,24 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height
 
 	if (!mHideScrollbar)
 	{
-		if( *visible_height < doc_height )
+		// Note: 1 pixel change can happen on final animation and should not trigger 
+		// the display of sliders.
+		if ((doc_height - *visible_height) > 1)
 		{
 			*show_v_scrollbar = TRUE;
 			*visible_width -= scrollbar_size;
 		}
-
-		if( *visible_width < doc_width )
+		if ((doc_width - *visible_width) > 1)
 		{
 			*show_h_scrollbar = TRUE;
 			*visible_height -= scrollbar_size;
 
+			// The view inside the scroll container should not be extended
+			// to container's full height to ensure the correct computation
+			// of *show_v_scrollbar after subtracting horizontal scrollbar_size.
+
 			// Must retest now that visible_height has changed
-			if( !*show_v_scrollbar && (*visible_height < doc_height) )
+			if( !*show_v_scrollbar && ((doc_height - *visible_height) > 1) )
 			{
 				*show_v_scrollbar = TRUE;
 				*visible_width -= scrollbar_size;
diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h
index 3aa79cc255b47d5bd4d7c158fca21f92fe6d1d65..d87c95b3d759f2348b6657c833c13c398f9cbbb4 100644
--- a/indra/llui/llscrollcontainer.h
+++ b/indra/llui/llscrollcontainer.h
@@ -91,7 +91,7 @@ class LLScrollContainer : public LLUICtrl
 	void			setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; }
 	LLRect			getVisibleContentRect();
 	LLRect			getContentWindowRect();
-	const LLRect&	getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; }
+	virtual const LLRect	getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; }
 	void			pageUp(S32 overlap = 0);
 	void			pageDown(S32 overlap = 0);
 	void			goToTop();
@@ -116,6 +116,9 @@ class LLScrollContainer : public LLUICtrl
 	
 	bool autoScroll(S32 x, S32 y);
 
+protected:
+	LLView*		mScrolledView;
+
 private:
 	// internal scrollbar handlers
 	virtual void scrollHorizontal( S32 new_pos );
@@ -124,7 +127,6 @@ class LLScrollContainer : public LLUICtrl
 	void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const;
 
 	LLScrollbar* mScrollbar[SCROLLBAR_COUNT];
-	LLView*		mScrolledView;
 	S32			mSize;
 	BOOL		mIsOpaque;
 	LLUIColor	mBackgroundColor;
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 9d25c7180dd4db401d5089b39fc9ddd6847f5eb3..8000efad0e2c31927092168f7c90e283707b66bf 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -232,7 +232,7 @@ BOOL LLScrollListText::getVisible() const
 //virtual 
 S32 LLScrollListText::getHeight() const
 {
-	return llround(mFont->getLineHeight());
+	return mFont->getLineHeight();
 }
 
 
@@ -306,7 +306,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
 			break;
 		}
 		LLRect highlight_rect(left - 2, 
-				llround(mFont->getLineHeight()) + 1, 
+				mFont->getLineHeight() + 1, 
 				left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1, 
 				1);
 		mRoundedRectImage->draw(highlight_rect, highlight_color);
@@ -329,7 +329,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
 		break;
 	}
 	mFont->render(mText.getWString(), 0, 
-					start_x, 2.f,
+					start_x, 0.f,
 					display_color,
 					mFontAlignment,
 					LLFontGL::BOTTOM, 
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 466fac33ea3c3f1e876717e28630c4d3a35825f3..b3e1b63db58a4d788001458509c34c8aacc87b2e 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -2504,7 +2504,7 @@ void	LLScrollListCtrl::copy()
 	{
 		buffer += (*itor)->getContentsCSV() + "\n";
 	}
-	gClipboard.copyFromSubstring(utf8str_to_wstring(buffer), 0, buffer.length());
+	LLClipboard::instance().copyToClipboard(utf8str_to_wstring(buffer), 0, buffer.length());
 }
 
 // virtual
diff --git a/indra/llui/llscrolllistitem.cpp b/indra/llui/llscrolllistitem.cpp
index d95752e31cb982cc5d132e00c1cbfd53cdac7477..5a1e96ab034cc74fd1be5aa766c45b7c0b20f8c1 100644
--- a/indra/llui/llscrolllistitem.cpp
+++ b/indra/llui/llscrolllistitem.cpp
@@ -138,7 +138,7 @@ void LLScrollListItem::draw(const LLRect& rect, const LLColor4& fg_color, const
 
 		LLUI::pushMatrix();
 		{
-			LLUI::translate((F32) cur_x, (F32) rect.mBottom, 0.0f);
+			LLUI::translate((F32) cur_x, (F32) rect.mBottom);
 
 			cell->draw( fg_color, highlight_color );
 		}
diff --git a/indra/llui/llscrolllistitem.h b/indra/llui/llscrolllistitem.h
index 611df729b41fb17d3a7ce239cd70bf671d6472ff..13655b5873b9f5cf8e35938e6e0ea92442632f9b 100644
--- a/indra/llui/llscrolllistitem.h
+++ b/indra/llui/llscrolllistitem.h
@@ -33,10 +33,10 @@
 #include "v4color.h"
 #include "llinitparam.h"
 #include "llscrolllistcell.h"
+#include "llcoord.h"
 
 #include <vector>
 
-class LLCoordGL;
 class LLCheckBoxCtrl;
 class LLResizeBar;
 class LLScrollListCtrl;
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 0040be45c711cde660eb72359177e87e4571ac56..7aeeae298f754407abcf026372b21c6d6935ba8b 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1192,7 +1192,10 @@ void LLTextBase::reflow()
 
 		// shrink document to minimum size (visible portion of text widget)
 		// to force inlined widgets with follows set to shrink
-		mDocumentView->reshape(mVisibleTextRect.getWidth(), mDocumentView->getRect().getHeight());
+		if (mWordWrap)
+		{
+			mDocumentView->reshape(mVisibleTextRect.getWidth(), mDocumentView->getRect().getHeight());
+		}
 
 		S32 cur_top = 0;
 
@@ -2157,7 +2160,7 @@ LLRect LLTextBase::getLocalRectFromDocIndex(S32 pos) const
 	{ 
 		// return default height rect in upper left
 		local_rect = content_window_rect;
-		local_rect.mBottom = local_rect.mTop - (S32)(mDefaultFont->getLineHeight());
+		local_rect.mBottom = local_rect.mTop - mDefaultFont->getLineHeight();
 		return local_rect;
 	}
 
@@ -2380,6 +2383,9 @@ S32 LLTextBase::getEditableIndex(S32 index, bool increasing_direction)
 
 void LLTextBase::updateRects()
 {
+	LLRect old_text_rect = mVisibleTextRect;
+	mVisibleTextRect = mScroller ? mScroller->getContentWindowRect() : getLocalRect();
+
 	if (mLineInfoList.empty()) 
 	{
 		mTextBoundingRect = LLRect(0, mVPad, mHPad, 0);
@@ -2395,10 +2401,24 @@ void LLTextBase::updateRects()
 		}
 
 		mTextBoundingRect.mTop += mVPad;
-		// subtract a pixel off the bottom to deal with rounding errors in measuring font height
-		mTextBoundingRect.mBottom -= 1;
 
-		S32 delta_pos = -mTextBoundingRect.mBottom;
+		S32 delta_pos = 0;
+		
+		switch(mVAlign)
+		{
+		case LLFontGL::TOP:
+			delta_pos = llmax(mVisibleTextRect.getHeight() - mTextBoundingRect.mTop, -mTextBoundingRect.mBottom);
+			break;
+		case LLFontGL::VCENTER:
+			delta_pos = (llmax(mVisibleTextRect.getHeight() - mTextBoundingRect.mTop, -mTextBoundingRect.mBottom) + (mVisibleTextRect.mBottom - mTextBoundingRect.mBottom)) / 2;
+			break;
+		case LLFontGL::BOTTOM:
+			delta_pos = mVisibleTextRect.mBottom - mTextBoundingRect.mBottom;
+			break;
+		case LLFontGL::BASELINE:
+			// do nothing
+			break;
+		}
 		// move line segments to fit new document rect
 		for (line_list_t::iterator it = mLineInfoList.begin(); it != mLineInfoList.end(); ++it)
 		{
@@ -2408,8 +2428,9 @@ void LLTextBase::updateRects()
 	}
 
 	// update document container dimensions according to text contents
-	LLRect doc_rect = mTextBoundingRect;
+	LLRect doc_rect;
 	// use old mVisibleTextRect constraint document to width of viewable region
+	doc_rect.mBottom = llmin(mVisibleTextRect.mBottom,  mTextBoundingRect.mBottom);
 	doc_rect.mLeft = 0;
 
 	// allow horizontal scrolling?
@@ -2419,11 +2440,22 @@ void LLTextBase::updateRects()
 	doc_rect.mRight = mScroller 
 		? llmax(mVisibleTextRect.getWidth(), mTextBoundingRect.mRight)
 		: mVisibleTextRect.getWidth();
+	doc_rect.mTop = llmax(mVisibleTextRect.mTop, mTextBoundingRect.mTop);
 
 	if (!mScroller)
 	{
 		// push doc rect to top of text widget
-		doc_rect.translate(0, mVisibleTextRect.getHeight() - doc_rect.mTop);
+		switch(mVAlign)
+		{
+		case LLFontGL::TOP:
+			doc_rect.translate(0, mVisibleTextRect.getHeight() - doc_rect.mTop);
+			break;
+		case LLFontGL::VCENTER:
+			doc_rect.translate(0, (mVisibleTextRect.getHeight() - doc_rect.mTop) / 2);
+		case LLFontGL::BOTTOM:
+		default:
+			break;
+		}
 	}
 
 	mDocumentView->setShape(doc_rect);
@@ -2431,7 +2463,6 @@ void LLTextBase::updateRects()
 	//update mVisibleTextRect *after* mDocumentView has been resized
 	// so that scrollbars are added if document needs to scroll
 	// since mVisibleTextRect does not include scrollbars
-	LLRect old_text_rect = mVisibleTextRect;
 	mVisibleTextRect = mScroller ? mScroller->getContentWindowRect() : getLocalRect();
 	//FIXME: replace border with image?
 	if (mBorderVisible)
@@ -2444,9 +2475,27 @@ void LLTextBase::updateRects()
 	}
 
 	// update document container again, using new mVisibleTextRect (that has scrollbars enabled as needed)
+	doc_rect.mBottom = llmin(mVisibleTextRect.mBottom,  mTextBoundingRect.mBottom);
+	doc_rect.mLeft = 0;
 	doc_rect.mRight = mScroller 
 		? llmax(mVisibleTextRect.getWidth(), mTextBoundingRect.mRight)
 		: mVisibleTextRect.getWidth();
+	doc_rect.mTop = llmax(mVisibleTextRect.mTop, mTextBoundingRect.mTop);
+	if (!mScroller)
+	{
+		// push doc rect to top of text widget
+		switch(mVAlign)
+		{
+		case LLFontGL::TOP:
+			doc_rect.translate(0, mVisibleTextRect.getHeight() - doc_rect.mTop);
+			break;
+		case LLFontGL::VCENTER:
+			doc_rect.translate(0, (mVisibleTextRect.getHeight() - doc_rect.mTop) / 2);
+		case LLFontGL::BOTTOM:
+		default:
+			break;
+		}
+	}
 	mDocumentView->setShape(doc_rect);
 }
 
@@ -2560,8 +2609,7 @@ BOOL LLTextSegment::handleScrollWheel(S32 x, S32 y, S32 clicks) { return FALSE;
 BOOL LLTextSegment::handleToolTip(S32 x, S32 y, MASK mask) { return FALSE; }
 const std::string&	LLTextSegment::getName() const 
 {
-	static std::string empty_string("");
-	return empty_string; 
+	return LLStringUtil::null;
 }
 void LLTextSegment::onMouseCaptureLost() {}
 void LLTextSegment::screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {}
@@ -2578,7 +2626,7 @@ LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 e
 	mToken(NULL),
 	mEditor(editor)
 {
-	mFontHeight = llceil(mStyle->getFont()->getLineHeight());
+	mFontHeight = mStyle->getFont()->getLineHeight();
 
 	LLUIImagePtr image = mStyle->getImage();
 	if (image.notNull())
@@ -2594,7 +2642,7 @@ LLNormalTextSegment::LLNormalTextSegment( const LLColor4& color, S32 start, S32
 {
 	mStyle = new LLStyle(LLStyle::Params().visible(is_visible).color(color));
 
-	mFontHeight = llceil(mStyle->getFont()->getLineHeight());
+	mFontHeight = mStyle->getFont()->getLineHeight();
 }
 
 LLNormalTextSegment::~LLNormalTextSegment()
@@ -2962,11 +3010,11 @@ LLLineBreakTextSegment::LLLineBreakTextSegment(S32 pos):LLTextSegment(pos,pos+1)
 {
 	LLStyleSP s( new LLStyle(LLStyle::Params().visible(true)));
 
-	mFontHeight = llceil(s->getFont()->getLineHeight());
+	mFontHeight = s->getFont()->getLineHeight();
 }
 LLLineBreakTextSegment::LLLineBreakTextSegment(LLStyleConstSP style,S32 pos):LLTextSegment(pos,pos+1)
 {
-	mFontHeight = llceil(style->getFont()->getLineHeight());
+	mFontHeight = style->getFont()->getLineHeight();
 }
 LLLineBreakTextSegment::~LLLineBreakTextSegment()
 {
@@ -3003,7 +3051,7 @@ static const S32 IMAGE_HPAD = 3;
 bool LLImageTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const
 {
 	width = 0;
-	height = llceil(mStyle->getFont()->getLineHeight());;
+	height = mStyle->getFont()->getLineHeight();
 
 	LLUIImagePtr image = mStyle->getImage();
 	if( num_chars>0 && image.notNull())
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 3a23ce1cacad667d63fce353adf560e4392e3d53..9720dded6c658e5844fe04a949a5997b4060d742 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -1332,7 +1332,7 @@ void LLTextEditor::cut()
 	}
 	S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
 	S32 length = llabs( mSelectionStart - mSelectionEnd );
-	gClipboard.copyFromSubstring( getWText(), left_pos, length, mSourceID );
+	LLClipboard::instance().copyToClipboard( getWText(), left_pos, length);
 	deleteSelection( FALSE );
 
 	onKeyStroke();
@@ -1352,12 +1352,12 @@ void LLTextEditor::copy()
 	}
 	S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
 	S32 length = llabs( mSelectionStart - mSelectionEnd );
-	gClipboard.copyFromSubstring(getWText(), left_pos, length, mSourceID);
+	LLClipboard::instance().copyToClipboard(getWText(), left_pos, length);
 }
 
 BOOL LLTextEditor::canPaste() const
 {
-	return !mReadOnly && gClipboard.canPasteString();
+	return !mReadOnly && LLClipboard::instance().isTextAvailable();
 }
 
 // paste from clipboard
@@ -1393,16 +1393,8 @@ void LLTextEditor::pasteHelper(bool is_primary)
 		return;
 	}
 
-	LLUUID source_id;
 	LLWString paste;
-	if (is_primary)
-	{
-		paste = gClipboard.getPastePrimaryWString(&source_id);
-	}
-	else 
-	{
-		paste = gClipboard.getPasteWString(&source_id);
-	}
+	LLClipboard::instance().pasteFromClipboard(paste, is_primary);
 
 	if (paste.empty())
 	{
@@ -1475,12 +1467,12 @@ void LLTextEditor::copyPrimary()
 	}
 	S32 left_pos = llmin( mSelectionStart, mSelectionEnd );
 	S32 length = llabs( mSelectionStart - mSelectionEnd );
-	gClipboard.copyFromPrimarySubstring(getWText(), left_pos, length, mSourceID);
+	LLClipboard::instance().copyToClipboard(getWText(), left_pos, length, true);
 }
 
 BOOL LLTextEditor::canPastePrimary() const
 {
-	return !mReadOnly && gClipboard.canPastePrimaryString();
+	return !mReadOnly && LLClipboard::instance().isTextAvailable(true);
 }
 
 void LLTextEditor::updatePrimary()
@@ -1992,7 +1984,7 @@ void LLTextEditor::drawPreeditMarker()
 		return;
 	}
 		
-	const S32 line_height = llround( mDefaultFont->getLineHeight() );
+	const S32 line_height = mDefaultFont->getLineHeight();
 
 	S32 line_start = getLineStart(cur_line);
 	S32 line_y = mVisibleTextRect.mTop - line_height;
@@ -2715,7 +2707,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
 
     const LLWString textString(getWText());
 	const llwchar * const text = textString.c_str();
-	const S32 line_height = llround(mDefaultFont->getLineHeight());
+	const S32 line_height = mDefaultFont->getLineHeight();
 
 	if (coord)
 	{
@@ -2818,7 +2810,7 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length)
 
 S32 LLTextEditor::getPreeditFontSize() const
 {
-	return llround(mDefaultFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]);
+	return llround((F32)mDefaultFont->getLineHeight() * LLUI::sGLScaleFactor.mV[VY]);
 }
 
 BOOL LLTextEditor::isDirty() const
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 9b31a6449df3bc082f83de8abecd22f692b12071..81ea0ebf0ca603099532841ee5cbf50e1ce75f1c 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -827,7 +827,7 @@ void LLToolBar::draw()
 	// rect may have shifted during layout
 	LLUI::popMatrix();
 	LLUI::pushMatrix();
-	LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom, 0.f);
+	LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom);
 
 	// Position the caret 
 	LLIconCtrl* caret = getChild<LLIconCtrl>("caret");
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index 23cdd9ad9a4817e17384bcd20fe094b1b58df30c..f737d48abfaade2245b71b1c486a80663a7bae54 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -180,6 +180,7 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
 	params.font = p.font;
 	params.use_ellipses = true;
 	params.wrap = p.wrap;
+	params.font_valign = LLFontGL::VCENTER;
 	params.parse_urls = false; // disallow hyperlinks in tooltips, as they want to spawn their own explanatory tooltips
 	mTextBox = LLUICtrlFactory::create<LLTextBox> (params);
 	addChild(mTextBox);
@@ -190,7 +191,6 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
 	{
 		LLButton::Params icon_params;
 		icon_params.name = "tooltip_info";
-		icon_params.label(""); // provid label but set to empty so name does not overwrite it -angela
 		LLRect icon_rect;
 		LLUIImage* imagep = p.image;
 		TOOLTIP_ICON_SIZE = (imagep ? imagep->getWidth() : 16);
@@ -291,6 +291,12 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p)
 	S32 text_width = llmin(p.max_width(), mTextBox->getTextPixelWidth());
 	S32 text_height = mTextBox->getTextPixelHeight();
 	mTextBox->reshape(text_width, text_height);
+	if (mInfoButton)
+	{
+		LLRect text_rect = mTextBox->getRect();
+		LLRect icon_rect = mInfoButton->getRect();
+		mTextBox->translate(0, icon_rect.getCenterY() - text_rect.getCenterY());
+	}
 
 	// reshape tooltip panel to fit text box
 	LLRect tooltip_rect = calcBoundingRect();
@@ -299,6 +305,8 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p)
 	tooltip_rect.mBottom = 0;
 	tooltip_rect.mLeft = 0;
 
+	mTextBox->reshape(mTextBox->getRect().getWidth(), llmax(mTextBox->getRect().getHeight(), tooltip_rect.getHeight() - 2 * mPadding));
+
 	setShape(tooltip_rect);
 }
 
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 6b74c5a6be0f09d7a0b827a71a1b7000937c2d6d..31ccec0d2af701c63a4c42a40d7861f8d9658c53 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -1688,21 +1688,22 @@ void LLUI::translate(F32 x, F32 y, F32 z)
 	gGL.translateUI(x,y,z);
 	LLFontGL::sCurOrigin.mX += (S32) x;
 	LLFontGL::sCurOrigin.mY += (S32) y;
-	LLFontGL::sCurOrigin.mZ += z;
+	LLFontGL::sCurDepth += z;
 }
 
 //static
 void LLUI::pushMatrix()
 {
 	gGL.pushUIMatrix();
-	LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin);
+	LLFontGL::sOriginStack.push_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth));
 }
 
 //static
 void LLUI::popMatrix()
 {
 	gGL.popUIMatrix();
-	LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin();
+	LLFontGL::sCurOrigin = LLFontGL::sOriginStack.back().first;
+	LLFontGL::sCurDepth = LLFontGL::sOriginStack.back().second;
 	LLFontGL::sOriginStack.pop_back();
 }
 
@@ -1712,7 +1713,7 @@ void LLUI::loadIdentity()
 	gGL.loadUIIdentity(); 
 	LLFontGL::sCurOrigin.mX = 0;
 	LLFontGL::sCurOrigin.mY = 0;
-	LLFontGL::sCurOrigin.mZ = 0;
+	LLFontGL::sCurDepth = 0.f;
 }
 
 //static
@@ -1735,10 +1736,7 @@ void LLUI::setMousePositionScreen(S32 x, S32 y)
 	screen_x = llround((F32)x * sGLScaleFactor.mV[VX]);
 	screen_y = llround((F32)y * sGLScaleFactor.mV[VY]);
 	
-	LLCoordWindow window_point;
-	LLView::getWindow()->convertCoords(LLCoordGL(screen_x, screen_y), &window_point);
-
-	LLView::getWindow()->setCursorPosition(window_point);
+	LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert());
 }
 
 //static 
@@ -1746,8 +1744,7 @@ void LLUI::getMousePositionScreen(S32 *x, S32 *y)
 {
 	LLCoordWindow cursor_pos_window;
 	getWindow()->getCursorPosition(&cursor_pos_window);
-	LLCoordGL cursor_pos_gl;
-	getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl);
+	LLCoordGL cursor_pos_gl(cursor_pos_window.convert());
 	*x = llround((F32)cursor_pos_gl.mX / sGLScaleFactor.mV[VX]);
 	*y = llround((F32)cursor_pos_gl.mY / sGLScaleFactor.mV[VX]);
 }
@@ -2052,7 +2049,7 @@ void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y)
 	// Start at spawn position (using left/top)
 	view->setOrigin( local_x, local_y - view->getRect().getHeight());
 	// Make sure we're on-screen and not overlapping the mouse
-	view->translateIntoRectWithExclusion( virtual_window_rect, mouse_rect, FALSE );
+	view->translateIntoRectWithExclusion( virtual_window_rect, mouse_rect );
 }
 
 LLView* LLUI::resolvePath(LLView* context, const std::string& path)
diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp
index ac69d3bf8513074cb22fd7519aae0823217cd442..c4e073ccdb9cb9892a7fe502a4d56daaca8f8b1b 100644
--- a/indra/llui/lluistring.cpp
+++ b/indra/llui/lluistring.cpp
@@ -128,17 +128,13 @@ void LLUIString::updateResult() const
 	}
 	mResult = mOrig;
 	
-	// get the defailt args + local args
-	if (!mArgs || mArgs->empty())
+	// get the default args + local args
+	LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs();
+	if (mArgs && !mArgs->empty())
 	{
-		LLStringUtil::format(mResult, LLTrans::getDefaultArgs());
-	}
-	else
-	{
-		LLStringUtil::format_map_t combined_args = LLTrans::getDefaultArgs();
 		combined_args.insert(mArgs->begin(), mArgs->end());
-		LLStringUtil::format(mResult, combined_args);
 	}
+	LLStringUtil::format(mResult, combined_args);
 }
 
 void LLUIString::updateWResult() const
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index e1ee0a5b14f07ccb19f84f4802f5704579dda8b6..54843227b74c4f99263a5dcbd4d70d7dfba9629a 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -1106,7 +1106,7 @@ void LLView::drawChildren()
 				{
 					LLUI::pushMatrix();
 					{
-						LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f);
+						LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom);
 						// flag the fact we are in draw here, in case overridden draw() method attempts to remove this widget
 						viewp->mInDraw = true;
 						viewp->draw();
@@ -1159,7 +1159,7 @@ void LLView::drawDebugRect()
 
 		if (getUseBoundingRect())
 		{
-			LLUI::translate((F32)mBoundingRect.mLeft - (F32)mRect.mLeft, (F32)mBoundingRect.mBottom - (F32)mRect.mBottom, 0.f);
+			LLUI::translate((F32)mBoundingRect.mLeft - (F32)mRect.mLeft, (F32)mBoundingRect.mBottom - (F32)mRect.mBottom);
 		}
 
 		LLRect debug_rect = getUseBoundingRect() ? mBoundingRect : mRect;
@@ -1231,7 +1231,7 @@ void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_dr
 			gGL.matrixMode(LLRender::MM_MODELVIEW);
 			LLUI::pushMatrix();
 			{
-				LLUI::translate((F32)childp->getRect().mLeft + x_offset, (F32)childp->getRect().mBottom + y_offset, 0.f);
+				LLUI::translate((F32)childp->getRect().mLeft + x_offset, (F32)childp->getRect().mBottom + y_offset);
 				childp->draw();
 			}
 			LLUI::popMatrix();
@@ -1300,7 +1300,10 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)
 			S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft;
 			S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom;
 			viewp->translate( delta_x, delta_y );
-			viewp->reshape(child_rect.getWidth(), child_rect.getHeight());
+			if (child_rect.getWidth() != viewp->getRect().getWidth() || child_rect.getHeight() != viewp->getRect().getHeight())
+			{
+				viewp->reshape(child_rect.getWidth(), child_rect.getHeight());
+			}
 		}
 	}
 
@@ -1616,59 +1619,30 @@ LLView* LLView::findNextSibling(LLView* child)
 }
 
 
-LLCoordGL getNeededTranslation(const LLRect& input, const LLRect& constraint, BOOL allow_partial_outside)
+LLCoordGL getNeededTranslation(const LLRect& input, const LLRect& constraint, S32 min_overlap_pixels)
 {
 	LLCoordGL delta;
 
-	if (allow_partial_outside)
-	{
-		const S32 KEEP_ONSCREEN_PIXELS = 16;
+	const S32 KEEP_ONSCREEN_PIXELS_WIDTH = llmin(min_overlap_pixels, input.getWidth());
+	const S32 KEEP_ONSCREEN_PIXELS_HEIGHT = llmin(min_overlap_pixels, input.getHeight());
 
-		if( input.mRight - KEEP_ONSCREEN_PIXELS < constraint.mLeft )
-		{
-			delta.mX = constraint.mLeft - (input.mRight - KEEP_ONSCREEN_PIXELS);
-		}
-		else
-		if( input.mLeft + KEEP_ONSCREEN_PIXELS > constraint.mRight )
-		{
-			delta.mX = constraint.mRight - (input.mLeft + KEEP_ONSCREEN_PIXELS);
-		}
+	if( input.mRight - KEEP_ONSCREEN_PIXELS_WIDTH < constraint.mLeft )
+	{
+		delta.mX = constraint.mLeft - (input.mRight - KEEP_ONSCREEN_PIXELS_WIDTH);
+	}
+	else if( input.mLeft + KEEP_ONSCREEN_PIXELS_WIDTH > constraint.mRight )
+	{
+		delta.mX = constraint.mRight - (input.mLeft + KEEP_ONSCREEN_PIXELS_WIDTH);
+	}
 
-		if( input.mTop > constraint.mTop )
-		{
-			delta.mY = constraint.mTop - input.mTop;
-		}
-		else
-		if( input.mTop - KEEP_ONSCREEN_PIXELS < constraint.mBottom )
-		{
-			delta.mY = constraint.mBottom - (input.mTop - KEEP_ONSCREEN_PIXELS);
-		}
+	if( input.mTop > constraint.mTop )
+	{
+		delta.mY = constraint.mTop - input.mTop;
 	}
 	else
+	if( input.mTop - KEEP_ONSCREEN_PIXELS_HEIGHT < constraint.mBottom )
 	{
-		if( input.mLeft < constraint.mLeft )
-		{
-			delta.mX = constraint.mLeft - input.mLeft;
-		}
-		else
-		if( input.mRight > constraint.mRight )
-		{
-			delta.mX = constraint.mRight - input.mRight;
-			// compensate for left edge possible going off screen
-			delta.mX += llmax( 0, input.getWidth() - constraint.getWidth() );
-		}
-
-		if( input.mTop > constraint.mTop )
-		{
-			delta.mY = constraint.mTop - input.mTop;
-		}
-		else
-		if( input.mBottom < constraint.mBottom )
-		{
-			delta.mY = constraint.mBottom - input.mBottom;
-			// compensate for top edge possible going off screen
-			delta.mY -= llmax( 0, input.getHeight() - constraint.getHeight() );
-		}
+		delta.mY = constraint.mBottom - (input.mTop - KEEP_ONSCREEN_PIXELS_HEIGHT);
 	}
 
 	return delta;
@@ -1677,9 +1651,9 @@ LLCoordGL getNeededTranslation(const LLRect& input, const LLRect& constraint, BO
 // Moves the view so that it is entirely inside of constraint.
 // If the view will not fit because it's too big, aligns with the top and left.
 // (Why top and left?  That's where the drag bars are for floaters.)
-BOOL LLView::translateIntoRect(const LLRect& constraint, BOOL allow_partial_outside )
+BOOL LLView::translateIntoRect(const LLRect& constraint, S32 min_overlap_pixels)
 {
-	LLCoordGL translation = getNeededTranslation(getRect(), constraint, allow_partial_outside);
+	LLCoordGL translation = getNeededTranslation(getRect(), constraint, min_overlap_pixels);
 
 	if (translation.mX != 0 || translation.mY != 0)
 	{
@@ -1691,9 +1665,9 @@ BOOL LLView::translateIntoRect(const LLRect& constraint, BOOL allow_partial_outs
 
 // move this view into "inside" but not onto "exclude"
 // NOTE: if this view is already contained in "inside", we ignore the "exclude" rect
-BOOL LLView::translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, BOOL allow_partial_outside )
+BOOL LLView::translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels)
 {
-	LLCoordGL translation = getNeededTranslation(getRect(), inside, allow_partial_outside);
+	LLCoordGL translation = getNeededTranslation(getRect(), inside, min_overlap_pixels);
 	
 	if (translation.mX != 0 || translation.mY != 0)
 	{
@@ -1861,7 +1835,10 @@ const LLCtrlQuery & LLView::getFocusRootsQuery()
 
 void	LLView::setShape(const LLRect& new_rect, bool by_user)
 {
-	handleReshape(new_rect, by_user);
+	if (new_rect != getRect())
+	{
+		handleReshape(new_rect, by_user);
+	}
 }
 
 void LLView::handleReshape(const LLRect& new_rect, bool by_user)
@@ -2251,145 +2228,163 @@ static bool get_last_child_rect(LLView* parent, LLRect *rect)
 }
 
 //static
-void LLView::applyXUILayout(LLView::Params& p, LLView* parent)
+void LLView::applyXUILayout(LLView::Params& p, LLView* parent, LLRect layout_rect)
 {
+	if (!parent) return;
+
 	const S32 VPAD = 4;
 	const S32 MIN_WIDGET_HEIGHT = 10;
 	
 	// *NOTE:  This will confuse export of floater/panel coordinates unless
 	// the default is also "topleft".  JC
-	if (p.layout().empty() && parent)
+	if (p.layout().empty())
 	{
 		p.layout = parent->getLayout();
 	}
 
-	if (parent)
+	if (layout_rect.isEmpty())
 	{
-		LLRect parent_rect = parent->getLocalRect();
-		// overwrite uninitialized rect params, using context
-		LLRect default_rect = parent->getLocalRect();
+		layout_rect = parent->getLocalRect();
+	}
 
-		bool layout_topleft = (p.layout() == "topleft");
+	// overwrite uninitialized rect params, using context
+	LLRect default_rect = parent->getLocalRect();
 
-		// convert negative or centered coordinates to parent relative values
-		// Note: some of this logic matches the logic in TypedParam<LLRect>::setValueFromBlock()
-		if (p.rect.left.isProvided() && p.rect.left < 0) p.rect.left = p.rect.left + parent_rect.getWidth();
-		if (p.rect.right.isProvided() && p.rect.right < 0) p.rect.right = p.rect.right + parent_rect.getWidth();
-		if (p.rect.bottom.isProvided() && p.rect.bottom < 0) p.rect.bottom = p.rect.bottom + parent_rect.getHeight();
-		if (p.rect.top.isProvided() && p.rect.top < 0) p.rect.top = p.rect.top + parent_rect.getHeight();
+	bool layout_topleft = (p.layout() == "topleft");
 
+	// convert negative or centered coordinates to parent relative values
+	// Note: some of this logic matches the logic in TypedParam<LLRect>::setValueFromBlock()
+	if (p.rect.left.isProvided()) 
+	{
+		p.rect.left = p.rect.left + ((p.rect.left >= 0) ? layout_rect.mLeft : layout_rect.mRight);
+	}
+	if (p.rect.right.isProvided())
+	{
+		p.rect.right = p.rect.right + ((p.rect.right >= 0) ? layout_rect.mLeft : layout_rect.mRight);
+	}
+	if (p.rect.bottom.isProvided()) 
+	{
+		p.rect.bottom = p.rect.bottom + ((p.rect.bottom >= 0) ? layout_rect.mBottom : layout_rect.mTop);
 		if (layout_topleft)
 		{
 			//invert top to bottom
-			if (p.rect.top.isProvided()) p.rect.top = parent_rect.getHeight() - p.rect.top;
-			if (p.rect.bottom.isProvided()) p.rect.bottom = parent_rect.getHeight() - p.rect.bottom;
+			p.rect.bottom = layout_rect.mBottom + layout_rect.mTop - p.rect.bottom;
 		}
-
-		// DEPRECATE: automatically fall back to height of MIN_WIDGET_HEIGHT pixels
-		if (!p.rect.height.isProvided() && !p.rect.top.isProvided() && p.rect.height == 0)
+	}
+	if (p.rect.top.isProvided())
+	{
+		p.rect.top = p.rect.top + ((p.rect.top >= 0) ? layout_rect.mBottom : layout_rect.mTop);
+		if (layout_topleft)
 		{
-			p.rect.height = MIN_WIDGET_HEIGHT;
+			//invert top to bottom
+			p.rect.top = layout_rect.mBottom + layout_rect.mTop - p.rect.top;
 		}
+	}
+
+	// DEPRECATE: automatically fall back to height of MIN_WIDGET_HEIGHT pixels
+	if (!p.rect.height.isProvided() && !p.rect.top.isProvided() && p.rect.height == 0)
+	{
+		p.rect.height = MIN_WIDGET_HEIGHT;
+	}
 
-		default_rect.translate(0, default_rect.getHeight());
+	default_rect.translate(0, default_rect.getHeight());
 
-		// If there was a recently constructed child, use its rectangle
-		get_last_child_rect(parent, &default_rect);
+	// If there was a recently constructed child, use its rectangle
+	get_last_child_rect(parent, &default_rect);
 
-		if (layout_topleft)
+	if (layout_topleft)
+	{
+		// Invert the sense of bottom_delta for topleft layout
+		if (p.bottom_delta.isProvided())
 		{
-			// Invert the sense of bottom_delta for topleft layout
-			if (p.bottom_delta.isProvided())
-			{
-				p.bottom_delta = -p.bottom_delta;
-			}
-			else if (p.top_pad.isProvided()) 
-			{
-				p.bottom_delta = -(p.rect.height + p.top_pad);
-			}
-			else if (p.top_delta.isProvided())
-			{
-				p.bottom_delta =
-					-(p.top_delta + p.rect.height - default_rect.getHeight());
-			}
-			else if (!p.left_delta.isProvided()
-					 && !p.left_pad.isProvided())
-			{
-				// set default position is just below last rect
-				p.bottom_delta.set(-(p.rect.height + VPAD), false);
-			}
-			else
-			{
-				p.bottom_delta.set(0, false);
-			}
-	
-			// default to same left edge
-			if (!p.left_delta.isProvided())
-			{
-				p.left_delta.set(0, false);
-			}
-			if (p.left_pad.isProvided())
-			{
-				// left_pad is based on prior widget's right edge
-				p.left_delta.set(p.left_pad + default_rect.getWidth(), false);
-			}
-			
-			default_rect.translate(p.left_delta, p.bottom_delta);				
+			p.bottom_delta = -p.bottom_delta;
 		}
-		else
-		{	
-			// set default position is just below last rect
-			if (!p.bottom_delta.isProvided())
-			{
-				p.bottom_delta.set(-(p.rect.height + VPAD), false);
-			}
-			if (!p.left_delta.isProvided())
-			{
-				p.left_delta.set(0, false);
-			}
-			default_rect.translate(p.left_delta, p.bottom_delta);
+		else if (p.top_pad.isProvided()) 
+		{
+			p.bottom_delta = -(p.rect.height + p.top_pad);
 		}
-
-		// this handles case where *both* x and x_delta are provided
-		// ignore x in favor of default x + x_delta
-		if (p.bottom_delta.isProvided()) p.rect.bottom.set(0, false);
-		if (p.left_delta.isProvided()) p.rect.left.set(0, false);
-
-		// selectively apply rectangle defaults, making sure that
-		// params are not flagged as having been "provided"
-		// as rect params are overconstrained and rely on provided flags
-		if (!p.rect.left.isProvided())
+		else if (p.top_delta.isProvided())
 		{
-			p.rect.left.set(default_rect.mLeft, false);
-			//HACK: get around the fact that setting a rect param component value won't invalidate the existing rect object value
-			p.rect.paramChanged(p.rect.left, true);
+			p.bottom_delta =
+				-(p.top_delta + p.rect.height - default_rect.getHeight());
 		}
-		if (!p.rect.bottom.isProvided())
+		else if (!p.left_delta.isProvided()
+					&& !p.left_pad.isProvided())
 		{
-			p.rect.bottom.set(default_rect.mBottom, false);
-			p.rect.paramChanged(p.rect.bottom, true);
+			// set default position is just below last rect
+			p.bottom_delta.set(-(p.rect.height + VPAD), false);
 		}
-		if (!p.rect.top.isProvided())
+		else
 		{
-			p.rect.top.set(default_rect.mTop, false);
-			p.rect.paramChanged(p.rect.top, true);
+			p.bottom_delta.set(0, false);
 		}
-		if (!p.rect.right.isProvided())
+	
+		// default to same left edge
+		if (!p.left_delta.isProvided())
 		{
-			p.rect.right.set(default_rect.mRight, false);
-			p.rect.paramChanged(p.rect.right, true);
-
+			p.left_delta.set(0, false);
 		}
-		if (!p.rect.width.isProvided())
+		if (p.left_pad.isProvided())
 		{
-			p.rect.width.set(default_rect.getWidth(), false);
-			p.rect.paramChanged(p.rect.width, true);
+			// left_pad is based on prior widget's right edge
+			p.left_delta.set(p.left_pad + default_rect.getWidth(), false);
 		}
-		if (!p.rect.height.isProvided())
+			
+		default_rect.translate(p.left_delta, p.bottom_delta);				
+	}
+	else
+	{	
+		// set default position is just below last rect
+		if (!p.bottom_delta.isProvided())
+		{
+			p.bottom_delta.set(-(p.rect.height + VPAD), false);
+		}
+		if (!p.left_delta.isProvided())
 		{
-			p.rect.height.set(default_rect.getHeight(), false);
-			p.rect.paramChanged(p.rect.height, true);
+			p.left_delta.set(0, false);
 		}
+		default_rect.translate(p.left_delta, p.bottom_delta);
+	}
+
+	// this handles case where *both* x and x_delta are provided
+	// ignore x in favor of default x + x_delta
+	if (p.bottom_delta.isProvided()) p.rect.bottom.set(0, false);
+	if (p.left_delta.isProvided()) p.rect.left.set(0, false);
+
+	// selectively apply rectangle defaults, making sure that
+	// params are not flagged as having been "provided"
+	// as rect params are overconstrained and rely on provided flags
+	if (!p.rect.left.isProvided())
+	{
+		p.rect.left.set(default_rect.mLeft, false);
+		//HACK: get around the fact that setting a rect param component value won't invalidate the existing rect object value
+		p.rect.paramChanged(p.rect.left, true);
+	}
+	if (!p.rect.bottom.isProvided())
+	{
+		p.rect.bottom.set(default_rect.mBottom, false);
+		p.rect.paramChanged(p.rect.bottom, true);
+	}
+	if (!p.rect.top.isProvided())
+	{
+		p.rect.top.set(default_rect.mTop, false);
+		p.rect.paramChanged(p.rect.top, true);
+	}
+	if (!p.rect.right.isProvided())
+	{
+		p.rect.right.set(default_rect.mRight, false);
+		p.rect.paramChanged(p.rect.right, true);
+
+	}
+	if (!p.rect.width.isProvided())
+	{
+		p.rect.width.set(default_rect.getWidth(), false);
+		p.rect.paramChanged(p.rect.width, true);
+	}
+	if (!p.rect.height.isProvided())
+	{
+		p.rect.height.set(default_rect.getHeight(), false);
+		p.rect.paramChanged(p.rect.height, true);
 	}
 }
 
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index f1fac5f69ce90483d03744e413ecc06cff25fa4f..1c353495107b1f09426693ed6aabdd76195f7661 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -370,8 +370,8 @@ class LLView
 	virtual void	reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 	virtual void	translate( S32 x, S32 y );
 	void			setOrigin( S32 x, S32 y )	{ mRect.translate( x - mRect.mLeft, y - mRect.mBottom ); }
-	BOOL			translateIntoRect( const LLRect& constraint, BOOL allow_partial_outside );
-	BOOL			translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, BOOL allow_partial_outside );
+	BOOL			translateIntoRect( const LLRect& constraint, S32 min_overlap_pixels = S32_MAX);
+	BOOL			translateIntoRectWithExclusion( const LLRect& inside, const LLRect& exclude, S32 min_overlap_pixels = S32_MAX);
 	void			centerWithin(const LLRect& bounds);
 
 	void	setShape(const LLRect& new_rect, bool by_user = false);
@@ -505,7 +505,7 @@ class LLView
 
 	// Set up params after XML load before calling new(),
 	// usually to adjust layout.
-	static void applyXUILayout(Params& p, LLView* parent);
+	static void applyXUILayout(Params& p, LLView* parent, LLRect layout_rect = LLRect());
 
 	// For re-export of floaters and panels, convert the coordinate system
 	// to be top-left based.
diff --git a/indra/llvfs/lllfsthread.cpp b/indra/llvfs/lllfsthread.cpp
index 3d3ed9f6d4d32f34999a3b36bc659b19461e6a8b..073b1af2a1b3b029231d8d9b6b4710d2f7711a7c 100644
--- a/indra/llvfs/lllfsthread.cpp
+++ b/indra/llvfs/lllfsthread.cpp
@@ -45,7 +45,7 @@ void LLLFSThread::initClass(bool local_is_threaded)
 //static
 S32 LLLFSThread::updateClass(U32 ms_elapsed)
 {
-	sLocal->update(ms_elapsed);
+	sLocal->update((F32)ms_elapsed);
 	return sLocal->getPending();
 }
 
diff --git a/indra/llvfs/llvfsthread.cpp b/indra/llvfs/llvfsthread.cpp
index 254f8b55ba3b4af3e3e7c81e09f5040ae3446f18..a57e2b15abc68f42ee607b48776abbf08fcca717 100644
--- a/indra/llvfs/llvfsthread.cpp
+++ b/indra/llvfs/llvfsthread.cpp
@@ -46,7 +46,7 @@ void LLVFSThread::initClass(bool local_is_threaded)
 //static
 S32 LLVFSThread::updateClass(U32 ms_elapsed)
 {
-	sLocal->update(ms_elapsed);
+	sLocal->update((F32)ms_elapsed);
 	return sLocal->getPending();
 }
 
diff --git a/indra/llwindow/lldragdropwin32.cpp b/indra/llwindow/lldragdropwin32.cpp
index d4d444eb2886c4e3b08742e66cc13cc9f7ff8654..15acddd987682a605ce90c0e5a449ada22c26e50 100644
--- a/indra/llwindow/lldragdropwin32.cpp
+++ b/indra/llwindow/lldragdropwin32.cpp
@@ -124,10 +124,9 @@ class LLDragDropWin32Target:
 						ScreenToClient( mAppWindowHandle, &pt2 );
 
 						LLCoordWindow cursor_coord_window( pt2.x, pt2.y );
-						window_imp->convertCoords(cursor_coord_window, &gl_coord);
 						MASK mask = gKeyboard->currentMask(TRUE);
 
-						LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask, 
+						LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( cursor_coord_window.convert(), mask, 
 							LLWindowCallbacks::DNDA_START_TRACKING, mDropUrl );
 
 						switch (result)
@@ -180,10 +179,9 @@ class LLDragDropWin32Target:
 					ScreenToClient( mAppWindowHandle, &pt2 );
 
 					LLCoordWindow cursor_coord_window( pt2.x, pt2.y );
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
 					MASK mask = gKeyboard->currentMask(TRUE);
 
-					LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask, 
+					LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( cursor_coord_window.convert(), mask, 
 						LLWindowCallbacks::DNDA_TRACK, mDropUrl );
 					
 					switch (result)
@@ -237,15 +235,13 @@ class LLDragDropWin32Target:
 				LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong( mAppWindowHandle, GWL_USERDATA );
 				if ( NULL != window_imp )
 				{
-					LLCoordGL gl_coord( 0, 0 );
-
 					POINT pt_client;
 					pt_client.x = pt.x;
 					pt_client.y = pt.y;
 					ScreenToClient( mAppWindowHandle, &pt_client );
 
 					LLCoordWindow cursor_coord_window( pt_client.x, pt_client.y );
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					LLCoordGL gl_coord(cursor_coord_window.convert());
 					llinfos << "### (Drop) URL is: " << mDropUrl << llendl;
 					llinfos << "###        raw coords are: " << pt.x << " x " << pt.y << llendl;
 					llinfos << "###	    client coords are: " << pt_client.x << " x " << pt_client.y << llendl;
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index 2e9e31bfea1cdddd7f7d1de26bce96f888ff52ac..5b7424acbb69dcf2762f78236ef68e96342c1e87 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -192,6 +192,21 @@ BOOL LLWindow::setSize(LLCoordScreen size)
 	return setSizeImpl(size);
 }
 
+BOOL LLWindow::setSize(LLCoordWindow size)
+{
+	//HACK: we are inconsistently using minimum window dimensions
+	// in this case, we are constraining the inner "client" rect and other times
+	// we constrain the outer "window" rect
+	// There doesn't seem to be a good way to do this consistently without a bunch of platform
+	// specific code
+	if (!getMaximized())
+	{
+		size.mX = llmax(size.mX, mMinWindowWidth);
+		size.mY = llmax(size.mY, mMinWindowHeight);
+	}
+	return setSizeImpl(size);
+}
+
 
 // virtual
 void LLWindow::setMinSize(U32 min_width, U32 min_height, bool enforce_immediately)
@@ -436,3 +451,42 @@ BOOL LLWindowManager::isWindowValid(LLWindow *window)
 {
 	return sWindowList.find(window) != sWindowList.end();
 }
+
+//coordinate conversion utility funcs that forward to llwindow
+LLCoordCommon LL_COORD_TYPE_WINDOW::convertToCommon() const
+{
+	const LLCoordWindow& self = LLCoordWindow::getTypedCoords(*this);
+
+	LLWindow* windowp = &(*LLWindow::beginInstances());
+	LLCoordGL out;
+	windowp->convertCoords(self, &out);
+	return out.convert();
+}
+
+void LL_COORD_TYPE_WINDOW::convertFromCommon(const LLCoordCommon& from)
+{
+	LLCoordWindow& self = LLCoordWindow::getTypedCoords(*this);
+
+	LLWindow* windowp = &(*LLWindow::beginInstances());
+	LLCoordGL from_gl(from);
+	windowp->convertCoords(from_gl, &self);
+}
+
+LLCoordCommon LL_COORD_TYPE_SCREEN::convertToCommon() const
+{
+	const LLCoordScreen& self = LLCoordScreen::getTypedCoords(*this);
+
+	LLWindow* windowp = &(*LLWindow::beginInstances());
+	LLCoordGL out;
+	windowp->convertCoords(self, &out);
+	return out.convert();
+}
+
+void LL_COORD_TYPE_SCREEN::convertFromCommon(const LLCoordCommon& from)
+{
+	LLCoordScreen& self = LLCoordScreen::getTypedCoords(*this);
+
+	LLWindow* windowp = &(*LLWindow::beginInstances());
+	LLCoordGL from_gl(from);
+	windowp->convertCoords(from_gl, &self);
+}
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index cab2d0a8fb74cf0205712f15b433531d6afe94e7..4da87f4e068d64d90f5d039b8e9f3ca0fe890db5 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -39,7 +39,7 @@ class LLWindowCallbacks;
 
 // Refer to llwindow_test in test/common/llwindow for usage example
 
-class LLWindow
+class LLWindow : public LLInstanceTracker<LLWindow>
 {
 public:
 	struct LLWindowResolution
@@ -73,6 +73,7 @@ class LLWindow
 	virtual BOOL getSize(LLCoordWindow *size) = 0;
 	virtual BOOL setPosition(LLCoordScreen position) = 0;
 	BOOL setSize(LLCoordScreen size);
+	BOOL setSize(LLCoordWindow size);
 	virtual void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true);
 	virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) = 0;
 	virtual BOOL setCursorPosition(LLCoordWindow position) = 0;
@@ -172,6 +173,7 @@ class LLWindow
 	virtual BOOL canDelete();
 
 	virtual BOOL setSizeImpl(LLCoordScreen size) = 0;
+	virtual BOOL setSizeImpl(LLCoordWindow size) = 0;
 
 protected:
 	LLWindowCallbacks*	mCallbacks;
diff --git a/indra/llwindow/llwindowcallbacks.cpp b/indra/llwindow/llwindowcallbacks.cpp
index c2705bbf746e3b5ef209c9d29515bc06f8e9195e..9712ae1d91a39111a0db162da0055a5214d16732 100644
--- a/indra/llwindow/llwindowcallbacks.cpp
+++ b/indra/llwindow/llwindowcallbacks.cpp
@@ -28,8 +28,6 @@
 
 #include "llwindowcallbacks.h"
 
-#include "llcoord.h"
-
 //
 // LLWindowCallbacks
 //
diff --git a/indra/llwindow/llwindowcallbacks.h b/indra/llwindow/llwindowcallbacks.h
index 8572b442f1d2ddcfaf31f5f16be997bfdeb3fd2d..7da5959700ce51a8fcf720a16e2cc799b57afadd 100644
--- a/indra/llwindow/llwindowcallbacks.h
+++ b/indra/llwindow/llwindowcallbacks.h
@@ -26,7 +26,7 @@
 #ifndef LLWINDOWCALLBACKS_H
 #define LLWINDOWCALLBACKS_H
 
-class LLCoordGL;
+#include "llcoord.h"
 class LLWindow;
 
 class LLWindowCallbacks
diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h
index d4a778cb85bddf569f34e98025f53b57e5fdedcb..1f767f4c97d65716942ba819684b4fc217478951 100644
--- a/indra/llwindow/llwindowheadless.h
+++ b/indra/llwindow/llwindowheadless.h
@@ -47,6 +47,7 @@ class LLWindowHeadless : public LLWindow
 	/*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;};
 	/*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
 	/*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;};
+	/*virtual*/ BOOL setSizeImpl(LLCoordWindow size) {return FALSE;};
 	/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;};
 	/*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;};
 	/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;};
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index c952f8bbcf504cf0172d66dbb20513abd4642144..32bb84cba59171dfe2450ea77801103682e094e8 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -1266,6 +1266,31 @@ BOOL LLWindowMacOSX::setSizeImpl(const LLCoordScreen size)
 	return TRUE;
 }
 
+BOOL LLWindowMacOSX::setSizeImpl(const LLCoordWindow size)
+{
+	Rect client_rect;
+	if (mWindow)
+	{
+		OSStatus err = GetWindowBounds(mWindow, kWindowContentRgn, &client_rect);
+		if (err == noErr)
+		{
+			client_rect.right = client_rect.left + size.mX;
+			client_rect.bottom = client_rect.top + size.mY;
+			err = SetWindowBounds(mWindow, kWindowContentRgn, &client_rect);
+		}
+		if (err == noErr)
+		{
+			return TRUE;
+		}
+		else
+		{
+			llinfos << "Error setting size" << err << llendl;
+			return FALSE;
+		}
+	}
+	return FALSE;
+}
+
 void LLWindowMacOSX::swapBuffers()
 {
 	aglSwapBuffers(mContext);
diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h
index 073f294b543722340288fa6b0793e80464ce8ad2..52ba8b3bf3eb7f43c7044f08317aacc920887482 100644
--- a/indra/llwindow/llwindowmacosx.h
+++ b/indra/llwindow/llwindowmacosx.h
@@ -59,6 +59,7 @@ class LLWindowMacOSX : public LLWindow
 	/*virtual*/ BOOL getSize(LLCoordWindow *size);
 	/*virtual*/ BOOL setPosition(LLCoordScreen position);
 	/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
+	/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
 	/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
 	/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
 	/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index 5f5baceef838cfeb1f7525edc562523f4333542e..3d33af9d9bc97289a4f67030576d2f3f75613983 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -981,6 +981,25 @@ BOOL LLWindowSDL::setSizeImpl(const LLCoordScreen size)
 	return FALSE;
 }
 
+BOOL LLWindowSDL::setSizeImpl(const LLCoordWindow size)
+{
+	if(mWindow)
+	{
+		// Push a resize event onto SDL's queue - we'll handle it
+		// when it comes out again.
+		SDL_Event event;
+		event.type = SDL_VIDEORESIZE;
+		event.resize.w = size.mX;
+		event.resize.h = size.mY;
+		SDL_PushEvent(&event); // copied into queue
+
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+
 void LLWindowSDL::swapBuffers()
 {
 	if (mWindow)
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index 59719e404625d1c80e465f04641ec85d0bacda67..4e2a269ea33b4587c903662e55106c05e22d8a8d 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -64,6 +64,7 @@ class LLWindowSDL : public LLWindow
 	/*virtual*/ BOOL getSize(LLCoordWindow *size);
 	/*virtual*/ BOOL setPosition(LLCoordScreen position);
 	/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
+	/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
 	/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
 	/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
 	/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 228fbefd194f0a21554e8d54e4c02919e2910861..bc85acbf4593a29926ae3cf44d256f0a294348ab 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -872,10 +872,30 @@ BOOL LLWindowWin32::setSizeImpl(const LLCoordScreen size)
 		return FALSE;
 	}
 
+	WINDOWPLACEMENT placement;
+	placement.length = sizeof(WINDOWPLACEMENT);
+
+	if (!GetWindowPlacement(mWindowHandle, &placement)) return FALSE;
+
+	placement.showCmd = SW_RESTORE;
+
+	if (!SetWindowPlacement(mWindowHandle, &placement)) return FALSE;
+
 	moveWindow(position, size);
 	return TRUE;
 }
 
+BOOL LLWindowWin32::setSizeImpl(const LLCoordWindow size)
+{
+	RECT window_rect = {0, 0, size.mX, size.mY };
+	DWORD dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
+	DWORD dw_style = WS_OVERLAPPEDWINDOW;
+
+	AdjustWindowRectEx(&window_rect, dw_style, FALSE, dw_ex_style);
+
+	return setSizeImpl(LLCoordScreen(window_rect.right - window_rect.left, window_rect.bottom - window_rect.top));
+}
+
 // changing fullscreen resolution
 BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
 {
@@ -886,12 +906,12 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 	DWORD	current_refresh;
 	DWORD	dw_ex_style;
 	DWORD	dw_style;
-	RECT	window_rect;
+	RECT	window_rect = {0, 0, 0, 0};
 	S32 width = size.mX;
 	S32 height = size.mY;
 	BOOL auto_show = FALSE;
 
-	if (mhRC)
+	if (mhRC)	
 	{
 		auto_show = TRUE;
 		resetDisplayResolution();
@@ -986,7 +1006,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 			dw_ex_style = WS_EX_APPWINDOW;
 			dw_style = WS_POPUP;
 
-			// Move window borders out not to cover window contents
+			// Move window borders out not to cover window contents.
+			// This converts client rect to window rect, i.e. expands it by the window border size.
 			AdjustWindowRectEx(&window_rect, dw_style, FALSE, dw_ex_style);
 		}
 		// If it failed, we don't want to run fullscreen
@@ -1014,6 +1035,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 		dw_style = WS_OVERLAPPEDWINDOW;
 	}
 
+
 	// don't post quit messages when destroying old windows
 	mPostQuit = FALSE;
 
@@ -1065,6 +1087,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 		return FALSE;
 	}
 
+	LL_INFOS("Window") << "Device context retrieved." << llendl ;
+
 	if (!(pixel_format = ChoosePixelFormat(mhDC, &pfd)))
 	{
 		close();
@@ -1073,6 +1097,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 		return FALSE;
 	}
 
+	LL_INFOS("Window") << "Pixel format chosen." << llendl ;
+
 	// Verify what pixel format we actually received.
 	if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR),
 		&pfd))
@@ -1541,24 +1567,16 @@ void LLWindowWin32::moveWindow( const LLCoordScreen& position, const LLCoordScre
 
 BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position)
 {
-	LLCoordScreen screen_pos;
-
 	mMousePositionModified = TRUE;
 	if (!mWindowHandle)
 	{
 		return FALSE;
 	}
 
-	if (!convertCoords(position, &screen_pos))
-	{
-		return FALSE;
-	}
 
 	// Inform the application of the new mouse position (needed for per-frame
 	// hover/picking to function).
-	LLCoordGL gl_pos;
-	convertCoords(position, &gl_pos);
-	mCallbacks->handleMouseMove(this, gl_pos, (MASK)0);
+	mCallbacks->handleMouseMove(this, position.convert(), (MASK)0);
 	
 	// DEV-18951 VWR-8524 Camera moves wildly when alt-clicking.
 	// Because we have preemptively notified the application of the new
@@ -1568,24 +1586,23 @@ BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position)
 	while (PeekMessage(&msg, NULL, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE))
 	{ }
 
-	return SetCursorPos(screen_pos.mX, screen_pos.mY);
+	LLCoordScreen screen_pos(position.convert());
+	return ::SetCursorPos(screen_pos.mX, screen_pos.mY);
 }
 
 BOOL LLWindowWin32::getCursorPosition(LLCoordWindow *position)
 {
 	POINT cursor_point;
-	LLCoordScreen screen_pos;
 
-	if (!mWindowHandle ||
-		!GetCursorPos(&cursor_point))
+	if (!mWindowHandle 
+		|| !GetCursorPos(&cursor_point)
+		|| !position)
 	{
 		return FALSE;
 	}
 
-	screen_pos.mX = cursor_point.x;
-	screen_pos.mY = cursor_point.y;
-
-	return convertCoords(screen_pos, position);
+	*position = LLCoordScreen(cursor_point.x, cursor_point.y).convert();
+	return TRUE;
 }
 
 void LLWindowWin32::hideCursor()
@@ -1803,6 +1820,10 @@ static LLFastTimer::DeclareTimer FTM_MOUSEHANDLER("Handle Mouse");
 
 LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_param, LPARAM l_param)
 {
+	// Ignore clicks not originated in the client area, i.e. mouse-up events not preceded with a WM_LBUTTONDOWN.
+	// This helps prevent avatar walking after maximizing the window by double-clicking the title bar.
+	static bool sHandleLeftMouseUp = true;
+
 	LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(h_wnd, GWL_USERDATA);
 
 
@@ -2149,10 +2170,20 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 			window_imp->handleUnicodeUTF16((U16)w_param, gKeyboard->currentMask(FALSE));
 			return 0;
 
+		case WM_NCLBUTTONDOWN:
+			{
+				window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_NCLBUTTONDOWN");
+				// A click in a non-client area, e.g. title bar or window border.
+				sHandleLeftMouseUp = false;
+			}
+			break;
+
 		case WM_LBUTTONDOWN:
 			{
 				window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONDOWN");
 				LLFastTimer t2(FTM_MOUSEHANDLER);
+				sHandleLeftMouseUp = true;
+
 				if (LLWinImm::isAvailable() && window_imp->mPreeditor)
 				{
 					window_imp->interruptLanguageTextInput();
@@ -2163,15 +2194,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2193,15 +2224,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2217,6 +2248,13 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 			{
 				window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONUP");
 				LLFastTimer t2(FTM_MOUSEHANDLER);
+
+				if (!sHandleLeftMouseUp)
+				{
+					sHandleLeftMouseUp = true;
+					break;
+				}
+
 				//if (gDebugClicks)
 				//{
 				//	LL_INFOS("Window") << "WndProc left button up" << LL_ENDL;
@@ -2226,15 +2264,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2261,15 +2299,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2290,15 +2328,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2325,15 +2363,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2354,15 +2392,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
 				// will occur at the wrong location.  JC
-				LLCoordWindow cursor_coord_window;
 				if (window_imp->mMousePositionModified)
 				{
+					LLCoordWindow cursor_coord_window;
 					window_imp->getCursorPosition(&cursor_coord_window);
-					window_imp->convertCoords(cursor_coord_window, &gl_coord);
+					gl_coord = cursor_coord_window.convert();
 				}
 				else
 				{
-					window_imp->convertCoords(window_coord, &gl_coord);
+					gl_coord = window_coord.convert();
 				}
 				MASK mask = gKeyboard->currentMask(TRUE);
 				// generate move event to update mouse coordinates
@@ -2434,9 +2472,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 		case WM_MOUSEMOVE:
 			{
 				window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEMOVE");
-				window_imp->convertCoords(window_coord, &gl_coord);
 				MASK mask = gKeyboard->currentMask(TRUE);
-				window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask);
+				window_imp->mCallbacks->handleMouseMove(window_imp, window_coord.convert(), mask);
 				return 0;
 			}
 
@@ -3324,7 +3361,7 @@ void LLWindowWin32::setLanguageTextInput( const LLCoordGL & position )
 
 			LLWinImm::setCompositionWindow( himc, &ime_form );
 
-			sWinIMEWindowPosition.set( win_pos.mX, win_pos.mY );
+			sWinIMEWindowPosition = win_pos;
 		}
 
 		LLWinImm::releaseContext(mWindowHandle, himc);
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index b3602be8b7bad98b920b32c645a23ec345fad3aa..54c9ac4d4d182fd52349e67caeaf56fa92999b5c 100644
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -58,6 +58,7 @@ class LLWindowWin32 : public LLWindow
 	/*virtual*/ BOOL getSize(LLCoordWindow *size);
 	/*virtual*/ BOOL setPosition(LLCoordScreen position);
 	/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
+	/*virtual*/ BOOL setSizeImpl(LLCoordWindow size);
 	/*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL);
 	/*virtual*/ BOOL setCursorPosition(LLCoordWindow position);
 	/*virtual*/ BOOL getCursorPosition(LLCoordWindow *position);
diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h
index bf38a8b062dbcddacdf34e3faa751abe0ecf3960..597031ec707a6dd09b8db07be710685f16d8a330 100644
--- a/indra/llxml/llcontrol.h
+++ b/indra/llxml/llcontrol.h
@@ -92,6 +92,8 @@ typedef enum e_control_type
 
 class LLControlVariable : public LLRefCount
 {
+	LOG_CLASS(LLControlVariable);
+
 	friend class LLControlGroup;
 	
 public:
@@ -180,6 +182,8 @@ T convert_from_llsd(const LLSD& sd, eControlType type, const std::string& contro
 //const U32 STRING_CACHE_SIZE = 10000;
 class LLControlGroup : public LLInstanceTracker<LLControlGroup, std::string>
 {
+	LOG_CLASS(LLControlGroup);
+
 protected:
 	typedef std::map<std::string, LLControlVariablePtr > ctrl_name_table_t;
 	ctrl_name_table_t mNameTable;
diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp
index 2b4a0fc2a1eab6431fd10e936fb327b9ec2d8285..2ffb0d8503cd662c106704c3f53d781a7ee55261 100644
--- a/indra/llxml/llxmlnode.cpp
+++ b/indra/llxml/llxmlnode.cpp
@@ -631,13 +631,14 @@ bool LLXMLNode::updateNode(
 	}
 
 	//update all of node's children with updateNodes children that match name
-	LLXMLNodePtr child;
+	LLXMLNodePtr child = node->getFirstChild();
+	LLXMLNodePtr last_child = child;
 	LLXMLNodePtr updateChild;
 	
 	for (updateChild = update_node->getFirstChild(); updateChild.notNull(); 
 		 updateChild = updateChild->getNextSibling())
 	{
-		for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
+		while(child.notNull())
 		{
 			std::string nodeName;
 			std::string updateName;
@@ -656,6 +657,22 @@ bool LLXMLNode::updateNode(
 			if ((nodeName != "") && (updateName == nodeName))
 			{
 				updateNode(child, updateChild);
+				last_child = child;
+				child = child->getNextSibling();
+				if (child.isNull())
+				{
+					child = node->getFirstChild();
+				}
+				break;
+			}
+			
+			child = child->getNextSibling();
+			if (child.isNull())
+			{
+				child = node->getFirstChild();
+			}
+			if (child == last_child)
+			{
 				break;
 			}
 		}
@@ -784,7 +801,7 @@ bool LLXMLNode::parseStream(
 	while(str.good())
 	{
 		str.read((char*)buffer, BUFSIZE);
-		int count = str.gcount();
+		int count = (int)str.gcount();
 		
 		if (XML_Parse(my_parser, (const char *)buffer, count, !str.good()) != XML_STATUS_OK)
 		{
@@ -882,11 +899,8 @@ bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root,
 
 	for (itor = paths.begin(), ++itor; itor != paths.end(); ++itor)
 	{
-		std::string nodeName;
-		std::string updateName;
-
 		std::string layer_filename = *itor;
-		if(layer_filename.empty())
+		if(layer_filename.empty() || layer_filename == filename)
 		{
 			// no localized version of this file, that's ok, keep looking
 			continue;
@@ -898,6 +912,9 @@ bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root,
 			return false;
 		}
 
+		std::string nodeName;
+		std::string updateName;
+
 		updateRoot->getAttributeString("name", updateName);
 		root->getAttributeString("name", nodeName);
 
diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h
index ab209577609b8efb728efd8c8cb7f2df5d0ba592..4ab1d891a366b168e52a52ef91985c8029c813e6 100644
--- a/indra/llxuixml/llinitparam.h
+++ b/indra/llxuixml/llinitparam.h
@@ -1253,15 +1253,16 @@ namespace LLInitParam
 			return mValues.back();
 		}
 
-		void add(const value_t& item)
+		self_t& add(const value_t& item)
 		{
 			param_value_t param_value;
 			param_value.setValue(item);
 			mValues.push_back(param_value);
 			setProvided();
+			return *this;
 		}
 
-		void add(const typename name_value_lookup_t::name_t& name)
+		self_t& add(const typename name_value_lookup_t::name_t& name)
 		{
 			value_t value;
 
@@ -1271,6 +1272,8 @@ namespace LLInitParam
 				add(value);
 				mValues.back().setValueName(name);
 			}
+
+			return *this;
 		}
 
 		// implicit conversion
@@ -1441,13 +1444,14 @@ namespace LLInitParam
 			return mValues.back();
 		}
 
-		void add(const value_t& item)
+		self_t& add(const value_t& item)
 		{
 			mValues.push_back(item);
 			setProvided();
+			return *this;
 		}
 
-		void add(const typename name_value_lookup_t::name_t& name)
+		self_t& add(const typename name_value_lookup_t::name_t& name)
 		{
 			value_t value;
 
@@ -1457,6 +1461,7 @@ namespace LLInitParam
 				add(value);
 				mValues.back().setValueName(name);
 			}
+			return *this;
 		}
 
 		// implicit conversion
diff --git a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp
index 999f754dcf8e3b54d560c13607188e12b665ec45..24328202cb11c30cb64a52e906593e801e3aa74d 100644
--- a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp
+++ b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp
@@ -705,7 +705,7 @@ class MediaPluginQuickTime : public MediaPluginBase
 		// look up "Display Name" in meta data
 		OSType meta_data_key = kQTMetaDataCommonKeyDisplayName;
 		QTMetaDataItem item = kQTMetaDataItemUninitialized;
-		result = QTMetaDataGetNextItem( media_data_ref, kQTMetaDataStorageFormatWildcard, 
+		result = (OSErr)QTMetaDataGetNextItem( media_data_ref, kQTMetaDataStorageFormatWildcard, 
 										0, kQTMetaDataKeyFormatCommon, 
 										(const UInt8 *)&meta_data_key, 
 										sizeof( meta_data_key ), &item );
@@ -714,14 +714,14 @@ class MediaPluginQuickTime : public MediaPluginBase
 
 		// find the size of the title
 		ByteCount size;
-		result = QTMetaDataGetItemValue( media_data_ref, item, NULL, 0, &size );
+		result = (OSErr)QTMetaDataGetItemValue( media_data_ref, item, NULL, 0, &size );
 		if ( noErr != result || size <= 0 /*|| size > 1024  FIXME: arbitrary limit */ ) 
 			return false;
 
 		// allocate some space and grab it
 		UInt8* item_data = new UInt8[ size + 1 ];
 		memset( item_data, 0, ( size + 1 ) * sizeof( UInt8 ) );
-		result = QTMetaDataGetItemValue( media_data_ref, item, item_data, size, NULL );
+		result = (OSErr)QTMetaDataGetItemValue( media_data_ref, item, item_data, size, NULL );
 		if ( noErr != result ) 
 		{
 			delete [] item_data;
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp
index 47f8dcd545926233cc0238315cfe4d4dc2966bf9..1812abd7d54656c5784864b958ae4374837c7fef 100644
--- a/indra/media_plugins/webkit/media_plugin_webkit.cpp
+++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp
@@ -991,7 +991,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 		{
 			if(message_name == "set_volume")
 			{
-				F32 volume = message_in.getValueReal("volume");
+				F32 volume = (F32)message_in.getValueReal("volume");
 				setVolume(volume);
 			}
 		}
@@ -1057,9 +1057,9 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 				S32 height = message_in.getValueS32("height");
 				S32 texture_width = message_in.getValueS32("texture_width");
 				S32 texture_height = message_in.getValueS32("texture_height");
-				mBackgroundR = message_in.getValueReal("background_r");
-				mBackgroundG = message_in.getValueReal("background_g");
-				mBackgroundB = message_in.getValueReal("background_b");
+				mBackgroundR = (F32)message_in.getValueReal("background_r");
+				mBackgroundG = (F32)message_in.getValueReal("background_g");
+				mBackgroundB = (F32)message_in.getValueReal("background_b");
 //				mBackgroundA = message_in.setValueReal("background_a");		// Ignore any alpha
 								
 				if(!name.empty())
@@ -1245,9 +1245,9 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 			if(message_name == "js_agent_location")
 			{
 #if LLQTWEBKIT_API_VERSION >= 9
-				F32 x = message_in.getValueReal("x");
-				F32 y = message_in.getValueReal("y");
-				F32 z = message_in.getValueReal("z");
+				F32 x = (F32)message_in.getValueReal("x");
+				F32 y = (F32)message_in.getValueReal("y");
+				F32 z = (F32)message_in.getValueReal("z");
 				LLQtWebKit::getInstance()->setAgentLocation( x, y, z );
 				LLQtWebKit::getInstance()->emitLocation();
 #endif
@@ -1256,9 +1256,9 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 			if(message_name == "js_agent_global_location")
 			{
 #if LLQTWEBKIT_API_VERSION >= 9
-				F32 x = message_in.getValueReal("x");
-				F32 y = message_in.getValueReal("y");
-				F32 z = message_in.getValueReal("z");
+				F32 x = (F32)message_in.getValueReal("x");
+				F32 y = (F32)message_in.getValueReal("y");
+				F32 z = (F32)message_in.getValueReal("z");
 				LLQtWebKit::getInstance()->setAgentGlobalLocation( x, y, z );
 				LLQtWebKit::getInstance()->emitLocation();
 #endif
@@ -1267,7 +1267,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 			if(message_name == "js_agent_orientation")
 			{
 #if LLQTWEBKIT_API_VERSION >= 9
-				F32 angle = message_in.getValueReal("angle");
+				F32 angle = (F32)message_in.getValueReal("angle");
 				LLQtWebKit::getInstance()->setAgentOrientation( angle );
 				LLQtWebKit::getInstance()->emitLocation();
 #endif
@@ -1323,7 +1323,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 			else if(message_name == "set_page_zoom_factor")
 			{
 #if LLQTWEBKIT_API_VERSION >= 15
-				F32 factor = message_in.getValueReal("factor");
+				F32 factor = (F32)message_in.getValueReal("factor");
 				LLQtWebKit::getInstance()->setPageZoomFactor(factor);
 #else
 				llwarns << "Ignoring setPageZoomFactor message (llqtwebkit version is too old)." << llendl;
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index f85b943c70d4db08b59eea83bcd05d7ed4ae1604..0593475c54640ec12c5e237558e66b0cfb4bedb6 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -41,6 +41,7 @@ include(UnixInstall)
 include(LLKDU)
 include(ViewerMiscLibs)
 include(LLLogin)
+include(VisualLeakDetector)
 include(GLOD)
 include(CMakeCopyIfDifferent)
 
@@ -287,7 +288,6 @@ set(viewer_SOURCE_FILES
     llinspectremoteobject.cpp
     llinspecttoast.cpp
     llinventorybridge.cpp
-    llinventoryclipboard.cpp
     llinventoryfilter.cpp
     llinventoryfunctions.cpp
     llinventoryicon.cpp
@@ -842,7 +842,6 @@ set(viewer_HEADER_FILES
     llinspectremoteobject.h
     llinspecttoast.h
     llinventorybridge.h
-    llinventoryclipboard.h
     llinventoryfilter.h
     llinventoryfunctions.h
     llinventoryicon.h
@@ -1345,7 +1344,9 @@ if (WINDOWS)
         DXGUID_LIBRARY
         )
 
+# see EXP-1765 - theory is opengl32.lib needs to be included before gdi32.lib (windows libs)
     set(viewer_LIBRARIES
+        opengl32
         ${WINDOWS_LIBRARIES}
         comdlg32
         ${DINPUT_LIBRARY}
@@ -1355,7 +1356,6 @@ if (WINDOWS)
         odbccp32
         ole32
         oleaut32
-        opengl32
         shell32
         Vfw32
         winspool
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 0e26013152c2fd6194ada44207836c708dd6b080..15da381e2f4042f96a451e523c1b430838884aae 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -621,6 +621,28 @@
       <key>Value</key>
       <string>http://lecs-viewer-web-components.s3.amazonaws.com/v3.0/[GRID_LOWERCASE]/avatars.html</string>
     </map>
+    <key>AvatarRotateThresholdSlow</key>
+    <map>
+      <key>Comment</key>
+      <string>Angle between avatar facing and camera facing at which avatar turns to face same direction as camera, when moving slowly (degrees)</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>F32</string>
+      <key>Value</key>
+      <integer>60</integer>
+    </map>  
+    <key>AvatarRotateThresholdFast</key>
+    <map>
+      <key>Comment</key>
+      <string>Angle between avatar facing and camera facing at which avatar turns to face same direction as camera, when moving fast (degrees)</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>F32</string>
+      <key>Value</key>
+      <integer>2</integer>
+    </map>  
     <key>AvatarBakedTextureUploadTimeout</key>
     <map>
       <key>Comment</key>
@@ -9608,18 +9630,29 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>ShowConsoleWindow</key>
-    <map>
-      <key>Comment</key>
-      <string>Show log in separate OS window</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
-    <key>NavBarShowCoordinates</key>
+  <key>ShowConsoleWindow</key>
+  <map>
+    <key>Comment</key>
+    <string>Show log in separate OS window</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>Boolean</string>
+    <key>Value</key>
+    <integer>0</integer>
+  </map>
+  <key>EnableVisualLeakDetector</key>
+  <map>
+    <key>Comment</key>
+    <string>EnableVisualLeakDetector</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>Boolean</string>
+    <key>Value</key>
+    <integer>0</integer>
+  </map>
+  <key>NavBarShowCoordinates</key>
     <map>
       <key>Comment</key>
       <string>Show coordinates in navigation bar</string>
@@ -12755,7 +12788,7 @@
     <key>WindowX</key>
     <map>
       <key>Comment</key>
-      <string>X coordinate of lower left corner of SL viewer window, relative to primary display (pixels)</string>
+      <string>X coordinate of upper left corner of SL viewer window, relative to upper left corner of primary display (pixels)</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
@@ -12766,7 +12799,7 @@
     <key>WindowY</key>
     <map>
       <key>Comment</key>
-      <string>Y coordinate of lower left corner of SL viewer window, relative to primary display (pixels)</string>
+      <string>Y coordinate of upper left corner of SL viewer window, relative to upper left corner of primary display (pixels)</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index 8cdd8ed838084dce4e1ff7a53f6fe2fa945d5d3b..143126b3345307e4d16083378d5ee539da0637d1 100644
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -33,6 +33,28 @@
         <key>Value</key>
             <string />
         </map>
+    <key>InventoryInboxHeight</key>
+    <map>
+        <key>Comment</key>
+            <string>Inventory inbox panel height in Inventory floater.</string>
+        <key>Persist</key>
+            <integer>1</integer>
+        <key>Type</key>
+            <string>S32</string>
+        <key>Value</key>
+            <integer>200</integer>
+    </map>
+    <key>InventoryInboxToggleState</key>
+    <map>
+        <key>Comment</key>
+            <string>Stores the open/closed state of inventory Received Items panel.</string>
+        <key>Persist</key>
+            <integer>1</integer>
+        <key>Type</key>
+            <string>Boolean</string>
+        <key>Value</key>
+            <integer>0</integer>
+    </map>
     <key>DisplayDestinationsOnInitialRun</key>
         <map>
         <key>Comment</key>
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 09305a5b4d2685f298652fc5ed7f3aa35983dcea..dd02a74a381f764d8ba787c04b2ae311186b3b7c 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -817,7 +817,10 @@ void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
 	if (wearable)
 	{
 		mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
+		if (isAgentAvatarValid())
+		{
 		gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
+		}
 		wearable->setLabelUpdated();
 	}
 }
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index 647ace7ee32281bc20912f31800b04ce41f9429c..bad60a9757af3e116170e330d8d1891f136b4d80 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -26,11 +26,16 @@
 
 #include "llviewerprecompiledheaders.h"
 
+#ifdef INCLUDE_VLD
+#include "vld.h"
+#endif
+
 #include "llappviewerwin32.h"
 
 #include "llmemtype.h"
 
-#include "llwindowwin32.cpp" // *FIX: for setting gIconResource.
+#include "llwindowwin32.h" // *FIX: for setting gIconResource.
+#include "llgl.h"
 #include "res/resource.h" // *FIX: for setting gIconResource.
 
 #include <fcntl.h>		//_O_APPEND
@@ -104,6 +109,14 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
                      LPSTR     lpCmdLine,
                      int       nCmdShow)
 {
+#ifdef INCLUDE_VLD
+	// only works for debug builds (hard coded into vld.h)
+	#ifdef _DEBUG
+		// start with Visual Leak Detector turned off
+		VLDGlobalDisable();
+	#endif // _DEBUG
+#endif // INCLUDE_VLD
+
 	LLMemType mt1(LLMemType::MTYPE_STARTUP);
 
 	const S32 MAX_HEAPS = 255;
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 9a7cdcfa21ba9dd3f41a313305991f9ec41e6294..f618af953674af2eba56b6552bd2c5ac6517aa25 100755
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -738,6 +738,11 @@ void LLAvatarActions::shareWithAvatars()
 
 	LLFloaterAvatarPicker* picker =
 		LLFloaterAvatarPicker::show(boost::bind(give_inventory, _1, _2), TRUE, FALSE);
+	if (!picker)
+	{
+		return;
+	}
+
 	picker->setOkBtnEnableCb(boost::bind(is_give_inventory_acceptable));
 	picker->openFriendsTab();
 	LLNotificationsUtil::add("ShareNotification");
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index e3217668c540eda7e0895051f03f533cdb5e8bae..f2375bfa4f7630c34faedf88a62bb1eb55014fd3 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -188,7 +188,7 @@ void LLCallFloater::draw()
 
 	// Need to resort the participant list if it's in sort by recent speaker order.
 	if (mParticipants)
-		mParticipants->updateRecentSpeakersOrder();
+		mParticipants->update();
 
 	LLFloater::draw();
 }
@@ -333,6 +333,7 @@ void LLCallFloater::refreshParticipantList()
 
 	if (!non_avatar_caller)
 	{
+		llassert(mParticipants == NULL); // check for possible memory leak
 		mParticipants = new LLParticipantList(mSpeakerManager, mAvatarList, true, mVoiceType != VC_GROUP_CHAT && mVoiceType != VC_AD_HOC_CHAT, false);
 		mParticipants->setValidateSpeakerCallback(boost::bind(&LLCallFloater::validateSpeaker, this, _1));
 		const U32 speaker_sort_order = gSavedSettings.getU32("SpeakerParticipantDefaultOrder");
diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp
index 2abfbf37ca9c3e347cfdd792b52902ac33d6c403..935dcb74b0f8370c8df57fb3c0db77862f5ddb76 100644
--- a/indra/newview/llexpandabletextbox.cpp
+++ b/indra/newview/llexpandabletextbox.cpp
@@ -55,7 +55,7 @@ class LLExpanderSegment : public LLTextSegment
 		else
 		{
 			width = mEditor.getDocumentView()->getRect().getWidth() - mEditor.getHPad(); 
-			height = llceil(mStyle->getFont()->getLineHeight());
+			height = mStyle->getFont()->getLineHeight();
 		}
 		return true;
 	}
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index 233038daba3664c74fa5749c18311927609c1073..9664aa7dbe2e5026cf17a6ff171fe1452397445e 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -149,7 +149,7 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask)
 
 LLFastTimer::NamedTimer* LLFastTimerView::getLegendID(S32 y)
 {
-	S32 idx = (getRect().getHeight() - y) / ((S32) LLFontGL::getFontMonospace()->getLineHeight()+2) - 5;
+	S32 idx = (getRect().getHeight() - y) / (LLFontGL::getFontMonospace()->getLineHeight()+2) - 5;
 
 	if (idx >= 0 && idx < (S32)ft_display_idx.size())
 	{
@@ -552,7 +552,7 @@ void LLFastTimerView::draw()
 	// update rectangle that includes timer bars
 	mBarRect.mLeft = xleft;
 	mBarRect.mRight = getRect().getWidth();
-	mBarRect.mTop = ytop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4);
+	mBarRect.mTop = ytop - (LLFontGL::getFontMonospace()->getLineHeight() + 4);
 	mBarRect.mBottom = margin + LINE_GRAPH_HEIGHT;
 
 	y = ytop;
@@ -846,7 +846,7 @@ void LLFastTimerView::draw()
 				tdesc = llformat("%4.2f ms", ms);
 							
 			x = mGraphRect.mRight - LLFontGL::getFontMonospace()->getWidth(tdesc)-5;
-			y = mGraphRect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight());
+			y = mGraphRect.mTop - LLFontGL::getFontMonospace()->getLineHeight();
  
 			LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white,
 										 LLFontGL::LEFT, LLFontGL::TOP);
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index f4b6dc2c816190673274924519e8705ef46afaf0..575b613ccfcce44e41e09484073f2a19f2ffce0f 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -39,7 +39,7 @@
 
 #include "llagent.h"
 #include "llclipboard.h"
-#include "llinventoryclipboard.h"
+#include "llclipboard.h"
 #include "llinventorybridge.h"
 #include "llinventoryfunctions.h"
 #include "llfloatersidepanelcontainer.h"
@@ -1118,7 +1118,7 @@ BOOL LLFavoritesBarCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
 }
 void copy_slurl_to_clipboard_cb(std::string& slurl)
 {
-	gClipboard.copyFromString(utf8str_to_wstring(slurl));
+	LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl),0,slurl.size());
 
 	LLSD args;
 	args["SLURL"] = slurl;
@@ -1187,7 +1187,7 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata)
 	}
 	else if (action == "copy")
 	{
-		LLInventoryClipboard::instance().store(mSelectedItemID);
+		LLClipboard::instance().copyToClipboard(mSelectedItemID, LLAssetType::AT_LANDMARK);
 	}
 	else if (action == "paste")
 	{
@@ -1211,13 +1211,13 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata)
 
 BOOL LLFavoritesBarCtrl::isClipboardPasteable() const
 {
-	if (!LLInventoryClipboard::instance().hasContents())
+	if (!LLClipboard::instance().hasContents())
 	{
 		return FALSE;
 	}
 
 	LLDynamicArray<LLUUID> objects;
-	LLInventoryClipboard::instance().retrieve(objects);
+	LLClipboard::instance().pasteFromClipboard(objects);
 	S32 count = objects.count();
 	for(S32 i = 0; i < count; i++)
 	{
@@ -1246,7 +1246,7 @@ void LLFavoritesBarCtrl::pastFromClipboard() const
 	{
 		LLInventoryItem* item = NULL;
 		LLDynamicArray<LLUUID> objects;
-		LLInventoryClipboard::instance().retrieve(objects);
+		LLClipboard::instance().pasteFromClipboard(objects);
 		S32 count = objects.count();
 		LLUUID parent_id(mFavoriteFolderId);
 		for(S32 i = 0; i < count; i++)
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp
index 8024755e8665e934953c345f99614b85fb954d52..360e35f6d3dbb498e47501a972e69c03ce93fb59 100644
--- a/indra/newview/llfilepicker.cpp
+++ b/indra/newview/llfilepicker.cpp
@@ -1073,8 +1073,11 @@ void LLFilePicker::chooser_responder(GtkWidget *widget, gint response, gpointer
 	}
 
 	// set the default path for this usage context.
-	picker->mContextToPathMap[picker->mCurContextName] =
-		gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(widget));
+	const char* cur_folder = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(widget));
+	if (cur_folder != NULL)
+	{
+		picker->mContextToPathMap[picker->mCurContextName] = cur_folder;
+	}
 
 	gtk_widget_destroy(widget);
 	gtk_main_quit();
diff --git a/indra/newview/llfloateranimpreview.h b/indra/newview/llfloateranimpreview.h
index f1ffb6547f2aabd3e1bf610013a1eaaa7c5b4a51..b7854c56973fcbe11a76cb6f738de746a85971f6 100644
--- a/indra/newview/llfloateranimpreview.h
+++ b/indra/newview/llfloateranimpreview.h
@@ -32,6 +32,7 @@
 #include "lldynamictexture.h"
 #include "llcharacter.h"
 #include "llquaternion.h"
+#include "llextendedstatus.h"
 
 class LLVOAvatar;
 class LLViewerJointMesh;
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp
index aa66fcf9b8d0edaa9c893d65159f677c2a40bd3d..0290e7cdf080b6e5b9df5c1203f03f9b1d49f71d 100644
--- a/indra/newview/llfloateravatarpicker.cpp
+++ b/indra/newview/llfloateravatarpicker.cpp
@@ -63,6 +63,11 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback,
 	// *TODO: Use a key to allow this not to be an effective singleton
 	LLFloaterAvatarPicker* floater = 
 		LLFloaterReg::showTypedInstance<LLFloaterAvatarPicker>("avatar_picker");
+	if (!floater)
+	{
+		llwarns << "Cannot instantiate avatar picker" << llendl;
+		return NULL;
+	}
 	
 	floater->mSelectionCallback = callback;
 	floater->setAllowMultiple(allow_multiple);
diff --git a/indra/newview/llfloaterbuildoptions.cpp b/indra/newview/llfloaterbuildoptions.cpp
index 86c1bf0534ed1b4eabe37a0c5cc8accf95a81d9d..1b65d8d68384956703570225742e62a38a955437 100644
--- a/indra/newview/llfloaterbuildoptions.cpp
+++ b/indra/newview/llfloaterbuildoptions.cpp
@@ -41,13 +41,9 @@
 // Methods
 //
 
-void commit_grid_mode(LLUICtrl *);
-
 LLFloaterBuildOptions::LLFloaterBuildOptions(const LLSD& key)
-  : LLFloater(key),
-    mComboGridMode(NULL)
+  : LLFloater(key)
 {
-	mCommitCallbackRegistrar.add("GridOptions.gridMode", boost::bind(&commit_grid_mode,_1));
 }
 
 LLFloaterBuildOptions::~LLFloaterBuildOptions()
@@ -55,45 +51,9 @@ LLFloaterBuildOptions::~LLFloaterBuildOptions()
 
 BOOL LLFloaterBuildOptions::postBuild()
 {
-	mComboGridMode = getChild<LLComboBox>("combobox grid mode");
-
 	return TRUE;
 }
 
-void LLFloaterBuildOptions::setGridMode(EGridMode mode)
-{
-	mComboGridMode->setCurrentByIndex((S32)mode);
-}
-
-void LLFloaterBuildOptions::updateGridMode()
-{
-	if (mComboGridMode)
-	{
-		S32 index = mComboGridMode->getCurrentIndex();
-		mComboGridMode->removeall();
-
-		switch (mObjectSelection->getSelectType())
-		{
-		case SELECT_TYPE_HUD:
-		  mComboGridMode->add(getString("grid_screen_text"));
-		  mComboGridMode->add(getString("grid_local_text"));
-		  break;
-		case SELECT_TYPE_WORLD:
-		  mComboGridMode->add(getString("grid_world_text"));
-		  mComboGridMode->add(getString("grid_local_text"));
-		  mComboGridMode->add(getString("grid_reference_text"));
-		  break;
-		case SELECT_TYPE_ATTACHMENT:
-		  mComboGridMode->add(getString("grid_attachment_text"));
-		  mComboGridMode->add(getString("grid_local_text"));
-		  mComboGridMode->add(getString("grid_reference_text"));
-		  break;
-		}
-
-		mComboGridMode->setCurrentByIndex(index);
-	}
-}
-
 // virtual
 void LLFloaterBuildOptions::onOpen(const LLSD& key)
 {
@@ -105,10 +65,3 @@ void LLFloaterBuildOptions::onClose(bool app_quitting)
 {
 	mObjectSelection = NULL;
 }
-
-void commit_grid_mode(LLUICtrl *ctrl)
-{
-	LLComboBox* combo = (LLComboBox*)ctrl;
-
-	LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex());
-}
diff --git a/indra/newview/llfloaterbuildoptions.h b/indra/newview/llfloaterbuildoptions.h
index 7f3811bf1cba1f8fe9948fb189a6f37993a7c69b..02c56cb6a9253a9006350b74bdeec89b80620049 100644
--- a/indra/newview/llfloaterbuildoptions.h
+++ b/indra/newview/llfloaterbuildoptions.h
@@ -35,7 +35,6 @@
 #include "llfloater.h"
 #include "llselectmgr.h"
 
-class LLComboBox;
 class LLObjectSelection;
 
 typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle;
@@ -44,23 +43,17 @@ class LLFloaterBuildOptions
 	:	public LLFloater
 {
 public:
-
 	virtual BOOL postBuild();
 
 	/*virtual*/ void onOpen(const LLSD& key);
 	/*virtual*/	void onClose(bool app_quitting);
 
-	void setGridMode(EGridMode mode);
-	void updateGridMode();
-
 private:
-
 	friend class LLFloaterReg;
 
 	LLFloaterBuildOptions(const LLSD& key);
 	~LLFloaterBuildOptions();
 
-	LLComboBox*	mComboGridMode;
 	LLObjectSelectionHandle	mObjectSelection;
 };
 #endif
diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp
index ee8487b1605c128404772946b4f3b8d3bee4f389..087b0007e19a3a7dd2204c4b53f1ed7c0c315dd1 100644
--- a/indra/newview/llfloaterbuy.cpp
+++ b/indra/newview/llfloaterbuy.cpp
@@ -239,8 +239,9 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
 
 		// Compute icon for this item
 		BOOL item_is_multi = FALSE;
-		if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED 
+		if (( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED
 			|| inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
+			&& !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK))
 		{
 			item_is_multi = TRUE;
 		}
diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp
index a7388d21a37d2277440f25b2f331b76d9984e24f..bca4b5e447188a64526b73266771923ac3e2b194 100644
--- a/indra/newview/llfloaterbuycontents.cpp
+++ b/indra/newview/llfloaterbuycontents.cpp
@@ -210,7 +210,9 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
 		LLSD row;
 
 		BOOL item_is_multi = FALSE;
-		if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED )
+		if ((inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED
+			|| inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
+			&& !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK))
 		{
 			item_is_multi = TRUE;
 		}
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index d495f20a9a861a3a843b19b9a6c58e4fdadcd152..56051ff68458f5cbd589ae833028116bbad3be41 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -32,7 +32,7 @@
 #include "llinventorybridge.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
-#include "llinventoryclipboard.h"
+#include "llclipboard.h"
 
 #include "llagent.h"
 #include "llappearancemgr.h"
@@ -90,6 +90,12 @@ class GestureCopiedCallback : public LLInventoryCallback
 		if(mFloater)
 		{
 			mFloater->addGesture(inv_item,NULL,mFloater->getChild<LLScrollListCtrl>("gesture_list"));
+
+			// EXP-1909 (Pasted gesture displayed twice)
+			// The problem is that addGesture is called here for the second time for the same item (which is copied)
+			// First time addGesture is called from LLFloaterGestureObserver::changed(), which is a callback for inventory
+			// change. So we need to refresh the gesture list to avoid duplicates.
+			mFloater->refreshAll();
 		}
 	}
 };
@@ -391,11 +397,11 @@ bool LLFloaterGesture::isActionEnabled(const LLSD& command)
 	std::string command_name = command.asString();
 	if("paste" == command_name)
 	{
-		if(!LLInventoryClipboard::instance().hasContents())
+		if(!LLClipboard::instance().hasContents())
 			return false;
 
 		LLDynamicArray<LLUUID> ids;
-		LLInventoryClipboard::instance().retrieve(ids);
+		LLClipboard::instance().pasteFromClipboard(ids);
 		for(LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
 		{
 			LLInventoryItem* item = gInventory.getItem(*it);
@@ -490,27 +496,26 @@ void LLFloaterGesture::onActivateBtnClick()
 void LLFloaterGesture::onCopyPasteAction(const LLSD& command)
 {
 	std::string command_name  = command.asString();
-	// since we select this comman inventory item had  already arrived .
+	// Since we select this command, the inventory items must have already arrived
 	if("copy_gesture" == command_name)
 	{
 		uuid_vec_t ids;
 		getSelectedIds(ids);
-		// make sure that clopboard is empty
-		LLInventoryClipboard::instance().reset();
+		// Make sure the clipboard is empty
+		LLClipboard::instance().reset();
 		for(uuid_vec_t::iterator it = ids.begin(); it != ids.end(); it++)
 		{
 			LLInventoryItem* item = gInventory.getItem(*it);
 			if(item  && item->getInventoryType() == LLInventoryType::IT_GESTURE)
 			{
-				LLInventoryClipboard::instance().add(item->getUUID());
+				LLClipboard::instance().addToClipboard(item->getUUID(),LLAssetType::AT_GESTURE);
 			}
 		}
 	}
 	else if ("paste" == command_name)
 	{
-		LLInventoryClipboard& clipbord = LLInventoryClipboard::instance();
 		LLDynamicArray<LLUUID> ids;
-		clipbord.retrieve(ids);
+		LLClipboard::instance().pasteFromClipboard(ids);
 		if(ids.empty() || !gInventory.isCategoryComplete(mGestureFolderID))
 			return;
 		LLInventoryCategory* gesture_dir = gInventory.getCategory(mGestureFolderID);
@@ -530,11 +535,11 @@ void LLFloaterGesture::onCopyPasteAction(const LLSD& command)
 						gesture_dir->getUUID(), getString("copy_name", string_args), cb);
 			}
 		}
-		clipbord.reset();
+		LLClipboard::instance().reset();
 	}
 	else if ("copy_uuid" == command_name)
 	{
-		gClipboard.copyFromString(utf8str_to_wstring(mGestureList->getCurrentID().asString()), mGestureList->getCurrentID());
+		LLClipboard::instance().copyToClipboard(mGestureList->getCurrentID(),LLAssetType::AT_GESTURE);
 	}
 }
 
diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp
index a34e0353ec5d9cd9593a20a858a5c54894b7050c..fb905eae116cc672db3507463f7e2b651c3c5a30 100644
--- a/indra/newview/llfloatergodtools.cpp
+++ b/indra/newview/llfloatergodtools.cpp
@@ -1123,8 +1123,12 @@ bool LLPanelObjectTools::callbackSimWideDeletes( const LLSD& notification, const
 
 void LLPanelObjectTools::onClickSet()
 {
+	LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelObjectTools::callbackAvatarID, this, _1,_2));
 	// grandparent is a floater, which can have a dependent
-	gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelObjectTools::callbackAvatarID, this, _1,_2)));
+	if (picker)
+	{
+		gFloaterView->getParentFloater(this)->addDependentFloater(picker);
+	}
 }
 
 void LLPanelObjectTools::onClickSetBySelection(void* data)
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 95da8ff948bd25b016d9499e7772e0b99db617d0..ee18c95b34745f00afbb1bda96268608aa953f58 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -2739,7 +2739,12 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata)
 
 void LLPanelLandAccess::onClickAddAccess()
 {
-	gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1)) );
+	LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
+		boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1));
+	if (picker)
+	{
+		gFloaterView->getParentFloater(this)->addDependentFloater(picker);
+	}
 }
 
 void LLPanelLandAccess::callbackAvatarCBAccess(const uuid_vec_t& ids)
@@ -2783,7 +2788,12 @@ void LLPanelLandAccess::onClickRemoveAccess(void* data)
 // static
 void LLPanelLandAccess::onClickAddBanned()
 {
-	gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1)));
+	LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
+		boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1));
+	if (picker)
+	{
+		gFloaterView->getParentFloater(this)->addDependentFloater(picker);
+	}
 }
 
 // static
diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp
index 895e16adef7d17dddee08adde2f1cb9f307eabd4..4f2a6ec1b7058da7107d94c9400e6c771228e4ec 100644
--- a/indra/newview/llfloatermediasettings.cpp
+++ b/indra/newview/llfloatermediasettings.cpp
@@ -312,3 +312,9 @@ bool LLFloaterMediaSettings::haveValuesChanged() const
 	return values_changed;
 }
 
+bool LLFloaterMediaSettings::instanceExists()
+{
+	return LLFloaterReg::findTypedInstance<LLFloaterMediaSettings>("media_settings");
+}
+
+
diff --git a/indra/newview/llfloatermediasettings.h b/indra/newview/llfloatermediasettings.h
index ecc55d2cbc9975fd477fcaf920675d5c5c4deb9a..1d25530986d09f7f0ffe182d23cc82c0c0a1a64d 100644
--- a/indra/newview/llfloatermediasettings.h
+++ b/indra/newview/llfloatermediasettings.h
@@ -45,6 +45,7 @@ class LLFloaterMediaSettings :
 	/*virtual*/ void onClose(bool app_quitting);
 
 	static LLFloaterMediaSettings* getInstance();
+	static bool instanceExists();
 	static void apply();
 	static void initValues( const LLSD& media_settings , bool editable);
 	static void clearValues( bool editable);
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index a333989e7e5951319f38aa05027acc803965821e..173b0e538cab14114b54b4116b0cf97fb2e9fd87 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -741,7 +741,8 @@ void LLFloaterPreference::onClose(bool app_quitting)
 
 void LLFloaterPreference::onOpenHardwareSettings()
 {
-	LLFloaterReg::showInstance("prefs_hardware_settings");
+	LLFloater* floater = LLFloaterReg::showInstance("prefs_hardware_settings");
+	addDependentFloater(floater, FALSE);
 }
 // static 
 void LLFloaterPreference::onBtnOK()
@@ -1800,7 +1801,46 @@ void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl)
 	}
 }
 
+class LLPanelPreferencePrivacy : public LLPanelPreference
+{
+public:
+	LLPanelPreferencePrivacy()
+	{
+		mAccountIndependentSettings.push_back("VoiceCallsFriendsOnly");
+		mAccountIndependentSettings.push_back("AutoDisengageMic");
+	}
+
+	/*virtual*/ void saveSettings()
+	{
+		LLPanelPreference::saveSettings();
+
+		// Don't save (=erase from the saved values map) per-account privacy settings
+		// if we're not logged in, otherwise they will be reset to defaults on log off.
+		if (LLStartUp::getStartupState() != STATE_STARTED)
+		{
+			// Erase only common settings, assuming there are no color settings on Privacy page.
+			for (control_values_map_t::iterator it = mSavedValues.begin(); it != mSavedValues.end(); )
+			{
+				const std::string setting = it->first->getName();
+				if (std::find(mAccountIndependentSettings.begin(),
+					mAccountIndependentSettings.end(), setting) == mAccountIndependentSettings.end())
+				{
+					mSavedValues.erase(it++);
+				}
+				else
+				{
+					++it;
+				}
+			}
+		}
+	}
+
+private:
+	std::list<std::string> mAccountIndependentSettings;
+};
+
 static LLRegisterPanelClassWrapper<LLPanelPreferenceGraphics> t_pref_graph("panel_preference_graphics");
+static LLRegisterPanelClassWrapper<LLPanelPreferencePrivacy> t_pref_privacy("panel_preference_privacy");
 
 BOOL LLPanelPreferenceGraphics::postBuild()
 {
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 7ee3294478b9e6e2da634590c7a0ba76fca6eba8..ec5994e91754afa5a071a478179dac2843b8e565 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -198,15 +198,17 @@ class LLPanelPreference : public LLPanel
 	virtual void saveSettings();
 	
 	class Updater;
+
+protected:
+	typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
+	control_values_map_t mSavedValues;
+
 private:
 	//for "Only friends and groups can call or IM me"
 	static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&);
 	//for "Show my Favorite Landmarks at Login"
 	static void showFavoritesOnLoginWarning(LLUICtrl* checkbox, const LLSD& value);
 
-	typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
-	control_values_map_t mSavedValues;
-
 	typedef std::map<std::string, LLColor4> string_color_map_t;
 	string_color_map_t mSavedColors;
 
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 676059779c74df64dedfc690d02b8d4cf5a2fd95..17850ff35d382fc8550fc6dc67792bf1a87c58ee 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -650,7 +650,10 @@ void LLPanelRegionGeneralInfo::onClickKick()
 	// in order to set up floater dependency
 	LLFloater* parent_floater = gFloaterView->getParentFloater(this);
 	LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, this, _1), FALSE, TRUE);
-	parent_floater->addDependentFloater(child_floater);
+	if (child_floater)
+	{
+		parent_floater->addDependentFloater(child_floater);
+	}
 }
 
 void LLPanelRegionGeneralInfo::onKickCommit(const uuid_vec_t& ids)
@@ -1470,7 +1473,10 @@ void LLPanelEstateInfo::onClickKickUser()
 	// in order to set up floater dependency
 	LLFloater* parent_floater = gFloaterView->getParentFloater(this);
 	LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, this, _1), FALSE, TRUE);
-	parent_floater->addDependentFloater(child_floater);
+	if (child_floater)
+	{
+		parent_floater->addDependentFloater(child_floater);
+	}
 }
 
 void LLPanelEstateInfo::onKickUserCommit(const uuid_vec_t& ids)
@@ -1891,6 +1897,26 @@ void LLPanelEstateInfo::sendEstateAccessDelta(U32 flags, const LLUUID& agent_or_
 	gAgent.sendReliableMessage();
 }
 
+// static
+void LLPanelEstateInfo::updateEstateOwnerName(const std::string& name)
+{
+	LLPanelEstateInfo* panelp = LLFloaterRegionInfo::getPanelEstate();
+	if (panelp)
+	{
+		panelp->setOwnerName(name);
+	}
+}
+
+// static
+void LLPanelEstateInfo::updateEstateName(const std::string& name)
+{
+	LLPanelEstateInfo* panelp = LLFloaterRegionInfo::getPanelEstate();
+	if (panelp)
+	{
+		panelp->getChildRef<LLTextBox>("estate_name").setText(name);
+	}
+}
+
 void LLPanelEstateInfo::updateControls(LLViewerRegion* region)
 {
 	BOOL god = gAgent.isGodlike();
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index c402de66e86443ed6be7be5427c47fb7b0e8c787..e36ef4604b23d950e8b1b303eef68d586a647e5d 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -33,6 +33,7 @@
 #include "llfloater.h"
 #include "llhost.h"
 #include "llpanel.h"
+#include "llextendedstatus.h"
 
 #include "llenvmanager.h" // for LLEnvironmentSettings
 
@@ -293,6 +294,9 @@ class LLPanelEstateInfo : public LLPanelRegionInfo
 	
 	void updateControls(LLViewerRegion* region);
 	
+	static void updateEstateName(const std::string& name);
+	static void updateEstateOwnerName(const std::string& name);
+
 	virtual bool refreshFromRegion(LLViewerRegion* region);
 	virtual bool estateUpdate(LLMessageSystem* msg);
 	
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index c08848b1ea4f1fc59c652c5446692c2d4a5e2404..3ec1e372eb1bd2eae68d599bdc52f9a08763f36e 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -285,7 +285,11 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id)
 
 void LLFloaterReporter::onClickSelectAbuser()
 {
-	gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE ));
+	LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE );
+	if (picker)
+	{
+		gFloaterView->getParentFloater(this)->addDependentFloater(picker);
+	}
 }
 
 void LLFloaterReporter::callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h
index cd98f7be57312b4b2b1de51e5e46424a10e64098..7d684317103d4e747e17ee02fde1fdc8dc868085 100644
--- a/indra/newview/llfloaterreporter.h
+++ b/indra/newview/llfloaterreporter.h
@@ -31,6 +31,7 @@
 #include "llfloater.h"
 #include "lluuid.h"
 #include "v3math.h"
+#include "llextendedstatus.h"
 
 class LLAvatarName;
 class LLMessageSystem;
diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp
index 3434841d09b52d3d3e288079b86b9cc715b94b08..64c0dfa0236b7ed1fe48bc4bc01e173fb1aaa42d 100644
--- a/indra/newview/llfloatersellland.cpp
+++ b/indra/newview/llfloatersellland.cpp
@@ -392,8 +392,12 @@ void LLFloaterSellLandUI::onChangeValue(LLUICtrl *ctrl, void *userdata)
 
 void LLFloaterSellLandUI::doSelectAgent()
 {
+	LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE);
 	// grandparent is a floater, in order to set up dependency
-	addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE));
+	if (picker)
+	{
+		addDependentFloater(picker);
+	}
 }
 
 void LLFloaterSellLandUI::callbackAvatarPick(const uuid_vec_t& ids, const std::vector<LLAvatarName> names)
diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp
index be7a53491d81a8c7f86ed94d71a647efe11ce3c7..5385977d95d23071be0d24e440fe7a0abae19ba9 100644
--- a/indra/newview/llfloatersidepanelcontainer.cpp
+++ b/indra/newview/llfloatersidepanelcontainer.cpp
@@ -59,7 +59,10 @@ LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_na
 	LLView* view = findChildView(panel_name, true);
 	if (!view) return NULL;
 
-	openFloater();
+	if (!getVisible())
+	{
+		openFloater();
+	}
 
 	LLPanel* panel = NULL;
 
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index bd5b5f4eb0c38174fb2e5a10223a2045611f359f..6978e6a430c4e4b1a74dd197365d0a0d1b6564eb 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -36,6 +36,7 @@
 #include "llagentcamera.h"
 #include "llbutton.h"
 #include "llcheckboxctrl.h"
+#include "llcombobox.h"
 #include "lldraghandle.h"
 #include "llerror.h"
 #include "llfloaterbuildoptions.h"
@@ -103,6 +104,7 @@ const std::string PANEL_NAMES[LLFloaterTools::PANEL_COUNT] =
 
 
 // Local prototypes
+void commit_grid_mode(LLUICtrl *ctrl);
 void commit_select_component(void *data);
 void click_show_more(void*);
 void click_popup_info(void*);
@@ -252,6 +254,7 @@ BOOL	LLFloaterTools::postBuild()
 	getChild<LLUICtrl>("checkbox uniform")->setValue((BOOL)gSavedSettings.getBOOL("ScaleUniform"));
 	mCheckStretchTexture	= getChild<LLCheckBoxCtrl>("checkbox stretch textures");
 	getChild<LLUICtrl>("checkbox stretch textures")->setValue((BOOL)gSavedSettings.getBOOL("ScaleStretchTextures"));
+	mComboGridMode			= getChild<LLComboBox>("combobox grid mode");
 	mCheckStretchUniformLabel = getChild<LLTextBox>("checkbox uniform label");
 
 	//
@@ -330,6 +333,7 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)
 	mCheckSnapToGrid(NULL),
 	mBtnGridOptions(NULL),
 	mTitleMedia(NULL),
+	mComboGridMode(NULL),
 	mCheckStretchUniform(NULL),
 	mCheckStretchTexture(NULL),
 	mCheckStretchUniformLabel(NULL),
@@ -386,6 +390,7 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)
 	mCommitCallbackRegistrar.add("BuildTool.commitRadioMove",	boost::bind(&commit_radio_group_move,_1));
 	mCommitCallbackRegistrar.add("BuildTool.commitRadioEdit",	boost::bind(&commit_radio_group_edit,_1));
 
+	mCommitCallbackRegistrar.add("BuildTool.gridMode",			boost::bind(&commit_grid_mode,_1));
 	mCommitCallbackRegistrar.add("BuildTool.selectComponent",	boost::bind(&commit_select_component, this));
 	mCommitCallbackRegistrar.add("BuildTool.gridOptions",		boost::bind(&LLFloaterTools::onClickGridOptions,this));
 	mCommitCallbackRegistrar.add("BuildTool.applyToSelection",	boost::bind(&click_apply_to_selection, this));
@@ -687,6 +692,33 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
 		mRadioGroupEdit->setValue("radio select face");
 	}
 
+	if (mComboGridMode) 
+	{
+		mComboGridMode->setVisible( edit_visible );
+		S32 index = mComboGridMode->getCurrentIndex();
+		mComboGridMode->removeall();
+
+		switch (mObjectSelection->getSelectType())
+		{
+			case SELECT_TYPE_HUD:
+				mComboGridMode->add(getString("grid_screen_text"));
+				mComboGridMode->add(getString("grid_local_text"));
+				break;
+			case SELECT_TYPE_WORLD:
+				mComboGridMode->add(getString("grid_world_text"));
+				mComboGridMode->add(getString("grid_local_text"));
+				mComboGridMode->add(getString("grid_reference_text"));
+				break;
+			case SELECT_TYPE_ATTACHMENT:
+				mComboGridMode->add(getString("grid_attachment_text"));
+				mComboGridMode->add(getString("grid_local_text"));
+				mComboGridMode->add(getString("grid_reference_text"));
+				break;
+		}
+
+		mComboGridMode->setCurrentByIndex(index);
+	}
+
 	// Snap to grid disabled for grab tool - very confusing
 	if (mCheckSnapToGrid) mCheckSnapToGrid->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ );
 	if (mBtnGridOptions) mBtnGridOptions->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ );
@@ -1037,6 +1069,13 @@ void LLFloaterTools::setObjectType( LLPCode pcode )
 	gFocusMgr.setMouseCapture(NULL);
 }
 
+void commit_grid_mode(LLUICtrl *ctrl)
+{
+	LLComboBox* combo = (LLComboBox*)ctrl;
+
+	LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex());
+}
+
 
 void LLFloaterTools::onClickGridOptions()
 {
@@ -1144,7 +1183,7 @@ void LLFloaterTools::updateLandImpacts()
 	childSetTextArg("remaining_capacity", "[CAPACITY_STRING]", remaining_capacity_str);
 
 	// Update land impacts info in the weights floater
-	LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::getTypedInstance<LLFloaterObjectWeights>("object_weights");
+	LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::findTypedInstance<LLFloaterObjectWeights>("object_weights");
 	if(object_weights_floater)
 	{
 		object_weights_floater->updateLandImpacts(parcel);
@@ -1234,6 +1273,7 @@ void LLFloaterTools::getMediaState()
 		}
 	} func;
 	
+	
 	// check if all faces have media(or, all dont have media)
 	LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo = selected_objects->getSelectedTEValue( &func, bool_has_media );
 	
diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h
index 63ed9dc82bacbb7408dea583f395e5cfb2cfb053..7a19d093a42f7ad5ea7f1594a640870bb92c2b0d 100644
--- a/indra/newview/llfloatertools.h
+++ b/indra/newview/llfloatertools.h
@@ -33,6 +33,7 @@
 
 class LLButton;
 class LLCheckBoxCtrl;
+class LLComboBox;
 class LLPanelPermissions;
 class LLPanelObject;
 class LLPanelVolume;
@@ -140,6 +141,7 @@ class LLFloaterTools
 
 	LLCheckBoxCtrl*	mCheckSnapToGrid;
 	LLButton*		mBtnGridOptions;
+	LLComboBox*		mComboGridMode;
 	LLCheckBoxCtrl*	mCheckStretchUniform;
 	LLCheckBoxCtrl*	mCheckStretchTexture;
 
diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp
index 428a02e9f05366e8f77eeb1c6300d0576cdf4fb6..1a17183efdd39b0f2903c626601bd5e508a20e2a 100644
--- a/indra/newview/llfloatertranslationsettings.cpp
+++ b/indra/newview/llfloatertranslationsettings.cpp
@@ -293,6 +293,6 @@ void LLFloaterTranslationSettings::onBtnOK()
 	gSavedSettings.setString("TranslationService", getSelectedService());
 	gSavedSettings.setString("BingTranslateAPIKey", getEnteredBingKey());
 	gSavedSettings.setString("GoogleTranslateAPIKey", getEnteredGoogleKey());
-	LLNearbyChatBar::getInstance()->enableTranslationCheckbox(LLTranslate::isTranslationConfigured());
+	LLNearbyChatBar::getInstance()->showTranslationCheckbox(LLTranslate::isTranslationConfigured());
 	closeFloater(false);
 }
diff --git a/indra/newview/llfloatervoiceeffect.cpp b/indra/newview/llfloatervoiceeffect.cpp
index 030fed0575deaa9508652140c417745934463da1..227720bee34975370dd10a45d2b79c79e7885327 100644
--- a/indra/newview/llfloatervoiceeffect.cpp
+++ b/indra/newview/llfloatervoiceeffect.cpp
@@ -145,7 +145,9 @@ void LLFloaterVoiceEffect::refreshEffectList()
 		for (voice_effect_list_t::const_iterator it = template_list.begin(); it != template_list.end(); ++it)
 		{
 			const LLUUID& effect_id = it->second;
-			std::string effect_name = getString("effect_" + it->first); // will throw an error if the effect is not listed in the XML
+
+			std::string localized_effect = "effect_" + it->first;
+			std::string effect_name = hasString(localized_effect) ? getString(localized_effect) : it->first;  // XML contains localized effects names
 
 			LLSD effect_properties = effect_interface->getVoiceEffectProperties(effect_id);
 
diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp
index 3b5c3663fbc772bca84ba27a47d1ad1a70ac2a31..3fe2518de67230cb185fda3cc036366796cfd5aa 100644
--- a/indra/newview/llfloaterwebcontent.cpp
+++ b/indra/newview/llfloaterwebcontent.cpp
@@ -169,7 +169,7 @@ void LLFloaterWebContent::geometryChanged(const std::string &uuid, S32 x, S32 y,
 void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height)
 {
 	// Make sure the layout of the browser control is updated, so this calculation is correct.
-	LLLayoutStack::updateClass();
+	getChild<LLLayoutStack>("stack1")->updateLayout();
 
 	// TODO: need to adjust size and constrain position to make sure floaters aren't moved outside the window view, etc.
 	LLCoordWindow window_size;
@@ -258,7 +258,7 @@ void LLFloaterWebContent::open_media(const Params& p)
 
 	if (!p.preferred_media_size().isEmpty())
 	{
-		LLLayoutStack::updateClass();
+		getChild<LLLayoutStack>("stack1")->updateLayout();
 		LLRect browser_rect = mWebBrowser->calcScreenRect();
 		LLCoordWindow window_size;
 		getWindow()->getSize(&window_size);
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index e0d7d67f7d76e3e0489e4e8d9a54b93cfe0a1191..068a6407f747a7b6f2e9d454b021a716017cb379 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -30,7 +30,7 @@
 
 #include "llcallbacklist.h"
 #include "llinventorybridge.h"
-#include "llinventoryclipboard.h" // *TODO: remove this once hack below gone.
+#include "llclipboard.h" // *TODO: remove this once hack below gone.
 #include "llinventoryfilter.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodelbackgroundfetch.h"
@@ -164,6 +164,33 @@ void LLCloseAllFoldersFunctor::doFolder(LLFolderViewFolder* folder)
 void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item)
 { }
 
+///----------------------------------------------------------------------------
+/// Class LLFolderViewScrollContainer
+///----------------------------------------------------------------------------
+
+// virtual
+const LLRect LLFolderViewScrollContainer::getScrolledViewRect() const
+{
+	LLRect rect = LLRect::null;
+	if (mScrolledView)
+	{
+		LLFolderView* folder_view = dynamic_cast<LLFolderView*>(mScrolledView);
+		if (folder_view)
+		{
+			S32 height = folder_view->mRunningHeight;
+
+			rect = mScrolledView->getRect();
+			rect.setLeftTopAndSize(rect.mLeft, rect.mTop, rect.getWidth(), height);
+		}
+	}
+
+	return rect;
+}
+
+LLFolderViewScrollContainer::LLFolderViewScrollContainer(const LLScrollContainer::Params& p)
+:	LLScrollContainer(p)
+{}
+
 ///----------------------------------------------------------------------------
 /// Class LLFolderView
 ///----------------------------------------------------------------------------
@@ -255,7 +282,7 @@ LLFolderView::LLFolderView(const Params& p)
 	LLRect new_r = LLRect(rect.mLeft + ICON_PAD,
 			      rect.mTop - TEXT_PAD,
 			      rect.mRight,
-			      rect.mTop - TEXT_PAD - llfloor(font->getLineHeight()));
+			      rect.mTop - TEXT_PAD - font->getLineHeight());
 	text_p.rect(new_r);
 	text_p.name(std::string(p.name));
 	text_p.font(font);
@@ -388,7 +415,7 @@ void LLFolderView::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse
 
 static LLFastTimer::DeclareTimer FTM_ARRANGE("Arrange");
 
-// This view grows and shinks to enclose all of its children items and folders.
+// This view grows and shrinks to enclose all of its children items and folders.
 S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_generation )
 {
 	if (getListener()->getUUID().notNull())
@@ -414,7 +441,7 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen
 		getRoot()->getFilter()->getShowFolderState();
 
 	S32 total_width = LEFT_PAD;
-	S32 running_height = mDebugFilters ? llceil(LLFontGL::getFontMonospace()->getLineHeight()) : 0;
+	S32 running_height = mDebugFilters ? LLFontGL::getFontMonospace()->getLineHeight() : 0;
 	S32 target_height = running_height;
 	S32 parent_item_height = getRect().getHeight();
 
@@ -429,8 +456,8 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen
 		}
 		else
 		{
-			folderp->setVisible(show_folder_state == LLInventoryFilter::SHOW_ALL_FOLDERS || // always show folders?
-									(folderp->getFiltered(filter_generation) || folderp->hasFilteredDescendants(filter_generation))); // passed filter or has descendants that passed filter
+			folderp->setVisible((show_folder_state == LLInventoryFilter::SHOW_ALL_FOLDERS || // always show folders?
+								 (folderp->getFiltered(filter_generation) || folderp->hasFilteredDescendants(filter_generation))));
 		}
 
 		if (folderp->getVisible())
@@ -527,15 +554,16 @@ void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent)
 		LLView::reshape(width, height, called_from_parent);
 		scroll_rect = mScrollContainer->getContentWindowRect();
 	}
-	width = llmax(mMinWidth, scroll_rect.getWidth());
+	width  = llmax(mMinWidth, scroll_rect.getWidth());
 	height = llmax(mRunningHeight, scroll_rect.getHeight());
 
-	// restrict width with scroll container's width
-	if (mUseEllipses)
+	// Restrict width within scroll container's width
+	if (mUseEllipses && mScrollContainer)
+	{
 		width = scroll_rect.getWidth();
+	}
 
 	LLView::reshape(width, height, called_from_parent);
-
 	mReshapeSignal(mSelectedItems, FALSE);
 }
 
@@ -912,7 +940,7 @@ void LLFolderView::draw()
 	}
 	else if (mShowEmptyMessage)
 	{
-		if (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() || mCompletedFilterGeneration < mFilter->getMinRequiredGeneration())
+		if (LLInventoryModelBackgroundFetch::instance().folderFetchActive() || mCompletedFilterGeneration < mFilter->getMinRequiredGeneration())
 		{
 			mStatusText = LLTrans::getString("Searching");
 		}
@@ -943,6 +971,9 @@ void LLFolderView::draw()
 			// We should call this method to also notify parent about required rect.
 			// See EXT-7564, EXT-7047.
 			arrangeFromRoot();
+			LLUI::popMatrix();
+			LLUI::pushMatrix();
+			LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom);
 		}
 	}
 
@@ -1014,6 +1045,36 @@ bool isDescendantOfASelectedItem(LLFolderViewItem* item, const std::vector<LLFol
 	return false;
 }
 
+// static
+void LLFolderView::removeCutItems()
+{
+	// There's no item in "cut" mode on the clipboard -> exit
+	if (!LLClipboard::instance().isCutMode())
+		return;
+
+	// Get the list of clipboard item uuids and iterate through them
+	LLDynamicArray<LLUUID> objects;
+	LLClipboard::instance().pasteFromClipboard(objects);
+	for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin();
+		 iter != objects.end();
+		 ++iter)
+	{
+		const LLUUID& item_id = (*iter);
+		LLInventoryObject *obj = gInventory.getObject(item_id);
+		if (obj)
+		{
+			if (LLAssetType::AT_CATEGORY == obj->getType())
+			{
+				remove_category(&gInventory, item_id);
+			}
+			else
+			{
+				remove_item(&gInventory, item_id);
+			}
+		}
+	}
+}
+
 void LLFolderView::onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response)
 {
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
@@ -1293,7 +1354,7 @@ BOOL LLFolderView::canCopy() const
 void LLFolderView::copy()
 {
 	// *NOTE: total hack to clear the inventory clipboard
-	LLInventoryClipboard::instance().reset();
+	LLClipboard::instance().reset();
 	S32 count = mSelectedItems.size();
 	if(getVisible() && getEnabled() && (count > 0))
 	{
@@ -1334,7 +1395,7 @@ BOOL LLFolderView::canCut() const
 void LLFolderView::cut()
 {
 	// clear the inventory clipboard
-	LLInventoryClipboard::instance().reset();
+	LLClipboard::instance().reset();
 	S32 count = mSelectedItems.size();
 	if(getVisible() && getEnabled() && (count > 0))
 	{
@@ -1348,6 +1409,7 @@ void LLFolderView::cut()
 				listener->cutToClipboard();
 			}
 		}
+		LLFolderView::removeCutItems();
 	}
 	mSearchString.clear();
 }
@@ -1966,7 +2028,7 @@ void LLFolderView::scrollToShowSelection()
 	// However we allow scrolling for folder views with mAutoSelectOverride
 	// (used in Places SP) as an exception because the selection in them
 	// is not reset during items filtering. See STORM-133.
-	if ( (!LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() || mAutoSelectOverride)
+	if ( (!LLInventoryModelBackgroundFetch::instance().folderFetchActive() || mAutoSelectOverride)
 			&& mSelectedItems.size() )
 	{
 		mNeedsScroll = TRUE;
@@ -1994,7 +2056,7 @@ void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constr
 		LLRect visible_doc_rect = mScrollContainer->getVisibleContentRect();
 		
 		S32 icon_height = mIcon.isNull() ? 0 : mIcon->getHeight(); 
-		S32 label_height = llround(getLabelFontForStyle(mLabelStyle)->getLineHeight()); 
+		S32 label_height = getLabelFontForStyle(mLabelStyle)->getLineHeight(); 
 		// when navigating with keyboard, only move top of opened folder on screen, otherwise show whole folder
 		S32 max_height_to_show = item->isOpen() && mScrollContainer->hasFocus() ? (llmax( icon_height, label_height ) + ICON_PAD) : local_rect.getHeight(); 
 		
@@ -2108,10 +2170,10 @@ bool LLFolderView::doToSelected(LLInventoryModel* model, const LLSD& userdata)
 		removeSelectedItems();
 		return true;
 	}
-
-	if ("copy" == action)
-	{	
-		LLInventoryClipboard::instance().reset();
+	if (("copy" == action) || ("cut" == action))
+	{
+		// Clear the clipboard before we start adding things on it
+		LLClipboard::instance().reset();
 	}
 
 	static const std::string change_folder_string = "change_folder_type_";
diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h
index 1d018b5e6a75f4d0516a61c56625d89cbc483702..da8bb15f8ef9397c45efad6f36d346caf8491f4e 100644
--- a/indra/newview/llfolderview.h
+++ b/indra/newview/llfolderview.h
@@ -44,6 +44,7 @@
 #include "lldepthstack.h"
 #include "lleditmenuhandler.h"
 #include "llfontgl.h"
+#include "llscrollcontainer.h"
 #include "lltooldraganddrop.h"
 #include "llviewertexture.h"
 
@@ -54,15 +55,33 @@ class LLInventoryModel;
 class LLPanel;
 class LLLineEditor;
 class LLMenuGL;
-class LLScrollContainer;
 class LLUICtrl;
 class LLTextBox;
 
+/**
+ * Class LLFolderViewScrollContainer
+ *
+ * A scroll container which provides the information about the height
+ * of currently displayed folder view contents.
+ * Used for updating vertical scroll bar visibility in inventory panel.
+ * See LLScrollContainer::calcVisibleSize().
+ */
+class LLFolderViewScrollContainer : public LLScrollContainer
+{
+public:
+	/*virtual*/ ~LLFolderViewScrollContainer() {};
+	/*virtual*/ const LLRect getScrolledViewRect() const;
+
+protected:
+	LLFolderViewScrollContainer(const LLScrollContainer::Params& p);
+	friend class LLUICtrlFactory;
+};
+
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLFolderView
 //
-// Th LLFolderView represents the root level folder view object. It
-// manages the screen region of the folder view.
+// The LLFolderView represents the root level folder view object. 
+// It manages the screen region of the folder view.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
@@ -81,6 +100,9 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 
 		Params();
 	};
+
+	friend class LLFolderViewScrollContainer;
+
 	LLFolderView(const Params&);
 	virtual ~LLFolderView( void );
 
@@ -88,7 +110,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 
 	virtual LLFolderView*	getRoot() { return this; }
 
-	// FolderViews default to sort by name.  This will change that,
+	// FolderViews default to sort by name. This will change that,
 	// and resort the items if necessary.
 	void setSortOrder(U32 order);
 	void setFilterPermMask(PermissionMask filter_perm_mask);
@@ -117,20 +139,20 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	virtual void setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse);
 	virtual BOOL addFolder( LLFolderViewFolder* folder);
 
-	// Finds width and height of this object and it's children.  Also
-	// makes sure that this view and it's children are the right size.
+	// Find width and height of this object and its children. Also
+	// makes sure that this view and its children are the right size.
 	virtual S32 arrange( S32* width, S32* height, S32 filter_generation );
 
 	void arrangeAll() { mArrangeGeneration++; }
 	S32 getArrangeGeneration() { return mArrangeGeneration; }
 
-	// applies filters to control visibility of inventory items
+	// Apply filters to control visibility of inventory items
 	virtual void filter( LLInventoryFilter& filter);
 
-	// get the last selected item
+	// Get the last selected item
 	virtual LLFolderViewItem* getCurSelectedItem( void );
 
-	// Record the selected item and pass it down the hierachy.
+	// Record the selected item and pass it down the hierarchy.
 	virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem,
 		BOOL take_keyboard_focus);
 
@@ -140,13 +162,13 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	// Called once a frame to update the selection if mSelectThisID has been set
 	void updateSelection();
 
-	// This method is used to toggle the selection of an item. Walks
-	// children, and keeps track of selected objects.
+	// This method is used to toggle the selection of an item. 
+	// Walks children and keeps track of selected objects.
 	virtual BOOL changeSelection(LLFolderViewItem* selection, BOOL selected);
 
 	virtual std::set<LLUUID> getSelectionList() const;
 
-	// make sure if ancestor is selected, descendents are not
+	// Make sure if ancestor is selected, descendents are not
 	void sanitizeSelection();
 	void clearSelection();
 	void addToSelectionList(LLFolderViewItem* item);
@@ -157,21 +179,22 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	void setDraggingOverItem(LLFolderViewItem* item) { mDraggingOverItem = item; }
 	LLFolderViewItem* getDraggingOverItem() { return mDraggingOverItem; }
 
-	// deletion functionality
+	// Deletion functionality
  	void removeSelectedItems();
+ 	static void removeCutItems();
 
-	// open the selected item.
+	// Open the selected item
 	void openSelectedItems( void );
 	void propertiesSelectedItems( void );
 
-	// change the folder type
+	// Change the folder type
 	void changeType(LLInventoryModel *model, LLFolderType::EType new_folder_type);
 
 	void autoOpenItem(LLFolderViewFolder* item);
 	void closeAutoOpenedFolders();
 	BOOL autoOpenTest(LLFolderViewFolder* item);
 
-	// copy & paste
+	// Copy & paste
 	virtual void	copy();
 	virtual BOOL	canCopy() const;
 
@@ -184,7 +207,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	virtual void	doDelete();
 	virtual BOOL	canDoDelete() const;
 
-	// public rename functionality - can only start the process
+	// Public rename functionality - can only start the process
 	void startRenamingSelectedItem( void );
 
 	// These functions were used when there was only one folderview,
@@ -325,7 +348,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 
 	/**
 	 * Is used to determine if we need to cut text In LLFolderViewItem to avoid horizontal scroll.
-	 * NOTE: For now it uses only to cut LLFolderViewItem::mLabel text to be used for Landmarks in Places Panel.
+	 * NOTE: For now it's used only to cut LLFolderViewItem::mLabel text for Landmarks in Places Panel.
 	 */
 	bool							mUseEllipses; // See EXT-719
 
diff --git a/indra/newview/llfoldervieweventlistener.h b/indra/newview/llfoldervieweventlistener.h
index aee31ca0339e2caa1f39ed1b4dc57bf10e44da23..06682dcbf1f9d8058e9449e146027f4ae80f38a0 100644
--- a/indra/newview/llfoldervieweventlistener.h
+++ b/indra/newview/llfoldervieweventlistener.h
@@ -75,7 +75,7 @@ class LLFolderViewEventListener
 	virtual void move( LLFolderViewEventListener* parent_listener ) = 0;
 	virtual BOOL isItemCopyable() const = 0;
 	virtual BOOL copyToClipboard() const = 0;
-	virtual void cutToClipboard() = 0;
+	virtual BOOL cutToClipboard() const = 0;
 	virtual BOOL isClipboardPasteable() const = 0;
 	virtual void pasteFromClipboard() = 0;
 	virtual void pasteLinkFromClipboard() = 0;
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 8d6114c8873f2ced3f990bdbb8b43d49bd3c869c..712d3e4583e3a9fc6fc06aed834c795292a0db7d 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -40,6 +40,7 @@
 #include "llviewerwindow.h"		// Argh, only for setCursor()
 
 // linden library includes
+#include "llclipboard.h"
 #include "llfocusmgr.h"		// gFocusMgr
 #include "lltrans.h"
 
@@ -410,8 +411,8 @@ BOOL LLFolderViewItem::addToFolder(LLFolderViewFolder* folder, LLFolderView* roo
 }
 
 
-// Finds width and height of this object and it's children.  Also
-// makes sure that this view and it's children are the right size.
+// Finds width and height of this object and its children.  Also
+// makes sure that this view and its children are the right size.
 S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation)
 {
 	const Params& p = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
@@ -423,7 +424,7 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation)
 		: 0;
 	if (mLabelWidthDirty)
 	{
-		mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + getLabelFontForStyle(mLabelStyle)->getWidth(mSearchableLabel); 
+		mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + TEXT_PAD_RIGHT; 
 		mLabelWidthDirty = false;
 	}
 
@@ -1002,7 +1003,7 @@ void LLFolderViewItem::draw()
 	LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor;
 	if (highlight_link) color = sLinkColor;
 	if (in_library) color = sLibraryColor;
-
+	
 	F32 right_x  = 0;
 	F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD;
 	F32 text_left = (F32)(ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mIndentation);
@@ -1045,7 +1046,7 @@ void LLFolderViewItem::draw()
 	}
 	if ((mIsLoading
 		&&	mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime"))
-			||	(LLInventoryModelBackgroundFetch::instance().backgroundFetchActive()
+			||	(LLInventoryModelBackgroundFetch::instance().folderFetchActive()
 				&&	root_is_loading
 				&&	mShowLoadStatus))
 	{
@@ -1158,7 +1159,36 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
 		mNeedsSort = false;
 	}
 
+	// evaluate mHasVisibleChildren
 	mHasVisibleChildren = hasFilteredDescendants(filter_generation);
+	if (mHasVisibleChildren)
+	{
+		// We have to verify that there's at least one child that's not filtered out
+		bool found = false;
+		// Try the items first
+		for (items_t::iterator iit = mItems.begin(); iit != mItems.end(); ++iit)
+		{
+			LLFolderViewItem* itemp = (*iit);
+			found = (itemp->getFiltered(filter_generation));
+			if (found)
+				break;
+		}
+		if (!found)
+		{
+			// If no item found, try the folders
+			for (folders_t::iterator fit = mFolders.begin(); fit != mFolders.end(); ++fit)
+			{
+				LLFolderViewFolder* folderp = (*fit);
+				found = ( folderp->getListener()
+								&&	(folderp->getFiltered(filter_generation)
+									 ||	(folderp->getFilteredFolder(filter_generation) 
+										 && folderp->hasFilteredDescendants(filter_generation))));
+				if (found)
+					break;
+			}
+		}
+		mHasVisibleChildren = found;
+	}
 
 	// calculate height as a single item (without any children), and reshapes rectangle to match
 	LLFolderViewItem::arrange( width, height, filter_generation );
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h
index 2fc79f576582fd926bd02ad67f5fd438a6e85bec..4e8dc2da167caa822e21c6f14129f85b12043f3d 100644
--- a/indra/newview/llfolderviewitem.h
+++ b/indra/newview/llfolderviewitem.h
@@ -114,6 +114,7 @@ class LLFolderViewItem : public LLView
 	static const S32 ICON_PAD = 2;
 	static const S32 ICON_WIDTH = 16;
 	static const S32 TEXT_PAD = 1;
+	static const S32 TEXT_PAD_RIGHT = 4;
 	static const S32 ARROW_SIZE = 12;
 	static const S32 MAX_FOLDER_ITEM_OVERLAP = 2;
 	// animation parameters
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index bbf66ca7503c5187d15ebeb74e4feb314b68b126..129cddda455f404f18b2f821560dee2ecace2384 100644
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -123,6 +123,22 @@ BOOL LLGroupList::handleRightMouseDown(S32 x, S32 y, MASK mask)
 	return handled;
 }
 
+// virtual
+BOOL LLGroupList::handleDoubleClick(S32 x, S32 y, MASK mask)
+{
+	BOOL handled = LLView::handleDoubleClick(x, y, mask);
+	// Handle double click only for the selected item in the list, skip clicks on empty space.
+	if (handled)
+	{
+		if (mDoubleClickSignal)
+		{
+			(*mDoubleClickSignal)(this, x, y, mask);
+		}
+	}
+
+	return handled;
+}
+
 void LLGroupList::setNameFilter(const std::string& filter)
 {
 	std::string filter_upper = filter;
diff --git a/indra/newview/llgrouplist.h b/indra/newview/llgrouplist.h
index d7051db891c9f83f09d3fe97fbf62ce212b9b468..8abf14b3d031542fdd75f7d5dd55241fcc9593da 100644
--- a/indra/newview/llgrouplist.h
+++ b/indra/newview/llgrouplist.h
@@ -51,6 +51,7 @@ class LLGroupList: public LLFlatListViewEx, public LLOldEvents::LLSimpleListener
 
 	virtual void draw(); // from LLView
 	/*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); // from LLView
+	/*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); // from LLView
 
 	void setNameFilter(const std::string& filter);
 	void toggleIcons();
diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp
index 122711a86d23f6c06959d598a846a2587648db61..dff310ecf930bfda15c71964e73dbfe35a606f9e 100644
--- a/indra/newview/llhudrender.cpp
+++ b/indra/newview/llhudrender.cpp
@@ -138,7 +138,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
 	LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f));
 	F32 right_x;
 	
-	font.render(wstr, 0, 0, 0, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x);
+	font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x);
 
 	LLUI::popMatrix();
 	gGL.popMatrix();
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 24a876c59adde175e9c7d612f29415e26584aee2..579b6008ae85ad769e63b2bccba042383b3fc8f0 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -227,7 +227,7 @@ void LLHUDText::renderText()
 			 segment_iter != mTextSegments.end(); ++segment_iter )
 		{
 			const LLFontGL* fontp = segment_iter->mFont;
-			y_offset -= fontp->getLineHeight();
+			y_offset -= fontp->getLineHeight() - 1; // correction factor to match legacy font metrics
 
 			U8 style = segment_iter->mStyle;
 			LLFontGL::ShadowType shadow = LLFontGL::DROP_SHADOW;
@@ -480,8 +480,6 @@ void LLHUDText::updateSize()
 	F32 width = 0.f;
 
 	S32 max_lines = getMaxLines();
-	//S32 lines = (max_lines < 0) ? (S32)mTextSegments.size() : llmin((S32)mTextSegments.size(), max_lines);
-	//F32 height = (F32)mFontp->getLineHeight() * (lines + mLabelSegments.size());
 
 	S32 start_segment;
 	if (max_lines < 0) start_segment = 0;
@@ -491,7 +489,7 @@ void LLHUDText::updateSize()
 	while (iter != mTextSegments.end())
 	{
 		const LLFontGL* fontp = iter->mFont;
-		height += fontp->getLineHeight();
+		height += fontp->getLineHeight() - 1; // correction factor to match legacy font metrics
 		width = llmax(width, llmin(iter->getWidth(fontp), HUD_TEXT_MAX_WIDTH));
 		++iter;
 	}
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index a856bd0bdc67bc719de33db922238dd199241c29..e69c45de58583d1a878504ef7e889e9697f451d4 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -2977,6 +2977,17 @@ bool LLIMMgr::isVoiceCall(const LLUUID& session_id)
 	return im_session->mStartedAsIMCall;
 }
 
+void LLIMMgr::addNotifiedNonFriendSessionID(const LLUUID& session_id)
+{
+	mNotifiedNonFriendSessions.insert(session_id);
+}
+
+bool LLIMMgr::isNonFriendSessionNotified(const LLUUID& session_id)
+{
+	return mNotifiedNonFriendSessions.end() != mNotifiedNonFriendSessions.find(session_id);
+
+}
+
 void LLIMMgr::noteOfflineUsers(
 	const LLUUID& session_id,
 	const LLDynamicArray<LLUUID>& ids)
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index b1be26a169ee962e80701cfed82cec74e1dd1e8e..f07a78e2f77d33529c56ff389d04704c3f8b1a94 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -438,6 +438,10 @@ class LLIMMgr : public LLSingleton<LLIMMgr>
 
 	bool isVoiceCall(const LLUUID& session_id);
 
+	void addNotifiedNonFriendSessionID(const LLUUID& session_id);
+
+	bool isNonFriendSessionNotified(const LLUUID& session_id);
+
 private:
 
 	/**
@@ -465,6 +469,14 @@ class LLIMMgr : public LLSingleton<LLIMMgr>
 	typedef std::list <LLIMSessionObserver *> session_observers_list_t;
 	session_observers_list_t mSessionObservers;
 
+	// EXP-901
+	// If "Only friends and groups can IM me" option is ON but the user got message from non-friend,
+	// the user should be notified that to be able to see this message the option should be OFF.
+	// This set stores session IDs in which user was notified. Need to store this IDs so that the user
+	// be notified only one time per session with non-friend.
+	typedef std::set<LLUUID> notified_non_friend_sessions_t;
+	notified_non_friend_sessions_t mNotifiedNonFriendSessions;
+
 	LLSD mPendingInvitations;
 	LLSD mPendingAgentListUpdates;
 };
diff --git a/indra/newview/llinspecttoast.cpp b/indra/newview/llinspecttoast.cpp
index d7b82667d17732dacbfa5a7e6521c011f4f8af3f..f4fe5dec01437692ba104e5fc0855e32e455944a 100644
--- a/indra/newview/llinspecttoast.cpp
+++ b/indra/newview/llinspecttoast.cpp
@@ -72,6 +72,8 @@ LLInspectToast::LLInspectToast(const LLSD& notification_id) :
 LLInspectToast::~LLInspectToast()
 {
 	LLTransientFloaterMgr::getInstance()->removeControlView(this);
+
+	mConnection.disconnect();
 }
 
 // virtual
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index c0065a94e662c710bd29b5da4fff218f199ddd21..fbed8e31ffd6c1f3e3c9848918cea3a67cac6878 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -47,7 +47,7 @@
 #include "llgiveinventory.h" 
 #include "llimfloater.h"
 #include "llimview.h"
-#include "llinventoryclipboard.h"
+#include "llclipboard.h"
 #include "llinventorydefines.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
@@ -113,6 +113,13 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response
 bool confirm_attachment_rez(const LLSD& notification, const LLSD& response);
 void teleport_via_landmark(const LLUUID& asset_id);
 static BOOL can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit);
+static bool check_category(LLInventoryModel* model,
+						   const LLUUID& cat_id,
+						   LLFolderView* active_folder_view,
+						   LLInventoryFilter* filter);
+static bool check_item(const LLUUID& item_id,
+					   LLFolderView* active_folder_view,
+					   LLInventoryFilter* filter);
 
 // Helper functions
 
@@ -136,6 +143,42 @@ bool isMarketplaceSendAction(const std::string& action)
 	return ("send_to_marketplace" == action);
 }
 
+// Used by LLFolderBridge as callback for directory fetching recursion
+class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver
+{
+public:
+	LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids) : LLInventoryFetchDescendentsObserver(ids) {}
+	~LLRightClickInventoryFetchDescendentsObserver() {}
+	virtual void execute(bool clear_observer = false);
+	virtual void done()
+	{
+		execute(true);
+	}
+};
+
+// Used by LLFolderBridge as callback for directory content items fetching
+class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver
+{
+public:
+	LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) : LLInventoryFetchItemsObserver(ids) { };
+	~LLRightClickInventoryFetchObserver() {}
+	void execute(bool clear_observer = false)
+	{
+		if (clear_observer)
+		{
+			dec_busy_count();
+			gInventory.removeObserver(this);
+			delete this;
+		}
+		// we've downloaded all the items, so repaint the dialog
+		LLFolderBridge::staticFolderOptionsMenu();
+	}
+	virtual void done()
+	{
+		execute(true);
+	}
+};
+
 // +=================================================+
 // |        LLInvFVBridge                            |
 // +=================================================+
@@ -148,7 +191,7 @@ LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory,
 	mInvType(LLInventoryType::IT_NONE),
 	mIsLink(FALSE)
 {
-	mInventoryPanel = inventory->getHandle();
+	mInventoryPanel = inventory->getInventoryPanelHandle();
 	const LLInventoryObject* obj = getInventoryObject();
 	mIsLink = obj && obj->getIsLinkType();
 }
@@ -208,13 +251,27 @@ BOOL LLInvFVBridge::isLink() const
 /**
  * @brief Adds this item into clipboard storage
  */
-void LLInvFVBridge::cutToClipboard()
+BOOL LLInvFVBridge::cutToClipboard() const
+{
+	const LLInventoryObject* obj = gInventory.getObject(mUUID);
+	if (obj && isItemMovable() && isItemRemovable())
+	{
+		LLClipboard::instance().setCutMode(true);
+		return LLClipboard::instance().addToClipboard(mUUID);
+	}
+	return FALSE;
+}
+
+BOOL LLInvFVBridge::copyToClipboard() const
 {
-	if(isItemMovable())
+	const LLInventoryObject* obj = gInventory.getObject(mUUID);
+	if (obj && isItemCopyable())
 	{
-		LLInventoryClipboard::instance().cut(mUUID);
+		return LLClipboard::instance().addToClipboard(mUUID);
 	}
+	return FALSE;
 }
+
 // *TODO: make sure this does the right thing
 void LLInvFVBridge::showProperties()
 {
@@ -389,6 +446,11 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
 	for(; it != end; ++it)
 	{
 		gInventory.moveObject((*it), trash_id);
+		LLViewerInventoryItem* item = gInventory.getItem(*it);
+		if (item)
+		{
+			model->updateItem(item);
+		}
 	}
 
 	// notify inventory observers.
@@ -397,7 +459,8 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
 
 BOOL LLInvFVBridge::isClipboardPasteable() const
 {
-	if (!LLInventoryClipboard::instance().hasContents() || !isAgentInventory())
+	// Return FALSE on degenerated cases: empty clipboard, no inventory, no agent
+	if (!LLClipboard::instance().hasContents() || !isAgentInventory())
 	{
 		return FALSE;
 	}
@@ -407,37 +470,42 @@ BOOL LLInvFVBridge::isClipboardPasteable() const
 		return FALSE;
 	}
 
-	const LLUUID &agent_id = gAgent.getID();
+	// In cut mode, whatever is on the clipboard is always pastable
+	if (LLClipboard::instance().isCutMode())
+	{
+		return TRUE;
+	}
 
+	// In normal mode, we need to check each element of the clipboard to know if we can paste or not
 	LLDynamicArray<LLUUID> objects;
-	LLInventoryClipboard::instance().retrieve(objects);
+	LLClipboard::instance().pasteFromClipboard(objects);
 	S32 count = objects.count();
 	for(S32 i = 0; i < count; i++)
 	{
 		const LLUUID &item_id = objects.get(i);
 
-		// Can't paste folders
+		// Folders are pastable if all items in there are copyable
 		const LLInventoryCategory *cat = model->getCategory(item_id);
 		if (cat)
 		{
+			LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, item_id);
+			if (!cat_br.isItemCopyable())
 			return FALSE;
+			// Skip to the next item in the clipboard
+			continue;
 		}
 
-		const LLInventoryItem *item = model->getItem(item_id);
-		if (item)
-		{
-			if (!item->getPermissions().allowCopyBy(agent_id))
-			{
+		// Each item must be copyable to be pastable
+		LLItemBridge item_br(mInventoryPanel.get(), mRoot, item_id);
+		if (!item_br.isItemCopyable())
 				return FALSE;
 			}
-		}
-	}
 	return TRUE;
 }
 
 BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
 {
-	if (!LLInventoryClipboard::instance().hasContents() || !isAgentInventory())
+	if (!LLClipboard::instance().hasContents() || !isAgentInventory())
 	{
 		return FALSE;
 	}
@@ -448,7 +516,7 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
 	}
 
 	LLDynamicArray<LLUUID> objects;
-	LLInventoryClipboard::instance().retrieve(objects);
+	LLClipboard::instance().pasteFromClipboard(objects);
 	S32 count = objects.count();
 	for(S32 i = 0; i < count; i++)
 	{
@@ -599,6 +667,12 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
 				disabled_items.push_back(std::string("Copy"));
 			}
 
+			items.push_back(std::string("Cut"));
+			if (!isItemMovable() || !isItemRemovable())
+			{
+				disabled_items.push_back(std::string("Cut"));
+			}
+
 			if (canListOnMarketplace())
 			{
 				items.push_back(std::string("Marketplace Separator"));
@@ -798,7 +872,7 @@ LLInventoryObject* LLInvFVBridge::getInventoryObject() const
 
 LLInventoryModel* LLInvFVBridge::getInventoryModel() const
 {
-	LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+	LLInventoryPanel* panel = mInventoryPanel.get();
 	return panel ? panel->getModel() : NULL;
 }
 
@@ -1278,6 +1352,12 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
 		gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(buffer));
 		return;
 	}
+	else if ("cut" == action)
+	{
+		cutToClipboard();
+		LLFolderView::removeCutItems();
+		return;
+	}
 	else if ("copy" == action)
 	{
 		copyToClipboard();
@@ -1285,7 +1365,6 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
 	}
 	else if ("paste" == action)
 	{
-		// Single item only
 		LLInventoryItem* itemp = model->getItem(mUUID);
 		if (!itemp) return;
 
@@ -1324,8 +1403,8 @@ void LLItemBridge::selectItem()
 	LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem());
 	if(item && !item->isFinished())
 	{
-		item->fetchFromServer();
-		//LLInventoryModelBackgroundFetch::instance().start(item->getUUID(), false);
+		//item->fetchFromServer();
+		LLInventoryModelBackgroundFetch::instance().start(item->getUUID(), false);
 	}
 }
 
@@ -1660,16 +1739,6 @@ BOOL LLItemBridge::isItemCopyable() const
 	return FALSE;
 }
 
-BOOL LLItemBridge::copyToClipboard() const
-{
-	if(isItemCopyable())
-	{
-		LLInventoryClipboard::instance().add(mUUID);
-		return TRUE;
-	}
-	return FALSE;
-}
-
 LLViewerInventoryItem* LLItemBridge::getItem() const
 {
 	LLViewerInventoryItem* item = NULL;
@@ -1703,16 +1772,20 @@ BOOL LLFolderBridge::isItemMovable() const
 	LLInventoryObject* obj = getInventoryObject();
 	if(obj)
 	{
-		return (!LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType()));
+		// If it's a protected type folder, we can't move it
+		if (LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType()))
+			return FALSE;
+		return TRUE;
 	}
 	return FALSE;
 }
 
 void LLFolderBridge::selectItem()
 {
+	// Have no fear: the first thing start() does is to test if everything for that folder has been fetched...
+	LLInventoryModelBackgroundFetch::instance().start(getUUID(), true);
 }
 
-
 // Iterate through a folder's children to determine if
 // all the children are removable.
 class LLIsItemRemovable : public LLFolderViewFunctor
@@ -1738,7 +1811,7 @@ BOOL LLFolderBridge::isItemRemovable() const
 		return FALSE;
 	}
 
-	LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+	LLInventoryPanel* panel = mInventoryPanel.get();
 	LLFolderViewFolder* folderp = dynamic_cast<LLFolderViewFolder*>(panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL);
 	if (folderp)
 	{
@@ -1768,19 +1841,35 @@ BOOL LLFolderBridge::isUpToDate() const
 
 BOOL LLFolderBridge::isItemCopyable() const
 {
-	// Can copy folders to paste-as-link, but not for straight paste.
-	return gSavedSettings.getBOOL("InventoryLinking");
+	// Folders are copyable if items in them are, recursively, copyable.
+	
+	// Get the content of the folder
+	LLInventoryModel::cat_array_t* cat_array;
+	LLInventoryModel::item_array_t* item_array;
+	gInventory.getDirectDescendentsOf(mUUID,cat_array,item_array);
+
+	// Check the items
+	LLInventoryModel::item_array_t item_array_copy = *item_array;
+	for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
+	{
+		LLInventoryItem* item = *iter;
+		LLItemBridge item_br(mInventoryPanel.get(), mRoot, item->getUUID());
+		if (!item_br.isItemCopyable())
+			return FALSE;
 }
 
-BOOL LLFolderBridge::copyToClipboard() const
+	// Check the folders
+	LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
+	for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
 {
-	if(isItemCopyable())
-	{
-		LLInventoryClipboard::instance().add(mUUID);
+		LLViewerInventoryCategory* category = *iter;
+		LLFolderBridge cat_br(mInventoryPanel.get(), mRoot, category->getUUID());
+		if (!cat_br.isItemCopyable())
+			return FALSE;
+	}
+	
 		return TRUE;
 	}
-	return FALSE;
-}
 
 BOOL LLFolderBridge::isClipboardPasteable() const
 {
@@ -1797,7 +1886,7 @@ BOOL LLFolderBridge::isClipboardPasteable() const
 		}
 
 		LLDynamicArray<LLUUID> objects;
-		LLInventoryClipboard::instance().retrieve(objects);
+		LLClipboard::instance().pasteFromClipboard(objects);
 		const LLViewerInventoryCategory *current_cat = getCategory();
 
 		// Search for the direct descendent of current Friends subfolder among all pasted items,
@@ -1835,7 +1924,7 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const
 		const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat );
 		const LLUUID &current_cat_id = current_cat->getUUID();
 		LLDynamicArray<LLUUID> objects;
-		LLInventoryClipboard::instance().retrieve(objects);
+		LLClipboard::instance().pasteFromClipboard(objects);
 		S32 count = objects.count();
 		for(S32 i = 0; i < count; i++)
 		{
@@ -1959,6 +2048,12 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 	if (!isAgentAvatarValid()) return FALSE;
 	if (!isAgentInventory()) return FALSE; // cannot drag categories into library
 
+	LLInventoryPanel* destination_panel = mInventoryPanel.get();
+	if (!destination_panel) return false;
+
+	LLInventoryFilter* filter = destination_panel->getFilter();
+	if (!filter) return false;
+
 	const LLUUID &cat_id = inv_cat->getUUID();
 	const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
 	const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
@@ -2096,7 +2191,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 							// NOTE: The cargo id's count is a total of categories AND items but we err on the side of
 							//       prevention rather than letting too many folders into the hierarchy of the outbox,
 							//       when we're dragging the item to a new parent
-							dragged_folder_count += LLToolDragAndDrop::instance().getCargoIDsCount();
+							dragged_folder_count += LLToolDragAndDrop::instance().getCargoCount();
 						}
 					}
 					
@@ -2146,6 +2241,39 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 			}
 		}
 
+		if (is_movable)
+		{
+			LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
+			is_movable = active_panel != NULL;
+
+			// For a folder to pass the filter all its descendants are required to pass.
+			// We make this exception to allow reordering folders within an inventory panel,
+			// which has a filter applied, like Recent tab for example.
+			// There may be folders which are displayed because some of their descendants pass
+			// the filter, but other don't, and thus remain hidden. Without this check,
+			// such folders would not be allowed to be moved within a panel.
+			if (destination_panel == active_panel)
+			{
+				is_movable = true;
+			}
+			else
+			{
+				LLFolderView* active_folder_view = NULL;
+
+				if (is_movable)
+				{
+					active_folder_view = active_panel->getRootFolder();
+					is_movable = active_folder_view != NULL;
+				}
+
+				if (is_movable)
+				{
+					// Check whether the folder being dragged from active inventory panel
+					// passes the filter of the destination panel.
+					is_movable = check_category(model, cat_id, active_folder_view, filter);
+				}
+			}
+		}
 		// 
 		//--------------------------------------------------------------------------------
 
@@ -2240,7 +2368,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 		}
 		else
 		{
-			accept = move_inv_category_world_to_agent(cat_id, mUUID, drop);
+			accept = move_inv_category_world_to_agent(cat_id, mUUID, drop, NULL, NULL, filter);
 		}
 	}
 	else if (LLToolDragAndDrop::SOURCE_LIBRARY == source)
@@ -2285,7 +2413,8 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 									  const LLUUID& category_id,
 									  BOOL drop,
 									  void (*callback)(S32, void*),
-									  void* user_data)
+									  void* user_data,
+									  LLInventoryFilter* filter)
 {
 	// Make sure the object exists. If we allowed dragging from
 	// anonymous objects, it would be possible to bypass
@@ -2309,7 +2438,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 		return FALSE;
 	}
 
-	BOOL accept = TRUE;
+	BOOL accept = FALSE;
 	BOOL is_move = FALSE;
 
 	// coming from a task. Need to figure out if the person can
@@ -2318,9 +2447,16 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 	LLInventoryObject::object_list_t::iterator end = inventory_objects.end();
 	for ( ; it != end; ++it)
 	{
+		LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(it->get());
+		if (!item)
+		{
+			llwarns << "Invalid inventory item for drop" << llendl;
+			continue;
+		}
+
 		// coming from a task. Need to figure out if the person can
 		// move/copy this item.
-		LLPermissions perm(((LLInventoryItem*)((LLInventoryObject*)(*it)))->getPermissions());
+		LLPermissions perm(item->getPermissions());
 		if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
 			&& perm.allowTransferTo(gAgent.getID())))
 //			|| gAgent.isGodlike())
@@ -2335,9 +2471,14 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 			is_move = TRUE;
 			accept = TRUE;
 		}
-		else
+
+		if (filter && accept)
+		{
+			accept = filter->check(item);
+		}
+
+		if (!accept)
 		{
-			accept = FALSE;
 			break;
 		}
 	}
@@ -2373,121 +2514,114 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 	return accept;
 }
 
-//Used by LLFolderBridge as callback for directory recursion.
-class LLRightClickInventoryFetchObserver : public LLInventoryFetchItemsObserver
-{
-public:
-	LLRightClickInventoryFetchObserver(const uuid_vec_t& ids) :
-		LLInventoryFetchItemsObserver(ids),
-		mCopyItems(false)
-	{ };
-	LLRightClickInventoryFetchObserver(const uuid_vec_t& ids,
-									   const LLUUID& cat_id, 
-									   bool copy_items) :
-		LLInventoryFetchItemsObserver(ids),
-		mCatID(cat_id),
-		mCopyItems(copy_items)
-	{ };
-	virtual void done()
-	{
-		// we've downloaded all the items, so repaint the dialog
-		LLFolderBridge::staticFolderOptionsMenu();
-
-		gInventory.removeObserver(this);
-		delete this;
-	}
-
-protected:
-	LLUUID mCatID;
-	bool mCopyItems;
-
-};
-
-//Used by LLFolderBridge as callback for directory recursion.
-class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver
-{
-public:
-	LLRightClickInventoryFetchDescendentsObserver(const uuid_vec_t& ids,
-												  bool copy_items) : 
-		LLInventoryFetchDescendentsObserver(ids),
-		mCopyItems(copy_items) 
-	{}
-	~LLRightClickInventoryFetchDescendentsObserver() {}
-	virtual void done();
-protected:
-	bool mCopyItems;
-};
-
-void LLRightClickInventoryFetchDescendentsObserver::done()
+void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer)
 {
-	// Avoid passing a NULL-ref as mCompleteFolders.front() down to
-	// gInventory.collectDescendents()
+	// Bail out immediately if no descendents
 	if( mComplete.empty() )
 	{
 		llwarns << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << llendl;
+		if (clear_observer)
+		{
 		dec_busy_count();
 		gInventory.removeObserver(this);
 		delete this;
+		}
 		return;
 	}
 
-	// What we do here is get the complete information on the items in
-	// the library, and set up an observer that will wait for that to
-	// happen.
-	LLInventoryModel::cat_array_t cat_array;
-	LLInventoryModel::item_array_t item_array;
-	gInventory.collectDescendents(mComplete.front(),
-								  cat_array,
-								  item_array,
-								  LLInventoryModel::EXCLUDE_TRASH);
-	S32 count = item_array.count();
-#if 0 // HACK/TODO: Why?
-	// This early causes a giant menu to get produced, and doesn't seem to be needed.
-	if(!count)
-	{
-		llwarns << "Nothing fetched in category " << mCompleteFolders.front()
-				<< llendl;
+	// Copy the list of complete fetched folders while "this" is still valid
+	uuid_vec_t completed_folder = mComplete;
+	
+	// Clean up, and remove this as an observer now since recursive calls
+	// could notify observers and throw us into an infinite loop.
+	if (clear_observer)
+	{
 		dec_busy_count();
 		gInventory.removeObserver(this);
 		delete this;
-		return;
 	}
-#endif
 
-	uuid_vec_t ids;
-	for(S32 i = 0; i < count; ++i)
+	for (uuid_vec_t::iterator current_folder = completed_folder.begin(); current_folder != completed_folder.end(); ++current_folder)
 	{
-		ids.push_back(item_array.get(i)->getUUID());
-	}
+		// Get the information on the fetched folder items and subfolders and fetch those 
+		LLInventoryModel::cat_array_t* cat_array;
+		LLInventoryModel::item_array_t* item_array;
+		gInventory.getDirectDescendentsOf(*current_folder, cat_array, item_array);
 
-	LLRightClickInventoryFetchObserver* outfit = new LLRightClickInventoryFetchObserver(ids, mComplete.front(), mCopyItems);
+		S32 item_count = item_array->count();
+		S32 cat_count = cat_array->count();
+	
+		// Move to next if current folder empty
+		if ((item_count == 0) && (cat_count == 0))
+	{
+			continue;
+	}
 
-	// clean up, and remove this as an observer since the call to the
-	// outfit could notify observers and throw us into an infinite
-	// loop.
-	dec_busy_count();
-	gInventory.removeObserver(this);
-	delete this;
+		uuid_vec_t ids;
+		LLRightClickInventoryFetchObserver* outfit = NULL;
+		LLRightClickInventoryFetchDescendentsObserver* categories = NULL;
 
-	// increment busy count and either tell the inventory to check &
-	// call done, or add this object to the inventory for observation.
-	inc_busy_count();
+		// Fetch the items
+		if (item_count)
+		{
+			for (S32 i = 0; i < item_count; ++i)
+			{
+				ids.push_back(item_array->get(i)->getUUID());
+			}
+			outfit = new LLRightClickInventoryFetchObserver(ids);
+		}
+		// Fetch the subfolders
+		if (cat_count)
+		{
+			for (S32 i = 0; i < cat_count; ++i)
+			{
+				ids.push_back(cat_array->get(i)->getUUID());
+			}
+			categories = new LLRightClickInventoryFetchDescendentsObserver(ids);
+		}
 
-	// do the fetch
+		// Perform the item fetch
+		if (outfit)
+		{
 	outfit->startFetch();
-	outfit->done();				//Not interested in waiting and this will be right 99% of the time.
+			outfit->execute();				// Not interested in waiting and this will be right 99% of the time.
+			delete outfit;
 //Uncomment the following code for laggy Inventory UI.
-/*	if(outfit->isFinished())
+			/*
+			 if (outfit->isFinished())
 	{
 	// everything is already here - call done.
-	outfit->done();
+				outfit->execute();
+				delete outfit;
 	}
 	else
 	{
-	// it's all on it's way - add an observer, and the inventory
+				// it's all on its way - add an observer, and the inventory
 	// will call done for us when everything is here.
+				inc_busy_count();
 	gInventory.addObserver(outfit);
-	}*/
+			}
+			*/
+		}
+		// Perform the subfolders fetch : this is where we truly recurse down the folder hierarchy
+		if (categories)
+		{
+			categories->startFetch();
+			if (categories->isFinished())
+			{
+				// everything is already here - call done.
+				categories->execute();
+				delete categories;
+			}
+			else
+			{
+				// it's all on its way - add an observer, and the inventory
+				// will call done for us when everything is here.
+				inc_busy_count();
+				gInventory.addObserver(categories);
+			}
+		}
+	}
 }
 
 
@@ -2606,6 +2740,12 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
 		modifyOutfit(TRUE);
 		return;
 	}
+	else if ("cut" == action)
+	{
+		cutToClipboard();
+		LLFolderView::removeCutItems();
+		return;
+	}
 	else if ("copy" == action)
 	{
 		copyToClipboard();
@@ -2820,20 +2960,65 @@ void LLFolderBridge::pasteFromClipboard()
 	if(model && isClipboardPasteable())
 	{
 		const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
+		const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
+
 		const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
 		const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+		const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id);
+
+		LLDynamicArray<LLUUID> objects;
+		LLClipboard::instance().pasteFromClipboard(objects);
+
+		if (move_is_into_outbox)
+		{
+			LLFolderViewItem * outbox_itemp = mRoot->getItemByID(mUUID);
+
+			if (outbox_itemp)
+			{
+				LLToolDragAndDrop::instance().setCargoCount(objects.size());
+
+				BOOL can_list = TRUE;
+
+				for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin();
+					(iter != objects.end()) && (can_list == TRUE);
+					++iter)
+				{
+					const LLUUID& item_id = (*iter);
+					LLInventoryItem *item = model->getItem(item_id);
+
+					if (item)
+					{
+						MASK mask = 0x0;
+						BOOL drop = FALSE;
+						EDragAndDropType cargo_type = LLViewerAssetType::lookupDragAndDropType(item->getActualType());
+						void * cargo_data = (void *) item;
+						std::string tooltip_msg;
+
+						can_list = outbox_itemp->getListener()->dragOrDrop(mask, drop, cargo_type, cargo_data, tooltip_msg);
+					}
+				}
+
+				LLToolDragAndDrop::instance().resetCargoCount();
+
+				if (can_list == FALSE)
+				{
+					// Notify user of failure somehow -- play error sound?  modal dialog?
+					return;
+				}
+			}
+		}
 
 		const LLUUID parent_id(mUUID);
 
-		LLDynamicArray<LLUUID> objects;
-		LLInventoryClipboard::instance().retrieve(objects);
 		for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin();
 			 iter != objects.end();
 			 ++iter)
 		{
 			const LLUUID& item_id = (*iter);
+
 			LLInventoryItem *item = model->getItem(item_id);
-			if (item)
+			LLInventoryObject *obj = model->getObject(item_id);
+			if (obj)
 			{
 				if (move_is_into_current_outfit || move_is_into_outfit)
 				{
@@ -2842,10 +3027,21 @@ void LLFolderBridge::pasteFromClipboard()
 						dropToOutfit(item, move_is_into_current_outfit);
 					}
 				}
-				else if(LLInventoryClipboard::instance().isCutMode())
+				else if (LLClipboard::instance().isCutMode())
+				{
+					// Do a move to "paste" a "cut"
+					// move_inventory_item() is not enough, as we have to update inventory locally too
+					if (LLAssetType::AT_CATEGORY == obj->getType())
+					{
+						LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id);
+						llassert(vicat);
+						if (vicat)
+						{
+							changeCategoryParent(model, vicat, parent_id, FALSE);
+						}
+					}
+					else
 				{
-					// move_inventory_item() is not enough,
-					//we have to update inventory locally too
 					LLViewerInventoryItem* viitem = dynamic_cast<LLViewerInventoryItem*>(item);
 					llassert(viitem);
 					if (viitem)
@@ -2853,6 +3049,19 @@ void LLFolderBridge::pasteFromClipboard()
 						changeItemParent(model, viitem, parent_id, FALSE);
 					}
 				}
+				}
+				else
+				{
+					// Do a "copy" to "paste" a regular copy clipboard
+					if (LLAssetType::AT_CATEGORY == obj->getType())
+					{
+						LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id);
+						llassert(vicat);
+						if (vicat)
+						{
+							copy_inventory_category(model, vicat, parent_id);
+						}
+					}
 				else
 				{
 					copy_inventory_item(
@@ -2866,6 +3075,9 @@ void LLFolderBridge::pasteFromClipboard()
 			}
 		}
 	}
+		// Change mode to paste for next paste
+		LLClipboard::instance().setCutMode(false);
+	}
 }
 
 void LLFolderBridge::pasteLinkFromClipboard()
@@ -2874,13 +3086,22 @@ void LLFolderBridge::pasteLinkFromClipboard()
 	if(model)
 	{
 		const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
+		const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
+
 		const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
 		const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+		const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id);
+
+		if (move_is_into_outbox)
+		{
+			// Notify user of failure somehow -- play error sound?  modal dialog?
+			return;
+		}
 
 		const LLUUID parent_id(mUUID);
 
 		LLDynamicArray<LLUUID> objects;
-		LLInventoryClipboard::instance().retrieve(objects);
+		LLClipboard::instance().pasteFromClipboard(objects);
 		for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin();
 			 iter != objects.end();
 			 ++iter)
@@ -2918,6 +3139,8 @@ void LLFolderBridge::pasteLinkFromClipboard()
 					LLPointer<LLInventoryCallback>(NULL));
 			}
 		}
+		// Change mode to paste for next paste
+		LLClipboard::instance().setCutMode(false);
 	}
 }
 
@@ -3175,16 +3398,19 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		folders.push_back(category->getUUID());
 
 		sSelf = getHandle();
-		LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders, FALSE);
+		LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(folders);
 		fetch->startFetch();
-		inc_busy_count();
 		if (fetch->isFinished())
 		{
+			// Do not call execute() or done() here as if the folder is here, there's likely no point drilling down 
+			// This saves lots of time as buildContextMenu() is called a lot
+			delete fetch;
 			buildContextMenuFolderOptions(flags);
 		}
 		else
 		{
 			// it's all on its way - add an observer, and the inventory will call done for us when everything is here.
+			inc_busy_count();
 			gInventory.addObserver(fetch);
 		}
 	}
@@ -3290,7 +3516,7 @@ void LLFolderBridge::createNewCategory(void* user_data)
 {
 	LLFolderBridge* bridge = (LLFolderBridge*)user_data;
 	if(!bridge) return;
-	LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(bridge->mInventoryPanel.get());
+	LLInventoryPanel* panel = bridge->mInventoryPanel.get();
 	if (!panel) return;
 	LLInventoryModel* model = panel->getModel();
 	if(!model) return;
@@ -3470,7 +3696,7 @@ void LLFolderBridge::dropToFavorites(LLInventoryItem* inv_item)
 	// use callback to rearrange favorite landmarks after adding
 	// to have new one placed before target (on which it was dropped). See EXT-4312.
 	LLPointer<AddFavoriteLandmarkCallback> cb = new AddFavoriteLandmarkCallback();
-	LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+	LLInventoryPanel* panel = mInventoryPanel.get();
 	LLFolderViewItem* drag_over_item = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL;
 	if (drag_over_item && drag_over_item->getListener())
 	{
@@ -3520,6 +3746,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 	if (!isAgentInventory()) return FALSE; // cannot drag into library
 	if (!isAgentAvatarValid()) return FALSE;
 
+	LLInventoryPanel* destination_panel = mInventoryPanel.get();
+	if (!destination_panel) return false;
+
+	LLInventoryFilter* filter = destination_panel->getFilter();
+	if (!filter) return false;
+
 	const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
 	const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE, false);
 	const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false);
@@ -3529,7 +3761,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 	const BOOL move_is_into_favorites = (mUUID == favorites_id);
 	const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
 	const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id);
-	const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); //(mUUID == outbox_id);
+	const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id);
 	const BOOL move_is_from_outbox = model->isObjectDescendentOf(inv_item->getUUID(), outbox_id);
 
 	LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
@@ -3608,7 +3840,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			{
 				const LLViewerInventoryCategory * master_folder = model->getFirstDescendantOf(outbox_id, mUUID);
 				
-				int existing_item_count = LLToolDragAndDrop::instance().getCargoIDsCount();
+				int existing_item_count = LLToolDragAndDrop::instance().getCargoCount();
 				
 				if (master_folder != NULL)
 				{
@@ -3628,6 +3860,21 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			}
 		}
 
+		LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
+
+		// Check whether the item being dragged from active inventory panel
+		// passes the filter of the destination panel.
+		if (accept && active_panel)
+		{
+			LLFolderView* active_folder_view = active_panel->getRootFolder();
+			if (!active_folder_view) return false;
+
+			LLFolderViewItem* fv_item = active_folder_view->getItemByID(inv_item->getUUID());
+			if (!fv_item) return false;
+
+			accept = filter->check(fv_item);
+		}
+
 		if (accept && drop)
 		{
 			if (inv_item->getType() == LLAssetType::AT_GESTURE
@@ -3637,15 +3884,10 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			}
 			// If an item is being dragged between windows, unselect everything in the active window 
 			// so that we don't follow the selection to its new location (which is very annoying).
-			LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
-			if (active_panel)
-			{
-				LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
-				if (active_panel && (panel != active_panel))
+			if (active_panel && (destination_panel != active_panel))
 				{
 					active_panel->unSelectAll();
 				}
-			}
 
 			//--------------------------------------------------------------------------------
 			// Destination folder logic
@@ -3655,8 +3897,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			// (only reorder the item in Favorites folder)
 			if ((mUUID == inv_item->getParentUUID()) && move_is_into_favorites)
 			{
-				LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
-				LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL;
+				LLFolderViewItem* itemp = destination_panel->getRootFolder()->getDraggingOverItem();
 				if (itemp)
 				{
 					LLUUID srcItemId = inv_item->getUUID();
@@ -3760,6 +4001,13 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			accept = FALSE;
 		}
 		
+		// Check whether the item being dragged from in world
+		// passes the filter of the destination panel.
+		if (accept)
+		{
+			accept = filter->check(inv_item);
+		}
+
 		if (accept && drop)
 		{
 			LLMoveInv* move_inv = new LLMoveInv;
@@ -3797,6 +4045,13 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			accept = !(move_is_into_current_outfit || move_is_into_outfit);
 		}
 		
+		// Check whether the item being dragged from notecard
+		// passes the filter of the destination panel.
+		if (accept)
+		{
+			accept = filter->check(inv_item);
+		}
+
 		if (accept && drop)
 		{
 			copy_inventory_from_notecard(mUUID,  // Drop to the chosen destination folder
@@ -3828,6 +4083,21 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 				accept = can_move_to_landmarks(inv_item);
 			}
 
+			LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
+
+			// Check whether the item being dragged from the library
+			// passes the filter of the destination panel.
+			if (accept && active_panel)
+			{
+				LLFolderView* active_folder_view = active_panel->getRootFolder();
+				if (!active_folder_view) return false;
+
+				LLFolderViewItem* fv_item = active_folder_view->getItemByID(inv_item->getUUID());
+				if (!fv_item) return false;
+
+				accept = filter->check(fv_item);
+			}
+
 			if (accept && drop)
 			{
 				// FAVORITES folder
@@ -3862,6 +4132,69 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 	return accept;
 }
 
+// static
+bool check_category(LLInventoryModel* model,
+					const LLUUID& cat_id,
+					LLFolderView* active_folder_view,
+					LLInventoryFilter* filter)
+{
+	if (!model || !active_folder_view || !filter)
+		return false;
+
+	if (!filter->checkFolder(cat_id))
+	{
+		return false;
+	}
+
+	LLInventoryModel::cat_array_t descendent_categories;
+	LLInventoryModel::item_array_t descendent_items;
+	model->collectDescendents(cat_id, descendent_categories, descendent_items, TRUE);
+
+	S32 num_descendent_categories = descendent_categories.count();
+	S32 num_descendent_items = descendent_items.count();
+
+	if (num_descendent_categories + num_descendent_items == 0)
+	{
+		// Empty folder should be checked as any other folder view item.
+		// If we are filtering by date the folder should not pass because
+		// it doesn't have its own creation date. See LLInvFVBridge::getCreationDate().
+		return check_item(cat_id, active_folder_view, filter);
+	}
+
+	for (S32 i = 0; i < num_descendent_categories; ++i)
+	{
+		LLInventoryCategory* category = descendent_categories[i];
+		if(!check_category(model, category->getUUID(), active_folder_view, filter))
+		{
+			return false;
+		}
+	}
+
+	for (S32 i = 0; i < num_descendent_items; ++i)
+	{
+		LLViewerInventoryItem* item = descendent_items[i];
+		if(!check_item(item->getUUID(), active_folder_view, filter))
+		{
+			return false;
+		}
+	}
+
+	return true;
+}
+
+// static
+bool check_item(const LLUUID& item_id,
+				LLFolderView* active_folder_view,
+				LLInventoryFilter* filter)
+{
+	if (!active_folder_view || !filter) return false;
+
+	LLFolderViewItem* fv_item = active_folder_view->getItemByID(item_id);
+	if (!fv_item) return false;
+
+	return filter->check(fv_item);
+}
+
 // +=================================================+
 // |        LLTextureBridge                          |
 // +=================================================+
@@ -4184,7 +4517,7 @@ LLCallingCardBridge::~LLCallingCardBridge()
 
 void LLCallingCardBridge::refreshFolderViewItem()
 {
-	LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+	LLInventoryPanel* panel = mInventoryPanel.get();
 	LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL;
 	if (itemp)
 	{
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 871657a58ae0afd808b59857d13168576f4e0593..dc9e88d54d84fb2c048609a5478eb0ad6b335098 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -35,6 +35,7 @@
 #include "llviewercontrol.h"
 #include "llwearable.h"
 
+class LLInventoryFilter;
 class LLInventoryPanel;
 class LLInventoryModel;
 class LLMenuGL;
@@ -105,8 +106,8 @@ class LLInvFVBridge : public LLFolderViewEventListener
 	virtual void removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch);
 	virtual void move(LLFolderViewEventListener* new_parent_bridge) {}
 	virtual BOOL isItemCopyable() const { return FALSE; }
-	virtual BOOL copyToClipboard() const { return FALSE; }
-	virtual void cutToClipboard();
+	virtual BOOL copyToClipboard() const;
+	virtual BOOL cutToClipboard() const;
 	virtual BOOL isClipboardPasteable() const;
 	virtual BOOL isClipboardPasteableAsLink() const;
 	virtual void pasteFromClipboard() {}
@@ -161,7 +162,7 @@ class LLInvFVBridge : public LLFolderViewEventListener
 									 BOOL restamp);
 	void removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*>& batch);
 protected:
-	LLHandle<LLPanel> mInventoryPanel;
+	LLHandle<LLInventoryPanel> mInventoryPanel;
 	LLFolderView* mRoot;
 	const LLUUID mUUID;	// item id
 	LLInventoryType::EType mInvType;
@@ -211,7 +212,6 @@ class LLItemBridge : public LLInvFVBridge
 	virtual BOOL renameItem(const std::string& new_name);
 	virtual BOOL removeItem();
 	virtual BOOL isItemCopyable() const;
-	virtual BOOL copyToClipboard() const;
 	virtual BOOL hasChildren() const { return FALSE; }
 	virtual BOOL isUpToDate() const { return TRUE; }
 
@@ -274,7 +274,6 @@ class LLFolderBridge : public LLInvFVBridge
 	virtual BOOL isItemCopyable() const;
 	virtual BOOL isClipboardPasteable() const;
 	virtual BOOL isClipboardPasteableAsLink() const;
-	virtual BOOL copyToClipboard() const;
 	
 	static void createWearable(LLFolderBridge* bridge, LLWearableType::EType type);
 
@@ -645,7 +644,8 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 									  const LLUUID& category_id,
 									  BOOL drop,
 									  void (*callback)(S32, void*) = NULL,
-									  void* user_data = NULL);
+									  void* user_data = NULL,
+									  LLInventoryFilter* filter = NULL);
 
 // Utility function to hide all entries except those in the list
 // Can be called multiple times on the same menu (e.g. if multiple items
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index d54bce4619d3fff2c82c59917ed74c2f7df170b9..e859535d18d7cb63a726cd1f8c63990914954b28 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -39,8 +39,11 @@
 #include "llviewerfoldertype.h"
 
 // linden library includes
+#include "llclipboard.h"
 #include "lltrans.h"
 
+LLFastTimer::DeclareTimer FT_FILTER_CLIPBOARD("Filter Clipboard");
+
 LLInventoryFilter::FilterOps::FilterOps() :
 	mFilterObjectTypes(0xffffffffffffffffULL),
 	mFilterCategoryTypes(0xffffffffffffffffULL),
@@ -88,11 +91,15 @@ LLInventoryFilter::~LLInventoryFilter()
 
 BOOL LLInventoryFilter::check(const LLFolderViewItem* item) 
 {
-	// If it's a folder and we're showing all folders, return TRUE automatically.
+	// Clipboard cut items are *always* filtered so we need this value upfront
+	const LLFolderViewEventListener* listener = item->getListener();
+	const BOOL passed_clipboard = (listener ? checkAgainstClipboard(listener->getUUID()) : TRUE);
+
+	// If it's a folder and we're showing all folders, return automatically.
 	const BOOL is_folder = (dynamic_cast<const LLFolderViewFolder*>(item) != NULL);
 	if (is_folder && (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS))
 	{
-		return TRUE;
+		return passed_clipboard;
 	}
 
 	mSubStringMatchOffset = mFilterSubString.size() ? item->getSearchableLabel().find(mFilterSubString) : std::string::npos;
@@ -103,22 +110,60 @@ BOOL LLInventoryFilter::check(const LLFolderViewItem* item)
 	const BOOL passed = (passed_filtertype &&
 						 passed_permissions &&
 						 passed_filterlink &&
+						 passed_clipboard &&
 						 (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos));
 
 	return passed;
 }
 
-bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder)
+bool LLInventoryFilter::check(const LLInventoryItem* item)
 {
-	// we're showing all folders, overriding filter
-	if (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS)
+	mSubStringMatchOffset = mFilterSubString.size() ? item->getName().find(mFilterSubString) : std::string::npos;
+
+	const bool passed_filtertype = checkAgainstFilterType(item);
+	const bool passed_permissions = checkAgainstPermissions(item);
+	const BOOL passed_clipboard = checkAgainstClipboard(item->getUUID());
+	const bool passed = (passed_filtertype &&
+						 passed_permissions &&
+						 passed_clipboard &&
+						 (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos));
+
+	return passed;
+}
+
+bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder) const
+{
+	if (!folder)
 	{
-		return true;
+		llwarns << "The filter can not be checked on an invalid folder." << llendl;
+		llassert(false); // crash in development builds
+		return false;
 	}
 
 	const LLFolderViewEventListener* listener = folder->getListener();
+	if (!listener)
+	{
+		llwarns << "Folder view event listener not found." << llendl;
+		llassert(false); // crash in development builds
+		return false;
+	}
+
 	const LLUUID folder_id = listener->getUUID();
+
+	return checkFolder(folder_id);
+}
+
+bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const
+{
+	// Always check against the clipboard
+	const BOOL passed_clipboard = checkAgainstClipboard(folder_id);
 	
+	// we're showing all folders, overriding filter
+	if (mFilterOps.mShowFolderState == LLInventoryFilter::SHOW_ALL_FOLDERS)
+	{
+		return passed_clipboard;
+	}
+
 	if (mFilterOps.mFilterTypes & FILTERTYPE_CATEGORY)
 	{
 		// Can only filter categories for items in your inventory
@@ -131,7 +176,7 @@ bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder)
 			return false;
 	}
 
-	return true;
+	return passed_clipboard;
 }
 
 BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) const
@@ -223,10 +268,85 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) con
 			}
 		}
 	}
-	
+
 	return TRUE;
 }
 
+bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) const
+{
+	LLInventoryType::EType object_type = item->getInventoryType();
+	const LLUUID object_id = item->getUUID();
+
+	const U32 filterTypes = mFilterOps.mFilterTypes;
+
+	////////////////////////////////////////////////////////////////////////////////
+	// FILTERTYPE_OBJECT
+	// Pass if this item's type is of the correct filter type
+	if (filterTypes & FILTERTYPE_OBJECT)
+	{
+		// If it has no type, pass it, unless it's a link.
+		if (object_type == LLInventoryType::IT_NONE)
+		{
+			if (item && item->getIsLinkType())
+			{
+				return false;
+			}
+		}
+		else if ((1LL << object_type & mFilterOps.mFilterObjectTypes) == U64(0))
+		{
+			return false;
+		}
+	}
+
+	////////////////////////////////////////////////////////////////////////////////
+	// FILTERTYPE_UUID
+	// Pass if this item is the target UUID or if it links to the target UUID
+	if (filterTypes & FILTERTYPE_UUID)
+	{
+		if (!item) return false;
+
+		if (item->getLinkedUUID() != mFilterOps.mFilterUUID)
+			return false;
+	}
+
+	////////////////////////////////////////////////////////////////////////////////
+	// FILTERTYPE_DATE
+	// Pass if this item is within the date range.
+	if (filterTypes & FILTERTYPE_DATE)
+	{
+		// We don't get the updated item creation date for the task inventory or
+		// a notecard embedded item. See LLTaskInvFVBridge::getCreationDate().
+		return false;
+	}
+
+	return true;
+}
+
+// Items and folders that are on the clipboard or, recursively, in a folder which  
+// is on the clipboard must be filtered out if the clipboard is in the "cut" mode.
+bool LLInventoryFilter::checkAgainstClipboard(const LLUUID& object_id) const
+{
+	if (LLClipboard::instance().isCutMode())
+	{
+		LLFastTimer ft(FT_FILTER_CLIPBOARD);
+		LLUUID current_id = object_id;
+		LLInventoryObject *current_object = gInventory.getObject(object_id);
+		while (current_id.notNull() && current_object)
+		{
+			if (LLClipboard::instance().isOnClipboard(current_id))
+			{
+				return false;
+			}
+			current_id = current_object->getParentUUID();
+			if (current_id.notNull())
+			{
+				current_object = gInventory.getObject(current_id);
+			}
+		}
+	}
+	return true;
+}
+
 BOOL LLInventoryFilter::checkAgainstPermissions(const LLFolderViewItem* item) const
 {
 	const LLFolderViewEventListener* listener = item->getListener();
@@ -244,6 +364,17 @@ BOOL LLInventoryFilter::checkAgainstPermissions(const LLFolderViewItem* item) co
 	return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions;
 }
 
+bool LLInventoryFilter::checkAgainstPermissions(const LLInventoryItem* item) const
+{
+	if (!item) return false;
+
+	LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+	PermissionMask perm = new_item->getPermissionMask();
+	new_item = NULL;
+
+	return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions;
+}
+
 BOOL LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewItem* item) const
 {
 	const LLFolderViewEventListener* listener = item->getListener();
@@ -286,7 +417,7 @@ BOOL LLInventoryFilter::isNotDefault() const
 	not_default |= (mFilterOps.mMinDate != mDefaultFilterOps.mMinDate);
 	not_default |= (mFilterOps.mMaxDate != mDefaultFilterOps.mMaxDate);
 	not_default |= (mFilterOps.mHoursAgo != mDefaultFilterOps.mHoursAgo);
-
+	
 	return not_default;
 }
 
@@ -464,7 +595,15 @@ void LLInventoryFilter::setDateRange(time_t min_date, time_t max_date)
 		mFilterOps.mMaxDate = llmax(mFilterOps.mMinDate, max_date);
 		setModified();
 	}
-	mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+
+	if (areDateLimitsSet())
+	{
+		mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+	}
+	else
+	{
+		mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE;
+	}
 }
 
 void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl)
@@ -476,10 +615,18 @@ void LLInventoryFilter::setDateRangeLastLogoff(BOOL sl)
 	}
 	if (!sl && isSinceLogoff())
 	{
-		setDateRange(0, time_max());
+		setDateRange(time_min(), time_max());
 		setModified();
 	}
-	mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+
+	if (areDateLimitsSet())
+	{
+		mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+	}
+	else
+	{
+		mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE;
+	}
 }
 
 BOOL LLInventoryFilter::isSinceLogoff() const
@@ -524,7 +671,15 @@ void LLInventoryFilter::setHoursAgo(U32 hours)
 			setModified(FILTER_RESTART);
 		}
 	}
-	mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+
+	if (areDateLimitsSet())
+	{
+		mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
+	}
+	else
+	{
+		mFilterOps.mFilterTypes &= ~FILTERTYPE_DATE;
+	}
 }
 
 void LLInventoryFilter::setFilterLinks(U64 filter_links)
@@ -804,7 +959,7 @@ const std::string& LLInventoryFilter::getFilterText()
 		filtered_by_all_types = FALSE;
 	}
 
-	if (!LLInventoryModelBackgroundFetch::instance().backgroundFetchActive()
+	if (!LLInventoryModelBackgroundFetch::instance().folderFetchActive()
 		&& filtered_by_type
 		&& !filtered_by_all_types)
 	{
@@ -848,7 +1003,7 @@ void LLInventoryFilter::fromLLSD(LLSD& data)
 {
 	if(data.has("filter_types"))
 	{
-		setFilterObjectTypes((U32)data["filter_types"].asInteger());
+		setFilterObjectTypes((U64)data["filter_types"].asInteger());
 	}
 
 	if(data.has("min_date") && data.has("max_date"))
@@ -974,3 +1129,10 @@ const std::string& LLInventoryFilter::getEmptyLookupMessage() const
 	return mEmptyLookupMessage;
 
 }
+
+bool LLInventoryFilter::areDateLimitsSet()
+{
+	return     mFilterOps.mMinDate != time_min()
+			|| mFilterOps.mMaxDate != time_max()
+			|| mFilterOps.mHoursAgo != 0;
+}
diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h
index bba24ac65290b9f9e12463af3061e54b7fd41c23..1804637a040a0f742e85665e3ac15ff965cef3a2 100644
--- a/indra/newview/llinventoryfilter.h
+++ b/indra/newview/llinventoryfilter.h
@@ -32,6 +32,7 @@
 
 class LLFolderViewItem;
 class LLFolderViewFolder;
+class LLInventoryItem;
 
 class LLInventoryFilter
 {
@@ -115,10 +116,15 @@ class LLInventoryFilter
 	// + Execution And Results
 	// +-------------------------------------------------------------------+
 	BOOL 				check(const LLFolderViewItem* item);
-	bool				checkFolder(const LLFolderViewFolder* folder);
+	bool				check(const LLInventoryItem* item);
+	bool				checkFolder(const LLFolderViewFolder* folder) const;
+	bool				checkFolder(const LLUUID& folder_id) const;
 	BOOL 				checkAgainstFilterType(const LLFolderViewItem* item) const;
+	bool 				checkAgainstFilterType(const LLInventoryItem* item) const;
 	BOOL 				checkAgainstPermissions(const LLFolderViewItem* item) const;
+	bool 				checkAgainstPermissions(const LLInventoryItem* item) const;
 	BOOL 				checkAgainstFilterLinks(const LLFolderViewItem* item) const;
+	bool				checkAgainstClipboard(const LLUUID& object_id) const;
 
 	std::string::size_type getStringMatchOffset() const;
 
@@ -175,6 +181,8 @@ class LLInventoryFilter
 	void 				fromLLSD(LLSD& data);
 
 private:
+	bool				areDateLimitsSet();
+
 	struct FilterOps
 	{
 		FilterOps();
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index dd92188e9d2d0367d0eb8acfda16375249bac2bd..236c997ef618d477e6e98ebd3deebb1555fb0ab6 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -54,7 +54,6 @@
 #include "lliconctrl.h"
 #include "llimview.h"
 #include "llinventorybridge.h"
-#include "llinventoryclipboard.h"
 #include "llinventorymodel.h"
 #include "llinventorypanel.h"
 #include "lllineeditor.h"
@@ -161,6 +160,31 @@ void change_category_parent(LLInventoryModel* model,
 	model->notifyObservers();
 }
 
+// Move the item to the trash. Works for folders and objects.
+// Caution: This method assumes that the item is removable!
+void remove_item(LLInventoryModel* model, const LLUUID& id)
+{
+	LLViewerInventoryItem* item = model->getItem(id);
+	if (!item)
+		return;
+	
+	if (item->getType() == LLAssetType::AT_CATEGORY)
+	{
+		// Call the general helper function to delete a folder
+		remove_category(model, id);
+	}
+	else
+	{
+		// Get the trash UUID
+		LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH, false);
+		if (trash_id.notNull())
+		{
+			// Finally, move the item to the trash
+			change_item_parent(model, item, trash_id, true);
+		}
+	}
+}
+
 void remove_category(LLInventoryModel* model, const LLUUID& cat_id)
 {
 	if (!model || !get_is_category_removable(model, cat_id))
@@ -214,6 +238,49 @@ void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::s
 	model->notifyObservers();
 }
 
+void copy_inventory_category(LLInventoryModel* model,
+							 LLViewerInventoryCategory* cat,
+							 const LLUUID& parent_id,
+							 const LLUUID& root_copy_id)
+{
+	// Create the initial folder
+	LLUUID new_cat_uuid = gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName());
+	model->notifyObservers();
+	
+	// We need to exclude the initial root of the copy to avoid recursively copying the copy, etc...
+	LLUUID root_id = (root_copy_id.isNull() ? new_cat_uuid : root_copy_id);
+
+	// Get the content of the folder
+	LLInventoryModel::cat_array_t* cat_array;
+	LLInventoryModel::item_array_t* item_array;
+	gInventory.getDirectDescendentsOf(cat->getUUID(),cat_array,item_array);
+
+	// Copy all the items
+	LLInventoryModel::item_array_t item_array_copy = *item_array;
+	for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
+	{
+		LLInventoryItem* item = *iter;
+		copy_inventory_item(
+							gAgent.getID(),
+							item->getPermissions().getOwner(),
+							item->getUUID(),
+							new_cat_uuid,
+							std::string(),
+							LLPointer<LLInventoryCallback>(NULL));
+	}
+	
+	// Copy all the folders
+	LLInventoryModel::cat_array_t cat_array_copy = *cat_array;
+	for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++)
+	{
+		LLViewerInventoryCategory* category = *iter;
+		if (category->getUUID() != root_id)
+		{
+			copy_inventory_category(model, category, new_cat_uuid, root_id);
+		}
+	}
+}
+
 class LLInventoryCollectAllItems : public LLInventoryCollectFunctor
 {
 public:
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index ce2b89b22e67baaeb18d0444590a8cc3665a4e6e..b3d9f4b966a383d87abb0641266bd338d6c0674e 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -62,6 +62,8 @@ void change_item_parent(LLInventoryModel* model,
 									 const LLUUID& new_parent_id,
 									 BOOL restamp);
 
+void remove_item(LLInventoryModel* model, const LLUUID& id);
+
 void change_category_parent(LLInventoryModel* model,
 	LLViewerInventoryCategory* cat,
 	const LLUUID& new_parent_id,
@@ -71,6 +73,8 @@ void remove_category(LLInventoryModel* model, const LLUUID& cat_id);
 
 void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name);
 
+void copy_inventory_category(LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& parent_id, const LLUUID& root_copy_id = LLUUID::null);
+
 // Generates a string containing the path to the item specified by item_id.
 void append_path(const LLUUID& id, std::string& path);
 
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index a71b699fdd7cbef9c6cfa32552192bc453fd8bf8..0eba8bd0f1aa3ceae8a1020e93557d40c2f7ce3e 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -30,6 +30,7 @@
 #include "llagent.h"
 #include "llagentwearables.h"
 #include "llappearancemgr.h"
+#include "llclipboard.h"
 #include "llinventorypanel.h"
 #include "llinventorybridge.h"
 #include "llinventoryfunctions.h"
@@ -1110,50 +1111,82 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id)
 		return;
 	}
 	LLPointer<LLViewerInventoryCategory> cat = getCategory(id);
-	if(cat.notNull())
-	{
-		// do the cache accounting
-		llinfos << "LLInventoryModel::purgeDescendentsOf " << cat->getName()
-				<< llendl;
-		S32 descendents = cat->getDescendentCount();
-		if(descendents > 0)
-		{
-			LLCategoryUpdate up(id, -descendents);
-			accountForUpdate(up);
+	if (cat.notNull())
+	{
+		if (LLClipboard::instance().hasContents() && LLClipboard::instance().isCutMode())
+		{
+			// Something on the clipboard is in "cut mode" and needs to be preserved
+			llinfos << "LLInventoryModel::purgeDescendentsOf " << cat->getName()
+			<< " iterate and purge non hidden items" << llendl;
+			cat_array_t* categories;
+			item_array_t* items;
+			// Get the list of direct descendants in tha categoy passed as argument
+			getDirectDescendentsOf(id, categories, items);
+			std::vector<LLUUID> list_uuids;
+			// Make a unique list with all the UUIDs of the direct descendants (items and categories are not treated differently)
+			// Note: we need to do that shallow copy as purging things will invalidate the categories or items lists
+			for (cat_array_t::const_iterator it = categories->begin(); it != categories->end(); ++it)
+			{
+				list_uuids.push_back((*it)->getUUID());
+			}
+			for (item_array_t::const_iterator it = items->begin(); it != items->end(); ++it)
+			{
+				list_uuids.push_back((*it)->getUUID());
+			}
+			// Iterate through the list and only purge the UUIDs that are not on the clipboard
+			for (std::vector<LLUUID>::const_iterator it = list_uuids.begin(); it != list_uuids.end(); ++it)
+			{
+				if (!LLClipboard::instance().isOnClipboard(*it))
+				{
+					purgeObject(*it);
+				}
+			}
 		}
+		else
+		{
+			// Fast purge
+			// do the cache accounting
+			llinfos << "LLInventoryModel::purgeDescendentsOf " << cat->getName()
+				<< llendl;
+			S32 descendents = cat->getDescendentCount();
+			if(descendents > 0)
+			{
+				LLCategoryUpdate up(id, -descendents);
+				accountForUpdate(up);
+			}
 
-		// we know that descendent count is 0, aide since the
-		// accounting may actually not do an update, we should force
-		// it here.
-		cat->setDescendentCount(0);
+			// we know that descendent count is 0, however since the
+			// accounting may actually not do an update, we should force
+			// it here.
+			cat->setDescendentCount(0);
+
+			// send it upstream
+			LLMessageSystem* msg = gMessageSystem;
+			msg->newMessage("PurgeInventoryDescendents");
+			msg->nextBlock("AgentData");
+			msg->addUUID("AgentID", gAgent.getID());
+			msg->addUUID("SessionID", gAgent.getSessionID());
+			msg->nextBlock("InventoryData");
+			msg->addUUID("FolderID", id);
+			gAgent.sendReliableMessage();
 
-		// send it upstream
-		LLMessageSystem* msg = gMessageSystem;
-		msg->newMessage("PurgeInventoryDescendents");
-		msg->nextBlock("AgentData");
-		msg->addUUID("AgentID", gAgent.getID());
-		msg->addUUID("SessionID", gAgent.getSessionID());
-		msg->nextBlock("InventoryData");
-		msg->addUUID("FolderID", id);
-		gAgent.sendReliableMessage();
-
-		// unceremoniously remove anything we have locally stored.
-		cat_array_t categories;
-		item_array_t items;
-		collectDescendents(id,
-						   categories,
-						   items,
-						   INCLUDE_TRASH);
-		S32 count = items.count();
-		S32 i;
-		for(i = 0; i < count; ++i)
-		{
-			deleteObject(items.get(i)->getUUID());
-		}
-		count = categories.count();
-		for(i = 0; i < count; ++i)
-		{
-			deleteObject(categories.get(i)->getUUID());
+			// unceremoniously remove anything we have locally stored.
+			cat_array_t categories;
+			item_array_t items;
+			collectDescendents(id,
+							   categories,
+							   items,
+							   INCLUDE_TRASH);
+			S32 count = items.count();
+			for(S32 i = 0; i < count; ++i)
+			{
+				deleteObject(items.get(i)->getUUID());
+			}
+			count = categories.count();
+			for(S32 i = 0; i < count; ++i)
+			{
+				deleteObject(categories.get(i)->getUUID());
+			}
 		}
 	}
 }
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index 91fdd678063195234545c8c16e83cc5d6758f17c..f4d0110b0f478114b74ea91d7fb3ed635355713a 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -43,6 +43,7 @@ const S32 MAX_FETCH_RETRIES = 10;
 
 LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch() :
 	mBackgroundFetchActive(FALSE),
+	mFolderFetchActive(false),
 	mAllFoldersFetched(FALSE),
 	mRecursiveInventoryFetchStarted(FALSE),
 	mRecursiveLibraryFetchStarted(FALSE),
@@ -50,7 +51,7 @@ LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch() :
 	mMinTimeBetweenFetches(0.3f),
 	mMaxTimeBetweenFetches(10.f),
 	mTimelyFetchPending(FALSE),
-	mBulkFetchCount(0)
+	mFetchCount(0)
 {
 }
 
@@ -60,7 +61,7 @@ LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch()
 
 bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete() const
 {
-	return mFetchQueue.empty() && mBulkFetchCount<=0;
+	return mFetchQueue.empty() && mFetchCount<=0;
 }
 
 bool LLInventoryModelBackgroundFetch::libraryFetchStarted() const
@@ -98,19 +99,21 @@ bool LLInventoryModelBackgroundFetch::isEverythingFetched() const
 	return mAllFoldersFetched;
 }
 
-BOOL LLInventoryModelBackgroundFetch::backgroundFetchActive() const
+BOOL LLInventoryModelBackgroundFetch::folderFetchActive() const
 {
-	return mBackgroundFetchActive;
+	return mFolderFetchActive;
 }
 
-void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id, BOOL recursive)
+void LLInventoryModelBackgroundFetch::start(const LLUUID& id, BOOL recursive)
 {
-	if (!mAllFoldersFetched || cat_id.notNull())
-	{
-		LL_DEBUGS("InventoryFetch") << "Start fetching category: " << cat_id << ", recursive: " << recursive << LL_ENDL;
+	LLViewerInventoryCategory* cat = gInventory.getCategory(id);
+	if (cat || (id.isNull() && !isEverythingFetched()))
+	{	// it's a folder, do a bulk fetch
+		LL_DEBUGS("InventoryFetch") << "Start fetching category: " << id << ", recursive: " << recursive << LL_ENDL;
 
 		mBackgroundFetchActive = TRUE;
-		if (cat_id.isNull())
+		mFolderFetchActive = true;
+		if (id.isNull())
 		{
 			if (!mRecursiveInventoryFetchStarted)
 			{
@@ -128,41 +131,41 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id, BOOL recursive
 		else
 		{
 			// Specific folder requests go to front of queue.
-			if (mFetchQueue.empty() || mFetchQueue.front().mCatUUID != cat_id)
+			if (mFetchQueue.empty() || mFetchQueue.front().mUUID != id)
 			{
-				mFetchQueue.push_front(FetchQueueInfo(cat_id, recursive));
+				mFetchQueue.push_front(FetchQueueInfo(id, recursive));
 				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
 			}
-			if (cat_id == gInventory.getLibraryRootFolderID())
+			if (id == gInventory.getLibraryRootFolderID())
 			{
 				mRecursiveLibraryFetchStarted |= recursive;
 			}
-			if (cat_id == gInventory.getRootFolderID())
+			if (id == gInventory.getRootFolderID())
 			{
 				mRecursiveInventoryFetchStarted |= recursive;
 			}
 		}
 	}
+	else if (LLViewerInventoryItem* itemp = gInventory.getItem(id))
+	{
+		if (!itemp->mIsComplete && (mFetchQueue.empty() || mFetchQueue.front().mUUID != id))
+		{
+			mBackgroundFetchActive = TRUE;
+
+			mFetchQueue.push_front(FetchQueueInfo(id, false, false));
+			gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+		}
+	}
 }
 
 void LLInventoryModelBackgroundFetch::findLostItems()
 {
 	mBackgroundFetchActive = TRUE;
+	mFolderFetchActive = true;
     mFetchQueue.push_back(FetchQueueInfo(LLUUID::null, TRUE));
     gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
 }
 
-void LLInventoryModelBackgroundFetch::stopBackgroundFetch()
-{
-	if (mBackgroundFetchActive)
-	{
-		mBackgroundFetchActive = FALSE;
-		gIdleCallbacks.deleteFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
-		mBulkFetchCount=0;
-		mMinTimeBetweenFetches=0.0f;
-	}
-}
-
 void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
 {
 	if (mRecursiveInventoryFetchStarted &&
@@ -170,7 +173,7 @@ void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
 	{
 		mAllFoldersFetched = TRUE;
 	}
-	stopBackgroundFetch();
+	mFolderFetchActive = false;
 }
 
 void LLInventoryModelBackgroundFetch::backgroundFetchCB(void *)
@@ -183,10 +186,9 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 	if (mBackgroundFetchActive && gAgent.getRegion())
 	{
 		// If we'll be using the capability, we'll be sending batches and the background thing isn't as important.
-		std::string url = gAgent.getRegion()->getCapability("FetchInventoryDescendents2");   
-		if (gSavedSettings.getBOOL("UseHTTPInventory") && !url.empty()) 
+		if (gSavedSettings.getBOOL("UseHTTPInventory")) 
 		{
-			bulkFetch(url);
+			bulkFetch();
 			return;
 		}
 		
@@ -201,6 +203,9 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 			llinfos << "Inventory fetch completed" << llendl;
 
 			setAllFoldersFetched();
+			mBackgroundFetchActive = false;
+			mFolderFetchActive = false;
+
 			return;
 		}
 
@@ -230,80 +235,114 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 			}
 
 			const FetchQueueInfo info = mFetchQueue.front();
-			LLViewerInventoryCategory* cat = gInventory.getCategory(info.mCatUUID);
 
-			// Category has been deleted, remove from queue.
-			if (!cat)
+			if (info.mIsCategory)
 			{
-				mFetchQueue.pop_front();
-				continue;
-			}
+
+				LLViewerInventoryCategory* cat = gInventory.getCategory(info.mUUID);
+
+				// Category has been deleted, remove from queue.
+				if (!cat)
+				{
+					mFetchQueue.pop_front();
+					continue;
+				}
 			
-			if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches && 
-				LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
-			{
-				// Category exists but has no children yet, fetch the descendants
-				// for now, just request every time and rely on retry timer to throttle.
-				if (cat->fetch())
+				if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches && 
+					LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
 				{
-					mFetchTimer.reset();
-					mTimelyFetchPending = TRUE;
+					// Category exists but has no children yet, fetch the descendants
+					// for now, just request every time and rely on retry timer to throttle.
+					if (cat->fetch())
+					{
+						mFetchTimer.reset();
+						mTimelyFetchPending = TRUE;
+					}
+					else
+					{
+						//  The catagory also tracks if it has expired and here it says it hasn't
+						//  yet.  Get out of here because nothing is going to happen until we
+						//  update the timers.
+						break;
+					}
 				}
-				else
+				// Do I have all my children?
+				else if (gInventory.isCategoryComplete(info.mUUID))
 				{
-					//  The catagory also tracks if it has expired and here it says it hasn't
-					//  yet.  Get out of here because nothing is going to happen until we
-					//  update the timers.
+					// Finished with this category, remove from queue.
+					mFetchQueue.pop_front();
+
+					// Add all children to queue.
+					LLInventoryModel::cat_array_t* categories;
+					LLInventoryModel::item_array_t* items;
+					gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
+					for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
+						 it != categories->end();
+						 ++it)
+					{
+						mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(),info.mRecursive));
+					}
+
+					// We received a response in less than the fast time.
+					if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() < fast_fetch_time)
+					{
+						// Shrink timeouts based on success.
+						mMinTimeBetweenFetches = llmax(mMinTimeBetweenFetches * 0.8f, 0.3f);
+						mMaxTimeBetweenFetches = llmax(mMaxTimeBetweenFetches * 0.8f, 10.f);
+						lldebugs << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl;
+					}
+
+					mTimelyFetchPending = FALSE;
+					continue;
+				}
+				else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches)
+				{
+					// Received first packet, but our num descendants does not match db's num descendants
+					// so try again later.
+					mFetchQueue.pop_front();
+
+					if (mNumFetchRetries++ < MAX_FETCH_RETRIES)
+					{
+						// push on back of queue
+						mFetchQueue.push_back(info);
+					}
+					mTimelyFetchPending = FALSE;
+					mFetchTimer.reset();
 					break;
 				}
+
+				// Not enough time has elapsed to do a new fetch
+				break;
 			}
-			// Do I have all my children?
-			else if (gInventory.isCategoryComplete(info.mCatUUID))
+			else
 			{
-				// Finished with this category, remove from queue.
-				mFetchQueue.pop_front();
+				LLViewerInventoryItem* itemp = gInventory.getItem(info.mUUID);
 
-				// Add all children to queue.
-				LLInventoryModel::cat_array_t* categories;
-				LLInventoryModel::item_array_t* items;
-				gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
-				for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
-					 it != categories->end();
-					 ++it)
+				mFetchQueue.pop_front();
+				if (!itemp) 
 				{
-					mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(),info.mRecursive));
+					continue;
 				}
 
-				// We received a response in less than the fast time.
-				if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() < fast_fetch_time)
+				if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches)
 				{
-					// Shrink timeouts based on success.
-					mMinTimeBetweenFetches = llmax(mMinTimeBetweenFetches * 0.8f, 0.3f);
-					mMaxTimeBetweenFetches = llmax(mMaxTimeBetweenFetches * 0.8f, 10.f);
-					lldebugs << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl;
+					itemp->fetchFromServer();
+					mFetchTimer.reset();
+					mTimelyFetchPending = TRUE;
 				}
-
-				mTimelyFetchPending = FALSE;
-				continue;
-			}
-			else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches)
-			{
-				// Received first packet, but our num descendants does not match db's num descendants
-				// so try again later.
-				mFetchQueue.pop_front();
-
-				if (mNumFetchRetries++ < MAX_FETCH_RETRIES)
+				else if (itemp->mIsComplete)
+				{
+					mTimelyFetchPending = FALSE;
+				}
+				else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches)
 				{
-					// push on back of queue
 					mFetchQueue.push_back(info);
+					mFetchTimer.reset();
+					mTimelyFetchPending = FALSE;
 				}
-				mTimelyFetchPending = FALSE;
-				mFetchTimer.reset();
+				// Not enough time has elapsed to do a new fetch
 				break;
 			}
-
-			// Not enough time has elapsed to do a new fetch
-			break;
 		}
 
 		//
@@ -313,15 +352,35 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 	}
 }
 
-void LLInventoryModelBackgroundFetch::incrBulkFetch(S16 fetching) 
+void LLInventoryModelBackgroundFetch::incrFetchCount(S16 fetching) 
 {  
-	mBulkFetchCount += fetching; 
-	if (mBulkFetchCount < 0)
+	mFetchCount += fetching; 
+	if (mFetchCount < 0)
 	{
-		mBulkFetchCount = 0; 
+		mFetchCount = 0; 
 	}
 }
 
+class LLInventoryModelFetchItemResponder : public LLInventoryModel::fetchInventoryResponder
+{
+public:
+	LLInventoryModelFetchItemResponder(const LLSD& request_sd) : LLInventoryModel::fetchInventoryResponder(request_sd) {};
+	void result(const LLSD& content);			
+	void error(U32 status, const std::string& reason);
+};
+
+void LLInventoryModelFetchItemResponder::result( const LLSD& content )
+{
+	LLInventoryModel::fetchInventoryResponder::result(content);
+	LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1);
+}
+
+void LLInventoryModelFetchItemResponder::error( U32 status, const std::string& reason )
+{
+	LLInventoryModel::fetchInventoryResponder::error(status, reason);
+	LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1);
+}
+
 
 class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::Responder
 {
@@ -458,7 +517,7 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
 		}
 	}
 
-	fetcher->incrBulkFetch(-1);
+	fetcher->incrFetchCount(-1);
 	
 	if (fetcher->isBulkFetchProcessingComplete())
 	{
@@ -477,7 +536,7 @@ void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::str
 	llinfos << "LLInventoryModelFetchDescendentsResponder::error "
 		<< status << ": " << reason << llendl;
 						
-	fetcher->incrBulkFetch(-1);
+	fetcher->incrFetchCount(-1);
 
 	if (status==499) // timed out
 	{
@@ -508,12 +567,13 @@ BOOL LLInventoryModelFetchDescendentsResponder::getIsRecursive(const LLUUID& cat
 
 // Bundle up a bunch of requests to send all at once.
 // static   
-void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
+void LLInventoryModelBackgroundFetch::bulkFetch()
 {
 	//Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped.
 	//If there are items in mFetchQueue, we want to check the time since the last bulkFetch was 
 	//sent.  If it exceeds our retry time, go ahead and fire off another batch.  
-	//Stopbackgroundfetch will be run from the Responder instead of here.  
+	LLViewerRegion* region = gAgent.getRegion();
+	if (!region) return;
 
 	S16 max_concurrent_fetches=8;
 	F32 new_min_time = 0.5f;			//HACK!  Clean this up when old code goes away entirely.
@@ -523,12 +583,13 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
 	}
 	
 	if (gDisconnected ||
-		(mBulkFetchCount > max_concurrent_fetches) ||
+		(mFetchCount > max_concurrent_fetches) ||
 		(mFetchTimer.getElapsedTimeF32() < mMinTimeBetweenFetches))
 	{
 		return; // just bail if we are disconnected
 	}	
 
+	U32 item_count=0;
 	U32 folder_count=0;
 	U32 max_batch_size=5;
 
@@ -536,83 +597,159 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
 
 	uuid_vec_t recursive_cats;
 
-	LLSD body;
-	LLSD body_lib;
+	LLSD folder_request_body;
+	LLSD folder_request_body_lib;
+	LLSD item_request_body;
+	LLSD item_request_body_lib;
 
-	while (!(mFetchQueue.empty()) && (folder_count < max_batch_size))
+	while (!mFetchQueue.empty() 
+			&& (item_count + folder_count) < max_batch_size)
 	{
 		const FetchQueueInfo& fetch_info = mFetchQueue.front();
-		const LLUUID &cat_id = fetch_info.mCatUUID;
-        if (cat_id.isNull()) //DEV-17797
-        {
-			LLSD folder_sd;
-			folder_sd["folder_id"]		= LLUUID::null.asString();
-			folder_sd["owner_id"]		= gAgent.getID();
-			folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
-			folder_sd["fetch_folders"]	= (LLSD::Boolean)FALSE;
-			folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
-			body["folders"].append(folder_sd);
-            folder_count++;
-        }
-        else
-        {
-		    const LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+		if (fetch_info.mIsCategory)
+		{
+			const LLUUID &cat_id = fetch_info.mUUID;
+			if (cat_id.isNull()) //DEV-17797
+			{
+				LLSD folder_sd;
+				folder_sd["folder_id"]		= LLUUID::null.asString();
+				folder_sd["owner_id"]		= gAgent.getID();
+				folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
+				folder_sd["fetch_folders"]	= (LLSD::Boolean)FALSE;
+				folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
+				folder_request_body["folders"].append(folder_sd);
+				folder_count++;
+			}
+			else
+			{
+				const LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
 		
-		    if (cat)
-		    {
-			    if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
-			    {
-				    LLSD folder_sd;
-				    folder_sd["folder_id"]		= cat->getUUID();
-				    folder_sd["owner_id"]		= cat->getOwnerID();
-				    folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
-				    folder_sd["fetch_folders"]	= TRUE; //(LLSD::Boolean)sFullFetchStarted;
-				    folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
-				    
-				    if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID())
-					    body_lib["folders"].append(folder_sd);
-				    else
-					    body["folders"].append(folder_sd);
-				    folder_count++;
-			    }
-				// May already have this folder, but append child folders to list.
-			    if (fetch_info.mRecursive)
-			    {	
-					LLInventoryModel::cat_array_t* categories;
-					LLInventoryModel::item_array_t* items;
-					gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
-					for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
-						 it != categories->end();
-						 ++it)
+				if (cat)
+				{
+					if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
 					{
-						mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(), fetch_info.mRecursive));
-				    }
-			    }
-		    }
-        }
-		if (fetch_info.mRecursive)
-			recursive_cats.push_back(cat_id);
+						LLSD folder_sd;
+						folder_sd["folder_id"]		= cat->getUUID();
+						folder_sd["owner_id"]		= cat->getOwnerID();
+						folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
+						folder_sd["fetch_folders"]	= TRUE; //(LLSD::Boolean)sFullFetchStarted;
+						folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
+				    
+						if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID())
+							folder_request_body_lib["folders"].append(folder_sd);
+						else
+							folder_request_body["folders"].append(folder_sd);
+						folder_count++;
+					}
+					// May already have this folder, but append child folders to list.
+					if (fetch_info.mRecursive)
+					{	
+						LLInventoryModel::cat_array_t* categories;
+						LLInventoryModel::item_array_t* items;
+						gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
+						for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
+							 it != categories->end();
+							 ++it)
+						{
+							mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(), fetch_info.mRecursive));
+						}
+					}
+				}
+			}
+			if (fetch_info.mRecursive)
+				recursive_cats.push_back(cat_id);
+		}
+		else
+		{
+			LLViewerInventoryItem* itemp = gInventory.getItem(fetch_info.mUUID);
+			if (itemp)
+			{
+				LLSD item_sd;
+				item_sd["owner_id"] = itemp->getPermissions().getOwner();
+				item_sd["item_id"] = itemp->getUUID();
+				if (itemp->getPermissions().getOwner() == gAgent.getID())
+				{
+					item_request_body.append(item_sd);
+				}
+				else
+				{
+					item_request_body_lib.append(item_sd);
+				}
+				//itemp->fetchFromServer();
+				item_count++;
+			}
+		}
 
 		mFetchQueue.pop_front();
 	}
 		
-	if (folder_count > 0)
+	if (item_count + folder_count > 0)
 	{
-		mBulkFetchCount++;
-		if (body["folders"].size())
+		if (folder_count)
 		{
-			LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(body, recursive_cats);
-			LLHTTPClient::post(url, body, fetcher, 300.0);
+			std::string url = region->getCapability("FetchInventoryDescendents2");   
+			mFetchCount++;
+			if (folder_request_body["folders"].size())
+			{
+				LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body, recursive_cats);
+				LLHTTPClient::post(url, folder_request_body, fetcher, 300.0);
+			}
+			if (folder_request_body_lib["folders"].size())
+			{
+				std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents2");
+
+				LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body_lib, recursive_cats);
+				LLHTTPClient::post(url_lib, folder_request_body_lib, fetcher, 300.0);
+			}
 		}
-		if (body_lib["folders"].size())
+		if (item_count)
 		{
-			std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents2");
-			
-			LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(body_lib, recursive_cats);
-			LLHTTPClient::post(url_lib, body_lib, fetcher, 300.0);
+			std::string url;
+
+			if (item_request_body.size())
+			{
+				mFetchCount++;
+				url = region->getCapability("FetchInventory2");
+				if (!url.empty())
+				{
+					LLSD body;
+					body["agent_id"]	= gAgent.getID();
+					body["items"] = item_request_body;
+
+					LLHTTPClient::post(url, body, new LLInventoryModelFetchItemResponder(body));
+				}
+				//else
+				//{
+				//	LLMessageSystem* msg = gMessageSystem;
+				//	msg->newMessage("FetchInventory");
+				//	msg->nextBlock("AgentData");
+				//	msg->addUUID("AgentID", gAgent.getID());
+				//	msg->addUUID("SessionID", gAgent.getSessionID());
+				//	msg->nextBlock("InventoryData");
+				//	msg->addUUID("OwnerID", mPermissions.getOwner());
+				//	msg->addUUID("ItemID", mUUID);
+				//	gAgent.sendReliableMessage();
+				//}
+			}
+
+			if (item_request_body_lib.size())
+			{
+				mFetchCount++;
+
+				url = region->getCapability("FetchLib2");
+				if (!url.empty())
+				{
+					LLSD body;
+					body["agent_id"]	= gAgent.getID();
+					body["items"] = item_request_body_lib;
+
+					LLHTTPClient::post(url, body, new LLInventoryModelFetchItemResponder(body));
+				}
+			}
 		}
 		mFetchTimer.reset();
 	}
+
 	else if (isBulkFetchProcessingComplete())
 	{
 		setAllFoldersFetched();
@@ -624,7 +761,7 @@ bool LLInventoryModelBackgroundFetch::fetchQueueContainsNoDescendentsOf(const LL
 	for (fetch_queue_t::const_iterator it = mFetchQueue.begin();
 		 it != mFetchQueue.end(); ++it)
 	{
-		const LLUUID& fetch_id = (*it).mCatUUID;
+		const LLUUID& fetch_id = (*it).mUUID;
 		if (gInventory.isObjectDescendentOf(fetch_id, cat_id))
 			return false;
 	}
diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h
index c35c785ceb34dfb7f6f424353aef4517d1a443ef..9dfedddd6d28d8ac82eeef2f9d4103bfa34443ad 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.h
+++ b/indra/newview/llinventorymodelbackgroundfetch.h
@@ -48,7 +48,7 @@ class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackg
 	// This gets triggered when performing a filter-search.
 	void start(const LLUUID& cat_id = LLUUID::null, BOOL recursive = TRUE);
 
-	BOOL backgroundFetchActive() const;
+	BOOL folderFetchActive() const;
 	bool isEverythingFetched() const; // completing the fetch once per session should be sufficient
 
 	bool libraryFetchStarted() const;
@@ -60,14 +60,13 @@ class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackg
 	bool inventoryFetchInProgress() const;
 
     void findLostItems();	
+	void incrFetchCount(S16 fetching);
 protected:
-	void incrBulkFetch(S16 fetching);
 	bool isBulkFetchProcessingComplete() const;
-	void bulkFetch(std::string url);
+	void bulkFetch();
 
 	void backgroundFetch();
 	static void backgroundFetchCB(void*); // background fetch idle function
-	void stopBackgroundFetch(); // stop fetch process
 
 	void setAllFoldersFetched();
 	bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id) const;
@@ -77,7 +76,8 @@ class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackg
 	BOOL mAllFoldersFetched;
 
 	BOOL mBackgroundFetchActive;
-	S16 mBulkFetchCount;
+	bool mFolderFetchActive;
+	S16 mFetchCount;
 	BOOL mTimelyFetchPending;
 	S32 mNumFetchRetries;
 
@@ -87,11 +87,11 @@ class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackg
 
 	struct FetchQueueInfo
 	{
-		FetchQueueInfo(const LLUUID& id, BOOL recursive) :
-			mCatUUID(id), mRecursive(recursive)
-		{
-		}
-		LLUUID mCatUUID;
+		FetchQueueInfo(const LLUUID& id, BOOL recursive, bool is_category = true) :
+			mUUID(id), mRecursive(recursive), mIsCategory(is_category)
+		{}
+		LLUUID mUUID;
+		bool mIsCategory;
 		BOOL mRecursive;
 	};
 	typedef std::deque<FetchQueueInfo> fetch_queue_t;
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 382569fa3a34c40586a1b45cab908c3202302f28..71dd963f28c0dcc8ebd3a2a537cb7cb865293083 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -33,6 +33,7 @@
 #include "llagentwearables.h"
 #include "llappearancemgr.h"
 #include "llavataractions.h"
+#include "llclipboard.h"
 #include "llfloaterinventory.h"
 #include "llfloaterreg.h"
 #include "llfloatersidepanelcontainer.h"
@@ -206,10 +207,11 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
 		scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom);
 		LLScrollContainer::Params scroller_params(params.scroll());
 		scroller_params.rect(scroller_view_rect);
-		mScroller = LLUICtrlFactory::create<LLScrollContainer>(scroller_params);
+		mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params);
 		addChild(mScroller);
 		mScroller->addChild(mFolderRoot);
 		mFolderRoot->setScrollContainer(mScroller);
+		mFolderRoot->setFollowsAll();
 		mFolderRoot->addChild(mFolderRoot->mStatusTextBox);
 	}
 
@@ -247,6 +249,9 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
 		getFilter()->setFilterEmptySystemFolders();
 	}
 	
+	// keep track of the clipboard state so that we avoid filtering too much
+	mClipboardState = LLClipboard::instance().getGeneration();
+	
 	// Initialize base class params.
 	LLPanel::initFromParams(params);
 }
@@ -277,6 +282,14 @@ void LLInventoryPanel::draw()
 {
 	// Select the desired item (in case it wasn't loaded when the selection was requested)
 	mFolderRoot->updateSelection();
+	
+	// Nudge the filter if the clipboard state changed
+	if (mClipboardState != LLClipboard::instance().getGeneration())
+	{
+		mClipboardState = LLClipboard::instance().getGeneration();
+		getFilter()->setModified(LLClipboard::instance().isCutMode() ? LLInventoryFilter::FILTER_MORE_RESTRICTIVE : LLInventoryFilter::FILTER_LESS_RESTRICTIVE);
+	}
+	
 	LLPanel::draw();
 }
 
@@ -817,7 +830,7 @@ BOOL LLInventoryPanel::handleHover(S32 x, S32 y, MASK mask)
 	if(handled)
 	{
 		ECursorType cursor = getWindow()->getCursor();
-		if (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() && cursor == UI_CURSOR_ARROW)
+		if (LLInventoryModelBackgroundFetch::instance().folderFetchActive() && cursor == UI_CURSOR_ARROW)
 		{
 			// replace arrow cursor with arrow and hourglass cursor
 			getWindow()->setCursor(UI_CURSOR_WORKING);
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 8279163762fbebca43820b499d445397500cbf36..6db59afb9b92a7a967a3bf5d81e4aeb30ac50b86 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -160,6 +160,8 @@ class LLInventoryPanel : public LLPanel
 	
 	void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
 	
+	LLHandle<LLInventoryPanel> getInventoryPanelHandle() const { return getDerivedHandle<LLInventoryPanel>(); }
+
 	// Callbacks
 	void doToSelected(const LLSD& userdata);
 	void doCreate(const LLSD& userdata);
@@ -220,6 +222,7 @@ class LLInventoryPanel : public LLPanel
 
 private:
 	std::string					mSortOrderSetting;
+	int							mClipboardState;
 
 	//--------------------------------------------------------------------
 	// Hidden folders
diff --git a/indra/newview/llmemoryview.cpp b/indra/newview/llmemoryview.cpp
index 7e9c3c84a742147582dbf636ecce9f7c821f9f8a..c0a323d6cb3afeb81838d5bf35d9f70c41037624 100644
--- a/indra/newview/llmemoryview.cpp
+++ b/indra/newview/llmemoryview.cpp
@@ -220,7 +220,7 @@ void LLMemoryView::draw()
 	S32 x, y;
 
 	S32 margin = 10;
-	S32 texth = (S32)LLFontGL::getFontMonospace()->getLineHeight();
+	S32 texth = LLFontGL::getFontMonospace()->getLineHeight();
 
 	S32 xleft = margin;
 	S32 ytop = height - margin;
diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h
index 04e157008111bf7c43e51933aad8876dc8884caf..7a70370fe33519106950250dd2f98d197ac25bdd 100644
--- a/indra/newview/llmutelist.h
+++ b/indra/newview/llmutelist.h
@@ -29,6 +29,7 @@
 
 #include "llstring.h"
 #include "lluuid.h"
+#include "llextendedstatus.h"
 
 class LLViewerObject;
 class LLMessageSystem;
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index 4512c14b7a85f2ffb145d355979739539139cd38..b4224e30e688d884104a85403e20e022f98fdfad 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -124,7 +124,7 @@ BOOL LLNearbyChatBar::postBuild()
 // virtual
 void LLNearbyChatBar::onOpen(const LLSD& key)
 {
-	enableTranslationCheckbox(LLTranslate::isTranslationConfigured());
+	showTranslationCheckbox(LLTranslate::isTranslationConfigured());
 }
 
 bool LLNearbyChatBar::applyRectControl()
@@ -170,9 +170,9 @@ void LLNearbyChatBar::showHistory()
 	}
 }
 
-void LLNearbyChatBar::enableTranslationCheckbox(BOOL enable)
+void LLNearbyChatBar::showTranslationCheckbox(BOOL show)
 {
-	getChild<LLUICtrl>("translate_chat_checkbox")->setEnabled(enable);
+	getChild<LLUICtrl>("translate_chat_checkbox_lp")->setVisible(show);
 }
 
 void LLNearbyChatBar::draw()
diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h
index baf12a06ea07cecad402b904ff6631a2bcf9ac16..8547cf0bcedbf83b5a05bc61d1fbcce8d4508d92 100644
--- a/indra/newview/llnearbychatbar.h
+++ b/indra/newview/llnearbychatbar.h
@@ -61,7 +61,7 @@ class LLNearbyChatBar :	public LLFloater
 	static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate);
 
 	void showHistory();
-	void enableTranslationCheckbox(BOOL enable);
+	void showTranslationCheckbox(BOOL show);
 	/*virtual*/void setMinimized(BOOL b);
 
 protected:
diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h
index 20fcee0814bf2ff1db301dddf3e4028b06e4c47e..1f7e7d68c60ffea70a2382de406fb00f5d1e4b62 100644
--- a/indra/newview/llnetmap.h
+++ b/indra/newview/llnetmap.h
@@ -33,9 +33,9 @@
 #include "v3dmath.h"
 #include "v4color.h"
 #include "llpointer.h"
+#include "llcoord.h"
 
 class LLColor4U;
-class LLCoordGL;
 class LLImageRaw;
 class LLViewerTexture;
 class LLFloaterMap;
diff --git a/indra/newview/llnotificationmanager.cpp b/indra/newview/llnotificationmanager.cpp
index 6105eff8ea6e4352e979e08af664f794c6051040..f792f53ac58d76c08bde206a55fa0a20283eaa51 100644
--- a/indra/newview/llnotificationmanager.cpp
+++ b/indra/newview/llnotificationmanager.cpp
@@ -35,6 +35,7 @@
 #include "llnotifications.h"
 
 #include <boost/bind.hpp>
+#include <boost/foreach.hpp>
 
 using namespace LLNotificationsUI;
 
@@ -48,6 +49,10 @@ LLNotificationManager::LLNotificationManager()
 //--------------------------------------------------------------------------
 LLNotificationManager::~LLNotificationManager()
 {
+	BOOST_FOREACH(listener_pair_t& pair, mChannelListeners)
+	{
+		pair.second.disconnect();
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -64,16 +69,16 @@ void LLNotificationManager::init()
 	LLNotificationChannel::buildChannel("Browser", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "browser"));
 	LLNotificationChannel::buildChannel("Outbox", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "outbox"));
   
-	LLNotifications::instance().getChannel("Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("NotificationTips")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("Group Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("Alerts")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("AlertModal")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("IM Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("Offer")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
-	LLNotifications::instance().getChannel("Hints")->connectChanged(boost::bind(&LLHintHandler::processNotification, LLHintHandler::getInstance(), _1));
-	LLNotifications::instance().getChannel("Browser")->connectChanged(boost::bind(&LLBrowserNotification::processNotification, LLBrowserNotification::getInstance(), _1));
-	LLNotifications::instance().getChannel("Outbox")->connectChanged(boost::bind(&LLOutboxNotification::processNotification, LLOutboxNotification::getInstance(), _1));
+	mChannelListeners["Notifications"] = LLNotifications::instance().getChannel("Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["NotificationTips"] = LLNotifications::instance().getChannel("NotificationTips")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["Group Notifications"] = LLNotifications::instance().getChannel("Group Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["Alerts"] = LLNotifications::instance().getChannel("Alerts")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["AlertModal"] = LLNotifications::instance().getChannel("AlertModal")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["IM Notifications"] = LLNotifications::instance().getChannel("IM Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["Offer"] = LLNotifications::instance().getChannel("Offer")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
+	mChannelListeners["Hints"] = LLNotifications::instance().getChannel("Hints")->connectChanged(boost::bind(&LLHintHandler::processNotification, LLHintHandler::getInstance(), _1));
+	mChannelListeners["Browser"] = LLNotifications::instance().getChannel("Browser")->connectChanged(boost::bind(&LLBrowserNotification::processNotification, LLBrowserNotification::getInstance(), _1));
+	mChannelListeners["Outbox"] = LLNotifications::instance().getChannel("Outbox")->connectChanged(boost::bind(&LLOutboxNotification::processNotification, LLOutboxNotification::getInstance(), _1));
 
 	mNotifyHandlers["notify"] = boost::shared_ptr<LLEventHandler>(new LLScriptHandler(NT_NOTIFY, LLSD()));
 	mNotifyHandlers["notifytip"] =  boost::shared_ptr<LLEventHandler>(new LLTipHandler(NT_NOTIFY, LLSD()));
@@ -92,6 +97,9 @@ bool LLNotificationManager::onNotification(const LLSD& notify)
 {
 	LLSysHandler* handle = NULL;
 
+	if (LLNotifications::destroyed())
+		return false;
+
 	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
 	
 	if (!notification) 
diff --git a/indra/newview/llnotificationmanager.h b/indra/newview/llnotificationmanager.h
index 16e82e4cce025aee80e151b34513b19720d59c2a..27b6ba1c7173521cd059d67f57004c943a3a616a 100644
--- a/indra/newview/llnotificationmanager.h
+++ b/indra/newview/llnotificationmanager.h
@@ -28,6 +28,8 @@
 #ifndef LL_LLNOTIFICATIONMANAGER_H
 #define LL_LLNOTIFICATIONMANAGER_H
 
+#include "llevents.h"
+
 #include "lluictrl.h"
 #include "llnotificationhandler.h"
 
@@ -47,6 +49,7 @@ class LLToast;
 class LLNotificationManager : public LLSingleton<LLNotificationManager>
 {
 	typedef std::pair<std::string, LLEventHandler*> eventhandlers;
+	typedef std::pair<const std::string, LLBoundListener> listener_pair_t;
 public:	
 	LLNotificationManager();	
 	virtual ~LLNotificationManager();
@@ -70,6 +73,8 @@ class LLNotificationManager : public LLSingleton<LLNotificationManager>
 	//TODO (*)
 	std::map<std::string, boost::shared_ptr<LLEventHandler> > mNotifyHandlers;
 	// cruft std::map<std::string, LLChatHandler*> mChatHandlers;
+
+	std::map<std::string, LLBoundListener> mChannelListeners;
 };
 
 }
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index a4f6921f9879ee4c4d73bc1347808c58d05b2540..7301b305b2d54182110e48c6caf68e360a47c379 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -875,8 +875,15 @@ void LLPanelFace::getState()
 			{
 				getChild<LLUICtrl>("TexScaleU")->setValue(2.0f * getChild<LLUICtrl>("TexScaleU")->getValue().asReal() );
 				getChild<LLUICtrl>("TexScaleV")->setValue(2.0f * getChild<LLUICtrl>("TexScaleV")->getValue().asReal() );
-			}
 
+				// EXP-1507 (change label based on the mapping mode)
+				getChild<LLUICtrl>("rpt")->setValue(getString("string repeats per meter"));
+			}
+			else
+			if (selected_texgen == 0)  // FIXME: should not be magic numbers
+			{
+				getChild<LLUICtrl>("rpt")->setValue(getString("string repeats per face"));
+			}
 		}
 
 		{
diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp
index ca48e8561b11aa4b9dbd1fe769717992bb37a227..7a15d931811371ac3dc5bd7fcf22e69c1270416f 100644
--- a/indra/newview/llpanelgroupinvite.cpp
+++ b/indra/newview/llpanelgroupinvite.cpp
@@ -289,12 +289,12 @@ void LLPanelGroupInvite::impl::callbackClickAdd(void* userdata)
 		//Soon the avatar picker will be embedded into this panel
 		//instead of being it's own separate floater.  But that is next week.
 		//This will do for now. -jwolk May 10, 2006
-		LLFloater* parentp;
-
-		parentp = gFloaterView->getParentFloater(panelp);
-		parentp->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(impl::callbackAddUsers, _1,
-																panelp->mImplementation),
-																 TRUE));
+		LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
+			boost::bind(impl::callbackAddUsers, _1, panelp->mImplementation), TRUE);
+		if (picker)
+		{
+			gFloaterView->getParentFloater(panelp)->addDependentFloater(picker);
+		}
 	}
 }
 
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index fbe331c7ab925edef1c90a3faf5bd2e10cf21d76..f825ee3215ba8f15dbbc0a1da8a08c18b63b3129 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -749,7 +749,10 @@ LLPanelGroupMembersSubTab::LLPanelGroupMembersSubTab()
 
 LLPanelGroupMembersSubTab::~LLPanelGroupMembersSubTab()
 {
-	gSavedSettings.setString("GroupMembersSortOrder", mMembersList->getSortColumnName());
+	if (mMembersList)
+	{
+		gSavedSettings.setString("GroupMembersSortOrder", mMembersList->getSortColumnName());
+	}
 }
 
 BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp
index 0295ad151f4b7f733bda7237a1be8703023578d0..eda0749cdb56afb2f9214498b8ddde1e96f7780c 100644
--- a/indra/newview/llpanelimcontrolpanel.cpp
+++ b/indra/newview/llpanelimcontrolpanel.cpp
@@ -374,7 +374,7 @@ void LLPanelGroupControlPanel::draw()
 {
 	// Need to resort the participant list if it's in sort by recent speaker order.
 	if (mParticipantList)
-		mParticipantList->updateRecentSpeakersOrder();
+		mParticipantList->update();
 	LLPanelChatControlPanel::draw();
 }
 
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index c7454e85a91d82929c11adffd9256ff2c645a32d..68a3b6d1cdd5957b8abb76ed6d0676ad1bb2e4b1 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -1149,7 +1149,7 @@ Processes such actions: cut/rename/delete/paste actions
 	- cut/rename/delete in any other accordions
 	- paste - only in Favorites, Landmarks accordions
  3. For Folders we can: perform any action in Landmarks accordion, except Received folder
- 4. We can not paste folders from Clipboard (processed by LLFolderView::canPaste())
+ 4. We can paste folders from Clipboard (processed by LLFolderView::canPaste())
  5. Check LLFolderView/Inventory Bridges rules
  */
 bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFolderViewItem* item) const
@@ -1206,8 +1206,7 @@ bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFold
 
 		if ("cut" == command_name)
 		{
-			// "Cut" disabled for folders. See EXT-8697.
-			can_be_modified = root_folder->canCut() && listenerp->getInventoryType() != LLInventoryType::IT_CATEGORY;
+			can_be_modified = root_folder->canCut();
 		}
 		else if ("rename" == command_name)
 		{
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 058d1ad6bc91433e9e8f656396438753f60bac9c..76aadcd9138d1458bcb886b94e6031ff74a93049 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -216,6 +216,7 @@ void LLPanelLogin::addUsersWithFavoritesToUsername()
 
 void LLPanelLogin::addFavoritesToStartLocation()
 {
+	// Clear the combo.
 	LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
 	if (!combo) return;
 	int num_items = combo->getItemCount();
@@ -223,6 +224,10 @@ void LLPanelLogin::addFavoritesToStartLocation()
 	{
 		combo->remove(i);
 	}
+
+	// Load favorites into the combo.
+	std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
+	std::string canonical_user_name = canonicalize_username(user_defined_name);
 	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
 	LLSD fav_llsd;
 	llifstream file;
@@ -232,15 +237,18 @@ void LLPanelLogin::addFavoritesToStartLocation()
 	for (LLSD::map_const_iterator iter = fav_llsd.beginMap();
 		iter != fav_llsd.endMap(); ++iter)
 	{
-		std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple();
-
 		// The account name in stored_favorites.xml has Resident last name even if user has
 		// a single word account name, so it can be compared case-insensitive with the
 		// user defined "firstname lastname".
-		S32 res = LLStringUtil::compareInsensitive(canonicalize_username(user_defined_name), iter->first);
-		if (res != 0) continue;
+		S32 res = LLStringUtil::compareInsensitive(canonical_user_name, iter->first);
+		if (res != 0)
+		{
+			lldebugs << "Skipping favorites for " << iter->first << llendl;
+			continue;
+		}
 
 		combo->addSeparator();
+		lldebugs << "Loading favorites for " << iter->first << llendl;
 		LLSD user_llsd = iter->second;
 		for (LLSD::array_const_iterator iter1 = user_llsd.beginArray();
 			iter1 != user_llsd.endArray(); ++iter1)
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 374afb90be48eb7f7776f3aad4fa7f72f14e329f..c11597f532366fd793cafca0d26a6910cfcf5336 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -375,7 +375,7 @@ void LLPanelMainInventory::onClearSearch()
 	if (mActivePanel)
 	{
 		mActivePanel->setFilterSubString(LLStringUtil::null);
-		mActivePanel->setFilterTypes(0xffffffff);
+		mActivePanel->setFilterTypes(0xffffffffffffffffULL);
 		mActivePanel->setFilterLinks(LLInventoryFilter::FILTERLINK_INCLUDE_LINKS);
 	}
 
@@ -567,7 +567,7 @@ void LLPanelMainInventory::updateItemcountText()
 
 	std::string text = "";
 
-	if (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive())
+	if (LLInventoryModelBackgroundFetch::instance().folderFetchActive())
 	{
 		text = getString("ItemcountFetching", string_args);
 	}
@@ -726,7 +726,7 @@ void LLFloaterInventoryFinder::updateElementsFromFilter()
 void LLFloaterInventoryFinder::draw()
 {
 	LLMemType mt(LLMemType::MTYPE_INVENTORY_DRAW);
-	U32 filter = 0xffffffff;
+	U64 filter = 0xffffffffffffffffULL;
 	BOOL filtered_by_all_types = TRUE;
 
 	if (!getChild<LLUICtrl>("check_animation")->getValue())
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 98ea6805043ea1f69fb2f251e1553f0caed4a532..1ca24f30316339da42901fe3e6e0acddb20090cc 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -124,7 +124,7 @@ class LLTaskInvFVBridge : public LLFolderViewEventListener
 	virtual void move(LLFolderViewEventListener* parent_listener);
 	virtual BOOL isItemCopyable() const;
 	virtual BOOL copyToClipboard() const;
-	virtual void cutToClipboard();
+	virtual BOOL cutToClipboard() const;
 	virtual BOOL isClipboardPasteable() const;
 	virtual void pasteFromClipboard();
 	virtual void pasteLinkFromClipboard();
@@ -524,8 +524,9 @@ BOOL LLTaskInvFVBridge::copyToClipboard() const
 	return FALSE;
 }
 
-void LLTaskInvFVBridge::cutToClipboard()
+BOOL LLTaskInvFVBridge::cutToClipboard() const
 {
+	return FALSE;
 }
 
 BOOL LLTaskInvFVBridge::isClipboardPasteable() const
@@ -1568,7 +1569,7 @@ void LLPanelObjectInventory::reset()
 	scroll_p.rect(scroller_rect);
 	scroll_p.tab_stop(true);
 	scroll_p.follows.flags(FOLLOWS_ALL);
-	mScroller = LLUICtrlFactory::create<LLScrollContainer>(scroll_p);
+	mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroll_p);
 	addChild(mScroller);
 	mScroller->addChild(mFolders);
 	
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 9c46f04abfd6399862aeb7d968e1e3a11e9f05ba..f1380e7a3628a4bf9e2c754b29dad164fae90315 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -1162,8 +1162,13 @@ void LLPanelPeople::onAddFriendWizButtonClicked()
 {
 	// Show add friend wizard.
 	LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelPeople::onAvatarPicked, _1, _2), FALSE, TRUE);
+	if (!picker)
+	{
+		return;
+	}
+
 	// Need to disable 'ok' button when friend occurs in selection
-	if (picker)	picker->setOkBtnEnableCb(boost::bind(&LLPanelPeople::isItemsFreeOfFriends, this, _1));
+	picker->setOkBtnEnableCb(boost::bind(&LLPanelPeople::isItemsFreeOfFriends, this, _1));
 	LLFloater* root_floater = gFloaterView->getParentFloater(this);
 	if (root_floater)
 	{
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index 39c0628cbe00c04cc3aa65a0b2df88ffaa59ccbd..76d38f067d4e263bd9593a2550737420418f24db 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -818,7 +818,7 @@ bool LLPanelPrimMediaControls::isMouseOver()
 		LLCoordGL cursor_pos_gl;
 		S32 x, y;
 		getWindow()->getCursorPosition(&cursor_pos_window);
-		getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl);
+		cursor_pos_gl = cursor_pos_window.convert();
 				
 		if(mMediaControlsStack->getVisible())
 		{
diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h
index 66956181f2b9d60146d967153711e4189460464b..eeb433e3062e0616dd6e8eeb8e5fa8c4d80db5b8 100644
--- a/indra/newview/llpanelprimmediacontrols.h
+++ b/indra/newview/llpanelprimmediacontrols.h
@@ -30,9 +30,9 @@
 #include "llpanel.h"
 #include "llviewermedia.h"
 #include "llnotificationptr.h"
+#include "llcoord.h"
 
 class LLButton;
-class LLCoordWindow;
 class LLIconCtrl;
 class LLLayoutStack;
 class LLProgressBar;
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index 1f1cccad856bc8890381f08c8af2c771e626b8e7..c63d89fc9812706427b7b41282a38184ca31e8f7 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -358,7 +358,7 @@ void LLTeleportHistoryPanel::ContextMenu::onInfo()
 //static
 void LLTeleportHistoryPanel::ContextMenu::gotSLURLCallback(const std::string& slurl)
 {
-	gClipboard.copyFromString(utf8str_to_wstring(slurl));
+	LLClipboard::instance().copyToClipboard(utf8str_to_wstring(slurl),0,slurl.size());
 }
 
 void LLTeleportHistoryPanel::ContextMenu::onCopyToClipboard()
diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp
index eb4c7572d43c0151119a4500926d437839154b42..280cc11179670ea84450245460433d7890a1cf7f 100644
--- a/indra/newview/llpaneltopinfobar.cpp
+++ b/indra/newview/llpaneltopinfobar.cpp
@@ -467,7 +467,7 @@ void LLPanelTopInfoBar::onContextMenuItemClicked(const LLSD::String& item)
 		LLAgentUI::buildSLURL(slurl, false);
 		LLUIString location_str(slurl.getSLURLString());
 
-		gClipboard.copyFromString(location_str);
+		LLClipboard::instance().copyToClipboard(location_str,0,location_str.length());
 	}
 }
 
diff --git a/indra/newview/llpanelvoiceeffect.cpp b/indra/newview/llpanelvoiceeffect.cpp
index 4bbfec8ab715379d57bd0086ce63f78db90fb650..5fec6d967d4d8978083b15e615d19053e43482c9 100644
--- a/indra/newview/llpanelvoiceeffect.cpp
+++ b/indra/newview/llpanelvoiceeffect.cpp
@@ -123,7 +123,6 @@ void LLPanelVoiceEffect::update(bool list_updated)
 	if (mVoiceEffectCombo)
 	{
 		LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
-		llassert(effect_interface);
 		if (!effect_interface) return;
 		if (list_updated)
 		{
diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp
index e2801c09bde095d5a28b6f26b8c1b9b87cf6518c..3b9934d4be36b08b941ac55b711a455af598fc3d 100644
--- a/indra/newview/llpanelwearing.cpp
+++ b/indra/newview/llpanelwearing.cpp
@@ -302,6 +302,6 @@ void LLPanelWearing::copyToClipboard()
 		}
 	}
 
-	gClipboard.copyFromString(utf8str_to_wstring(text));
+	LLClipboard::instance().copyToClipboard(utf8str_to_wstring(text),0,text.size());
 }
 // EOF
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 5c95e805ce9d9c3e7664b5810c56a849da86bcce..975a6c67d80a57390b6246e939420db6f2df8acd 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -390,7 +390,10 @@ void LLParticipantList::onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param)
 		{
 			const LLPointer<LLSpeaker>& speakerp = *it;
 
-			update_speaker_indicator(list, speakerp->mID, speakerp->mModeratorMutedVoice);
+			if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY)
+			{
+				update_speaker_indicator(list, speakerp->mID, speakerp->mModeratorMutedVoice);
+			}
 		}
 	}
 }
@@ -466,12 +469,12 @@ void LLParticipantList::setValidateSpeakerCallback(validate_speaker_callback_t c
 	mValidateSpeakerCallback = cb;
 }
 
-void LLParticipantList::updateRecentSpeakersOrder()
+void LLParticipantList::update()
 {
+	mSpeakerMgr->update(true);
+
 	if (E_SORT_BY_RECENT_SPEAKERS == getSortOrder() && !isHovered())
 	{
-		// Need to update speakers to sort list correctly
-		mSpeakerMgr->update(true);
 		// Resort avatar list
 		sort();
 	}
@@ -760,6 +763,7 @@ void LLParticipantList::LLParticipantListMenu::toggleMute(const LLSD& userdata,
 	LLPointer<LLSpeaker> speakerp = mParent.mSpeakerMgr->findSpeaker(speaker_id);
 	if (speakerp.isNull())
 	{
+		LL_WARNS("Speakers") << "Speaker " << speaker_id << " not found" << llendl;
 		return;
 	}
 	LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*>(mParent.mAvatarList->getItemByValue(speaker_id));
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index a001d29b671553ec3666047d5461659f99df9eb4..53966c15fe6297096fcbf90892a8a81b44dfe85e 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -72,9 +72,9 @@ class LLParticipantList
 	const EParticipantSortOrder getSortOrder() const;
 
 	/**
-	 * Refreshes the participant list if it's in sort by recent speaker order.
+	 * Refreshes the participant list.
 	 */
-	void updateRecentSpeakersOrder();
+	void update();
 
 	/**
 	 * Set a callback to be called before adding a speaker. Invalid speakers will not be added.
diff --git a/indra/newview/llplacesinventorybridge.cpp b/indra/newview/llplacesinventorybridge.cpp
index 225ac6e224fb06ae6eac3438cc9d16610ca1cded..fe4cc0f55ff5f89a5f93bae0e91d894fd9f806c0 100644
--- a/indra/newview/llplacesinventorybridge.cpp
+++ b/indra/newview/llplacesinventorybridge.cpp
@@ -89,7 +89,7 @@ void LLPlacesFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		std::vector<std::string> items;
 		std::vector<std::string> disabled_items;
 
-		LLInventoryPanel* inv_panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+		LLInventoryPanel* inv_panel = mInventoryPanel.get();
 		bool is_open = false;
 		if (inv_panel)
 		{
@@ -137,7 +137,7 @@ void LLPlacesFolderBridge::performAction(LLInventoryModel* model, std::string ac
 LLFolderViewFolder* LLPlacesFolderBridge::getFolder()
 {
 	LLFolderViewFolder* folder = NULL;
-	LLInventoryPanel* inv_panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+	LLInventoryPanel* inv_panel = mInventoryPanel.get();
 	if (inv_panel)
 	{
 		folder = dynamic_cast<LLFolderViewFolder*>(inv_panel->getRootFolder()->getItemByID(mUUID));
diff --git a/indra/newview/llpopupview.cpp b/indra/newview/llpopupview.cpp
index 9fbb67a63aa436447a7f0fb5e8baa6a699d61330..08829c11840d5fd5b57cdfb2efb1a78048ab90ea 100644
--- a/indra/newview/llpopupview.cpp
+++ b/indra/newview/llpopupview.cpp
@@ -83,7 +83,7 @@ void LLPopupView::draw()
 
 			LLUI::pushMatrix();
 			{
-				LLUI::translate( (F32) screen_x, (F32) screen_y, 0.f);
+				LLUI::translate( (F32) screen_x, (F32) screen_y);
 				popup->draw();
 			}
 			LLUI::popMatrix();
diff --git a/indra/newview/llpreview.h b/indra/newview/llpreview.h
index 896e17c3c31d08024b38681f9eb2374fa8b2bcae..759430c3a5ef6bc1d8a9a4f24222e76da77e0f7d 100644
--- a/indra/newview/llpreview.h
+++ b/indra/newview/llpreview.h
@@ -32,6 +32,7 @@
 #include "llpointer.h"
 #include "lluuid.h"
 #include "llinventoryobserver.h"
+#include "llextendedstatus.h"
 #include <map>
 
 class LLInventoryItem;
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index 5301955964bfc5fac0e0db4d6d27fb47b4487d0b..d340b304ca802bfdabc61484f19023436c7fe8cb 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -195,17 +195,18 @@ LLScreenChannel::~LLScreenChannel()
 	
 }
 
-std::list<LLToast*> LLScreenChannel::findToasts(const Matcher& matcher)
+std::list<const LLToast*> LLScreenChannel::findToasts(const Matcher& matcher)
 {
-	std::list<LLToast*> res;
+	std::list<const LLToast*> res;
 
 	// collect stored toasts
 	for (std::vector<ToastElem>::iterator it = mStoredToastList.begin(); it
 			!= mStoredToastList.end(); it++)
 	{
-		if (matcher.matches(it->toast->getNotification()))
+		const LLToast* toast = it->getToast();
+		if (toast && matcher.matches(toast->getNotification()))
 		{
-			res.push_back(it->toast);
+			res.push_back(toast);
 		}
 	}
 
@@ -213,9 +214,10 @@ std::list<LLToast*> LLScreenChannel::findToasts(const Matcher& matcher)
 	for (std::vector<ToastElem>::iterator it = mToastList.begin(); it
 			!= mToastList.end(); it++)
 	{
-		if (matcher.matches(it->toast->getNotification()))
+		const LLToast* toast = it->getToast();
+		if (toast && matcher.matches(toast->getNotification()))
 		{
-			res.push_back(it->toast);
+			res.push_back(toast);
 		}
 	}
 
@@ -260,15 +262,16 @@ void LLScreenChannel::addToast(const LLToast::Params& p)
 		return;
 	}
 
-	ToastElem new_toast_elem(p);
+	LLToast* toast = new LLToast(p);
+	ToastElem new_toast_elem(toast->getHandle());
 
-	new_toast_elem.toast->setOnFadeCallback(boost::bind(&LLScreenChannel::onToastFade, this, _1));
-	new_toast_elem.toast->setOnToastDestroyedCallback(boost::bind(&LLScreenChannel::onToastDestroyed, this, _1));
+	toast->setOnFadeCallback(boost::bind(&LLScreenChannel::onToastFade, this, _1));
+	toast->setOnToastDestroyedCallback(boost::bind(&LLScreenChannel::onToastDestroyed, this, _1));
 	if(mControlHovering)
 	{
-		new_toast_elem.toast->setOnToastHoverCallback(boost::bind(&LLScreenChannel::onToastHover, this, _1, _2));
-		new_toast_elem.toast->setMouseEnterCallback(boost::bind(&LLScreenChannel::stopToastTimer, this, new_toast_elem.toast));
-		new_toast_elem.toast->setMouseLeaveCallback(boost::bind(&LLScreenChannel::startToastTimer, this, new_toast_elem.toast));
+		toast->setOnToastHoverCallback(boost::bind(&LLScreenChannel::onToastHover, this, _1, _2));
+		toast->setMouseEnterCallback(boost::bind(&LLScreenChannel::stopToastTimer, this, toast));
+		toast->setMouseLeaveCallback(boost::bind(&LLScreenChannel::startToastTimer, this, toast));
 	}
 	
 	if(show_toast)
@@ -340,13 +343,13 @@ void LLScreenChannel::onToastFade(LLToast* toast)
 //--------------------------------------------------------------------------
 void LLScreenChannel::deleteToast(LLToast* toast)
 {
-	if (toast->isDead())
+	if (!toast || toast->isDead())
 	{
 		return;
 	}
 
 	// send signal to observers about destroying of a toast
-	toast->mOnDeleteToastSignal(toast);
+	toast->closeToast();
 	
 	// update channel's Hovering state
 	// turning hovering off manually because onMouseLeave won't happen if a toast was closed using a keyboard
@@ -354,9 +357,6 @@ void LLScreenChannel::deleteToast(LLToast* toast)
 	{
 		mHoveredToast  = NULL;
 	}
-
-	// close the toast
-	toast->closeFloater();
 }
 
 //--------------------------------------------------------------------------
@@ -364,12 +364,16 @@ void LLScreenChannel::deleteToast(LLToast* toast)
 void LLScreenChannel::storeToast(ToastElem& toast_elem)
 {
 	// do not store clones
-	std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(), mStoredToastList.end(), toast_elem.id);
+	std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(), mStoredToastList.end(), toast_elem.getID());
 	if( it != mStoredToastList.end() )
 		return;
 
-	mStoredToastList.push_back(toast_elem);
-	mOnStoreToast(toast_elem.toast->getPanel(), toast_elem.id);
+	const LLToast* toast = toast_elem.getToast();
+	if (toast)
+	{
+		mStoredToastList.push_back(toast_elem);
+		mOnStoreToast(toast->getPanel(), toast->getNotificationID());
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -382,9 +386,13 @@ void LLScreenChannel::loadStoredToastsToChannel()
 
 	for(it = mStoredToastList.begin(); it != mStoredToastList.end(); ++it)
 	{
-		(*it).toast->setIsHidden(false);
-		(*it).toast->startTimer();
-		mToastList.push_back((*it));
+		LLToast* toast = it->getToast();
+		if (toast)
+		{
+			toast->setIsHidden(false);
+			toast->startTimer();
+			mToastList.push_back(*it);
+		}
 	}
 
 	mStoredToastList.clear();
@@ -399,17 +407,19 @@ void LLScreenChannel::loadStoredToastByNotificationIDToChannel(LLUUID id)
 	if( it == mStoredToastList.end() )
 		return;
 
-	LLToast* toast = (*it).toast;
-
-	if(toast->getVisible())
+	LLToast* toast = it->getToast();
+	if (toast)
 	{
-		// toast is already in channel
-		return;
-	}
+		if(toast->getVisible())
+		{
+			// toast is already in channel
+			return;
+		}
 
-	toast->setIsHidden(false);
-	toast->startTimer();
-	mToastList.push_back((*it));
+		toast->setIsHidden(false);
+		toast->startTimer();
+		mToastList.push_back(*it);
+	}
 
 	redrawToasts();
 }
@@ -423,9 +433,19 @@ void LLScreenChannel::removeStoredToastByNotificationID(LLUUID id)
 	if( it == mStoredToastList.end() )
 		return;
 
-	LLToast* toast = (*it).toast;
-	mStoredToastList.erase(it);
-	mRejectToastSignal(toast->getNotificationID());
+	const LLToast* toast = it->getToast();
+	if (toast)
+	{
+		mRejectToastSignal(toast->getNotificationID());
+	}
+
+	// Call find() once more, because the mStoredToastList could have been changed
+	// in mRejectToastSignal callback and the iterator could have become invalid.
+	it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
+	if (it != mStoredToastList.end())
+	{
+		mStoredToastList.erase(it);
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -436,21 +456,22 @@ void LLScreenChannel::killToastByNotificationID(LLUUID id)
 	
 	if( it != mToastList.end())
 	{
-		LLToast* toast = (*it).toast;
+		LLToast* toast = it->getToast();
 		// if it is a notification toast and notification is UnResponded - then respond on it
 		// else - simply destroy a toast
 		//
 		// NOTE:	if a notification is unresponded this function will be called twice for the same toast.
 		//			At first, the notification will be discarded, at second (it will be caused by discarding),
 		//			the toast will be destroyed.
-		if(toast->isNotificationValid())
+		if(toast && toast->isNotificationValid())
 		{
 			mRejectToastSignal(toast->getNotificationID());
 		}
 		else
 		{
-			mToastList.erase(it);
+
 			deleteToast(toast);
+			mToastList.erase(it);
 			redrawToasts();
 		}
 		return;
@@ -459,20 +480,31 @@ void LLScreenChannel::killToastByNotificationID(LLUUID id)
 	// searching among stored toasts
 	it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
 
-	if( it != mStoredToastList.end() )
+	if (it != mStoredToastList.end())
+	{
+		LLToast* toast = it->getToast();
+		if (toast)
+		{
+			// send signal to a listener to let him perform some action on toast rejecting
+			mRejectToastSignal(toast->getNotificationID());
+			deleteToast(toast);
+		}
+	}
+
+	// Call find() once more, because the mStoredToastList could have been changed
+	// in mRejectToastSignal callback and the iterator could have become invalid.
+	it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
+	if (it != mStoredToastList.end())
 	{
-		LLToast* toast = (*it).toast;
 		mStoredToastList.erase(it);
-		// send signal to a listener to let him perform some action on toast rejecting
-		mRejectToastSignal(toast->getNotificationID());
-		deleteToast(toast);
 	}
+
 }
 
 void LLScreenChannel::killMatchedToasts(const Matcher& matcher)
 {
-	std::list<LLToast*> to_delete = findToasts(matcher);
-	for (std::list<LLToast*>::iterator it = to_delete.begin(); it
+	std::list<const LLToast*> to_delete = findToasts(matcher);
+	for (std::list<const LLToast*>::iterator it = to_delete.begin(); it
 			!= to_delete.end(); it++)
 	{
 		killToastByNotificationID((*it)-> getNotificationID());
@@ -486,12 +518,15 @@ void LLScreenChannel::modifyToastByNotificationID(LLUUID id, LLPanel* panel)
 	
 	if( it != mToastList.end() && panel)
 	{
-		LLToast* toast = (*it).toast;
-		LLPanel* old_panel = toast->getPanel();
-		toast->removeChild(old_panel);
-		delete old_panel;
-		toast->insertPanel(panel);
-		toast->startTimer();
+		LLToast* toast = it->getToast();
+		if (toast)
+		{
+			LLPanel* old_panel = toast->getPanel();
+			toast->removeChild(old_panel);
+			delete old_panel;
+			toast->insertPanel(panel);
+			toast->startTimer();
+		}
 		redrawToasts();
 	}
 }
@@ -540,16 +575,29 @@ void LLScreenChannel::showToastsBottom()
 	{
 		if(it != mToastList.rbegin())
 		{
-			LLToast* toast = (*(it-1)).toast;
+			LLToast* toast = (it-1)->getToast();
+			if (!toast)
+			{
+				llwarns << "Attempt to display a deleted toast." << llendl;
+				return;
+			}
+
 			bottom = toast->getRect().mTop - toast->getTopPad();
 			toast_margin = gSavedSettings.getS32("ToastGap");
 		}
 
-		toast_rect = (*it).toast->getRect();
+		LLToast* toast = it->getToast();
+		if(!toast)
+		{
+			llwarns << "Attempt to display a deleted toast." << llendl;
+			return;
+		}
+
+		toast_rect = toast->getRect();
 		toast_rect.setOriginAndSize(getRect().mRight - toast_rect.getWidth(),
 				bottom + toast_margin, toast_rect.getWidth(),
 				toast_rect.getHeight());
-		(*it).toast->setRect(toast_rect);
+		toast->setRect(toast_rect);
 
 		if(floater && floater->overlapsScreenChannel())
 		{
@@ -561,7 +609,7 @@ void LLScreenChannel::showToastsBottom()
 				{
 					shift += floater->getDockControl()->getTongueHeight();
 				}
-				(*it).toast->translate(0, shift);
+				toast->translate(0, shift);
 			}
 
 			LLRect channel_rect = getChannelRect();
@@ -572,13 +620,13 @@ void LLScreenChannel::showToastsBottom()
 			}
 		}
 
-		bool stop_showing_toasts = (*it).toast->getRect().mTop > getRect().mTop;
+		bool stop_showing_toasts = toast->getRect().mTop > getRect().mTop;
 
 		if(!stop_showing_toasts)
 		{
 			if( it != mToastList.rend()-1)
 			{
-				S32 toast_top = (*it).toast->getRect().mTop + gSavedSettings.getS32("ToastGap");
+				S32 toast_top = toast->getRect().mTop + gSavedSettings.getS32("ToastGap");
 				stop_showing_toasts = toast_top > getRect().mTop;
 			}
 		} 
@@ -592,17 +640,17 @@ void LLScreenChannel::showToastsBottom()
 		if(stop_showing_toasts)
 			break;
 
-		if( !(*it).toast->getVisible() )
+		if( !toast->getVisible() )
 		{
 			// HACK
 			// EXT-2653: it is necessary to prevent overlapping for secondary showed toasts
-			(*it).toast->setVisible(TRUE);
+			toast->setVisible(TRUE);
 		}		
-		if(!(*it).toast->hasFocus())
+		if(!toast->hasFocus())
 		{
 			// Fixing Z-order of toasts (EXT-4862)
 			// Next toast will be positioned under this one.
-			gFloaterView->sendChildToBack((*it).toast);
+			gFloaterView->sendChildToBack(toast);
 		}
 	}
 
@@ -612,7 +660,11 @@ void LLScreenChannel::showToastsBottom()
 		mHiddenToastsNum = 0;
 		for(; it != mToastList.rend(); it++)
 		{
-			(*it).toast->hide();
+			LLToast* toast = it->getToast();
+			if (toast)
+			{
+				toast->hide();
+			}
 		}
 	}
 }
@@ -620,17 +672,31 @@ void LLScreenChannel::showToastsBottom()
 //--------------------------------------------------------------------------
 void LLScreenChannel::showToastsCentre()
 {
-	LLRect	toast_rect;	
-	S32		bottom = (getRect().mTop - getRect().mBottom)/2 + mToastList[0].toast->getRect().getHeight()/2;
+	LLToast* toast = mToastList[0].getToast();
+	if (!toast)
+	{
+		llwarns << "Attempt to display a deleted toast." << llendl;
+		return;
+	}
+
+	LLRect	toast_rect;
+	S32		bottom = (getRect().mTop - getRect().mBottom)/2 + toast->getRect().getHeight()/2;
 	std::vector<ToastElem>::reverse_iterator it;
 
 	for(it = mToastList.rbegin(); it != mToastList.rend(); ++it)
 	{
-		toast_rect = (*it).toast->getRect();
+		LLToast* toast = it->getToast();
+		if (!toast)
+		{
+			llwarns << "Attempt to display a deleted toast." << llendl;
+			return;
+		}
+
+		toast_rect = toast->getRect();
 		toast_rect.setLeftTopAndSize(getRect().mLeft - toast_rect.getWidth() / 2, bottom + toast_rect.getHeight() / 2 + gSavedSettings.getS32("ToastGap"), toast_rect.getWidth() ,toast_rect.getHeight());
-		(*it).toast->setRect(toast_rect);
+		toast->setRect(toast_rect);
 
-		(*it).toast->setVisible(TRUE);	
+		toast->setVisible(TRUE);
 	}
 }
 
@@ -652,16 +718,29 @@ void LLScreenChannel::showToastsTop()
 	{
 		if(it != mToastList.rbegin())
 		{
-			LLToast* toast = (*(it-1)).toast;
+			LLToast* toast = (it-1)->getToast();
+			if (!toast)
+			{
+				llwarns << "Attempt to display a deleted toast." << llendl;
+				return;
+			}
+
 			top = toast->getRect().mBottom - toast->getTopPad();
 			toast_margin = gSavedSettings.getS32("ToastGap");
 		}
 
-		toast_rect = (*it).toast->getRect();
+		LLToast* toast = it->getToast();
+		if (!toast)
+		{
+			llwarns << "Attempt to display a deleted toast." << llendl;
+			return;
+		}
+
+		toast_rect = toast->getRect();
 		toast_rect.setLeftTopAndSize(channel_rect.mRight - toast_rect.getWidth(),
 			top, toast_rect.getWidth(),
 			toast_rect.getHeight());
-		(*it).toast->setRect(toast_rect);
+		toast->setRect(toast_rect);
 
 		if(floater && floater->overlapsScreenChannel())
 		{
@@ -673,7 +752,7 @@ void LLScreenChannel::showToastsTop()
 				{
 					shift -= floater->getDockControl()->getTongueHeight();
 				}
-				(*it).toast->translate(0, shift);
+				toast->translate(0, shift);
 			}
 
 			LLRect channel_rect = getChannelRect();
@@ -684,13 +763,13 @@ void LLScreenChannel::showToastsTop()
 			}
 		}
 
-		bool stop_showing_toasts = (*it).toast->getRect().mBottom < channel_rect.mBottom;
+		bool stop_showing_toasts = toast->getRect().mBottom < channel_rect.mBottom;
 
 		if(!stop_showing_toasts)
 		{
 			if( it != mToastList.rend()-1)
 			{
-				S32 toast_bottom = (*it).toast->getRect().mBottom - gSavedSettings.getS32("ToastGap");
+				S32 toast_bottom = toast->getRect().mBottom - gSavedSettings.getS32("ToastGap");
 				stop_showing_toasts = toast_bottom < channel_rect.mBottom;
 			}
 		} 
@@ -704,29 +783,41 @@ void LLScreenChannel::showToastsTop()
 		if(stop_showing_toasts)
 			break;
 
-		if( !(*it).toast->getVisible() )
+		if (!toast->getVisible())
 		{
 			// HACK
 			// EXT-2653: it is necessary to prevent overlapping for secondary showed toasts
-			(*it).toast->setVisible(TRUE);
+			toast->setVisible(TRUE);
 		}		
-		if(!(*it).toast->hasFocus())
+		if (!toast->hasFocus())
 		{
 			// Fixing Z-order of toasts (EXT-4862)
 			// Next toast will be positioned under this one.
-			gFloaterView->sendChildToBack((*it).toast);
+			gFloaterView->sendChildToBack(toast);
 		}
 	}
 
 	// Dismiss toasts we don't have space for (STORM-391).
+	std::vector<LLToast*> toasts_to_hide;
 	if(it != mToastList.rend())
 	{
 		mHiddenToastsNum = 0;
 		for(; it != mToastList.rend(); it++)
 		{
-			(*it).toast->hide();
+			LLToast* toast = it->getToast();
+			if (toast)
+			{
+				toasts_to_hide.push_back(toast);
+			}
 		}
 	}
+
+	for (std::vector<LLToast*>::iterator it = toasts_to_hide.begin(), end_it = toasts_to_hide.end();
+		it != end_it;
+		++it)
+	{
+		(*it)->hide();
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -827,7 +918,17 @@ void LLNotificationsUI::LLScreenChannel::startToastTimer(LLToast* toast)
 void LLScreenChannel::hideToastsFromScreen()
 {
 	for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++)
-		(*it).toast->setVisible(FALSE);
+	{
+		LLToast* toast = it->getToast();
+		if (toast)
+		{
+			toast->setVisible(FALSE);
+		}
+		else
+		{
+			llwarns << "Attempt to hide a deleted toast." << llendl;
+		}
+	}
 }
 
 //--------------------------------------------------------------------------
@@ -836,8 +937,15 @@ void LLScreenChannel::hideToast(const LLUUID& notification_id)
 	std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), notification_id);
 	if(mToastList.end() != it)
 	{
-		ToastElem te = *it;
-		te.toast->hide();
+		LLToast* toast = it->getToast();
+		if (toast)
+		{
+			toast->hide();
+		}
+		else
+		{
+			llwarns << "Attempt to hide a deleted toast." << llendl;
+		}
 	}
 }
 
@@ -845,24 +953,25 @@ void LLScreenChannel::closeHiddenToasts(const Matcher& matcher)
 {
 	// since we can't guarantee that close toast operation doesn't change mToastList
 	// we collect matched toasts that should be closed into separate list
-	std::list<ToastElem> toasts;
+	std::list<LLToast*> toasts;
 	for (std::vector<ToastElem>::iterator it = mToastList.begin(); it
 			!= mToastList.end(); it++)
 	{
-		LLToast * toast = it->toast;
+		LLToast* toast = it->getToast();
 		// add to list valid toast that match to provided matcher criteria
 		if (toast != NULL && !toast->isDead() && toast->getNotification() != NULL
 				&& !toast->getVisible() && matcher.matches(toast->getNotification()))
 		{
-			toasts.push_back(*it);
+			toasts.push_back(toast);
 		}
 	}
 
 	// close collected toasts
-	for (std::list<ToastElem>::iterator it = toasts.begin(); it
+	for (std::list<LLToast*>::iterator it = toasts.begin(); it
 			!= toasts.end(); it++)
 	{
-		it->toast->closeFloater();
+		LLToast* toast = *it;
+		toast->closeFloater();
 	}
 }
 
@@ -872,7 +981,7 @@ void LLScreenChannel::removeToastsFromChannel()
 	hideToastsFromScreen();
 	for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++)
 	{
-		deleteToast((*it).toast);
+		deleteToast(it->getToast());
 	}
 	mToastList.clear();
 }
@@ -886,9 +995,10 @@ void LLScreenChannel::removeAndStoreAllStorableToasts()
 	hideToastsFromScreen();
 	for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end();)
 	{
-		if((*it).toast->getCanBeStored())
+		LLToast* toast = it->getToast();
+		if(toast && toast->getCanBeStored())
 		{
-			storeToast(*(it));
+			storeToast(*it);
 			it = mToastList.erase(it);
 		}
 		else
@@ -908,9 +1018,10 @@ void LLScreenChannel::removeToastsBySessionID(LLUUID id)
 	hideToastsFromScreen();
 	for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end();)
 	{
-		if((*it).toast->getSessionID() == id)
+		LLToast* toast = it->getToast();
+		if(toast && toast->getSessionID() == id)
 		{
-			deleteToast((*it).toast);
+			deleteToast(toast);
 			it = mToastList.erase(it);
 		}
 		else
@@ -968,5 +1079,5 @@ LLToast* LLScreenChannel::getToastByNotificationID(LLUUID id)
 	if (it == mStoredToastList.end())
 		return NULL;
 
-	return it->toast;
+	return it->getToast();
 }
diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h
index c9f8855fe63c7a63fb719d8bb548e957a82e867b..695b6cd44d5974e1a11c9fca55fda64961155bf2 100644
--- a/indra/newview/llscreenchannel.h
+++ b/indra/newview/llscreenchannel.h
@@ -163,7 +163,7 @@ class LLScreenChannel : public LLScreenChannelBase
 		virtual bool matches(const LLNotificationPtr) const = 0;
 	};
 
-	std::list<LLToast*> findToasts(const Matcher& matcher);
+	std::list<const LLToast*> findToasts(const Matcher& matcher);
 
 	// Channel's outfit-functions
 	// update channel's size and position in the World View
@@ -238,31 +238,39 @@ class LLScreenChannel : public LLScreenChannelBase
 	reject_tost_signal_t mRejectToastSignal; boost::signals2::connection setOnRejectToastCallback(reject_tost_callback_t cb) { return mRejectToastSignal.connect(cb); }
 
 private:
-	struct ToastElem
+	class ToastElem
 	{
-		LLUUID		id;
-		LLToast*	toast;
+	public:
+		ToastElem(const LLHandle<LLToast>& toast) : mToast(toast)
+		{
+		}
 
-		ToastElem(LLToast::Params p) : id(p.notif_id)
+		ToastElem(const ToastElem& toast_elem) : mToast(toast_elem.mToast)
 		{
-			toast = new LLToast(p);
 		}
 
-		ToastElem(const ToastElem& toast_elem)
+		LLToast* getToast() const
 		{
-			id = toast_elem.id;
-			toast = toast_elem.toast;
+			return mToast.get();
+		}
+
+		LLUUID getID() const
+		{
+			return mToast.isDead() ? LLUUID() : mToast.get()->getNotificationID();
 		}
 
 		bool operator == (const LLUUID &id_op) const
 		{
-			return (id == id_op);
+			return (getID() == id_op);
 		}
 
 		bool operator == (LLPanel* panel_op) const
 		{
-			return (toast == panel_op);
+			return (mToast.get() == panel_op);
 		}
+
+	private:
+		LLHandle<LLToast>	mToast;
 	};
 
 	// Channel's handlers
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index 8d64c8c04f4bf2b3bd00dd29f482f024d0263923..30400a4c6a6b7d44a616ca8c33ae0414a3f32627 100644
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -1360,7 +1360,11 @@ void LLSecAPIBasicHandler::_writeProtectedData()
 		// (even though this file isn't really secure.  Perhaps in the future
 		// it may be, however.
 		LLFile::remove(tmp_filename);
-		throw LLProtectedDataException("Error writing Protected Data Store");
+
+		// EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData()
+		// Decided throwing an exception here was overkill until we figure out why this happens
+		//throw LLProtectedDataException("Error writing Protected Data Store");
+		llinfos << "LLProtectedDataException(Error writing Protected Data Store)" << llendl;
 	}
 
 	// move the temporary file to the specified file location.
@@ -1369,7 +1373,11 @@ void LLSecAPIBasicHandler::_writeProtectedData()
 	   (LLFile::rename(tmp_filename, mProtectedDataFilename)))
 	{
 		LLFile::remove(tmp_filename);
-		throw LLProtectedDataException("Could not overwrite protected data store");
+
+		// EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData()
+		// Decided throwing an exception here was overkill until we figure out why this happens
+		//throw LLProtectedDataException("Could not overwrite protected data store");
+		llinfos << "LLProtectedDataException(Could not overwrite protected data store)" << llendl;
 	}
 }
 		
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index 038b18afbdc0fcf0331e8e3af4e9b34db4baeb2c..4f9ab318a56807443cc0fdee6c3bad8f0b25d207 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -78,7 +78,6 @@ static const char * const MARKETPLACE_INBOX_PANEL = "marketplace_inbox";
 //
 // Helpers
 //
-
 class LLInboxAddedObserver : public LLInventoryCategoryAddedObserver
 {
 public:
@@ -130,6 +129,11 @@ LLSidepanelInventory::LLSidepanelInventory()
 
 LLSidepanelInventory::~LLSidepanelInventory()
 {
+	LLLayoutPanel* inbox_layout_panel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME);
+
+	// Save the InventoryMainPanelHeight in settings per account
+	gSavedPerAccountSettings.setS32("InventoryInboxHeight", inbox_layout_panel->getTargetDim());
+
 	if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver))
 	{
 		gInventory.removeObserver(mCategoriesObserver);
@@ -217,15 +221,22 @@ BOOL LLSidepanelInventory::postBuild()
 	{
 		LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME);
 
-		// Collapse inbox panel
-		inv_stack->collapsePanel(getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME), true);
-		
 		// Set up button states and callbacks
 		LLButton * inbox_button = getChild<LLButton>(INBOX_BUTTON_NAME);
 
-		inbox_button->setToggleState(false);
 		inbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this));
 
+		// Get the previous inbox state from "InventoryInboxToggleState" setting.
+		bool is_inbox_collapsed = !inbox_button->getToggleState();
+
+		// Restore the collapsed inbox panel state
+		LLLayoutPanel* inbox_panel = getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME);
+		inv_stack->collapsePanel(inbox_panel, is_inbox_collapsed);
+		if (!is_inbox_collapsed)
+		{
+			inbox_panel->setTargetDim(gSavedPerAccountSettings.getS32("InventoryInboxHeight"));
+		}
+
 		// Set the inbox visible based on debug settings (final setting comes from http request below)
 		enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox"));
 
@@ -368,10 +379,19 @@ void LLSidepanelInventory::onToggleInboxBtn()
 	// Expand/collapse the indicated panel
 	inv_stack->collapsePanel(inboxPanel, !inbox_expanded);
 
-	if (inbox_expanded && inboxPanel->isInVisibleChain())
+	if (inbox_expanded)
 	{
-		gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
+		inboxPanel->setTargetDim(gSavedPerAccountSettings.getS32("InventoryInboxHeight"));
+		if (inboxPanel->isInVisibleChain())
+		{
+			gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
+		}
 	}
+	else
+	{
+		gSavedPerAccountSettings.setS32("InventoryInboxHeight", inboxPanel->getTargetDim());
+	}
+
 }
 
 void LLSidepanelInventory::onOpen(const LLSD& key)
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index c588bd8fb44e63a6c8dfcaa601512c16094c5d02..07d2f1ad6f98bb29a0c48d755949d6a8806f2cd2 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -272,6 +272,7 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin
 		speakerp->mStatus = status;
 		mSpeakers.insert(std::make_pair(speakerp->mID, speakerp));
 		mSpeakersSorted.push_back(speakerp);
+		LL_DEBUGS("Speakers") << "Added speaker " << id << llendl;
 		fireEvent(new LLSpeakerListChangeEvent(this, speakerp->mID), "add");
 	}
 	else
@@ -290,6 +291,10 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin
 				speakerp->lookupName();
 			}
 		}
+		else
+		{
+			LL_WARNS("Speakers") << "Speaker " << id << " not found" << llendl;
+		}
 	}
 
 	mSpeakerDelayRemover->unsetActionTimer(speakerp->mID);
@@ -354,6 +359,7 @@ void LLSpeakerMgr::update(BOOL resort_ok)
 			if (moderator_muted_voice != speakerp->mModeratorMutedVoice)
 			{
 				speakerp->mModeratorMutedVoice = moderator_muted_voice;
+				LL_DEBUGS("Speakers") << (speakerp->mModeratorMutedVoice? "Muted" : "Umuted") << " speaker " << speaker_id<< llendl;
 				speakerp->fireEvent(new LLSpeakerVoiceModerationEvent(speakerp));
 			}
 
@@ -484,6 +490,7 @@ bool LLSpeakerMgr::removeSpeaker(const LLUUID& speaker_id)
 		}
 	}
 
+	LL_DEBUGS("Speakers") << "Removed speaker " << speaker_id << llendl;
 	fireEvent(new LLSpeakerListChangeEvent(this, speaker_id), "remove");
 
 	update(TRUE);
@@ -595,7 +602,10 @@ void LLIMSpeakerMgr::setSpeakers(const LLSD& speakers)
 					speaker_it->second["mutes"]["text"];
 				// Fire event only if moderator changed
 				if ( is_moderator != speakerp->mIsModerator )
+				{
+					LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << llendl;
 					fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator");
+				}
 			}
 		}
 	}
@@ -665,7 +675,10 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
 					speakerp->mIsModerator = agent_info["is_moderator"];
 					// Fire event only if moderator changed
 					if ( is_moderator != speakerp->mIsModerator )
+					{
+						LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << llendl;
 						fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator");
+					}
 				}
 
 				if (agent_info.has("mutes"))
@@ -857,6 +870,7 @@ void LLActiveSpeakerMgr::updateSpeakerList()
 	// always populate from active voice channel
 	if (LLVoiceChannel::getCurrentVoiceChannel() != mVoiceChannel) //MA: seems this is always false
 	{
+		LL_DEBUGS("Speakers") << "Removed all speakers" << llendl;
 		fireEvent(new LLSpeakerListChangeEvent(this, LLUUID::null), "clear");
 		mSpeakers.clear();
 		mSpeakersSorted.clear();
diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h
index 35f2ee7056235d9d12e1b77a0ff36b5fcbd70825..b9358cf37c0856b9681c28a11545f4be8840b227 100644
--- a/indra/newview/llspeakers.h
+++ b/indra/newview/llspeakers.h
@@ -208,6 +208,8 @@ class LLSpeakersDelayActionsStorage
 
 class LLSpeakerMgr : public LLOldEvents::LLObservable
 {
+	LOG_CLASS(LLSpeakerMgr);
+
 public:
 	LLSpeakerMgr(LLVoiceChannel* channelp);
 	virtual ~LLSpeakerMgr();
@@ -271,6 +273,8 @@ class LLSpeakerMgr : public LLOldEvents::LLObservable
 
 class LLIMSpeakerMgr : public LLSpeakerMgr
 {
+	LOG_CLASS(LLIMSpeakerMgr);
+
 public:
 	LLIMSpeakerMgr(LLVoiceChannel* channel);
 	
@@ -320,6 +324,8 @@ class LLIMSpeakerMgr : public LLSpeakerMgr
 
 class LLActiveSpeakerMgr : public LLSpeakerMgr, public LLSingleton<LLActiveSpeakerMgr>
 {
+	LOG_CLASS(LLActiveSpeakerMgr);
+
 public:
 	LLActiveSpeakerMgr();
 protected:
@@ -328,6 +334,7 @@ class LLActiveSpeakerMgr : public LLSpeakerMgr, public LLSingleton<LLActiveSpeak
 
 class LLLocalSpeakerMgr : public LLSpeakerMgr, public LLSingleton<LLLocalSpeakerMgr>
 {
+	LOG_CLASS(LLLocalSpeakerMgr);
 public:
 	LLLocalSpeakerMgr();
 	~LLLocalSpeakerMgr ();
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 3923b4510a7b8b1e74401af8545a8baf2e801542..0ac8c1fe397d8b2fb0c6fd444a5b9e21cae561af 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -880,7 +880,6 @@ bool idle_startup()
 		LLFile::mkdir(gDirUtilp->getLindenUserDir());
 
 		// Set PerAccountSettingsFile to the default value.
-		std::string per_account_settings_file = LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount");
 		gSavedSettings.setString("PerAccountSettingsFile",
 			gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, 
 				LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount")));
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index de22f2ae6b7f6fe3085363d7c6e8d76fa00bf782..e26d2e001c7b4e1aac67297c3f176fd733b50d83 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -922,7 +922,7 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
 	S32 image_top = getRect().getHeight();
 	S32 image_bottom = BTN_HEIGHT_SMALL;
 	S32 image_middle = (image_top + image_bottom) / 2;
-	S32 line_height = llround(LLFontGL::getFontSansSerifSmall()->getLineHeight());
+	S32 line_height = LLFontGL::getFontSansSerifSmall()->getLineHeight();
 
 	LLTextBox::Params tentative_label_p(p.multiselect_text);
 	tentative_label_p.name("Multiple");
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
index 1c89766b2672b61d5a0bf446c5154d83c04b5d78..5b41a05f2aac01d5f66ad1fcf9b4c849c731e9c6 100644
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -386,7 +386,7 @@ class LLAvatarTexBar : public LLView
 		Params()
 		:	texture_view("texture_view")
 		{
-			S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+			S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 			changeDefault(rect, LLRect(0,0,100,line_height * 4));
 		}
 	};
@@ -411,7 +411,7 @@ void LLAvatarTexBar::draw()
 	LLVOAvatarSelf* avatarp = gAgentAvatarp;
 	if (!avatarp) return;
 
-	const S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+	const S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 	const S32 v_offset = 0;
 	const S32 l_offset = 3;
 
@@ -485,7 +485,7 @@ class LLGLTexMemBar : public LLView
 		Params()
 		:	texture_view("texture_view")
 		{
-			S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+			S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 			changeDefault(rect, LLRect(0,0,100,line_height * 4));
 		}
 	};
@@ -512,7 +512,7 @@ void LLGLTexMemBar::draw()
 	F32 discard_bias = LLViewerTexture::sDesiredDiscardBias;
 	F32 cache_usage = (F32)BYTES_TO_MEGA_BYTES(LLAppViewer::getTextureCache()->getUsage()) ;
 	F32 cache_max_usage = (F32)BYTES_TO_MEGA_BYTES(LLAppViewer::getTextureCache()->getMaxUsage()) ;
-	S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+	S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 	S32 v_offset = (S32)((texture_bar_height + 2.2f) * mTextureView->mNumTextureBars + 2.0f);
 	F32 total_texture_downloaded = (F32)gTotalTextureBytes / (1024 * 1024);
 	F32 total_object_downloaded = (F32)gTotalObjectBytes / (1024 * 1024);
@@ -1097,7 +1097,7 @@ void LLTextureSizeView::drawTextureSizeGraph()
 {
 	if(mTextureSizeBar.size() == 0)
 	{
-		S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+		S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 		mTextureSizeBar.resize(LLImageGL::sTextureLoadedCounter.size()) ;
 		mTextureSizeBarRect.set(700, line_height * 2 + 400, 700 + mTextureSizeBar.size() * mTextureSizeBarWidth, line_height * 2) ;
 		
@@ -1140,7 +1140,7 @@ F32 LLTextureSizeView::drawTextureSizeDistributionGraph()
 		}
 	}
 
-	S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+	S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 	S32 left = mTextureSizeBarRect.mLeft ;
 	S32 bottom = mTextureSizeBarRect.mBottom ;
 	S32 right = mTextureSizeBarRect.mRight ;
@@ -1222,7 +1222,7 @@ void LLTextureSizeView::drawTextureCategoryGraph()
 {
 	if(mTextureSizeBar.size() == 0)
 	{
-		S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+		S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 		mTextureSizeBar.resize(LLViewerTexture::getTotalNumOfCategories()) ;
 		mTextureSizeBarRect.set(700, line_height * 2 + 400, 700 + mTextureSizeBar.size() * mTextureSizeBarWidth, line_height * 2) ;
 		
@@ -1267,7 +1267,7 @@ F32 LLTextureSizeView::drawTextureCategoryDistributionGraph()
 		}
 	}
 
-	S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+	S32 line_height = LLFontGL::getFontMonospace()->getLineHeight();
 	S32 left = mTextureSizeBarRect.mLeft ;
 	S32 bottom = mTextureSizeBarRect.mBottom ;
 	S32 right = mTextureSizeBarRect.mRight ;
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index da691a2d0c3a2071b1ec47986c0e3ddba9164e2c..0eec7f0afd153f50cbdf9f76c7a175131e7a74c1 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -180,11 +180,14 @@ LLToast::~LLToast()
 //--------------------------------------------------------------------------
 void LLToast::hide()
 {
-	setVisible(FALSE);
-	setFading(false);
-	mTimer->stop();
-	mIsHidden = true;
-	mOnFadeSignal(this); 
+	if (!mIsHidden)
+	{
+		setVisible(FALSE);
+		setFading(false);
+		mTimer->stop();
+		mIsHidden = true;
+		mOnFadeSignal(this); 
+	}
 }
 
 void LLToast::onFocusLost()
@@ -215,6 +218,13 @@ void LLToast::setFadingTime(S32 seconds)
 	mToastFadingTime = seconds;
 }
 
+void LLToast::closeToast()
+{
+	mOnDeleteToastSignal(this);
+
+	closeFloater();
+}
+
 S32 LLToast::getTopPad()
 {
 	if(mWrapperPanel)
@@ -296,9 +306,7 @@ void LLToast::reshapeToPanel()
 	if(!panel)
 		return;
 
-	LLRect panel_rect = panel->getRect();
-
-	panel_rect.setLeftTopAndSize(0, panel_rect.getHeight(), panel_rect.getWidth(), panel_rect.getHeight());
+	LLRect panel_rect = panel->getLocalRect();
 	panel->setShape(panel_rect);
 	
 	LLRect toast_rect = getRect();
diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h
index 0b067289350f55976ec5ed58578e6293279e14ef..e1d99b1bcba9afd2abde97820bf5a13b841e6443 100644
--- a/indra/newview/lltoast.h
+++ b/indra/newview/lltoast.h
@@ -75,6 +75,7 @@ class LLToast : public LLModalDialog, public LLInstanceTracker<LLToast>
 public:
 	typedef boost::function<void (LLToast* toast)> toast_callback_t;
 	typedef boost::signals2::signal<void (LLToast* toast)> toast_signal_t;
+	typedef boost::signals2::signal<void (LLToast* toast, bool mouse_enter)> toast_hover_check_signal_t;
 
 	struct Params : public LLInitParam::Block<Params>
 	{
@@ -131,7 +132,7 @@ class LLToast : public LLModalDialog, public LLInstanceTracker<LLToast>
 	void reshapeToPanel();
 
 	// get toast's panel
-	LLPanel* getPanel() { return mPanel; }
+	LLPanel* getPanel() const { return mPanel; }
 	// enable/disable Toast's Hide button
 	void setHideButtonEnabled(bool enabled);
 	//
@@ -155,6 +156,8 @@ class LLToast : public LLModalDialog, public LLInstanceTracker<LLToast>
 
 	void setFadingTime(S32 seconds);
 
+	void closeToast();
+
 	/**
 	 * Returns padding between floater top and wrapper_panel top.
 	 * This padding should be taken into account when positioning or reshaping toasts
@@ -167,9 +170,9 @@ class LLToast : public LLModalDialog, public LLInstanceTracker<LLToast>
 	// get information whether the notification corresponding to the toast is valid or not
 	bool isNotificationValid();
 	// get toast's Notification ID
-	const LLUUID getNotificationID() { return mNotificationID;}
+	const LLUUID getNotificationID() const { return mNotificationID;}
 	// get toast's Session ID
-	const LLUUID getSessionID() { return mSessionID;}
+	const LLUUID getSessionID() const { return mSessionID;}
 	//
 	void setCanFade(bool can_fade);
 	//
@@ -179,19 +182,12 @@ class LLToast : public LLModalDialog, public LLInstanceTracker<LLToast>
 	// set whether this toast considered as hidden or not
 	void setIsHidden( bool is_toast_hidden ) { mIsHidden = is_toast_hidden; }
 
-	const LLNotificationPtr& getNotification() { return mNotification;}
+	const LLNotificationPtr& getNotification() const { return mNotification;}
 
 	// Registers signals/callbacks for events
-	toast_signal_t mOnFadeSignal;
-	toast_signal_t mOnDeleteToastSignal;
-	toast_signal_t mOnToastDestroyedSignal;
-	boost::signals2::connection setOnFadeCallback(toast_callback_t cb) { return mOnFadeSignal.connect(cb); }
-	boost::signals2::connection setOnToastDestroyedCallback(toast_callback_t cb) { return mOnToastDestroyedSignal.connect(cb); }
-
-	typedef boost::function<void (LLToast* toast, bool mouse_enter)> toast_hover_check_callback_t;
-	typedef boost::signals2::signal<void (LLToast* toast, bool mouse_enter)> toast_hover_check_signal_t;
-	toast_hover_check_signal_t mOnToastHoverSignal;	
-	boost::signals2::connection setOnToastHoverCallback(toast_hover_check_callback_t cb) { return mOnToastHoverSignal.connect(cb); }
+	boost::signals2::connection setOnFadeCallback(const toast_signal_t::slot_type& cb) { return mOnFadeSignal.connect(cb); }
+	boost::signals2::connection setOnToastDestroyedCallback(const toast_signal_t::slot_type& cb) { return mOnToastDestroyedSignal.connect(cb); }
+	boost::signals2::connection setOnToastHoverCallback(const toast_hover_check_signal_t::slot_type& cb) { return mOnToastHoverSignal.connect(cb); }
 
 	boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb ) { return mToastMouseEnterSignal.connect(cb); };
 	boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb ) { return mToastMouseLeaveSignal.connect(cb); };
@@ -237,6 +233,11 @@ class LLToast : public LLModalDialog, public LLInstanceTracker<LLToast>
 	bool		mIsFading;
 	bool		mIsHovered;
 
+	toast_signal_t mOnFadeSignal;
+	toast_signal_t mOnDeleteToastSignal;
+	toast_signal_t mOnToastDestroyedSignal;
+	toast_hover_check_signal_t mOnToastHoverSignal;
+
 	commit_signal_t mToastMouseEnterSignal;
 	commit_signal_t mToastMouseLeaveSignal;
 };
diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp
index 0f337825e92b14c5fc63d0042329d1383e1eddeb..9ba8431fdeac47a1f1fac5e4a024004584da07c5 100644
--- a/indra/newview/lltoastalertpanel.cpp
+++ b/indra/newview/lltoastalertpanel.cpp
@@ -69,8 +69,22 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal
 		mLabel(notification->getName()),
 		mLineEditor(NULL)
 {
+	// EXP-1822
+	// save currently focused view, so that return focus to it
+	// on destroying this toast.
+	LLView* current_selection = dynamic_cast<LLView*>(gFocusMgr.getKeyboardFocus());
+	while(current_selection)
+	{
+		if (current_selection->isFocusRoot())
+		{
+			mPreviouslyFocusedView = current_selection->getHandle();
+			break;
+		}
+		current_selection = current_selection->getParent();
+	}
+
 	const LLFontGL* font = LLFontGL::getFontSansSerif();
-	const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f);
+	const S32 LINE_HEIGHT = font->getLineHeight();
 	const S32 EDITOR_HEIGHT = 20;
 
 	LLNotificationFormPtr form = mNotification->getForm();
@@ -365,7 +379,7 @@ bool LLToastAlertPanel::setCheckBox( const std::string& check_title, const std::
 	}
 
 	const LLFontGL* font =  mCheck->getFont();
-	const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f);
+	const S32 LINE_HEIGHT = font->getLineHeight();
 	
 	// Extend dialog for "check next time"
 	S32 max_msg_width = LLToastPanel::getRect().getWidth() - 2 * HPAD;
@@ -408,6 +422,13 @@ LLToastAlertPanel::~LLToastAlertPanel()
 {
 	LLTransientFloaterMgr::instance().removeControlView(
 			LLTransientFloaterMgr::GLOBAL, this);
+
+	// EXP-1822
+	// return focus to the previously focused view
+	if (mPreviouslyFocusedView.get())
+	{
+		mPreviouslyFocusedView.get()->setFocus(TRUE);
+	}
 }
 
 BOOL LLToastAlertPanel::hasTitleBar() const
diff --git a/indra/newview/lltoastalertpanel.h b/indra/newview/lltoastalertpanel.h
index 7b157f19bb10123af3c6c487496512ac5100b4e0..d1be5e018ead9eae01a34701e18eaef821f7726d 100644
--- a/indra/newview/lltoastalertpanel.h
+++ b/indra/newview/lltoastalertpanel.h
@@ -113,6 +113,7 @@ class LLToastAlertPanel
 	LLFrameTimer	mDefaultBtnTimer;
 	// For Dialogs that take a line as text as input:
 	LLLineEditor* mLineEditor;
+	LLHandle<LLView>	mPreviouslyFocusedView;
 
 };
 
diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp
index fc69157a40841662f1d7f00eb4bc0f0cd93f8a6a..d2a4ce8745a27f655a2a11200d313aebd180a60d 100644
--- a/indra/newview/lltoastpanel.cpp
+++ b/indra/newview/lltoastpanel.cpp
@@ -68,7 +68,7 @@ void LLToastPanel::snapToMessageHeight(LLTextBase* message, S32 maxLineCount)
 	if (message->getVisible())
 	{
 		S32 heightDelta = 0;
-		S32 maxTextHeight = (S32)(message->getDefaultFont()->getLineHeight() * maxLineCount);
+		S32 maxTextHeight = message->getDefaultFont()->getLineHeight() * maxLineCount;
 
 		LLRect messageRect = message->getRect();
 		S32 oldTextHeight = messageRect.getHeight();
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index eccb2cf2f15900301f90b63e3e101fcbe66e9fee..81ad96f39e4f34b321ee0bb3a47b982e0a01e36c 100644
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -75,6 +75,7 @@ LLToolBarView::LLToolBarView(const LLToolBarView::Params& p)
 	mDragStarted(false),
 	mShowToolbars(true),
 	mDragToolbarButton(NULL),
+	mDragItem(NULL),
 	mToolbarsLoaded(false)
 {
 	for (S32 i = 0; i < TOOLBAR_COUNT; i++)
@@ -579,7 +580,6 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp
 			uuid_vec_t cargo_ids;
 			types.push_back(DAD_WIDGET);
 			cargo_ids.push_back(uuid);
-			gClipboard.setSourceObject(uuid,LLAssetType::AT_WIDGET);
 			LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_VIEWER;
 			LLUUID srcID;
 			LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src, srcID);
@@ -662,6 +662,18 @@ void LLToolBarView::resetDragTool(LLToolBarButton* toolbarButton)
 	gToolBarView->mDragToolbarButton = toolbarButton;
 }
 
+// Provide a handle on a free standing inventory item containing references to the tool.
+// This might be used by Drag and Drop to move around references to tool items.
+LLInventoryObject* LLToolBarView::getDragItem()
+{
+	if (mDragToolbarButton)
+	{
+		LLUUID item_uuid = mDragToolbarButton->getCommandId().uuid();
+		mDragItem = new LLInventoryObject (item_uuid, LLUUID::null, LLAssetType::AT_WIDGET, "");
+	}
+	return mDragItem;
+}
+
 void LLToolBarView::setToolBarsVisible(bool visible)
 {
 	mShowToolbars = visible;
diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h
index be66bcae3614feb779a67a2f62e3597c44af3932..9c4194ebed1ce1c78a40f24bcd579d40f752e63f 100644
--- a/indra/newview/lltoolbarview.h
+++ b/indra/newview/lltoolbarview.h
@@ -31,6 +31,7 @@
 #include "lluictrl.h"
 #include "lltoolbar.h"
 #include "llcommandmanager.h"
+#include "llinventory.h"
 
 class LLUICtrlFactory;
 
@@ -106,6 +107,7 @@ class LLToolBarView : public LLUICtrl
 	static BOOL handleDragTool(S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type);
 	static BOOL handleDropTool(void* cargo_data, S32 x, S32 y, LLToolBar* toolbar);
 	static void resetDragTool(LLToolBarButton* toolbarButton);
+	LLInventoryObject* getDragItem();
 
 	bool isModified() const;
 	
@@ -129,6 +131,7 @@ class LLToolBarView : public LLUICtrl
 	
 	bool				mDragStarted;
 	LLToolBarButton*	mDragToolbarButton;
+	LLInventoryObject*	mDragItem;
 	bool				mShowToolbars;
 };
 
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 8c32dfcb4de424dcc7881e8ebc49c703df0aa072..4f4eef0f3d5421dc8cec30ffbccebc1e7a816e63 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -48,6 +48,7 @@
 #include "llpreviewnotecard.h"
 #include "llrootview.h"
 #include "llselectmgr.h"
+#include "lltoolbarview.h"
 #include "lltoolmgr.h"
 #include "lltooltip.h"
 #include "lltrans.h"
@@ -333,14 +334,15 @@ LLToolDragAndDrop::LLDragAndDropDictionary::LLDragAndDropDictionary()
 };
 
 LLToolDragAndDrop::LLToolDragAndDrop()
-:	 LLTool(std::string("draganddrop"), NULL),
-	 mDragStartX(0),
-	 mDragStartY(0),
-	 mSource(SOURCE_AGENT),
-	 mCursor(UI_CURSOR_NO),
-	 mLastAccept(ACCEPT_NO),
-	 mDrop(FALSE),
-	 mCurItemIndex(0)
+:	LLTool(std::string("draganddrop"), NULL),
+	mCargoCount(0),
+	mDragStartX(0),
+	mDragStartY(0),
+	mSource(SOURCE_AGENT),
+	mCursor(UI_CURSOR_NO),
+	mLastAccept(ACCEPT_NO),
+	mDrop(FALSE),
+	mCurItemIndex(0)
 {
 
 }
@@ -2527,7 +2529,7 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(
 	}
 	else if(mSource == SOURCE_VIEWER)
 	{
-		item = (LLViewerInventoryItem*)gClipboard.getSourceObject();
+		item = (LLViewerInventoryItem*)gToolBarView->getDragItem();
 	}
 	if(item) return item;
 	if(cat) return cat;
diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h
index 188d36cd1b907b5f65da81fb15f8764e9883f32c..245c2a23e63b40d39325867d3b02351c9cc73e9c 100644
--- a/indra/newview/lltooldraganddrop.h
+++ b/indra/newview/lltooldraganddrop.h
@@ -86,8 +86,11 @@ class LLToolDragAndDrop : public LLTool, public LLSingleton<LLToolDragAndDrop>
 	EAcceptance getLastAccept() { return mLastAccept; }
 
 	boost::signals2::connection setEndDragCallback( const enddrag_signal_t::slot_type& cb ) { return mEndDragSignal.connect(cb); }
-	
-	uuid_vec_t::size_type getCargoIDsCount() const { return mCargoIDs.size(); }
+
+	void setCargoCount(U32 count) { mCargoCount = count; }
+	void resetCargoCount() { mCargoCount = 0; }
+	U32 getCargoCount() const { return (mCargoCount > 0) ? mCargoCount : mCargoIDs.size(); }
+
 	static S32 getOperationId() { return sOperationId; }
 
 protected:
@@ -118,6 +121,8 @@ class LLToolDragAndDrop : public LLTool, public LLSingleton<LLToolDragAndDrop>
 
 protected:
 
+	U32				mCargoCount;
+
 	S32				mDragStartX;
 	S32				mDragStartY;
 	
diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp
index c1cc9c7bc4ea08c294777e64af1b5bc8517fa503..f3d8de1904be0f2f1ccabdd0d806805806db13fa 100755
--- a/indra/newview/lltranslate.cpp
+++ b/indra/newview/lltranslate.cpp
@@ -162,10 +162,10 @@ void LLBingTranslationHandler::getTranslateURL(
 	const std::string &text) const
 {
 	url = std::string("http://api.microsofttranslator.com/v2/Http.svc/Translate?appId=")
-		+ getAPIKey() + "&text=" + LLURI::escape(text) + "&to=" + to_lang;
+		+ getAPIKey() + "&text=" + LLURI::escape(text) + "&to=" + getAPILanguageCode(to_lang);
 	if (!from_lang.empty())
 	{
-		url += "&from=" + from_lang;
+		url += "&from=" + getAPILanguageCode(from_lang);
 	}
 }
 
@@ -236,6 +236,12 @@ std::string LLBingTranslationHandler::getAPIKey()
 	return gSavedSettings.getString("BingTranslateAPIKey");
 }
 
+// static
+std::string LLBingTranslationHandler::getAPILanguageCode(const std::string& lang)
+{
+	return lang == "zh" ? "zh-CHT" : lang; // treat Chinese as Traditional Chinese
+}
+
 LLTranslate::TranslationReceiver::TranslationReceiver(const std::string& from_lang, const std::string& to_lang)
 :	mFromLang(from_lang)
 ,	mToLang(to_lang)
diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h
index 424bc14587f3bdb3dc1a622bb448bdb2a6bbbfa6..c58e1adb8ca031a9061c1aae15502fd455e9dc88 100755
--- a/indra/newview/lltranslate.h
+++ b/indra/newview/lltranslate.h
@@ -157,6 +157,7 @@ class LLBingTranslationHandler : public LLTranslationAPIHandler
 	/*virtual*/ bool isConfigured() const;
 private:
 	static std::string getAPIKey();
+	static std::string getAPILanguageCode(const std::string& lang);
 };
 
 /**
diff --git a/indra/newview/lluploaddialog.cpp b/indra/newview/lluploaddialog.cpp
index df7c5be0d6d573ff74867fe184ff336f98600662..e59064c0743097ed8a790cce8bb8fe7cb436edf2 100644
--- a/indra/newview/lluploaddialog.cpp
+++ b/indra/newview/lluploaddialog.cpp
@@ -115,7 +115,7 @@ void LLUploadDialog::setMessage( const std::string& msg)
 		token = strtok( NULL, "\n" );
 	}
 
-	S32 line_height = S32( font->getLineHeight() + 0.99f );
+	S32 line_height = font->getLineHeight();
 	S32 dialog_width = max_msg_width + 2 * HPAD;
 	S32 dialog_height = line_height * msg_lines.size() + 2 * VPAD;
 
diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp
index 56b5bbf9420685965a9562183f83314dda4b2951..cad57690421a4c0b51fb1403fb4f6305cb884525 100644
--- a/indra/newview/llurllineeditorctrl.cpp
+++ b/indra/newview/llurllineeditorctrl.cpp
@@ -89,5 +89,5 @@ void LLURLLineEditor::copyEscapedURLToClipboard()
 	else // human-readable location
 		text_to_copy = utf8str_to_wstring(unescaped_text);
 		
-	gClipboard.copyFromString( text_to_copy );
+	LLClipboard::instance().copyToClipboard(text_to_copy, 0, text_to_copy.size());
 }
diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h
index cc3395115ba567edccc7fa99546c580ab36765a6..184033de424bc6b1ea9d21536ba816971dc4985d 100644
--- a/indra/newview/llviewercamera.h
+++ b/indra/newview/llviewercamera.h
@@ -32,8 +32,8 @@
 #include "llstat.h"
 #include "lltimer.h"
 #include "m4math.h"
+#include "llcoord.h"
 
-class LLCoordGL;
 class LLViewerObject;
 
 // This rotation matrix moves the default OpenGL reference frame 
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 163581ea7fe7a0bed135b968919293f45f762d39..45ca23cdfe2d3b19b49dd1f1410d99902731a57b 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -436,11 +436,6 @@ void LLViewerInventoryItem::fetchFromServer(void) const
 			gAgent.sendReliableMessage();
 		}
 	}
-	else
-	{
-		// *FIX: this can be removed after a bit.
-		llwarns << "request to fetch complete item" << llendl;
-	}
 }
 
 // virtual
@@ -1462,6 +1457,7 @@ const std::string& LLViewerInventoryItem::getName() const
 class LLFavoritesOrderStorage : public LLSingleton<LLFavoritesOrderStorage>
 	, public LLDestroyClass<LLFavoritesOrderStorage>
 {
+	LOG_CLASS(LLFavoritesOrderStorage);
 public:
 	/**
 	 * Sets sort index for specified with LLUUID favorite landmark
@@ -1620,10 +1616,18 @@ void LLFavoritesOrderStorage::load()
 void LLFavoritesOrderStorage::saveFavoritesSLURLs()
 {
 	// Do not change the file if we are not logged in yet.
-	if (!LLLoginInstance::getInstance()->authSuccess()) return;
+	if (!LLLoginInstance::getInstance()->authSuccess())
+	{
+		llwarns << "Cannot save favorites: not logged in" << llendl;
+		return;
+	}
 	
 	std::string user_dir = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "");
-	if (user_dir.empty()) return;
+	if (user_dir.empty())
+	{
+		llwarns << "Cannot save favorites: empty user dir name" << llendl;
+		return;
+	}
 
 	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
 	llifstream in_file;
@@ -1649,13 +1653,19 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs()
 		slurls_map_t::iterator slurl_iter = mSLURLs.find(value["asset_id"]);
 		if (slurl_iter != mSLURLs.end())
 		{
+			lldebugs << "Saving favorite: idx=" << (*it)->getSortField() << ", SLURL=" <<  slurl_iter->second << ", value=" << value << llendl;
 			value["slurl"] = slurl_iter->second;
 			user_llsd[(*it)->getSortField()] = value;
 		}
+		else
+		{
+			llwarns << "Not saving favorite " << value["name"] << ": no matching SLURL" << llendl;
+		}
 	}
 
 	LLAvatarName av_name;
 	LLAvatarNameCache::get( gAgentID, &av_name );
+	lldebugs << "Saved favorites for " << av_name.getLegacyName() << llendl;
 	fav_llsd[av_name.getLegacyName()] = user_llsd;
 
 	llofstream file;
@@ -1674,6 +1684,7 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser()
 
 	LLAvatarName av_name;
 	LLAvatarNameCache::get( gAgentID, &av_name );
+	lldebugs << "Removed favorites for " << av_name.getLegacyName() << llendl;
 	if (fav_llsd.has(av_name.getLegacyName()))
 	{
 		fav_llsd.erase(av_name.getLegacyName());
@@ -1706,6 +1717,7 @@ void LLFavoritesOrderStorage::onLandmarkLoaded(const LLUUID& asset_id, LLLandmar
 
 void LLFavoritesOrderStorage::storeFavoriteSLURL(const LLUUID& asset_id, std::string& slurl)
 {
+	lldebugs << "Saving landmark SLURL: " << slurl << llendl;
 	mSLURLs[asset_id] = slurl;
 }
 
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 046360e9e9ae428842bb1a9e6962ada571779f33..1eb4bedfaf9b47114be4f6c85a0962d7a61eef32 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -387,7 +387,6 @@ class LLViewerMediaMuteListObserver : public LLMuteListObserver
 
 static LLViewerMediaMuteListObserver sViewerMediaMuteListObserver;
 static bool sViewerMediaMuteListObserverInitialized = false;
-static bool sInWorldMediaDisabled = false;
 
 
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -652,20 +651,6 @@ void LLViewerMedia::muteListChanged()
 	}
 }
 
-//////////////////////////////////////////////////////////////////////////////////////////
-// static
-void LLViewerMedia::setInWorldMediaDisabled(bool disabled)
-{
-	sInWorldMediaDisabled = disabled;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// static
-bool LLViewerMedia::getInWorldMediaDisabled()
-{
-	return sInWorldMediaDisabled;
-}
-
 //////////////////////////////////////////////////////////////////////////////////////////
 // static
 bool LLViewerMedia::isInterestingEnough(const LLVOVolume *object, const F64 &object_interest)
@@ -1568,7 +1553,6 @@ LLPluginClassMedia* LLViewerMedia::getSpareBrowserMediaSource()
 
 bool LLViewerMedia::hasInWorldMedia()
 {
-	if (sInWorldMediaDisabled) return false;
 	impl_list::iterator iter = sViewerMediaImplList.begin();
 	impl_list::iterator end = sViewerMediaImplList.end();
 	// This should be quick, because there should be very few non-in-world-media impls
@@ -1901,7 +1885,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
 		}
 	}
 	
-	LL_WARNS_ONCE("Plugin") << "plugin intialization failed for mime type: " << media_type << LL_ENDL;
+	LL_WARNS_ONCE("Plugin") << "plugin initialization failed for mime type: " << media_type << LL_ENDL;
 	LLSD args;
 	args["MIME_TYPE"] = media_type;
 	LLNotificationsUtil::add("NoPlugin", args);
@@ -3107,15 +3091,6 @@ bool LLViewerMediaImpl::isForcedUnloaded() const
 		return true;
 	}
 	
-	if(sInWorldMediaDisabled)
-	{
-		// When inworld media is disabled, all instances that aren't marked as "used in UI" will not be loaded.
-		if(!mUsedInUI)
-		{
-			return true;
-		}
-	}
-	
 	// If this media's class is not supposed to be shown, unload
 	if (!shouldShowBasedOnClass())
 	{
@@ -3783,12 +3758,22 @@ bool LLViewerMediaImpl::shouldShowBasedOnClass() const
 	
 	// If it is attached to an avatar and the pref is off, we shouldn't show it
 	if (attached_to_another_avatar)
-		return gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING);
-	
+	{
+		static LLCachedControl<bool> show_media_on_others(gSavedSettings, LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING);
+		return show_media_on_others;
+	}
 	if (inside_parcel)
-		return gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING);
+	{
+		static LLCachedControl<bool> show_media_within_parcel(gSavedSettings, LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING);
+
+		return show_media_within_parcel;
+	}
 	else 
-		return gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING);
+	{
+		static LLCachedControl<bool> show_media_outside_parcel(gSavedSettings, LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING);
+
+		return show_media_outside_parcel;
+	}
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index 15dcda59cfbd4017a0c40dc86af217ca0c3819cd..fff5b3fc089211ac9693295cf90e1ac2a78326e2 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -112,9 +112,6 @@ class LLViewerMedia
 	
 	static F32 getVolume();	
 	static void muteListChanged();
-	static void setInWorldMediaDisabled(bool disabled);
-	static bool getInWorldMediaDisabled();
-	
 	static bool isInterestingEnough(const LLVOVolume* object, const F64 &object_interest);
 	
 	// Returns the priority-sorted list of all media impls.
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 99540ccce918dc8d0e6f24280ce25bc9880e08d3..37cf916423638df79cc2728aef82617e507f247b 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -25,6 +25,11 @@
  */
 
 #include "llviewerprecompiledheaders.h"
+
+#ifdef INCLUDE_VLD
+#include "vld.h"
+#endif
+
 #include "llviewermenu.h" 
 
 // linden library includes
@@ -214,7 +219,7 @@ void near_sit_down_point(BOOL success, void *);
 
 
 void velocity_interpolate( void* );
-
+void handle_visual_leak_detector_toggle(void*);
 void handle_rebake_textures(void*);
 BOOL check_admin_override(void*);
 void handle_admin_override_toggle(void*);
@@ -2018,6 +2023,15 @@ class LLAdvancedToggleViewAdminOptions : public view_listener_t
 	}
 };
 
+class LLAdvancedToggleVisualLeakDetector : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		handle_visual_leak_detector_toggle(NULL);
+		return true;
+	}
+};
+
 class LLAdvancedCheckViewAdminOptions : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
@@ -3444,6 +3458,35 @@ void handle_admin_override_toggle(void*)
 	show_debug_menus();
 }
 
+void handle_visual_leak_detector_toggle(void*)
+{
+	static bool vld_enabled = false;
+
+	if ( vld_enabled )
+	{
+#ifdef INCLUDE_VLD
+		// only works for debug builds (hard coded into vld.h)
+#ifdef _DEBUG
+		// start with Visual Leak Detector turned off
+		VLDDisable();
+#endif // _DEBUG
+#endif // INCLUDE_VLD
+		vld_enabled = false;
+	}
+	else
+	{
+#ifdef INCLUDE_VLD
+		// only works for debug builds (hard coded into vld.h)
+	#ifdef _DEBUG
+		// start with Visual Leak Detector turned off
+		VLDEnable();
+	#endif // _DEBUG
+#endif // INCLUDE_VLD
+
+		vld_enabled = true;
+	};
+}
+
 void handle_god_mode(void*)
 {
 	gAgent.requestEnterGodMode();
@@ -7281,12 +7324,6 @@ class LLToolsUseSelectionForGrid : public view_listener_t
 		} func;
 		LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func);
 		LLSelectMgr::getInstance()->setGridMode(GRID_MODE_REF_OBJECT);
-
-		LLFloaterBuildOptions* build_options_floater = LLFloaterReg::getTypedInstance<LLFloaterBuildOptions>("build_options");
-		if (build_options_floater && build_options_floater->getVisible())
-		{
-			build_options_floater->setGridMode(GRID_MODE_REF_OBJECT);
-		}
 		return true;
 	}
 };
@@ -8243,6 +8280,8 @@ void initialize_menus()
 	view_listener_t::addMenu(new LLAdvancedEnableViewAdminOptions(), "Advanced.EnableViewAdminOptions");
 	view_listener_t::addMenu(new LLAdvancedToggleViewAdminOptions(), "Advanced.ToggleViewAdminOptions");
 	view_listener_t::addMenu(new LLAdvancedCheckViewAdminOptions(), "Advanced.CheckViewAdminOptions");
+	view_listener_t::addMenu(new LLAdvancedToggleVisualLeakDetector(), "Advanced.ToggleVisualLeakDetector");
+
 	view_listener_t::addMenu(new LLAdvancedRequestAdminStatus(), "Advanced.RequestAdminStatus");
 	view_listener_t::addMenu(new LLAdvancedLeaveAdminStatus(), "Advanced.LeaveAdminStatus");
 
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 7e830e14bf2b0d8ea5d4b9ea10003dc58e334478..f31f0364b320c2f58edb416099602215ffa469d1 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -527,8 +527,22 @@ class LLFileTakeSnapshotToDisk : public view_listener_t
 									   FALSE))
 		{
 			gViewerWindow->playSnapshotAnimAndSound();
-			
-			LLPointer<LLImageFormatted> formatted = new LLImagePNG;
+			LLPointer<LLImageFormatted> formatted;
+			LLFloaterSnapshot::ESnapshotFormat fmt = (LLFloaterSnapshot::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat");
+			switch (fmt)
+			{
+			case LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG:
+				formatted = new LLImageJPEG(gSavedSettings.getS32("SnapshotQuality"));
+				break;
+			default:
+				llwarns << "Unknown local snapshot format: " << fmt << llendl;
+			case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG:
+				formatted = new LLImagePNG;
+				break;
+			case LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP:
+				formatted = new LLImageBMP;
+				break;
+			}
 			formatted->enableOverSize() ;
 			formatted->encode(raw, 0);
 			formatted->disableOverSize() ;
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 3c6770df43fd84747e6f904f473b4ae7cce1b9e6..17c7644ec4afc6aa894e42d8a1152400db1935de 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -135,6 +135,7 @@ extern BOOL gDebugClicks;
 
 // function prototypes
 bool check_offer_throttle(const std::string& from_name, bool check_only);
+bool check_asset_previewable(const LLAssetType::EType asset_type);
 static void process_money_balance_reply_extended(LLMessageSystem* msg);
 
 //inventory offer throttle globals
@@ -1147,7 +1148,18 @@ bool check_offer_throttle(const std::string& from_name, bool check_only)
 		}
 	}
 }
- 
+
+// Return "true" if we have a preview method for that asset type, "false" otherwise
+bool check_asset_previewable(const LLAssetType::EType asset_type)
+{
+	return	(asset_type == LLAssetType::AT_NOTECARD)  || 
+			(asset_type == LLAssetType::AT_LANDMARK)  ||
+			(asset_type == LLAssetType::AT_TEXTURE)   ||
+			(asset_type == LLAssetType::AT_ANIMATION) ||
+			(asset_type == LLAssetType::AT_SCRIPT)    ||
+			(asset_type == LLAssetType::AT_SOUND);
+}
+
 void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_name)
 {
 	for (uuid_vec_t::const_iterator obj_iter = objects.begin();
@@ -1171,7 +1183,7 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam
 
 		// Either an inventory item or a category.
 		const LLInventoryItem* item = dynamic_cast<const LLInventoryItem*>(obj);
-		if (item)
+		if (item && check_asset_previewable(asset_type))
 		{
 			////////////////////////////////////////////////////////////////////////////////
 			// Special handling for various types.
@@ -1246,6 +1258,7 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam
 						LLFloaterReg::showInstance("preview_sound", LLSD(obj_id), take_focus);
 						break;
 					default:
+						LL_DEBUGS("Messaging") << "No preview method for previewable asset type : " << LLAssetType::lookupHumanReadable(asset_type)  << LL_ENDL;
 						break;
 				}
 			}
@@ -2360,8 +2373,15 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
 
 			bool mute_im = is_muted;
-			if(accept_im_from_only_friend&&!is_friend)
+			if (accept_im_from_only_friend && !is_friend)
 			{
+				if (!gIMMgr->isNonFriendSessionNotified(session_id))
+				{
+					std::string message = LLTrans::getString("IM_unblock_only_groups_friends");
+					gIMMgr->addMessage(session_id, from_id, name, message);
+					gIMMgr->addNotifiedNonFriendSessionID(session_id);
+				}
+
 				mute_im = true;
 			}
 			if (!mute_im || is_linden) 
@@ -6823,12 +6843,14 @@ void process_covenant_reply(LLMessageSystem* msg, void**)
 
 	LLPanelEstateCovenant::updateEstateName(estate_name);
 	LLPanelLandCovenant::updateEstateName(estate_name);
+	LLPanelEstateInfo::updateEstateName(estate_name);
 	LLFloaterBuyLand::updateEstateName(estate_name);
 
 	std::string owner_name =
 		LLSLURL("agent", estate_owner_id, "inspect").getSLURLString();
 	LLPanelEstateCovenant::updateEstateOwnerName(owner_name);
 	LLPanelLandCovenant::updateEstateOwnerName(owner_name);
+	LLPanelEstateInfo::updateEstateOwnerName(owner_name);
 	LLFloaterBuyLand::updateEstateOwnerName(owner_name);
 
 	LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel<LLPanelPlaceProfile>("places", "panel_place_profile");
diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h
index d8acd99953844cb18ead8aca25b722a99e6ed67e..46bfb2dad06f614dd4c609e298392794e928404c 100644
--- a/indra/newview/llviewermessage.h
+++ b/indra/newview/llviewermessage.h
@@ -35,6 +35,7 @@
 #include "message.h"
 #include "stdenums.h"
 #include "llnotifications.h"
+#include "llextendedstatus.h"
 
 //
 // Forward declarations
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index b41ed00f17c6da7bf62053b6476878c16ebdff2c..99102309a16fdd0fcdd3cdfa23929dcce44aa54a 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -187,7 +187,7 @@ class LLEmbeddedItemSegment : public LLTextSegment
 		else
 		{
 			width = EMBEDDED_ITEM_LABEL_PADDING + mImage->getWidth() + mStyle->getFont()->getWidth(mLabel.c_str());
-			height = llmax(mImage->getHeight(), llceil(mStyle->getFont()->getLineHeight()));
+			height = llmax(mImage->getHeight(), mStyle->getFont()->getLineHeight());
 		}
 		return false;
 	}
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index e0653fec30699ce7e79586617e4603c79cb1b233..ecd76f5495edc4611be211c95c91d263e8b447f4 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -27,9 +27,6 @@
 #include "llviewerprecompiledheaders.h"
 #include "llviewerwindow.h"
 
-#if LL_WINDOWS
-#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
-#endif
 
 // system library includes
 #include <stdio.h>
@@ -49,7 +46,6 @@
 #include "llviewquery.h"
 #include "llxmltree.h"
 #include "llslurl.h"
-//#include "llviewercamera.h"
 #include "llrender.h"
 
 #include "llvoiceclient.h"	// for push-to-talk button handling
@@ -1540,14 +1536,14 @@ LLViewerWindow::LLViewerWindow(const Params& p)
 	mResDirty(false),
 	mStatesDirty(false),
 	mCurrResolutionIndex(0),
+	mProgressView(NULL)
+{
 	// gKeyboard is still NULL, so it doesn't do LLWindowListener any good to
 	// pass its value right now. Instead, pass it a nullary function that
 	// will, when we later need it, return the value of gKeyboard.
 	// boost::lambda::var() constructs such a functor on the fly.
-	mWindowListener(new LLWindowListener(this, boost::lambda::var(gKeyboard))),
-	mViewerWindowListener(new LLViewerWindowListener(this)),
-	mProgressView(NULL)
-{
+	mWindowListener.reset(new LLWindowListener(this, boost::lambda::var(gKeyboard)));
+	mViewerWindowListener.reset(new LLViewerWindowListener(this));
 	LLNotificationChannel::buildChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alert"));
 	LLNotificationChannel::buildChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alertmodal"));
 
@@ -2165,13 +2161,19 @@ void LLViewerWindow::reshape(S32 width, S32 height)
 			// tell the OS specific window code about min window size
 			mWindow->setMinSize(min_window_width, min_window_height);
 
+			LLCoordScreen window_rect;
+			if (mWindow->getSize(&window_rect))
+			{
 			// Only save size if not maximized
-			gSavedSettings.setU32("WindowWidth", mWindowRectRaw.getWidth());
-			gSavedSettings.setU32("WindowHeight", mWindowRectRaw.getHeight());
+				gSavedSettings.setU32("WindowWidth", window_rect.mX);
+				gSavedSettings.setU32("WindowHeight", window_rect.mY);
+			}
 		}
 
 		LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_WIDTH, (F64)width);
 		LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_HEIGHT, (F64)height);
+
+		LLLayoutStack::updateClass();
 	}
 }
 
@@ -2375,7 +2377,7 @@ void LLViewerWindow::draw()
 
 			gGL.matrixMode(LLRender::MM_MODELVIEW);
 			LLUI::pushMatrix();
-			LLUI::translate( (F32) screen_x, (F32) screen_y, 0.f);
+			LLUI::translate( (F32) screen_x, (F32) screen_y);
 			top_ctrl->draw();	
 			LLUI::popMatrix();
 		}
@@ -3183,12 +3185,6 @@ void LLViewerWindow::updateLayout()
 		//gMenuBarView->setItemVisible("BuildTools", gFloaterTools->getVisible());
 	}
 
-	LLFloaterBuildOptions* build_options_floater = LLFloaterReg::findTypedInstance<LLFloaterBuildOptions>("build_options");
-	if (build_options_floater && build_options_floater->getVisible())
-	{
-		build_options_floater->updateGridMode();
-	}
-
 	// Always update console
 	if(gConsole)
 	{
@@ -4106,14 +4102,11 @@ void LLViewerWindow::resetSnapshotLoc()
 void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
 {
 	LLCoordWindow size;
+	LLCoordWindow new_size(new_width, new_height);
 	gViewerWindow->getWindow()->getSize(&size);
-	if ( size.mX != new_width
-		|| size.mY != new_height)
+	if ( size != new_size )
 	{
-		LLCoordWindow new_size(new_width, new_height);
-		LLCoordScreen screen_size;
-		gViewerWindow->getWindow()->convertCoords(new_size, &screen_size);
-		gViewerWindow->getWindow()->setSize(screen_size);
+		gViewerWindow->getWindow()->setSize(new_size);
 	}
 }
 
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index bc7f5a9744a326d68fa051757296eedb1f4e1d32..a3a40de5ebbcb8ed0834570ae92fcc69dd5227c2 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -149,10 +149,6 @@ const F32 PELVIS_LAG_WALKING	= 0.4f;	// ...while walking
 const F32 PELVIS_LAG_MOUSELOOK = 0.15f;
 const F32 MOUSELOOK_PELVIS_FOLLOW_FACTOR = 0.5f;
 const F32 PELVIS_LAG_WHEN_FOLLOW_CAM_IS_ON = 0.0001f; // not zero! - something gets divided by this!
-
-const F32 PELVIS_ROT_THRESHOLD_SLOW = 60.0f;	// amount of deviation allowed between
-const F32 PELVIS_ROT_THRESHOLD_FAST = 2.0f;	// the pelvis and the view direction
-											// when moving fast & slow
 const F32 TORSO_NOISE_AMOUNT = 1.0f;	// Amount of deviation from up-axis, in degrees
 const F32 TORSO_NOISE_SPEED = 0.2f;	// Time scale factor on torso noise.
 
@@ -3652,7 +3648,11 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
 			BOOL self_in_mouselook = isSelf() && gAgentCamera.cameraMouselook();
 
 			LLVector3 pelvisDir( mRoot.getWorldMatrix().getFwdRow4().mV );
-			F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, PELVIS_ROT_THRESHOLD_SLOW, PELVIS_ROT_THRESHOLD_FAST);
+
+			static LLCachedControl<F32> s_pelvis_rot_threshold_slow(gSavedSettings, "AvatarRotateThresholdSlow");
+			static LLCachedControl<F32> s_pelvis_rot_threshold_fast(gSavedSettings, "AvatarRotateThresholdFast");
+
+			F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, s_pelvis_rot_threshold_slow, s_pelvis_rot_threshold_fast);
 						
 			if (self_in_mouselook)
 			{
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index e525d6bad078f80194870f0d6b544401c3267f1c..f063653cc5555ab84f3ee05f2317e5a1d00b67b0 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -366,9 +366,9 @@ BOOL LLVOAvatarSelf::buildMenus()
 						item_params.label = sub_piemenu_name;
 					}
 					item_params.name =(item_params.label );
-					item_params.on_click.function_name = "Attachment.Detach";
+					item_params.on_click.function_name = "Attachment.DetachFromPoint";
 					item_params.on_click.parameter = iter->first;
-					item_params.on_enable.function_name = "Attachment.EnableDetach";
+					item_params.on_enable.function_name = "Attachment.PointFilled";
 					item_params.on_enable.parameter = iter->first;
 					LLMenuItemCallGL* item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
 
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index e50851b8e76488dbdf8ac4659876700301d38cda..a20ee8686b3a576fac36bcf16976b0587cc6b43b 100644
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -513,7 +513,7 @@ void LLWorldMapView::draw()
 					 TRUE,
 					 "You are here",
 					 "",
-					 llround(LLFontGL::getFontSansSerifSmall()->getLineHeight())); // offset vertically by one line, to avoid overlap with target tracking
+					 LLFontGL::getFontSansSerifSmall()->getLineHeight()); // offset vertically by one line, to avoid overlap with target tracking
 	}
 
 	// Draw the current agent viewing angle
@@ -992,7 +992,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4&
 	const S32 TEXT_PADDING = DEFAULT_TRACKING_ARROW_SIZE + 2;
 	S32 half_text_width = llfloor(font->getWidthF32(label) * 0.5f);
 	text_x = llclamp(text_x, half_text_width + TEXT_PADDING, getRect().getWidth() - half_text_width - TEXT_PADDING);
-	text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - llround(font->getLineHeight()) - TEXT_PADDING - vert_offset);
+	text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - font->getLineHeight() - TEXT_PADDING - vert_offset);
 
 	if (label != "")
 	{
@@ -1005,7 +1005,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4&
 
 		if (tooltip != "")
 		{
-			text_y -= (S32)font->getLineHeight();
+			text_y -= font->getLineHeight();
 
 			font->renderUTF8(
 				tooltip, 0,
@@ -1203,7 +1203,7 @@ void LLWorldMapView::drawIconName(F32 x_pixels,
 		LLFontGL::NORMAL, 
 		LLFontGL::DROP_SHADOW);
 
-	text_y -= llround(LLFontGL::getFontSansSerif()->getLineHeight());
+	text_y -= LLFontGL::getFontSansSerif()->getLineHeight();
 
 	// render text
 	LLFontGL::getFontSansSerif()->renderUTF8(second_line, 0,
diff --git a/indra/newview/skins/default/xui/de/panel_status_bar.xml b/indra/newview/skins/default/xui/de/panel_status_bar.xml
index 2493d60df6697edbbabbe0b81fdbef6d468decba..14ace0ac3af0d071f3365356a2017bffeacf7360 100644
--- a/indra/newview/skins/default/xui/de/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/de/panel_status_bar.xml
@@ -15,7 +15,7 @@
 	<panel.string name="buycurrencylabel">
 		[AMT] L$
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-415" name="balance_bg" width="205">
 		<text name="balance" tool_tip="Klicken, um L$-Guthaben zu aktualisieren" value="20 L$"/>
 		<button label="L$ kaufen" name="buyL" tool_tip="Hier klicken, um mehr L$ zu kaufen"/>
 		<button label="Einkaufen" name="goShop" tool_tip="Second Life-Marktplatz öffnen" width="85"/>
diff --git a/indra/newview/skins/default/xui/en/floater_aaa.xml b/indra/newview/skins/default/xui/en/floater_aaa.xml
index 930bbaa8cb10b74b80ce297f27bd71d56649c7fb..d11373ce1d574c7a35cd08fcc6df7bf19ffbeb90 100644
--- a/indra/newview/skins/default/xui/en/floater_aaa.xml
+++ b/indra/newview/skins/default/xui/en/floater_aaa.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- legacy_header_height="18"
  can_minimize="false"
  can_tear_off="false"
  can_resize="true"
@@ -16,67 +15,98 @@
  save_dock_state="true"
  save_visibility="true"
  single_instance="true" 
- width="320">
-  <string name="nudge_parabuild" translate="false">Nudge 1</string>
-  <string name="test_the_vlt">This string CHANGE2 is extracted.</string>
-  <string name="testing_eli">Just a test. changes.</string>
-  <text_editor
-   parse_urls="true"
-   bg_readonly_color="ChatHistoryBgColor"
-   bg_writeable_color="ChatHistoryBgColor" 
-   border_visible="false"
-   follows="all"
-   font="SansSerif" 
-	 left="1"
-   top="20"
-   layout="topleft"
-	 height="260"
-   name="chat_history"
-   max_length="200000" 
-   parse_highlights="true"
-   text_color="ChatHistoryTextColor"
-   text_readonly_color="ChatHistoryTextColor"
-   translate="false"
-   track_end="true" 
-   wrap="true" 
-   width="320">
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    Really long line that is long enough to wrap once with jyg descenders.
-    </text_editor>
+ width="650">
+  <text left="0"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"        
+        bottom="-5"
+        width="100"
+        valign="top">
+this
+is
+some
+text
+that
+is
+top
+aligned</text>
+  <text left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        bottom="-5"
+        clip_partial="true"
+        width="100"
+        valign="center">
+this
+is
+some
+text
+that
+is
+center
+aligned</text>
+  <text left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"        
+        bottom="-5"
+        width="100"
+        valign="bottom">
+this
+is
+some
+text
+that
+is
+bottom
+aligned</text>
+  <text_editor left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"
+        bottom="-5"
+        width="100"
+        valign="top">
+this
+is
+some
+text
+that
+is
+top
+aligned
+  </text_editor>
+  <text_editor left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        bottom="-5"
+        clip_partial="true"
+        width="100"
+        valign="center">
+this
+is
+some
+text
+that
+is
+center
+aligned
+  </text_editor>
+  <text_editor left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"
+        bottom="-5"
+        width="100"
+        valign="bottom">
+this
+is
+some
+text
+that
+is
+bottom
+aligned
+  </text_editor>
 </floater>
diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml
index c7e9ec781daa343bdbf3ff75220412b4df54548e..060d88900327b5adf81538625697af44b2c9d353 100644
--- a/indra/newview/skins/default/xui/en/floater_about.xml
+++ b/indra/newview/skins/default/xui/en/floater_about.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="centered"
+ positioning="centered"
  legacy_header_height="18"
  height="440"
  layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml
index 1d5a6740b74d9266ec9056563defe2b65f2341e3..aa7c6e5ed7d5d1d962631ced291172c429c39d36 100644
--- a/indra/newview/skins/default/xui/en/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/en/floater_about_land.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  can_tear_off="false"
  height="420"
  layout="topleft"
@@ -192,12 +192,12 @@
              type="string"
              length="1"
              follows="left|top"
-             height="20"
+             height="18"
              layout="topleft"
              left_pad="2"
              valign="center" 
              name="ContentRatingText"
-             top_delta="0"
+             top_delta="-2"
              width="250">
                 Adult
             </text>
@@ -209,7 +209,7 @@
              layout="topleft"
              left="10"
              name="Owner:"
-             top_pad="1"
+             top_pad="3"
              width="100">
                 Owner:
             </text>
@@ -736,7 +736,7 @@
              height="16"
              layout="topleft"
              left_pad="10"
-             top_delta="-3" 
+             top_delta="-1" 
              mouse_opaque="false"
              name="region_maturity_text"
              valign="center" 
@@ -1951,7 +1951,7 @@ Only large parcels can be listed in search.
 			 name="access_estate_defined">
 				(Defined by the Estate)
 			</panel.string>
-            <panel.string
+      <panel.string
              name="estate_override">
                 One or more of these options is set at the estate level
             </panel.string>
@@ -2085,7 +2085,7 @@ Only large parcels can be listed in search.
              column_padding="0"
              follows="top|bottom"
              heading_height="14"
-             height="120"
+             height="125"
              layout="topleft"
              left="0"
              multi_select="true"
@@ -2134,7 +2134,7 @@ Only large parcels can be listed in search.
              column_padding="0"
              follows="top|bottom"
              heading_height="14"
-             height="120"
+             height="125"
              layout="topleft"
              left="0"
              multi_select="true"
diff --git a/indra/newview/skins/default/xui/en/floater_avatar.xml b/indra/newview/skins/default/xui/en/floater_avatar.xml
index 82c340300823b5f509e9b421eadbc37b63c5a55b..cd5cca02bdb19023929b882956c8308713bb7f6b 100644
--- a/indra/newview/skins/default/xui/en/floater_avatar.xml
+++ b/indra/newview/skins/default/xui/en/floater_avatar.xml
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  ignore_ui_scale="false"
  legacy_header_height="225"
  can_minimize="true"
  can_close="true"
  can_resize="true"
  min_height="230"
- min_width="450"
+ min_width="515"
  height="230"
  layout="topleft"
  name="Avatar"
diff --git a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
index cbbbeb609481a49ce10f0c3b6111d078e447f4b6..1a55dc2e2ce46108413c32671dd27c480783defe 100644
--- a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
+++ b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  legacy_header_height="18"
  can_resize="true"
  height="350"
diff --git a/indra/newview/skins/default/xui/en/floater_build_options.xml b/indra/newview/skins/default/xui/en/floater_build_options.xml
index 35918e9705d65093740cedd016fb9e945d857f93..38428b36fc6d55c4cfdbe4b2b1a96f3f3dc2c3e8 100644
--- a/indra/newview/skins/default/xui/en/floater_build_options.xml
+++ b/indra/newview/skins/default/xui/en/floater_build_options.xml
@@ -1,70 +1,13 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
  legacy_header_height="18"
- height="198"
+ height="170"
  layout="topleft"
  name="build options floater"
  help_topic="build_options_floater"
  save_rect="true"
  title="GRID OPTIONS"
  width="264">
- 	<floater.string
-     name="grid_screen_text">
-        Screen
-    </floater.string>
-    <floater.string
-     name="grid_local_text">
-        Local
-    </floater.string>
-    <floater.string
-     name="grid_world_text">
-        World
-    </floater.string>
-    <floater.string
-     name="grid_reference_text">
-        Reference
-    </floater.string>
-    <floater.string
-     name="grid_attachment_text">
-        Attachment
-    </floater.string>
-    <text
-     type="string"
-     length="1"
-     follows="left|top"
-     height="16"
-     layout="topleft"
-     left="10"
-     tool_tip="Grid opacity"
-     name="grid_mode_label"
-     top_pad="30"
-     width="123">
-        Mode
-    </text>
-    <combo_box
-     height="23"
-     layout="topleft"
-     left_pad="9"
-     follows="left|top"
-     name="combobox grid mode"
-     tool_tip="Choose the type of grid ruler for positioning the object"
-     top_delta="-3"
-     width="108">
-      <combo_box.item
-       label="World grid"
-       name="World"
-       value="World" />
-      <combo_box.item
-       label="Local grid"
-       name="Local"
-       value="Local" />
-      <combo_box.item
-       label="Reference grid"
-       name="Reference"
-       value="Reference" />
-       <combo_box.commit_callback
-      function="GridOptions.gridMode"/>
-    </combo_box>
     <spinner
      control_name="GridResolution"
      follows="left|top"
@@ -77,7 +20,7 @@
      max_val="5"
      min_val="0.01"
      name="GridResolution"
-     top_pad="4"
+     top_pad="30"
      width="200" />
     <spinner
      control_name="GridDrawSize"
diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml
index 4673c6def59a729e2a241588dbff3ae60e175d09..22bc488a925377a06c974a10b9bd11393c3f726f 100644
--- a/indra/newview/skins/default/xui/en/floater_camera.xml
+++ b/indra/newview/skins/default/xui/en/floater_camera.xml
@@ -1,8 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="specified"
- specified_left="458"
- specified_bottom="80"
+ positioning="specified"
+ left="458"
+ bottom="-80"
+ follows="left|bottom"
  legacy_header_height="18"
  can_minimize="true"
  can_close="true"
diff --git a/indra/newview/skins/default/xui/en/floater_chat_bar.xml b/indra/newview/skins/default/xui/en/floater_chat_bar.xml
index 63992462b34a33973cdd5675a6ad6eadfb203399..688a01ce7bc2d05a8b43a0ef906a73509c312bf3 100644
--- a/indra/newview/skins/default/xui/en/floater_chat_bar.xml
+++ b/indra/newview/skins/default/xui/en/floater_chat_bar.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="specified"
- specified_left="10"
- specified_bottom="10"
+ positioning="specified"
+ left="10"
+ bottom="-10"
  height="60"
  layout="topleft"
  legacy_header_height="25"
diff --git a/indra/newview/skins/default/xui/en/floater_choose_group.xml b/indra/newview/skins/default/xui/en/floater_choose_group.xml
index dc1ee5f24e21f5b4bf7591adb1d9a4a40e831ca4..2cf6e682fde9d484d7c778c5f2246391fc69e090 100644
--- a/indra/newview/skins/default/xui/en/floater_choose_group.xml
+++ b/indra/newview/skins/default/xui/en/floater_choose_group.xml
@@ -20,7 +20,7 @@
         Choose a group:
     </text>
     <scroll_list
-     height="160"
+     height="165"
      layout="topleft"
      left_delta="0"
      name="group list"
diff --git a/indra/newview/skins/default/xui/en/floater_critical.xml b/indra/newview/skins/default/xui/en/floater_critical.xml
index 13b15bf724060976b62fdae0f1a1437628d08e66..143bcb44300ad988dbc8590fa0d8bbed27255062 100644
--- a/indra/newview/skins/default/xui/en/floater_critical.xml
+++ b/indra/newview/skins/default/xui/en/floater_critical.xml
@@ -6,7 +6,7 @@
  height="500"
  layout="topleft"
  name="modal container"
- open_positioning="centered"
+ positioning="centered"
  width="600">
     <button
      height="20"
diff --git a/indra/newview/skins/default/xui/en/floater_destinations.xml b/indra/newview/skins/default/xui/en/floater_destinations.xml
index 373114a1eb8a748170552b2dcf1450fd86defe16..39aa8e07bb647b5131ad52614b8429aa6d4b2d33 100644
--- a/indra/newview/skins/default/xui/en/floater_destinations.xml
+++ b/indra/newview/skins/default/xui/en/floater_destinations.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  ignore_ui_scale="false"
  legacy_header_height="225"
  can_minimize="true"
diff --git a/indra/newview/skins/default/xui/en/floater_fast_timers.xml b/indra/newview/skins/default/xui/en/floater_fast_timers.xml
index 49aa8f384008638e734b0a7bab7ab2f6adeed287..77adb5524e7b073931d9e38744c46734ed250029 100644
--- a/indra/newview/skins/default/xui/en/floater_fast_timers.xml
+++ b/indra/newview/skins/default/xui/en/floater_fast_timers.xml
@@ -22,7 +22,6 @@
           top="5"
           width="180"
           height="40"
-          pad_bottom="-5"
           label="Pause"
           font="SansSerifHuge"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/en/floater_gesture.xml b/indra/newview/skins/default/xui/en/floater_gesture.xml
index b96a94a849b2e299e169ee31fd072d26960eaca8..200e9b9537c2228ad07e799201ce8c3b84b999d4 100644
--- a/indra/newview/skins/default/xui/en/floater_gesture.xml
+++ b/indra/newview/skins/default/xui/en/floater_gesture.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  save_rect="true"
  legacy_header_height="18"
  can_resize="true"
diff --git a/indra/newview/skins/default/xui/en/floater_help_browser.xml b/indra/newview/skins/default/xui/en/floater_help_browser.xml
index cd075abc415f5762666fb493d595443c8fd5edd6..c06cb63f8acd1b414d814a5e708740f7306dcc38 100644
--- a/indra/newview/skins/default/xui/en/floater_help_browser.xml
+++ b/indra/newview/skins/default/xui/en/floater_help_browser.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  legacy_header_height="18"
  can_resize="true"
  height="600"
diff --git a/indra/newview/skins/default/xui/en/floater_joystick.xml b/indra/newview/skins/default/xui/en/floater_joystick.xml
index 6e1bb8fcd02fa9b8469766331d618122832b4911..59f6a9434c4ac5661411b878b34c9874b0b2c765 100644
--- a/indra/newview/skins/default/xui/en/floater_joystick.xml
+++ b/indra/newview/skins/default/xui/en/floater_joystick.xml
@@ -13,6 +13,7 @@
     </floater.string>
     <check_box
      bottom="38"
+     height="10"
      control_name="JoystickEnabled"
      halign="left"
      label="Enable Joystick:"
@@ -28,6 +29,7 @@
      width="380" />
     <spinner
      bottom="48"
+     height="10"
      control_name="JoystickAxis1"
      decimal_digits="0"
      increment="1"
@@ -41,6 +43,7 @@
      width="140" />
     <spinner
      bottom="48"
+     height="10"     
      control_name="JoystickAxis2"
      decimal_digits="0"
      increment="1"
@@ -54,6 +57,7 @@
      width="140" />
     <spinner
      bottom="48"
+     height="10"     
      control_name="JoystickAxis0"
      decimal_digits="0"
      increment="1"
@@ -67,6 +71,7 @@
      width="140" />
     <spinner
      bottom="68"
+     height="10"     
      control_name="JoystickAxis4"
      decimal_digits="0"
      increment="1"
@@ -80,6 +85,7 @@
      width="140" />
     <spinner
      bottom="68"
+     height="10"     
      control_name="JoystickAxis5"
      decimal_digits="0"
      increment="1"
@@ -93,6 +99,7 @@
      width="140" />
     <spinner
      bottom="68"
+     height="10"     
      control_name="JoystickAxis3"
      decimal_digits="0"
      increment="1"
@@ -106,6 +113,7 @@
      width="140" />
     <spinner
      bottom="88"
+     height="10"     
      control_name="JoystickAxis6"
      decimal_digits="0"
      increment="1"
@@ -119,6 +127,7 @@
      width="140" />
     <check_box
      bottom_delta="18"
+     height="10"
      control_name="ZoomDirect"
      label="Direct Zoom"
      layout="topleft"
@@ -127,6 +136,7 @@
      width="60" />
     <check_box
      bottom_delta="0"
+     height="10"     
      control_name="Cursor3D"
      label="3D Cursor"
      layout="topleft"
@@ -135,6 +145,7 @@
      width="60" />
     <check_box
      bottom_delta="0"
+     height="10"     
      control_name="AutoLeveling"
      label="Auto Level"
      layout="topleft"
@@ -157,6 +168,7 @@
     </text>
     <check_box
      bottom="127"
+     height="10"     
      control_name="JoystickAvatarEnabled"
      halign="center"
      label="Avatar"
@@ -166,6 +178,7 @@
      width="60" />
     <check_box
      bottom="127"
+     height="10"     
      control_name="JoystickBuildEnabled"
      halign="center"
      label="Build"
@@ -175,6 +188,7 @@
      width="60" />
     <check_box
      bottom="127"
+     height="10"     
      control_name="JoystickFlycamEnabled"
      halign="center"
      label="Flycam"
@@ -257,6 +271,7 @@
     </text>
     <spinner
      bottom="144"
+     height="10"     
      control_name="AvatarAxisScale1"
      decimal_digits="2"
      label_width="0"
@@ -268,6 +283,7 @@
      width="56" />
     <spinner
      bottom="144"
+     height="10"     
      control_name="BuildAxisScale1"
      decimal_digits="2"
      label_width="0"
@@ -279,6 +295,7 @@
      width="56" />
     <spinner
      bottom="144"
+     height="10"     
      control_name="FlycamAxisScale1"
      decimal_digits="2"
      label_width="0"
@@ -301,6 +318,7 @@
     </text>
     <spinner
      bottom="164"
+     height="10"     
      control_name="AvatarAxisScale2"
      decimal_digits="2"
      label_width="0"
@@ -312,6 +330,7 @@
      width="56" />
     <spinner
      bottom="164"
+     height="10"     
      control_name="BuildAxisScale2"
      decimal_digits="2"
      label_width="0"
@@ -323,6 +342,7 @@
      width="56" />
     <spinner
      bottom="164"
+     height="10"     
      control_name="FlycamAxisScale2"
      decimal_digits="2"
      label_width="0"
@@ -345,6 +365,7 @@
     </text>
     <spinner
      bottom="184"
+     height="10"     
      control_name="AvatarAxisScale0"
      decimal_digits="2"
      label_width="0"
@@ -356,6 +377,7 @@
      width="56" />
     <spinner
      bottom="184"
+     height="10"     
      control_name="BuildAxisScale0"
      decimal_digits="2"
      label_width="0"
@@ -367,6 +389,7 @@
      width="56" />
     <spinner
      bottom="184"
+     height="10"     
      control_name="FlycamAxisScale0"
      decimal_digits="2"
      label_width="0"
@@ -389,6 +412,7 @@
     </text>
     <spinner
      bottom="204"
+     height="10"     
      control_name="AvatarAxisScale4"
      decimal_digits="2"
      label_width="0"
@@ -400,6 +424,7 @@
      width="56" />
     <spinner
      bottom="204"
+     height="10"     
      control_name="BuildAxisScale4"
      decimal_digits="2"
      label_width="0"
@@ -411,6 +436,7 @@
      width="56" />
     <spinner
      bottom="204"
+     height="10"     
      control_name="FlycamAxisScale4"
      decimal_digits="2"
      label_width="0"
@@ -433,6 +459,7 @@
     </text>
     <spinner
      bottom="224"
+     height="10"
      control_name="AvatarAxisScale5"
      decimal_digits="2"
      label_width="0"
@@ -444,6 +471,7 @@
      width="56" />
     <spinner
      bottom="224"
+     height="10"
      control_name="BuildAxisScale5"
      decimal_digits="2"
      label_width="0"
@@ -455,6 +483,7 @@
      width="56" />
     <spinner
      bottom="224"
+     height="10"
      control_name="FlycamAxisScale5"
      decimal_digits="2"
      label_width="0"
@@ -477,6 +506,7 @@
     </text>
     <spinner
      bottom="244"
+     height="10"
      control_name="BuildAxisScale3"
      decimal_digits="2"
      label_width="0"
@@ -488,6 +518,7 @@
      width="56" />
     <spinner
      bottom="244"
+     height="10"
      control_name="FlycamAxisScale3"
      decimal_digits="2"
      label_width="0"
@@ -510,6 +541,7 @@
     </text>
     <spinner
      bottom="274"
+     height="10"
      control_name="AvatarAxisDeadZone1"
      decimal_digits="2"
      increment="0.01"
@@ -520,6 +552,7 @@
      width="56" />
     <spinner
      bottom="274"
+     height="10"
      control_name="BuildAxisDeadZone1"
      decimal_digits="2"
      increment="0.01"
@@ -530,6 +563,7 @@
      width="56" />
     <spinner
      bottom="274"
+     height="10"
      control_name="FlycamAxisDeadZone1"
      decimal_digits="2"
      increment="0.01"
@@ -551,6 +585,7 @@
     </text>
     <spinner
      bottom="294"
+     height="10"     
      control_name="AvatarAxisDeadZone2"
      decimal_digits="2"
      increment="0.01"
@@ -561,6 +596,7 @@
      width="56" />
     <spinner
      bottom="294"
+     height="10"
      control_name="BuildAxisDeadZone2"
      decimal_digits="2"
      increment="0.01"
@@ -571,6 +607,7 @@
      width="56" />
     <spinner
      bottom="294"
+     height="10"
      control_name="FlycamAxisDeadZone2"
      decimal_digits="2"
      increment="0.01"
@@ -592,6 +629,7 @@
     </text>
     <spinner
      bottom="314"
+     height="10"
      control_name="AvatarAxisDeadZone0"
      decimal_digits="2"
      increment="0.01"
@@ -602,6 +640,7 @@
      width="56" />
     <spinner
      bottom="314"
+     height="10"
      control_name="BuildAxisDeadZone0"
      decimal_digits="2"
      increment="0.01"
@@ -612,6 +651,7 @@
      width="56" />
     <spinner
      bottom="314"
+     height="10"
      control_name="FlycamAxisDeadZone0"
      decimal_digits="2"
      increment="0.01"
@@ -633,6 +673,7 @@
     </text>
     <spinner
      bottom="334"
+     height="10"
      control_name="AvatarAxisDeadZone4"
      decimal_digits="2"
      increment="0.01"
@@ -643,6 +684,7 @@
      width="56" />
     <spinner
      bottom="334"
+     height="10"
      control_name="BuildAxisDeadZone4"
      decimal_digits="2"
      increment="0.01"
@@ -653,6 +695,7 @@
      width="56" />
     <spinner
      bottom="334"
+     height="10"
      control_name="FlycamAxisDeadZone4"
      decimal_digits="2"
      increment="0.01"
@@ -674,6 +717,7 @@
     </text>
     <spinner
      bottom="354"
+     height="10"
      control_name="AvatarAxisDeadZone5"
      decimal_digits="2"
      increment="0.01"
@@ -684,6 +728,7 @@
      width="56" />
     <spinner
      bottom="354"
+     height="10"
      control_name="BuildAxisDeadZone5"
      decimal_digits="2"
      increment="0.01"
@@ -694,6 +739,7 @@
      width="56" />
     <spinner
      bottom="354"
+     height="10"
      control_name="FlycamAxisDeadZone5"
      decimal_digits="2"
      increment="0.01"
@@ -715,6 +761,7 @@
     </text>
     <spinner
      bottom="374"
+     height="10"
      control_name="BuildAxisDeadZone3"
      decimal_digits="2"
      increment="0.01"
@@ -725,6 +772,7 @@
      width="56" />
     <spinner
      bottom="374"
+     height="10"
      control_name="FlycamAxisDeadZone3"
      decimal_digits="2"
      increment="0.01"
@@ -802,6 +850,7 @@
     </text>
     <spinner
      bottom="430"
+     height="10"
      control_name="FlycamAxisScale6"
      decimal_digits="2"
      label_width="0"
@@ -824,6 +873,7 @@
     </text>
     <spinner
      bottom="450"
+     height="10"
      control_name="FlycamAxisDeadZone6"
      decimal_digits="2"
      increment="0.01"
diff --git a/indra/newview/skins/default/xui/en/floater_land_holdings.xml b/indra/newview/skins/default/xui/en/floater_land_holdings.xml
index 3737294ebe633bb0b9e0e65c7e6182f305181435..390ec9ab7d4015364fbc0bcd1660fb2acc994377 100644
--- a/indra/newview/skins/default/xui/en/floater_land_holdings.xml
+++ b/indra/newview/skins/default/xui/en/floater_land_holdings.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="centered"
+ positioning="centered"
  legacy_header_height="18"
  height="430"
  layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/floater_map.xml b/indra/newview/skins/default/xui/en/floater_map.xml
index 3eeebcf120628eb393daa6b73d77056f9e41d3aa..b8893e11d90207b5430afd4630aadccc0f57fc44 100644
--- a/indra/newview/skins/default/xui/en/floater_map.xml
+++ b/indra/newview/skins/default/xui/en/floater_map.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  can_minimize="true" 
  can_resize="true"
  chrome="true"
diff --git a/indra/newview/skins/default/xui/en/floater_merchant_outbox.xml b/indra/newview/skins/default/xui/en/floater_merchant_outbox.xml
index 6f387f4800b47fc02d8c25158f00fd9e51c6f3d9..72d2281435b9957f8b74746ffc6ba36bb91b4ddb 100644
--- a/indra/newview/skins/default/xui/en/floater_merchant_outbox.xml
+++ b/indra/newview/skins/default/xui/en/floater_merchant_outbox.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <floater
-    open_positioning="cascading"
+    positioning="cascading"
     can_close="true"
     can_resize="true"
     height="440"
@@ -99,7 +99,7 @@
             halign="center"
             font="SansSerifMedium"
             font_shadow="hard"
-            valign="bottom">
+            valign="top">
           Drag items here to create folders
         </text>
       </panel>
@@ -114,7 +114,7 @@
           height="20"
           wrap="true"
           halign="left"
-          valign="bottom"
+          valign="center"
           font="SansSerif" />
       <button
           label="Send to Marketplace"
diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml
index eebc5ddc72ae0f72a9ef7af040faba327504b68e..0e211551e67dc099c159b46688f30d1405590dd7 100644
--- a/indra/newview/skins/default/xui/en/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml
@@ -117,18 +117,18 @@
              name="lod_tab_border"
              top_pad="0"
              width="619" />
-            <text
-             follows="left|top"
-             height="18"
-             initial_value="Source"
-             layout="topleft"
-             left="75"
-             name="source"
-             text_color="ModelUploaderLabels"
-             top="15"
-             valign="center"
-             value="Source"
-             width="335" />
+          <text
+           follows="left|top"
+           height="18"
+           initial_value="Source"
+           layout="topleft"
+           left="75"
+           name="source"
+           text_color="ModelUploaderLabels"
+           top="15"
+           valign="center"
+           value="Source"
+           width="335"/>
             <text
              follows="left|top"
              halign="right"
@@ -163,7 +163,7 @@
              name="high_label"
              text_color="ModelUploaderLabels"
              top_pad="10"
-             valign="center"
+             valign="top"
              value="High"
              width="65" />
             <combo_box
@@ -240,34 +240,34 @@
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="high_triangles"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="high_vertices"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="center"
-             height="18"
+             height="15"
              initial_value=""
              layout="topleft"
              left_pad="0"
              name="high_status"
-             valign="center"
+             valign="top"
              value=""
              width="65" />
             <icon
@@ -277,7 +277,7 @@
              left_delta="20"
              mouse_opaque="true"
              name="status_icon_high"
-             top_delta="0"
+             top_delta="-2"
              width="16" />
             <text
              follows="left|top"
@@ -288,7 +288,7 @@
              name="medium_label"
              text_color="ModelUploaderLabels"
              top_pad="15"
-             valign="center"
+             valign="top"
              value="Medium"
              width="65" />
             <combo_box
@@ -368,34 +368,34 @@
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="medium_triangles"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="medium_vertices"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="center"
-             height="18"
+             height="15"
              initial_value=""
              layout="topleft"
              left_pad="0"
              name="medium_status"
-             valign="center"
+             valign="top"
              value=""
              width="65" />
             <icon
@@ -405,7 +405,7 @@
              left_delta="20"
              mouse_opaque="true"
              name="status_icon_medium"
-             top_delta="0"
+             top_delta="-2"
              width="16" />
             <text
              follows="left|top"
@@ -416,7 +416,7 @@
              name="low_label"
              text_color="ModelUploaderLabels"
              top_pad="15"
-             valign="center"
+             valign="top"
              value="Low"
              width="65" />
             <combo_box
@@ -496,34 +496,34 @@
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="low_triangles"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="low_vertices"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="center"
-             height="18"
+             height="15"
              initial_value=""
              layout="topleft"
              left_pad="0"
              name="low_status"
-             valign="center"
+             valign="top"
              value=""
              width="65" />
             <icon
@@ -533,7 +533,7 @@
              left_delta="20"
              mouse_opaque="true"
              name="status_icon_low"
-             top_delta="0"
+             top_delta="-2"
              width="16" />
             <text
              follows="left|top"
@@ -544,7 +544,7 @@
              name="lowest_label"
              text_color="ModelUploaderLabels"
              top_pad="15"
-             valign="center"
+             valign="top"
              value="Lowest"
              width="65" />
             <combo_box
@@ -624,34 +624,34 @@
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="lowest_triangles"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="right"
-             height="18"
+             height="15"
              initial_value="0"
              layout="topleft"
              left_pad="0"
              name="lowest_vertices"
-             valign="center"
+             valign="top"
              value="0"
              width="65" />
             <text
              follows="left|top"
              halign="center"
-             height="18"
+             height="15"
              initial_value=""
              layout="topleft"
              left_pad="0"
              name="lowest_status"
-             valign="center"
+             valign="top"
              value=""
              width="65" />
             <icon
diff --git a/indra/newview/skins/default/xui/en/floater_moveview.xml b/indra/newview/skins/default/xui/en/floater_moveview.xml
index 065dab0413110dce69077744dbf9b9d788026c1d..4e7ee7913fba8e7766646b3406b49bc1c81df15e 100644
--- a/indra/newview/skins/default/xui/en/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/en/floater_moveview.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="specified"
- specified_left="320"
- specified_bottom="80"
+ positioning="specified"
+ left="320"
+ bottom="-80"
  legacy_header_height="18"
  can_dock="false"
  can_minimize="true"
diff --git a/indra/newview/skins/default/xui/en/floater_my_appearance.xml b/indra/newview/skins/default/xui/en/floater_my_appearance.xml
index 1c4b25a7b02a4bb8e6fbfd158660252e4e0a383c..fdea7a821ab28e26259eb9d2a54d417f77a5af57 100644
--- a/indra/newview/skins/default/xui/en/floater_my_appearance.xml
+++ b/indra/newview/skins/default/xui/en/floater_my_appearance.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 
 <floater
-  open_positioning="cascading"
+  positioning="cascading"
   legacy_header_height="18"
   can_resize="true"
   height="588"
diff --git a/indra/newview/skins/default/xui/en/floater_my_inventory.xml b/indra/newview/skins/default/xui/en/floater_my_inventory.xml
index cd0b59dc5136e76f1e1b9a1391d33b1df62808be..184f29625595a485568d60304ff98e526df51ba0 100644
--- a/indra/newview/skins/default/xui/en/floater_my_inventory.xml
+++ b/indra/newview/skins/default/xui/en/floater_my_inventory.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  can_close="true"
  can_resize="true"
  height="570"
diff --git a/indra/newview/skins/default/xui/en/floater_people.xml b/indra/newview/skins/default/xui/en/floater_people.xml
index d6d8431150af131810b6811d53549a2f3fd22283..08d0b00a835ebd5140021d85e94d9b23ddb12d74 100644
--- a/indra/newview/skins/default/xui/en/floater_people.xml
+++ b/indra/newview/skins/default/xui/en/floater_people.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 
 <floater
-  open_positioning="cascading"
+  positioning="cascading"
   can_close="true"
   can_resize="true"
   height="570"
diff --git a/indra/newview/skins/default/xui/en/floater_picks.xml b/indra/newview/skins/default/xui/en/floater_picks.xml
index 78821166624401bdea23a42c6c97d09a1aa11f25..984894b0165a4012b6056806ac3a813cc96d5b5a 100644
--- a/indra/newview/skins/default/xui/en/floater_picks.xml
+++ b/indra/newview/skins/default/xui/en/floater_picks.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  can_close="true"
  can_resize="true"
  height="572"
diff --git a/indra/newview/skins/default/xui/en/floater_places.xml b/indra/newview/skins/default/xui/en/floater_places.xml
index ccceac0a7b28af05d95e0b55d00238308a1c1e61..b241e265a9a7ba6bcc502e18d9443131ca6e6a2c 100644
--- a/indra/newview/skins/default/xui/en/floater_places.xml
+++ b/indra/newview/skins/default/xui/en/floater_places.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 
 <floater
-  open_positioning="cascading"
+  positioning="cascading"
   legacy_header_height="18"
   can_resize="true"
   height="588"
diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml
index 402868bb977659a03b3afd7afc64de835cf093dc..bd6faf4ed8fb01650f528413e2c2fb9d303eca51 100644
--- a/indra/newview/skins/default/xui/en/floater_preferences.xml
+++ b/indra/newview/skins/default/xui/en/floater_preferences.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
  legacy_header_height="18"
- open_positioning="centered"
+ positioning="centered"
  default_tab_group="1"
  height="460"
  layout="topleft"
@@ -100,7 +100,7 @@
          help_topic="preferences_colors_tab"
          name="colors" />
         <panel
-		 class="panel_preference"
+         class="panel_preference_privacy"
          filename="panel_preferences_privacy.xml"
          label="Privacy"
          layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/floater_search.xml b/indra/newview/skins/default/xui/en/floater_search.xml
index dd818e2e0659646b6f3d1dda5f582631dfda8640..c3e7028dc5b79e2686a0230143d91e691e84a960 100644
--- a/indra/newview/skins/default/xui/en/floater_search.xml
+++ b/indra/newview/skins/default/xui/en/floater_search.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
-  open_positioning="cascading"
+  positioning="cascading"
   legacy_header_height="18"
   can_resize="true"
   height="775"
diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml
index 0c38283d5975298ddead8832f1297029d26ab539..49d64767cc783f28164c1ad28da13ef9515bab51 100644
--- a/indra/newview/skins/default/xui/en/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  legacy_header_height="18"
  can_minimize="true"
  can_close="true"
diff --git a/indra/newview/skins/default/xui/en/floater_test_layout_stacks.xml b/indra/newview/skins/default/xui/en/floater_test_layout_stacks.xml
index f95f21e63a760c75a0e4272331cdb0233bad2c6e..a04050e7eb7987c5b30ccc65c44a66ea999ab07e 100644
--- a/indra/newview/skins/default/xui/en/floater_test_layout_stacks.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_layout_stacks.xml
@@ -26,6 +26,26 @@
                   background_visible="true">
       <text follows="top|left|right" halign="center" text_color="white">flex</text>
     </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="11"
+                  min_height="0"
+                  visible="false"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
+    <layout_panel name="flex"
+                  auto_resize="true"
+                  user_resize="true"
+                  bg_alpha_color="blue"
+                  height="11"
+                  min_height="0"
+                  visible="true"
+                  background_visible="true">
+      <text follows="top|left|right" halign="center" text_color="white">flex</text>
+    </layout_panel>
     <layout_panel name="flex"
                   auto_resize="true"
                   user_resize="true"
diff --git a/indra/newview/skins/default/xui/en/floater_test_text_editor.xml b/indra/newview/skins/default/xui/en/floater_test_text_editor.xml
index 548e24efba3d9cdd817377a4e6ca8cceafb949f6..e1fefc363133250c94dfaa3c8819b24ce71204ff 100644
--- a/indra/newview/skins/default/xui/en/floater_test_text_editor.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_text_editor.xml
@@ -3,6 +3,7 @@
  legacy_header_height="18"
  can_resize="true"
  height="600"
+ single_instance="false"
  layout="topleft"
  name="floater_test_text_editor"
  translate="false"
diff --git a/indra/newview/skins/default/xui/en/floater_test_text_vertical_aligment.xml b/indra/newview/skins/default/xui/en/floater_test_text_vertical_aligment.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d11373ce1d574c7a35cd08fcc6df7bf19ffbeb90
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_test_text_vertical_aligment.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ can_minimize="false"
+ can_tear_off="false"
+ can_resize="true"
+ can_drag_on_left="false"
+ can_close="true"
+ can_dock="true"
+ bevel_style="in"
+ height="300"
+ layout="topleft"
+ name="Test Floater"
+ save_rect="true"
+ title="TEST FLOATER"
+ save_dock_state="true"
+ save_visibility="true"
+ single_instance="true" 
+ width="650">
+  <text left="0"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"        
+        bottom="-5"
+        width="100"
+        valign="top">
+this
+is
+some
+text
+that
+is
+top
+aligned</text>
+  <text left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        bottom="-5"
+        clip_partial="true"
+        width="100"
+        valign="center">
+this
+is
+some
+text
+that
+is
+center
+aligned</text>
+  <text left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"        
+        bottom="-5"
+        width="100"
+        valign="bottom">
+this
+is
+some
+text
+that
+is
+bottom
+aligned</text>
+  <text_editor left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"
+        bottom="-5"
+        width="100"
+        valign="top">
+this
+is
+some
+text
+that
+is
+top
+aligned
+  </text_editor>
+  <text_editor left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        bottom="-5"
+        clip_partial="true"
+        width="100"
+        valign="center">
+this
+is
+some
+text
+that
+is
+center
+aligned
+  </text_editor>
+  <text_editor left_pad="5"
+        follows="left|top|bottom"
+        top="5"
+        clip_partial="true"
+        bottom="-5"
+        width="100"
+        valign="bottom">
+this
+is
+some
+text
+that
+is
+bottom
+aligned
+  </text_editor>
+</floater>
diff --git a/indra/newview/skins/default/xui/en/floater_test_textbox.xml b/indra/newview/skins/default/xui/en/floater_test_textbox.xml
index 2df9bb35fe89c24525e1d0c9b03b76c4fc06450e..1d31fbd6dc05f14f2dfd3ef275a800435ff73a74 100644
--- a/indra/newview/skins/default/xui/en/floater_test_textbox.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_textbox.xml
@@ -8,21 +8,7 @@
  help_topic="floater_test_textbox"
  translate="false"
  width="800">
-    <text
-     type="string"
-     length="1"
-     height="90"
-     layout="topleft"
-     left="10"
-     top_pad="30"
-     width="300">
-        First line of multiple lines
-Second line of multiple lines
-Third line of multiple lines
-Fourth line of multiple lines
-Fifth line of multiple lines
-    </text>
-  <text
+ <text
     clip_partial="true"
     top_pad="10"
     left="10"
diff --git a/indra/newview/skins/default/xui/en/floater_test_widgets.xml b/indra/newview/skins/default/xui/en/floater_test_widgets.xml
index 13c850c86c0300c1000a46c372011795bdf3b13b..10854f5a499c358bba03f8b2b4a84f69ce2f7e6a 100644
--- a/indra/newview/skins/default/xui/en/floater_test_widgets.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_widgets.xml
@@ -115,6 +115,7 @@
   </flyout_button>
   <check_box
    bottom_delta="35"
+   height="10"
    label="Checkbox"
    layout="topleft"
    tool_tip="checkbox"
@@ -275,6 +276,7 @@
   <!-- "spinner" is a numerical input widget with an up and down arrow to
        change the value. -->
   <spinner
+    height="10"
    bottom_delta="35"
    follows="top|left"
    label="Spinner"
diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml
index f9147ea650cb318d38cf1290d829cce811c7562f..e37740d20cd71aa64c8ca4746165bb36d7253829 100644
--- a/indra/newview/skins/default/xui/en/floater_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_tools.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  legacy_header_height="18"
  height="580"
  layout="topleft"
@@ -14,7 +14,27 @@
  save_visibility="true"
  sound_flags="0"
  width="295">
-    <floater.string
+  <floater.string
+     name="grid_screen_text">
+    Screen
+  </floater.string>
+  <floater.string
+   name="grid_local_text">
+    Local
+  </floater.string>
+  <floater.string
+   name="grid_world_text">
+    World
+  </floater.string>
+  <floater.string
+   name="grid_reference_text">
+    Reference
+  </floater.string>
+  <floater.string
+   name="grid_attachment_text">
+    Attachment
+  </floater.string>
+  <floater.string
      name="status_rotate">
         Drag colored bands to rotate object
     </floater.string>
@@ -312,20 +332,48 @@
      top_pad="0"
      name="checkbox snap to grid"
      width="134" />
-    <button
-     left_pad="0"
-     label="Options..."
+    <combo_box
+      height="20"
+      layout="topleft"
+      follows="left|top"
+      name="combobox grid mode"
+      tool_tip="Choose the type of grid ruler for positioning the object"
+      top="83"
+      left="195"
+      top_pad="0"
+      width="60">
+      <combo_box.item
+      label="World"
+      name="World"
+      value="World" />
+      <combo_box.item
+      label="Local"
+      name="Local"
+      value="Local" />
+      <combo_box.item
+      label="Reference"
+      name="Reference"
+      value="Reference" />
+      <combo_box.commit_callback
+      function="BuildTool.gridMode"/>
+    </combo_box>  
+  
+  <button
+     left="259"
+     label=""
+     image_selected="ForwardArrow_Press"
+     image_unselected="ForwardArrow_Off"
      layout="topleft"
      follows="top|left"
      name="Options..."
      tool_tip="See more grid options"
      top="83"
-     right="-35"
-     width="65"
-     height="21" >
+     width="25"
+     height="20" >
 	 <button.commit_callback
 	     function="BuildTool.gridOptions"/>
 	</button>
+  
    <button
      follows="left|top"
      height="20"
@@ -1158,6 +1206,7 @@ even though the user gets a free copy.
              label="Modify"
              layout="topleft"
              left="10"
+             height="10"
              name="checkbox next owner can modify"
              width="85" />
             <check_box
diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml
index 72e6187a14d1fbb530ae112f39481347a7242cfe..d8211c24a72744f149cdc82c4126fcc79c251654 100644
--- a/indra/newview/skins/default/xui/en/floater_toybox.xml
+++ b/indra/newview/skins/default/xui/en/floater_toybox.xml
@@ -10,7 +10,7 @@
   layout="topleft"
   legacy_header_height="18"
   name="Toybox"
-  open_positioning="centered"
+  positioning="centered"
   save_rect="true"
   single_instance="true"
   title="TOOLBAR BUTTONS"
@@ -18,7 +18,7 @@
   <text
     follows="left|top"
     font="SansSerifMedium"
-    valign="bottom"
+    valign="top"
     halign="left"
     height="20"
     layout="topleft"
@@ -33,7 +33,7 @@
   <text
     follows="left|top"
     font="SansSerifMedium"
-    valign="bottom"
+    valign="top"
     halign="left"
     height="20"
     layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/floater_voice_controls.xml b/indra/newview/skins/default/xui/en/floater_voice_controls.xml
index cea19ec75c7b518dc470c8e2c3982b85b5aceeee..2afc7fd3d166dbeec3d8f2b341a1a27f9fa3e7bc 100644
--- a/indra/newview/skins/default/xui/en/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/en/floater_voice_controls.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- open_positioning="cascading"
+ positioning="cascading"
  can_resize="true"
  can_minimize="true"
  can_close="true"
diff --git a/indra/newview/skins/default/xui/en/floater_voice_effect.xml b/indra/newview/skins/default/xui/en/floater_voice_effect.xml
index 77fb21e27c5eadddaa008933318d557af24602cf..35cb2670d0904187dfcd55e9cd06c0df45a4f27d 100644
--- a/indra/newview/skins/default/xui/en/floater_voice_effect.xml
+++ b/indra/newview/skins/default/xui/en/floater_voice_effect.xml
@@ -36,15 +36,20 @@
   <string name="effect_Cyber">Cyber</string>
   <string name="effect_DeepBot">DeepBot</string>
   <string name="effect_Demon">Demon</string>
+  <string name="effect_Female Elf">Female Elf</string>
   <string name="effect_Flirty">Flirty</string>
   <string name="effect_Foxy">Foxy</string>
-  <string name="effect_Halloween_2010_Bonus">Halloween_2010_Bonus</string>
+  <string name="effect_Halloween 2010 Bonus">Halloween_2010_Bonus</string>
   <string name="effect_Helium">Helium</string>
   <string name="effect_Husky">Husky</string>
+  <string name="effect_Husky Whisper">Husky Whisper</string>
   <string name="effect_Intercom">Intercom</string>
+  <string name="effect_Julia">Julia</string>
+  <string name="effect_Lo Lilt">Lo Lilt</string>
   <string name="effect_Macho">Macho</string>
   <string name="effect_Micro">Micro</string>
   <string name="effect_Mini">Mini</string>
+  <string name="effect_Model">Model</string>
   <string name="effect_Nano">Nano</string>
   <string name="effect_Nightmare">Nightmare</string>
   <string name="effect_PopBot">PopBot</string>
@@ -52,10 +57,12 @@
   <string name="effect_Radio">Radio</string>
   <string name="effect_Robot">Robot</string>
   <string name="effect_Roxanne">Roxanne</string>
+  <string name="effect_Rumble">Rumble</string>
   <string name="effect_Sabrina">Sabrina</string>
   <string name="effect_Samantha">Samantha</string>
   <string name="effect_Sexy">Sexy</string>
   <string name="effect_Shorty">Shorty</string>
+  <string name="effect_Smaller">Smaller</string>
   <string name="effect_Sneaky">Sneaky</string>
   <string name="effect_Stallion">Stallion</string>
   <string name="effect_Sultry">Sultry</string>
diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml
index 56d79f62c7bf0586b15c66991bc76951f3c1b564..83407069d2eee1ab962a8d3381a9c897bd9c746a 100644
--- a/indra/newview/skins/default/xui/en/floater_world_map.xml
+++ b/indra/newview/skins/default/xui/en/floater_world_map.xml
@@ -2,7 +2,7 @@
 <floater
  legacy_header_height="18"
  can_resize="true"
- open_positioning="centered"
+ positioning="centered"
  height="600"
  layout="topleft"
  min_height="520"
diff --git a/indra/newview/skins/default/xui/en/inspect_object.xml b/indra/newview/skins/default/xui/en/inspect_object.xml
index 8d14c974b434b4ddef43e3b0a49a95732cbea132..b122e1bcff5c95db8b992ce2de169f7cce5ae82e 100644
--- a/indra/newview/skins/default/xui/en/inspect_object.xml
+++ b/indra/newview/skins/default/xui/en/inspect_object.xml
@@ -90,6 +90,7 @@ L$30,000
    follows="all"
    font="SansSerifSmall"
    height="13"
+   clip="false"
    name="object_media_url"
    width="207"
    left_pad="2"
diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml
index ef4a1bc0618b275f25c7b219e85443acecb2b1c9..b13bf5b5086d7594984a3e446139fdf410f2f8ae 100644
--- a/indra/newview/skins/default/xui/en/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory.xml
@@ -452,6 +452,14 @@
     <menu_item_separator
      layout="topleft" 
      name="Copy Separator" />
+    <menu_item_call
+     label="Cut"
+     layout="topleft"
+     name="Cut">
+        <menu_item_call.on_click
+         function="Inventory.DoToSelected"
+         parameter="cut" />
+    </menu_item_call>
     <menu_item_call
      label="Copy"
      layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 1d11abcf73eb06d08ad5443113d44dc193debb63..5ba566b175e59a113a0abc154e62f0748e39f9fd 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -3268,6 +3268,14 @@
             <menu_item_call.on_click
              function="Advanced.CompressImage" />
         </menu_item_call>
+
+      <menu_item_call
+         label="Enable Visual Leak Detector"
+         name="Enable Visual Leak Detector">
+        <menu_item_call.on_click
+           function="Advanced.ToggleVisualLeakDetector" />
+        </menu_item_call>
+      
         <menu_item_check
          label="Output Debug Minidump"
          name="Output Debug Minidump">
@@ -3294,6 +3302,7 @@
          name="Set Logging Level"
          tear_off="true">
           <menu_item_check
+            name="Debug"
             label="Debug">
             <menu_item_check.on_check
               function="Develop.CheckLoggingLevel"
@@ -3303,6 +3312,7 @@
              parameter="0" />
           </menu_item_check>
           <menu_item_check
+            name="Info"
             label="Info">
             <menu_item_check.on_check
               function="Develop.CheckLoggingLevel"
@@ -3312,6 +3322,7 @@
              parameter="1" />
           </menu_item_check>
           <menu_item_check
+            name="Warning"
             label="Warning">
             <menu_item_check.on_check
               function="Develop.CheckLoggingLevel"
@@ -3321,6 +3332,7 @@
              parameter="2" />
           </menu_item_check>
           <menu_item_check
+            name="Error"
             label="Error">
             <menu_item_check.on_check
               function="Develop.CheckLoggingLevel"
@@ -3330,6 +3342,7 @@
              parameter="3" />
           </menu_item_check>
           <menu_item_check
+            name="None"
             label="None">
             <menu_item_check.on_check
               function="Develop.CheckLoggingLevel"
diff --git a/indra/newview/skins/default/xui/en/panel_chat_header.xml b/indra/newview/skins/default/xui/en/panel_chat_header.xml
index 2645d472f98be0588feb540107bf518c1b09550b..5c5c718bdf9c684fd6e21e6f9c9aab8f07e89f43 100644
--- a/indra/newview/skins/default/xui/en/panel_chat_header.xml
+++ b/indra/newview/skins/default/xui/en/panel_chat_header.xml
@@ -23,7 +23,7 @@
     <text
       parse_urls="false"
       allow_scroll="false"
-      v_pad = "7"
+      v_pad = "6"
       read_only = "true"
       follows="left|right"
       font.style="BOLD"
@@ -37,7 +37,7 @@
       top="0"
       translate="false"
       use_ellipses="true"
-      valign="bottom" 
+      valign="top" 
       value="TestString PleaseIgnore" />
   <text
     allow_scroll="false"
@@ -49,7 +49,7 @@
     left_pad="5"
     name="time_box"
     right="-5"
-    top="8"
+    top="7"
     value="23:30"
     width="110" />
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_chat_item.xml b/indra/newview/skins/default/xui/en/panel_chat_item.xml
index 6af110540075ae0bf770df51efadbeaf733e130a..1ef99649e67d27cd2a46c75406f6fe9adb1f702f 100644
--- a/indra/newview/skins/default/xui/en/panel_chat_item.xml
+++ b/indra/newview/skins/default/xui/en/panel_chat_item.xml
@@ -16,13 +16,14 @@
         top="3"
         width="18" />
 	<text_chat
-      top="5"
+      top="3"
       left="30"
+      right="-10"
       height="120"
       text_color="white"
       word_wrap="true"
       mouse_opaque="true"
-      valign="bottom"
+      valign="top"
       name="msg_text">
 	</text_chat>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_group_roles.xml b/indra/newview/skins/default/xui/en/panel_group_roles.xml
index a7178dc28864d56fb5aae93571ee6431e6d5d396..eea26061256279f29de0a5410ccfbb3ea5a0ff8b 100644
--- a/indra/newview/skins/default/xui/en/panel_group_roles.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_roles.xml
@@ -172,7 +172,7 @@ including the Everyone and Owner Roles.
              draw_heading="true"
              draw_stripes="false"
              heading_height="23"
-             height="130"
+             height="132"
              layout="topleft"
              search_column="1"
              left="0"
diff --git a/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml b/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml
index 383e637ace13947f996cb4a8132b6e498a35ef2d..413e22e444947a07363ecee76dc00e83f82627c0 100644
--- a/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_inbox_inventory.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <inbox_inventory_panel
+    accepts_drag_and_drop="false"
     name="inventory_inbox"
     start_folder="Received Items"
     follows="all" layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_landmark_info.xml b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
index d2088594dd91148667ce12312e97f700a61ea2b2..fd6e96b9a7e1255972ac801a8fcfcabdeac0accd 100644
--- a/indra/newview/skins/default/xui/en/panel_landmark_info.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
@@ -271,7 +271,7 @@
                 <text_editor
                  bg_readonly_color="DkGray2"
                  follows="all"
-                 height="70"
+                 height="75"
                  layout="topleft"
                  left="0"
                  max_length="127"
@@ -288,7 +288,7 @@
                  layout="topleft"
                  left="0"
                  name="folder_label"
-                 top_pad="15"
+                 top_pad="10"
                  value="Landmark location:"
                  width="290" />
                 <combo_box
diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
index d6d8b2a83e1714db40e194bad3b7a317bcb34daf..1c882bb099aa48ee30e1fe944fc8d58b9b883837 100644
--- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
@@ -80,7 +80,6 @@
      top="16"
      width="288" />
     <recent_inventory_panel
-     accepts_drag_and_drop="false"
      bg_opaque_color="DkGray2"
      bg_alpha_color="DkGray2"
      background_visible="true"
diff --git a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml
index 4bf420b79f9c4a056e69cde9ce0d6e74c13b811a..3edeb9aa3670b7e782b7afac5715e28633fbeb5c 100644
--- a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml
@@ -70,7 +70,7 @@
            layout="topleft"
            auto_resize="true"
            user_resize="true"
-           min_width="480"
+           min_width="410"
            name="navigation_layout_panel"
            width="480">
 	        <panel
@@ -148,15 +148,15 @@
 	         layout="topleft"
            auto_resize="true"
            user_resize="true"
-           min_width="315"
+           min_width="185"
            name="favorites_layout_panel"
-           width="315">
+           width="320">
            <icon
              follows="top|left"
              height="25"
              image_name="ChatBarHandle"
              layout="topleft"
-             left="-318"
+             left="-323"
              name="resize_handle"
              top="4"
              width="5" />
@@ -171,16 +171,17 @@
              name="favorite"
              image_drag_indication="Accordion_ArrowOpened_Off"
              tool_tip="Drag Landmarks here for quick access to your favorite places in Second Life!"
-             width="311">
+             width="320">
             <label
              follows="left|top"
-             height="15"
+             height="13"
              layout="topleft"
              left="10"
              name="favorites_bar_label"
              text_color="LtGray"
              tool_tip="Drag Landmarks here for quick access to your favorite places in Second Life!"
-             top="12"
+             top="13"
+	     valign="bottom"
              width="102">
               Favorites Bar
             </label>
diff --git a/indra/newview/skins/default/xui/en/panel_nearby_chat.xml b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml
index d492f9bd68b1f84bc031e80ba3e3ad00389701e5..d683116eb8b339321114fc75732a3f7a260d5246 100644
--- a/indra/newview/skins/default/xui/en/panel_nearby_chat.xml
+++ b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml
@@ -1,35 +1,63 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel
- height="300"
  follows="all"
+ height="300"
+ help_topic="nearby_chat"
  layout="topleft"
  name="nearby_chat"
- help_topic="nearby_chat"
  width="320">
-            <check_box
-             bottom_delta="36"
-             control_name="TranslateChat"
-             enabled="true"
-             height="16"
-             label="Translate chat"
-             layout="topleft"
-             left="5"
-             name="translate_chat_checkbox"
-             width="230" />
-  <chat_history
-    parse_urls="true"
-    bg_readonly_color="ChatHistoryBgColor"
-    bg_writeable_color="ChatHistoryBgColor"
-    follows="all"
-    left="5"
-    top_delta="17"
-    layout="topleft"
-    height="260"
-    name="chat_history"
-    parse_highlights="true"
-    text_color="ChatHistoryTextColor"
-    text_readonly_color="ChatHistoryTextColor"
-    right_widget_pad="5"
-    left_widget_pad="0"
-    width="315" />
+  <layout_stack
+   follows="all"
+   height="295"
+   layout="topleft"
+   left="0"
+   name="stack"
+   top="5"
+   orientation="vertical"
+   width="320">
+    <layout_panel
+     auto_resize="false"
+     height="26"
+     layout="topleft"
+     left_delta="0"
+     name="translate_chat_checkbox_lp"
+     top_delta="0"
+     visible="true"
+     width="313">
+      <check_box
+       top="10"
+       control_name="TranslateChat"
+       enabled="true"
+       height="16"
+       label="Translate chat"
+       layout="topleft"
+       left="5"
+       name="translate_chat_checkbox"
+       width="300" />
+    </layout_panel>
+    <layout_panel
+     auto_resize="true"
+     height="277"
+     left_delta="0"
+     layout="topleft"
+     name="chat_history_lp"
+     width="318">
+      <chat_history
+       bg_readonly_color="ChatHistoryBgColor"
+       bg_writeable_color="ChatHistoryBgColor"
+       follows="all"
+       layout="topleft"
+       left="5"
+       left_widget_pad="0"
+       height="272"
+       name="chat_history"
+       parse_highlights="true"
+       parse_urls="true"
+       right_widget_pad="5"
+       text_color="ChatHistoryTextColor"
+       text_readonly_color="ChatHistoryTextColor"
+       top="0"
+       width="313" />
+    </layout_panel>
+  </layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_postcard_settings.xml b/indra/newview/skins/default/xui/en/panel_postcard_settings.xml
index e9427a23882beed63b894f6b99ebb334a94a7893..3f67a48b14ff3f848bedd91fd330cab8f9373949 100644
--- a/indra/newview/skins/default/xui/en/panel_postcard_settings.xml
+++ b/indra/newview/skins/default/xui/en/panel_postcard_settings.xml
@@ -85,6 +85,7 @@
              top_delta="0"
              width="95" />
             <check_box
+              height="10"
              bottom_delta="20"
              follows="left|top"
              label="Constrain proportions"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml
index 9827180aa729c2abab608c57a76ac34d5d8edd44..24882988b06619646bb5f3e51d3db867f65301d2 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml
@@ -331,7 +331,7 @@
    </text>
    <radio_group
      control_name="LetterKeysFocusChatBar" 
-     height="20"
+     height="34"
      layout="topleft"
      left="35"
      top_pad="0" 
@@ -339,7 +339,7 @@
         <radio_item
          label="Starts local chat"
          name="radio_start_chat"
-         top_delta="20" 
+         top="0" 
          layout="topleft"
          height="16" 
          left="0" 
@@ -364,7 +364,7 @@
      layout="topleft"
      left="30"
      name="title_afk_text"
-     top_pad="15" 
+     top_pad="5" 
      width="190">
     	Away timeout:
     </text>
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml
index 1f92244eb97d5c265214c85e1ccb621400faad1e..b71586aab16921ae4114845c273dd976c2d56f38 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml
@@ -63,7 +63,7 @@
       layout="topleft"
       left_pad="0"
       name="mute_chb_label"
-      top_delta="0"
+      top_delta="-1"
       width="150"
       wrap="true">
       Mute when minimized
diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml b/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml
index 9057ebb65eb4d96915d6a5bc2b46e2cd75e40381..71d808fa4b22b0ac5145739dc3015488bbd59a6a 100644
--- a/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_snapshot_inventory.xml
@@ -114,6 +114,7 @@
      width="95" />
     <check_box
      bottom_delta="20"
+     height="10"
      follows="left|top"
      label="Constrain proportions"
      layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_local.xml b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml
index b966358f18d74114288b608dfd88672bb7f84b58..781ab174031b942158a3d8708012983f2a2f8769 100644
--- a/indra/newview/skins/default/xui/en/panel_snapshot_local.xml
+++ b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml
@@ -132,6 +132,7 @@
              width="95" />
             <check_box
              bottom_delta="20"
+             height="10"
              follows="left|top"
              label="Constrain proportions"
              layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml b/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml
index 5bd383b81e85b585ffe6c608e6d6c6b917a70d98..0dd357aa1a747c9711c800ea5f45c9117ff32039 100644
--- a/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_snapshot_profile.xml
@@ -119,6 +119,7 @@
              top_delta="0"
              width="95" />
             <check_box
+              height="10"
              bottom_delta="20"
              label="Constrain proportions"
              layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml
index d453a970e7568a03c745ce521c7fc84a3a4c10bb..3aa34439f13210f1f1b51cd88d147bc29f3831b6 100644
--- a/indra/newview/skins/default/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml
@@ -35,8 +35,8 @@
     </panel.string>
   <panel
     height="18"
-    left="-370"
-    width="160"
+    left="-395"
+    width="185"
     top="1"
     follows="right|top" 
     name="balance_bg">
@@ -67,7 +67,6 @@
      label_shadow="true"
      name="buyL"
      pad_right="0"
-     pad_bottom="2"
      tool_tip="Click to buy more L$"
      top="0"
      width="80" />
@@ -87,7 +86,6 @@
      left_pad="0"
      label_shadow="true"
      name="goShop"
-     pad_bottom="2"
      tool_tip="Open Second Life Marketplace"
      top="0"
      width="65" />
diff --git a/indra/newview/skins/default/xui/en/panel_toast.xml b/indra/newview/skins/default/xui/en/panel_toast.xml
index 062c403a26bdbff9d306668f8bbd4cd2d27da58a..66c4b170b6a272af2f986fa6827ea67964935d33 100644
--- a/indra/newview/skins/default/xui/en/panel_toast.xml
+++ b/indra/newview/skins/default/xui/en/panel_toast.xml
@@ -10,7 +10,6 @@
 -->
 
 <floater
- open_positioning="none"
  legacy_header_height="0"
  header_height="0"
  name="toast"
diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml
index 29aa6d103953627e7ac72450334630503273ca86..6ecb57b41d8da6bc45d16df29bc672080f1618ed 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml
@@ -51,7 +51,7 @@
 			 <layout_panel
                  width="330"
                  layout="topleft"
-                 auto_resize="true"
+                 auto_resize="false"
                  user_resize="true"
                  follows="left|right|top"
                  name="inbox_layout_panel"
@@ -73,6 +73,7 @@
                      <string name="InboxLabelWithArg">Received items ([NUM])</string>
                      <string name="InboxLabelNoArg">Received items</string>
                      <button
+                        control_name="InventoryInboxToggleState"
                         label="Received items"
 						font="SansSerifMedium"
                         name="inbox_btn"
@@ -104,6 +105,7 @@
                         [NUM] new
                      </text>
                      <panel
+                        name="inbox_inventory_placeholder_panel"
                         follows="all"
                         left="10"
                         bottom="235"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 4bc72be49b9a0e49d71ea1dcc3768f893e56b3fe..f2dab9c49b069cf99d9701b60b8a1e7b3a277c0c 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -3238,6 +3238,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 	<string name="IM_to_label">To</string>
 	<string name="IM_moderator_label">(Moderator)</string>
 	<string name="Saved_message">(Saved [LONG_TIMESTAMP])</string>
+	<string name="IM_unblock_only_groups_friends">To see this message, you must uncheck &apos;Only friends and groups can call or IM me&apos; in Preferences/Privacy.</string>
 
 	<!-- voice calls -->
 	<string name="answered_call">Your call has been answered</string>
diff --git a/indra/newview/skins/default/xui/en/widgets/button.xml b/indra/newview/skins/default/xui/en/widgets/button.xml
index e2baba92a3a45051a6f2c03eba8ea9050e4c2c6e..2b2c3faf917e8ad4acc59aa0c6dbfedbbe6892c8 100644
--- a/indra/newview/skins/default/xui/en/widgets/button.xml
+++ b/indra/newview/skins/default/xui/en/widgets/button.xml
@@ -21,7 +21,7 @@
         font="SansSerifSmall"
         hover_glow_amount="0.15"
         halign="center"
-        pad_bottom="3" 
+        pad_bottom="1"
         height="23"
         scale_image="true"
         handle_right_mouse="true"
diff --git a/indra/newview/skins/default/xui/en/widgets/check_box.xml b/indra/newview/skins/default/xui/en/widgets/check_box.xml
index cca64fad2a735a33c82163f2f6d967d451b7801e..8947024e458e05959268cf36937df1729ac3e9bc 100644
--- a/indra/newview/skins/default/xui/en/widgets/check_box.xml
+++ b/indra/newview/skins/default/xui/en/widgets/check_box.xml
@@ -10,7 +10,7 @@
                         text_readonly_color="LabelDisabledColor"/>
   <check_box.check_button name="CheckboxCtrl Button"
                           left="2"
-                          bottom="2"
+                          bottom="1"
                           width="13"
                           height="13" 
                           commit_on_return="false"
diff --git a/indra/newview/skins/default/xui/en/widgets/floater.xml b/indra/newview/skins/default/xui/en/widgets/floater.xml
index adbb183317884bb66bb78384ce827354fc317d00..97a5ae7d4e575451496c357d644206b4a582a03c 100644
--- a/indra/newview/skins/default/xui/en/widgets/floater.xml
+++ b/indra/newview/skins/default/xui/en/widgets/floater.xml
@@ -2,7 +2,7 @@
 <!-- See also settings.xml UIFloater* settings for configuration -->
 <floater
  name="floater"
- open_positioning="none"
+ positioning="none"
  layout="topleft"
  bg_opaque_color="FloaterFocusBackgroundColor"
  bg_alpha_color="FloaterDefaultBackgroundColor"
diff --git a/indra/newview/skins/default/xui/en/widgets/tab_container.xml b/indra/newview/skins/default/xui/en/widgets/tab_container.xml
index 3e2202b20fc5486448786fe78601bcfb2c1ec14d..0586119681a5cf16953c5bd056eec0a9e2b8298f 100644
--- a/indra/newview/skins/default/xui/en/widgets/tab_container.xml
+++ b/indra/newview/skins/default/xui/en/widgets/tab_container.xml
@@ -11,7 +11,7 @@ label_pad_left - padding to the left of tab button labels
                halign="center"
                font="SansSerifSmall" 
                tab_height="21"
-               label_pad_bottom="2"
+               label_pad_bottom="1"
                label_pad_left="4">
   <!--
   Possible additional attributes for tabs:
diff --git a/indra/newview/skins/default/xui/es/panel_status_bar.xml b/indra/newview/skins/default/xui/es/panel_status_bar.xml
index 79b2c32b23617c0a3e7d357f8b55784531bcea8a..7eead3bc184ddb340d1d18590c79931fc3598f5c 100644
--- a/indra/newview/skins/default/xui/es/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/es/panel_status_bar.xml
@@ -15,7 +15,7 @@
 	<panel.string name="buycurrencylabel">
 		[AMT] L$
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-410" name="balance_bg" width="200">
 		<text name="balance" tool_tip="Haz clic para actualizar tu saldo en L$" value="20 L$"/>
 		<button label="Comprar L$" name="buyL" tool_tip="Pulsa para comprar más L$"/>
 		<button label="Comprar" name="goShop" tool_tip="Abrir el mercado de Second Life" width="80"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_status_bar.xml b/indra/newview/skins/default/xui/fr/panel_status_bar.xml
index c0d59a3182d034c3ae276c666e382ee78bf8831e..ba36a7d2991f5f49f344a32bd45a51848422d851 100644
--- a/indra/newview/skins/default/xui/fr/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/fr/panel_status_bar.xml
@@ -15,7 +15,7 @@
 	<panel.string name="buycurrencylabel">
 		[AMT] L$
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-405" name="balance_bg" width="195">
 		<text name="balance" tool_tip="Cliquer sur ce bouton pour actualiser votre solde en L$." value="20 L$"/>
 		<button label="Acheter L$" name="buyL" tool_tip="Cliquer pour acheter plus de L$."/>
 		<button label="Achats" name="goShop" tool_tip="Ouvrir la Place du marché Second Life." width="75"/>
diff --git a/indra/newview/skins/default/xui/it/panel_status_bar.xml b/indra/newview/skins/default/xui/it/panel_status_bar.xml
index 4abc90113f4cbb7322cb956b6cc425b184e0b8c5..0aaf89d8c89d8788645d40ddb59183d925bb41b2 100644
--- a/indra/newview/skins/default/xui/it/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/it/panel_status_bar.xml
@@ -15,7 +15,7 @@
 	<panel.string name="buycurrencylabel">
 		L$ [AMT]
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-405" name="balance_bg" width="195">
 		<text name="balance" tool_tip="Clicca per aggiornare il tuo saldo in L$" value="L$ 20"/>
 		<button label="Acquista L$" name="buyL" tool_tip="Clicca per acquistare più L$"/>
 		<button label="Acquisti" name="goShop" tool_tip="Apri Mercato Second Life" width="75"/>
diff --git a/indra/newview/skins/default/xui/ja/panel_status_bar.xml b/indra/newview/skins/default/xui/ja/panel_status_bar.xml
index 4fb876f690bd95fa00360b6b516d32fcbdc3e1a1..f09643d56223817b68da9a208b260e7d6dd2b830 100644
--- a/indra/newview/skins/default/xui/ja/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/ja/panel_status_bar.xml
@@ -15,7 +15,7 @@
 	<panel.string name="buycurrencylabel">
 		L$ [AMT]
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-370" name="balance_bg" width="160">
 		<text name="balance" tool_tip="クリックして L$ 残高を更新" value="L$20"/>
 		<button label="L$ の購入" name="buyL" tool_tip="クリックして L$ を購入します"/>
 		<button label="店" name="goShop" tool_tip="Second Life マーケットプレイスを開く"  width="40"/>
diff --git a/indra/newview/skins/default/xui/pt/panel_status_bar.xml b/indra/newview/skins/default/xui/pt/panel_status_bar.xml
index 22853f0643cd32d1deaa7e9ccaaf52530f54e07f..cb9a6eb757629b22f5b0e4fc9a3ed9dcaaa88638 100644
--- a/indra/newview/skins/default/xui/pt/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/pt/panel_status_bar.xml
@@ -15,7 +15,7 @@
 	<panel.string name="buycurrencylabel">
 		L$ [AMT]
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-410" name="balance_bg" width="200">
 		<text name="balance" tool_tip="Atualizar saldo de L$" value="L$20"/>
 		<button label="Comprar L$" name="buyL" tool_tip="Comprar mais L$"/>
 		<button label="Comprar" name="goShop" tool_tip="Abrir Mercado do Second Life" width="80"/>
diff --git a/indra/newview/skins/default/xui/ru/panel_status_bar.xml b/indra/newview/skins/default/xui/ru/panel_status_bar.xml
index babe5811acefa94369de93156ac3a53ae4fc778f..9c84ff1fd894e142e4a65e95c0e64b7128fd371d 100644
--- a/indra/newview/skins/default/xui/ru/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/ru/panel_status_bar.xml
@@ -15,7 +15,7 @@
 	<panel.string name="buycurrencylabel">
 		L$ [AMT]
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-450" name="balance_bg" width="240">
 		<text name="balance" tool_tip="Щелкните для обновления вашего баланса L$" value="L$20"/>
 		<button label="Купить L$" name="buyL" tool_tip="Щелкните для покупки L$"/>
 		<button label="Торговый центр" name="goShop" tool_tip="Открыть торговый центр Second Life" width="121"/>
diff --git a/indra/newview/skins/default/xui/tr/panel_status_bar.xml b/indra/newview/skins/default/xui/tr/panel_status_bar.xml
index 81c304a5d80203d90663c9de7cbcc5573ae6d18c..178cbda4a2e000d64c0c39e08b3065417b09e91a 100644
--- a/indra/newview/skins/default/xui/tr/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/tr/panel_status_bar.xml
@@ -15,7 +15,7 @@
 	<panel.string name="buycurrencylabel">
 		L$ [AMT]
 	</panel.string>
-	<panel name="balance_bg">
+	<panel left="-425" name="balance_bg" width="215">
 		<text name="balance" tool_tip="L$ bakiyenizi yenilemek için buraya tıklayın" value="L$20"/>
 		<button label="L$ Satın Al" name="buyL" tool_tip="Daha fazla L$ satın almak için tıklayın"/>
 		<button label="Alışveriş yap" name="goShop" tool_tip="Second Life Pazaryeri Aç" width="95"/>
diff --git a/indra/newview/tests/llworldmipmap_test.cpp b/indra/newview/tests/llworldmipmap_test.cpp
index 4c0959d1a939205a414fa5a8c7662529a713a07c..e7ef0177608558651de83f6fa2d27a8d05dbf6c7 100644
--- a/indra/newview/tests/llworldmipmap_test.cpp
+++ b/indra/newview/tests/llworldmipmap_test.cpp
@@ -100,9 +100,9 @@ namespace tut
 	{
 		S32 level = mMap->scaleToLevel(0.0);
 		ensure("scaleToLevel() test 1 failed", level == LLWorldMipmap::MAP_LEVELS);
-		level = mMap->scaleToLevel(LLWorldMipmap::MAP_TILE_SIZE);
+		level = mMap->scaleToLevel((F32)LLWorldMipmap::MAP_TILE_SIZE);
 		ensure("scaleToLevel() test 2 failed", level == 1);
-		level = mMap->scaleToLevel(10 * LLWorldMipmap::MAP_TILE_SIZE);
+		level = mMap->scaleToLevel(10.f * LLWorldMipmap::MAP_TILE_SIZE);
 		ensure("scaleToLevel() test 3 failed", level == 1);
 	}
 	// Test 2 : globalToMipmap()
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 0931c4ec9b81b10557b1a3ecbd3d424a43180e0c..9bf755c8f8eba58148ed53617becf13039353ef4 100644
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -1047,9 +1047,13 @@ def construct(self):
             self.path("libuuid.so.16")
             self.path("libuuid.so.16.0.22")
             self.path("libSDL-1.2.so.0.11.3")
+            self.path("libSDL-1.2.so.0")
             self.path("libdirectfb-1.4.so.5.0.4")
+            self.path("libdirectfb-1.4.so.5")
             self.path("libfusion-1.4.so.5.0.4")
+            self.path("libfusion-1.4.so.5")
             self.path("libdirect-1.4.so.5.0.4")
+            self.path("libdirect-1.4.so.5")
             self.path("libopenjpeg.so.1.4.0")
             self.path("libopenjpeg.so.1")
             self.path("libopenjpeg.so")
diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp
index 1888f191e2f4ed40c98bfe8439350ed59181dab6..2e18218667c3b7d0ba5708dcdeb43737ef31d109 100644
--- a/indra/viewer_components/updater/llupdaterservice.cpp
+++ b/indra/viewer_components/updater/llupdaterservice.cpp
@@ -447,7 +447,7 @@ void LLUpdaterServiceImpl::restartTimer(unsigned int seconds)
 	LL_INFOS("UpdaterService") << "will check for update again in " << 
 	seconds << " seconds" << LL_ENDL; 
 	mTimer.start();
-	mTimer.setTimerExpirySec(seconds);
+	mTimer.setTimerExpirySec((F32)seconds);
 	LLEventPumps::instance().obtain("mainloop").listen(
 		sListenerName, boost::bind(&LLUpdaterServiceImpl::onMainLoop, this, _1));
 }