master
Andrew Meadows 2011-01-07 15:22:22 -08:00
commit d23f7df822
577 changed files with 16608 additions and 5199 deletions

View File

@ -37,3 +37,9 @@ db0fe9bb65187f365e58a717dd23d0f4754a9c1d 2.3.0-beta2
6ad3d6fa35a4e320e9ce442fce2bf9c7fc852556 2.3.0-beta3
6ad3d6fa35a4e320e9ce442fce2bf9c7fc852556 2.3.0-release
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
a82e5b1e22c7f90e3c7977d146b80588f004ed0d 2.5.0-start

View File

@ -14,6 +14,9 @@ public_build = true
# Update Public Inworld Build Status Indicators
email_status_this_is_os = true
# Limit extent of codeticket updates to revisions after...
codeticket_since = 2.2.0-release
# ========================================
# Viewer Development
# ========================================
@ -206,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,8 +364,15 @@ JB Kraft
Joghert LeSabre
VWR-64
Jonathan Yap
VWR-17801
STORM-596
STORM-523
STORM-616
STORM-679
STORM-737
STORM-726
STORM-812
VWR-17801
STORM-785
Kage Pixel
VWR-11
Ken March
@ -369,6 +386,9 @@ Khyota Wulluf
VWR-9966
Kitty Barnett
VWR-19699
STORM-288
STORM-799
STORM-800
Kunnis Basiat
VWR-82
VWR-102
@ -581,6 +601,7 @@ Robin Cornelius
STORM-422
VWR-2488
VWR-9557
VWR-10579
VWR-11128
VWR-12533
VWR-12587
@ -604,6 +625,7 @@ Sammy Frederix
VWR-6186
Satomi Ahn
STORM-501
STORM-229
Scrippy Scofield
VWR-3748
Seg Baphomet
@ -728,6 +750,8 @@ Tue Torok
CT-74
Twisted Laws
SNOW-352
STORM-466
STORM-467
Vadim Bigbear
VWR-2681
Vector Hastings
@ -768,16 +792,19 @@ WolfPup Lowenhar
STORM-102
STORM-103
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
VWR-19505
Wolfpup Lowenhar
STORM-255
STORM-256
Zarkonnen Decosta
VWR-253
Zi Ree

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

@ -1557,6 +1557,10 @@ bool LLAudioSource::hasPendingPreloads() const
LLAudioData *adp = iter->second;
// note: a bad UUID will forever be !hasDecodedData()
// but also !hasValidData(), hence the check for hasValidData()
if (!adp)
{
continue;
}
if (!adp->hasDecodedData() && adp->hasValidData())
{
// This source is still waiting for a preload

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

@ -63,9 +63,6 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap
{
LLThread *threadp = (LLThread *)datap;
// Set thread state to running
threadp->mStatus = RUNNING;
// Run the user supplied function
threadp->run();
@ -167,10 +164,25 @@ void LLThread::shutdown()
void LLThread::start()
{
apr_thread_create(&mAPRThreadp, NULL, staticRun, (void *)this, mAPRPoolp);
llassert(isStopped());
// Set thread state to running
mStatus = RUNNING;
// We won't bother joining
apr_thread_detach(mAPRThreadp);
apr_status_t status =
apr_thread_create(&mAPRThreadp, NULL, staticRun, (void *)this, mAPRPoolp);
if(status == APR_SUCCESS)
{
// We won't bother joining
apr_thread_detach(mAPRThreadp);
}
else
{
mStatus = STOPPED;
llwarns << "failed to start thread " << mName << llendl;
ll_apr_warn_status(status);
}
}
//============================================================================

View File

@ -28,14 +28,14 @@
#define LL_LLVERSIONVIEWER_H
const S32 LL_VERSION_MAJOR = 2;
const S32 LL_VERSION_MINOR = 5;
const S32 LL_VERSION_MINOR = 6;
const S32 LL_VERSION_PATCH = 0;
const S32 LL_VERSION_BUILD = 211776;
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

@ -61,8 +61,6 @@ static const std::string INV_FOLDER_ID_LABEL_WS("category_id");
///----------------------------------------------------------------------------
/// Local function declarations, constants, enums, and typedefs
///----------------------------------------------------------------------------
const U8 TASK_INVENTORY_ITEM_KEY = 0;
const U8 TASK_INVENTORY_ASSET_KEY = 1;
const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730");

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

@ -556,35 +556,43 @@ std::string LLCacheName::buildUsername(const std::string& full_name)
//static
std::string LLCacheName::buildLegacyName(const std::string& complete_name)
{
// regexp doesn't play nice with unicode, chop off the display name
//boost::regexp was showing up in the crashreporter, so doing
//painfully manual parsing using substr. LF
S32 open_paren = complete_name.rfind(" (");
S32 close_paren = complete_name.rfind(')');
if (open_paren == std::string::npos)
if (open_paren != std::string::npos &&
close_paren == complete_name.length()-1)
{
return complete_name;
S32 length = close_paren - open_paren - 2;
std::string legacy_name = complete_name.substr(open_paren+2, length);
if (legacy_name.length() > 0)
{
std::string cap_letter = legacy_name.substr(0, 1);
LLStringUtil::toUpper(cap_letter);
legacy_name = cap_letter + legacy_name.substr(1);
S32 separator = legacy_name.find('.');
if (separator != std::string::npos)
{
std::string last_name = legacy_name.substr(separator+1);
legacy_name = legacy_name.substr(0, separator);
if (last_name.length() > 0)
{
cap_letter = last_name.substr(0, 1);
LLStringUtil::toUpper(cap_letter);
legacy_name = legacy_name + " " + cap_letter + last_name.substr(1);
}
}
return legacy_name;
}
}
std::string username = complete_name.substr(open_paren);
boost::regex complete_name_regex("( \\()([a-z0-9]+)(.[a-z]+)*(\\))");
boost::match_results<std::string::const_iterator> name_results;
if (!boost::regex_match(username, name_results, complete_name_regex)) return complete_name;
std::string legacy_name = name_results[2];
// capitalize the first letter
std::string cap_letter = legacy_name.substr(0, 1);
LLStringUtil::toUpper(cap_letter);
legacy_name = cap_letter + legacy_name.substr(1);
if (name_results[3].matched)
{
std::string last_name = name_results[3];
std::string cap_letter = last_name.substr(1, 1);
LLStringUtil::toUpper(cap_letter);
last_name = cap_letter + last_name.substr(2);
legacy_name = legacy_name + " " + last_name;
}
return legacy_name;
return complete_name;
}
// This is a little bit kludgy. LLCacheNameCallback is a slot instead of a function pointer.
@ -967,6 +975,10 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup)
if (entry->mLastName.empty())
{
full_name = cleanFullName(entry->mFirstName);
//fix what we are putting in the cache
entry->mFirstName = full_name;
entry->mLastName = "Resident";
}
else
{

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

@ -203,7 +203,8 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw()
S32 width = getRect().getWidth();
S32 height = getRect().getHeight();
gl_rect_2d(0,0,width - 1 ,height - 1,mHeaderBGColor.get(),true);
F32 alpha = getCurrentTransparency();
gl_rect_2d(0,0,width - 1 ,height - 1,mHeaderBGColor.get() % alpha,true);
LLAccordionCtrlTab* parent = dynamic_cast<LLAccordionCtrlTab*>(getParent());
bool collapsible = (parent && parent->getCollapsible());

View File

@ -98,7 +98,8 @@ LLButton::Params::Params()
is_toggle("is_toggle", false),
scale_image("scale_image", true),
hover_glow_amount("hover_glow_amount"),
commit_on_return("commit_on_return", true)
commit_on_return("commit_on_return", true),
use_draw_context_alpha("use_draw_context_alpha", true)
{
addSynonym(is_toggle, "toggle");
held_down_delay.seconds = 0.5f;
@ -158,7 +159,8 @@ LLButton::LLButton(const LLButton::Params& p)
mLastDrawCharsCount(0),
mMouseDownSignal(NULL),
mMouseUpSignal(NULL),
mHeldDownSignal(NULL)
mHeldDownSignal(NULL),
mUseDrawContextAlpha(p.use_draw_context_alpha)
{
static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0);
@ -539,7 +541,7 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask)
// virtual
void LLButton::draw()
{
F32 alpha = getDrawContext().mAlpha;
F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency();
bool flash = FALSE;
static LLUICachedControl<F32> button_flash_rate("ButtonFlashRate", 0);
static LLUICachedControl<S32> button_flash_count("ButtonFlashCount", 0);

View File

@ -124,6 +124,8 @@ public:
Optional<F32> hover_glow_amount;
Optional<TimeIntervalParam> held_down_delay;
Optional<bool> use_draw_context_alpha;
Params();
};
@ -338,6 +340,8 @@ private:
S32 mImageOverlayTopPad;
S32 mImageOverlayBottomPad;
bool mUseDrawContextAlpha;
/*
* Space between image_overlay and label
*/

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

@ -94,6 +94,7 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mMaxChars(p.max_chars),
mPrearrangeCallback(p.prearrange_callback()),
mTextEntryCallback(p.text_entry_callback()),
mTextChangedCallback(p.text_changed_callback()),
mListPosition(p.list_position),
mLastSelectedIndex(-1),
mLabel(p.label)
@ -769,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)
else if (mList->getLastSelectedItem() != last_selected_item ||
(key == KEY_DOWN || key == KEY_UP) && !mList->isEmpty())
{
showList();
}
@ -833,6 +835,10 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor)
mList->deselectAllItems();
mLastSelectedIndex = -1;
}
if (mTextChangedCallback != NULL)
{
(mTextChangedCallback)(line_editor, LLSD());
}
return;
}
@ -877,6 +883,10 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor)
// RN: presumably text entry
updateSelection();
}
if (mTextChangedCallback != NULL)
{
(mTextChangedCallback)(line_editor, LLSD());
}
}
void LLComboBox::updateSelection()

View File

@ -73,7 +73,8 @@ public:
allow_new_values;
Optional<S32> max_chars;
Optional<commit_callback_t> prearrange_callback,
text_entry_callback;
text_entry_callback,
text_changed_callback;
Optional<EPreferredPosition, PreferredPositionValues> list_position;
@ -190,6 +191,7 @@ public:
void setPrearrangeCallback( commit_callback_t cb ) { mPrearrangeCallback = cb; }
void setTextEntryCallback( commit_callback_t cb ) { mTextEntryCallback = cb; }
void setTextChangedCallback( commit_callback_t cb ) { mTextChangedCallback = cb; }
void setButtonVisible(BOOL visible);
@ -220,6 +222,7 @@ private:
BOOL mTextEntryTentative;
commit_callback_t mPrearrangeCallback;
commit_callback_t mTextEntryCallback;
commit_callback_t mTextChangedCallback;
commit_callback_t mSelectionCallback;
boost::signals2::connection mTopLostSignalConnection;
S32 mLastSelectedIndex;

View File

@ -220,10 +220,15 @@ void LLDockControl::moveDockable()
case TOP:
x = dockRect.getCenterX() - dockableRect.getWidth() / 2;
y = dockRect.mTop + dockableRect.getHeight();
// unique docking used with dock tongue, so add tongue height o the Y coordinate
// unique docking used with dock tongue, so add tongue height to the Y coordinate
if (use_tongue)
{
y += mDockTongue->getHeight();
if ( y > rootRect.mTop)
{
y = rootRect.mTop;
}
}
// check is dockable inside root view rect
@ -257,7 +262,7 @@ void LLDockControl::moveDockable()
case BOTTOM:
x = dockRect.getCenterX() - dockableRect.getWidth() / 2;
y = dockRect.mBottom;
// unique docking used with dock tongue, so add tongue height o the Y coordinate
// unique docking used with dock tongue, so add tongue height to the Y coordinate
if (use_tongue)
{
y -= mDockTongue->getHeight();
@ -292,9 +297,21 @@ void LLDockControl::moveDockable()
break;
}
// move dockable
dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(),
dockableRect.getHeight());
S32 max_available_height = rootRect.getHeight() - mDockTongueY - mDockTongue->getHeight();
// A floater should be shrunk so it doesn't cover a part of its docking tongue and
// there is a space between a dockable floater and a control to which it is docked.
if (use_tongue && dockableRect.getHeight() >= max_available_height)
{
dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(), max_available_height);
mDockableFloater->reshape(dockableRect.getWidth(), dockableRect.getHeight());
}
else
{
// move dockable
dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(),
dockableRect.getHeight());
}
LLRect localDocableParentRect;
mDockableFloater->getParent()->screenRectToLocal(dockableRect,
&localDocableParentRect);

View File

@ -1,4 +1,5 @@
/**
* @file llfloater.cpp
* @brief LLFloater base class
*
@ -61,10 +62,6 @@
// use this to control "jumping" behavior when Ctrl-Tabbing
const S32 TABBED_FLOATER_OFFSET = 0;
// static
F32 LLFloater::sActiveFloaterTransparency = 0.0f;
F32 LLFloater::sInactiveFloaterTransparency = 0.0f;
std::string LLFloater::sButtonNames[BUTTON_COUNT] =
{
"llfloater_close_btn", //BUTTON_CLOSE
@ -208,14 +205,14 @@ void LLFloater::initClass()
if (ctrl)
{
ctrl->getSignal()->connect(boost::bind(&LLFloater::updateActiveFloaterTransparency));
sActiveFloaterTransparency = LLUI::sSettingGroups["config"]->getF32("ActiveFloaterTransparency");
updateActiveFloaterTransparency();
}
ctrl = LLUI::sSettingGroups["config"]->getControl("InactiveFloaterTransparency").get();
if (ctrl)
{
ctrl->getSignal()->connect(boost::bind(&LLFloater::updateInactiveFloaterTransparency));
sInactiveFloaterTransparency = LLUI::sSettingGroups["config"]->getF32("InactiveFloaterTransparency");
updateInactiveFloaterTransparency();
}
}
@ -225,7 +222,7 @@ static LLWidgetNameRegistry::StaticRegistrar sRegisterFloaterParams(&typeid(LLFl
LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
: LLPanel(), // intentionally do not pass params here, see initFromParams
mDragHandle(NULL),
mDragHandle(NULL),
mTitle(p.title),
mShortTitle(p.short_title),
mSingleInstance(p.single_instance),
@ -368,13 +365,13 @@ void LLFloater::layoutDragHandle()
// static
void LLFloater::updateActiveFloaterTransparency()
{
sActiveFloaterTransparency = LLUI::sSettingGroups["config"]->getF32("ActiveFloaterTransparency");
sActiveControlTransparency = LLUI::sSettingGroups["config"]->getF32("ActiveFloaterTransparency");
}
// static
void LLFloater::updateInactiveFloaterTransparency()
{
sInactiveFloaterTransparency = LLUI::sSettingGroups["config"]->getF32("InactiveFloaterTransparency");
sInactiveControlTransparency = LLUI::sSettingGroups["config"]->getF32("InactiveFloaterTransparency");
}
void LLFloater::addResizeCtrls()
@ -1193,6 +1190,7 @@ void LLFloater::setFocus( BOOL b )
last_focus->setFocus(TRUE);
}
}
updateTransparency(b ? TT_ACTIVE : TT_INACTIVE);
}
// virtual
@ -1465,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);
}
}
@ -1652,7 +1653,7 @@ void LLFloater::onClickCloseBtn()
// virtual
void LLFloater::draw()
{
mCurrentTransparency = hasFocus() ? sActiveFloaterTransparency : sInactiveFloaterTransparency;
const F32 alpha = getCurrentTransparency();
// draw background
if( isBackgroundVisible() )
@ -1684,12 +1685,12 @@ void LLFloater::draw()
if (image)
{
// We're using images for this floater's backgrounds
image->draw(getLocalRect(), overlay_color % mCurrentTransparency);
image->draw(getLocalRect(), overlay_color % alpha);
}
else
{
// We're not using images, use old-school flat colors
gl_rect_2d( left, top, right, bottom, color % mCurrentTransparency );
gl_rect_2d( left, top, right, bottom, color % alpha );
// draw highlight on title bar to indicate focus. RDW
if(hasFocus()
@ -1701,7 +1702,7 @@ void LLFloater::draw()
const LLFontGL* font = LLFontGL::getFontSansSerif();
LLRect r = getRect();
gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - (S32)font->getLineHeight() - 1,
titlebar_focus_color % mCurrentTransparency, 0, TRUE);
titlebar_focus_color % alpha, 0, TRUE);
}
}
}
@ -1767,10 +1768,32 @@ void LLFloater::drawShadow(LLPanel* panel)
shadow_color.mV[VALPHA] *= 0.5f;
}
gl_drop_shadow(left, top, right, bottom,
shadow_color % mCurrentTransparency,
shadow_color % getCurrentTransparency(),
llround(shadow_offset));
}
void LLFloater::updateTransparency(LLView* view, ETypeTransparency transparency_type)
{
child_list_t children = *view->getChildList();
child_list_t::iterator it = children.begin();
LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(view);
if (ctrl)
{
ctrl->setTransparencyType(transparency_type);
}
for(; it != children.end(); ++it)
{
updateTransparency(*it, transparency_type);
}
}
void LLFloater::updateTransparency(ETypeTransparency transparency_type)
{
updateTransparency(this, transparency_type);
}
void LLFloater::setCanMinimize(BOOL can_minimize)
{
// if removing minimize/restore button programmatically,
@ -2887,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

@ -284,6 +284,8 @@ public:
static void setFloaterHost(LLMultiFloater* hostp) {sHostp = hostp; }
static LLMultiFloater* getFloaterHost() {return sHostp; }
void updateTransparency(ETypeTransparency transparency_type);
protected:
@ -343,6 +345,7 @@ private:
static void updateActiveFloaterTransparency();
static void updateInactiveFloaterTransparency();
void updateTransparency(LLView* view, ETypeTransparency transparency_type);
public:
// Called when floater is opened, passes mKey
@ -411,11 +414,6 @@ private:
bool mDocked;
bool mTornOff;
F32 mCurrentTransparency;
static F32 sActiveFloaterTransparency;
static F32 sInactiveFloaterTransparency;
static LLMultiFloater* sHostp;
static BOOL sQuitting;
static std::string sButtonNames[BUTTON_COUNT];

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

@ -41,6 +41,7 @@ static LLDefaultChildRegistry::Register<LLIconCtrl> r("icon");
LLIconCtrl::Params::Params()
: image("image_name"),
color("color"),
use_draw_context_alpha("use_draw_context_alpha", true),
scale_image("scale_image")
{
tab_stop = false;
@ -51,6 +52,7 @@ LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p)
: LLUICtrl(p),
mColor(p.color()),
mImagep(p.image),
mUseDrawContextAlpha(p.use_draw_context_alpha),
mPriority(0),
mDrawWidth(0),
mDrawHeight(0)
@ -71,7 +73,8 @@ void LLIconCtrl::draw()
{
if( mImagep.notNull() )
{
mImagep->draw(getLocalRect(), mColor.get() % getDrawContext().mAlpha );
const F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency();
mImagep->draw(getLocalRect(), mColor.get() % alpha );
}
LLUICtrl::draw();

View File

@ -48,6 +48,7 @@ public:
{
Optional<LLUIImage*> image;
Optional<LLUIColor> color;
Optional<bool> use_draw_context_alpha;
Ignored scale_image;
Params();
};
@ -79,6 +80,10 @@ protected:
S32 mDrawWidth ;
S32 mDrawHeight ;
// If set to true (default), use the draw context transparency.
// If false, will use transparency returned by getCurrentTransparency(). See STORM-698.
bool mUseDrawContextAlpha;
private:
LLUIColor mColor;
LLPointer<LLUIImage> mImagep;

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,8 +1530,11 @@ void LLLineEditor::drawBackground()
{
image = mBgImage;
}
if (!image) return;
F32 alpha = getDrawContext().mAlpha;
F32 alpha = getCurrentTransparency();
// optionally draw programmatic border
if (has_focus)
{

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

@ -175,6 +175,13 @@ void LLMenuButton::updateMenuOrigin()
mY = rect.mTop + mMenuHandle.get()->getRect().getHeight();
break;
}
case MP_TOP_RIGHT:
{
const LLRect& menu_rect = mMenuHandle.get()->getRect();
mX = rect.mRight - menu_rect.getWidth();
mY = rect.mTop + menu_rect.getHeight();
break;
}
case MP_BOTTOM_LEFT:
{
mX = rect.mLeft;

View File

@ -47,6 +47,7 @@ public:
typedef enum e_menu_position
{
MP_TOP_LEFT,
MP_TOP_RIGHT,
MP_BOTTOM_LEFT
} EMenuPosition;

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

@ -194,6 +194,8 @@ void LLPanel::draw()
// draw background
if( mBgVisible )
{
alpha = getCurrentTransparency();
LLRect local_rect = getLocalRect();
if (mBgOpaque )
{
@ -434,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

@ -422,9 +422,10 @@ void LLScrollContainer::draw()
// Draw background
if( mIsOpaque )
{
F32 alpha = getCurrentTransparency();
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4fv( mBackgroundColor.get().mV );
gl_rect_2d( mInnerRect );
gl_rect_2d(mInnerRect, mBackgroundColor.get() % alpha);
}
// Draw mScrolledViews and update scroll bars.

View File

@ -83,7 +83,14 @@ void LLScrollColumnHeader::draw()
&& (sort_column == mColumn->mSortingColumn || sort_column == mColumn->mName);
BOOL is_ascending = mColumn->mParentCtrl->getSortAscending();
setImageOverlay(is_ascending ? "up_arrow.tga" : "down_arrow.tga", LLFontGL::RIGHT, draw_arrow ? LLColor4::white : LLColor4::transparent);
if (draw_arrow)
{
setImageOverlay(is_ascending ? "up_arrow.tga" : "down_arrow.tga", LLFontGL::RIGHT, LLColor4::white);
}
else
{
setImageOverlay(LLUUID::null);
}
// Draw children
LLButton::draw();

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());
}
@ -1482,8 +1483,9 @@ void LLScrollListCtrl::draw()
// Draw background
if (mBackgroundVisible)
{
F32 alpha = getCurrentTransparency();
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gl_rect_2d(background, getEnabled() ? mBgWriteableColor.get() : mBgReadOnlyColor.get() );
gl_rect_2d(background, getEnabled() ? mBgWriteableColor.get() % alpha : mBgReadOnlyColor.get() % alpha );
}
if (mColumnsDirty)
@ -2370,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);
}
}
@ -2419,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;
}
}
@ -2581,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
@ -2604,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;
}
}
@ -2667,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
@ -2701,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;
@ -2744,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;
}
@ -2805,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());
}
@ -2842,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
@ -2857,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

@ -1005,6 +1005,7 @@ void LLTextBase::draw()
if (mBGVisible)
{
F32 alpha = getCurrentTransparency();
// clip background rect against extents, if we support scrolling
LLRect bg_rect = mVisibleTextRect;
if (mScroller)
@ -1016,7 +1017,7 @@ void LLTextBase::draw()
: hasFocus()
? mFocusBgColor.get()
: mWriteableBgColor.get();
gl_rect_2d(doc_rect, bg_color, TRUE);
gl_rect_2d(doc_rect, bg_color % alpha, TRUE);
}
// draw document view

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

@ -950,7 +950,7 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor
}
// Draw gray and white checkerboard with black border
void gl_rect_2d_checkerboard(const LLRect& rect)
void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha)
{
// Initialize the first time this is called.
const S32 PIXELS = 32;
@ -971,11 +971,11 @@ void gl_rect_2d_checkerboard(const LLRect& rect)
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
// ...white squares
gGL.color3f( 1.f, 1.f, 1.f );
gGL.color4f( 1.f, 1.f, 1.f, alpha );
gl_rect_2d(rect);
// ...gray squares
gGL.color3f( .7f, .7f, .7f );
gGL.color4f( .7f, .7f, .7f, alpha );
gGL.flush();
glPolygonStipple( checkerboard );
@ -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

@ -79,7 +79,7 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LL
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset = 0, BOOL filled = TRUE );
void gl_rect_2d(const LLRect& rect, BOOL filled = TRUE );
void gl_rect_2d(const LLRect& rect, const LLColor4& color, BOOL filled = TRUE );
void gl_rect_2d_checkerboard(const LLRect& rect);
void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha = 1.0f);
void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines);

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

@ -36,6 +36,9 @@
static LLDefaultChildRegistry::Register<LLUICtrl> r("ui_ctrl");
F32 LLUICtrl::sActiveControlTransparency = 1.0f;
F32 LLUICtrl::sInactiveControlTransparency = 1.0f;
// Compiler optimization, generate extern template
template class LLUICtrl* LLView::getChild<class LLUICtrl>(
const std::string& name, BOOL recurse) const;
@ -110,7 +113,8 @@ LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel)
mMouseUpSignal(NULL),
mRightMouseDownSignal(NULL),
mRightMouseUpSignal(NULL),
mDoubleClickSignal(NULL)
mDoubleClickSignal(NULL),
mTransparencyType(TT_DEFAULT)
{
mUICtrlHandle.bind(this);
}
@ -823,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())
{
@ -923,6 +927,37 @@ BOOL LLUICtrl::getTentative() const
void LLUICtrl::setColor(const LLColor4& color)
{ }
F32 LLUICtrl::getCurrentTransparency()
{
F32 alpha = 0;
switch(mTransparencyType)
{
case TT_DEFAULT:
alpha = getDrawContext().mAlpha;
break;
case TT_ACTIVE:
alpha = sActiveControlTransparency;
break;
case TT_INACTIVE:
alpha = sInactiveControlTransparency;
break;
case TT_FADING:
alpha = sInactiveControlTransparency / 2;
break;
}
return alpha;
}
void LLUICtrl::setTransparencyType(ETypeTransparency type)
{
mTransparencyType = type;
}
boost::signals2::connection LLUICtrl::setCommitCallback( const commit_signal_t::slot_type& cb )
{
if (!mCommitSignal) mCommitSignal = new commit_signal_t();

View File

@ -120,6 +120,13 @@ public:
Params();
};
enum ETypeTransparency
{
TT_DEFAULT,
TT_ACTIVE, // focused floater
TT_INACTIVE, // other floaters
TT_FADING, // fading toast
};
/*virtual*/ ~LLUICtrl();
void initFromParams(const Params& p);
@ -202,6 +209,11 @@ public:
virtual void setColor(const LLColor4& color);
F32 getCurrentTransparency();
void setTransparencyType(ETypeTransparency type);
ETypeTransparency getTransparencyType() const {return mTransparencyType;}
BOOL focusNextItem(BOOL text_entry_only);
BOOL focusPrevItem(BOOL text_entry_only);
BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
@ -283,6 +295,10 @@ protected:
boost::signals2::connection mMakeVisibleControlConnection;
LLControlVariable* mMakeInvisibleControlVariable;
boost::signals2::connection mMakeInvisibleControlConnection;
static F32 sActiveControlTransparency;
static F32 sInactiveControlTransparency;
private:
BOOL mTabStop;
@ -290,6 +306,8 @@ private:
BOOL mTentative;
LLRootHandle<LLUICtrl> mUICtrlHandle;
ETypeTransparency mTransparencyType;
class DefaultTabGroupFirstSorter;
};

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