diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index db5495091e5b826eb14cf5433d6ecf2b16d3d650..b159092592bac2022512dfaa82b3ffa793225c44 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -35,13 +35,13 @@ if (WINDOWS)
   # Don't build DLLs.
   set(BUILD_SHARED_LIBS OFF)
 
-  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd"
+  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Od /Zi /MDd /MP"
       CACHE STRING "C++ compiler debug options" FORCE)
   set(CMAKE_CXX_FLAGS_RELWITHDEBINFO 
-      "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD"
+      "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Zi /MD /MP"
       CACHE STRING "C++ compiler release-with-debug options" FORCE)
   set(CMAKE_CXX_FLAGS_RELEASE
-      "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD"
+      "${CMAKE_CXX_FLAGS_RELEASE} ${LL_CXX_FLAGS} /O2 /Zi /MD /MP"
       CACHE STRING "C++ compiler release options" FORCE)
 
   set(CMAKE_CXX_STANDARD_LIBRARIES "")
diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
index 4563b59ad2b5d1fff9e92af864fbae909742ce8b..4fc25dcc241224de7beab5eee8c964a031ae7db8 100644
--- a/indra/cmake/CMakeLists.txt
+++ b/indra/cmake/CMakeLists.txt
@@ -16,7 +16,7 @@ set(cmake_SOURCE_FILES
     CARes.cmake
     CURL.cmake
     CMakeCopyIfDifferent.cmake
-    CopyWinLibs.cmake
+    Copy3rdPartyLibs.cmake
     CSharpMacros.cmake
     DBusGlib.cmake
     DirectX.cmake
diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..af407d52def482d7512d3d173512714824863c8e
--- /dev/null
+++ b/indra/cmake/Copy3rdPartyLibs.cmake
@@ -0,0 +1,389 @@
+# -*- cmake -*-
+
+# The copy_win_libs folder contains file lists and a script used to
+# copy dlls, exes and such needed to run the SecondLife from within
+# VisualStudio.
+
+include(CMakeCopyIfDifferent)
+
+###################################################################
+# set up platform specific lists of files that need to be copied
+###################################################################
+if(WINDOWS)
+    set(SHARED_LIB_STAGING_DIR_DEBUG            "${SHARED_LIB_STAGING_DIR}/Debug")
+    set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO   "${SHARED_LIB_STAGING_DIR}/RelWithDebInfo")
+    set(SHARED_LIB_STAGING_DIR_RELEASE          "${SHARED_LIB_STAGING_DIR}/Release")
+
+    #*******************************
+    # VIVOX - *NOTE: no debug version
+    set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-win32")
+    set(vivox_files
+        SLVoice.exe
+        alut.dll
+        vivoxsdk.dll
+        ortp.dll
+        wrap_oal.dll
+        )
+
+    #*******************************
+    # Misc shared libs 
+
+    # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
+    # or ARCH_PREBUILT_DIRS
+    set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
+    set(debug_files
+        openjpegd.dll
+        libtcmalloc_minimal-debug.dll
+        libapr-1.dll
+        libaprutil-1.dll
+        libapriconv-1.dll
+        )
+
+    # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
+    # or ARCH_PREBUILT_DIRS
+    set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
+    set(release_files
+        openjpeg.dll
+        libtcmalloc_minimal.dll
+        libapr-1.dll
+        libaprutil-1.dll
+        libapriconv-1.dll
+        )
+
+    if (FMOD_SDK_DIR)
+        set(fmod_files fmod.dll)
+    endif (FMOD_SDK_DIR)
+
+    #*******************************
+    # LLKDU
+    set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
+    if(NOT EXISTS ${internal_llkdu_path})
+        if (EXISTS "${debug_src_dir}/llkdu.dll")
+            set(debug_llkdu_src "${debug_src_dir}/llkdu.dll")
+            set(debug_llkdu_dst "${SHARED_LIB_STAGING_DIR_DEBUG}/llkdu.dll")
+        endif (EXISTS "${debug_src_dir}/llkdu.dll")
+
+        if (EXISTS "${release_src_dir}/llkdu.dll")
+            set(release_llkdu_src "${release_src_dir}/llkdu.dll")
+            set(release_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELEASE}/llkdu.dll")
+            set(relwithdebinfo_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}/llkdu.dll")
+        endif (EXISTS "${release_src_dir}/llkdu.dll")
+    endif (NOT EXISTS ${internal_llkdu_path})
+
+#*******************************
+# Copy MS C runtime dlls, required for packaging.
+# *TODO - Adapt this to support VC9
+if (MSVC80)
+    FIND_PATH(debug_msvc8_redist_path msvcr80d.dll
+        PATHS
+         [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/Debug_NonRedist/x86/Microsoft.VC80.DebugCRT
+        NO_DEFAULT_PATH
+        NO_DEFAULT_PATH
+        )
+
+    if(EXISTS ${debug_msvc8_redist_path})
+        set(debug_msvc8_files
+            msvcr80d.dll
+            msvcp80d.dll
+            Microsoft.VC80.DebugCRT.manifest
+            )
+
+        copy_if_different(
+            ${debug_msvc8_redist_path}
+            "${SHARED_LIB_STAGING_DIR_DEBUG}"
+            out_targets
+            ${debug_msvc8_files}
+            )
+        set(third_party_targets ${third_party_targets} ${out_targets})
+
+    endif (EXISTS ${debug_msvc8_redist_path})
+
+    FIND_PATH(release_msvc8_redist_path msvcr80.dll
+        PATHS
+         [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\Setup\\VC;ProductDir]/redist/x86/Microsoft.VC80.CRT
+        NO_DEFAULT_PATH
+        NO_DEFAULT_PATH
+        )
+
+    if(EXISTS ${release_msvc8_redist_path})
+        set(release_msvc8_files
+            msvcr80.dll
+            msvcp80.dll
+            Microsoft.VC80.CRT.manifest
+            )
+
+        copy_if_different(
+            ${release_msvc8_redist_path}
+            "${SHARED_LIB_STAGING_DIR_RELEASE}"
+            out_targets
+            ${release_msvc8_files}
+            )
+        set(third_party_targets ${third_party_targets} ${out_targets})
+
+        copy_if_different(
+            ${release_msvc8_redist_path}
+            "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
+            out_targets
+            ${release_msvc8_files}
+            )
+        set(third_party_targets ${third_party_targets} ${out_targets})
+          
+    endif (EXISTS ${release_msvc8_redist_path})
+endif (MSVC80)
+
+elseif(DARWIN)
+    set(SHARED_LIB_STAGING_DIR_DEBUG            "${SHARED_LIB_STAGING_DIR}/Debug/Resources")
+    set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO   "${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/Resources")
+    set(SHARED_LIB_STAGING_DIR_RELEASE          "${SHARED_LIB_STAGING_DIR}/Release/Resources")
+
+    set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/universal-darwin")
+    set(vivox_files
+        SLVoice
+        libalut.dylib
+        libopenal.dylib
+        libortp.dylib
+        libvivoxsdk.dylib
+       )
+    # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
+    # or ARCH_PREBUILT_DIRS
+    set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_debug")
+    set(debug_files
+       )
+    # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
+    # or ARCH_PREBUILT_DIRS
+    set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release")
+    set(release_files
+        libapr-1.0.3.7.dylib
+        libapr-1.dylib
+        libaprutil-1.0.3.8.dylib
+        libaprutil-1.dylib
+        libexpat.0.5.0.dylib
+        libexpat.dylib
+        libllqtwebkit.dylib
+        libndofdev.dylib
+       )
+
+    # fmod is statically linked on darwin
+    set(fmod_files "")
+
+    #*******************************
+    # LLKDU
+    set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
+    if(NOT EXISTS ${internal_llkdu_path})
+        if (EXISTS "${debug_src_dir}/libllkdu.dylib")
+            set(debug_llkdu_src "${debug_src_dir}/libllkdu.dylib")
+            set(debug_llkdu_dst "${SHARED_LIB_STAGING_DIR_DEBUG}/libllkdu.dylib")
+        endif (EXISTS "${debug_src_dir}/libllkdu.dylib")
+
+        if (EXISTS "${release_src_dir}/libllkdu.dylib")
+            set(release_llkdu_src "${release_src_dir}/libllkdu.dylib")
+            set(release_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELEASE}/libllkdu.dylib")
+            set(relwithdebinfo_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}/libllkdu.dylib")
+        endif (EXISTS "${release_src_dir}/libllkdu.dylib")
+    endif (NOT EXISTS ${internal_llkdu_path})
+elseif(LINUX)
+    # linux is weird, multiple side by side configurations aren't supported
+    # and we don't seem to have any debug shared libs built yet anyways...
+    set(SHARED_LIB_STAGING_DIR_DEBUG            "${SHARED_LIB_STAGING_DIR}")
+    set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO   "${SHARED_LIB_STAGING_DIR}")
+    set(SHARED_LIB_STAGING_DIR_RELEASE          "${SHARED_LIB_STAGING_DIR}")
+
+    set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-linux")
+    set(vivox_files
+        libalut.so
+        libopenal.so.1
+        libortp.so
+        libvivoxsdk.so
+        SLVoice
+       )
+    # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
+    # or ARCH_PREBUILT_DIRS
+    set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-linux/lib_debug")
+    set(debug_files
+       )
+    # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
+    # or ARCH_PREBUILT_DIRS
+    set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-linux/lib_release_client")
+    # *FIX - figure out what to do with duplicate libalut.so here -brad
+    set(release_files
+        libapr-1.so.0
+        libaprutil-1.so.0
+        libatk-1.0.so
+        libcrypto.so
+        libdb-4.2.so
+        libexpat.so
+        libgmock_main.so
+        libgmock.so.0
+        libgmodule-2.0.so
+        libgobject-2.0.so
+        libgtest_main.so
+        libgtest.so.0
+        libopenal.so
+        libopenjpeg.so
+        libssl.so
+        libstacktrace.so
+        libtcmalloc.so
+        libuuid.so.1
+        libz.so
+        libssl.so.0.9.7
+       )
+
+    if (FMOD_SDK_DIR)
+        set(fmod_files "libfmod-3.75.so")
+    endif (FMOD_SDK_DIR)
+
+    #*******************************
+    # LLKDU
+    set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
+    if(NOT EXISTS ${internal_llkdu_path})
+        if (EXISTS "${debug_src_dir}/libllkdu.so")
+            set(debug_llkdu_src "${debug_src_dir}/libllkdu.so")
+            set(debug_llkdu_dst "${SHARED_LIB_STAGING_DIR_DEBUG}/libllkdu.so")
+        endif (EXISTS "${debug_src_dir}/libllkdu.so")
+
+        if (EXISTS "${release_src_dir}/libllkdu.so")
+            set(release_llkdu_src "${release_src_dir}/libllkdu.so")
+            set(release_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELEASE}/libllkdu.so")
+            set(relwithdebinfo_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}/libllkdu.so")
+        endif (EXISTS "${release_src_dir}/libllkdu.so")
+    endif(NOT EXISTS ${internal_llkdu_path})
+else(WINDOWS)
+    message(STATUS "WARNING: unrecognized platform for staging 3rd party libs, skipping...")
+    set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-linux")
+    set(vivox_files "")
+    # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
+    # or ARCH_PREBUILT_DIRS
+    set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-linux/lib/debug")
+    set(debug_files "")
+    # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
+    # or ARCH_PREBUILT_DIRS
+    set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-linux/lib/release")
+    set(release_files "")
+
+    set(fmod_files "")
+
+    set(debug_llkdu_src "")
+    set(debug_llkdu_dst "")
+    set(release_llkdu_src "")
+    set(release_llkdu_dst "")
+    set(relwithdebinfo_llkdu_dst "")
+endif(WINDOWS)
+
+
+################################################################
+# Done building the file lists, now set up the copy commands.
+################################################################
+
+copy_if_different(
+    ${vivox_src_dir}
+    "${SHARED_LIB_STAGING_DIR_DEBUG}"
+    out_targets 
+   ${vivox_files}
+    )
+set(third_party_targets ${third_party_targets} ${out_targets})
+
+copy_if_different(
+    ${vivox_src_dir}
+    "${SHARED_LIB_STAGING_DIR_RELEASE}"
+    out_targets
+    ${vivox_files}
+    )
+set(third_party_targets ${third_party_targets} ${out_targets})
+
+copy_if_different(
+    ${vivox_src_dir}
+    "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
+    out_targets
+    ${vivox_files}
+    )
+set(third_party_targets ${third_party_targets} ${out_targets})
+
+
+
+copy_if_different(
+    ${debug_src_dir}
+    "${SHARED_LIB_STAGING_DIR_DEBUG}"
+    out_targets
+    ${debug_files}
+    )
+set(third_party_targets ${third_party_targets} ${out_targets})
+
+copy_if_different(
+    ${release_src_dir}
+    "${SHARED_LIB_STAGING_DIR_RELEASE}"
+    out_targets
+    ${release_files}
+    )
+set(third_party_targets ${third_party_targets} ${out_targets})
+
+copy_if_different(
+    ${release_src_dir}
+    "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
+    out_targets
+    ${release_files}
+    )
+set(third_party_targets ${third_party_targets} ${out_targets})
+
+if (FMOD_SDK_DIR)
+    copy_if_different(
+        ${FMOD_SDK_DIR} 
+        "${CMAKE_CURRENT_BINARY_DIR}/Debug"
+        out_targets 
+        ${fmod_files}
+        )
+    set(all_targets ${all_targets} ${out_targets})
+    copy_if_different(
+        ${FMOD_SDK_DIR} 
+        "${CMAKE_CURRENT_BINARY_DIR}/Release"
+        out_targets 
+        ${fmod_files}
+        )
+    set(all_targets ${all_targets} ${out_targets})
+    copy_if_different(
+        ${FMOD_SDK_DIR} 
+        "${CMAKE_CURRENT_BINARY_DIR}/RelWithDbgInfo"
+        out_targets 
+        ${fmod_files}
+        )
+    set(all_targets ${all_targets} ${out_targets})
+endif (FMOD_SDK_DIR)
+
+#*******************************
+# LLKDU
+set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
+if(NOT EXISTS ${internal_llkdu_path})
+    if (EXISTS "${debug_llkdu_src}")
+        ADD_CUSTOM_COMMAND(
+            OUTPUT  ${debug_llkdu_dst}
+            COMMAND ${CMAKE_COMMAND} -E copy_if_different ${debug_llkdu_src} ${debug_llkdu_dst}
+            DEPENDS ${debug_llkdu_src}
+            COMMENT "Copying llkdu.dll ${SHARED_LIB_STAGING_DIR_DEBUG}"
+            )
+        set(third_party_targets ${third_party_targets} $} ${debug_llkdu_dst})
+    endif (EXISTS "${debug_llkdu_src}")
+
+    if (EXISTS "${release_llkdu_src}")
+        ADD_CUSTOM_COMMAND(
+            OUTPUT  ${release_llkdu_dst}
+            COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${release_llkdu_dst}
+            DEPENDS ${release_llkdu_src}
+            COMMENT "Copying llkdu.dll ${SHARED_LIB_STAGING_DIR_RELEASE}"
+            )
+        set(third_party_targets ${third_party_targets} ${release_llkdu_dst})
+
+        ADD_CUSTOM_COMMAND(
+            OUTPUT  ${relwithdebinfo_llkdu_dst}
+            COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${relwithdebinfo_llkdu_dst}
+            DEPENDS ${release_llkdu_src}
+            COMMENT "Copying llkdu.dll ${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
+            )
+        set(third_party_targets ${third_party_targets} ${relwithdebinfo_llkdu_dst})
+    endif (EXISTS "${release_llkdu_src}")
+
+endif (NOT EXISTS ${internal_llkdu_path})
+
+
+add_custom_target(stage_third_party_libs ALL
+  DEPENDS 
+    ${third_party_targets}
+  )
diff --git a/indra/cmake/DeploySharedLibs.cmake b/indra/cmake/DeploySharedLibs.cmake
index a7e772bd7501e3d67c9fb58b779bfc57be88f137..663c272e502ffca8e33b2e7c7784e672a85bf687 100644
--- a/indra/cmake/DeploySharedLibs.cmake
+++ b/indra/cmake/DeploySharedLibs.cmake
@@ -6,8 +6,14 @@
 # BIN_NAME= The full path the the binary to search for dependecies.
 # SEARCH_DIRS= The full paths to dirs to search for dependencies.
 # DST_PATH= The full path where the dependecies will be copied. 
-include(GetPrerequisites)
+
+# *FIX:Mani - I pulled in the CMake 2.8 GetPrerequisites.cmake script here, because it works on windows where 2.6 did not.
+# Once we have officially upgraded to 2.8 we can just use that version of GetPrerequisites.cmake.
+get_filename_component(current_dir ${CMAKE_CURRENT_LIST_FILE} PATH)
+include(${current_dir}/GetPrerequisites_2_8.cmake)
+
 message("Getting recursive dependencies for file: ${BIN_NAME}")
+
 set(EXCLUDE_SYSTEM 1)
 set(RECURSE 1)
 get_filename_component(EXE_PATH ${BIN_NAME} PATH)
@@ -26,42 +32,42 @@ endif(DEP_FILES)
 
 foreach(DEP_FILE ${DEP_FILES})
   if(FOUND_FILES)
-	list(FIND FOUND_FILES ${DEP_FILE} FOUND)
+    list(FIND FOUND_FILES ${DEP_FILE} FOUND)
   else(FOUND_FILES)
-	set(FOUND -1)
+    set(FOUND -1)
   endif(FOUND_FILES)
 
   if(FOUND EQUAL -1)
-	find_path(DEP_PATH ${DEP_FILE} PATHS ${SEARCH_DIRS} NO_DEFAULT_PATH)
-	if(DEP_PATH)
-	  set(FOUND_FILES ${FOUND_FILES} "${DEP_PATH}/${DEP_FILE}")
-	  set(DEP_PATH NOTFOUND) #reset DEP_PATH for the next find_path call.
-	else(DEP_PATH)
-	  set(MISSING_FILES ${MISSING_FILES} ${DEP_FILE})
-	endif(DEP_PATH)
+    find_path(DEP_PATH ${DEP_FILE} PATHS ${SEARCH_DIRS} NO_DEFAULT_PATH)
+    if(DEP_PATH)
+      set(FOUND_FILES ${FOUND_FILES} "${DEP_PATH}/${DEP_FILE}")
+      set(DEP_PATH NOTFOUND) #reset DEP_PATH for the next find_path call.
+    else(DEP_PATH)
+      set(MISSING_FILES ${MISSING_FILES} ${DEP_FILE})
+    endif(DEP_PATH)
   endif(FOUND EQUAL -1)
 endforeach(DEP_FILE)
 
 if(MISSING_FILES)
   message("Missing:")
   foreach(FILE ${MISSING_FILES})
-	message("  ${FILE}")
+    message("  ${FILE}")
   endforeach(FILE)
   message("Searched in:")
   foreach(SEARCH_DIR ${SEARCH_DIRS})
-	message("  ${SEARCH_DIR}")
+    message("  ${SEARCH_DIR}")
   endforeach(SEARCH_DIR)
   message(FATAL_ERROR "Failed")
 endif(MISSING_FILES)
 
 if(FOUND_FILES)
   foreach(FILE ${FOUND_FILES})
-	get_filename_component(DST_FILE ${FILE} NAME)
-	set(DST_FILE "${DST_PATH}/${DST_FILE}")
-	message("Copying ${FILE} to ${DST_FILE}")
-	execute_process(
-	  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILE} ${DST_FILE}
-	  )
+    get_filename_component(DST_FILE ${FILE} NAME)
+    set(DST_FILE "${DST_PATH}/${DST_FILE}")
+    message("Copying ${FILE} to ${DST_FILE}")
+    execute_process(
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILE} ${DST_FILE}
+      )
   endforeach(FILE ${FOUND_FILES})
 endif(FOUND_FILES)
 message("Success!")
diff --git a/indra/cmake/GetPrerequisites_2_8.cmake b/indra/cmake/GetPrerequisites_2_8.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..5a24842c896af36c13b8897a0285222dbffa2d12
--- /dev/null
+++ b/indra/cmake/GetPrerequisites_2_8.cmake
@@ -0,0 +1,786 @@
+# GetPrerequisites.cmake
+#
+# This script provides functions to list the .dll, .dylib or .so files that an
+# executable or shared library file depends on. (Its prerequisites.)
+#
+# It uses various tools to obtain the list of required shared library files:
+#   dumpbin (Windows)
+#   ldd (Linux/Unix)
+#   otool (Mac OSX)
+#
+# The following functions are provided by this script:
+#   gp_append_unique
+#   is_file_executable
+#   gp_item_default_embedded_path
+#     (projects can override with gp_item_default_embedded_path_override)
+#   gp_resolve_item
+#     (projects can override with gp_resolve_item_override)
+#   gp_resolved_file_type
+#   gp_file_type
+#   get_prerequisites
+#   list_prerequisites
+#   list_prerequisites_by_glob
+#
+# Requires CMake 2.6 or greater because it uses function, break, return and
+# PARENT_SCOPE.
+
+#=============================================================================
+# Copyright 2008-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+# gp_append_unique list_var value
+#
+# Append value to the list variable ${list_var} only if the value is not
+# already in the list.
+#
+function(gp_append_unique list_var value)
+  set(contains 0)
+
+  foreach(item ${${list_var}})
+    if("${item}" STREQUAL "${value}")
+      set(contains 1)
+      break()
+    endif("${item}" STREQUAL "${value}")
+  endforeach(item)
+
+  if(NOT contains)
+    set(${list_var} ${${list_var}} "${value}" PARENT_SCOPE)
+  endif(NOT contains)
+endfunction(gp_append_unique)
+
+
+# is_file_executable file result_var
+#
+# Return 1 in ${result_var} if ${file} is a binary executable.
+#
+# Return 0 in ${result_var} otherwise.
+#
+function(is_file_executable file result_var)
+  #
+  # A file is not executable until proven otherwise:
+  #
+  set(${result_var} 0 PARENT_SCOPE)
+
+  get_filename_component(file_full "${file}" ABSOLUTE)
+  string(TOLOWER "${file_full}" file_full_lower)
+
+  # If file name ends in .exe on Windows, *assume* executable:
+  #
+  if(WIN32)
+    if("${file_full_lower}" MATCHES "\\.exe$")
+      set(${result_var} 1 PARENT_SCOPE)
+      return()
+    endif("${file_full_lower}" MATCHES "\\.exe$")
+
+    # A clause could be added here that uses output or return value of dumpbin
+    # to determine ${result_var}. In 99%+? practical cases, the exe name
+    # match will be sufficient...
+    #
+  endif(WIN32)
+
+  # Use the information returned from the Unix shell command "file" to
+  # determine if ${file_full} should be considered an executable file...
+  #
+  # If the file command's output contains "executable" and does *not* contain
+  # "text" then it is likely an executable suitable for prerequisite analysis
+  # via the get_prerequisites macro.
+  #
+  if(UNIX)
+    if(NOT file_cmd)
+      find_program(file_cmd "file")
+    endif(NOT file_cmd)
+
+    if(file_cmd)
+      execute_process(COMMAND "${file_cmd}" "${file_full}"
+        OUTPUT_VARIABLE file_ov
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        )
+
+      # Replace the name of the file in the output with a placeholder token
+      # (the string " _file_full_ ") so that just in case the path name of
+      # the file contains the word "text" or "executable" we are not fooled
+      # into thinking "the wrong thing" because the file name matches the
+      # other 'file' command output we are looking for...
+      #
+      string(REPLACE "${file_full}" " _file_full_ " file_ov "${file_ov}")
+      string(TOLOWER "${file_ov}" file_ov)
+
+      #message(STATUS "file_ov='${file_ov}'")
+      if("${file_ov}" MATCHES "executable")
+        #message(STATUS "executable!")
+        if("${file_ov}" MATCHES "text")
+          #message(STATUS "but text, so *not* a binary executable!")
+        else("${file_ov}" MATCHES "text")
+          set(${result_var} 1 PARENT_SCOPE)
+          return()
+        endif("${file_ov}" MATCHES "text")
+      endif("${file_ov}" MATCHES "executable")
+    else(file_cmd)
+      message(STATUS "warning: No 'file' command, skipping execute_process...")
+    endif(file_cmd)
+  endif(UNIX)
+endfunction(is_file_executable)
+
+
+# gp_item_default_embedded_path item default_embedded_path_var
+#
+# Return the path that others should refer to the item by when the item
+# is embedded inside a bundle.
+#
+# Override on a per-project basis by providing a project-specific
+# gp_item_default_embedded_path_override function.
+#
+function(gp_item_default_embedded_path item default_embedded_path_var)
+
+  # On Windows and Linux, "embed" prerequisites in the same directory
+  # as the executable by default:
+  #
+  set(path "@executable_path")
+  set(overridden 0)
+
+  # On the Mac, relative to the executable depending on the type
+  # of the thing we are embedding:
+  #
+  if(APPLE)
+    #
+    # The assumption here is that all executables in the bundle will be
+    # in same-level-directories inside the bundle. The parent directory
+    # of an executable inside the bundle should be MacOS or a sibling of
+    # MacOS and all embedded paths returned from here will begin with
+    # "@executable_path/../" and will work from all executables in all
+    # such same-level-directories inside the bundle.
+    #
+
+    # By default, embed things right next to the main bundle executable:
+    #
+    set(path "@executable_path/../../Contents/MacOS")
+
+    # Embed .dylibs right next to the main bundle executable:
+    #
+    if(item MATCHES "\\.dylib$")
+      set(path "@executable_path/../MacOS")
+      set(overridden 1)
+    endif(item MATCHES "\\.dylib$")
+
+    # Embed frameworks in the embedded "Frameworks" directory (sibling of MacOS):
+    #
+    if(NOT overridden)
+      if(item MATCHES "[^/]+\\.framework/")
+        set(path "@executable_path/../Frameworks")
+        set(overridden 1)
+      endif(item MATCHES "[^/]+\\.framework/")
+    endif(NOT overridden)
+  endif()
+
+  # Provide a hook so that projects can override the default embedded location
+  # of any given library by whatever logic they choose:
+  #
+  if(COMMAND gp_item_default_embedded_path_override)
+    gp_item_default_embedded_path_override("${item}" path)
+  endif(COMMAND gp_item_default_embedded_path_override)
+
+  set(${default_embedded_path_var} "${path}" PARENT_SCOPE)
+endfunction(gp_item_default_embedded_path)
+
+
+# gp_resolve_item context item exepath dirs resolved_item_var
+#
+# Resolve an item into an existing full path file.
+#
+# Override on a per-project basis by providing a project-specific
+# gp_resolve_item_override function.
+#
+function(gp_resolve_item context item exepath dirs resolved_item_var)
+  set(resolved 0)
+  set(resolved_item "${item}")
+
+  # Is it already resolved?
+  #
+  if(EXISTS "${resolved_item}")
+    set(resolved 1)
+  endif(EXISTS "${resolved_item}")
+
+  if(NOT resolved)
+    if(item MATCHES "@executable_path")
+      #
+      # @executable_path references are assumed relative to exepath
+      #
+      string(REPLACE "@executable_path" "${exepath}" ri "${item}")
+      get_filename_component(ri "${ri}" ABSOLUTE)
+
+      if(EXISTS "${ri}")
+        #message(STATUS "info: embedded item exists (${ri})")
+        set(resolved 1)
+        set(resolved_item "${ri}")
+      else(EXISTS "${ri}")
+        message(STATUS "warning: embedded item does not exist '${ri}'")
+      endif(EXISTS "${ri}")
+    endif(item MATCHES "@executable_path")
+  endif(NOT resolved)
+
+  if(NOT resolved)
+    if(item MATCHES "@loader_path")
+      #
+      # @loader_path references are assumed relative to the
+      # PATH of the given "context" (presumably another library)
+      #
+      get_filename_component(contextpath "${context}" PATH)
+      string(REPLACE "@loader_path" "${contextpath}" ri "${item}")
+      get_filename_component(ri "${ri}" ABSOLUTE)
+
+      if(EXISTS "${ri}")
+        #message(STATUS "info: embedded item exists (${ri})")
+        set(resolved 1)
+        set(resolved_item "${ri}")
+      else(EXISTS "${ri}")
+        message(STATUS "warning: embedded item does not exist '${ri}'")
+      endif(EXISTS "${ri}")
+    endif(item MATCHES "@loader_path")
+  endif(NOT resolved)
+
+  if(NOT resolved)
+    set(ri "ri-NOTFOUND")
+    find_file(ri "${item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
+    find_file(ri "${item}" ${exepath} ${dirs} /usr/lib)
+    if(ri)
+      #message(STATUS "info: 'find_file' in exepath/dirs (${ri})")
+      set(resolved 1)
+      set(resolved_item "${ri}")
+      set(ri "ri-NOTFOUND")
+    endif(ri)
+  endif(NOT resolved)
+
+  if(NOT resolved)
+    if(item MATCHES "[^/]+\\.framework/")
+      set(fw "fw-NOTFOUND")
+      find_file(fw "${item}"
+        "~/Library/Frameworks"
+        "/Library/Frameworks"
+        "/System/Library/Frameworks"
+      )
+      if(fw)
+        #message(STATUS "info: 'find_file' found framework (${fw})")
+        set(resolved 1)
+        set(resolved_item "${fw}")
+        set(fw "fw-NOTFOUND")
+      endif(fw)
+    endif(item MATCHES "[^/]+\\.framework/")
+  endif(NOT resolved)
+
+  # Using find_program on Windows will find dll files that are in the PATH.
+  # (Converting simple file names into full path names if found.)
+  #
+  if(WIN32)
+  if(NOT resolved)
+    set(ri "ri-NOTFOUND")
+    find_program(ri "${item}" PATHS "${exepath};${dirs}" NO_DEFAULT_PATH)
+    find_program(ri "${item}" PATHS "${exepath};${dirs}")
+    if(ri)
+      #message(STATUS "info: 'find_program' in exepath/dirs (${ri})")
+      set(resolved 1)
+      set(resolved_item "${ri}")
+      set(ri "ri-NOTFOUND")
+    endif(ri)
+  endif(NOT resolved)
+  endif(WIN32)
+
+  # Provide a hook so that projects can override item resolution
+  # by whatever logic they choose:
+  #
+  if(COMMAND gp_resolve_item_override)
+    gp_resolve_item_override("${context}" "${item}" "${exepath}" "${dirs}" resolved_item resolved)
+  endif(COMMAND gp_resolve_item_override)
+
+  if(NOT resolved)
+    message(STATUS "
+warning: cannot resolve item '${item}'
+
+  possible problems:
+    need more directories?
+    need to use InstallRequiredSystemLibraries?
+    run in install tree instead of build tree?
+")
+#    message(STATUS "
+#******************************************************************************
+#warning: cannot resolve item '${item}'
+#
+#  possible problems:
+#    need more directories?
+#    need to use InstallRequiredSystemLibraries?
+#    run in install tree instead of build tree?
+#
+#    context='${context}'
+#    item='${item}'
+#    exepath='${exepath}'
+#    dirs='${dirs}'
+#    resolved_item_var='${resolved_item_var}'
+#******************************************************************************
+#")
+  endif(NOT resolved)
+
+  set(${resolved_item_var} "${resolved_item}" PARENT_SCOPE)
+endfunction(gp_resolve_item)
+
+
+# gp_resolved_file_type original_file file exepath dirs type_var
+#
+# Return the type of ${file} with respect to ${original_file}. String
+# describing type of prerequisite is returned in variable named ${type_var}.
+#
+# Use ${exepath} and ${dirs} if necessary to resolve non-absolute ${file}
+# values -- but only for non-embedded items.
+#
+# Possible types are:
+#   system
+#   local
+#   embedded
+#   other
+#
+function(gp_resolved_file_type original_file file exepath dirs type_var)
+  #message(STATUS "**")
+
+  if(NOT IS_ABSOLUTE "${original_file}")
+    message(STATUS "warning: gp_resolved_file_type expects absolute full path for first arg original_file")
+  endif()
+
+  set(is_embedded 0)
+  set(is_local 0)
+  set(is_system 0)
+
+  set(resolved_file "${file}")
+
+  if("${file}" MATCHES "^@(executable|loader)_path")
+    set(is_embedded 1)
+  endif()
+
+  if(NOT is_embedded)
+    if(NOT IS_ABSOLUTE "${file}")
+      gp_resolve_item("${original_file}" "${file}" "${exepath}" "${dirs}" resolved_file)
+    endif()
+
+    string(TOLOWER "${original_file}" original_lower)
+    string(TOLOWER "${resolved_file}" lower)
+
+    if(UNIX)
+      if(resolved_file MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/)")
+        set(is_system 1)
+      endif()
+    endif()
+
+    if(APPLE)
+      if(resolved_file MATCHES "^(/System/Library/|/usr/lib/)")
+        set(is_system 1)
+      endif()
+    endif()
+
+    if(WIN32)
+      string(TOLOWER "$ENV{SystemRoot}" sysroot)
+      string(REGEX REPLACE "\\\\" "/" sysroot "${sysroot}")
+
+      string(TOLOWER "$ENV{windir}" windir)
+      string(REGEX REPLACE "\\\\" "/" windir "${windir}")
+
+      if(lower MATCHES "^(${sysroot}/system|${windir}/system|${sysroot}/syswow|${windir}/syswow|(.*/)*msvc[^/]+dll)")
+        set(is_system 1)
+      endif()
+    endif()
+
+    if(NOT is_system)
+      get_filename_component(original_path "${original_lower}" PATH)
+      get_filename_component(path "${lower}" PATH)
+      if("${original_path}" STREQUAL "${path}")
+        set(is_local 1)
+      endif()
+    endif()
+  endif()
+
+  # Return type string based on computed booleans:
+  #
+  set(type "other")
+
+  if(is_system)
+    set(type "system")
+  elseif(is_embedded)
+    set(type "embedded")
+  elseif(is_local)
+    set(type "local")
+  endif()
+
+  #message(STATUS "gp_resolved_file_type: '${file}' '${resolved_file}'")
+  #message(STATUS "                type: '${type}'")
+
+  if(NOT is_embedded)
+    if(NOT IS_ABSOLUTE "${resolved_file}")
+      if(lower MATCHES "^msvc[^/]+dll" AND is_system)
+        message(STATUS "info: non-absolute msvc file '${file}' returning type '${type}'")
+      else()
+        message(STATUS "warning: gp_resolved_file_type non-absolute file '${file}' returning type '${type}' -- possibly incorrect")
+      endif()
+    endif()
+  endif()
+
+  set(${type_var} "${type}" PARENT_SCOPE)
+
+  #message(STATUS "**")
+endfunction()
+
+
+# gp_file_type original_file file type_var
+#
+# Return the type of ${file} with respect to ${original_file}. String
+# describing type of prerequisite is returned in variable named ${type_var}.
+#
+# Possible types are:
+#   system
+#   local
+#   embedded
+#   other
+#
+function(gp_file_type original_file file type_var)
+  if(NOT IS_ABSOLUTE "${original_file}")
+    message(STATUS "warning: gp_file_type expects absolute full path for first arg original_file")
+  endif()
+
+  get_filename_component(exepath "${original_file}" PATH)
+
+  set(type "")
+  gp_resolved_file_type("${original_file}" "${file}" "${exepath}" "" type)
+
+  set(${type_var} "${type}" PARENT_SCOPE)
+endfunction(gp_file_type)
+
+
+# get_prerequisites target prerequisites_var exclude_system recurse dirs
+#
+# Get the list of shared library files required by ${target}. The list in
+# the variable named ${prerequisites_var} should be empty on first entry to
+# this function. On exit, ${prerequisites_var} will contain the list of
+# required shared library files.
+#
+#  target is the full path to an executable file
+#
+#  prerequisites_var is the name of a CMake variable to contain the results
+#
+#  exclude_system is 0 or 1: 0 to include "system" prerequisites , 1 to
+#   exclude them
+#
+#  recurse is 0 or 1: 0 for direct prerequisites only, 1 for all prerequisites
+#   recursively
+#
+#  exepath is the path to the top level executable used for @executable_path
+#   replacment on the Mac
+#
+#  dirs is a list of paths where libraries might be found: these paths are
+#   searched first when a target without any path info is given. Then standard
+#   system locations are also searched: PATH, Framework locations, /usr/lib...
+#
+function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs)
+  set(verbose 0)
+  set(eol_char "E")
+
+  if(NOT IS_ABSOLUTE "${target}")
+    message("warning: target '${target}' is not absolute...")
+  endif(NOT IS_ABSOLUTE "${target}")
+
+  if(NOT EXISTS "${target}")
+    message("warning: target '${target}' does not exist...")
+  endif(NOT EXISTS "${target}")
+
+  # <setup-gp_tool-vars>
+  #
+  # Try to choose the right tool by default. Caller can set gp_tool prior to
+  # calling this function to force using a different tool.
+  #
+  if("${gp_tool}" STREQUAL "")
+    set(gp_tool "ldd")
+    if(APPLE)
+      set(gp_tool "otool")
+    endif(APPLE)
+    if(WIN32)
+      set(gp_tool "dumpbin")
+    endif(WIN32)
+  endif("${gp_tool}" STREQUAL "")
+
+  set(gp_tool_known 0)
+
+  if("${gp_tool}" STREQUAL "ldd")
+    set(gp_cmd_args "")
+    set(gp_regex "^[\t ]*[^\t ]+ => ([^\t ]+).*${eol_char}$")
+    set(gp_regex_cmp_count 1)
+    set(gp_tool_known 1)
+  endif("${gp_tool}" STREQUAL "ldd")
+
+  if("${gp_tool}" STREQUAL "otool")
+    set(gp_cmd_args "-L")
+    set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
+    set(gp_regex_cmp_count 3)
+    set(gp_tool_known 1)
+  endif("${gp_tool}" STREQUAL "otool")
+
+  if("${gp_tool}" STREQUAL "dumpbin")
+    set(gp_cmd_args "/dependents")
+    set(gp_regex "^    ([^ ].*[Dd][Ll][Ll])${eol_char}$")
+    set(gp_regex_cmp_count 1)
+    set(gp_tool_known 1)
+    set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE.
+  endif("${gp_tool}" STREQUAL "dumpbin")
+
+  if(NOT gp_tool_known)
+    message(STATUS "warning: gp_tool='${gp_tool}' is an unknown tool...")
+    message(STATUS "CMake function get_prerequisites needs more code to handle '${gp_tool}'")
+    message(STATUS "Valid gp_tool values are dumpbin, ldd and otool.")
+    return()
+  endif(NOT gp_tool_known)
+
+  set(gp_cmd_paths ${gp_cmd_paths}
+    "C:/Program Files/Microsoft Visual Studio 9.0/VC/bin"
+    "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin"
+    "C:/Program Files/Microsoft Visual Studio 8/VC/BIN"
+    "C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN"
+    "C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN"
+    "C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN"
+    "/usr/local/bin"
+    "/usr/bin"
+    )
+
+  find_program(gp_cmd ${gp_tool} PATHS ${gp_cmd_paths})
+
+  if(NOT gp_cmd)
+    message(STATUS "warning: could not find '${gp_tool}' - cannot analyze prerequisites...")
+    return()
+  endif(NOT gp_cmd)
+
+  if("${gp_tool}" STREQUAL "dumpbin")
+    # When running dumpbin, it also needs the "Common7/IDE" directory in the
+    # PATH. It will already be in the PATH if being run from a Visual Studio
+    # command prompt. Add it to the PATH here in case we are running from a
+    # different command prompt.
+    #
+    get_filename_component(gp_cmd_dir "${gp_cmd}" PATH)
+    get_filename_component(gp_cmd_dlls_dir "${gp_cmd_dir}/../../Common7/IDE" ABSOLUTE)
+    if(EXISTS "${gp_cmd_dlls_dir}")
+      # only add to the path if it is not already in the path
+      if(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}")
+        set(ENV{PATH} "$ENV{PATH};${gp_cmd_dlls_dir}")
+      endif(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}")
+    endif(EXISTS "${gp_cmd_dlls_dir}")
+  endif("${gp_tool}" STREQUAL "dumpbin")
+  #
+  # </setup-gp_tool-vars>
+
+  if("${gp_tool}" STREQUAL "ldd")
+    set(old_ld_env "$ENV{LD_LIBRARY_PATH}")
+    foreach(dir ${exepath} ${dirs})
+      set(ENV{LD_LIBRARY_PATH} "${dir}:$ENV{LD_LIBRARY_PATH}")
+    endforeach(dir)
+  endif("${gp_tool}" STREQUAL "ldd")
+
+
+  # Track new prerequisites at each new level of recursion. Start with an
+  # empty list at each level:
+  #
+  set(unseen_prereqs)
+
+  # Run gp_cmd on the target:
+  #
+  execute_process(
+    COMMAND ${gp_cmd} ${gp_cmd_args} ${target}
+    OUTPUT_VARIABLE gp_cmd_ov
+    )
+
+  if("${gp_tool}" STREQUAL "ldd")
+    set(ENV{LD_LIBRARY_PATH} "${old_ld_env}")
+  endif("${gp_tool}" STREQUAL "ldd")
+
+  if(verbose)
+    message(STATUS "<RawOutput cmd='${gp_cmd} ${gp_cmd_args} ${target}'>")
+    message(STATUS "gp_cmd_ov='${gp_cmd_ov}'")
+    message(STATUS "</RawOutput>")
+  endif(verbose)
+
+  get_filename_component(target_dir "${target}" PATH)
+
+  # Convert to a list of lines:
+  #
+  string(REGEX REPLACE ";" "\\\\;" candidates "${gp_cmd_ov}")
+  string(REGEX REPLACE "\n" "${eol_char};" candidates "${candidates}")
+
+  # Analyze each line for file names that match the regular expression:
+  #
+  foreach(candidate ${candidates})
+  if("${candidate}" MATCHES "${gp_regex}")
+    # Extract information from each candidate:
+    string(REGEX REPLACE "${gp_regex}" "\\1" raw_item "${candidate}")
+
+    if(gp_regex_cmp_count GREATER 1)
+      string(REGEX REPLACE "${gp_regex}" "\\2" raw_compat_version "${candidate}")
+      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" compat_major_version "${raw_compat_version}")
+      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" compat_minor_version "${raw_compat_version}")
+      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" compat_patch_version "${raw_compat_version}")
+    endif(gp_regex_cmp_count GREATER 1)
+
+    if(gp_regex_cmp_count GREATER 2)
+      string(REGEX REPLACE "${gp_regex}" "\\3" raw_current_version "${candidate}")
+      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" current_major_version "${raw_current_version}")
+      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" current_minor_version "${raw_current_version}")
+      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" current_patch_version "${raw_current_version}")
+    endif(gp_regex_cmp_count GREATER 2)
+
+    # Use the raw_item as the list entries returned by this function. Use the
+    # gp_resolve_item function to resolve it to an actual full path file if
+    # necessary.
+    #
+    set(item "${raw_item}")
+
+    # Add each item unless it is excluded:
+    #
+    set(add_item 1)
+
+    if(${exclude_system})
+      set(type "")
+      gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type)
+      if("${type}" STREQUAL "system")
+        set(add_item 0)
+      endif("${type}" STREQUAL "system")
+    endif(${exclude_system})
+
+    if(add_item)
+      list(LENGTH ${prerequisites_var} list_length_before_append)
+      gp_append_unique(${prerequisites_var} "${item}")
+      list(LENGTH ${prerequisites_var} list_length_after_append)
+
+      if(${recurse})
+        # If item was really added, this is the first time we have seen it.
+        # Add it to unseen_prereqs so that we can recursively add *its*
+        # prerequisites...
+        #
+        # But first: resolve its name to an absolute full path name such
+        # that the analysis tools can simply accept it as input.
+        #
+        if(NOT list_length_before_append EQUAL list_length_after_append)
+          gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item)
+          set(unseen_prereqs ${unseen_prereqs} "${resolved_item}")
+        endif(NOT list_length_before_append EQUAL list_length_after_append)
+      endif(${recurse})
+    endif(add_item)
+  else("${candidate}" MATCHES "${gp_regex}")
+    if(verbose)
+      message(STATUS "ignoring non-matching line: '${candidate}'")
+    endif(verbose)
+  endif("${candidate}" MATCHES "${gp_regex}")
+  endforeach(candidate)
+
+  list(LENGTH ${prerequisites_var} prerequisites_var_length)
+  if(prerequisites_var_length GREATER 0)
+    list(SORT ${prerequisites_var})
+  endif(prerequisites_var_length GREATER 0)
+  if(${recurse})
+    set(more_inputs ${unseen_prereqs})
+    foreach(input ${more_inputs})
+      get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}")
+    endforeach(input)
+  endif(${recurse})
+
+  set(${prerequisites_var} ${${prerequisites_var}} PARENT_SCOPE)
+endfunction(get_prerequisites)
+
+
+# list_prerequisites target all exclude_system verbose
+#
+#  ARGV0 (target) is the full path to an executable file
+#
+#  optional ARGV1 (all) is 0 or 1: 0 for direct prerequisites only,
+#   1 for all prerequisites recursively
+#
+#  optional ARGV2 (exclude_system) is 0 or 1: 0 to include "system"
+#   prerequisites , 1 to exclude them
+#
+#  optional ARGV3 (verbose) is 0 or 1: 0 to print only full path
+#   names of prerequisites, 1 to print extra information
+#
+function(list_prerequisites target)
+  if("${ARGV1}" STREQUAL "")
+    set(all 1)
+  else("${ARGV1}" STREQUAL "")
+    set(all "${ARGV1}")
+  endif("${ARGV1}" STREQUAL "")
+
+  if("${ARGV2}" STREQUAL "")
+    set(exclude_system 0)
+  else("${ARGV2}" STREQUAL "")
+    set(exclude_system "${ARGV2}")
+  endif("${ARGV2}" STREQUAL "")
+
+  if("${ARGV3}" STREQUAL "")
+    set(verbose 0)
+  else("${ARGV3}" STREQUAL "")
+    set(verbose "${ARGV3}")
+  endif("${ARGV3}" STREQUAL "")
+
+  set(count 0)
+  set(count_str "")
+  set(print_count "${verbose}")
+  set(print_prerequisite_type "${verbose}")
+  set(print_target "${verbose}")
+  set(type_str "")
+
+  get_filename_component(exepath "${target}" PATH)
+
+  set(prereqs "")
+  get_prerequisites("${target}" prereqs ${exclude_system} ${all} "${exepath}" "")
+
+  if(print_target)
+    message(STATUS "File '${target}' depends on:")
+  endif(print_target)
+
+  foreach(d ${prereqs})
+    math(EXPR count "${count} + 1")
+
+    if(print_count)
+      set(count_str "${count}. ")
+    endif(print_count)
+
+    if(print_prerequisite_type)
+      gp_file_type("${target}" "${d}" type)
+      set(type_str " (${type})")
+    endif(print_prerequisite_type)
+
+    message(STATUS "${count_str}${d}${type_str}")
+  endforeach(d)
+endfunction(list_prerequisites)
+
+
+# list_prerequisites_by_glob glob_arg glob_exp
+#
+#  glob_arg is GLOB or GLOB_RECURSE
+#
+#  glob_exp is a globbing expression used with "file(GLOB" to retrieve a list
+#   of matching files. If a matching file is executable, its prerequisites are
+#   listed.
+#
+# Any additional (optional) arguments provided are passed along as the
+# optional arguments to the list_prerequisites calls.
+#
+function(list_prerequisites_by_glob glob_arg glob_exp)
+  message(STATUS "=============================================================================")
+  message(STATUS "List prerequisites of executables matching ${glob_arg} '${glob_exp}'")
+  message(STATUS "")
+  file(${glob_arg} file_list ${glob_exp})
+  foreach(f ${file_list})
+    is_file_executable("${f}" is_f_executable)
+    if(is_f_executable)
+      message(STATUS "=============================================================================")
+      list_prerequisites("${f}" ${ARGN})
+      message(STATUS "")
+    endif(is_f_executable)
+  endforeach(f)
+endfunction(list_prerequisites_by_glob)
diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake
index d8f64199cf63abdcd92219d6b21a6e8e282a1a52..bf4d9b72a9fe8036ea1196b629bdf650a0dec54c 100644
--- a/indra/cmake/LLAddBuildTest.cmake
+++ b/indra/cmake/LLAddBuildTest.cmake
@@ -107,6 +107,8 @@ INCLUDE(GoogleMock)
 
     # Setup target
     ADD_EXECUTABLE(PROJECT_${project}_TEST_${name} ${${name}_test_SOURCE_FILES})
+    SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${EXE_STAGING_DIR})
+
     #
     # Per-codefile additional / external project dep and lib dep property extraction
     #
@@ -142,8 +144,10 @@ INCLUDE(GoogleMock)
     
     IF(WINDOWS)
       set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR})
+    ELSEIF(DARWIN)
+      set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources:/usr/lib)
     ELSE(WINDOWS)
-      set(LD_LIBRARY_PATH ${ARCH_PREBUILT_DIRS}:${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}:/usr/lib)
+      set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}:/usr/lib)
     ENDIF(WINDOWS)
 
     LL_TEST_COMMAND("${LD_LIBRARY_PATH}" ${TEST_CMD})
@@ -200,6 +204,7 @@ FUNCTION(LL_ADD_INTEGRATION_TEST
     message(STATUS "ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})")
   endif(TEST_DEBUG)
   ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})
+  SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${EXE_STAGING_DIR})
 
   # Add link deps to the executable
   if(TEST_DEBUG)
@@ -230,8 +235,10 @@ FUNCTION(LL_ADD_INTEGRATION_TEST
 
   IF(WINDOWS)
     set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR})
+  ELSEIF(DARWIN)
+    set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources:/usr/lib)
   ELSE(WINDOWS)
-    set(LD_LIBRARY_PATH ${ARCH_PREBUILT_DIRS}:${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}:/usr/lib)
+    set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}:/usr/lib)
   ENDIF(WINDOWS)
 
   LL_TEST_COMMAND("${LD_LIBRARY_PATH}" ${test_command})
@@ -250,4 +257,4 @@ FUNCTION(LL_ADD_INTEGRATION_TEST
   # Use CTEST? Not sure how to yet...
   # ADD_TEST(INTEGRATION_TEST_RUNNER_${testname} ${TEST_SCRIPT_CMD})
 
-ENDFUNCTION(LL_ADD_INTEGRATION_TEST)
\ No newline at end of file
+ENDFUNCTION(LL_ADD_INTEGRATION_TEST)
diff --git a/indra/cmake/LLSharedLibs.cmake b/indra/cmake/LLSharedLibs.cmake
index a8c81609bb90cc3d1946ce80e7dcce563800322e..6f602680f49df4eeceff40e5610ccc6b19ed36c8 100644
--- a/indra/cmake/LLSharedLibs.cmake
+++ b/indra/cmake/LLSharedLibs.cmake
@@ -1,31 +1,74 @@
 # ll_deploy_sharedlibs_command
 # target_exe: the cmake target of the executable for which the shared libs will be deployed.
-# search_dirs: a list of dirs to search for the dependencies
-# dst_path: path to copy deps to, relative to the output location of the target_exe
-macro(ll_deploy_sharedlibs_command target_exe search_dirs dst_path) 
-  get_target_property(OUTPUT_LOCATION ${target_exe} LOCATION)
-
+macro(ll_deploy_sharedlibs_command target_exe) 
+  get_target_property(TARGET_LOCATION ${target_exe} LOCATION)
+  get_filename_component(OUTPUT_PATH ${TARGET_LOCATION} PATH)
+  
   if(DARWIN)
+	set(SEARCH_DIRS "${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources")
     get_target_property(IS_BUNDLE ${target_exe} MACOSX_BUNDLE)
     if(IS_BUNDLE)
-      get_filename_component(TARGET_FILE ${OUTPUT_LOCATION} NAME)
-      set(OUTPUT_PATH ${OUTPUT_LOCATION}.app/Contents/MacOS)
-      set(OUTPUT_LOCATION ${OUTPUT_PATH}/${TARGET_FILE})
+	  # If its a bundle the exe is not in the target location, this should find it.
+      get_filename_component(TARGET_FILE ${TARGET_LOCATION} NAME)
+      set(OUTPUT_PATH ${TARGET_LOCATION}.app/Contents/MacOS)
+      set(TARGET_LOCATION ${OUTPUT_PATH}/${TARGET_FILE})
+	  set(OUTPUT_PATH ${OUTPUT_PATH}/../Resources)
     endif(IS_BUNDLE)
-  else(DARWIN)
-    message(FATAL_ERROR "Only darwin currently supported!")
+  elseif(WINDOWS)
+    set(SEARCH_DIRS "${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}" "$ENV{SystemRoot}/system32")
+  elseif(LINUX)
+	set(SEARCH_DIRS "${SHARED_LIB_STAGING_DIR}")
+	set(OUTPUT_PATH ${OUTPUT_PATH}/lib)
   endif(DARWIN)
-  
+
   add_custom_command(
     TARGET ${target_exe} POST_BUILD
     COMMAND ${CMAKE_COMMAND} 
     ARGS
-    "-DBIN_NAME=\"${OUTPUT_LOCATION}\""
-    "-DSEARCH_DIRS=\"${search_dirs}\""
-    "-DDST_PATH=\"${OUTPUT_PATH}/${dst_path}\""
+    "-DBIN_NAME=\"${TARGET_LOCATION}\""
+    "-DSEARCH_DIRS=\"${SEARCH_DIRS}\""
+    "-DDST_PATH=\"${OUTPUT_PATH}\""
     "-P"
     "${CMAKE_SOURCE_DIR}/cmake/DeploySharedLibs.cmake"
     )
 
 endmacro(ll_deploy_sharedlibs_command)
 
+# ll_stage_sharedlib
+# Performs config and adds a copy command for a sharedlib target.
+macro(ll_stage_sharedlib DSO_TARGET)
+  if(SHARED_LIB_STAGING_DIR)
+    # target gets written to the DLL staging directory.
+    # Also this directory is shared with RunBuildTest.cmake, y'know, for the tests.
+    set_target_properties(${DSO_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SHARED_LIB_STAGING_DIR})
+    if(NOT WINDOWS)
+      get_target_property(DSO_PATH ${DSO_TARGET} LOCATION)
+      get_filename_component(DSO_FILE ${DSO_PATH} NAME)
+      if(DARWIN)
+        set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources)
+      else(DARWIN)
+        set(SHARED_LIB_STAGING_DIR_CONFIG ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR})
+      endif(DARWIN)
+	  
+      # *TODO - maybe make this a symbolic link? -brad
+      add_custom_command(
+        TARGET ${DSO_TARGET} POST_BUILD
+        COMMAND ${CMAKE_COMMAND}
+        ARGS
+          -E
+          copy_if_different
+          ${DSO_PATH}
+          ${SHARED_LIB_STAGING_DIR_CONFIG}/${DSO_FILE}
+          COMMENT "Copying llcommon to the staging folder."
+        )
+    endif(NOT WINDOWS)
+  endif(SHARED_LIB_STAGING_DIR)
+
+  if (DARWIN)
+    set_target_properties(${DSO_TARGET} PROPERTIES
+      BUILD_WITH_INSTALL_RPATH 1
+      INSTALL_NAME_DIR "@executable_path/../Resources"
+      )
+  endif(DARWIN)
+
+endmacro(ll_stage_sharedlib)
\ No newline at end of file
diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake
index 1f3553539f718b878fead3974b693590ef29f215..bca99caf2a521b0c4284c6cb36c449262f5a1857 100644
--- a/indra/cmake/Linking.cmake
+++ b/indra/cmake/Linking.cmake
@@ -6,6 +6,7 @@ if (NOT STANDALONE)
     set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/release)
     set(ARCH_PREBUILT_DIRS_DEBUG ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/debug)
     set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs CACHE FILEPATH "Location of staged DLLs")
+    set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs CACHE FILEPATH "Location of staged executables")
   elseif (LINUX)
     if (VIEWER)
       set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release_client)
@@ -14,12 +15,14 @@ if (NOT STANDALONE)
     endif (VIEWER)
     set(ARCH_PREBUILT_DIRS_RELEASE ${ARCH_PREBUILT_DIRS})
     set(ARCH_PREBUILT_DIRS_DEBUG ${ARCH_PREBUILT_DIRS})
-    set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs CACHE FILEPATH "Location of staged .sos")
+    set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/lib CACHE FILEPATH "Location of staged .sos")
+    set(EXE_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs/bin CACHE FILEPATH "Location of staged executables")
   elseif (DARWIN)
     set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release)
     set(ARCH_PREBUILT_DIRS ${ARCH_PREBUILT_DIRS_RELEASE})
     set(ARCH_PREBUILT_DIRS_DEBUG ${ARCH_PREBUILT_DIRS_RELEASE})
     set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs CACHE FILEPATH "Location of staged DLLs")
+    set(EXE_STAGING_DIR "${CMAKE_BINARY_DIR}/sharedlibs/\$(CONFIGURATION)" CACHE FILEPATH "Location of staged executables")
   endif (WINDOWS)
 endif (NOT STANDALONE)
 
diff --git a/indra/develop.py b/indra/develop.py
index 7836c97473b1f46236e8c6e480d4f1e4cac1501b..79baa613adb1a2758b2b05117ea7c90fddc59dd0 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -239,6 +239,7 @@ def arch(self):
 
     def run(self, command, name=None):
         '''Run a program.  If the program fails, raise an exception.'''
+        sys.stdout.flush()
         ret = os.system(command)
         if ret:
             if name is None:
@@ -456,7 +457,7 @@ def run_build(self, opts, targets):
             targets = ' '.join(['-target ' + repr(t) for t in targets])
         else:
             targets = ''
-        cmd = ('xcodebuild -configuration %s %s %s' %
+        cmd = ('xcodebuild -configuration %s %s %s | grep -v "^[[:space:]]*setenv" ; exit ${PIPESTATUS[0]}' %
                (self.build_type, ' '.join(opts), targets))
         for d in self.build_dirs():
             try:
diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py
index 59c84e571b6d6c5470f635cad3c4866e07afe704..8c0521061899a96c59a92e1b257b3ba3e51e6c57 100644
--- a/indra/lib/python/indra/util/llmanifest.py
+++ b/indra/lib/python/indra/util/llmanifest.py
@@ -120,9 +120,8 @@ def get_channel(srctree):
          default=""),
     dict(name='build', description='Build directory.', default=DEFAULT_SRCTREE),
     dict(name='configuration',
-         description="""The build configuration used. Only used on OS X for
-        now, but it could be used for other platforms as well.""",
-         default="Universal"),
+         description="""The build configuration used.""",
+         default="Release"),
     dict(name='dest', description='Destination directory.', default=DEFAULT_SRCTREE),
     dict(name='grid',
          description="""Which grid the client will try to connect to. Even
diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp
index e68672d46f9a4017bf60fdd3ad8ccdff6f528a4e..528a7bb4a5f51f9b11b29739502a6738e9f08b8b 100644
--- a/indra/llcharacter/llcharacter.cpp
+++ b/indra/llcharacter/llcharacter.cpp
@@ -273,13 +273,13 @@ void LLCharacter::removeAnimationData(std::string name)
 //-----------------------------------------------------------------------------
 // setVisualParamWeight()
 //-----------------------------------------------------------------------------
-BOOL LLCharacter::setVisualParamWeight(LLVisualParam* which_param, F32 weight, BOOL set_by_user)
+BOOL LLCharacter::setVisualParamWeight(LLVisualParam* which_param, F32 weight, BOOL upload_bake)
 {
 	S32 index = which_param->getID();
 	visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index);
 	if (index_iter != mVisualParamIndexMap.end())
 	{
-		index_iter->second->setWeight(weight, set_by_user);
+		index_iter->second->setWeight(weight, upload_bake);
 		return TRUE;
 	}
 	return FALSE;
@@ -288,7 +288,7 @@ BOOL LLCharacter::setVisualParamWeight(LLVisualParam* which_param, F32 weight, B
 //-----------------------------------------------------------------------------
 // setVisualParamWeight()
 //-----------------------------------------------------------------------------
-BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL set_by_user)
+BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake)
 {
 	std::string tname(param_name);
 	LLStringUtil::toLower(tname);
@@ -296,7 +296,7 @@ BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL
 	visual_param_name_map_t::iterator name_iter = mVisualParamNameMap.find(tableptr);
 	if (name_iter != mVisualParamNameMap.end())
 	{
-		name_iter->second->setWeight(weight, set_by_user);
+		name_iter->second->setWeight(weight, upload_bake);
 		return TRUE;
 	}
 	llwarns << "LLCharacter::setVisualParamWeight() Invalid visual parameter: " << param_name << llendl;
@@ -306,12 +306,12 @@ BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL
 //-----------------------------------------------------------------------------
 // setVisualParamWeight()
 //-----------------------------------------------------------------------------
-BOOL LLCharacter::setVisualParamWeight(S32 index, F32 weight, BOOL set_by_user)
+BOOL LLCharacter::setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake)
 {
 	visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index);
 	if (index_iter != mVisualParamIndexMap.end())
 	{
-		index_iter->second->setWeight(weight, set_by_user);
+		index_iter->second->setWeight(weight, upload_bake);
 		return TRUE;
 	}
 	llwarns << "LLCharacter::setVisualParamWeight() Invalid visual parameter index: " << index << llendl;
diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h
index cb44a32e8af07c8dce9ba71946b2c646c8505db1..27e2a51c626d460707c1993665fc96562d216823 100644
--- a/indra/llcharacter/llcharacter.h
+++ b/indra/llcharacter/llcharacter.h
@@ -203,9 +203,9 @@ class LLCharacter
 	void addVisualParam(LLVisualParam *param);
 	void addSharedVisualParam(LLVisualParam *param);
 
-	virtual BOOL setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL set_by_user = FALSE );
-	virtual BOOL setVisualParamWeight(const char* param_name, F32 weight, BOOL set_by_user = FALSE );
-	virtual BOOL setVisualParamWeight(S32 index, F32 weight, BOOL set_by_user = FALSE );
+	virtual BOOL setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake = FALSE );
+	virtual BOOL setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake = FALSE );
+	virtual BOOL setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake = FALSE );
 
 	// get visual param weight by param or name
 	F32 getVisualParamWeight(LLVisualParam *distortion);
diff --git a/indra/llcharacter/llvisualparam.cpp b/indra/llcharacter/llvisualparam.cpp
index 6232c7588bb38321c19908919965e31e79880193..297322fe58e51f1457651ffe01c129bdd1dbd134 100644
--- a/indra/llcharacter/llvisualparam.cpp
+++ b/indra/llcharacter/llvisualparam.cpp
@@ -225,7 +225,7 @@ BOOL LLVisualParam::parseData(LLXmlTreeNode *node)
 //-----------------------------------------------------------------------------
 // setWeight()
 //-----------------------------------------------------------------------------
-void LLVisualParam::setWeight(F32 weight, BOOL set_by_user)
+void LLVisualParam::setWeight(F32 weight, BOOL upload_bake)
 {
 	if (mIsAnimating)
 	{
@@ -243,19 +243,19 @@ void LLVisualParam::setWeight(F32 weight, BOOL set_by_user)
 	
 	if (mNext)
 	{
-		mNext->setWeight(weight, set_by_user);
+		mNext->setWeight(weight, upload_bake);
 	}
 }
 
 //-----------------------------------------------------------------------------
 // setAnimationTarget()
 //-----------------------------------------------------------------------------
-void LLVisualParam::setAnimationTarget(F32 target_value, BOOL set_by_user)
+void LLVisualParam::setAnimationTarget(F32 target_value, BOOL upload_bake)
 {
 	// don't animate dummy parameters
 	if (mIsDummy)
 	{
-		setWeight(target_value, set_by_user);
+		setWeight(target_value, upload_bake);
 		return;
 	}
 
@@ -274,7 +274,7 @@ void LLVisualParam::setAnimationTarget(F32 target_value, BOOL set_by_user)
 
 	if (mNext)
 	{
-		mNext->setAnimationTarget(target_value, set_by_user);
+		mNext->setAnimationTarget(target_value, upload_bake);
 	}
 }
 
@@ -291,24 +291,24 @@ void LLVisualParam::setNextParam( LLVisualParam *next )
 //-----------------------------------------------------------------------------
 // animate()
 //-----------------------------------------------------------------------------
-void LLVisualParam::animate( F32 delta, BOOL set_by_user )
+void LLVisualParam::animate( F32 delta, BOOL upload_bake )
 {
 	if (mIsAnimating)
 	{
 		F32 new_weight = ((mTargetWeight - mCurWeight) * delta) + mCurWeight;
-		setWeight(new_weight, set_by_user);
+		setWeight(new_weight, upload_bake);
 	}
 }
 
 //-----------------------------------------------------------------------------
 // stopAnimating()
 //-----------------------------------------------------------------------------
-void LLVisualParam::stopAnimating(BOOL set_by_user)
+void LLVisualParam::stopAnimating(BOOL upload_bake)
 { 
 	if (mIsAnimating && getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE)
 	{
 		mIsAnimating = FALSE; 
-		setWeight(mTargetWeight, set_by_user);
+		setWeight(mTargetWeight, upload_bake);
 	}
 }
 
diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h
index eec56d78443d010db7df8b1e2f05b39ecd241a63..12b45e6ebe64e712af6dc45ac301521d3fe395e2 100644
--- a/indra/llcharacter/llvisualparam.h
+++ b/indra/llcharacter/llvisualparam.h
@@ -113,10 +113,10 @@ class LLVisualParam
 	//virtual BOOL			parseData( LLXmlTreeNode *node ) = 0;
 	virtual void			apply( ESex avatar_sex ) = 0;
 	//  Default functions
-	virtual void			setWeight(F32 weight, BOOL set_by_user);
-	virtual void			setAnimationTarget( F32 target_value, BOOL set_by_user );
-	virtual void			animate(F32 delta, BOOL set_by_user);
-	virtual void			stopAnimating(BOOL set_by_user);
+	virtual void			setWeight(F32 weight, BOOL upload_bake);
+	virtual void			setAnimationTarget( F32 target_value, BOOL upload_bake );
+	virtual void			animate(F32 delta, BOOL upload_bake);
+	virtual void			stopAnimating(BOOL upload_bake);
 
 	virtual BOOL			linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params);
 	virtual void			resetDrivenParams();
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index f7856986121958e39e123447888cab3bd6d1c377..e41c75846b33071156b036a3389ed374926856c0 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -1,3 +1,4 @@
+
 # -*- cmake -*-
 
 project(llcommon)
@@ -6,11 +7,9 @@ include(00-Common)
 include(LLCommon)
 include(Linking)
 include(Boost)
-include (Pth)
-
-if (WINDOWS)
-    include(CopyWinLibs)
-endif (WINDOWS)
+include(Pth)
+include(LLSharedLibs)
+include(Copy3rdPartyLibs)
 
 include_directories(
     ${EXPAT_INCLUDE_DIRS}
@@ -42,6 +41,7 @@ set(llcommon_SOURCE_FILES
     llerror.cpp
     llerrorthread.cpp
     llevent.cpp
+    lleventapi.cpp
     lleventcoro.cpp
     lleventdispatcher.cpp
     lleventfilter.cpp
@@ -141,6 +141,7 @@ set(llcommon_HEADER_FILES
     llerrorlegacy.h
     llerrorthread.h
     llevent.h
+    lleventapi.h
     lleventcoro.h
     lleventdispatcher.h
     lleventfilter.h
@@ -243,35 +244,7 @@ list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES})
 
 if(LLCOMMON_LINK_SHARED)
     add_library (llcommon SHARED ${llcommon_SOURCE_FILES})
-
-    if(SHARED_LIB_STAGING_DIR)
-        # *FIX:Mani ---
-        # llcommon.dll get written to the DLL staging directory.
-        # Also this directory is shared with RunBuildTest.cmake, y'know, for the tests.
-        set_target_properties(llcommon PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${SHARED_LIB_STAGING_DIR})
-        if(NOT WINDOWS)
-          get_target_property(LLCOMMON_PATH llcommon LOCATION)
-          get_filename_component(LLCOMMON_FILE ${LLCOMMON_PATH} NAME)
-          add_custom_command(
-            TARGET llcommon POST_BUILD
-            COMMAND ${CMAKE_COMMAND}
-            ARGS
-              -E
-              copy_if_different
-              ${LLCOMMON_PATH}
-              ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/${LLCOMMON_FILE}
-            COMMENT "Copying llcommon to the staging folder."
-            )
-        endif(NOT WINDOWS)
-    endif(SHARED_LIB_STAGING_DIR)
-
-    if (DARWIN)
-      set_target_properties(llcommon PROPERTIES
-        BUILD_WITH_INSTALL_RPATH 1
-        INSTALL_NAME_DIR "@executable_path/../Resources"
-        )
-    endif(DARWIN)
-
+	ll_stage_sharedlib(llcommon)
 else(LLCOMMON_LINK_SHARED)
     add_library (llcommon ${llcommon_SOURCE_FILES})
 endif(LLCOMMON_LINK_SHARED)
@@ -305,6 +278,7 @@ LL_ADD_INTEGRATION_TEST(lldate "" "${test_libs}")
 LL_ADD_INTEGRATION_TEST(lldependencies "" "${test_libs}")
 LL_ADD_INTEGRATION_TEST(llerror "" "${test_libs}")
 LL_ADD_INTEGRATION_TEST(llframetimer "" "${test_libs}")
+LL_ADD_INTEGRATION_TEST(llinstancetracker "" "${test_libs}")
 LL_ADD_INTEGRATION_TEST(lllazy "" "${test_libs}")
 LL_ADD_INTEGRATION_TEST(llrand "" "${test_libs}")
 LL_ADD_INTEGRATION_TEST(llsdserialize "" "${test_libs}")
diff --git a/indra/llcommon/lleventapi.cpp b/indra/llcommon/lleventapi.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1dd104da8f631ce4702f2446cc5910d8fd828fbb
--- /dev/null
+++ b/indra/llcommon/lleventapi.cpp
@@ -0,0 +1,30 @@
+/**
+ * @file   lleventapi.cpp
+ * @author Nat Goodspeed
+ * @date   2009-11-10
+ * @brief  Implementation for lleventapi.
+ * 
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+// Precompiled header
+#include "linden_common.h"
+// associated header
+#include "lleventapi.h"
+// STL headers
+// std headers
+// external library headers
+// other Linden headers
+
+LLEventAPI::LLEventAPI(const std::string& name, const std::string& desc, const std::string& field):
+    lbase(name, field),
+    ibase(name),
+    mDesc(desc)
+{
+}
+
+LLEventAPI::~LLEventAPI()
+{
+}
diff --git a/indra/llcommon/lleventapi.h b/indra/llcommon/lleventapi.h
new file mode 100644
index 0000000000000000000000000000000000000000..2cd3b5bf8975abbe52c0375e91eb27820ae28657
--- /dev/null
+++ b/indra/llcommon/lleventapi.h
@@ -0,0 +1,53 @@
+/**
+ * @file   lleventapi.h
+ * @author Nat Goodspeed
+ * @date   2009-10-28
+ * @brief  LLEventAPI is the base class for every class that wraps a C++ API
+ *         in an event API
+ * (see https://wiki.lindenlab.com/wiki/Incremental_Viewer_Automation/Event_API).
+ * 
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+#if ! defined(LL_LLEVENTAPI_H)
+#define LL_LLEVENTAPI_H
+
+#include "lleventdispatcher.h"
+#include "llinstancetracker.h"
+#include <string>
+
+/**
+ * LLEventAPI not only provides operation dispatch functionality, inherited
+ * from LLDispatchListener -- it also gives us event API introspection.
+ * Deriving from LLInstanceTracker lets us enumerate instances.
+ */
+class LL_COMMON_API LLEventAPI: public LLDispatchListener,
+                  public LLInstanceTracker<LLEventAPI, std::string>
+{
+    typedef LLDispatchListener lbase;
+    typedef LLInstanceTracker<LLEventAPI, std::string> ibase;
+
+public:
+    /**
+     * @param name LLEventPump name on which this LLEventAPI will listen. This
+     * also serves as the LLInstanceTracker instance key.
+     * @param desc Documentation string shown to a client trying to discover
+     * available event APIs.
+     * @param field LLSD::Map key used by LLDispatchListener to look up the
+     * subclass method to invoke [default "op"].
+     */
+    LLEventAPI(const std::string& name, const std::string& desc, const std::string& field="op");
+    virtual ~LLEventAPI();
+
+    /// Get the string name of this LLEventAPI
+    std::string getName() const { return ibase::getKey(); }
+    /// Get the documentation string
+    std::string getDesc() const { return mDesc; }
+
+private:
+    std::string mDesc;
+};
+
+#endif /* ! defined(LL_LLEVENTAPI_H) */
diff --git a/indra/llcommon/lleventdispatcher.cpp b/indra/llcommon/lleventdispatcher.cpp
index 6b1413d05494851ca76373a91ed5f3569e93df1b..017bf3a52194ae8d1b5878738918aaeffc7d7614 100644
--- a/indra/llcommon/lleventdispatcher.cpp
+++ b/indra/llcommon/lleventdispatcher.cpp
@@ -36,9 +36,11 @@ LLEventDispatcher::~LLEventDispatcher()
 }
 
 /// Register a callable by name
-void LLEventDispatcher::add(const std::string& name, const Callable& callable, const LLSD& required)
+void LLEventDispatcher::add(const std::string& name, const std::string& desc,
+                            const Callable& callable, const LLSD& required)
 {
-    mDispatch[name] = DispatchMap::mapped_type(callable, required);
+    mDispatch.insert(DispatchMap::value_type(name,
+                                             DispatchMap::mapped_type(callable, desc, required)));
 }
 
 void LLEventDispatcher::addFail(const std::string& name, const std::string& classname) const
@@ -98,14 +100,14 @@ bool LLEventDispatcher::attemptCall(const std::string& name, const LLSD& event)
     }
     // Found the name, so it's plausible to even attempt the call. But first,
     // validate the syntax of the event itself.
-    std::string mismatch(llsd_matches(found->second.second, event));
+    std::string mismatch(llsd_matches(found->second.mRequired, event));
     if (! mismatch.empty())
     {
         LL_ERRS("LLEventDispatcher") << "LLEventDispatcher(" << mDesc << ") calling '" << name
                                      << "': bad request: " << mismatch << LL_ENDL;
     }
     // Event syntax looks good, go for it!
-    (found->second.first)(event);
+    (found->second.mFunc)(event);
     return true;                    // tell caller we were able to call
 }
 
@@ -116,7 +118,7 @@ LLEventDispatcher::Callable LLEventDispatcher::get(const std::string& name) cons
     {
         return Callable();
     }
-    return found->second.first;
+    return found->second.mFunc;
 }
 
 LLDispatchListener::LLDispatchListener(const std::string& pumpname, const std::string& key):
diff --git a/indra/llcommon/lleventdispatcher.h b/indra/llcommon/lleventdispatcher.h
index 5a86b90bff1924a5357b843f3dab622df4262a39..eba7b607f18eb25b1694aee4db0c2a1ba6677087 100644
--- a/indra/llcommon/lleventdispatcher.h
+++ b/indra/llcommon/lleventdispatcher.h
@@ -44,7 +44,10 @@ class LL_COMMON_API LLEventDispatcher
      * is used to validate the structure of each incoming event (see
      * llsd_matches()).
      */
-    void add(const std::string& name, const Callable& callable, const LLSD& required=LLSD());
+    void add(const std::string& name,
+             const std::string& desc,
+             const Callable& callable,
+             const LLSD& required=LLSD());
 
     /**
      * Special case: a subclass of this class can pass an unbound member
@@ -52,18 +55,22 @@ class LL_COMMON_API LLEventDispatcher
      * <tt>boost::bind()</tt> expression.
      */
     template <class CLASS>
-    void add(const std::string& name, void (CLASS::*method)(const LLSD&),
+    void add(const std::string& name,
+             const std::string& desc,
+             void (CLASS::*method)(const LLSD&),
              const LLSD& required=LLSD())
     {
-        addMethod<CLASS>(name, method, required);
+        addMethod<CLASS>(name, desc, method, required);
     }
 
     /// Overload for both const and non-const methods
     template <class CLASS>
-    void add(const std::string& name, void (CLASS::*method)(const LLSD&) const,
+    void add(const std::string& name,
+             const std::string& desc,
+             void (CLASS::*method)(const LLSD&) const,
              const LLSD& required=LLSD())
     {
-        addMethod<CLASS>(name, method, required);
+        addMethod<CLASS>(name, desc, method, required);
     }
 
     /// Unregister a callable
@@ -86,7 +93,8 @@ class LL_COMMON_API LLEventDispatcher
 
 private:
     template <class CLASS, typename METHOD>
-    void addMethod(const std::string& name, const METHOD& method, const LLSD& required)
+    void addMethod(const std::string& name, const std::string& desc,
+                   const METHOD& method, const LLSD& required)
     {
         CLASS* downcast = dynamic_cast<CLASS*>(this);
         if (! downcast)
@@ -95,7 +103,7 @@ class LL_COMMON_API LLEventDispatcher
         }
         else
         {
-            add(name, boost::bind(method, downcast, _1), required);
+            add(name, desc, boost::bind(method, downcast, _1), required);
         }
     }
     void addFail(const std::string& name, const std::string& classname) const;
@@ -103,7 +111,18 @@ class LL_COMMON_API LLEventDispatcher
     bool attemptCall(const std::string& name, const LLSD& event) const;
 
     std::string mDesc, mKey;
-    typedef std::map<std::string, std::pair<Callable, LLSD> > DispatchMap;
+    struct DispatchEntry
+    {
+        DispatchEntry(const Callable& func, const std::string& desc, const LLSD& required):
+            mFunc(func),
+            mDesc(desc),
+            mRequired(required)
+        {}
+        Callable mFunc;
+        std::string mDesc;
+        LLSD mRequired;
+    };
+    typedef std::map<std::string, DispatchEntry> DispatchMap;
     DispatchMap mDispatch;
 };
 
diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h
index 192d79b27ddb2658c4fda32c1fdc1d83d8502588..f52cf33fd8df6898651e967f3d4770169c637720 100644
--- a/indra/llcommon/llevents.h
+++ b/indra/llcommon/llevents.h
@@ -45,10 +45,12 @@
 #include "llsingleton.h"
 #include "lldependencies.h"
 
+/*==========================================================================*|
 // override this to allow binding free functions with more parameters
 #ifndef LLEVENTS_LISTENER_ARITY
 #define LLEVENTS_LISTENER_ARITY 10
 #endif
+|*==========================================================================*/
 
 // hack for testing
 #ifndef testable
diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index ea50acbbc5e08008c241eb34d188ba9cbc0a1280..11fe5236519f3e35f6bbfc720e06b8c15c6e80d3 100644
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -38,42 +38,73 @@
 
 #include "string_table.h"
 #include <boost/utility.hpp>
-
-// This mix-in class adds support for tracking all instances of the specified class parameter T
-// The (optional) key associates a value of type KEY with a given instance of T, for quick lookup
-// If KEY is not provided, then instances are stored in a simple set
-// *NOTE: see explicit specialization below for default KEY==T* case
+#include <boost/function.hpp>
+#include <boost/bind.hpp>
+#include <boost/iterator/transform_iterator.hpp>
+#include <boost/iterator/indirect_iterator.hpp>
+
+/// This mix-in class adds support for tracking all instances of the specified class parameter T
+/// The (optional) key associates a value of type KEY with a given instance of T, for quick lookup
+/// If KEY is not provided, then instances are stored in a simple set
+/// @NOTE: see explicit specialization below for default KEY==T* case
 template<typename T, typename KEY = T*>
 class LLInstanceTracker : boost::noncopyable
 {
+	typedef typename std::map<KEY, T*> InstanceMap;
+	typedef boost::function<const KEY&(typename InstanceMap::value_type&)> KeyGetter;
+	typedef boost::function<T*(typename InstanceMap::value_type&)> InstancePtrGetter;
 public:
-	typedef typename std::map<KEY, T*>::iterator instance_iter;
-	typedef typename std::map<KEY, T*>::const_iterator instance_const_iter;
-
-	static T* getInstance(const KEY& k) { instance_iter found = getMap().find(k); return (found == getMap().end()) ? NULL : found->second; }
+	/// Dereferencing key_iter gives you a const KEY&
+	typedef boost::transform_iterator<KeyGetter, typename InstanceMap::iterator> key_iter;
+	/// Dereferencing instance_iter gives you a T&
+	typedef boost::indirect_iterator< boost::transform_iterator<InstancePtrGetter, typename InstanceMap::iterator> > instance_iter;
+
+	static T* getInstance(const KEY& k)
+	{
+		typename InstanceMap::const_iterator found = getMap_().find(k);
+		return (found == getMap_().end()) ? NULL : found->second;
+	}
 
-	static instance_iter beginInstances() { return getMap().begin(); }
-	static instance_iter endInstances() { return getMap().end(); }
-	static S32 instanceCount() { return getMap().size(); }
+	static key_iter beginKeys()
+	{
+		return boost::make_transform_iterator(getMap_().begin(),
+											  boost::bind(&InstanceMap::value_type::first, _1));
+	}
+	static key_iter endKeys()
+	{
+		return boost::make_transform_iterator(getMap_().end(),
+											  boost::bind(&InstanceMap::value_type::first, _1));
+	}
+	static instance_iter beginInstances()
+	{
+		return instance_iter(boost::make_transform_iterator(getMap_().begin(),
+															boost::bind(&InstanceMap::value_type::second, _1)));
+	}
+	static instance_iter endInstances()
+	{
+		return instance_iter(boost::make_transform_iterator(getMap_().end(),
+															boost::bind(&InstanceMap::value_type::second, _1)));
+	}
+	static S32 instanceCount() { return getMap_().size(); }
 protected:
-	LLInstanceTracker(KEY key) { add(key); }
-	virtual ~LLInstanceTracker() { remove(); }
-	virtual void setKey(KEY key) { remove(); add(key); }
+	LLInstanceTracker(KEY key) { add_(key); }
+	virtual ~LLInstanceTracker() { remove_(); }
+	virtual void setKey(KEY key) { remove_(); add_(key); }
 	virtual const KEY& getKey() const { return mKey; }
 
 private:
-	void add(KEY key) 
+	void add_(KEY key) 
 	{ 
 		mKey = key; 
-		getMap()[key] = static_cast<T*>(this); 
+		getMap_()[key] = static_cast<T*>(this); 
 	}
-	void remove() { getMap().erase(mKey); }
+	void remove_() { getMap_().erase(mKey); }
 
-    static std::map<KEY, T*>& getMap()
+    static InstanceMap& getMap_()
     {
         if (! sInstances)
         {
-            sInstances = new std::map<KEY, T*>;
+            sInstances = new InstanceMap;
         }
         return *sInstances;
     }
@@ -81,41 +112,48 @@ class LLInstanceTracker : boost::noncopyable
 private:
 
 	KEY mKey;
-	static std::map<KEY, T*>* sInstances;
+	static InstanceMap* sInstances;
 };
 
-// explicit specialization for default case where KEY is T*
-// use a simple std::set<T*>
+/// explicit specialization for default case where KEY is T*
+/// use a simple std::set<T*>
 template<typename T>
 class LLInstanceTracker<T, T*>
 {
+	typedef typename std::set<T*> InstanceSet;
 public:
-	typedef typename std::set<T*>::iterator instance_iter;
-	typedef typename std::set<T*>::const_iterator instance_const_iter;
-
-	static instance_iter beginInstances() { return getSet().begin(); }
-	static instance_iter endInstances() { return getSet().end(); }
-	static S32 instanceCount() { return getSet().size(); }
+	/// Dereferencing key_iter gives you a T* (since T* is the key)
+	typedef typename InstanceSet::iterator key_iter;
+	/// Dereferencing instance_iter gives you a T&
+	typedef boost::indirect_iterator<key_iter> instance_iter;
+
+	/// for completeness of analogy with the generic implementation
+	static T* getInstance(T* k) { return k; }
+	static key_iter beginKeys() { return getSet_().begin(); }
+	static key_iter endKeys()   { return getSet_().end(); }
+	static instance_iter beginInstances() { return instance_iter(getSet_().begin()); }
+	static instance_iter endInstances()   { return instance_iter(getSet_().end()); }
+	static S32 instanceCount() { return getSet_().size(); }
 
 protected:
-	LLInstanceTracker() { getSet().insert(static_cast<T*>(this)); }
-	virtual ~LLInstanceTracker() { getSet().erase(static_cast<T*>(this)); }
+	LLInstanceTracker() { getSet_().insert(static_cast<T*>(this)); }
+	virtual ~LLInstanceTracker() { getSet_().erase(static_cast<T*>(this)); }
 
-	LLInstanceTracker(const LLInstanceTracker& other) { getSet().insert(static_cast<T*>(this)); }
+	LLInstanceTracker(const LLInstanceTracker& other) { getSet_().insert(static_cast<T*>(this)); }
 
-    static std::set<T*>& getSet()   // called after getReady() but before go()
+    static InstanceSet& getSet_()   // called after getReady() but before go()
     {
         if (! sInstances)
         {
-            sInstances = new std::set<T*>;
+            sInstances = new InstanceSet;
         }
         return *sInstances;
     }
 
-	static std::set<T*>* sInstances;
+	static InstanceSet* sInstances;
 };
 
-template <typename T, typename KEY> std::map<KEY, T*>* LLInstanceTracker<T, KEY>::sInstances = NULL;
-template <typename T> std::set<T*>* LLInstanceTracker<T, T*>::sInstances = NULL;
+template <typename T, typename KEY> typename LLInstanceTracker<T, KEY>::InstanceMap* LLInstanceTracker<T, KEY>::sInstances = NULL;
+template <typename T> typename LLInstanceTracker<T, T*>::InstanceSet* LLInstanceTracker<T, T*>::sInstances = NULL;
 
 #endif
diff --git a/indra/llcommon/llprocesslauncher.h b/indra/llcommon/llprocesslauncher.h
index 880562157fbcdb6f4f6cd8a8481ec6e4993d71c6..929d547f6edbd43bc54262a976be787dd9ef1294 100644
--- a/indra/llcommon/llprocesslauncher.h
+++ b/indra/llcommon/llprocesslauncher.h
@@ -70,6 +70,14 @@ class LL_COMMON_API LLProcessLauncher
 	
 	// This needs to be called periodically on Mac/Linux to clean up zombie processes.
 	static void reap(void);
+	
+	// Accessors for platform-specific process ID
+#if LL_WINDOWS
+	HANDLE getProcessHandle() { return mProcessHandle; };
+#else
+	pid_t getProcessID() { return mProcessID; };
+#endif	
+	
 private:
 	std::string mExecutable;
 	std::string mWorkingDir;
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp
index ea5b0c03ef18e8cadf136d85d5cfbd4d2f0d1284..ef3e8dbc946396353fa014978d3898900cba06a5 100644
--- a/indra/llcommon/lltimer.cpp
+++ b/indra/llcommon/lltimer.cpp
@@ -583,13 +583,13 @@ void LLEventTimer::updateClass()
 	std::list<LLEventTimer*> completed_timers;
 	for (instance_iter iter = beginInstances(); iter != endInstances(); ) 
 	{
-		LLEventTimer* timer = *iter++;
-		F32 et = timer->mEventTimer.getElapsedTimeF32();
-		if (timer->mEventTimer.getStarted() && et > timer->mPeriod) {
-			timer->mEventTimer.reset();
-			if ( timer->tick() )
+		LLEventTimer& timer = *iter++;
+		F32 et = timer.mEventTimer.getElapsedTimeF32();
+		if (timer.mEventTimer.getStarted() && et > timer.mPeriod) {
+			timer.mEventTimer.reset();
+			if ( timer.tick() )
 			{
-				completed_timers.push_back( timer );
+				completed_timers.push_back( &timer );
 			}
 		}
 	}
diff --git a/indra/llcommon/tests/llinstancetracker_test.cpp b/indra/llcommon/tests/llinstancetracker_test.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..7415f2d33b1eb31eb27853c3abe103b781b9103b
--- /dev/null
+++ b/indra/llcommon/tests/llinstancetracker_test.cpp
@@ -0,0 +1,160 @@
+/**
+ * @file   llinstancetracker_test.cpp
+ * @author Nat Goodspeed
+ * @date   2009-11-10
+ * @brief  Test for llinstancetracker.
+ * 
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+// Precompiled header
+#include "linden_common.h"
+// associated header
+#include "llinstancetracker.h"
+// STL headers
+#include <string>
+#include <vector>
+#include <set>
+#include <algorithm>                // std::sort()
+// std headers
+// external library headers
+#include <boost/scoped_ptr.hpp>
+// other Linden headers
+#include "../test/lltut.h"
+
+struct Keyed: public LLInstanceTracker<Keyed, std::string>
+{
+    Keyed(const std::string& name):
+        LLInstanceTracker<Keyed, std::string>(name),
+        mName(name)
+    {}
+    std::string mName;
+};
+
+struct Unkeyed: public LLInstanceTracker<Unkeyed>
+{
+};
+
+/*****************************************************************************
+*   TUT
+*****************************************************************************/
+namespace tut
+{
+    struct llinstancetracker_data
+    {
+    };
+    typedef test_group<llinstancetracker_data> llinstancetracker_group;
+    typedef llinstancetracker_group::object object;
+    llinstancetracker_group llinstancetrackergrp("llinstancetracker");
+
+    template<> template<>
+    void object::test<1>()
+    {
+        ensure_equals(Keyed::instanceCount(), 0);
+        {
+            Keyed one("one");
+            ensure_equals(Keyed::instanceCount(), 1);
+            Keyed* found = Keyed::getInstance("one");
+            ensure("couldn't find stack Keyed", found);
+            ensure_equals("found wrong Keyed instance", found, &one);
+            {
+                boost::scoped_ptr<Keyed> two(new Keyed("two"));
+                ensure_equals(Keyed::instanceCount(), 2);
+                Keyed* found = Keyed::getInstance("two");
+                ensure("couldn't find heap Keyed", found);
+                ensure_equals("found wrong Keyed instance", found, two.get());
+            }
+            ensure_equals(Keyed::instanceCount(), 1);
+        }
+        Keyed* found = Keyed::getInstance("one");
+        ensure("Keyed key lives too long", ! found);
+        ensure_equals(Keyed::instanceCount(), 0);
+    }
+
+    template<> template<>
+    void object::test<2>()
+    {
+        ensure_equals(Unkeyed::instanceCount(), 0);
+        {
+            Unkeyed one;
+            ensure_equals(Unkeyed::instanceCount(), 1);
+            Unkeyed* found = Unkeyed::getInstance(&one);
+            ensure_equals(found, &one);
+            {
+                boost::scoped_ptr<Unkeyed> two(new Unkeyed);
+                ensure_equals(Unkeyed::instanceCount(), 2);
+                Unkeyed* found = Unkeyed::getInstance(two.get());
+                ensure_equals(found, two.get());
+            }
+            ensure_equals(Unkeyed::instanceCount(), 1);
+        }
+        ensure_equals(Unkeyed::instanceCount(), 0);
+    }
+
+    template<> template<>
+    void object::test<3>()
+    {
+        Keyed one("one"), two("two"), three("three");
+        // We don't want to rely on the underlying container delivering keys
+        // in any particular order. That allows us the flexibility to
+        // reimplement LLInstanceTracker using, say, a hash map instead of a
+        // std::map. We DO insist that every key appear exactly once.
+        typedef std::vector<std::string> StringVector;
+        StringVector keys(Keyed::beginKeys(), Keyed::endKeys());
+        std::sort(keys.begin(), keys.end());
+        StringVector::const_iterator ki(keys.begin());
+        ensure_equals(*ki++, "one");
+        ensure_equals(*ki++, "three");
+        ensure_equals(*ki++, "two");
+        // Use ensure() here because ensure_equals would want to display
+        // mismatched values, and frankly that wouldn't help much.
+        ensure("didn't reach end", ki == keys.end());
+
+        // Use a somewhat different approach to order independence with
+        // beginInstances(): explicitly capture the instances we know in a
+        // set, and delete them as we iterate through.
+        typedef std::set<Keyed*> InstanceSet;
+        InstanceSet instances;
+        instances.insert(&one);
+        instances.insert(&two);
+        instances.insert(&three);
+        for (Keyed::instance_iter ii(Keyed::beginInstances()), iend(Keyed::endInstances());
+             ii != iend; ++ii)
+        {
+            Keyed& ref = *ii;
+            ensure_equals("spurious instance", instances.erase(&ref), 1);
+        }
+        ensure_equals("unreported instance", instances.size(), 0);
+    }
+
+    template<> template<>
+    void object::test<4>()
+    {
+        Unkeyed one, two, three;
+        typedef std::set<Unkeyed*> KeySet;
+        KeySet keys;
+        keys.insert(&one);
+        keys.insert(&two);
+        keys.insert(&three);
+        for (Unkeyed::key_iter ki(Unkeyed::beginKeys()), kend(Unkeyed::endKeys());
+             ki != kend; ++ki)
+        {
+            ensure_equals("spurious key", keys.erase(*ki), 1);
+        }
+        ensure_equals("unreported key", keys.size(), 0);
+
+        KeySet instances;
+        instances.insert(&one);
+        instances.insert(&two);
+        instances.insert(&three);
+        for (Unkeyed::instance_iter ii(Unkeyed::beginInstances()), iend(Unkeyed::endInstances());
+             ii != iend; ++ii)
+        {
+            Unkeyed& ref = *ii;
+            ensure_equals("spurious instance", instances.erase(&ref), 1);
+        }
+        ensure_equals("unreported instance", instances.size(), 0);
+    }
+} // namespace tut
diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp
index acbf51d75ca26be890928c262ffd5e39f4f5918d..104629c157d2ba7cbd34f1de4cb27d85853bb005 100644
--- a/indra/llmessage/llares.cpp
+++ b/indra/llmessage/llares.cpp
@@ -106,7 +106,7 @@ void LLAres::QueryResponder::queryError(int code)
 LLAres::LLAres() :
     chan_(NULL),
     mInitSuccess(false),
-    mListener(new LLAresListener("LLAres", this))
+    mListener(new LLAresListener(this))
 {
 	if (ares_init(&chan_) != ARES_SUCCESS)
 	{
diff --git a/indra/llmessage/llareslistener.cpp b/indra/llmessage/llareslistener.cpp
index a8beb8cbde350d7a414eccd7d8855903b69387bc..7db3675b77420c80c883526b41b42fd3d3a01969 100644
--- a/indra/llmessage/llareslistener.cpp
+++ b/indra/llmessage/llareslistener.cpp
@@ -22,13 +22,18 @@
 #include "llevents.h"
 #include "llsdutil.h"
 
-LLAresListener::LLAresListener(const std::string& pumpname, LLAres* llares):
-    LLDispatchListener(pumpname, "op"),
+LLAresListener::LLAresListener(LLAres* llares):
+    LLEventAPI("LLAres",
+               "LLAres listener to request DNS operations"),
     mAres(llares)
 {
     // add() every method we want to be able to invoke via this event API.
-    // Optional third parameter validates expected LLSD request structure.
-    add("rewriteURI", &LLAresListener::rewriteURI,
+    // Optional last parameter validates expected LLSD request structure.
+    add("rewriteURI",
+        "Given [\"uri\"], return on [\"reply\"] an array of alternative URIs.\n"
+        "On failure, returns an array containing only the original URI, so\n"
+        "failure case can be processed like success case.",
+        &LLAresListener::rewriteURI,
         LLSD().insert("uri", LLSD()).insert("reply", LLSD()));
 }
 
diff --git a/indra/llmessage/llareslistener.h b/indra/llmessage/llareslistener.h
index bf093b3d3d79bfb17dadf5e98cf2ff62c695bb51..33cef79c093f934232509384eeb89650e2a25de7 100644
--- a/indra/llmessage/llareslistener.h
+++ b/indra/llmessage/llareslistener.h
@@ -14,18 +14,17 @@
 #if ! defined(LL_LLARESLISTENER_H)
 #define LL_LLARESLISTENER_H
 
-#include "lleventdispatcher.h"
+#include "lleventapi.h"
 
 class LLAres;
 class LLSD;
 
 /// Listen on an LLEventPump with specified name for LLAres request events.
-class LLAresListener: public LLDispatchListener
+class LLAresListener: public LLEventAPI
 {
 public:
-    /// Specify the pump name on which to listen, and bind the LLAres instance
-    /// to use (e.g. gAres)
-    LLAresListener(const std::string& pumpname, LLAres* llares);
+    /// Bind the LLAres instance to use (e.g. gAres)
+    LLAresListener(LLAres* llares);
 
 private:
     /// command["op"] == "rewriteURI" 
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index 457c074ef1e6046b92c69f2a8a50198fdfb7a600..42d5ec49cd302da5bb2c1e226ca9435e6e69d7a5 100644
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -61,14 +61,14 @@ LLPluginClassMedia::~LLPluginClassMedia()
 	reset();
 }
 
-bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::string &plugin_filename)
+bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug)
 {	
 	LL_DEBUGS("Plugin") << "launcher: " << launcher_filename << LL_ENDL;
 	LL_DEBUGS("Plugin") << "plugin: " << plugin_filename << LL_ENDL;
 	
 	mPlugin = new LLPluginProcessParent(this);
 	mPlugin->setSleepTime(mSleepTime);
-	mPlugin->init(launcher_filename, plugin_filename);
+	mPlugin->init(launcher_filename, plugin_filename, debug);
 
 	return true;
 }
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index 90ecd1e0735d3792699f7a332ae4264dc8bf2b7d..dcc4a3bd6a257c6e1993f1372b083f7e6c3a0de8 100644
--- a/indra/llplugin/llpluginclassmedia.h
+++ b/indra/llplugin/llpluginclassmedia.h
@@ -47,7 +47,7 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
 	virtual ~LLPluginClassMedia();
 
 	// local initialization, called by the media manager when creating a source
-	virtual bool init(const std::string &launcher_filename, const std::string &plugin_filename);
+	virtual bool init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug = false);
 
 	// undoes everything init() didm called by the media manager when destroying a source
 	virtual void reset();
diff --git a/indra/llplugin/llpluginmessage.cpp b/indra/llplugin/llpluginmessage.cpp
index e7412a1d8f880285a0ee5fa8a82cf70805eb5a55..32601b47dbbc63035e09255f18c04ae9f84593c5 100644
--- a/indra/llplugin/llpluginmessage.cpp
+++ b/indra/llplugin/llpluginmessage.cpp
@@ -39,6 +39,11 @@ LLPluginMessage::LLPluginMessage()
 {
 }
 
+LLPluginMessage::LLPluginMessage(const LLPluginMessage &p)
+{
+	mMessage = p.mMessage;
+}
+
 LLPluginMessage::LLPluginMessage(const std::string &message_class, const std::string &message_name)
 {
 	setMessage(message_class, message_name);
diff --git a/indra/llplugin/llpluginmessage.h b/indra/llplugin/llpluginmessage.h
index f1a0e7c62436f9e8629439da8d58d7d998bf08ca..5e93d8b7a1cf485b1cac97fded668fd85165a413 100644
--- a/indra/llplugin/llpluginmessage.h
+++ b/indra/llplugin/llpluginmessage.h
@@ -40,6 +40,7 @@ class LLPluginMessage
 	LOG_CLASS(LLPluginMessage);
 public:
 	LLPluginMessage();
+	LLPluginMessage(const LLPluginMessage &p);
 	LLPluginMessage(const std::string &message_class, const std::string &message_name);
 	~LLPluginMessage();
 	
diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp
index 39f9438fb3de59279cbf173ed2b5ec650cd074e7..b7ce800c3aba27263f479d1f0255cd72147192be 100644
--- a/indra/llplugin/llpluginprocessparent.cpp
+++ b/indra/llplugin/llpluginprocessparent.cpp
@@ -55,6 +55,7 @@ LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner)
 	mBoundPort = 0;
 	mState = STATE_UNINITIALIZED;
 	mDisableTimeout = false;
+	mDebug = false;
 
 	// initialize timer - heartbeat test (mHeartbeat.hasExpired()) 
 	// can sometimes return true immediately otherwise and plugins 
@@ -96,11 +97,12 @@ void LLPluginProcessParent::errorState(void)
 		setState(STATE_ERROR);
 }
 
-void LLPluginProcessParent::init(const std::string &launcher_filename, const std::string &plugin_filename)
+void LLPluginProcessParent::init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug)
 {	
 	mProcess.setExecutable(launcher_filename);
 	mPluginFile = plugin_filename;
 	mCPUUsage = 0.0f;
+	mDebug = debug;
 	
 	setState(STATE_INITIALIZED);
 }
@@ -291,6 +293,31 @@ void LLPluginProcessParent::idle(void)
 				}
 				else
 				{
+					if(mDebug)
+					{
+						#if LL_DARWIN
+						// If we're set to debug, start up a gdb instance in a new terminal window and have it attach to the plugin process and continue.
+						
+						// The command we're constructing would look like this on the command line:
+						// osascript -e 'tell application "Terminal"' -e 'set win to do script "gdb -pid 12345"' -e 'do script "continue" in win' -e 'end tell'
+
+						std::stringstream cmd;
+						
+						mDebugger.setExecutable("/usr/bin/osascript");
+						mDebugger.addArgument("-e");
+						mDebugger.addArgument("tell application \"Terminal\"");
+						mDebugger.addArgument("-e");
+						cmd << "set win to do script \"gdb -pid " << mProcess.getProcessID() << "\"";
+						mDebugger.addArgument(cmd.str());
+						mDebugger.addArgument("-e");
+						mDebugger.addArgument("do script \"continue\" in win");
+						mDebugger.addArgument("-e");
+						mDebugger.addArgument("end tell");
+						mDebugger.launch();
+
+						#endif
+					}
+					
 					// This will allow us to time out if the process never starts.
 					mHeartbeat.start();
 					mHeartbeat.setTimerExpirySec(PLUGIN_LAUNCH_SECONDS);
@@ -661,7 +688,7 @@ bool LLPluginProcessParent::pluginLockedUpOrQuit()
 {
 	bool result = false;
 	
-	if(!mDisableTimeout)
+	if(!mDisableTimeout && !mDebug)
 	{
 		if(!mProcess.isRunning())
 		{
diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h
index 754ebeb94683efc033c077013f0f06bc48dde25b..1289e86c1365521be3ecea831ab895c9ce1303a9 100644
--- a/indra/llplugin/llpluginprocessparent.h
+++ b/indra/llplugin/llpluginprocessparent.h
@@ -56,7 +56,7 @@ class LLPluginProcessParent : public LLPluginMessagePipeOwner
 	LLPluginProcessParent(LLPluginProcessParentOwner *owner);
 	~LLPluginProcessParent();
 		
-	void init(const std::string &launcher_filename, const std::string &plugin_filename);
+	void init(const std::string &launcher_filename, const std::string &plugin_filename, bool debug = false);
 	void idle(void);
 	
 	// returns true if the plugin is on its way to steady state
@@ -150,6 +150,9 @@ class LLPluginProcessParent : public LLPluginMessagePipeOwner
 	F64		mCPUUsage;
 	
 	bool mDisableTimeout;
+	bool mDebug;
+
+	LLProcessLauncher mDebugger;
 };
 
 #endif // LL_LLPLUGINPROCESSPARENT_H
diff --git a/indra/llprimitive/llmediaentry.cpp b/indra/llprimitive/llmediaentry.cpp
index 701300163a3eae1528f2c62052a1d415a199160b..2fc1e5e60ca741c78bf2ddd27967f70b956f0b68 100644
--- a/indra/llprimitive/llmediaentry.cpp
+++ b/indra/llprimitive/llmediaentry.cpp
@@ -389,8 +389,12 @@ U32 LLMediaEntry::setWhiteList( const std::vector<std::string> &whitelist )
 
 U32 LLMediaEntry::setWhiteList( const LLSD &whitelist )
 {
-    // If whitelist is undef, this is a no-op.
-    if (whitelist.isUndefined()) return LSL_STATUS_OK;
+    // If whitelist is undef, the whitelist is cleared
+    if (whitelist.isUndefined()) 
+	{
+		mWhiteList.clear();
+		return LSL_STATUS_OK;
+	}
 
     // However, if the whitelist is an empty array, erase it.
     if (whitelist.isArray()) 
diff --git a/indra/llprimitive/tests/llmediaentry_test.cpp b/indra/llprimitive/tests/llmediaentry_test.cpp
index cd9608d56b74a4b7270a08de1e8fcee0004dfdb3..277e370ca4b4e47cd9e455b336237d2ab4a14b2a 100644
--- a/indra/llprimitive/tests/llmediaentry_test.cpp
+++ b/indra/llprimitive/tests/llmediaentry_test.cpp
@@ -9,7 +9,14 @@
 
 #include "linden_common.h"
 #include "lltut.h"
-#include "boost/lexical_cast.hpp"
+#if LL_WINDOWS
+#pragma warning (push)
+#pragma warning (disable : 4702) // boost::lexical_cast generates this warning
+#endif
+#include <boost/lexical_cast.hpp>
+#if LL_WINDOWS
+#pragma warning (pop)
+#endif
 #include "llstring.h"
 #include "llsdutil.h"
 #include "llsdserialize.h"
@@ -190,9 +197,9 @@ namespace tut
         entry.setWhiteList(tokens);
     }
 
-    void whitelist_test(bool enable, const char *whitelist, const char *candidate_url, bool expected_pass)
+    void whitelist_test(int num, bool enable, const char *whitelist, const char *candidate_url, bool expected_pass)
     {
-        std::string message = "Whitelist test";
+        std::string message = "Whitelist test " + boost::lexical_cast<std::string>(num);
         LLMediaEntry entry;
         entry.setWhiteListEnable(enable);
         set_whitelist(entry, whitelist);
@@ -209,13 +216,13 @@ namespace tut
         ensure(message, expected_pass == passed_whitelist);
     }
 
-    void whitelist_test(const char *whitelist, const char *candidate_url, bool expected_pass)
+    void whitelist_test(int num, const char *whitelist, const char *candidate_url, bool expected_pass)
     {
-        whitelist_test(true, whitelist, candidate_url, expected_pass);
+        whitelist_test(num, true, whitelist, candidate_url, expected_pass);
     }
-    void whitelist_test(const char *whitelist, const char *candidate_url)
+    void whitelist_test(int num, const char *whitelist, const char *candidate_url)
     {
-        whitelist_test(true, whitelist, candidate_url, true);
+        whitelist_test(num, true, whitelist, candidate_url, true);
     }
 
 	template<> template<>
@@ -265,12 +272,30 @@ namespace tut
         ensure_llsd_equals(get_test_name() + " failed", defaultMediaEntryLLSD, sd);
     }
 
+	
+    template<> template<>
+    void object::test<5>()
+    {
+        set_test_name("Test LLMediaEntry::asLLSD() -> LLMediaEntry::fromLLSD()");
+        LLMediaEntry entry1, entry2;
+		// Add a whitelist to entry2
+		std::vector<std::string> whitelist;
+		whitelist.push_back("*.example.com");
+        entry2.setWhiteList(whitelist);
+		// Render entry1 (which has no whitelist) as an LLSD
+        LLSD sd;
+		entry1.asLLSD(sd);
+		// "read" that LLSD into entry 2
+		entry2.fromLLSD(sd);
+        ensure_llsd_equals(get_test_name() + " failed", defaultMediaEntryLLSD, entry2.asLLSD());
+    }
+	
     // limit tests
     const char *URL_OK = "http://www.example.com";
     const char *URL_TOO_BIG = "http://www.example.com.qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq";
 
     template<> template<>
-    void object::test<5>()
+    void object::test<6>()
     {
         set_test_name("Test Limits on setting current URL");
         LLMediaEntry entry;
@@ -281,7 +306,7 @@ namespace tut
     }    
 
     template<> template<>
-    void object::test<6>()
+    void object::test<7>()
     {
         set_test_name("Test Limits on setting home URL");
         LLMediaEntry entry;
@@ -292,7 +317,7 @@ namespace tut
     }
 
     template<> template<>
-    void object::test<7>()
+    void object::test<8>()
     {
         set_test_name("Test Limits on setting whitelist");
         
@@ -306,7 +331,7 @@ namespace tut
     }
 
     template<> template<>
-    void object::test<8>()
+    void object::test<9>()
     {
         set_test_name("Test Limits on setting whitelist too big");
         
@@ -321,7 +346,7 @@ namespace tut
     }
 
     template<> template<>
-    void object::test<9>()
+    void object::test<10>()
     {
         set_test_name("Test Limits on setting whitelist too many");
         
@@ -337,7 +362,7 @@ namespace tut
     }
 
     template<> template<>
-    void object::test<10>()
+    void object::test<11>()
     {
         set_test_name("Test to make sure both setWhiteList() functions behave the same");
         
@@ -355,7 +380,7 @@ namespace tut
     }
     
     template<> template<>
-    void object::test<11>()
+    void object::test<12>()
     {
         set_test_name("Test to make sure both setWhiteList() functions behave the same");
 
@@ -376,7 +401,7 @@ namespace tut
     }
 
     template<> template<>
-    void object::test<12>()
+    void object::test<13>()
     {
         set_test_name("Test to make sure both setWhiteList() functions behave the same");
 
@@ -396,103 +421,70 @@ namespace tut
                empty == entry2.getWhiteList());
     }
     
-    // Whitelist check tests
-    
-    // Check the "empty whitelist" case
     template<> template<>
-    void object::test<13>() { whitelist_test("", "http://www.example.com", true); }
+    void object::test<14>() 
+	{
+		// Whitelist check tests
+		int n=0;
+		
+		// Check the "empty whitelist" case
+		whitelist_test(++n, "", "http://www.example.com", true); 
 
-    // Check the "missing scheme" case
-    template<> template<>
-    void object::test<14>() { whitelist_test("www.example.com", "http://www.example.com", true); }
+		// Check the "missing scheme" case
+		whitelist_test(++n, "www.example.com", "http://www.example.com", true);
 
-    // Check the "exactly the same" case
-    template<> template<>
-    void object::test<15>() { whitelist_test("http://example.com", "http://example.com", true); }
+		// Check the "exactly the same" case
+		whitelist_test(++n, "http://example.com", "http://example.com", true);
 
-    // Check the enable flag
-    template<> template<>
-    void object::test<16>() { whitelist_test(false, "www.example.com", "http://www.secondlife.com", true); }
-    template<> template<>
-    void object::test<17>() { whitelist_test(true, "www.example.com", "http://www.secondlife.com", false); }
+		// Check the enable flag
+		whitelist_test(++n, false, "www.example.com", "http://www.secondlife.com", true);
+		whitelist_test(++n, true, "www.example.com", "http://www.secondlife.com", false);
 
-    // Check permutations of trailing slash:
-    template<> template<>
-    void object::test<18>() { whitelist_test("http://www.example.com", "http://www.example.com/", true); }
-    template<> template<>
-    void object::test<19>() { whitelist_test("http://www.example.com/", "http://www.example.com/", true); }
-    template<> template<>
-    void object::test<20>() { whitelist_test("http://www.example.com/", "http://www.example.com", false); }
-    template<> template<>
-    void object::test<21>() { whitelist_test("http://www.example.com", "http://www.example.com/foobar", true); }
-    template<> template<>
-    void object::test<22>() { whitelist_test("http://www.example.com/", "http://www.example.com/foobar", false); }
+		// Check permutations of trailing slash:
+		whitelist_test(++n, "http://www.example.com", "http://www.example.com/", true);
+		whitelist_test(++n, "http://www.example.com/", "http://www.example.com/", true);
+		whitelist_test(++n, "http://www.example.com/", "http://www.example.com", false);
+		whitelist_test(++n, "http://www.example.com", "http://www.example.com/foobar", true);
+		whitelist_test(++n, "http://www.example.com/", "http://www.example.com/foobar", false);
 
     
-    // More cases...
-    template<> template<>
-    void object::test<23>() { whitelist_test("http://example.com", "http://example.com/wiki", true); }
-    template<> template<>
-    void object::test<24>() { whitelist_test("www.example.com", "http://www.example.com/help", true); }
-    template<> template<>
-    void object::test<25>() { whitelist_test("http://www.example.com", "http://wwwexample.com", false); }
-    template<> template<>
-    void object::test<26>() { whitelist_test("http://www.example.com", "http://www.example.com/wiki", true); }
-    template<> template<>
-    void object::test<27>() { whitelist_test("example.com", "http://wwwexample.com", false); }
-    template<> template<>
-    void object::test<28>() { whitelist_test("http://www.example.com/", "http://www.amazon.com/wiki", false); }
-    template<> template<>
-    void object::test<29>() { whitelist_test("www.example.com", "http://www.amazon.com", false); }
-
-    // regexp cases
-    template<> template<>
-    void object::test<30>() { whitelist_test("*.example.com", "http://www.example.com", true); }
-    template<> template<>
-    void object::test<31>() { whitelist_test("*.example.com", "http://www.amazon.com", false); }
-    template<> template<>
-    void object::test<32>() { whitelist_test("*.example.com", "http://www.example.com/foo/bar", true); }
-    template<> template<>
-    void object::test<33>() { whitelist_test("*.example.com", "http:/example.com/foo/bar", false); }
-    template<> template<>
-    void object::test<34>() { whitelist_test("*example.com", "http://example.com/foo/bar", true); }
-    template<> template<>
-    void object::test<35>() { whitelist_test("*example.com", "http://my.virus.com/foo/bar?example.com", false); }
-    template<> template<>
-    void object::test<36>() { whitelist_test("example.com", "http://my.virus.com/foo/bar?example.com", false); }
-    template<> template<>
-    void object::test<37>() { whitelist_test("*example.com", "http://my.virus.com/foo/bar?*example.com", false); }
-    template<> template<>
-    void object::test<38>() { whitelist_test("http://*example.com", "http://www.example.com", true); }
-    template<> template<>
-    void object::test<39>() { whitelist_test("http://*.example.com", "http://www.example.com", true); }
-    template<> template<>
-    void object::test<40>() { whitelist_test("http://*.e$?^.com", "http://www.e$?^.com", true); }
-    template<> template<>
-    void object::test<41>() { whitelist_test("*.example.com/foo/bar", "http://www.example.com/", false); }
-    template<> template<>
-    void object::test<42>() { whitelist_test("*.example.com/foo/bar", "http://example.com/foo/bar", false); }
-    template<> template<>
-    void object::test<43>() { whitelist_test("http://*.example.com/foo/bar", "http://www.example.com", false); }
-    template<> template<>
-    void object::test<44>() { whitelist_test("http://*.example.com", "https://www.example.com", false); }
-    template<> template<>
-    void object::test<45>() { whitelist_test("http*://*.example.com", "rtsp://www.example.com", false); }
-    template<> template<>
-    void object::test<46>() { whitelist_test("http*://*.example.com", "https://www.example.com", true); }
-    template<> template<>
-    void object::test<47>() { whitelist_test("example.com", "http://www.example.com", false); }
-    template<> template<>
-    void object::test<48>() { whitelist_test("www.example.com", "http://www.example.com:80", false); }
-    template<> template<>
-    void object::test<49>() { whitelist_test("www.example.com", "http://www.example.com", true); }
-    template<> template<>
-    void object::test<50>() { whitelist_test("www.example.com/", "http://www.example.com", false); }
-    template<> template<>
-    void object::test<51>() { whitelist_test("www.example.com/foo/bar/*", "http://www.example.com/foo/bar/baz", true); }
-    // Path only
-    template<> template<>
-    void object::test<52>() { whitelist_test("/foo/*/baz", "http://www.example.com/foo/bar/baz", true); }
-    template<> template<>
-    void object::test<53>() { whitelist_test("/foo/*/baz", "http://www.example.com/foo/bar/", false); }
+		// More cases...
+		whitelist_test(++n, "http://example.com", "http://example.com/wiki", true);
+		whitelist_test(++n, "www.example.com", "http://www.example.com/help", true);
+		whitelist_test(++n, "http://www.example.com", "http://wwwexample.com", false);
+		whitelist_test(++n, "http://www.example.com", "http://www.example.com/wiki", true);
+		whitelist_test(++n, "example.com", "http://wwwexample.com", false);
+		whitelist_test(++n, "http://www.example.com/", "http://www.amazon.com/wiki", false);
+		whitelist_test(++n, "www.example.com", "http://www.amazon.com", false);
+
+		// regexp cases
+		whitelist_test(++n, "*.example.com", "http://www.example.com", true);
+		whitelist_test(++n, "*.example.com", "http://www.amazon.com", false);
+		whitelist_test(++n, "*.example.com", "http://www.example.com/foo/bar", true);
+		whitelist_test(++n, "*.example.com", "http:/example.com/foo/bar", false);
+		whitelist_test(++n, "*example.com", "http://example.com/foo/bar", true);
+		whitelist_test(++n, "*example.com", "http://my.virus.com/foo/bar?example.com", false);
+		whitelist_test(++n, "example.com", "http://my.virus.com/foo/bar?example.com", false);
+		whitelist_test(++n, "*example.com", "http://my.virus.com/foo/bar?*example.com", false);
+		whitelist_test(++n, "http://*example.com", "http://www.example.com", true);
+		whitelist_test(++n, "http://*.example.com", "http://www.example.com", true);
+		whitelist_test(++n, "http://*.e$?^.com", "http://www.e$?^.com", true);
+		whitelist_test(++n, "*.example.com/foo/bar", "http://www.example.com/", false);
+		whitelist_test(++n, "*.example.com/foo/bar", "http://example.com/foo/bar", false);
+		whitelist_test(++n, "http://*.example.com/foo/bar", "http://www.example.com", false);
+		whitelist_test(++n, "http://*.example.com", "https://www.example.com", false);
+		whitelist_test(++n, "http*://*.example.com", "rtsp://www.example.com", false);
+		whitelist_test(++n, "http*://*.example.com", "https://www.example.com", true);
+		whitelist_test(++n, "example.com", "http://www.example.com", false);
+		whitelist_test(++n, "www.example.com", "http://www.example.com:80", false);
+		whitelist_test(++n, "www.example.com", "http://www.example.com", true);
+		whitelist_test(++n, "www.example.com/", "http://www.example.com", false);
+		whitelist_test(++n, "www.example.com/foo/bar/*", "http://www.example.com/foo/bar/baz", true);
+
+        // Path only
+		whitelist_test(++n, "/foo/*/baz", "http://www.example.com/foo/bar/baz", true);
+		whitelist_test(++n, "/foo/*/baz", "http://www.example.com/foo/bar/", false);
+	}
+	
 }
+
diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp
index d9520b3bf63c1f226bb65244bb50904b4a51ee2f..f0df3bcf90c47a43dcadc1e67a2d3addee4faca0 100644
--- a/indra/llrender/llrendertarget.cpp
+++ b/indra/llrender/llrendertarget.cpp
@@ -61,8 +61,11 @@ BOOL LLRenderTarget::sUseFBO = FALSE;
 LLRenderTarget::LLRenderTarget() :
 	mResX(0),
 	mResY(0),
+	mViewportWidth(0),
+	mViewportHeight(0),
 	mTex(0),
 	mFBO(0),
+	mColorFmt(0),
 	mDepth(0),
 	mStencil(0),
 	mUseDepth(FALSE),
@@ -86,13 +89,31 @@ void LLRenderTarget::setSampleBuffer(LLMultisampleBuffer* buffer)
 
 void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo)
 {
+	// only reallocate if something changed
+	if (mResX == resx
+		&& mResY == resy
+		&& mUseDepth == depth
+		&& mStencil == stencil
+		&& mUsage == usage
+		&& (mFBO != 0) == ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject)
+		&& mColorFmt == color_fmt)
+	{
+		// nothing to do
+		return;
+	}
+		
 	stop_glerror();
 	mResX = resx;
 	mResY = resy;
+	// default viewport to entire texture
+	mViewportWidth = mResX;
+	mViewportHeight = mResY;
 
 	mStencil = stencil;
 	mUsage = usage;
 	mUseDepth = depth;
+	mFBO = 0;
+	mColorFmt = color_fmt;
 
 	release();
 
@@ -312,7 +333,7 @@ void LLRenderTarget::bindTarget()
 		}
 	}
 
-	glViewport(0, 0, mResX, mResY);
+	glViewport(0, 0, mViewportWidth, mViewportHeight);
 	sBoundTarget = this;
 }
 
@@ -515,12 +536,18 @@ BOOL LLRenderTarget::isComplete() const
 	return (!mTex.empty() || mDepth) ? TRUE : FALSE;
 }
 
+void LLRenderTarget::setViewport(U32 width, U32 height)
+{
+	mViewportWidth = llmin(width, mResX);
+	mViewportHeight = llmin(height, mResY);
+}
+
 void LLRenderTarget::getViewport(S32* viewport)
 {
 	viewport[0] = 0;
 	viewport[1] = 0;
-	viewport[2] = mResX;
-	viewport[3] = mResY;
+	viewport[2] = mViewportWidth;
+	viewport[3] = mViewportHeight;
 }
 
 //==================================================
@@ -581,7 +608,7 @@ void LLMultisampleBuffer::bindTarget(LLRenderTarget* ref)
 
 	check_framebuffer_status();
 
-	glViewport(0, 0, mResX, mResY);
+	glViewport(0, 0, mViewportWidth, mViewportHeight);
 
 	sBoundTarget = this;
 }
@@ -593,13 +620,30 @@ void LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth
 
 void LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil,  LLTexUnit::eTextureType usage, BOOL use_fbo, U32 samples )
 {
+	if (mResX == resx
+		&& mResY == resy
+		&& mUseDepth == depth
+		&& mStencil == stencil
+		&& mUsage == usage
+		&& (mFBO != 0) == ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject)
+		&& mColorFmt == color_fmt
+		&& mSamples == samples)
+	{
+		// nothing to do
+		return;
+	}
+
 	stop_glerror();
 	mResX = resx;
 	mResY = resy;
+	mViewportWidth = mResX;
+	mViewportHeight = mResY;
 
 	mUsage = usage;
 	mUseDepth = depth;
 	mStencil = stencil;
+	mFBO = 0;
+	mColorFmt = color_fmt;
 
 	releaseSampleBuffer();
 
diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h
index b7ebfc8f7f6308cf1221f076ad7abaed90465631..125747424c0b68f3ef999a8a923ee1dd1f622033 100644
--- a/indra/llrender/llrendertarget.h
+++ b/indra/llrender/llrendertarget.h
@@ -107,6 +107,9 @@ class LLRenderTarget
 	//uses scissor rect if in copy-to-texture mode
 	void clear(U32 mask = 0xFFFFFFFF);
 	
+	// override default viewport to a smaller size
+	void setViewport(U32 width, U32 height);
+
 	//get applied viewport
 	void getViewport(S32* viewport);
 
@@ -150,12 +153,16 @@ class LLRenderTarget
 	friend class LLMultisampleBuffer;
 	U32 mResX;
 	U32 mResY;
+	U32 mViewportWidth;
+	U32 mViewportHeight;
 	std::vector<U32> mTex;
 	U32 mFBO;
+	U32 mColorFmt;
 	U32 mDepth;
 	BOOL mStencil;
 	BOOL mUseDepth;
 	BOOL mRenderDepth;
+
 	LLTexUnit::eTextureType mUsage;
 	U32 mSamples;
 	LLMultisampleBuffer* mSampleBuffer;
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp
index e0053b4cc70ce0a5a64ec4d4eb057c759e1c5ec3..48c76cf105ca61d2d57fbad25589e38a9301858b 100644
--- a/indra/llui/llconsole.cpp
+++ b/indra/llui/llconsole.cpp
@@ -60,6 +60,8 @@ LLConsole* gConsole = NULL;  // Created and destroyed in LLViewerWindow.
 const F32 FADE_DURATION = 2.f;
 const S32 MIN_CONSOLE_WIDTH = 200;
  
+static LLDefaultChildRegistry::Register<LLConsole> r("console");
+
 LLConsole::LLConsole(const LLConsole::Params& p) 
 :	LLUICtrl(p),
 	LLFixedBuffer(p.max_lines),
diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp
index 35a854267a4d194e7c9e8eb4bf8a68f5d8d69481..045505af5b66e8f044f0756cbe21c404336f5970 100644
--- a/indra/llui/lldockcontrol.cpp
+++ b/indra/llui/lldockcontrol.cpp
@@ -256,7 +256,6 @@ void LLDockControl::on()
 {
 	 if (isDockVisible())
 	{
-		mDockableFloater->setCanDrag(false);
 		mEnabled = true;
 		mRecalculateDocablePosition = true;
 	}
@@ -264,7 +263,6 @@ void LLDockControl::on()
 
 void LLDockControl::off()
 {
-	mDockableFloater->setCanDrag(true);
 	mEnabled = false;
 }
 
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index aac27e65627af66829811997d8c8f7c429d67107..f2cdad8854a431a6a888054cb0911fa4f785f9a7 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1857,6 +1857,8 @@ void LLFloater::buildButtons()
 /////////////////////////////////////////////////////
 // LLFloaterView
 
+static LLDefaultChildRegistry::Register<LLFloaterView> r("floater_view");
+
 LLFloaterView::LLFloaterView (const Params& p)
 :	LLUICtrl (p),
 	mFocusCycleMode(FALSE),
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index 03925f922c1182024deb2a1826f03579a5f8d6e9..eb67e3a56143b6fe1c6a5f5647cd224f2314a2a7 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -46,7 +46,7 @@ LLFloaterReg::instance_map_t LLFloaterReg::sInstanceMap;
 LLFloaterReg::build_map_t LLFloaterReg::sBuildMap;
 std::map<std::string,std::string> LLFloaterReg::sGroupMap;
 
-static LLFloaterRegListener sFloaterRegListener("LLFloaterReg");
+static LLFloaterRegListener sFloaterRegListener;
 
 //*******************************************************
 
diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp
index 57d148b5af474025a2fd9bbbc94f816c7850da2a..029d3b681035246cad07545abfe2350ebbfc4826 100644
--- a/indra/llui/llfloaterreglistener.cpp
+++ b/indra/llui/llfloaterreglistener.cpp
@@ -21,19 +21,35 @@
 #include "llfloater.h"
 #include "llbutton.h"
 
-LLFloaterRegListener::LLFloaterRegListener(const std::string& pumpName):
-    LLDispatchListener(pumpName, "op")
+LLFloaterRegListener::LLFloaterRegListener():
+    LLEventAPI("LLFloaterReg",
+               "LLFloaterReg listener to (e.g.) show/hide LLFloater instances")
 {
-    add("getBuildMap",  &LLFloaterRegListener::getBuildMap,  LLSD().insert("reply", LLSD()));
+    add("getBuildMap",
+        "Return on [\"reply\"] data about all registered LLFloaterReg floater names",
+        &LLFloaterRegListener::getBuildMap,
+        LLSD().insert("reply", LLSD()));
     LLSD requiredName;
     requiredName["name"] = LLSD();
-    add("showInstance", &LLFloaterRegListener::showInstance, requiredName);
-    add("hideInstance", &LLFloaterRegListener::hideInstance, requiredName);
-    add("toggleInstance", &LLFloaterRegListener::toggleInstance, requiredName);
+    add("showInstance",
+        "Ask to display the floater specified in [\"name\"]",
+        &LLFloaterRegListener::showInstance,
+        requiredName);
+    add("hideInstance",
+        "Ask to hide the floater specified in [\"name\"]",
+        &LLFloaterRegListener::hideInstance,
+        requiredName);
+    add("toggleInstance",
+        "Ask to toggle the state of the floater specified in [\"name\"]",
+        &LLFloaterRegListener::toggleInstance,
+        requiredName);
     LLSD requiredNameButton;
     requiredNameButton["name"] = LLSD();
     requiredNameButton["button"] = LLSD();
-    add("clickButton", &LLFloaterRegListener::clickButton, requiredNameButton);
+    add("clickButton",
+        "Simulate clicking the named [\"button\"] in the visible floater named in [\"name\"]",
+        &LLFloaterRegListener::clickButton,
+        requiredNameButton);
 }
 
 void LLFloaterRegListener::getBuildMap(const LLSD& event) const
diff --git a/indra/llui/llfloaterreglistener.h b/indra/llui/llfloaterreglistener.h
index 304ecd10904aebd567289db04c69c7da45136318..a38117f6b073f1a945106e8b8ae4f84d74cc4696 100644
--- a/indra/llui/llfloaterreglistener.h
+++ b/indra/llui/llfloaterreglistener.h
@@ -12,18 +12,18 @@
 #if ! defined(LL_LLFLOATERREGLISTENER_H)
 #define LL_LLFLOATERREGLISTENER_H
 
-#include "lleventdispatcher.h"
+#include "lleventapi.h"
 #include <string>
 
 class LLSD;
 
 /// Event API wrapper for LLFloaterReg
-class LLFloaterRegListener: public LLDispatchListener
+class LLFloaterRegListener: public LLEventAPI
 {
 public:
     /// As all public LLFloaterReg methods are static, there's no point in
     /// binding an LLFloaterReg instance.
-    LLFloaterRegListener(const std::string& pumpName);
+    LLFloaterRegListener();
 
 private:
     void getBuildMap(const LLSD& event) const;
diff --git a/indra/llui/llhelp.h b/indra/llui/llhelp.h
index c06d29a4bd497203df318238157ab8a2dacc62dd..82c3bc385f322434a033b356f1ea94fd8a0214cf 100644
--- a/indra/llui/llhelp.h
+++ b/indra/llui/llhelp.h
@@ -40,6 +40,8 @@ class LLHelp
 	virtual void showTopic(const std::string &topic) = 0;
 	// return default (fallback) topic name suitable for showTopic()
 	virtual std::string defaultTopic() = 0;
+	// return topic to use before the user logs in
+	virtual std::string preLoginTopic() = 0;
 };
 
 #endif // headerguard
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index bac54919432a83f44339977e72615f78a907a67e..14a6ddb7e0e8babee240e65250221f3fed77e771 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -137,6 +137,7 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p)
 	mPanelSpacing(p.border_size),
 	mOrientation((p.orientation() == "vertical") ? VERTICAL : HORIZONTAL),
 	mAnimate(p.animate),
+	mAnimatedThisFrame(false),
 	mClip(p.clip)
 {}
 
@@ -172,6 +173,7 @@ void LLLayoutStack::draw()
 		// only force drawing invisible children if visible amount is non-zero
 		drawChild(panelp, 0, 0, !clip_rect.isEmpty());
 	}
+	mAnimatedThisFrame = false;
 }
 
 void LLLayoutStack::removeChild(LLView* view)
@@ -411,8 +413,10 @@ void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL au
 	}
 }
 
+static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks");
 void LLLayoutStack::updateLayout(BOOL force_resize)
 {
+	LLFastTimer ft(FTM_UPDATE_LAYOUT);
 	static LLUICachedControl<S32> resize_bar_overlap ("UIResizeBarOverlap", 0);
 	calcMinExtents();
 
@@ -431,10 +435,13 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
 		{
 			if (mAnimate)
 			{
-				(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(ANIM_OPEN_TIME));
-				if ((*panel_it)->mVisibleAmt > 0.99f)
+				if (!mAnimatedThisFrame)
 				{
-					(*panel_it)->mVisibleAmt = 1.f;
+					(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(ANIM_OPEN_TIME));
+					if ((*panel_it)->mVisibleAmt > 0.99f)
+					{
+						(*panel_it)->mVisibleAmt = 1.f;
+					}
 				}
 			}
 			else
@@ -446,10 +453,13 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
 		{
 			if (mAnimate)
 			{
-				(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(ANIM_CLOSE_TIME));
-				if ((*panel_it)->mVisibleAmt < 0.001f)
+				if (!mAnimatedThisFrame)
 				{
-					(*panel_it)->mVisibleAmt = 0.f;
+					(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(ANIM_CLOSE_TIME));
+					if ((*panel_it)->mVisibleAmt < 0.001f)
+					{
+						(*panel_it)->mVisibleAmt = 0.f;
+					}
 				}
 			}
 			else
@@ -631,10 +641,10 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
 		// adjust running headroom count based on new sizes
 		shrink_headroom_total += delta_size;
 
-		panelp->reshape(new_width, new_height);
-		panelp->setOrigin(cur_x, cur_y - new_height);
+		LLRect panel_rect;
+		panel_rect.setLeftTopAndSize(cur_x, cur_y, new_width, new_height);
+		panelp->setShape(panel_rect);
 
-		LLRect panel_rect = panelp->getRect();
 		LLRect resize_bar_rect = panel_rect;
 		if (mOrientation == HORIZONTAL)
 		{
@@ -705,6 +715,8 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
 		llassert_always(force_resize == FALSE);
 		updateLayout(TRUE);
 	}
+
+	 mAnimatedThisFrame = true;
 } // end LLLayoutStack::updateLayout
 
 
@@ -772,3 +784,16 @@ void LLLayoutStack::calcMinExtents()
 		}
 	}
 }
+
+// update layout stack animations, etc. once per frame
+// NOTE: we use this to size world view based on animating UI, *before* we draw the UI
+// we might still need to call updateLayout during UI draw phase, in case UI elements
+// are resizing themselves dynamically
+//static 
+void LLLayoutStack::updateClass()
+{
+	for (LLLayoutStack::instance_iter it = beginInstances(); it != endInstances(); ++it)
+	{
+		it->updateLayout();
+	}
+}
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index 9ded48ef6a19c0629aded4bd1878a144a6efe4f8..3a073fa1b28b08209346c6f834d3e78ab90cd37e 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -38,7 +38,7 @@
 
 class LLPanel;
 
-class LLLayoutStack : public LLView
+class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
 {
 public:
 	struct Params : public LLInitParam::Block<Params, LLView::Params>
@@ -81,6 +81,10 @@ class LLLayoutStack : public LLView
 	S32 getNumPanels() { return mPanels.size(); }
 
 	void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize);
+
+
+	static void updateClass();
+
 protected:
 	LLLayoutStack(const Params&);
 	friend class LLUICtrlFactory;
@@ -105,6 +109,8 @@ class LLLayoutStack : public LLView
 	S32 mMinHeight;  // calculated by calcMinExtents
 	S32 mPanelSpacing;
 
+	// true if we already applied animation this frame
+	bool mAnimatedThisFrame;
 	bool mAnimate;
 	bool mClip;
 }; // end class LLLayoutStack
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index c6a38c7ca76f2aab7a897c3bb01c423def9ca4f4..de9a854f63702872920e2fbfdadeea1e4c23dbca 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -3270,11 +3270,9 @@ BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask )
 ///============================================================================
 LLCoordGL LLMenuHolderGL::sContextMenuSpawnPos(S32_MAX, S32_MAX);
 
-LLMenuHolderGL::LLMenuHolderGL()
-	: LLPanel()
+LLMenuHolderGL::LLMenuHolderGL(const LLMenuHolderGL::Params& p)
+	: LLPanel(p)
 {
-	setName("Menu Holder");
-	setMouseOpaque(FALSE);
 	sItemActivationTimer.stop();
 	mCanHide = TRUE;
 }
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index dc8ed3b3fd6f07bc2b972934514856964cb2de0d..cbb9b4d3448a105d588af9fdf3de3924507a814f 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -746,7 +746,9 @@ class LLMenuBarGL : public LLMenuGL
 class LLMenuHolderGL : public LLPanel
 {
 public:
-	LLMenuHolderGL();
+	struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+	{};
+	LLMenuHolderGL(const Params& p);
 	virtual ~LLMenuHolderGL() {}
 
 	virtual BOOL hideMenus();
diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp
index 75f4d6177dc3958e5b1fc0b9f54dc6133e8a7ccb..fe4fbe75105eeb2064d5b9a6d188cd0b3ef387ae 100644
--- a/indra/llui/llnotificationslistener.cpp
+++ b/indra/llui/llnotificationslistener.cpp
@@ -16,10 +16,14 @@
 #include "llnotifications.h"
 
 LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications) :
-    LLDispatchListener("LLNotifications", "op"),
+    LLEventAPI("LLNotifications",
+               "LLNotifications listener to (e.g.) pop up a notification"),
     mNotifications(notifications)
 {
-    add("requestAdd", &LLNotificationsListener::requestAdd);
+    add("requestAdd",
+        "Add a notification with specified [\"name\"], [\"substitutions\"] and [\"payload\"].\n"
+        "If optional [\"reply\"] specified, arrange to send user response on that LLEventPump.",
+        &LLNotificationsListener::requestAdd);
 }
 
 void LLNotificationsListener::requestAdd(const LLSD& event_data) const
diff --git a/indra/llui/llnotificationslistener.h b/indra/llui/llnotificationslistener.h
index 6f71a7c7817dc6490592e9c570c4f386d8977788..9b405d7b4b0c72c00b2c0299da81c0638f39ed86 100644
--- a/indra/llui/llnotificationslistener.h
+++ b/indra/llui/llnotificationslistener.h
@@ -12,12 +12,12 @@
 #ifndef LL_LLNOTIFICATIONSLISTENER_H
 #define LL_LLNOTIFICATIONSLISTENER_H
 
-#include "lleventdispatcher.h"
+#include "lleventapi.h"
 
 class LLNotifications;
 class LLSD;
 
-class LLNotificationsListener : public LLDispatchListener
+class LLNotificationsListener : public LLEventAPI
 {
 public:
     LLNotificationsListener(LLNotifications & notifications);
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 07c0f3ce847eaff623422813a29b5e2488efae4c..89c46562973ec4e39982c235933ebba96fc38884 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -512,6 +512,8 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
 			// add children using dimensions from referenced xml for consistent layout
 			setShape(params.rect);
 			LLUICtrlFactory::createChildren(this, referenced_xml, child_registry_t::instance());
+
+			setXMLFilename(xml_filename);
 		}
 
 		// ask LLUICtrlFactory for filename, since xml_filename might be empty
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index a7c268758adcbffdbd450643f27b77cf021d33be..544352176abcbe61cf704ce30c687508538f234a 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -71,7 +71,8 @@ LLScrollListCell* LLScrollListCell::create(const LLScrollListCell::Params& cell_
 
 
 LLScrollListCell::LLScrollListCell(const LLScrollListCell::Params& p)
-:	mWidth(p.width)
+:	mWidth(p.width), 
+	mToolTip(p.tool_tip)
 {}
 
 // virtual
@@ -204,13 +205,28 @@ BOOL LLScrollListText::isText() const
 	return TRUE;
 }
 
+// virtual
+const std::string &LLScrollListText::getToolTip() const
+{
+	// If base class has a tooltip, return that
+	if (! LLScrollListCell::getToolTip().empty())
+		return LLScrollListCell::getToolTip();
+	
+	// ...otherwise, return the value itself as the tooltip
+	return mText.getString();
+}
+
+// virtual
 BOOL LLScrollListText::needsToolTip() const
 {
-	// show tooltips for truncated text
+	// If base class has a tooltip, return that
+	if (LLScrollListCell::needsToolTip())
+		return LLScrollListCell::needsToolTip();
+	
+	// ...otherwise, show tooltips for truncated text
 	return mFont->getWidth(mText.getString()) > getWidth();
 }
 
-
 //virtual 
 BOOL LLScrollListText::getVisible() const
 {
diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h
index 758623f1212b40f9dbb4e8a95eb693ff56b746b8..5fecf5aade9d2849e2ad043f2fce012fd327797e 100644
--- a/indra/llui/llscrolllistcell.h
+++ b/indra/llui/llscrolllistcell.h
@@ -66,6 +66,7 @@ class LLScrollListCell
 
 		Optional<void*>				userdata;
 		Optional<LLSD>				value;
+		Optional<std::string>		tool_tip;
 
 		Optional<const LLFontGL*>	font;
 		Optional<LLColor4>			font_color;
@@ -80,6 +81,7 @@ class LLScrollListCell
 			enabled("enabled", true),
 			visible("visible", true),
 			value("value"),
+			tool_tip("tool_tip", ""),
 			font("font", LLFontGL::getFontSansSerifSmall()),
 			font_color("font_color", LLColor4::black),
 			color("color", LLColor4::white),
@@ -101,11 +103,13 @@ class LLScrollListCell
 	virtual S32				getHeight() const { return 0; }
 	virtual const LLSD		getValue() const;
 	virtual void			setValue(const LLSD& value) { }
+	virtual const std::string &getToolTip() const { return mToolTip; }
+	virtual void			setToolTip(const std::string &str) { mToolTip = str; }
 	virtual BOOL			getVisible() const { return TRUE; }
 	virtual void			setWidth(S32 width) { mWidth = width; }
 	virtual void			highlightText(S32 offset, S32 num_chars) {}
 	virtual BOOL			isText() const { return FALSE; }
-	virtual BOOL			needsToolTip() const { return FALSE; }
+	virtual BOOL			needsToolTip() const { return ! mToolTip.empty(); }
 	virtual void			setColor(const LLColor4&) {}
 	virtual void			onCommit() {};
 
@@ -114,6 +118,7 @@ class LLScrollListCell
 
 private:
 	S32 mWidth;
+	std::string mToolTip;
 };
 
 class LLScrollListSpacer : public LLScrollListCell
@@ -143,6 +148,7 @@ class LLScrollListText : public LLScrollListCell
 
 	/*virtual*/ void	setColor(const LLColor4&);
 	/*virtual*/ BOOL	isText() const;
+	/*virtual*/ const std::string &	getToolTip() const;
 	/*virtual*/ BOOL	needsToolTip() const;
 
 	void			setText(const LLStringExplicit& text);
diff --git a/indra/llui/llscrolllistcolumn.cpp b/indra/llui/llscrolllistcolumn.cpp
index ba53f84877478e48cf5dc783e9e56e42a3e79065..d28134120221ce17cf8377655d1b20e198ed238f 100644
--- a/indra/llui/llscrolllistcolumn.cpp
+++ b/indra/llui/llscrolllistcolumn.cpp
@@ -44,6 +44,9 @@
 
 const S32 MIN_COLUMN_WIDTH = 20;
 
+// defaults for LLScrollColumnHeader param block pulled from widgets/scroll_column_header.xml
+static LLWidgetNameRegistry::StaticRegistrar sRegisterColumnHeaderParams(&typeid(LLScrollColumnHeader::Params), "scroll_column_header");
+
 //---------------------------------------------------------------------------
 // LLScrollColumnHeader
 //---------------------------------------------------------------------------
@@ -51,15 +54,7 @@ LLScrollColumnHeader::Params::Params()
 :	column("column")
 {
 	name  = "column_header";
-	image_unselected.name("square_btn_32x128.tga");
-	image_selected.name("square_btn_selected_32x128.tga");
-	image_disabled.name("square_btn_32x128.tga");
-	image_disabled_selected.name("square_btn_selected_32x128.tga");
-	image_overlay.name("combobox_arrow.tga");
-	image_overlay_alignment("right");
-	font_halign = LLFontGL::LEFT;
 	tab_stop(false);
-	scale_image(true);
 }
 
 
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index a6cd6412e5024fe7d44126c22224787c44e160ef..a53a30b501200d5a61b3bebb620a8f182b61617a 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -1565,7 +1565,7 @@ BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, MASK mask)
 
 			// display tooltip exactly over original cell, in same font
 			LLToolTipMgr::instance().show(LLToolTip::Params()
-										.message(hit_cell->getValue().asString())
+										.message(hit_cell->getToolTip())
 										.font(LLFontGL::getFontSansSerifSmall())
 										.pos(LLCoordGL(sticky_rect.mLeft - 5, sticky_rect.mTop + 6))
 										.delay_time(0.2f)
@@ -2624,7 +2624,7 @@ void LLScrollListCtrl::addColumn(const LLScrollListColumn::Params& column_params
 
 			LLRect temp_rect = LLRect(left,top+mHeadingHeight,right,top);
 
-			LLScrollColumnHeader::Params params;
+			LLScrollColumnHeader::Params params(LLUICtrlFactory::getDefaultParams<LLScrollColumnHeader>());
 			params.name = "btn_" + name;
 			params.rect = temp_rect;
 			params.column = new_column;
diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp
index fd3f88d1f61317b7ef43f792a66a3891a29927eb..71511f69a41307099f4d88c505c98c7b59c11d34 100644
--- a/indra/llui/llstyle.cpp
+++ b/indra/llui/llstyle.cpp
@@ -51,6 +51,7 @@ LLStyle::Params::Params()
 LLStyle::LLStyle(const LLStyle::Params& p)
 :	mVisible(p.visible),
 	mColor(p.color()),
+	mReadOnlyColor(p.readonly_color()),
 	mFont(p.font()),
 	mLink(p.link_href),
 	mDropShadow(p.drop_shadow),
diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h
index c7699641366550c985f9d26ed822353319e38728..ee9ca730e9473820e537e76d6a3ff331a1487e93 100644
--- a/indra/llui/llstyle.h
+++ b/indra/llui/llstyle.h
@@ -46,7 +46,8 @@ class LLStyle : public LLRefCount
 	{
 		Optional<bool>					visible;
 		Optional<LLFontGL::ShadowType>	drop_shadow;
-		Optional<LLUIColor>				color;
+		Optional<LLUIColor>				color,
+										readonly_color;
 		Optional<const LLFontGL*>		font;
 		Optional<LLUIImage*>			image;
 		Optional<std::string>			link_href;
@@ -57,6 +58,8 @@ class LLStyle : public LLRefCount
 	const LLColor4& getColor() const { return mColor; }
 	void setColor(const LLColor4 &color) { mColor = color; }
 
+	const LLColor4& getReadOnlyColor() const { return mReadOnlyColor; }
+
 	BOOL isVisible() const;
 	void setVisible(BOOL is_visible);
 
@@ -81,6 +84,7 @@ class LLStyle : public LLRefCount
 		return 
 			mVisible == rhs.mVisible
 			&& mColor == rhs.mColor
+			&& mReadOnlyColor == rhs.mReadOnlyColor
 			&& mFont == rhs.mFont
 			&& mLink == rhs.mLink
 			&& mImagep == rhs.mImagep
@@ -104,6 +108,7 @@ class LLStyle : public LLRefCount
 private:
 	BOOL		mVisible;
 	LLUIColor	mColor;
+	LLUIColor   mReadOnlyColor;
 	std::string	mFontName;
 	const LLFontGL*   mFont;		// cached for performance
 	std::string	mLink;
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index b67f753d39431e09fe47143bf2f7b3bf7121c3fe..44eff8d357c8c36b62747210751f178051669702 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -346,7 +346,13 @@ void LLTabContainer::draw()
 		}
 	}
 
-	LLPanel::draw();
+	{
+		LLRect clip_rect = getLocalRect();
+		clip_rect.mLeft+=(LLPANEL_BORDER_WIDTH + 2);
+		clip_rect.mRight-=(LLPANEL_BORDER_WIDTH + 2);
+		LLLocalClipRect clip(clip_rect);
+		LLPanel::draw();
+	}
 
 	// if tabs are hidden, don't draw them and leave them in the invisible state
 	if (!getTabsHidden())
@@ -358,24 +364,6 @@ void LLTabContainer::draw()
 			tuple->mButton->setVisible( TRUE );
 		}
 
-		// Draw some of the buttons...
-		LLRect clip_rect = getLocalRect();
-		if (has_scroll_arrows)
-		{
-			// ...but clip them.
-			if (mIsVertical)
-			{
-				clip_rect.mBottom = mNextArrowBtn->getRect().mTop + 3*tabcntrv_pad;
-				clip_rect.mTop = mPrevArrowBtn->getRect().mBottom - 3*tabcntrv_pad;
-			}
-			else
-			{
-				clip_rect.mLeft = mPrevArrowBtn->getRect().mRight;
-				clip_rect.mRight = mNextArrowBtn->getRect().mLeft;
-			}
-		}
-		LLLocalClipRect clip(clip_rect);
-
 		S32 max_scroll_visible = getTabCount() - getMaxScrollPos() + getScrollPos();
 		S32 idx = 0;
 		for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
@@ -403,7 +391,7 @@ void LLTabContainer::draw()
 						mNextArrowBtn->setFlashing( TRUE );
 					}
 				}
-			}
+			}
 
 			idx++;
 		}
@@ -1039,6 +1027,11 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel)
 	{
 		LLUICtrl::addChild(child, 1);
 	}
+
+	sendChildToFront(mPrevArrowBtn);
+	sendChildToFront(mNextArrowBtn);
+	sendChildToFront(mJumpPrevArrowBtn);
+	sendChildToFront(mJumpNextArrowBtn);
 	
 	if( select )
 	{
@@ -1672,23 +1665,23 @@ void LLTabContainer::initButtons()
 		S32 btn_top = (getTabPosition() == TOP ) ? getRect().getHeight() - getTopBorderHeight() : tabcntr_arrow_btn_size + 1;
 
 		LLRect left_arrow_btn_rect;
-		left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1+tabcntr_arrow_btn_size, btn_top + arrow_fudge, tabcntr_arrow_btn_size, tabcntr_arrow_btn_size );
+		left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1+tabcntr_arrow_btn_size, btn_top + arrow_fudge, tabcntr_arrow_btn_size, mTabHeight );
 
 		LLRect jump_left_arrow_btn_rect;
-		jump_left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1, btn_top + arrow_fudge, tabcntr_arrow_btn_size, tabcntr_arrow_btn_size );
+		jump_left_arrow_btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH+1, btn_top + arrow_fudge, tabcntr_arrow_btn_size, mTabHeight );
 
 		S32 right_pad = tabcntr_arrow_btn_size + LLPANEL_BORDER_WIDTH + 1;
 
 		LLRect right_arrow_btn_rect;
 		right_arrow_btn_rect.setLeftTopAndSize( getRect().getWidth() - mRightTabBtnOffset - right_pad - tabcntr_arrow_btn_size,
 												btn_top + arrow_fudge,
-												tabcntr_arrow_btn_size, tabcntr_arrow_btn_size );
+												tabcntr_arrow_btn_size, mTabHeight );
 
 
 		LLRect jump_right_arrow_btn_rect;
 		jump_right_arrow_btn_rect.setLeftTopAndSize( getRect().getWidth() - mRightTabBtnOffset - right_pad,
 													 btn_top + arrow_fudge,
-													 tabcntr_arrow_btn_size, tabcntr_arrow_btn_size );
+													 tabcntr_arrow_btn_size, mTabHeight );
 
 		LLButton::Params p;
 		p.name(std::string("Jump Left Arrow"));
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 97ba69134184142c9e5cecc5020104ac47256ea7..9706878a579476d835950b0f19436caa32fe6b39 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -286,8 +286,7 @@ bool LLTextBase::truncate()
 
 LLStyle::Params LLTextBase::getDefaultStyle()
 {
-	LLColor4 text_color = ( mReadOnly ? mReadOnlyFgColor.get() : mFgColor.get() );
-	return LLStyle::Params().color(text_color).font(mDefaultFont).drop_shadow(mFontShadow);
+	return LLStyle::Params().color(mFgColor.get()).readonly_color(mReadOnlyFgColor.get()).font(mDefaultFont).drop_shadow(mFontShadow);
 }
 
 void LLTextBase::onValueChange(S32 start, S32 end)
@@ -995,6 +994,12 @@ void LLTextBase::setColor( const LLColor4& c )
 	mFgColor = c;
 }
 
+//virtual 
+void LLTextBase::setReadOnlyColor(const LLColor4 &c)
+{
+	mReadOnlyFgColor = c;
+}
+
 //virtual
 void LLTextBase::setValue(const LLSD& value )
 {
@@ -2232,7 +2237,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
 
 	const LLFontGL* font = mStyle->getFont();
 
-	LLColor4 color = mStyle->getColor() % alpha;
+	LLColor4 color = (mEditor.getReadOnly() ? mStyle->getReadOnlyColor() : mStyle->getColor())  % alpha;
 
 	font = mStyle->getFont();
 
@@ -2370,7 +2375,9 @@ bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt
 
 	height = mFontHeight;
 	width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars);
-	return num_chars >= 1 && text[mStart + num_chars - 1] == '\n';
+	// if last character is a newline, then return true, forcing line break
+	llwchar last_char = text[mStart + first_char + num_chars - 1];
+	return num_chars >= 1 && last_char == '\n';
 }
 
 S32	LLNormalTextSegment::getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 8cae8fde220ebb960af7a9d24a5081c3952f2570..fb01cd1e7cc5c389966b3283464b74bd760cd32f 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -118,6 +118,8 @@ class LLTextBase
 	// LLUICtrl interface
 	/*virtual*/ BOOL		acceptsTextInput() const { return !mReadOnly; }
 	/*virtual*/ void		setColor( const LLColor4& c );
+	virtual     void 		setReadOnlyColor(const LLColor4 &c);
+
 	/*virtual*/ void		setValue(const LLSD& value );
 	/*virtual*/ LLTextViewModel* getViewModel() const;
 
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 3ce5a0320be63dd849375a12369349bf4edf9ee9..d136c6b49d6dd9d1d9879a3330456912da1ee867 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -2005,7 +2005,8 @@ void LLTextEditor::setEnabled(BOOL enabled)
 	bool read_only = !enabled;
 	if (read_only != mReadOnly)
 	{
-		mReadOnly = read_only;
+		//mReadOnly = read_only;
+		LLTextBase::setReadOnly(read_only);
 		updateSegments();
 		updateAllowingLanguageInput();
 	}
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index 4bc9a9c042661c4924aa56810b27b5b2383e883b..bb8517781148f635c5b787d6aee92bc401eb109e 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -57,6 +57,8 @@ LLToolTipView *gToolTipView = NULL;
 // Member functions
 //
 
+static LLDefaultChildRegistry::Register<LLToolTipView> register_tooltip_view("tooltip_view");
+
 LLToolTipView::Params::Params()
 {
 	mouse_opaque = false;
@@ -137,12 +139,16 @@ void LLToolTipView::drawStickyRect()
 {
 	gl_rect_2d(LLToolTipMgr::instance().getMouseNearRect(), LLColor4::white, false);
 }
+
+// defaults for floater param block pulled from widgets/floater.xml
+static LLWidgetNameRegistry::StaticRegistrar sRegisterInspectorParams(&typeid(LLInspector::Params), "inspector");
+
 //
 // LLToolTip
 //
 
 
-static LLDefaultChildRegistry::Register<LLToolTip> r("tool_tip");
+static LLDefaultChildRegistry::Register<LLToolTip> register_tooltip("tool_tip");
 
 
 LLToolTip::Params::Params()
@@ -166,7 +172,6 @@ LLToolTip::Params::Params()
 
 LLToolTip::LLToolTip(const LLToolTip::Params& p)
 :	LLPanel(p),
-	mMaxWidth(p.max_width),
 	mHasClickCallback(p.click_callback.isProvided()),
 	mPadding(p.padding),
 	mTextBox(NULL),
@@ -175,11 +180,9 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
 	mHomePageButton(NULL)
 {
 	LLTextBox::Params params;
-	params.initial_value = "tip_text";
 	params.name = params.initial_value().asString();
 	// bake textbox padding into initial rect
 	params.rect = LLRect (mPadding, mPadding + 1, mPadding + 1, mPadding);
-	params.follows.flags = FOLLOWS_ALL;
 	params.h_pad = 0;
 	params.v_pad = 0;
 	params.mouse_opaque = false;
@@ -204,7 +207,6 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
 		TOOLTIP_ICON_SIZE = (imagep ? imagep->getWidth() : 16);
 		icon_rect.setOriginAndSize(mPadding, mPadding, TOOLTIP_ICON_SIZE, TOOLTIP_ICON_SIZE);
 		icon_params.rect = icon_rect;
-		//icon_params.follows.flags = FOLLOWS_LEFT | FOLLOWS_BOTTOM;
 		icon_params.image_unselected(imagep);
 		icon_params.image_selected(imagep);
 
@@ -275,15 +277,30 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
 	}
 }
 
-void LLToolTip::setValue(const LLSD& value)
+void LLToolTip::initFromParams(const LLToolTip::Params& p)
 {
+	LLPanel::initFromParams(p);
+
+	// do this *after* we've had our size set in LLPanel::initFromParams();
 	const S32 REALLY_LARGE_HEIGHT = 10000;
-	reshape(mMaxWidth, REALLY_LARGE_HEIGHT);
+	mTextBox->reshape(p.max_width, REALLY_LARGE_HEIGHT);
 
-	mTextBox->setValue(value);
+	if (p.styled_message.isProvided())
+	{
+		for (LLInitParam::ParamIterator<LLToolTip::StyledText>::const_iterator text_it = p.styled_message().begin();
+			text_it != p.styled_message().end();
+			++text_it)
+		{
+			mTextBox->appendText(text_it->text(), false, text_it->style);
+		}
+	}
+	else
+	{
+		mTextBox->setText(p.message());
+	}
 
 	LLRect text_contents_rect = mTextBox->getContentsRect();
-	S32 text_width = llmin(mMaxWidth, text_contents_rect.getWidth());
+	S32 text_width = llmin(p.max_width(), text_contents_rect.getWidth());
 	S32 text_height = text_contents_rect.getHeight();
 	mTextBox->reshape(text_width, text_height);
 
@@ -294,7 +311,7 @@ void LLToolTip::setValue(const LLSD& value)
 	tooltip_rect.mBottom = 0;
 	tooltip_rect.mLeft = 0;
 
-	setRect(tooltip_rect);
+	setShape(tooltip_rect);
 }
 
 void LLToolTip::setVisible(BOOL visible)
@@ -405,9 +422,8 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params)
 	}
 	tooltip_params.rect = LLRect (0, 1, 1, 0);
 
-
 	mToolTip = LLUICtrlFactory::create<LLToolTip> (tooltip_params);
-	mToolTip->setValue(params.message());
+
 	gToolTipView->addChild(mToolTip);
 
 	if (params.pos.isProvided())
diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h
index 30d251266c0ff8e9b306803159cfc41d51391bf6..8c8fdf0a4c91866f4f988e25614cf1fb6faafd1e 100644
--- a/indra/llui/lltooltip.h
+++ b/indra/llui/lltooltip.h
@@ -37,6 +37,7 @@
 #include "llsingleton.h"
 #include "llinitparam.h"
 #include "llpanel.h"
+#include "llstyle.h"
 
 //
 // Classes
@@ -65,11 +66,19 @@ class LLToolTipView : public LLView
 class LLToolTip : public LLPanel
 {
 public:
+
+	struct StyledText : public LLInitParam::Block<StyledText>
+	{
+		Mandatory<std::string>		text;
+		Optional<LLStyle::Params>	style;
+	};
+
 	struct Params : public LLInitParam::Block<Params, LLPanel::Params> 
 	{
 		typedef boost::function<void(void)> click_callback_t;
 
-		Mandatory<std::string>		message;
+		Optional<std::string>		message;
+		Multiple<StyledText>		styled_message;
 
 		Optional<LLCoordGL>			pos;
 		Optional<F32>				delay_time,
@@ -85,8 +94,8 @@ class LLToolTip : public LLPanel
 		Optional<click_callback_t>	click_callback,
 									click_playmedia_callback,
 									click_homepage_callback;
-		Optional<S32>				max_width;
-		Optional<S32>				padding;
+		Optional<S32>				max_width,
+									padding;
 		Optional<bool>				wrap;
 
 		Params();
@@ -94,7 +103,6 @@ class LLToolTip : public LLPanel
 	/*virtual*/ void draw();
 	/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
 	/*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
-	/*virtual*/ void setValue(const LLSD& value);
 	/*virtual*/ void setVisible(BOOL visible);
 
 	bool isFading();
@@ -102,6 +110,7 @@ class LLToolTip : public LLPanel
 	bool hasClickCallback();
 
 	LLToolTip(const Params& p);
+	void initFromParams(const LLToolTip::Params& params);
 
 private:
 	class LLTextBox*	mTextBox;
@@ -111,11 +120,16 @@ class LLToolTip : public LLPanel
 
 	LLFrameTimer	mFadeTimer;
 	LLFrameTimer	mVisibleTimer;
-	S32				mMaxWidth;
 	bool			mHasClickCallback;
 	S32				mPadding;	// pixels
 };
 
+// used for the inspector tooltips which need different background images etc.
+class LLInspector : public LLToolTip
+{
+public:
+	struct Params : public LLInitParam::Block<Params, LLToolTip::Params> {};
+};
 
 class LLToolTipMgr : public LLSingleton<LLToolTipMgr>
 {
diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp
index 851091f0ca2ecc64f57175b430d5f39f6a534bed..f1e3000547d3be73c37d4240e66cb2a8e8687ba7 100644
--- a/indra/llui/lluicolortable.cpp
+++ b/indra/llui/lluicolortable.cpp
@@ -69,7 +69,14 @@ void LLUIColorTable::insertFromParams(const Params& p)
 		ColorEntryParams color_entry = *it;
 		if(color_entry.color.value.isChosen())
 		{
-			setColor(color_entry.name, color_entry.color.value, mLoadedColors);
+			if(mUserSetColors.find(color_entry.name)!=mUserSetColors.end())
+			{
+				setColor(color_entry.name, color_entry.color.value);
+			}
+			else
+			{
+				setColor(color_entry.name, color_entry.color.value, mLoadedColors);
+			}
 		}
 		else
 		{
@@ -213,7 +220,7 @@ bool LLUIColorTable::loadFromSettings()
 		result |= loadFromFilename(current_filename);
 	}
 
-	std::string user_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SKIN, "colors.xml");
+	std::string user_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "colors.xml");
 	loadFromFilename(user_filename);
 
 	return result;
@@ -239,7 +246,7 @@ void LLUIColorTable::saveUserSettings() const
 
 	if(!output_node->isNull())
 	{
-		const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SKIN, "colors.xml");
+		const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "colors.xml");
 		LLFILE *fp = LLFile::fopen(filename, "w");
 
 		if(fp != NULL)
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index 08fc8fb7849203697e2e183446b80ba4709356bb..aaadc1b58da969858e4a825a532db630ca547366 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -38,6 +38,10 @@
 #include "llpanel.h"
 #include "lluictrlfactory.h"
 
+// This breaks the ability to construct dummy LLUICtrls for calls like
+// getChild<LLUICtrl>("not-there")
+//static LLWidgetNameRegistry::StaticRegistrar r(&typeid(LLUICtrl::Params), "ui_ctrl");
+// This doesn't appear to read/apply ui_ctrl.xml
 static LLDefaultChildRegistry::Register<LLUICtrl> r("ui_ctrl");
 
 LLUICtrl::Params::Params()
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index c3c0daed0f4017cd770331d638e655c5246faad1..adfbb41feb56d9ab924356c169791a4717668180 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -449,3 +449,9 @@ const std::string* LLUICtrlFactory::getWidgetTag(const std::type_info* widget_ty
 {
 	return LLWidgetNameRegistry::instance().getValue(widget_type);
 }
+
+// static
+void LLUICtrlFactory::connect(LLView* parent, LLView* child)
+{
+	parent->addChild(child);
+}
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index 17e32dc7a99ba5be6d937c48ba59735bd090f789..8a9c9e23c1d76a43d00a764894417b84d395d477 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -188,10 +188,15 @@ class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory>
 		T* widget = new T(params);
 		widget->initFromParams(params);
 		if (parent)
-			widget->setParent(parent);
+		{
+			connect(parent, widget);
+		}
 		return widget;
 	}
 
+	// fix for gcc template instantiation annoyance
+	static void connect(LLView* parent, LLView* child);
+	
 	LLView* createFromXML(LLXMLNodePtr node, LLView* parent, const std::string& filename, const widget_registry_t&, LLXMLNodePtr output_node );
 
 	template<typename T>
diff --git a/indra/llui/lluiimage.cpp b/indra/llui/lluiimage.cpp
index 6c1a32722f1140e2a34ca55214823b442fd0dc64..a8683e55c3597bfd6985f90ff2f29921957af629 100644
--- a/indra/llui/lluiimage.cpp
+++ b/indra/llui/lluiimage.cpp
@@ -142,6 +142,13 @@ namespace LLInitParam
 {
 	LLUIImage* TypedParam<LLUIImage*>::getValueFromBlock() const
 	{
+		// The keyword "none" is specifically requesting a null image
+		// do not default to current value. Used to overwrite template images. 
+		if (name() == "none")
+		{
+			return NULL;
+		}
+
 		LLUIImage* imagep =  LLUI::getUIImage(name());
 		if (!imagep)
 		{
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index dae4b512d15ed2ed8f55d7a515c3a282d03169ea..219fae84be8dd529457cbe5ad8fed338a0d1b075 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -512,50 +512,6 @@ std::string LLUrlEntryTeleport::getLocation(const std::string &url) const
 	return ::getStringAfterToken(url, "app/teleport/");
 }
 
-///
-/// LLUrlEntryObjectIM Describes a Second Life object instant msg Url, e.g.,
-/// secondlife:///app/objectim/<sessionid>
-///
-LLUrlEntryObjectIM::LLUrlEntryObjectIM()
-{
-	mPattern = boost::regex("secondlife:///app/objectim/[\\da-f-]+\\??\\S*",
-							boost::regex::perl|boost::regex::icase);
-	mMenuName = "menu_url_objectim.xml";
-	mTooltip = LLTrans::getString("TooltipObjectIMUrl");
-}
-
-std::string LLUrlEntryObjectIM::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
-{
-	LLURI uri(url);
-	LLSD params = uri.queryMap();
-	if (params.has("name"))
-	{
-		// look for a ?name=<obj-name> param in the url
-		// and use that as the label if present.
-		std::string name = params.get("name");
-		LLStringUtil::trim(name);
-		if (name.empty())
-		{
-			name = LLTrans::getString("Unnamed");
-		}
-		return name;
-	}
-
-	return unescapeUrl(url);
-}
-
-std::string LLUrlEntryObjectIM::getLocation(const std::string &url) const
-{
-	LLURI uri(url);
-	LLSD params = uri.queryMap();
-	if (params.has("slurl"))
-	{
-		return params.get("slurl");
-	}
-
-	return "";
-}
-
 //
 // LLUrlEntrySL Describes a generic SLURL, e.g., a Url that starts
 // with secondlife:// (used as a catch-all for cases not matched above)
diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h
index 4507572b1e1939d722eb6dbfd574d30534d9a08c..7970b48eb5a7445148cdd7e97f2ea9a5cbaa5853 100644
--- a/indra/llui/llurlentry.h
+++ b/indra/llui/llurlentry.h
@@ -208,18 +208,6 @@ class LLUrlEntryTeleport : public LLUrlEntryBase
 	/*virtual*/ std::string getLocation(const std::string &url) const;
 };
 
-///
-/// LLUrlEntryObjectIM Describes a Second Life object instant msg Url, e.g.,
-/// secondlife:///app/objectim/<sessionid>?name=Foo
-///
-class LLUrlEntryObjectIM : public LLUrlEntryBase
-{
-public:
-	LLUrlEntryObjectIM();
-	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
-	/*virtual*/ std::string getLocation(const std::string &url) const;
-};
-
 ///
 /// LLUrlEntrySL Describes a generic SLURL, e.g., a Url that starts
 /// with secondlife:// (used as a catch-all for cases not matched above)
diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp
index 60275b60bc23d86a7cb6aac7625b898074adb210..a6922b019b52cd2f88999935943086905b5b042c 100644
--- a/indra/llui/llurlregistry.cpp
+++ b/indra/llui/llurlregistry.cpp
@@ -52,7 +52,6 @@ LLUrlRegistry::LLUrlRegistry()
 	registerUrl(new LLUrlEntryParcel());
 	registerUrl(new LLUrlEntryTeleport());
 	registerUrl(new LLUrlEntryWorldMap());
-	registerUrl(new LLUrlEntryObjectIM());
 	registerUrl(new LLUrlEntryPlace());
 	registerUrl(new LLUrlEntrySL());
 	registerUrl(new LLUrlEntrySLLabel());
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index f9b4a6b73d556a9e7674a462ad1d7f10e782a005..dba24ee165fbb2a1aa19423c59b407f74fa8a97d 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -1697,8 +1697,11 @@ LLView* LLView::getChildView(const std::string& name, BOOL recurse) const
 	return child;
 }
 
+static LLFastTimer::DeclareTimer FTM_FIND_VIEWS("Find Widgets");
+
 LLView* LLView::findChildView(const std::string& name, BOOL recurse) const
 {
+	LLFastTimer ft(FTM_FIND_VIEWS);
 	//richard: should we allow empty names?
 	//if(name.empty())
 	//	return NULL;
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index c3b442e0224383803325c76ab3658da33d70892e..2607120e17cbd54ea9d1390694936849e3377625 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -267,9 +267,6 @@ class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElem
 	// remove the specified child from the view, and set it's parent to NULL.
 	virtual void	removeChild(LLView* view);
 
-	// helper function for lluictrlfactory.h create<> template
-	void setParent(LLView* parent) { if (parent) parent->addChild(this); }
-
 	virtual BOOL	postBuild() { return TRUE; }
 
 	child_tab_order_t getCtrlOrder() const		{ return mCtrlOrder; }
diff --git a/indra/mac_crash_logger/CMakeLists.txt b/indra/mac_crash_logger/CMakeLists.txt
index 1d6494fecff6f1d201f2813f066c83fe393261f4..420e836e3689b5af3c7a2fc79a0de3ce4b19090e 100644
--- a/indra/mac_crash_logger/CMakeLists.txt
+++ b/indra/mac_crash_logger/CMakeLists.txt
@@ -75,7 +75,6 @@ add_custom_command(
     ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mac-crash-logger.app/Contents/Resources/CrashReporter.nib
   )
 
-ll_deploy_sharedlibs_command(
-  mac-crash-logger
-  "${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR};${ARCH_PREBUILT_DIRS}" 
-  "../Resources") 
+ll_deploy_sharedlibs_command(mac-crash-logger)
+
+
diff --git a/indra/mac_updater/CMakeLists.txt b/indra/mac_updater/CMakeLists.txt
index d7bd6f993ce0e3a0c46bf1496267165c178786f9..57d426aa24d9779d867bb821cc42759374519f11 100644
--- a/indra/mac_updater/CMakeLists.txt
+++ b/indra/mac_updater/CMakeLists.txt
@@ -77,7 +77,4 @@ add_custom_command(
     ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/mac-updater.app/Contents/Resources/AutoUpdater.nib
   )
 
-ll_deploy_sharedlibs_command(
-  mac-updater
-  "${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR};${ARCH_PREBUILT_DIRS}" 
-  "../Resources") 
+ll_deploy_sharedlibs_command(mac-updater) 
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 649d86aaa68642121d287dd8bff8359eb99dff7b..b129bca1f3921bf520c497538bb90aebf6685164 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -185,7 +185,7 @@ set(viewer_SOURCE_FILES
     llfloatermediasettings.cpp
     llfloatermemleak.cpp
     llfloaternamedesc.cpp
-	llfloaternearbymedia.cpp
+        llfloaternearbymedia.cpp
     llfloaternotificationsconsole.cpp
     llfloateropenobject.cpp
     llfloaterparcel.cpp
@@ -246,6 +246,7 @@ set(viewer_SOURCE_FILES
     llinspectavatar.cpp
     llinspectgroup.cpp
     llinspectobject.cpp
+    llinspectremoteobject.cpp
     llinventorybridge.cpp
     llinventoryclipboard.cpp
     llinventoryfilter.cpp
@@ -681,7 +682,7 @@ set(viewer_HEADER_FILES
     llfloatermediasettings.h
     llfloatermemleak.h
     llfloaternamedesc.h
-	llfloaternearbymedia.h
+        llfloaternearbymedia.h
     llfloaternotificationsconsole.h
     llfloateropenobject.h
     llfloaterparcel.h
@@ -741,6 +742,7 @@ set(viewer_HEADER_FILES
     llinspectavatar.h
     llinspectgroup.h
     llinspectobject.h
+    llinspectremoteobject.h
     llinventorybridge.h
     llinventoryclipboard.h
     llinventoryfilter.h
@@ -1168,7 +1170,7 @@ if (WINDOWS)
 
     if (NOT STANDALONE)
         list(APPEND viewer_SOURCE_FILES ${viewer_RESOURCE_FILES})
-    endif (NOT STANDALONE)	
+    endif (NOT STANDALONE)      
 
     find_library(DINPUT_LIBRARY dinput8 ${DIRECTX_LIBRARY_DIR})
     find_library(DXGUID_LIBRARY dxguid ${DIRECTX_LIBRARY_DIR})
@@ -1350,7 +1352,7 @@ file(GLOB EVENT_HOST_SCRIPT_GLOB_LIST
      ${CMAKE_CURRENT_SOURCE_DIR}/../viewer_components/*.py)
 list(APPEND EVENT_HOST_SCRIPTS ${EVENT_HOST_SCRIPT_GLOB_LIST})
 
-set(PACKAGE OFF CACHE BOOL
+set(PACKAGE ON CACHE BOOL
     "Add a package target that builds an installer package.")
 
 if (WINDOWS)
@@ -1379,7 +1381,7 @@ if (WINDOWS)
               ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.sln
               --workingdir
               ${VIEWER_BINARY_NAME}
-              ${CMAKE_CURRENT_SOURCE_DIR}
+              "${CMAKE_CURRENT_SOURCE_DIR}"
             COMMENT "Setting the ${VIEWER_BINARY_NAME} working directory for debugging."
             )
     endif (NOT UNATTENDED)
@@ -1396,85 +1398,87 @@ if (WINDOWS)
         )
 
     add_custom_command(
-        TARGET ${VIEWER_BINARY_NAME} PRE_BUILD
-        COMMAND ${CMAKE_COMMAND}
-        ARGS
-          -E
-          copy_if_different
-          ${CMAKE_CURRENT_SOURCE_DIR}/../../etc/message.xml
-          ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/app_settings/message.xml
-        COMMENT "Copying message.xml to the runtime folder."
-        )
+      TARGET ${VIEWER_BINARY_NAME} PRE_BUILD
+      COMMAND ${CMAKE_COMMAND}
+      ARGS
+        -E
+        copy_if_different
+        ${CMAKE_CURRENT_SOURCE_DIR}/../../etc/message.xml
+        ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/app_settings/message.xml
+      COMMENT "Copying message.xml to the runtime folder."
+      )
        
-    if(WINDOWS)
-      # Copy Win Libs...
-      # This happens at build time, not config time. We can't glob files in this cmake.
-      # *FIX:Mani Write a sub script to glob the files...
-      # *FIX:Mani Use actually dependencies rather than bulk copy.
-      add_custom_command(
-        TARGET ${VIEWER_BINARY_NAME} PRE_BUILD
-        COMMAND ${CMAKE_COMMAND}
-        ARGS
-          -E
-          copy_directory
-          ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}
-          ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
-        COMMENT "Copying staged dlls."
-        )
+    add_custom_command(
+      TARGET ${VIEWER_BINARY_NAME} POST_BUILD
+      COMMAND ${PYTHON_EXECUTABLE}
+      ARGS
+        ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
+        --actions=copy
+        --artwork=${ARTWORK_DIR}
+        --build=${CMAKE_CURRENT_BINARY_DIR}
+        --configuration=${CMAKE_CFG_INTDIR}
+        --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
+        --grid=${GRID}
+        --source=${CMAKE_CURRENT_SOURCE_DIR}
+      DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
+      COMMENT "Performing viewer_manifest copy"
+      )
 
-      add_dependencies(${VIEWER_BINARY_NAME} stage_third_party_libs llcommon)
-      if(LLKDU_LIBRARY)
-	# kdu may not exist!
-	add_dependencies(${VIEWER_BINARY_NAME} llkdu)
-      endif(LLKDU_LIBRARY)
-    endif(WINDOWS)    
+    add_dependencies(${VIEWER_BINARY_NAME} stage_third_party_libs llcommon)
+    
+    if(LLKDU_LIBRARY)
+      # kdu may not exist!
+      add_dependencies(${VIEWER_BINARY_NAME} llkdu)
+    endif(LLKDU_LIBRARY)
 
     if (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts)
       add_dependencies(${VIEWER_BINARY_NAME} copy_win_scripts)
     endif (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts)
         
-    add_custom_command(
+    add_dependencies(${VIEWER_BINARY_NAME} 
+      SLPlugin 
+      media_plugin_quicktime 
+      media_plugin_webkit
+      windows-updater 
+      windows-crash-logger
+      )
+
+    if (PACKAGE)
+      add_custom_command(
+        OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/event_host.tar.bz2
+        COMMAND ${PYTHON_EXECUTABLE}
+        ARGS
+          ${CMAKE_CURRENT_SOURCE_DIR}/event_host_manifest.py
+          ${CMAKE_CURRENT_SOURCE_DIR}/..
+          ${CMAKE_CURRENT_BINARY_DIR}
+          ${CMAKE_CFG_INTDIR}
+        DEPENDS 
+          lleventhost 
+          ${EVENT_HOST_SCRIPTS}
+          ${CMAKE_CURRENT_SOURCE_DIR}/event_host_manifest.py
+        )
+
+      add_custom_command(
         OUTPUT ${CMAKE_CFG_INTDIR}/touched.bat
         COMMAND ${PYTHON_EXECUTABLE}
         ARGS
           ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
-          --configuration=${CMAKE_CFG_INTDIR}
+          --artwork=${ARTWORK_DIR}
+          --build=${CMAKE_CURRENT_BINARY_DIR}
           --channel=${VIEWER_CHANNEL}
-          --login_channel=${VIEWER_LOGIN_CHANNEL}
+          --configuration=${CMAKE_CFG_INTDIR}
+          --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
           --grid=${GRID}
+          --login_channel=${VIEWER_LOGIN_CHANNEL}
           --source=${CMAKE_CURRENT_SOURCE_DIR}
-              --artwork=${ARTWORK_DIR}
-              --build=${CMAKE_CURRENT_BINARY_DIR}
-              --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
-              --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/touched.bat
+          --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/touched.bat
         DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
         )
 
-    add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_quicktime media_plugin_webkit)
-
-    if (PACKAGE)
-      add_custom_command(
-          OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/event_host.tar.bz2
-          COMMAND ${PYTHON_EXECUTABLE}
-          ARGS
-            ${CMAKE_CURRENT_SOURCE_DIR}/event_host_manifest.py
-            ${CMAKE_CURRENT_SOURCE_DIR}/..
-            ${CMAKE_CURRENT_BINARY_DIR}
-            ${CMAKE_CFG_INTDIR}
-
-          DEPENDS 
-            lleventhost 
-            ${EVENT_HOST_SCRIPTS}
-            ${CMAKE_CURRENT_SOURCE_DIR}/event_host_manifest.py)
-
-      add_custom_target(package ALL 
-          DEPENDS 
-            ${CMAKE_CFG_INTDIR}/touched.bat)
-            # temporarily disable packaging of event_host until hg subrepos get
-            # sorted out on the parabuild cluster...
-            #${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/event_host.tar.bz2)
-      add_dependencies(package windows-updater windows-crash-logger)
-
+      add_custom_target(package ALL DEPENDS ${CMAKE_CFG_INTDIR}/touched.bat)
+        # temporarily disable packaging of event_host until hg subrepos get
+        # sorted out on the parabuild cluster...
+        #${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/event_host.tar.bz2)
 
     endif (PACKAGE)
 endif (WINDOWS)
@@ -1537,15 +1541,16 @@ if (LINUX)
       COMMAND ${PYTHON_EXECUTABLE}
       ARGS
         ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
-        --grid=${GRID}
-        --channel=${VIEWER_CHANNEL}
-        --login_channel=${VIEWER_LOGIN_CHANNEL}
-        --installer_name=${product}
         --arch=${ARCH}
-        --source=${CMAKE_CURRENT_SOURCE_DIR}
         --artwork=${ARTWORK_DIR}
         --build=${CMAKE_CURRENT_BINARY_DIR}
+        --channel=${VIEWER_CHANNEL}
+        --configuration=${CMAKE_CFG_INTDIR}
         --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged
+        --grid=${GRID}
+        --installer_name=${product}
+        --login_channel=${VIEWER_LOGIN_CHANNEL}
+        --source=${CMAKE_CURRENT_SOURCE_DIR}
         --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched
       DEPENDS secondlife-stripped ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
       )
@@ -1580,13 +1585,13 @@ if (DARWIN)
     COMMAND ${PYTHON_EXECUTABLE}
     ARGS
       ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
-      --grid=${GRID}
       --actions=copy
-      --configuration=${CMAKE_CFG_INTDIR}
-      --source=${CMAKE_CURRENT_SOURCE_DIR}
       --artwork=${ARTWORK_DIR}
       --build=${CMAKE_CURRENT_BINARY_DIR}
+      --configuration=${CMAKE_CFG_INTDIR}
       --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app
+      --grid=${GRID}
+      --source=${CMAKE_CURRENT_SOURCE_DIR}
     DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
     )
 
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml
index d7bb64ce8a7787b39abc4bf24ebfc954571cdfdb..ec80d2d01409e30623e1836297058caa475837eb 100644
--- a/indra/newview/app_settings/logcontrol.xml
+++ b/indra/newview/app_settings/logcontrol.xml
@@ -34,6 +34,7 @@
 						</array>
 					<key>classes</key>
 						<array>
+							<string>LLBottomTray</string>
 						</array>
 					<key>files</key>
 						<array>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 55ff255c38e82a6ddb4f2ca2d8584d645c5ccfed..38f14793d9b53b283b0c292cedcf027aabbd2d9e 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -3563,7 +3563,7 @@
       <key>Type</key>
       <string>S32</string>
       <key>Value</key>
-      <integer>400</integer>
+      <integer>305</integer>
     </map>
     <key>HelpUseLocal</key>
     <map>
@@ -4895,7 +4895,7 @@
       <key>Type</key>
       <string>S32</string>
       <key>Value</key>
-      <integer>350</integer>
+      <integer>305</integer>
     </map>
     <key>NotificationToastLifeTime</key>
     <map>
@@ -5327,6 +5327,17 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>PluginAttachDebuggerToPlugins</key>
+    <map>
+      <key>Comment</key>
+      <string>If true, attach a debugger session to each plugin process as it's launched.</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
     <key>PluginInstancesCPULimit</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 24bdf66c2a15d040747b0cdba540f2d3baabaa4f..d2c8558f0b2da2da3ae3460c4bf4ddd39340b982 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -2619,9 +2619,9 @@ void LLAgent::updateLookAt(const S32 mouse_x, const S32 mouse_y)
 		{
 			// range from -.5 to .5
 			F32 x_from_center = 
-				((F32) mouse_x / (F32) gViewerWindow->getWindowWidth() ) - 0.5f;
+				((F32) mouse_x / (F32) gViewerWindow->getWindowWidthScaled() ) - 0.5f;
 			F32 y_from_center = 
-				((F32) mouse_y / (F32) gViewerWindow->getWindowHeight() ) - 0.5f;
+				((F32) mouse_y / (F32) gViewerWindow->getWindowHeightScaled() ) - 0.5f;
 
 			frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD);
 			frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD);
@@ -3436,11 +3436,11 @@ F32 LLAgent::calcCustomizeAvatarUIOffset( const LLVector3d& camera_pos_global )
 		const LLRect& rect = gFloaterCustomize->getRect();
 
 		// Move the camera so that the avatar isn't covered up by this floater.
-		F32 fraction_of_fov = 0.5f - (0.5f * (1.f - llmin(1.f, ((F32)rect.getWidth() / (F32)gViewerWindow->getWindowWidth()))));
+		F32 fraction_of_fov = 0.5f - (0.5f * (1.f - llmin(1.f, ((F32)rect.getWidth() / (F32)gViewerWindow->getWindowWidthScaled()))));
 		F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect();  // radians
 		F32 offset = tan(apparent_angle);
 
-		if( rect.mLeft < (gViewerWindow->getWindowWidth() - rect.mRight) )
+		if( rect.mLeft < (gViewerWindow->getWindowWidthScaled() - rect.mRight) )
 		{
 			// Move the avatar to the right (camera to the left)
 			ui_offset = offset;
diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp
index 0f00078b33ca0eef6e58e501774e1030fbfd6d13..b3ed7c353ed577a9fc2b75015dc77ec26264a31c 100644
--- a/indra/newview/llagentlistener.cpp
+++ b/indra/newview/llagentlistener.cpp
@@ -22,12 +22,20 @@
 #include "llviewerregion.h"
 
 LLAgentListener::LLAgentListener(LLAgent &agent)
-  : LLDispatchListener("LLAgent", "op"),
+  : LLEventAPI("LLAgent",
+               "LLAgent listener to (e.g.) teleport, sit, stand, etc."),
     mAgent(agent)
 {
-	add("requestTeleport", &LLAgentListener::requestTeleport);
-	add("requestSit", &LLAgentListener::requestSit);
-	add("requestStand", &LLAgentListener::requestStand);
+	add("requestTeleport",
+        "Teleport: [\"regionname\"], [\"x\"], [\"y\"], [\"z\"]\n"
+        "If [\"skip_confirmation\"] is true, use LLURLDispatcher rather than LLCommandDispatcher.",
+        &LLAgentListener::requestTeleport);
+	add("requestSit",
+        "Ask to sit on the object specified in [\"obj_uuid\"]",
+        &LLAgentListener::requestSit);
+	add("requestStand",
+        "Ask to stand up",
+        &LLAgentListener::requestStand);
 }
 
 void LLAgentListener::requestTeleport(LLSD const & event_data) const
@@ -40,7 +48,7 @@ void LLAgentListener::requestTeleport(LLSD const & event_data) const
 		params.append(event_data["y"]);
 		params.append(event_data["z"]);
 		LLCommandDispatcher::dispatch("teleport", params, LLSD(), NULL, true);
-		// *TODO - lookup other LLCommandHandlers for "agent", "classified", "event", "group", "floater", "objectim", "parcel", "login", login_refresh", "balance", "chat"
+		// *TODO - lookup other LLCommandHandlers for "agent", "classified", "event", "group", "floater", "parcel", "login", login_refresh", "balance", "chat"
 		// should we just compose LLCommandHandler and LLDispatchListener?
 	}
 	else
diff --git a/indra/newview/llagentlistener.h b/indra/newview/llagentlistener.h
index 6f0b5a54c5f0efd54b8bd116437b00779ae63879..eed6922b3e2e6b1a3b283c047ac4a7e8b94b9d17 100644
--- a/indra/newview/llagentlistener.h
+++ b/indra/newview/llagentlistener.h
@@ -13,12 +13,12 @@
 #ifndef LL_LLAGENTLISTENER_H
 #define LL_LLAGENTLISTENER_H
 
-#include "lleventdispatcher.h"
+#include "lleventapi.h"
 
 class LLAgent;
 class LLSD;
 
-class LLAgentListener : public LLDispatchListener
+class LLAgentListener : public LLEventAPI
 {
 public:
 	LLAgentListener(LLAgent &agent);
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 3fc1055acdff14aab3b7da7110e21068cb7a6768..9938c3db2bfdf25f68286e3fe8690cd145054d17 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -1985,14 +1985,14 @@ bool LLAgentWearables::canWearableBeRemoved(const LLWearable* wearable) const
 	return !(((type == WT_SHAPE) || (type == WT_SKIN) || (type == WT_HAIR) || (type == WT_EYES))
 			 && (getWearableCount(type) <= 1) );		  
 }
-void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL set_by_user)
+void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake)
 {
 	for( S32 type = 0; type < WT_COUNT; ++type )
 	{
 		for (S32 count = 0; count < (S32)getWearableCount((EWearableType)type); ++count)
 		{
 			LLWearable *wearable = getWearable((EWearableType)type,count);
-			wearable->animateParams(delta, set_by_user);
+			wearable->animateParams(delta, upload_bake);
 		}
 	}
 }
diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h
index 317f4a7e4fbc512759bb850d7097da16bafd1c96..9017c25fc64240ab7eb163294274d210915e824a 100644
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -80,7 +80,7 @@ class LLAgentWearables
 	// Note: False for shape, skin, eyes, and hair, unless you have MORE than 1.
 	bool			canWearableBeRemoved(const LLWearable* wearable) const;
 
-	void			animateAllWearableParams(F32 delta, BOOL set_by_user);
+	void			animateAllWearableParams(F32 delta, BOOL upload_bake);
 	
 	//--------------------------------------------------------------------
 	// Accessors
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 8e6d6b885d696ab4dddf62c240901fc60d817224..845a264327d8d6f9b1f443808b55e37a7b3b4e31 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -207,7 +207,7 @@
 #pragma warning (disable:4702)
 #endif
 
-static LLAppViewerListener sAppViewerListener("LLAppViewer", LLAppViewer::instance);
+static LLAppViewerListener sAppViewerListener(LLAppViewer::instance);
 
 ////// Windows-specific includes to the bottom - nasty defines in these pollute the preprocessor
 //
@@ -3282,7 +3282,7 @@ void LLAppViewer::saveFinalSnapshot()
 		snap_filename += gDirUtilp->getDirDelimiter();
 		snap_filename += SCREEN_LAST_FILENAME;
 		// use full pixel dimensions of viewer window (not post-scale dimensions)
-		gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, TRUE);
+		gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, TRUE);
 		mSavedFinalSnapshot = TRUE;
 	}
 }
diff --git a/indra/newview/llappviewerlistener.cpp b/indra/newview/llappviewerlistener.cpp
index 3259309eee76872a69e8aa2b8cd16563c77dd10a..adb5f43c1a8a701f093cfe9214b89280531e987c 100644
--- a/indra/newview/llappviewerlistener.cpp
+++ b/indra/newview/llappviewerlistener.cpp
@@ -19,14 +19,18 @@
 // other Linden headers
 #include "llappviewer.h"
 
-LLAppViewerListener::LLAppViewerListener(const std::string& pumpname,
-                                         const LLAppViewerGetter& getter):
-    LLDispatchListener(pumpname, "op"),
+LLAppViewerListener::LLAppViewerListener(const LLAppViewerGetter& getter):
+    LLEventAPI("LLAppViewer",
+               "LLAppViewer listener to (e.g.) request shutdown"),
     mAppViewerGetter(getter)
 {
     // add() every method we want to be able to invoke via this event API.
-    add("requestQuit", &LLAppViewerListener::requestQuit);
-    add("forceQuit", &LLAppViewerListener::forceQuit);
+    add("requestQuit",
+        "Ask to quit nicely",
+        &LLAppViewerListener::requestQuit);
+    add("forceQuit",
+        "Quit abruptly",
+        &LLAppViewerListener::forceQuit);
 }
 
 void LLAppViewerListener::requestQuit(const LLSD& event)
diff --git a/indra/newview/llappviewerlistener.h b/indra/newview/llappviewerlistener.h
index 73227cb95a771e2a74092f3cf74197ae230a2c52..deedcbc17976db460bcbfbb88d4771104ceef697 100644
--- a/indra/newview/llappviewerlistener.h
+++ b/indra/newview/llappviewerlistener.h
@@ -12,20 +12,19 @@
 #if ! defined(LL_LLAPPVIEWERLISTENER_H)
 #define LL_LLAPPVIEWERLISTENER_H
 
-#include "lleventdispatcher.h"
+#include "lleventapi.h"
 #include <boost/function.hpp>
 
 class LLAppViewer;
 class LLSD;
 
 /// Listen on an LLEventPump with specified name for LLAppViewer request events.
-class LLAppViewerListener: public LLDispatchListener
+class LLAppViewerListener: public LLEventAPI
 {
 public:
     typedef boost::function<LLAppViewer*(void)> LLAppViewerGetter;
-    /// Specify the pump name on which to listen, and bind the LLAppViewer
-    /// instance to use (e.g. LLAppViewer::instance()).
-    LLAppViewerListener(const std::string& pumpname, const LLAppViewerGetter& getter);
+    /// Bind the LLAppViewer instance to use (e.g. LLAppViewer::instance()).
+    LLAppViewerListener(const LLAppViewerGetter& getter);
 
 private:
     void requestQuit(const LLSD& event);
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index dae4296a82ede79c202988180741751ed0bf5e9c..f6319785650470bf48113458467826a60b179a61 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -54,11 +54,15 @@
 #include "llmutelist.h"
 #include "llrecentpeople.h"
 #include "llsidetray.h"
+#include "lltrans.h"
 #include "llviewerobjectlist.h"
 #include "llviewermessage.h"	// for handle_lure
 #include "llviewerregion.h"
 #include "llimfloater.h"
+#include "lltrans.h"
 
+// callback connection to auto-call when the IM floater initializes
+boost::signals2::connection gAdhocAutoCall;
 
 // static
 void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::string& name)
@@ -205,6 +209,39 @@ void LLAvatarActions::startCall(const LLUUID& id)
 	make_ui_sound("UISndStartIM");
 }
 
+// static
+void LLAvatarActions::startAdhocCall(const std::vector<LLUUID>& ids)
+{
+	if (ids.size() == 0)
+	{
+		return;
+	}
+
+	// convert vector into LLDynamicArray for addSession
+	LLDynamicArray<LLUUID> id_array;
+	for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
+	{
+		id_array.push_back(*it);
+	}
+
+	// create the new ad hoc voice session
+	const std::string title = LLTrans::getString("conference-title");
+	LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START,
+										   ids[0], id_array);
+	if (session_id == LLUUID::null)
+	{
+		return;
+	}
+
+	// always open IM window when connecting to voice
+	LLIMFloater::show(session_id);
+
+	// start the call once the floater has fully initialized
+	gAdhocAutoCall = LLIMModel::getInstance()->addSessionInitializedCallback(callbackAutoStartCall);
+
+	make_ui_sound("UISndStartIM");
+}
+
 // static
 bool LLAvatarActions::isCalling(const LLUUID &id)
 {
@@ -226,7 +263,8 @@ void LLAvatarActions::startConference(const std::vector<LLUUID>& ids)
 	{
 		id_array.push_back(*it);
 	}
-	LLUUID session_id = gIMMgr->addSession("Friends Conference", IM_SESSION_CONFERENCE_START, ids[0], id_array);
+	const std::string title = LLTrans::getString("conference-title");
+	LLUUID session_id = gIMMgr->addSession(title, IM_SESSION_CONFERENCE_START, ids[0], id_array);
 	if (session_id != LLUUID::null)
 	{
 		LLIMFloater::show(session_id);
@@ -393,6 +431,17 @@ bool LLAvatarActions::callbackAddFriend(const LLSD& notification, const LLSD& re
     return false;
 }
 
+// static
+void LLAvatarActions::callbackAutoStartCall(const LLSD& data)
+{
+	// start the adhoc voice call now the IM panel has initialized
+	LLUUID session_id = data["session_id"].asUUID();
+	gIMMgr->startCall(session_id);
+
+	// and deschedule this callback as its work is done now
+	gAdhocAutoCall.disconnect();
+}
+
 // static
 void LLAvatarActions::requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message)
 {
diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h
index 0ec20ae3572477764a2ffed0c9e881682b9cbb83..66ea6880dbf22267c06beeaa6665ce9491401383 100644
--- a/indra/newview/llavataractions.h
+++ b/indra/newview/llavataractions.h
@@ -33,6 +33,13 @@
 #ifndef LL_LLAVATARACTIONS_H
 #define LL_LLAVATARACTIONS_H
 
+#include "lldarray.h"
+#include "llsd.h"
+#include "lluuid.h"
+
+#include <string>
+#include <vector>
+
 /**
  * Friend-related actions (add, remove, offer teleport, etc)
  */
@@ -71,6 +78,11 @@ class LLAvatarActions
 	 */
 	static void startCall(const LLUUID& id);
 
+	/**
+	 * Start an ad-hoc conference voice call with multiple users
+	 */
+	static void startAdhocCall(const std::vector<LLUUID>& ids);
+
 	/**
 	 * Start conference chat with the given avatars.
 	 */
@@ -117,6 +129,7 @@ class LLAvatarActions
 	static bool handleRemove(const LLSD& notification, const LLSD& response);
 	static bool handlePay(const LLSD& notification, const LLSD& response, LLUUID avatar_id);
 	static void callback_invite_to_group(LLUUID group_id, LLUUID id);
+	static void callbackAutoStartCall(const LLSD& data);
 
 	// Just request friendship, no dialog.
 	static void requestFriendship(const LLUUID& target_id, const std::string& target_name, const std::string& message);
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index e5cc2fce881c5b158d82b23bce432d5ff2f3502d..291f645ea23fb75a6810a734cccfa6fe93af2387 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -50,6 +50,8 @@ LLBottomTray::LLBottomTray(const LLSD&)
 	mSpeakBtn(NULL),
 	mNearbyChatBar(NULL),
 	mToolbarStack(NULL)
+,	mMovementButton(NULL)
+// Add more members
 {
 	mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL);
 
@@ -70,7 +72,9 @@ LLBottomTray::LLBottomTray(const LLSD&)
 	//this is to fix a crash that occurs because LLBottomTray is a singleton
 	//and thus is deleted at the end of the viewers lifetime, but to be cleanly
 	//destroyed LLBottomTray requires some subsystems that are long gone
-	LLUI::getRootView()->addChild(this);
+	//LLUI::getRootView()->addChild(this);
+
+	initStateProcessedObjectMap();
 
 	// Necessary for focus movement among child controls
 	setFocusRoot(TRUE);
@@ -234,30 +238,31 @@ void LLBottomTray::showBottomTrayContextMenu(S32 x, S32 y, MASK mask)
 
 void LLBottomTray::showGestureButton(BOOL visible)
 {
-	mGesturePanel->setVisible(visible);
+	showTrayButton(RS_BUTTON_GESTURES, visible);
 }
 
 void LLBottomTray::showMoveButton(BOOL visible)
 {
-	mMovementPanel->setVisible(visible);
+	showTrayButton(RS_BUTTON_MOVEMENT, visible);
 }
 
 void LLBottomTray::showCameraButton(BOOL visible)
 {
-	mCamPanel->setVisible(visible);
+	showTrayButton(RS_BUTTON_CAMERA, visible);
 }
 
 void LLBottomTray::showSnapshotButton(BOOL visible)
 {
-	mSnapshotPanel->setVisible(visible);
+	showTrayButton(RS_BUTTON_SNAPSHOT, visible);
 }
 
 namespace
 {
-	const std::string& PANEL_CHICLET_NAME = "chiclet_list_panel";
-	const std::string& PANEL_CHATBAR_NAME = "chat_bar";
-	const std::string& PANEL_MOVEMENT_NAME = "movement_panel";
-	const std::string& PANEL_CAMERA_NAME = "cam_panel";
+	const std::string& PANEL_CHICLET_NAME	= "chiclet_list_panel";
+	const std::string& PANEL_CHATBAR_NAME	= "chat_bar";
+	const std::string& PANEL_MOVEMENT_NAME	= "movement_panel";
+	const std::string& PANEL_CAMERA_NAME	= "cam_panel";
+	const std::string& PANEL_GESTURE_NAME	= "gesture_panel";
 }
 
 BOOL LLBottomTray::postBuild()
@@ -283,159 +288,381 @@ BOOL LLBottomTray::postBuild()
 	return TRUE;
 }
 
+void LLBottomTray::log(LLView* panel, const std::string& descr)
+{
+	if (NULL == panel) return;
+	LLView* layout = panel->getParent();
+	lldebugs << descr << ": "
+		<< "panel: " << panel->getName()
+		<< ", rect: " << panel->getRect()
+ 
+ 
+		<< "layout: " << layout->getName()
+		<< ", rect: " << layout->getRect()
+		<< llendl
+		; 
+}
+
 void LLBottomTray::verifyChildControlsSizes()
 {
 	LLRect rect = mChicletPanel->getRect();
+	/*
 	if (rect.getWidth() < mChicletPanel->getMinWidth())
 	{
+		llwarns << "QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ: chiclet panel less then min" << llendl;
 		mChicletPanel->reshape(mChicletPanel->getMinWidth(), rect.getHeight());
 	}
-
+*/
 	rect = mNearbyChatBar->getRect();
+/*
 	if (rect.getWidth() < mNearbyChatBar->getMinWidth())
 	{
+		llwarns << "WWWWWWWWWWWWWWWWWWWWWWWWWWWWW: near chat panel less then min" << llendl;
 		mNearbyChatBar->reshape(mNearbyChatBar->getMinWidth(), rect.getHeight());
 	}
-	else if (rect.getWidth() > mNearbyChatBar->getMaxWidth())
+	else 
+*/
+		if (rect.getWidth() > mNearbyChatBar->getMaxWidth())
 	{
+		llerrs << "WWWWWWWWWWWWWWWWWWWWWWWWWWWWW: near chat panel more then max width" << llendl;
+
 		rect.setLeftTopAndSize(rect.mLeft, rect.mTop, mNearbyChatBar->getMaxWidth(), rect.getHeight());
 		mNearbyChatBar->reshape(mNearbyChatBar->getMaxWidth(), rect.getHeight());
 		mNearbyChatBar->setRect(rect);
 	}
 }
-
+#define __FEATURE_EXT_991
 void LLBottomTray::reshape(S32 width, S32 height, BOOL called_from_parent)
 {
+	lldebugs << "****************************************" << llendl;
+
+	S32 current_width = getRect().getWidth();
+	lldebugs << "Reshaping: " 
+		<< ", width: " << width
+		<< ", height: " << height
+		<< ", called_from_parent: " << called_from_parent
+		<< ", cur width: " << current_width
+		<< ", cur height: " << getRect().getHeight()
+		<< llendl;
+
+	if (mNearbyChatBar)			log(mNearbyChatBar, "before");
+	if (mChicletPanel)			log(mChicletPanel, "before");
 
 	if (mChicletPanel && mToolbarStack && mNearbyChatBar)
 	{
-#ifdef __FEATURE_EXT_991__
-		BOOL shrink = width < getRect().getWidth();
-		const S32 MIN_RENDERED_CHARS = 3;
-#endif
+		mToolbarStack->updatePanelAutoResize(PANEL_CHICLET_NAME, TRUE);
+ 		verifyChildControlsSizes();
+ 		updateResizeState(width, current_width);
+	}
 
-		verifyChildControlsSizes();
-		updateResizeState(width, height);
+	LLPanel::reshape(width, height, called_from_parent);
 
-		switch (mResizeState)
-		{
-		case STATE_CHICLET_PANEL:
-			mToolbarStack->updatePanelAutoResize(PANEL_CHICLET_NAME, TRUE);
 
-			mToolbarStack->updatePanelAutoResize(PANEL_CHATBAR_NAME, FALSE);
-			mToolbarStack->updatePanelAutoResize(PANEL_CAMERA_NAME, FALSE);
-			mToolbarStack->updatePanelAutoResize(PANEL_MOVEMENT_NAME, FALSE);
+	if (mNearbyChatBar)			log(mNearbyChatBar, "after");
+	if (mChicletPanel)			log(mChicletPanel, "after");
+}
 
-			break;
-		case STATE_CHATBAR_INPUT:
-			mToolbarStack->updatePanelAutoResize(PANEL_CHATBAR_NAME, TRUE);
+void LLBottomTray::updateResizeState(S32 new_width, S32 cur_width)
+{
+	mResizeState = RS_NORESIZE;
 
-			mToolbarStack->updatePanelAutoResize(PANEL_CHICLET_NAME, FALSE);
-			mToolbarStack->updatePanelAutoResize(PANEL_CAMERA_NAME, FALSE);
-			mToolbarStack->updatePanelAutoResize(PANEL_MOVEMENT_NAME, FALSE);
+	S32 delta_width = new_width - cur_width;
+//	if (delta_width == 0) return;
+	bool shrink = new_width < cur_width;
 
-			break;
+	const S32 chiclet_panel_width = mChicletPanel->getParent()->getRect().getWidth();
+	const S32 chiclet_panel_min_width = mChicletPanel->getMinWidth();
 
-#ifdef __FEATURE_EXT_991__
+	const S32 chatbar_panel_width = mNearbyChatBar->getRect().getWidth();
+	const S32 chatbar_panel_min_width = mNearbyChatBar->getMinWidth();
+	const S32 chatbar_panel_max_width = mNearbyChatBar->getMaxWidth();
 
-		case STATE_BUTTONS:
-			mToolbarStack->updatePanelAutoResize(PANEL_CAMERA_NAME, TRUE);
-			mToolbarStack->updatePanelAutoResize(PANEL_MOVEMENT_NAME, TRUE);
+	lldebugs << "chatbar_panel_width: " << chatbar_panel_width
+		<< ", chatbar_panel_min_width: " << chatbar_panel_min_width
+		<< ", chatbar_panel_max_width: " << chatbar_panel_max_width
+		<< ", chiclet_panel_width: " << chiclet_panel_width
+		<< ", chiclet_panel_min_width: " << chiclet_panel_min_width
+		<< llendl;
 
-			mToolbarStack->updatePanelAutoResize(PANEL_CHICLET_NAME, FALSE);
-			mToolbarStack->updatePanelAutoResize(PANEL_CHATBAR_NAME, FALSE);
+	// bottom tray is narrowed
+	if (shrink)
+	{
+		processWidthDecreased(delta_width);
+	}
+	// bottom tray is widen
+	else
+	{
+		processWidthIncreased(delta_width);
+	}
 
-			if (shrink)
-			{
+	lldebugs << "New resize state: " << mResizeState << llendl;
+}
 
-				if (mSnapshotPanel->getVisible())
-				{
-					showSnapshotButton(FALSE);
-				}
+void LLBottomTray::processWidthDecreased(S32 delta_width)
+{
+	bool still_should_be_processed = true;
 
-				if (mCamPanel->getVisible() && mCamButton->getLastDrawCharsCount() < MIN_RENDERED_CHARS)
-				{
-					showCameraButton(FALSE);
-				}
+	const S32 chiclet_panel_width = mChicletPanel->getParent()->getRect().getWidth();
+	const S32 chiclet_panel_min_width = mChicletPanel->getMinWidth();
 
-				if (mMovementPanel->getVisible() && mMovementButton->getLastDrawCharsCount() < MIN_RENDERED_CHARS)
-				{
-					showMoveButton(FALSE);
-				}
+	if (chiclet_panel_width > chiclet_panel_min_width)
+	{
+		// we have some space to decrease chiclet panel
+		S32 panel_delta_min = chiclet_panel_width - chiclet_panel_min_width;
+		mResizeState |= RS_CHICLET_PANEL;
 
-			}
-			else
-			{
-				showMoveButton(TRUE);
-				mMovementPanel->draw();
-
-				if (mMovementButton->getLastDrawCharsCount() >= MIN_RENDERED_CHARS)
-				{
-					showMoveButton(TRUE);
-				}
-				else
-				{
-					showMoveButton(FALSE);
-				}
-			}
-			break;
-#endif
+		S32 delta_panel = llmin(-delta_width, panel_delta_min);
 
-		default:
-			break;
-		}
-	}
+		lldebugs << "delta_width: " << delta_width
+			<< ", panel_delta_min: " << panel_delta_min
+			<< ", delta_panel: " << delta_panel
+			<< llendl;
 
-	LLPanel::reshape(width, height, called_from_parent);
-}
+		// is chiclet panel width enough to process resizing?
+		delta_width += panel_delta_min;
 
-void LLBottomTray::updateResizeState(S32 width, S32 height)
-{
-	mResizeState = STATE_BUTTONS;
+		still_should_be_processed = delta_width < 0;
 
-	const S32 chiclet_panel_width = mChicletPanel->getRect().getWidth();
-	const S32 chiclet_panel_min_width = mChicletPanel->getMinWidth();
+		mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - delta_panel, mChicletPanel->getParent()->getRect().getHeight());
+		log(mChicletPanel, "after processing panel decreasing via chiclet panel");
+
+		lldebugs << "RS_CHICLET_PANEL" 
+			<< ", delta_width: " << delta_width
+			<< llendl;
+	}
 
 	const S32 chatbar_panel_width = mNearbyChatBar->getRect().getWidth();
 	const S32 chatbar_panel_min_width = mNearbyChatBar->getMinWidth();
-	const S32 chatbar_panel_max_width = mNearbyChatBar->getMaxWidth();
+	if (still_should_be_processed && chatbar_panel_width > chatbar_panel_min_width)
+	{
+		// we have some space to decrease chatbar panel
+		S32 panel_delta_min = chatbar_panel_width - chatbar_panel_min_width;
+		mResizeState |= RS_CHATBAR_INPUT;
 
-	// bottom tray is narrowed
-	if (width < getRect().getWidth())
+		S32 delta_panel = llmin(-delta_width, panel_delta_min);
+
+		// is chatbar panel width enough to process resizing?
+		delta_width += panel_delta_min;
+
+
+		still_should_be_processed = delta_width < 0;
+
+		mNearbyChatBar->reshape(mNearbyChatBar->getRect().getWidth() - delta_panel, mNearbyChatBar->getRect().getHeight());
+
+		lldebugs << "RS_CHATBAR_INPUT"
+			<< ", delta_panel: " << delta_panel
+			<< ", delta_width: " << delta_width
+			<< llendl;
+
+		log(mChicletPanel, "after nearby was processed");
+
+	}
+
+	S32 buttons_freed_width = 0;
+	if (still_should_be_processed)
 	{
-		if (chiclet_panel_width > chiclet_panel_min_width)
+		processHideButton(RS_BUTTON_SNAPSHOT, &delta_width, &buttons_freed_width);
+
+		if (delta_width < 0)
 		{
-			mResizeState = STATE_CHICLET_PANEL;
+			processHideButton(RS_BUTTON_CAMERA, &delta_width, &buttons_freed_width);
 		}
-		else if (chatbar_panel_width > chatbar_panel_min_width)
+
+		if (delta_width < 0)
 		{
-			mResizeState = STATE_CHATBAR_INPUT;
+			processHideButton(RS_BUTTON_MOVEMENT, &delta_width, &buttons_freed_width);
 		}
-		else
+
+		if (delta_width < 0)
 		{
-			mResizeState = STATE_BUTTONS;
+			processHideButton(RS_BUTTON_GESTURES, &delta_width, &buttons_freed_width);
+		}
+
+		if (delta_width < 0)
+		{
+			llwarns << "WARNING: there is no enough room for bottom tray, resizing still should be processed" << llendl;
+		}
+
+		if (buttons_freed_width > 0)
+		{
+			log(mNearbyChatBar, "before applying compensative width");
+			mNearbyChatBar->reshape(mNearbyChatBar->getRect().getWidth() + buttons_freed_width, mNearbyChatBar->getRect().getHeight() );
+			log(mNearbyChatBar, "after applying compensative width");
+			lldebugs << buttons_freed_width << llendl;
 		}
 	}
-	// bottom tray is widen
-	else
+}
+
+void LLBottomTray::processWidthIncreased(S32 delta_width)
+{
+	const S32 chiclet_panel_width = mChicletPanel->getParent()->getRect().getWidth();
+	const S32 chiclet_panel_min_width = mChicletPanel->getMinWidth();
+
+	const S32 chatbar_panel_width = mNearbyChatBar->getRect().getWidth();
+	const S32 chatbar_panel_min_width = mNearbyChatBar->getMinWidth();
+	const S32 chatbar_panel_max_width = mNearbyChatBar->getMaxWidth();
+
+	const S32 chatbar_available_shrink_width = chatbar_panel_width - chatbar_panel_min_width;
+	const S32 available_width_chiclet = chiclet_panel_width - chiclet_panel_min_width;
+
+	// how many room we have to show hidden buttons
+	S32 available_width = delta_width + chatbar_available_shrink_width + available_width_chiclet;
+	S32 buttons_required_width = 0; //How many room will take shown buttons
+
+	if (available_width > 0)
+	{
+		lldebugs << "Trying to process: RS_BUTTON_GESTURES" << llendl;
+		processShowButton(RS_BUTTON_GESTURES, &available_width, &buttons_required_width);
+	}
+
+	if (available_width > 0)
+	{
+		lldebugs << "Trying to process: RS_BUTTON_MOVEMENT" << llendl;
+		processShowButton(RS_BUTTON_MOVEMENT, &available_width, &buttons_required_width);
+	}
+
+	if (available_width > 0)
+	{
+		lldebugs << "Trying to process: RS_BUTTON_CAMERA" << llendl;
+		processShowButton(RS_BUTTON_CAMERA, &available_width, &buttons_required_width);
+	}
+
+	if (available_width > 0)
+	{
+		lldebugs << "Trying to process: RS_BUTTON_SNAPSHOT" << llendl;
+		processShowButton(RS_BUTTON_SNAPSHOT, &available_width, &buttons_required_width);
+	}
+
+	// if we have to show some buttons but whidth increasing is not enough...
+	if (buttons_required_width > 0 && delta_width < buttons_required_width)
 	{
-#ifdef __FEATURE_EXT_991__
-		if (!mMovementPanel->getVisible())
+		// ... let's shrink nearby chat & chiclet panels
+		S32 required_to_process_width = buttons_required_width;
+
+		// 1. use delta width of resizing
+		required_to_process_width -= delta_width;
+
+		// 2. use width available via decreasing of nearby chat panel
+		S32 chatbar_shrink_width = required_to_process_width;
+		if (chatbar_available_shrink_width < chatbar_shrink_width)
 		{
-			mResizeState = STATE_BUTTONS;
+			chatbar_shrink_width = chatbar_available_shrink_width;
 		}
-		else
-#endif
-		if (chatbar_panel_width < chatbar_panel_max_width)
+
+		log(mNearbyChatBar, "increase width: before applying compensative width");
+		mNearbyChatBar->reshape(mNearbyChatBar->getRect().getWidth() - chatbar_shrink_width, mNearbyChatBar->getRect().getHeight() );
+		if (mNearbyChatBar)			log(mNearbyChatBar, "after applying compensative width");
+		lldebugs << chatbar_shrink_width << llendl;
+
+		// 3. use width available via decreasing of chiclet panel
+		required_to_process_width -= chatbar_shrink_width;
+
+		if (required_to_process_width > 0)
 		{
-			mResizeState = STATE_CHATBAR_INPUT;
+			mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - required_to_process_width, mChicletPanel->getParent()->getRect().getHeight());
+			log(mChicletPanel, "after applying compensative width for chiclets: ");
+			lldebugs << required_to_process_width << llendl;
 		}
-		else
+
+	}
+
+	// shown buttons take some space, rest should be processed by nearby chatbar & chiclet panels
+	delta_width -= buttons_required_width;
+
+	// how many space can nearby chatbar take?
+	S32 chatbar_panel_width_ = mNearbyChatBar->getRect().getWidth();
+	if (delta_width > 0 && chatbar_panel_width_ < chatbar_panel_max_width)
+	{
+		mResizeState |= RS_CHATBAR_INPUT;
+		S32 delta_panel_max = chatbar_panel_max_width - chatbar_panel_width_;
+		S32 delta_panel = llmin(delta_width, delta_panel_max);
+		delta_width -= delta_panel_max;
+		mNearbyChatBar->reshape(chatbar_panel_width_ + delta_panel, mNearbyChatBar->getRect().getHeight());
+	}
+}
+
+bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* available_width, S32* buttons_required_width)
+{
+	LLPanel* panel = mStateProcessedObjectMap[shown_object_type];
+	if (NULL == panel)
+	{
+		lldebugs << "There is no object to process for state: " << shown_object_type << llendl;
+		return false;
+	}
+	bool can_be_shown = canButtonBeShown(panel);
+	if (can_be_shown)
+	{
+		//validate if we have enough room to show this button
+		const S32 required_width = panel->getRect().getWidth();
+		can_be_shown = *available_width >= required_width;
+		if (can_be_shown)
+		{
+			*available_width -= required_width;
+			*buttons_required_width += required_width;
+
+			showTrayButton(shown_object_type, true);
+
+			lldebugs << "processing object type: " << shown_object_type
+				<< ", buttons_required_width: " << *buttons_required_width
+				<< llendl;
+		}
+	}
+	return can_be_shown;
+}
+
+void LLBottomTray::processHideButton(EResizeState shown_object_type, S32* required_width, S32* buttons_freed_width)
+{
+	LLPanel* panel = mStateProcessedObjectMap[shown_object_type];
+	if (NULL == panel)
+	{
+		lldebugs << "There is no object to process for state: " << shown_object_type << llendl;
+		return;
+	}
+
+	if (panel->getVisible())
+	{
+		*required_width += panel->getRect().getWidth();
+
+		if (*required_width > 0)
 		{
-			mResizeState = STATE_CHICLET_PANEL;
+			*buttons_freed_width += *required_width;
 		}
+
+		showTrayButton(shown_object_type, false);
+
+		lldebugs << "processing object type: " << shown_object_type
+			<< ", buttons_freed_width: " << *buttons_freed_width
+			<< llendl;
 	}
+}
 
+bool LLBottomTray::canButtonBeShown(LLPanel* panel) const
+{
+	bool can_be_shown = !panel->getVisible();
+	if (can_be_shown)
+	{
+		// *TODO: mantipov: synchronize with situation when button was hidden via context menu;
+	}
+	return can_be_shown;
+}
+
+void LLBottomTray::initStateProcessedObjectMap()
+{
+	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_GESTURES, mGesturePanel));
+	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MOVEMENT, mMovementPanel));
+	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_CAMERA, mCamPanel));
+	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SNAPSHOT, mSnapshotPanel));
+}
+
+void LLBottomTray::showTrayButton(EResizeState shown_object_type, bool visible)
+{
+	LLPanel* panel = mStateProcessedObjectMap[shown_object_type];
+	if (NULL == panel)
+	{
+		lldebugs << "There is no object to show for state: " << shown_object_type << llendl;
+		return;
+	}
 
-	// TODO: finish implementation
+	panel->setVisible(visible);
 }
+//EOF
diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h
index 02588a1975f09822182b70ead37219df08b96366..2972a2b1ac78c515377360e1aef4b6b2a2f10c08 100644
--- a/indra/newview/llbottomtray.h
+++ b/indra/newview/llbottomtray.h
@@ -52,6 +52,7 @@ class LLBottomTray
 	, public LLPanel
 	, public LLIMSessionObserver
 {
+	LOG_CLASS(LLBottomTray);
 	friend class LLSingleton<LLBottomTray>;
 public:
 	~LLBottomTray();
@@ -82,18 +83,34 @@ class LLBottomTray
 	void showSnapshotButton(BOOL visible);
 
 private:
-
-	enum EResizeState
+	typedef enum e_resize_status_type
 	{
-		STATE_CHICLET_PANEL = 1,
-		STATE_CHATBAR_INPUT,
-		STATE_BUTTONS
-	};
-
-	void updateResizeState(S32 width, S32 height);
+		  RS_NORESIZE			= 0x0000
+		, RS_CHICLET_PANEL		= 0x0001
+		, RS_CHATBAR_INPUT		= 0x0002
+		, RS_BUTTON_SNAPSHOT	= 0x0004
+		, RS_BUTTON_CAMERA		= 0x0008
+		, RS_BUTTON_MOVEMENT	= 0x0010
+		, RS_BUTTON_GESTURES	= 0x0020
+		, RS_BUTTON_SPEAK		= 0x0040
+		, RS_RESIZABLE_BUTTONS			= /*RS_BUTTON_SNAPSHOT | */RS_BUTTON_CAMERA | RS_BUTTON_MOVEMENT | RS_BUTTON_GESTURES
+	}EResizeState;
+
+	void updateResizeState(S32 new_width, S32 cur_width);
 	void verifyChildControlsSizes();
-
-	EResizeState mResizeState;
+	void processWidthDecreased(S32 delta_width);
+	void processWidthIncreased(S32 delta_width);
+	void log(LLView* panel, const std::string& descr);
+	bool processShowButton(EResizeState shown_object_type, S32* available_width, S32* buttons_required_width);
+	void processHideButton(EResizeState shown_object_type, S32* required_width, S32* buttons_freed_width);
+	bool canButtonBeShown(LLPanel* panel) const;
+	void initStateProcessedObjectMap();
+	void showTrayButton(EResizeState shown_object_type, bool visible);
+
+	MASK mResizeState;
+
+	typedef std::map<EResizeState, LLPanel*> state_object_map_t;
+	state_object_map_t mStateProcessedObjectMap;
 
 protected:
 
diff --git a/indra/newview/llchannelmanager.cpp b/indra/newview/llchannelmanager.cpp
index 642742257264bbd1595b42b29c80ba9408f77b8f..914435b6409d7d6645d6fdaacbace88775d7d9ac 100644
--- a/indra/newview/llchannelmanager.cpp
+++ b/indra/newview/llchannelmanager.cpp
@@ -127,7 +127,7 @@ void LLChannelManager::onLoginCompleted()
 	gViewerWindow->getRootView()->addChild(mStartUpChannel);
 
 	// init channel's position and size
-	S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
+	S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
 	S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
 	mStartUpChannel->init(channel_right_bound - channel_width, channel_right_bound);
 	mStartUpChannel->setMouseDownCallback(boost::bind(&LLSysWellWindow::onStartUpToastClick, LLFloaterReg::getTypedInstance<LLSysWellWindow>("syswell_window"), _2, _3, _4));
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 056f2ee333d7cf8181de13be287d42b3aa03d899..43a1aeaefbb3fd2aaa003d04a0732cfd05529224 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -47,7 +47,6 @@
 #include "llmutelist.h"
 
 static LLDefaultChildRegistry::Register<LLChatHistory> r("chat_history");
-static const std::string MESSAGE_USERNAME_DATE_SEPARATOR(" ----- ");
 
 std::string formatCurrentTime()
 {
@@ -132,7 +131,7 @@ class LLChatHistoryHeader: public LLPanel
 		menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_object_icon.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 		mPopupMenuHandleObject = menu->getHandle();
 
-		setMouseDownCallback(boost::bind(&LLChatHistoryHeader::onHeaderPanelClick, this, _2, _3, _4));
+		setDoubleClickCallback(boost::bind(&LLChatHistoryHeader::onHeaderPanelClick, this, _2, _3, _4));
 
 		return LLPanel::postBuild();
 	}
@@ -175,7 +174,7 @@ class LLChatHistoryHeader: public LLPanel
 	const std::string&	getFirstName() const { return mFirstName; }
 	const std::string&	getLastName	() const { return mLastName; }
 
-	void setup(const LLChat& chat) 
+	void setup(const LLChat& chat,const LLStyle::Params& style_params) 
 	{
 		mAvatarID = chat.mFromID;
 		mSourceType = chat.mSourceType;
@@ -185,8 +184,11 @@ class LLChatHistoryHeader: public LLPanel
 			mSourceType = CHAT_SOURCE_SYSTEM;
 		}
 
-
 		LLTextBox* userName = getChild<LLTextBox>("user_name");
+
+		LLUIColor color = style_params.color;
+		userName->setReadOnlyColor(color);
+		userName->setColor(color);
 		
 		if(!chat.mFromName.empty())
 		{
@@ -198,6 +200,7 @@ class LLChatHistoryHeader: public LLPanel
 			std::string SL = LLTrans::getString("SECOND_LIFE");
 			userName->setValue(SL);
 		}
+
 		
 		LLTextBox* timeBox = getChild<LLTextBox>("time_box");
 		timeBox->setValue(formatCurrentTime());
@@ -323,17 +326,17 @@ LLView* LLChatHistory::getSeparator()
 	return separator;
 }
 
-LLView* LLChatHistory::getHeader(const LLChat& chat)
+LLView* LLChatHistory::getHeader(const LLChat& chat,const LLStyle::Params& style_params)
 {
 	LLChatHistoryHeader* header = LLChatHistoryHeader::createInstance(mMessageHeaderFilename);
-	header->setup(chat);
+	header->setup(chat,style_params);
 	return header;
 }
 
 void LLChatHistory::appendWidgetMessage(const LLChat& chat, LLStyle::Params& style_params)
 {
 	LLView* view = NULL;
-	std::string view_text;
+	std::string view_text = "\n[" + formatCurrentTime() + "] " + chat.mFromName + ": ";
 
 	LLInlineViewSegment::Params p;
 	p.force_newline = true;
@@ -343,14 +346,12 @@ void LLChatHistory::appendWidgetMessage(const LLChat& chat, LLStyle::Params& sty
 	if (mLastFromName == chat.mFromName)
 	{
 		view = getSeparator();
-		view_text = "\n";
 		p.top_pad = mTopSeparatorPad;
 		p.bottom_pad = mBottomSeparatorPad;
 	}
 	else
 	{
-		view = getHeader(chat);
-		view_text = chat.mFromName + MESSAGE_USERNAME_DATE_SEPARATOR + formatCurrentTime() + '\n';
+		view = getHeader(chat,style_params);
 		if (getText().size() == 0)
 			p.top_pad = 0;
 		else
@@ -374,5 +375,4 @@ void LLChatHistory::appendWidgetMessage(const LLChat& chat, LLStyle::Params& sty
 
 	mLastFromName = chat.mFromName;
 	blockUndo();
-	setCursorAndScrollToEnd();
 }
diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h
index 3789ebff4e94273e56fd4c2de55c5a9747790ac4..f0944042afbb3243fd2f14c4746e7291810995e1 100644
--- a/indra/newview/llchathistory.h
+++ b/indra/newview/llchathistory.h
@@ -94,11 +94,9 @@ class LLChatHistory : public LLTextEditor
 		LLView* getSeparator();
 		/**
 		 * Builds a message header.
-		 * @param from owner of a message.
-		 * @param time time of a message.
 		 * @return pointer to LLView header object.
 		 */
-		LLView* getHeader(const LLChat& chat);
+		LLView* getHeader(const LLChat& chat,const LLStyle::Params& style_params);
 
 	public:
 		~LLChatHistory();
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index eda4bfaa78699bc866e3836942f662fc629ca88a..fd861926509e1df0feea03d25e0cdcb31e5dc98b 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -54,10 +54,12 @@ static LLDefaultChildRegistry::Register<LLChicletPanel> t1("chiclet_panel");
 static LLDefaultChildRegistry::Register<LLNotificationChiclet> t2("chiclet_notification");
 static LLDefaultChildRegistry::Register<LLIMP2PChiclet> t3("chiclet_im_p2p");
 static LLDefaultChildRegistry::Register<LLIMGroupChiclet> t4("chiclet_im_group");
+static LLDefaultChildRegistry::Register<LLAdHocChiclet> t5("chiclet_im_adhoc");
 
 static const LLRect CHICLET_RECT(0, 25, 25, 0);
-static const LLRect CHICLET_ICON_RECT(0, 24, 24, 0);
+static const LLRect CHICLET_ICON_RECT(0, 22, 22, 0);
 static const LLRect VOICE_INDICATOR_RECT(25, 25, 45, 0);
+static const S32	OVERLAY_ICON_SHIFT = 2;	// used for shifting of an overlay icon for new massages in a chiclet
 
 // static
 const S32 LLChicletPanel::s_scroll_ratio = 10;
@@ -217,13 +219,15 @@ LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p)
 	icon_params.visible = false;
 	icon_params.image = LLUI::getUIImage(p.new_messages_icon_name);
 	mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
+	addChild(mNewMessagesIcon);
+
 	// adjust size and position of an icon
 	LLRect chiclet_rect = p.rect;
-	LLRect overlay_icon_rect = LLRect(chiclet_rect.getWidth()/2, chiclet_rect.mTop, chiclet_rect.mRight, chiclet_rect.getHeight()/2); 
-	// shift an icon a little bit to the right and up corner of a chiclet
-	overlay_icon_rect.translate(overlay_icon_rect.getWidth()/5, overlay_icon_rect.getHeight()/5);
+	LLRect overlay_icon_rect = LLRect(chiclet_rect.getWidth()/2, chiclet_rect.getHeight(), chiclet_rect.getWidth(), chiclet_rect.getHeight()/2); 
 	mNewMessagesIcon->setRect(overlay_icon_rect);
-	addChild(mNewMessagesIcon);
+	
+	// shift an icon a little bit to the right and up corner of a chiclet
+	overlay_icon_rect.translate(OVERLAY_ICON_SHIFT, OVERLAY_ICON_SHIFT);
 
 	setShowCounter(false);
 }
@@ -423,7 +427,6 @@ void LLIMP2PChiclet::updateMenuItems()
 	bool is_friend = LLAvatarActions::isFriend(getOtherParticipantId());
 
 	mPopupMenu->getChild<LLUICtrl>("Add Friend")->setEnabled(!is_friend);
-	mPopupMenu->getChild<LLUICtrl>("Remove Friend")->setEnabled(is_friend);
 }
 
 BOOL LLIMP2PChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
@@ -602,6 +605,9 @@ BOOL LLAdHocChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
 
 LLIMGroupChiclet::Params::Params()
 : group_icon("group_icon")
+, unread_notifications("unread_notifications")
+, speaker("speaker")
+, show_speaker("show_speaker")
 {
 	rect(CHICLET_RECT);
 
@@ -791,11 +797,13 @@ LLChicletPanel::Params::Params()
 	chiclet_padding = 3;
 	scrolling_offset = 40;
 
+/*
 	if (!min_width.isProvided())
 	{
 		// min_width = 4 chiclets + 3 paddings
-		min_width = 179 + 3*chiclet_padding;
+		min_width = 180 + 3*chiclet_padding;
 	}
+*/
 };
 
 LLChicletPanel::LLChicletPanel(const Params&p)
@@ -809,6 +817,7 @@ LLChicletPanel::LLChicletPanel(const Params&p)
 , mShowControls(true)
 {
 	LLPanel::Params panel_params;
+	panel_params.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT);
 	mScrollArea = LLUICtrlFactory::create<LLPanel>(panel_params,this);
 
 	// important for Show/Hide Camera and Move controls menu in bottom tray to work properly
@@ -819,14 +828,21 @@ LLChicletPanel::LLChicletPanel(const Params&p)
 
 LLChicletPanel::~LLChicletPanel()
 {
+	LLTransientFloaterMgr::getInstance()->removeControlView(mLeftScrollButton);
+	LLTransientFloaterMgr::getInstance()->removeControlView(mRightScrollButton);
 
 }
 
 void im_chiclet_callback(LLChicletPanel* panel, const LLSD& data){
 	
 	LLUUID session_id = data["session_id"].asUUID();
-	S32 unread = data["num_unread"].asInteger();
+	LLUUID from_id = data["from_id"].asUUID();
+	const std::string from = data["from"].asString();
+
+	//we do not show balloon (indicator of new messages) for system messages and our own messages
+	if (from_id.isNull() || from_id == gAgentID || SYSTEM_FROM == from) return;
 
+	S32 unread = data["num_unread"].asInteger();
 	LLIMFloater* im_floater = LLIMFloater::findInstance(session_id);
 	if (im_floater && im_floater->getVisible())
 	{
@@ -875,19 +891,34 @@ BOOL LLChicletPanel::postBuild()
 
 void LLChicletPanel::onCurrentVoiceChannelChanged(const LLUUID& session_id)
 {
-	for(chiclet_list_t::iterator it = mChicletList.begin(); it != mChicletList.end(); ++it)
+	static LLUUID s_previous_active_voice_session_id;
+
+	std::list<LLChiclet*> chiclets = LLIMChiclet::sFindChicletsSignal(session_id);
+
+	for(std::list<LLChiclet *>::iterator it = chiclets.begin(); it != chiclets.end(); ++it)
 	{
 		LLIMChiclet* chiclet = dynamic_cast<LLIMChiclet*>(*it);
 		if(chiclet)
 		{
-			if(chiclet->getSessionId() == session_id)
+			chiclet->setShowSpeaker(true);
+		}
+	}
+
+	if(!s_previous_active_voice_session_id.isNull() && s_previous_active_voice_session_id != session_id)
+	{
+		chiclets = LLIMChiclet::sFindChicletsSignal(s_previous_active_voice_session_id);
+
+		for(std::list<LLChiclet *>::iterator it = chiclets.begin(); it != chiclets.end(); ++it)
+		{
+			LLIMChiclet* chiclet = dynamic_cast<LLIMChiclet*>(*it);
+			if(chiclet)
 			{
-				chiclet->setShowSpeaker(true);
-				continue;
+				chiclet->setShowSpeaker(false);
 			}
-			chiclet->setShowSpeaker(false);
-		}
+		}		
 	}
+
+	s_previous_active_voice_session_id = session_id;
 }
 
 S32 LLChicletPanel::calcChickletPanleWidth()
@@ -1057,7 +1088,7 @@ void LLChicletPanel::reshape(S32 width, S32 height, BOOL called_from_parent )
 		width, scroll_button_rect.mBottom));
 	mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + SCROLL_BUTTON_PAD,
 		height, width - scroll_button_rect.getWidth() - SCROLL_BUTTON_PAD, 0));
-	mShowControls = width > mMinWidth;
+	mShowControls = width >= mMinWidth;
 	mScrollArea->setVisible(mShowControls);
 
 	trimChiclets();
diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp
index 9057d84f63c9a44464a9e80f62f18e0ee0f0559b..20dc4440c243833145c02ee3bf459934dd681467 100644
--- a/indra/newview/lldebugview.cpp
+++ b/indra/newview/lldebugview.cpp
@@ -55,12 +55,16 @@ LLDebugView* gDebugView = NULL;
 //
 // Methods
 //
+static LLDefaultChildRegistry::Register<LLDebugView> r("debug_view");
 
 LLDebugView::LLDebugView(const LLDebugView::Params& p)
 :	LLView(p)
+{}
+
+void LLDebugView::init()
 {
 	LLRect r;
-	LLRect rect(p.rect);
+	LLRect rect = getLocalRect();
 
 	r.set(10, rect.getHeight() - 100, rect.getWidth()/2, 100);
 	LLConsole::Params cp;
@@ -75,16 +79,16 @@ LLDebugView::LLDebugView(const LLDebugView::Params& p)
 
 	r.set(150 - 25, rect.getHeight() - 50, rect.getWidth()/2 - 25, rect.getHeight() - 450);
 
-	r.set(25, rect.getHeight() - 50, (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f), 
-  									 (S32) (gViewerWindow->getVirtualWindowRect().getHeight() * 0.75f));
+	r.set(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f), 
+  									 (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f));
 	mFastTimerView = new LLFastTimerView(r);
 	mFastTimerView->setFollowsTop();
 	mFastTimerView->setFollowsLeft();
 	mFastTimerView->setVisible(FALSE);			// start invisible
 	addChild(mFastTimerView);
 
-	r.set(25, rect.getHeight() - 50, (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f), 
-									 (S32) (gViewerWindow->getVirtualWindowRect().getHeight() * 0.75f));
+	r.set(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f), 
+									 (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f));
 	LLMemoryView::Params mp;
 	mp.name("memory");
 	mp.rect(r);
diff --git a/indra/newview/lldebugview.h b/indra/newview/lldebugview.h
index 9cf2a59a0a7c9de1ad7d74e3fba62ab61c902cd5..b17cdb43cdca670a0856c88b4ef1c0287bd517b3 100644
--- a/indra/newview/lldebugview.h
+++ b/indra/newview/lldebugview.h
@@ -60,6 +60,8 @@ class LLDebugView : public LLView
 	LLDebugView(const Params&);
 	~LLDebugView();
 
+	void init();
+
 	void setStatsVisible(BOOL visible);
 	
 	LLFastTimerView* mFastTimerView;
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 03a3f2b43de2434606adc8c2e7d16d4cb1b127d6..d60330024afedf42cb35e2dd6e08c7a19c141c29 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -89,7 +89,7 @@ LLDynamicArrayPtr<LLPointer<LLDrawable> > LLDrawable::sDeadList;
 void LLDrawable::incrementVisible() 
 {
 	sCurVisible++;
-	sCurPixelAngle = (F32) gViewerWindow->getWindowDisplayHeight()/LLViewerCamera::getInstance()->getView();
+	sCurPixelAngle = (F32) gViewerWindow->getWindowHeightRaw()/LLViewerCamera::getInstance()->getView();
 }
 void LLDrawable::init()
 {
diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp
index 45f4b4fbd04c47edd184a1e806cca80d86eadbe8..3961afe9af22546b381d92bded3da2db159a2a82 100644
--- a/indra/newview/lldriverparam.cpp
+++ b/indra/newview/lldriverparam.cpp
@@ -242,7 +242,7 @@ BOOL LLDriverParam::parseData(LLXmlTreeNode* node)
 }
 #endif
 
-void LLDriverParam::setWeight(F32 weight, BOOL set_by_user)
+void LLDriverParam::setWeight(F32 weight, BOOL upload_bake)
 {
 	F32 min_weight = getMinWeight();
 	F32 max_weight = getMaxWeight();
@@ -301,7 +301,7 @@ void LLDriverParam::setWeight(F32 weight, BOOL set_by_user)
 					driven_weight = driven_min;
 				}
 				
-				setDrivenWeight(driven,driven_weight,set_by_user);
+				setDrivenWeight(driven,driven_weight,upload_bake);
 				continue;
 			}
 			else 
@@ -325,13 +325,13 @@ void LLDriverParam::setWeight(F32 weight, BOOL set_by_user)
 					driven_weight = driven_min;
 				}
 
-				setDrivenWeight(driven,driven_weight,set_by_user);
+				setDrivenWeight(driven,driven_weight,upload_bake);
 				continue;
 			}
 		}
 
 		driven_weight = getDrivenWeight(driven, mCurWeight);
-		setDrivenWeight(driven,driven_weight,set_by_user);
+		setDrivenWeight(driven,driven_weight,upload_bake);
 	}
 }
 
@@ -455,9 +455,9 @@ const LLVector3*	LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_
 //-----------------------------------------------------------------------------
 // setAnimationTarget()
 //-----------------------------------------------------------------------------
-void LLDriverParam::setAnimationTarget( F32 target_value, BOOL set_by_user )
+void LLDriverParam::setAnimationTarget( F32 target_value, BOOL upload_bake )
 {
-	LLVisualParam::setAnimationTarget(target_value, set_by_user);
+	LLVisualParam::setAnimationTarget(target_value, upload_bake);
 
 	for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
 	{
@@ -466,16 +466,16 @@ void LLDriverParam::setAnimationTarget( F32 target_value, BOOL set_by_user )
 
 		// this isn't normally necessary, as driver params handle interpolation of their driven params
 		// but texture params need to know to assume their final value at beginning of interpolation
-		driven->mParam->setAnimationTarget(driven_weight, set_by_user);
+		driven->mParam->setAnimationTarget(driven_weight, upload_bake);
 	}
 }
 
 //-----------------------------------------------------------------------------
 // stopAnimating()
 //-----------------------------------------------------------------------------
-void LLDriverParam::stopAnimating(BOOL set_by_user)
+void LLDriverParam::stopAnimating(BOOL upload_bake)
 {
-	LLVisualParam::stopAnimating(set_by_user);
+	LLVisualParam::stopAnimating(upload_bake);
 
 	for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
 	{
@@ -585,7 +585,7 @@ F32 LLDriverParam::getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight
 	return driven_weight;
 }
 
-void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool set_by_user)
+void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake)
 {
 	LLVOAvatarSelf *avatar_self = gAgent.getAvatarObject();
 	if(mWearablep && 
@@ -593,10 +593,10 @@ void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bo
 	   mWearablep->isOnTop())
 	{
 		// call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values
-		avatar_self->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, set_by_user );
+		avatar_self->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake );
 	}
 	else
 	{
-		driven->mParam->setWeight( driven_weight, set_by_user );
+		driven->mParam->setWeight( driven_weight, upload_bake );
 	}
 }
diff --git a/indra/newview/lldriverparam.h b/indra/newview/lldriverparam.h
index 069e71a2cb3588b5614ff80955bf0f9ceea6fe09..4e2daf5ba79409a76976257e8ea90ff750289c60 100644
--- a/indra/newview/lldriverparam.h
+++ b/indra/newview/lldriverparam.h
@@ -99,9 +99,9 @@ class LLDriverParam : public LLViewerVisualParam
 	// LLVisualParam Virtual functions
 	///*virtual*/ BOOL				parseData(LLXmlTreeNode* node);
 	/*virtual*/ void				apply( ESex sex ) {} // apply is called separately for each driven param.
-	/*virtual*/ void				setWeight(F32 weight, BOOL set_by_user);
-	/*virtual*/ void				setAnimationTarget( F32 target_value, BOOL set_by_user );
-	/*virtual*/ void				stopAnimating(BOOL set_by_user);
+	/*virtual*/ void				setWeight(F32 weight, BOOL upload_bake);
+	/*virtual*/ void				setAnimationTarget( F32 target_value, BOOL upload_bake );
+	/*virtual*/ void				stopAnimating(BOOL upload_bake);
 	/*virtual*/ BOOL				linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params);
 	/*virtual*/ void				resetDrivenParams();
 	
@@ -114,7 +114,7 @@ class LLDriverParam : public LLViewerVisualParam
 	/*virtual*/ const LLVector3*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);
 protected:
 	F32 getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight);
-	void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool set_by_user);
+	void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake);
 
 
 	LLVector3	mDefaultVec; // temp holder
diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp
index e41c4104ebe4000b92ff1c6bcf210d57808872f3..9bc7221dc87487bfe851f8023e8cdcea690f56d6 100644
--- a/indra/newview/lldynamictexture.cpp
+++ b/indra/newview/lldynamictexture.cpp
@@ -126,7 +126,7 @@ void LLViewerDynamicTexture::preRender(BOOL clear_depth)
 		// force rendering to on-screen portion of frame buffer
 		LLCoordScreen window_pos;
 		gViewerWindow->getWindow()->getPosition( &window_pos );
-		mOrigin.set(0, gViewerWindow->getWindowDisplayHeight() - mFullHeight);  // top left corner
+		mOrigin.set(0, gViewerWindow->getWindowHeightRaw() - mFullHeight);  // top left corner
 
 		if (window_pos.mX < 0)
 		{
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index c54b83d8655a139a10fb172939574b2ff8891d26..31f1462a12b72581c09c922b09927c3b861a44e9 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -1403,7 +1403,7 @@ F32 LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
 //the projection of the face partially overlaps with the screen
 F32 LLFace::adjustPartialOverlapPixelArea(F32 cos_angle_to_view_dir, F32 radius )
 {
-	F32 screen_radius = (F32)llmax(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()) ;
+	F32 screen_radius = (F32)llmax(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()) ;
 	F32 center_angle = acosf(cos_angle_to_view_dir) ;
 	F32 d = center_angle * LLDrawable::sCurPixelAngle ;
 
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index 2ab17d622005815fadde7d52321d089ffde26ada..0b27001f10300ae8d32ac585e71c876ba5655860 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -256,7 +256,8 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask)
 
 			LLToolTipMgr::instance().show(LLToolTip::Params()
 				.message(mHoverTimer->getToolTip(LLFastTimer::NamedTimer::HISTORY_NUM - mScrollIndex - mHoverBarIndex))
-				.sticky_rect(screen_rect));
+				.sticky_rect(screen_rect)
+				.delay_time(0.f));
 
 			return TRUE;
 		}
@@ -302,8 +303,8 @@ void LLFastTimerView::draw()
 	F64 iclock_freq = 1000.0 / clock_freq;
 	
 	S32 margin = 10;
-	S32 height = (S32) (gViewerWindow->getVirtualWindowRect().getHeight()*0.75f);
-	S32 width = (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f);
+	S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f);
+	S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f);
 	
 	// HACK: casting away const. Should use setRect or some helper function instead.
 		const_cast<LLRect&>(getRect()).setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height);
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index b01293d17c73ada9fc880c0e8f3f2c5c7cfd8796..80b0a430e0248fc76f95594a80df1bd14b167288 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -64,7 +64,7 @@
 #include "llwindow.h"
 #include "stringize.h"
 #include "llsdutil_math.h"
-#include "lleventdispatcher.h"
+#include "lleventapi.h"
 
 #if LL_WINDOWS
 #include "lldxhardware.h"
@@ -302,13 +302,17 @@ static std::string get_viewer_release_notes_url()
 	return LLWeb::escapeURL(url.str());
 }
 
-class LLFloaterAboutListener: public LLDispatchListener
+class LLFloaterAboutListener: public LLEventAPI
 {
 public:
 	LLFloaterAboutListener():
-		LLDispatchListener("LLFloaterAbout", "op")
+		LLEventAPI("LLFloaterAbout",
+                   "LLFloaterAbout listener to retrieve About box info")
 	{
-		add("getInfo", &LLFloaterAboutListener::getInfo, LLSD().insert("reply", LLSD()));
+		add("getInfo",
+            "Request an LLSD::Map containing information used to populate About box",
+            &LLFloaterAboutListener::getInfo,
+            LLSD().insert("reply", LLSD()));
 	}
 
 private:
diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp
index 262dc1804d3b5e1e1c0c28b89b5c9a1b6d586eab..9ba61ba92f7e1e0cc8943b51191ed8ca4289f546 100644
--- a/indra/newview/llfloaterauction.cpp
+++ b/indra/newview/llfloaterauction.cpp
@@ -188,8 +188,8 @@ void LLFloaterAuction::onClickSnapshot(void* data)
 
 	gForceRenderLandFence = self->childGetValue("fence_check").asBoolean();
 	BOOL success = gViewerWindow->rawSnapshot(raw,
-											  gViewerWindow->getWindowWidth(),
-											  gViewerWindow->getWindowHeight(),
+											  gViewerWindow->getWindowWidthScaled(),
+											  gViewerWindow->getWindowHeightScaled(),
 											  TRUE, FALSE,
 											  FALSE, FALSE);
 	gForceRenderLandFence = FALSE;
diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp
index d941f24f49e0ca81c338306eebb48b51f22974ca..44e68d77455df757c92a665c13c395fc9fa465f3 100644
--- a/indra/newview/llfloatermediasettings.cpp
+++ b/indra/newview/llfloatermediasettings.cpp
@@ -145,13 +145,18 @@ LLFloaterMediaSettings* LLFloaterMediaSettings::getInstance()
 //static 
 void LLFloaterMediaSettings::apply()
 {
-	
     LLSD settings;
+	sInstance->mPanelMediaSettingsGeneral->preApply();
     sInstance->mPanelMediaSettingsGeneral->getValues( settings );
-    sInstance->mPanelMediaSettingsSecurity->getValues( settings );
+	sInstance->mPanelMediaSettingsSecurity->preApply();
+	sInstance->mPanelMediaSettingsSecurity->getValues( settings );
+	sInstance->mPanelMediaSettingsPermissions->preApply();
     sInstance->mPanelMediaSettingsPermissions->getValues( settings );
 	LLSelectMgr::getInstance()->selectionSetMedia( LLTextureEntry::MF_HAS_MEDIA );
     LLSelectMgr::getInstance()->selectionSetMediaData(settings);
+	sInstance->mPanelMediaSettingsGeneral->postApply();
+	sInstance->mPanelMediaSettingsSecurity->postApply();
+	sInstance->mPanelMediaSettingsPermissions->postApply();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 2af1313db45d15a3296ef715cdfb73a597deaf46..4434a8013d6e37936eaf9dcf1cd0769426d91408 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -348,6 +348,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
 	mCommitCallbackRegistrar.add("Pref.AutoDetectAspect",       boost::bind(&LLFloaterPreference::onCommitAutoDetectAspect, this));	
 	mCommitCallbackRegistrar.add("Pref.onSelectAspectRatio",    boost::bind(&LLFloaterPreference::onKeystrokeAspectRatio, this));	
 	mCommitCallbackRegistrar.add("Pref.QualityPerformance",     boost::bind(&LLFloaterPreference::onChangeQuality, this, _2));	
+	mCommitCallbackRegistrar.add("Pref.applyUIColor",			boost::bind(&LLFloaterPreference::applyUIColor, this ,_1, _2));
+	mCommitCallbackRegistrar.add("Pref.getUIColor",				boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2));
 	
 	sSkin = gSavedSettings.getString("SkinCurrent");
 	
@@ -1332,8 +1334,8 @@ void LLFloaterPreference::initWindowSizeControls(LLPanel* panelp)
 	
 	// Look to see if current window size matches existing window sizes, if so then
 	// just set the selection value...
-	const U32 height = gViewerWindow->getWindowDisplayHeight();
-	const U32 width = gViewerWindow->getWindowDisplayWidth();
+	const U32 height = gViewerWindow->getWindowHeightRaw();
+	const U32 width = gViewerWindow->getWindowWidthRaw();
 	for (S32 i=0; i < ctrl_window_size->getItemCount(); i++)
 	{
 		U32 height_test = 0;
@@ -1356,18 +1358,24 @@ void LLFloaterPreference::initWindowSizeControls(LLPanel* panelp)
 }
 
 
+void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param)
+{
+	LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue()));
+}
+
+void LLFloaterPreference::getUIColor(LLUICtrl* ctrl, const LLSD& param)
+{
+	LLColorSwatchCtrl* color_swatch = (LLColorSwatchCtrl*) ctrl;
+	color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString()));
+}
+
 
 //----------------------------------------------------------------------------
 static LLRegisterPanelClassWrapper<LLPanelPreference> t_places("panel_preference");
 LLPanelPreference::LLPanelPreference()
 : LLPanel()
 {
-	mCommitCallbackRegistrar.add("Pref.setControlFalse",		boost::bind(&LLPanelPreference::setControlFalse,this, _2));
-}
-
-static void applyUIColor(const std::string& color_name, LLUICtrl* ctrl, const LLSD& param)
-{
-	LLUIColorTable::instance().setColor(color_name, LLColor4(param));
+	mCommitCallbackRegistrar.add("Pref.setControlFalse",	boost::bind(&LLPanelPreference::setControlFalse,this, _2));
 }
 
 //virtual
@@ -1496,55 +1504,6 @@ BOOL LLPanelPreference::postBuild()
 		refresh();
 	}
 	
-
-	if(hasChild("user") && hasChild("agent") && hasChild("im") 
-	&& hasChild("system") && hasChild("script_error") && hasChild("objects") 
-	&& hasChild("owner") && hasChild("background") && hasChild("links"))
-	{
-		LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("user");
-		color_swatch->setCommitCallback(boost::bind(&applyUIColor, "UserChatColor", _1, _2));
-		color_swatch->setOriginal(LLUIColorTable::instance().getColor("UserChatColor"));
-
-		color_swatch = getChild<LLColorSwatchCtrl>("agent");
-		color_swatch->setCommitCallback(boost::bind(&applyUIColor, "AgentChatColor", _1, _2));
-		color_swatch->setOriginal(LLUIColorTable::instance().getColor("AgentChatColor"));
-
-		color_swatch = getChild<LLColorSwatchCtrl>("im");
-		color_swatch->setCommitCallback(boost::bind(&applyUIColor, "IMChatColor", _1, _2));
-		color_swatch->setOriginal(LLUIColorTable::instance().getColor("IMChatColor"));
-
-		color_swatch = getChild<LLColorSwatchCtrl>("system");
-		color_swatch->setCommitCallback(boost::bind(&applyUIColor, "SystemChatColor", _1, _2));
-		color_swatch->setOriginal(LLUIColorTable::instance().getColor("SystemChatColor"));
-
-		color_swatch = getChild<LLColorSwatchCtrl>("script_error");
-		color_swatch->setCommitCallback(boost::bind(&applyUIColor, "ScriptErrorColor", _1, _2));
-		color_swatch->setOriginal(LLUIColorTable::instance().getColor("ScriptErrorColor"));
-
-		color_swatch = getChild<LLColorSwatchCtrl>("objects");
-		color_swatch->setCommitCallback(boost::bind(&applyUIColor, "ObjectChatColor", _1, _2));
-		color_swatch->setOriginal(LLUIColorTable::instance().getColor("ObjectChatColor"));
-
-		color_swatch = getChild<LLColorSwatchCtrl>("owner");
-		color_swatch->setCommitCallback(boost::bind(&applyUIColor, "llOwnerSayChatColor", _1, _2));
-		color_swatch->setOriginal(LLUIColorTable::instance().getColor("llOwnerSayChatColor"));
-
-		color_swatch = getChild<LLColorSwatchCtrl>("background");
-		color_swatch->setCommitCallback(boost::bind(&applyUIColor, "BackgroundChatColor", _1, _2));
-		color_swatch->setOriginal(LLUIColorTable::instance().getColor("BackgroundChatColor"));
-
-		color_swatch = getChild<LLColorSwatchCtrl>("links");
-		color_swatch->setCommitCallback(boost::bind(&applyUIColor, "HTMLLinkColor", _1, _2));
-		color_swatch->setOriginal(LLUIColorTable::instance().getColor("HTMLLinkColor"));
-	}
-
-	if(hasChild("effect_color_swatch"))
-	{
-		LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("effect_color_swatch");
-		color_swatch->setCommitCallback(boost::bind(&applyUIColor, "EffectColor", _1, _2));
-		color_swatch->setOriginal(LLUIColorTable::instance().getColor("EffectColor"));
-	}
-
 	apply();
 	return true;
 }
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index b1ad0348c0de2b60c8ab16fa91923ff365271eaf..10f39e46f1468351eda053f00f43bcbf61376054 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -133,7 +133,9 @@ class LLFloaterPreference : public LLFloater
 	void onCommitAutoDetectAspect();
 	void applyResolution();
 	void applyWindowSize();
-
+	void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
+	void getUIColor(LLUICtrl* ctrl, const LLSD& param);	
+	
 	static void initWindowSizeControls(LLPanel* panelp);
 	
 	static void buildLists(void* data);
@@ -159,6 +161,7 @@ class LLPanelPreference : public LLPanel
 	virtual void apply();
 	virtual void cancel();
 	void setControlFalse(const LLSD& user_data);
+
 private:
 	typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
 	control_values_map_t mSavedValues;
diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp
index 4375787ea2eb0d4add6f915b6a238bbd4aa165e1..928126bff94626dd183c2639b53441b6f2021b13 100644
--- a/indra/newview/llfloaterproperties.cpp
+++ b/indra/newview/llfloaterproperties.cpp
@@ -900,7 +900,7 @@ LLMultiProperties::LLMultiProperties()
 	{
 		// start with a small rect in the top-left corner ; will get resized
 		LLRect rect;
-		rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeight(), 20, 20);
+		rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeightScaled(), 20, 20);
 		setRect(rect);
 	}
 	setTitle(LLTrans::getString("MultiPropertiesTitle"));
diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp
index 97c573ddea516ecd6f3b777a8c2ffe9605965ccd..e2df2ffdf700a790ca203e626c03dbb72be1893f 100644
--- a/indra/newview/llfloatersearch.cpp
+++ b/indra/newview/llfloatersearch.cpp
@@ -36,6 +36,7 @@
 #include "llmediactrl.h"
 #include "lllogininstance.h"
 #include "lluri.h"
+#include "llagent.h"
 
 LLFloaterSearch::LLFloaterSearch(const LLSD& key) :
 	LLFloater(key),
@@ -122,6 +123,22 @@ void LLFloaterSearch::search(const LLSD &key)
 	LLSD search_token = LLLoginInstance::getInstance()->getResponse("search_token");
 	url += "&p=" + search_token.asString();
 
+	// also append the user's preferred maturity (can be changed via prefs)
+	std::string maturity;
+	if (gAgent.prefersAdult())
+	{
+		maturity = "42";  // PG,Mature,Adult
+	}
+	else if (gAgent.prefersMature())
+	{
+		maturity = "21";  // PG,Mature
+	}
+	else
+	{
+		maturity = "13";  // PG
+	}
+	url += "&r=" + maturity;
+
 	// and load the URL in the web view
 	mBrowser->navigateTo(url);
 }
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index fd2e7b3487a79a99c64b9be94d6c26dacc482357..1cc7042c3a0bb60c645623c5b784efb9113ad459 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -101,6 +101,8 @@ S32 BORDER_WIDTH = 6;
 const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte
 const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512
 
+static LLDefaultChildRegistry::Register<LLSnapshotFloaterView> r("snapshot_floater_view");
+
 ///----------------------------------------------------------------------------
 /// Class LLSnapshotLivePreview 
 ///----------------------------------------------------------------------------
@@ -243,10 +245,10 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Param
 // 	gIdleCallbacks.addFunction( &LLSnapshotLivePreview::onIdle, (void*)this );
 	sList.insert(this);
 	setFollowsAll();
-	mWidth[0] = gViewerWindow->getWindowDisplayWidth();
-	mWidth[1] = gViewerWindow->getWindowDisplayWidth();
-	mHeight[0] = gViewerWindow->getWindowDisplayHeight();
-	mHeight[1] = gViewerWindow->getWindowDisplayHeight();
+	mWidth[0] = gViewerWindow->getWindowWidthRaw();
+	mWidth[1] = gViewerWindow->getWindowWidthRaw();
+	mHeight[0] = gViewerWindow->getWindowHeightRaw();
+	mHeight[1] = gViewerWindow->getWindowHeightRaw();
 	mImageScaled[0] = FALSE;
 	mImageScaled[1] = FALSE;
 
@@ -492,27 +494,27 @@ void LLSnapshotLivePreview::draw()
 			LLLocalClipRect clip(getLocalRect());
 			{
 				// draw diagonal stripe with gradient that passes over screen
-				S32 x1 = gViewerWindow->getWindowWidth() * llround((clamp_rescale(shine_interp, 0.f, 1.f, -1.f - SHINE_WIDTH, 1.f)));
-				S32 x2 = x1 + llround(gViewerWindow->getWindowWidth() * SHINE_WIDTH);
-				S32 x3 = x2 + llround(gViewerWindow->getWindowWidth() * SHINE_WIDTH);
+				S32 x1 = gViewerWindow->getWindowWidthScaled() * llround((clamp_rescale(shine_interp, 0.f, 1.f, -1.f - SHINE_WIDTH, 1.f)));
+				S32 x2 = x1 + llround(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH);
+				S32 x3 = x2 + llround(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH);
 				S32 y1 = 0;
-				S32 y2 = gViewerWindow->getWindowHeight();
+				S32 y2 = gViewerWindow->getWindowHeightScaled();
 
 				gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 				gGL.begin(LLRender::QUADS);
 				{
 					gGL.color4f(1.f, 1.f, 1.f, 0.f);
 					gGL.vertex2i(x1, y1);
-					gGL.vertex2i(x1 + gViewerWindow->getWindowWidth(), y2);
+					gGL.vertex2i(x1 + gViewerWindow->getWindowWidthScaled(), y2);
 					gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY);
-					gGL.vertex2i(x2 + gViewerWindow->getWindowWidth(), y2);
+					gGL.vertex2i(x2 + gViewerWindow->getWindowWidthScaled(), y2);
 					gGL.vertex2i(x2, y1);
 
 					gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY);
 					gGL.vertex2i(x2, y1);
-					gGL.vertex2i(x2 + gViewerWindow->getWindowWidth(), y2);
+					gGL.vertex2i(x2 + gViewerWindow->getWindowWidthScaled(), y2);
 					gGL.color4f(1.f, 1.f, 1.f, 0.f);
-					gGL.vertex2i(x3 + gViewerWindow->getWindowWidth(), y2);
+					gGL.vertex2i(x3 + gViewerWindow->getWindowWidthScaled(), y2);
 					gGL.vertex2i(x3, y1);
 				}
 				gGL.end();
@@ -615,8 +617,8 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize()
 	{
 		return FALSE ;
 	}
-	S32 window_width = gViewerWindow->getWindowDisplayWidth() ;
-	S32 window_height = gViewerWindow->getWindowDisplayHeight() ;
+	S32 window_width = gViewerWindow->getWindowWidthRaw() ;
+	S32 window_height = gViewerWindow->getWindowHeightRaw() ;
 
 	F32 window_aspect_ratio = ((F32)window_width) / ((F32)window_height);
 
@@ -1166,7 +1168,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
 		gSavedSettings.setS32("SnapshotLocalLastResolution", 0);
 
 		LLSnapshotLivePreview* previewp = getPreviewView(floaterp);
-		previewp->setSize(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight());
+		previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
 	}
 
 	bool use_freeze_frame = floaterp->childGetValue("freeze_frame_check").asBoolean();
@@ -1691,7 +1693,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL
 		if (width == 0 || height == 0)
 		{
 			// take resolution from current window size
-			previewp->setSize(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight());
+			previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
 		}
 		else if (width == -1 || height == -1)
 		{
@@ -1844,13 +1846,13 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3
 #endif
 	if(previewp && previewp->mKeepAspectRatio)
 	{
-		if(gViewerWindow->getWindowDisplayWidth() < 1 || gViewerWindow->getWindowDisplayHeight() < 1)
+		if(gViewerWindow->getWindowWidthRaw() < 1 || gViewerWindow->getWindowHeightRaw() < 1)
 		{
 			return FALSE ;
 		}
 
 		//aspect ratio of the current window
-		F32 aspect_ratio = (F32)gViewerWindow->getWindowDisplayWidth() / gViewerWindow->getWindowDisplayHeight() ;
+		F32 aspect_ratio = (F32)gViewerWindow->getWindowWidthRaw() / gViewerWindow->getWindowHeightRaw() ;
 
 		//change another value proportionally
 		if(isWidthChanged)
@@ -2042,10 +2044,12 @@ BOOL LLFloaterSnapshot::postBuild()
 	LLSnapshotLivePreview::Params p;
 	p.rect(full_screen_rect);
 	LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p);
-	getRootView()->removeChild(gSnapshotFloaterView);
+	LLView* parent_view = gSnapshotFloaterView->getParent();
+	
+	parent_view->removeChild(gSnapshotFloaterView);
 	// make sure preview is below snapshot floater
-	getRootView()->addChild(previewp);
-	getRootView()->addChild(gSnapshotFloaterView);
+	parent_view->addChild(previewp);
+	parent_view->addChild(gSnapshotFloaterView);
 	
 	//move snapshot floater to special purpose snapshotfloaterview
 	gFloaterView->removeChild(this);
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index 3aef15a35c0848a0b87889147d2277aedef98be1..3c3dfb760ee32892ee92154048469fd845c30088 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -86,6 +86,7 @@
 #include "llviewermenu.h"
 #include "llviewerparcelmgr.h"
 #include "llviewerwindow.h"
+#include "llvovolume.h"
 #include "lluictrlfactory.h"
 
 // Globals
@@ -1079,21 +1080,45 @@ void LLFloaterTools::getMediaState()
 	}
 	
 	bool editable = (first_object->permModify() || selectedMediaEditable());
-	
+
+	// Check modify permissions and whether any selected objects are in
+	// the process of being fetched.  If they are, then we're not editable
+	if (editable)
+	{
+		LLObjectSelection::iterator iter = selected_objects->begin(); 
+		LLObjectSelection::iterator end = selected_objects->end();
+		for ( ; iter != end; ++iter)
+		{
+			LLSelectNode* node = *iter;
+			LLVOVolume* object = dynamic_cast<LLVOVolume*>(node->getObject());
+			if (NULL != object)
+			{
+				if (!object->permModify() || object->isMediaDataBeingFetched())
+				{
+					editable = false;
+					break;
+				}
+			}
+		}
+	}
+
 	// Media settings
-	U8 has_media = (U8)0;
-	struct media_functor : public LLSelectedTEGetFunctor<U8>
+	bool bool_has_media = false;
+	struct media_functor : public LLSelectedTEGetFunctor<bool>
 	{
-		U8 get(LLViewerObject* object, S32 face)
+		bool get(LLViewerObject* object, S32 face)
 		{
-			return (object->getTE(face)->getMediaTexGen());
+			LLTextureEntry *te = object->getTE(face);
+			if (te)
+			{
+				return te->hasMedia();
+			}
+			return false;
 		}
 	} func;
 	
 	// check if all faces have media(or, all dont have media)
-	LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo = selected_objects->getSelectedTEValue( &func, has_media );
-	bool bool_has_media = (has_media & LLTextureEntry::MF_HAS_MEDIA);
-
+	LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo = selected_objects->getSelectedTEValue( &func, bool_has_media );
 	
 	const LLMediaEntry default_media_data;
 	
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 7863c373c62348b9d203083c8f33772a4a3f6496..21458f83cdbe0757f53783d2b355e9a0970bbe86 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -2174,7 +2174,7 @@ void LLFolderView::updateRenamerPosition()
 		screenPointToLocal( x, y, &x, &y );
 		mRenamer->setOrigin( x, y );
 
-		LLRect scroller_rect(0, 0, gViewerWindow->getWindowWidth(), 0);
+		LLRect scroller_rect(0, 0, gViewerWindow->getWindowWidthScaled(), 0);
 		if (mScrollContainer)
 		{
 			scroller_rect = mScrollContainer->getContentWindowRect();
diff --git a/indra/newview/llhudicon.cpp b/indra/newview/llhudicon.cpp
index eda1d3fc55b8ce6a5bd44169cfb1cf57cf5a017f..040027c70d6e509d59b3b9ebcf20f48a5d773a18 100644
--- a/indra/newview/llhudicon.cpp
+++ b/indra/newview/llhudicon.cpp
@@ -145,8 +145,8 @@ void LLHUDIcon::renderIcon(BOOL for_select)
 	}
 
 	F32 image_aspect = (F32)mImagep->getFullWidth() / (F32)mImagep->getFullHeight() ;
-	LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * x_pixel_vec;
-	LLVector3 y_scale = (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * y_pixel_vec;
+	LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * x_pixel_vec;
+	LLVector3 y_scale = (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * y_pixel_vec;
 
 	LLVector3 lower_left = icon_position - (x_scale * 0.5f);
 	LLVector3 lower_right = icon_position + (x_scale * 0.5f);
@@ -261,8 +261,8 @@ BOOL LLHUDIcon::lineSegmentIntersect(const LLVector3& start, const LLVector3& en
 	}
 	
 	F32 image_aspect = (F32)mImagep->getFullWidth() / (F32)mImagep->getFullHeight() ;
-	LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * x_pixel_vec;
-	LLVector3 y_scale = (F32)gViewerWindow->getWindowHeight() * mScale * scale_factor * y_pixel_vec;
+	LLVector3 x_scale = image_aspect * (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * x_pixel_vec;
+	LLVector3 y_scale = (F32)gViewerWindow->getWindowHeightScaled() * mScale * scale_factor * y_pixel_vec;
 
 	LLVector3 lower_left = icon_position - (x_scale * 0.5f);
 	LLVector3 lower_right = icon_position + (x_scale * 0.5f);
diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp
index 886fe3da0750594c58c79c876c783b505feeffce..ab0be90defa82611b96f3ad214b782b8049da093 100644
--- a/indra/newview/llhudrender.cpp
+++ b/indra/newview/llhudrender.cpp
@@ -77,8 +77,8 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
 	LLVector3 up_axis;
 	if (orthographic)
 	{
-		right_axis.setVec(0.f, -1.f / gViewerWindow->getWorldViewWidth(), 0.f);
-		up_axis.setVec(0.f, 0.f, 1.f / gViewerWindow->getWorldViewHeight());
+		right_axis.setVec(0.f, -1.f / gViewerWindow->getWorldViewWidthRaw(), 0.f);
+		up_axis.setVec(0.f, 0.f, 1.f / gViewerWindow->getWorldViewHeightRaw());
 	}
 	else
 	{
@@ -106,7 +106,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
 	//get the render_pos in screen space
 	
 	F64 winX, winY, winZ;
-	LLRect world_view_rect = gViewerWindow->getWorldViewRect();
+	LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
 	S32	viewport[4];
 	viewport[0] = world_view_rect.mLeft;
 	viewport[1] = world_view_rect.mBottom;
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 55019f91f89d2f1458512c2697646359d4c2c12c..0b5da40be4d5fb74594b2b58457613ccf49a8b54 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -156,8 +156,8 @@ BOOL LLHUDText::lineSegmentIntersect(const LLVector3& start, const LLVector3& en
 	
 	if (mOnHUDAttachment)
 	{
-		x_pixel_vec = LLVector3::y_axis / (F32)gViewerWindow->getWindowWidth();
-		y_pixel_vec = LLVector3::z_axis / (F32)gViewerWindow->getWindowHeight();
+		x_pixel_vec = LLVector3::y_axis / (F32)gViewerWindow->getWindowWidthScaled();
+		y_pixel_vec = LLVector3::z_axis / (F32)gViewerWindow->getWindowHeightScaled();
 	}
 	else
 	{
@@ -316,8 +316,8 @@ void LLHUDText::renderText(BOOL for_select)
 	
 	if (mOnHUDAttachment)
 	{
-		x_pixel_vec = LLVector3::y_axis / (F32)gViewerWindow->getWorldViewWidth();
-		y_pixel_vec = LLVector3::z_axis / (F32)gViewerWindow->getWorldViewHeight();
+		x_pixel_vec = LLVector3::y_axis / (F32)gViewerWindow->getWorldViewWidthRaw();
+		y_pixel_vec = LLVector3::z_axis / (F32)gViewerWindow->getWorldViewHeightRaw();
 	}
 	else
 	{
@@ -351,8 +351,8 @@ void LLHUDText::renderText(BOOL for_select)
 
 	//if (mOnHUD)
 	//{
-	//	render_position.mV[VY] -= fmodf(render_position.mV[VY], 1.f / (F32)gViewerWindow->getWindowWidth());
-	//	render_position.mV[VZ] -= fmodf(render_position.mV[VZ], 1.f / (F32)gViewerWindow->getWindowHeight());
+	//	render_position.mV[VY] -= fmodf(render_position.mV[VY], 1.f / (F32)gViewerWindow->getWindowWidthScaled());
+	//	render_position.mV[VZ] -= fmodf(render_position.mV[VZ], 1.f / (F32)gViewerWindow->getWindowHeightScaled());
 	//}
 	//else
 	//{
@@ -800,7 +800,7 @@ LLVector2 LLHUDText::updateScreenPos(LLVector2 &offset)
 
 	screen_pos_vec.setVec((F32)screen_pos.mX, (F32)screen_pos.mY);
 
-	LLRect world_rect = gViewerWindow->getVirtualWorldViewRect();
+	LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
 	S32 bottom = world_rect.mBottom + STATUS_BAR_HEIGHT;
 
 	LLVector2 screen_center;
@@ -897,7 +897,7 @@ void LLHUDText::updateAll()
 	std::sort(sVisibleHUDTextObjects.begin(), sVisibleHUDTextObjects.end(), lltextobject_further_away());
 
 	// iterate from front to back, and set LOD based on current screen coverage
-	F32 screen_area = (F32)(gViewerWindow->getWindowWidth() * gViewerWindow->getWindowHeight());
+	F32 screen_area = (F32)(gViewerWindow->getWindowWidthScaled() * gViewerWindow->getWindowHeightScaled());
 	F32 current_screen_area = 0.f;
 	std::vector<LLPointer<LLHUDText> >::reverse_iterator r_it;
 	for (r_it = sVisibleTextObjects.rbegin(); r_it != sVisibleTextObjects.rend(); ++r_it)
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 8b44ccebdde1f567719a1bc782f409f8fddd4c48..5ea900e46d9a8fca6eddc041bf711eb98c7cccc9 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -211,6 +211,7 @@ BOOL LLIMFloater::postBuild()
 	}
 
 	mControlPanel->setSessionId(mSessionID);
+	mControlPanel->setVisible(gSavedSettings.getBOOL("IMShowControlPanel"));
 
 	LLButton* slide_left = getChild<LLButton>("slide_left_btn");
 	slide_left->setVisible(mControlPanel->getVisible());
@@ -356,14 +357,12 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
 				LLDockControl::TOP,  boost::bind(&LLIMFloater::getAllowedRect, floater, _1)));
 	}
 
-	floater->childSetVisible("panel_im_control_panel", gSavedSettings.getBOOL("IMShowControlPanel"));
-
 	return floater;
 }
 
 void LLIMFloater::getAllowedRect(LLRect& rect)
 {
-	rect = gViewerWindow->getWorldViewRect();
+	rect = gViewerWindow->getWorldViewRectRaw();
 }
 
 void LLIMFloater::setDocked(bool docked, bool pop_on_undock)
@@ -517,7 +516,7 @@ void LLIMFloater::onInputEditorFocusReceived( LLFocusableElement* caller, void*
 	LLIMModel::LLIMSession* im_session =
 		LLIMModel::instance().findIMSession(self->mSessionID);
 	//TODO: While disabled lllineeditor can receive focus we need to check if it is enabled (EK)
-	if( im_session && im_session->mTextIMPossible && !self->mInputEditor->getEnabled())
+	if( im_session && im_session->mTextIMPossible && self->mInputEditor->getEnabled())
 	{
 		//in disconnected state IM input editor should be disabled
 		self->mInputEditor->setEnabled(!gDisconnected);
diff --git a/indra/newview/llimhandler.cpp b/indra/newview/llimhandler.cpp
index 74971f3fd85d101a345575f2563776e2be1fb654..524a889f972754372cbdfcbd00a91534adb7bbb7 100644
--- a/indra/newview/llimhandler.cpp
+++ b/indra/newview/llimhandler.cpp
@@ -58,7 +58,7 @@ LLIMHandler::~LLIMHandler()
 //--------------------------------------------------------------------------
 void LLIMHandler::initChannel()
 {
-	S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
+	S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
 	S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
 	mChannel->init(channel_right_bound - channel_width, channel_right_bound);
 }
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index e894022e52818193672650d9dfaa4a2fe896c02a..9c38d9c5fc3354f2c6b6437f1e78b4d1fce89f7b 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -439,8 +439,7 @@ bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, co
 	addToHistory(session_id, from, from_id, utf8_text);
 	if (log2file) logToFile(session_id, from, from_id, utf8_text);
 
-	//we do not count system messages
-	if (from_id.notNull()) session->mNumUnread++;
+	session->mNumUnread++;
 
 	// notify listeners
 	LLSD arg;
@@ -850,7 +849,17 @@ bool LLIMModel::sendStartSession(
 	return false;
 }
 
-
+// static
+void LLIMModel::sendSessionInitialized(const LLUUID &session_id)
+{
+	LLIMSession* session = getInstance()->findIMSession(session_id);
+	if (session)
+	{
+		LLSD arg;
+		arg["session_id"] = session_id;
+		getInstance()->mSessionInitializedSignal(arg);
+	}
+}
 
 //
 // Helper Functions
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index bd55bd2c30632ae9f5edb44f280698eaef7068e8..c566b111ca95cb8a061f3d37ba0f26cc7bb50c6a 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -102,6 +102,7 @@ class LLIMModel :  public LLSingleton<LLIMModel>
 	typedef boost::function<void(const LLSD&)> session_callback_t;
 	session_signal_t mNewMsgSignal;
 	session_signal_t mNoUnreadMsgsSignal;
+	session_signal_t mSessionInitializedSignal;
 	
 	/** 
 	 * Find an IM Session corresponding to session_id
@@ -116,6 +117,7 @@ class LLIMModel :  public LLSingleton<LLIMModel>
 
 	boost::signals2::connection addNewMsgCallback( session_callback_t cb ) { return mNewMsgSignal.connect(cb); }
 	boost::signals2::connection addNoUnreadMsgsCallback( session_callback_t cb ) { return mNoUnreadMsgsSignal.connect(cb); }
+	boost::signals2::connection addSessionInitializedCallback(session_callback_t cb ) {	return mSessionInitializedSignal.connect(cb); }
 
 	/**
 	 * Create new session object in a model
@@ -189,6 +191,7 @@ class LLIMModel :  public LLSingleton<LLIMModel>
 	static bool sendStartSession(const LLUUID& temp_session_id, const LLUUID& other_participant_id,
 						  const std::vector<LLUUID>& ids, EInstantMessage dialog);
 	static void sendTypingState(LLUUID session_id, LLUUID other_participant_id, BOOL typing);
+	static void sendSessionInitialized(const LLUUID &session_id);
 	static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id,
 								const LLUUID& other_participant_id, EInstantMessage dialog);
 
diff --git a/indra/newview/llinspectremoteobject.cpp b/indra/newview/llinspectremoteobject.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e4d2eec242bf8bd846498aee5379b449b66a7335
--- /dev/null
+++ b/indra/newview/llinspectremoteobject.cpp
@@ -0,0 +1,200 @@
+/** 
+ * @file llinspectremoteobject.cpp
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llinspectremoteobject.h"
+#include "llinspect.h"
+#include "llslurl.h"
+#include "llmutelist.h"
+#include "llurlaction.h"
+#include "llpanelblockedlist.h"
+#include "llfloaterreg.h"
+#include "llui.h"
+#include "lluictrl.h"
+
+class LLViewerObject;
+
+//////////////////////////////////////////////////////////////////////////////
+// LLInspectRemoteObject
+//////////////////////////////////////////////////////////////////////////////
+
+// Remote Object Inspector, a small information window used to
+// display information about potentially-remote objects. Used
+// to display details about objects sending messages to the user.
+class LLInspectRemoteObject : public LLInspect
+{
+	friend class LLFloaterReg;
+	
+public:
+	LLInspectRemoteObject(const LLSD& object_id);
+	virtual ~LLInspectRemoteObject() {};
+
+	/*virtual*/ BOOL postBuild(void);
+	/*virtual*/ void onOpen(const LLSD& avatar_id);
+
+	void onClickMap();
+	void onClickBlock();
+	void onClickClose();
+	
+private:
+	void update();
+	static void nameCallback(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* data);
+	
+private:
+	LLUUID		 mObjectID;
+	LLUUID		 mOwnerID;
+	std::string  mOwner;
+	std::string  mSLurl;
+	std::string  mName;
+	bool         mGroupOwned;
+};
+
+LLInspectRemoteObject::LLInspectRemoteObject(const LLSD& sd) :
+	LLInspect(LLSD()),
+	mObjectID(NULL),
+	mOwnerID(NULL),
+	mOwner(""),
+	mSLurl(""),
+	mName(""),
+	mGroupOwned(false)
+{
+}
+
+/*virtual*/
+BOOL LLInspectRemoteObject::postBuild(void)
+{
+	// hook up the inspector's buttons
+	getChild<LLUICtrl>("map_btn")->setCommitCallback(
+		boost::bind(&LLInspectRemoteObject::onClickMap, this));
+	getChild<LLUICtrl>("block_btn")->setCommitCallback(
+		boost::bind(&LLInspectRemoteObject::onClickBlock, this));
+	getChild<LLUICtrl>("close_btn")->setCommitCallback(
+		boost::bind(&LLInspectRemoteObject::onClickClose, this));
+
+	return TRUE;
+}
+
+/*virtual*/
+void LLInspectRemoteObject::onOpen(const LLSD& data)
+{
+	// Start animation
+	LLInspect::onOpen(data);
+
+	// Extract appropriate object information from input LLSD
+	// (Eventually, it might be nice to query server for details
+	// rather than require caller to pass in the information.)
+	mObjectID   = data["object_id"].asUUID();
+	mName       = data["name"].asString();
+	mOwnerID    = data["owner_id"].asUUID();
+	mGroupOwned = data["group_owned"].asBoolean();
+	mSLurl      = data["slurl"].asString();
+
+	// work out the owner's name
+	mOwner = "";
+	if (gCacheName)
+	{
+		gCacheName->get(mOwnerID, mGroupOwned, nameCallback, this);
+	}
+
+	// update the inspector with the current object state
+	update();
+
+	// Position the inspector relative to the mouse cursor
+	LLUI::positionViewNearMouse(this);
+}
+
+void LLInspectRemoteObject::onClickMap()
+{
+	std::string url = "secondlife://" + mSLurl;
+	LLUrlAction::showLocationOnMap(url);
+	closeFloater();
+}
+
+void LLInspectRemoteObject::onClickBlock()
+{
+	LLMute::EType mute_type = mGroupOwned ? LLMute::GROUP : LLMute::AGENT;
+	LLMute mute(mOwnerID, mOwner, mute_type);
+	LLMuteList::getInstance()->add(mute);
+	LLPanelBlockedList::showPanelAndSelect(mute.mID);
+	closeFloater();
+}
+
+void LLInspectRemoteObject::onClickClose()
+{
+	closeFloater();
+}
+
+//static 
+void LLInspectRemoteObject::nameCallback(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* data)
+{
+	LLInspectRemoteObject *self = (LLInspectRemoteObject*)data;
+	self->mOwner = first;
+	if (!last.empty())
+	{
+		self->mOwner += " " + last;
+	}
+	self->update();
+}
+
+void LLInspectRemoteObject::update()
+{
+	// show the object name as the inspector's title
+	getChild<LLUICtrl>("object_name")->setValue(mName);
+
+	// show the object's owner - click it to show profile
+	std::string owner = mOwner;
+	if (! mOwnerID.isNull())
+	{
+		if (mGroupOwned)
+		{
+			owner = LLSLURL::buildCommand("group", mOwnerID, "about");
+		}
+		else
+		{
+			owner = LLSLURL::buildCommand("agent", mOwnerID, "about");
+		}
+	}
+	getChild<LLUICtrl>("object_owner")->setValue(owner);
+
+	// display the object's SLurl - click it to teleport
+	std::string url = "secondlife:///app/teleport/" + mSLurl;
+	getChild<LLUICtrl>("object_slurl")->setValue(url);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// LLInspectRemoteObjectUtil
+//////////////////////////////////////////////////////////////////////////////
+void LLInspectRemoteObjectUtil::registerFloater()
+{
+	LLFloaterReg::add("inspect_remote_object", "inspect_remote_object.xml",
+					  &LLFloaterReg::build<LLInspectRemoteObject>);
+}
diff --git a/indra/newview/llinspectremoteobject.h b/indra/newview/llinspectremoteobject.h
new file mode 100644
index 0000000000000000000000000000000000000000..e756f1caf4effb63b725c186417ad22e074345fe
--- /dev/null
+++ b/indra/newview/llinspectremoteobject.h
@@ -0,0 +1,40 @@
+/** 
+ * @file llinspectremoteobject.h
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LLINSPECTREMOTEOBJECT_H
+#define LLINSPECTREMOTEOBJECT_H
+
+namespace LLInspectRemoteObjectUtil
+{
+	void registerFloater();
+}
+
+#endif
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 4b7e364cf9364812fa3f4911f5dc62717796f4a6..e7d7eb19d0ed82167626c5965a18d2a89963cc79 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1271,8 +1271,11 @@ void LLInventoryModel::fetchInventoryResponder::error(U32 status, const std::str
 
 bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id)
 {
-	if(folder_id.isNull()) return false;
-	
+	if(folder_id.isNull()) 
+	{
+		llwarns << "Calling fetch descendents on NULL folder id!" << llendl;
+		return false;
+	}
 	LLViewerInventoryCategory* cat = getCategory(folder_id);
 	if(!cat)
 	{
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index e5f347ddc404696933b6ccc7e78840d67268670d..945294f3f2734980302da7bf106e29b45927641c 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -73,9 +73,9 @@ LLLoginInstance::LLLoginInstance() :
 {
 	mLoginModule->getEventPump().listen("lllogininstance", 
 		boost::bind(&LLLoginInstance::handleLoginEvent, this, _1));
-	mDispatcher.add("fail.login", boost::bind(&LLLoginInstance::handleLoginFailure, this, _1));
-	mDispatcher.add("connect",    boost::bind(&LLLoginInstance::handleLoginSuccess, this, _1));
-	mDispatcher.add("disconnect", boost::bind(&LLLoginInstance::handleDisconnect, this, _1));
+	mDispatcher.add("fail.login", "", boost::bind(&LLLoginInstance::handleLoginFailure, this, _1));
+	mDispatcher.add("connect",    "", boost::bind(&LLLoginInstance::handleLoginSuccess, this, _1));
+	mDispatcher.add("disconnect", "", boost::bind(&LLLoginInstance::handleDisconnect, this, _1));
 }
 
 LLLoginInstance::~LLLoginInstance()
diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp
index f62d7229a31276eab5a7638147b69fc3a74f1cea..fa1dbe0603460d055b7fc0b5e2a72549302a90e1 100644
--- a/indra/newview/llmanip.cpp
+++ b/indra/newview/llmanip.cpp
@@ -265,8 +265,8 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect
 	if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
 	{
 		BOOL result = FALSE;
-		F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidth() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom;
-		F32 mouse_y = ((F32)y / gViewerWindow->getWindowHeight() - 0.5f) / gAgent.mHUDCurZoom;
+		F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidthScaled() - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom;
+		F32 mouse_y = ((F32)y / gViewerWindow->getWindowHeightScaled() - 0.5f) / gAgent.mHUDCurZoom;
 
 		LLVector3 origin_agent = gAgent.getPosAgentFromGlobal(origin);
 		LLVector3 mouse_pos = LLVector3(0.f, -mouse_x, mouse_y);
@@ -304,8 +304,8 @@ BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, co
 
 	if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
 	{
-		F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom;
-		F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.mHUDCurZoom;
+		F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidthScaled()) - 0.5f) * LLViewerCamera::getInstance()->getAspect() / gAgent.mHUDCurZoom;
+		F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeightScaled()) - 0.5f) / gAgent.mHUDCurZoom;
 		a1 = LLVector3(llmin(b1.mV[VX] - 0.1f, b2.mV[VX] - 0.1f, 0.f), -mouse_x, mouse_y);
 		a2 = a1 + LLVector3(1.f, 0.f, 0.f);
 	}
@@ -429,9 +429,9 @@ void LLManip::renderXYZ(const LLVector3 &vec)
 	const S32 PAD = 10;
 	std::string feedback_string;
 	LLVector3 camera_pos = LLViewerCamera::getInstance()->getOrigin() + LLViewerCamera::getInstance()->getAtAxis();
-	S32 vertical_offset = gViewerWindow->getWindowHeight() / 2 - VERTICAL_OFFSET;
-	S32 window_center_x = gViewerWindow->getWindowWidth() / 2;
-	S32 window_center_y = gViewerWindow->getWindowHeight() / 2;
+	S32 vertical_offset = gViewerWindow->getWindowHeightScaled() / 2 - VERTICAL_OFFSET;
+	S32 window_center_x = gViewerWindow->getWindowWidthScaled() / 2;
+	S32 window_center_y = gViewerWindow->getWindowHeightScaled() / 2;
 
 	glPushMatrix();
 	{
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index c99e67be3f24830142148c27c173f14cf80e6dfd..bcaebb6bbb96d6af297fb25fee3e1a4dc17c52b3 100644
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -1107,8 +1107,8 @@ BOOL LLManipRotate::updateVisiblity()
 		mCenterToProfilePlaneMag = mRadiusMeters * mRadiusMeters / mCenterToCamMag;
 		mCenterToProfilePlane = -mCenterToProfilePlaneMag * mCenterToCamNorm;
 
-		mCenterScreen.set((S32)((0.5f - mRotationCenter.mdV[VY]) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewWidth()),
-							(S32)((mRotationCenter.mdV[VZ] + 0.5f) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeight()));
+		mCenterScreen.set((S32)((0.5f - mRotationCenter.mdV[VY]) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewWidthRaw()),
+							(S32)((mRotationCenter.mdV[VZ] + 0.5f) / gAgent.mHUDCurZoom * gViewerWindow->getWorldViewHeightRaw()));
 		visible = TRUE;
 	}
 	else
@@ -1624,8 +1624,8 @@ void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_
 {
 	if (LLSelectMgr::getInstance()->getSelection()->getSelectType() == SELECT_TYPE_HUD)
 	{
-		F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewWidth()) - 0.5f) / gAgent.mHUDCurZoom;
-		F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewHeight()) - 0.5f) / gAgent.mHUDCurZoom;
+		F32 mouse_x = (((F32)x / gViewerWindow->getWorldViewWidthRaw()) - 0.5f) / gAgent.mHUDCurZoom;
+		F32 mouse_y = ((((F32)y) / gViewerWindow->getWorldViewHeightRaw()) - 0.5f) / gAgent.mHUDCurZoom;
 
 		*ray_pt = LLVector3(-1.f, -mouse_x, mouse_y);
 		*ray_dir = LLVector3(1.f, 0.f, 0.f);
@@ -1699,7 +1699,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y )
 	F32 dist_y = mouse_dir_y.normVec();
 	F32 dist_z = mouse_dir_z.normVec();
 
-	F32 distance_threshold = (MAX_MANIP_SELECT_DISTANCE * mRadiusMeters) / gViewerWindow->getWorldViewHeight();
+	F32 distance_threshold = (MAX_MANIP_SELECT_DISTANCE * mRadiusMeters) / gViewerWindow->getWorldViewHeightRaw();
 
 	if (llabs(dist_x - mRadiusMeters) * llmax(0.05f, proj_rot_x_axis) < distance_threshold)
 	{
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index 72596e850a7c043c6d3e09f3498ab4034c1357ab..84a5eb7352be56a0cc3b16e0cefeb23f3a27c64b 100644
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -493,8 +493,9 @@ void LLManipScale::highlightManipulators(S32 x, S32 y)
 			mProjectedManipulators.insert(projManipulator);
 		}
 
-		F32 half_width = (F32)gViewerWindow->getWorldViewWidth() / 2.f;
-		F32 half_height = (F32)gViewerWindow->getWorldViewHeight() / 2.f;
+		LLRect world_view_rect = gViewerWindow->getWorldViewRectScaled();
+		F32 half_width = (F32)world_view_rect.getWidth() / 2.f;
+		F32 half_height = (F32)world_view_rect.getHeight() / 2.f;
 		LLVector2 manip2d;
 		LLVector2 mousePos((F32)x - half_width, (F32)y - half_height);
 		LLVector2 delta;
@@ -1368,7 +1369,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox)
 	else
 	{
 		F32 object_distance = dist_vec(mScaleCenter, LLViewerCamera::getInstance()->getOrigin());
-		mSnapRegimeOffset = (SNAP_GUIDE_SCREEN_OFFSET * gViewerWindow->getWorldViewWidth() * object_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio();
+		mSnapRegimeOffset = (SNAP_GUIDE_SCREEN_OFFSET * gViewerWindow->getWorldViewWidthRaw() * object_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio();
 	}
 	LLVector3 cam_at_axis;
 	F32 snap_guide_length;
@@ -1381,7 +1382,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox)
 	{
 		cam_at_axis = LLViewerCamera::getInstance()->getAtAxis();
 		F32 manipulator_distance = dist_vec(box_corner_agent, LLViewerCamera::getInstance()->getOrigin());
-		snap_guide_length = (SNAP_GUIDE_SCREEN_LENGTH * gViewerWindow->getWorldViewWidth() * manipulator_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio();
+		snap_guide_length = (SNAP_GUIDE_SCREEN_LENGTH * gViewerWindow->getWorldViewWidthRaw() * manipulator_distance) / LLViewerCamera::getInstance()->getPixelMeterRatio();
 	}
 	
 	mSnapGuideLength = snap_guide_length / llmax(0.1f, (llmin(mSnapGuideDir1 * cam_at_axis, mSnapGuideDir2 * cam_at_axis)));
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index f1b3a37677a445fe9a680e902b4da572f30f40ea..932a3d8a83f7509412a16f349eb2f8c48dbeffef 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -413,8 +413,9 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
 	}
 	
 	// Handle auto-rotation if necessary.
+	LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
 	const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD;
-	const S32 ROTATE_H_MARGIN = gViewerWindow->getWorldViewWidth() / 20;
+	const S32 ROTATE_H_MARGIN = world_rect.getWidth() / 20;
 	const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped;
 	BOOL rotated = FALSE;
 
@@ -426,7 +427,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
 			gAgent.cameraOrbitAround(rotate_angle);
 			rotated = TRUE;
 		}
-		else if (x > gViewerWindow->getWorldViewWidth() - ROTATE_H_MARGIN)
+		else if (x > world_rect.getWidth() - ROTATE_H_MARGIN)
 		{
 			gAgent.cameraOrbitAround(-rotate_angle);
 			rotated = TRUE;
@@ -960,8 +961,9 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y)
 	LLVector2 manip_start_2d;
 	LLVector2 manip_end_2d;
 	LLVector2 manip_dir;
-	F32 half_width = gViewerWindow->getWorldViewWidth() / 2.f;
-	F32 half_height = gViewerWindow->getWorldViewHeight() / 2.f;
+	LLRect world_view_rect = gViewerWindow->getWorldViewRectScaled();
+	F32 half_width = (F32)world_view_rect.getWidth() / 2.f;
+	F32 half_height = (F32)world_view_rect.getHeight() / 2.f;
 	LLVector2 mousePos((F32)x - half_width, (F32)y - half_height);
 	LLVector2 mouse_delta;
 
@@ -1225,7 +1227,7 @@ void LLManipTranslate::renderSnapGuides()
 		{
 			LLVector3 cam_to_selection = getPivotPoint() - LLViewerCamera::getInstance()->getOrigin();
 			F32 current_range = cam_to_selection.normVec();
-			guide_size_meters = SNAP_GUIDE_SCREEN_SIZE * gViewerWindow->getWorldViewHeight() * current_range / LLViewerCamera::getInstance()->getPixelMeterRatio();
+			guide_size_meters = SNAP_GUIDE_SCREEN_SIZE * gViewerWindow->getWorldViewHeightRaw() * current_range / LLViewerCamera::getInstance()->getPixelMeterRatio();
 	
 			F32 fraction_of_fov = mAxisArrowLength / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels();
 			F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView();  // radians
@@ -1800,7 +1802,7 @@ void LLManipTranslate::renderTranslationHandles()
 	// Drag handles 	
 	if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
 	{
-		mArrowLengthMeters = mAxisArrowLength / gViewerWindow->getWorldViewHeight();
+		mArrowLengthMeters = mAxisArrowLength / gViewerWindow->getWorldViewHeightRaw();
 		mArrowLengthMeters /= gAgent.mHUDCurZoom;
 	}
 	else
diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp
index 512104a2f420e0b43a14bfa7be77e852dc72ac0f..986c14acff7b3e1384fe9c0a94983324a913a82c 100755
--- a/indra/newview/llmediadataclient.cpp
+++ b/indra/newview/llmediadataclient.cpp
@@ -324,6 +324,22 @@ std::ostream& operator<<(std::ostream &s, const LLMediaDataClient::PriorityQueue
 	return s;
 }
 
+// find the given object in the queue.
+bool LLMediaDataClient::PriorityQueue::find(const LLMediaDataClientObject::ptr_t &obj) const
+{
+	std::vector<LLMediaDataClient::request_ptr_t>::const_iterator iter = c.begin();
+	std::vector<LLMediaDataClient::request_ptr_t>::const_iterator end = c.end();
+	while (iter < end)
+	{
+		if (obj->getID() == (*iter)->getObject()->getID())
+		{
+			return true;
+		}
+		iter++;
+	}
+	return false;
+}
+
 //////////////////////////////////////////////////////////////////////////////////////
 //
 // LLMediaDataClient::QueueTimer
@@ -491,6 +507,11 @@ bool LLMediaDataClient::isEmpty() const
 	return (NULL == pRequestQueue) ? true : pRequestQueue->empty();
 }
 
+bool LLMediaDataClient::isInQueue(const LLMediaDataClientObject::ptr_t &object) const
+{
+	return (NULL == pRequestQueue) ? false : pRequestQueue->find(object);
+}
+
 //////////////////////////////////////////////////////////////////////////////////////
 //
 // LLObjectMediaDataClient
diff --git a/indra/newview/llmediadataclient.h b/indra/newview/llmediadataclient.h
index 9d0aa0981e77cb9a651f2fbf259467374dd838ab..0d1450ffbe53487ee52be734dad6f72b4eb777ca 100755
--- a/indra/newview/llmediadataclient.h
+++ b/indra/newview/llmediadataclient.h
@@ -89,7 +89,10 @@ class LLMediaDataClient : public LLRefCount
 	F32 getRetryTimerDelay() const { return mRetryTimerDelay; }
 	
 	// Returns true iff the queue is empty
-	bool isEmpty() const; 
+	bool isEmpty() const;
+	
+	// Returns true iff the given object is in the queue
+	bool isInQueue(const LLMediaDataClientObject::ptr_t &object) const;
 	
 protected:
 	// Destructor
@@ -206,6 +209,9 @@ class LLMediaDataClient : public LLRefCount
 		Comparator >
 	{
 	public:
+		// Return whether the given object is in the queue
+		bool find(const LLMediaDataClientObject::ptr_t &obj) const;
+		
 		friend std::ostream& operator<<(std::ostream &s, const PriorityQueue &q);
 	};
     
diff --git a/indra/newview/llmemoryview.cpp b/indra/newview/llmemoryview.cpp
index b3aa67733b051c54e8abeb3c58d8b04fab3db4a7..cbe4cef12f8132208271b18bc42ddf30ae283477 100644
--- a/indra/newview/llmemoryview.cpp
+++ b/indra/newview/llmemoryview.cpp
@@ -130,8 +130,8 @@ void LLMemoryView::draw()
 	curUpdate++;
 
 	// setup window properly
-	S32 height = (S32) (gViewerWindow->getVirtualWindowRect().getHeight()*0.75f);
-	S32 width = (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.9f);
+	S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f);
+	S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.9f);
 	setRect(LLRect().setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height));
 	
 	// setup window color
diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp
index 14da35594fb358238a804dae207d4132cc9b95e6..e3ba1b8e4adb3b17a3297a9dc64f17ca691e029a 100644
--- a/indra/newview/llmoveview.cpp
+++ b/indra/newview/llmoveview.cpp
@@ -598,14 +598,11 @@ BOOL LLPanelStandStopFlying::postBuild()
 void LLPanelStandStopFlying::setVisible(BOOL visible)
 {
 	//we dont need to show the panel if these buttons are not activated
-	if (visible && !mStandButton->getVisible() && !mStopFlyingButton->getVisible()) visible = false;
-
 	if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false;
 
 	if (visible)
 	{
 		updatePosition();
-		getParent()->sendChildToFront(this);
 	}
 
 	LLPanel::setVisible(visible);
@@ -638,7 +635,7 @@ LLPanelStandStopFlying* LLPanelStandStopFlying::getStandStopFlyingPanel()
 	LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_stand_stop_flying.xml");
 
 	panel->setVisible(FALSE);
-	LLUI::getRootView()->addChild(panel);
+	//LLUI::getRootView()->addChild(panel);
 
 	llinfos << "Build LLPanelStandStopFlying panel" << llendl;
 
@@ -680,7 +677,7 @@ void LLPanelStandStopFlying::updatePosition()
 	//align centers of a button and a floater
 	S32 x = movement_btn->calcScreenRect().getCenterX() - getRect().getWidth()/2;
 
-	S32 y = tray->getRect().getHeight();
+	S32 y = 0;
 
 	LLFloater *move_floater = LLFloaterReg::findInstance("moveview");
 	if (move_floater)
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index 541db0ca6e1bb2fa02d68e11908b951bebfd9d68..9439717fb851acd4b74275b5986506bb32dfe7c2 100644
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -323,8 +323,8 @@ void LLNameListCtrl::refreshAll(const LLUUID& id, const std::string& first,
 	LLInstanceTracker<LLNameListCtrl>::instance_iter it;
 	for (it = beginInstances(); it != endInstances(); ++it)
 	{
-		LLNameListCtrl* ctrl = *it;
-		ctrl->refresh(id, first, last, is_group);
+		LLNameListCtrl& ctrl = *it;
+		ctrl.refresh(id, first, last, is_group);
 	}
 }
 
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index d38cd28ce26e586f051c81babd925a932e5a32b8..794d73a5adeae0fb5c35c65cedca01b258620664 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -586,6 +586,8 @@ void LLNavigationBar::showNavigationPanel(BOOL visible)
 			// this is duplicated in 'else' section because it should be called BEFORE fb->reshape
 			reshape(nbRect.getWidth(), nbRect.getHeight());
 			setRect(nbRect);
+			// propagate size to parent container
+			getParent()->reshape(nbRect.getWidth(), nbRect.getHeight());
 
 			fb->reshape(fbRect.getWidth(), fbRect.getHeight());
 			fb->setRect(fbRect);
@@ -599,6 +601,7 @@ void LLNavigationBar::showNavigationPanel(BOOL visible)
 
 			reshape(nbRect.getWidth(), nbRect.getHeight());
 			setRect(nbRect);
+			getParent()->reshape(nbRect.getWidth(), nbRect.getHeight());
 		}
 	}
 	else
@@ -613,6 +616,7 @@ void LLNavigationBar::showNavigationPanel(BOOL visible)
 			// this is duplicated in 'else' section because it should be called BEFORE fb->reshape
 			reshape(nbRect.getWidth(), nbRect.getHeight());
 			setRect(nbRect);
+			getParent()->reshape(nbRect.getWidth(), nbRect.getHeight());
 
 			fb->reshape(fbRect.getWidth(), fbRect.getHeight());
 			fb->setRect(fbRect);
@@ -625,16 +629,12 @@ void LLNavigationBar::showNavigationPanel(BOOL visible)
 
 			reshape(nbRect.getWidth(), nbRect.getHeight());
 			setRect(nbRect);
+			getParent()->reshape(nbRect.getWidth(), nbRect.getHeight());
 		}
 	}
 
 	childSetVisible("bg_icon", fpVisible);
 	childSetVisible("bg_icon_no_fav", !fpVisible);
-
-	if(LLSideTray::instanceCreated())
-	{
-		LLSideTray::getInstance()->resetPanelRect();
-	}
 }
 
 void LLNavigationBar::showFavoritesPanel(BOOL visible)
@@ -669,6 +669,7 @@ void LLNavigationBar::showFavoritesPanel(BOOL visible)
 
 		reshape(nbRect.getWidth(), nbRect.getHeight());
 		setRect(nbRect);
+		getParent()->reshape(nbRect.getWidth(), nbRect.getHeight());
 
 		fb->reshape(fbRect.getWidth(), fbRect.getHeight());
 		fb->setRect(fbRect);
@@ -693,14 +694,11 @@ void LLNavigationBar::showFavoritesPanel(BOOL visible)
 
 		reshape(nbRect.getWidth(), nbRect.getHeight());
 		setRect(nbRect);
+		getParent()->reshape(nbRect.getWidth(), nbRect.getHeight());
 	}
 
 	childSetVisible("bg_icon", visible);
 	childSetVisible("bg_icon_no_fav", !visible);
 
 	fb->setVisible(visible);
-	if(LLSideTray::instanceCreated())
-	{
-		LLSideTray::getInstance()->resetPanelRect();
-	}
 }
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index 974291a54e8eaaf30fe54a366d10f0fcd50dab2d..ac806d7106a7aaa01d4422d0dc16d357d99f8130 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -290,7 +290,7 @@ void LLNearbyChat::setRect	(const LLRect &rect)
 
 void LLNearbyChat::getAllowedRect(LLRect& rect)
 {
-	rect = gViewerWindow->getWorldViewRect();
+	rect = gViewerWindow->getWorldViewRectRaw();
 }
 
 
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index d54545971bbb684ef9b304941623e46720b851f6..39934313118de30ce7e915a37b2f5941b0f4c361 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -260,6 +260,8 @@ bool LLNearbyChatBar::instanceExists()
 
 void LLNearbyChatBar::draw()
 {
+// TODO: mantipov: remove
+/*
 	LLRect rect = getRect();
 	S32 max_width = getMaxWidth();
 
@@ -269,6 +271,7 @@ void LLNearbyChatBar::draw()
 		reshape(rect.getWidth(), rect.getHeight(), FALSE);
 		setRect(rect);
 	}
+*/
 
 	displaySpeakingIndicator();
 	LLPanel::draw();
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index 8a8ad9d073fc65b9df128bed5f1f2949eb9a4b84..b4e0ab198af32d9d89c2a4b14882609a7e933ecf 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -122,8 +122,8 @@ class LLNearbyChatScreenChannel: public LLScreenChannelBase
 
 void LLNearbyChatScreenChannel::init(S32 channel_left, S32 channel_right)
 {
-	S32 channel_top = gViewerWindow->getWorldViewRect().getHeight();
-	S32 channel_bottom = gViewerWindow->getWorldViewRect().mBottom;
+	S32 channel_top = gViewerWindow->getWorldViewRectRaw().getHeight();
+	S32 channel_bottom = gViewerWindow->getWorldViewRectRaw().mBottom;
 	setRect(LLRect(channel_left, channel_top, channel_right, channel_bottom));
 	setVisible(TRUE);
 }
@@ -223,7 +223,7 @@ void LLNearbyChatScreenChannel::addNotification(LLSD& notification)
 
 void LLNearbyChatScreenChannel::arrangeToasts()
 {
-	if(m_active_toasts.size() == 0 || mIsHovering)
+	if(m_active_toasts.size() == 0 || isHovering())
 		return;
 
 	hideToastsFromScreen();
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 4286582cdc5b6758b58604fd26f60673d96c0c40..6145588df285092709f34af3b37b9918418b69e6 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -155,11 +155,9 @@ void LLNetMap::draw()
 	F32 rotation = 0;
 
 	{
-		LLGLEnable scissor(GL_SCISSOR_TEST);
-		
+		LLLocalClipRect clip(getLocalRect());
 		{
 			gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-			LLLocalClipRect clip(getLocalRect());
 
 			glMatrixMode(GL_MODELVIEW);
 
diff --git a/indra/newview/llnotificationalerthandler.cpp b/indra/newview/llnotificationalerthandler.cpp
index 1be03cef0b57be4e2f05e28ad5e1954761eaea06..1f68c76bfc3503672bebe6c3f037a4781d3dd054 100644
--- a/indra/newview/llnotificationalerthandler.cpp
+++ b/indra/newview/llnotificationalerthandler.cpp
@@ -66,7 +66,7 @@ LLAlertHandler::~LLAlertHandler()
 //--------------------------------------------------------------------------
 void LLAlertHandler::initChannel()
 {
-	S32 channel_right_bound = gViewerWindow->getWorldViewRect().getWidth() / 2;
+	S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().getWidth() / 2;
 	mChannel->init(channel_right_bound, channel_right_bound);
 }
 
diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp
index ffa92b543cc459344760b7ce7b24effd47fae34d..fc6fb25644a94a12cf2adf281fdf2cc98e391b15 100644
--- a/indra/newview/llnotificationgrouphandler.cpp
+++ b/indra/newview/llnotificationgrouphandler.cpp
@@ -57,7 +57,7 @@ LLGroupHandler::~LLGroupHandler()
 //--------------------------------------------------------------------------
 void LLGroupHandler::initChannel()
 {
-	S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
+	S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
 	S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
 	mChannel->init(channel_right_bound - channel_width, channel_right_bound);
 }
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index 6305ca12aa4b3559743b5cc69337d72f853cd41b..471dd284265f48c2e0bdfd7a8d6e5ba46012da77 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -65,7 +65,7 @@ LLOfferHandler::~LLOfferHandler()
 //--------------------------------------------------------------------------
 void LLOfferHandler::initChannel()
 {
-	S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
+	S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
 	S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
 	mChannel->init(channel_right_bound - channel_width, channel_right_bound);
 }
diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp
index dac7a4ca3a4eecce8a7a83af4305bf813ff3eb0c..70b86e8b976e3c69fed1dce6efb4d38307516ea6 100644
--- a/indra/newview/llnotificationscripthandler.cpp
+++ b/indra/newview/llnotificationscripthandler.cpp
@@ -64,7 +64,7 @@ LLScriptHandler::~LLScriptHandler()
 //--------------------------------------------------------------------------
 void LLScriptHandler::initChannel()
 {
-	S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
+	S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
 	S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
 	mChannel->init(channel_right_bound - channel_width, channel_right_bound);
 }
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index 543198c1d2158c8aa62d92d54465b4a2b95c4f84..823c92a94e377f8813dd28868b8b7f86462d1f29 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -60,7 +60,7 @@ LLTipHandler::~LLTipHandler()
 //--------------------------------------------------------------------------
 void LLTipHandler::initChannel()
 {
-	S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
+	S32 channel_right_bound = gViewerWindow->getWorldViewRectRaw().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); 
 	S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
 	mChannel->init(channel_right_bound - channel_width, channel_right_bound);
 }
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index 88aad4923d67bced285108a9020c3b15cde5aab8..7b5b232ad23e18ed911ece5b825ddbbae31afab3 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -2383,12 +2383,8 @@ BOOL LLPanelGroupActionsSubTab::postBuildSubTab(LLView* root)
 void LLPanelGroupActionsSubTab::activate()
 {
 	LLPanelGroupSubTab::activate();
-	lldebugs << "LLPanelGroupActionsSubTab::activate()" << llendl;
 
-	mActionList->deselectAllItems();
-	mActionMembers->deleteAllItems();
-	mActionRoles->deleteAllItems();
-	mActionDescription->clear();
+	update(GC_ALL);
 }
 
 void LLPanelGroupActionsSubTab::deactivate()
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp
index 350b78ee3daf3c5a70ce5e64546d65158f0863b2..1770138b3ec648089a93f86b8a7d74c17122c7f5 100644
--- a/indra/newview/llpanelimcontrolpanel.cpp
+++ b/indra/newview/llpanelimcontrolpanel.cpp
@@ -92,6 +92,14 @@ void LLPanelChatControlPanel::draw()
 		&& callback_enabled;
 	childSetEnabled("call_btn", enable_connect);
 
+	// send a signal when the floater is fully initialized
+	// this lets LLAvatarActions::startAdhocCall() start the call
+	if (enable_connect && !mInitialized)
+	{
+		LLIMModel::sendSessionInitialized(mSessionId);
+		mInitialized = true;
+	}
+
 	LLPanel::draw();
 }
 
@@ -173,7 +181,14 @@ void LLPanelIMControlPanel::setSessionId(const LLUUID& session_id)
 	LLIMModel::LLIMSession* im_session =
 		im_model.findIMSession(session_id);
 	if( im_session && !im_session->mOtherParticipantIsAvatar )
+	{
 		childSetEnabled("view_profile_btn", FALSE);
+		childSetEnabled("add_friend_btn", FALSE);
+
+		childSetEnabled("share_btn", FALSE);
+		childSetEnabled("teleport_btn", FALSE);
+		childSetEnabled("pay_btn", FALSE);
+	}
 }
 
 void LLPanelIMControlPanel::nameUpdatedCallback(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group)
diff --git a/indra/newview/llpanelimcontrolpanel.h b/indra/newview/llpanelimcontrolpanel.h
index a0d3420d231b66afd076dfd0f007acf10fd58230..923c5acbd217d53f2ba232d850510753d5af26a0 100644
--- a/indra/newview/llpanelimcontrolpanel.h
+++ b/indra/newview/llpanelimcontrolpanel.h
@@ -43,7 +43,9 @@ class LLParticipantList;
 class LLPanelChatControlPanel : public LLPanel
 {
 public:
-	LLPanelChatControlPanel() {};
+	LLPanelChatControlPanel() :
+		mSessionId(LLUUID()),
+		mInitialized(false) {};
 	~LLPanelChatControlPanel() {};
 
 	virtual BOOL postBuild();
@@ -59,6 +61,7 @@ class LLPanelChatControlPanel : public LLPanel
 
 private:
 	LLUUID mSessionId;
+	bool   mInitialized;
 };
 
 
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 5d826f0a561c895cc1c0e99ff12915c46db17266..b3e14eb2fb8cb5f83291a8164e7776776a4d5157 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -310,7 +310,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 void LLPanelLogin::reshapeBrowser()
 {
 	LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("login_html");
-	LLRect rect = gViewerWindow->getVirtualWindowRect();
+	LLRect rect = gViewerWindow->getWindowRectScaled();
 	LLRect html_rect;
 #if USE_VIEWER_AUTH
 	html_rect.setCenterAndSize( 
diff --git a/indra/newview/llpanelmediasettingsgeneral.cpp b/indra/newview/llpanelmediasettingsgeneral.cpp
index 5186a5888b16a97e772a85365a955fa3ad754440..2cf56d557117d29d95b611d18c79a22d62be6a6c 100644
--- a/indra/newview/llpanelmediasettingsgeneral.cpp
+++ b/indra/newview/llpanelmediasettingsgeneral.cpp
@@ -366,21 +366,15 @@ void LLPanelMediaSettingsGeneral::onCommitHomeURL( LLUICtrl* ctrl, void *userdat
 void LLPanelMediaSettingsGeneral::onBtnResetCurrentUrl(LLUICtrl* ctrl, void *userdata)
 {
 	LLPanelMediaSettingsGeneral* self =(LLPanelMediaSettingsGeneral *)userdata;
-	self->navigateHomeSelectedFace();
+	self->navigateHomeSelectedFace(false);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// static
-void LLPanelMediaSettingsGeneral::apply( void* userdata )
+// 
+void LLPanelMediaSettingsGeneral::preApply()
 {
-	LLPanelMediaSettingsGeneral *self =(LLPanelMediaSettingsGeneral *)userdata;
-	self->mHomeURL->onCommit();
-	// build LLSD Fragment
-	LLSD media_data_general;
-	self->getValues(media_data_general);
-
-	// this merges contents of LLSD passed in with what's there so this is ok
-	LLSelectMgr::getInstance()->selectionSetMediaData( media_data_general );
+	// Make sure the home URL entry is committed
+	mHomeURL->onCommit();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -392,13 +386,24 @@ void LLPanelMediaSettingsGeneral::getValues( LLSD &fill_me_in )
     fill_me_in[LLMediaEntry::AUTO_SCALE_KEY] = mAutoScale->getValue();
     fill_me_in[LLMediaEntry::AUTO_ZOOM_KEY] = mAutoZoom->getValue();
     fill_me_in[LLMediaEntry::CONTROLS_KEY] = mControls->getCurrentIndex();
-    fill_me_in[LLMediaEntry::CURRENT_URL_KEY] = mCurrentURL->getValue();
+    //Don't fill in current URL: this is only supposed to get changed via navigate
+	// fill_me_in[LLMediaEntry::CURRENT_URL_KEY] = mCurrentURL->getValue();
     fill_me_in[LLMediaEntry::HEIGHT_PIXELS_KEY] = mHeightPixels->getValue();
     fill_me_in[LLMediaEntry::HOME_URL_KEY] = mHomeURL->getValue();
     fill_me_in[LLMediaEntry::FIRST_CLICK_INTERACT_KEY] = mFirstClick->getValue();
     fill_me_in[LLMediaEntry::WIDTH_PIXELS_KEY] = mWidthPixels->getValue();
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// 
+void LLPanelMediaSettingsGeneral::postApply()
+{	
+	// Make sure to navigate to the home URL if the current URL is empty and 
+	// autoplay is on
+	navigateHomeSelectedFace(true);
+}
+
+
 ////////////////////////////////////////////////////////////////////////////////
 //
 void LLPanelMediaSettingsGeneral::setParent( LLFloaterMediaSettings* parent )
@@ -406,33 +411,37 @@ void LLPanelMediaSettingsGeneral::setParent( LLFloaterMediaSettings* parent )
 	mParent = parent;
 };
 
-bool LLPanelMediaSettingsGeneral::navigateHomeSelectedFace()
+////////////////////////////////////////////////////////////////////////////////
+//
+bool LLPanelMediaSettingsGeneral::navigateHomeSelectedFace(bool only_if_current_is_empty)
 {
-	// HACK: This is directly referencing an impl name.  BAD!
-	// This can be removed when we have a truly generic media browser that only 
-	// builds an impl based on the type of url it is passed.
 	struct functor_navigate_media : public LLSelectedTEGetFunctor< bool>
 	{
+		functor_navigate_media(bool flag) : only_if_current_is_empty(flag) {}
 		bool get( LLViewerObject* object, S32 face )
 		{
-			if ( object )
-				if ( object->getTE(face) )
-					if ( object->getTE(face)->getMediaData() )
+			if ( object && object->getTE(face) && object->permModify() )
+			{
+				const LLMediaEntry *media_data = object->getTE(face)->getMediaData();
+				if ( media_data )
+				{	
+					if (!only_if_current_is_empty || (media_data->getCurrentURL().empty() && media_data->getAutoPlay()))
 					{
-						if(object->permModify())
+						viewer_media_t media_impl =
+							LLViewerMedia::getMediaImplFromTextureID(object->getTE(face)->getMediaData()->getMediaID());
+						if(media_impl)
 						{
-							viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(object->getTE(face)->getMediaData()->getMediaID());
-							if(media_impl)
-							{
-								media_impl->navigateHome();
-								return true;
-							}
-						}	
+							media_impl->navigateHome();
+							return true;
+						}
 					}
-		   return false;
-		 };
+				}
+			}
+			return false;
+		};
+		bool only_if_current_is_empty;
 				
-	} functor_navigate_media;
+	} functor_navigate_media(only_if_current_is_empty);
 	
 	bool all_face_media_navigated = false;
 	LLObjectSelectionHandle selected_objects =LLSelectMgr::getInstance()->getSelection();
diff --git a/indra/newview/llpanelmediasettingsgeneral.h b/indra/newview/llpanelmediasettingsgeneral.h
index b48e081a1b53b8498137cbed424ee3a166aa87b5..f8b8f0d224af7c53e05a71e4f2674464226eb432 100644
--- a/indra/newview/llpanelmediasettingsgeneral.h
+++ b/indra/newview/llpanelmediasettingsgeneral.h
@@ -47,21 +47,30 @@ class LLFloaterMediaSettings;
 class LLPanelMediaSettingsGeneral : public LLPanel
 {
 public:
+	LLPanelMediaSettingsGeneral();
+	~LLPanelMediaSettingsGeneral();
+	
+	// XXX TODO: put these into a common parent class?
+	// Hook that the floater calls before applying changes from the panel
+	void preApply();
+	// Function that asks the panel to fill in values associated with the panel
+    void getValues(LLSD &fill_me_in);
+	// Hook that the floater calls after applying changes to the panel
+	void postApply();
+	
 	BOOL postBuild();
 	/*virtual*/ void draw();
 	/*virtual*/ void onClose(bool app_quitting);
 
-	static void apply(void*);
-    void getValues(LLSD &fill_me_in);
-
-	LLPanelMediaSettingsGeneral();
-	~LLPanelMediaSettingsGeneral();
-
 	void setParent( LLFloaterMediaSettings* parent );
 	static void initValues( void* userdata, const LLSD& media_settings ,bool editable);
 	static void clearValues( void* userdata, bool editable);
 	
-	bool navigateHomeSelectedFace();
+	// Navigates the current selected face to the Home URL.
+	// If 'only_if_current_is_empty' is "true", it only performs
+	// the operation if: 1) the current URL is empty, and 2) auto play is true.
+	bool navigateHomeSelectedFace(bool only_if_current_is_empty);
+	
 	void updateMediaPreview();
 
 	const std::string getHomeUrl();
diff --git a/indra/newview/llpanelmediasettingspermissions.cpp b/indra/newview/llpanelmediasettingspermissions.cpp
index 4d84874e7a8baf0198622626154b42db28745597..2f3f550e35baf2a6bf47df8b1cf2aeca37d4181d 100644
--- a/indra/newview/llpanelmediasettingspermissions.cpp
+++ b/indra/newview/llpanelmediasettingspermissions.cpp
@@ -218,17 +218,10 @@ void LLPanelMediaSettingsPermissions::initValues( void* userdata, const LLSD& me
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// static
-void LLPanelMediaSettingsPermissions::apply( void* userdata )
+// 
+void LLPanelMediaSettingsPermissions::preApply()
 {
-    LLPanelMediaSettingsPermissions *self =(LLPanelMediaSettingsPermissions *)userdata;
-
-    // build LLSD Fragment
-    LLSD media_data_permissions;
-    self->getValues(media_data_permissions);
-
-    // this merges contents of LLSD passed in with what's there so this is ok
-    LLSelectMgr::getInstance()->selectionSetMediaData( media_data_permissions );
+    // no-op
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -254,3 +247,11 @@ void LLPanelMediaSettingsPermissions::getValues( LLSD &fill_me_in )
     fill_me_in[LLMediaEntry::PERMS_CONTROL_KEY] = control;
     fill_me_in[LLMediaEntry::PERMS_INTERACT_KEY] = interact;
 }
+
+
+////////////////////////////////////////////////////////////////////////////////
+// 
+void LLPanelMediaSettingsPermissions::postApply()
+{
+    // no-op
+}
diff --git a/indra/newview/llpanelmediasettingspermissions.h b/indra/newview/llpanelmediasettingspermissions.h
index ecc50e3582683fae70c0f39ad20401c0f6712591..45a596c615ece82b0940aabf2ed1051c163c0483 100644
--- a/indra/newview/llpanelmediasettingspermissions.h
+++ b/indra/newview/llpanelmediasettingspermissions.h
@@ -46,26 +46,32 @@ class LLNameBox;
 
 class LLPanelMediaSettingsPermissions : public LLPanel
 {
-	public:
-		BOOL postBuild();
-		virtual void draw();
-		static void apply(void*);
-        void getValues(LLSD &fill_me_in);
-
-		LLPanelMediaSettingsPermissions();
-		~LLPanelMediaSettingsPermissions();
-
-		static void initValues( void* userdata, const LLSD& media_settings, bool editable );
-		static void clearValues( void* userdata,  bool editable);
-
-	private:
-        LLCheckBoxCtrl* mPermsOwnerInteract;
-		LLCheckBoxCtrl* mPermsOwnerControl;
-		LLNameBox* mPermsGroupName;
-		LLCheckBoxCtrl* mPermsGroupInteract;
-		LLCheckBoxCtrl* mPermsGroupControl;
-		LLCheckBoxCtrl* mPermsWorldInteract;
-		LLCheckBoxCtrl* mPermsWorldControl;
+public:
+	LLPanelMediaSettingsPermissions();
+	~LLPanelMediaSettingsPermissions();
+	
+	BOOL postBuild();
+	virtual void draw();
+	
+	// XXX TODO: put these into a common parent class?
+	// Hook that the floater calls before applying changes from the panel
+	void preApply();
+	// Function that asks the panel to fill in values associated with the panel
+    void getValues(LLSD &fill_me_in);
+	// Hook that the floater calls after applying changes to the panel
+	void postApply();
+	
+	static void initValues( void* userdata, const LLSD& media_settings, bool editable );
+	static void clearValues( void* userdata,  bool editable);
+	
+private:
+	LLCheckBoxCtrl* mPermsOwnerInteract;
+	LLCheckBoxCtrl* mPermsOwnerControl;
+	LLNameBox* mPermsGroupName;
+	LLCheckBoxCtrl* mPermsGroupInteract;
+	LLCheckBoxCtrl* mPermsGroupControl;
+	LLCheckBoxCtrl* mPermsWorldInteract;
+	LLCheckBoxCtrl* mPermsWorldControl;
 };
 
 #endif  // LL_LLPANELMEDIAMEDIASETTINGSPERMISSIONS_H
diff --git a/indra/newview/llpanelmediasettingssecurity.cpp b/indra/newview/llpanelmediasettingssecurity.cpp
index 3577f63340f267dc33a8eac84f5ee0115f5bd435..bec2494eac9b589d67fe20d5bad5c7060c817069 100644
--- a/indra/newview/llpanelmediasettingssecurity.cpp
+++ b/indra/newview/llpanelmediasettingssecurity.cpp
@@ -198,17 +198,12 @@ void LLPanelMediaSettingsSecurity::clearValues( void* userdata , bool editable)
 	self->mEnableWhiteList->setEnabled(editable);
 	self->mWhiteListList->setEnabled(editable);
 }
+
 ////////////////////////////////////////////////////////////////////////////////
-// static
-void LLPanelMediaSettingsSecurity::apply( void* userdata )
+// 
+void LLPanelMediaSettingsSecurity::preApply()
 {
-	LLPanelMediaSettingsSecurity *self =(LLPanelMediaSettingsSecurity *)userdata;
-
-	// build LLSD Fragment
-	LLSD media_data_security;
-	self->getValues(media_data_security);
-	// this merges contents of LLSD passed in with what's there so this is ok
-	LLSelectMgr::getInstance()->selectionSetMediaData( media_data_security );
+	// no-op
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -220,7 +215,9 @@ void LLPanelMediaSettingsSecurity::getValues( LLSD &fill_me_in )
     // iterate over white list and extract items
     std::vector< LLScrollListItem* > white_list_items = mWhiteListList->getAllData();
     std::vector< LLScrollListItem* >::iterator iter = white_list_items.begin();
-    fill_me_in[LLMediaEntry::WHITELIST_KEY].clear();
+	// *NOTE: need actually set the key to be an emptyArray(), or the merge
+	// we do with this LLSD will think there's nothing to change.
+    fill_me_in[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray();
     while( iter != white_list_items.end() )
     {
         std::string white_list_url = (*iter)->getValue().asString();
@@ -229,23 +226,30 @@ void LLPanelMediaSettingsSecurity::getValues( LLSD &fill_me_in )
     };
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// 
+void LLPanelMediaSettingsSecurity::postApply()
+{
+	// no-op
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 // Try to make a valid URL if a fragment (
 // white list list box widget and build a list to test against. Can also
 const std::string LLPanelMediaSettingsSecurity::makeValidUrl( const std::string& src_url )
 {
 	// use LLURI to determine if we have a valid scheme
-	LLURI candidate_url( src_url );
-	if ( candidate_url.scheme().empty() )
-	{
+	LLURI candidate_url( src_url );
+	if ( candidate_url.scheme().empty() )
+	{
 		// build a URL comprised of default scheme and the original fragment 
 		const std::string default_scheme( "http://" );
 		return default_scheme + src_url;
-	};
-
-	// we *could* test the "default scheme" + "original fragment" URL again
-	// using LLURI to see if it's valid but I think the outcome is the same
-	// in either case - our only option is to return the original URL
+	};
+
+	// we *could* test the "default scheme" + "original fragment" URL again
+	// using LLURI to see if it's valid but I think the outcome is the same
+	// in either case - our only option is to return the original URL
 
 	// we *think* the original url passed in was valid
 	return src_url;
@@ -332,10 +336,10 @@ void LLPanelMediaSettingsSecurity::onBtnDel( void* userdata )
 	self->mWhiteListList->deleteSelectedItems();
 }
 
-////////////////////////////////////////////////////////////////////////////////
-//
-void LLPanelMediaSettingsSecurity::setParent( LLFloaterMediaSettings* parent )
-{
-	mParent = parent;
-};
-
+////////////////////////////////////////////////////////////////////////////////
+//
+void LLPanelMediaSettingsSecurity::setParent( LLFloaterMediaSettings* parent )
+{
+	mParent = parent;
+};
+
diff --git a/indra/newview/llpanelmediasettingssecurity.h b/indra/newview/llpanelmediasettingssecurity.h
index 2555bb8dc8546904ee646367d12a42c38d5fc389..638664e59d74015393598a6f1aaf8f4567d6e7a8 100644
--- a/indra/newview/llpanelmediasettingssecurity.h
+++ b/indra/newview/llpanelmediasettingssecurity.h
@@ -41,31 +41,37 @@ class LLFloaterMediaSettings;
 
 class LLPanelMediaSettingsSecurity : public LLPanel
 {
-	public:
-		BOOL postBuild();
-		virtual void draw();
-		static void apply(void*);
-        void getValues(LLSD &fill_me_in);
-
-		LLPanelMediaSettingsSecurity();
-		~LLPanelMediaSettingsSecurity();
-
-		static void initValues( void* userdata, const LLSD& media_settings,bool editable );
-		static void clearValues( void* userdata, bool editable);
-		void addWhiteListItem(const std::string& url);
-		void setParent( LLFloaterMediaSettings* parent );
-		const std::string makeValidUrl( const std::string& src_url );
-		bool passesWhiteList( const std::string& added_url, const std::string& test_url );
-
-	protected:
-		LLFloaterMediaSettings* mParent;
-
-	private:
-		LLCheckBoxCtrl* mEnableWhiteList;
-		LLScrollListCtrl* mWhiteListList;
-
-		static void onBtnAdd(void*);
-		static void onBtnDel(void*);
+public:
+	LLPanelMediaSettingsSecurity();
+	~LLPanelMediaSettingsSecurity();
+	
+	BOOL postBuild();
+	virtual void draw();	
+	
+	// XXX TODO: put these into a common parent class?
+	// Hook that the floater calls before applying changes from the panel
+	void preApply();
+	// Function that asks the panel to fill in values associated with the panel
+    void getValues(LLSD &fill_me_in);
+	// Hook that the floater calls after applying changes to the panel
+	void postApply();
+	
+	static void initValues( void* userdata, const LLSD& media_settings,bool editable );
+	static void clearValues( void* userdata, bool editable);
+	void addWhiteListItem(const std::string& url);
+	void setParent( LLFloaterMediaSettings* parent );
+	const std::string makeValidUrl( const std::string& src_url );
+	bool passesWhiteList( const std::string& added_url, const std::string& test_url );
+	
+protected:
+	LLFloaterMediaSettings* mParent;
+	
+private:
+	LLCheckBoxCtrl* mEnableWhiteList;
+	LLScrollListCtrl* mWhiteListList;
+	
+	static void onBtnAdd(void*);
+	static void onBtnDel(void*);
 };
 
 #endif  // LL_LLPANELMEDIAMEDIASETTINGSSECURITY_H
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 005a00df75c98bfd91e2b9f916e8cbe19160ce52..9ba94c8ca98eec7c08a3b6e5a4facdb90f27e3f4 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -275,7 +275,8 @@ class LLFriendListUpdater : public LLAvatarListUpdater, public LLFriendObserver
 
 	~LLFriendListUpdater()
 	{
-		delete mInvObserver;
+		// will be deleted by ~LLInventoryModel
+		//delete mInvObserver;
 		LLVoiceClient::getInstance()->removeObserver(this);
 		LLAvatarTracker::instance().removeObserver(this);
 	}
@@ -754,7 +755,7 @@ void LLPanelPeople::updateButtons()
 	buttonSetEnabled("teleport_btn",		friends_tab_active && item_selected && isFriendOnline(selected_uuids.front()));
 	buttonSetEnabled("view_profile_btn",	item_selected);
 	buttonSetEnabled("im_btn",				multiple_selected); // allow starting the friends conference for multiple selection
-	buttonSetEnabled("call_btn",			item_selected);
+	buttonSetEnabled("call_btn",			multiple_selected);
 	buttonSetEnabled("share_btn",			item_selected && false); // not implemented yet
 
 	bool none_group_selected = item_selected && selected_id.isNull();
@@ -1192,11 +1193,12 @@ void LLPanelPeople::onCallButtonClicked()
 	if (selected_uuids.size() == 1)
 	{
 		// initiate a P2P voice chat with the selected user
-		LLAvatarActions::startCall(getCurrentItemID());
+		LLAvatarActions::startCall(selected_uuids[0]);
 	}
 	else if (selected_uuids.size() > 1)
 	{
-		// *NOTE: ad-hoc voice chat not implemented yet
+		// initiate an ad-hoc voice chat with multiple users
+		LLAvatarActions::startAdhocCall(selected_uuids);
 	}
 }
 
diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp
index aaf6849fe94128f50226b54307259a3c14adb4c9..7dea5eaf6758539380d33b2aa694c8a98a103f20 100644
--- a/indra/newview/llpanelpeoplemenus.cpp
+++ b/indra/newview/llpanelpeoplemenus.cpp
@@ -64,7 +64,6 @@ void ContextMenu::show(LLView* spawning_view, const std::vector<LLUUID>& uuids,
 		if (parent)
 		{
 			parent->removeChild(mMenu);
-			mMenu->setParent(NULL);
 		}
 		delete mMenu;
 		mMenu = NULL;
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index 73e19b3b2a048023fe2a454a201c1498a4216e80..24de2dcdfc58f763f9cc49b64eb5f9e8bcbef912 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -118,21 +118,33 @@ LLPanelPrimMediaControls::~LLPanelPrimMediaControls()
 BOOL LLPanelPrimMediaControls::postBuild()
 {
 	LLButton* scroll_up_ctrl = getChild<LLButton>("scrollup");
-	scroll_up_ctrl->setClickedCallback(onScrollUp, this);
-	scroll_up_ctrl->setHeldDownCallback(onScrollUpHeld, this);
-	scroll_up_ctrl->setMouseUpCallback(onScrollStop, this);
+	if (scroll_up_ctrl)
+	{
+		scroll_up_ctrl->setClickedCallback(onScrollUp, this);
+		scroll_up_ctrl->setHeldDownCallback(onScrollUpHeld, this);
+		scroll_up_ctrl->setMouseUpCallback(onScrollStop, this);
+	}
 	LLButton* scroll_left_ctrl = getChild<LLButton>("scrollleft");
-	scroll_left_ctrl->setClickedCallback(onScrollLeft, this);
-	scroll_left_ctrl->setHeldDownCallback(onScrollLeftHeld, this);
-	scroll_left_ctrl->setMouseUpCallback(onScrollStop, this);
+	if (scroll_left_ctrl)
+	{
+		scroll_left_ctrl->setClickedCallback(onScrollLeft, this);
+		scroll_left_ctrl->setHeldDownCallback(onScrollLeftHeld, this);
+		scroll_left_ctrl->setMouseUpCallback(onScrollStop, this);
+	}
 	LLButton* scroll_right_ctrl = getChild<LLButton>("scrollright");
-	scroll_right_ctrl->setClickedCallback(onScrollRight, this);
-	scroll_right_ctrl->setHeldDownCallback(onScrollRightHeld, this);
-	scroll_right_ctrl->setMouseUpCallback(onScrollStop, this);
+	if (scroll_right_ctrl)
+	{
+		scroll_right_ctrl->setClickedCallback(onScrollRight, this);
+		scroll_right_ctrl->setHeldDownCallback(onScrollRightHeld, this);
+		scroll_right_ctrl->setMouseUpCallback(onScrollStop, this);
+	}
 	LLButton* scroll_down_ctrl = getChild<LLButton>("scrolldown");
-	scroll_down_ctrl->setClickedCallback(onScrollDown, this);
-	scroll_down_ctrl->setHeldDownCallback(onScrollDownHeld, this);
-	scroll_down_ctrl->setMouseUpCallback(onScrollStop, this);
+	if (scroll_down_ctrl)
+	{
+		scroll_down_ctrl->setClickedCallback(onScrollDown, this);
+		scroll_down_ctrl->setHeldDownCallback(onScrollDownHeld, this);
+		scroll_down_ctrl->setMouseUpCallback(onScrollStop, this);
+	}
 	
 	LLUICtrl* media_address	= getChild<LLUICtrl>("media_address");
 	media_address->setFocusReceivedCallback(boost::bind(&LLPanelPrimMediaControls::onInputURL, _1, this ));
@@ -326,11 +338,14 @@ void LLPanelPrimMediaControls::updateShape()
 
 			whitelist_icon->setVisible(false);
 			secure_lock_icon->setVisible(false);
-			scroll_up_ctrl->setVisible(false);
-			scroll_left_ctrl->setVisible(false);
-			scroll_right_ctrl->setVisible(false);
-			scroll_down_ctrl->setVisible(false);
-			media_panel_scroll->setVisible(false);
+			if (media_panel_scroll)
+			{
+				media_panel_scroll->setVisible(false);
+				scroll_up_ctrl->setVisible(false);
+				scroll_left_ctrl->setVisible(false);
+				scroll_right_ctrl->setVisible(false);
+				scroll_down_ctrl->setVisible(false);
+			}
 				
 			F32 volume = media_impl->getVolume();
 			// movie's url changed
@@ -422,12 +437,15 @@ void LLPanelPrimMediaControls::updateShape()
 			volume_ctrl->setEnabled(FALSE);
 			volume_up_ctrl->setEnabled(FALSE);
 			volume_down_ctrl->setEnabled(FALSE);
-				
-			scroll_up_ctrl->setVisible(has_focus);
-			scroll_left_ctrl->setVisible(has_focus);
-			scroll_right_ctrl->setVisible(has_focus);
-			scroll_down_ctrl->setVisible(has_focus);
-			media_panel_scroll->setVisible(has_focus);
+			
+			if (media_panel_scroll)
+			{
+				media_panel_scroll->setVisible(has_focus);
+				scroll_up_ctrl->setVisible(has_focus);
+				scroll_left_ctrl->setVisible(has_focus);
+				scroll_right_ctrl->setVisible(has_focus);
+				scroll_down_ctrl->setVisible(has_focus);
+			}
 			// TODO: get the secure lock bool from media plug in
 			std::string prefix =  std::string("https://");
 			std::string test_prefix = mCurrentURL.substr(0, prefix.length());
@@ -561,12 +579,12 @@ void LLPanelPrimMediaControls::updateShape()
 		}
 
         LLCoordGL screen_min;
-		screen_min.mX = llround((F32)gViewerWindow->getWorldViewWidth() * (min.mV[VX] + 1.f) * 0.5f);
-		screen_min.mY = llround((F32)gViewerWindow->getWorldViewHeight() * (min.mV[VY] + 1.f) * 0.5f);
+		screen_min.mX = llround((F32)gViewerWindow->getWorldViewWidthRaw() * (min.mV[VX] + 1.f) * 0.5f);
+		screen_min.mY = llround((F32)gViewerWindow->getWorldViewHeightRaw() * (min.mV[VY] + 1.f) * 0.5f);
 
 		LLCoordGL screen_max;
-		screen_max.mX = llround((F32)gViewerWindow->getWorldViewWidth() * (max.mV[VX] + 1.f) * 0.5f);
-		screen_max.mY = llround((F32)gViewerWindow->getWorldViewHeight() * (max.mV[VY] + 1.f) * 0.5f);
+		screen_max.mX = llround((F32)gViewerWindow->getWorldViewWidthRaw() * (max.mV[VX] + 1.f) * 0.5f);
+		screen_max.mY = llround((F32)gViewerWindow->getWorldViewHeightRaw() * (max.mV[VY] + 1.f) * 0.5f);
 
 		// grow panel so that screenspace bounding box fits inside "media_region" element of HUD
 		LLRect media_controls_rect;
@@ -697,6 +715,7 @@ bool LLPanelPrimMediaControls::isMouseOver()
 		LLView* controls_view = NULL;
 		controls_view = getChild<LLView>("media_controls");
 		
+		//FIXME: rewrite as LLViewQuery or get hover set from LLViewerWindow?
 		if(controls_view && controls_view->getVisible())
 		{
 			controls_view->screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, &x, &y);
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index 72856d5b8261fd334006ae3af6fdc82c8329f103..057cdde6f055b3a8f6ade4e70eb02afba90f8021 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -163,7 +163,6 @@ void LLTeleportHistoryPanel::ContextMenu::show(LLView* spawning_view, S32 index,
 		if (parent)
 		{
 			parent->removeChild(mMenu);
-			mMenu->setParent(NULL);
 		}
 		delete mMenu;
 	}
@@ -658,7 +657,6 @@ void LLTeleportHistoryPanel::onAccordionTabRightClick(LLView *view, S32 x, S32 y
 		if (parent)
 		{
 			parent->removeChild(mAccordionTabMenu);
-			mAccordionTabMenu->setParent(NULL);
 		}
 		delete mAccordionTabMenu;
 	}
diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp
index 34e78b5c469abce87d5aef2c54988ce79f6f9f83..c95882931b6a9314a8b28a7f1316368c82fc8ac1 100644
--- a/indra/newview/llpreview.cpp
+++ b/indra/newview/llpreview.cpp
@@ -454,7 +454,7 @@ LLMultiPreview::LLMultiPreview()
 	{
 		// start with a rect in the top-left corner ; will get resized
 		LLRect rect;
-		rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeight(), 200, 200);
+		rect.setLeftTopAndSize(0, gViewerWindow->getWindowHeightScaled(), 200, 200);
 		setRect(rect);
 	}
 	setTitle(LLTrans::getString("MultiPreviewTitle"));
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 3eab13fc4a23b942e51957a09529d91bbefe9704..13d02b7dec021ae00f11fc8489b141707ebf2201 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -394,8 +394,8 @@ void LLPreviewTexture::updateDimensions()
 	S32 client_height = image_height;
 	S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE;
 	S32 vert_pad = PREVIEW_HEADER_SIZE + 2 * CLIENT_RECT_VPAD + LLPANEL_BORDER_WIDTH;	
-	S32 max_client_width = gViewerWindow->getWindowWidth() - horiz_pad;
-	S32 max_client_height = gViewerWindow->getWindowHeight() - vert_pad;
+	S32 max_client_width = gViewerWindow->getWindowWidthScaled() - horiz_pad;
+	S32 max_client_height = gViewerWindow->getWindowHeightScaled() - vert_pad;
 
 	if (mAspectRatio > 0.f)
 	{
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index e4dbcbd21928875ac7b4242ed84ac1369bdb3337..ed606d54570bf6119f04866145e6b6da18efb743 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -63,7 +63,7 @@ LLScreenChannelBase::LLScreenChannelBase(const LLUUID& id) :
 												,mCanStoreToasts(true)
 												,mHiddenToastsNum(0)
 												,mOverflowToastHidden(false)
-												,mIsHovering(false)
+												,mHoveredToast(NULL)
 												,mControlHovering(false)
 												,mShowToasts(true)
 {	
@@ -103,8 +103,8 @@ void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect ne
 
 void LLScreenChannelBase::init(S32 channel_left, S32 channel_right)
 {
-	S32 channel_top = gViewerWindow->getWorldViewRect().getHeight();
-	S32 channel_bottom = gViewerWindow->getWorldViewRect().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");
+	S32 channel_top = gViewerWindow->getWorldViewRectRaw().getHeight();
+	S32 channel_bottom = gViewerWindow->getWorldViewRectRaw().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");
 	setRect(LLRect(channel_left, channel_top, channel_right, channel_bottom));
 	setVisible(TRUE);
 }
@@ -216,8 +216,10 @@ void LLScreenChannel::deleteToast(LLToast* toast)
 	
 	// update channel's Hovering state
 	// turning hovering off manually because onMouseLeave won't happen if a toast was closed using a keyboard
-	if(toast->hasFocus())
-		setHovering(false);
+	if(mHoveredToast == toast)
+	{
+		mHoveredToast  = NULL;
+	}
 
 	// close the toast
 	toast->closeFloater();
@@ -352,7 +354,7 @@ void LLScreenChannel::modifyToastByNotificationID(LLUUID id, LLPanel* panel)
 //--------------------------------------------------------------------------
 void LLScreenChannel::redrawToasts()
 {
-	if(mToastList.size() == 0 || mIsHovering)
+	if(mToastList.size() == 0 || isHovering())
 		return;
 
 	hideToastsFromScreen();
@@ -456,7 +458,6 @@ void LLScreenChannel::createOverflowToast(S32 bottom, F32 timer)
 	mOverflowToastPanel->setOnFadeCallback(boost::bind(&LLScreenChannel::closeOverflowToastPanel, this));
 
 	LLTextBox* text_box = mOverflowToastPanel->getChild<LLTextBox>("toast_text");
-	LLIconCtrl* icon = mOverflowToastPanel->getChild<LLIconCtrl>("icon");
 	std::string	text = llformat(mOverflowFormatString.c_str(),mHiddenToastsNum);
 	if(mHiddenToastsNum == 1)
 	{
@@ -474,7 +475,6 @@ void LLScreenChannel::createOverflowToast(S32 bottom, F32 timer)
 
 	text_box->setValue(text);
 	text_box->setVisible(TRUE);
-	icon->setVisible(TRUE);
 
 	mOverflowToastPanel->setVisible(TRUE);
 }
@@ -532,7 +532,6 @@ void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer)
 	mStartUpToastPanel->setOnFadeCallback(boost::bind(&LLScreenChannel::onStartUpToastHide, this));
 
 	LLTextBox* text_box = mStartUpToastPanel->getChild<LLTextBox>("toast_text");
-	LLIconCtrl* icon = mStartUpToastPanel->getChild<LLIconCtrl>("icon");
 
 	std::string mStartUpFormatString;
 
@@ -555,8 +554,6 @@ void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer)
 
 	text_box->setValue(text);
 	text_box->setVisible(TRUE);
-	icon->setVisible(TRUE);
-
 	addChild(mStartUpToastPanel);
 	
 	mStartUpToastPanel->setVisible(TRUE);
@@ -654,7 +651,14 @@ void LLScreenChannel::onToastHover(LLToast* toast, bool mouse_enter)
 	// we must check this to prevent incorrect setting for hovering in a channel
 	std::map<LLToast*, bool>::iterator it_first, it_second;
 	S32 stack_size = mToastEventStack.size();
-	mIsHovering = mouse_enter;
+	if(mouse_enter)
+	{
+		mHoveredToast = toast;
+	}
+	else
+	{
+		mHoveredToast = NULL;
+	}
 
 	switch(stack_size)
 	{
@@ -666,7 +670,7 @@ void LLScreenChannel::onToastHover(LLToast* toast, bool mouse_enter)
 		if((*it_first).second && !mouse_enter && ((*it_first).first != toast) )
 		{
 			mToastEventStack.clear();
-			mIsHovering = true;
+			mHoveredToast = toast;
 		}
 		else
 		{
@@ -678,7 +682,7 @@ void LLScreenChannel::onToastHover(LLToast* toast, bool mouse_enter)
 		LL_ERRS ("LLScreenChannel::onToastHover: stack size error " ) << stack_size << llendl;
 	}
 
-	if(!mIsHovering)
+	if(!isHovering())
 		redrawToasts();
 }
 
@@ -706,7 +710,7 @@ void LLScreenChannel::updateShowToastsState()
 	// for Message Well floater showed in a docked state - adjust channel's height
 	if(dynamic_cast<LLSysWellWindow*>(floater))
 	{
-		S32 channel_bottom = gViewerWindow->getWorldViewRect().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");;
+		S32 channel_bottom = gViewerWindow->getWorldViewRectRaw().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");;
 		LLRect this_rect = getRect();
 		if(floater->getVisible() && floater->isDocked())
 		{
diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h
index fd31690622f8b65ad63a16c7de08f5bb7d184b04..f39b94b89df3b722602e6606312453b83964fd07 100644
--- a/indra/newview/llscreenchannel.h
+++ b/indra/newview/llscreenchannel.h
@@ -93,9 +93,10 @@ class LLScreenChannelBase : public LLUICtrl
 	// Channel's behavior-functions
 	// set whether a channel will control hovering inside itself or not
 	virtual void setControlHovering(bool control) { mControlHovering = control; }
-	// set Hovering flag for a channel
-	virtual void setHovering(bool hovering) { mIsHovering = hovering; }
 	
+
+	bool isHovering() { return mHoveredToast != NULL; }
+
 	void setCanStoreToasts(bool store) { mCanStoreToasts = store; }
 
 	void setDisplayToastsAlways(bool display_toasts) { mDisplayToastsAlways = display_toasts; }
@@ -117,7 +118,7 @@ class LLScreenChannelBase : public LLUICtrl
 protected:
 	// Channel's flags
 	bool		mControlHovering;
-	bool		mIsHovering;
+	LLToast*		mHoveredToast;
 	bool		mCanStoreToasts;
 	bool		mDisplayToastsAlways;
 	bool		mOverflowToastHidden;
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index b25dea92ccee4952947dd118e6251e2e43a904bf..70dc04f575ff3d6526c918a8fcabd7e8548e6d86 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -100,7 +100,8 @@ LLSideTray* LLSideTray::getInstance()
 {
 	if (!sInstance)
 	{
-		sInstance = LLUICtrlFactory::createFromFile<LLSideTray>("panel_side_tray.xml",gViewerWindow->getRootView(), LLRootView::child_registry_t::instance());
+		sInstance = LLUICtrlFactory::createFromFile<LLSideTray>("panel_side_tray.xml",NULL, LLRootView::child_registry_t::instance());
+		sInstance->setXMLFilename("panel_side_tray.xml");
 	}
 
 	return sInstance;
@@ -148,7 +149,6 @@ class LLSideTrayTab: public LLPanel
 	/*virtual*/ bool	addChild	(LLView* view, S32 tab_group);
 	
 	
-	void			arrange		(S32 width, S32 height);
 	void			reshape		(S32 width, S32 height, BOOL called_from_parent = TRUE);
 	
 	static LLSideTrayTab*  createInstance	();
@@ -156,8 +156,6 @@ class LLSideTrayTab: public LLPanel
 	const std::string& getDescription () const { return mDescription;}
 	const std::string& getTabTitle() const { return mTabTitle;}
 	
-	void draw();
-	
 	void			onOpen		(const LLSD& key);
 	
 private:
@@ -209,60 +207,24 @@ BOOL LLSideTrayTab::postBuild()
 
 static const S32 splitter_margin = 1;
 
-//virtual 
-void	LLSideTrayTab::arrange(S32 width, S32 height )
-{
-	if(!mMainPanel)
-		return;
-	
-	S32 offset = 0;
-
-	LLView* title_panel = findChildView(TAB_PANEL_CAPTION_NAME, true);
-
-	if(title_panel)
-	{
-		title_panel->setOrigin( 0, height - title_panel->getRect().getHeight() );
-		offset = title_panel->getRect().getHeight();
-	}
-
-	LLRect sRect = mMainPanel->getRect();
-	sRect.setLeftTopAndSize( splitter_margin, height - offset - splitter_margin, width - 2*splitter_margin, height - offset - 2*splitter_margin);
-	mMainPanel->reshape(sRect.getWidth(),sRect.getHeight());
-	mMainPanel->setRect(sRect);
-	
-
-	
-}
-
 void LLSideTrayTab::reshape		(S32 width, S32 height, BOOL called_from_parent )
 {
-	if(!mMainPanel)
-		return;
-	S32 offset = 0;
-
+	LLPanel::reshape(width, height, called_from_parent);
 	LLView* title_panel = findChildView(TAB_PANEL_CAPTION_NAME, true);
-
-	if(title_panel)
+	if (!title_panel)
 	{
-		title_panel->setOrigin( 0, height - title_panel->getRect().getHeight() );
-		title_panel->reshape(width,title_panel->getRect().getHeight());
-		offset = title_panel->getRect().getHeight();
+		// not fully constructed yet
+		return;
 	}
 
-	
-
-	LLRect sRect = mMainPanel->getRect();
-	sRect.setLeftTopAndSize( splitter_margin, height - offset - splitter_margin, width - 2*splitter_margin, height - offset - 2*splitter_margin);
-	//mMainPanel->setMaxWidth(sRect.getWidth());
-	mMainPanel->reshape(sRect.getWidth(), sRect.getHeight());
-	
-	mMainPanel->setRect(sRect);
-
-}
+	S32 title_height = title_panel->getRect().getHeight();
+	title_panel->setOrigin( 0, height - title_height );
+	title_panel->reshape(width,title_height);
 
-void LLSideTrayTab::draw()
-{
-	LLPanel::draw();
+	LLRect sRect;
+	sRect.setLeftTopAndSize( splitter_margin, height - title_height - splitter_margin, 
+							width - 2*splitter_margin, height - title_height - 2*splitter_margin);
+	mMainPanel->setShape(sRect);
 }
 
 void	LLSideTrayTab::onOpen		(const LLSD& key)
@@ -300,17 +262,20 @@ LLSideTray::LLSideTray(Params& params)
 	    ,mActiveTab(0)
 		,mCollapsed(false)
 		,mCollapseButton(0)
-	    ,mMaxBarWidth(params.rect.width)
 {
 	mCollapsed=params.collapsed;
 
-
 	LLUICtrl::CommitCallbackRegistry::Registrar& commit = LLUICtrl::CommitCallbackRegistry::currentRegistrar();
 
 	// register handler function to process data from the xml. 
 	// panel_name should be specified via "parameter" attribute.
 	commit.add("SideTray.ShowPanel", boost::bind(&LLSideTray::showPanel, this, _2, LLUUID::null));
 	LLTransientFloaterMgr::getInstance()->addControlView(this);
+
+	LLPanel::Params p;
+	p.name = "buttons_panel";
+	p.mouse_opaque = false;
+	mButtonsPanel = LLUICtrlFactory::create<LLPanel>(p);
 }
 
 
@@ -389,7 +354,8 @@ bool LLSideTray::selectTabByName	(const std::string& name)
 	return true;
 }
 
-LLButton* LLSideTray::createButton	(const std::string& name,const std::string& image,LLUICtrl::commit_callback_t callback)
+LLButton* LLSideTray::createButton	(const std::string& name,const std::string& image,const std::string& tooltip,
+									 LLUICtrl::commit_callback_t callback)
 {
 	static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams<LLSideTray>());	
 	
@@ -399,7 +365,7 @@ LLButton* LLSideTray::createButton	(const std::string& name,const std::string& i
 	rect.setOriginAndSize(0, 0, sidetray_params.default_button_width, sidetray_params.default_button_height); 
 
 	bparams.name(name);
-	bparams.follows.flags (FOLLOWS_LEFT | FOLLOWS_BOTTOM);
+	bparams.follows.flags (FOLLOWS_LEFT | FOLLOWS_TOP);
 	bparams.rect (rect);
 	bparams.tab_stop(false);
 	bparams.image_unselected.name(sidetray_params.tab_btn_image_normal);
@@ -410,13 +376,16 @@ LLButton* LLSideTray::createButton	(const std::string& name,const std::string& i
 	LLButton* button = LLUICtrlFactory::create<LLButton> (bparams);
 	button->setLabel(name);
 	button->setClickedCallback(callback);
+
+	if(tooltip!="Home")
+		button->setToolTip(tooltip);
 	
 	if(image.length())
 	{
 		button->setImageOverlay(image);
 	}
 
-	addChildInBack(button);
+	mButtonsPanel->addChildInBack(button);
 
 	return button;
 }
@@ -448,12 +417,12 @@ void	LLSideTray::createButtons	()
 		// change if the home screen becomes its own tab.
 		if (name == "sidebar_home")
 		{
-			mCollapseButton = createButton("",sidebar_tab->mImage,
+			mCollapseButton = createButton("",sidebar_tab->mImage,sidebar_tab->getTabTitle(),
 				boost::bind(&LLSideTray::onToggleCollapse, this));
 		}
 		else
 		{
-			LLButton* button = createButton("",sidebar_tab->mImage,
+			LLButton* button = createButton("",sidebar_tab->mImage,sidebar_tab->getTabTitle(),
 				boost::bind(&LLSideTray::onTabButtonClick, this, name));
 			mTabButtons[name] = button;
 		}
@@ -526,7 +495,7 @@ void		LLSideTray::onToggleCollapse()
 
 void LLSideTray::reflectCollapseChange()
 {
-	setPanelRect();
+	updateSidetrayVisibility();
 
 	if(mCollapsed)
 	{
@@ -535,23 +504,24 @@ void LLSideTray::reflectCollapseChange()
 	}
 	else
 	{
-		gFloaterView->setSnapOffsetRight(mMaxBarWidth);
+		gFloaterView->setSnapOffsetRight(getRect().getWidth());
 		setFocus(TRUE);
 	}
 
 	gFloaterView->refresh();
 }
 
-void LLSideTray::arrange			()
+void LLSideTray::arrange()
 {
 	static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams<LLSideTray>());	
 
-	setPanelRect();
+	updateSidetrayVisibility();
 	
 	LLRect ctrl_rect;
-	ctrl_rect.setLeftTopAndSize(0,getRect().getHeight()-sidetray_params.default_button_width
-							,sidetray_params.default_button_width
-							,sidetray_params.default_button_height);
+	ctrl_rect.setLeftTopAndSize(0,
+								mButtonsPanel->getRect().getHeight() - sidetray_params.default_button_width,
+								sidetray_params.default_button_width,
+								sidetray_params.default_button_height);
 
 	mCollapseButton->setRect(ctrl_rect);
 
@@ -563,9 +533,10 @@ void LLSideTray::arrange			()
 	{
 		LLSideTrayTab* sidebar_tab = *child_it;
 		
-		ctrl_rect.setLeftTopAndSize(0,getRect().getHeight()-offset
-								,sidetray_params.default_button_width
-								,sidetray_params.default_button_height);
+		ctrl_rect.setLeftTopAndSize(0,
+									mButtonsPanel->getRect().getHeight()-offset,
+									sidetray_params.default_button_width,
+									sidetray_params.default_button_height);
 
 		if(mTabButtons.find(sidebar_tab->getName()) == mTabButtons.end())
 			continue;
@@ -579,14 +550,11 @@ void LLSideTray::arrange			()
 		btn->setVisible(ctrl_rect.mBottom > 0);
 	}
 
-	ctrl_rect.setLeftTopAndSize(sidetray_params.default_button_width,getRect().getHeight(),mMaxBarWidth,getRect().getHeight());
-
 	//arrange tabs
-	for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it)
+	for ( child_vector_t::iterator child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it)
 	{
 		LLSideTrayTab* sidebar_tab = *child_it;
-		sidebar_tab->setRect(ctrl_rect);
-		sidebar_tab->arrange(mMaxBarWidth,getRect().getHeight());
+		sidebar_tab->setShape(getLocalRect());
 	}
 }
 
@@ -615,7 +583,7 @@ void LLSideTray::collapseSideBar()
 	{
 		mCollapseButton->setImageOverlay( home_tab->mImage );
 	}
-	mActiveTab->setVisible(FALSE);
+	//mActiveTab->setVisible(FALSE);
 	reflectCollapseChange();
 	setFocus( FALSE );
 
@@ -631,7 +599,6 @@ void LLSideTray::expandSideBar()
 	}
 	LLSD key;//empty
 	mActiveTab->onOpen(key);
-	mActiveTab->setVisible(TRUE);
 
 	reflectCollapseChange();
 }
@@ -647,15 +614,6 @@ void LLSideTray::highlightFocused()
 	*/
 }
 
-BOOL	LLSideTray::handleScrollWheel(S32 x, S32 y, S32 mask)
-{
-	BOOL ret = LLPanel::handleScrollWheel(x,y,mask);
-
-	if(!ret && childFromPoint(x,y) != 0 )
-		return TRUE;//mouse wheel over sidetray buttons, eat mouse wheel
-	return ret;
-}
-
 //virtual
 BOOL		LLSideTray::handleMouseDown	(S32 x, S32 y, MASK mask)
 {
@@ -665,58 +623,13 @@ BOOL		LLSideTray::handleMouseDown	(S32 x, S32 y, MASK mask)
 	return ret;
 }
 
-void LLSideTray::reshape			(S32 width, S32 height, BOOL called_from_parent)
+void LLSideTray::reshape(S32 width, S32 height, BOOL called_from_parent)
 {
-	
 	LLPanel::reshape(width, height, called_from_parent);
 	if(!mActiveTab)
 		return;
 	
-	static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams<LLSideTray>());	
-
-	setPanelRect();
-
-	LLRect ctrl_rect;
-	ctrl_rect.setLeftTopAndSize(0
-							,getRect().getHeight()-sidetray_params.default_button_width
-							,sidetray_params.default_button_width
-							,sidetray_params.default_button_height);
-	
-	mCollapseButton->setRect(ctrl_rect);
-
-	//arrange tab buttons
-	child_vector_const_iter_t child_it;
-	int offset = (sidetray_params.default_button_height+sidetray_params.default_button_margin)*2;
-	for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it)	
-	{
-		LLSideTrayTab* sidebar_tab = *child_it;
-		
-		ctrl_rect.setLeftTopAndSize(0,getRect().getHeight()-offset
-								,sidetray_params.default_button_width
-								,sidetray_params.default_button_height);
-
-		if(mTabButtons.find(sidebar_tab->getName()) == mTabButtons.end())
-			continue;
-
-		LLButton* btn = mTabButtons[sidebar_tab->getName()];
-
-		btn->setRect(ctrl_rect);
-		offset+=sidetray_params.default_button_height;
-		offset+=sidetray_params.default_button_margin;
-
-		btn->setVisible(ctrl_rect.mBottom > 0);
-	}
-
-	//arrange tabs
-	
-	for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it)
-	{
-		LLSideTrayTab* sidebar_tab = *child_it;
-		sidebar_tab->reshape(mMaxBarWidth,getRect().getHeight());
-		ctrl_rect.setLeftTopAndSize(sidetray_params.default_button_width,getRect().getHeight(),mMaxBarWidth,getRect().getHeight());
-		sidebar_tab->setRect(ctrl_rect);
-		
-	}
+	arrange();
 }
 
 /**
@@ -764,42 +677,12 @@ LLPanel*	LLSideTray::showPanel		(const std::string& panel_name, const LLSD& para
 static const S32	fake_offset = 132;
 static const S32	fake_top_offset = 18;
 
-void LLSideTray::resetPanelRect	()
-{
-	const LLRect& parent_rect = gViewerWindow->getRootView()->getRect();
-
-	static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams<LLSideTray>());	
-
-	S32 panel_width = sidetray_params.default_button_width;
-	panel_width += mCollapsed ? 0 : mMaxBarWidth;
-
-	S32 panel_height = parent_rect.getHeight()-fake_top_offset;
-
-	reshape(panel_width,panel_height);
-}
-
-void	LLSideTray::setPanelRect	()
+void	LLSideTray::updateSidetrayVisibility()
 {
-	LLNavigationBar* nav_bar = LLNavigationBar::getInstance();
-	LLRect nav_rect = nav_bar->getRect();
-	
-	static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams<LLSideTray>());	
-
-	const LLRect& parent_rect = gViewerWindow->getRootView()->getRect();
-
-	S32 panel_width = sidetray_params.default_button_width;
-	panel_width += mCollapsed ? 0 : mMaxBarWidth;
-
-	S32 panel_height = parent_rect.getHeight()-fake_top_offset - nav_rect.getHeight();
-	S32 panel_top = parent_rect.mTop-fake_top_offset - nav_rect.getHeight();
-
-	LLRect panel_rect;
-	panel_rect.setLeftTopAndSize( parent_rect.mRight-panel_width, panel_top, panel_width, panel_height);
-	setRect(panel_rect);
+	// set visibility of parent container based on collapsed state
+	if (getParent())
+	{
+		getParent()->setVisible(!mCollapsed);
+	}
 }
 
-S32	LLSideTray::getTrayWidth()
-{
-	static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams<LLSideTray>());	
-	return getRect().getWidth() - (sidetray_params.default_button_width + sidetray_params.default_button_margin);
-}
diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h
index 246979ac54b8bf542daaa2eab450ae7895362554..8b30199c45688ff50f1b8ab4c6786956ec23f674 100644
--- a/indra/newview/llsidetray.h
+++ b/indra/newview/llsidetray.h
@@ -118,6 +118,8 @@ class LLSideTray : public LLPanel, private LLDestroyClass<LLSideTray>
 		LLPanel::setVisible(visible);
 	}
 
+	LLPanel*	getButtonsPanel() { return mButtonsPanel; }
+
 public:
 	virtual ~LLSideTray(){};
 
@@ -129,12 +131,8 @@ class LLSideTray : public LLPanel, private LLDestroyClass<LLSideTray>
 	bool		addChild		(LLView* view, S32 tab_group);
 
 	BOOL		handleMouseDown	(S32 x, S32 y, MASK mask);
-	BOOL		handleScrollWheel(S32 x, S32 y, S32 mask);
 	
 	void		reshape			(S32 width, S32 height, BOOL called_from_parent = TRUE);
-	S32			getTrayWidth();
-
-	void		resetPanelRect	();
 
 	void		processTriState ();
 	
@@ -143,13 +141,14 @@ class LLSideTray : public LLPanel, private LLDestroyClass<LLSideTray>
 	LLSideTrayTab* getTab		(const std::string& name);
 
 	void		createButtons	();
-	LLButton*	createButton	(const std::string& name,const std::string& image,LLUICtrl::commit_callback_t callback);
+	LLButton*	createButton	(const std::string& name,const std::string& image,const std::string& tooltip,
+									LLUICtrl::commit_callback_t callback);
 	void		arrange			();
 	void		reflectCollapseChange();
 
 	void		toggleTabButton	(LLSideTrayTab* tab);
 
-	void		setPanelRect	();
+	void		updateSidetrayVisibility();
 
 	
 
@@ -165,15 +164,15 @@ class LLSideTray : public LLPanel, private LLDestroyClass<LLSideTray>
 
 private:
 
-	std::map<std::string,LLButton*>	mTabButtons;
+	LLPanel*						mButtonsPanel;
+	typedef std::map<std::string,LLButton*> button_map_t;
+	button_map_t					mTabButtons;
 	child_vector_t					mTabs;
 	LLSideTrayTab*					mActiveTab;	
 	
 	LLButton*						mCollapseButton;
 	bool							mCollapsed;
 	
-	S32								mMaxBarWidth;
-
 	static LLSideTray*				sInstance;
 };
 
diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp
index d441762fa6fbc90d271db30080593162f02d0fad..57ea018f2540c833bb9a19dfe6fbdb30d2fc35f8 100644
--- a/indra/newview/llspeakbutton.cpp
+++ b/indra/newview/llspeakbutton.cpp
@@ -129,6 +129,8 @@ LLSpeakButton::LLSpeakButton(const Params& p)
 
 LLSpeakButton::~LLSpeakButton()
 {
+	LLTransientFloaterMgr::getInstance()->removeControlView(mSpeakBtn);
+	LLTransientFloaterMgr::getInstance()->removeControlView(mShowBtn);
 }
 
 void LLSpeakButton::onMouseDown_SpeakBtn()
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 0a6eefc41df7fbebd5fb739815312b69a78cf725..64dcd7b97fbe6e4f45eefe500b0cea70a7e452c9 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1386,7 +1386,7 @@ bool idle_startup()
 
 		// Make sure agent knows correct aspect ratio
 		// FOV limits depend upon aspect ratio so this needs to happen before initializing the FOV below
-		LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWorldViewHeight());
+		LLViewerCamera::getInstance()->setViewHeightInPixels(gViewerWindow->getWorldViewHeightRaw());
 		LLViewerCamera::getInstance()->setAspect(gViewerWindow->getWorldViewAspectRatio());
 		// Initialize FOV
 		LLViewerCamera::getInstance()->setDefaultFOV(gSavedSettings.getF32("CameraAngle")); 
@@ -2122,7 +2122,7 @@ void login_show()
 	BOOL bUseDebugLogin = TRUE;
 #endif
 
-	LLPanelLogin::show(	gViewerWindow->getVirtualWindowRect(),
+	LLPanelLogin::show(	gViewerWindow->getWindowRectScaled(),
 						bUseDebugLogin,
 						login_callback, NULL );
 
diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp
index 723ac0fc33a203ec58404d4ab9a37df0fdb445c4..2fb6550107a40c19ac772d83f4428dbe5b6e7793 100644
--- a/indra/newview/llsyswellwindow.cpp
+++ b/indra/newview/llsyswellwindow.cpp
@@ -238,7 +238,7 @@ void LLSysWellWindow::initChannel()
 //---------------------------------------------------------------------------------
 void LLSysWellWindow::getAllowedRect(LLRect& rect)
 {
-	rect = gViewerWindow->getWorldViewRect();
+	rect = gViewerWindow->getWorldViewRectRaw();
 }
 
 //---------------------------------------------------------------------------------
@@ -501,14 +501,14 @@ LLSysWellWindow::RowPanel::RowPanel(const LLSysWellWindow* parent, const LLUUID&
 	switch (im_chiclet_type)
 	{
 	case LLIMChiclet::TYPE_GROUP:
+		mChiclet = getChild<LLIMGroupChiclet>("group_chiclet");
+		break;
 	case LLIMChiclet::TYPE_AD_HOC:
-		mChiclet = getChild<LLIMChiclet>("group_chiclet");
-		childSetVisible("p2p_chiclet", false);
+		mChiclet = getChild<LLAdHocChiclet>("adhoc_chiclet");		
 		break;
 	case LLIMChiclet::TYPE_UNKNOWN: // assign mChiclet a non-null value anyway
 	case LLIMChiclet::TYPE_IM:
-		mChiclet = getChild<LLIMChiclet>("p2p_chiclet");
-		childSetVisible("group_chiclet", false);
+		mChiclet = getChild<LLIMP2PChiclet>("p2p_chiclet");
 		break;
 	}
 
@@ -517,6 +517,7 @@ LLSysWellWindow::RowPanel::RowPanel(const LLSysWellWindow* parent, const LLUUID&
 	mChiclet->setSessionId(sessionId);
 	mChiclet->setIMSessionName(name);
 	mChiclet->setOtherParticipantId(otherParticipantId);
+	mChiclet->setVisible(true);
 
 	LLTextBox* contactName = getChild<LLTextBox>("contact_name");
 	contactName->setValue(name);
diff --git a/indra/newview/lltexglobalcolor.cpp b/indra/newview/lltexglobalcolor.cpp
index 595b24ad471441bd9d15219ef49f1fa482c7f40d..d7840fb4355b337fbc352344a5800acb65aaf3b0 100644
--- a/indra/newview/lltexglobalcolor.cpp
+++ b/indra/newview/lltexglobalcolor.cpp
@@ -108,9 +108,9 @@ LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color)
 	return new_param;
 }
 
-void LLTexParamGlobalColor::onGlobalColorChanged(bool set_by_user)
+void LLTexParamGlobalColor::onGlobalColorChanged(bool upload_bake)
 {
-	mAvatar->onGlobalColorChanged(mTexGlobalColor, set_by_user);
+	mAvatar->onGlobalColorChanged(mTexGlobalColor, upload_bake);
 }
 
 //-----------------------------------------------------------------------------
diff --git a/indra/newview/lltexglobalcolor.h b/indra/newview/lltexglobalcolor.h
index 1e6754133fb5f398fb1ca22c5d41a5cd0f99bb11..829a7d645be4daeb048f52a4f2a6d390446a5185 100644
--- a/indra/newview/lltexglobalcolor.h
+++ b/indra/newview/lltexglobalcolor.h
@@ -80,7 +80,7 @@ class LLTexParamGlobalColor : public LLTexLayerParamColor
 	LLTexParamGlobalColor(LLTexGlobalColor *tex_color);
 	/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
 protected:
-	/*virtual*/ void onGlobalColorChanged(bool set_by_user);
+	/*virtual*/ void onGlobalColorChanged(bool upload_bake);
 private:
 	LLTexGlobalColor*		mTexGlobalColor;
 };
diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp
index 5d682cad3c09b1f857a4fa49897b22357018931c..25e0ca46e4d27b45c0b5f1b34ea21556f658cba0 100644
--- a/indra/newview/lltexlayer.cpp
+++ b/indra/newview/lltexlayer.cpp
@@ -1834,7 +1834,7 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i)
 		}
 		if (layer)
 		{
-			wearable->writeToAvatar(FALSE, FALSE);
+			wearable->writeToAvatar();
 			layer->setLTO(lto);
 			success &= layer->render(x,y,width,height);
 		}
diff --git a/indra/newview/lltexlayerparams.cpp b/indra/newview/lltexlayerparams.cpp
index b744722f4cd5b72a5f16af772e32212f9d8d2793..0c7e61d00e2e75ffe9aea9289d37d700cabf8c38 100644
--- a/indra/newview/lltexlayerparams.cpp
+++ b/indra/newview/lltexlayerparams.cpp
@@ -160,7 +160,7 @@ BOOL LLTexLayerParamAlpha::getMultiplyBlend() const
 	return ((LLTexLayerParamAlphaInfo *)getInfo())->mMultiplyBlend; 	
 }
 
-void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL set_by_user)
+void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake)
 {
 	if (mIsAnimating || mTexLayer == NULL)
 	{
@@ -179,37 +179,37 @@ void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL set_by_user)
 		{
 			if (gAgent.cameraCustomizeAvatar())
 			{
-				set_by_user = FALSE;
+				upload_bake = FALSE;
 			}
-			mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), set_by_user);
+			mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
 			mTexLayer->invalidateMorphMasks();
 		}
 	}
 }
 
-void LLTexLayerParamAlpha::setAnimationTarget(F32 target_value, BOOL set_by_user)
+void LLTexLayerParamAlpha::setAnimationTarget(F32 target_value, BOOL upload_bake)
 { 
 	// do not animate dummy parameters
 	if (mIsDummy)
 	{
-		setWeight(target_value, set_by_user);
+		setWeight(target_value, upload_bake);
 		return;
 	}
 
 	mTargetWeight = target_value; 
-	setWeight(target_value, set_by_user); 
+	setWeight(target_value, upload_bake); 
 	mIsAnimating = TRUE;
 	if (mNext)
 	{
-		mNext->setAnimationTarget(target_value, set_by_user);
+		mNext->setAnimationTarget(target_value, upload_bake);
 	}
 }
 
-void LLTexLayerParamAlpha::animate(F32 delta, BOOL set_by_user)
+void LLTexLayerParamAlpha::animate(F32 delta, BOOL upload_bake)
 {
 	if (mNext)
 	{
-		mNext->animate(delta, set_by_user);
+		mNext->animate(delta, upload_bake);
 	}
 }
 
@@ -449,7 +449,7 @@ LLColor4 LLTexLayerParamColor::getNetColor() const
 	}
 }
 
-void LLTexLayerParamColor::setWeight(F32 weight, BOOL set_by_user)
+void LLTexLayerParamColor::setWeight(F32 weight, BOOL upload_bake)
 {
 	if (mIsAnimating)
 	{
@@ -474,10 +474,10 @@ void LLTexLayerParamColor::setWeight(F32 weight, BOOL set_by_user)
 
 		if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
 		{
-			onGlobalColorChanged(set_by_user);
+			onGlobalColorChanged(upload_bake);
 			if (mTexLayer)
 			{
-				mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), set_by_user);
+				mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
 			}
 		}
 
@@ -485,23 +485,23 @@ void LLTexLayerParamColor::setWeight(F32 weight, BOOL set_by_user)
 	}
 }
 
-void LLTexLayerParamColor::setAnimationTarget(F32 target_value, BOOL set_by_user)
+void LLTexLayerParamColor::setAnimationTarget(F32 target_value, BOOL upload_bake)
 { 
 	// set value first then set interpolating flag to ignore further updates
 	mTargetWeight = target_value; 
-	setWeight(target_value, set_by_user);
+	setWeight(target_value, upload_bake);
 	mIsAnimating = TRUE;
 	if (mNext)
 	{
-		mNext->setAnimationTarget(target_value, set_by_user);
+		mNext->setAnimationTarget(target_value, upload_bake);
 	}
 }
 
-void LLTexLayerParamColor::animate(F32 delta, BOOL set_by_user)
+void LLTexLayerParamColor::animate(F32 delta, BOOL upload_bake)
 {
 	if (mNext)
 	{
-		mNext->animate(delta, set_by_user);
+		mNext->animate(delta, upload_bake);
 	}
 }
 
diff --git a/indra/newview/lltexlayerparams.h b/indra/newview/lltexlayerparams.h
index 98365864f99eb46d52adee903ed952116777a2b8..2b80dbdba4cf34833489f92347b57141af8321f9 100644
--- a/indra/newview/lltexlayerparams.h
+++ b/indra/newview/lltexlayerparams.h
@@ -66,9 +66,9 @@ class LLTexLayerParamAlpha : public LLTexLayerParam
 	// LLVisualParam Virtual functions
 	///*virtual*/ BOOL		parseData(LLXmlTreeNode* node);
 	/*virtual*/ void		apply( ESex avatar_sex ) {}
-	/*virtual*/ void		setWeight(F32 weight, BOOL set_by_user);
-	/*virtual*/ void		setAnimationTarget(F32 target_value, BOOL set_by_user); 
-	/*virtual*/ void		animate(F32 delta, BOOL set_by_user);
+	/*virtual*/ void		setWeight(F32 weight, BOOL upload_bake);
+	/*virtual*/ void		setAnimationTarget(F32 target_value, BOOL upload_bake); 
+	/*virtual*/ void		animate(F32 delta, BOOL upload_bake);
 
 	// LLViewerVisualParam Virtual functions
 	/*virtual*/ F32					getTotalDistortion()									{ return 1.f; }
@@ -143,9 +143,9 @@ class LLTexLayerParamColor : public LLTexLayerParam
 	// LLVisualParam Virtual functions
 	///*virtual*/ BOOL			parseData(LLXmlTreeNode* node);
 	/*virtual*/ void			apply( ESex avatar_sex ) {}
-	/*virtual*/ void			setWeight(F32 weight, BOOL set_by_user);
-	/*virtual*/ void			setAnimationTarget(F32 target_value, BOOL set_by_user);
-	/*virtual*/ void			animate(F32 delta, BOOL set_by_user);
+	/*virtual*/ void			setWeight(F32 weight, BOOL upload_bake);
+	/*virtual*/ void			setAnimationTarget(F32 target_value, BOOL upload_bake);
+	/*virtual*/ void			animate(F32 delta, BOOL upload_bake);
 
 
 	// LLViewerVisualParam Virtual functions
@@ -159,7 +159,7 @@ class LLTexLayerParamColor : public LLTexLayerParam
 	// New functions
 	LLColor4				getNetColor() const;
 protected:
-	virtual void onGlobalColorChanged(bool set_by_user) {}
+	virtual void onGlobalColorChanged(bool upload_bake) {}
 private:
 	LLVector3				mAvgDistortionVec;
 };
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 69a2d1d7a6bd914264658c3bff764ccabb5216e5..9be342c424ca39a7b697cb365068a71d3242bc61 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1541,21 +1541,24 @@ bool LLTextureCache::readComplete(handle_t handle, bool abort)
 {
 	lockWorkers();
 	handle_map_t::iterator iter = mReaders.find(handle);
-	llassert_always(iter != mReaders.end() || abort);
-	LLTextureCacheWorker* worker = iter->second;
-	bool res = worker->complete();
-	if (res || abort)
+	LLTextureCacheWorker* worker = NULL;
+	bool complete = false;
+	if (iter != mReaders.end())
+	{
+		worker = iter->second;
+		complete = worker->complete();
+	}
+	if (worker && (complete || abort))
 	{
-		mReaders.erase(handle);
+		mReaders.erase(iter);
 		unlockWorkers();
 		worker->scheduleDelete();
-		return true;
 	}
 	else
 	{
 		unlockWorkers();
-		return false;
 	}
+	return (complete || abort);
 }
 
 LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id, U32 priority,
diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp
index 0572f9a69864879bf986fb4ff0cd799a69aa8207..268a18d2a2c0c05476b2431920a81cd27be7e31c 100644
--- a/indra/newview/lltoolbar.cpp
+++ b/indra/newview/lltoolbar.cpp
@@ -206,7 +206,7 @@ void LLToolBar::layoutButtons()
 {
 #if LL_DARWIN
 	const S32 FUDGE_WIDTH_OF_SCREEN = 4;                                    
-	S32 width = gViewerWindow->getWindowWidth() + FUDGE_WIDTH_OF_SCREEN;   
+	S32 width = gViewerWindow->getWindowWidthScaled() + FUDGE_WIDTH_OF_SCREEN;   
 	S32 pad = 2;
 
 	// this function may be called before postBuild(), in which case mResizeHandle won't have been set up yet.
diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp
index 9400840bdfaa4b3a85dbfeaf911fe3da350d55ac..e2ccc05e30f3e75358c655993906a8d12acfaab9 100644
--- a/indra/newview/lltoolfocus.cpp
+++ b/indra/newview/lltoolfocus.cpp
@@ -365,7 +365,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
 			// Orbit tool
 			if (hasMouseCapture())
 			{
-				const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidth();
+				const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthRaw();
 
 				if (dx != 0)
 				{
@@ -393,7 +393,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
 				F32 dist = (F32) camera_to_focus.normVec();
 
 				// Fudge factor for pan
-				F32 meters_per_pixel = 3.f * dist / gViewerWindow->getWorldViewWidth();
+				F32 meters_per_pixel = 3.f * dist / gViewerWindow->getWorldViewWidthRaw();
 
 				if (dx != 0)
 				{
@@ -415,7 +415,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask)
 			if (hasMouseCapture())
 			{
 
-				const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidth();
+				const F32 RADIANS_PER_PIXEL = 360.f * DEG_TO_RAD / gViewerWindow->getWorldViewWidthRaw();
 
 				if (dx != 0)
 				{
diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp
index b7a97562bd1b0e4cfa8385094515b542007c2fd1..44fb6e92715f38a2e9523568202358610b970ca5 100644
--- a/indra/newview/lltoolgrab.cpp
+++ b/indra/newview/lltoolgrab.cpp
@@ -510,8 +510,8 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
 	const F32 RADIANS_PER_PIXEL_X = 0.01f;
 	const F32 RADIANS_PER_PIXEL_Y = 0.01f;
 
-	S32 dx = x - (gViewerWindow->getWorldViewWidth() / 2);
-	S32 dy = y - (gViewerWindow->getWorldViewHeight() / 2);
+	S32 dx = x - (gViewerWindow->getWorldViewWidthRaw() / 2);
+	S32 dy = y - (gViewerWindow->getWorldViewHeightRaw() / 2);
 
 	if (dx != 0 || dy != 0)
 	{
@@ -631,10 +631,10 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
 			// Handle auto-rotation at screen edge.
 			LLVector3 grab_pos_agent = gAgent.getPosAgentFromGlobal( grab_point_global );
 
-			LLCoordGL grab_center_gl( gViewerWindow->getWorldViewWidth() / 2, gViewerWindow->getWorldViewHeight() / 2);
+			LLCoordGL grab_center_gl( gViewerWindow->getWorldViewWidthRaw() / 2, gViewerWindow->getWorldViewHeightRaw() / 2);
 			LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_pos_agent, grab_center_gl);
 
-			const S32 ROTATE_H_MARGIN = gViewerWindow->getWorldViewWidth() / 20;
+			const S32 ROTATE_H_MARGIN = gViewerWindow->getWorldViewWidthRaw() / 20;
 			const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD;
 			const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped;
 			// ...build mode moves camera about focus point
@@ -649,7 +649,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
 					gAgent.cameraOrbitAround(rotate_angle);
 				}
 			}
-			else if (grab_center_gl.mX > gViewerWindow->getWorldViewWidth() - ROTATE_H_MARGIN)
+			else if (grab_center_gl.mX > gViewerWindow->getWorldViewWidthRaw() - ROTATE_H_MARGIN)
 			{
 				if (gAgent.getFocusOnAvatar())
 				{
@@ -662,7 +662,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
 			}
 
 			// Don't move above top of screen or below bottom
-			if ((grab_center_gl.mY < gViewerWindow->getWorldViewHeight() - 6)
+			if ((grab_center_gl.mY < gViewerWindow->getWorldViewHeightRaw() - 6)
 				&& (grab_center_gl.mY > 24))
 			{
 				// Transmit update to simulator
@@ -893,7 +893,7 @@ void LLToolGrab::handleHoverInactive(S32 x, S32 y, MASK mask)
 				gAgent.yaw(rotate_angle);
 				//gAgent.setControlFlags(AGENT_CONTROL_YAW_POS);
 			}
-			else if (x == (gViewerWindow->getWorldViewWidth() - 1) )
+			else if (x == (gViewerWindow->getWorldViewWidthRaw() - 1) )
 			{
 				gAgent.yaw(-rotate_angle);
 				//gAgent.setControlFlags(AGENT_CONTROL_YAW_NEG);
diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp
index 53d71a42cfaea534cd54cde2d4b8ab15e70c76a1..a441d653c7cccd9574716872f0f637a12b1e4ecf 100644
--- a/indra/newview/lltoolgun.cpp
+++ b/indra/newview/lltoolgun.cpp
@@ -140,7 +140,7 @@ void LLToolGun::draw()
 	{
 		LLUIImagePtr crosshair = LLUI::getUIImage("crosshairs.tga");
 		crosshair->draw(
-			( gViewerWindow->getVirtualWorldViewRect().getWidth() - crosshair->getWidth() ) / 2,
-			( gViewerWindow->getVirtualWorldViewRect().getHeight() - crosshair->getHeight() ) / 2);
+			( gViewerWindow->getWorldViewRectScaled().getWidth() - crosshair->getWidth() ) / 2,
+			( gViewerWindow->getWorldViewRectScaled().getHeight() - crosshair->getHeight() ) / 2);
 	}
 }
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 93da32b115f2f38e851b0e5bc167588dd2f9cf8f..d49ea5109dd645e57ee5dcfde42d3679f273745f 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -700,13 +700,17 @@ BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask)
 
 				// *HACK: We may select this object, so pretend it was clicked
 				mPick = mHoverPick;
-				LLToolTipMgr::instance().show(LLToolTip::Params()
-					.message(avatar_name)
-					.image(LLUI::getUIImage("Info"))
-					.click_callback(boost::bind(showAvatarInspector, hover_object->getID()))
-					.visible_time_near(6.f)
-					.visible_time_far(3.f)
-					.wrap(false));
+				LLInspector::Params p;
+				p.message(avatar_name);
+				p.image(LLUI::getUIImage("Info"));
+				p.click_callback(boost::bind(showAvatarInspector, hover_object->getID()));
+				p.visible_time_near(6.f);
+				p.visible_time_far(3.f);
+				p.wrap(false);
+
+				p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
+				
+				LLToolTipMgr::instance().show(p);
 			}
 		}
 		else
@@ -787,18 +791,22 @@ BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask)
 				{
 					// We may select this object, so pretend it was clicked
 					mPick = mHoverPick;
-					LLToolTipMgr::instance().show(LLToolTip::Params()
-						.message(tooltip_msg)
-						.image(LLUI::getUIImage("Info_Off"))
-						.click_callback(boost::bind(showObjectInspector, hover_object->getID(), mHoverPick.mObjectFace))
-						.time_based_media(is_time_based_media)
-						.web_based_media(is_web_based_media)						  
-						.media_playing(is_media_playing)						  
-						.click_playmedia_callback(boost::bind(playCurrentMedia, mHoverPick))
-						.click_homepage_callback(boost::bind(VisitHomePage, mHoverPick))						
-						.visible_time_near(6.f)
-						.visible_time_far(3.f)
-						.wrap(false));
+					LLInspector::Params p;
+					p.message(tooltip_msg);
+					p.image(LLUI::getUIImage("Info_Off"));
+					p.click_callback(boost::bind(showObjectInspector, hover_object->getID(), mHoverPick.mObjectFace));
+					p.time_based_media(is_time_based_media);
+					p.web_based_media(is_web_based_media);
+					p.media_playing(is_media_playing);
+					p.click_playmedia_callback(boost::bind(playCurrentMedia, mHoverPick));
+					p.click_homepage_callback(boost::bind(VisitHomePage, mHoverPick));
+					p.visible_time_near(6.f);
+					p.visible_time_far(3.f);
+					p.wrap(false);
+
+					p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
+					
+					LLToolTipMgr::instance().show(p);
 				}
 			}
 		}
diff --git a/indra/newview/lluilistener.cpp b/indra/newview/lluilistener.cpp
index 9c643e78dec9ee2fcd8f0833a7697ec3308a75f6..8b4cfa72481582dcafabaef2e0cb4f9b0316bf70 100644
--- a/indra/newview/lluilistener.cpp
+++ b/indra/newview/lluilistener.cpp
@@ -20,10 +20,16 @@
 #include "lluictrl.h"
 #include "llerror.h"
 
-LLUIListener::LLUIListener(const std::string& name):
-    LLDispatchListener(name, "op")
+LLUIListener::LLUIListener():
+    LLEventAPI("UI",
+               "LLUICtrl::CommitCallbackRegistry listener.\n"
+               "Capable of invoking any function (with parameter) you can specify in XUI.")
 {
-    add("call", &LLUIListener::call, LLSD().insert("function", LLSD()));
+    add("call",
+        "Invoke the operation named by [\"function\"], passing [\"parameter\"],\n"
+        "as if from a user gesture on a menu -- or a button click.",
+        &LLUIListener::call,
+        LLSD().insert("function", LLSD()));
 }
 
 void LLUIListener::call(const LLSD& event) const
diff --git a/indra/newview/lluilistener.h b/indra/newview/lluilistener.h
index ea904a99ff86b82bae69b85d79a920ad5d84cc9f..8605d60bd33ecae10252b81965be9d873314fe09 100644
--- a/indra/newview/lluilistener.h
+++ b/indra/newview/lluilistener.h
@@ -12,15 +12,15 @@
 #if ! defined(LL_LLUILISTENER_H)
 #define LL_LLUILISTENER_H
 
-#include "lleventdispatcher.h"
+#include "lleventapi.h"
 #include <string>
 
 class LLSD;
 
-class LLUIListener: public LLDispatchListener
+class LLUIListener: public LLEventAPI
 {
 public:
-    LLUIListener(const std::string& name);
+    LLUIListener();
 
 private:
     void call(const LLSD& event) const;
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index a3daca6fa42947c000fd80095cb4775373a5efe3..9e064d81356dd37417fd93d03db6c8309b0fa70f 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -364,9 +364,9 @@ bool LLURLDispatcher::dispatchRightClick(const std::string& url)
 bool LLURLDispatcher::dispatchFromTextEditor(const std::string& url)
 {
 	// *NOTE: Text editors are considered sources of trusted URLs
-	// in order to make objectim and avatar profile links in chat
-	// history work.  While a malicious resident could chat an app
-	// SLURL, the receiving resident will see it and must affirmatively
+	// in order to make avatar profile links in chat history work.
+	// While a malicious resident could chat an app SLURL, the
+	// receiving resident will see it and must affirmatively
 	// click on it.
 	// *TODO: Make this trust model more refined.  JC
 	const bool trusted_browser = true;
diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp
index b5709fa10214720a68131ad5bedd65c9e8be5609..5566fea89f2217b32f3681bdb17513d87e727698 100644
--- a/indra/newview/llviewercamera.cpp
+++ b/indra/newview/llviewercamera.cpp
@@ -401,10 +401,10 @@ void LLViewerCamera::setPerspective(BOOL for_selection,
 	
 	if (for_selection && (width > 1 || height > 1))
 	{
-		calculateFrustumPlanesFromWindow((F32)(x - width / 2) / (F32)gViewerWindow->getWindowWidth() - 0.5f,
-								(F32)(y_from_bot - height / 2) / (F32)gViewerWindow->getWindowHeight() - 0.5f,
-								(F32)(x + width / 2) / (F32)gViewerWindow->getWindowWidth() - 0.5f,
-								(F32)(y_from_bot + height / 2) / (F32)gViewerWindow->getWindowHeight() - 0.5f);
+		calculateFrustumPlanesFromWindow((F32)(x - width / 2) / (F32)gViewerWindow->getWindowWidthScaled() - 0.5f,
+								(F32)(y_from_bot - height / 2) / (F32)gViewerWindow->getWindowHeightScaled() - 0.5f,
+								(F32)(x + width / 2) / (F32)gViewerWindow->getWindowWidthScaled() - 0.5f,
+								(F32)(y_from_bot + height / 2) / (F32)gViewerWindow->getWindowHeightScaled() - 0.5f);
 
 	}
 
@@ -469,7 +469,7 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord
 		}
 	}
 
-	LLRect world_view_rect = gViewerWindow->getWorldViewRect();
+	LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
 	S32	viewport[4];
 	viewport[0] = world_view_rect.mLeft;
 	viewport[1] = world_view_rect.mBottom;
@@ -485,7 +485,7 @@ BOOL LLViewerCamera::projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoord
 		y /= gViewerWindow->getDisplayScale().mV[VY];
 
 		// should now have the x,y coords of grab_point in screen space
-		LLRect world_view_rect = gViewerWindow->getVirtualWorldViewRect();
+		LLRect world_view_rect = gViewerWindow->getWorldViewRectScaled();
 
 		// convert to pixel coordinates
 		S32 int_x = lltrunc(x);
@@ -572,7 +572,7 @@ BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent,
 		in_front = FALSE;
 	}
 
-	LLRect world_view_rect = gViewerWindow->getWorldViewRect();
+	LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
 	S32	viewport[4];
 	viewport[0] = world_view_rect.mLeft;
 	viewport[1] = world_view_rect.mBottom;
@@ -587,7 +587,7 @@ BOOL LLViewerCamera::projectPosAgentToScreenEdge(const LLVector3 &pos_agent,
 		x /= gViewerWindow->getDisplayScale().mV[VX];
 		y /= gViewerWindow->getDisplayScale().mV[VY];
 		// should now have the x,y coords of grab_point in screen space
-		const LLRect& world_rect = gViewerWindow->getVirtualWorldViewRect();
+		const LLRect& world_rect = gViewerWindow->getWorldViewRectScaled();
 
 		// ...sanity check
 		S32 int_x = lltrunc(x);
diff --git a/indra/newview/llviewercontrollistener.cpp b/indra/newview/llviewercontrollistener.cpp
index ecba1b8eb0a3ea26dc4aa33eb24d1856f96ecf6b..0b9db1b906d33052bafe98da18c01378843dc605 100644
--- a/indra/newview/llviewercontrollistener.cpp
+++ b/indra/newview/llviewercontrollistener.cpp
@@ -18,12 +18,22 @@
 LLViewerControlListener gSavedSettingsListener;
 
 LLViewerControlListener::LLViewerControlListener()
-	: LLDispatchListener("LLViewerControl",  "group")
+	: LLEventAPI("LLViewerControl",
+                 "LLViewerControl listener: set, toggle or set default for various controls",
+                 "group")
 {
-	add("Global", boost::bind(&LLViewerControlListener::set, &gSavedSettings, _1));
-	add("PerAccount", boost::bind(&LLViewerControlListener::set, &gSavedPerAccountSettings, _1));
-	add("Warning", boost::bind(&LLViewerControlListener::set, &gWarningSettings, _1));
-	add("Crash", boost::bind(&LLViewerControlListener::set, &gCrashSettings, _1));
+	add("Global",
+        "Set gSavedSettings control [\"key\"] to value [\"value\"]",
+        boost::bind(&LLViewerControlListener::set, &gSavedSettings, _1));
+	add("PerAccount",
+        "Set gSavedPerAccountSettings control [\"key\"] to value [\"value\"]",
+        boost::bind(&LLViewerControlListener::set, &gSavedPerAccountSettings, _1));
+	add("Warning",
+        "Set gWarningSettings control [\"key\"] to value [\"value\"]",
+        boost::bind(&LLViewerControlListener::set, &gWarningSettings, _1));
+	add("Crash",
+        "Set gCrashSettings control [\"key\"] to value [\"value\"]",
+        boost::bind(&LLViewerControlListener::set, &gCrashSettings, _1));
 
 #if 0
 	add(/*"toggleControl",*/ "Global", boost::bind(&LLViewerControlListener::toggleControl, &gSavedSettings, _1));
diff --git a/indra/newview/llviewercontrollistener.h b/indra/newview/llviewercontrollistener.h
index cacf97e908e8f6784339e155b20267b718acfbdf..88afbb871dc025ca6a84bd9b5c9a82a90af7dfdf 100644
--- a/indra/newview/llviewercontrollistener.h
+++ b/indra/newview/llviewercontrollistener.h
@@ -12,12 +12,12 @@
 #ifndef LL_LLVIEWERCONTROLLISTENER_H
 #define LL_LLVIEWERCONTROLLISTENER_H
 
-#include "lleventdispatcher.h"
+#include "lleventapi.h"
 
 class LLControlGroup;
 class LLSD;
 
-class  LLViewerControlListener : public LLDispatchListener
+class  LLViewerControlListener : public LLEventAPI
 {
 public:
 	LLViewerControlListener();
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index e0bb8fedeb1da7aebe4f6d33bfa6482eb4ead218..5b733ed817be95014757a7b424cae6d784545ea3 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -782,10 +782,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		//		LLRect floater_rect = frontmost_floaterp->calcScreenRect();
 		//		// deflate by one pixel so rounding errors don't occlude outside of floater extents
 		//		floater_rect.stretch(-1);
-		//		LLRectf floater_3d_rect((F32)floater_rect.mLeft / (F32)gViewerWindow->getWindowWidth(), 
-		//								(F32)floater_rect.mTop / (F32)gViewerWindow->getWindowHeight(),
-		//								(F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidth(),
-		//								(F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeight());
+		//		LLRectf floater_3d_rect((F32)floater_rect.mLeft / (F32)gViewerWindow->getWindowWidthScaled(), 
+		//								(F32)floater_rect.mTop / (F32)gViewerWindow->getWindowHeightScaled(),
+		//								(F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidthScaled(),
+		//								(F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeightScaled());
 		//		floater_3d_rect.translate(-0.5f, -0.5f);
 		//		glTranslatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear());
 		//		glScalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f);
@@ -874,7 +874,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		/// and then display it again with compositor effects.
 		/// Using render to texture would be faster/better, but I don't have a 
 		/// grasp of their full display stack just yet.
-		// gPostProcess->apply(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight());
+		// gPostProcess->apply(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
 		
 		if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender)
 		{
@@ -1011,7 +1011,7 @@ void render_hud_attachments()
 
 BOOL setup_hud_matrices()
 {
-	LLRect whole_screen = gViewerWindow->getVirtualWindowRect();
+	LLRect whole_screen = gViewerWindow->getWindowRectScaled();
 
 	// apply camera zoom transform (for high res screenshots)
 	F32 zoom_factor = LLViewerCamera::getInstance()->getZoomFactor();
@@ -1019,13 +1019,13 @@ BOOL setup_hud_matrices()
 	if (zoom_factor > 1.f)
 	{
 		S32 num_horizontal_tiles = llceil(zoom_factor);
-		S32 tile_width = llround((F32)gViewerWindow->getWindowWidth() / zoom_factor);
-		S32 tile_height = llround((F32)gViewerWindow->getWindowHeight() / zoom_factor);
+		S32 tile_width = llround((F32)gViewerWindow->getWindowWidthScaled() / zoom_factor);
+		S32 tile_height = llround((F32)gViewerWindow->getWindowHeightScaled() / zoom_factor);
 		int tile_y = sub_region / num_horizontal_tiles;
 		int tile_x = sub_region - (tile_y * num_horizontal_tiles);
 		glh::matrix4f mat;
 
-		whole_screen.setLeftTopAndSize(tile_x * tile_width, gViewerWindow->getWindowHeight() - (tile_y * tile_height), tile_width, tile_height);
+		whole_screen.setLeftTopAndSize(tile_x * tile_width, gViewerWindow->getWindowHeightScaled() - (tile_y * tile_height), tile_width, tile_height);
 	}
 
 	return setup_hud_matrices(whole_screen);
@@ -1048,12 +1048,12 @@ BOOL setup_hud_matrices(const LLRect& screen_region)
 		F32 aspect_ratio = LLViewerCamera::getInstance()->getAspect();
 
 		glh::matrix4f mat;
-		F32 scale_x = (F32)gViewerWindow->getWindowWidth() / (F32)screen_region.getWidth();
-		F32 scale_y = (F32)gViewerWindow->getWindowHeight() / (F32)screen_region.getHeight();
+		F32 scale_x = (F32)gViewerWindow->getWindowWidthScaled() / (F32)screen_region.getWidth();
+		F32 scale_y = (F32)gViewerWindow->getWindowHeightScaled() / (F32)screen_region.getHeight();
 		mat.set_scale(glh::vec3f(scale_x, scale_y, 1.f));
 		mat.set_translate(
-			glh::vec3f(clamp_rescale((F32)screen_region.getCenterX(), 0.f, (F32)gViewerWindow->getWindowWidth(), 0.5f * scale_x * aspect_ratio, -0.5f * scale_x * aspect_ratio),
-						clamp_rescale((F32)screen_region.getCenterY(), 0.f, (F32)gViewerWindow->getWindowHeight(), 0.5f * scale_y, -0.5f * scale_y),
+			glh::vec3f(clamp_rescale((F32)screen_region.getCenterX(), 0.f, (F32)gViewerWindow->getWindowWidthScaled(), 0.5f * scale_x * aspect_ratio, -0.5f * scale_x * aspect_ratio),
+						clamp_rescale((F32)screen_region.getCenterY(), 0.f, (F32)gViewerWindow->getWindowHeightScaled(), 0.5f * scale_y, -0.5f * scale_y),
 						0.f));
 		proj *= mat;
 
@@ -1269,8 +1269,8 @@ void render_ui_2d()
 		int pos_y = sub_region / llceil(zoom_factor);
 		int pos_x = sub_region - (pos_y*llceil(zoom_factor));
 		// offset for this tile
-		LLFontGL::sCurOrigin.mX -= llround((F32)gViewerWindow->getWindowWidth() * (F32)pos_x / zoom_factor);
-		LLFontGL::sCurOrigin.mY -= llround((F32)gViewerWindow->getWindowHeight() * (F32)pos_y / zoom_factor);
+		LLFontGL::sCurOrigin.mX -= llround((F32)gViewerWindow->getWindowWidthScaled() * (F32)pos_x / zoom_factor);
+		LLFontGL::sCurOrigin.mY -= llround((F32)gViewerWindow->getWindowHeightScaled() * (F32)pos_y / zoom_factor);
 	}
 
 	stop_glerror();
@@ -1280,8 +1280,8 @@ void render_ui_2d()
 	if (gAgent.getAvatarObject() && gAgent.mHUDCurZoom < 0.98f)
 	{
 		glPushMatrix();
-		S32 half_width = (gViewerWindow->getWindowWidth() / 2);
-		S32 half_height = (gViewerWindow->getWindowHeight() / 2);
+		S32 half_width = (gViewerWindow->getWindowWidthScaled() / 2);
+		S32 half_height = (gViewerWindow->getWindowHeightScaled() / 2);
 		glScalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f);
 		glTranslatef((F32)half_width, (F32)half_height, 0.f);
 		F32 zoom = gAgent.mHUDCurZoom;
@@ -1341,8 +1341,8 @@ void render_ui_2d()
 
 		LLGLDisable cull(GL_CULL_FACE);
 		LLGLDisable blend(GL_BLEND);
-		S32 width = gViewerWindow->getWindowWidth();
-		S32 height = gViewerWindow->getWindowHeight();
+		S32 width = gViewerWindow->getWindowWidthScaled();
+		S32 height = gViewerWindow->getWindowHeightScaled();
 		gGL.getTexUnit(0)->bind(&gPipeline.mUIScreen);
 		gGL.begin(LLRender::TRIANGLE_STRIP);
 		gGL.color4f(1,1,1,1);
@@ -1411,8 +1411,8 @@ void render_disconnected_background()
 	}
 
 	// Make sure the progress view always fills the entire window.
-	S32 width = gViewerWindow->getWindowWidth();
-	S32 height = gViewerWindow->getWindowHeight();
+	S32 width = gViewerWindow->getWindowWidthScaled();
+	S32 height = gViewerWindow->getWindowHeightScaled();
 
 	if (gDisconnectedImagep)
 	{
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index edbac69e1b888a74bdc7875fafe077a107506eb9..964d3bc2fa5728227eb596cd81c535528c57bd09 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -112,6 +112,7 @@
 #include "llinspectavatar.h"
 #include "llinspectgroup.h"
 #include "llinspectobject.h"
+#include "llinspectremoteobject.h"
 #include "llmediaremotectrl.h"
 #include "llmoveview.h"
 #include "llnearbychat.h"
@@ -176,6 +177,7 @@ void LLViewerFloaterReg::registerFloaters()
 	LLInspectAvatarUtil::registerFloater();
 	LLInspectGroupUtil::registerFloater();
 	LLInspectObjectUtil::registerFloater();
+	LLInspectRemoteObjectUtil::registerFloater();
 	
 	LLFloaterReg::add("lagmeter", "floater_lagmeter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLagMeter>);
 	LLFloaterReg::add("land_holdings", "floater_land_holdings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLandHoldings>);
diff --git a/indra/newview/llviewerhelp.cpp b/indra/newview/llviewerhelp.cpp
index 0e0727e38250e3fd02b4408eb7f449f0860277f9..056260791c4e5460c24c77c84e3ec888b19dff7f 100644
--- a/indra/newview/llviewerhelp.cpp
+++ b/indra/newview/llviewerhelp.cpp
@@ -39,6 +39,7 @@
 #include "llviewercontrol.h"
 #include "llversionviewer.h"
 #include "llappviewer.h"
+#include "lllogininstance.h"
 
 #include "llviewerhelputil.h"
 #include "llviewerhelp.h"
@@ -51,17 +52,25 @@ void LLViewerHelp::showTopic(const std::string &topic)
 {
 	showHelp();
 	
+	// allow overriding the help server with a local help file
 	if( gSavedSettings.getBOOL("HelpUseLocal") )
 	{
 		LLFloaterHelpBrowser* helpbrowser = dynamic_cast<LLFloaterHelpBrowser*>(LLFloaterReg::getInstance("help_browser"));
 		helpbrowser->navigateToLocalPage( "help-offline" , "index.html" );
+		return;
 	}
-	else 
+
+	// use a special login topic before the user logs in
+	std::string help_topic = topic;
+	if (! LLLoginInstance::getInstance()->authSuccess())
 	{
-		const LLOSInfo& osinfo = LLAppViewer::instance()->getOSInfo();
-		std::string helpURL = LLViewerHelpUtil::buildHelpURL( topic, gSavedSettings, osinfo );
-		setRawURL( helpURL );
+		help_topic = preLoginTopic();
 	}
+
+	// work out the URL for this topic and display it 
+	const LLOSInfo& osinfo = LLAppViewer::instance()->getOSInfo();
+	std::string helpURL = LLViewerHelpUtil::buildHelpURL( help_topic, gSavedSettings, osinfo );
+	setRawURL( helpURL );
 }
 
 std::string LLViewerHelp::defaultTopic()
@@ -70,6 +79,12 @@ std::string LLViewerHelp::defaultTopic()
 	return "this_is_fallbacktopic";
 }
 
+std::string LLViewerHelp::preLoginTopic()
+{
+	// *hack: to be done properly
+	return "pre_login_help";
+}
+
 //////////////////////////////
 // our own interfaces
 
diff --git a/indra/newview/llviewerhelp.h b/indra/newview/llviewerhelp.h
index 17aab6f239738a75de2a2aa53bcd885cb1cf836b..dcb5ae32c98956b7349b37703e9adc723b2f9ffc 100644
--- a/indra/newview/llviewerhelp.h
+++ b/indra/newview/llviewerhelp.h
@@ -57,6 +57,9 @@ class LLViewerHelp : public LLHelp, public LLSingleton<LLViewerHelp>
 	// return topic derived from viewer UI focus, else default topic
 	std::string getTopicFromFocus();
 
+	// return topic to use before the user logs in
+	std::string preLoginTopic();
+
  private:
 	static void showHelp(); // make sure help UI is visible & raised
 	static void setRawURL(std::string url); // send URL to help UI
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 69650425cb437228f7dab228986e2114a56cf36a..493457704bbdcb96864790d355e1536bf9555a66 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -295,11 +295,21 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
 		}
 	}
 	
-	if(media_impl && needs_navigate)
+	if(media_impl)
 	{
 		std::string url = media_entry->getCurrentURL();
-			
-		media_impl->navigateTo(url, "", true, true);
+		if(needs_navigate)
+		{
+			media_impl->navigateTo(url, "", true, true);
+		}
+		else if(!media_impl->mMediaURL.empty() && (media_impl->mMediaURL != url))
+		{
+			// If we already have a non-empty media URL set and we aren't doing a navigate, update the media URL to match the media entry.
+			media_impl->mMediaURL = url;
+
+			// If this causes a navigate at some point (such as after a reload), it should be considered server-driven so it isn't broadcast.
+			media_impl->mNavigateServerRequest = true;
+		}
 	}
 	
 	return media_impl;
@@ -847,7 +857,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
 		{
 			LLPluginClassMedia* media_source = new LLPluginClassMedia(owner);
 			media_source->setSize(default_width, default_height);
-			if (media_source->init(launcher_name, plugin_name))
+			if (media_source->init(launcher_name, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")))
 			{
 				return media_source;
 			}
@@ -1133,11 +1143,15 @@ void LLViewerMediaImpl::mouseMove(S32 x, S32 y, MASK mask)
 void LLViewerMediaImpl::mouseDown(const LLVector2& texture_coords, MASK mask, S32 button)
 {
 	if(mMediaSource)
-	{		
-		mouseDown(
-			llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()),
-			llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()),
-			mask, button);
+	{
+		// scale x and y to texel units.
+		S32 x = llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth());
+		S32 y = llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight());
+
+		// Adjust for the difference between the actual texture height and the amount of the texture in use.
+		y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight());
+
+		mouseDown(x, y, mask, button);
 	}
 }
 
@@ -1145,10 +1159,14 @@ void LLViewerMediaImpl::mouseUp(const LLVector2& texture_coords, MASK mask, S32
 {
 	if(mMediaSource)
 	{		
-		mouseUp(
-			llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()),
-			llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()),
-			mask, button);
+		// scale x and y to texel units.
+		S32 x = llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth());
+		S32 y = llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight());
+
+		// Adjust for the difference between the actual texture height and the amount of the texture in use.
+		y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight());
+
+		mouseUp(x, y, mask, button);
 	}
 }
 
@@ -1156,10 +1174,14 @@ void LLViewerMediaImpl::mouseMove(const LLVector2& texture_coords, MASK mask)
 {
 	if(mMediaSource)
 	{		
-		mouseMove(
-			llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth()),
-			llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight()),
-			mask);
+		// scale x and y to texel units.
+		S32 x = llround(texture_coords.mV[VX] * mMediaSource->getTextureWidth());
+		S32 y = llround((1.0f - texture_coords.mV[VY]) * mMediaSource->getTextureHeight());
+
+		// Adjust for the difference between the actual texture height and the amount of the texture in use.
+		y -= (mMediaSource->getTextureHeight() - mMediaSource->getHeight());
+
+		mouseMove(x, y, mask);
 	}
 }
 
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index cb1be5fabc913a7b433ae8a2f32ce6c6d41cc26e..976d89a5b7f2f3f6d9fb5a4a8c75dc9c498764fd 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -415,7 +415,7 @@ class LLMenuParcelObserver : public LLParcelObserver
 
 static LLMenuParcelObserver* gMenuParcelObserver = NULL;
 
-static LLUIListener sUIListener("UI");
+static LLUIListener sUIListener;
 
 LLMenuParcelObserver::LLMenuParcelObserver()
 {
@@ -468,16 +468,6 @@ void set_underclothes_menu_options()
 void init_menus()
 {
 	S32 top = gViewerWindow->getRootView()->getRect().getHeight();
-	S32 width = gViewerWindow->getRootView()->getRect().getWidth();
-
-	//
-	// Main menu bar
-	//
-	gMenuHolder = new LLViewerMenuHolderGL();
-	gMenuHolder->setRect(LLRect(0, top, width, 0));
-	gMenuHolder->setFollowsAll();
-
-	LLMenuGL::sMenuContainer = gMenuHolder;
 
 	// Initialize actions
 	initialize_menus();
@@ -3807,7 +3797,7 @@ class LLViewDefaultUISize : public view_listener_t
 	{
 		gSavedSettings.setF32("UIScaleFactor", 1.0f);
 		gSavedSettings.setBOOL("UIAutoScale", FALSE);	
-		gViewerWindow->reshape(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight());
+		gViewerWindow->reshape(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
 		return true;
 	}
 };
@@ -7078,6 +7068,11 @@ void handle_test_load_url(void*)
 //
 // LLViewerMenuHolderGL
 //
+static LLDefaultChildRegistry::Register<LLViewerMenuHolderGL> r("menu_holder");
+
+LLViewerMenuHolderGL::LLViewerMenuHolderGL(const LLViewerMenuHolderGL::Params& p)
+: LLMenuHolderGL(p)
+{}
 
 BOOL LLViewerMenuHolderGL::hideMenus()
 {
@@ -7087,8 +7082,11 @@ BOOL LLViewerMenuHolderGL::hideMenus()
 	mParcelSelection = NULL;
 	mObjectSelection = NULL;
 
-	gMenuBarView->clearHoverItem();
-	gMenuBarView->resetMenuTrigger();
+	if (gMenuBarView)
+	{
+		gMenuBarView->clearHoverItem();
+		gMenuBarView->resetMenuTrigger();
+	}
 
 	return handled;
 }
diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h
index db4eb3be9d89aef864e3718e49b7d075a75c5426..9a6fe03f9fa3baee3d46c29bc629fda12dbc6745 100644
--- a/indra/newview/llviewermenu.h
+++ b/indra/newview/llviewermenu.h
@@ -133,6 +133,11 @@ void handle_export_selected( void * );
 class LLViewerMenuHolderGL : public LLMenuHolderGL
 {
 public:
+	struct Params : public LLInitParam::Block<Params, LLMenuHolderGL::Params>
+	{};
+
+	LLViewerMenuHolderGL(const Params& p);
+
 	virtual BOOL hideMenus();
 	
 	void setParcelSelection(LLSafeHandle<LLParcelSelection> selection);
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index d17c7e486feab21400b49b85d475103565eb3b46..753acab172b84a21d8e16eba388516ef52855bf1 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -404,8 +404,8 @@ class LLFileTakeSnapshotToDisk : public view_listener_t
 	{
 		LLPointer<LLImageRaw> raw = new LLImageRaw;
 
-		S32 width = gViewerWindow->getWindowDisplayWidth();
-		S32 height = gViewerWindow->getWindowDisplayHeight();
+		S32 width = gViewerWindow->getWindowWidthRaw();
+		S32 height = gViewerWindow->getWindowHeightRaw();
 
 		if (gSavedSettings.getBOOL("HighResSnapshot"))
 		{
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index bb61b4e16fc23eb3e2ecafa2b625612af853f8b1..4088eafe16cc2303ee00288712cc9ad7e1e44200 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1431,6 +1431,17 @@ bool goto_url_callback(const LLSD& notification, const LLSD& response)
 }
 static LLNotificationFunctorRegistration goto_url_callback_reg("GotoURL", goto_url_callback);
 
+bool inspect_remote_object_callback(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotification::getSelectedOption(notification, response);
+	if (0 == option)
+	{
+		LLFloaterReg::showInstance("inspect_remote_object", notification["payload"]);
+	}
+	return false;
+}
+static LLNotificationFunctorRegistration inspect_remote_object_callback_reg("ServerObjectMessage", inspect_remote_object_callback);
+
 void process_improved_im(LLMessageSystem *msg, void **user_data)
 {
 	if (gNoRender)
@@ -1943,9 +1954,23 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 				return;
 			}
 
+			// Build a link to open the object IM info window.
+			std::string location = ll_safe_string((char*)binary_bucket, binary_bucket_size-1);
+
 			LLSD substitutions;
+			substitutions["NAME"] = name;
 			substitutions["MSG"] = message;
-			LLNotifications::instance().add("ServerObjectMessage", substitutions);
+
+			LLSD payload;
+			payload["object_id"] = session_id;
+			payload["owner_id"] = from_id;
+			payload["slurl"] = location;
+			payload["name"] = name;
+			if (from_group)
+			{
+				payload["groupowned"] = "true";
+			}
+			LLNotifications::instance().add("ServerObjectMessage", substitutions, payload);
 		}
 		break;
 	case IM_FROM_TASK_AS_ALERT:
@@ -4329,7 +4354,7 @@ void process_alert_core(const std::string& message, BOOL modal)
 		std::string snap_filename = gDirUtilp->getLindenUserDir();
 		snap_filename += gDirUtilp->getDirDelimiter();
 		snap_filename += SCREEN_HOME_FILENAME;
-		gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, FALSE);
+		gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE);
 	}
 
 	const std::string ALERT_PREFIX("ALERT: ");
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index caa94dba381252b8369484d446968428d09ae007..939d5e3970dff8b12f36ae38f81b68ead2bde7e1 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -822,8 +822,8 @@ void send_stats()
 	// Screen size so the UI team can figure out how big the widgets
 	// appear and use a "typical" size for end user tests.
 
-	S32 window_width = gViewerWindow->getWindowDisplayWidth();
-	S32 window_height = gViewerWindow->getWindowDisplayHeight();
+	S32 window_width = gViewerWindow->getWindowWidthRaw();
+	S32 window_height = gViewerWindow->getWindowHeightRaw();
 	S32 window_size = (window_width * window_height) / 1024;
 	misc["string_1"] = llformat("%d", window_size);
 	// misc["string_2"] = 
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index fc09c946af4adb7404bf65b5227bb9c962d71f68..1054223dcf113a8ef2eb9f0251a96383d599d1a5 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -315,7 +315,7 @@ class LLDebugText
 		mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f );
 
 		// Draw stuff growing up from right lower corner of screen
-		U32 xpos = mWindow->getWindowWidth() - 350;
+		U32 xpos = mWindow->getWindowWidthScaled() - 350;
 		U32 ypos = 64;
 		const U32 y_inc = 20;
 
@@ -600,8 +600,8 @@ void LLViewerWindow::updateDebugText()
 
 BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window,  LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down)
 {
-	std::string buttonname;
-	std::string buttonstatestr; 
+	const char* buttonname = "";
+	const char* buttonstatestr = "";
 	BOOL handled = FALSE;	
 	S32 x = pos.mX;
 	S32 y = pos.mY;
@@ -1196,9 +1196,9 @@ LLViewerWindow::LLViewerWindow(
 	mActive(TRUE),
 	mWantFullscreen(fullscreen),
 	mShowFullscreenProgress(FALSE),
-	mWindowRect(0, height, width, 0),
-	mVirtualWindowRect(0, height, width, 0),
-	mWorldViewRect(0, height, width, 0),
+	mWindowRectRaw(0, height, width, 0),
+	mWindowRectScaled(0, height, width, 0),
+	mWorldViewRectRaw(0, height, width, 0),
 	mLeftMouseDown(FALSE),
 	mMiddleMouseDown(FALSE),
 	mRightMouseDown(FALSE),
@@ -1212,7 +1212,7 @@ LLViewerWindow::LLViewerWindow(
 	mStatesDirty(false),
 	mIsFullscreenChecked(false),
 	mCurrResolutionIndex(0),
-    mViewerWindowListener(new LLViewerWindowListener("LLViewerWindow", this))
+    mViewerWindowListener(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"));
@@ -1267,8 +1267,8 @@ LLViewerWindow::LLViewerWindow(
 	{
 		LLCoordWindow size;
 		mWindow->getSize(&size);
-		mWindowRect.set(0, size.mY, size.mX, 0);
-		mVirtualWindowRect.set(0, llround((F32)size.mY / mDisplayScale.mV[VY]), llround((F32)size.mX / mDisplayScale.mV[VX]), 0);
+		mWindowRectRaw.set(0, size.mY, size.mX, 0);
+		mWindowRectScaled.set(0, llround((F32)size.mY / mDisplayScale.mV[VY]), llround((F32)size.mX / mDisplayScale.mV[VX]), 0);
 	}
 	
 	LLFontManager::initClass();
@@ -1324,15 +1324,15 @@ LLViewerWindow::LLViewerWindow(
 	// Create container for all sub-views
 	LLView::Params rvp;
 	rvp.name("root");
-	rvp.rect(mVirtualWindowRect);
+	rvp.rect(mWindowRectScaled);
 	rvp.mouse_opaque(false);
 	rvp.follows.flags(FOLLOWS_NONE);
 	mRootView = LLUICtrlFactory::create<LLRootView>(rvp);
 	LLUI::setRootView(mRootView);
 
 	// Make avatar head look forward at start
-	mCurrentMousePoint.mX = getWindowWidth() / 2;
-	mCurrentMousePoint.mY = getWindowHeight() / 2;
+	mCurrentMousePoint.mX = getWindowWidthScaled() / 2;
+	mCurrentMousePoint.mY = getWindowHeightScaled() / 2;
 
 	gShowOverlayTitle = gSavedSettings.getBOOL("ShowOverlayTitle");
 	mOverlayTitle = gSavedSettings.getString("OverlayTitle");
@@ -1377,10 +1377,14 @@ void LLViewerWindow::initGLDefaults()
 	gCylinder.prerender();
 }
 
+struct MainPanel : public LLPanel
+{
+};
+
 void LLViewerWindow::initBase()
 {
-	S32 height = getWindowHeight();
-	S32 width = getWindowWidth();
+	S32 height = getWindowHeightScaled();
+	S32 width = getWindowWidthScaled();
 
 	LLRect full_window(0, height, width, 0);
 
@@ -1400,30 +1404,18 @@ void LLViewerWindow::initBase()
 	// Create the floater view at the start so that other views can add children to it. 
 	// (But wait to add it as a child of the root view so that it will be in front of the 
 	// other views.)
+	MainPanel* main_view = new MainPanel();
+	LLUICtrlFactory::instance().buildPanel(main_view, "main_view.xml");
+	main_view->setShape(full_window);
+	getRootView()->addChild(main_view);
+
+	// placeholder widget that controls where "world" is rendered
+	mWorldViewPlaceholder = main_view->getChildView("world_view_rect")->getHandle();
 
 	// Constrain floaters to inside the menu and status bar regions.
-	LLRect floater_view_rect = full_window;
-	// make space for menu bar
-	floater_view_rect.mTop -= MENU_BAR_HEIGHT;
-
-	LLFloaterView::Params fvparams;
-	fvparams.name("Floater View");
-	fvparams.rect(floater_view_rect);
-	fvparams.mouse_opaque(false);
-	fvparams.follows.flags(FOLLOWS_ALL);
-	fvparams.tab_stop(false);
-	gFloaterView = LLUICtrlFactory::create<LLFloaterView> (fvparams);
-
-	LLSnapshotFloaterView::Params snapParams;
-	snapParams.name("Snapshot Floater View");
-	snapParams.rect(full_window);
-	snapParams.enabled(false);
-	gSnapshotFloaterView = LLUICtrlFactory::create<LLSnapshotFloaterView> (snapParams);
+	gFloaterView = getRootView()->getChild<LLFloaterView>("Floater View");
+	gSnapshotFloaterView = getRootView()->getChild<LLSnapshotFloaterView>("Snapshot Floater View");
 	
-	// Snapshot floater must start invisible otherwise it eats all
-	// the tooltips. JC
-	gSnapshotFloaterView->setVisible(FALSE);
-
 	// Console
 	llassert( !gConsole );
 	LLConsole::Params cp;
@@ -1447,43 +1439,21 @@ void LLViewerWindow::initBase()
 	}
 #endif
 
-	// Debug view over the console
-	LLDebugView::Params debug_p;
-	debug_p.name("DebugView");
-	debug_p.rect(full_window);
-	debug_p.follows.flags(FOLLOWS_ALL);
-	debug_p.visible(true);
-	gDebugView = LLUICtrlFactory::create<LLDebugView>(debug_p);
-	getRootView()->addChild(gDebugView);
-
-	// Add floater view at the end so it will be on top, and give it tab priority over others
-	getRootView()->addChild(gFloaterView, -1);
-	getRootView()->addChild(gSnapshotFloaterView);
-
-	// notify above floaters!
-	LLRect notify_rect = floater_view_rect;
-	LLNotifyBoxView::Params p;
-	p.name("notify_container");
-	p.rect(notify_rect);
-	p.mouse_opaque(false);
-	p.follows.flags(FOLLOWS_ALL);
-	gNotifyBoxView = LLUICtrlFactory::create<LLNotifyBoxView> (p);
-	getRootView()->addChild(gNotifyBoxView, -2);
-
-	// View for tooltips
-	LLToolTipView::Params hvp;
-	hvp.name("tooltip view");
-	hvp.rect(full_window);
-	hvp.follows.flags(FOLLOWS_ALL);
-	gToolTipView = LLUICtrlFactory::create<LLToolTipView>(hvp);
-	gToolTipView->setFollowsAll();
-	getRootView()->addChild(gToolTipView);
+	gDebugView = getRootView()->getChild<LLDebugView>("DebugView");
+	gDebugView->init();
+	gNotifyBoxView = getRootView()->getChild<LLNotifyBoxView>("notify_container");
+	gToolTipView = getRootView()->getChild<LLToolTipView>("tooltip view");
 
 	// Add the progress bar view (startup view), which overrides everything
 	mProgressView = new LLProgressView(full_window);
 	getRootView()->addChild(mProgressView);
 	setShowProgress(FALSE);
 	setProgressCancelButtonVisible(FALSE);
+
+	gMenuHolder = getRootView()->getChild<LLViewerMenuHolderGL>("Menu Holder");
+
+	LLMenuGL::sMenuContainer = gMenuHolder;
+
 }
 
 void LLViewerWindow::initWorldUI()
@@ -1492,20 +1462,19 @@ void LLViewerWindow::initWorldUI()
 	S32 width = mRootView->getRect().getWidth();
 	LLRect full_window(0, height, width, 0);
 
-	gIMMgr = LLIMMgr::getInstance();
 
-	// side tray
-	getRootView()->addChild(LLSideTray::getInstance());
+	gIMMgr = LLIMMgr::getInstance();
 
 	getRootView()->sendChildToFront(gFloaterView);
 	getRootView()->sendChildToFront(gSnapshotFloaterView);
 
 	// new bottom panel
-	LLRect rc = LLBottomTray::getInstance()->getRect();
-	rc.mLeft = 0;
-	rc.mRight = mRootView->getRect().getWidth();
-	LLBottomTray::getInstance()->reshape(rc.getWidth(),rc.getHeight(),FALSE);
-	LLBottomTray::getInstance()->setRect(rc);
+	LLPanel* bottom_tray_container = getRootView()->getChild<LLPanel>("bottom_tray_container");
+	LLBottomTray* bottom_tray = LLBottomTray::getInstance();
+	bottom_tray->setShape(bottom_tray_container->getLocalRect());
+	bottom_tray->setFollowsAll();
+	bottom_tray_container->addChild(bottom_tray);
+	bottom_tray_container->setVisible(TRUE);
 
 	// Pre initialize instance communicate instance;
 	//  currently needs to happen before initializing chat or IM
@@ -1521,17 +1490,6 @@ void LLViewerWindow::initWorldUI()
 	gMorphView = LLUICtrlFactory::create<LLMorphView>(mvp);
 	getRootView()->addChild(gMorphView);
 
-	// Make space for nav bar.
-	LLNavigationBar* navbar = LLNavigationBar::getInstance();
-	LLRect floater_view_rect = gFloaterView->getRect();
-	LLRect notify_view_rect = gNotifyBoxView->getRect();
-	floater_view_rect.mTop -= navbar->getDefNavBarHeight();
-	floater_view_rect.mBottom += LLBottomTray::getInstance()->getRect().getHeight();
-	notify_view_rect.mTop -= navbar->getDefNavBarHeight();
-	notify_view_rect.mBottom += LLBottomTray::getInstance()->getRect().getHeight();
-	gFloaterView->setRect(floater_view_rect);
-	gNotifyBoxView->setRect(notify_view_rect);
-
 	LLWorldMapView::initClass();
 	
 	// Force gFloaterWorldMap to initialize
@@ -1542,22 +1500,23 @@ void LLViewerWindow::initWorldUI()
 	LLFloaterReg::hideInstance("build");
 
 	// Status bar
-	S32 menu_bar_height = gMenuBarView->getRect().getHeight();
-	LLRect root_rect = getRootView()->getRect();
-	LLRect status_rect(0, root_rect.getHeight(), root_rect.getWidth(), root_rect.getHeight() - menu_bar_height);
-	gStatusBar = new LLStatusBar(status_rect);
-	gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP);
-
-	gStatusBar->reshape(root_rect.getWidth(), gStatusBar->getRect().getHeight(), TRUE);
-	gStatusBar->translate(0, root_rect.getHeight() - gStatusBar->getRect().getHeight());
+	LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container");
+	gStatusBar = new LLStatusBar(status_bar_container->getLocalRect());
+	gStatusBar->setFollowsAll();
+	gStatusBar->setShape(status_bar_container->getLocalRect());
 	// sync bg color with menu bar
 	gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor().get() );
+	status_bar_container->addChild(gStatusBar);
+	status_bar_container->setVisible(TRUE);
 
 	// Navigation bar
-	navbar->reshape(root_rect.getWidth(), navbar->getRect().getHeight(), TRUE); // *TODO: redundant?
-	navbar->translate(0, root_rect.getHeight() - menu_bar_height - navbar->getRect().getHeight()); // FIXME
-	navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get());
+	LLPanel* nav_bar_container = getRootView()->getChild<LLPanel>("nav_bar_container");
 
+	LLNavigationBar* navbar = LLNavigationBar::getInstance();
+	navbar->setShape(nav_bar_container->getLocalRect());
+	navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get());
+	nav_bar_container->addChild(navbar);
+	nav_bar_container->setVisible(TRUE);
 	
 	if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel"))
 	{
@@ -1589,19 +1548,6 @@ void LLViewerWindow::initWorldUI()
 		LLBottomTray::getInstance()->showGestureButton(FALSE);
 	}
 
-	getRootView()->addChild(gStatusBar);
-	getRootView()->addChild(navbar);
-
-
-	//sidetray
-	//then notify area
-	//then menu
-	//getRootView()->sendChildToFront(LLSideTray::getInstance());
-
-	getRootView()->sendChildToFront(gNotifyBoxView);
-	// menu holder appears on top to get first pass at all mouse events
-	getRootView()->sendChildToFront(gMenuHolder);
-
 	if ( gHUDView == NULL )
 	{
 		LLRect hud_rect = full_window;
@@ -1615,11 +1561,27 @@ void LLViewerWindow::initWorldUI()
 		getRootView()->addChildInBack(gHUDView);
 	}
 
-	// this allows not to see UI elements created while UI initializing after Alt+Tab was pressed during login. EXT-744.
-	moveProgressViewToFront();
-
-	// tooltips are always on top
-	getRootView()->sendChildToFront(gToolTipView);
+	LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("stand_stop_flying_container");
+	LLPanelStandStopFlying* panel_stand_stop_flying	= LLPanelStandStopFlying::getInstance();
+	panel_stand_stop_flying->setShape(panel_ssf_container->getLocalRect());
+	panel_stand_stop_flying->setFollowsAll();
+	panel_ssf_container->addChild(panel_stand_stop_flying);
+	panel_ssf_container->setVisible(TRUE);
+
+	// put sidetray in container
+	LLPanel* side_tray_container = getRootView()->getChild<LLPanel>("side_tray_container");
+	LLSideTray* sidetrayp = LLSideTray::getInstance();
+	sidetrayp->setShape(side_tray_container->getLocalRect());
+	sidetrayp->setFollowsAll();
+	side_tray_container->addChild(sidetrayp);
+	side_tray_container->setVisible(FALSE);
+	
+	// put sidetray buttons in their own panel
+	LLPanel* buttons_panel = sidetrayp->getButtonsPanel();
+	LLPanel* buttons_panel_container = getRootView()->getChild<LLPanel>("side_bar_tabs");
+	buttons_panel->setShape(buttons_panel_container->getLocalRect());
+	buttons_panel->setFollowsAll();
+	buttons_panel_container->addChild(buttons_panel);
 }
 
 // Destroy the UI
@@ -1747,8 +1709,8 @@ void LLViewerWindow::sendShapeToSim()
 	msg->addU32Fast(_PREHASH_CircuitCode, gMessageSystem->mOurCircuitCode);
 	msg->nextBlockFast(_PREHASH_HeightWidthBlock);
 	msg->addU32Fast(_PREHASH_GenCounter, 0);
-	U16 height16 = (U16) mWorldViewRect.getHeight();
-	U16 width16 = (U16) mWorldViewRect.getWidth();
+	U16 height16 = (U16) mWorldViewRectRaw.getHeight();
+	U16 width16 = (U16) mWorldViewRectRaw.getWidth();
 	msg->addU16Fast(_PREHASH_Height, height16);
 	msg->addU16Fast(_PREHASH_Width, width16);
 	gAgent.sendReliableMessage();
@@ -1770,14 +1732,14 @@ void LLViewerWindow::reshape(S32 width, S32 height)
 		}
 
 		// update our window rectangle
-		mWindowRect.mRight = mWindowRect.mLeft + width;
-		mWindowRect.mTop = mWindowRect.mBottom + height;
+		mWindowRectRaw.mRight = mWindowRectRaw.mLeft + width;
+		mWindowRectRaw.mTop = mWindowRectRaw.mBottom + height;
 
 		//glViewport(0, 0, width, height );
 
 		if (height > 0)
 		{ 
-			LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRect.getHeight() );
+			LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() );
 			LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
 		}
 
@@ -1787,8 +1749,8 @@ void LLViewerWindow::reshape(S32 width, S32 height)
 		LLUI::setScaleFactor(mDisplayScale);
 
 		// update our window rectangle
-		mVirtualWindowRect.mRight = mVirtualWindowRect.mLeft + llround((F32)width / mDisplayScale.mV[VX]);
-		mVirtualWindowRect.mTop = mVirtualWindowRect.mBottom + llround((F32)height / mDisplayScale.mV[VY]);
+		mWindowRectScaled.mRight = mWindowRectScaled.mLeft + llround((F32)width / mDisplayScale.mV[VX]);
+		mWindowRectScaled.mTop = mWindowRectScaled.mBottom + llround((F32)height / mDisplayScale.mV[VY]);
 
 		setup2DViewport();
 
@@ -1930,7 +1892,7 @@ void LLViewerWindow::draw()
 
 	if (!gSavedSettings.getBOOL("RenderUIBuffer"))
 	{
-		LLUI::sDirtyRect = this->getWindowRect();
+		LLUI::sDirtyRect = this->getWindowRectRaw();
 	}
 
 	// HACK for timecode debugging
@@ -1944,8 +1906,8 @@ void LLViewerWindow::draw()
 		microsecondsToTimecodeString(gFrameTime,text);
 		const LLFontGL* font = LLFontGL::getFontSansSerif();
 		font->renderUTF8(text, 0,
-						llround((getWindowWidth()/2)-100.f),
-						llround((getWindowHeight()-60.f)),
+						llround((getWindowWidthScaled()/2)-100.f),
+						llround((getWindowHeightScaled()-60.f)),
 			LLColor4( 1.f, 1.f, 1.f, 1.f ),
 			LLFontGL::LEFT, LLFontGL::TOP);
 	}
@@ -1968,8 +1930,8 @@ void LLViewerWindow::draw()
 			int pos_y = sub_region / llceil(zoom_factor);
 			int pos_x = sub_region - (pos_y*llceil(zoom_factor));
 			// offset for this tile
-			glTranslatef((F32)getWindowWidth() * -(F32)pos_x, 
-						(F32)getWindowHeight() * -(F32)pos_y, 
+			glTranslatef((F32)getWindowWidthScaled() * -(F32)pos_x, 
+						(F32)getWindowHeightScaled() * -(F32)pos_y, 
 						0.f);
 			glScalef(zoom_factor, zoom_factor, 1.f);
 			LLUI::sGLScaleFactor *= zoom_factor;
@@ -2014,8 +1976,8 @@ void LLViewerWindow::draw()
 			const S32 DIST_FROM_TOP = 20;
 			LLFontGL::getFontSansSerifBig()->renderUTF8(
 				mOverlayTitle, 0,
-				llround( getWindowWidth() * 0.5f),
-				getWindowHeight() - DIST_FROM_TOP,
+				llround( getWindowWidthScaled() * 0.5f),
+				getWindowHeightScaled() - DIST_FROM_TOP,
 				LLColor4(1, 1, 1, 0.4f),
 				LLFontGL::HCENTER, LLFontGL::TOP);
 		}
@@ -2315,7 +2277,7 @@ void LLViewerWindow::handleScrollWheel(S32 clicks)
 
 	// Zoom the camera in and out behavior
 
-	if(top_ctrl == 0 && mWorldViewRect.pointInRect(mCurrentMousePoint.mX, mCurrentMousePoint.mY) )
+	if(top_ctrl == 0 && mWorldViewRectRaw.pointInRect(mCurrentMousePoint.mX, mCurrentMousePoint.mY) )
 		gAgent.handleScrollWheel(clicks);
 
 	return;
@@ -2323,8 +2285,8 @@ void LLViewerWindow::handleScrollWheel(S32 clicks)
 
 void LLViewerWindow::moveCursorToCenter()
 {
-	S32 x = mWorldViewRect.getWidth() / 2;
-	S32 y = mWorldViewRect.getHeight() / 2;
+	S32 x = mWorldViewRectRaw.getWidth() / 2;
+	S32 y = mWorldViewRectRaw.getHeight() / 2;
 	
 	//on a forced move, all deltas get zeroed out to prevent jumping
 	mCurrentMousePoint.set(x,y);
@@ -2334,42 +2296,19 @@ void LLViewerWindow::moveCursorToCenter()
 	LLUI::setMousePositionScreen(x, y);	
 }
 
-void LLViewerWindow::updateBottomTrayRect()
-{
-	if(LLBottomTray::instanceExists() && LLSideTray::instanceCreated())
-	{
-		S32 side_tray_width = 0;
-		if(LLSideTray::getInstance()->getVisible())
-		{
-			side_tray_width = LLSideTray::getInstance()->getTrayWidth();
-		}
-
-		LLBottomTray* bottom_tray = LLBottomTray::getInstance();
-		S32 right = llround((F32)mWindowRect.mRight / mDisplayScale.mV[VX]) - side_tray_width;
-
-		LLRect rc = bottom_tray->getRect();
-		if (right != rc.mRight)
-		{
-			rc.mRight = right;
-			bottom_tray->reshape(rc.getWidth(), rc.getHeight(), FALSE);
-			bottom_tray->setRect(rc);
-			mOnBottomTrayWidthChanged();
-		}
-	}
-}
 
 //////////////////////////////////////////////////////////////////////
 //
 // Hover handlers
 //
 
-void append_xui_tooltip(LLView* viewp, std::string& tool_tip_msg)
+void append_xui_tooltip(LLView* viewp, LLToolTip::Params& params)
 {
 	if (viewp) 
 	{
-		if (!tool_tip_msg.empty())
+		if (!params.styled_message().empty())
 		{
-			tool_tip_msg.append("\n---------\n");
+			params.styled_message.add().text("\n---------\n"); 
 		}
 		LLView::root_to_view_iterator_t end_tooltip_it = viewp->endRootToView();
 		// NOTE: we skip "root" since it is assumed
@@ -2379,15 +2318,16 @@ void append_xui_tooltip(LLView* viewp, std::string& tool_tip_msg)
 		{
 			LLView* viewp = *tooltip_it;
 		
-			tool_tip_msg.append(viewp->getName());
+			params.styled_message.add().text(viewp->getName());
+
 			LLPanel* panelp = dynamic_cast<LLPanel*>(viewp);
 			if (panelp && !panelp->getXMLFilename().empty())
 			{
-				tool_tip_msg.append("(");
-				tool_tip_msg.append(panelp->getXMLFilename());
-				tool_tip_msg.append(")");
+				params.styled_message.add()
+					.text("(" + panelp->getXMLFilename() + ")")
+					.style.color(LLColor4(0.7f, 0.7f, 1.f, 1.f));
 			}
-			tool_tip_msg.append("/");
+			params.styled_message.add().text("/");
 		}
 	}
 }
@@ -2398,9 +2338,10 @@ void LLViewerWindow::updateUI()
 {
 	static std::string last_handle_msg;
 
-	updateWorldViewRect();
+	// animate layout stacks so we have up to date rect for world view
+	LLLayoutStack::updateClass();
 
-	updateBottomTrayRect();
+	updateWorldViewRect();
 
 	LLView::sMouseHandlerMessage.clear();
 
@@ -2627,6 +2568,8 @@ void LLViewerWindow::updateUI()
 
 		if (gSavedSettings.getBOOL("DebugShowXUINames"))
 		{
+			LLToolTip::Params params;
+
 			LLView* tooltip_view = mRootView;
 			LLView::tree_iterator_t end_it = mRootView->endTreeDFS();
 			for (LLView::tree_iterator_t it = mRootView->beginTreeDFS(); it != end_it; ++it)
@@ -2659,20 +2602,20 @@ void LLViewerWindow::updateUI()
 					// NOTE: this emulates visiting only the leaf nodes that meet our criteria
 					if (!viewp->hasAncestor(tooltip_view))
 					{
-						append_xui_tooltip(tooltip_view, tool_tip_msg);
+						append_xui_tooltip(tooltip_view, params);
 						screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect());
 					}
 					tooltip_view = viewp;
 				}
 			}
 
-			append_xui_tooltip(tooltip_view, tool_tip_msg);
+			append_xui_tooltip(tooltip_view, params);
 			screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect());
 			
-			LLToolTipMgr::instance().show(LLToolTip::Params()
-				.message(tool_tip_msg)
-				.sticky_rect(screen_sticky_rect)
-				.max_width(400));
+			params.sticky_rect = screen_sticky_rect;
+			params.max_width = 400;
+
+			LLToolTipMgr::instance().show(params);
 		}
 		// if there is a mouse captor, nothing else gets a tooltip
 		else if (mouse_captor)
@@ -2784,8 +2727,8 @@ void LLViewerWindow::updateMouseDelta()
 	mWindow->getCursorPosition(&mouse_pos);
 	if (mouse_pos.mX < 0 || 
 		mouse_pos.mY < 0 ||
-		mouse_pos.mX > mWindowRect.getWidth() ||
-		mouse_pos.mY > mWindowRect.getHeight())
+		mouse_pos.mX > mWindowRectRaw.getWidth() ||
+		mouse_pos.mY > mWindowRectRaw.getHeight())
 	{
 		mMouseInWindow = FALSE;
 	}
@@ -2900,42 +2843,30 @@ void LLViewerWindow::updateKeyboardFocus()
 		LLSideTray::getInstance()->highlightFocused();
 }
 
+static LLFastTimer::DeclareTimer FTM_UPDATE_WORLD_VIEW("Update World View");
 void LLViewerWindow::updateWorldViewRect(bool use_full_window)
 {
-	if (!LLSideTray::instanceCreated()) return;
+	LLFastTimer ft(FTM_UPDATE_WORLD_VIEW);
 
 	// start off using whole window to render world
-	LLRect new_world_rect = mWindowRect;
+	LLRect new_world_rect = mWindowRectRaw;
 
-	if (use_full_window == false)
+	if (use_full_window == false && mWorldViewPlaceholder.get())
 	{
-		// pull in right side of world view based on sidetray
-		LLSideTray* sidetray = LLSideTray::getInstance();
-		if (sidetray->getVisible())
-		{
-			new_world_rect.mRight -= llround((F32)sidetray->getTrayWidth() * mDisplayScale.mV[VX]);
-		}
-
-		// push top of world view below nav bar
-		if (LLNavigationBar::getInstance()->getVisible())
-		{
-			LLNavigationBar* barp = LLNavigationBar::getInstance();
-			LLRect nav_bar_rect;
-			if(barp->localRectToOtherView(barp->getLocalRect(), &nav_bar_rect, mRootView))
-			{
-				new_world_rect.mTop = llround((F32)LLNavigationBar::getInstance()->getRect().mBottom * mDisplayScale.mV[VY]);
-			}
-		}
+		new_world_rect = mWorldViewPlaceholder.get()->calcScreenRect();
+		// clamp to at least a 1x1 rect so we don't try to allocate zero width gl buffers
+		new_world_rect.mTop = llmax(new_world_rect.mTop, new_world_rect.mBottom + 1);
+		new_world_rect.mRight = llmax(new_world_rect.mRight, new_world_rect.mLeft + 1);
 	}
 
-	if (mWorldViewRect != new_world_rect)
+	if (mWorldViewRectRaw != new_world_rect)
 	{
 		// sending a signal with a new WorldView rect
-		mOnWorldViewRectUpdated(mWorldViewRect, new_world_rect);
+		mOnWorldViewRectUpdated(mWorldViewRectRaw, new_world_rect);
 
-		mWorldViewRect = new_world_rect;
+		mWorldViewRectRaw = new_world_rect;
 		gResizeScreenTexture = TRUE;
-		LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRect.getHeight() );
+		LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() );
 		LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
 	}
 }
@@ -2948,9 +2879,9 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
 	{
 		mCurrentMousePoint.mX = 0;
 	}
-	else if (point.mX > getWindowWidth())
+	else if (point.mX > getWindowWidthScaled())
 	{
-		mCurrentMousePoint.mX = getWindowWidth();
+		mCurrentMousePoint.mX = getWindowWidthScaled();
 	}
 	else
 	{
@@ -2961,9 +2892,9 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
 	{
 		mCurrentMousePoint.mY = 0;
 	}
-	else if (point.mY > getWindowHeight() )
+	else if (point.mY > getWindowHeightScaled() )
 	{
-		mCurrentMousePoint.mY = getWindowHeight();
+		mCurrentMousePoint.mY = getWindowHeightScaled();
 	}
 	else
 	{
@@ -3208,10 +3139,10 @@ void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback
 	{
 		mPickScreenRegion.setCenterAndSize(x, y_from_bot, PICK_DIAMETER, PICK_DIAMETER);
 
-		if (mPickScreenRegion.mLeft < mWorldViewRect.mLeft) mPickScreenRegion.translate(mWorldViewRect.mLeft - mPickScreenRegion.mLeft, 0);
-		if (mPickScreenRegion.mBottom < mWorldViewRect.mBottom) mPickScreenRegion.translate(0, mWorldViewRect.mBottom - mPickScreenRegion.mBottom);
-		if (mPickScreenRegion.mRight > mWorldViewRect.mRight ) mPickScreenRegion.translate(mWorldViewRect.mRight - mPickScreenRegion.mRight, 0);
-		if (mPickScreenRegion.mTop > mWorldViewRect.mTop ) mPickScreenRegion.translate(0, mWorldViewRect.mTop - mPickScreenRegion.mTop);
+		if (mPickScreenRegion.mLeft < mWorldViewRectRaw.mLeft) mPickScreenRegion.translate(mWorldViewRectRaw.mLeft - mPickScreenRegion.mLeft, 0);
+		if (mPickScreenRegion.mBottom < mWorldViewRectRaw.mBottom) mPickScreenRegion.translate(0, mWorldViewRectRaw.mBottom - mPickScreenRegion.mBottom);
+		if (mPickScreenRegion.mRight > mWorldViewRectRaw.mRight ) mPickScreenRegion.translate(mWorldViewRectRaw.mRight - mPickScreenRegion.mRight, 0);
+		if (mPickScreenRegion.mTop > mWorldViewRectRaw.mTop ) mPickScreenRegion.translate(0, mWorldViewRectRaw.mTop - mPickScreenRegion.mTop);
 	}
 
 	// set frame buffer region for picking results
@@ -3417,11 +3348,11 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const
 	F32			fov = LLViewerCamera::getInstance()->getView();
 
 	// find world view center in scaled ui coordinates
-	F32			center_x = (F32)getWorldViewRect().getCenterX() / mDisplayScale.mV[VX];
-	F32			center_y = (F32)getWorldViewRect().getCenterY() / mDisplayScale.mV[VY];
+	F32			center_x = (F32)getWorldViewRectRaw().getCenterX() / mDisplayScale.mV[VX];
+	F32			center_y = (F32)getWorldViewRectRaw().getCenterY() / mDisplayScale.mV[VY];
 
 	// calculate pixel distance to screen
-	F32			distance = ((F32)getWorldViewHeight() / (mDisplayScale.mV[VY] * 2.f)) / (tan(fov / 2.f));
+	F32			distance = ((F32)getWorldViewHeightRaw() / (mDisplayScale.mV[VY] * 2.f)) / (tan(fov / 2.f));
 
 	// calculate click point relative to middle of screen
 	F32			click_x = x - center_x;
@@ -3440,11 +3371,11 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const
 LLVector3 LLViewerWindow::mousePointHUD(const S32 x, const S32 y) const
 {
 	// find screen resolution
-	S32			height = llround((F32)getWorldViewHeight() / mDisplayScale.mV[VY]);
+	S32			height = llround((F32)getWorldViewHeightRaw() / mDisplayScale.mV[VY]);
 
 	// find world view center
-	F32			center_x = (F32)getWorldViewRect().getCenterX() / mDisplayScale.mV[VX];
-	F32			center_y = (F32)getWorldViewRect().getCenterY() / mDisplayScale.mV[VY];
+	F32			center_x = (F32)getWorldViewRectRaw().getCenterX() / mDisplayScale.mV[VX];
+	F32			center_y = (F32)getWorldViewRectRaw().getCenterY() / mDisplayScale.mV[VY];
 
 	// remap with uniform scale (1/height) so that top is -0.5, bottom is +0.5
 	F32 hud_x = -((F32)x - center_x)  / height;
@@ -3462,12 +3393,12 @@ LLVector3 LLViewerWindow::mouseDirectionCamera(const S32 x, const S32 y) const
 	F32			fov_width = fov_height * LLViewerCamera::getInstance()->getAspect();
 
 	// find screen resolution
-	S32			height = llround((F32)getWorldViewHeight() / mDisplayScale.mV[VY]);
-	S32			width = llround((F32)getWorldViewWidth() / mDisplayScale.mV[VX]);
+	S32			height = llround((F32)getWorldViewHeightRaw() / mDisplayScale.mV[VY]);
+	S32			width = llround((F32)getWorldViewWidthRaw() / mDisplayScale.mV[VX]);
 
 	// find world view center
-	F32			center_x = (F32)getWorldViewRect().getCenterX() / mDisplayScale.mV[VX];
-	F32			center_y = (F32)getWorldViewRect().getCenterY() / mDisplayScale.mV[VY];
+	F32			center_x = (F32)getWorldViewRectRaw().getCenterX() / mDisplayScale.mV[VX];
+	F32			center_y = (F32)getWorldViewRectRaw().getCenterY() / mDisplayScale.mV[VY];
 
 	// calculate click point relative to middle of screen
 	F32			click_x = (((F32)x - center_x) / (F32)width) * fov_width * -1.f;
@@ -3707,8 +3638,8 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
 		||(size.mY != new_height + BORDERHEIGHT))
 	{
 		// use actual display dimensions, not virtual UI dimensions
-		S32 x = gViewerWindow->getWindowDisplayWidth();
-		S32 y = gViewerWindow->getWindowDisplayHeight();
+		S32 x = gViewerWindow->getWindowWidthRaw();
+		S32 y = gViewerWindow->getWindowHeightRaw();
 		BORDERWIDTH = size.mX - x;
 		BORDERHEIGHT = size.mY- y;
 		LLCoordScreen new_size(new_width + BORDERWIDTH, 
@@ -3806,9 +3737,9 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p
 	S32 w = preview_width ;
 	S32 h = preview_height ;
 	LLVector2 display_scale = mDisplayScale ;
-	mDisplayScale.setVec((F32)w / mWindowRect.getWidth(), (F32)h / mWindowRect.getHeight()) ;
-	LLRect window_rect = mWindowRect;
-	mWindowRect.set(0, h, w, 0);
+	mDisplayScale.setVec((F32)w / mWindowRectRaw.getWidth(), (F32)h / mWindowRectRaw.getHeight()) ;
+	LLRect window_rect = mWindowRectRaw;
+	mWindowRectRaw.set(0, h, w, 0);
 	
 	gDisplaySwapBuffers = FALSE;
 	gDepthDirty = TRUE;
@@ -3820,7 +3751,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p
 	LLHUDText::setDisplayText(FALSE) ;
 	if (type == SNAPSHOT_TYPE_OBJECT_ID)
 	{
-		gObjectList.renderPickList(gViewerWindow->getVirtualWindowRect(), FALSE, FALSE);
+		gObjectList.renderPickList(gViewerWindow->getWindowRectScaled(), FALSE, FALSE);
 	}
 	else
 	{
@@ -3873,7 +3804,7 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p
 	LLFontGL::setFontDisplay(TRUE) ;
 	LLHUDText::setDisplayText(TRUE) ;
 	mDisplayScale.setVec(display_scale) ;
-	mWindowRect = window_rect;	
+	mWindowRectRaw = window_rect;	
 	setup3DRender();
 	gDisplaySwapBuffers = FALSE;
 	gDepthDirty = TRUE;
@@ -3941,12 +3872,12 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
 	// Copy screen to a buffer
 	// crop sides or top and bottom, if taking a snapshot of different aspect ratio
 	// from window
-	S32 snapshot_width = mWindowRect.getWidth();
-	S32 snapshot_height =  mWindowRect.getHeight();
+	S32 snapshot_width = mWindowRectRaw.getWidth();
+	S32 snapshot_height =  mWindowRectRaw.getHeight();
 	// SNAPSHOT
-	S32 window_width = mWindowRect.getWidth();
-	S32 window_height = mWindowRect.getHeight();	
-	LLRect window_rect = mWindowRect;
+	S32 window_width = mWindowRectRaw.getWidth();
+	S32 window_height = mWindowRectRaw.getHeight();	
+	LLRect window_rect = mWindowRectRaw;
 	BOOL use_fbo = FALSE;
 
 	LLRenderTarget target;
@@ -3977,7 +3908,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
 					window_width = snapshot_width;
 					window_height = snapshot_height;
 					scale_factor = 1.f;
-					mWindowRect.set(0, snapshot_height, snapshot_width, 0);
+					mWindowRectRaw.set(0, snapshot_height, snapshot_width, 0);
 					target.bindTarget();			
 				}
 			}
@@ -4045,7 +3976,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
 
 				LLViewerCamera::getInstance()->setZoomParameters(scale_factor, subimage_x+(subimage_y*llceil(scale_factor)));
 				setup3DRender();
-				gObjectList.renderPickList(gViewerWindow->getVirtualWindowRect(), FALSE, FALSE);
+				gObjectList.renderPickList(gViewerWindow->getWindowRectScaled(), FALSE, FALSE);
 			}
 			else
 			{
@@ -4124,7 +4055,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
 
 	if (use_fbo)
 	{
-		mWindowRect = window_rect;
+		mWindowRectRaw = window_rect;
 		target.flush();
 		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
 	}
@@ -4205,23 +4136,13 @@ void LLViewerWindow::drawMouselookInstructions()
 
 	font->renderUTF8( 
 		instructions, 0,
-		getVirtualWorldViewRect().getCenterX(),
-		getVirtualWorldViewRect().mBottom + INSTRUCTIONS_PAD,
+		getWorldViewRectScaled().getCenterX(),
+		getWorldViewRectScaled().mBottom + INSTRUCTIONS_PAD,
 		LLColor4( 1.0f, 1.0f, 1.0f, 0.5f ),
 		LLFontGL::HCENTER, LLFontGL::TOP,
 		LLFontGL::NORMAL,LLFontGL::DROP_SHADOW);
 }
 
-S32	LLViewerWindow::getWindowHeight()	const 	
-{ 
-	return mVirtualWindowRect.getHeight(); 
-}
-
-S32	LLViewerWindow::getWindowWidth() const 	
-{ 
-	return mVirtualWindowRect.getWidth(); 
-}
-
 void* LLViewerWindow::getPlatformWindow() const
 {
 	return mWindow->getPlatformWindow();
@@ -4242,9 +4163,9 @@ LLRootView*	LLViewerWindow::getRootView() const
 	return mRootView;
 }
 
-LLRect LLViewerWindow::getVirtualWorldViewRect() const
+LLRect LLViewerWindow::getWorldViewRectScaled() const
 {
-	LLRect world_view_rect = mWorldViewRect;
+	LLRect world_view_rect = mWorldViewRectRaw;
 	world_view_rect.mLeft = llround((F32)world_view_rect.mLeft / mDisplayScale.mV[VX]);
 	world_view_rect.mRight = llround((F32)world_view_rect.mRight / mDisplayScale.mV[VX]);
 	world_view_rect.mBottom = llround((F32)world_view_rect.mBottom / mDisplayScale.mV[VY]);
@@ -4252,39 +4173,49 @@ LLRect LLViewerWindow::getVirtualWorldViewRect() const
 	return world_view_rect;
 }
 
-S32 LLViewerWindow::getWorldViewHeight() const
+S32 LLViewerWindow::getWorldViewHeightRaw() const
 {
-	return mWorldViewRect.getHeight(); 
+	return mWorldViewRectRaw.getHeight(); 
 }
 
-S32 LLViewerWindow::getWorldViewWidth() const
+S32 LLViewerWindow::getWorldViewWidthRaw() const
 {
-	return mWorldViewRect.getWidth(); 
+	return mWorldViewRectRaw.getWidth(); 
+}
+
+S32	LLViewerWindow::getWindowHeightScaled()	const 	
+{ 
+	return mWindowRectScaled.getHeight(); 
+}
+
+S32	LLViewerWindow::getWindowWidthScaled() const 	
+{ 
+	return mWindowRectScaled.getWidth(); 
 }
 
-S32	LLViewerWindow::getWindowDisplayHeight()	const 	
+S32	LLViewerWindow::getWindowHeightRaw()	const 	
 { 
-	return mWindowRect.getHeight(); 
+	return mWindowRectRaw.getHeight(); 
 }
 
-S32	LLViewerWindow::getWindowDisplayWidth() const 	
+S32	LLViewerWindow::getWindowWidthRaw() const 	
 { 
-	return mWindowRect.getWidth(); 
+	return mWindowRectRaw.getWidth(); 
 }
 
 void LLViewerWindow::setup2DRender()
 {
 	// setup ortho camera
-	gl_state_for_2d(mWindowRect.getWidth(), mWindowRect.getHeight());
+	gl_state_for_2d(mWindowRectRaw.getWidth(), mWindowRectRaw.getHeight());
 	setup2DViewport();
 }
 
 void LLViewerWindow::setup2DViewport(S32 x_offset, S32 y_offset)
 {
-	gGLViewport[0] = mWindowRect.mLeft + x_offset;
-	gGLViewport[1] = mWindowRect.mBottom + y_offset;
-	gGLViewport[2] = mWindowRect.getWidth();
-	gGLViewport[3] = mWindowRect.getHeight();
+	gGLViewport[0] = mWindowRectRaw.mLeft + x_offset;
+	gGLViewport[1] = mWindowRectRaw.mBottom + y_offset;
+	gGLViewport[2] = mWindowRectRaw.getWidth();
+	gGLViewport[3] = mWindowRectRaw.getHeight();
 	glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
 }
 
@@ -4292,7 +4223,7 @@ void LLViewerWindow::setup2DViewport(S32 x_offset, S32 y_offset)
 void LLViewerWindow::setup3DRender()
 {
 	// setup perspective camera
-	LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, mWorldViewRect.mLeft, mWorldViewRect.mBottom,  mWorldViewRect.getWidth(), mWorldViewRect.getHeight(), FALSE, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f);
+	LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, mWorldViewRectRaw.mLeft, mWorldViewRectRaw.mBottom,  mWorldViewRectRaw.getWidth(), mWorldViewRectRaw.getHeight(), FALSE, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f);
 	setup3DViewport();
 }
 
@@ -4300,17 +4231,17 @@ void LLViewerWindow::setup3DViewport(S32 x_offset, S32 y_offset)
 {
 	if (LLRenderTarget::getCurrentBoundTarget() != NULL)
 	{
-		// don't use translation component of mWorldViewRect, as we are already in a properly sized render target
+		// don't use translation component of mWorldViewRectRaw, as we are already in a properly sized render target
 		gGLViewport[0] = x_offset;
 		gGLViewport[1] = y_offset;
 	}
 	else
 	{
-		gGLViewport[0] = mWorldViewRect.mLeft + x_offset;
-		gGLViewport[1] = mWorldViewRect.mBottom + y_offset;
+		gGLViewport[0] = mWorldViewRectRaw.mLeft + x_offset;
+		gGLViewport[1] = mWorldViewRectRaw.mBottom + y_offset;
 	}
-	gGLViewport[2] = mWorldViewRect.getWidth();
-	gGLViewport[3] = mWorldViewRect.getHeight();
+	gGLViewport[2] = mWorldViewRectRaw.getWidth();
+	gGLViewport[3] = mWorldViewRectRaw.getHeight();
 	glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
 }
 
@@ -4521,8 +4452,8 @@ void LLViewerWindow::getTargetWindow(BOOL& fullscreen, S32& width, S32& height)
 	if (mWindow
 	&&  mWindow->getFullscreen() == mWantFullscreen)
 	{
-		width = getWindowDisplayWidth();
-		height = getWindowDisplayHeight();
+		width = getWindowWidthRaw();
+		height = getWindowHeightRaw();
 	}
 	else if (mWantFullscreen)
 	{
@@ -4569,7 +4500,7 @@ BOOL LLViewerWindow::checkSettings()
 			getWindow()->setNativeAspectRatio(gSavedSettings.getF32("FullScreenAspectRatio"));
 		}
 		
-		reshape(getWindowDisplayWidth(), getWindowDisplayHeight());
+		reshape(getWindowWidthRaw(), getWindowHeightRaw());
 
 		// force aspect ratio
 		if (mIsFullscreenChecked)
@@ -4795,8 +4726,8 @@ F32 LLViewerWindow::getDisplayAspectRatio() const
 
 F32	LLViewerWindow::getWorldViewAspectRatio() const
 {
-	F32 world_aspect = (F32)mWorldViewRect.getWidth() / (F32)mWorldViewRect.getHeight();
-	//F32 window_aspect = (F32)mWindowRect.getWidth() / (F32)mWindowRect.getHeight();
+	F32 world_aspect = (F32)mWorldViewRectRaw.getWidth() / (F32)mWorldViewRectRaw.getHeight();
+	//F32 window_aspect = (F32)mWindowRectRaw.getWidth() / (F32)mWindowRectRaw.getHeight();
 	if (mWindow->getFullscreen())
 	{
 		return world_aspect * mWindow->getPixelAspectRatio();
@@ -4813,7 +4744,7 @@ void LLViewerWindow::calcDisplayScale()
 	F32 ui_scale_factor = gSavedSettings.getF32("UIScaleFactor");
 	LLVector2 display_scale;
 	display_scale.setVec(llmax(1.f / mWindow->getPixelAspectRatio(), 1.f), llmax(mWindow->getPixelAspectRatio(), 1.f));
-	F32 height_normalization = gSavedSettings.getBOOL("UIAutoScale") ? ((F32)mWindowRect.getHeight() / display_scale.mV[VY]) / 768.f : 1.f;
+	F32 height_normalization = gSavedSettings.getBOOL("UIAutoScale") ? ((F32)mWindowRectRaw.getHeight() / display_scale.mV[VY]) / 768.f : 1.f;
 	if(mWindow->getFullscreen())
 	{
 		display_scale *= (ui_scale_factor * height_normalization);
@@ -4831,8 +4762,8 @@ void LLViewerWindow::calcDisplayScale()
 
 	if (mWindow->getFullscreen())
 	{
-		display_scale.mV[0] = llround(display_scale.mV[0], 2.0f/(F32) mWindowRect.getWidth());
-		display_scale.mV[1] = llround(display_scale.mV[1], 2.0f/(F32) mWindowRect.getHeight());
+		display_scale.mV[0] = llround(display_scale.mV[0], 2.0f/(F32) mWindowRectRaw.getWidth());
+		display_scale.mV[1] = llround(display_scale.mV[1], 2.0f/(F32) mWindowRectRaw.getHeight());
 	}
 	
 	if (display_scale != mDisplayScale)
@@ -4857,7 +4788,7 @@ S32 LLViewerWindow::getChatConsoleBottomPad()
 
 LLRect LLViewerWindow::getChatConsoleRect()
 {
-	LLRect full_window(0, getWindowHeight(), getWindowWidth(), 0);
+	LLRect full_window(0, getWindowHeightScaled(), getWindowWidthScaled(), 0);
 	LLRect console_rect = full_window;
 
 	const S32 CONSOLE_PADDING_TOP = 24;
@@ -4879,7 +4810,7 @@ LLRect LLViewerWindow::getChatConsoleRect()
 	{
 		// Make console rect somewhat narrow so having inventory open is
 		// less of a problem.
-		console_rect.mRight  = console_rect.mLeft + 2 * getWindowWidth() / 3;
+		console_rect.mRight  = console_rect.mLeft + 2 * getWindowWidthScaled() / 3;
 	}
 
 	return console_rect;
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index c2906b1718dbac795585b0f7ae583f934f38aa9d..ce71ef6173d84a0551732b5656d9a8cd86ae390c 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -210,21 +210,23 @@ class LLViewerWindow : public LLWindowCallbacks
 	//
 	LLRootView*			getRootView()		const;
 
+	// 3D world area in scaled pixels (via UI scale), use for most UI computations
+	LLRect			getWorldViewRectScaled() const;
+
+	// 3D world area, in raw unscaled pixels
+	LLRect			getWorldViewRectRaw() const		{ return mWorldViewRectRaw; }
+	S32 			getWorldViewHeightRaw() const;
+	S32 			getWorldViewWidthRaw() const;
+
+	// Window in scaled pixels (via UI scale), use for most UI computations
+	LLRect			getWindowRectScaled() const		{ return mWindowRectScaled; }
+	S32				getWindowHeightScaled() const;
+	S32				getWindowWidthScaled() const;
+
 	// Window in raw pixels as seen on screen.
-	const LLRect&	getWindowRect()		const	{ return mWindowRect; };
-	// portion of window that shows 3d world
-	const LLRect&	getWorldViewRect()		const	{ return mWorldViewRect; };
-	LLRect			getVirtualWorldViewRect()	const;
-	S32 			getWorldViewHeight() const;
-	S32 			getWorldViewWidth() const;
-	S32				getWindowDisplayHeight()	const;
-	S32				getWindowDisplayWidth()	const;
-
-	// Window in scaled pixels (via UI scale), use this for
-	// UI elements checking size.
-	const LLRect&	getVirtualWindowRect()		const	{ return mVirtualWindowRect; };
-	S32				getWindowHeight()	const;
-	S32				getWindowWidth()	const;
+	LLRect			getWindowRectRaw() const		{ return mWindowRectRaw; }
+	S32				getWindowHeightRaw() const;
+	S32				getWindowWidthRaw() const;
 
 	LLWindow*		getWindow()			const	{ return mWindow; }
 	void*			getPlatformWindow() const;
@@ -294,7 +296,6 @@ class LLViewerWindow : public LLWindowCallbacks
 	void				updateKeyboardFocus();		
 
 	void			updateWorldViewRect(bool use_full_window=false);
-	void			updateBottomTrayRect();
 
 	BOOL			handleKey(KEY key, MASK mask);
 	void			handleScrollWheel	(S32 clicks);
@@ -410,10 +411,11 @@ class LLViewerWindow : public LLWindowCallbacks
 	BOOL			mActive;
 	BOOL			mWantFullscreen;
 	BOOL			mShowFullscreenProgress;
-	LLRect			mWindowRect;
-	LLRect			mVirtualWindowRect;
-	LLRect			mWorldViewRect;					// specifies area of screen where we render the 3D world
-	LLRootView*		mRootView;					// a view of size mWindowRect, containing all child views
+
+	LLRect			mWindowRectRaw;				// whole window, including UI
+	LLRect			mWindowRectScaled;			// whole window, scaled by UI size
+	LLRect			mWorldViewRectRaw;			// area of screen for 3D world
+	LLRootView*		mRootView;					// a view of size mWindowRectRaw, containing all child views
 	LLVector2		mDisplayScale;
 
 	LLCoordGL		mCurrentMousePoint;			// last mouse position in GL coords
@@ -451,6 +453,8 @@ class LLViewerWindow : public LLWindowCallbacks
 	BOOL			mIgnoreActivate;
 
 	std::string		mInitAlert;			// Window / GL initialization requires an alert
+
+	LLHandle<LLView> mWorldViewPlaceholder;	// widget that spans the portion of screen dedicated to rendering the 3d world
 	
 	class LLDebugText* mDebugText; // Internal class for debug text
 	
diff --git a/indra/newview/llviewerwindowlistener.cpp b/indra/newview/llviewerwindowlistener.cpp
index 317e361c804d5ca93d16fe880f42307973bfe248..de5778827112fa732d9ba75e61b562ddc6ac0291 100644
--- a/indra/newview/llviewerwindowlistener.cpp
+++ b/indra/newview/llviewerwindowlistener.cpp
@@ -20,8 +20,9 @@
 // other Linden headers
 #include "llviewerwindow.h"
 
-LLViewerWindowListener::LLViewerWindowListener(const std::string& pumpname, LLViewerWindow* llviewerwindow):
-    LLDispatchListener(pumpname, "op"),
+LLViewerWindowListener::LLViewerWindowListener(LLViewerWindow* llviewerwindow):
+    LLEventAPI("LLViewerWindow",
+               "LLViewerWindow listener to (e.g.) save a screenshot"),
     mViewerWindow(llviewerwindow)
 {
     // add() every method we want to be able to invoke via this event API.
@@ -34,8 +35,15 @@ LLViewerWindowListener::LLViewerWindowListener(const std::string& pumpname, LLVi
 //  saveSnapshotArgs["showui"] = LLSD::Boolean();
 //  saveSnapshotArgs["rebuild"] = LLSD::Boolean();
 //  saveSnapshotArgs["type"] = LLSD::String();
-    add("saveSnapshot", &LLViewerWindowListener::saveSnapshot, saveSnapshotArgs);
-    add("requestReshape", &LLViewerWindowListener::requestReshape);
+    add("saveSnapshot",
+        "Save screenshot: [\"filename\"], [\"width\"], [\"height\"], [\"showui\"], [\"rebuild\"], [\"type\"]\n"
+        "type: \"COLOR\", \"DEPTH\", \"OBJECT_ID\"\n"
+        "Post on [\"reply\"] an event containing [\"ok\"]",
+        &LLViewerWindowListener::saveSnapshot,
+        saveSnapshotArgs);
+    add("requestReshape",
+        "Resize the window: [\"w\"], [\"h\"]",
+        &LLViewerWindowListener::requestReshape);
 }
 
 void LLViewerWindowListener::saveSnapshot(const LLSD& event) const
@@ -50,8 +58,8 @@ void LLViewerWindowListener::saveSnapshot(const LLSD& event) const
 #undef  tp
     // Our add() call should ensure that the incoming LLSD does in fact
     // contain our required arguments. Deal with the optional ones.
-    S32 width (mViewerWindow->getWindowDisplayWidth());
-    S32 height(mViewerWindow->getWindowDisplayHeight());
+    S32 width (mViewerWindow->getWindowWidthRaw());
+    S32 height(mViewerWindow->getWindowHeightRaw());
     if (event.has("width"))
         width = event["width"].asInteger();
     if (event.has("height"))
diff --git a/indra/newview/llviewerwindowlistener.h b/indra/newview/llviewerwindowlistener.h
index 59c636ecec85b5b683019d3d7475b45dbe7673d4..699f7907af2ef682a88ba5e4c6eff3d58733b06b 100644
--- a/indra/newview/llviewerwindowlistener.h
+++ b/indra/newview/llviewerwindowlistener.h
@@ -12,18 +12,17 @@
 #if ! defined(LL_LLVIEWERWINDOWLISTENER_H)
 #define LL_LLVIEWERWINDOWLISTENER_H
 
-#include "lleventdispatcher.h"
+#include "lleventapi.h"
 
 class LLViewerWindow;
 class LLSD;
 
 /// Listen on an LLEventPump with specified name for LLViewerWindow request events.
-class LLViewerWindowListener: public LLDispatchListener
+class LLViewerWindowListener: public LLEventAPI
 {
 public:
-    /// Specify the pump name on which to listen, and bind the LLViewerWindow
-    /// instance to use (e.g. gViewerWindow).
-    LLViewerWindowListener(const std::string& pumpname, LLViewerWindow* llviewerwindow);
+    /// Bind the LLViewerWindow instance to use (e.g. gViewerWindow).
+    LLViewerWindowListener(LLViewerWindow* llviewerwindow);
 
 private:
     void saveSnapshot(const LLSD& event) const;
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 16bd74f7989a9af73f5a7398bfbec9ea7805a3c7..62ac8adad0bf8d782e929f91910e7dae471d6a50 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -647,7 +647,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
 	mWindFreq(0.f),
 	mRipplePhase( 0.f ),
 	mBelowWater(FALSE),
-	mAppearanceAnimSetByUser(FALSE),
 	mLastAppearanceBlendTime(0.f),
 	mAppearanceAnimating(FALSE),
 	mNameString(),
@@ -2436,7 +2435,7 @@ void LLVOAvatar::idleUpdateAppearanceAnimation()
 			{
 				if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE)
 				{
-					param->stopAnimating(mAppearanceAnimSetByUser);
+					param->stopAnimating(FALSE);
 				}
 			}
 			updateVisualParams();
@@ -2459,7 +2458,7 @@ void LLVOAvatar::idleUpdateAppearanceAnimation()
 				{
 					if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE)
 					{
-						param->animate(morph_amt, mAppearanceAnimSetByUser);
+						param->animate(morph_amt, FALSE);
 					}
 				}
 			}
@@ -5372,11 +5371,11 @@ void LLVOAvatar::updateShadowFaces()
 //-----------------------------------------------------------------------------
 // updateSexDependentLayerSets()
 //-----------------------------------------------------------------------------
-void LLVOAvatar::updateSexDependentLayerSets( BOOL set_by_user )
+void LLVOAvatar::updateSexDependentLayerSets( BOOL upload_bake )
 {
-	invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, set_by_user );
-	invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, set_by_user );
-	invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, set_by_user );
+	invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, upload_bake );
+	invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, upload_bake );
+	invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, upload_bake );
 }
 
 //-----------------------------------------------------------------------------
@@ -5741,7 +5740,7 @@ LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) const
 }
 
 // virtual
-void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user )
+void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result )
 {
 }
 
@@ -5754,18 +5753,18 @@ void LLVOAvatar::setCompositeUpdatesEnabled( BOOL b )
 {
 }
 
-void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL set_by_user )
+void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake )
 {
 	if (global_color == mTexSkinColor)
 	{
-		invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, set_by_user );
-		invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, set_by_user );
-		invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, set_by_user );
+		invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, upload_bake );
+		invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, upload_bake );
+		invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, upload_bake );
 	}
 	else if (global_color == mTexHairColor)
 	{
-		invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, set_by_user );
-		invalidateComposite( mBakedTextureDatas[BAKED_HAIR].mTexLayerSet, set_by_user );
+		invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, upload_bake );
+		invalidateComposite( mBakedTextureDatas[BAKED_HAIR].mTexLayerSet, upload_bake );
 		
 		// ! BACKWARDS COMPATIBILITY !
 		// Fix for dealing with avatars from viewers that don't bake hair.
@@ -5781,7 +5780,7 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL
 	else if (global_color == mTexEyeColor)
 	{
 //		llinfos << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << llendl; 
-		invalidateComposite( mBakedTextureDatas[BAKED_EYES].mTexLayerSet,  set_by_user );
+		invalidateComposite( mBakedTextureDatas[BAKED_EYES].mTexLayerSet,  upload_bake );
 	}
 	updateMeshTextures();
 }
@@ -6239,14 +6238,14 @@ BOOL LLVOAvatar::teToColorParams( ETextureIndex te, U32 *param_name )
 	return TRUE;
 }
 
-void LLVOAvatar::setClothesColor( ETextureIndex te, const LLColor4& new_color, BOOL set_by_user )
+void LLVOAvatar::setClothesColor( ETextureIndex te, const LLColor4& new_color, BOOL upload_bake )
 {
 	U32 param_name[3];
 	if( teToColorParams( te, param_name ) )
 	{
-		setVisualParamWeight( param_name[0], new_color.mV[VX], set_by_user );
-		setVisualParamWeight( param_name[1], new_color.mV[VY], set_by_user );
-		setVisualParamWeight( param_name[2], new_color.mV[VZ], set_by_user );
+		setVisualParamWeight( param_name[0], new_color.mV[VX], upload_bake );
+		setVisualParamWeight( param_name[1], new_color.mV[VY], upload_bake );
+		setVisualParamWeight( param_name[2], new_color.mV[VZ], upload_bake );
 	}
 }
 
@@ -6592,7 +6591,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
 		{
 			if (interp_params)
 			{
-				startAppearanceAnimation(FALSE, FALSE);
+				startAppearanceAnimation();
 			}
 			updateVisualParams();
 
@@ -6977,11 +6976,10 @@ void LLVOAvatar::cullAvatarsByPixelArea()
 	}
 }
 
-void LLVOAvatar::startAppearanceAnimation(BOOL set_by_user, BOOL play_sound)
+void LLVOAvatar::startAppearanceAnimation()
 {
 	if(!mAppearanceAnimating)
 	{
-		mAppearanceAnimSetByUser = set_by_user;
 		mAppearanceAnimating = TRUE;
 		mAppearanceMorphTimer.reset();
 		mLastAppearanceBlendTime = 0.f;
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 173ad02808a4981359c27699495e20a529412bcd..2fd1a506a9024a135e635688428f6a1ec99d053b 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -522,7 +522,7 @@ class LLVOAvatar :
 	// Composites
 	//--------------------------------------------------------------------
 public:
-	virtual void	invalidateComposite(LLTexLayerSet* layerset, BOOL set_by_user);
+	virtual void	invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result);
 	virtual void	invalidateAll();
 	virtual void	setCompositeUpdatesEnabled(BOOL b);
 
@@ -558,7 +558,7 @@ class LLVOAvatar :
 
 public:
 	void 			updateMeshTextures();
-	void 			updateSexDependentLayerSets(BOOL set_by_user);
+	void 			updateSexDependentLayerSets(BOOL upload_bake);
 	void 			dirtyMesh(); // Dirty the avatar mesh
 	void 			updateMeshData();
 protected:
@@ -591,7 +591,7 @@ class LLVOAvatar :
 public:
 	void 			processAvatarAppearance(LLMessageSystem* mesgsys);
 	void 			hideSkirt();
-	void			startAppearanceAnimation(BOOL set_by_user, BOOL play_sound);
+	void			startAppearanceAnimation();
 	
 	//--------------------------------------------------------------------
 	// Appearance morphing
@@ -600,14 +600,13 @@ class LLVOAvatar :
 	BOOL			mAppearanceAnimating;
 private:
 	LLFrameTimer	mAppearanceMorphTimer;
-	BOOL			mAppearanceAnimSetByUser;
 	F32				mLastAppearanceBlendTime;
 
 	//--------------------------------------------------------------------
 	// Clothing colors (convenience functions to access visual parameters)
 	//--------------------------------------------------------------------
 public:
-	void			setClothesColor(LLVOAvatarDefines::ETextureIndex te, const LLColor4& new_color, BOOL set_by_user);
+	void			setClothesColor(LLVOAvatarDefines::ETextureIndex te, const LLColor4& new_color, BOOL upload_bake);
 	LLColor4		getClothesColor(LLVOAvatarDefines::ETextureIndex te);
 	static BOOL			teToColorParams(LLVOAvatarDefines::ETextureIndex te, U32 *param_name);
 
@@ -616,7 +615,7 @@ class LLVOAvatar :
 	//--------------------------------------------------------------------
 public:
 	LLColor4		getGlobalColor(const std::string& color_name ) const;
-	void			onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL set_by_user);
+	void			onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake);
 private:
 	LLTexGlobalColor* mTexSkinColor;
 	LLTexGlobalColor* mTexHairColor;
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index a2203ba2ea89ba1e2af78eefe34d0028d9114d28..185274d40d2b13c1e8a8731831d2e319362c0094 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -633,33 +633,33 @@ LLJoint *LLVOAvatarSelf::getJoint(const std::string &name)
 	return LLVOAvatar::getJoint(name);
 }
 
-/*virtual*/ BOOL LLVOAvatarSelf::setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL set_by_user )
+/*virtual*/ BOOL LLVOAvatarSelf::setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake )
 {
 	if (!which_param)
 	{
 		return FALSE;
 	}
 	LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(which_param->getID());
-	return setParamWeight(param,weight,set_by_user);
+	return setParamWeight(param,weight,upload_bake);
 }
 
-/*virtual*/ BOOL LLVOAvatarSelf::setVisualParamWeight(const char* param_name, F32 weight, BOOL set_by_user )
+/*virtual*/ BOOL LLVOAvatarSelf::setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake )
 {
 	if (!param_name)
 	{
 		return FALSE;
 	}
 	LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(param_name);
-	return setParamWeight(param,weight,set_by_user);
+	return setParamWeight(param,weight,upload_bake);
 }
 
-/*virtual*/ BOOL LLVOAvatarSelf::setVisualParamWeight(S32 index, F32 weight, BOOL set_by_user )
+/*virtual*/ BOOL LLVOAvatarSelf::setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake )
 {
 	LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(index);
-	return setParamWeight(param,weight,set_by_user);
+	return setParamWeight(param,weight,upload_bake);
 }
 
-BOOL LLVOAvatarSelf::setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL set_by_user )
+BOOL LLVOAvatarSelf::setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL upload_bake )
 {
 	if (!param)
 	{
@@ -675,12 +675,12 @@ BOOL LLVOAvatarSelf::setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL
 			LLWearable *wearable = gAgentWearables.getWearable(type,count);
 			if (wearable)
 			{
-				wearable->setVisualParamWeight(param->getID(), weight, set_by_user);
+				wearable->setVisualParamWeight(param->getID(), weight, upload_bake);
 			}
 		}
 	}
 
-	return LLCharacter::setVisualParamWeight(param,weight,set_by_user);
+	return LLCharacter::setVisualParamWeight(param,weight,upload_bake);
 }
 
 /*virtual*/ 
@@ -691,7 +691,7 @@ void LLVOAvatarSelf::updateVisualParams()
 		LLWearable *wearable = gAgentWearables.getTopWearable((EWearableType)type);
 		if (wearable)
 		{
-			wearable->writeToAvatar(FALSE, FALSE);
+			wearable->writeToAvatar();
 		}
 	}
 
@@ -702,7 +702,7 @@ void LLVOAvatarSelf::updateVisualParams()
 void LLVOAvatarSelf::idleUpdateAppearanceAnimation()
 {
 	// Animate all top-level wearable visual parameters
-	gAgentWearables.animateAllWearableParams(calcMorphAmount(), mAppearanceAnimSetByUser);
+	gAgentWearables.animateAllWearableParams(calcMorphAmount(), FALSE);
 
 	// apply wearable visual params to avatar
 	updateVisualParams();
@@ -737,8 +737,7 @@ void LLVOAvatarSelf::stopMotionFromSource(const LLUUID& source_id)
 	}
 }
 
-// virtual
-void LLVOAvatarSelf::setLocalTextureTE(U8 te, LLViewerTexture* image, BOOL set_by_user, U32 index)
+void LLVOAvatarSelf::setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index)
 {
 	if (te >= TEX_NUM_INDICES)
 	{
@@ -1347,7 +1346,7 @@ bool LLVOAvatarSelf::hasPendingBakedUploads() const
 	return false;
 }
 
-void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user )
+void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_result )
 {
 	if( !layerset || !layerset->getUpdatesEnabled() )
 	{
@@ -1358,7 +1357,7 @@ void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_u
 	layerset->requestUpdate();
 	layerset->invalidateMorphMasks();
 
-	if( set_by_user )
+	if( upload_result )
 	{
 		llassert(isSelf());
 
@@ -1945,9 +1944,7 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
 				if (layer_set)
 				{
 					llinfos << "TAT: rebake - matched entry " << (S32)index << llendl;
-					// Apparently set_by_user == force upload
-					BOOL set_by_user = TRUE;
-					self->invalidateComposite(layer_set, set_by_user);
+					self->invalidateComposite(layer_set, TRUE);
 					found = TRUE;
 					LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES);
 				}
@@ -1983,8 +1980,7 @@ void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug)
 				layer_set->cancelUpload();
 			}
 
-			BOOL set_by_user = TRUE;
-			invalidateComposite(layer_set, set_by_user);
+			invalidateComposite(layer_set, TRUE);
 			LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES);
 		}
 		else
@@ -2047,7 +2043,6 @@ void LLVOAvatarSelf::onCustomizeEnd()
 	if (avatarp)
 	{
 		avatarp->invalidateAll();
-		avatarp->requestLayerSetUploads();
 	}
 }
 
@@ -2084,7 +2079,6 @@ void LLVOAvatarSelf::setInvisible(BOOL newvalue)
 	{
 		setCompositeUpdatesEnabled(TRUE);
 		invalidateAll();
-		requestLayerSetUploads();
 		gAgent.sendAgentSetAppearance();
 	}
 }
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 8a66422c445a14c021943af260cef88dfa53d1f7..6702f030feb3ceceaafd43bd6c800d567debe727 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -86,15 +86,15 @@ class LLVOAvatarSelf :
 	/*virtual*/ void 		requestStopMotion(LLMotion* motion);
 	/*virtual*/ LLJoint*	getJoint(const std::string &name);
 
-	/*virtual*/ BOOL setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL set_by_user = FALSE );
-	/*virtual*/ BOOL setVisualParamWeight(const char* param_name, F32 weight, BOOL set_by_user = FALSE );
-	/*virtual*/ BOOL setVisualParamWeight(S32 index, F32 weight, BOOL set_by_user = FALSE );
+	/*virtual*/ BOOL setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake = FALSE );
+	/*virtual*/ BOOL setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake = FALSE );
+	/*virtual*/ BOOL setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake = FALSE );
 	/*virtual*/ void updateVisualParams();
 	/*virtual*/ void idleUpdateAppearanceAnimation();
 
 private:
 	// helper function. Passed in param is assumed to be in avatar's parameter list.
-	BOOL setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL set_by_user = FALSE );
+	BOOL setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL upload_bake = FALSE );
 
 
 /**                    Initialization
@@ -186,7 +186,7 @@ class LLVOAvatarSelf :
 	BOOL				getLocalTextureGL(LLVOAvatarDefines::ETextureIndex type, LLViewerTexture** image_gl_pp, U32 index) const;
 	LLViewerFetchedTexture*	getLocalTextureGL(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
 	const LLUUID&		getLocalTextureID(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
-	void				setLocalTextureTE(U8 te, LLViewerTexture* image, BOOL set_by_user, U32 index);
+	void				setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index);
 	const LLUUID&		grabLocalTexture(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
 	BOOL				canGrabLocalTexture(LLVOAvatarDefines::ETextureIndex type, U32 index) const;
 	/*virtual*/ void	setLocalTexture(LLVOAvatarDefines::ETextureIndex type, LLViewerTexture* tex, BOOL baked_version_exits, U32 index);
@@ -228,7 +228,7 @@ class LLVOAvatarSelf :
 	// Composites
 	//--------------------------------------------------------------------
 public:
-	/* virtual */ void	invalidateComposite(LLTexLayerSet* layerset, BOOL set_by_user);
+	/* virtual */ void	invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result);
 	/* virtual */ void	invalidateAll();
 	/* virtual */ void	setCompositeUpdatesEnabled(BOOL b); // only works for self
 	void				setupComposites();
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index c987dd17647ac1b0e26e7c5ef0331c68ed7913b0..2def905bbba05bd11f29e8adcd8000c685912023 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -108,6 +108,12 @@ class LLMediaDataClientObjectImpl : public LLMediaDataClientObject
 				if (te->getMediaData() != NULL)
 				{
 					result = te->getMediaData()->asLLSD();
+					// XXX HACK: workaround bug in asLLSD() where whitelist is not set properly
+					// See DEV-41949
+					if (!result.has(LLMediaEntry::WHITELIST_KEY))
+					{
+						result[LLMediaEntry::WHITELIST_KEY] = LLSD::emptyArray();
+					}
 				}
 			}
 			return result;
@@ -1663,6 +1669,13 @@ void LLVOVolume::requestMediaDataUpdate()
     sObjectMediaClient->fetchMedia(new LLMediaDataClientObjectImpl(this));
 }
 
+bool LLVOVolume::isMediaDataBeingFetched() const
+{
+	// I know what I'm doing by const_casting this away: this is just 
+	// a wrapper class that is only going to do a lookup.
+	return sObjectMediaClient->isInQueue(new LLMediaDataClientObjectImpl(const_cast<LLVOVolume*>(this)));
+}
+
 void LLVOVolume::cleanUpMediaImpls()
 {
 	// Iterate through our TEs and remove any Impls that are no longer used
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 784ef16ba363122795dab59529cef4e7ee1ab356..10fc8865fc5ba06c6bd4855410c5cd964c721a91 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -265,7 +265,10 @@ class LLVOVolume : public LLViewerObject
 	bool hasMedia() const;
 	
 	LLVector3 getApproximateFaceNormal(U8 face_id);
-
+	
+	// Returns 'true' iff the media data for this object is in flight
+	bool isMediaDataBeingFetched() const;
+	
 protected:
 	S32	computeLODDetail(F32	distance, F32 radius);
 	BOOL calcLOD();
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp
index 3185ee45bfe1ae2f69526a409e1a4a128ea06727..c5c97e7649c69d40cc47a3cc0a81e7361ef7564d 100644
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llwearable.cpp
@@ -602,7 +602,7 @@ void LLWearable::setTexturesToDefaults()
 }
 
 // Updates the user's avatar's appearance
-void LLWearable::writeToAvatar( BOOL set_by_user, BOOL update_customize_floater )
+void LLWearable::writeToAvatar()
 {
 	LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
 	llassert( avatar );
@@ -622,24 +622,10 @@ void LLWearable::writeToAvatar( BOOL set_by_user, BOOL update_customize_floater
 			S32 param_id = param->getID();
 			F32 weight = getVisualParamWeight(param_id);
 
-			// only animate with user-originated changes
-			if (set_by_user)
-			{
-				param->setAnimationTarget(weight, set_by_user);
-			}
-			else
-			{
-				avatar->setVisualParamWeight( param_id, weight, set_by_user );
-			}
+			avatar->setVisualParamWeight( param_id, weight, FALSE );
 		}
 	}
 
-	// only interpolate with user-originated changes
-	if (set_by_user)
-	{
-		avatar->startAppearanceAnimation(TRUE, TRUE);
-	}
-
 	// Pull texture entries
 	for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
 	{
@@ -657,24 +643,17 @@ void LLWearable::writeToAvatar( BOOL set_by_user, BOOL update_customize_floater
 			}
 			LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE );
 			// MULTI-WEARABLE: replace hard-coded 0
-			avatar->setLocalTextureTE(te, image, set_by_user, 0);
+			avatar->setLocalTextureTE(te, image, 0);
 		}
 	}
 
-
-	if( gFloaterCustomize && update_customize_floater )
-	{
-		gFloaterCustomize->setWearable(mType, 0);
-		gFloaterCustomize->setCurrentWearableType( mType );
-	}
-
 	ESex new_sex = avatar->getSex();
 	if( old_sex != new_sex )
 	{
-		avatar->updateSexDependentLayerSets( set_by_user );
+		avatar->updateSexDependentLayerSets( FALSE );
 	}	
 	
-//	if( set_by_user )
+//	if( upload_bake )
 //	{
 //		gAgent.sendAgentSetAppearance();
 //	}
@@ -683,7 +662,7 @@ void LLWearable::writeToAvatar( BOOL set_by_user, BOOL update_customize_floater
 
 // Updates the user's avatar's appearance, replacing this wearables' parameters and textures with default values.
 // static 
-void LLWearable::removeFromAvatar( EWearableType type, BOOL set_by_user )
+void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake )
 {
 	LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
 	llassert( avatar );
@@ -707,7 +686,7 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL set_by_user )
 		if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
 		{
 			S32 param_id = param->getID();
-			avatar->setVisualParamWeight( param_id, param->getDefaultWeight(), set_by_user );
+			avatar->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake );
 		}
 	}
 
@@ -719,7 +698,7 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL set_by_user )
 	avatar->updateVisualParams();
 	avatar->wearableUpdated(type);
 
-//	if( set_by_user )
+//	if( upload_bake )
 //	{
 //		gAgent.sendAgentSetAppearance();
 //	}
@@ -868,12 +847,12 @@ void LLWearable::setVisualParams()
 }
 
 
-void LLWearable::setVisualParamWeight(S32 param_index, F32 value, BOOL set_by_user)
+void LLWearable::setVisualParamWeight(S32 param_index, F32 value, BOOL upload_bake)
 {
 	if( is_in_map(mVisualParamIndexMap, param_index ) )
 	{
 		LLVisualParam *wearable_param = mVisualParamIndexMap[param_index];
-		wearable_param->setWeight(value, set_by_user);
+		wearable_param->setWeight(value, upload_bake);
 	}
 	else
 	{
@@ -914,14 +893,14 @@ void LLWearable::getVisualParams(visual_param_vec_t &list)
 	}
 }
 
-void LLWearable::animateParams(F32 delta, BOOL set_by_user)
+void LLWearable::animateParams(F32 delta, BOOL upload_bake)
 {
 	for(visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
 		 iter != mVisualParamIndexMap.end();
 		 ++iter)
 	{
 		LLVisualParam *param = (LLVisualParam*) iter->second;
-		param->animate(delta, set_by_user);
+		param->animate(delta, upload_bake);
 	}
 }
 
@@ -939,14 +918,14 @@ LLColor4 LLWearable::getClothesColor(S32 te) const
 	return color;
 }
 
-void LLWearable::setClothesColor( S32 te, const LLColor4& new_color, BOOL set_by_user )
+void LLWearable::setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake )
 {
 	U32 param_name[3];
 	if( LLVOAvatar::teToColorParams( (LLVOAvatarDefines::ETextureIndex)te, param_name ) )
 	{
 		for( U8 index = 0; index < 3; index++ )
 		{
-			setVisualParamWeight(param_name[index], new_color.mV[index], set_by_user);
+			setVisualParamWeight(param_name[index], new_color.mV[index], upload_bake);
 		}
 	}
 }
diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h
index 96631811c58cdec770637de31e049343d16d2cdb..fd19a864062565e46bd19a18a9906f9df571f8a8 100644
--- a/indra/newview/llwearable.h
+++ b/indra/newview/llwearable.h
@@ -89,9 +89,9 @@ class LLWearable
 	BOOL				isDirty() const;
 	BOOL				isOldVersion() const;
 
-	void				writeToAvatar( BOOL set_by_user, BOOL update_customize_floater = TRUE );
-	void				removeFromAvatar( BOOL set_by_user )	{ LLWearable::removeFromAvatar( mType, set_by_user ); }
-	static void			removeFromAvatar( EWearableType type, BOOL set_by_user ); 
+	void				writeToAvatar();
+	void				removeFromAvatar( BOOL upload_bake )	{ LLWearable::removeFromAvatar( mType, upload_bake ); }
+	static void			removeFromAvatar( EWearableType type, BOOL upload_bake ); 
 
 	BOOL				exportFile(LLFILE* file) const;
 	BOOL				importFile(LLFILE* file);
@@ -115,14 +115,14 @@ class LLWearable
 	void				setLocalTextureObject(S32 index, LLLocalTextureObject *lto);
 	void				addVisualParam(LLVisualParam *param);
 	void				setVisualParams();
-	void 				setVisualParamWeight(S32 index, F32 value, BOOL set_by_user);
+	void 				setVisualParamWeight(S32 index, F32 value, BOOL upload_bake);
 	F32					getVisualParamWeight(S32 index) const;
 	LLVisualParam*		getVisualParam(S32 index) const;
 	void				getVisualParams(visual_param_vec_t &list);
-	void				animateParams(F32 delta, BOOL set_by_user);
+	void				animateParams(F32 delta, BOOL upload_bake);
 
 	LLColor4			getClothesColor(S32 te) const;
-	void 				setClothesColor( S32 te, const LLColor4& new_color, BOOL set_by_user );
+	void 				setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake );
 
 	void				revertValues();
 
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 2daaf777728581df4e03b1f2c82d609a0df8d122..507c726e02d6e1834c44ee1332d16d667fc4cd83 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -506,20 +506,24 @@ void LLPipeline::destroyGL()
 	}
 }
 
+static LLFastTimer::DeclareTimer FTM_RESIZE_SCREEN_TEXTURE("Resize Screen Texture");
 void LLPipeline::resizeScreenTexture()
 {
+	LLFastTimer ft(FTM_RESIZE_SCREEN_TEXTURE);
 	if (gPipeline.canUseVertexShaders() && assertInitialized())
 	{
-		GLuint resX = gViewerWindow->getWorldViewWidth();
-		GLuint resY = gViewerWindow->getWorldViewHeight();
+		GLuint resX = gViewerWindow->getWindowWidthRaw();
+		GLuint resY = gViewerWindow->getWindowHeightRaw();
+		GLuint view_width = gViewerWindow->getWorldViewWidthRaw();
+		GLuint view_height = gViewerWindow->getWorldViewHeightRaw();
 	
-		allocateScreenBuffer(resX,resY);
+		allocateScreenBuffer(resX, resY, view_width, view_height);
 
 		llinfos << "RESIZED SCREEN TEXTURE: " << resX << "x" << resY << llendl;
 	}
 }
 
-void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
+void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U32 viewport_height)
 {
 	U32 samples = gSavedSettings.getU32("RenderFSAASamples");
 
@@ -540,18 +544,24 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
 		//allocate deferred rendering color buffers
 		mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE);
 		mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE);
+		mDeferredScreen.setViewport(viewport_width, viewport_height);
+		mDeferredDepth.setViewport(viewport_width, viewport_height);
 		addDeferredAttachments(mDeferredScreen);
 		mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE);		
 		mEdgeMap.allocate(resX, resY, GL_ALPHA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE);
+		mScreen.setViewport(viewport_width, viewport_height);
+		mEdgeMap.setViewport(viewport_width, viewport_height);
 
 		for (U32 i = 0; i < 3; i++)
 		{
 			mDeferredLight[i].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE);
+			mDeferredLight[i].setViewport(viewport_width, viewport_height);
 		}
 
 		for (U32 i = 0; i < 2; i++)
 		{
 			mGIMapPost[i].allocate(resX,resY, GL_RGB, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE);
+			mGIMapPost[i].setViewport(viewport_width, viewport_height);
 		}
 
 		F32 scale = gSavedSettings.getF32("RenderShadowResolutionScale");
@@ -559,6 +569,7 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
 		for (U32 i = 0; i < 4; i++)
 		{
 			mShadow[i].allocate(U32(resX*scale),U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE);
+			mShadow[i].setViewport(viewport_width, viewport_height);
 		}
 
 
@@ -568,6 +579,7 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
 		for (U32 i = 4; i < 6; i++)
 		{
 			mShadow[i].allocate(width, height, 0, TRUE, FALSE);
+			mShadow[i].setViewport(viewport_width, viewport_height);
 		}
 
 
@@ -575,16 +587,19 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
 		width = nhpo2(resX)/2;
 		height = nhpo2(resY)/2;
 		mLuminanceMap.allocate(width,height, GL_RGBA, FALSE, FALSE);
+		mLuminanceMap.setViewport(viewport_width, viewport_height);
 	}
 	else
 	{
 		mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE);		
+		mScreen.setViewport(viewport_width, viewport_height);
 	}
 	
 
 	if (gGLManager.mHasFramebufferMultisample && samples > 1)
 	{
 		mSampleBuffer.allocate(resX,resY,GL_RGBA,TRUE,TRUE,LLTexUnit::TT_RECT_TEXTURE,FALSE,samples);
+		mSampleBuffer.setViewport(viewport_width, viewport_height);
 		mScreen.setSampleBuffer(&mSampleBuffer);
 
 		if (LLPipeline::sRenderDeferred)
@@ -696,8 +711,10 @@ void LLPipeline::createGLBuffers()
 
 	stop_glerror();
 
-	GLuint resX = gViewerWindow->getWorldViewWidth();
-	GLuint resY = gViewerWindow->getWorldViewHeight();
+	GLuint resX = gViewerWindow->getWindowWidthRaw();
+	GLuint resY = gViewerWindow->getWindowHeightRaw();
+	GLuint viewport_width = gViewerWindow->getWorldViewWidthRaw();
+	GLuint viewport_height = gViewerWindow->getWorldViewHeightRaw();
 	
 	if (LLPipeline::sRenderGlow)
 	{ //screen space glow buffers
@@ -709,7 +726,7 @@ void LLPipeline::createGLBuffers()
 			mGlow[i].allocate(512,glow_res,GL_RGBA,FALSE,FALSE);
 		}
 
-		allocateScreenBuffer(resX,resY);
+		allocateScreenBuffer(resX,resY, viewport_width, viewport_height);
 	}
 	
 	if (sRenderDeferred)
@@ -3049,7 +3066,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
 	if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PICKING))
 	{
 		LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderForSelect");
-		gObjectList.renderObjectsForSelect(camera, gViewerWindow->getVirtualWindowRect());
+		gObjectList.renderObjectsForSelect(camera, gViewerWindow->getWindowRectScaled());
 	}
 	else
 	{
@@ -5530,8 +5547,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 	U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor");
 
 	LLVector2 tc1(0,0);
-	LLVector2 tc2((F32) gViewerWindow->getWorldViewWidth()*2,
-				  (F32) gViewerWindow->getWorldViewHeight()*2);
+	LLVector2 tc2((F32) gViewerWindow->getWorldViewWidthRaw()*2,
+				  (F32) gViewerWindow->getWorldViewHeightRaw()*2);
 
 	if (res_mod > 1)
 	{
@@ -5731,14 +5748,14 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
 		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
 	}
 
-	gGLViewport[0] = gViewerWindow->getWorldViewRect().mLeft;
-	gGLViewport[1] = gViewerWindow->getWorldViewRect().mBottom;
-	gGLViewport[2] = gViewerWindow->getWorldViewRect().getWidth();
-	gGLViewport[3] = gViewerWindow->getWorldViewRect().getHeight();
+	gGLViewport[0] = gViewerWindow->getWorldViewRectRaw().mLeft;
+	gGLViewport[1] = gViewerWindow->getWorldViewRectRaw().mBottom;
+	gGLViewport[2] = gViewerWindow->getWorldViewRectRaw().getWidth();
+	gGLViewport[3] = gViewerWindow->getWorldViewRectRaw().getHeight();
 	glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
 
-	tc2.setVec((F32) gViewerWindow->getWorldViewWidth(),
-			(F32) gViewerWindow->getWorldViewHeight());
+	tc2.setVec((F32) gViewerWindow->getWorldViewWidthRaw(),
+			(F32) gViewerWindow->getWorldViewHeightRaw());
 
 	gGL.flush();
 	
@@ -8742,7 +8759,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
 	glClearStencil(0);
 
 	// get the number of pixels per angle
-	F32 pa = gViewerWindow->getWindowDisplayHeight() / (RAD_TO_DEG * LLViewerCamera::getInstance()->getView());
+	F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * LLViewerCamera::getInstance()->getView());
 
 	//get resolution based on angle width and height of impostor (double desired resolution to prevent aliasing)
 	U32 resY = llmin(nhpo2((U32) (fov*pa)), (U32) 512);
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index ce50a3740503eb81c6e0eedfabb5741d30738152..9193e19bb1aaf184329a9b6ff298b089ff16e144 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -111,7 +111,7 @@ class LLPipeline
 	void resizeScreenTexture();
 	void releaseGLBuffers();
 	void createGLBuffers();
-	void allocateScreenBuffer(U32 resX, U32 resY);
+	void allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U32 viewport_height);
 
 	void resetVertexBuffers(LLDrawable* drawable);
 	void setUseVBO(BOOL use_vbo);
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index 572a4cf9e950763ee3b98f3d76ab7668fe4e525f..028a5844c63b17dcfe8353eb077e9501d4851c91 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -70,7 +70,7 @@
 	 value="1 1 0 1" />
 	<color
 	 name="Unused?"
-	 value="1 0 1 1" />
+	 value="1 0.5 0 1" />
 	<color
 	 name="Transparent"
 	 value="0 0 0 0" />
@@ -513,7 +513,7 @@
      reference="White" />
     <color
      name="ObjectChatColor"
-     reference="LtGray" />
+     reference="0.7 0.8 0.9 1" />
     <color
      name="OverdrivenColor"
      value="1 0 0 1" />
diff --git a/indra/newview/skins/default/textures/icons/AudioMute_Off.png b/indra/newview/skins/default/textures/icons/AudioMute_Off.png
new file mode 100644
index 0000000000000000000000000000000000000000..938aaef491303fe1a5e1a65585c4f971c84a1d21
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/AudioMute_Off.png differ
diff --git a/indra/newview/skins/default/textures/icons/AudioMute_Over.png b/indra/newview/skins/default/textures/icons/AudioMute_Over.png
new file mode 100644
index 0000000000000000000000000000000000000000..7bd1b12aae62337ff22651320aef61acb324f302
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/AudioMute_Over.png differ
diff --git a/indra/newview/skins/default/textures/icons/Audio_Off.png b/indra/newview/skins/default/textures/icons/Audio_Off.png
new file mode 100644
index 0000000000000000000000000000000000000000..ef746aab924c7da8e61199ecc3518d8c15b1946a
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Audio_Off.png differ
diff --git a/indra/newview/skins/default/textures/icons/Audio_Press.png b/indra/newview/skins/default/textures/icons/Audio_Press.png
new file mode 100644
index 0000000000000000000000000000000000000000..25a669224a841e29359f502a8ce004097ebb1017
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Audio_Press.png differ
diff --git a/indra/newview/skins/default/textures/icons/ExternalBrowser_Off.png b/indra/newview/skins/default/textures/icons/ExternalBrowser_Off.png
new file mode 100644
index 0000000000000000000000000000000000000000..69646ce473709df726453b1f221b968f79c3cdb9
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/ExternalBrowser_Off.png differ
diff --git a/indra/newview/skins/default/textures/icons/Pause_Off.png b/indra/newview/skins/default/textures/icons/Pause_Off.png
new file mode 100644
index 0000000000000000000000000000000000000000..77f6be569dbe2e9376208c6d1901bfd5e1eac80e
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Pause_Off.png differ
diff --git a/indra/newview/skins/default/textures/icons/Pause_Over.png b/indra/newview/skins/default/textures/icons/Pause_Over.png
new file mode 100644
index 0000000000000000000000000000000000000000..580808bf7eb488469301f6ec6c0b2b3f1c032668
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Pause_Over.png differ
diff --git a/indra/newview/skins/default/textures/icons/Pause_Press.png b/indra/newview/skins/default/textures/icons/Pause_Press.png
new file mode 100644
index 0000000000000000000000000000000000000000..859db34cae57d51f19993e847d3b3736855739f8
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Pause_Press.png differ
diff --git a/indra/newview/skins/default/textures/icons/Play_Off.png b/indra/newview/skins/default/textures/icons/Play_Off.png
new file mode 100644
index 0000000000000000000000000000000000000000..e594c1a4cb77b34eb8fa84065b804506e5cb2442
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Play_Off.png differ
diff --git a/indra/newview/skins/default/textures/icons/Play_Over.png b/indra/newview/skins/default/textures/icons/Play_Over.png
new file mode 100644
index 0000000000000000000000000000000000000000..70ab94e8c23599c46e851874feddd4375b529a8f
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Play_Over.png differ
diff --git a/indra/newview/skins/default/textures/icons/Play_Press.png b/indra/newview/skins/default/textures/icons/Play_Press.png
new file mode 100644
index 0000000000000000000000000000000000000000..b52742c6da3ef4dea9c22ad20d80bcd41c06938a
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Play_Press.png differ
diff --git a/indra/newview/skins/default/textures/icons/SkipBackward_Off.png b/indra/newview/skins/default/textures/icons/SkipBackward_Off.png
new file mode 100644
index 0000000000000000000000000000000000000000..8fc10e6583e2928dd19f26678832d317e1668482
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/SkipBackward_Off.png differ
diff --git a/indra/newview/skins/default/textures/icons/SkipForward_Off.png b/indra/newview/skins/default/textures/icons/SkipForward_Off.png
new file mode 100644
index 0000000000000000000000000000000000000000..2892e3cfa92e314e37f2b63193cb79acb9455fdd
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/SkipForward_Off.png differ
diff --git a/indra/newview/skins/default/textures/icons/StopReload_Off.png b/indra/newview/skins/default/textures/icons/StopReload_Off.png
new file mode 100644
index 0000000000000000000000000000000000000000..698569a540337429cd3c7c570167ee47b379f4e8
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/StopReload_Off.png differ
diff --git a/indra/newview/skins/default/textures/icons/StopReload_Over.png b/indra/newview/skins/default/textures/icons/StopReload_Over.png
new file mode 100644
index 0000000000000000000000000000000000000000..251b38630a418a057c650c51960c2a4532711f42
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/StopReload_Over.png differ
diff --git a/indra/newview/skins/default/textures/icons/Zoom_Off.png b/indra/newview/skins/default/textures/icons/Zoom_Off.png
new file mode 100644
index 0000000000000000000000000000000000000000..d096720c9c26010f75347f14f12b27a32ffa63df
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Zoom_Off.png differ
diff --git a/indra/newview/skins/default/textures/icons/parcel_color_EVRY.png b/indra/newview/skins/default/textures/icons/parcel_color_EVRY.png
new file mode 100644
index 0000000000000000000000000000000000000000..b5508423ebc0f6ae36b11d37fb0cf8697a727692
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/parcel_color_EVRY.png differ
diff --git a/indra/newview/skins/default/textures/icons/parcel_color_EXP.png b/indra/newview/skins/default/textures/icons/parcel_color_EXP.png
new file mode 100644
index 0000000000000000000000000000000000000000..4813d37198356805ef1c67724adae778fec9a442
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/parcel_color_EXP.png differ
diff --git a/indra/newview/skins/default/textures/icons/parcel_color_M.png b/indra/newview/skins/default/textures/icons/parcel_color_M.png
new file mode 100644
index 0000000000000000000000000000000000000000..41984c43e46f5f46913209821b219c9957c56121
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/parcel_color_M.png differ
diff --git a/indra/newview/skins/default/textures/navbar/Flag.png b/indra/newview/skins/default/textures/navbar/Flag.png
new file mode 100644
index 0000000000000000000000000000000000000000..df53c8922480451b49e14f87dfd7d42aa7d502b2
Binary files /dev/null and b/indra/newview/skins/default/textures/navbar/Flag.png differ
diff --git a/indra/newview/skins/default/textures/navbar/Lock.png b/indra/newview/skins/default/textures/navbar/Lock.png
new file mode 100644
index 0000000000000000000000000000000000000000..cf569d6ad29c42622f8cd7f4ccbec90cc864b26f
Binary files /dev/null and b/indra/newview/skins/default/textures/navbar/Lock.png differ
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 508ae689753ce56dc5abefa000b0ee1bea8b5473..525452e4d4fb7b14bf7dbb2dfca3d379c1dce4bf 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -23,6 +23,14 @@
   <texture name="Arrow_Up" file_name="widgets/Arrow_Up.png" preload="true" />
   <texture name="Arrow_Down" file_name="widgets/Arrow_Down.png" preload="true" />
 
+  <texture name="AudioMute_Off.png" file_name="icons/AudioMute_Off.png" preload="false" />
+  <texture name="AudioMute_Over.png" file_name="icons/AudioMute_Over.png" preload="false" />
+  <texture name="AudioMute_Press.png" file_name="icons/AudioMute_Press.png" preload="false" />
+
+  <texture name="Audio_Off.png" file_name="icons/Audio_Off.png" preload="false" />
+  <texture name="Audio_Over.png" file_name="icons/Audio_Over.png" preload="false" />
+  <texture name="Audio_Press.png" file_name="icons/Audio_Press.png" preload="false" />
+
   <texture name="BackArrow_Disabled" file_name="icons/BackArrow_Disabled.png" preload="false" />
   <texture name="BackArrow_Off" file_name="icons/BackArrow_Off.png" preload="false" />
   <texture name="BackArrow_Press" file_name="icons/BackArrow_Press.png" preload="false" />
@@ -101,6 +109,10 @@
 
   <texture name="DropTarget" file_name="widgets/DropTarget.png" preload="false" />
 
+  <texture name="ExternalBrowser_Off.png" file_name="icons/ExternalBrowser_Off.png" preload="false" />
+  <texture name="ExternalBrowser_Over.png" file_name="icons/ExternalBrowser_Over.png" preload="false" />
+  <texture name="ExternalBrowser_Press.png" file_name="icons/ExternalBrowser_Press.png" preload="false" />
+
   <texture name="Favorite_Star_Active" file_name="navbar/Favorite_Star_Active.png" preload="false" />
   <texture name="Favorite_Star_Off" file_name="navbar/Favorite_Star_Off.png" preload="false" />
   <texture name="Favorite_Star_Press" file_name="navbar/Favorite_Star_Press.png" preload="false" />
@@ -110,6 +122,8 @@
   <texture name="FileMenu_BarSelect" file_name="navbar/FileMenu_BarSelect.png" preload="false" scale.left="2" scale.top="0" scale.right="2" scale.bottom="0" />
   <texture name="FileMenu_BG" file_name="navbar/FileMenu_BG.png" preload="false" />
 
+  <texture name="Flag" file_name="navbar/Flag.png" preload="false" />
+
   <texture name="ForSale_Badge" file_name="icons/ForSale_Badge.png" preload="false" />
   <texture name="ForwardArrow_Off" file_name="icons/ForwardArrow_Off.png" preload="false" />
   <texture name="ForwardArrow_Press" file_name="icons/ForwardArrow_Press.png" preload="false" />
@@ -209,6 +223,7 @@
   <texture name="ListItem_Over" file_name="widgets/ListItem_Over.png" preload="true" />
 
   <texture name="Lock" file_name="icons/Lock.png" preload="false" />
+  <texture name="Lock2" file_name="navbar/Lock.png" preload="false" />
 
   <texture name="Login_Pod" file_name="windows/Login_Pod.png" preload="true" />
 
@@ -279,10 +294,16 @@
   <texture name="Overhead_M" file_name="world/Overhead_M.png" preload="false" />
   <texture name="Overhead_S" file_name="world/Overhead_S.png" preload="false" />
 
+  <texture name="parcel_color_EVRY" file_name="icons/parcel_color_EVRY.png" preload="false" />
+  <texture name="parcel_color_EXP" file_name="icons/parcel_color_EXP.png" preload="false" />
+  <texture name="parcel_color_M" file_name="icons/parcel_color_M.png" preload="false" />
+
   <texture name="parcel_drk_Build" file_name="icons/parcel_drk_Build.png" preload="false" />
  <texture name="parcel_drk_BuildNo" file_name="icons/parcel_drk_BuildNo.png" preload="false" />
  <texture name="parcel_drk_Damage" file_name="icons/parcel_drk_Damage.png" preload="false" />
  <texture name="parcel_drk_DamageNo" file_name="icons/parcel_drk_DamageNo.png" preload="false" />
+  <texture name="parcel_drk_EVRY" file_name="icons/parcel_drk_EVRY.png" preload="false" />
+  <texture name="parcel_drk_EXP" file_name="icons/parcel_drk_EXP.png" preload="false" />
  <texture name="parcel_drk_Fly" file_name="icons/parcel_drk_Fly.png" preload="false" />
  <texture name="parcel_drk_FlyNo" file_name="icons/parcel_drk_FlyNo.png" preload="false" />
  <texture name="parcel_drk_ForSale" file_name="icons/parcel_drk_ForSale.png" preload="false" />
@@ -301,6 +322,8 @@
  <texture name="parcel_lght_BuildNo" file_name="icons/parcel_lght_BuildNo.png" preload="false" />
  <texture name="parcel_lght_Damage" file_name="icons/parcel_lght_Damage.png" preload="false" />
  <texture name="parcel_lght_DamageNo" file_name="icons/parcel_lght_DamageNo.png" preload="false" />
+  <texture name="parcel_lght_EVRY" file_name="icons/parcel_lght_EVRY.png" preload="false" />
+  <texture name="parcel_lght_EXP" file_name="icons/parcel_lght_EXP.png" preload="false" />
  <texture name="parcel_lght_Fly" file_name="icons/parcel_lght_Fly.png" preload="false" />
  <texture name="parcel_lght_FlyNo" file_name="icons/parcel_lght_FlyNo.png" preload="false" />
  <texture name="parcel_lght_ForSale" file_name="icons/parcel_lght_ForSale.png" preload="false" />
@@ -315,6 +338,13 @@
  <texture name="parcel_lght_Voice" file_name="icons/parcel_lght_Voice.png" preload="false" />
  <texture name="parcel_lght_VoiceNo" file_name="icons/parcel_lght_VoiceNo.png" preload="false" />
 
+  <texture name="Pause_Off.png" file_name="icons/Pause_Off.png" preload="false" />
+  <texture name="Pause_Over.png" file_name="icons/Pause_Over.png" preload="false" />
+  <texture name="Pause_Press.png" file_name="icons/Pause_Press.png" preload="false" />
+  <texture name="Play_Off.png" file_name="icons/Play_Off.png" preload="false" />
+  <texture name="Play_Over.png" file_name="icons/Play_Over.png" preload="false" />
+  <texture name="Play_Press.png" file_name="icons/Play_Press.png" preload="false" />
+
   <texture name="Progress_1" file_name="icons/Progress_1.png" preload="false" />
   <texture name="Progress_2" file_name="icons/Progress_2.png" preload="false" />
   <texture name="Progress_3" file_name="icons/Progress_3.png" preload="false" />
@@ -366,6 +396,12 @@
   <texture name="ScrollTrack_Vert" file_name="widgets/ScrollTrack_Vert.png" preload="true" scale.left="2" scale.top="40" scale.bottom="13" scale.right="0" />
   <texture name="ScrollTrack_Horiz" file_name="widgets/ScrollTrack_Horiz.png" preload="true" scale.left="4" scale.top="0" scale.bottom="0" scale.right="2" />
 
+  <texture name="ScrubberThumb_Disabled" file_name="widgets/ScrubberThumb_Disabled.png" preload="false" />
+  <texture name="ScrubberThumb_Focus" file_name="widgets/ScrubberThumb_Focus.png" preload="false" />
+  <texture name="ScrubberThumb_Off" file_name="widgets/ScrubberThumb_Off.png" preload="false" />
+  <texture name="ScrubberThumb_Over" file_name="widgets/ScrubberThumb_Over.png" preload="false" />
+  <texture name="ScrubberThumb_Press" file_name="widgets/ScrubberThumb_Press.png" preload="false" />
+
   <texture name="Search" file_name="navbar/Search.png" preload="false" />
 
   <texture name="SegmentedBtn_Left_Off" file_name="widgets/SegmentedBtn_Left_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
@@ -389,6 +425,13 @@
   <texture name="SegmentedBtn_Right_Selected_Press" file_name="widgets/SegmentedBtn_Right_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
   <texture name="SegmentedBtn_Right_Selected_Disabled" file_name="widgets/SegmentedBtn_Right_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
 
+  <texture name="SkipBackward_Off.png" file_name="icons/SkipBackward_Off.png" preload="false" />
+  <texture name="SkipBackward_Over.png" file_name="icons/SkipBackward_Over.png" preload="false" />
+  <texture name="SkipBackward_Press.png" file_name="icons/SkipBackward_Press.png" preload="false" />
+  <texture name="SkipForward_Off.png" file_name="icons/SkipForward_Off.png" preload="false" />
+  <texture name="SkipForward_Over.png" file_name="icons/SkipForward_Over.png" preload="false" />
+  <texture name="SkipForward_Press.png" file_name="icons/SkipForward_Press.png" preload="false" />
+
   <texture name="SliderTrack_Horiz" file_name="widgets/SliderTrack_Horiz.png" scale.left="4" scale.top="4" scale.right="100" scale.bottom="2" />
   <texture name="SliderTrack_Vert" file_name="widgets/SliderTrack_Vert.png" scale.left="2" scale.top="100" scale.right="4" scale.bottom="4" />
   <texture name="SliderThumb_Off" file_name="widgets/SliderThumb_Off.png" />
@@ -406,6 +449,10 @@
   <texture name="Stepper_Up_Off" file_name="widgets/Stepper_Up_Off.png" preload="true" />
   <texture name="Stepper_Up_Press" file_name="widgets/Stepper_Up_Press.png" preload="true" />
 
+  <texture name="StopReload_Off.png" file_name="icons/StopReload_Off.png" preload="false" />
+  <texture name="StopReload_Over.png" file_name="icons/StopReload_Over.png" preload="false" />
+  <texture name="StopReload_Press.png" file_name="icons/StopReload_Press.png" preload="false" />
+
   <texture name="TabIcon_Appearance_Large" file_name="taskpanel/TabIcon_Appearance_Large.png" preload="false" />
   <texture name="TabIcon_Appearance_Off" file_name="taskpanel/TabIcon_Appearance_Off.png" preload="false" />
   <texture name="TabIcon_Appearance_Over" file_name="taskpanel/TabIcon_Appearance_Over.png" preload="false" />
@@ -461,6 +508,9 @@
   <texture name="TextField_Disabled" file_name="widgets/TextField_Disabled.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" />
   <texture name="TextField_Active" file_name="widgets/TextField_Active.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" />
 
+  <texture name="TimeBasedMediaBackground" file_name="windows/TimeBasedMediaBackground.png" preload="false" />
+
+
   <texture name="Toast_CloseBtn" file_name="windows/Toast_CloseBtn.png" preload="true" />
   <texture name="Toast_Background" file_name="windows/Toast_Background.png" preload="true"
            scale.left="4" scale.top="28" scale.right="60" scale.bottom="4" />
@@ -481,6 +531,8 @@
   <texture name="Toolbar_Right_Off" file_name="containers/Toolbar_Right_Off.png" preload="false" />
   <texture name="Toolbar_Right_Press" file_name="containers/Toolbar_Right_Press.png" preload="false" />
   <texture name="Toolbar_Right_Selected" file_name="containers/Toolbar_Right_Selected.png" preload="false" />
+  
+  <texture name="Tooltip" file_name="widgets/Tooltip.png" preload="true" scale.left="2" scale.top="1" scale.right="99" scale.bottom="14" />
 
   <texture name="TrashItem_Disabled" file_name="icons/TrashItem_Disabled.png" preload="false" />
   <texture name="TrashItem_Off" file_name="icons/TrashItem_Off.png" preload="false" />
@@ -495,6 +547,8 @@
   <texture name="VoicePTT_Off" file_name="bottomtray/VoicePTT_Off.png" preload="false" />
   <texture name="VoicePTT_On" file_name="bottomtray/VoicePTT_On.png" preload="false" />
 
+  <texture name="WebBasedMediaBackground" file_name="windows/WebBasedMediaBackground.png" preload="false" />
+
   <texture name="Widget_DownArrow" file_name="icons/Widget_DownArrow.png" preload="true" />
   <texture name="Widget_UpArrow" file_name="icons/Widget_UpArrow.png" preload="true" />
 
@@ -509,6 +563,10 @@
 
   <texture name="YouAreHere_Badge" file_name="icons/YouAreHere_Badge.png" preload="false" />
 
+  <texture name="Zoom_Off.png" file_name="icons/Zoom_Off.png" preload="false" />
+  <texture name="Zoom_Over.png" file_name="icons/Zoom_Over.png" preload="false" />
+  <texture name="Zoom_Press.png" file_name="icons/Zoom_Press.png" preload="false" />
+
   <!--WARNING OLD ART *do not use*-->
 
   <texture name="btn_chatbar.tga" scale.left="20" scale.top="24" scale.right="44" scale.bottom="0" />
diff --git a/indra/newview/skins/default/textures/widgets/Tooltip.png b/indra/newview/skins/default/textures/widgets/Tooltip.png
new file mode 100644
index 0000000000000000000000000000000000000000..f989ac9083283cfeab4fdcfc93ebf9175152cf7b
Binary files /dev/null and b/indra/newview/skins/default/textures/widgets/Tooltip.png differ
diff --git a/indra/newview/skins/default/xui/en/floater_aaa.xml b/indra/newview/skins/default/xui/en/floater_aaa.xml
index 4d5268681b6fc0c7959f6774f734896a7662b1f7..d0d0cc64c55ee442f775141b8850b98c77fd7579 100644
--- a/indra/newview/skins/default/xui/en/floater_aaa.xml
+++ b/indra/newview/skins/default/xui/en/floater_aaa.xml
@@ -1,24 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
- legacy_header_height="18"
- height="440"
+ height="768"
  layout="topleft"
  name="floater_aaa"
- help_topic="floater_aaa"
- save_rect="true"
  can_resize="true" 
- title="ABOUT [APP_NAME]"
- width="470">
-    <text_editor
-     follows="left|top|right|bottom"
-     height="400"
-     layout="topleft"
-     left="6"
-     max_length="65536"
-     name="credits_editor"
-     top="25"
-     width="458"
-     word_wrap="true">
-This is line 4
-    </text_editor>
+ width="1024">
+  <panel filename="main_view.xml" follows="all" width="1024" height="768" top="0"/>
 </floater>
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 a0f9bb59fd2cb0849e75cd369e5a585115010e5c..3a1499eaaaf0ec0c3d3ab8a6fcfdc6654e9d9af5 100644
--- a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
+++ b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml
@@ -16,7 +16,7 @@
     </floater.string>
     <floater.string
      name="no_one_near">
-        No-one near
+        No one near
     </floater.string>
     <floater.string
      name="no_results">
diff --git a/indra/newview/skins/default/xui/en/floater_media_settings.xml b/indra/newview/skins/default/xui/en/floater_media_settings.xml
index 68dd2001afb9809ab62fd563e4fff33e331d1325..8122386fae35c3fb7c31072949454e9b43b5a779 100644
--- a/indra/newview/skins/default/xui/en/floater_media_settings.xml
+++ b/indra/newview/skins/default/xui/en/floater_media_settings.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
  legacy_header_height="18"
- bottom="-666" 
+ bottom="666" 
  can_close="true" 
  can_drag_on_left="false" 
  can_minimize="true"
@@ -12,14 +12,14 @@
  width="365" 
  height="535" 
  left="330" 
- min_height="430" 
- min_width="620"
+ min_height="535" 
+ min_width="365"
  mouse_opaque="true" 
- name="Media Settings" 
+ name="media_settings" 
  help_topic = "media_settings"
  title="MEDIA SETTINGS">
 	<button 
-	 bottom="-525" 
+	 bottom="525" 
 	 enabled="true" 
 	 follows="right|bottom" 
 	 font="SansSerif"
@@ -61,7 +61,7 @@
 	 scale_image="true"
 	 width="90" />
 	<tab_container 
-	 bottom="-500" 
+	 bottom="500" 
 	 enabled="true" 
 	 follows="left|top|right|bottom" 
 	 height="485"
diff --git a/indra/newview/skins/default/xui/en/floater_search.xml b/indra/newview/skins/default/xui/en/floater_search.xml
index edc1fb88385a69452c950457361d6453185f4771..d9498586af9d0459e0581009d30df9669e5bae28 100644
--- a/indra/newview/skins/default/xui/en/floater_search.xml
+++ b/indra/newview/skins/default/xui/en/floater_search.xml
@@ -2,7 +2,7 @@
 <floater
  legacy_header_height="18"
  can_resize="true"
- height="400"
+ height="512"
  layout="topleft"
  min_height="140"
  min_width="467"
@@ -25,7 +25,7 @@
         Done
     </floater.string>
     <layout_stack
-     bottom="400"
+     bottom="512"
      follows="left|right|top|bottom"
      layout="topleft"
      left="10"
@@ -54,7 +54,7 @@
              layout="topleft"
              left_delta="0"
              name="status_text"
-             top_pad="4"
+             top_pad="5"
              width="150" />
         </layout_panel>
     </layout_stack>
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 8dba05f1eebbcabba773fe17af5d58339af5e16c..3aeb7c93e7f7db08474263c07dbc46ab6438f9f6 100644
--- a/indra/newview/skins/default/xui/en/floater_test_textbox.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_textbox.xml
@@ -10,83 +10,64 @@
     <text
      type="string"
      length="1"
-     height="10"
-     layout="topleft"
-     left="10"
-     top="30"
-     width="300">
-        Bottom and left specified
-    </text>
-    <text
-     type="string"
-     length="1"
-     height="10"
-     layout="topleft"
-     left_delta="200"
-     top_delta="0"
-     width="300">
-        Bottom delta left delta
-    </text>
-    <text
-     type="string"
-     length="1"
-     height="10"
+     height="90"
      layout="topleft"
      left="10"
-     top="50"
-     width="300">
-        Bottom delta -20
-    </text>
-    <text
-     type="string"
-     length="1"
-     height="10"
-     layout="topleft"
-     left_delta="0"
      top_pad="30"
      width="300">
         First line of multiple lines
-    Second 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
        top_pad="10"
        left="10"
-       right="-10" 
+       right="-10"
+       height="20"
        follows="top|left"
        font.name="SansSerifSmall"
        name="test_text10"
        tool_tip="text">
-        SansSerifSmall. Русский 中文 (简体) The quick brown fox jumped over the lazy dog.
+        SansSerifSmall
+The 华文细黑 brown fox ヒラキjumped over the lazy dog.
       </text>
       <text
        top_pad="10"
        left="10"
-       right="-10" 
+       right="-10"
+       height="25"
        follows="top|left"
-       font.name="SansSerif"
+       font.name="SansSerifMedium"
        name="test_text11"
        tool_tip="text">
-        SansSerif.  Русский 中文 (简体) The quick brown fox jumped over the lazy dog.
+        SansSerif
+The 华文细黑 brown fox ヒラキjumped over the lazy dog.
       </text>
       <text
        top_pad="10"
        left="10"
-       right="-10" 
+       right="-10"
        follows="top|left"
+       height="26"
        font.name="SansSerifLarge"
        name="test_text12"
        tool_tip="text">
-        SansSerifLarge.  Русский 中文 (简体) The quick brown fox jumped over the lazy dog.
+        SansSerifLarge
+The 华文细黑 brown fox ヒラキjumped over the lazy dog.
       </text>
       <text
        top_pad="10"
        left="10"
-       right="-10" 
+       height="35"
+       right="-10"
        follows="top|left"
        font.name="SansSerifHuge"
        name="test_text13"
        tool_tip="text">
-        SansSerifHuge.  Русский 中文 (简体) The quick brown fox jumped over the lazy dog.
+        SansSerifHuge
+The 华文细黑 brown fox ヒラキjumped over the lazy dog.
       </text>
     <text
      type="string"
@@ -112,27 +93,6 @@
      width="300">
       SansSerif BOLD UNDERLINE
     </text>
-    <text
-     type="string"
-     length="1"
-     font="SansSerif"
-     height="10"
-     layout="topleft"
-     left_delta="0"
-     top_pad="10"
-     width="300">
-      SansSerif UNDERLINE
-    </text>
-    <text
-     type="string"
-     length="1"
-     height="10"
-     layout="topleft"
-     left_delta="0"
-     top_pad="10"
-     width="300">
-        Escaped greater than &gt;
-    </text>
     <text
    type="string"
    length="1"
@@ -142,8 +102,7 @@
    left="10"
    name="right_aligned_text"
    width="380"
-   halign="right" 
-   text_color="1 1 1 0.7"
+   halign="right"
    top_pad="10">
     Right aligned text
   </text>
@@ -157,21 +116,19 @@
  name="centered_text"
  width="380"
  halign="center"
- text_color="1 1 1 0.7"
  top_pad="10">
     Centered text
   </text>
   <text
  type="string"
  length="1"
- height="60" 
+ height="60"
  label="N"
  layout="topleft"
  left="10"
  name="left_aligned_text"
  width="380"
  halign="left"
- text_color="1 1 1 0.7"
  top_pad="10">
     Left aligned text
   </text>
@@ -184,7 +141,6 @@
    left="10"
    name="floater_map_north"
    right="30"
-   text_color="1 1 1 0.7"
    top="370">
     N
   </text>
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 44dcb075264d257ae1ce281c51e3bcbfecbd16f8..a2055d8c52f797103ed32035ea698a9906488b38 100644
--- a/indra/newview/skins/default/xui/en/floater_test_widgets.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_widgets.xml
@@ -380,6 +380,16 @@ line to actually fit
        tool_tip="Color Swatch: Click to open Color Picker"
        top_delta="0"
        width="80" />
+      <text
+       top_pad="10"
+       left="10"
+       width="250" 
+       follows="top|left"
+       font.name="Monospace"
+       name="test_text10"
+       tool_tip="text">
+        Monospace Button Flyout Checkbox
+      </text>
       <text
        top_pad="10"
        left="10"
diff --git a/indra/newview/skins/default/xui/en/fonts.xml b/indra/newview/skins/default/xui/en/fonts.xml
index f3da62a8964198557a5cd0afcc54b7a42c23493b..ebbb53729d2895cfc75a05f5de0fc2a1b6d866cf 100644
--- a/indra/newview/skins/default/xui/en/fonts.xml
+++ b/indra/newview/skins/default/xui/en/fonts.xml
@@ -144,18 +144,18 @@
 	     />
   <font_size name="Huge"
 	     comment="Size of huge font (points, or 1/72 of an inch)"
-	     size="15.0"
+	     size="16.0"
 	     />
   <font_size name="Large"
 	     comment="Size of large font (points, or 1/72 of an inch)"
-	     size="10.0"
+	     size="10.6"
 	     />
   <font_size name="Medium"
 	     comment="Size of medium font (points, or 1/72 of an inch)"
-	     size="9.0"
+	     size="8.6"
 	     />
   <font_size name="Small"
 	     comment="Size of small font (points, or 1/72 of an inch)"
-	     size="7.8"
+	     size="7.6"
 	     />
 </fonts>
diff --git a/indra/newview/skins/default/xui/en/inspect_remote_object.xml b/indra/newview/skins/default/xui/en/inspect_remote_object.xml
new file mode 100644
index 0000000000000000000000000000000000000000..07c684d9047fe0910286c1770f1dd08c7fc4ae79
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/inspect_remote_object.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<!--
+  Not can_close / no title to avoid window chrome
+  Single instance - only have one at a time, recycle it each spawn
+-->
+<floater
+ legacy_header_height="18"
+ bevel_style="in"
+ bg_opaque_image="Inspector_Background" 
+ can_close="false"
+ can_minimize="false"
+ height="145"
+ layout="topleft"
+ name="inspect_remote_object"
+ single_instance="true"
+ sound_flags="0"
+ visible="true"
+ width="300">
+  <text
+   follows="all"
+   font="SansSerifLargeBold"
+   height="16"
+   left="8"
+   name="object_name"
+   text_color="White"
+   top="5"
+   use_ellipses="true"
+   width="290">
+     Test Object Name That Is Really Long
+  </text>
+  <text
+   follows="all"
+   font="SansSerif"
+   height="20"
+   left="8"
+   name="object_owner_label"
+   width="55"
+   top_pad="20">
+     Owner:
+  </text>
+  <text
+   follows="top|left"
+   font="SansSerif"
+   height="20"
+   left_pad="10"
+   name="object_owner"
+   use_ellipses="true"
+   width="200"
+   word_wrap="false">
+     Longavatarname Johnsonlongstonnammer
+  </text>
+  <text
+   follows="top|left"
+   font="SansSerif"
+   height="20"
+   left="8"
+   name="object_slurl_label"
+   top_pad="10"
+   width="55">
+     Location:
+  </text>
+  <text
+   follows="top|left"
+   height="20"
+   left_pad="10"
+   name="object_slurl"
+   width="240"
+   use_ellipses="true"
+   word_wrap="false">
+     http://slurl.com/Ahern/50/50/50
+  </text>
+  <button
+   follows="top|left"
+   font="SansSerif"
+   height="20"
+   label="Map"
+   left="10"
+   name="map_btn"
+   top="114"
+   width="75" />
+  <button
+   follows="top|left"
+   font="SansSerif"
+   height="20"
+   label="Block"
+   left_pad="5"
+   name="block_btn"
+   top_delta="0"
+   width="75" />
+  <button
+   follows="top|left"
+   font="SansSerif"
+   height="20"
+   label="Close"
+   right="-10"
+   name="close_btn"
+   top_delta="0"
+   width="75" />
+</floater>
diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml
new file mode 100644
index 0000000000000000000000000000000000000000..08f7ee456e4361b269bf0cb965bd6e3ef82ba9b4
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/main_view.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+ follows="left|right|top|bottom"
+ height="768"
+ layout="topleft"
+ left="0"
+ mouse_opaque="false"
+ name="main_view"
+ width="1024">
+  <layout_stack border_size="0"
+                follows="all"
+                mouse_opaque="false"
+                height="772"
+                name="menu_stack"
+                orientation="vertical"
+                top="0">
+    <layout_panel auto_resize="false"
+                  min_height="19"
+                  mouse_opaque="false"
+                  name="status_bar_container"
+                  height="19"
+                  width="1024"
+                  visible="false"/>
+    <layout_panel auto_resize="false"
+                  height="65"
+                  mouse_opaque="false"
+                  name="nav_bar_container"
+                  width="1024"
+                  visible="false"/>
+    <panel        auto_resize="true"
+                  follows="all"
+                  height="500"
+                  layout="topleft"
+                  mouse_opaque="false"
+                  name="hud"
+                  width="1024">
+      <layout_stack border_size="0"
+                    follows="all"
+                    height="500"
+                    left="0"
+                    mouse_opaque="false"
+                    name="hud_stack"
+                    orientation="horizontal"
+                    top="0"
+                    width="1024">
+        <panel auto_resize="true"
+               follows="all"
+               height="500"
+               layout="topleft"
+               mouse_opaque="false"
+               name="main_view"
+               user_resize="true"
+               width="500">
+          <layout_stack border_size="0"
+                        bottom="500"
+                        follows="all"
+                        height="500"
+                        left="0"
+                        mouse_opaque="false"
+                        name="world_stack"
+                        orientation="vertical">
+            <panel auto_resize="true"
+                   follows="all"
+                   height="500"
+                   layout="topleft"
+                   mouse_opaque="false"
+                   name="hud container"
+                   width="500">
+              <view bottom="500"
+                    follows="all"
+                    height="500"
+                    left="0"
+                    mouse_opaque="false"
+                    name="world_view_rect"
+                    width="500"/>
+              <panel follows="right|top|bottom"
+                     height="500"
+                     mouse_opaque="false"
+                     name="side_bar_tabs"
+                     right="500"
+                     top="0"
+                     width="32"/>
+              <panel bottom="500"
+                     follows="left|right|bottom"
+                     height="25"
+                     left="0"
+                     mouse_opaque="false"
+                     name="stand_stop_flying_container"
+                     visible="false"
+                     width="500"/>
+            </panel>
+            <layout_panel auto_resize="false"
+                   follows="all"
+                   min_height="33"
+                   mouse_opaque="false"
+                   name="bottom_tray_container"
+                   visible="false"/>
+          </layout_stack>
+        </panel>
+        <!-- side tray -->
+        <layout_panel auto_resize="false"
+                      follows="all"
+                      height="500"
+                      min_width="333"
+                      mouse_opaque="false"
+                      name="side_tray_container"
+                      user_resize="true"
+                      visible="false"
+                      width="333"/>
+      </layout_stack>
+      <floater_view follows="all"
+                    height="500"
+                    left="0"
+                    mouse_opaque="false"
+                    name="Floater View"
+                    tab_group="-1"
+                    tab_stop="false"
+                    top="0"
+                    width="1024"/>
+      <debug_view follows="all"
+                  left="0"
+                  top="0"
+                  mouse_opaque="false"
+                  height="500"
+                  name="DebugView"
+                  width="1024"/>
+  </panel>
+  </layout_stack>
+  <notify_box_view top="0"
+                   follows="all"
+                   height="768"
+                   mouse_opaque="false"
+                   name="notify_container"
+                   tab_group="-2"
+                   width="1024"/>
+  <menu_holder top="0"
+               follows="all"
+               height="768"
+               mouse_opaque="false"
+               name="Menu Holder"
+               width="1024"/>
+  <snapshot_floater_view enabled="false"
+                         follows="all"
+                         height="768"
+                         left="0"
+                         mouse_opaque="false"
+                         name="Snapshot Floater View"
+                         tab_stop="false"
+                         top="0"
+                         visible="false"
+                         width="1024"/>
+  <tooltip_view top="0"
+                follows="all"
+                height="768"
+                mouse_opaque="false"
+                name="tooltip view"
+                tab_group="-2"
+                width="1024"/>
+</panel>
diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml
index 5eb0560962da5fccbeab7856d08e45317a0cbc3e..bd60574a9558e44ac23e58ba7b3ed2fb48d3c37a 100644
--- a/indra/newview/skins/default/xui/en/menu_login.xml
+++ b/indra/newview/skins/default/xui/en/menu_login.xml
@@ -185,6 +185,14 @@
         <menu_item_call.on_click
          function="Advanced.ShowSideTray" />
       </menu_item_call>
+        <menu_item_call
+         label="Widget Test"
+         name="Widget Test"
+         shortcut="control|shift|T">
+            <menu_item_call.on_click
+             function="ShowFloater"
+             parameter="test_widgets" />
+        </menu_item_call>
       <menu_item_check
          label="Reg In Client Test (restart)"
          name="Reg In Client Test (restart)">
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 1499095bcc7079432e263543cada870637564138..e98a6d57bbbc508ff3298d8f3c4c988cf4e99cb1 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -843,18 +843,18 @@
                 <menu_item_call.on_click
                  function="Floater.Toggle"
                  parameter="perm_prefs" />
-         <menu_item_check
-         label="Show Advanced Permissions"
-         layout="topleft"
-         name="DebugPermissions">
-            <menu_item_check.on_check
-             function="CheckControl"
-             parameter="DebugPermissions" />
-            <menu_item_check.on_click
-             function="ToggleControl"
-             parameter="DebugPermissions" />
-        </menu_item_check>
             </menu_item_call>
+			<menu_item_check
+			   label="Show Advanced Permissions"
+			   layout="topleft"
+			   name="DebugPermissions">
+			  <menu_item_check.on_check
+				 function="CheckControl"
+				 parameter="DebugPermissions" />
+			  <menu_item_check.on_click
+				 function="ToggleControl"
+				 parameter="DebugPermissions" />
+			</menu_item_check>
             <!--menu_item_call
              label="Show Script Warning/Error Window"
              layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index ccd8bc569e7e236a626be775f6974f98f922a1db..ff0cd7ffebe57e63c054380c22739992763137f1 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -4696,7 +4696,12 @@ The objects on the selected parcel that are NOT owned by you have been returned
    icon="notify.tga"
    name="ServerObjectMessage"
    type="notify">
+Message from [NAME]:
 [MSG]
+    <usetemplate
+     name="okcancelbuttons"
+     notext="OK"
+     yestext="Inspect"/>
   </notification>
 
   <notification
@@ -5013,6 +5018,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you a
    name="GodMessage"
    type="notify">
 [NAME]
+
 [MESSAGE]
   </notification>
 
diff --git a/indra/newview/skins/default/xui/en/panel_activeim_row.xml b/indra/newview/skins/default/xui/en/panel_activeim_row.xml
index 8b815b0f711cc1cde2702d8bf90f7670fe6bdba9..5562ec84066302b124706c42e833f371217a9f50 100644
--- a/indra/newview/skins/default/xui/en/panel_activeim_row.xml
+++ b/indra/newview/skins/default/xui/en/panel_activeim_row.xml
@@ -15,7 +15,16 @@
 		top="3"
 		left="5"
 		height="25"
-		width="25">
+		width="25"
+    visible="false"
+    speaker.name="speaker_p2p"
+    speaker.width="20"
+    speaker.height="25"
+    speaker.left="25"
+    speaker.top="25"
+    speaker.auto_update="true"
+    speaker.draw_border="false"
+    speaker.visible="false">
   </chiclet_im_p2p>
   <chiclet_im_group
 		name="group_chiclet"
@@ -24,14 +33,41 @@
 		top="3"
 		left="5"
 		height="25"
-		width="25">
+		width="25"
+    visible="false"
+    speaker.name="speaker_grp"
+    speaker.width="20"
+    speaker.height="25"
+    speaker.left="25"
+    speaker.top="25"
+    speaker.auto_update="true"
+    speaker.draw_border="false"
+    speaker.visible="false">
   </chiclet_im_group>
+  <chiclet_im_adhoc
+		name="adhoc_chiclet"
+		layout="topleft"
+		follows="left"
+		top="3"
+		left="5"
+		height="25"
+		width="25"
+    visible="false"
+    speaker.name="speaker_hoc"
+    speaker.width="20"
+    speaker.height="25"
+    speaker.left="25"
+    speaker.top="25"
+    speaker.auto_update="true"
+    speaker.draw_border="false"
+    speaker.visible="false">
+  </chiclet_im_adhoc>
 	<text
 		type="string"
 		name="contact_name"
 		layout="topleft"
 		top="10"
-		left_pad="0"
+		left_pad="20"
 		height="14"
 		width="245"
 		length="1"
diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
index 34fa7dbef29ea18ce7d7df7938342d0544531344..818801645527b5eb23a2021dadf06b6dcee65c7c 100644
--- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
@@ -31,6 +31,7 @@
          height="10"
          image_name="spacer24.tga"
          layout="topleft"
+         min_width="4"
          left="0"
          top="0"
          width="4" />
@@ -44,7 +45,7 @@
          min_height="23"
          width="310"
          top="0"
-         min_width="300"
+         min_width="192"
          name="chat_bar"
          user_resize="false"
          filename="panel_nearby_chat_bar.xml" />
@@ -55,34 +56,35 @@
          height="28"
          layout="topleft"
          min_height="28"
-         width="100"
+         width="104"
          top_delta="0"
-         min_width="96"
+         min_width="104"
          name="speak_panel"
          user_resize="false">
-         <talk_button
-          follows="right"
-          height="23"
-          speak_button.tab_stop="true"
-          show_button.tab_stop="true"
-          layout="topleft"
-          left="0"
-          name="talk"
-          top="3"
+          <talk_button
+           follows="right"
+           height="23"
+           speak_button.tab_stop="true"
+           show_button.tab_stop="true"
+           layout="topleft"
+           left="0"
+           name="talk"
+           top="3"
           width="100"
           speak_button.tool_tip="Turns microphone on/off"
           show_button.tool_tip="Shows/hides voice control panel" />
         </layout_panel>
-		 <icon
-         auto_resize="false"
-         follows="left|right"
-         height="10"
-         image_name="spacer24.tga"
-         layout="topleft"
-         left="0"
-         name="DUMMY"
-         top="0"
-         width="4"/>
+        <icon
+            auto_resize="false"
+            follows="left|right"
+            height="10"
+            image_name="spacer24.tga"
+            layout="topleft"
+            left="0"
+            name="DUMMY"
+            min_width="4"
+            top="0"
+            width="4"/>
         <layout_panel
          mouse_opaque="false"
          auto_resize="false"
@@ -90,13 +92,13 @@
          height="28"
          layout="topleft"
          min_height="28"
-         width="80"
+         width="82"
          top_delta="0"
-         min_width="76"
+         min_width="82"
          name="gesture_panel"
          user_resize="false">
-         <button
-           follows="right"
+         <gesture_combo_box
+          follows="left|right"
           height="23"
           label="Gesture"
           layout="topleft"
@@ -104,7 +106,7 @@
           left="0"
           top="3"
          use_ellipses="true"
-          width="80"
+          width="82"
           tool_tip="Shows/hides gestures"/>
         </layout_panel>
 		 <icon
@@ -115,6 +117,7 @@
          image_name="spacer24.tga"
          layout="topleft"
          left="0"
+         min_width="4" 
          name="DUMMY"
          top="0"
          width="4"/>
@@ -126,8 +129,9 @@
          layout="topleft"
          min_height="28"
          name="movement_panel"
+         user_resize="false"
          width="80"
-         min_width="76">
+         min_width="80">
             <button
              follows="left|right"
              height="23"
@@ -152,6 +156,7 @@
          image_name="spacer24.tga"
          layout="topleft"
          left="0"
+         min_width="4" 
          name="DUMMY"
          top="0"
          width="4"/>
@@ -162,10 +167,10 @@
          height="28"
          layout="topleft"
          min_height="28"
-         min_width="76"
+         min_width="80"
          name="cam_panel"
-         top_delta="-10"
-         width="100">
+         user_resize="false"
+         width="80">
             <button
              follows="left|right"
              height="23"
@@ -191,6 +196,7 @@
          image_name="spacer24.tga"
          layout="topleft"
          left="0"
+         min_width="4" 
          name="DUMMY"
          top="0"
          width="4"/>
@@ -200,10 +206,11 @@
          follows="left|right"
          height="28"
          layout="topleft"
+         min_width="40"
          name="snapshot_panel"
          width="40">
             <button
-         follows="left|right"
+			 follows="left|right"
              height="23"
              left="0"
              label=""
@@ -212,9 +219,12 @@
              width="36"
              top="3"
              image_overlay="Snapshot_Off"
-            tool_tip="Take snapshot"
-                 />
-        </layout_panel>
+             tool_tip="Take snapshot">
+				<button.commit_callback
+				 function="Floater.Toggle"
+				 parameter="snapshot" />
+			</button>
+		</layout_panel>
         <layout_panel
          mouse_opaque="false"
          follows="left|right"
@@ -223,15 +233,18 @@
          top="0"
          name="chiclet_list_panel"
          width="189"
-         min_width="189"
+         min_width="180"
          user_resize="false"
          auto_resize="true">
+<!--*NOTE: min_width of the chiclet_panel (chiclet_list) must be the same 
+as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly. EXT-991-->
             <chiclet_panel
 	    mouse_opaque="false"
              follows="left|right"
              height="28"
              layout="topleft"
              left="0"
+             min_width="180"
              name="chiclet_list"
              top="0"
              chiclet_padding="3"
@@ -271,6 +284,7 @@
          image_name="spacer24.tga"
          layout="topleft"
          left="0"
+         min_width="4" 
          top="0"
          width="5"/>
         <layout_panel
@@ -304,9 +318,9 @@
                />
                <unread_notifications
                width="34"
-               height="23"
-               left="22"
-               top="23" />
+               height="20"
+               left="0"
+               top="19" />
 	    </chiclet_notification>
         </layout_panel>
        <icon
@@ -316,6 +330,7 @@
          height="10"
          image_name="spacer24.tga"
          layout="topleft"
+         min_width="4" 
          right="-1"
          top="0"
          width="26"/>
diff --git a/indra/newview/skins/default/xui/en/panel_group_general.xml b/indra/newview/skins/default/xui/en/panel_group_general.xml
index 4f24c7a745b62232b734cb28ccdf2319fcc8505a..58a78a0ab852aefef0059ad5b2d64927a074b510 100644
--- a/indra/newview/skins/default/xui/en/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_general.xml
@@ -8,7 +8,7 @@
  left="0"
  top="0"
  name="general_tab"
- width="303">
+ width="310">
     <panel.string
      name="help_text">
         The General tab contains general information about this group, a list of members, general Group Preferences and member options.
@@ -32,7 +32,7 @@ Hover your mouse over the options for more help.
      max_length="511"
      name="charter"
      top="5"
-     width="303"
+     width="305"
      word_wrap="true">
      Group Charter
     </text_editor>
@@ -43,10 +43,10 @@ Hover your mouse over the options for more help.
      heading_height="16"
      height="130"
      layout="topleft"
-     left_delta="0"
+     left="5"
      name="visible_members"
-     top_pad="0"
-     width="303">
+     top_pad="2"
+     width="305">
         <name_list.columns
          label="Member"
          name="name"
@@ -64,7 +64,7 @@ Hover your mouse over the options for more help.
          left_delta="0"
          name="active_title_label"
          top_pad="5"
-         width="303">
+         width="300">
             My Title
         </text>
         <combo_box
@@ -75,7 +75,7 @@ Hover your mouse over the options for more help.
          name="active_title"
          tool_tip="Sets the title that appears in your avatar&apos;s name tag when this group is active."
          top_pad="2"
-         width="303" />
+         width="305" />
         <check_box
          height="16"
          font="SansSerifSmall"
@@ -85,7 +85,7 @@ Hover your mouse over the options for more help.
          name="receive_notices"
          tool_tip="Sets whether you want to receive Notices from this group.  Uncheck this box if this group is spamming you."
          top_pad="5"
-         width="303" />
+         width="300" />
         <check_box
          height="16"
          label="Show in my profile"
@@ -94,7 +94,7 @@ Hover your mouse over the options for more help.
          name="list_groups_in_profile"
          tool_tip="Sets whether you want to show this group in your profile"
          top_pad="5"
-         width="303" />
+         width="295" />
         <panel
          background_visible="true"
          bevel_style="in"
@@ -106,7 +106,7 @@ Hover your mouse over the options for more help.
          left="5"
          name="preferences_container"
          top_pad="5"
-         width="303">
+         width="305">
         <check_box
          follows="right|top"
          height="16"
diff --git a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
index de1323d9cb51dee368e5d5a0178cba375c61b462..0082128ca42fd5ea5202f8579501227f3f15f943 100644
--- a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
@@ -9,7 +9,7 @@ background_visible="true"
  left="0"
  top="20"
  name="GroupInfo"
- width="333">
+ width="323">
     <panel.string
      name="default_needs_apply_text">
         There are unsaved changes to the current tab
@@ -117,28 +117,17 @@ background_visible="true"
      width="120" />
    <accordion
              follows="all"
-             height="425"
+             height="405"
              layout="topleft"
              left="0"
              name="groups_accordion"
              top_pad="15"
-             width="336">
+             width="323">
              <accordion_tab
                  expanded="true"
                  layout="topleft"
                  name="group_general_tab"
                  title="General">
-         <scroll_container
-         color="DkGray2"
-         opaque="true"
-         height="323"
-         follows="all"
-         layout="topleft"
-         left="0"
-         top="0"
-         name="general_scroll"
-         reserve_scroll_corner="false"
-         width="333">
             <panel
             border="false"
          class="panel_group_general" 
@@ -146,27 +135,15 @@ background_visible="true"
              layout="topleft"
              left="0"
              help_topic="group_general_tab"
-         name="group_general_tab_panel"
+             name="group_general_tab_panel"
              top="0"
-             width="303" />
-         </scroll_container>
+             width="300" />
          </accordion_tab>
          <accordion_tab
                  expanded="false"
                  layout="topleft"
                  name="group_roles_tab"
                  title="Roles">
-               <scroll_container
-                  color="DkGray2"
-                  opaque="true"
-                  height="323"
-                  follows="all"
-                  layout="topleft"
-                  left="0"
-                  top="0"
-                  name="roles_scroll"
-                  reserve_scroll_corner="false"
-                  width="333">
                  <panel
                  border="false"
          class="panel_group_roles"
@@ -177,24 +154,12 @@ background_visible="true"
          name="group_roles_tab_panel"
                   top="0"
              width="303" />
-         </scroll_container>
          </accordion_tab>
          <accordion_tab
                  expanded="false"
                  layout="topleft"
                  name="group_notices_tab"
                  title="Notices">
-            <scroll_container
-                  color="DkGray2"
-                  opaque="true"
-                  height="323"
-                  follows="all"
-                  layout="topleft"
-                  left="0"
-                  top="0"
-                  name="notices_scroll"
-                  reserve_scroll_corner="false"
-                  width="333">
         <panel
         border="false"
          class="panel_group_notices"
@@ -205,24 +170,12 @@ background_visible="true"
          name="group_notices_tab_panel"
          top="0"
          width="303" />
-         </scroll_container>
          </accordion_tab>
         <accordion_tab
                  expanded="false"
                  layout="topleft"
                  name="group_land_tab"
                  title="Land/Assets">
-           <scroll_container
-                  color="DkGray2"
-                  opaque="true"
-                  height="323"
-                  follows="all"
-                  layout="topleft"
-                  left="0"
-                  top="0"
-                  name="land_scroll"
-                  reserve_scroll_corner="false"
-                  width="333">
         <panel
         border="false"
          class="panel_group_land_money"
@@ -232,8 +185,7 @@ background_visible="true"
          help_topic="group_land_money_tab"
          name="group_land_tab_panel"
          top="0"
-         width="313" />
-         </scroll_container>
+         width="300" />
          </accordion_tab>
          </accordion>
    <button
diff --git a/indra/newview/skins/default/xui/en/panel_group_land_money.xml b/indra/newview/skins/default/xui/en/panel_group_land_money.xml
index 0c6f81f8fd892ea9f8681e4638237822b5caafbf..2c649642c331f3e200b5846003d0abb6ee1bc0a3 100644
--- a/indra/newview/skins/default/xui/en/panel_group_land_money.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_land_money.xml
@@ -5,10 +5,10 @@
  height="510"
  label="Land &amp; L$"
  layout="topleft"
- left="1"
+ left="0"
  name="land_money_tab"
  top="0"
- width="313">
+ width="310">
     <panel.string
      name="help_text">
         Parcels owned by a group are listed along with contribution details. A warning appears until the Total Land in Use is less than or = to the Total Contribution.
@@ -47,10 +47,10 @@
      heading_height="20"
      height="150"
      layout="topleft"
-     left="0"
+     left="2"
      name="group_parcel_list"
      top_pad="0"
-     width="313">
+     width="305">
         <scroll_list.columns
          label="Parcel"
          name="name"
@@ -79,7 +79,7 @@
      label_selected="Map"
      layout="topleft"
      name="map_button"
-     right="-10"
+     right="-5"
      top_pad="5"
      width="95"
      enabled="false" />
@@ -185,7 +185,9 @@
      layout="topleft"
      left_pad="3"
      name="your_contribution_units"
-     top_delta="2">
+     top_delta="2"
+     width="40"
+      >
         m²
     </text>
      <text
@@ -210,17 +212,17 @@
      visible="false"
      width="16" />
     <text
-      follows="left|top"
+     follows="left|top"
      type="string"
      word_wrap="true"
      font="SansSerifSmall"
      height="35"
      layout="topleft"
-     left_pad="0"
+     left_pad="5"
      name="group_over_limit_text"
      text_color="EmphasisColor"
      top_delta="0"
-     width="290">
+     width="260">
         Group members must contribute more land credits to support land in use
     </text>
     <text
@@ -241,7 +243,7 @@
      height="200"
      halign="center"
      layout="topleft"
-     left="10"
+     left="5"
      name="group_money_tab_container"
      tab_position="top"
      tab_height="20"
@@ -268,7 +270,7 @@
              left="0"
              max_length="4096"
              name="group_money_planning_text"
-             top="0"
+             top="2"
              width="300"
              word_wrap="true">
                 Loading...
@@ -293,7 +295,7 @@
              left="0"
              max_length="4096"
              name="group_money_details_text"
-             top="0"
+             top="2"
              width="300"
              word_wrap="true">
                 Loading...
@@ -305,8 +307,8 @@
 	     layout="topleft"
 	     name="earlier_details_button"
 	     tool_tip="Back"
-	     top_pad="3"
-             right="-35"
+	     top_pad="5"
+             right="-45"
 	     width="31" />
              <button
 	     follows="left|top"
@@ -327,7 +329,7 @@
          left_delta="0"
          help_topic="group_money_sales_tab"
          name="group_money_sales_tab"
-         top_delta="-1"
+         top="5"
          width="300">
             <text_editor
              type="string"
@@ -337,7 +339,7 @@
              left="0"
              max_length="4096"
              name="group_money_sales_text"
-             top="0"
+             top="2"
              width="300"
              word_wrap="true">
                 Loading...
@@ -349,8 +351,8 @@
 	     layout="topleft"
 	     name="earlier_sales_button"
 	     tool_tip="Back"
-	     top_pad="3"
-             right="-35"
+	     top_pad="5"
+         right="-45"
 	     width="31" />
              <button
 	     follows="left|top"
@@ -358,7 +360,7 @@
 	     image_overlay="Arrow_Right_Off"
 	     layout="topleft"
 	     left_pad="10"
-             name="later_sales_button"
+         name="later_sales_button"
 	     tool_tip="Next"
 	     width="31" />
         </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_group_notices.xml b/indra/newview/skins/default/xui/en/panel_group_notices.xml
index 24a4005a4595c256e6bc54678076e7648cd92372..e56db6414f91efca6e46928a9f8b8ede51f74469 100644
--- a/indra/newview/skins/default/xui/en/panel_group_notices.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_notices.xml
@@ -7,7 +7,7 @@
  left="0"
  name="notices_tab"
  top="0"
- width="313">
+ width="310">
     <panel.string
      name="help_text">
         Notices are a quick way to communicate across a 
@@ -27,7 +27,7 @@ the General tab.
      word_wrap="true"
      height="30"
      layout="topleft"
-     left="10"
+     left="5"
      name="lbl2"
      top="5"
      width="300">
@@ -41,10 +41,10 @@ Groups are limited to 200 notices/group daily
      heading_height="16"
      height="125"
      layout="topleft"
-     left="0"
+     left="2"
      name="notice_list"
      top_pad="0"
-     width="303">
+     width="305">
         <scroll_list.columns
          label=""
          name="icon"
@@ -81,10 +81,10 @@ Groups are limited to 200 notices/group daily
        image_disabled="AddItem_Disabled"
        layout="topleft"
        label="Create a new notice"
-       left="15"
+       left="5"
        name="create_new_notice"
        tool_tip="Create a new notice"
-     top_delta="-5"
+     top_delta="0"
        width="18" />
      <button
      follows="top|left"
@@ -93,7 +93,7 @@ Groups are limited to 200 notices/group daily
      layout="topleft"
      name="refresh_notices"
      right="-5"
-     top_delta="5"
+     top_delta="0"
      width="23" />
     <panel
      follows="left|top"
@@ -219,7 +219,7 @@ Groups are limited to 200 notices/group daily
          label_selected="Send Notice"
          layout="topleft"
          right="-10"
-         top_pad="20"
+         top_pad="10"
          name="send_notice"
          width="100" />
       <group_drop_target
diff --git a/indra/newview/skins/default/xui/en/panel_group_notify.xml b/indra/newview/skins/default/xui/en/panel_group_notify.xml
index bd98996ae13718963d0da6787bb41f0c944f41d0..ef3120174e8cb3337ff91ac1366f13df3c75b6b9 100644
--- a/indra/newview/skins/default/xui/en/panel_group_notify.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_notify.xml
@@ -25,7 +25,7 @@
      name="subject"
      text_color="GroupNotifyTextColor"
      font="SansSerifBig"
-     top="60"
+     top="40"
      use_ellipses="true"
      value="subject"
      width="300"
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 4129d7b44881e35e27a8c762a44c8da06151edca..604fb81c8e740685f0dfb2bd46e00961318fca9c 100644
--- a/indra/newview/skins/default/xui/en/panel_group_roles.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_roles.xml
@@ -7,7 +7,7 @@
  left="0"
  top="0"
  name="roles_tab"
- width="313">
+ width="310">
     <panel.string
      name="default_needs_apply_text">
         There are unsaved changes to the current tab
@@ -28,9 +28,9 @@
      name="roles_tab_container"
      tab_position="top"
      tab_height="20"
-     tab_min_width="96"
+     tab_min_width="75"
      top="3"
-     width="303">
+     width="300">
         <panel
          border="false"
          height="220"
@@ -51,23 +51,13 @@ clicking on their names.
          <filter_editor
          layout="topleft"
          top="10"
-         left="4"
+         left="5"
          width="280"
          height="20"
          follows="left|top|right"
          max_length="250"
          label="Filter Members"
          name="filter_input" />
-          <!--  <button
-             enabled="false"
-             font="SansSerifSmall"
-             height="20"
-             label="Show All"
-             layout="topleft"
-             left_pad="-90"
-             name="show_all_button"
-             top_delta="-6"
-             width="80" />-->
             <name_list
              column_padding="0"
              draw_heading="true"
@@ -111,14 +101,6 @@ clicking on their names.
              right="-5"
              name="member_eject"
              width="100" />
-             <!--What is this?-->
-            <icon
-             height="16"
-             image_name="Inv_FolderClosed"
-             layout="topleft"
-             name="power_folder_icon"
-             visible="false"
-             width="16" />
         </panel>
         <panel
          border="false"
@@ -156,7 +138,7 @@ including the Everyone and Owner Roles.
          <filter_editor
          layout="topleft"
          top="10"
-         left="4"
+         left="5"
          width="280"
          height="20"
          follows="left|top|right"
@@ -179,12 +161,12 @@ including the Everyone and Owner Roles.
              draw_stripes="false"
              follows="left|top"
              heading_height="20"
-             height="150"
+             height="160"
              layout="topleft"
              search_column="1"
              left="0"
              name="role_list"
-             top_pad="4"
+             top_pad="2"
              width="300">
                 <scroll_list.columns
                  label="Role"
@@ -238,24 +220,13 @@ things in this group. There&apos;s a broad variety of Abilities.
          <filter_editor
          layout="topleft"
          top="10"
-         left="4"
+         left="5"
          width="280"
          height="20"
          follows="left|top|right"
          max_length="250"
          label="Filter Abilities"
          name="filter_input" />
-            <!--
-            <button
-             enabled="false"
-             font="SansSerifSmall"
-             height="20"
-             label="Show All"
-             layout="topleft"
-             left_pad="0"
-             name="show_all_button"
-             top_delta="0"
-             width="80" /> -->
             <scroll_list
              column_padding="0"
              draw_stripes="false"
@@ -267,14 +238,14 @@ things in this group. There&apos;s a broad variety of Abilities.
              name="action_list"
              search_column="1"
              tool_tip="Select an Ability to view more details"
-             top_pad="6"
+             top_pad="2"
              width="300">
                 <scroll_list.columns
                  label=""
                  name="icon"
                  width="16" />
                 <scroll_list.columns
-                 label=""
+                 label="Action"
                  name="action"
                  width="247" />
             </scroll_list>
@@ -293,9 +264,9 @@ things in this group. There&apos;s a broad variety of Abilities.
      follows="left|top"
      left="10"
      name="members_footer"
-     top_pad="10"
+     top="245"
      top_delta="0"
-     width="300">
+     width="290">
         <text
          type="string"
          height="16"
@@ -304,7 +275,7 @@ things in this group. There&apos;s a broad variety of Abilities.
          left="0"
          name="static"
          top_pad="5"
-         width="295">
+         width="285">
             Assigned Roles
         </text>
         <scroll_list
@@ -315,7 +286,7 @@ things in this group. There&apos;s a broad variety of Abilities.
          left="0"
          name="member_assigned_roles"
          top_pad="0"
-         width="295">
+         width="285">
             <scroll_list.columns
              label=""
              name="checkbox"
@@ -323,7 +294,7 @@ things in this group. There&apos;s a broad variety of Abilities.
             <scroll_list.columns
              label=""
              name="role"
-             width="265" />
+             width="255" />
         </scroll_list>
                  <text
          type="string"
@@ -333,7 +304,7 @@ things in this group. There&apos;s a broad variety of Abilities.
          left="0"
          name="static2"
          top_pad="5"
-         width="295">
+         width="285">
             Allowed Abilities
         </text>
          <scroll_list
@@ -345,7 +316,7 @@ things in this group. There&apos;s a broad variety of Abilities.
          search_column="2"
          tool_tip="For details of each allowed ability see the abilities tab"
          top_pad="0"
-         width="295">
+         width="285">
             <scroll_list.columns
              label=""
              name="icon"
@@ -353,7 +324,7 @@ things in this group. There&apos;s a broad variety of Abilities.
             <scroll_list.columns
              label=""
              name="action"
-             width="275" />
+             width="265" />
         </scroll_list>
     </panel>
     <panel
@@ -364,7 +335,7 @@ things in this group. There&apos;s a broad variety of Abilities.
      top_delta="0"
      top="245"
      visible="false"
-     width="300">
+     width="290">
         <text
          type="string"
          height="16"
@@ -386,7 +357,7 @@ things in this group. There&apos;s a broad variety of Abilities.
          max_length="295"
          name="role_name"
          top_pad="0"
-         width="295">
+         width="290">
             Employees
         </line_editor>
         <text
@@ -395,7 +366,7 @@ things in this group. There&apos;s a broad variety of Abilities.
          layout="topleft"
          name="static3"
          top_pad="5"
-         width="295">
+         width="290">
             Title
         </text>
         <line_editor
@@ -408,7 +379,7 @@ things in this group. There&apos;s a broad variety of Abilities.
          max_length="295"
          name="role_title"
          top_pad="0"
-         width="295">
+         width="290">
           (waiting)
         </line_editor>
                 <text
@@ -442,7 +413,7 @@ things in this group. There&apos;s a broad variety of Abilities.
          left="0"
          name="static4"
          top_pad="5"
-         width="295">
+         width="290">
             Assigned Roles
         </text>
         <name_list
@@ -452,7 +423,7 @@ things in this group. There&apos;s a broad variety of Abilities.
          left="0"
          name="role_assigned_members"
          top_pad="0"
-         width="295" />
+         width="290" />
         <check_box
          height="15"
          label="Reveal members"
@@ -469,7 +440,7 @@ things in this group. There&apos;s a broad variety of Abilities.
          left="0"
          name="static5"
          top_pad="5"
-         width="295">
+         width="290">
             Allowed Abilities
         </text>
         <scroll_list
@@ -504,7 +475,7 @@ things in this group. There&apos;s a broad variety of Abilities.
      top_delta="0"
      top="245"
      visible="false"
-     width="300">
+     width="290">
         <text
          type="string"
          height="16"
@@ -550,7 +521,7 @@ things in this group. There&apos;s a broad variety of Abilities.
          layout="topleft"
          name="static3"
          top_pad="5"
-         width="295">
+         width="290">
             Members with this ability
         </text>
         <name_list
@@ -558,6 +529,6 @@ things in this group. There&apos;s a broad variety of Abilities.
          layout="topleft"
          name="action_members"
          top_pad="0"
-         width="295" />
+         width="290" />
     </panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml b/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml
index 7128c200380d8385100370f6dc2dd7aa86428e5d..a77094e9420613c82153a43d598c04e1264286dd 100644
--- a/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml
@@ -9,7 +9,7 @@
  top="21"
  width="310">
     <string name="min_width">
-        310
+        192
     </string>
     <string name="max_width">
         320
@@ -27,7 +27,7 @@
      name="chat_box"
      tool_tip="Press Enter to say, Ctrl+Enter to shout"
      top="0"
-     width="250" />
+     width="279" />
     <output_monitor
      auto_update="true"
      follows="right"
@@ -43,11 +43,13 @@
     <button
      follows="right"
      is_toggle="true"
-     width="45"
+     width="20"
      top="0"
      layout="topleft"
-     left_pad="8"
-     label="Log"
+     left_pad="4           "
+     image_disabled="ComboButton_UpOff"
+     image_unselected="ComboButton_UpOff"
+     image_selected="ComboButton_UpSelected"
      height="23"
      name="show_nearby_chat"
      tool_tip="Shows/hides nearby chat log">
diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml
index 15fdd73bdc14bc2b260701706db04b971a4ec10a..9fac7d34f75f6b2ca260ccef711f9b0039cc9239 100644
--- a/indra/newview/skins/default/xui/en/panel_people.xml
+++ b/indra/newview/skins/default/xui/en/panel_people.xml
@@ -16,7 +16,7 @@ background_visible="true"
      value="No people" />
     <string
      name="no_one_near"
-     value="No-one near" />
+     value="No one near" />
     <string
      name="no_friends_online"
      value="No friends online" />
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
index 06f0710406538cd434ab7569fa0a763e5a8846ba..0ac0521b10c4d9fe071f82d6e94bb174e9c4e46f 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
@@ -284,7 +284,7 @@ Avatars:
      enabled_control="EnableVoiceChat"
      control_name="PushToTalkToggle"
      height="20"
-     label="Toggle mode for microphone when I press the Speak trigger key:"
+     label="Toggle mode for microphone when I press the speak trigger key:"
      layout="topleft"
      left="30"
      name="push_to_talk_toggle_check"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
index 645863e7a4ac804e53f4097eade5f44950ee4430..5a4b0a3892d2f387eca5570209dd999b99546c48 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
@@ -45,14 +45,20 @@
     <color_swatch
      border_color="0.45098 0.517647 0.607843 1"
      can_apply_immediately="true"
-     control_name="UserChatColor"
      follows="left|top"
      height="47"
      layout="topleft"
      left="30"
      name="user"
      top_pad="10"
-     width="44" />
+     width="44" >
+		<color_swatch.init_callback
+		 function="Pref.getUIColor"
+		 parameter="UserChatColor" />
+		<color_swatch.commit_callback
+		 function="Pref.applyUIColor"
+		 parameter="UserChatColor" />
+	</color_swatch>
     <text
      type="string"
      length="1"
@@ -69,14 +75,20 @@
     <color_swatch
      border_color="0.45098 0.517647 0.607843 1"
      can_apply_immediately="true"
-     control_name="AgentChatColor"
      follows="left|top"
      height="47"
      layout="topleft"
      left="180"
      name="agent"
      top_pad="-17"
-     width="44" />
+     width="44" >
+		<color_swatch.init_callback
+		 function="Pref.getUIColor"
+		 parameter="AgentChatColor" />
+		<color_swatch.commit_callback
+		 function="Pref.applyUIColor"
+		 parameter="AgentChatColor" />
+	</color_swatch>
     <text
      type="string"
      length="1"
@@ -94,7 +106,6 @@
      border_color="0.45098 0.517647 0.607843 1"
      can_apply_immediately="true"
      color="0.6 0.6 1 1"
-     control_name="IMChatColor"
      follows="left|top"
      height="47"
      label_width="60"
@@ -102,8 +113,15 @@
      left="350"
      name="im"
      top_pad="-17"
-     width="44" />
-        <text
+     width="44">
+		<color_swatch.init_callback
+		 function="Pref.getUIColor"
+		 parameter="IMChatColor" />
+		<color_swatch.commit_callback
+		 function="Pref.applyUIColor"
+		 parameter="IMChatColor" />
+	</color_swatch>
+	<text
      type="string"
      length="1"
      follows="left|top"
@@ -120,7 +138,6 @@
      border_color="0.45098 0.517647 0.607843 1"
      can_apply_immediately="true"
      color="0.8 1 1 1"
-     control_name="SystemChatColor"
      follows="left|top"
      height="47"
      label_width="44"
@@ -128,7 +145,14 @@
      left="30"
      name="system"
      top_pad="40"
-     width="44" />
+     width="44" >
+		<color_swatch.init_callback
+		 function="Pref.getUIColor"
+		 parameter="SystemChatColor" />
+		<color_swatch.commit_callback
+		 function="Pref.applyUIColor"
+		 parameter="SystemChatColor" />
+	</color_swatch>
     <text
      type="string"
      length="1"
@@ -146,14 +170,20 @@
      border_color="0.45098 0.517647 0.607843 1"
      can_apply_immediately="true"
      color="0.82 0.82 0.99 1"
-     control_name="ScriptErrorColor"
      follows="left|top"
      height="47"
      layout="topleft"
      left="180"
      name="script_error"
      top_pad="-17"
-     width="44" />
+     width="44">
+		<color_swatch.init_callback
+		 function="Pref.getUIColor"
+		 parameter="ScriptErrorColor" />
+		<color_swatch.commit_callback
+		 function="Pref.applyUIColor"
+		 parameter="ScriptErrorColor" />
+	</color_swatch>
     <text
      type="string"
      length="1"
@@ -171,14 +201,20 @@
      border_color="0.45098 0.517647 0.607843 1"
      can_apply_immediately="true"
      color="0.7 0.9 0.7 1"
-     control_name="ObjectChatColor"
      follows="left|top"
      height="47"
      layout="topleft"
      left="350"
      name="objects"
      top_pad="-17"
-     width="44" />
+     width="44" >
+		<color_swatch.init_callback
+		 function="Pref.getUIColor"
+		 parameter="ObjectChatColor" />
+		<color_swatch.commit_callback
+		 function="Pref.applyUIColor"
+		 parameter="ObjectChatColor" />
+	</color_swatch>
     <text
      type="string"
      length="1"
@@ -196,14 +232,20 @@
      border_color="0.45098 0.517647 0.607843 1"
      can_apply_immediately="true"
      color="0.7 0.9 0.7 1"
-     control_name="llOwnerSayChatColor"
      follows="left|top"
      height="47"
      layout="topleft"
      left="30"
      name="owner"
      top_pad="40"
-     width="44" />
+     width="44" >
+		<color_swatch.init_callback
+		 function="Pref.getUIColor"
+		 parameter="llOwnerSayChatColor" />
+		<color_swatch.commit_callback
+		 function="Pref.applyUIColor"
+		 parameter="llOwnerSayChatColor" />
+	</color_swatch>
     <text
      type="string"
      length="1"
@@ -221,14 +263,20 @@
      border_color="0.45098 0.517647 0.607843 1"
      can_apply_immediately="true"
      color="0.6 0.6 1 1"
-     control_name="HTMLLinkColor"
      follows="left|top"
      height="47"
      layout="topleft"
      left="180"
      name="links"
      top_pad="-17"
-     width="44" />
+     width="44" >
+		<color_swatch.init_callback
+		 function="Pref.getUIColor"
+		 parameter="HTMLLinkColor" />
+		<color_swatch.commit_callback
+		 function="Pref.applyUIColor"
+		 parameter="HTMLLinkColor" />
+	</color_swatch>
     <text
      type="string"
      length="1"
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 975d21aaa6a16e1424bdfebceee7c2a1e380b0c6..a6ca73d4b7f48735e494dfd8df3332ac3fccbd84 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml
@@ -305,7 +305,7 @@
      name="effects_color_textbox"
      top_pad="5"
      width="400">
-        My Effects:
+        My effects:
     </text>
     <color_swatch
      border_color="0.45098 0.517647 0.607843 1"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
index acf4601bfe5eaf6c2d7c8583193b582e65ff312a..8c22a5e483957c844173a214903b06e15c94858e 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
@@ -208,7 +208,7 @@
     <button
      follows="left|bottom"
      height="20"
-     label="Block List"
+     label="Block list"
      layout="topleft"
      left="30"
      name="block_list"
diff --git a/indra/newview/skins/default/xui/en/panel_side_tray.xml b/indra/newview/skins/default/xui/en/panel_side_tray.xml
index a9874f45530eb20b8a023079ab9fb8ec82d59ab1..a419a02d756c1d7199386caac0f672c71daee7f4 100644
--- a/indra/newview/skins/default/xui/en/panel_side_tray.xml
+++ b/indra/newview/skins/default/xui/en/panel_side_tray.xml
@@ -94,7 +94,7 @@
   <sidetray_tab
     name="sidebar_me"
     help_topic="sidebar_me"
-    tab_title="Me"
+    tab_title="My Profile"
     description="Edit your public profile and Picks."
     image="TabIcon_Me_Off"
     image_selected="TabIcon_Me_Selected"
@@ -112,7 +112,7 @@
   <sidetray_tab
     name="sidebar_appearance"
     help_topic="sidebar_appearance"
-    tab_title="Appearance"
+    tab_title="My Appearance"
     description="Change your appearance and current look."
     image="TabIcon_Appearance_Off"
     image_selected="TabIcon_Appearance_Selected"
@@ -131,7 +131,7 @@
   <sidetray_tab
     name="sidebar_inventory"
     help_topic="sidebar_inventory"
-    tab_title="Inventory"
+    tab_title="My Inventory"
     description="Browse your inventory."
     image="TabIcon_Things_Off"
     image_selected="TabIcon_Things_Selected"
diff --git a/indra/newview/skins/default/xui/en/panel_sidetray_home_tab.xml b/indra/newview/skins/default/xui/en/panel_sidetray_home_tab.xml
index 9636e321870a9edab4944ca0df262dc0ba893e81..566fc95230b3a7cbd52aa00df9b1e64f00f793e8 100644
--- a/indra/newview/skins/default/xui/en/panel_sidetray_home_tab.xml
+++ b/indra/newview/skins/default/xui/en/panel_sidetray_home_tab.xml
@@ -227,7 +227,7 @@
          right="-10"
          top="10"
          width="20"
-         image_name="TabIcon_Inventory_Selected"/>
+         image_name="TabIcon_Things_Selected"/>
         <text
          follows="all"
          height="90"
diff --git a/indra/newview/skins/default/xui/en/panel_stand_stop_flying.xml b/indra/newview/skins/default/xui/en/panel_stand_stop_flying.xml
index c8703aa895ac3be7e1a1458be6084a1a09f56fb5..b48943c6994fb6e17979c3bd72bb8d0130955fff 100644
--- a/indra/newview/skins/default/xui/en/panel_stand_stop_flying.xml
+++ b/indra/newview/skins/default/xui/en/panel_stand_stop_flying.xml
@@ -5,7 +5,7 @@
  layout="topleft"
  name="panel_stand_stop_flying"
  mouse_opaque="false"
- visible="false"
+ visible="true"
  width="115">
     <button
      follows="left|bottom"
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 7b9c9f47a2fe1a7463139adc05e4fa71629a741d..1171a8f0b5d8a20ae6630a11778e873c3d706d83 100644
--- a/indra/newview/skins/default/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml
@@ -3,7 +3,7 @@
  background_opaque="true"
  background_visible="true"
  bg_opaque_color="MouseGray"
- follows="top|left|right"
+ follows="all"
  height="19"
  layout="topleft"
  left="0"
diff --git a/indra/newview/skins/default/xui/en/panel_toast.xml b/indra/newview/skins/default/xui/en/panel_toast.xml
index 7f7777586c21459c5de986ac9844f8297c7101c5..f16329f8d78a174fb58468abe9a3e798340e6937 100644
--- a/indra/newview/skins/default/xui/en/panel_toast.xml
+++ b/indra/newview/skins/default/xui/en/panel_toast.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <!-- All our XML is utf-8 encoded. -->
 
-<!-- All this does is establish the position of the "close" button on the toast. -->
+<!-- Don't remove floater's height! It is needed for Overflow and Start-Up toasts!-->
 
 <floater
  legacy_header_height="18"
@@ -9,6 +9,7 @@
 	title=""
   visible="false"
   layout="topleft"
+  height="40" 
 	width="305"
   left="0"
   top="0"
@@ -26,36 +27,21 @@
   drop_shadow_visible = "false"
   border = "false"
   >
-
-  <!--
+  <!-- Don't remove this wiget! It is needed for Overflow and Start-Up toasts!-->
   <text
    visible="false"
    follows="left|top|right|bottom"
    font="SansSerifBold"
-   height="40"
+   height="20"
    layout="topleft"
-   left="60"
+   left="20"
    name="toast_text"
    word_wrap="true"
    text_color="white"
-   top="20"
-   width="290">
+   top="5" 
+   width="260">
     Toast text;
   </text>
-  <icon
-    top="20"
-    left="10"
-    width="32"
-    height="32"
-    follows="top|left"
-    layout="topleft"
-    visible="false"
-    color="1 1 1 1"
-    enabled="true"
-    image_name="notify_tip_icon.tga"
-    mouse_opaque="true"
-    name="icon"
-  />-->
   <button
     layout="topleft"
     top="-6"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index c850dce141947d07008d4fc24c75be8d0e7fbd5b..ea66bfa197fbfa14bb0a338fa5088fbef93ca991 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2850,7 +2850,6 @@ 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="ringing-im">
     Joining Voice Chat...
   </string>
@@ -2863,6 +2862,9 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
   <string name="answering-im">
     Connecting...
   </string>
+  <string name="conference-title">
+    Friends Conference
+  </string>
   <string name="inventory_item_offered-im">
     Inventory item offered
   </string>
diff --git a/indra/newview/skins/default/xui/en/widgets/context_menu.xml b/indra/newview/skins/default/xui/en/widgets/context_menu.xml
new file mode 100644
index 0000000000000000000000000000000000000000..459706c689c940d100852fe1c81fcada91b628a1
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/widgets/context_menu.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<context_menu visible="false"/>
diff --git a/indra/newview/skins/default/xui/en/widgets/inspector.xml b/indra/newview/skins/default/xui/en/widgets/inspector.xml
new file mode 100644
index 0000000000000000000000000000000000000000..61950d7554e092e2f35069eb076a3ba93eb38a7f
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/widgets/inspector.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<!-- See also settings.xml UIFloater* settings for configuration -->
+<inspector name="inspector"
+          bg_opaque_color="ToolTipBgColor"
+          background_visible="true"
+          bg_opaque_image="none"
+          bg_alpha_image="none"
+ />
diff --git a/indra/newview/skins/default/xui/en/widgets/scroll_column_header.xml b/indra/newview/skins/default/xui/en/widgets/scroll_column_header.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0794b49a0c63967a7360be806cd5b5f7af5a5f2c
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/widgets/scroll_column_header.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<scroll_column_header image_unselected="square_btn_32x128.tga"
+                      image_selected="square_btn_selected_32x128.tga"
+                      image_disabled="square_btn_32x128.tga"
+                      image_disabled_selected="square_btn_selected_32x128.tga"
+                      image_overlay="combobox_arrow.tga"
+                      image_overlay_alignment="right"
+                      halign="left"
+                      scale_image="true"/>
diff --git a/indra/newview/skins/default/xui/en/widgets/side_tray.xml b/indra/newview/skins/default/xui/en/widgets/side_tray.xml
index 8b4a5afbe9564e31e3622dd481872461d05033ca..022564c12fcee20dc04b7d23d71fcfa01a46dec9 100644
--- a/indra/newview/skins/default/xui/en/widgets/side_tray.xml
+++ b/indra/newview/skins/default/xui/en/widgets/side_tray.xml
@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <side_tray tab_btn_image="TaskPanel_Tab_Off"
-        tab_btn_image_selected="TaskPanel_Tab_Selected"
-		tab_btn_width="32"
-		tab_btn_height="40"
-		tab_btn_margin="1"
-        >
+           tab_btn_image_selected="TaskPanel_Tab_Selected"
+           tab_btn_width="32"
+           tab_btn_height="40"
+           tab_btn_margin="1">
 </side_tray>
diff --git a/indra/newview/skins/default/xui/en/widgets/toggleable_menu.xml b/indra/newview/skins/default/xui/en/widgets/toggleable_menu.xml
new file mode 100644
index 0000000000000000000000000000000000000000..48950a98ad547f59d7d83a2396438e0f414d8894
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/widgets/toggleable_menu.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<toggleable_menu visible="false"/>
diff --git a/indra/newview/skins/default/xui/en/widgets/ui_ctrl.xml b/indra/newview/skins/default/xui/en/widgets/ui_ctrl.xml
new file mode 100644
index 0000000000000000000000000000000000000000..2f72ad65a1513bdd53d9d735788e705bd3eb373a
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/widgets/ui_ctrl.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<!-- Global settings for all widgets ("UI Controls") -->
+<ui_ctrl
+  font="SansSerif"
+  /> 
diff --git a/indra/newview/tests/llmediadataclient_test.cpp b/indra/newview/tests/llmediadataclient_test.cpp
index 445ec7aa344cd13f1f1903a8ed3bf262dea9f969..3ac631d96e3213a9df2b0051365f7d015f115e97 100644
--- a/indra/newview/tests/llmediadataclient_test.cpp
+++ b/indra/newview/tests/llmediadataclient_test.cpp
@@ -497,5 +497,38 @@ namespace tut
 		ensure("REF COUNT", o->getNumRefs(), 1);
     }
 
-	
+	template<> template<>
+    void mediadataclient_object_t::test<7>()
+    {
+		// Test LLMediaDataClient::isInQueue()
+		LOG_TEST(7);
+		
+		LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(
+			_DATA(VALID_OBJECT_ID_1,"3.0","1.0"));
+		LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(
+			_DATA(VALID_OBJECT_ID_2,"1.0","1.0"));
+		int num_refs_start = o1->getNumRefs();
+		{
+			LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD);
+			
+			ensure("not in queue yet 1", ! mdc->isInQueue(o1));
+			ensure("not in queue yet 2", ! mdc->isInQueue(o2));
+			
+			mdc->fetchMedia(o1);
+			
+			ensure("is in queue", mdc->isInQueue(o1));
+			ensure("is not in queue", ! mdc->isInQueue(o2));
+			
+			::pump_timers();
+			
+			ensure("not in queue anymore", ! mdc->isInQueue(o1));
+			ensure("still is not in queue", ! mdc->isInQueue(o2));
+			
+			ensure("queue empty", mdc->isEmpty());
+		}
+		
+		// Make sure everyone's destroyed properly
+		ensure("REF COUNT", o1->getNumRefs(), num_refs_start);
+		
+	}
 }
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index b85d31d1ac6563ce26a12340afd982688fea8a39..7e5c30a97897b115b84a6ba3b15ea4ef7c39642d 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -231,8 +231,21 @@ def construct(self):
                                'llplugin', 'slplugin', self.args['configuration'], "slplugin.exe"),
                   "slplugin.exe")
         
-        # need to get the llcommon.dll from the build directory as well
-        if self.prefix(src=self.args['configuration'], dst=""):
+        self.disable_manifest_check()
+
+        # Get shared libs from the shared libs staging directory
+        if self.prefix(src=os.path.join(os.pardir, 'sharedlibs', self.args['configuration']),
+                       dst=""):
+
+            self.enable_crt_manifest_check()
+            
+            # Get kdu dll, continue if missing.
+            try:
+                self.path('%s/llkdu.dll' % self.args['configuration'], dst='llkdu.dll')
+            except RuntimeError:
+                print "Skipping llkdu.dll"
+
+            # Get llcommon and deps. If missing assume static linkage and continue.
             try:
                 self.path('llcommon.dll')
                 self.path('libapr-1.dll')
@@ -242,22 +255,41 @@ def construct(self):
                 print err.message
                 print "Skipping llcommon.dll (assuming llcommon was linked statically)"
 
-            self.end_prefix()
+            self.disable_manifest_check()
 
-        # need to get the kdu dll from the build directory as well
-        try:
-            self.path('%s/llkdu.dll' % self.args['configuration'], dst='llkdu.dll')
-        except RuntimeError:
-            print "Skipping llkdu.dll"
-
-        self.disable_manifest_check()
-
-        # For textures
-        if self.prefix(src=self.args['configuration'], dst=""):
-            if(self.args['configuration'].lower() == 'debug'):
+            # For textures
+            if self.args['configuration'].lower() == 'debug':
                 self.path("openjpegd.dll")
             else:
                 self.path("openjpeg.dll")
+
+            # These need to be installed as a SxS assembly, currently a 'private' assembly.
+            # See http://msdn.microsoft.com/en-us/library/ms235291(VS.80).aspx
+            if self.args['configuration'].lower() == 'debug':
+                self.path("msvcr80d.dll")
+                self.path("msvcp80d.dll")
+                self.path("Microsoft.VC80.DebugCRT.manifest")
+            else:
+                self.path("msvcr80.dll")
+                self.path("msvcp80.dll")
+                self.path("Microsoft.VC80.CRT.manifest")
+
+            # Vivox runtimes
+            self.path("SLVoice.exe")
+            self.path("alut.dll")
+            self.path("vivoxsdk.dll")
+            self.path("ortp.dll")
+            self.path("wrap_oal.dll")
+
+            # For google-perftools tcmalloc allocator.
+            try:
+                if self.args['configuration'].lower() == 'debug':
+                    self.path('libtcmalloc_minimal-debug.dll')
+                else:
+                    self.path('libtcmalloc_minimal.dll')
+            except:
+                print "Skipping libtcmalloc_minimal.dll"
+
             self.end_prefix()
 
         self.path(src="licenses-win32.txt", dst="licenses.txt")
@@ -270,6 +302,7 @@ def construct(self):
         self.path("fmod.dll")
 
         self.enable_no_crt_manifest_check()
+        
         # Media plugins - QuickTime
         if self.prefix(src='../media_plugins/quicktime/%s' % self.args['configuration'], dst="llplugin"):
             self.path("media_plugin_quicktime.dll")
@@ -302,28 +335,6 @@ def construct(self):
 
         self.disable_manifest_check()
 
-        # These need to be installed as a SxS assembly, currently a 'private' assembly.
-        # See http://msdn.microsoft.com/en-us/library/ms235291(VS.80).aspx
-        if self.prefix(src=self.args['configuration'], dst=""):
-            if self.args['configuration'] == 'Debug':
-                self.path("msvcr80d.dll")
-                self.path("msvcp80d.dll")
-                self.path("Microsoft.VC80.DebugCRT.manifest")
-            else:
-                self.path("msvcr80.dll")
-                self.path("msvcp80.dll")
-                self.path("Microsoft.VC80.CRT.manifest")
-            self.end_prefix()
-
-        # Vivox runtimes
-        if self.prefix(src=self.args['configuration'], dst=""):
-            self.path("SLVoice.exe")
-            self.path("alut.dll")
-            self.path("vivoxsdk.dll")
-            self.path("ortp.dll")
-            self.path("wrap_oal.dll")
-            self.end_prefix()
-
         # pull in the crash logger and updater from other projects
         # tag:"crash-logger" here as a cue to the exporter
         self.path(src='../win_crash_logger/%s/windows-crash-logger.exe' % self.args['configuration'],
@@ -331,17 +342,6 @@ def construct(self):
         self.path(src='../win_updater/%s/windows-updater.exe' % self.args['configuration'],
                   dst="updater.exe")
 
-        # For google-perftools tcmalloc allocator.
-        if self.prefix(src=self.args['configuration'], dst=""):
-            try:
-                if self.args['configuration'] == 'Debug':
-                    self.path('libtcmalloc_minimal-debug.dll')
-                else:
-                    self.path('libtcmalloc_minimal.dll')
-            except:
-                print "Skipping libtcmalloc_minimal.dll"
-            self.end_prefix()
-
     def nsi_file_commands(self, install=True):
         def wpath(path):
             if path.endswith('/') or path.endswith(os.path.sep):
diff --git a/indra/test_apps/llplugintest/CMakeLists.txt b/indra/test_apps/llplugintest/CMakeLists.txt
index 53b981cccdebf88cea6d1c09e5daa42c7e94dd30..0011daaec6e9b36f36e579690000cb5364d6bd05 100644
--- a/indra/test_apps/llplugintest/CMakeLists.txt
+++ b/indra/test_apps/llplugintest/CMakeLists.txt
@@ -7,6 +7,7 @@ include(FindOpenGL)
 include(LLCommon)
 include(LLPlugin)
 include(Linking)
+include(LLSharedLibs)
 include(PluginAPI)
 include(LLImage)
 include(LLMath)
@@ -324,27 +325,7 @@ if (DARWIN)
       make_directory
       ${PLUGINS_DESTINATION_DIR}
     COMMENT "Creating Resources directory in app bundle."
-  )
-
-  # copy the llcommon dylib and its dependencies to Contents/Resources.
-  get_target_property(BUILT_LLCOMMON llcommon LOCATION)
-  add_custom_command(TARGET llmediaplugintest POST_BUILD
-    COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_LLCOMMON}  ${PLUGINS_DESTINATION_DIR}
-    DEPENDS ${BUILT_LLCOMMON}
-  )
-  # FIXME: these paths should come from somewhere reliable.  The canonical list seems to be in indra/newview/viewer_manifest.py
-  add_custom_command(TARGET llmediaplugintest POST_BUILD
-    COMMAND ${CMAKE_COMMAND} -E copy ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.0.3.7.dylib  ${PLUGINS_DESTINATION_DIR}
-    DEPENDS ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.0.3.7.dylib
-  )
-  add_custom_command(TARGET llmediaplugintest POST_BUILD
-    COMMAND ${CMAKE_COMMAND} -E copy ${ARCH_PREBUILT_DIRS_RELEASE}/libaprutil-1.0.3.8.dylib  ${PLUGINS_DESTINATION_DIR}
-    DEPENDS ${ARCH_PREBUILT_DIRS_RELEASE}/libaprutil-1.0.3.8.dylib
-  )
-  add_custom_command(TARGET llmediaplugintest POST_BUILD
-    COMMAND ${CMAKE_COMMAND} -E copy ${ARCH_PREBUILT_DIRS_RELEASE}/libexpat.0.5.0.dylib  ${PLUGINS_DESTINATION_DIR}
-    DEPENDS ${ARCH_PREBUILT_DIRS_RELEASE}/libexpat.0.5.0.dylib
-  )
+  ) 
 else (DARWIN)
   set(PLUGINS_DESTINATION_DIR
     ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
@@ -497,22 +478,14 @@ if(WINDOWS)
     ${plugintest_release_files}
     )
   set(plugin_test_targets ${plugin_test_targets} ${out_targets})
-
-  copy_if_different(
-    "${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}"
-    "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
-    out_targets
-    llcommon.dll libapr-1.dll libaprutil-1.dll libapriconv-1.dll
-    )
-  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
-
-  add_custom_target(copy_plugintest_libs ALL
-    DEPENDS 
-      ${plugin_test_targets}
-      llcommon
-    )
+ 
+   add_custom_target(copy_plugintest_libs ALL
+     DEPENDS 
+     ${plugin_test_targets}
+     )
 
   add_dependencies(llmediaplugintest copy_plugintest_libs)
 
 endif(WINDOWS)
 
+ll_deploy_sharedlibs_command(llmediaplugintest) 
diff --git a/indra/win_crash_logger/CMakeLists.txt b/indra/win_crash_logger/CMakeLists.txt
index 0bd59f09908e981e6e12195e17a9cdf546e096a1..990dc6783ee1d8663d0a522fc03934d9ac661ddd 100644
--- a/indra/win_crash_logger/CMakeLists.txt
+++ b/indra/win_crash_logger/CMakeLists.txt
@@ -11,6 +11,7 @@ include(LLVFS)
 include(LLWindow)
 include(LLXML)
 include(Linking)
+include(LLSharedLibs)
 
 include_directories(
     ${LLCOMMON_INCLUDE_DIRS}
@@ -87,3 +88,5 @@ if (WINDOWS)
         LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\""
         )
 endif (WINDOWS)
+
+ll_deploy_sharedlibs_command(windows-crash-logger)
\ No newline at end of file
diff --git a/indra/win_updater/CMakeLists.txt b/indra/win_updater/CMakeLists.txt
index dedb7cfcc72ef1dd10cbf264657a0158fe214ba1..82347adf201bf786ad30ec8c399bb60a2732c430 100644
--- a/indra/win_updater/CMakeLists.txt
+++ b/indra/win_updater/CMakeLists.txt
@@ -33,3 +33,6 @@ set_target_properties(windows-updater
     LINK_FLAGS "/NODEFAULTLIB:LIBCMT"
     LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\""
     )
+
+# The windows-updater doesn't link against anything non-system, apparently
+#ll_deploy_sharedlibs_command(windows-updater)
\ No newline at end of file
diff --git a/install.xml b/install.xml
index 6d40d6fe4e303fcff21f19c1a9fc5673795c180e..ff9fa805003a2b597b430cce38a8f3fcb6e730da 100644
--- a/install.xml
+++ b/install.xml
@@ -1269,7 +1269,7 @@ anguage Infrstructure (CLI) international standard</string>
       <key>quicktime</key>
       <map>
         <key>copyright</key>
-        <string>Copyright (C) 1990-2006 by Apple Computer, Inc., all rights reserved.</string>
+        <string>Copyright (C) 1990-2007 by Apple Computer, Inc., all rights reserved.</string>
         <key>description</key>
         <string>Separate download. Used to play in-world video clips on a prim. </string>
         <key>license</key>
@@ -1279,9 +1279,9 @@ anguage Infrstructure (CLI) international standard</string>
           <key>windows</key>
           <map>
             <key>md5sum</key>
-            <string>7a2e6fc89b1ef027f3a36ebb46fb0c8a</string>
+            <string>be45825cc14ede53790ac93c58307dcb</string>
             <key>url</key>
-            <uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/quicktime-windows-20080611.tar.bz2</uri>
+            <uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/quicktime-sdk-windows-7.3-20091110.tar.bz2</uri>
           </map>
         </map>
       </map>