merge changes for storm-34

master
Oz Linden 2011-01-07 10:39:05 -05:00
commit e1e38c4cee
474 changed files with 15240 additions and 4707 deletions

View File

@ -40,3 +40,5 @@ dbc206fc61d89ff4cfe15aade0bf0c7bc7fee1c9 2.4.0-start
dc6483491b4af559060bccaef8e9045a303212dd 2.4.0-beta1
dc6483491b4af559060bccaef8e9045a303212dd 2.4.0-beta1
3bc1f50a72e117f4d4ad8d555f0c785ea8cc201e 2.4.0-beta1
25bd6007e3d2fc15db9326ed4b18a24a5969a46a 2.4.0-beta2
1ed382c6a08ba3850b6ce9061bc551ddece0ea07 2.4.0-release

View File

@ -46,9 +46,6 @@ viewer-beta.viewer_channel = "Second Life Beta Viewer"
viewer-beta.login_channel = "Second Life Beta Viewer"
viewer-beta.build_debug_release_separately = true
viewer-beta.build_viewer_update_version_manager = true
# Settings to test new code ticket service
viewer-beta.codeticket_server_url = "http://pdp75.lindenlab.com:8000/codeticket/linden/"
viewer-beta.codeticket_add_context = true
# ========================================
# Viewer Release
@ -212,5 +209,29 @@ viewer-tut-teamcity.email = enus@lindenlab.com
viewer-tut-teamcity.build_server = false
viewer-tut-teamcity.build_server_tests = false
# ========================================
# experience
# ========================================
viewer-experience.public_build = false
viewer-experience.viewer_channel = "Second Life SkyLight Viewer"
viewer-experience.login_channel = "Second Life SkyLight Viewer"
# =================================================================
# asset delivery 2010 projects
# =================================================================
viewer-asset-delivery.viewer_channel = "Second Life Development"
viewer-asset-delivery.login_channel = "Second Life Development"
viewer-asset-delivery.build_viewer_update_version_manager = false
viewer-asset-delivery.email = monty@lindenlab.com
viewer-asset-delivery.build_server = false
viewer-asset-delivery.build_server_tests = false
viewer-asset-delivery-metrics.viewer_channel = "Second Life Development"
viewer-asset-delivery-metrics.login_channel = "Second Life Development"
viewer-asset-delivery-metrics.build_viewer_update_version_manager = false
viewer-asset-delivery-metrics.email = monty@lindenlab.com
viewer-asset-delivery-metrics.build_server = false
viewer-asset-delivery-metrics.build_server_tests = false
# eof

View File

@ -59,10 +59,11 @@ pre_build()
-t $variant \
-G "$cmake_generator" \
configure \
-DGRID:STRING="$viewer_grid" \
-DGRID:STRING="$viewer_grid" \
-DVIEWER_CHANNEL:STRING="$viewer_channel" \
-DVIEWER_LOGIN_CHANNEL:STRING="$login_channel" \
-DINSTALL_PROPRIETARY:BOOL=ON \
-DRELEASE_CRASH_REPORTING:BOOL=ON \
-DLOCALIZESETUP:BOOL=ON \
-DPACKAGE:BOOL=ON \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE
@ -169,13 +170,7 @@ do
mkdir -p "$build_dir"
if pre_build "$variant" "$build_dir" >> "$build_log" 2>&1
then
if $build_link_parallel
then
begin_section BuildParallel
( build "$variant" "$build_dir" > "$build_dir/build.log" 2>&1 ) &
build_processes="$build_processes $!"
end_section BuildParallel
elif $build_coverity
if $build_coverity
then
mkdir -p "$build_dir/cvbuild"
coverity_config=`cygpath --windows "$coverity_dir/config/coverity_config.xml"`
@ -197,7 +192,6 @@ do
begin_section CovAnalyze\
&&\
"$coverity_dir"/bin/cov-analyze\
--cxx\
--security\
--concurrency\
--dir "$coverity_tmpdir"\
@ -208,14 +202,14 @@ do
begin_section CovCommit\
&&\
"$coverity_dir"/bin/cov-commit-defects\
--product "$coverity_product"\
--stream "$coverity_product"\
--dir "$coverity_tmpdir"\
--remote "$coverity_server"\
--host "$coverity_server"\
--strip-path "$coverity_root"\
--target "$branch/$arch"\
--version "$revision"\
--description "$repo: $variant $revision"\
--user admin --password admin\
--user admin --password coverity\
>> "$build_log" 2>&1\
|| record_failure "Coverity Build Failed"
# since any step could have failed, rely on the enclosing block to close any pending sub-blocks
@ -226,6 +220,12 @@ do
then
upload_item log "$build_dir"/cvbuild/build-log.txt text/plain
fi
elif $build_link_parallel
then
begin_section BuildParallel
( build "$variant" "$build_dir" > "$build_dir/build.log" 2>&1 ) &
build_processes="$build_processes $!"
end_section BuildParallel
else
begin_section "Build$variant"
build "$variant" "$build_dir" >> "$build_log" 2>&1

View File

@ -61,19 +61,27 @@ Aimee Trescothick
Alejandro Rosenthal
VWR-1184
Aleric Inglewood
SNOW-240
SNOW-522
SNOW-626
SNOW-756
SNOW-764
VWR-10001
VWR-10579
VWR-10759
VWR-10837
VWR-12691
VWR-12984
VWR-13996
VWR-14426
VWR-24247
VWR-24251
VWR-24252
VWR-24254
VWR-24261
SNOW-84
SNOW-477
SNOW-744
SNOW-766
STORM-163
Ales Beaumont
@ -211,6 +219,8 @@ Catherine Pfeffer
Celierra Darling
VWR-1274
VWR-6975
Cron Stardust
VWR-10579
Cypren Christenson
STORM-417
Dale Glass
@ -354,10 +364,15 @@ JB Kraft
Joghert LeSabre
VWR-64
Jonathan Yap
VWR-17801
STORM-596
STORM-523
STORM-616
STORM-679
STORM-596
STORM-737
STORM-726
STORM-812
VWR-17801
STORM-785
Kage Pixel
VWR-11
Ken March
@ -371,6 +386,9 @@ Khyota Wulluf
VWR-9966
Kitty Barnett
VWR-19699
STORM-288
STORM-799
STORM-800
Kunnis Basiat
VWR-82
VWR-102
@ -583,6 +601,7 @@ Robin Cornelius
STORM-422
VWR-2488
VWR-9557
VWR-10579
VWR-11128
VWR-12533
VWR-12587
@ -606,6 +625,7 @@ Sammy Frederix
VWR-6186
Satomi Ahn
STORM-501
STORM-229
Scrippy Scofield
VWR-3748
Seg Baphomet
@ -730,6 +750,8 @@ Tue Torok
CT-74
Twisted Laws
SNOW-352
STORM-466
STORM-467
Vadim Bigbear
VWR-2681
Vector Hastings
@ -772,10 +794,13 @@ WolfPup Lowenhar
STORM-143
STORM-255
STORM-256
STORM-288
STORM-535
STORM-544
STORM-654
STORM-674
STORM-776
STORM-825
VWR-20741
VWR-20933
Zai Lynch

View File

@ -43,6 +43,7 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llaudio)
add_subdirectory(${LIBS_OPEN_PREFIX}llcharacter)
add_subdirectory(${LIBS_OPEN_PREFIX}llcommon)
add_subdirectory(${LIBS_OPEN_PREFIX}llimage)
add_subdirectory(${LIBS_OPEN_PREFIX}llkdu)
add_subdirectory(${LIBS_OPEN_PREFIX}llimagej2coj)
add_subdirectory(${LIBS_OPEN_PREFIX}llinventory)
add_subdirectory(${LIBS_OPEN_PREFIX}llmath)
@ -53,10 +54,6 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llvfs)
add_subdirectory(${LIBS_OPEN_PREFIX}llwindow)
add_subdirectory(${LIBS_OPEN_PREFIX}llxml)
if (EXISTS ${LIBS_CLOSED_DIR}llkdu)
add_subdirectory(${LIBS_CLOSED_PREFIX}llkdu)
endif (EXISTS ${LIBS_CLOSED_DIR}llkdu)
add_subdirectory(${LIBS_OPEN_PREFIX}lscript)
if (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts)

View File

@ -4,27 +4,28 @@
include(Variables)
# Portable compilation flags.
if (EXISTS ${CMAKE_SOURCE_DIR}/llphysics)
# The release build should only offer to send crash reports if we're
# building from a Linden internal source tree.
set(release_crash_reports 1)
else (EXISTS ${CMAKE_SOURCE_DIR}/llphysics)
set(release_crash_reports 0)
endif (EXISTS ${CMAKE_SOURCE_DIR}/llphysics)
set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DLL_DEBUG=1")
set(CMAKE_CXX_FLAGS_RELEASE
"-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=${release_crash_reports} -DNDEBUG")
"-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -D_SECURE_SCL=0 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
"-DLL_RELEASE=1 -D_SECURE_SCL=0 -DLL_SEND_CRASH_REPORTS=0 -DNDEBUG -DLL_RELEASE_WITH_DEBUG_INFO=1")
"-DLL_RELEASE=1 -D_SECURE_SCL=0 -DNDEBUG -DLL_RELEASE_WITH_DEBUG_INFO=1")
# Configure crash reporting
set(RELEASE_CRASH_REPORTING OFF CACHE BOOL "Enable use of crash reporting in release builds")
set(NON_RELEASE_CRASH_REPORTING OFF CACHE BOOL "Enable use of crash reporting in developer builds")
if(RELEASE_CRASH_REPORTING)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DLL_SEND_CRASH_REPORTS=1")
endif()
if(NON_RELEASE_CRASH_REPORTING)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DLL_SEND_CRASH_REPORTS=1")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DLL_SEND_CRASH_REPORTS=1")
endif()
# Don't bother with a MinSizeRel build.
set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release;Debug" CACHE STRING
"Supported build types." FORCE)

View File

@ -6,6 +6,11 @@ set(DB_FIND_REQUIRED ON)
if (STANDALONE)
include(FindBerkeleyDB)
else (STANDALONE)
set(DB_LIBRARIES db-4.2)
if (LINUX)
# Need to add dependency pthread explicitely to support ld.gold.
set(DB_LIBRARIES db-4.2 pthread)
else (LINUX)
set(DB_LIBRARIES db-4.2)
endif (LINUX)
set(DB_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE)

View File

@ -33,6 +33,7 @@ set(cmake_SOURCE_FILES
FindMySQL.cmake
FindOpenJPEG.cmake
FindXmlRpcEpi.cmake
FindZLIB.cmake
FMOD.cmake
FreeType.cmake
GStreamer010Plugin.cmake

View File

@ -10,10 +10,10 @@ else (STANDALONE)
use_prebuilt_binary(curl)
if (WINDOWS)
set(CURL_LIBRARIES
debug libcurld
optimized libcurl)
debug libcurld.lib
optimized libcurl.lib)
else (WINDOWS)
set(CURL_LIBRARIES curl)
set(CURL_LIBRARIES libcurl.a)
endif (WINDOWS)
set(CURL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include)
endif (STANDALONE)

View File

@ -60,22 +60,6 @@ if(WINDOWS)
set(release_files ${release_files} fmod.dll)
endif (FMOD)
#*******************************
# 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
@ -174,21 +158,6 @@ elseif(DARWIN)
# 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...
@ -242,21 +211,6 @@ elseif(LINUX)
set(release_files ${release_files} "libfmod-3.75.so")
endif (FMOD)
#*******************************
# 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")
@ -334,40 +288,29 @@ copy_if_different(
)
set(third_party_targets ${third_party_targets} ${out_targets})
#*******************************
# 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})
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)
if(NOT STANDALONE)
add_custom_target(

View File

@ -21,7 +21,12 @@ EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Try to find a library that was compiled with the same compiler version as we currently use.
SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson_linux-gcc-${_gcc_COMPILER_VERSION}_libmt.so)
IF (STANDALONE)
# On standalone, assume that the system installed library was compiled with the used compiler.
SET(JSONCPP_NAMES ${JSONCPP_NAMES} libjson.so)
ENDIF (STANDALONE)
FIND_LIBRARY(JSONCPP_LIBRARY
NAMES ${JSONCPP_NAMES}
PATHS /usr/lib /usr/local/lib

View File

@ -0,0 +1,62 @@
# -*- cmake -*-
# - Find llqtwebkit
# Find the llqtwebkit includes and library
# This module defines
# LLQTWEBKIT_INCLUDE_DIR, where to find llqtwebkit.h, etc.
# LLQTWEBKIT_LIBRARY, the llqtwebkit library with full path.
# LLQTWEBKIT_FOUND, If false, do not try to use llqtwebkit.
# also defined, but not for general use are
# LLQTWEBKIT_LIBRARIES, the libraries needed to use llqtwebkit.
# LLQTWEBKIT_LIBRARY_DIRS, where to find the llqtwebkit library.
# LLQTWEBKIT_DEFINITIONS - You should add_definitions(${LLQTWEBKIT_DEFINITIONS})
# before compiling code that includes llqtwebkit library files.
# Try to use pkg-config first.
# This allows to have two different libllqtwebkit packages installed:
# one for viewer 2.x and one for viewer 1.x.
include(FindPkgConfig)
if (PKG_CONFIG_FOUND)
if (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)
set(_PACKAGE_ARGS libllqtwebkit>=${LLQtWebkit_FIND_VERSION} REQUIRED)
else (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)
set(_PACKAGE_ARGS libllqtwebkit)
endif (LLQtWebkit_FIND_REQUIRED AND LLQtWebkit_FIND_VERSION)
if (NOT "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_LESS "2.8")
# As virtually nobody will have a pkg-config file for this, do this check always quiet.
# Unfortunately cmake 2.8 or higher is required for pkg_check_modules to have a 'QUIET'.
set(_PACKAGE_ARGS ${_PACKAGE_ARGS} QUIET)
endif ()
pkg_check_modules(LLQTWEBKIT ${_PACKAGE_ARGS})
endif (PKG_CONFIG_FOUND)
set(LLQTWEBKIT_DEFINITIONS ${LLQTWEBKIT_CFLAGS_OTHER})
find_path(LLQTWEBKIT_INCLUDE_DIR llqtwebkit.h NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_INCLUDE_DIRS})
find_library(LLQTWEBKIT_LIBRARY NAMES llqtwebkit NO_SYSTEM_ENVIRONMENT_PATH HINTS ${LLQTWEBKIT_LIBRARY_DIRS})
if (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND) # If pkg-config couldn't find it, pretend we don't have pkg-config.
set(LLQTWEBKIT_LIBRARIES llqtwebkit)
get_filename_component(LLQTWEBKIT_LIBRARY_DIRS ${LLQTWEBKIT_LIBRARY} PATH)
endif (NOT PKG_CONFIG_FOUND OR NOT LLQTWEBKIT_FOUND)
# Handle the QUIETLY and REQUIRED arguments and set LLQTWEBKIT_FOUND
# to TRUE if all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
LLQTWEBKIT
DEFAULT_MSG
LLQTWEBKIT_LIBRARY
LLQTWEBKIT_INCLUDE_DIR
LLQTWEBKIT_LIBRARIES
LLQTWEBKIT_LIBRARY_DIRS
)
mark_as_advanced(
LLQTWEBKIT_LIBRARY
LLQTWEBKIT_INCLUDE_DIR
LLQTWEBKIT_LIBRARIES
LLQTWEBKIT_LIBRARY_DIRS
LLQTWEBKIT_DEFINITIONS
)

View File

@ -0,0 +1,39 @@
# -*- cmake -*-
# - Find NDOF
# Find the NDOF includes and library
# This module defines
# NDOF_INCLUDE_DIR, where to find ndofdev_external.h, etc.
# NDOF_LIBRARY, the library needed to use NDOF.
# NDOF_FOUND, If false, do not try to use NDOF.
find_path(NDOF_INCLUDE_DIR ndofdev_external.h
PATH_SUFFIXES ndofdev
)
set(NDOF_NAMES ${NDOF_NAMES} ndofdev libndofdev)
find_library(NDOF_LIBRARY
NAMES ${NDOF_NAMES}
)
if (NDOF_LIBRARY AND NDOF_INCLUDE_DIR)
set(NDOF_FOUND "YES")
else (NDOF_LIBRARY AND NDOF_INCLUDE_DIR)
set(NDOF_FOUND "NO")
endif (NDOF_LIBRARY AND NDOF_INCLUDE_DIR)
if (NDOF_FOUND)
if (NOT NDOF_FIND_QUIETLY)
message(STATUS "Found NDOF: Library in '${NDOF_LIBRARY}' and header in '${NDOF_INCLUDE_DIR}' ")
endif (NOT NDOF_FIND_QUIETLY)
else (NDOF_FOUND)
if (NDOF_FIND_REQUIRED)
message(FATAL_ERROR " * * *\nCould not find NDOF library!\nIf you don't need Space Navigator Joystick support you can skip this test by configuring with -DNDOF:BOOL=OFF\n * * *")
endif (NDOF_FIND_REQUIRED)
endif (NDOF_FOUND)
mark_as_advanced(
NDOF_LIBRARY
NDOF_INCLUDE_DIR
)

View File

@ -3,12 +3,11 @@
# - Find Tut
# Find the Tut unit test framework includes and library
# This module defines
# TUT_INCLUDE_DIR, where to find tut.h, etc.
# TUT_INCLUDE_DIR, where to find tut/tut.hpp.
# TUT_FOUND, If false, do not try to use Tut.
find_path(TUT_INCLUDE_DIR tut.h
/usr/local/include/
/usr/include
find_path(TUT_INCLUDE_DIR tut/tut.hpp
NO_SYSTEM_ENVIRONMENT_PATH
)
if (TUT_INCLUDE_DIR)

View File

@ -0,0 +1,46 @@
# -*- cmake -*-
# - Find zlib
# Find the ZLIB includes and library
# This module defines
# ZLIB_INCLUDE_DIRS, where to find zlib.h, etc.
# ZLIB_LIBRARIES, the libraries needed to use zlib.
# ZLIB_FOUND, If false, do not try to use zlib.
#
# This FindZLIB is about 43 times as fast the one provided with cmake (2.8.x),
# because it doesn't look up the version of zlib, resulting in a dramatic
# speed up for configure (from 4 minutes 22 seconds to 6 seconds).
#
# Note: Since this file is only used for standalone, the windows
# specific parts were left out.
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
NO_SYSTEM_ENVIRONMENT_PATH
)
FIND_LIBRARY(ZLIB_LIBRARY z)
if (ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
SET(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
SET(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
SET(ZLIB_FOUND "YES")
else (ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
SET(ZLIB_FOUND "NO")
endif (ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
if (ZLIB_FOUND)
if (NOT ZLIB_FIND_QUIETLY)
message(STATUS "Found ZLIB: ${ZLIB_LIBRARIES}")
SET(ZLIB_FIND_QUIETLY TRUE)
endif (NOT ZLIB_FIND_QUIETLY)
else (ZLIB_FOUND)
if (ZLIB_FIND_REQUIRED)
message(FATAL_ERROR "Could not find ZLIB library")
endif (ZLIB_FIND_REQUIRED)
endif (ZLIB_FOUND)
mark_as_advanced(
ZLIB_LIBRARY
ZLIB_INCLUDE_DIR
)

View File

@ -205,6 +205,9 @@ FUNCTION(LL_ADD_INTEGRATION_TEST
endif(TEST_DEBUG)
ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})
SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}")
if(STANDALONE)
SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES COMPILE_FLAGS -I"${TUT_INCLUDE_DIR}")
endif(STANDALONE)
# Add link deps to the executable
if(TEST_DEBUG)

View File

@ -13,7 +13,14 @@ set(LLCOMMON_INCLUDE_DIRS
${Boost_INCLUDE_DIRS}
)
set(LLCOMMON_LIBRARIES llcommon)
if (LINUX)
# In order to support using ld.gold on linux, we need to explicitely
# specify all libraries that llcommon uses.
# llcommon uses `clock_gettime' which is provided by librt on linux.
set(LLCOMMON_LIBRARIES llcommon rt)
else (LINUX)
set(LLCOMMON_LIBRARIES llcommon)
endif (LINUX)
add_definitions(${TCMALLOC_FLAG})

View File

@ -1,7 +1,20 @@
# -*- cmake -*-
include(Prebuilt)
# USE_KDU can be set when launching cmake or develop.py as an option using the argument -DUSE_KDU:BOOL=ON
# When building using proprietary binaries though (i.e. having access to LL private servers), we always build with KDU
if (INSTALL_PROPRIETARY AND NOT STANDALONE)
use_prebuilt_binary(kdu)
set(LLKDU_LIBRARY llkdu)
set(USE_KDU ON)
endif (INSTALL_PROPRIETARY AND NOT STANDALONE)
if (USE_KDU)
use_prebuilt_binary(kdu)
if (WINDOWS)
set(KDU_LIBRARY kdu.lib)
else (WINDOWS)
set(KDU_LIBRARY libkdu.a)
endif (WINDOWS)
set(KDU_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/kdu)
set(LLKDU_INCLUDE_DIRS ${LIBS_OPEN_DIR}/llkdu)
set(LLKDU_LIBRARIES llkdu)
endif (USE_KDU)

View File

@ -5,4 +5,10 @@ set(LLPLUGIN_INCLUDE_DIRS
${LIBS_OPEN_DIR}/llplugin
)
set(LLPLUGIN_LIBRARIES llplugin)
if (LINUX)
# In order to support using ld.gold on linux, we need to explicitely
# specify all libraries that llplugin uses.
set(LLPLUGIN_LIBRARIES llplugin pthread)
else (LINUX)
set(LLPLUGIN_LIBRARIES llplugin)
endif (LINUX)

View File

@ -1,14 +1,32 @@
# -*- cmake -*-
include(Prebuilt)
use_prebuilt_binary(ndofdev)
set(NDOF ON CACHE BOOL "Use NDOF space navigator joystick library.")
if (WINDOWS OR DARWIN OR LINUX)
if (NDOF)
if (STANDALONE)
set(NDOF_FIND_REQUIRED ON)
include(FindNDOF)
else (STANDALONE)
use_prebuilt_binary(ndofdev)
if (WINDOWS)
set(NDOF_LIBRARY libndofdev)
elseif (DARWIN OR LINUX)
set(NDOF_LIBRARY ndofdev)
endif (WINDOWS)
set(NDOF_INCLUDE_DIR ${ARCH_PREBUILT_DIRS}/include/ndofdev)
set(NDOF_FOUND 1)
endif (STANDALONE)
endif (NDOF)
if (NDOF_FOUND)
add_definitions(-DLIB_NDOF=1)
endif (WINDOWS OR DARWIN OR LINUX)
include_directories(${NDOF_INCLUDE_DIR})
else (NDOF_FOUND)
message(STATUS "Building without N-DoF joystick support")
set(NDOF_INCLUDE_DIR "")
set(NDOF_LIBRARY "")
endif (NDOF_FOUND)
if (WINDOWS)
set(NDOF_LIBRARY libndofdev)
elseif (DARWIN OR LINUX)
set(NDOF_LIBRARY ndofdev)
endif (WINDOWS)

View File

@ -1,7 +1,7 @@
# -*- cmake -*-
include(Prebuilt)
set(PULSEAUDIO ON CACHE BOOL "Build with PulseAudio support, if available.")
set(PULSEAUDIO OFF CACHE BOOL "Build with PulseAudio support, if available.")
if (PULSEAUDIO)
if (STANDALONE)

View File

@ -6,7 +6,6 @@ set(TUT_FIND_QUIETLY TRUE)
if (STANDALONE)
include(FindTut)
include_directories(${TUT_INCLUDE_DIR})
else (STANDALONE)
use_prebuilt_binary(tut)
endif (STANDALONE)

View File

@ -3,6 +3,29 @@ include(Linking)
include(Prebuilt)
if (STANDALONE)
# The minimal version, 4.4.3, is rather arbitrary: it's the version in Debian/Lenny.
find_package(Qt4 4.4.3 COMPONENTS QtCore QtGui QtNetwork QtOpenGL QtWebKit REQUIRED)
include(${QT_USE_FILE})
set(QTDIR $ENV{QTDIR})
if (QTDIR AND NOT "${QT_BINARY_DIR}" STREQUAL "${QTDIR}/bin")
message(FATAL_ERROR "\"${QT_BINARY_DIR}\" is unequal \"${QTDIR}/bin\"; "
"Qt is found by looking for qmake in your PATH. "
"Please set your PATH such that 'qmake' is found in \$QTDIR/bin, "
"or unset QTDIR if the found Qt is correct.")
endif (QTDIR AND NOT "${QT_BINARY_DIR}" STREQUAL "${QTDIR}/bin")
find_package(LLQtWebkit REQUIRED QUIET)
# Add the plugins.
set(QT_PLUGIN_LIBRARIES)
foreach(qlibname qgif qjpeg)
find_library(QT_PLUGIN_${qlibname} ${qlibname} PATHS ${QT_PLUGINS_DIR}/imageformats NO_DEFAULT_PATH)
if (QT_PLUGIN_${qlibname})
list(APPEND QT_PLUGIN_LIBRARIES ${QT_PLUGIN_${qlibname}})
else (QT_PLUGIN_${qtlibname})
message(FATAL_ERROR "Could not find the Qt plugin ${qlibname} in \"${QT_PLUGINS_DIR}/imageformats\"!")
endif (QT_PLUGIN_${qlibname})
endforeach(qlibname)
# qjpeg depends on libjpeg
list(APPEND QT_PLUGIN_LIBRARIES jpeg)
set(WEBKITLIBPLUGIN OFF CACHE BOOL
"WEBKITLIBPLUGIN support for the llplugin/llmedia test apps.")
else (STANDALONE)
@ -35,7 +58,7 @@ elseif (DARWIN)
)
elseif (LINUX)
if (STANDALONE)
set(WEBKIT_PLUGIN_LIBRARIES llqtwebkit)
set(WEBKIT_PLUGIN_LIBRARIES ${LLQTWEBKIT_LIBRARY} ${QT_LIBRARIES} ${QT_PLUGIN_LIBRARIES})
else (STANDALONE)
set(WEBKIT_PLUGIN_LIBRARIES
llqtwebkit

View File

@ -10,6 +10,7 @@ include(00-Common)
include(LLCommon)
include(LLImage)
include(LLImageJ2COJ) # ugh, needed for images
include(LLKDU)
include(LLMath)
include(LLMessage)
include(LLRender)
@ -71,6 +72,11 @@ endif (DARWIN)
target_link_libraries(llui_libtest
llui
llmessage
${LLRENDER_LIBRARIES}
${LLIMAGE_LIBRARIES}
${LLKDU_LIBRARIES}
${KDU_LIBRARY}
${LLIMAGEJ2COJ_LIBRARIES}
${OS_LIBRARIES}
${GOOGLE_PERFTOOLS_LIBRARIES}
)

View File

@ -52,20 +52,22 @@ def get_HKLM_registry_value(key_str, value_str):
def find_vc_dir():
supported_versions = (r'8.0', r'9.0')
supported_products = (r'VisualStudio', r'VCExpress')
value_str = (r'ProductDir')
for version in supported_versions:
key_str = (r'SOFTWARE\Microsoft\VisualStudio\%s\Setup\VC' %
version)
try:
return get_HKLM_registry_value(key_str, value_str)
except WindowsError, err:
x64_key_str = (r'SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%s\Setup\VS' %
version)
for product in supported_products:
for version in supported_versions:
key_str = (r'SOFTWARE\Microsoft\%s\%s\Setup\VC' %
(product, version))
try:
return get_HKLM_registry_value(x64_key_str, value_str)
except:
print >> sys.stderr, "Didn't find MS VC version %s " % version
return get_HKLM_registry_value(key_str, value_str)
except WindowsError, err:
x64_key_str = (r'SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%s\Setup\VS' %
version)
try:
return get_HKLM_registry_value(x64_key_str, value_str)
except:
print >> sys.stderr, "Didn't find MS %s version %s " % (product,version)
raise

View File

@ -28,6 +28,7 @@
#include "linden_common.h"
#include "llapr.h"
#include "apr_dso.h"
apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool
LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = NULL ; //global volatile APR memory pool.
@ -279,14 +280,31 @@ bool ll_apr_warn_status(apr_status_t status)
{
if(APR_SUCCESS == status) return false;
char buf[MAX_STRING]; /* Flawfinder: ignore */
apr_strerror(status, buf, MAX_STRING);
apr_strerror(status, buf, sizeof(buf));
LL_WARNS("APR") << "APR: " << buf << LL_ENDL;
return true;
}
bool ll_apr_warn_status(apr_status_t status, apr_dso_handle_t *handle)
{
bool result = ll_apr_warn_status(status);
// Despite observed truncation of actual Mac dylib load errors, increasing
// this buffer to more than MAX_STRING doesn't help: it appears that APR
// stores the output in a fixed 255-character internal buffer. (*sigh*)
char buf[MAX_STRING]; /* Flawfinder: ignore */
apr_dso_error(handle, buf, sizeof(buf));
LL_WARNS("APR") << "APR: " << buf << LL_ENDL;
return result;
}
void ll_apr_assert_status(apr_status_t status)
{
llassert(ll_apr_warn_status(status) == false);
llassert(! ll_apr_warn_status(status));
}
void ll_apr_assert_status(apr_status_t status, apr_dso_handle_t *handle)
{
llassert(! ll_apr_warn_status(status, handle));
}
//---------------------------------------------------------------------

View File

@ -53,6 +53,8 @@
extern LL_COMMON_API apr_thread_mutex_t* gLogMutexp;
extern apr_thread_mutex_t* gCallStacksLogMutexp;
struct apr_dso_handle_t;
/**
* @brief initialize the common apr constructs -- apr itself, the
* global pool, and a mutex.
@ -259,8 +261,11 @@ public:
* @return Returns <code>true</code> if status is an error condition.
*/
bool LL_COMMON_API ll_apr_warn_status(apr_status_t status);
/// There's a whole other APR error-message function if you pass a DSO handle.
bool LL_COMMON_API ll_apr_warn_status(apr_status_t status, apr_dso_handle_t* handle);
void LL_COMMON_API ll_apr_assert_status(apr_status_t status);
void LL_COMMON_API ll_apr_assert_status(apr_status_t status, apr_dso_handle_t* handle);
extern "C" LL_COMMON_API apr_pool_t* gAPRPoolp; // Global APR memory pool

View File

@ -475,7 +475,7 @@ void LLEventPump::stopListening(const std::string& name)
*****************************************************************************/
bool LLEventStream::post(const LLSD& event)
{
if (! mEnabled)
if (! mEnabled || !mSignal)
{
return false;
}
@ -515,6 +515,8 @@ bool LLEventQueue::post(const LLSD& event)
void LLEventQueue::flush()
{
if(!mSignal) return;
// Consider the case when a given listener on this LLEventQueue posts yet
// another event on the same queue. If we loop over mEventQueue directly,
// we'll end up processing all those events during the same flush() call

View File

@ -265,14 +265,7 @@ int LLProcessLauncher::launch(void)
delete[] fake_argv;
mProcessID = id;
// At this point, the child process will have been created (since that's how vfork works -- the child borrowed our execution context until it forked)
// If the process doesn't exist at this point, the exec failed.
if(!isRunning())
{
result = -1;
}
return result;
}

View File

@ -179,7 +179,7 @@ public:
void waitOnPending();
void printQueueStats();
S32 getPending();
virtual S32 getPending();
bool getThreaded() { return mThreaded ? true : false; }
// Request accessors

View File

@ -35,7 +35,7 @@ const S32 LL_VERSION_BUILD = 0;
const char * const LL_CHANNEL = "Second Life Developer";
#if LL_DARWIN
const char * const LL_VERSION_BUNDLE_ID = "com.secondlife.snowglobe.viewer";
const char * const LL_VERSION_BUNDLE_ID = "com.secondlife.indra.viewer";
#endif
#endif

View File

@ -3,12 +3,13 @@
project(llimage)
include(00-Common)
include(LLAddBuildTest)
include(LLCommon)
include(LLImage)
include(LLMath)
include(LLVFS)
include(ZLIB)
include(LLAddBuildTest)
include(Tut)
include_directories(
${LLCOMMON_INCLUDE_DIRS}
@ -57,11 +58,18 @@ add_library (llimage ${llimage_SOURCE_FILES})
# Sort by high-level to low-level
target_link_libraries(llimage
llcommon
llimagej2coj # *HACK: In theory a noop for KDU builds?
${JPEG_LIBRARIES}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
)
# Add tests
#ADD_BUILD_TEST(llimageworker llimage)
if (LL_TESTS)
SET(llimage_TEST_SOURCE_FILES
llimageworker.cpp
)
LL_ADD_PROJECT_UNIT_TESTS(llimage "${llimage_TEST_SOURCE_FILES}")
endif (LL_TESTS)

View File

@ -52,13 +52,11 @@ LLMutex* LLImage::sMutex = NULL;
void LLImage::initClass()
{
sMutex = new LLMutex(NULL);
LLImageJ2C::openDSO();
}
//static
void LLImage::cleanupClass()
{
LLImageJ2C::closeDSO();
delete sMutex;
sMutex = NULL;
}

View File

@ -24,9 +24,6 @@
*/
#include "linden_common.h"
#include "apr_pools.h"
#include "apr_dso.h"
#include "lldir.h"
#include "llimagej2c.h"
#include "llmemtype.h"
@ -37,18 +34,10 @@ typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)();
typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*);
typedef const char* (*EngineInfoLLImageJ2CFunction)();
//some "private static" variables so we only attempt to load
//dynamic libaries once
CreateLLImageJ2CFunction j2cimpl_create_func;
DestroyLLImageJ2CFunction j2cimpl_destroy_func;
EngineInfoLLImageJ2CFunction j2cimpl_engineinfo_func;
apr_pool_t *j2cimpl_dso_memory_pool;
apr_dso_handle_t *j2cimpl_dso_handle;
//Declare the prototype for theses functions here, their functionality
//will be implemented in other files which define a derived LLImageJ2CImpl
//but only ONE static library which has the implementation for this
//function should ever be included
// Declare the prototype for theses functions here. Their functionality
// will be implemented in other files which define a derived LLImageJ2CImpl
// but only ONE static library which has the implementation for these
// functions should ever be included.
LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl();
void fallbackDestroyLLImageJ2CImpl(LLImageJ2CImpl* impl);
const char* fallbackEngineInfoLLImageJ2CImpl();
@ -57,121 +46,10 @@ const char* fallbackEngineInfoLLImageJ2CImpl();
LLImageCompressionTester* LLImageJ2C::sTesterp = NULL ;
const std::string sTesterName("ImageCompressionTester");
//static
//Loads the required "create", "destroy" and "engineinfo" functions needed
void LLImageJ2C::openDSO()
{
//attempt to load a DSO and get some functions from it
std::string dso_name;
std::string dso_path;
bool all_functions_loaded = false;
apr_status_t rv;
#if LL_WINDOWS
dso_name = "llkdu.dll";
#elif LL_DARWIN
dso_name = "libllkdu.dylib";
#else
dso_name = "libllkdu.so";
#endif
dso_path = gDirUtilp->findFile(dso_name,
gDirUtilp->getAppRODataDir(),
gDirUtilp->getExecutableDir());
j2cimpl_dso_handle = NULL;
j2cimpl_dso_memory_pool = NULL;
//attempt to load the shared library
apr_pool_create(&j2cimpl_dso_memory_pool, NULL);
rv = apr_dso_load(&j2cimpl_dso_handle,
dso_path.c_str(),
j2cimpl_dso_memory_pool);
//now, check for success
if ( rv == APR_SUCCESS )
{
//found the dynamic library
//now we want to load the functions we're interested in
CreateLLImageJ2CFunction create_func = NULL;
DestroyLLImageJ2CFunction dest_func = NULL;
EngineInfoLLImageJ2CFunction engineinfo_func = NULL;
rv = apr_dso_sym((apr_dso_handle_sym_t*)&create_func,
j2cimpl_dso_handle,
"createLLImageJ2CKDU");
if ( rv == APR_SUCCESS )
{
//we've loaded the create function ok
//we need to delete via the DSO too
//so lets check for a destruction function
rv = apr_dso_sym((apr_dso_handle_sym_t*)&dest_func,
j2cimpl_dso_handle,
"destroyLLImageJ2CKDU");
if ( rv == APR_SUCCESS )
{
//we've loaded the destroy function ok
rv = apr_dso_sym((apr_dso_handle_sym_t*)&engineinfo_func,
j2cimpl_dso_handle,
"engineInfoLLImageJ2CKDU");
if ( rv == APR_SUCCESS )
{
//ok, everything is loaded alright
j2cimpl_create_func = create_func;
j2cimpl_destroy_func = dest_func;
j2cimpl_engineinfo_func = engineinfo_func;
all_functions_loaded = true;
}
}
}
}
if ( !all_functions_loaded )
{
//something went wrong with the DSO or function loading..
//fall back onto our satefy impl creation function
#if 0
// precious verbose debugging, sadly we can't use our
// 'llinfos' stream etc. this early in the initialisation seq.
char errbuf[256];
fprintf(stderr, "failed to load syms from DSO %s (%s)\n",
dso_name.c_str(), dso_path.c_str());
apr_strerror(rv, errbuf, sizeof(errbuf));
fprintf(stderr, "error: %d, %s\n", rv, errbuf);
apr_dso_error(j2cimpl_dso_handle, errbuf, sizeof(errbuf));
fprintf(stderr, "dso-error: %d, %s\n", rv, errbuf);
#endif
if ( j2cimpl_dso_handle )
{
apr_dso_unload(j2cimpl_dso_handle);
j2cimpl_dso_handle = NULL;
}
if ( j2cimpl_dso_memory_pool )
{
apr_pool_destroy(j2cimpl_dso_memory_pool);
j2cimpl_dso_memory_pool = NULL;
}
}
}
//static
void LLImageJ2C::closeDSO()
{
if ( j2cimpl_dso_handle ) apr_dso_unload(j2cimpl_dso_handle);
if (j2cimpl_dso_memory_pool) apr_pool_destroy(j2cimpl_dso_memory_pool);
}
//static
std::string LLImageJ2C::getEngineInfo()
{
if (!j2cimpl_engineinfo_func)
j2cimpl_engineinfo_func = fallbackEngineInfoLLImageJ2CImpl;
return j2cimpl_engineinfo_func();
return fallbackEngineInfoLLImageJ2CImpl();
}
LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
@ -181,20 +59,7 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
mReversible(FALSE),
mAreaUsedForDataSizeCalcs(0)
{
//We assume here that if we wanted to create via
//a dynamic library that the approriate open calls were made
//before any calls to this constructor.
//Therefore, a NULL creation function pointer here means
//we either did not want to create using functions from the dynamic
//library or there were issues loading it, either way
//use our fall back
if ( !j2cimpl_create_func )
{
j2cimpl_create_func = fallbackCreateLLImageJ2CImpl;
}
mImpl = j2cimpl_create_func();
mImpl = fallbackCreateLLImageJ2CImpl();
// Clear data size table
for( S32 i = 0; i <= MAX_DISCARD_LEVEL; i++)
@ -217,22 +82,9 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
// virtual
LLImageJ2C::~LLImageJ2C()
{
//We assume here that if we wanted to destroy via
//a dynamic library that the approriate open calls were made
//before any calls to this destructor.
//Therefore, a NULL creation function pointer here means
//we either did not want to destroy using functions from the dynamic
//library or there were issues loading it, either way
//use our fall back
if ( !j2cimpl_destroy_func )
{
j2cimpl_destroy_func = fallbackDestroyLLImageJ2CImpl;
}
if ( mImpl )
{
j2cimpl_destroy_func(mImpl);
fallbackDestroyLLImageJ2CImpl(mImpl);
}
}

View File

@ -72,8 +72,6 @@ public:
static S32 calcHeaderSizeJ2C();
static S32 calcDataSizeJ2C(S32 w, S32 h, S32 comp, S32 discard_level, F32 rate = 0.f);
static void openDSO();
static void closeDSO();
static std::string getEngineInfo();
protected:

View File

@ -26,10 +26,8 @@
*/
// Precompiled header: almost always required for newview cpp files
#include <list>
#include <map>
#include <algorithm>
// Class to test
#include "linden_common.h"
// Class to test
#include "../llimageworker.h"
// For timer class
#include "../llcommon/lltimer.h"
@ -44,7 +42,17 @@
// * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code)
// * A simulator for a class can be implemented here. Please comment and document thoroughly.
LLImageBase::LLImageBase() {}
LLImageBase::LLImageBase()
: mData(NULL),
mDataSize(0),
mWidth(0),
mHeight(0),
mComponents(0),
mBadBufferAllocation(false),
mAllowOverSize(false),
mMemType(LLMemType::MTYPE_IMAGEBASE)
{
}
LLImageBase::~LLImageBase() {}
void LLImageBase::dump() { }
void LLImageBase::sanityCheck() { }

View File

@ -90,6 +90,12 @@ void info_callback(const char* msg, void*)
lldebugs << "LLImageJ2COJ: " << chomp(msg) << llendl;
}
// Divide a by 2 to the power of b and round upwards
int ceildivpow2(int a, int b)
{
return (a + (1 << b) - 1) >> b;
}
LLImageJ2COJ::LLImageJ2COJ()
: LLImageJ2CImpl()

View File

@ -34,17 +34,11 @@ class LLImageJ2COJ : public LLImageJ2CImpl
public:
LLImageJ2COJ();
virtual ~LLImageJ2COJ();
protected:
/*virtual*/ BOOL getMetadata(LLImageJ2C &base);
/*virtual*/ BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count);
/*virtual*/ BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0,
BOOL reversible = FALSE);
int ceildivpow2(int a, int b)
{
// Divide a by b to the power of 2 and round upwards.
return (a + (1 << b) - 1) >> b;
}
};
#endif

View File

@ -199,7 +199,7 @@ bool LLNotecard::importStream(std::istream& str)
return FALSE;
}
if(text_len > mMaxText)
if(text_len > mMaxText || text_len < 0)
{
llwarns << "Invalid Linden text length: " << text_len << llendl;
return FALSE;

View File

@ -0,0 +1,55 @@
# -*- cmake -*-
project(llkdu)
# Visual Studio 2005 has a dumb bug that causes it to fail compilation
# of KDU if building with both optimisation and /WS (treat warnings as
# errors), even when the specific warnings that make it croak are
# disabled.
#set(VS_DISABLE_FATAL_WARNINGS ON)
include(00-Common)
include(LLCommon)
include(LLImage)
include(LLKDU)
include(LLMath)
include_directories(
${LLCOMMON_INCLUDE_DIRS}
${LLIMAGE_INCLUDE_DIRS}
${KDU_INCLUDE_DIR}
${LLMATH_INCLUDE_DIRS}
)
set(llkdu_SOURCE_FILES
llimagej2ckdu.cpp
llkdumem.cpp
)
set(llkdu_HEADER_FILES
CMakeLists.txt
llimagej2ckdu.h
llkdumem.h
)
set_source_files_properties(${llkdu_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
list(APPEND llkdu_SOURCE_FILES ${llkdu_HEADER_FILES})
if (USE_KDU)
add_library (${LLKDU_LIBRARIES} ${llkdu_SOURCE_FILES})
# Add tests
if (LL_TESTS)
include(LLAddBuildTest)
include(Tut)
SET(llkdu_TEST_SOURCE_FILES
llimagej2ckdu.cpp
)
LL_ADD_PROJECT_UNIT_TESTS(llkdu "${llkdu_TEST_SOURCE_FILES}")
endif (LL_TESTS)
endif (USE_KDU)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,90 @@
/**
* @file llimagej2ckdu.h
* @brief This is an implementation of JPEG2000 encode/decode using Kakadu
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLIMAGEJ2CKDU_H
#define LL_LLIMAGEJ2CKDU_H
#include "llimagej2c.h"
//
// KDU core header files
//
#include "kdu_elementary.h"
#include "kdu_messaging.h"
#include "kdu_params.h"
#include "kdu_compressed.h"
#include "kdu_sample_processing.h"
class LLKDUDecodeState;
class LLKDUMemSource;
class LLImageJ2CKDU : public LLImageJ2CImpl
{
public:
enum ECodeStreamMode
{
MODE_FAST = 0,
MODE_RESILIENT = 1,
MODE_FUSSY = 2
};
LLImageJ2CKDU();
virtual ~LLImageJ2CKDU();
protected:
/*virtual*/ BOOL getMetadata(LLImageJ2C &base);
/*virtual*/ BOOL decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count);
/*virtual*/ BOOL encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text, F32 encode_time=0.0,
BOOL reversible=FALSE);
private:
void setupCodeStream(LLImageJ2C &base, BOOL keep_codestream, ECodeStreamMode mode);
void cleanupCodeStream();
BOOL initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count );
// Encode variable
LLKDUMemSource *mInputp;
kdu_codestream *mCodeStreamp;
kdu_coords *mTPosp; // tile position
kdu_dims *mTileIndicesp;
// Temporary variables for in-progress decodes...
LLImageRaw *mRawImagep;
LLKDUDecodeState *mDecodeState;
};
#if LL_WINDOWS
# define LLSYMEXPORT __declspec(dllexport)
#elif LL_LINUX
# define LLSYMEXPORT __attribute__ ((visibility("default")))
#else
# define LLSYMEXPORT
#endif
extern "C" LLSYMEXPORT const char* engineInfoLLImageJ2CKDU();
extern "C" LLSYMEXPORT LLImageJ2CKDU* createLLImageJ2CKDU();
extern "C" LLSYMEXPORT void destroyLLImageJ2CKDU(LLImageJ2CKDU* kdu);
#endif

196
indra/llkdu/llkdumem.cpp Normal file
View File

@ -0,0 +1,196 @@
/**
* @file llkdumem.cpp
* @brief Helper class for kdu memory management
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llkdumem.h"
#include "llerror.h"
#if defined(LL_WINDOWS)
# pragma warning(disable: 4702) // unreachable code
#endif
LLKDUMemIn::LLKDUMemIn(const U8 *data,
const U32 size,
const U16 width,
const U16 height,
const U8 in_num_components,
siz_params *siz)
{
U8 n;
first_comp_idx = 0;
rows = height;
cols = width;
num_components = in_num_components;
alignment_bytes = 0;
for (n=0; n<3; ++n)
{
precision[n] = 0;
}
for (n=0; n < num_components; ++n)
{
siz->set(Sdims,n,0,rows);
siz->set(Sdims,n,1,cols);
siz->set(Ssigned,n,0,false);
siz->set(Sprecision,n,0,8);
}
incomplete_lines = NULL;
free_lines = NULL;
num_unread_rows = rows;
mData = data;
mDataSize = size;
mCurPos = 0;
}
LLKDUMemIn::~LLKDUMemIn()
{
if ((num_unread_rows > 0) || (incomplete_lines != NULL))
{
kdu_warning w;
w << "Not all rows of image components "
<< first_comp_idx << " through "
<< first_comp_idx+num_components-1
<< " were consumed!";
}
image_line_buf *tmp;
while ((tmp=incomplete_lines) != NULL)
{
incomplete_lines = tmp->next;
delete tmp;
}
while ((tmp=free_lines) != NULL)
{
free_lines = tmp->next;
delete tmp;
}
}
bool LLKDUMemIn::get(int comp_idx, kdu_line_buf &line, int x_tnum)
{
int idx = comp_idx - this->first_comp_idx;
assert((idx >= 0) && (idx < num_components));
x_tnum = x_tnum*num_components+idx;
image_line_buf *scan, *prev=NULL;
for (scan=incomplete_lines; scan != NULL; prev=scan, scan=scan->next)
{
assert(scan->next_x_tnum >= x_tnum);
if (scan->next_x_tnum == x_tnum)
{
break;
}
}
if (scan == NULL)
{ // Need to read a new image line.
assert(x_tnum == 0); // Must consume in very specific order.
if (num_unread_rows == 0)
{
return false;
}
if ((scan = free_lines) == NULL)
{
scan = new image_line_buf(cols+3,num_components);
}
free_lines = scan->next;
if (prev == NULL)
{
incomplete_lines = scan;
}
else
{
prev->next = scan;
}
// Copy from image buffer into scan.
memcpy(scan->buf, mData+mCurPos, cols*num_components);
mCurPos += cols*num_components;
num_unread_rows--;
scan->accessed_samples = 0;
scan->next_x_tnum = 0;
}
assert((cols-scan->accessed_samples) >= line.get_width());
int comp_offset = idx;
kdu_byte *sp = scan->buf+num_components*scan->accessed_samples + comp_offset;
int n=line.get_width();
if (line.get_buf32() != NULL)
{
kdu_sample32 *dp = line.get_buf32();
if (line.is_absolute())
{ // 32-bit absolute integers
for (; n > 0; n--, sp+=num_components, dp++)
{
dp->ival = ((kdu_int32)(*sp)) - 128;
}
}
else
{ // true 32-bit floats
for (; n > 0; n--, sp+=num_components, dp++)
{
dp->fval = (((float)(*sp)) / 256.0F) - 0.5F;
}
}
}
else
{
kdu_sample16 *dp = line.get_buf16();
if (line.is_absolute())
{ // 16-bit absolute integers
for (; n > 0; n--, sp+=num_components, dp++)
{
dp->ival = ((kdu_int16)(*sp)) - 128;
}
}
else
{ // 16-bit normalized representation.
for (; n > 0; n--, sp+=num_components, dp++)
{
dp->ival = (((kdu_int16)(*sp)) - 128) << (KDU_FIX_POINT-8);
}
}
}
scan->next_x_tnum++;
if (idx == (num_components-1))
{
scan->accessed_samples += line.get_width();
}
if (scan->accessed_samples == cols)
{ // Send empty line to free list.
assert(scan == incomplete_lines);
incomplete_lines = scan->next;
scan->next = free_lines;
free_lines = scan;
}
return true;
}

145
indra/llkdu/llkdumem.h Normal file
View File

@ -0,0 +1,145 @@
/**
* @file llkdumem.h
* @brief Helper class for kdu memory management
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLKDUMEM_H
#define LL_LLKDUMEM_H
// Support classes for reading and writing from memory buffers in KDU
#include "kdu_image.h"
#include "kdu_elementary.h"
#include "kdu_messaging.h"
#include "kdu_params.h"
#include "kdu_compressed.h"
#include "kdu_sample_processing.h"
#include "image_local.h"
#include "stdtypes.h"
class LLKDUMemSource: public kdu_compressed_source
{
public: // Member functions
LLKDUMemSource(U8 *input_buffer, U32 size)
{
mData = input_buffer;
mSize = size;
mCurPos = 0;
}
~LLKDUMemSource()
{
}
int read(kdu_byte *buf, int num_bytes)
{
U32 num_out;
num_out = num_bytes;
if ((mSize - mCurPos) < (U32)num_bytes)
{
num_out = mSize -mCurPos;
}
memcpy(buf, mData + mCurPos, num_out);
mCurPos += num_out;
return num_out;
}
void reset()
{
mCurPos = 0;
}
private: // Data
U8 *mData;
U32 mSize;
U32 mCurPos;
};
class LLKDUMemTarget: public kdu_compressed_target
{
public: // Member functions
LLKDUMemTarget(U8 *output_buffer, U32 &output_size, const U32 buffer_size)
{
mData = output_buffer;
mSize = buffer_size;
mCurPos = 0;
mOutputSize = &output_size;
}
~LLKDUMemTarget()
{
}
bool write(const kdu_byte *buf, int num_bytes)
{
U32 num_out;
num_out = num_bytes;
if ((mSize - mCurPos) < (U32)num_bytes)
{
num_out = mSize - mCurPos;
memcpy(mData + mCurPos, buf, num_out);
return false;
}
memcpy(mData + mCurPos, buf, num_out);
mCurPos += num_out;
*mOutputSize = mCurPos;
return true;
}
private: // Data
U8 *mData;
U32 mSize;
U32 mCurPos;
U32 *mOutputSize;
};
class LLKDUMemIn : public kdu_image_in_base
{
public: // Member functions
LLKDUMemIn(const U8 *data,
const U32 size,
const U16 rows,
const U16 cols,
U8 in_num_components,
siz_params *siz);
~LLKDUMemIn();
bool get(int comp_idx, kdu_line_buf &line, int x_tnum);
private: // Data
const U8 *mData;
int first_comp_idx;
int num_components;
int rows, cols;
int alignment_bytes; // Number of 0's at end of each line.
int precision[3];
image_line_buf *incomplete_lines; // Each "sample" represents a full pixel
image_line_buf *free_lines;
int num_unread_rows;
U32 mCurPos;
U32 mDataSize;
};
#endif

View File

@ -0,0 +1,248 @@
/**
* @file llimagej2ckdu_test.cpp
* @author Merov Linden
* @date 2010-12-17
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
// Class to test
#include "../llimagej2ckdu.h"
#include "../llkdumem.h"
// Tut header
#include "../test/lltut.h"
// -------------------------------------------------------------------------------------------
// Stubbing: Declarations required to link and run the class being tested
// Notes:
// * Add here stubbed implementation of the few classes and methods used in the class to be tested
// * Add as little as possible (let the link errors guide you)
// * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code)
// * A simulator for a class can be implemented here. Please comment and document thoroughly.
// End Stubbing
// -------------------------------------------------------------------------------------------
// Stubb the LL Image Classes
LLImageRaw::LLImageRaw() { }
LLImageRaw::~LLImageRaw() { }
U8* LLImageRaw::allocateData(S32 ) { return NULL; }
void LLImageRaw::deleteData() { }
U8* LLImageRaw::reallocateData(S32 ) { return NULL; }
BOOL LLImageRaw::resize(U16, U16, S8) { return TRUE; } // this method always returns TRUE...
LLImageBase::LLImageBase()
: mData(NULL),
mDataSize(0),
mWidth(0),
mHeight(0),
mComponents(0),
mBadBufferAllocation(false),
mAllowOverSize(false),
mMemType(LLMemType::MTYPE_IMAGEBASE)
{ }
LLImageBase::~LLImageBase() { }
U8* LLImageBase::allocateData(S32 ) { return NULL; }
void LLImageBase::deleteData() { }
void LLImageBase::dump() { }
const U8* LLImageBase::getData() const { return NULL; }
U8* LLImageBase::getData() { return NULL; }
U8* LLImageBase::reallocateData(S32 ) { return NULL; }
void LLImageBase::sanityCheck() { }
void LLImageBase::setSize(S32 , S32 , S32 ) { }
LLImageJ2CImpl::~LLImageJ2CImpl() { }
LLImageFormatted::LLImageFormatted(S8 ) { }
LLImageFormatted::~LLImageFormatted() { }
U8* LLImageFormatted::allocateData(S32 ) { return NULL; }
S32 LLImageFormatted::calcDataSize(S32 ) { return 0; }
S32 LLImageFormatted::calcDiscardLevelBytes(S32 ) { return 0; }
BOOL LLImageFormatted::decodeChannels(LLImageRaw*, F32, S32, S32) { return FALSE; }
BOOL LLImageFormatted::copyData(U8 *, S32) { return TRUE; } // this method always returns TRUE...
void LLImageFormatted::deleteData() { }
void LLImageFormatted::dump() { }
U8* LLImageFormatted::reallocateData(S32 ) { return NULL; }
void LLImageFormatted::resetLastError() { }
void LLImageFormatted::sanityCheck() { }
void LLImageFormatted::setLastError(const std::string& , const std::string& ) { }
LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C) { }
LLImageJ2C::~LLImageJ2C() { }
S32 LLImageJ2C::calcDataSize(S32 ) { return 0; }
S32 LLImageJ2C::calcDiscardLevelBytes(S32 ) { return 0; }
S32 LLImageJ2C::calcHeaderSize() { return 0; }
BOOL LLImageJ2C::decode(LLImageRaw*, F32) { return FALSE; }
BOOL LLImageJ2C::decodeChannels(LLImageRaw*, F32, S32, S32 ) { return FALSE; }
void LLImageJ2C::decodeFailed() { }
BOOL LLImageJ2C::encode(const LLImageRaw*, F32) { return FALSE; }
S8 LLImageJ2C::getRawDiscardLevel() { return 0; }
void LLImageJ2C::resetLastError() { }
void LLImageJ2C::setLastError(const std::string&, const std::string&) { }
BOOL LLImageJ2C::updateData() { return FALSE; }
void LLImageJ2C::updateRawDiscardLevel() { }
LLKDUMemIn::LLKDUMemIn(const U8*, const U32, const U16, const U16, const U8, siz_params*) { }
LLKDUMemIn::~LLKDUMemIn() { }
bool LLKDUMemIn::get(int, kdu_line_buf&, int) { return false; }
// Stub Kakadu Library calls
kdu_tile_comp kdu_tile::access_component(int ) { kdu_tile_comp a; return a; }
void kdu_tile::close(kdu_thread_env* ) { }
int kdu_tile::get_num_components() { return 0; }
bool kdu_tile::get_ycc() { return false; }
void kdu_tile::set_components_of_interest(int , const int* ) { }
kdu_resolution kdu_tile_comp::access_resolution() { kdu_resolution a; return a; }
int kdu_tile_comp::get_bit_depth(bool ) { return 8; }
bool kdu_tile_comp::get_reversible() { return false; }
kdu_subband kdu_resolution::access_subband(int ) { kdu_subband a; return a; }
void kdu_resolution::get_dims(kdu_dims& ) { }
int kdu_resolution::which() { return 0; }
kdu_decoder::kdu_decoder(kdu_subband , kdu_sample_allocator*, bool , float, int, kdu_thread_env*, kdu_thread_queue*) { }
kdu_synthesis::kdu_synthesis(kdu_resolution, kdu_sample_allocator*, bool, float, kdu_thread_env*, kdu_thread_queue*) { }
kdu_params::kdu_params(const char*, bool, bool, bool, bool, bool) { }
kdu_params::~kdu_params() { }
void kdu_params::set(const char* , int , int , bool ) { }
void kdu_params::set(const char* , int , int , int ) { }
void kdu_params::finalize_all(bool ) { }
void kdu_params::copy_from(kdu_params*, int, int, int, int, int, bool, bool, bool) { }
bool kdu_params::parse_string(const char*) { return false; }
bool kdu_params::get(const char*, int, int, bool&, bool, bool, bool) { return false; }
bool kdu_params::get(const char*, int, int, float&, bool, bool, bool) { return false; }
bool kdu_params::get(const char*, int, int, int&, bool, bool, bool) { return false; }
kdu_params* kdu_params::access_relation(int, int, int, bool) { return NULL; }
kdu_params* kdu_params::access_cluster(const char*) { return NULL; }
void kdu_codestream::set_fast() { }
void kdu_codestream::set_fussy() { }
void kdu_codestream::get_dims(int, kdu_dims&, bool ) { }
void kdu_codestream::change_appearance(bool, bool, bool) { }
void kdu_codestream::get_tile_dims(kdu_coords, int, kdu_dims&, bool ) { }
void kdu_codestream::destroy() { }
void kdu_codestream::collect_timing_stats(int ) { }
void kdu_codestream::set_max_bytes(kdu_long, bool, bool ) { }
void kdu_codestream::get_valid_tiles(kdu_dims& ) { }
void kdu_codestream::create(siz_params*, kdu_compressed_target*, kdu_dims*, int, kdu_long ) { }
void kdu_codestream::create(kdu_compressed_source*, kdu_thread_env*) { }
void kdu_codestream::apply_input_restrictions( int, int, int, int, kdu_dims*, kdu_component_access_mode ) { }
void kdu_codestream::get_subsampling(int , kdu_coords&, bool ) { }
void kdu_codestream::flush(kdu_long *, int , kdu_uint16 *, bool, bool, double, kdu_thread_env*) { }
void kdu_codestream::set_resilient(bool ) { }
int kdu_codestream::get_num_components(bool ) { return 0; }
siz_params* kdu_codestream::access_siz() { return NULL; }
kdu_tile kdu_codestream::open_tile(kdu_coords , kdu_thread_env* ) { kdu_tile a; return a; }
kdu_codestream_comment kdu_codestream::add_comment() { kdu_codestream_comment a; return a; }
bool kdu_codestream_comment::put_text(const char*) { return false; }
void kdu_customize_warnings(kdu_message*) { }
void kdu_customize_errors(kdu_message*) { }
void kdu_convert_ycc_to_rgb(kdu_line_buf&, kdu_line_buf&, kdu_line_buf&, int) { }
kdu_long kdu_multi_analysis::create(kdu_codestream, kdu_tile, bool, kdu_roi_image*, bool, int, kdu_thread_env*, kdu_thread_queue*, bool ) { kdu_long a = 0; return a; }
siz_params::siz_params() : kdu_params(NULL, false, false, false, false, false) { }
void siz_params::finalize(bool ) { }
void siz_params::copy_with_xforms(kdu_params*, int, int, bool, bool, bool) { }
int siz_params::write_marker_segment(kdu_output*, kdu_params*, int) { return 0; }
bool siz_params::check_marker_segment(kdu_uint16, int, kdu_byte a[], int&) { return false; }
bool siz_params::read_marker_segment(kdu_uint16, int, kdu_byte a[], int) { return false; }
// -------------------------------------------------------------------------------------------
// TUT
// -------------------------------------------------------------------------------------------
namespace tut
{
// Test wrapper declarations
struct llimagej2ckdu_test
{
// Derived test class
class LLTestImageJ2CKDU : public LLImageJ2CKDU
{
public:
// Provides public access to some protected methods for testing
BOOL callGetMetadata(LLImageJ2C &base) { return getMetadata(base); }
BOOL callDecodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count)
{
return decodeImpl(base, raw_image, decode_time, first_channel, max_channel_count);
}
BOOL callEncodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, const char* comment_text)
{
return encodeImpl(base, raw_image, comment_text);
}
};
// Instance to be tested
LLTestImageJ2CKDU* mImage;
// Constructor and destructor of the test wrapper
llimagej2ckdu_test()
{
mImage = new LLTestImageJ2CKDU;
}
~llimagej2ckdu_test()
{
delete mImage;
}
};
// Tut templating thingamagic: test group, object and test instance
typedef test_group<llimagej2ckdu_test> llimagej2ckdu_t;
typedef llimagej2ckdu_t::object llimagej2ckdu_object_t;
tut::llimagej2ckdu_t tut_llimagej2ckdu("LLImageJ2CKDU");
// ---------------------------------------------------------------------------------------
// Test functions
// Notes:
// * Test as many as you possibly can without requiring a full blown simulation of everything
// * The tests are executed in sequence so the test instance state may change between calls
// * Remember that you cannot test private methods with tut
// ---------------------------------------------------------------------------------------
// Test 1 : test getMetadata()
template<> template<>
void llimagej2ckdu_object_t::test<1>()
{
LLImageJ2C* image = new LLImageJ2C();
BOOL res = mImage->callGetMetadata(*image);
// Trying to set up a data stream with all NIL values and stubbed KDU will "work" and return TRUE
// Note that is linking with KDU, that call will throw an exception and fail, returning FALSE
ensure("getMetadata() test failed", res == TRUE);
}
// Test 2 : test decodeImpl()
template<> template<>
void llimagej2ckdu_object_t::test<2>()
{
LLImageJ2C* image = new LLImageJ2C();
LLImageRaw* raw = new LLImageRaw();
BOOL res = mImage->callDecodeImpl(*image, *raw, 0.0, 0, 0);
// Decoding returns TRUE whenever there's nothing else to do, including if decoding failed, so we'll get TRUE here
ensure("decodeImpl() test failed", res == TRUE);
}
// Test 3 : test encodeImpl()
template<> template<>
void llimagej2ckdu_object_t::test<3>()
{
LLImageJ2C* image = new LLImageJ2C();
LLImageRaw* raw = new LLImageRaw();
BOOL res = mImage->callEncodeImpl(*image, *raw, NULL);
// Encoding returns TRUE unless an exception was raised, so we'll get TRUE here though nothing really was done
ensure("encodeImpl() test failed", res == TRUE);
}
}

View File

@ -280,7 +280,6 @@ namespace tut
llmat_obj.setRows(llvec1, llvec2, llvec3);
llmat_obj.orthogonalize();
skip("Grr, LLMatrix3::orthogonalize test is failing. Has it ever worked?");
ensure("LLMatrix3::orthogonalize failed ",
is_approx_equal(0.19611613f, llmat_obj.mMatrix[0][0]) &&
is_approx_equal(0.78446454f, llmat_obj.mMatrix[0][1]) &&

View File

@ -513,6 +513,10 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL
}
//
// *NOTE: Logic here is replicated in LLViewerAssetStorage::_queueDataRequest.
// Changes here may need to be replicated in the viewer's derived class.
//
void LLAssetStorage::_queueDataRequest(const LLUUID& uuid, LLAssetType::EType atype,
LLGetAssetCallback callback,
void *user_data, BOOL duplicate,

View File

@ -235,27 +235,21 @@ public:
/*virtual*/ void error(U32 status, const std::string& reason)
{
// We're going to construct a dummy record and cache it for a while,
// either briefly for a 503 Service Unavailable, or longer for other
// errors.
F64 retry_timestamp = errorRetryTimestamp(status);
// If there's an error, it might be caused by PeopleApi,
// or when loading textures on startup and using a very slow
// network, this query may time out. Fallback to the legacy
// cache.
// *NOTE: "??" starts trigraphs in C/C++, escape the question marks.
const std::string DUMMY_NAME("\?\?\?");
LLAvatarName av_name;
av_name.mUsername = DUMMY_NAME;
av_name.mDisplayName = DUMMY_NAME;
av_name.mIsDisplayNameDefault = false;
av_name.mIsDummy = true;
av_name.mExpires = retry_timestamp;
llwarns << "LLAvatarNameResponder error " << status << " " << reason << llendl;
// Add dummy records for all agent IDs in this request
std::vector<LLUUID>::const_iterator it = mAgentIDs.begin();
for ( ; it != mAgentIDs.end(); ++it)
{
const LLUUID& agent_id = *it;
// cache it and fire signals
LLAvatarNameCache::processName(agent_id, av_name, true);
gCacheName->get(agent_id, false, // legacy compatibility
boost::bind(&LLAvatarNameCache::legacyNameCallback,
_1, _2, _3));
}
}
@ -357,7 +351,7 @@ void LLAvatarNameCache::requestNamesViaCapability()
if (url.size() > NAME_URL_SEND_THRESHOLD)
{
//llinfos << "requestNames " << url << llendl;
LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));
LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));//, LLSD(), 10.0f);
url.clear();
agent_ids.clear();
}
@ -366,7 +360,7 @@ void LLAvatarNameCache::requestNamesViaCapability()
if (!url.empty())
{
//llinfos << "requestNames " << url << llendl;
LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));
LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));//, LLSD(), 10.0f);
url.clear();
agent_ids.clear();
}

View File

@ -20,6 +20,7 @@ include_directories(
${LLRENDER_INCLUDE_DIRS}
${LLXML_INCLUDE_DIRS}
${LLWINDOW_INCLUDE_DIRS}
${LLQTWEBKIT_INCLUDE_DIR}
)
set(llplugin_SOURCE_FILES

View File

@ -160,7 +160,7 @@ void LLPluginClassMedia::idle(void)
mPlugin->idle();
}
if((mMediaWidth == -1) || (!mTextureParamsReceived) || (mPlugin == NULL) || (mPlugin->isBlocked()))
if((mMediaWidth == -1) || (!mTextureParamsReceived) || (mPlugin == NULL) || (mPlugin->isBlocked()) || (mOwner == NULL))
{
// Can't process a size change at this time
}
@ -522,7 +522,15 @@ bool LLPluginClassMedia::keyEvent(EKeyEventType type, int key_code, MASK modifie
}
break;
}
#if LL_DARWIN
if(modifiers & MASK_ALT)
{
// Option-key modified characters should be handled by the unicode input path instead of this one.
result = false;
}
#endif
if(result)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "key_event");
@ -674,7 +682,21 @@ void LLPluginClassMedia::sendPickFileResponse(const std::string &file)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "pick_file_response");
message.setValue("file", file);
if(mPlugin->isBlocked())
if(mPlugin && mPlugin->isBlocked())
{
// If the plugin sent a blocking pick-file request, the response should unblock it.
message.setValueBoolean("blocking_response", true);
}
sendMessage(message);
}
void LLPluginClassMedia::sendAuthResponse(bool ok, const std::string &username, const std::string &password)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "auth_response");
message.setValueBoolean("ok", ok);
message.setValue("username", username);
message.setValue("password", password);
if(mPlugin && mPlugin->isBlocked())
{
// If the plugin sent a blocking pick-file request, the response should unblock it.
message.setValueBoolean("blocking_response", true);
@ -947,6 +969,12 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
{
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_PICK_FILE_REQUEST);
}
else if(message_name == "auth_request")
{
mAuthURL = message.getValue("url");
mAuthRealm = message.getValue("realm");
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_AUTH_REQUEST);
}
else
{
LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL;
@ -1019,6 +1047,15 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_GEOMETRY_CHANGE);
}
else if(message_name == "link_hovered")
{
// text is not currently used -- the tooltip hover text is taken from the "title".
mHoverLink = message.getValue("link");
mHoverText = message.getValue("title");
// message.getValue("text");
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_LINK_HOVERED);
}
else
{
LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL;
@ -1192,6 +1229,20 @@ void LLPluginClassMedia::proxyWindowClosed(const std::string &uuid)
sendMessage(message);
}
void LLPluginClassMedia::ignore_ssl_cert_errors(bool ignore)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "ignore_ssl_cert_errors");
message.setValueBoolean("ignore", ignore);
sendMessage(message);
}
void LLPluginClassMedia::addCertificateFilePath(const std::string& path)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "add_certificate_file_path");
message.setValue("path", path);
sendMessage(message);
}
void LLPluginClassMedia::crashPlugin()
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "crash");

View File

@ -85,6 +85,8 @@ public:
void setBackgroundColor(LLColor4 color) { mBackgroundColor = color; };
void setOwner(LLPluginClassMediaOwner *owner) { mOwner = owner; };
// Returns true if all of the texture parameters (depth, format, size, and texture size) are set up and consistent.
// This will initially be false, and will also be false for some time after setSize while the resize is processed.
// Note that if this returns true, it is safe to use all the get() functions above without checking for invalid return values
@ -159,6 +161,8 @@ public:
void sendPickFileResponse(const std::string &file);
void sendAuthResponse(bool ok, const std::string &username, const std::string &password);
// Valid after a MEDIA_EVENT_CURSOR_CHANGED event
std::string getCursorName() const { return mCursorName; };
@ -198,6 +202,8 @@ public:
void setBrowserUserAgent(const std::string& user_agent);
void proxyWindowOpened(const std::string &target, const std::string &uuid);
void proxyWindowClosed(const std::string &uuid);
void ignore_ssl_cert_errors(bool ignore);
void addCertificateFilePath(const std::string& path);
// This is valid after MEDIA_EVENT_NAVIGATE_BEGIN or MEDIA_EVENT_NAVIGATE_COMPLETE
std::string getNavigateURI() const { return mNavigateURI; };
@ -231,7 +237,15 @@ public:
S32 getGeometryY() const { return mGeometryY; };
S32 getGeometryWidth() const { return mGeometryWidth; };
S32 getGeometryHeight() const { return mGeometryHeight; };
// These are valid during MEDIA_EVENT_AUTH_REQUEST
std::string getAuthURL() const { return mAuthURL; };
std::string getAuthRealm() const { return mAuthRealm; };
// These are valid during MEDIA_EVENT_LINK_HOVERED
std::string getHoverText() const { return mHoverText; };
std::string getHoverLink() const { return mHoverLink; };
std::string getMediaName() const { return mMediaName; };
std::string getMediaDescription() const { return mMediaDescription; };
@ -369,6 +383,10 @@ protected:
S32 mGeometryY;
S32 mGeometryWidth;
S32 mGeometryHeight;
std::string mAuthURL;
std::string mAuthRealm;
std::string mHoverText;
std::string mHoverLink;
/////////////////////////////////////////
// media_time class

View File

@ -59,7 +59,11 @@ public:
MEDIA_EVENT_GEOMETRY_CHANGE, // The plugin requested its window geometry be changed (per the javascript window interface)
MEDIA_EVENT_PLUGIN_FAILED_LAUNCH, // The plugin failed to launch
MEDIA_EVENT_PLUGIN_FAILED // The plugin died unexpectedly
MEDIA_EVENT_PLUGIN_FAILED, // The plugin died unexpectedly
MEDIA_EVENT_AUTH_REQUEST, // The plugin wants to display an auth dialog
MEDIA_EVENT_LINK_HOVERED // Got a "link hovered" event from the plugin
} EMediaEvent;

View File

@ -111,6 +111,7 @@ set(llui_SOURCE_FILES
llviewmodel.cpp
llview.cpp
llviewquery.cpp
llwindowshade.cpp
)
set(llui_HEADER_FILES
@ -159,6 +160,7 @@ set(llui_HEADER_FILES
llnotificationslistener.h
llnotificationsutil.h
llnotificationtemplate.h
llnotificationvisibilityrule.h
llpanel.h
llprogressbar.h
llradiogroup.h
@ -209,6 +211,7 @@ set(llui_HEADER_FILES
llviewmodel.h
llview.h
llviewquery.h
llwindowshade.h
)
set_source_files_properties(${llui_HEADER_FILES}

View File

@ -88,27 +88,19 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p)
tbparams.font(p.font);
}
mLabel = LLUICtrlFactory::create<LLTextBox> (tbparams);
mLabel->reshapeToFitText();
addChild(mLabel);
S32 text_width = mLabel->getTextBoundingRect().getWidth();
S32 text_height = llround(mFont->getLineHeight());
LLRect label_rect;
label_rect.setOriginAndSize(
llcheckboxctrl_hpad + llcheckboxctrl_btn_size + llcheckboxctrl_spacing,
llcheckboxctrl_vpad + 1, // padding to get better alignment
text_width + llcheckboxctrl_hpad,
text_height );
mLabel->setShape(label_rect);
LLRect label_rect = mLabel->getRect();
// Button
// Note: button cover the label by extending all the way to the right.
LLRect btn_rect;
LLRect btn_rect = p.check_button.rect();
btn_rect.setOriginAndSize(
llcheckboxctrl_hpad,
llcheckboxctrl_vpad,
llcheckboxctrl_btn_size + llcheckboxctrl_spacing + text_width + llcheckboxctrl_hpad,
llmax( text_height, llcheckboxctrl_btn_size() ) + llcheckboxctrl_vpad);
btn_rect.mLeft,
btn_rect.mBottom,
llmax(btn_rect.mRight, label_rect.mRight - btn_rect.mLeft),
llmax( label_rect.getHeight(), btn_rect.mTop));
std::string active_true_id, active_false_id;
std::string inactive_true_id, inactive_false_id;
@ -174,31 +166,20 @@ void LLCheckBoxCtrl::clear()
void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
{
//stretch or shrink bounding rectangle of label when rebuilding UI at new scale
static LLUICachedControl<S32> llcheckboxctrl_spacing ("UICheckboxctrlSpacing", 0);
static LLUICachedControl<S32> llcheckboxctrl_hpad ("UICheckboxctrlHPad", 0);
static LLUICachedControl<S32> llcheckboxctrl_vpad ("UICheckboxctrlVPad", 0);
static LLUICachedControl<S32> llcheckboxctrl_btn_size ("UICheckboxctrlBtnSize", 0);
S32 text_width = mLabel->getTextBoundingRect().getWidth();
S32 text_height = llround(mFont->getLineHeight());
LLRect label_rect;
label_rect.setOriginAndSize(
llcheckboxctrl_hpad + llcheckboxctrl_btn_size + llcheckboxctrl_spacing,
llcheckboxctrl_vpad,
text_width,
text_height );
mLabel->setShape(label_rect);
mLabel->reshapeToFitText();
LLRect btn_rect;
LLRect label_rect = mLabel->getRect();
// Button
// Note: button cover the label by extending all the way to the right.
LLRect btn_rect = mButton->getRect();
btn_rect.setOriginAndSize(
llcheckboxctrl_hpad,
llcheckboxctrl_vpad,
llcheckboxctrl_btn_size + llcheckboxctrl_spacing + text_width,
llmax( text_height, llcheckboxctrl_btn_size() ) );
mButton->setShape( btn_rect );
LLUICtrl::reshape(width, height, called_from_parent);
btn_rect.mLeft,
btn_rect.mBottom,
llmax(btn_rect.getWidth(), label_rect.mRight - btn_rect.mLeft),
llmax(label_rect.mTop - btn_rect.mBottom, btn_rect.getHeight()));
mButton->setShape(btn_rect);
}
//virtual

View File

@ -770,7 +770,8 @@ BOOL LLComboBox::handleKeyHere(KEY key, MASK mask)
return FALSE;
}
// if selection has changed, pop open list
else if ((mList->getLastSelectedItem() != last_selected_item) || (key == KEY_DOWN) || (key == KEY_UP))
else if (mList->getLastSelectedItem() != last_selected_item ||
(key == KEY_DOWN || key == KEY_UP) && !mList->isEmpty())
{
showList();
}

View File

@ -1,4 +1,5 @@
/**
* @file llfloater.cpp
* @brief LLFloater base class
*
@ -1189,7 +1190,7 @@ void LLFloater::setFocus( BOOL b )
last_focus->setFocus(TRUE);
}
}
updateTransparency(this, b ? TT_ACTIVE : TT_INACTIVE);
updateTransparency(b ? TT_ACTIVE : TT_INACTIVE);
}
// virtual
@ -1462,6 +1463,9 @@ void LLFloater::setFrontmost(BOOL take_focus)
// there are more than one floater view
// so we need to query our parent directly
((LLFloaterView*)getParent())->bringToFront(this, take_focus);
// Make sure to set the appropriate transparency type (STORM-732).
updateTransparency(hasFocus() || getIsChrome() ? TT_ACTIVE : TT_INACTIVE);
}
}
@ -2906,7 +2910,9 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str
params.from_xui = true;
applyXUILayout(params, parent);
initFromParams(params);
// chrome floaters don't take focus at all
setFocusRoot(!getIsChrome());
initFloater(params);
LLMultiFloater* last_host = LLFloater::getFloaterHost();

View File

@ -61,13 +61,6 @@ public:
return *this;
}
template<typename Subclass>
LLHandle<T>& operator =(const LLHandle<Subclass>& other)
{
mTombStone = other.mTombStone;
return *this;
}
bool isDead() const
{
return mTombStone->getTarget() == NULL;
@ -99,7 +92,6 @@ public:
{
return lhs.mTombStone > rhs.mTombStone;
}
protected:
protected:
LLPointer<LLTombStone<T> > mTombStone;

View File

@ -38,6 +38,12 @@
static LLDefaultChildRegistry::Register<LLLayoutStack> register_layout_stack("layout_stack");
static LLLayoutStack::LayoutStackRegistry::Register<LLLayoutPanel> register_layout_panel("layout_panel");
void LLLayoutStack::OrientationNames::declareValues()
{
declare("horizontal", HORIZONTAL);
declare("vertical", VERTICAL);
}
//
// LLLayoutPanel
//
@ -47,47 +53,47 @@ LLLayoutPanel::LLLayoutPanel(const Params& p)
mMaxDim(p.max_dim),
mAutoResize(p.auto_resize),
mUserResize(p.user_resize),
mCollapsed(FALSE),
mCollapseAmt(0.f),
mVisibleAmt(1.f), // default to fully visible
mResizeBar(NULL)
{
mCollapsed(FALSE),
mCollapseAmt(0.f),
mVisibleAmt(1.f), // default to fully visible
mResizeBar(NULL)
{
// panels initialized as hidden should not start out partially visible
if (!getVisible())
{
{
mVisibleAmt = 0.f;
}
}
}
}
void LLLayoutPanel::initFromParams(const Params& p)
{
{
LLPanel::initFromParams(p);
setFollowsNone();
}
}
LLLayoutPanel::~LLLayoutPanel()
{
// probably not necessary, but...
delete mResizeBar;
mResizeBar = NULL;
}
{
// probably not necessary, but...
delete mResizeBar;
mResizeBar = NULL;
}
F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation)
{
{
if (orientation == LLLayoutStack::HORIZONTAL)
{
F32 collapse_amt =
clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)mMinDim / (F32)llmax(1, getRect().getWidth()));
return mVisibleAmt * collapse_amt;
}
else
{
F32 collapse_amt =
clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)mMinDim / (F32)llmax(1, getRect().getWidth()));
return mVisibleAmt * collapse_amt;
}
else
{
F32 collapse_amt =
clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, (F32)mMinDim / (F32)llmax(1, getRect().getHeight())));
return mVisibleAmt * collapse_amt;
}
}
}
//
// LLLayoutStack
@ -97,6 +103,8 @@ LLLayoutStack::Params::Params()
: orientation("orientation"),
animate("animate", true),
clip("clip", true),
open_time_constant("open_time_constant", 0.02f),
close_time_constant("close_time_constant", 0.03f),
border_size("border_size", LLCachedControl<S32>(*LLUI::sSettingGroups["config"], "UIResizeBarHeight", 0))
{
name="stack";
@ -107,10 +115,12 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p)
mMinWidth(0),
mMinHeight(0),
mPanelSpacing(p.border_size),
mOrientation((p.orientation() == "vertical") ? VERTICAL : HORIZONTAL),
mOrientation(p.orientation),
mAnimate(p.animate),
mAnimatedThisFrame(false),
mClip(p.clip)
mClip(p.clip),
mOpenTimeConstant(p.open_time_constant),
mCloseTimeConstant(p.close_time_constant)
{}
LLLayoutStack::~LLLayoutStack()
@ -303,9 +313,6 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
S32 total_width = 0;
S32 total_height = 0;
const F32 ANIM_OPEN_TIME = 0.02f;
const F32 ANIM_CLOSE_TIME = 0.03f;
e_panel_list_t::iterator panel_it;
for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
{
@ -316,7 +323,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
{
if (!mAnimatedThisFrame)
{
(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(ANIM_OPEN_TIME));
(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(mOpenTimeConstant));
if ((*panel_it)->mVisibleAmt > 0.99f)
{
(*panel_it)->mVisibleAmt = 1.f;
@ -334,7 +341,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
{
if (!mAnimatedThisFrame)
{
(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(ANIM_CLOSE_TIME));
(*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
if ((*panel_it)->mVisibleAmt < 0.001f)
{
(*panel_it)->mVisibleAmt = 0.f;
@ -349,11 +356,11 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
if ((*panel_it)->mCollapsed)
{
(*panel_it)->mCollapseAmt = lerp((*panel_it)->mCollapseAmt, 1.f, LLCriticalDamp::getInterpolant(ANIM_CLOSE_TIME));
(*panel_it)->mCollapseAmt = lerp((*panel_it)->mCollapseAmt, 1.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
}
else
{
(*panel_it)->mCollapseAmt = lerp((*panel_it)->mCollapseAmt, 0.f, LLCriticalDamp::getInterpolant(ANIM_CLOSE_TIME));
(*panel_it)->mCollapseAmt = lerp((*panel_it)->mCollapseAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
}
if (mOrientation == HORIZONTAL)

View File

@ -37,27 +37,35 @@ class LLLayoutPanel;
class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
{
public:
struct LayoutStackRegistry : public LLChildRegistry<LayoutStackRegistry>
{};
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
Mandatory<std::string> orientation;
Optional<S32> border_size;
Optional<bool> animate,
clip;
Params();
};
typedef LayoutStackRegistry child_registry_t;
typedef enum e_layout_orientation
{
HORIZONTAL,
VERTICAL
} ELayoutOrientation;
struct OrientationNames
: public LLInitParam::TypeValuesHelper<ELayoutOrientation, OrientationNames>
{
static void declareValues();
};
struct LayoutStackRegistry : public LLChildRegistry<LayoutStackRegistry>
{};
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
Mandatory<ELayoutOrientation, OrientationNames> orientation;
Optional<S32> border_size;
Optional<bool> animate,
clip;
Optional<F32> open_time_constant,
close_time_constant;
Params();
};
typedef LayoutStackRegistry child_registry_t;
virtual ~LLLayoutStack();
/*virtual*/ void draw();
@ -137,6 +145,8 @@ private:
bool mAnimatedThisFrame;
bool mAnimate;
bool mClip;
F32 mOpenTimeConstant;
F32 mCloseTimeConstant;
}; // end class LLLayoutStack
class LLLayoutPanel : public LLPanel
@ -167,6 +177,9 @@ public:
~LLLayoutPanel();
void initFromParams(const Params& p);
void setMinDim(S32 value) { mMinDim = value; }
void setMaxDim(S32 value) { mMaxDim = value; }
protected:
LLLayoutPanel(const Params& p) ;

View File

@ -88,6 +88,7 @@ LLLineEditor::Params::Params()
revert_on_esc("revert_on_esc", true),
commit_on_focus_lost("commit_on_focus_lost", true),
ignore_tab("ignore_tab", true),
is_password("is_password", false),
cursor_color("cursor_color"),
text_color("text_color"),
text_readonly_color("text_readonly_color"),
@ -129,7 +130,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
mBorderThickness( 0 ),
mIgnoreArrowKeys( FALSE ),
mIgnoreTab( p.ignore_tab ),
mDrawAsterixes( FALSE ),
mDrawAsterixes( p.is_password ),
mSelectAllonFocusReceived( p.select_on_focus ),
mPassDelete(FALSE),
mReadOnly(FALSE),
@ -1529,6 +1530,8 @@ void LLLineEditor::drawBackground()
{
image = mBgImage;
}
if (!image) return;
F32 alpha = getCurrentTransparency();

View File

@ -85,7 +85,8 @@ public:
Optional<bool> select_on_focus,
revert_on_esc,
commit_on_focus_lost,
ignore_tab;
ignore_tab,
is_password;
// colors
Optional<LLUIColor> cursor_color,
@ -336,7 +337,7 @@ protected:
std::vector<S32> mPreeditPositions;
LLPreeditor::standouts_t mPreeditStandouts;
LLHandle<LLView> mContextMenuHandle;
LLHandle<LLContextMenu> mContextMenuHandle;
private:
// Instances that by default point to the statics but can be overidden in XML.

View File

@ -1462,7 +1462,7 @@ BOOL LLMenuItemBranchDownGL::handleAcceleratorKey(KEY key, MASK mask)
{
BOOL branch_visible = getBranch()->getVisible();
BOOL handled = getBranch()->handleAcceleratorKey(key, mask);
if (handled && !branch_visible && getVisible())
if (handled && !branch_visible && isInVisibleChain())
{
// flash this menu entry because we triggered an invisible menu item
LLMenuHolderGL::setActivatedItem(this);
@ -2611,6 +2611,7 @@ LLMenuItemGL* LLMenuGL::getHighlightedItem()
LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disabled)
{
if (mItems.empty()) return NULL;
// highlighting first item on a torn off menu is the
// same as giving focus to it
if (!cur_item && getTornOff())
@ -2711,6 +2712,8 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa
LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disabled)
{
if (mItems.empty()) return NULL;
// highlighting first item on a torn off menu is the
// same as giving focus to it
if (!cur_item && getTornOff())
@ -3045,6 +3048,11 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
const S32 CURSOR_HEIGHT = 22; // Approximate "normal" cursor size
const S32 CURSOR_WIDTH = 12;
if(menu->getChildList()->empty())
{
return;
}
// Save click point for detecting cursor moves before mouse-up.
// Must be in local coords to compare with mouseUp events.
// If the mouse doesn't move, the menu will stay open ala the Mac.
@ -3125,7 +3133,10 @@ BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask)
mAltKeyTrigger = FALSE;
}
if(!result && (key == KEY_F10 && mask == MASK_CONTROL) && !gKeyboard->getKeyRepeated(key))
if(!result
&& (key == KEY_F10 && mask == MASK_CONTROL)
&& !gKeyboard->getKeyRepeated(key)
&& isInVisibleChain())
{
if (getHighlightedItem())
{
@ -3508,8 +3519,10 @@ BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent)
else
{
//highlight first enabled one
pMenu->highlightNextItem(NULL);
handled = true;
if(pMenu->highlightNextItem(NULL))
{
handled = true;
}
}
}
}
@ -3742,9 +3755,7 @@ public:
LLContextMenuBranch(const Params&);
virtual ~LLContextMenuBranch()
{
delete mBranch;
}
{}
// called to rebuild the draw label
virtual void buildDrawLabel( void );
@ -3752,21 +3763,21 @@ public:
// onCommit() - do the primary funcationality of the menu item.
virtual void onCommit( void );
LLContextMenu* getBranch() { return mBranch; }
LLContextMenu* getBranch() { return mBranch.get(); }
void setHighlight( BOOL highlight );
protected:
void showSubMenu();
LLContextMenu* mBranch;
LLHandle<LLContextMenu> mBranch;
};
LLContextMenuBranch::LLContextMenuBranch(const LLContextMenuBranch::Params& p)
: LLMenuItemGL(p),
mBranch( p.branch )
mBranch( p.branch()->getHandle() )
{
mBranch->hide();
mBranch->setParentMenuItem(this);
mBranch.get()->hide();
mBranch.get()->setParentMenuItem(this);
}
// called to rebuild the draw label
@ -3775,12 +3786,12 @@ void LLContextMenuBranch::buildDrawLabel( void )
{
// default enablement is this -- if any of the subitems are
// enabled, this item is enabled. JC
U32 sub_count = mBranch->getItemCount();
U32 sub_count = mBranch.get()->getItemCount();
U32 i;
BOOL any_enabled = FALSE;
for (i = 0; i < sub_count; i++)
{
LLMenuItemGL* item = mBranch->getItem(i);
LLMenuItemGL* item = mBranch.get()->getItem(i);
item->buildDrawLabel();
if (item->getEnabled() && !item->getDrawTextDisabled() )
{
@ -3802,13 +3813,13 @@ void LLContextMenuBranch::buildDrawLabel( void )
void LLContextMenuBranch::showSubMenu()
{
LLMenuItemGL* menu_item = mBranch->getParentMenuItem();
LLMenuItemGL* menu_item = mBranch.get()->getParentMenuItem();
if (menu_item != NULL && menu_item->getVisible())
{
S32 center_x;
S32 center_y;
localPointToScreen(getRect().getWidth(), getRect().getHeight() , &center_x, &center_y);
mBranch->show(center_x, center_y);
mBranch.get()->show(center_x, center_y);
}
}
@ -3828,7 +3839,7 @@ void LLContextMenuBranch::setHighlight( BOOL highlight )
}
else
{
mBranch->hide();
mBranch.get()->hide();
}
}
@ -3859,6 +3870,11 @@ void LLContextMenu::setVisible(BOOL visible)
// Takes cursor position in screen space?
void LLContextMenu::show(S32 x, S32 y)
{
if (getChildList()->empty())
{
// nothing to show, so abort
return;
}
// Save click point for detecting cursor moves before mouse-up.
// Must be in local coords to compare with mouseUp events.
// If the mouse doesn't move, the menu will stay open ala the Mac.

View File

@ -678,9 +678,12 @@ public:
BOOL appendContextSubMenu(LLContextMenu *menu);
LLHandle<LLContextMenu> getHandle() { mHandle.bind(this); return mHandle; }
protected:
BOOL mHoveredAnyItem;
LLMenuItemGL* mHoverItem;
BOOL mHoveredAnyItem;
LLMenuItemGL* mHoverItem;
LLRootHandle<LLContextMenu> mHandle;
};

View File

@ -28,6 +28,7 @@
#include "llnotifications.h"
#include "llnotificationtemplate.h"
#include "llnotificationvisibilityrule.h"
#include "llavatarnamecache.h"
#include "llinstantmessage.h"
@ -81,6 +82,7 @@ LLNotificationForm::FormButton::FormButton()
LLNotificationForm::FormInput::FormInput()
: type("type"),
text("text"),
max_length_chars("max_length_chars"),
width("width", 0),
value("value")
@ -137,12 +139,6 @@ private:
bool filterIgnoredNotifications(LLNotificationPtr notification)
{
// filter everything if we are to ignore ALL
if(LLNotifications::instance().getIgnoreAllNotifications())
{
return false;
}
LLNotificationFormPtr form = notification->getForm();
// Check to see if the user wants to ignore this alert
return !notification->getForm()->getIgnored();
@ -177,6 +173,28 @@ bool handleIgnoredNotification(const LLSD& payload)
return false;
}
bool defaultResponse(const LLSD& payload)
{
if (payload["sigtype"].asString() == "add")
{
LLNotificationPtr pNotif = LLNotifications::instance().find(payload["id"].asUUID());
if (pNotif)
{
// supply default response
pNotif->respond(pNotif->getResponseTemplate(LLNotification::WITH_DEFAULT_BUTTON));
}
}
return false;
}
bool visibilityRuleMached(const LLSD& payload)
{
// This is needed because LLNotifications::isVisibleByRules may have cancelled the notification.
// Returning true here makes LLNotificationChannelBase::updateItem do an early out, which prevents things from happening in the wrong order.
return true;
}
namespace LLNotificationFilters
{
// a sample filter
@ -404,12 +422,49 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par
it != end_it;
++it)
{
mUniqueContext.push_back(it->key);
mUniqueContext.push_back(it->value);
}
lldebugs << "notification \"" << mName << "\": tag count is " << p.tags.size() << llendl;
for(LLInitParam::ParamIterator<LLNotificationTemplate::Tag>::const_iterator it = p.tags.begin(),
end_it = p.tags.end();
it != end_it;
++it)
{
lldebugs << " tag \"" << std::string(it->value) << "\"" << llendl;
mTags.push_back(it->value);
}
mForm = LLNotificationFormPtr(new LLNotificationForm(p.name, p.form_ref.form));
}
LLNotificationVisibilityRule::LLNotificationVisibilityRule(const LLNotificationVisibilityRule::Rule &p)
{
if (p.show.isChosen())
{
mType = p.show.type;
mTag = p.show.tag;
mName = p.show.name;
mVisible = true;
}
else if (p.hide.isChosen())
{
mType = p.hide.type;
mTag = p.hide.tag;
mName = p.hide.name;
mVisible = false;
}
else if (p.respond.isChosen())
{
mType = p.respond.type;
mTag = p.respond.tag;
mName = p.respond.name;
mVisible = false;
mResponse = p.respond.response;
}
}
LLNotification::LLNotification(const LLNotification::Params& p) :
mTimestamp(p.time_stamp),
mSubstitutions(p.substitutions),
@ -679,6 +734,25 @@ bool LLNotification::hasUniquenessConstraints() const
return (mTemplatep ? mTemplatep->mUnique : false);
}
bool LLNotification::matchesTag(const std::string& tag)
{
bool result = false;
if(mTemplatep)
{
std::list<std::string>::iterator it;
for(it = mTemplatep->mTags.begin(); it != mTemplatep->mTags.end(); it++)
{
if((*it) == tag)
{
result = true;
break;
}
}
}
return result;
}
void LLNotification::setIgnored(bool ignore)
{
@ -719,13 +793,19 @@ bool LLNotification::isEquivalentTo(LLNotificationPtr that) const
{
const LLSD& these_substitutions = this->getSubstitutions();
const LLSD& those_substitutions = that->getSubstitutions();
const LLSD& this_payload = this->getPayload();
const LLSD& that_payload = that->getPayload();
// highlander bit sez there can only be one of these
for (std::vector<std::string>::const_iterator it = mTemplatep->mUniqueContext.begin(), end_it = mTemplatep->mUniqueContext.end();
it != end_it;
++it)
{
if (these_substitutions.get(*it).asString() != those_substitutions.get(*it).asString())
// if templates differ in either substitution strings or payload with the given field name
// then they are considered inequivalent
// use of get() avoids converting the LLSD value to a map as the [] operator would
if (these_substitutions.get(*it).asString() != those_substitutions.get(*it).asString()
|| this_payload.get(*it).asString() != that_payload.get(*it).asString())
{
return false;
}
@ -1064,12 +1144,12 @@ std::string LLNotificationChannel::summarize()
// LLNotifications implementation
// ---
LLNotifications::LLNotifications() : LLNotificationChannelBase(LLNotificationFilters::includeEverything,
LLNotificationComparators::orderByUUID()),
mIgnoreAllNotifications(false)
LLNotificationComparators::orderByUUID()),
mIgnoreAllNotifications(false)
{
LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Notification.Show", boost::bind(&LLNotifications::addFromCallback, this, _2));
mListener.reset(new LLNotificationsListener(*this));
mListener.reset(new LLNotificationsListener(*this));
}
@ -1184,6 +1264,7 @@ LLNotificationChannelPtr LLNotifications::getChannel(const std::string& channelN
void LLNotifications::initSingleton()
{
loadTemplates();
loadVisibilityRules();
createDefaultChannels();
}
@ -1191,15 +1272,19 @@ void LLNotifications::createDefaultChannels()
{
// now construct the various channels AFTER loading the notifications,
// because the history channel is going to rewrite the stored notifications file
LLNotificationChannel::buildChannel("Expiration", "",
LLNotificationChannel::buildChannel("Enabled", "",
!boost::bind(&LLNotifications::getIgnoreAllNotifications, this));
LLNotificationChannel::buildChannel("Expiration", "Enabled",
boost::bind(&LLNotifications::expirationFilter, this, _1));
LLNotificationChannel::buildChannel("Unexpired", "",
LLNotificationChannel::buildChannel("Unexpired", "Enabled",
!boost::bind(&LLNotifications::expirationFilter, this, _1)); // use negated bind
LLNotificationChannel::buildChannel("Unique", "Unexpired",
boost::bind(&LLNotifications::uniqueFilter, this, _1));
LLNotificationChannel::buildChannel("Ignore", "Unique",
filterIgnoredNotifications);
LLNotificationChannel::buildChannel("Visible", "Ignore",
LLNotificationChannel::buildChannel("VisibilityRules", "Ignore",
boost::bind(&LLNotifications::isVisibleByRules, this, _1));
LLNotificationChannel::buildChannel("Visible", "VisibilityRules",
&LLNotificationFilters::includeEverything);
// create special persistent notification channel
@ -1207,6 +1292,8 @@ void LLNotifications::createDefaultChannels()
new LLPersistentNotificationChannel();
// connect action methods to these channels
LLNotifications::instance().getChannel("Enabled")->
connectFailedFilter(&defaultResponse);
LLNotifications::instance().getChannel("Expiration")->
connectChanged(boost::bind(&LLNotifications::expirationHandler, this, _1));
// uniqueHandler slot should be added as first slot of the signal due to
@ -1218,6 +1305,8 @@ void LLNotifications::createDefaultChannels()
// connectFailedFilter(boost::bind(&LLNotifications::failedUniquenessTest, this, _1));
LLNotifications::instance().getChannel("Ignore")->
connectFailedFilter(&handleIgnoredNotification);
LLNotifications::instance().getChannel("VisibilityRules")->
connectFailedFilter(&visibilityRuleMached);
}
bool LLNotifications::addTemplate(const std::string &name,
@ -1347,6 +1436,12 @@ bool LLNotifications::loadTemplates()
LLXUIParser parser;
parser.readXUI(root, params, full_filename);
if(!params.validateBlock())
{
llerrs << "Problem reading UI Notifications file: " << full_filename << llendl;
return false;
}
mTemplates.clear();
for(LLInitParam::ParamIterator<LLNotificationTemplate::GlobalString>::const_iterator it = params.strings.begin(), end_it = params.strings.end();
@ -1396,6 +1491,34 @@ bool LLNotifications::loadTemplates()
return true;
}
bool LLNotifications::loadVisibilityRules()
{
const std::string xml_filename = "notification_visibility.xml";
std::string full_filename = gDirUtilp->findSkinnedFilename(LLUI::getXUIPaths().front(), xml_filename);
LLNotificationVisibilityRule::Rules params;
LLSimpleXUIParser parser;
parser.readXUI(full_filename, params);
if(!params.validateBlock())
{
llerrs << "Problem reading UI Notification Visibility Rules file: " << full_filename << llendl;
return false;
}
mVisibilityRules.clear();
for(LLInitParam::ParamIterator<LLNotificationVisibilityRule::Rule>::iterator it = params.rules.begin(),
end_it = params.rules.end();
it != end_it;
++it)
{
mVisibilityRules.push_back(LLNotificationVisibilityRulePtr(new LLNotificationVisibilityRule(*it)));
}
return true;
}
// Add a simple notification (from XUI)
void LLNotifications::addFromCallback(const LLSD& name)
{
@ -1546,6 +1669,94 @@ bool LLNotifications::getIgnoreAllNotifications()
return mIgnoreAllNotifications;
}
bool LLNotifications::isVisibleByRules(LLNotificationPtr n)
{
if(n->isRespondedTo())
{
// This avoids infinite recursion in the case where the filter calls respond()
return true;
}
VisibilityRuleList::iterator it;
for(it = mVisibilityRules.begin(); it != mVisibilityRules.end(); it++)
{
// An empty type/tag/name string will match any notification, so only do the comparison when the string is non-empty in the rule.
lldebugs
<< "notification \"" << n->getName() << "\" "
<< "testing against " << ((*it)->mVisible?"show":"hide") << " rule, "
<< "name = \"" << (*it)->mName << "\" "
<< "tag = \"" << (*it)->mTag << "\" "
<< "type = \"" << (*it)->mType << "\" "
<< llendl;
if(!(*it)->mType.empty())
{
if((*it)->mType != n->getType())
{
// Type doesn't match, so skip this rule.
continue;
}
}
if(!(*it)->mTag.empty())
{
// check this notification's tag(s) against it->mTag and continue if no match is found.
if(!n->matchesTag((*it)->mTag))
{
// This rule's non-empty tag didn't match one of the notification's tags. Skip this rule.
continue;
}
}
if(!(*it)->mName.empty())
{
// check this notification's name against the notification's name and continue if no match is found.
if((*it)->mName != n->getName())
{
// This rule's non-empty name didn't match the notification. Skip this rule.
continue;
}
}
// If we got here, the rule matches. Don't evaluate subsequent rules.
if(!(*it)->mVisible)
{
// This notification is being hidden.
if((*it)->mResponse.empty())
{
// Response property is empty. Cancel this notification.
lldebugs << "cancelling notification " << n->getName() << llendl;
n->cancel();
}
else
{
// Response property is not empty. Return the specified response.
LLSD response = n->getResponseTemplate(LLNotification::WITHOUT_DEFAULT_BUTTON);
// TODO: verify that the response template has an item with the correct name
response[(*it)->mResponse] = true;
lldebugs << "responding to notification " << n->getName() << " with response = " << response << llendl;
n->respond(response);
}
return false;
}
// If we got here, exit the loop and return true.
break;
}
lldebugs << "allowing notification " << n->getName() << llendl;
return true;
}
// ---
// END OF LLNotifications implementation
// =========================================================

View File

@ -195,6 +195,7 @@ public:
Mandatory<std::string> type;
Optional<S32> width;
Optional<S32> max_length_chars;
Optional<std::string> text;
Optional<std::string> value;
FormInput();
@ -270,6 +271,11 @@ struct LLNotificationTemplate;
// with smart pointers
typedef boost::shared_ptr<LLNotificationTemplate> LLNotificationTemplatePtr;
struct LLNotificationVisibilityRule;
typedef boost::shared_ptr<LLNotificationVisibilityRule> LLNotificationVisibilityRulePtr;
/**
* @class LLNotification
* @brief The object that expresses the details of a notification
@ -506,7 +512,7 @@ public:
std::string getLabel() const;
std::string getURL() const;
S32 getURLOption() const;
S32 getURLOpenExternally() const;
S32 getURLOpenExternally() const;
const LLNotificationFormPtr getForm();
@ -578,6 +584,8 @@ public:
bool hasUniquenessConstraints() const;
bool matchesTag(const std::string& tag);
virtual ~LLNotification() {}
};
@ -859,6 +867,10 @@ public:
// OK to call more than once because it will reload
bool loadTemplates();
// load visibility rules from file;
// OK to call more than once because it will reload
bool loadVisibilityRules();
// Add a simple notification (from XUI)
void addFromCallback(const LLSD& name);
@ -904,6 +916,8 @@ public:
// test for existence
bool templateExists(const std::string& name);
typedef std::list<LLNotificationVisibilityRulePtr> VisibilityRuleList;
void forceResponse(const LLNotification::Params& params, S32 option);
void createDefaultChannels();
@ -919,6 +933,8 @@ public:
void setIgnoreAllNotifications(bool ignore);
bool getIgnoreAllNotifications();
bool isVisibleByRules(LLNotificationPtr pNotification);
private:
// we're a singleton, so we don't have a public constructor
LLNotifications();
@ -938,6 +954,8 @@ private:
bool addTemplate(const std::string& name, LLNotificationTemplatePtr theTemplate);
TemplateMap mTemplates;
VisibilityRuleList mVisibilityRules;
std::string mFileName;
LLNotificationMap mUniqueNotifications;

View File

@ -74,11 +74,13 @@ struct LLNotificationTemplate
struct UniquenessContext : public LLInitParam::Block<UniquenessContext>
{
Mandatory<std::string> key;
Mandatory<std::string> value;
UniquenessContext()
: key("key")
{}
: value("value")
{
addSynonym(value, "key");
}
};
@ -88,7 +90,7 @@ struct LLNotificationTemplate
// this idiom allows
// <notification unique="true">
// as well as
// <notification> <unique> <context key=""/> </unique>...
// <notification> <unique> <context></context> </unique>...
Optional<bool> dummy_val;
public:
Multiple<UniquenessContext> contexts;
@ -156,6 +158,15 @@ struct LLNotificationTemplate
{}
};
struct Tag : public LLInitParam::Block<Tag>
{
Mandatory<std::string> value;
Tag()
: value("value")
{}
};
struct Params : public LLInitParam::Block<Params>
{
Mandatory<std::string> name;
@ -173,6 +184,7 @@ struct LLNotificationTemplate
Optional<FormRef> form_ref;
Optional<ENotificationPriority,
NotificationPriorityValues> priority;
Multiple<Tag> tags;
Params()
@ -189,7 +201,8 @@ struct LLNotificationTemplate
expire_option("expireOption", -1),
url("url"),
unique("unique"),
form_ref("")
form_ref(""),
tags("tag")
{}
};
@ -232,8 +245,8 @@ struct LLNotificationTemplate
// (used for things like progress indications, or repeating warnings
// like "the grid is going down in N minutes")
bool mUnique;
// if we want to be unique only if a certain part of the payload is constant
// specify the field names for the payload. The notification will only be
// if we want to be unique only if a certain part of the payload or substitutions args
// are constant specify the field names for the payload. The notification will only be
// combined if all of the fields named in the context are identical in the
// new and the old notification; otherwise, the notification will be
// duplicated. This is to support suppressing duplicate offers from the same
@ -276,6 +289,8 @@ struct LLNotificationTemplate
// this is loaded as a name, but looked up to get the UUID upon template load.
// If null, it wasn't specified.
LLUUID mSoundEffect;
// List of tags that rules can match against.
std::list<std::string> mTags;
};
#endif //LL_LLNOTIFICATION_TEMPLATE_H

View File

@ -0,0 +1,104 @@
/**
* @file llnotificationvisibility.h
* @brief Rules for
* @author Monroe
*
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLNOTIFICATION_VISIBILITY_RULE_H
#define LL_LLNOTIFICATION_VISIBILITY_RULE_H
#include "llinitparam.h"
//#include "llnotifications.h"
// This is the class of object read from the XML file (notification_visibility.xml,
// from the appropriate local language directory).
struct LLNotificationVisibilityRule
{
struct Filter : public LLInitParam::Block<Filter>
{
Optional<std::string> type,
tag,
name;
Filter()
: type("type"),
tag("tag"),
name("name")
{}
};
struct Respond : public LLInitParam::Block<Respond, Filter>
{
Mandatory<std::string> response;
Respond()
: response("response")
{}
};
struct Rule : public LLInitParam::Choice<Rule>
{
Alternative<Filter> show;
Alternative<Filter> hide;
Alternative<Respond> respond;
Rule()
: show("show"),
hide("hide"),
respond("respond")
{}
};
struct Rules : public LLInitParam::Block<Rules>
{
Multiple<Rule> rules;
Rules()
: rules("")
{}
};
LLNotificationVisibilityRule(const Rule& p);
// If true, this rule makes matching notifications visible. Otherwise, it makes them invisible.
bool mVisible;
// Which response to give when making a notification invisible. An empty string means the notification should be cancelled instead of responded to.
std::string mResponse;
// String to match against the notification's "type". An empty string matches all notifications.
std::string mType;
// String to match against the notification's tag(s). An empty string matches all notifications.
std::string mTag;
// String to match against the notification's name. An empty string matches all notifications.
std::string mName;
};
#endif //LL_LLNOTIFICATION_VISIBILITY_RULE_H

View File

@ -436,7 +436,7 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
//and LLView::initFromParams will use them to set visible and enabled
setVisible(p.visible);
setEnabled(p.enabled);
setFocusRoot(p.focus_root);
setSoundFlags(p.sound_flags);
// control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible

View File

@ -50,7 +50,7 @@ LLProgressBar::Params::Params()
LLProgressBar::LLProgressBar(const LLProgressBar::Params& p)
: LLView(p),
: LLUICtrl(p),
mImageBar(p.image_bar),
mImageFill(p.image_fill),
mColorBackground(p.color_bg()),
@ -80,7 +80,7 @@ void LLProgressBar::draw()
mImageFill->draw(progress_rect, bar_color);
}
void LLProgressBar::setPercent(const F32 percent)
void LLProgressBar::setValue(const LLSD& value)
{
mPercentDone = llclamp(percent, 0.f, 100.f);
mPercentDone = llclamp((F32)value.asReal(), 0.f, 100.f);
}

View File

@ -27,14 +27,14 @@
#ifndef LL_LLPROGRESSBAR_H
#define LL_LLPROGRESSBAR_H
#include "llview.h"
#include "lluictrl.h"
#include "llframetimer.h"
class LLProgressBar
: public LLView
: public LLUICtrl
{
public:
struct Params : public LLInitParam::Block<Params, LLView::Params>
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
Optional<LLUIImage*> image_bar,
image_fill;
@ -47,7 +47,7 @@ public:
LLProgressBar(const Params&);
virtual ~LLProgressBar();
void setPercent(const F32 percent);
void setValue(const LLSD& value);
/*virtual*/ void draw();

View File

@ -69,7 +69,7 @@ protected:
static LLWidgetNameRegistry::StaticRegistrar register_radio_item(&typeid(LLRadioGroup::ItemParams), "radio_item");
LLRadioGroup::Params::Params()
: has_border("draw_border"),
: allow_deselect("allow_deselect"),
items("item")
{
addSynonym(items, "radio_item");
@ -85,18 +85,8 @@ LLRadioGroup::LLRadioGroup(const LLRadioGroup::Params& p)
: LLUICtrl(p),
mFont(p.font.isProvided() ? p.font() : LLFontGL::getFontSansSerifSmall()),
mSelectedIndex(-1),
mHasBorder(p.has_border)
{
if (mHasBorder)
{
LLViewBorder::Params params;
params.name("radio group border");
params.rect(LLRect(0, getRect().getHeight(), getRect().getWidth(), 0));
params.bevel_style(LLViewBorder::BEVEL_NONE);
LLViewBorder * vb = LLUICtrlFactory::create<LLViewBorder> (params);
addChild (vb);
}
}
mAllowDeselect(p.allow_deselect)
{}
void LLRadioGroup::initFromParams(const Params& p)
{
@ -184,7 +174,7 @@ void LLRadioGroup::setIndexEnabled(S32 index, BOOL enabled)
BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event)
{
if (index < 0 || (S32)mRadioButtons.size() <= index )
if ((S32)mRadioButtons.size() <= index )
{
return FALSE;
}
@ -202,13 +192,16 @@ BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event)
mSelectedIndex = index;
LLRadioCtrl* radio_item = mRadioButtons[mSelectedIndex];
radio_item->setTabStop(true);
radio_item->setValue( TRUE );
if (hasFocus())
if (mSelectedIndex >= 0)
{
mRadioButtons[mSelectedIndex]->focusFirstItem(FALSE, FALSE);
LLRadioCtrl* radio_item = mRadioButtons[mSelectedIndex];
radio_item->setTabStop(true);
radio_item->setValue( TRUE );
if (hasFocus())
{
radio_item->focusFirstItem(FALSE, FALSE);
}
}
if (!from_event)
@ -307,8 +300,15 @@ void LLRadioGroup::onClickButton(LLUICtrl* ctrl)
LLRadioCtrl* radio = *iter;
if (radio == clicked_radio)
{
// llinfos << "clicked button " << index << llendl;
setSelectedIndex(index);
if (index == mSelectedIndex && mAllowDeselect)
{
// don't select anything
setSelectedIndex(-1);
}
else
{
setSelectedIndex(index);
}
// BUG: Calls click callback even if button didn't actually change
onCommit();

View File

@ -49,7 +49,7 @@ public:
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
Optional<bool> has_border;
Optional<bool> allow_deselect;
Multiple<ItemParams, AtLeast<1> > items;
Params();
};
@ -73,7 +73,6 @@ public:
void setIndexEnabled(S32 index, BOOL enabled);
// return the index value of the selected item
S32 getSelectedIndex() const { return mSelectedIndex; }
// set the index value programatically
BOOL setSelectedIndex(S32 index, BOOL from_event = FALSE);
@ -103,12 +102,13 @@ public:
/*virtual*/ BOOL operateOnAll(EOperation op);
private:
const LLFontGL* mFont;
S32 mSelectedIndex;
typedef std::vector<class LLRadioCtrl*> button_list_t;
button_list_t mRadioButtons;
const LLFontGL* mFont;
S32 mSelectedIndex;
BOOL mHasBorder;
typedef std::vector<class LLRadioCtrl*> button_list_t;
button_list_t mRadioButtons;
bool mAllowDeselect; // user can click on an already selected option to deselect it
};
#endif

View File

@ -322,6 +322,7 @@ LLScrollListCtrl::~LLScrollListCtrl()
delete mSortCallback;
std::for_each(mItemList.begin(), mItemList.end(), DeletePointer());
std::for_each(mColumns.begin(), mColumns.end(), DeletePairedPointer());
}
@ -2371,10 +2372,10 @@ void LLScrollListCtrl::onScrollChange( S32 new_pos, LLScrollbar* scrollbar )
void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending)
{
std::map<std::string, LLScrollListColumn>::iterator itor = mColumns.find(name);
column_map_t::iterator itor = mColumns.find(name);
if (itor != mColumns.end())
{
sortByColumnIndex((*itor).second.mIndex, ascending);
sortByColumnIndex((*itor).second->mIndex, ascending);
}
}
@ -2420,11 +2421,11 @@ void LLScrollListCtrl::dirtyColumns()
// just in case someone indexes into it immediately
mColumnsIndexed.resize(mColumns.size());
std::map<std::string, LLScrollListColumn>::iterator column_itor;
column_map_t::iterator column_itor;
for (column_itor = mColumns.begin(); column_itor != mColumns.end(); ++column_itor)
{
LLScrollListColumn *column = &column_itor->second;
mColumnsIndexed[column_itor->second.mIndex] = column;
LLScrollListColumn *column = column_itor->second;
mColumnsIndexed[column_itor->second->mIndex] = column;
}
}
@ -2582,8 +2583,8 @@ void LLScrollListCtrl::addColumn(const LLScrollListColumn::Params& column_params
if (mColumns.find(name) == mColumns.end())
{
// Add column
mColumns[name] = LLScrollListColumn(column_params, this);
LLScrollListColumn* new_column = &mColumns[name];
mColumns[name] = new LLScrollListColumn(column_params, this);
LLScrollListColumn* new_column = mColumns[name];
new_column->mIndex = mColumns.size()-1;
// Add button
@ -2605,14 +2606,14 @@ void LLScrollListCtrl::addColumn(const LLScrollListColumn::Params& column_params
S32 top = mItemListRect.mTop;
S32 left = mItemListRect.mLeft;
for (std::map<std::string, LLScrollListColumn>::iterator itor = mColumns.begin();
for (column_map_t::iterator itor = mColumns.begin();
itor != mColumns.end();
++itor)
{
if (itor->second.mIndex < new_column->mIndex &&
itor->second.getWidth() > 0)
if (itor->second->mIndex < new_column->mIndex &&
itor->second->getWidth() > 0)
{
left += itor->second.getWidth() + mColumnPadding;
left += itor->second->getWidth() + mColumnPadding;
}
}
@ -2668,8 +2669,8 @@ void LLScrollListCtrl::onClickColumn(void *userdata)
if (column->mSortingColumn != column->mName
&& parent->mColumns.find(column->mSortingColumn) != parent->mColumns.end())
{
LLScrollListColumn& info_redir = parent->mColumns[column->mSortingColumn];
column_index = info_redir.mIndex;
LLScrollListColumn* info_redir = parent->mColumns[column->mSortingColumn];
column_index = info_redir->mIndex;
}
// if this column is the primary sort key, reverse the direction
@ -2702,16 +2703,17 @@ BOOL LLScrollListCtrl::hasSortOrder() const
void LLScrollListCtrl::clearColumns()
{
std::map<std::string, LLScrollListColumn>::iterator itor;
column_map_t::iterator itor;
for (itor = mColumns.begin(); itor != mColumns.end(); ++itor)
{
LLScrollColumnHeader *header = itor->second.mHeader;
LLScrollColumnHeader *header = itor->second->mHeader;
if (header)
{
removeChild(header);
delete header;
}
}
std::for_each(mColumns.begin(), mColumns.end(), DeletePairedPointer());
mColumns.clear();
mSortColumns.clear();
mTotalStaticColumnWidth = 0;
@ -2745,7 +2747,7 @@ LLScrollListColumn* LLScrollListCtrl::getColumn(const std::string& name)
column_map_t::iterator column_itor = mColumns.find(name);
if (column_itor != mColumns.end())
{
return &column_itor->second;
return column_itor->second;
}
return NULL;
}
@ -2806,7 +2808,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS
new_column.width.pixel_width = cell_p.width;
}
addColumn(new_column);
columnp = &mColumns[column];
columnp = mColumns[column];
new_item->setNumColumns(mColumns.size());
}
@ -2843,7 +2845,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS
LLScrollListCell* cell = LLScrollListCell::create(LLScrollListCell::Params().value(item_p.value));
if (cell)
{
LLScrollListColumn* columnp = &(mColumns.begin()->second);
LLScrollListColumn* columnp = mColumns.begin()->second;
new_item->setColumn(0, cell);
if (columnp->mHeader
@ -2858,10 +2860,10 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS
// add dummy cells for missing columns
for (column_map_t::iterator column_it = mColumns.begin(); column_it != mColumns.end(); ++column_it)
{
S32 column_idx = column_it->second.mIndex;
S32 column_idx = column_it->second->mIndex;
if (new_item->getColumn(column_idx) == NULL)
{
LLScrollListColumn* column_ptr = &column_it->second;
LLScrollListColumn* column_ptr = column_it->second;
LLScrollListCell::Params cell_p;
cell_p.width = column_ptr->getWidth();

View File

@ -491,7 +491,7 @@ private:
mutable bool mSorted;
typedef std::map<std::string, LLScrollListColumn> column_map_t;
typedef std::map<std::string, LLScrollListColumn*> column_map_t;
column_map_t mColumns;
BOOL mDirty;

View File

@ -45,6 +45,7 @@ LLParamSDParser::LLParamSDParser()
if (sReadFuncs.empty())
{
registerParserFuncs<LLInitParam::NoParamValue>(readNoValue, &LLParamSDParser::writeNoValue);
registerParserFuncs<S32>(readS32, &LLParamSDParser::writeTypedValue<S32>);
registerParserFuncs<U32>(readU32, &LLParamSDParser::writeU32Param);
registerParserFuncs<F32>(readF32, &LLParamSDParser::writeTypedValue<F32>);
@ -71,6 +72,18 @@ bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const voi
return true;
}
bool LLParamSDParser::writeNoValue(LLParamSDParser::parser_t& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack)
{
LLParamSDParser& sdparser = static_cast<LLParamSDParser&>(parser);
if (!sdparser.mWriteRootSD) return false;
LLSD* sd_to_write = sdparser.getSDWriteNode(name_stack);
if (!sd_to_write) return false;
return true;
}
void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool silent)
{
mCurReadSD = NULL;
@ -87,6 +100,8 @@ void LLParamSDParser::writeSD(LLSD& sd, const LLInitParam::BaseBlock& block)
block.serializeBlock(*this);
}
const LLSD NO_VALUE_MARKER;
void LLParamSDParser::readSDValues(const LLSD& sd, LLInitParam::BaseBlock& block)
{
if (sd.isMap())
@ -110,6 +125,11 @@ void LLParamSDParser::readSDValues(const LLSD& sd, LLInitParam::BaseBlock& block
readSDValues(*it, block);
}
}
else if (sd.isUndefined())
{
mCurReadSD = &NO_VALUE_MARKER;
block.submitValue(mNameStack, *this);
}
else
{
mCurReadSD = &sd;
@ -206,6 +226,13 @@ LLSD* LLParamSDParser::getSDWriteNode(const parser_t::name_stack_t& name_stack)
return sd_to_write;
}
bool LLParamSDParser::readNoValue(Parser& parser, void* val_ptr)
{
LLParamSDParser& self = static_cast<LLParamSDParser&>(parser);
return self.mCurReadSD == &NO_VALUE_MARKER;
}
bool LLParamSDParser::readS32(Parser& parser, void* val_ptr)
{
LLParamSDParser& self = static_cast<LLParamSDParser&>(parser);

View File

@ -63,7 +63,9 @@ private:
LLSD* getSDWriteNode(const parser_t::name_stack_t& name_stack);
static bool writeU32Param(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack);
static bool writeNoValue(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack);
static bool readNoValue(Parser& parser, void* val_ptr);
static bool readS32(Parser& parser, void* val_ptr);
static bool readU32(Parser& parser, void* val_ptr);
static bool readF32(Parser& parser, void* val_ptr);

View File

@ -277,6 +277,8 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
mHPad += UI_TEXTEDITOR_LINE_NUMBER_MARGIN;
updateRects();
}
mParseOnTheFly = TRUE;
}
void LLTextEditor::initFromParams( const LLTextEditor::Params& p)
@ -324,8 +326,10 @@ void LLTextEditor::setText(const LLStringExplicit &utf8str, const LLStyle::Param
blockUndo();
deselect();
mParseOnTheFly = FALSE;
LLTextBase::setText(utf8str, input_params);
mParseOnTheFly = TRUE;
resetDirty();
}
@ -1367,6 +1371,7 @@ void LLTextEditor::pastePrimary()
// paste from primary (itsprimary==true) or clipboard (itsprimary==false)
void LLTextEditor::pasteHelper(bool is_primary)
{
mParseOnTheFly = FALSE;
bool can_paste_it;
if (is_primary)
{
@ -1450,6 +1455,7 @@ void LLTextEditor::pasteHelper(bool is_primary)
deselect();
onKeyStroke();
mParseOnTheFly = TRUE;
}
@ -2385,7 +2391,7 @@ void LLTextEditor::loadKeywords(const std::string& filename,
void LLTextEditor::updateSegments()
{
if (mReflowIndex < S32_MAX && mKeywords.isLoaded())
if (mReflowIndex < S32_MAX && mKeywords.isLoaded() && mParseOnTheFly)
{
LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING);
// HACK: No non-ascii keywords for now

View File

@ -315,6 +315,7 @@ private:
BOOL mAllowEmbeddedItems;
bool mShowContextMenu;
bool mParseOnTheFly;
LLUUID mSourceID;

View File

@ -1596,23 +1596,25 @@ void LLUI::initClass(const settings_map_t& settings,
sWindow = NULL; // set later in startup
LLFontGL::sShadowColor = LLUIColorTable::instance().getColor("ColorDropShadow");
LLUICtrl::CommitCallbackRegistry::Registrar& reg = LLUICtrl::CommitCallbackRegistry::defaultRegistrar();
// Callbacks for associating controls with floater visibilty:
LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Floater.Toggle", boost::bind(&LLFloaterReg::toggleFloaterInstance, _2));
LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Floater.Show", boost::bind(&LLFloaterReg::showFloaterInstance, _2));
LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Floater.Hide", boost::bind(&LLFloaterReg::hideFloaterInstance, _2));
LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Floater.InitToVisibilityControl", boost::bind(&LLFloaterReg::initUICtrlToFloaterVisibilityControl, _1, _2));
reg.add("Floater.Toggle", boost::bind(&LLFloaterReg::toggleFloaterInstance, _2));
reg.add("Floater.Show", boost::bind(&LLFloaterReg::showFloaterInstance, _2));
reg.add("Floater.Hide", boost::bind(&LLFloaterReg::hideFloaterInstance, _2));
reg.add("Floater.InitToVisibilityControl", boost::bind(&LLFloaterReg::initUICtrlToFloaterVisibilityControl, _1, _2));
// Button initialization callback for toggle buttons
LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Button.SetFloaterToggle", boost::bind(&LLButton::setFloaterToggle, _1, _2));
reg.add("Button.SetFloaterToggle", boost::bind(&LLButton::setFloaterToggle, _1, _2));
// Button initialization callback for toggle buttons on dockale floaters
LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Button.SetDockableFloaterToggle", boost::bind(&LLButton::setDockableFloaterToggle, _1, _2));
reg.add("Button.SetDockableFloaterToggle", boost::bind(&LLButton::setDockableFloaterToggle, _1, _2));
// Display the help topic for the current context
LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Button.ShowHelp", boost::bind(&LLButton::showHelp, _1, _2));
reg.add("Button.ShowHelp", boost::bind(&LLButton::showHelp, _1, _2));
// Currently unused, but kept for reference:
LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("Button.ToggleFloater", boost::bind(&LLButton::toggleFloaterAndSetToggleState, _1, _2));
reg.add("Button.ToggleFloater", boost::bind(&LLButton::toggleFloaterAndSetToggleState, _1, _2));
// Used by menus along with Floater.Toggle to display visibility as a checkmark
LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.Visible", boost::bind(&LLFloaterReg::floaterInstanceVisible, _2));

View File

@ -215,6 +215,12 @@ bool LLUIColorTable::loadFromSettings()
result |= loadFromFilename(current_filename, mLoadedColors);
}
current_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SKIN, "colors.xml");
if(current_filename != default_filename)
{
result |= loadFromFilename(current_filename, mLoadedColors);
}
std::string user_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "colors.xml");
loadFromFilename(user_filename, mUserSetColors);

View File

@ -827,7 +827,7 @@ LLUICtrl* LLUICtrl::findRootMostFocusRoot()
{
LLUICtrl* focus_root = NULL;
LLUICtrl* next_view = this;
while(next_view)
while(next_view && next_view->hasTabStop())
{
if (next_view->isFocusRoot())
{
@ -944,6 +944,10 @@ F32 LLUICtrl::getCurrentTransparency()
case TT_INACTIVE:
alpha = sInactiveControlTransparency;
break;
case TT_FADING:
alpha = sInactiveControlTransparency / 2;
break;
}
return alpha;

View File

@ -123,8 +123,9 @@ public:
enum ETypeTransparency
{
TT_DEFAULT,
TT_ACTIVE,
TT_INACTIVE
TT_ACTIVE, // focused floater
TT_INACTIVE, // other floaters
TT_FADING, // fading toast
};
/*virtual*/ ~LLUICtrl();

View File

@ -61,7 +61,6 @@ public:
LLUIString() : mArgs(NULL), mNeedsResult(false), mNeedsWResult(false) {}
LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args);
LLUIString(const std::string& instring) : mArgs(NULL) { assign(instring); }
~LLUIString() { delete mArgs; }
void assign(const std::string& instring);

View File

@ -27,6 +27,7 @@
#include "linden_common.h"
#include "llurlentry.h"
#include "lluictrl.h"
#include "lluri.h"
#include "llurlmatch.h"
#include "llurlregistry.h"
@ -167,6 +168,15 @@ void LLUrlEntryBase::callObservers(const std::string &id,
}
}
/// is this a match for a URL that should not be hyperlinked?
bool LLUrlEntryBase::isLinkDisabled() const
{
// this allows us to have a global setting to turn off text hyperlink highlighting/action
bool globally_disabled = LLUI::sSettingGroups["config"]->getBOOL("DisableTextHyperlinkActions");
return globally_disabled;
}
static std::string getStringAfterToken(const std::string str, const std::string token)
{
size_t pos = str.find(token);
@ -456,8 +466,8 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa
LLStyle::Params LLUrlEntryAgent::getStyle() const
{
LLStyle::Params style_params = LLUrlEntryBase::getStyle();
style_params.color = LLUIColorTable::instance().getColor("AgentLinkColor");
style_params.readonly_color = LLUIColorTable::instance().getColor("AgentLinkColor");
style_params.color = LLUIColorTable::instance().getColor("HTMLLinkColor");
style_params.readonly_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
return style_params;
}
@ -795,6 +805,69 @@ std::string LLUrlEntryPlace::getLocation(const std::string &url) const
return ::getStringAfterToken(url, "://");
}
//
// LLUrlEntryRegion Describes secondlife:///app/region/REGION_NAME/X/Y/Z URLs, e.g.
// secondlife:///app/region/Ahern/128/128/0
//
LLUrlEntryRegion::LLUrlEntryRegion()
{
mPattern = boost::regex("secondlife:///app/region/[^/\\s]+(/\\d+)?(/\\d+)?(/\\d+)?/?",
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_slurl.xml";
mTooltip = LLTrans::getString("TooltipSLURL");
}
std::string LLUrlEntryRegion::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
{
//
// we handle SLURLs in the following formats:
// - secondlife:///app/region/Place/X/Y/Z
// - secondlife:///app/region/Place/X/Y
// - secondlife:///app/region/Place/X
// - secondlife:///app/region/Place
//
LLSD path_array = LLURI(url).pathArray();
S32 path_parts = path_array.size();
if (path_parts < 3) // no region name
{
llwarns << "Failed to parse url [" << url << "]" << llendl;
return url;
}
std::string label = unescapeUrl(path_array[2]); // region name
if (path_parts > 3) // secondlife:///app/region/Place/X
{
std::string x = path_array[3];
label += " (" + x;
if (path_parts > 4) // secondlife:///app/region/Place/X/Y
{
std::string y = path_array[4];
label += "," + y;
if (path_parts > 5) // secondlife:///app/region/Place/X/Y/Z
{
std::string z = path_array[5];
label = label + "," + z;
}
}
label += ")";
}
return label;
}
std::string LLUrlEntryRegion::getLocation(const std::string &url) const
{
LLSD path_array = LLURI(url).pathArray();
std::string region_name = unescapeUrl(path_array[2]);
return region_name;
}
//
// LLUrlEntryTeleport Describes a Second Life teleport Url, e.g.,
// secondlife:///app/teleport/Ahern/50/50/50/

View File

@ -94,6 +94,8 @@ public:
virtual LLUUID getID(const std::string &string) const { return LLUUID::null; }
bool isLinkDisabled() const;
protected:
std::string getIDStringFromUrl(const std::string &url) const;
std::string escapeUrl(const std::string &url) const;
@ -299,6 +301,18 @@ public:
/*virtual*/ std::string getLocation(const std::string &url) const;
};
///
/// LLUrlEntryRegion Describes a Second Life location Url, e.g.,
/// secondlife:///app/region/Ahern/128/128/0
///
class LLUrlEntryRegion : public LLUrlEntryBase
{
public:
LLUrlEntryRegion();
/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
/*virtual*/ std::string getLocation(const std::string &url) const;
};
///
/// LLUrlEntryTeleport Describes a Second Life teleport Url, e.g.,
/// secondlife:///app/teleport/Ahern/50/50/50/

View File

@ -54,6 +54,7 @@ LLUrlRegistry::LLUrlRegistry()
registerUrl(new LLUrlEntryGroup());
registerUrl(new LLUrlEntryParcel());
registerUrl(new LLUrlEntryTeleport());
registerUrl(new LLUrlEntryRegion());
registerUrl(new LLUrlEntryWorldMap());
registerUrl(new LLUrlEntryObjectIM());
registerUrl(new LLUrlEntryPlace());

View File

@ -102,6 +102,7 @@ LLView::Params::Params()
left_pad("left_pad"),
left_delta("left_delta", S32_MAX),
from_xui("from_xui", false),
focus_root("focus_root", false),
needs_translate("translate"),
xmlns("xmlns"),
xmlns_xsi("xmlns:xsi"),
@ -117,7 +118,7 @@ LLView::LLView(const LLView::Params& p)
mParentView(NULL),
mReshapeFlags(FOLLOWS_NONE),
mFromXUI(p.from_xui),
mIsFocusRoot(FALSE),
mIsFocusRoot(p.focus_root),
mLastVisible(FALSE),
mNextInsertionOrdinal(0),
mHoverCursor(getCursorFromString(p.hover_cursor)),
@ -163,8 +164,6 @@ LLView::~LLView()
if (mDefaultWidgets)
{
std::for_each(mDefaultWidgets->begin(), mDefaultWidgets->end(),
DeletePairedPointer());
delete mDefaultWidgets;
mDefaultWidgets = NULL;
}
@ -1682,18 +1681,7 @@ BOOL LLView::hasChild(const std::string& childname, BOOL recurse) const
//-----------------------------------------------------------------------------
LLView* LLView::getChildView(const std::string& name, BOOL recurse) const
{
LLView* child = findChildView(name, recurse);
if (!child)
{
child = getDefaultWidget<LLView>(name);
if (!child)
{
LLView::Params view_params;
view_params.name = name;
child = LLUICtrlFactory::create<LLView>(view_params);
}
}
return child;
return getChild<LLView>(name, recurse);
}
static LLFastTimer::DeclareTimer FTM_FIND_VIEWS("Find Widgets");
@ -2804,11 +2792,14 @@ LLView::root_to_view_iterator_t LLView::endRootToView()
// only create maps on demand, as they incur heap allocation/deallocation cost
// when a view is constructed/deconstructed
LLView::default_widget_map_t& LLView::getDefaultWidgetMap() const
LLView& LLView::getDefaultWidgetContainer() const
{
if (!mDefaultWidgets)
{
mDefaultWidgets = new default_widget_map_t();
LLView::Params p;
p.name = "default widget container";
p.visible = false; // ensures default widgets can't steal focus, etc.
mDefaultWidgets = new LLView(p);
}
return *mDefaultWidgets;
}

View File

@ -116,7 +116,8 @@ public:
visible,
mouse_opaque,
use_bounding_rect,
from_xui;
from_xui,
focus_root;
Optional<S32> tab_group,
default_tab_group;
@ -412,14 +413,9 @@ public:
LLControlVariable *findControl(const std::string& name);
// Moved setValue(), getValue(), setControlValue(), setControlName(),
// controlListener() to LLUICtrl because an LLView is NOT assumed to
// contain a value. If that's what you want, use LLUICtrl instead.
// virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
const child_list_t* getChildList() const { return &mChildList; }
const child_list_const_iter_t beginChild() { return mChildList.begin(); }
const child_list_const_iter_t endChild() { return mChildList.end(); }
child_list_const_iter_t beginChild() const { return mChildList.begin(); }
child_list_const_iter_t endChild() const { return mChildList.end(); }
// LLMouseHandler functions
// Default behavior is to pass events to children
@ -466,12 +462,8 @@ public:
template <class T> T* getDefaultWidget(const std::string& name) const
{
default_widget_map_t::const_iterator found_it = getDefaultWidgetMap().find(name);
if (found_it == getDefaultWidgetMap().end())
{
return NULL;
}
return dynamic_cast<T*>(found_it->second);
LLView* widgetp = getDefaultWidgetContainer().findChildView(name);
return dynamic_cast<T*>(widgetp);
}
//////////////////////////////////////////////
@ -585,9 +577,9 @@ private:
typedef std::map<std::string, LLView*> default_widget_map_t;
// allocate this map no demand, as it is rarely needed
mutable default_widget_map_t* mDefaultWidgets;
mutable LLView* mDefaultWidgets;
default_widget_map_t& getDefaultWidgetMap() const;
LLView& getDefaultWidgetContainer() const;
public:
// Depth in view hierarchy during rendering
@ -654,7 +646,7 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co
return NULL;
}
getDefaultWidgetMap()[name] = result;
getDefaultWidgetContainer().addChild(result);
}
}
return result;

View File

@ -0,0 +1,328 @@
/**
* @file LLWindowShade.cpp
* @brief Notification dialog that slides down and optionally disabled a piece of UI
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llwindowshade.h"
#include "lllayoutstack.h"
#include "lltextbox.h"
#include "lliconctrl.h"
#include "llbutton.h"
#include "llcheckboxctrl.h"
#include "lllineeditor.h"
const S32 MIN_NOTIFICATION_AREA_HEIGHT = 30;
const S32 MAX_NOTIFICATION_AREA_HEIGHT = 100;
LLWindowShade::Params::Params()
: bg_image("bg_image"),
modal("modal", false),
text_color("text_color"),
can_close("can_close", true)
{
mouse_opaque = false;
}
LLWindowShade::LLWindowShade(const LLWindowShade::Params& params)
: LLUICtrl(params),
mNotification(params.notification),
mModal(params.modal),
mFormHeight(0),
mTextColor(params.text_color)
{
setFocusRoot(true);
}
void LLWindowShade::initFromParams(const LLWindowShade::Params& params)
{
LLUICtrl::initFromParams(params);
LLLayoutStack::Params layout_p;
layout_p.name = "notification_stack";
layout_p.rect = params.rect;
layout_p.follows.flags = FOLLOWS_ALL;
layout_p.mouse_opaque = false;
layout_p.orientation = LLLayoutStack::VERTICAL;
layout_p.border_size = 0;
LLLayoutStack* stackp = LLUICtrlFactory::create<LLLayoutStack>(layout_p);
addChild(stackp);
LLLayoutPanel::Params panel_p;
panel_p.rect = LLRect(0, 30, 800, 0);
panel_p.name = "notification_area";
panel_p.visible = false;
panel_p.user_resize = false;
panel_p.background_visible = true;
panel_p.bg_alpha_image = params.bg_image;
panel_p.auto_resize = false;
LLLayoutPanel* notification_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
stackp->addChild(notification_panel);
panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>();
panel_p.auto_resize = true;
panel_p.user_resize = false;
panel_p.rect = params.rect;
panel_p.name = "background_area";
panel_p.mouse_opaque = false;
panel_p.background_visible = false;
panel_p.bg_alpha_color = LLColor4(0.f, 0.f, 0.f, 0.2f);
LLLayoutPanel* dummy_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
stackp->addChild(dummy_panel);
layout_p = LLUICtrlFactory::getDefaultParams<LLLayoutStack>();
layout_p.rect = LLRect(0, 30, 800, 0);
layout_p.follows.flags = FOLLOWS_ALL;
layout_p.orientation = LLLayoutStack::HORIZONTAL;
stackp = LLUICtrlFactory::create<LLLayoutStack>(layout_p);
notification_panel->addChild(stackp);
panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>();
panel_p.rect.height = 30;
LLLayoutPanel* panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
stackp->addChild(panel);
LLIconCtrl::Params icon_p;
icon_p.name = "notification_icon";
icon_p.rect = LLRect(5, 23, 21, 8);
panel->addChild(LLUICtrlFactory::create<LLIconCtrl>(icon_p));
LLTextBox::Params text_p;
text_p.rect = LLRect(31, 20, panel->getRect().getWidth() - 5, 0);
text_p.follows.flags = FOLLOWS_ALL;
text_p.text_color = mTextColor;
text_p.font = LLFontGL::getFontSansSerifSmall();
text_p.font.style = "BOLD";
text_p.name = "notification_text";
text_p.use_ellipses = true;
text_p.wrap = true;
panel->addChild(LLUICtrlFactory::create<LLTextBox>(text_p));
panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>();
panel_p.auto_resize = false;
panel_p.user_resize = false;
panel_p.name="form_elements";
panel_p.rect = LLRect(0, 30, 130, 0);
LLLayoutPanel* form_elements_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
stackp->addChild(form_elements_panel);
if (params.can_close)
{
panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>();
panel_p.auto_resize = false;
panel_p.user_resize = false;
panel_p.rect = LLRect(0, 30, 25, 0);
LLLayoutPanel* close_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
stackp->addChild(close_panel);
LLButton::Params button_p;
button_p.name = "close_notification";
button_p.rect = LLRect(5, 23, 21, 7);
button_p.image_color.control="DkGray_66";
button_p.image_unselected.name="Icon_Close_Foreground";
button_p.image_selected.name="Icon_Close_Press";
button_p.click_callback.function = boost::bind(&LLWindowShade::onCloseNotification, this);
close_panel->addChild(LLUICtrlFactory::create<LLButton>(button_p));
}
LLSD payload = mNotification->getPayload();
LLNotificationFormPtr formp = mNotification->getForm();
LLLayoutPanel& notification_area = getChildRef<LLLayoutPanel>("notification_area");
notification_area.getChild<LLUICtrl>("notification_icon")->setValue(mNotification->getIcon());
notification_area.getChild<LLUICtrl>("notification_text")->setValue(mNotification->getMessage());
notification_area.getChild<LLUICtrl>("notification_text")->setToolTip(mNotification->getMessage());
LLNotificationForm::EIgnoreType ignore_type = formp->getIgnoreType();
LLLayoutPanel& form_elements = notification_area.getChildRef<LLLayoutPanel>("form_elements");
form_elements.deleteAllChildren();
const S32 FORM_PADDING_HORIZONTAL = 10;
const S32 FORM_PADDING_VERTICAL = 3;
const S32 WIDGET_HEIGHT = 24;
const S32 LINE_EDITOR_WIDTH = 120;
S32 cur_x = FORM_PADDING_HORIZONTAL;
S32 cur_y = FORM_PADDING_VERTICAL + WIDGET_HEIGHT;
S32 form_width = cur_x;
if (ignore_type != LLNotificationForm::IGNORE_NO)
{
LLCheckBoxCtrl::Params checkbox_p;
checkbox_p.name = "ignore_check";
checkbox_p.rect = LLRect(cur_x, cur_y, cur_x, cur_y - WIDGET_HEIGHT);
checkbox_p.label = formp->getIgnoreMessage();
checkbox_p.label_text.text_color = LLColor4::black;
checkbox_p.commit_callback.function = boost::bind(&LLWindowShade::onClickIgnore, this, _1);
checkbox_p.initial_value = formp->getIgnored();
LLCheckBoxCtrl* check = LLUICtrlFactory::create<LLCheckBoxCtrl>(checkbox_p);
check->setRect(check->getBoundingRect());
form_elements.addChild(check);
cur_x = check->getRect().mRight + FORM_PADDING_HORIZONTAL;
form_width = llmax(form_width, cur_x);
}
for (S32 i = 0; i < formp->getNumElements(); i++)
{
LLSD form_element = formp->getElement(i);
std::string type = form_element["type"].asString();
if (type == "button")
{
LLButton::Params button_p;
button_p.name = form_element["name"];
button_p.label = form_element["text"];
button_p.rect = LLRect(cur_x, cur_y, cur_x, cur_y - WIDGET_HEIGHT);
button_p.click_callback.function = boost::bind(&LLWindowShade::onClickNotificationButton, this, form_element["name"].asString());
button_p.auto_resize = true;
LLButton* button = LLUICtrlFactory::create<LLButton>(button_p);
button->autoResize();
form_elements.addChild(button);
if (form_element["default"].asBoolean())
{
form_elements.setDefaultBtn(button);
}
cur_x = button->getRect().mRight + FORM_PADDING_HORIZONTAL;
form_width = llmax(form_width, cur_x);
}
else if (type == "text" || type == "password")
{
// if not at beginning of line...
if (cur_x != FORM_PADDING_HORIZONTAL)
{
// start new line
cur_x = FORM_PADDING_HORIZONTAL;
cur_y -= WIDGET_HEIGHT + FORM_PADDING_VERTICAL;
}
LLTextBox::Params label_p;
label_p.name = form_element["name"].asString() + "_label";
label_p.rect = LLRect(cur_x, cur_y, cur_x + LINE_EDITOR_WIDTH, cur_y - WIDGET_HEIGHT);
label_p.initial_value = form_element["text"];
label_p.text_color = mTextColor;
label_p.font_valign = LLFontGL::VCENTER;
label_p.v_pad = 5;
LLTextBox* textbox = LLUICtrlFactory::create<LLTextBox>(label_p);
textbox->reshapeToFitText();
textbox->reshape(textbox->getRect().getWidth(), form_elements.getRect().getHeight() - 2 * FORM_PADDING_VERTICAL);
form_elements.addChild(textbox);
cur_x = textbox->getRect().mRight + FORM_PADDING_HORIZONTAL;
LLLineEditor::Params line_p;
line_p.name = form_element["name"];
line_p.keystroke_callback = boost::bind(&LLWindowShade::onEnterNotificationText, this, _1, form_element["name"].asString());
line_p.is_password = type == "password";
line_p.rect = LLRect(cur_x, cur_y, cur_x + LINE_EDITOR_WIDTH, cur_y - WIDGET_HEIGHT);
LLLineEditor* line_editor = LLUICtrlFactory::create<LLLineEditor>(line_p);
form_elements.addChild(line_editor);
form_width = llmax(form_width, cur_x + LINE_EDITOR_WIDTH + FORM_PADDING_HORIZONTAL);
// reset to start of next line
cur_x = FORM_PADDING_HORIZONTAL;
cur_y -= WIDGET_HEIGHT + FORM_PADDING_VERTICAL;
}
}
mFormHeight = form_elements.getRect().getHeight() - (cur_y - FORM_PADDING_VERTICAL) + WIDGET_HEIGHT;
form_elements.reshape(form_width, mFormHeight);
form_elements.setMinDim(form_width);
// move all form elements back onto form surface
S32 delta_y = WIDGET_HEIGHT + FORM_PADDING_VERTICAL - cur_y;
for (child_list_const_iter_t it = form_elements.getChildList()->begin(), end_it = form_elements.getChildList()->end();
it != end_it;
++it)
{
(*it)->translate(0, delta_y);
}
}
void LLWindowShade::show()
{
getChildRef<LLLayoutPanel>("notification_area").setVisible(true);
getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(mModal);
setMouseOpaque(mModal);
}
void LLWindowShade::draw()
{
LLRect message_rect = getChild<LLTextBox>("notification_text")->getTextBoundingRect();
LLLayoutPanel* notification_area = getChild<LLLayoutPanel>("notification_area");
notification_area->reshape(notification_area->getRect().getWidth(),
llclamp(message_rect.getHeight() + 10,
llmin(mFormHeight, MAX_NOTIFICATION_AREA_HEIGHT),
MAX_NOTIFICATION_AREA_HEIGHT));
LLUICtrl::draw();
if (mNotification && !mNotification->isActive())
{
hide();
}
}
void LLWindowShade::hide()
{
getChildRef<LLLayoutPanel>("notification_area").setVisible(false);
getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(false);
setMouseOpaque(false);
}
void LLWindowShade::onCloseNotification()
{
LLNotifications::instance().cancel(mNotification);
}
void LLWindowShade::onClickIgnore(LLUICtrl* ctrl)
{
bool check = ctrl->getValue().asBoolean();
if (mNotification && mNotification->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN)
{
// question was "show again" so invert value to get "ignore"
check = !check;
}
mNotification->setIgnored(check);
}
void LLWindowShade::onClickNotificationButton(const std::string& name)
{
if (!mNotification) return;
mNotificationResponse[name] = true;
mNotification->respond(mNotificationResponse);
}
void LLWindowShade::onEnterNotificationText(LLUICtrl* ctrl, const std::string& name)
{
mNotificationResponse[name] = ctrl->getValue().asString();
}

View File

@ -0,0 +1,69 @@
/**
* @file llwindowshade.h
* @brief Notification dialog that slides down and optionally disabled a piece of UI
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLWINDOWSHADE_H
#define LL_LLWINDOWSHADE_H
#include "lluictrl.h"
#include "llnotifications.h"
class LLWindowShade : public LLUICtrl
{
public:
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
Mandatory<LLNotificationPtr> notification;
Optional<LLUIImage*> bg_image;
Optional<LLUIColor> text_color;
Optional<bool> modal,
can_close;
Params();
};
void show();
/*virtual*/ void draw();
void hide();
private:
friend class LLUICtrlFactory;
LLWindowShade(const Params& p);
void initFromParams(const Params& params);
void onCloseNotification();
void onClickNotificationButton(const std::string& name);
void onEnterNotificationText(LLUICtrl* ctrl, const std::string& name);
void onClickIgnore(LLUICtrl* ctrl);
LLNotificationPtr mNotification;
LLSD mNotificationResponse;
bool mModal;
S32 mFormHeight;
LLUIColor mTextColor;
};
#endif // LL_LLWINDOWSHADE_H

View File

@ -27,6 +27,7 @@
#include "linden_common.h"
#include "../llurlentry.h"
#include "../lluictrl.h"
#include "llurlentry_stub.cpp"
#include "lltut.h"
#include "../lluicolortable.h"
@ -34,6 +35,14 @@
#include <boost/regex.hpp>
typedef std::map<std::string, LLControlGroup*> settings_map_t;
settings_map_t LLUI::sSettingGroups;
BOOL LLControlGroup::getBOOL(const std::string& name)
{
return false;
}
LLUIColor LLUIColorTable::getColor(const std::string& name, const LLColor4& default_color) const
{
return LLUIColor();
@ -94,6 +103,45 @@ namespace tut
ensure_equals(testname, url, expected);
}
void dummyCallback(const std::string &url, const std::string &label, const std::string& icon)
{
}
void testLabel(const std::string &testname, LLUrlEntryBase &entry,
const char *text, const std::string &expected)
{
boost::regex regex = entry.getPattern();
std::string label = "";
boost::cmatch result;
bool found = boost::regex_search(text, result, regex);
if (found)
{
S32 start = static_cast<U32>(result[0].first - text);
S32 end = static_cast<U32>(result[0].second - text);
std::string url = std::string(text+start, end-start);
label = entry.getLabel(url, boost::bind(dummyCallback, _1, _2, _3));
}
ensure_equals(testname, label, expected);
}
void testLocation(const std::string &testname, LLUrlEntryBase &entry,
const char *text, const std::string &expected)
{
boost::regex regex = entry.getPattern();
std::string location = "";
boost::cmatch result;
bool found = boost::regex_search(text, result, regex);
if (found)
{
S32 start = static_cast<U32>(result[0].first - text);
S32 end = static_cast<U32>(result[0].second - text);
std::string url = std::string(text+start, end-start);
location = entry.getLocation(url);
}
ensure_equals(testname, location, expected);
}
template<> template<>
void object::test<1>()
{
@ -688,4 +736,114 @@ namespace tut
"<nolink>My Object</nolink>",
"My Object");
}
template<> template<>
void object::test<13>()
{
//
// test LLUrlEntryRegion - secondlife:///app/region/<location> URLs
//
LLUrlEntryRegion url;
// Regex tests.
testRegex("no valid region", url,
"secondlife:///app/region/",
"");
testRegex("invalid coords", url,
"secondlife:///app/region/Korea2/a/b/c",
"secondlife:///app/region/Korea2/"); // don't count invalid coords
testRegex("Ahern (50,50,50) [1]", url,
"secondlife:///app/region/Ahern/50/50/50/",
"secondlife:///app/region/Ahern/50/50/50/");
testRegex("Ahern (50,50,50) [2]", url,
"XXX secondlife:///app/region/Ahern/50/50/50/ XXX",
"secondlife:///app/region/Ahern/50/50/50/");
testRegex("Ahern (50,50,50) [3]", url,
"XXX secondlife:///app/region/Ahern/50/50/50 XXX",
"secondlife:///app/region/Ahern/50/50/50");
testRegex("Ahern (50,50,50) multicase", url,
"XXX secondlife:///app/region/Ahern/50/50/50/ XXX",
"secondlife:///app/region/Ahern/50/50/50/");
testRegex("Ahern (50,50) [1]", url,
"XXX secondlife:///app/region/Ahern/50/50/ XXX",
"secondlife:///app/region/Ahern/50/50/");
testRegex("Ahern (50,50) [2]", url,
"XXX secondlife:///app/region/Ahern/50/50 XXX",
"secondlife:///app/region/Ahern/50/50");
// DEV-21577: In-world SLURLs containing "(" or ")" are not treated as a hyperlink in chat
testRegex("Region with brackets", url,
"XXX secondlife:///app/region/Burning%20Life%20(Hyper)/27/210/30 XXX",
"secondlife:///app/region/Burning%20Life%20(Hyper)/27/210/30");
// DEV-35459: SLURLs and teleport Links not parsed properly
testRegex("Region with quote", url,
"XXX secondlife:///app/region/A'ksha%20Oasis/41/166/701 XXX",
"secondlife:///app/region/A%27ksha%20Oasis/41/166/701");
// Rendering tests.
testLabel("Render /app/region/Ahern/50/50/50/", url,
"secondlife:///app/region/Ahern/50/50/50/",
"Ahern (50,50,50)");
testLabel("Render /app/region/Ahern/50/50/50", url,
"secondlife:///app/region/Ahern/50/50/50",
"Ahern (50,50,50)");
testLabel("Render /app/region/Ahern/50/50/", url,
"secondlife:///app/region/Ahern/50/50/",
"Ahern (50,50)");
testLabel("Render /app/region/Ahern/50/50", url,
"secondlife:///app/region/Ahern/50/50",
"Ahern (50,50)");
testLabel("Render /app/region/Ahern/50/", url,
"secondlife:///app/region/Ahern/50/",
"Ahern (50)");
testLabel("Render /app/region/Ahern/50", url,
"secondlife:///app/region/Ahern/50",
"Ahern (50)");
testLabel("Render /app/region/Ahern/", url,
"secondlife:///app/region/Ahern/",
"Ahern");
testLabel("Render /app/region/Ahern/ within context", url,
"XXX secondlife:///app/region/Ahern/ XXX",
"Ahern");
testLabel("Render /app/region/Ahern", url,
"secondlife:///app/region/Ahern",
"Ahern");
testLabel("Render /app/region/Ahern within context", url,
"XXX secondlife:///app/region/Ahern XXX",
"Ahern");
testLabel("Render /app/region/Product%20Engine/", url,
"secondlife:///app/region/Product%20Engine/",
"Product Engine");
testLabel("Render /app/region/Product%20Engine", url,
"secondlife:///app/region/Product%20Engine",
"Product Engine");
// Location parsing texts.
testLocation("Location /app/region/Ahern/50/50/50/", url,
"secondlife:///app/region/Ahern/50/50/50/",
"Ahern");
testLocation("Location /app/region/Product%20Engine", url,
"secondlife:///app/region/Product%20Engine",
"Product Engine");
}
}

View File

@ -382,11 +382,7 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd
break;
case LL_PATH_USER_SKIN:
prefix = getOSUserAppDir();
prefix += mDirDelimiter;
prefix += "user_settings";
prefix += mDirDelimiter;
prefix += "skins";
prefix = getUserSkinDir();
break;
case LL_PATH_SKINS:

View File

@ -206,14 +206,6 @@ void LLDir_Win32::initAppDirs(const std::string &app_name,
}
}
res = LLFile::mkdir(getExpandedFilename(LL_PATH_USER_SKIN,""));
if (res == -1)
{
if (errno != EEXIST)
{
llwarns << "Couldn't create LL_PATH_SKINS dir " << getExpandedFilename(LL_PATH_USER_SKIN,"") << llendl;
}
}
mCAFile = getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem");
}

View File

@ -59,12 +59,13 @@ set(viewer_HEADER_FILES
# Libraries on which this library depends, needed for Linux builds
# Sort by high-level to low-level
if (NOT LINUX OR VIEWER)
if (LINUX AND VIEWER)
set(llwindow_LINK_LIBRARIES
${UI_LIBRARIES} # for GTK
${SDL_LIBRARY}
fontconfig # For FCInit and other FC* functions.
)
endif (NOT LINUX OR VIEWER)
endif (LINUX AND VIEWER)
if (DARWIN)
list(APPEND llwindow_SOURCE_FILES

View File

@ -40,7 +40,7 @@ enum EKeystate
KEYSTATE_UP
};
typedef void (*LLKeyFunc)(EKeystate keystate);
typedef boost::function<void(EKeystate keystate)> LLKeyFunc;
typedef std::string (LLKeyStringTranslatorFunc)(const char *label);
enum EKeyboardInsertMode

View File

@ -544,7 +544,27 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
if (closest_refresh == 0)
{
LL_WARNS("Window") << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << LL_ENDL;
success = FALSE;
//success = FALSE;
if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode))
{
success = FALSE;
}
else
{
if (dev_mode.dmBitsPerPel == BITS_PER_PIXEL)
{
LL_WARNS("Window") << "Current BBP is OK falling back to that" << LL_ENDL;
window_rect.right=width=dev_mode.dmPelsWidth;
window_rect.bottom=height=dev_mode.dmPelsHeight;
success = TRUE;
}
else
{
LL_WARNS("Window") << "Current BBP is BAD" << LL_ENDL;
success = FALSE;
}
}
}
// If we found a good resolution, use it.

View File

@ -170,6 +170,20 @@ LLSD LLControlVariable::getComparableValue(const LLSD& value)
storable_value = false;
}
}
else if (TYPE_LLSD == type() && value.isString())
{
LLPointer<LLSDNotationParser> parser = new LLSDNotationParser;
LLSD result;
std::stringstream value_stream(value.asString());
if (parser->parse(value_stream, result, LLSDSerialize::SIZE_UNLIMITED) != LLSDParser::PARSE_FAILURE)
{
storable_value = result;
}
else
{
storable_value = value;
}
}
else
{
storable_value = value;

View File

@ -312,6 +312,14 @@ namespace LLInitParam
}
}
// if no match, and no names left on stack, this is just an existence assertion of this block
// verify by calling readValue with NoParamValue type, an inherently unparseable type
if (!names_left)
{
NoParamValue no_value;
return p.readValue(no_value);
}
return false;
}

View File

@ -278,6 +278,9 @@ namespace LLInitParam
S32 mParseGeneration;
};
// used to indicate no matching value to a given name when parsing
struct NoParamValue{};
class BaseBlock;
class Param
@ -303,8 +306,8 @@ namespace LLInitParam
private:
friend class BaseBlock;
bool mIsProvided;
U16 mEnclosingBlockOffset;
bool mIsProvided;
};
// various callbacks and constraints associated with an individual param

View File

@ -343,4 +343,9 @@ private:
ScopedRegistrar* mStaticScope;
};
// helper macro for doing static registration
#define GLUED_TOKEN(x, y) x ## y
#define GLUE_TOKENS(x, y) GLUED_TOKEN(x, y)
#define LLREGISTER_STATIC(REGISTRY, KEY, VALUE) static REGISTRY::StaticRegistrar GLUE_TOKENS(reg, __LINE__)(KEY, VALUE);
#endif

Some files were not shown because too many files have changed in this diff Show More