diff --git a/.gitignore b/.gitignore index 6d75a91f5..1d7b8efd4 100644 --- a/.gitignore +++ b/.gitignore @@ -216,6 +216,7 @@ code/ryzom/server/src/ryzom_admin_service/ryzom_admin_service code/ryzom/server/src/ryzom_naming_service/ryzom_naming_service code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service code/ryzom/server/src/tick_service/tick_service + # WebTT temp dir code/ryzom/tools/server/www/webtt/app/tmp @@ -236,13 +237,13 @@ code/ryzom/tools/server/ryzom_ams/old -#tools and external dir's +# Tools and external directories external external_stlport nel_tools* ryzom_tools* -#Dumps +# Dumps *.dmp code/nel/tools/build_gamedata/processes/ai_wmap/ai_build_wmap.cfg diff --git a/.travis.yml b/.travis.yml index ec12c9989..33b3d0f8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ os: matrix: fast_finish: true env: - - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS=OFF -DWITH_NEL_SAMPLES=OFF -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_NEL_TOOLS=OFF" + - CMAKE_CONFIGURE_OPTIONS="-DWITH_NEL_TESTS=OFF -DWITH_NEL_SAMPLES=ON -DWITH_LUA51=ON -DWITH_RYZOM_SERVER=OFF -DWITH_RYZOM_TOOLS=OFF -DWITH_NEL_TOOLS=OFF" - CMAKE_CONFIGURE_OPTIONS="-DCPPTEST_LIBRARY_DEBUG:STRING=/usr/lib/libcpptest.so" CMAKE_BUILD_OPTIONS="--target nel_unit_test -- -j 2" RUN="build/bin/nel_unit_test" diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 425f296f5..681f7a959 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -53,8 +53,8 @@ ENDIF() CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(RyzomCore CXX C) -SET(NL_VERSION_MAJOR 0) -SET(NL_VERSION_MINOR 12) +SET(NL_VERSION_MAJOR 1) +SET(NL_VERSION_MINOR 0) SET(NL_VERSION_PATCH 0) SET(YEAR "2004-${CURRENT_YEAR}") SET(AUTHOR "Winch Gate and The Ryzom Core Community") @@ -86,12 +86,12 @@ NL_SETUP_NELNS_DEFAULT_OPTIONS() NL_SETUP_RYZOM_DEFAULT_OPTIONS() NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS() -NL_SETUP_PREFIX_PATHS() -RYZOM_SETUP_PREFIX_PATHS() - NL_SETUP_BUILD() NL_SETUP_BUILD_FLAGS() +NL_SETUP_PREFIX_PATHS() +RYZOM_SETUP_PREFIX_PATHS() + #----------------------------------------------------------------------------- #Platform specifics @@ -167,6 +167,7 @@ ENDIF() IF(APPLE) FIND_LIBRARY(CARBON_FRAMEWORK Carbon) FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation) + FIND_LIBRARY(SECURITY_FRAMEWORK Security) IF(APPLE_CERTIFICATE) # Find codesign_allocate @@ -191,214 +192,10 @@ IF(APPLE) ENDIF() ENDIF() -MACRO(ADD_QT_LIBRARY _NAME) - IF(WIN32) - SET(_PREFIX "Qt5") - SET(_EXT "lib") - ELSE() - SET(_PREFIX "libQt5") - SET(_EXT "a") - ENDIF() - SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}.${_EXT}") - IF(EXISTS ${_LIB}) - SET(QT_LIBRARIES ${QT_LIBRARIES} optimized ${_LIB}) - ENDIF() - SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}d.${_EXT}") - IF(EXISTS ${_LIB}) - SET(QT_LIBRARIES ${QT_LIBRARIES} debug ${_LIB}) - ENDIF() -ENDMACRO() - -MACRO(ADD_QT_PLUGIN _TYPE _NAME) - IF(WIN32) - SET(_PREFIX "") - SET(_EXT "lib") - ELSE() - SET(_PREFIX "lib") - SET(_EXT "a") - ENDIF() - SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}.${_EXT}") - IF(EXISTS ${_LIB}) - SET(QT_LIBRARIES ${QT_LIBRARIES} optimized ${_LIB}) - ENDIF() - SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}d.${_EXT}") - IF(EXISTS ${_LIB}) - SET(QT_LIBRARIES ${QT_LIBRARIES} debug ${_LIB}) - ENDIF() -ENDMACRO() +INCLUDE(FindHelpers) IF(WITH_QT5) - CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR) - - SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR}) - - FIND_PACKAGE(Qt5Core QUIET) - - IF(Qt5Core_FOUND) - # Check if we are using Qt static or shared libraries - GET_TARGET_PROPERTY(_FILE Qt5::Core IMPORTED_LOCATION_RELEASE) - - SET(QT_VERSION "${Qt5Core_VERSION_STRING}") - SET(_VERSION "${QT_VERSION}") - - IF(_FILE MATCHES "\\.(lib|a)$") - SET(QT_STATIC ON) - SET(_VERSION "${_VERSION} static version") - ELSE() - SET(QT_STATIC OFF) - SET(_VERSION "${_VERSION} shared version") - ENDIF() - - MESSAGE(STATUS "Found Qt ${_VERSION}") - - # These variables are not defined with Qt5 CMake modules - SET(QT_BINARY_DIR "${_qt5Core_install_prefix}/bin") - SET(QT_LIBRARY_DIR "${_qt5Core_install_prefix}/lib") - SET(QT_PLUGINS_DIR "${_qt5Core_install_prefix}/plugins") - SET(QT_TRANSLATIONS_DIR "${_qt5Core_install_prefix}/translations") - - # Fix wrong include directories with Qt 5 under Mac OS X - INCLUDE_DIRECTORIES("${_qt5Core_install_prefix}/include") - - FIND_PACKAGE(Qt5Gui) - FIND_PACKAGE(Qt5Widgets) - FIND_PACKAGE(Qt5OpenGL) - FIND_PACKAGE(Qt5Xml) - FIND_PACKAGE(Qt5LinguistTools) - FIND_PACKAGE(Qt5Network) - - IF(QT_STATIC) - ADD_DEFINITIONS(-DQT_STATICPLUGIN) - - SET(QT_LIBRARIES Qt5::Widgets) - - # Gui - SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Gui Qt5::OpenGL) - - ADD_QT_LIBRARY(PrintSupport) - - IF(WIN32) - SET(QT_LIBRARIES ${QT_LIBRARIES} - ${WINSDK_LIBRARY_DIR}/Imm32.lib - ${WINSDK_LIBRARY_DIR}/OpenGL32.lib - ${WINSDK_LIBRARY_DIR}/WinMM.Lib) - ADD_QT_PLUGIN(platforms qwindows) - ADD_QT_LIBRARY(PlatformSupport) - ELSEIF(APPLE) - # Cups needs .dylib - SET(OLD_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib) - FIND_LIBRARY(CUPS_LIBRARY cups) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_CMAKE_FIND_LIBRARY_SUFFIXES}) - - FIND_LIBRARY(IOKIT_FRAMEWORK IOKit) - FIND_LIBRARY(COCOA_FRAMEWORK Cocoa) - FIND_LIBRARY(SYSTEMCONFIGURATION_FRAMEWORK SystemConfiguration) - FIND_LIBRARY(OPENGL_FRAMEWORK NAMES OpenGL) - - SET(QT_LIBRARIES ${QT_LIBRARIES} - ${CUPS_LIBRARY} - ${COCOA_FRAMEWORK} - ${SYSTEMCONFIGURATION_FRAMEWORK} - ${IOKIT_FRAMEWORK} - ${OPENGL_FRAMEWORK}) - - ADD_QT_PLUGIN(printsupport cocoaprintersupport) - ADD_QT_PLUGIN(platforms qcocoa) - ADD_QT_LIBRARY(PlatformSupport) - ELSE() - # order is very important there - ADD_QT_PLUGIN(platforms qxcb) - ADD_QT_PLUGIN(xcbglintegrations qxcb-glx-integration) - - ADD_QT_LIBRARY(XcbQpa) - ADD_QT_LIBRARY(PlatformSupport) - SET(QT_LIBRARIES ${QT_LIBRARIES} -lX11-xcb -lXi -lSM -lICE -lxcb -lGL -lxcb-glx) - IF(EXISTS "${QT_LIBRARY_DIR}/libxcb-static.a") - SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_LIBRARY_DIR}/libxcb-static.a") - ENDIF() - SET(QT_LIBRARIES ${QT_LIBRARIES} -lfontconfig) - ADD_QT_LIBRARY(DBus) - ENDIF() - - ADD_QT_PLUGIN(imageformats qgif) - ADD_QT_PLUGIN(imageformats qicns) - ADD_QT_PLUGIN(imageformats qico) - ADD_QT_PLUGIN(imageformats qjpeg) - - # harfbuzz is needed since Qt 5.3 - IF(UNIX) - SET(HB_LIB "${QT_LIBRARY_DIR}/libqtharfbuzzng.a") - ELSEIF(WIN32) - SET(HB_LIB "${QT_LIBRARY_DIR}/qtharfbuzzng.lib") - ENDIF() - IF(EXISTS ${HB_LIB}) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${HB_LIB}) - ENDIF() - - # freetype is needed since Qt 5.5 - FIND_PACKAGE(Freetype) - - IF(FREETYPE_FOUND) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIBRARIES}) - ELSE() - IF(UNIX) - SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a") - ELSEIF(WIN32) - SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/qtfreetype.lib") - ENDIF() - IF(EXISTS ${FREETYPE_LIB}) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIB}) - ENDIF() - ENDIF() - - ADD_QT_PLUGIN(accessible qtaccessiblewidgets) - - SET(QT_LIBRARIES ${QT_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARY}) - - # Network - SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Network Qt5::Xml) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES}) - - IF(WIN32) - SET(QT_LIBRARIES ${QT_LIBRARIES} - ${WINSDK_LIBRARY_DIR}/Crypt32.lib - ${WINSDK_LIBRARY_DIR}/WS2_32.Lib - ${WINSDK_LIBRARY_DIR}/IPHlpApi.Lib) - ENDIF() - - # Core - SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Core) - - # pcre is needed since Qt 5.5 - IF(UNIX) - SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre.a") - ELSEIF(WIN32) - SET(PCRE_LIB "${QT_LIBRARY_DIR}/qtpcre.lib") - ENDIF() - IF(EXISTS ${PCRE_LIB}) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${PCRE_LIB}) - ENDIF() - - IF(APPLE) - FIND_LIBRARY(PCRE_LIBRARY pcre16 pcre) - - FIND_LIBRARY(SECURITY_FRAMEWORK Security) - - SET(QT_LIBRARIES ${QT_LIBRARIES} - ${PCRE_LIBRARY} - ${FOUNDATION_FRAMEWORK} - ${CARBON_FRAMEWORK} - ${SECURITY_FRAMEWORK}) - ELSEIF(UNIX) - SET(QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} -ldl -lrt) - ENDIF() - ELSE() - SET(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Gui Qt5::OpenGL Qt5::Core) - ENDIF() - ELSE() - MESSAGE(WARNING "Unable to find Qt 5") - ENDIF() + FIND_QT5() ENDIF() IF(WITH_QT) @@ -430,22 +227,41 @@ IF(WITH_NEL) IF(CURL_STATIC) SET(CURL_DEFINITIONS -DCURL_STATICLIB) - SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR}) - SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) + LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) + LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES}) - IF(UNIX) + IF(WIN32) + LIST(APPEND CURL_LIBRARIES Crypt32 Cryptui) + ELSE() # CURL depends on libidn FIND_LIBRARY(IDN_LIBRARY idn) IF(IDN_LIBRARY) - SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY}) + LIST(APPEND CURL_LIBRARIES ${IDN_LIBRARY}) ENDIF() - # CURL Macports version depends on libidn, libintl and libiconv too + # CURL Macports version can depend on libidn, libidn2, libintl, libpsl and libiconv too IF(APPLE) FIND_LIBRARY(INTL_LIBRARY intl) IF(INTL_LIBRARY) - SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${INTL_LIBRARY}) + LIST(APPEND CURL_LIBRARIES ${INTL_LIBRARY}) ENDIF() + + FIND_LIBRARY(IDN2_LIBRARY idn2) + IF(IDN2_LIBRARY) + LIST(APPEND CURL_LIBRARIES ${IDN2_LIBRARY}) + ENDIF() + + FIND_LIBRARY(PSL_LIBRARY psl) + IF(PSL_LIBRARY) + LIST(APPEND CURL_LIBRARIES ${PSL_LIBRARY}) + ENDIF() + + FIND_LIBRARY(UNISTRING_LIBRARY unistring) + IF(UNISTRING_LIBRARY) + LIST(APPEND CURL_LIBRARIES ${UNISTRING_LIBRARY}) + ENDIF() + + LIST(APPEND CURL_LIBRARIES ${SECURITY_FRAMEWORK}) ENDIF() ENDIF() ENDIF() @@ -453,6 +269,19 @@ IF(WITH_NEL) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include) ADD_SUBDIRECTORY(nel) + + # Aliases for targets + SET(NELMISC_LIBRARIES nelmisc) + SET(NELNET_LIBRARIES nelnet) + SET(NELLIGO_LIBRARIES nelligo) + SET(NELGEORGES_LIBRARIES nelgeorges) + SET(NEL3D_LIBRARIES nel3d) + SET(NELGUI_LIBRARIES nelgui) + SET(NELSOUND_LIBRARIES nelsound) +ELSE() +# FIND_PACKAGE(NeL COMPONENTS 3d misc pacs sound nimp REQUIRED) + FIND_PACKAGE(NeL REQUIRED) + INCLUDE_DIRECTORIES(${NEL_INCLUDE_DIRS}) ENDIF() IF(WITH_RYZOM) diff --git a/code/CMakeModules/FindHelpers.cmake b/code/CMakeModules/FindHelpers.cmake new file mode 100644 index 000000000..bc38354f4 --- /dev/null +++ b/code/CMakeModules/FindHelpers.cmake @@ -0,0 +1,959 @@ +MACRO(CONVERT_NUMBER_VERSION _VERSION_NUMBER _BASE _OUT) + SET(${_OUT}) + SET(_NUMBER ${_VERSION_NUMBER}) + WHILE(_NUMBER GREATER 0) + MATH(EXPR _TEMP "${_NUMBER} % ${_BASE}") + LIST(APPEND ${_OUT} ${_TEMP}) + MATH(EXPR _NUMBER "${_NUMBER} / ${_BASE}") + ENDWHILE() +ENDMACRO(CONVERT_NUMBER_VERSION) + +FUNCTION(JOIN VALUES GLUE OUTPUT) + STRING(REGEX REPLACE "([^\\]|^);" "\\1${GLUE}" _TMP_STR "${VALUES}") + STRING(REGEX REPLACE "[\\](.)" "\\1" _TMP_STR "${_TMP_STR}") #fixes escaping + SET(${OUTPUT} "${_TMP_STR}" PARENT_SCOPE) +ENDFUNCTION() + +MACRO(PARSE_VERSION_OTHER FILENAME) + IF(EXISTS ${FILENAME}) + SET(_FILTER_ARRAY ${ARGN}) + JOIN("${_FILTER_ARRAY}" "|" _FILTER_REGEX) + FILE(STRINGS ${FILENAME} _FILE REGEX "(${_FILTER_REGEX})[: \t=\(\)\"]+([0-9.]+)") + + IF(_FILE) + FOREACH(_LINE ${_FILE}) + FOREACH(_VAR ${_FILTER_ARRAY}) + IF("${${_VAR}}" STREQUAL "") + STRING(REGEX REPLACE "^.*${_VAR}[: \t=\(\)\"]+([0-9.]+).*$" "\\1" ${_VAR} "${_LINE}") + IF(${_VAR} STREQUAL "${_LINE}") + SET(${_VAR}) + ENDIF() + IF(NOT ${_VAR} AND NOT STREQUAL "0") + SET(${_VAR} 0) + ENDIF() + ENDIF() + ENDFOREACH() + ENDFOREACH() + ENDIF() + ENDIF() +ENDMACRO() + +# macro to define FIND_PACKAGE options with a different package name +MACRO(FIX_PACKAGE_OPTIONS OLDNAME NEWNAME) + # append other options if needed + SET(_OPTIONS COMPONENTS REQUIRED QUIETLY) + + # process each options + FOREACH(_OPTION ${_OPTIONS}) + SET(OLD_OPTION ${OLDNAME}_FIND_${_OPTION}) + IF(DEFINED ) + SET(NEW_OPTION ${NEWNAME}_FIND_${_OPTION}) + SET(${NEW_OPTION} ${OLD_OPTION}) + ENDIF() + ENDFOREACH() +ENDMACRO() + +MACRO(FIND_PACKAGE_HELPER NAME INCLUDE) + # Looks for a directory containing NAME. + # + # NAME is the name of the library, lowercase and uppercase can be mixed + # It should be EXACTLY (same case) the same part as XXXX in FindXXXX.cmake + # + # INCLUDE is the file to check for includes + # + # Following parameters are optional variables and must be prefixed by: + # + # RELEASE is the list of libraries to check in release mode + # DEBUG is the list of libraries to check in debug mode + # SUFFIXES is the PATH_SUFFIXES to check for include file + # QUIET don't display anything + # VERBOSE display more details if not found + # REQUIRED throw an error if not found + # DIR is the base directory where to look for + # + # The first match will be used in the specified order and next matches will be ignored + # + # The following values are defined + # NAME_INCLUDE_DIR - where to find NAME + # NAME_LIBRARIES - link against these to use NAME + # NAME_FOUND - True if NAME is available. + + SET(_PARAMS ${ARGN}) + + SET(_RELEASE_LIBRARIES) + SET(_DEBUG_LIBRARIES) + SET(_SUFFIXES) + SET(_BASE_DIRECTORIES) + + SET(_IS_RELEASE OFF) + SET(_IS_DEBUG OFF) + SET(_IS_SUFFIXES OFF) + SET(_IS_VERBOSE OFF) + SET(_IS_DIR OFF) + + IF(_PARAMS) + FOREACH(_PARAM ${_PARAMS}) + IF(_PARAM STREQUAL "RELEASE") + SET(_IS_RELEASE ON) + SET(_IS_DEBUG OFF) + SET(_IS_SUFFIXES OFF) + SET(_IS_DIR OFF) + ELSEIF(_PARAM STREQUAL "DEBUG") + SET(_IS_RELEASE OFF) + SET(_IS_DEBUG ON) + SET(_IS_SUFFIXES OFF) + SET(_IS_DIR OFF) + ELSEIF(_PARAM STREQUAL "SUFFIXES") + SET(_IS_RELEASE OFF) + SET(_IS_DEBUG OFF) + SET(_IS_DIR OFF) + SET(_IS_SUFFIXES ON) + ELSEIF(_PARAM STREQUAL "QUIET") + SET(_IS_RELEASE OFF) + SET(_IS_DEBUG OFF) + SET(_IS_SUFFIXES OFF) + SET(_IS_DIR OFF) + SET(${NAME}_FIND_QUIETLY ON) + ELSEIF(_PARAM STREQUAL "VERBOSE") + SET(_IS_RELEASE OFF) + SET(_IS_DEBUG OFF) + SET(_IS_SUFFIXES OFF) + SET(_IS_DIR OFF) + SET(_IS_VERBOSE ON) + ELSEIF(_PARAM STREQUAL "REQUIRED") + SET(_IS_RELEASE OFF) + SET(_IS_DEBUG OFF) + SET(_IS_SUFFIXES OFF) + SET(_IS_DIR OFF) + SET(${NAME}_FIND_REQUIRED ON) + ELSEIF(_PARAM STREQUAL "DIR") + SET(_IS_RELEASE OFF) + SET(_IS_DEBUG OFF) + SET(_IS_SUFFIXES OFF) + SET(_IS_DIR ON) + ELSE() + IF(_IS_RELEASE) + LIST(APPEND _RELEASE_LIBRARIES ${_PARAM}) + ELSEIF(_IS_DEBUG) + LIST(APPEND _DEBUG_LIBRARIES ${_PARAM}) + ELSEIF(_IS_SUFFIXES) + LIST(APPEND _SUFFIXES ${_PARAM}) + ELSEIF(_IS_DIR) + LIST(APPEND _BASE_DIRECTORIES ${_PARAM}) + ELSE() + MESSAGE(STATUS "parameter ${_PARAM} with no prefix") + ENDIF() + ENDIF() + ENDFOREACH() + ENDIF() + + # Fixes names if invalid characters are found + IF("${NAME}" MATCHES "^[a-zA-Z0-9]+$") + SET(_NAME_FIXED ${NAME}) + ELSE() + # if invalid characters are detected, replace them by valid ones + STRING(REPLACE "+" "p" _NAME_FIXED ${NAME}) + ENDIF() + + # Create uppercase and lowercase versions of NAME + STRING(TOUPPER ${NAME} _UPNAME) + STRING(TOLOWER ${NAME} _LOWNAME) + + STRING(TOUPPER ${_NAME_FIXED} _UPNAME_FIXED) + STRING(TOLOWER ${_NAME_FIXED} _LOWNAME_FIXED) + + SET(_SUFFIXES ${_SUFFIXES} ${_LOWNAME} ${_LOWNAME_FIXED} ${NAME}) + +# Don't use pkg-config +# IF(NOT WIN32 AND NOT IOS) +# FIND_PACKAGE(PkgConfig QUIET) +# SET(_MODULES ${_LOWNAME} ${_RELEASE_LIBRARIES}) +# LIST(REMOVE_DUPLICATES _MODULES) +# IF(PKG_CONFIG_EXECUTABLE) +# PKG_SEARCH_MODULE(PKG_${_NAME_FIXED} QUIET ${_MODULES}) +# ENDIF() +# ENDIF() + + SET(_INCLUDE_PATHS) + SET(_LIBRARY_PATHS) + + # Check for root directories passed to CMake with -DXXX_DIR=... + IF(DEFINED ${_UPNAME_FIXED}_DIR) + SET(_TMP ${${_UPNAME_FIXED}_DIR}) + GET_FILENAME_COMPONENT(_TMP ${_TMP} ABSOLUTE) + LIST(APPEND _INCLUDE_PATHS ${_TMP}/include ${_TMP}) + LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX}) + + IF(_IS_VERBOSE) + MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}") + ENDIF() + ENDIF() + + IF(DEFINED ${_UPNAME}_DIR) + SET(_TMP ${${_UPNAME}_DIR}) + LIST(APPEND _INCLUDE_PATHS ${_TMP}/include ${_TMP}) + LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX}) + + IF(_IS_VERBOSE) + MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}") + ENDIF() + ENDIF() + + IF(_BASE_DIRECTORIES) + FOREACH(_DIR ${_BASE_DIRECTORIES}) + IF(_DIR) + LIST(APPEND _INCLUDE_PATHS ${_DIR}/include ${_DIR}) + LIST(APPEND _LIBRARY_PATHS ${_DIR}/lib${LIB_SUFFIX}) + + IF(_IS_VERBOSE) + MESSAGE(STATUS "Using ${_DIR} as root directory") + ENDIF() + ENDIF() + ENDFOREACH() + ENDIF() + + IF(UNIX) + # Append UNIX standard include paths + SET(_UNIX_INCLUDE_PATHS) + + # Append multiarch include paths + IF(CMAKE_LIBRARY_ARCHITECTURE) + LIST(APPEND _UNIX_INCLUDE_PATHS + /usr/local/include/${CMAKE_LIBRARY_ARCHITECTURE} + /usr/include/${CMAKE_LIBRARY_ARCHITECTURE}) + ENDIF() + + LIST(APPEND _UNIX_INCLUDE_PATHS + /usr/local/include + /usr/include + /sw/include + /opt/local/include + /opt/csw/include + /opt/include) + ENDIF() + + IF(_IS_VERBOSE) + MESSAGE(STATUS "Searching header ${INCLUDE} in: ${_INCLUDE_PATHS} with suffixes ${_SUFFIXES}") + ENDIF() + + # Search for include directory + FIND_PATH(${_UPNAME_FIXED}_INCLUDE_DIR + NAMES ${INCLUDE} + HINTS + ${PKG_${_NAME_FIXED}_INCLUDE_DIRS} + ${_INCLUDE_PATHS} + $ENV{${_UPNAME}_DIR}/include + $ENV{${_UPNAME_FIXED}_DIR}/include + $ENV{${_UPNAME}_DIR} + $ENV{${_UPNAME_FIXED}_DIR} + PATHS + ${_UNIX_INCLUDE_PATHS} + PATH_SUFFIXES + ${_SUFFIXES} + DOC "Include path for ${NAME}" + ) + + IF(_IS_VERBOSE) + IF(${_UPNAME_FIXED}_INCLUDE_DIR) + MESSAGE(STATUS "${INCLUDE} found in ${${_UPNAME_FIXED}_INCLUDE_DIR}") + ELSE() + MESSAGE(STATUS "${INCLUDE} not found") + ENDIF() + ENDIF() + + # Append environment variables XXX_DIR + LIST(APPEND _LIBRARY_PATHS + $ENV{${_UPNAME}_DIR}/lib${LIB_SUFFIX} + $ENV{${_UPNAME_FIXED}_DIR}/lib${LIB_SUFFIX}) + + IF(UNIX) + SET(_UNIX_LIBRARY_PATHS) + + # Append multiarch libraries paths + IF(CMAKE_LIBRARY_ARCHITECTURE) + LIST(APPEND _UNIX_LIBRARY_PATHS + /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} + /lib/${CMAKE_LIBRARY_ARCHITECTURE} + /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}) + ENDIF() + + # Append UNIX standard libraries paths + LIST(APPEND _UNIX_LIBRARY_PATHS + /usr/local/lib + /usr/lib + /lib + /usr/local/X11R6/lib + /usr/X11R6/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib${LIB_SUFFIX}) + ENDIF() + + LIST(APPEND _RELEASE_LIBRARIES ${_LOWNAME} ${_LOWNAME_FIXED} ${NAME} ${_NAME_FIXED}) + LIST(APPEND _DEBUG_LIBRARIES ${_LOWNAME}d ${_LOWNAME_FIXED}d ${NAME}d ${_NAME_FIXED}d) + + # Under Windows, some libs may need the lib prefix + IF(WIN32) + SET(_LIBS ${_RELEASE_LIBRARIES}) + FOREACH(_LIB ${_LIBS}) + LIST(APPEND _RELEASE_LIBRARIES lib${_LIB}) + ENDFOREACH() + + SET(_LIBS ${_DEBUG_LIBRARIES}) + FOREACH(_LIB ${_LIBS}) + LIST(APPEND _DEBUG_LIBRARIES lib${_LIB}) + ENDFOREACH() + ENDIF() + + LIST(REMOVE_DUPLICATES _RELEASE_LIBRARIES) + LIST(REMOVE_DUPLICATES _DEBUG_LIBRARIES) + + # Search for release library + FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_RELEASE + NAMES + ${_RELEASE_LIBRARIES} + HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS} + PATHS + ${_LIBRARY_PATHS} + ${_UNIX_LIBRARY_PATHS} + NO_CMAKE_SYSTEM_PATH + ) + + IF(_IS_VERBOSE) + IF(${_UPNAME_FIXED}_LIBRARY_RELEASE) + MESSAGE(STATUS "${NAME} release library found: ${${_UPNAME_FIXED}_LIBRARY_RELEASE}") + ELSE() + MESSAGE(STATUS "${NAME} release library not found in ${_LIBRARY_PATHS};${_UNIX_LIBRARY_PATHS}") + ENDIF() + ENDIF() + + # Search for debug library + FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_DEBUG + NAMES + ${_DEBUG_LIBRARIES} + HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS} + PATHS + ${_LIBRARY_PATHS} + ${_UNIX_LIBRARY_PATHS} + NO_CMAKE_SYSTEM_PATH + ) + + IF(_IS_VERBOSE) + IF(${_UPNAME_FIXED}_LIBRARY_DEBUG) + MESSAGE(STATUS "${NAME} debug library found: ${${_UPNAME_FIXED}_LIBRARY_DEBUG}") + ELSE() + MESSAGE(STATUS "${NAME} debug library not found") + ENDIF() + ENDIF() + + SET(${_UPNAME_FIXED}_FOUND OFF) + + IF(${_UPNAME_FIXED}_INCLUDE_DIR) + # Set also _INCLUDE_DIRS + SET(${_UPNAME_FIXED}_INCLUDE_DIRS ${${_UPNAME_FIXED}_INCLUDE_DIR}) + ENDIF() + + # Library has been found if at least only one library and include are found + IF(${_UPNAME_FIXED}_LIBRARY_RELEASE AND ${_UPNAME_FIXED}_LIBRARY_DEBUG) + # Release and debug libraries found + SET(${_UPNAME_FIXED}_FOUND ON) + SET(${_UPNAME_FIXED}_LIBRARIES optimized ${${_UPNAME_FIXED}_LIBRARY_RELEASE} debug ${${_UPNAME_FIXED}_LIBRARY_DEBUG}) + SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE}) + ELSEIF(${_UPNAME_FIXED}_LIBRARY_RELEASE) + # Release library found + SET(${_UPNAME_FIXED}_FOUND ON) + SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_RELEASE}) + SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE}) + ELSEIF(${_UPNAME_FIXED}_LIBRARY_DEBUG) + # Debug library found + SET(${_UPNAME_FIXED}_FOUND ON) + SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_DEBUG}) + SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_DEBUG}) + ENDIF() + + IF(${_UPNAME_FIXED}_FOUND) + IF(NOT ${NAME}_FIND_QUIETLY) + MESSAGE(STATUS "Found ${NAME}: ${${_UPNAME_FIXED}_LIBRARIES}") + ENDIF() + ELSE() + IF(${NAME}_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Error: Unable to find ${NAME}!") + ENDIF() + IF(NOT ${NAME}_FIND_QUIETLY) + MESSAGE(STATUS "Warning: Unable to find ${NAME}!") + ENDIF() + ENDIF() + + MARK_AS_ADVANCED(${_UPNAME_FIXED}_LIBRARY_RELEASE ${_UPNAME_FIXED}_LIBRARY_DEBUG) +ENDMACRO() + +MACRO(MESSAGE_VERSION_PACKAGE_HELPER NAME VERSION) + MESSAGE(STATUS "Found ${NAME} ${VERSION}: ${ARGN}") +ENDMACRO() + +MACRO(FIND_LIBRARY_HELPER NAME) + # Looks for libraries. + # + # NAME is the name of the library, lowercase and uppercase can be mixed + # + # Following parameters are optional variables and must be prefixed by: + # + # RELEASE is the list of libraries to check in release mode + # DEBUG is the list of libraries to check in debug mode + # VERBOSE display more details if not found + # REQUIRED throw an error if not found + # DIR is the base directory where to look for + # + # The first match will be used in the specified order and next matches will be ignored + # + # The following values are defined + # NAME_LIBRARIES - link against these to use NAME + + SET(_PARAMS ${ARGN}) + + SET(_RELEASE_LIBRARIES) + SET(_DEBUG_LIBRARIES) + SET(_BASE_DIRECTORIES) + + SET(_IS_RELEASE OFF) + SET(_IS_DEBUG OFF) + SET(_IS_VERBOSE OFF) + SET(_IS_DIR OFF) + + IF(_PARAMS) + FOREACH(_PARAM ${_PARAMS}) + IF(_PARAM STREQUAL "RELEASE") + SET(_IS_RELEASE ON) + SET(_IS_DEBUG OFF) + SET(_IS_DIR OFF) + ELSEIF(_PARAM STREQUAL "DEBUG") + SET(_IS_RELEASE OFF) + SET(_IS_DEBUG ON) + SET(_IS_DIR OFF) + ELSEIF(_PARAM STREQUAL "VERBOSE") + SET(_IS_RELEASE OFF) + SET(_IS_DEBUG OFF) + SET(_IS_DIR OFF) + SET(_IS_VERBOSE ON) + ELSEIF(_PARAM STREQUAL "REQUIRED") + SET(_IS_RELEASE OFF) + SET(_IS_DEBUG OFF) + SET(_IS_DIR OFF) + SET(${NAME}_FIND_REQUIRED ON) + ELSEIF(_PARAM STREQUAL "DIR") + SET(_IS_RELEASE OFF) + SET(_IS_DEBUG OFF) + SET(_IS_DIR ON) + ELSE() + IF(_IS_RELEASE) + LIST(APPEND _RELEASE_LIBRARIES ${_PARAM}) + ELSEIF(_IS_DEBUG) + LIST(APPEND _DEBUG_LIBRARIES ${_PARAM}) + ELSEIF(_IS_DIR) + LIST(APPEND _BASE_DIRECTORIES ${_PARAM}) + ELSE() + MESSAGE(STATUS "parameter ${_PARAM} with no prefix") + ENDIF() + ENDIF() + ENDFOREACH() + ENDIF() + + # Fixes names if invalid characters are found + IF("${NAME}" MATCHES "^[a-zA-Z0-9]+$") + SET(_NAME_FIXED ${NAME}) + ELSE() + # if invalid characters are detected, replace them by valid ones + STRING(REPLACE "+" "p" _NAME_FIXED ${NAME}) + ENDIF() + + # Create uppercase and lowercase versions of NAME + STRING(TOUPPER ${NAME} _UPNAME) + STRING(TOLOWER ${NAME} _LOWNAME) + + STRING(TOUPPER ${_NAME_FIXED} _UPNAME_FIXED) + STRING(TOLOWER ${_NAME_FIXED} _LOWNAME_FIXED) + + SET(_LIBRARY_PATHS) + + # Check for root directories passed to CMake with -DXXX_DIR=... + IF(DEFINED ${_UPNAME_FIXED}_DIR) + SET(_TMP ${${_UPNAME_FIXED}_DIR}) + GET_FILENAME_COMPONENT(_TMP ${_TMP} ABSOLUTE) + LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX}) + + IF(_IS_VERBOSE) + MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}") + ENDIF() + ENDIF() + + IF(DEFINED ${_UPNAME}_DIR) + SET(_TMP ${${_UPNAME}_DIR}) + LIST(APPEND _LIBRARY_PATHS ${_TMP}/lib${LIB_SUFFIX}) + + IF(_IS_VERBOSE) + MESSAGE(STATUS "Using ${_UPNAME_FIXED}_DIR as root directory ${_TMP}") + ENDIF() + ENDIF() + + IF(_BASE_DIRECTORIES) + FOREACH(_DIR ${_BASE_DIRECTORIES}) + IF(_DIR) + LIST(APPEND _LIBRARY_PATHS ${_DIR}/lib${LIB_SUFFIX}) + + IF(_IS_VERBOSE) + MESSAGE(STATUS "Using ${_DIR} as root directory") + ENDIF() + ENDIF() + ENDFOREACH() + ENDIF() + + # Append environment variables XXX_DIR + LIST(APPEND _LIBRARY_PATHS + $ENV{${_UPNAME}_DIR}/lib${LIB_SUFFIX} + $ENV{${_UPNAME_FIXED}_DIR}/lib${LIB_SUFFIX}) + + IF(UNIX) + SET(_UNIX_LIBRARY_PATHS) + + # Append multiarch libraries paths + IF(CMAKE_LIBRARY_ARCHITECTURE) + LIST(APPEND _UNIX_LIBRARY_PATHS + /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} + /lib/${CMAKE_LIBRARY_ARCHITECTURE} + /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}) + ENDIF() + + # Append UNIX standard libraries paths + LIST(APPEND _UNIX_LIBRARY_PATHS + /usr/local/lib + /usr/lib + /lib + /usr/local/X11R6/lib + /usr/X11R6/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib${LIB_SUFFIX}) + ENDIF() + + LIST(APPEND _RELEASE_LIBRARIES ${_LOWNAME} ${_LOWNAME_FIXED} ${NAME} ${_NAME_FIXED}) + LIST(APPEND _DEBUG_LIBRARIES ${_LOWNAME}d ${_LOWNAME_FIXED}d ${NAME}d ${_NAME_FIXED}d) + + # Under Windows, some libs may need the lib prefix + IF(WIN32) + SET(_LIBS ${_RELEASE_LIBRARIES}) + FOREACH(_LIB ${_LIBS}) + LIST(APPEND _RELEASE_LIBRARIES lib${_LIB}) + ENDFOREACH() + + SET(_LIBS ${_DEBUG_LIBRARIES}) + FOREACH(_LIB ${_LIBS}) + LIST(APPEND _DEBUG_LIBRARIES lib${_LIB}) + ENDFOREACH() + ENDIF() + + LIST(REMOVE_DUPLICATES _RELEASE_LIBRARIES) + LIST(REMOVE_DUPLICATES _DEBUG_LIBRARIES) + + # Search for release library + FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_RELEASE + NAMES + ${_RELEASE_LIBRARIES} + HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS} + PATHS + ${_LIBRARY_PATHS} + ${_UNIX_LIBRARY_PATHS} + NO_CMAKE_SYSTEM_PATH + ) + + IF(_IS_VERBOSE) + IF(${_UPNAME_FIXED}_LIBRARY_RELEASE) + MESSAGE(STATUS "${NAME} release library found: ${${_UPNAME_FIXED}_LIBRARY_RELEASE}") + ELSE() + MESSAGE(STATUS "${NAME} release library not found in ${_LIBRARY_PATHS};${_UNIX_LIBRARY_PATHS}") + ENDIF() + ENDIF() + + # Search for debug library + FIND_LIBRARY(${_UPNAME_FIXED}_LIBRARY_DEBUG + NAMES + ${_DEBUG_LIBRARIES} + HINTS ${PKG_${_NAME_FIXED}_LIBRARY_DIRS} + PATHS + ${_LIBRARY_PATHS} + ${_UNIX_LIBRARY_PATHS} + NO_CMAKE_SYSTEM_PATH + ) + + IF(_IS_VERBOSE) + IF(${_UPNAME_FIXED}_LIBRARY_DEBUG) + MESSAGE(STATUS "${NAME} debug library found: ${${_UPNAME_FIXED}_LIBRARY_DEBUG}") + ELSE() + MESSAGE(STATUS "${NAME} debug library not found") + ENDIF() + ENDIF() + + # Library has been found if at least only one library and include are found + IF(${_UPNAME_FIXED}_LIBRARY_RELEASE AND ${_UPNAME_FIXED}_LIBRARY_DEBUG) + # Release and debug libraries found + SET(${_UPNAME_FIXED}_LIBRARIES optimized ${${_UPNAME_FIXED}_LIBRARY_RELEASE} debug ${${_UPNAME_FIXED}_LIBRARY_DEBUG}) + SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE}) + ELSEIF(${_UPNAME_FIXED}_LIBRARY_RELEASE) + # Release library found + SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_RELEASE}) + SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_RELEASE}) + ELSEIF(${_UPNAME_FIXED}_LIBRARY_DEBUG) + # Debug library found + SET(${_UPNAME_FIXED}_LIBRARIES ${${_UPNAME_FIXED}_LIBRARY_DEBUG}) + SET(${_UPNAME_FIXED}_LIBRARY ${${_UPNAME_FIXED}_LIBRARY_DEBUG}) + ENDIF() + + MARK_AS_ADVANCED(${_UPNAME_FIXED}_LIBRARY_RELEASE ${_UPNAME_FIXED}_LIBRARY_DEBUG) +ENDMACRO() + +MACRO(FIND_LIBCURL) + IF(NOT CURL_FOUND) + FIND_PACKAGE(CURL REQUIRED) + + IF(WIN32 OR CURL_LIBRARY MATCHES "\\.a" OR WITH_STATIC_CURL) + SET(CURL_STATIC ON) + ELSE() + SET(CURL_STATIC OFF) + ENDIF() + + IF(CURL_STATIC) + SET(CURL_DEFINITIONS -DCURL_STATICLIB) + + IF(UNIX) + # CURL can depend on libidn + FIND_LIBRARY(IDN_LIBRARY idn) + IF(IDN_LIBRARY) + LIST(APPEND CURL_LIBRARIES ${IDN_LIBRARY}) + ENDIF() + + # CURL Macports version can depend on libidn, libintl and libiconv too + IF(APPLE) + FIND_LIBRARY(INTL_LIBRARY intl) + IF(INTL_LIBRARY) + LIST(APPEND CURL_LIBRARIES ${INTL_LIBRARY}) + ENDIF() + ELSE() + # Only used by libcurl under Linux + FIND_PACKAGE(OpenSSL REQUIRED) + + #IF(WIN32) + # SET(OPENSSL_LIBRARIES ${OPENSSL_LIBRARIES} Crypt32.lib) + #ENDIF() + + # Only Linux version of libcurl depends on OpenSSL + LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) + LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES}) + ENDIF() + ENDIF() + ENDIF() + ENDIF() +ENDMACRO() + +MACRO(FIND_LIBXML2) + IF(NOT LIBXML2_FOUND) + FIND_PACKAGE(LibXml2 REQUIRED) + + IF(WIN32 OR WITH_STATIC_LIBXML2) + LIST(APPEND LIBXML2_DEFINITIONS -DLIBXML_STATIC) + ENDIF() + + IF(WITH_LIBXML2_ICONV) + FIND_PACKAGE(Iconv REQUIRED) +# LIST(APPEND CURL_INCLUDE_DIRS ${ICONV_INCLUDE_DIR}) + LIST(APPEND LIBXML2_LIBRARIES ${ICONV_LIBRARIES}) + ENDIF() + + IF(WITH_STATIC) + # libxml2 could need winsock2 library + IF(WIN32) + FIND_LIBRARY(WINSOCK2_LIB ws2_32) + + IF(WINSOCK2_LIB) + LIST(APPEND LIBXML2_LIBRARIES ${WINSOCK2_LIB}) + ENDIF() + + FIND_LIBRARY(CRYPT32_LIB Crypt32) + + IF(CRYPT32_LIB) + LIST(APPEND LIBXML2_LIBRARIES ${CRYPT32_LIB}) + ENDIF() + ELSE() + # under Linux and OS X, recent libxml2 versions are linked against liblzma + FIND_PACKAGE(LibLZMA) + + IF(LIBLZMA_LIBRARIES) + LIST(APPEND LIBXML2_LIBRARIES ${LIBLZMA_LIBRARIES}) + ENDIF() + ENDIF() + ENDIF() + ENDIF() +ENDMACRO() + +MACRO(ADD_QT_LIBRARY _NAME) + IF(WIN32) + SET(_PREFIX "Qt5") + SET(_EXT "lib") + ELSE() + SET(_PREFIX "libQt5") + SET(_EXT "a") + ENDIF() + SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}.${_EXT}") + IF(EXISTS ${_LIB}) + LIST(APPEND QT_LIBRARIES optimized ${_LIB}) + ENDIF() + SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}d.${_EXT}") + IF(EXISTS ${_LIB}) + LIST(APPEND QT_LIBRARIES debug ${_LIB}) + ENDIF() +ENDMACRO() + +MACRO(ADD_QT_PLUGIN _TYPE _NAME) + IF(WIN32) + SET(_PREFIX "") + SET(_EXT "lib") + ELSE() + SET(_PREFIX "lib") + SET(_EXT "a") + ENDIF() + SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}.${_EXT}") + IF(EXISTS ${_LIB}) + LIST(APPEND QT_LIBRARIES optimized ${_LIB}) + ENDIF() + SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}d.${_EXT}") + IF(EXISTS ${_LIB}) + LIST(APPEND QT_LIBRARIES debug ${_LIB}) + ENDIF() +ENDMACRO() + +MACRO(ADD_QT_SYSTEM_LIBRARY _NAME) + # Save default suffixes + SET(_OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + + # Define specific suffixes + SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) + + # Find the library with specified suffixes + FIND_LIBRARY(${_NAME}_LIBRARY NAMES ${_NAME}) + + # Restore default suffixes + SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_OLD_SUFFIXES}) + + IF(${_NAME}_LIBRARY) + MESSAGE(STATUS "Found ${${_NAME}_LIBRARY} ${_NAME}") + + LIST(APPEND QT_LIBRARIES ${${_NAME}_LIBRARY}) + ELSE() + MESSAGE(STATUS "Didn't find ${_NAME}") + ENDIF() +ENDMACRO() + +MACRO(FIND_QT5) + CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR) + + SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR}) + + FIND_PACKAGE(Qt5Core QUIET) + + IF(Qt5Core_FOUND) + # Check if we are using Qt static or shared libraries + GET_TARGET_PROPERTY(_FILE Qt5::Core IMPORTED_LOCATION_RELEASE) + + SET(QT_VERSION "${Qt5Core_VERSION_STRING}") + SET(_VERSION "${QT_VERSION}") + + IF(_FILE MATCHES "\\.(lib|a)$") + SET(QT_STATIC ON) + SET(_VERSION "${_VERSION} static version") + ELSE() + SET(QT_STATIC OFF) + SET(_VERSION "${_VERSION} shared version") + ENDIF() + + MESSAGE(STATUS "Found Qt ${_VERSION}") + + # These variables are not defined with Qt5 CMake modules + SET(QT_BINARY_DIR "${_qt5Core_install_prefix}/bin") + SET(QT_LIBRARY_DIR "${_qt5Core_install_prefix}/lib") + SET(QT_PLUGINS_DIR "${_qt5Core_install_prefix}/plugins") + SET(QT_TRANSLATIONS_DIR "${_qt5Core_install_prefix}/translations") + + # Fix wrong include directories with Qt 5 under Mac OS X + INCLUDE_DIRECTORIES("${_qt5Core_install_prefix}/include") + + FIND_PACKAGE(Qt5Gui) + FIND_PACKAGE(Qt5Widgets) + FIND_PACKAGE(Qt5OpenGL) + FIND_PACKAGE(Qt5Xml) + FIND_PACKAGE(Qt5LinguistTools) + FIND_PACKAGE(Qt5Network) + + IF(QT_STATIC) + FIND_PACKAGE(PNG REQUIRED) + FIND_PACKAGE(Jpeg REQUIRED) + + ADD_DEFINITIONS(-DQT_STATICPLUGIN) + + SET(QT_LIBRARIES Qt5::Widgets) + + # Gui + LIST(APPEND QT_LIBRARIES Qt5::Gui Qt5::OpenGL) + + ADD_QT_LIBRARY(PrintSupport) + + IF(WIN32) + LIST(APPEND QT_LIBRARIES + ${WINSDK_LIBRARY_DIR}/Imm32.lib + ${WINSDK_LIBRARY_DIR}/OpenGL32.lib + ${WINSDK_LIBRARY_DIR}/WinMM.Lib) + ADD_QT_PLUGIN(platforms qwindows) + ADD_QT_LIBRARY(PlatformSupport) + ELSEIF(APPLE) + # Cups needs .dylib + SET(OLD_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib) + FIND_LIBRARY(CUPS_LIBRARY cups) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_CMAKE_FIND_LIBRARY_SUFFIXES}) + + FIND_LIBRARY(IOKIT_FRAMEWORK IOKit) + FIND_LIBRARY(COCOA_FRAMEWORK Cocoa) + FIND_LIBRARY(SYSTEMCONFIGURATION_FRAMEWORK SystemConfiguration) + FIND_LIBRARY(OPENGL_FRAMEWORK NAMES OpenGL) + + LIST(APPEND QT_LIBRARIES + ${CUPS_LIBRARY} + ${COCOA_FRAMEWORK} + ${SYSTEMCONFIGURATION_FRAMEWORK} + ${IOKIT_FRAMEWORK} + ${OPENGL_FRAMEWORK}) + + ADD_QT_PLUGIN(printsupport cocoaprintersupport) + ADD_QT_PLUGIN(platforms qcocoa) + ADD_QT_LIBRARY(PlatformSupport) + ELSE() + # order is very important there + ADD_QT_PLUGIN(platforms qxcb) + ADD_QT_PLUGIN(xcbglintegrations qxcb-glx-integration) + + ADD_QT_LIBRARY(XcbQpa) + ADD_QT_LIBRARY(GlxSupport) + ADD_QT_LIBRARY(ServiceSupport) + ADD_QT_LIBRARY(EdidSupport) + ADD_QT_LIBRARY(FontDatabaseSupport) + ADD_QT_LIBRARY(ThemeSupport) + ADD_QT_LIBRARY(EventDispatcherSupport) + ADD_QT_LIBRARY(PlatformSupport) + + ADD_QT_LIBRARY(DBus) + + IF(EXISTS "${QT_LIBRARY_DIR}/libxcb-static.a") + LIST(APPEND QT_LIBRARIES "${QT_LIBRARY_DIR}/libxcb-static.a") + ENDIF() + + # always link these in dynamic, API never changes + ADD_QT_SYSTEM_LIBRARY(X11) + ADD_QT_SYSTEM_LIBRARY(Xmu) + ADD_QT_SYSTEM_LIBRARY(X11-xcb) + ADD_QT_SYSTEM_LIBRARY(Xi) + ADD_QT_SYSTEM_LIBRARY(SM) + ADD_QT_SYSTEM_LIBRARY(ICE) + ADD_QT_SYSTEM_LIBRARY(xcb) + ADD_QT_SYSTEM_LIBRARY(GL) + ADD_QT_SYSTEM_LIBRARY(xcb-glx) + ADD_QT_SYSTEM_LIBRARY(fontconfig) + ADD_QT_SYSTEM_LIBRARY(Xrender) + ENDIF() + + ADD_QT_PLUGIN(imageformats qgif) + ADD_QT_PLUGIN(imageformats qicns) + ADD_QT_PLUGIN(imageformats qico) + ADD_QT_PLUGIN(imageformats qjpeg) + + # harfbuzz is needed since Qt 5.3 + IF(UNIX) + SET(HB_LIB "${QT_LIBRARY_DIR}/libqtharfbuzzng.a") + IF(NOT EXISTS ${HB_LIB}) + SET(HB_LIB "${QT_LIBRARY_DIR}/libqtharfbuzz.a") + ENDIF() + ELSEIF(WIN32) + SET(HB_LIB "${QT_LIBRARY_DIR}/qtharfbuzzng.lib") + ENDIF() + IF(EXISTS ${HB_LIB}) + LIST(APPEND QT_LIBRARIES ${HB_LIB}) + ENDIF() + + # freetype is needed since Qt 5.5 + FIND_PACKAGE(Freetype) + + IF(FREETYPE_FOUND) + LIST(APPEND QT_LIBRARIES ${FREETYPE_LIBRARIES}) + ELSE() + IF(UNIX) + SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a") + ELSEIF(WIN32) + SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/qtfreetype.lib") + ENDIF() + IF(EXISTS ${FREETYPE_LIB}) + LIST(APPEND QT_LIBRARIES ${FREETYPE_LIB}) + ENDIF() + ENDIF() + + ADD_QT_PLUGIN(accessible qtaccessiblewidgets) + + LIST(APPEND QT_LIBRARIES ${PNG_LIBRARIES} ${JPEG_LIBRARY}) + + # Network + LIST(APPEND QT_LIBRARIES Qt5::Network Qt5::Xml) + LIST(APPEND QT_LIBRARIES ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES}) + + IF(WIN32) + LIST(APPEND QT_LIBRARIES + ${WINSDK_LIBRARY_DIR}/Crypt32.lib + ${WINSDK_LIBRARY_DIR}/WS2_32.Lib + ${WINSDK_LIBRARY_DIR}/IPHlpApi.Lib) + ENDIF() + + # Core + LIST(APPEND QT_LIBRARIES Qt5::Core) + + # pcre is needed since Qt 5.5 + IF(UNIX) + SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre.a") + IF(NOT EXISTS ${PCRE_LIB}) + SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre2.a") + ENDIF() + ELSEIF(WIN32) + SET(PCRE_LIB "${QT_LIBRARY_DIR}/qtpcre.lib") + ENDIF() + IF(EXISTS ${PCRE_LIB}) + LIST(APPEND QT_LIBRARIES ${PCRE_LIB}) + ENDIF() + + IF(APPLE) + FIND_LIBRARY(PCRE_LIBRARY pcre16 pcre) + + FIND_LIBRARY(SECURITY_FRAMEWORK Security) + + LIST(APPEND QT_LIBRARIES + ${PCRE_LIBRARY} + ${FOUNDATION_FRAMEWORK} + ${CARBON_FRAMEWORK} + ${SECURITY_FRAMEWORK}) + ELSEIF(UNIX) + FIND_PACKAGE(Threads) + LIST(APPEND QT_LIBRARIES ${ZLIB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} -lrt) + ENDIF() + ELSE() + SET(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Gui Qt5::OpenGL Qt5::Core) + ENDIF() + ELSE() + MESSAGE(WARNING "Unable to find Qt 5") + ENDIF() +ENDMACRO() diff --git a/code/CMakeModules/FindNeL.cmake b/code/CMakeModules/FindNeL.cmake new file mode 100644 index 000000000..e75163cce --- /dev/null +++ b/code/CMakeModules/FindNeL.cmake @@ -0,0 +1,398 @@ +# NEL_DIR can be specified as root directory + +# Returned variables +# NELDRIVER_XXX_BINARY_DEBUG +# NELDRIVER_XXX_BINARY_RELEASE +# NELDRIVER_XXX_LIBRARY_DEBUG +# NELDRIVER_XXX_LIBRARY_RELEASE +# NELDRIVER_XXX_FOUND +# NEL_DEFINITIONS +# NEL_INCLUDE_DIR +# NEL_INCLUDE_DIRS +# NEL_LIBRARIES +# NELXXX_FOUND +# NELXXX_LIBRARIES + + +INCLUDE(FindHelpers) + +# Init all variables we'll set +SET(NEL_LIBRARIES) +SET(NEL_INCLUDE_DIR) +SET(NEL_INCLUDE_DIRS) +SET(NEL_VERSION) +SET(NEL_STATIC) +SET(NEL_STATIC_DRIVERS) +SET(NEL_VERSION_MAJOR) +SET(NEL_VERSION_MINOR) +SET(NEL_VERSION_PATCH) +SET(NEL_REVISION) +SET(NEL_VERSION) + +SET(NEL_MODULES_FOUND) +SET(NEL_MODULES_AVAILABLE 3d georges gui ligo logic net pacs sound) # cegui pipeline + +SET(NEL_DRIVERS_FOUND) +SET(NEL_DRIVERS_AVAILABLE opengl opengles direct3d dsound fmod openal xaudio2) + +SET(NELMISC_FIND_REQUIRED ${NeL_FIND_REQUIRED}) + +# Force search of NELMISC +FIND_PACKAGE_HELPER(nelmisc nel/misc/types_nl.h RELEASE nelmisc_r nelmisc DEBUG nelmisc_d DIR ${NEL_DIR} VERBOSE QUIET) + +IF(NELMISC_FOUND) + # define NEL_DIR if not specified + IF(NOT NEL_DIR) + GET_FILENAME_COMPONENT(NEL_DIR ${NELMISC_INCLUDE_DIR}/.. ABSOLUTE) + ENDIF() + + # Aliases for include directory + SET(NEL_INCLUDE_DIR ${NELMISC_INCLUDE_DIR}) + SET(NEL_INCLUDE_DIRS ${NEL_INCLUDE_DIR}) + + MESSAGE(STATUS "Found NeL headers in ${NEL_INCLUDE_DIR}") + + GET_FILENAME_COMPONENT(NEL_LIBRARY_DIR ${NELMISC_LIBRARY} DIRECTORY) + + MESSAGE(STATUS "Found NeL library in ${NEL_LIBRARY_DIR}") + + # TODO: implement static version checks for Windows + + # static libraries + IF(UNIX) + GET_FILENAME_COMPONENT(_LIBEXT ${NELMISC_LIBRARY} EXT) + + IF(_LIBEXT STREQUAL ".a") + SET(NEL_STATIC ON) + MESSAGE(STATUS "NeL is using static libraries") + ENDIF() + ENDIF() + + IF(WIN32) + SET(NELDRIVER_DIRS_TO_CHECK + ${NEL_DIR}/bin${LIB_SUFFIX} + ${NEL_DIR} + ) + ELSE() + SET(NELDRIVER_DIRS_TO_CHECK + /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}/nel + /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} + /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/nel + /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} + /usr/lib/nel + /usr/lib + ) + ENDIF() + + # check for static drivers + FOREACH(_DRIVER ${NEL_DRIVERS_AVAILABLE}) + IF(WIN32) + SET(_DRIVER_RELASE_FILE "nel_drv_${_DRIVER}_win_r") + SET(_DRIVER_DEBUG_FILE "nel_drv_${_DRIVER}_win_d") + SET(_DRIVER_SHARED_EXT dll) + SET(_DRIVER_STATIC_EXT lib) + ELSE() + SET(_DRIVER_RELEASE_FILE "nel_drv_${_DRIVER}") + SET(_DRIVER_DEBUG_FILE) + SET(_DRIVER_SHARED_EXT so) + SET(_DRIVER_STATIC_EXT a) + ENDIF() + + STRING(TOUPPER ${_DRIVER} _UPDRIVER) + + FOREACH(_DIR ${NELDRIVER_DIRS_TO_CHECK}) + SET(_FOUND OFF) + + IF(_DRIVER_RELASE_FILE) + SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_SHARED_EXT}") + IF(EXISTS ${_FILE}) + SET(NELDRIVER_${_UPDRIVER}_BINARY_RELEASE ${_FILE}) + + MESSAGE(STATUS "Found NeL release shared driver ${_DRIVER}: ${_FILE}") + + SET(NEL_STATIC_DRIVERS OFF) + + IF(NOT NEL_DRIVER_DIR) + SET(NEL_DRIVER_DIR ${_DIR}) + ENDIF() + ENDIF() + + SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_STATIC_EXT}") + IF(EXISTS ${_FILE}) + SET(NELDRIVER_${_UPDRIVER}_LIBRARY_RELEASE ${_FILE}) + + MESSAGE(STATUS "Found NeL release static driver ${_DRIVER}: ${_FILE}") + + SET(NEL_STATIC_DRIVERS ON) + + IF(NOT NEL_DRIVER_DIR) + SET(NEL_DRIVER_DIR ${_DIR}) + ENDIF() + ENDIF() + ENDIF() + + IF(_DRIVER_DEBUG_FILE) + SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_SHARED_EXT}") + IF(EXISTS ${_FILE}) + SET(NELDRIVER_${_UPDRIVER}_BINARY_DEBUG ${_FILE}) + + MESSAGE(STATUS "Found NeL debug shared driver ${_DRIVER}: ${_FILE}") + + SET(NEL_STATIC_DRIVERS OFF) + + IF(NOT NEL_DRIVER_DIR) + SET(NEL_DRIVER_DIR ${_DIR}) + ENDIF() + ENDIF() + + SET(_FILE "${_DIR}/${_DRIVER_RELASE_FILE}.${_DRIVER_STATIC_EXT}") + IF(EXISTS ${_FILE}) + SET(NELDRIVER_${_UPDRIVER}_LIBRARY_DEBUG ${_FILE}) + + MESSAGE(STATUS "Found NeL debug static driver ${_DRIVER}: ${_FILE}") + + SET(NEL_STATIC_DRIVERS ON) + + IF(NOT NEL_DRIVER_DIR) + SET(NEL_DRIVER_DIR ${_DIR}) + ENDIF() + ENDIF() + + IF(_FOUND) + SET(NELDRIVER_${_UPDRIVER}_FOUND ON) + LIST(APPEND NEL_DRIVERS_FOUND ${_DRIVER}) + ENDIF() + ENDIF() + ENDFOREACH() + ENDFOREACH() + + MESSAGE(STATUS "Found NeL driver in ${NEL_DRIVER_DIR}") + + PARSE_VERSION_OTHER(${NEL_INCLUDE_DIR}/nel/misc/version_nl.h NL_VERSION_MAJOR NL_VERSION_MINOR NL_VERSION_PATCH NL_REVISION) + + SET(NEL_VERSION_MAJOR ${NL_VERSION_MAJOR}) + SET(NEL_VERSION_MINOR ${NL_VERSION_MINOR}) + SET(NEL_VERSION_PATCH ${NL_VERSION_PATCH}) + SET(NEL_REVISION ${NL_REVISION}) + + IF(NOT NEL_VERSION) + IF(NEL_VERSION_MAJOR OR NEL_VERSION_MINOR} OR NEL_VERSION_PATCH) + SET(NEL_VERSION "${NEL_VERSION_MAJOR}.${NEL_VERSION_MINOR}.${NEL_VERSION_PATCH}") + ELSE() + SET(NEL_VERSION "0.5.0") + ENDIF() + + IF(NEL_REVISION) + SET(NEL_VERSION "${NEL_VERSION}.${NEL_REVISION}") + ENDIF() + ENDIF() + + FIND_PACKAGE(PNG REQUIRED) + IF(PNG_FOUND) + LIST(APPEND NELMISC_LIBRARIES ${PNG_LIBRARIES}) + ENDIF() + + FIND_PACKAGE(Jpeg REQUIRED) + IF(JPEG_FOUND) + LIST(APPEND NELMISC_LIBRARIES ${JPEG_LIBRARY}) + ENDIF() + + FIND_PACKAGE(GIF) + + IF(GIF_FOUND) + LIST(APPEND NELMISC_LIBRARIES ${GIF_LIBRARY}) + ENDIF() + + FIND_LIBXML2() + + IF(LIBXML2_FOUND) + LIST(APPEND NELMISC_LIBRARIES ${LIBXML2_LIBRARIES}) + ENDIF() + + LIST(REMOVE_ITEM NeL_FIND_COMPONENTS misc) + + LIST(APPEND NEL_MODULES_FOUND misc) + LIST(APPEND NEL_LIBRARIES ${NELMISC_LIBRARIES}) +ENDIF() + +IF(NOT NeL_FIND_COMPONENTS) + SET(NeL_FIND_COMPONENTS ${NEL_MODULES_AVAILABLE}) + + # We can skip not installed modules + SET(NeL_FIND_REQUIRED OFF) +ENDIF() + +FOREACH(COMPONENT ${NeL_FIND_COMPONENTS}) + SET(_NAME NeL${COMPONENT}) + STRING(TOUPPER ${_NAME} _UPNAME) + + # module is required + SET(${_NAME}_FIND_REQUIRED ${NeL_FIND_REQUIRED}) + + IF(COMPONENT STREQUAL "3d") + SET(HEADER_FILE shape.h) +# ELSEIF(COMPONENT STREQUAL "cegui") +# SET(HEADER_FILE shape.h) + ELSEIF(COMPONENT STREQUAL "georges") + SET(HEADER_FILE form.h) + ELSEIF(COMPONENT STREQUAL "gui") + SET(HEADER_FILE reflect.h) + ELSEIF(COMPONENT STREQUAL "ligo") + SET(HEADER_FILE primitive.h) + ELSEIF(COMPONENT STREQUAL "logic") + SET(HEADER_FILE logic_state.h) + ELSEIF(COMPONENT STREQUAL "net") + SET(HEADER_FILE sock.h) + ELSEIF(COMPONENT STREQUAL "pacs") + SET(HEADER_FILE primitive_block.h) +# ELSEIF(COMPONENT STREQUAL "pipeline") +# SET(HEADER_FILE shape.h) + ELSEIF(COMPONENT STREQUAL "sound") + SET(HEADER_FILE shape.h) + ELSE() + SET(HEADER_FILE) + ENDIF() + + # display if a component has a wrong name + IF(NOT HEADER_FILE) + MESSAGE(STATUS "NeL module ${COMPONENT} not supported, ignoring it...") + CONTINUE() + ENDIF() + + FIND_PACKAGE_HELPER(${_NAME} nel/${COMPONENT}/${HEADER_FILE} + RELEASE nel${COMPONENT}_r nel${COMPONENT} + DEBUG nel${COMPONENT}_d + QUIET) + + IF(${_UPNAME}_FOUND) + LIST(APPEND NEL_MODULES_FOUND ${COMPONENT}) + + IF(COMPONENT STREQUAL "3d") + IF(NEL_STATIC) + # 3rd party dependencies + FIND_PACKAGE(Freetype REQUIRED) + IF(FREETYPE_FOUND) + LIST(APPEND ${_UPNAME}_LIBRARIES ${FREETYPE_LIBRARIES}) + ENDIF() + + # Append static 3D drivers + IF(NEL_STATIC_DRIVERS) + # Direct3D driver (only under Windows) + IF(WIN32) + IF(NELDRIVER_DIRECT3D_LIBRARY_DEBUG) + LIST(APPEND ${_UPNAME}_LIBRARIES debug ${NELDRIVER_DIRECT3D_LIBRARY_DEBUG}) + ENDIF() + + IF(NELDRIVER_DIRECT3D_LIBRARY_RELEASE) + LIST(APPEND ${_UPNAME}_LIBRARIES optimized ${NELDRIVER_DIRECT3D_LIBRARY_RELEASE}) + ENDIF() + ENDIF() + + # OpenGL driver + IF(NELDRIVER_OPENGL_LIBRARY_DEBUG) + LIST(APPEND ${_UPNAME}_LIBRARIES debug ${NELDRIVER_OPENGL_LIBRARY_DEBUG}) + ENDIF() + + IF(NELDRIVER_OPENGL_LIBRARY_RELEASE) + LIST(APPEND ${_UPNAME}_LIBRARIES optimized ${NELDRIVER_OPENGL_LIBRARY_RELEASE}) + ENDIF() + ENDIF() + ENDIF() + ELSEIF(COMPONENT STREQUAL "gui") + FIND_PACKAGE(Luabind REQUIRED) + + LIST(APPEND ${_UPNAME}_LIBRARIES ${LUABIND_LIBRARIES}) + + FIND_LIBCURL() + + IF(CURL_FOUND) + LIST(APPEND ${_UPNAME}_LIBRARIES ${CURL_LIBRARIES}) + LIST(APPEND ${_UPNAME}_DEFINITIONS ${CURL_DEFINITIONS}) + ENDIF() + + # TODO: remove complately OpenSSL requirement on Windows + + # Only used by libcurl under Linux + FIND_PACKAGE(OpenSSL REQUIRED) + + IF(WIN32) + LIST(APPEND OPENSSL_LIBRARIES Crypt32.lib) + ENDIF() + + # Only Linux version of libcurl depends on OpenSSL + LIST(APPEND CURL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) + LIST(APPEND CURL_LIBRARIES ${OPENSSL_LIBRARIES}) + + LIST(APPEND ${_UPNAME}_LIBRARIES ${LUABIND_LIBRARIES} ${CURL_LIBRARIES}) + LIST(APPEND NEL_DEFINITIONS ${${_UPNAME}_DEFINITIONS}) + ELSEIF(COMPONENT STREQUAL "sound") + FIND_PACKAGE(Ogg REQUIRED) + + IF(OGG_FOUND) + LIST(APPEND ${_UPNAME}_LIBRARIES ${OGG_LIBRARY}) + ENDIF() + + FIND_PACKAGE(Vorbis REQUIRED) + + IF(VORBIS_FOUND) + LIST(APPEND ${_UPNAME}_LIBRARIES ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY}) + ENDIF() + + IF(NEL_STATIC) + # Link to snd_lowlevel + FIND_LIBRARY_HELPER(nelsnd_lowlevel RELEASE nelsnd_lowlevel_r DEBUG nelsnd_lowlevel_d DIR ${NEL_DIR} REQUIRED) + + IF(NELSND_LOWLEVEL_LIBRARIES) + MESSAGE(STATUS "Found NeL sound lowlevel ${NELSND_LOWLEVEL_LIBRARIES}") + + LIST(APPEND NELSOUND_LIBRARIES ${NELSND_LOWLEVEL_LIBRARIES}) + + IF(NEL_STATIC_DRIVERS) + # DirectSound, XAudio2 and FMod drivers (only under Windows) + IF(WIN32) + # DirectSound + IF(NELDRIVER_DIRECTSOUND_LIBRARY_DEBUG) + LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_DIRECTSOUND_LIBRARY_DEBUG}) + ENDIF() + + IF(NELDRIVER_DIRECTSOUND_LIBRARY_RELEASE) + LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_DIRECTSOUND_LIBRARY_RELEASE}) + ENDIF() + + # FMod + IF(NELDRIVER_FMOD_LIBRARY_DEBUG) + LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_FMOD_LIBRARY_DEBUG}) + ENDIF() + + IF(NELDRIVER_FMOD_LIBRARY_RELEASE) + LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_FMOD_LIBRARY_RELEASE}) + ENDIF() + + # XAudio2 + IF(NELDRIVER_XAUDIO2_LIBRARY_DEBUG) + LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_XAUDIO2_LIBRARY_DEBUG}) + ENDIF() + + IF(NELDRIVER_XAUDIO2_LIBRARY_RELEASE) + LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_XAUDIO2_LIBRARY_RELEASE}) + ENDIF() + ENDIF() + + # OpenAL driver + IF(NELDRIVER_OPENAL_LIBRARY_DEBUG) + LIST(APPEND NELSOUND_LIBRARIES debug ${NELDRIVER_OPENAL_LIBRARY_DEBUG}) + ENDIF() + + IF(NELDRIVER_OPENAL_LIBRARY_RELEASE) + LIST(APPEND NELSOUND_LIBRARIES optimized ${NELDRIVER_OPENAL_LIBRARY_RELEASE}) + ENDIF() + ENDIF() + ENDIF() + ENDIF() + ENDIF() + + LIST(APPEND NEL_LIBRARIES ${${_UPNAME}_LIBRARIES}) + ENDIF() +ENDFOREACH() + +MESSAGE_VERSION_PACKAGE_HELPER(NeL ${NEL_VERSION} ${NEL_MODULES_FOUND}) diff --git a/code/CMakeModules/FindRyzomGameShare.cmake b/code/CMakeModules/FindRyzomGameShare.cmake new file mode 100644 index 000000000..f76e4dd93 --- /dev/null +++ b/code/CMakeModules/FindRyzomGameShare.cmake @@ -0,0 +1,14 @@ +INCLUDE(FindHelpers) + +FIND_PACKAGE_HELPER(RyzomGameShare game_share/continent.h RELEASE ryzom_gameshare_r ryzom_gameshare DEBUG ryzom_gameshare_d DIR ${NEL_DIR} ${RYZOM_DIR} SUFFIXES ryzom) + +IF(RYZOMGAMESHARE_FOUND) + FIND_PACKAGE(NeL REQUIRED) + LIST(APPEND RYZOMGAMESHARE_INCLUDE_DIRS ${NEL_INCLUDE_DIRS}) + LIST(APPEND RYZOMGAMESHARE_LIBRARIES ${NELMISC_LIBRARIES} ${NELLIGO_LIBRARIES} ${NELNET_LIBRARIES} ${NELGEORGES_LIBRARIES}) + + SET(RYZOM_GAMESHARE_LIBRARIES ${RYZOMGAMESHARE_LIBRARIES}) + SET(RYZOM_GAMESHARE_FOUND ${RYZOMGAMESHARE_FOUND}) + SET(RYZOM_GAMESHARE_INCLUDE_DIR ${RYZOMGAMESHARE_INCLUDE_DIR}) + SET(RYZOM_GAMESHARE_INCLUDE_DIRS ${RYZOMGAMESHARE_INCLUDE_DIRS}) +ENDIF() diff --git a/code/CMakeModules/FindSteam.cmake b/code/CMakeModules/FindSteam.cmake new file mode 100644 index 000000000..8d9b12372 --- /dev/null +++ b/code/CMakeModules/FindSteam.cmake @@ -0,0 +1,74 @@ +# - Locate Steam API +# This module defines +# STEAM_LIBRARY, the library to link against +# STEAM_FOUND, if false, do not try to link to STEAM +# STEAM_INCLUDE_DIR, where to find headers. + +IF(STEAM_LIBRARY AND STEAM_INCLUDE_DIR) + # in cache already + SET(Steam_FIND_QUIETLY TRUE) +ENDIF() + + +FIND_PATH(STEAM_INCLUDE_DIR + steam_api.h + PATH_SUFFIXES steam + PATHS + $ENV{STEAM_DIR}/public +) + +IF(WIN32) + IF(TARGET_X64) + SET(STEAM_LIBNAME steam_api64) + SET(STEAM_RUNTIMENAME steam_api64.dll) + SET(STEAM_PATHNAME redistributable_bin/win64) + ELSE() + SET(STEAM_LIBNAME steam_api) + SET(STEAM_RUNTIMENAME steam_api.dll) + SET(STEAM_PATHNAME redistributable_bin) + ENDIF() +ELSEIF(APPLE) + # universal binary + SET(STEAM_LIBNAME steam_api) + SET(STEAM_RUNTIMENAME libsteam_api.dylib) + SET(STEAM_PATHNAME redistributable_bin/osx32) +ELSE() + SET(STEAM_LIBNAME steam_api) + SET(STEAM_RUNTIMENAME libsteam_api.so) + IF(TARGET_X64) + SET(STEAM_PATHNAME redistributable_bin/linux64) + ELSE() + SET(STEAM_PATHNAME redistributable_bin/linux32) + ENDIF() +ENDIF() + +FIND_LIBRARY(STEAM_LIBRARY + NAMES ${STEAM_LIBNAME} + HINTS + $ENV{STEAM_DIR}/${STEAM_PATHNAME} +) + +FIND_FILE(STEAM_RUNTIME + NAMES ${STEAM_RUNTIMENAME} + HINTS + $ENV{STEAM_DIR}/${STEAM_PATHNAME} + PATHS + ${EXTERNAL_BINARY_PATH} + ${CMAKE_LIBRARY_PATH} + /usr/local/lib + /usr/lib +) + +# Don't need to check STEAM_LIBRARY because we're dynamically loading Steam DLL +IF(STEAM_INCLUDE_DIR) + SET(STEAM_FOUND ON) + SET(STEAM_LIBRARIES ${STEAM_LIBRARY}) + SET(STEAM_INCLUDE_DIRS ${STEAM_INCLUDE_DIR}) + IF(NOT Steam_FIND_QUIETLY) + MESSAGE(STATUS "Found Steam: ${STEAM_INCLUDE_DIR} and ${STEAM_RUNTIME}") + ENDIF() +ELSE() + IF(NOT Steam_FIND_QUIETLY) + MESSAGE(STATUS "Warning: Unable to find Steam!") + ENDIF() +ENDIF() diff --git a/code/CMakeModules/GetRevision.cmake b/code/CMakeModules/GetRevision.cmake index b29a8763e..dba90c765 100644 --- a/code/CMakeModules/GetRevision.cmake +++ b/code/CMakeModules/GetRevision.cmake @@ -83,4 +83,6 @@ ENDIF() IF(DEFINED REVISION) MESSAGE(STATUS "Found revision ${REVISION}") +ELSE() + SET(REVISION 0) ENDIF() diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index c396bd6cf..24b4d5a85 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -209,8 +209,8 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) ENDIF() ENDIF() - IF(USE_CPP0X AND gcc_compiler_version GREATER "6.2.0") - LIST(APPEND _FLAGS "-std=gnu++11") + IF(CMAKE_CXX11_EXTENSION_COMPILE_OPTION) + LIST(APPEND _FLAGS ${CMAKE_CXX11_EXTENSION_COMPILE_OPTION}) ENDIF() # Format definitions diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 95b28bb8a..abe41ca1f 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -238,6 +238,7 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) OPTION(WITH_EXTERNAL "With provided external." OFF) ENDIF() OPTION(WITH_STATIC_EXTERNAL "With static external libraries" OFF) + OPTION(WITH_STATIC_RUNTIMES "Use only static C++ runtimes" OFF) IF(UNIX AND NOT APPLE) OPTION(WITH_UNIX_STRUCTURE "Use UNIX structure (bin, include, lib)" ON ) ELSE() @@ -373,8 +374,14 @@ MACRO(ADD_PLATFORM_LINKFLAGS _FLAGS) SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${_FLAGS}") ENDMACRO() -MACRO(NL_SETUP_BUILD) +MACRO(CONVERT_VERSION_NUMBER _VERSION_NUMBER _BASE) + SET(${_VERSION_NUMBER} 0) + FOREACH(_ARG ${ARGN}) + MATH(EXPR ${_VERSION_NUMBER} "${${_VERSION_NUMBER}} * ${_BASE} + ${_ARG}") + ENDFOREACH() +ENDMACRO() +MACRO(NL_SETUP_BUILD) #----------------------------------------------------------------------------- # Setup the buildmode variables. # @@ -636,8 +643,14 @@ MACRO(NL_SETUP_BUILD) SET(NL_RELEASE_LINKFLAGS "/RELEASE ${NL_RELEASE_LINKFLAGS}") ENDIF() - SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${DEBUG_CFLAGS} ${NL_DEBUG_CFLAGS}") - SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${RELEASE_CFLAGS} ${NL_RELEASE_CFLAGS}") + IF(WITH_STATIC_RUNTIMES) + SET(RUNTIME_FLAG "/MT") + ELSE() + SET(RUNTIME_FLAG "/MD") + ENDIF() + + SET(NL_DEBUG_CFLAGS "/Zi ${RUNTIME_FLAG}d /RTC1 /D_DEBUG ${DEBUG_CFLAGS} ${NL_DEBUG_CFLAGS}") + SET(NL_RELEASE_CFLAGS "${RUNTIME_FLAG} /DNDEBUG ${RELEASE_CFLAGS} ${NL_RELEASE_CFLAGS}") SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt ${MSVC_INCREMENTAL_YES_FLAG} ${NL_DEBUG_LINKFLAGS}") SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO ${NL_RELEASE_LINKFLAGS}") @@ -665,7 +678,7 @@ MACRO(NL_SETUP_BUILD) IF(APPLE) SET(OBJC_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch -fobjc-weak) - + IF(NOT XCODE) IF(CMAKE_OSX_ARCHITECTURES) SET(TARGETS_COUNT 0) @@ -874,7 +887,9 @@ MACRO(NL_SETUP_BUILD) ENDIF() # use c++0x standard to use std::unique_ptr and std::shared_ptr - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -std=c++0x") + IF(CMAKE_CXX11_EXTENSION_COMPILE_OPTION) + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} ${CMAKE_CXX11_EXTENSION_COMPILE_OPTION}") + ENDIF() ADD_PLATFORM_FLAGS("-D_REENTRANT") @@ -950,8 +965,6 @@ MACRO(NL_SETUP_BUILD) ADD_PLATFORM_FLAGS("-fPIC") ENDIF() - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48") - # hardening ADD_PLATFORM_FLAGS("-fstack-protector --param=ssp-buffer-size=4") @@ -965,6 +978,10 @@ MACRO(NL_SETUP_BUILD) IF(NOT APPLE) ADD_PLATFORM_LINKFLAGS("-Wl,--no-undefined -Wl,--as-needed") + + IF(WITH_STATIC_RUNTIMES) + ADD_PLATFORM_LINKFLAGS("-static-libstdc++") + ENDIF() ENDIF() IF(NOT APPLE) @@ -1023,6 +1040,12 @@ MACRO(NL_MAKE_ABSOLUTE_PREFIX NAME_RELATIVE NAME_ABSOLUTE) ENDMACRO(NL_MAKE_ABSOLUTE_PREFIX) MACRO(NL_SETUP_PREFIX_PATHS) + IF(TARGET_X64 AND WIN32) + SET(LIB_SUFFIX "64") + ELSE() + SET(LIB_SUFFIX "") + ENDIF() + ## Allow override of install_prefix/etc path. IF(NOT NL_ETC_PREFIX) IF(WITH_UNIX_STRUCTURE) @@ -1046,7 +1069,7 @@ MACRO(NL_SETUP_PREFIX_PATHS) ## Allow override of install_prefix/sbin path. IF(NOT NL_SBIN_PREFIX) IF(WITH_UNIX_STRUCTURE) - SET(NL_SBIN_PREFIX "sbin" CACHE PATH "Installation path for admin tools and services.") + SET(NL_SBIN_PREFIX "sbin${LIB_SUFFIX}" CACHE PATH "Installation path for admin tools and services.") ELSE() SET(NL_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.") ENDIF() @@ -1056,7 +1079,7 @@ MACRO(NL_SETUP_PREFIX_PATHS) ## Allow override of install_prefix/bin path. IF(NOT NL_BIN_PREFIX) IF(WITH_UNIX_STRUCTURE) - SET(NL_BIN_PREFIX "bin" CACHE PATH "Installation path for tools and applications.") + SET(NL_BIN_PREFIX "bin${LIB_SUFFIX}" CACHE PATH "Installation path for tools and applications.") ELSE() SET(NL_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.") ENDIF() @@ -1068,7 +1091,7 @@ MACRO(NL_SETUP_PREFIX_PATHS) IF(LIBRARY_ARCHITECTURE) SET(NL_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.") ELSE() - SET(NL_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.") + SET(NL_LIB_PREFIX "lib${LIB_SUFFIX}" CACHE PATH "Installation path for libraries.") ENDIF() ENDIF() NL_MAKE_ABSOLUTE_PREFIX(NL_LIB_PREFIX NL_LIB_ABSOLUTE_PREFIX) @@ -1079,7 +1102,11 @@ MACRO(NL_SETUP_PREFIX_PATHS) IF(LIBRARY_ARCHITECTURE) SET(NL_DRIVER_PREFIX "lib/${LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers.") ELSE() - SET(NL_DRIVER_PREFIX "lib/nel" CACHE PATH "Installation path for drivers.") + IF(WIN32) + SET(NL_DRIVER_PREFIX "bin${LIB_SUFFIX}" CACHE PATH "Installation path for drivers.") + ELSE() + SET(NL_DRIVER_PREFIX "lib${LIB_SUFFIX}/nel" CACHE PATH "Installation path for drivers.") + ENDIF() ENDIF() ELSE() SET(NL_DRIVER_PREFIX "." CACHE PATH "Installation path for drivers.") @@ -1112,7 +1139,7 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS) ## Allow override of install_prefix/sbin path. IF(NOT RYZOM_SBIN_PREFIX) IF(WITH_UNIX_STRUCTURE) - SET(RYZOM_SBIN_PREFIX "sbin" CACHE PATH "Installation path for admin tools and services.") + SET(RYZOM_SBIN_PREFIX "sbin${LIB_SUFFIX}" CACHE PATH "Installation path for admin tools and services.") ELSE() SET(RYZOM_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.") ENDIF() @@ -1122,7 +1149,7 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS) ## Allow override of install_prefix/bin path. IF(NOT RYZOM_BIN_PREFIX) IF(WITH_UNIX_STRUCTURE) - SET(RYZOM_BIN_PREFIX "bin" CACHE PATH "Installation path for tools.") + SET(RYZOM_BIN_PREFIX "bin${LIB_SUFFIX}" CACHE PATH "Installation path for tools.") ELSE() SET(RYZOM_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.") ENDIF() @@ -1134,7 +1161,7 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS) IF(LIBRARY_ARCHITECTURE) SET(RYZOM_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.") ELSE() - SET(RYZOM_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.") + SET(RYZOM_LIB_PREFIX "lib${LIB_SUFFIX}" CACHE PATH "Installation path for libraries.") ENDIF() ENDIF() NL_MAKE_ABSOLUTE_PREFIX(RYZOM_LIB_PREFIX RYZOM_LIB_ABSOLUTE_PREFIX) @@ -1210,4 +1237,4 @@ MACRO(SETUP_EXTERNAL) FIND_PACKAGE(MSVC REQUIRED) FIND_PACKAGE(WindowsSDK REQUIRED) ENDIF() -ENDMACRO(SETUP_EXTERNAL) +ENDMACRO() diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index 52bda8576..85140b3da 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -224,7 +224,7 @@ public: // @{ // first param is the associated window. // Must be a HWND for Windows (WIN32). - virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show = true, bool resizeable = true) throw(EBadDisplay) = 0; + virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show = true, bool resizeable = true) = 0; // Must be called after a setDisplay that initialize the mode virtual bool setMode(const GfxMode &mode) = 0; virtual bool getModes(std::vector &modes) = 0; diff --git a/code/nel/include/nel/3d/dru.h b/code/nel/include/nel/3d/dru.h index fda543ecd..c23d41382 100644 --- a/code/nel/include/nel/3d/dru.h +++ b/code/nel/include/nel/3d/dru.h @@ -134,14 +134,14 @@ class CDRU public: /// Portable Function which create a GL Driver (using gl dll...). - static IDriver *createGlDriver() throw(EDru); + static IDriver *createGlDriver(); /// Portable Function which create a GL ES Driver (using gl dll...). - static IDriver *createGlEsDriver() throw(EDru); + static IDriver *createGlEsDriver(); #ifdef NL_OS_WINDOWS /// Windows Function which create a Direct3d Driver. - static IDriver *createD3DDriver() throw(EDru); + static IDriver *createD3DDriver(); #endif // NL_OS_WINDOWS /// \name 2D render. diff --git a/code/nel/include/nel/3d/landscape.h b/code/nel/include/nel/3d/landscape.h index aa432f88b..a7383963d 100644 --- a/code/nel/include/nel/3d/landscape.h +++ b/code/nel/include/nel/3d/landscape.h @@ -168,9 +168,9 @@ public: void clear(); /// Verify the binding of patchs of all zones. throw EBadBind if error. - void checkBinds() throw(EBadBind); + void checkBinds(); /// Verify the binding of patchs of one zone. throw EBadBind if error. nop if zone not loaded. - void checkBinds(uint16 zoneId) throw(EBadBind); + void checkBinds(uint16 zoneId); /** * Build tileBank. Call this after loading the near and far tile banks. diff --git a/code/nel/include/nel/3d/nelu.h b/code/nel/include/nel/3d/nelu.h index fb30a5012..b64e83672 100644 --- a/code/nel/include/nel/3d/nelu.h +++ b/code/nel/include/nel/3d/nelu.h @@ -64,7 +64,7 @@ public: * * You can access the driver with CNELU::Driver. */ - static bool initDriver(uint w, uint h, uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen=false, bool direct3d=false) throw(EDru); + static bool initDriver(uint w, uint h, uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen=false, bool direct3d=false); /** Init all that we need for a Scene. * - register scene basics models, @@ -108,7 +108,7 @@ public: * - initScene(); * - initEventServer(); */ - static bool init(uint w, uint h, CViewport viewport=CViewport(), uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen = false, bool direct3d = false) throw(EDru); + static bool init(uint w, uint h, CViewport viewport=CViewport(), uint bpp=32, bool windowed=true, nlWindow systemWindow=EmptyWindow, bool offscreen = false, bool direct3d = false); /** Delete all: * - releaseEventServer(); diff --git a/code/nel/include/nel/3d/text_context.h b/code/nel/include/nel/3d/text_context.h index 156ea9f79..a95916da4 100644 --- a/code/nel/include/nel/3d/text_context.h +++ b/code/nel/include/nel/3d/text_context.h @@ -88,7 +88,7 @@ public: void setShadeOutline (bool b) { _ShadeOutline = b; } - void setShadeExtent (float shext) { _ShadeExtent = shext; } + void setShadeExtent (float x, float y) { _ShadeExtentX = x; _ShadeExtentY = y; } /// The alpha of the shade is multiplied at each draw with the alpha of the color. Default: (0,0,0,255) void setShadeColor (NLMISC::CRGBA color) { _ShadeColor = color; } @@ -157,19 +157,20 @@ public: rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); if (_ShadeOutline) { - float rext = _ShadeExtent * 0.7071f; - rCS.render2D(*_Driver, x+rext, z-rext, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x-rext, z-rext, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x-rext, z+rext, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x+rext, z+rext, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x+_ShadeExtent, z, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x-_ShadeExtent, z, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ); - rCS.render2D(*_Driver, x, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ); + float rextX = _ShadeExtentX * 0.7071f; + float rextY = _ShadeExtentY * 0.7071f; + rCS.render2D(*_Driver, x+rextX, z-rextY, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x-rextX, z-rextY, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x-rextX, z+rextY, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x+rextX, z+rextY, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x+_ShadeExtentX, z, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x-_ShadeExtentX, z, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ); } else { - rCS.render2D(*_Driver, x+_ShadeExtent, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ); + rCS.render2D(*_Driver, x+_ShadeExtentX, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ); } rCS.Color= bkup; } @@ -190,19 +191,20 @@ public: rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); if (_ShadeOutline) { - float rext = _ShadeExtent * 0.7071f; - rCS.render2DClip(*_Driver, rdrBuffer, x+rext, z-rext, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x-rext, z-rext, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x-rext, z+rext, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x+rext, z+rext, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x-_ShadeExtent, z, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x, z+_ShadeExtent, xmin, ymin, xmax, ymax); - rCS.render2DClip(*_Driver, rdrBuffer, x, z-_ShadeExtent, xmin, ymin, xmax, ymax); + float rextX = _ShadeExtentX * 0.7071f; + float rextY = _ShadeExtentY * 0.7071f; + rCS.render2DClip(*_Driver, rdrBuffer, x+rextX, z-rextY, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x-rextX, z-rextY, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x-rextX, z+rextY, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x+rextX, z+rextY, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtentX, z, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x-_ShadeExtentX, z, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x, z+_ShadeExtentY, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x, z-_ShadeExtentY, xmin, ymin, xmax, ymax); } else { - rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z-_ShadeExtent, xmin, ymin, xmax, ymax); + rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtentX, z-_ShadeExtentY, xmin, ymin, xmax, ymax); } rCS.Color= bkup; } @@ -223,19 +225,20 @@ public: rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); if (_ShadeOutline) { - float rext = _ShadeExtent * 0.7071f; - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rext, y-rext, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rext, y-rext, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rext, y+rext, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rext, y+rext, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-_ShadeExtent, y, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y+_ShadeExtent, depth, xmin, ymin, xmax, ymax); - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax); + float rextX = _ShadeExtentX * 0.7071f; + float rextY = _ShadeExtentY * 0.7071f; + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rextX, y-rextY, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rextX, y-rextY, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rextX, y+rextY, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rextX, y+rextY, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtentX, y, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-_ShadeExtentX, y, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y+_ShadeExtentY, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y-_ShadeExtentY, depth, xmin, ymin, xmax, ymax); } else { - rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax); + rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtentX, y-_ShadeExtentY, depth, xmin, ymin, xmax, ymax); } rCS.Color= bkup; } @@ -258,19 +261,20 @@ public: _TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); if (_ShadeOutline) { - float rext = _ShadeExtent * 0.7071f; - _TempString.render2D(*_Driver,x+rext,z-rext,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x-rext,z-rext,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x-rext,z+rext,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x+rext,z+rext,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x+_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x-_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); + float rextX = _ShadeExtentX * 0.7071f; + float rextY = _ShadeExtentY * 0.7071f; + _TempString.render2D(*_Driver,x+rextX,z-rextY,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x-rextX,z-rextY,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x-rextX,z+rextY,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x+rextX,z+rextY,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x+_ShadeExtentX,z,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x-_ShadeExtentX,z,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x,z+_ShadeExtentY,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x,z-_ShadeExtentY,_HotSpot,_ScaleX,_ScaleZ); } else { - _TempString.render2D(*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver, x+_ShadeExtentX, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ); } _TempString.Color = bkup; } @@ -297,19 +301,20 @@ public: _TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8); if (_ShadeOutline) { - float rext = _ShadeExtent * 0.7071f; - _TempString.render2D(*_Driver,x+rext,z-rext,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x-rext,z-rext,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x-rext,z+rext,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x+rext,z+rext,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x+_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x-_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); - _TempString.render2D(*_Driver,x,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); + float rextX = _ShadeExtentX * 0.7071f; + float rextY = _ShadeExtentY * 0.7071f; + _TempString.render2D(*_Driver,x+rextX,z-rextY,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x-rextX,z-rextY,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x-rextX,z+rextY,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x+rextX,z+rextY,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x+_ShadeExtentX,z,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x-_ShadeExtentX,z,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x,z+_ShadeExtentY,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver,x,z-_ShadeExtentY,_HotSpot,_ScaleX,_ScaleZ); } else { - _TempString.render2D(*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ); + _TempString.render2D(*_Driver, x+_ShadeExtentX, z-_ShadeExtentY, _HotSpot, _ScaleX, _ScaleZ); } _TempString.Color = bkup; } @@ -412,7 +417,8 @@ private: bool _ShadeOutline; /// shade's extent (shadow size) - float _ShadeExtent; + float _ShadeExtentX; + float _ShadeExtentY; /// Shade color (default is black) NLMISC::CRGBA _ShadeColor; diff --git a/code/nel/include/nel/3d/text_context_user.h b/code/nel/include/nel/3d/text_context_user.h index b05238dbf..15e93c3f2 100644 --- a/code/nel/include/nel/3d/text_context_user.h +++ b/code/nel/include/nel/3d/text_context_user.h @@ -80,7 +80,7 @@ public: bool getShaded() const; void setShadeOutline(bool b); bool getShadeOutline() const; - void setShadeExtent(float shext) ; + void setShadeExtent(float x, float y); void setShadeColor (NLMISC::CRGBA sc); NLMISC::CRGBA getShadeColor () const; void setKeep800x600Ratio(bool keep); diff --git a/code/nel/include/nel/3d/u_text_context.h b/code/nel/include/nel/3d/u_text_context.h index 0aa9ea2f9..4c1dfea47 100644 --- a/code/nel/include/nel/3d/u_text_context.h +++ b/code/nel/include/nel/3d/u_text_context.h @@ -205,7 +205,7 @@ public: * set the shadow's size * \param the shade extent */ - virtual void setShadeExtent (float shext) = 0; + virtual void setShadeExtent (float x, float y) = 0; /** * set the shadow's color * The alpha of the shade is multiplied at each draw with the alpha of the color. Default: (0,0,0,255) diff --git a/code/nel/include/nel/gui/curl_certificates.h b/code/nel/include/nel/gui/curl_certificates.h index 021b13360..9d5ad4855 100644 --- a/code/nel/include/nel/gui/curl_certificates.h +++ b/code/nel/include/nel/gui/curl_certificates.h @@ -17,19 +17,22 @@ #ifndef CL_CURL_CERTIFICATES_HTML_H #define CL_CURL_CERTIFICATES_HTML_H -#include - #include "nel/misc/types_nl.h" +// forward declaration to avoid curl.h inclusion everywhere +typedef void CURL; + namespace NLGUI { -#if defined(NL_OS_WINDOWS) - class CCurlCertificates { + class CCurlCertificates + { public: - // cURL SSL certificate loading - static CURLcode sslCtxFunction(CURL *curl, void *sslctx, void *parm); + // allow to use custom PEM certificates + static void addCertificateFile(const std::string &cert); + + // set all CURL options to use custom SSL context function + static void useCertificates(CURL *curl); }; -#endif // NL_OS_WINDOWS } // namespace #endif diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 35ba3e40e..9c48149bf 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -17,8 +17,6 @@ #ifndef CL_GROUP_HTML_H #define CL_GROUP_HTML_H -#include - #include "nel/misc/types_nl.h" #include "nel/gui/interface_group.h" #include "nel/gui/group_scrolltext.h" @@ -27,6 +25,9 @@ #include "nel/gui/group_table.h" #include "nel/gui/libwww_types.h" +// forward declaration +typedef void CURLM; + typedef std::map TStyle; namespace NLGUI @@ -66,8 +67,6 @@ namespace NLGUI std::vector< std::string > trustedDomains; /// Maximum concurrent MultiCurl connections per CGroupHTML instance sint32 curlMaxConnections; - /// cacert.pem location - std::string curlCABundle; SWebOptions(): curlMaxConnections(2) { @@ -75,11 +74,26 @@ namespace NLGUI }; static SWebOptions options; - + + // text-shadow + struct STextShadow + { + public: + STextShadow(bool enabled = false, bool outline = false, sint32 x=1, sint32 y=1, NLMISC::CRGBA color=NLMISC::CRGBA::Black) + : Enabled(enabled), Outline(outline), X(x), Y(y), Color(color) + { } + + bool Enabled; + bool Outline; + sint32 X; + sint32 Y; + NLMISC::CRGBA Color; + }; + class CStyleParams { public: - CStyleParams () : FontFamily(""), TextColor(255,255,255,255) + CStyleParams () : FontFamily(""), TextColor(255,255,255,255), TextShadow() { FontSize=10; FontWeight=400; @@ -97,6 +111,7 @@ namespace NLGUI bool FontOblique; std::string FontFamily; NLMISC::CRGBA TextColor; + STextShadow TextShadow; bool GlobalColor; bool Underlined; bool StrikeThrough; @@ -505,78 +520,32 @@ namespace NLGUI // IL mode bool _LI; - // Current text color - std::vector _TextColor; - inline const NLMISC::CRGBA &getTextColor() const + // Current active style + CStyleParams _Style; + // Default style + CStyleParams _StyleDefault; + // Nested style stack + std::vector _StyleParams; + inline void pushStyle() { - if (_TextColor.empty()) - return TextColor; - return _TextColor.back(); + _StyleParams.push_back(_Style); + } + inline void popStyle() + { + if (_StyleParams.empty()) + _Style = _StyleDefault; + else + { + _Style = _StyleParams.back(); + _StyleParams.pop_back(); + } } - // Current global color flag - std::vector _GlobalColor; - inline bool getGlobalColor() const - { - if (_GlobalColor.empty()) - return false; - return _GlobalColor.back(); - } - - // Current font name - std::vector _FontFamily; - inline const char* getFontFamily() const - { - if (_FontFamily.empty()) - return ""; - return _FontFamily.back().c_str(); - } - - // Current font size - std::vector _FontSize; - inline uint getFontSize() const - { - if (_FontSize.empty()) - return TextFontSize; - return _FontSize.back(); - } inline uint getFontSizeSmaller() const { - if (getFontSize() < 5) + if (_Style.FontSize < 5) return 3; - return getFontSize()-2; - } - - std::vector _FontWeight; - inline uint getFontWeight() const - { - if (_FontWeight.empty()) - return 400; - return _FontWeight.back(); - } - - std::vector _FontOblique; - inline bool getFontOblique() const - { - if (_FontOblique.empty()) - return false; - return _FontOblique.back(); - } - - std::vector _FontUnderlined; - inline bool getFontUnderlined() const - { - if (_FontUnderlined.empty()) - return false; - return _FontUnderlined.back(); - } - - std::vector _FontStrikeThrough; - inline bool getFontStrikeThrough() const - { - if (_FontStrikeThrough.empty()) - return false; - return _FontStrikeThrough.back(); + return _Style.FontSize-2; } // Current link @@ -641,6 +610,14 @@ namespace NLGUI return _TR.back(); } + std::vector _TextShadow; + inline STextShadow getTextShadow() const + { + if (_TextShadow.empty()) + return STextShadow(); + return _TextShadow.back(); + } + // Forms class CForm { @@ -880,11 +857,6 @@ namespace NLGUI // HtmlType download finished void htmlDownloadFinished(const std::string &content, const std::string &type, long code); - - // cURL transfer callbacks - static size_t curlHeaderCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData); - static size_t curlDataCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData); - static size_t curlProgressCallback(void *pCCurlWWWData, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow); }; // adapter group that store y offset for inputs inside an html form diff --git a/code/nel/include/nel/gui/http_hsts.h b/code/nel/include/nel/gui/http_hsts.h index 2693461cd..28f1b5f5b 100644 --- a/code/nel/include/nel/gui/http_hsts.h +++ b/code/nel/include/nel/gui/http_hsts.h @@ -42,7 +42,7 @@ namespace NLGUI class CStrictTransportSecurity { public: - typedef std::map THSTSObject; + typedef std::map THSTSObjectMap; static CStrictTransportSecurity* getInstance(); static void release(); @@ -66,7 +66,7 @@ namespace NLGUI ~CStrictTransportSecurity(); std::string _Filename; - THSTSObject _Domains; + THSTSObjectMap _Domains; }; } diff --git a/code/nel/include/nel/gui/interface_element.h b/code/nel/include/nel/gui/interface_element.h index 1d84f4a4f..540ba96e8 100644 --- a/code/nel/include/nel/gui/interface_element.h +++ b/code/nel/include/nel/gui/interface_element.h @@ -192,6 +192,9 @@ namespace NLGUI void setMarginLeft(sint32 m) { _MarginLeft = m; } sint32 getMarginLeft() const { return _MarginLeft; } + // Return inner width for child elements + virtual sint32 getInnerWidth() const; + /** * Get the max width used by the window. * diff --git a/code/nel/include/nel/gui/interface_group.h b/code/nel/include/nel/gui/interface_group.h index b9efd3357..01f2b9701 100644 --- a/code/nel/include/nel/gui/interface_group.h +++ b/code/nel/include/nel/gui/interface_group.h @@ -164,6 +164,7 @@ namespace NLGUI sint32 getMaxH () const { return _MaxH; } sint32 getMaxWReal () const { return _Active ? _MaxWReal : 0; } sint32 getMaxHReal () const { return _Active ? _MaxHReal : 0; } + sint32 getInnerWidth () const; sint32 getOfsX () const { return _OffsetX; } sint32 getOfsY () const { return _OffsetY; } bool getResizeFromChildW() const { return _ResizeFromChildW; } diff --git a/code/nel/include/nel/gui/libwww.h b/code/nel/include/nel/gui/libwww.h index 0825779f2..64258608e 100644 --- a/code/nel/include/nel/gui/libwww.h +++ b/code/nel/include/nel/gui/libwww.h @@ -20,11 +20,12 @@ #ifndef CL_LIB_WWW_H #define CL_LIB_WWW_H -#include - #include "nel/misc/rgba.h" #include "nel/gui/libwww_types.h" +// forward declaration to avoid curl.h inclusion everywhere +typedef void CURL; + namespace NLGUI { class CCtrlBaseButton; @@ -102,6 +103,7 @@ namespace NLGUI HTML_ATTR(TR,L_MARGIN), HTML_ATTR(TR,NOWRAP), HTML_ATTR(TR,VALIGN), + HTML_ATTR(TR,STYLE), }; enum diff --git a/code/nel/include/nel/gui/lua_ihm.h b/code/nel/include/nel/gui/lua_ihm.h index 974ece6f7..e45e1125f 100644 --- a/code/nel/include/nel/gui/lua_ihm.h +++ b/code/nel/include/nel/gui/lua_ihm.h @@ -118,7 +118,7 @@ namespace NLGUI /** read/write between values on a lua stack & a property exported from a 'CReflectable' derived object * (throws on error) */ - static void luaValueToReflectedProperty(CLuaState &ls, int stackIndex, CReflectable &target, const CReflectedProperty &property) throw(ELuaIHMException); + static void luaValueToReflectedProperty(CLuaState &ls, int stackIndex, CReflectable &target, const CReflectedProperty &property); // push a reflected property on the stack // NB : no check is done that 'property' is part of the class info of 'reflectedObject' diff --git a/code/nel/include/nel/gui/lua_object.h b/code/nel/include/nel/gui/lua_object.h index 1d3b0d64c..88c011347 100644 --- a/code/nel/include/nel/gui/lua_object.h +++ b/code/nel/include/nel/gui/lua_object.h @@ -110,7 +110,7 @@ namespace NLGUI /** create a sub table for this object, with a string as a key * This object must be a table or an exception if thrown */ - CLuaObject newTable(const char *tableName) throw(ELuaNotATable); + CLuaObject newTable(const char *tableName); /** Set a value in a table. @@ -118,29 +118,29 @@ namespace NLGUI * NB : value should came from the same lua environment * \TODO other type of keys */ - void setValue(const char *key, const CLuaObject &value) throw(ELuaNotATable); - void setValue(const std::string &key, const CLuaObject &value) throw(ELuaNotATable) { setValue(key.c_str(), value); } - void setValue(const char *key, const std::string &value) throw(ELuaNotATable); - void setValue(const char *key, const char *value) throw(ELuaNotATable); - void setValue(const char *key, bool value) throw(ELuaNotATable); - void setValue(const char *key, TLuaWrappedFunction value) throw(ELuaNotATable); - void setValue(const char *key, double value) throw(ELuaNotATable); - void setValue(const char *key, uint32 value) throw(ELuaNotATable); - void setValue(const char *key, sint32 value) throw(ELuaNotATable); - void setValue(const char *key, sint64 value) throw(ELuaNotATable); - void setValue(const std::string &key, const std::string &value) throw(ELuaNotATable) { setValue(key.c_str(), value); } - void setNil(const char *key) throw(ELuaNotATable); - void setNil(const std::string &key) throw(ELuaNotATable) { setNil(key.c_str()); } + void setValue(const char *key, const CLuaObject &value); + void setValue(const std::string &key, const CLuaObject &value) { setValue(key.c_str(), value); } + void setValue(const char *key, const std::string &value); + void setValue(const char *key, const char *value); + void setValue(const char *key, bool value); + void setValue(const char *key, TLuaWrappedFunction value); + void setValue(const char *key, double value); + void setValue(const char *key, uint32 value); + void setValue(const char *key, sint32 value); + void setValue(const char *key, sint64 value); + void setValue(const std::string &key, const std::string &value) { setValue(key.c_str(), value); } + void setNil(const char *key); + void setNil(const std::string &key) { setNil(key.c_str()); } /** Erase a value in a table by its key. * If this object is not a table then an exception is thrown. * \TODO other type of keys */ - void eraseValue(const char *key) throw(ELuaNotATable); - void eraseValue(const std::string &key) throw(ELuaNotATable) { eraseValue(key.c_str()); } + void eraseValue(const char *key); + void eraseValue(const std::string &key) { eraseValue(key.c_str()); } // test is this object is enumerable bool isEnumerable() const; // Enumeration of a table. If the object is not a table, an exception is thrown. - CLuaEnumeration enumerate() throw(ELuaNotATable); + CLuaEnumeration enumerate(); // retrieve metatable of an object (or nil if object has no metatable) CLuaObject getMetaTable() const; // set metatable for this object @@ -155,7 +155,7 @@ namespace NLGUI CLuaObject operator[](const std::string &key) const { return operator[](key.c_str()); } /** Checked access to a sub element of a table. An exception is thrown is the element is not a table. */ - CLuaObject at(const char *key) const throw (ELuaNotATable); + CLuaObject at(const char *key) const; CLuaObject at(const std::string &key) const { return at(key.c_str()); } // Test is that table has the given key. The object must be a table or an exception is thrown diff --git a/code/nel/include/nel/gui/view_text.h b/code/nel/include/nel/gui/view_text.h index ad5a30f2a..aa1d83330 100644 --- a/code/nel/include/nel/gui/view_text.h +++ b/code/nel/include/nel/gui/view_text.h @@ -89,6 +89,7 @@ namespace NLGUI void setShadow (bool bShadow); void setShadowOutline (bool bShadowOutline); void setShadowColor (const NLMISC::CRGBA &color); + void setShadowOffset (sint x, sint y); void setLineMaxW (sint nMaxW, bool invalidate=true); void setOverflowText(const ucstring &text) { _OverflowText = text; } void setMultiLine (bool bMultiLine); @@ -114,6 +115,7 @@ namespace NLGUI bool getShadow() { return _Shadow; } bool getShadowOutline() { return _ShadowOutline; } NLMISC::CRGBA getShadowColor() { return _ShadowColor; } + void getShadowOffset(sint &x, sint &y) { x = _ShadowX; y = _ShadowY; } sint getLineMaxW() const { return _LineMaxW; } ucstring getOverflowText() const { return _OverflowText; } bool getMultiLine() const { return _MultiLine; } @@ -254,6 +256,8 @@ namespace NLGUI /// the shadow mode bool _Shadow; bool _ShadowOutline; + sint32 _ShadowX; + sint32 _ShadowY; /// the case mode TCaseMode _CaseMode; /// the text shadow color diff --git a/code/nel/include/nel/misc/CMakeLists.txt b/code/nel/include/nel/misc/CMakeLists.txt index 4b77b813f..85d8914f5 100644 --- a/code/nel/include/nel/misc/CMakeLists.txt +++ b/code/nel/include/nel/misc/CMakeLists.txt @@ -1,3 +1,7 @@ +CONVERT_VERSION_NUMBER(NL_VERSION_NUM 100 ${NL_VERSION_MAJOR} ${NL_VERSION_MINOR} ${NL_VERSION_PATCH}) + +CONFIGURE_FILE(version_nl.cmake ${CMAKE_BINARY_DIR}/version_nl.h) + FILE(GLOB HEADERS *.h) -INSTALL(FILES ${HEADERS} DESTINATION include/nel/misc COMPONENT headers) +INSTALL(FILES ${HEADERS} ${CMAKE_BINARY_DIR}/version_nl.h DESTINATION include/nel/misc COMPONENT headers) diff --git a/code/nel/include/nel/misc/class_registry.h b/code/nel/include/nel/misc/class_registry.h index 5c1fe8cd6..98139f5dc 100644 --- a/code/nel/include/nel/misc/class_registry.h +++ b/code/nel/include/nel/misc/class_registry.h @@ -86,10 +86,10 @@ public: static void release(); /// Register your class for future Instanciation. - static void registerClass(const std::string &className, IClassable* (*creator)(), const std::string &typeidCheck) throw(ERegistry); + static void registerClass(const std::string &className, IClassable* (*creator)(), const std::string &typeidCheck); /// Create an object from his class name. - static IClassable *create(const std::string &className) throw(ERegistry); + static IClassable *create(const std::string &className); /// check if the object has been correctly registered. Must be used for debug only, and Must compile with RTTI. static bool checkObject(IClassable* obj); diff --git a/code/nel/include/nel/misc/file.h b/code/nel/include/nel/misc/file.h index 17154e6be..78dba95c6 100644 --- a/code/nel/include/nel/misc/file.h +++ b/code/nel/include/nel/misc/file.h @@ -108,9 +108,9 @@ public: // Advanced Usage. /// flush the file. void flush(); /// Seek the file - bool seek (sint32 offset, IStream::TSeekOrigin origin) const throw(EStream); + bool seek (sint32 offset, IStream::TSeekOrigin origin) const; /// Get the location of the file pointer - sint32 getPos () const throw(EStream); + sint32 getPos () const; // Imp the Name of the stream as the name of the file. virtual std::string getStreamName() const; @@ -125,7 +125,7 @@ public: // Advanced Usage. // return true if there's nothing more to read (same as ifstream) bool eof (); - virtual void serialBuffer(uint8 *buf, uint len)throw(EReadError); + virtual void serialBuffer(uint8 *buf, uint len); /// \name Statistics @@ -148,7 +148,7 @@ public: // Advanced Usage. static void clearDump (); protected: - virtual void serialBit(bool &bit) throw(EReadError); + virtual void serialBit(bool &bit); virtual uint getDbgStreamSize() const; @@ -223,20 +223,20 @@ public: // Advanced Usage. /// flush the file. void flush(); /// Seek the file - bool seek (sint32 offset, IStream::TSeekOrigin origin) const throw(EStream); + bool seek (sint32 offset, IStream::TSeekOrigin origin) const; /// Get the location of the file pointer - sint32 getPos () const throw(EStream); + sint32 getPos () const; // Imp the Name of the stream as the name of the file. virtual std::string getStreamName() const; // very useful to serialize string in text mode (without the size) - virtual void serialBuffer(uint8 *buf, uint len) throw(EWriteError); + virtual void serialBuffer(uint8 *buf, uint len); protected: /// Internal close. void internalClose(bool success); - virtual void serialBit(bool &bit) throw(EWriteError); + virtual void serialBit(bool &bit); private: FILE *_F; diff --git a/code/nel/include/nel/misc/mem_stream.h b/code/nel/include/nel/misc/mem_stream.h index f614cc040..4222e1672 100644 --- a/code/nel/include/nel/misc/mem_stream.h +++ b/code/nel/include/nel/misc/mem_stream.h @@ -197,7 +197,7 @@ public: * \return true if seek sucessfull. * \see ESeekNotSupported SeekOrigin getPos */ - virtual bool seek (sint32 offset, TSeekOrigin origin) const throw(EStream); + virtual bool seek (sint32 offset, TSeekOrigin origin) const; /** * Get the location of the stream pointer. @@ -210,7 +210,7 @@ public: * \return the new offset regarding from the origin. * \see ESeekNotSupported SeekOrigin seek */ - virtual sint32 getPos () const throw(EStream) + virtual sint32 getPos () const { return sint32(_Buffer.Pos); } diff --git a/code/nel/include/nel/misc/smart_ptr.h b/code/nel/include/nel/misc/smart_ptr.h index 2273cebeb..b0fc1c301 100644 --- a/code/nel/include/nel/misc/smart_ptr.h +++ b/code/nel/include/nel/misc/smart_ptr.h @@ -226,7 +226,7 @@ public: std::string toString() { if(Ptr) return toString(*Ptr); else return ""; } // serial using serialPtr - void serialPtr(NLMISC::IStream &f) throw(NLMISC::EStream ) + void serialPtr(NLMISC::IStream &f) { T* obj= NULL; if(f.isReading()) @@ -242,7 +242,7 @@ public: } } // serial using serialPloyPtr - void serialPolyPtr(NLMISC::IStream &f) throw(NLMISC::EStream ) + void serialPolyPtr(NLMISC::IStream &f) { T* obj= NULL; if(f.isReading()) @@ -337,7 +337,7 @@ public: void kill(); // serial using serialPloyPtr - void serialPolyPtr(NLMISC::IStream &f) throw(NLMISC::EStream ) + void serialPolyPtr(NLMISC::IStream &f) { T* obj= NULL; if(f.isReading()) diff --git a/code/nel/include/nel/misc/string_mapper.h b/code/nel/include/nel/misc/string_mapper.h index a20489f1c..aeaccf959 100644 --- a/code/nel/include/nel/misc/string_mapper.h +++ b/code/nel/include/nel/misc/string_mapper.h @@ -177,10 +177,10 @@ public: uint32 getCount() { return _IdCounter; } // helper serialize a string id as a string - void serial(NLMISC::IStream &f, TSStringId &strId) throw(EStream); + void serial(NLMISC::IStream &f, TSStringId &strId); // helper serialize a string id vector - void serial(NLMISC::IStream &f, std::vector &strIdVect) throw(EStream); + void serial(NLMISC::IStream &f, std::vector &strIdVect); }; diff --git a/code/nel/include/nel/misc/types_nl.h b/code/nel/include/nel/misc/types_nl.h index 71702bce5..6431701fe 100644 --- a/code/nel/include/nel/misc/types_nl.h +++ b/code/nel/include/nel/misc/types_nl.h @@ -79,6 +79,9 @@ # elif _MSC_VER >= 1600 # define NL_COMP_VC10 # define NL_COMP_VC_VERSION 100 +# ifdef _HAS_CPP0X +# undef _HAS_CPP0X // VC++ 2010 doesn't implement C++11 stuff we need +# endif # elif _MSC_VER >= 1500 # define NL_COMP_VC9 # define NL_COMP_VC_VERSION 90 @@ -409,8 +412,16 @@ typedef unsigned int uint; // at least 32bits (depend of processor) #define NL_DEFAULT_MEMORY_ALIGNMENT 16 #define NL_ALIGN_SSE2 NL_ALIGN(NL_DEFAULT_MEMORY_ALIGNMENT) -#ifndef NL_CPU_X86_64 +#ifdef NL_CPU_X86_64 // on x86_64, new and delete are already aligned on 16 bytes +#elif (defined(NL_COMP_VC) && defined(NL_DEBUG)) +// don't use aligned memory if debugging with VC++ in 32 bits +#else +// use aligned memory in all other cases +#define NL_USE_ALIGNED_MEMORY_OPERATORS +#endif + +#ifdef NL_USE_ALIGNED_MEMORY_OPERATORS #ifdef NL_NO_EXCEPTION_SPECS extern void *operator new(size_t size); @@ -422,9 +433,9 @@ extern void *operator new(size_t size) throw(std::bad_alloc); extern void *operator new[](size_t size) throw(std::bad_alloc); extern void operator delete(void *p) throw(); extern void operator delete[](void *p) throw(); -#endif +#endif /* NL_NO_EXCEPTION_SPECS */ -#endif +#endif /* NL_USE_ALIGNED_MEMORY_OPERATORS */ #else /* NL_HAS_SSE2 */ diff --git a/code/nel/include/nel/misc/version_nl.cmake b/code/nel/include/nel/misc/version_nl.cmake new file mode 100644 index 000000000..2e650486e --- /dev/null +++ b/code/nel/include/nel/misc/version_nl.cmake @@ -0,0 +1,14 @@ +#ifndef NL_VERSION_H +#define NL_VERSION_H + +#define NL_VERSION "${NL_VERSION}" +#define NL_VERSION_MAJOR ${NL_VERSION_MAJOR} +#define NL_VERSION_MINOR ${NL_VERSION_MINOR} +#define NL_VERSION_PATCH ${NL_VERSION_PATCH} +#define NL_VERSION_NUM ${NL_VERSION_NUM} + +#define NL_REVISION ${REVISION} + +#define NL_BUILD_DATE "${BUILD_DATE}" + +#endif diff --git a/code/nel/include/nel/net/message.h b/code/nel/include/nel/net/message.h index e96cb50d3..f1c571d44 100644 --- a/code/nel/include/nel/net/message.h +++ b/code/nel/include/nel/net/message.h @@ -146,7 +146,7 @@ public: return _LengthR; } - virtual sint32 getPos () const throw(NLMISC::EStream) + virtual sint32 getPos() const { // return (_BufPos - _Buffer.getPtr()) - _SubMessagePosR; return _Buffer.Pos - _SubMessagePosR; diff --git a/code/nel/include/nel/net/module.h b/code/nel/include/nel/net/module.h index 4493dd966..790a49199 100644 --- a/code/nel/include/nel/net/module.h +++ b/code/nel/include/nel/net/module.h @@ -213,18 +213,14 @@ namespace NLNET * Note that a module can be plugged in several socket at the same * time, but not twice in the same socket. */ - virtual void plugModule(IModuleSocket *moduleSocket) - throw (EModuleAlreadyPluggedHere) - =0; + virtual void plugModule(IModuleSocket *moduleSocket) =0; /** Unplug this module from the specified socket. * Note that a module can be plugged in several socket at the same * time, but not twice in the same socket. * Throw an exception if the socket is not currently plug into * the specified socket. */ - virtual void unplugModule(IModuleSocket *moduleSocket) - throw (EModuleNotPluggedHere) - =0; + virtual void unplugModule(IModuleSocket *moduleSocket) =0; /** Fill resultList vector with the list of socket into * witch this module is currently plugged. * This method don't clear the result vector before filling it. @@ -265,9 +261,7 @@ namespace NLNET * The call is blocking until receptions of the operation * result message (or detection of the dest module module is down) */ - virtual void invokeModuleOperation(IModuleProxy *destModule, const NLNET::CMessage &opMsg, NLNET::CMessage &resultMsg) - throw (EInvokeFailed) - =0; + virtual void invokeModuleOperation(IModuleProxy *destModule, const NLNET::CMessage &opMsg, NLNET::CMessage &resultMsg) =0; //@} @@ -448,9 +442,7 @@ namespace NLNET * This method do the job of finding a valid socket to effectively send * the message. */ - virtual void sendModuleMessage(IModule *senderModule, const NLNET::CMessage &message) - throw (EModuleNotReachable) - =0; + virtual void sendModuleMessage(IModule *senderModule, const NLNET::CMessage &message) =0; /** Return the first item of the security item list * If no security data are available, the method @@ -779,10 +771,10 @@ namespace NLNET // Init base module, init module name bool initModule(const TParsedCommandLine &initInfo); - void plugModule(IModuleSocket *moduleSocket) throw (EModuleAlreadyPluggedHere); - void unplugModule(IModuleSocket *moduleSocket) throw (EModuleNotPluggedHere); + void plugModule(IModuleSocket *moduleSocket); + void unplugModule(IModuleSocket *moduleSocket); void getPluggedSocketList(std::vector &resultList); - void invokeModuleOperation(IModuleProxy *destModule, const NLNET::CMessage &opMsg, NLNET::CMessage &resultMsg) throw (EInvokeFailed); + void invokeModuleOperation(IModuleProxy *destModule, const NLNET::CMessage &opMsg, NLNET::CMessage &resultMsg); void _onModuleUp(IModuleProxy *removedProxy); void _onModuleDown(IModuleProxy *removedProxy); @@ -879,8 +871,7 @@ namespace NLNET /** Send a message to the module. */ - virtual void sendModuleMessage(IModule *senderModule, const NLNET::CMessage &message) - throw (EModuleNotReachable); + virtual void sendModuleMessage(IModule *senderModule, const NLNET::CMessage &message); virtual const TSecurityData *getFirstSecurityData() const { diff --git a/code/nel/include/nel/net/module_gateway.h b/code/nel/include/nel/net/module_gateway.h index a097f8de0..40da736a3 100644 --- a/code/nel/include/nel/net/module_gateway.h +++ b/code/nel/include/nel/net/module_gateway.h @@ -171,8 +171,7 @@ namespace NLNET virtual void setTransportPeerInvisible(const std::string &transportInstanceName, bool peerInvisible) =0; /// Activate/stop firewalling mode on a transport - virtual void setTransportFirewallMode(const std::string &transportInstanceName, bool firewalled) - throw (EGatewayFirewallBreak) =0; + virtual void setTransportFirewallMode(const std::string &transportInstanceName, bool firewalled) =0; /// Send a command to a transport virtual void transportCommand(const TParsedCommandLine &commandLine) =0; @@ -233,9 +232,7 @@ namespace NLNET /** Disclose module information to a connected gateway. * This can also be this gateway itself. */ - virtual void discloseModule(IModuleProxy *moduleProxy) - throw (EGatewayNotConnected) - =0; + virtual void discloseModule(IModuleProxy *moduleProxy) =0; /** Retrieve the proxy for a locally plugged module. * Each local module plugged in a gateway has an associated @@ -346,9 +343,9 @@ namespace NLNET virtual const std::string &getClassName() const =0; /// The gateway send a command message to the transport - virtual void onCommand(const CMessage &command) throw (EInvalidCommand) = 0; + virtual void onCommand(const CMessage &command) = 0; /// The gateway send a textual command to the transport - virtual bool onCommand(const TParsedCommandLine &command) throw (EInvalidCommand) = 0; + virtual bool onCommand(const TParsedCommandLine &command) = 0; /// The gateway update the transport regularly virtual void update() =0; diff --git a/code/nel/include/nel/net/module_socket.h b/code/nel/include/nel/net/module_socket.h index f4bad56d4..a60836656 100644 --- a/code/nel/include/nel/net/module_socket.h +++ b/code/nel/include/nel/net/module_socket.h @@ -42,15 +42,11 @@ namespace NLNET * If the destination module is not accessible through this socket, * an exception is thrown. */ - virtual void sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message ) - throw (EModuleNotPluggedHere) - =0; + virtual void sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message) =0; /** A plugged module send a message to all the module reachable * with this socket. */ - virtual void broadcastModuleMessage(IModule *senderModule, const NLNET::CMessage &message) - throw (EModuleNotPluggedHere) - =0; + virtual void broadcastModuleMessage(IModule *senderModule, const NLNET::CMessage &message) =0; /** Fill the resultList with the list of module that are * reachable with this socket. @@ -95,21 +91,15 @@ namespace NLNET virtual void _onModulePlugged(const TModulePtr &pluggedModule); virtual void _onModuleUnplugged(const TModulePtr &pluggedModule); - virtual void _sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message ) - throw (EModuleNotPluggedHere, NLNET::EModuleNotReachable) - =0; + virtual void _sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message) =0; - virtual void _broadcastModuleMessage(IModule *senderModule, const NLNET::CMessage &message) - throw (EModuleNotPluggedHere) - =0; + virtual void _broadcastModuleMessage(IModule *senderModule, const NLNET::CMessage &message) =0; - virtual void sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message ) - throw (EModuleNotPluggedHere); + virtual void sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message); /** A plugged module send a message to all the module reachable * with this socket. */ - virtual void broadcastModuleMessage(IModule *senderModule, const NLNET::CMessage &message) - throw (EModuleNotPluggedHere); + virtual void broadcastModuleMessage(IModule *senderModule, const NLNET::CMessage &message); }; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp index be7a74722..7a4618683 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -1328,7 +1328,7 @@ const D3DFORMAT FinalPixelFormat[ITexture::UploadFormatCount][CDriverD3D::FinalP // *************************************************************************** -bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay) +bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) { H_AUTO_D3D(CDriver3D_setDisplay); diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.h b/code/nel/src/3d/driver/direct3d/driver_direct3d.h index a4d9dbaeb..51c21bbc9 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -849,7 +849,7 @@ public: // Mode initialisation, requests virtual bool init (uintptr_t windowIcon = 0, emptyProc exitFunc = 0); - virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay); + virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable); virtual bool release(); virtual bool setMode(const GfxMode& mode); virtual bool getModes(std::vector &modes); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.h b/code/nel/src/3d/driver/opengl/driver_opengl.h index 68e6b0edf..a03077544 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl.h @@ -325,7 +325,7 @@ public: virtual void disableHardwareVertexArrayAGP(); virtual void disableHardwareTextureShader(); - virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay); + virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable); virtual bool setMode(const GfxMode& mode); virtual bool getModes(std::vector &modes); virtual bool getCurrentScreenMode(GfxMode &mode); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index a7eb6e62a..3d1803a2a 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -611,7 +611,7 @@ void CDriverGL::setWindowIcon(const std::vector &bitmaps) } // -------------------------------------------------- -bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool resizeable) throw(EBadDisplay) +bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool resizeable) { H_AUTO_OGL(CDriverGL_setDisplay) diff --git a/code/nel/src/3d/dru.cpp b/code/nel/src/3d/dru.cpp index 15ccbfe01..54248c001 100644 --- a/code/nel/src/3d/dru.cpp +++ b/code/nel/src/3d/dru.cpp @@ -77,7 +77,7 @@ extern IDriver* createGlEsDriverInstance (); #endif // *************************************************************************** -IDriver *CDRU::createGlDriver() throw (EDru) +IDriver *CDRU::createGlDriver() { #ifdef NL_STATIC @@ -131,7 +131,7 @@ IDriver *CDRU::createGlDriver() throw (EDru) } // *************************************************************************** -IDriver *CDRU::createGlEsDriver() throw (EDru) +IDriver *CDRU::createGlEsDriver() { #ifdef NL_STATIC @@ -188,7 +188,7 @@ IDriver *CDRU::createGlEsDriver() throw (EDru) #ifdef NL_OS_WINDOWS -IDriver *CDRU::createD3DDriver() throw (EDru) +IDriver *CDRU::createD3DDriver() { #ifdef NL_STATIC diff --git a/code/nel/src/3d/landscape.cpp b/code/nel/src/3d/landscape.cpp index 4b597fc2d..75e71920a 100644 --- a/code/nel/src/3d/landscape.cpp +++ b/code/nel/src/3d/landscape.cpp @@ -2423,7 +2423,7 @@ void CLandscape::checkZoneBinds(CZone &curZone, EBadBind &bindError) // *************************************************************************** -void CLandscape::checkBinds() throw(EBadBind) +void CLandscape::checkBinds() { EBadBind bindError; @@ -2439,7 +2439,7 @@ void CLandscape::checkBinds() throw(EBadBind) // *************************************************************************** -void CLandscape::checkBinds(uint16 zoneId) throw(EBadBind) +void CLandscape::checkBinds(uint16 zoneId) { EBadBind bindError; diff --git a/code/nel/src/3d/nelu.cpp b/code/nel/src/3d/nelu.cpp index 8cb6e0968..7807a5ef7 100644 --- a/code/nel/src/3d/nelu.cpp +++ b/code/nel/src/3d/nelu.cpp @@ -51,7 +51,7 @@ CEventServer CNELU::EventServer; CEventListenerAsync CNELU::AsyncListener; -bool CNELU::initDriver (uint w, uint h, uint bpp, bool windowed, nlWindow systemWindow, bool offscreen, bool direct3d) throw(EDru) +bool CNELU::initDriver (uint w, uint h, uint bpp, bool windowed, nlWindow systemWindow, bool offscreen, bool direct3d) { // Init debug system // NLMISC::InitDebug(); @@ -183,7 +183,7 @@ void CNELU::releaseDriver() } } -bool CNELU::init (uint w, uint h, CViewport viewport, uint bpp, bool windowed, nlWindow systemWindow, bool offscreen, bool direct3d) throw(EDru) +bool CNELU::init (uint w, uint h, CViewport viewport, uint bpp, bool windowed, nlWindow systemWindow, bool offscreen, bool direct3d) { NL3D::registerSerial3d(); if (initDriver(w,h,bpp,windowed,systemWindow,offscreen,direct3d)) diff --git a/code/nel/src/3d/text_context.cpp b/code/nel/src/3d/text_context.cpp index 8cee144ca..5fcc43daa 100644 --- a/code/nel/src/3d/text_context.cpp +++ b/code/nel/src/3d/text_context.cpp @@ -47,7 +47,8 @@ CTextContext::CTextContext() _Shaded = false; _ShadeOutline = false; - _ShadeExtent = 0.001f; + _ShadeExtentX = 0.001f; + _ShadeExtentY = 0.001f; _ShadeColor = NLMISC::CRGBA(0,0,0); _Keep800x600Ratio= true; diff --git a/code/nel/src/3d/text_context_user.cpp b/code/nel/src/3d/text_context_user.cpp index 1834a93ce..ae2cc2417 100644 --- a/code/nel/src/3d/text_context_user.cpp +++ b/code/nel/src/3d/text_context_user.cpp @@ -187,11 +187,11 @@ bool CTextContextUser::getShadeOutline() const return _TextContext.getShadeOutline(); } -void CTextContextUser::setShadeExtent(float shext) +void CTextContextUser::setShadeExtent(float x, float y) { H_AUTO2; - _TextContext.setShadeExtent(shext); + _TextContext.setShadeExtent(x, y); } void CTextContextUser::setShadeColor (NLMISC::CRGBA sc) { diff --git a/code/nel/src/3d/water_height_map.cpp b/code/nel/src/3d/water_height_map.cpp index 5f67ffce3..6fe88a8bc 100644 --- a/code/nel/src/3d/water_height_map.cpp +++ b/code/nel/src/3d/water_height_map.cpp @@ -677,7 +677,7 @@ void CWaterHeightMap::setWaves(float intensity, float period, uint radius, bool void CWaterHeightMap::serial(NLMISC::IStream &f) { f.xmlPushBegin("WaterHeightMap"); - f.xmlSetAttrib ("NAME") ; + f.xmlSetAttrib ("NAME"); f.serial (_Name); f.xmlPushEnd(); (void)f.serialVersion(0); diff --git a/code/nel/src/gui/CMakeLists.txt b/code/nel/src/gui/CMakeLists.txt index 5233b8ceb..cb7bbe23a 100644 --- a/code/nel/src/gui/CMakeLists.txt +++ b/code/nel/src/gui/CMakeLists.txt @@ -6,9 +6,10 @@ SOURCE_GROUP("src" FILES ${SRC}) NL_TARGET_LIB(nelgui ${SRC} ${HEADERS}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${CURL_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR}) + +TARGET_LINK_LIBRARIES(nelgui nelmisc nel3d ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) -TARGET_LINK_LIBRARIES(nelgui nelmisc nel3d ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${CURL_LIBRARIES}) NL_DEFAULT_PROPS(nelgui "NeL, Library: NeL GUI") NL_ADD_RUNTIME_FLAGS(nelgui) diff --git a/code/nel/src/gui/curl_certificates.cpp b/code/nel/src/gui/curl_certificates.cpp index 6cf34c8b8..6d1bc86ee 100644 --- a/code/nel/src/gui/curl_certificates.cpp +++ b/code/nel/src/gui/curl_certificates.cpp @@ -21,12 +21,18 @@ #include #include +#include -#if defined(NL_OS_WINDOWS) -#pragma comment(lib, "crypt32.lib") -#pragma comment(lib, "cryptui.lib") +#include + +// for compatibility with older versions +#ifndef CURL_AT_LEAST_VERSION +#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z) +#define CURL_AT_LEAST_VERSION(x,y,z) \ + (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) #endif + using namespace std; using namespace NLMISC; @@ -36,36 +42,143 @@ using namespace NLMISC; namespace NLGUI { -#if defined(NL_OS_WINDOWS) - static std::vector x509CertList; - // // x509CertList lifetime manager // - class SX509Certificates { + class SX509Certificates + { public: - SX509Certificates() + struct CertEntry { - curl_version_info_data *data; - data = curl_version_info(CURLVERSION_NOW); - if (!(data && data->features & CURL_VERSION_SSPI)) + X509 *cert; + std::string name; + std::string file; + + bool operator == (const std::string &str) { - addCertificatesFrom("CA"); - addCertificatesFrom("AuthRoot"); - addCertificatesFrom("ROOT"); + return file == str; } + }; + + std::vector CertList; + + bool isUsingOpenSSLBackend; + bool isInitialized; + + SX509Certificates():isUsingOpenSSLBackend(false), isInitialized(false) + { + init(); } ~SX509Certificates() { - for (uint i = 0; i < x509CertList.size(); ++i) + for (uint i = 0; i < CertList.size(); ++i) { - X509_free(x509CertList[i]); + X509_free(CertList[i].cert); } - x509CertList.clear(); + CertList.clear(); } + void init() + { + // init CURL + CURL *curl = curl_easy_init(); + if (!curl) return; + + // get information on CURL + curl_version_info_data *data = curl_version_info(CURLVERSION_NOW); + + bool useOpenSSLBackend = false; + +#if CURL_AT_LEAST_VERSION(7, 34, 0) + // get more information on CURL session + curl_tlssessioninfo *sessionInfo; + + CURLINFO info; + +#if CURL_AT_LEAST_VERSION(7, 48, 0) + info = CURLINFO_TLS_SSL_PTR; +#else + info = CURLINFO_TLS_SESSION; +#endif + + CURLcode res = curl_easy_getinfo(curl, info, &sessionInfo); + + // CURL using OpenSSL backend + if ((res == CURLE_OK) && sessionInfo && sessionInfo->backend == CURLSSLBACKEND_OPENSSL) useOpenSSLBackend = true; +#elif CURL_AT_LEAST_VERSION(7, 12, 3) + // get a list of OpenSSL engines + struct curl_slist *engines; + + CURLcode res = curl_easy_getinfo(curl, CURLINFO_SSL_ENGINES, &engines); + + // CURL using OpenSSL backend + // With OpenSSL compiled without any engine, engines will too return NULL + // Fortunately, if OpenSSL isn't compiled with engines means we compiled it ourself and CURL is a recent version + if ((res == CURLE_OK) && engines) + { + // free engines + curl_slist_free_all(engines); + + useOpenSSLBackend = true; + } +#else + // TODO: implement an equivalent, but CURL 7.12 was released in 2004 +#endif + + // only use OpenSSL callback if not using Windows SSPI and using OpenSSL backend + if (useOpenSSLBackend && !(data && data->features & CURL_VERSION_SSPI)) + { +#ifdef NL_OS_WINDOWS + // load native Windows CA Certs + addCertificatesFrom("CA"); + addCertificatesFrom("AuthRoot"); + addCertificatesFrom("ROOT"); +#endif + + isUsingOpenSSLBackend = true; + } + else + { + // if CURL is using SSPI or SChannel under Windows or DarwinSSL under OS X, we'll use native system CA Certs + isUsingOpenSSLBackend = false; + } + + // clean up CURL + curl_easy_cleanup(curl); + + isInitialized = true; + } + + static std::string getCertName(X509 *cert) + { + // NULL certificate + if (!cert) return ""; + + X509_NAME *subject = X509_get_subject_name(cert); + + std::string name; + unsigned char *tmp = NULL; + + // construct a multiline string with name + for (int j = 0, jlen = X509_NAME_entry_count(subject); j < jlen; ++j) + { + X509_NAME_ENTRY *e = X509_NAME_get_entry(subject, j); + ASN1_STRING *d = X509_NAME_ENTRY_get_data(e); + + if (ASN1_STRING_to_UTF8(&tmp, d) > 0) + { + name += NLMISC::toString("%s\n", tmp); + + OPENSSL_free(tmp); + } + } + + return name; + } + +#ifdef NL_OS_WINDOWS void addCertificatesFrom(LPCSTR root) { HCERTSTORE hStore; @@ -78,36 +191,154 @@ namespace NLGUI { x509 = NULL; x509 = d2i_X509(NULL, (const unsigned char **)&pContext->pbCertEncoded, pContext->cbCertEncoded); + if (x509) { - x509CertList.push_back(x509); + CertEntry entry; + entry.cert = x509; + entry.file = root; + entry.name = getCertName(x509); + + CertList.push_back(entry); } } + CertFreeCertificateContext(pContext); CertCloseStore(hStore, 0); } // this is called before debug context is set and log ends up in log.log - //nlinfo("Loaded %d certificates from '%s' certificate store", List.size(), root); + //nlinfo("Loaded %d certificates from '%s' certificate store", (int)CertList.size(), root); + } +#endif + + void addCertificatesFromFile(const std::string &cert) + { + if (!isInitialized) + { + nlwarning("CURL not initialized! Check if there are another errors"); + return; + } + + if (!isUsingOpenSSLBackend) + { + nlinfo("CURL not using OpenSSL backend! Unable to use custom certificates"); + return; + } + else + { + nlinfo("CURL using OpenSSL backend!"); + } + + // this file was already loaded + if (std::find(CertList.begin(), CertList.end(), cert) != CertList.end()) return; + + // look for certificate in search paths + string path = CPath::lookup(cert, false); + + if (path.empty()) + { + nlwarning("Unable to find %s", cert.c_str()); + return; + } + + nlinfo("CURL CA bundle '%s'", path.c_str()); + + CIFile file; + + // open certificate + if (!file.open(path)) + { + nlwarning("Unable to open %s", path.c_str()); + return; + } + + // load certificate content into memory + std::vector buffer(file.getFileSize()); + file.serialBuffer(&buffer[0], file.getFileSize()); + + // get a BIO + BIO *bio = BIO_new_mem_buf(&buffer[0], file.getFileSize()); + + if (bio) + { + // use it to read the PEM formatted certificate from memory into an X509 + // structure that SSL can use + STACK_OF(X509_INFO) *info = PEM_X509_INFO_read_bio(bio, NULL, NULL, NULL); + + if (info) + { + // iterate over all entries from the PEM file, add them to the x509_store one by one + for (sint i = 0; i < sk_X509_INFO_num(info); ++i) + { + X509_INFO *itmp = sk_X509_INFO_value(info, i); + + if (itmp && itmp->x509) + { + CertEntry entry; + entry.cert = X509_dup(itmp->x509); + entry.file = cert; + entry.name = getCertName(entry.cert); + + CertList.push_back(entry); + } + } + + // cleanup + sk_X509_INFO_pop_free(info, X509_INFO_free); + } + else + { + nlwarning("Unable to read PEM info"); + } + + // decrease reference counts + BIO_free(bio); + } + else + { + nlwarning("Unable to allocate BIO buffer for certificates"); + } } }; /// this will be initialized on startup and cleared on exit static SX509Certificates x509CertListManager; - // *************************************************************************** - // static - CURLcode CCurlCertificates::sslCtxFunction(CURL *curl, void *sslctx, void *parm) + // cURL SSL certificate loading + static CURLcode sslCtxFunction(CURL *curl, void *sslctx, void *parm) { - if (x509CertList.size() > 0) + CURLcode res = CURLE_OK; + + if (x509CertListManager.CertList.size() > 0) { SSL_CTX *ctx = (SSL_CTX*)sslctx; X509_STORE *x509store = SSL_CTX_get_cert_store(ctx); if (x509store) { - for (uint i = 0; i < x509CertList.size(); ++i) + char errorBuffer[1024]; + + for (uint i = 0, ilen = x509CertListManager.CertList.size(); i < ilen; ++i) { - X509_STORE_add_cert(x509store, x509CertList[i]); + SX509Certificates::CertEntry entry = x509CertListManager.CertList[i]; + + // add our certificate to this store + if (X509_STORE_add_cert(x509store, entry.cert) == 0) + { + uint errCode = ERR_get_error(); + + // ignore already in hash table errors + if (ERR_GET_LIB(errCode) != ERR_LIB_X509 || ERR_GET_REASON(errCode) != X509_R_CERT_ALREADY_IN_HASH_TABLE) + { + ERR_error_string_n(errCode, errorBuffer, 1024); + nlwarning("Error adding certificate %s: %s", entry.name.c_str(), errorBuffer); + res = CURLE_SSL_CACERT; + } + } + else + { + nldebug("Added certificate %s", entry.name.c_str()); + } } } else @@ -115,9 +346,40 @@ namespace NLGUI nlwarning("SSL_CTX_get_cert_store returned NULL"); } } - return CURLE_OK; + else + { + res = CURLE_SSL_CACERT; + } + + return res; + } + + // *************************************************************************** + // static + void CCurlCertificates::addCertificateFile(const std::string &cert) + { + x509CertListManager.addCertificatesFromFile(cert); + } + + // *************************************************************************** + // static + void CCurlCertificates::useCertificates(CURL *curl) + { + // CURL must be valid, using OpenSSL backend and certificates must be loaded, else return + if (!curl || !x509CertListManager.isInitialized || !x509CertListManager.isUsingOpenSSLBackend || x509CertListManager.CertList.empty()) return; + + curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "PEM"); + + // would allow to provide the CA in memory instead of using CURLOPT_CAINFO, but needs to include and link OpenSSL + if (curl_easy_setopt(curl, CURLOPT_SSL_CTX_FUNCTION, &sslCtxFunction) != CURLE_OK) + { + nlwarning("Unable to support CURLOPT_SSL_CTX_FUNCTION, curl not compiled with OpenSSL ?"); + } + + // set both CURLOPT_CAINFO and CURLOPT_CAPATH to NULL to be sure we won't use default values (these files can be missing and generate errors) + curl_easy_setopt(curl, CURLOPT_CAINFO, NULL); + curl_easy_setopt(curl, CURLOPT_CAPATH, NULL); } -#endif // NL_OS_WINDOWS }// namespace diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index e0ed401ce..b606a093d 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -49,6 +49,8 @@ #include "nel/gui/http_hsts.h" #include "nel/gui/curl_certificates.h" +#include + using namespace std; using namespace NLMISC; @@ -205,6 +207,47 @@ namespace NLGUI std::map HeadersRecv; }; + // cURL transfer callbacks + // *************************************************************************** + static size_t curlHeaderCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData) + { + CCurlWWWData * me = static_cast(pCCurlWWWData); + if (me) + { + std::string header; + header.append(buffer, size * nmemb); + me->setRecvHeader(header.substr(0, header.find_first_of("\n\r"))); + } + + return size * nmemb; + } + + // *************************************************************************** + static size_t curlDataCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData) + { + CCurlWWWData * me = static_cast(pCCurlWWWData); + if (me) + me->Content.append(buffer, size * nmemb); + + return size * nmemb; + } + + // *************************************************************************** + static size_t curlProgressCallback(void *pCCurlWWWData, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) + { + CCurlWWWData * me = static_cast(pCCurlWWWData); + if (me) + { + if (dltotal > 0 || dlnow > 0 || ultotal > 0 || ulnow > 0) + { + nlwarning("> dltotal %d, dlnow %d, ultotal %d, ulnow %d, url '%s'", dltotal, dlnow, ultotal, ulnow, me->Url.c_str()); + } + } + + // return 1 to cancel download + return 0; + } + // Check if domain is on TrustedDomain bool CGroupHTML::isTrustedDomain(const string &domain) { @@ -398,14 +441,8 @@ namespace NLGUI // https:// if (toLower(download.url.substr(0, 8)) == "https://") { -#if defined(NL_OS_WINDOWS) - curl_easy_setopt(curl, CURLOPT_SSL_CTX_FUNCTION, &CCurlCertificates::sslCtxFunction); -#else - if (!options.curlCABundle.empty()) - { - curl_easy_setopt(curl, CURLOPT_CAINFO, options.curlCABundle.c_str()); - } -#endif + // if supported, use custom SSL context function to load certificates + CCurlCertificates::useCertificates(curl); } download.data = new CCurlWWWData(curl, download.url); @@ -429,7 +466,7 @@ namespace NLGUI download.data->sendHeaders(headers); // catch headers - curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curlHeaderCallback); + curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, NLGUI::curlHeaderCallback); curl_easy_setopt(curl, CURLOPT_WRITEHEADER, download.data); std::string userAgent = options.appName + "/" + options.appVersion; @@ -459,7 +496,7 @@ namespace NLGUI #endif // Display cached image while downloading new - if (type != TImageType::OverImage && CFile::fileExists(dest)) + if (type != OverImage && CFile::fileExists(dest)) { setImage(img, dest, type); setImageSize(img, style); @@ -1057,6 +1094,29 @@ namespace NLGUI _CellParams.push_back (cellParams); \ } + static bool scanCssLength(const std::string& str, uint32 &px) + { + if (fromString(str, px)) + return true; + + if (str == "thin") + { + px = 1; + return true; + } + if (str == "medium") + { + px = 3; + return true; + } + if (str == "thick") + { + px = 5; + return true; + } + + return false; + } static bool isHexa(char c) { @@ -1485,23 +1545,14 @@ namespace NLGUI { registerAnchorName(MY_HTML_A); - CStyleParams style; - style.FontFamily = getFontFamily(); - style.FontSize = getFontSize(); - style.TextColor = LinkColor; - style.Underlined = true; - style.StrikeThrough = getFontStrikeThrough(); - style.GlobalColor = LinkColorGlobalColor; + pushStyle(); + _Style.TextColor = LinkColor; + _Style.Underlined = true; + _Style.GlobalColor = LinkColorGlobalColor; if (present[HTML_A_STYLE] && value[HTML_A_STYLE]) - getStyleParams(value[HTML_A_STYLE], style); + getStyleParams(value[HTML_A_STYLE], _Style); - _FontFamily.push_back(style.FontFamily); - _FontSize.push_back(style.FontSize); - _TextColor.push_back(style.TextColor); - _FontUnderlined.push_back(style.Underlined); - _FontStrikeThrough.push_back(style.StrikeThrough); - _GlobalColor.push_back(style.GlobalColor); _A.push_back(true); _Link.push_back (""); _LinkTitle.push_back(""); @@ -1539,6 +1590,7 @@ namespace NLGUI { _BlockLevelElement.push_back(true); registerAnchorName(MY_HTML_DIV); + pushStyle(); if (present[MY_HTML_DIV_NAME] && value[MY_HTML_DIV_NAME]) _DivName = value[MY_HTML_DIV_NAME]; @@ -1547,6 +1599,13 @@ namespace NLGUI if (present[MY_HTML_DIV_CLASS] && value[MY_HTML_DIV_CLASS]) instClass = value[MY_HTML_DIV_CLASS]; + string style; + if (present[MY_HTML_DIV_STYLE] && value[MY_HTML_DIV_STYLE]) + style = value[MY_HTML_DIV_STYLE]; + + if (!style.empty()) + getStyleParams(style, _Style); + // use generic template system if (_TrustedDomain && !instClass.empty() && instClass == "ryzom-ui-grouptemplate") { @@ -1554,10 +1613,6 @@ namespace NLGUI if (present[MY_HTML_DIV_ID] && value[MY_HTML_DIV_ID]) id = value[MY_HTML_DIV_ID]; - string style; - if (present[MY_HTML_DIV_STYLE] && value[MY_HTML_DIV_STYLE]) - style = value[MY_HTML_DIV_STYLE]; - typedef pair TTmplParam; vector tmplParams; @@ -1625,30 +1680,19 @@ namespace NLGUI break; case HTML_FONT: { - bool found = false; + pushStyle(); if (present[HTML_FONT_COLOR] && value[HTML_FONT_COLOR]) { CRGBA color; if (scanHTMLColor(value[HTML_FONT_COLOR], color)) - { - _TextColor.push_back(color); - found = true; - } - } - if (!found) - { - _TextColor.push_back(_TextColor.empty() ? CRGBA::White : _TextColor.back()); + _Style.TextColor = color; } if (present[HTML_FONT_SIZE] && value[HTML_FONT_SIZE]) { uint fontsize; fromString(value[HTML_FONT_SIZE], fontsize); - _FontSize.push_back(fontsize); - } - else - { - _FontSize.push_back(_FontSize.empty() ? TextFontSize : _FontSize.back()); + _Style.FontSize = fontsize; } } break; @@ -1699,6 +1743,10 @@ namespace NLGUI image = image.substr(4, image.size()-5); setBackground (image, scale, repeat); } + + // set default text style from + getStyleParams(style, _StyleDefault); + _Style = _StyleDefault; } } break; @@ -1720,46 +1768,76 @@ namespace NLGUI } break; case HTML_H1: - registerAnchorName(MY_HTML_H1); - newParagraph(PBeginSpace); - _FontSize.push_back(H1FontSize); - _TextColor.push_back(H1Color); - _GlobalColor.push_back(H1ColorGlobalColor); + { + registerAnchorName(MY_HTML_H1); + newParagraph(PBeginSpace); + pushStyle(); + _Style.FontSize = H1FontSize; + _Style.TextColor = H1Color; + _Style.GlobalColor = H1ColorGlobalColor; + if (present[MY_HTML_H1_STYLE] && value[MY_HTML_H1_STYLE]) + getStyleParams(value[MY_HTML_H1_STYLE], _Style); + } break; case HTML_H2: - registerAnchorName(MY_HTML_H2); - newParagraph(PBeginSpace); - _FontSize.push_back(H2FontSize); - _TextColor.push_back(H2Color); - _GlobalColor.push_back(H2ColorGlobalColor); + { + registerAnchorName(MY_HTML_H2); + newParagraph(PBeginSpace); + pushStyle(); + _Style.FontSize = H2FontSize; + _Style.TextColor = H2Color; + _Style.GlobalColor = H2ColorGlobalColor; + if (present[MY_HTML_H2_STYLE] && value[MY_HTML_H2_STYLE]) + getStyleParams(value[MY_HTML_H2_STYLE], _Style); + } break; case HTML_H3: - registerAnchorName(MY_HTML_H3); - newParagraph(PBeginSpace); - _FontSize.push_back(H3FontSize); - _TextColor.push_back(H3Color); - _GlobalColor.push_back(H3ColorGlobalColor); + { + registerAnchorName(MY_HTML_H3); + newParagraph(PBeginSpace); + pushStyle(); + _Style.FontSize = H3FontSize; + _Style.TextColor = H3Color; + _Style.GlobalColor = H3ColorGlobalColor; + if (present[MY_HTML_H3_STYLE] && value[MY_HTML_H3_STYLE]) + getStyleParams(value[MY_HTML_H3_STYLE], _Style); + } break; case HTML_H4: - registerAnchorName(MY_HTML_H4); - newParagraph(PBeginSpace); - _FontSize.push_back(H4FontSize); - _TextColor.push_back(H4Color); - _GlobalColor.push_back(H4ColorGlobalColor); + { + registerAnchorName(MY_HTML_H4); + newParagraph(PBeginSpace); + pushStyle(); + _Style.FontSize = H4FontSize; + _Style.TextColor = H4Color; + _Style.GlobalColor = H4ColorGlobalColor; + if (present[MY_HTML_H4_STYLE] && value[MY_HTML_H4_STYLE]) + getStyleParams(value[MY_HTML_H4_STYLE], _Style); + } break; case HTML_H5: - registerAnchorName(MY_HTML_H5); - newParagraph(PBeginSpace); - _FontSize.push_back(H5FontSize); - _TextColor.push_back(H5Color); - _GlobalColor.push_back(H5ColorGlobalColor); + { + registerAnchorName(MY_HTML_H5); + newParagraph(PBeginSpace); + pushStyle(); + _Style.FontSize = H5FontSize; + _Style.TextColor = H5Color; + _Style.GlobalColor = H5ColorGlobalColor; + if (present[MY_HTML_H5_STYLE] && value[MY_HTML_H5_STYLE]) + getStyleParams(value[MY_HTML_H5_STYLE], _Style); + } break; case HTML_H6: - registerAnchorName(MY_HTML_H6); - newParagraph(PBeginSpace); - _FontSize.push_back(H6FontSize); - _TextColor.push_back(H6Color); - _GlobalColor.push_back(H6ColorGlobalColor); + { + registerAnchorName(MY_HTML_H6); + newParagraph(PBeginSpace); + pushStyle(); + _Style.FontSize = H6FontSize; + _Style.TextColor = H6Color; + _Style.GlobalColor = H6ColorGlobalColor; + if (present[MY_HTML_H6_STYLE] && value[MY_HTML_H6_STYLE]) + getStyleParams(value[MY_HTML_H6_STYLE], _Style); + } break; case HTML_IMG: { @@ -1857,15 +1935,15 @@ namespace NLGUI if (present[MY_HTML_INPUT_TYPE] && value[MY_HTML_INPUT_TYPE]) { // by default not inherited, font family defaults to system font - CStyleParams style; - style.TextColor = TextColor; - style.FontSize = TextFontSize; - style.FontWeight = FONT_WEIGHT_NORMAL; - style.FontOblique = false; + pushStyle(); + _Style.TextColor = TextColor; + _Style.FontSize = TextFontSize; + _Style.FontWeight = FONT_WEIGHT_NORMAL; + _Style.FontOblique = false; // Global color flag if (present[MY_HTML_INPUT_GLOBAL_COLOR]) - style.GlobalColor = true; + _Style.GlobalColor = true; // Tooltip const char *tooltip = NULL; @@ -1873,13 +1951,7 @@ namespace NLGUI tooltip = value[MY_HTML_INPUT_ALT]; if (present[MY_HTML_INPUT_STYLE] && value[MY_HTML_INPUT_STYLE]) - getStyleParams(value[MY_HTML_INPUT_STYLE], style); - - _TextColor.push_back(style.TextColor); - _FontFamily.push_back(style.FontFamily); - _FontSize.push_back(style.FontSize); - _FontWeight.push_back(style.FontWeight); - _FontOblique.push_back(style.FontOblique); + getStyleParams(value[MY_HTML_INPUT_STYLE], _Style); string type = toLower(value[MY_HTML_INPUT_TYPE]); if (type == "image") @@ -1899,7 +1971,7 @@ namespace NLGUI // Add the ctrl button addButton (CCtrlButton::PushButton, name, normal, pushed.empty()?normal:pushed, over, - "html_submit_form", param.c_str(), tooltip, style); + "html_submit_form", param.c_str(), tooltip, _Style); } if (type == "button" || type == "submit") { @@ -1954,7 +2026,7 @@ namespace NLGUI if (!ctrlButton) ctrlButton = dynamic_cast(buttonGroup->getCtrl("b")); if (ctrlButton) { - ctrlButton->setModulateGlobalColorAll (style.GlobalColor); + ctrlButton->setModulateGlobalColorAll (_Style.GlobalColor); // Translate the tooltip if (tooltip) @@ -2037,7 +2109,7 @@ namespace NLGUI checked = (present[MY_HTML_INPUT_CHECKED] && value[MY_HTML_INPUT_CHECKED]); // Add the ctrl button - CCtrlButton *checkbox = addButton (btnType, name, normal, pushed, over, "", "", tooltip, style); + CCtrlButton *checkbox = addButton (btnType, name, normal, pushed, over, "", "", tooltip, _Style); if (checkbox) { if (btnType == CCtrlButton::RadioButton) @@ -2091,11 +2163,7 @@ namespace NLGUI } } - popIfNotEmpty(_FontFamily); - popIfNotEmpty(_FontSize); - popIfNotEmpty(_TextColor); - popIfNotEmpty(_FontWeight); - popIfNotEmpty(_FontOblique); + popStyle(); } } break; @@ -2189,6 +2257,10 @@ namespace NLGUI if (present[HTML_LI_VALUE] && value[HTML_LI_VALUE]) fromString(value[HTML_LI_VALUE], _UL.back().Value); + pushStyle(); + if (present[HTML_LI_STYLE] && value[HTML_LI_STYLE]) + getStyleParams(value[HTML_LI_STYLE], _Style); + ucstring str; str.fromUtf8(_UL.back().getListMarkerText()); addString (str); @@ -2206,35 +2278,28 @@ namespace NLGUI } break; case HTML_P: - newParagraph(PBeginSpace); + { + newParagraph(PBeginSpace); + pushStyle(); + if (present[HTML_BLOCK_STYLE] && value[HTML_BLOCK_STYLE]) + getStyleParams(value[HTML_BLOCK_STYLE], _Style); + } break; case HTML_PRE: { - CStyleParams style; - style.TextColor = getTextColor(); - style.FontFamily = "monospace"; - style.FontSize = getFontSize(); - style.FontWeight = getFontWeight(); - style.FontOblique = getFontOblique(); - style.Underlined = getFontUnderlined(); - style.StrikeThrough = getFontStrikeThrough(); + pushStyle(); + _Style.FontFamily = "monospace"; if (present[HTML_PRE_STYLE] && value[HTML_PRE_STYLE]) - getStyleParams(value[HTML_PRE_STYLE], style); + getStyleParams(value[HTML_PRE_STYLE], _Style); - _TextColor.push_back(style.TextColor); - _FontFamily.push_back(style.FontFamily); - _FontSize.push_back(style.FontSize); - _FontWeight.push_back(style.FontWeight); - _FontOblique.push_back(style.FontOblique); - _FontUnderlined.push_back(style.Underlined); - _FontStrikeThrough.push_back(style.StrikeThrough); _PRE.push_back(true); } break; case HTML_TABLE: { + pushStyle(); registerAnchorName(MY_HTML_TABLE); // Get cells parameters @@ -2253,6 +2318,8 @@ namespace NLGUI fromString(value[MY_HTML_TABLE_CELLSPACING], table->CellSpacing); if (present[MY_HTML_TABLE_CELLPADDING] && value[MY_HTML_TABLE_CELLPADDING]) fromString(value[MY_HTML_TABLE_CELLPADDING], table->CellPadding); + if (present[MY_HTML_TABLE_STYLE] && value[MY_HTML_TABLE_STYLE]) + getStyleParams(value[MY_HTML_TABLE_STYLE], _Style); table->setMarginLeft(getIndent()); addHtmlGroup (table, 0); @@ -2272,14 +2339,18 @@ namespace NLGUI // Get cells parameters getCellsParameters (MY_HTML_TD, true); + pushStyle(); if (element_number == HTML_TH) { - _FontWeight.push_back(FONT_WEIGHT_BOLD); + _Style.FontWeight = FONT_WEIGHT_BOLD; // center if not specified otherwise. TD/TH present/value arrays have same indices if (!(present[MY_HTML_TD_ALIGN] && value[MY_HTML_TD_ALIGN])) _CellParams.back().Align = CGroupCell::Center; } + if (present[MY_HTML_TD_STYLE] && value[MY_HTML_TD_STYLE]) + getStyleParams(value[MY_HTML_TD_STYLE], _Style); + CGroupTable *table = getTable(); if (table) { @@ -2359,27 +2430,22 @@ namespace NLGUI } break; case HTML_TEXTAREA: + pushStyle(); _PRE.push_back(true); + // not inherited by default, font family defaults to system font + _Style.TextColor = TextColor; + _Style.FontWeight = FONT_WEIGHT_NORMAL; + _Style.FontOblique = false; + _Style.FontSize = TextFontSize; + _Style.TextShadow = STextShadow(true); + + if (present[MY_HTML_TEXTAREA_STYLE] && value[MY_HTML_TEXTAREA_STYLE]) + getStyleParams(value[MY_HTML_TEXTAREA_STYLE], _Style); + // Got one form ? if (!(_Forms.empty())) { - // not inherited by default, font family defaults to system font - CStyleParams style; - style.TextColor = TextColor; - style.FontWeight = FONT_WEIGHT_NORMAL; - style.FontOblique = false; - style.FontSize = TextFontSize; - - if (present[MY_HTML_TEXTAREA_STYLE] && value[MY_HTML_TEXTAREA_STYLE]) - getStyleParams(value[MY_HTML_TEXTAREA_STYLE], style); - - _TextColor.push_back(style.TextColor); - _FontFamily.push_back(style.FontFamily); - _FontSize.push_back(style.FontSize); - _FontWeight.push_back(style.FontWeight); - _FontOblique.push_back(style.FontOblique); - // read general property string templateName; @@ -2428,6 +2494,10 @@ namespace NLGUI // Set TR flag if (!_TR.empty()) _TR.back() = true; + + pushStyle(); + if (present[MY_HTML_TR_STYLE] && value[MY_HTML_TR_STYLE]) + getStyleParams(value[MY_HTML_TR_STYLE], _Style); } break; case HTML_UL: @@ -2441,6 +2511,10 @@ namespace NLGUI _LI = _UL.size() > 1 || _DL.size() > 1; _Indent.push_back(getIndent() + ULIndent); endParagraph(); + + pushStyle(); + if (present[HTML_UL_STYLE] && value[HTML_UL_STYLE]) + getStyleParams(value[HTML_UL_STYLE], _Style); break; case HTML_OBJECT: _ObjectType.clear(); @@ -2460,69 +2534,77 @@ namespace NLGUI break; case HTML_SPAN: { - CStyleParams style; - style.TextColor = getTextColor(); - style.FontFamily = getFontFamily(); - style.FontSize = getFontSize(); - style.FontWeight = getFontWeight(); - style.FontOblique = getFontOblique(); - style.Underlined = getFontUnderlined(); - style.StrikeThrough = getFontStrikeThrough(); - style.GlobalColor = getGlobalColor(); + pushStyle(); if (present[MY_HTML_SPAN_STYLE] && value[MY_HTML_SPAN_STYLE]) - getStyleParams(value[MY_HTML_SPAN_STYLE], style); - - _TextColor.push_back(style.TextColor); - _FontFamily.push_back(style.FontFamily); - _FontSize.push_back(style.FontSize); - _FontWeight.push_back(style.FontWeight); - _FontOblique.push_back(style.FontOblique); - _FontUnderlined.push_back(style.Underlined); - _FontStrikeThrough.push_back(style.StrikeThrough); - _GlobalColor.push_back(style.GlobalColor); + getStyleParams(value[MY_HTML_SPAN_STYLE], _Style); } break; case HTML_DEL: - _FontStrikeThrough.push_back(true); + { + pushStyle(); + _Style.StrikeThrough = true; + } break; case HTML_U: - _FontUnderlined.push_back(true); + { + pushStyle(); + _Style.Underlined = true; + } break; case HTML_EM: - _FontOblique.push_back(true); + { + pushStyle(); + _Style.FontOblique = true; + } break; case HTML_STRONG: - _FontWeight.push_back(FONT_WEIGHT_BOLD); + { + pushStyle(); + _Style.FontWeight = FONT_WEIGHT_BOLD; + } break; case HTML_SMALL: - _FontSize.push_back(getFontSizeSmaller()); + { + pushStyle(); + _Style.FontSize = getFontSizeSmaller(); + } break; case HTML_STYLE: case HTML_SCRIPT: _IgnoreText = true; break; case HTML_DL: - _DL.push_back(HTMLDListElement()); - _LI = _DL.size() > 1 || !_UL.empty(); - endParagraph(); + { + _DL.push_back(HTMLDListElement()); + _LI = _DL.size() > 1 || !_UL.empty(); + endParagraph(); + pushStyle(); + if (present[HTML_GEN_STYLE] && value[HTML_GEN_STYLE]) + getStyleParams(value[HTML_GEN_STYLE], _Style); + } break; case HTML_DT: if (!_DL.empty()) { - // close DT if still open + // close if still open if (_DL.back().DD) { _DL.back().DD = false; popIfNotEmpty(_Indent); + popStyle(); } - // see if this is the first
, closing tag not required - if (!_DL.back().DT) - { - _DL.back().DT = true; - _FontWeight.push_back(FONT_WEIGHT_BOLD); - } + // close if still open + if (_DL.back().DT) + popStyle(); + + _DL.back().DT = true; + + pushStyle(); + _Style.FontWeight = FONT_WEIGHT_BOLD; + if (present[HTML_GEN_STYLE] && value[HTML_GEN_STYLE]) + getStyleParams(value[HTML_GEN_STYLE], _Style); if (!_LI) { @@ -2542,15 +2624,23 @@ namespace NLGUI if (_DL.back().DT) { _DL.back().DT = false; - popIfNotEmpty (_FontWeight); + popStyle(); } - if (!_DL.back().DD) + if (_DL.back().DD) { - _DL.back().DD = true; - _Indent.push_back(getIndent() + ULIndent); + _DL.back().DD = false; + popStyle(); + popIfNotEmpty(_Indent); } + _DL.back().DD = true; + _Indent.push_back(getIndent() + ULIndent); + + pushStyle(); + if (present[HTML_GEN_STYLE] && value[HTML_GEN_STYLE]) + getStyleParams(value[HTML_GEN_STYLE], _Style); + if (!_LI) { _LI = true; @@ -2564,6 +2654,7 @@ namespace NLGUI break; case HTML_OL: { + pushStyle(); sint32 start = 1; std::string type("1"); @@ -2571,6 +2662,8 @@ namespace NLGUI fromString(value[HTML_OL_START], start); if (present[HTML_OL_TYPE] && value[HTML_OL_TYPE]) type = value[HTML_OL_TYPE]; + if (present[HTML_OL_STYLE] && value[HTML_OL_STYLE]) + getStyleParams(value[HTML_OL_STYLE], _Style); _UL.push_back(HTMLOListElement(start, type)); // if LI is already present @@ -2633,16 +2726,10 @@ namespace NLGUI _ReadingHeadTag = false; break; case HTML_FONT: - popIfNotEmpty (_TextColor); - popIfNotEmpty (_FontSize); + popStyle(); break; case HTML_A: - popIfNotEmpty (_FontFamily); - popIfNotEmpty (_FontSize); - popIfNotEmpty (_TextColor); - popIfNotEmpty (_FontUnderlined); - popIfNotEmpty (_FontStrikeThrough); - popIfNotEmpty (_GlobalColor); + popStyle(); popIfNotEmpty (_A); popIfNotEmpty (_Link); popIfNotEmpty (_LinkTitle); @@ -2654,25 +2741,19 @@ namespace NLGUI case HTML_H4: case HTML_H5: case HTML_H6: - popIfNotEmpty (_FontSize); - popIfNotEmpty (_TextColor); - popIfNotEmpty (_GlobalColor); + popStyle(); endParagraph(); break; case HTML_P: + popStyle(); endParagraph(); break; case HTML_PRE: - popIfNotEmpty (_FontFamily); - popIfNotEmpty (_FontSize); - popIfNotEmpty (_FontWeight); - popIfNotEmpty (_FontOblique); - popIfNotEmpty (_TextColor); - popIfNotEmpty (_FontUnderlined); - popIfNotEmpty (_FontStrikeThrough); + popStyle(); popIfNotEmpty (_PRE); break; case HTML_DIV: + popStyle(); if (isBlockLevelElement()) { endParagraph(); @@ -2683,6 +2764,7 @@ namespace NLGUI break; case HTML_TABLE: + popStyle(); popIfNotEmpty (_CellParams); popIfNotEmpty (_TR); popIfNotEmpty (_Cells); @@ -2692,14 +2774,15 @@ namespace NLGUI // Add a cell break; case HTML_TH: - popIfNotEmpty (_FontWeight); // no break; case HTML_TD: + popStyle(); popIfNotEmpty (_CellParams); if (!_Cells.empty()) _Cells.back() = NULL; break; case HTML_TR: + popStyle(); popIfNotEmpty (_CellParams); break; case HTML_TEXTAREA: @@ -2716,14 +2799,9 @@ namespace NLGUI entry.TextArea = textArea; _Forms.back().Entries.push_back (entry); } - - popIfNotEmpty (_FontFamily); - popIfNotEmpty (_FontSize); - popIfNotEmpty (_FontWeight); - popIfNotEmpty (_FontOblique); - popIfNotEmpty (_TextColor); } + popStyle(); popIfNotEmpty (_PRE); } break; @@ -2831,10 +2909,16 @@ namespace NLGUI if (!_UL.empty()) { endParagraph(); + popStyle(); popIfNotEmpty(_UL); popIfNotEmpty(_Indent); } break; + case HTML_LI: + { + popStyle(); + } + break; case HTML_DL: if (!_DL.empty()) { @@ -2843,23 +2927,26 @@ namespace NLGUI // unclosed DT if (_DL.back().DT) { - popIfNotEmpty (_FontWeight); + popStyle(); } // unclosed DD if (_DL.back().DD) { popIfNotEmpty(_Indent); + popStyle(); } popIfNotEmpty (_DL); + popStyle(); } break; case HTML_DT: if (!_DL.empty()) { + if (_DL.back().DT) + popStyle(); _DL.back().DT = false; - popIfNotEmpty (_FontWeight); } break; case HTML_DD: @@ -2870,33 +2957,27 @@ namespace NLGUI { _DL.back().DD = false; popIfNotEmpty(_Indent); + popStyle(); } } break; case HTML_SPAN: - popIfNotEmpty (_FontFamily); - popIfNotEmpty (_FontSize); - popIfNotEmpty (_FontWeight); - popIfNotEmpty (_FontOblique); - popIfNotEmpty (_TextColor); - popIfNotEmpty (_FontUnderlined); - popIfNotEmpty (_FontStrikeThrough); - popIfNotEmpty (_GlobalColor); + popStyle(); break; case HTML_DEL: - popIfNotEmpty (_FontStrikeThrough); + popStyle(); break; case HTML_U: - popIfNotEmpty (_FontUnderlined); + popStyle(); break; case HTML_EM: - popIfNotEmpty (_FontOblique); + popStyle(); break; case HTML_STRONG: - popIfNotEmpty (_FontWeight); + popStyle(); break; case HTML_SMALL: - popIfNotEmpty (_FontSize); + popStyle(); break; case HTML_STYLE: case HTML_SCRIPT: @@ -4325,23 +4406,32 @@ namespace NLGUI // Text added ? bool added = false; - bool embolden = getFontWeight() >= FONT_WEIGHT_BOLD; + bool embolden = _Style.FontWeight >= FONT_WEIGHT_BOLD; // Number of child in this paragraph if (_CurrentViewLink) { bool skipLine = !_CurrentViewLink->getText().empty() && *(_CurrentViewLink->getText().rbegin()) == (ucchar) '\n'; + bool sameShadow = _Style.TextShadow.Enabled && _CurrentViewLink->getShadow(); + if (sameShadow && _Style.TextShadow.Enabled) + { + sint sx, sy; + _CurrentViewLink->getShadowOffset(sx, sy); + sameShadow = (_Style.TextShadow.Color == _CurrentViewLink->getShadowColor()); + sameShadow = sameShadow && (_Style.TextShadow.Outline == _CurrentViewLink->getShadowOutline()); + sameShadow = sameShadow && (_Style.TextShadow.X == sx) && (_Style.TextShadow.Y == sy); + } // Compatible with current parameters ? - if (!skipLine && - (getTextColor() == _CurrentViewLink->getColor()) && - (getFontFamily() == _CurrentViewLink->getFontName()) && - (getFontSize() == (uint)_CurrentViewLink->getFontSize()) && - (getFontUnderlined() == _CurrentViewLink->getUnderlined()) && - (getFontStrikeThrough() == _CurrentViewLink->getStrikeThrough()) && + if (!skipLine && sameShadow && + (_Style.TextColor == _CurrentViewLink->getColor()) && + (_Style.FontFamily == _CurrentViewLink->getFontName()) && + (_Style.FontSize == (uint)_CurrentViewLink->getFontSize()) && + (_Style.Underlined == _CurrentViewLink->getUnderlined()) && + (_Style.StrikeThrough == _CurrentViewLink->getStrikeThrough()) && (embolden == _CurrentViewLink->getEmbolden()) && - (getFontOblique() == _CurrentViewLink->getOblique()) && + (_Style.FontOblique == _CurrentViewLink->getOblique()) && (getLink() == _CurrentViewLink->Link) && - (getGlobalColor() == _CurrentViewLink->getModulateGlobalColor())) + (_Style.GlobalColor == _CurrentViewLink->getModulateGlobalColor())) { // Concat the text _CurrentViewLink->setText(_CurrentViewLink->getText()+tmpStr); @@ -4401,16 +4491,23 @@ namespace NLGUI } } newLink->setText(tmpStr); - newLink->setColor(getTextColor()); - newLink->setFontName(getFontFamily()); - newLink->setFontSize(getFontSize()); + newLink->setColor(_Style.TextColor); + newLink->setFontName(_Style.FontFamily); + newLink->setFontSize(_Style.FontSize); newLink->setEmbolden(embolden); - newLink->setOblique(getFontOblique()); - newLink->setUnderlined(getFontUnderlined()); - newLink->setStrikeThrough(getFontStrikeThrough()); - newLink->setMultiLineSpace((uint)((float)getFontSize()*LineSpaceFontFactor)); + newLink->setOblique(_Style.FontOblique); + newLink->setUnderlined(_Style.Underlined); + newLink->setStrikeThrough(_Style.StrikeThrough); + newLink->setMultiLineSpace((uint)((float)(_Style.FontSize)*LineSpaceFontFactor)); newLink->setMultiLine(true); - newLink->setModulateGlobalColor(getGlobalColor()); + newLink->setModulateGlobalColor(_Style.GlobalColor); + if (_Style.TextShadow.Enabled) + { + newLink->setShadow(true); + newLink->setShadowColor(_Style.TextShadow.Color); + newLink->setShadowOutline(_Style.TextShadow.Outline); + newLink->setShadowOffset(_Style.TextShadow.X, _Style.TextShadow.Y); + } // newLink->setLineAtBottom (true); registerAnchor(newLink); @@ -4517,22 +4614,32 @@ namespace NLGUI { // Not added ? std::vector > templateParams; - templateParams.push_back (std::pair ("w", toString (cols*getFontSize()))); + templateParams.push_back (std::pair ("w", toString (cols*_Style.FontSize))); templateParams.push_back (std::pair ("id", name)); templateParams.push_back (std::pair ("prompt", "")); templateParams.push_back (std::pair ("multiline", multiLine?"true":"false")); - templateParams.push_back (std::pair ("fontsize", toString (getFontSize()))); - templateParams.push_back (std::pair ("color", getTextColor().toString())); - if (getFontWeight() >= FONT_WEIGHT_BOLD) + templateParams.push_back (std::pair ("fontsize", toString (_Style.FontSize))); + templateParams.push_back (std::pair ("color", _Style.TextColor.toString())); + if (_Style.FontWeight >= FONT_WEIGHT_BOLD) templateParams.push_back (std::pair ("fontweight", "bold")); - if (getFontOblique()) + if (_Style.FontOblique) templateParams.push_back (std::pair ("fontstyle", "oblique")); if (multiLine) templateParams.push_back (std::pair ("multi_min_line", toString(rows))); templateParams.push_back (std::pair ("want_return", multiLine?"true":"false")); + templateParams.push_back (std::pair ("onenter", "")); templateParams.push_back (std::pair ("enter_recover_focus", "false")); if (maxlength > 0) templateParams.push_back (std::pair ("max_num_chars", toString(maxlength))); + templateParams.push_back (std::pair ("shadow", toString(_Style.TextShadow.Enabled))); + if (_Style.TextShadow.Enabled) + { + templateParams.push_back (std::pair ("shadow_x", toString(_Style.TextShadow.X))); + templateParams.push_back (std::pair ("shadow_y", toString(_Style.TextShadow.Y))); + templateParams.push_back (std::pair ("shadow_color", _Style.TextShadow.Color.toString())); + templateParams.push_back (std::pair ("shadow_outline", toString(_Style.TextShadow.Outline))); + } + CInterfaceGroup *textArea = CWidgetManager::getInstance()->getParser()->createGroupInstance (templateName.c_str(), getParagraph()->getId(), templateParams.empty()?NULL:&(templateParams[0]), (uint)templateParams.size()); @@ -4711,7 +4818,7 @@ namespace NLGUI if (overBitmap != normalBitmap) { over = localImageName(overBitmap); - addImageDownload(overBitmap, ctrlButton, style, TImageType::OverImage); + addImageDownload(overBitmap, ctrlButton, style, OverImage); } } @@ -4767,13 +4874,6 @@ namespace NLGUI { _Paragraph = NULL; _PRE.clear(); - _TextColor.clear(); - _GlobalColor.clear(); - _FontSize.clear(); - _FontWeight.clear(); - _FontOblique.clear(); - _FontUnderlined.clear(); - _FontStrikeThrough.clear(); _Indent.clear(); _LI = false; _UL.clear(); @@ -4797,6 +4897,11 @@ namespace NLGUI _IgnoreHeadTag = false; _IgnoreBaseUrlTag = false; + // reset style + _StyleDefault = CStyleParams(); + _Style = _StyleDefault; + _StyleParams.clear(); + // TR paragraphChange (); @@ -5343,14 +5448,8 @@ namespace NLGUI // https:// if (toLower(url.substr(0, 8)) == "https://") { -#if defined(NL_OS_WINDOWS) - curl_easy_setopt(curl, CURLOPT_SSL_CTX_FUNCTION, &CCurlCertificates::sslCtxFunction); -#else - if (!options.curlCABundle.empty()) - { - curl_easy_setopt(curl, CURLOPT_CAINFO, options.curlCABundle.c_str()); - } -#endif + // if supported, use custom SSL context function to load certificates + CCurlCertificates::useCertificates(curl); } // do not follow redirects, we have own handler @@ -5421,17 +5520,17 @@ namespace NLGUI _CurlWWW->sendHeaders(headers); // catch headers for redirect - curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curlHeaderCallback); + curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, NLGUI::curlHeaderCallback); curl_easy_setopt(curl, CURLOPT_WRITEHEADER, _CurlWWW); // catch body - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlDataCallback); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NLGUI::curlDataCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, _CurlWWW); #if LOG_DL // progress callback curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); - curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, curlProgressCallback); + curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, NLGUI::curlProgressCallback); curl_easy_setopt(curl, CURLOPT_XFERINFODATA, _CurlWWW); #else // progress off @@ -6118,6 +6217,14 @@ namespace NLGUI // style.StrikeThrough; // text-decoration: line-through; text-decoration-line: line-through; void CGroupHTML::getStyleParams(const std::string &styleString, CStyleParams &style, bool inherit) { + const CStyleParams current = _Style; + + if (inherit) + { + style.Underlined = current.Underlined; + style.StrikeThrough = current.StrikeThrough; + } + float tmpf; TStyle styles = parseStyle(styleString); TStyle::iterator it; @@ -6126,7 +6233,7 @@ namespace NLGUI if (it->first == "font-size") { if (it->second == "inherit") - style.FontSize = getFontSize(); + style.FontSize = current.FontSize; else { float tmp; @@ -6140,7 +6247,7 @@ namespace NLGUI if (it->first == "font-style") { if (it->second == "inherit") - style.FontOblique = getFontOblique(); + style.FontOblique = current.FontOblique; else if (it->second == "italic" || it->second == "oblique") style.FontOblique = true; @@ -6149,7 +6256,7 @@ namespace NLGUI if (it->first == "font-family") { if (it->second == "inherit") - style.FontFamily = getFontFamily(); + style.FontFamily = current.FontFamily; else if (it->second == "monospace") style.FontFamily = "monospace"; @@ -6162,7 +6269,7 @@ namespace NLGUI // https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight uint weight = 400; if (it->second == "inherit") - weight = getFontWeight(); + weight = current.FontWeight; else if (it->second == "normal") weight = 400; @@ -6173,7 +6280,7 @@ namespace NLGUI if (it->second == "lighter") { const uint lighter[] = {100, 100, 100, 100, 100, 400, 400, 700, 700}; - uint index = getFontWeight() / 100 - 1; + uint index = current.FontWeight / 100 - 1; clamp(index, 1u, 9u); weight = lighter[index-1]; } @@ -6181,7 +6288,7 @@ namespace NLGUI if (it->second == "bolder") { const uint bolder[] = {400, 400, 400, 700, 700, 900, 900, 900, 900}; - uint index = getFontWeight() / 100 + 1; + uint index = current.FontWeight / 100 + 1; clamp(index, 1u, 9u); weight = bolder[index-1]; } @@ -6197,7 +6304,7 @@ namespace NLGUI else if (it->first == "color") if (it->second == "inherit") - style.TextColor = getTextColor(); + style.TextColor = current.TextColor; else scanHTMLColor(it->second.c_str(), style.TextColor); else @@ -6208,6 +6315,115 @@ namespace NLGUI style.StrikeThrough = (prop.find("line-through") != std::string::npos); } else + if (it->first == "text-stroke" || it->first == "-webkit-text-stroke") + { + // text-stroke: length || color + bool success = false; + uint px = 0; + CRGBA color; + std::vector parts; + NLMISC::splitString(it->second, " ", parts); + if (parts.size() == 1) + { + success = scanCssLength(parts[0], px); + if (!success) + success = scanHTMLColor(parts[0].c_str(), color); + } + else if (parts.size() == 2) + { + success = scanCssLength(parts[0], px); + if (success) + success = scanHTMLColor(parts[1].c_str(), color); + else + { + success = scanHTMLColor(parts[0].c_str(), color); + success = success && scanCssLength(parts[1], px); + } + } + + // do not disable shadow if one is already set + if (success) + { + style.TextShadow.Enabled = (px > 0); + style.TextShadow.Color = color; + style.TextShadow.X = px; + style.TextShadow.Y = px; + style.TextShadow.Outline = true; + } + } + else + if (it->first == "text-shadow") + { + if (it->second == "none") + style.TextShadow = STextShadow(false); + else + if (it->second == "inherit") + style.TextShadow = current.TextShadow; + else + { + // text-shadow: offset-x offset-y | blur | #color + // text-shadow: #color | offset-x offset-y + bool success = true; + std::string prop(it->second); + size_t pos; + pos = prop.find_first_of(",\n\r"); + if (pos != std::string::npos) + prop = prop.substr(0, pos); + + std::vector parts; + NLMISC::splitString(prop, " ", parts); + switch(parts.size()) + { + case 1: + { + success = scanHTMLColor(it->second.c_str(), style.TextShadow.Color); + break; + } + // no case 2: + case 3: + { + if (!fromString(parts[0], style.TextShadow.X)) + { + success = scanHTMLColor(parts[0].c_str(), style.TextShadow.Color); + success = success && fromString(parts[1], style.TextShadow.X); + success = success && fromString(parts[2], style.TextShadow.Y); + } + else + { + success = fromString(parts[1], style.TextShadow.Y); + success = success && scanHTMLColor(parts[2].c_str(), style.TextShadow.Color); + } + break; + } + case 4: + { + if (!fromString(parts[0], style.TextShadow.X)) + { + success = scanHTMLColor(parts[0].c_str(), style.TextShadow.Color); + success = success && fromString(parts[1], style.TextShadow.X); + success = success && fromString(parts[2], style.TextShadow.Y); + // ignore blur [3] + } + else + { + success = fromString(parts[0], style.TextShadow.X); + success = success && fromString(parts[1], style.TextShadow.Y); + // ignore blur [2] + success = success && scanHTMLColor(parts[3].c_str(), style.TextShadow.Color); + } + break; + } + default: + { + // unsupported rule + break; + } + } + + style.TextShadow.Enabled = success; + } + } + else if (it->first == "width") getPercentage(style.Width, tmpf, it->second.c_str()); else @@ -6224,17 +6440,12 @@ namespace NLGUI { bool b; if (it->second == "inherit") - style.GlobalColor = getGlobalColor(); + style.GlobalColor = current.GlobalColor; else if (fromString(it->second, b)) style.GlobalColor = b; } } - if (inherit) - { - style.Underlined = getFontUnderlined() || style.Underlined; - style.StrikeThrough = getFontStrikeThrough() || style.StrikeThrough; - } } // *************************************************************************** @@ -6305,46 +6516,6 @@ namespace NLGUI } } - // *************************************************************************** - size_t CGroupHTML::curlHeaderCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData) - { - CCurlWWWData * me = static_cast(pCCurlWWWData); - if (me) - { - std::string header; - header.append(buffer, size * nmemb); - me->setRecvHeader(header.substr(0, header.find_first_of("\n\r"))); - } - - return size * nmemb; - } - - // *************************************************************************** - size_t CGroupHTML::curlDataCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData) - { - CCurlWWWData * me = static_cast(pCCurlWWWData); - if (me) - me->Content.append(buffer, size * nmemb); - - return size * nmemb; - } - - // *************************************************************************** - size_t CGroupHTML::curlProgressCallback(void *pCCurlWWWData, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) - { - CCurlWWWData * me = static_cast(pCCurlWWWData); - if (me) - { - if (dltotal > 0 || dlnow > 0 || ultotal > 0 || ulnow > 0) - { - nlwarning("> dltotal %d, dlnow %d, ultotal %d, ulnow %d, url '%s'", dltotal, dlnow, ultotal, ulnow, me->Url.c_str()); - } - } - - // return 1 to cancel download - return 0; - } - // *************************************************************************** std::string CGroupHTML::HTMLOListElement::getListMarkerText() const { diff --git a/code/nel/src/gui/group_paragraph.cpp b/code/nel/src/gui/group_paragraph.cpp index b2635b52e..d7d50af2e 100644 --- a/code/nel/src/gui/group_paragraph.cpp +++ b/code/nel/src/gui/group_paragraph.cpp @@ -1410,7 +1410,7 @@ namespace NLGUI // Get the child width maxWidth += _Elements[k].Element->getMaxUsedW(); } - return maxWidth; + return maxWidth + _MarginLeft; } // ---------------------------------------------------------------------------- @@ -1425,7 +1425,7 @@ namespace NLGUI if (width > minWidth) minWidth = width; } - return minWidth; + return minWidth + _MarginLeft; } diff --git a/code/nel/src/gui/group_table.cpp b/code/nel/src/gui/group_table.cpp index ef3eca57a..b10114a18 100644 --- a/code/nel/src/gui/group_table.cpp +++ b/code/nel/src/gui/group_table.cpp @@ -703,7 +703,7 @@ namespace NLGUI { if (ContinuousUpdate) { - sint parentWidth = std::min(_Parent->getMaxWReal(), _Parent->getWReal()); + sint parentWidth = _Parent->getInnerWidth(); if (_LastParentW != (sint) parentWidth) { _LastParentW = parentWidth; @@ -813,10 +813,6 @@ namespace NLGUI for(sint span = 0; span < cell->ColSpan -1; ++span) { ++column; - _Columns[column].Width = std::max(_Columns[column].Width, _Columns[column-1].Width); - _Columns[column].WidthMax = std::max(_Columns[column].WidthMax, _Columns[column-1].WidthMax); - _Columns[column].TableRatio = std::max(_Columns[column].TableRatio, _Columns[column-1].TableRatio); - _Columns[column].WidthWanted = std::max(_Columns[column].WidthWanted, _Columns[column-1].WidthWanted); _Columns[column].RowSpan = _Columns[column-1].RowSpan; } } @@ -1163,7 +1159,7 @@ namespace NLGUI { if (_Parent != NULL) { - sint parentWidth = std::min(_Parent->getMaxWReal(), _Parent->getWReal()); + sint parentWidth = _Parent->getInnerWidth(); if (_LastParentW != (sint) parentWidth) { if (ContinuousUpdate) @@ -1311,6 +1307,9 @@ namespace NLGUI // ---------------------------------------------------------------------------- void CGroupTable::draw () { + // move X for clip and borders + _XReal += _MarginLeft; + // search a parent container CInterfaceGroup *gr = getParent(); while (gr) @@ -1391,6 +1390,9 @@ namespace NLGUI } CInterfaceGroup::draw (); + + // restore + _XReal -= _MarginLeft; } std::string CGroupTable::getProperties( const std::string &name ) const diff --git a/code/nel/src/gui/http_hsts.cpp b/code/nel/src/gui/http_hsts.cpp index c69062538..c57bb738c 100644 --- a/code/nel/src/gui/http_hsts.cpp +++ b/code/nel/src/gui/http_hsts.cpp @@ -87,9 +87,12 @@ namespace NLGUI { if (domain.empty() || _Domains.empty()) return false; - if (_Domains.count(domain) > 0) + THSTSObjectMap::const_iterator itHsts; + + itHsts = _Domains.find(domain); + if (itHsts != _Domains.end()) { - hsts = _Domains.at(domain); + hsts = itHsts->second; return true; } @@ -99,11 +102,12 @@ namespace NLGUI { { std::string tmp; tmp = domain.substr(firstOf+1); - if (_Domains.count(tmp)) + itHsts = _Domains.find(tmp); + if (itHsts != _Domains.end()) { - if (_Domains.at(tmp).IncludeSubDomains) + if (itHsts->second.IncludeSubDomains) { - hsts = _Domains.at(tmp); + hsts = itHsts->second; return true; } @@ -182,7 +186,7 @@ namespace NLGUI { { uint32 nbItems = _Domains.size(); f.serial(nbItems); - for (THSTSObject::iterator it = _Domains.begin(); it != _Domains.end(); ++it) + for (THSTSObjectMap::iterator it = _Domains.begin(); it != _Domains.end(); ++it) { std::string domain(it->first); f.serial(domain); diff --git a/code/nel/src/gui/interface_element.cpp b/code/nel/src/gui/interface_element.cpp index 2e13d80e6..d3ed2d01c 100644 --- a/code/nel/src/gui/interface_element.cpp +++ b/code/nel/src/gui/interface_element.cpp @@ -506,10 +506,16 @@ namespace NLGUI } } + // ------------------------------------------------------------------------------------------------ + sint32 CInterfaceElement::getInnerWidth() const + { + return _WReal - _MarginLeft; + } + // ------------------------------------------------------------------------------------------------ void CInterfaceElement::updateCoords() { - _XReal = _X + _MarginLeft; + _XReal = _X; _YReal = _Y; _WReal = getW(); _HReal = getH(); @@ -526,7 +532,7 @@ namespace NLGUI if (el == NULL) return; - _XReal += el->_XReal - el->_MarginLeft; + _XReal += el->_XReal; _YReal += el->_YReal; THotSpot hsParent = _ParentPosRef; diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index d349411e1..5640da530 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -1397,6 +1397,13 @@ namespace NLGUI restoreClip (oldSciX, oldSciY, oldSciW, oldSciH); } + // ------------------------------------------------------------------------------------------------ + sint32 CInterfaceGroup::getInnerWidth() const + { + sint width = CInterfaceElement::getInnerWidth(); + return std::min(width, _MaxWReal - _MarginLeft); + } + // ------------------------------------------------------------------------------------------------ void CInterfaceGroup::checkCoords() { @@ -1468,7 +1475,7 @@ namespace NLGUI pIE->updateCoords(); } - _XReal -= _OffsetX - _MarginLeft; + _XReal -= (_OffsetX + _MarginLeft); _YReal -= _OffsetY; } @@ -1958,9 +1965,11 @@ namespace NLGUI newSciH = newSciH - ((newSciY+newSciH)-(oldSciY+oldSciH)); } - newSciXDest = newSciX - _MarginLeft; + // Don't apply margins because HTML list marker is drawn outside group paragraph inner content. + // Should not be an issue because horizontal scolling not used. + newSciXDest = newSciX/* + _MarginLeft*/; newSciYDest = newSciY; - newSciWDest = newSciW + _MarginLeft; + newSciWDest = newSciW/* - _MarginLeft*/; newSciHDest = newSciH; } diff --git a/code/nel/src/gui/libwww.cpp b/code/nel/src/gui/libwww.cpp index c8b41a38f..2e9b4451a 100644 --- a/code/nel/src/gui/libwww.cpp +++ b/code/nel/src/gui/libwww.cpp @@ -19,6 +19,8 @@ #include "nel/gui/libwww.h" #include "nel/gui/group_html.h" +#include + using namespace NLMISC; #ifdef DEBUG_NEW @@ -101,6 +103,7 @@ namespace NLGUI HTML_ATTR(TR,L_MARGIN), HTML_ATTR(TR,NOWRAP), HTML_ATTR(TR,VALIGN), + HTML_ATTR(TR,STYLE), { 0 } }; diff --git a/code/nel/src/gui/lua_ihm.cpp b/code/nel/src/gui/lua_ihm.cpp index 0b4a1d0dc..4a51d221f 100644 --- a/code/nel/src/gui/lua_ihm.cpp +++ b/code/nel/src/gui/lua_ihm.cpp @@ -1434,7 +1434,7 @@ namespace NLGUI } // *************************************************************************** - void CLuaIHM::luaValueToReflectedProperty(CLuaState &ls, int stackIndex, CReflectable &target, const CReflectedProperty &property) throw(ELuaIHMException) + void CLuaIHM::luaValueToReflectedProperty(CLuaState &ls, int stackIndex, CReflectable &target, const CReflectedProperty &property) { //H_AUTO(Lua_property_throw) if(ls.isNil(stackIndex)) diff --git a/code/nel/src/gui/lua_object.cpp b/code/nel/src/gui/lua_object.cpp index c957c3f2c..805e38ceb 100644 --- a/code/nel/src/gui/lua_object.cpp +++ b/code/nel/src/gui/lua_object.cpp @@ -222,7 +222,7 @@ namespace NLGUI } // ************************************************* - CLuaEnumeration CLuaObject::enumerate() throw(ELuaNotATable) + CLuaEnumeration CLuaObject::enumerate() { if (!isEnumerable()) { @@ -271,7 +271,7 @@ namespace NLGUI } // ************************************************* - CLuaObject CLuaObject::at(const char *key) const throw(ELuaNotATable) + CLuaObject CLuaObject::at(const char *key) const { if (!isEnumerable()) throw ELuaNotATable(NLMISC::toString("Can't get key '%s' in object '%s' because type is '%s', it is not a table.", key, getId().c_str(), getTypename()).c_str()); return operator[](key); @@ -286,7 +286,7 @@ namespace NLGUI } // ************************************************* - CLuaObject CLuaObject::newTable(const char *tableName) throw(ELuaNotATable) + CLuaObject CLuaObject::newTable(const char *tableName) { nlassert(tableName); nlassert(isValid()); @@ -301,7 +301,7 @@ namespace NLGUI } // ************************************************* - void CLuaObject::setValue(const char *key, const CLuaObject &value) throw(ELuaNotATable) + void CLuaObject::setValue(const char *key, const CLuaObject &value) { nlassert(key); nlassert(isValid()); @@ -317,7 +317,7 @@ namespace NLGUI } // ************************************************* - void CLuaObject::setNil(const char *key) throw(ELuaNotATable) + void CLuaObject::setNil(const char *key) { nlassert(key); nlassert(isValid()); @@ -331,7 +331,7 @@ namespace NLGUI } // ************************************************* - void CLuaObject::setValue(const char *key, const char *value) throw(ELuaNotATable) + void CLuaObject::setValue(const char *key, const char *value) { nlassert(value); nlassert(key); @@ -346,13 +346,13 @@ namespace NLGUI } // ************************************************* - void CLuaObject::setValue(const char *key, const std::string &value) throw(ELuaNotATable) + void CLuaObject::setValue(const char *key, const std::string &value) { setValue(key, value.c_str()); } // ************************************************* - void CLuaObject::setValue(const char *key, bool value) throw(ELuaNotATable) + void CLuaObject::setValue(const char *key, bool value) { nlassert(key); nlassert(isValid()); @@ -366,7 +366,7 @@ namespace NLGUI } // ************************************************* - void CLuaObject::setValue(const char *key, TLuaWrappedFunction value) throw(ELuaNotATable) + void CLuaObject::setValue(const char *key, TLuaWrappedFunction value) { nlassert(key); nlassert(isValid()); @@ -380,7 +380,7 @@ namespace NLGUI } // ************************************************* - void CLuaObject::setValue(const char *key, double value) throw(ELuaNotATable) + void CLuaObject::setValue(const char *key, double value) { nlassert(key); nlassert(isValid()); @@ -394,7 +394,7 @@ namespace NLGUI } // ************************************************* - void CLuaObject::setValue(const char *key, uint32 value) throw(ELuaNotATable) + void CLuaObject::setValue(const char *key, uint32 value) { nlassert(key); nlassert(isValid()); @@ -408,7 +408,7 @@ namespace NLGUI } // ************************************************* - void CLuaObject::setValue(const char *key, sint32 value) throw(ELuaNotATable) + void CLuaObject::setValue(const char *key, sint32 value) { nlassert(key); nlassert(isValid()); @@ -422,7 +422,7 @@ namespace NLGUI } // ************************************************* - void CLuaObject::setValue(const char *key, sint64 value) throw(ELuaNotATable) + void CLuaObject::setValue(const char *key, sint64 value) { nlassert(key); nlassert(isValid()); @@ -436,7 +436,7 @@ namespace NLGUI } // ************************************************* - void CLuaObject::eraseValue(const char *key) throw(ELuaNotATable) + void CLuaObject::eraseValue(const char *key) { nlassert(isValid()); nlassert(key); diff --git a/code/nel/src/gui/view_text.cpp b/code/nel/src/gui/view_text.cpp index 1a175e224..63263b6d6 100644 --- a/code/nel/src/gui/view_text.cpp +++ b/code/nel/src/gui/view_text.cpp @@ -72,6 +72,8 @@ namespace NLGUI _Shadow = false; _ShadowOutline = false; _ShadowColor = CRGBA(0,0,0,255); + _ShadowX = 1; + _ShadowY = 1; _MultiLine = false; _TextMode = DontClipWord; @@ -444,6 +446,22 @@ namespace NLGUI return true; } else + if( name == "shadow_x" ) + { + sint sx; + if( fromString( value, sx ) ) + _ShadowX = sx; + return true; + } + else + if( name == "shadow_y" ) + { + sint sy; + if( fromString( value, sy ) ) + _ShadowY = sy; + return true; + } + else if( name == "multi_line" ) { bool b; @@ -624,6 +642,8 @@ namespace NLGUI xmlSetProp( node, BAD_CAST "shadow", BAD_CAST toString( _Shadow ).c_str() ); xmlSetProp( node, BAD_CAST "shadow_outline", BAD_CAST toString( _ShadowOutline ).c_str() ); xmlSetProp( node, BAD_CAST "shadow_color", BAD_CAST toString( _ShadowColor ).c_str() ); + xmlSetProp( node, BAD_CAST "shadow_x", BAD_CAST toString( _ShadowX ).c_str() ); + xmlSetProp( node, BAD_CAST "shadow_y", BAD_CAST toString( _ShadowY ).c_str() ); xmlSetProp( node, BAD_CAST "multi_line", BAD_CAST toString( _MultiLine ).c_str() ); std::string just; @@ -735,6 +755,16 @@ namespace NLGUI if (prop) _ShadowColor = convertColor(prop); + prop= (char*) xmlGetProp( cur, (xmlChar*)"shadow_x" ); + _ShadowX = 1; + if (prop) + fromString( (const char *)prop, _ShadowX); + + prop= (char*) xmlGetProp( cur, (xmlChar*)"shadow_y" ); + _ShadowY = 1; + if (prop) + fromString( (const char *)prop, _ShadowY); + prop = (char*) xmlGetProp( cur, (xmlChar*)"multi_line" ); _MultiLine = false; if (prop) @@ -895,8 +925,7 @@ namespace NLGUI return maxw; else { - sint parentWidth = std::min(_Parent->getMaxWReal(), _Parent->getWReal() - _Parent->getMarginLeft()); - return std::min(parentWidth-(sint)(_XReal-(_Parent->getXReal()-_Parent->getMarginLeft())), (sint)_LineMaxW); + return std::min(_Parent->getInnerWidth(), (sint)_LineMaxW); } } @@ -989,6 +1018,19 @@ namespace NLGUI ((_YReal) > (ClipY+ClipH)) || ((_YReal+_HReal) < ClipY)) return; + // hack: allow shadow to overflow outside parent box. + // In CGroupHTML context, clip is set for row + if (std::abs(_ShadowX) > 0) + { + ClipX -= 3; + ClipW += 3; + } + if (std::abs(_ShadowY) > 0) + { + ClipY -= 3; + ClipH += 3; + } + // *** Screen Minimized? if (rVR.isMinimized()) return; @@ -1012,6 +1054,8 @@ namespace NLGUI shcol.A = (uint8)(((sint)shcol.A*((sint)CWidgetManager::getInstance()->getGlobalColorForContent().A+1))>>8); } + float oow, ooh; + rVR.getScreenOOSize (oow, ooh); // *** Draw multiline if ((_MultiLine)&&(_Parent != NULL)) @@ -1022,6 +1066,7 @@ namespace NLGUI TextContext->setShaded (_Shadow); TextContext->setShadeOutline (_ShadowOutline); TextContext->setShadeColor (shcol); + TextContext->setShadeExtent (_ShadowX*oow, _ShadowY*ooh); TextContext->setFontSize (_FontSize*_Scale); TextContext->setEmbolden (_Embolden); TextContext->setOblique (_Oblique); @@ -1142,6 +1187,7 @@ namespace NLGUI TextContext->setShaded (_Shadow); TextContext->setShadeOutline (_ShadowOutline); TextContext->setShadeColor (shcol); + TextContext->setShadeExtent (_ShadowX*oow, _ShadowY*ooh); TextContext->setFontSize (_FontSize*_Scale); TextContext->setEmbolden (_Embolden); TextContext->setOblique (_Oblique); @@ -1355,6 +1401,13 @@ namespace NLGUI _ShadowColor = color; } + // *************************************************************************** + void CViewText::setShadowOffset(sint32 x, sint32 y) + { + _ShadowX = x; + _ShadowY = y; + } + // *************************************************************************** void CViewText::setLineMaxW (sint nMaxW, bool invalidate) { diff --git a/code/nel/src/misc/class_registry.cpp b/code/nel/src/misc/class_registry.cpp index 91c603c90..c703e45d0 100644 --- a/code/nel/src/misc/class_registry.cpp +++ b/code/nel/src/misc/class_registry.cpp @@ -49,7 +49,7 @@ void CClassRegistry::release() } // ====================================================================================================== -IClassable *CClassRegistry::create(const string &className) throw(ERegistry) +IClassable *CClassRegistry::create(const string &className) { init(); @@ -72,7 +72,7 @@ IClassable *CClassRegistry::create(const string &className) throw(ERegistry) } // ====================================================================================================== -void CClassRegistry::registerClass(const string &className, IClassable* (*creator)(), const string &typeidCheck) throw(ERegistry) +void CClassRegistry::registerClass(const string &className, IClassable* (*creator)(), const string &typeidCheck) { init(); diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index db605f4f1..599f3cfb2 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -80,7 +80,7 @@ extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); } #endif // !NL_COMP_MINGW -#if defined(NL_HAS_SSE2) && !defined(NL_CPU_X86_64) +#ifdef NL_USE_ALIGNED_MEMORY_OPERATORS #ifdef NL_NO_EXCEPTION_SPECS void *operator new(size_t size) diff --git a/code/nel/src/misc/file.cpp b/code/nel/src/misc/file.cpp index 727c02f83..414a10e5a 100644 --- a/code/nel/src/misc/file.cpp +++ b/code/nel/src/misc/file.cpp @@ -401,7 +401,7 @@ bool CIFile::eof () } // ====================================================================================================== -void CIFile::serialBuffer(uint8 *buf, uint len) throw(EReadError) +void CIFile::serialBuffer(uint8 *buf, uint len) { if (len == 0) return; @@ -444,7 +444,7 @@ void CIFile::serialBuffer(uint8 *buf, uint len) throw(EReadError) } // ====================================================================================================== -void CIFile::serialBit(bool &bit) throw(EReadError) +void CIFile::serialBit(bool &bit) { // Simple for now. uint8 v=bit; @@ -453,7 +453,7 @@ void CIFile::serialBit(bool &bit) throw(EReadError) } // ====================================================================================================== -bool CIFile::seek (sint32 offset, IStream::TSeekOrigin origin) const throw(EStream) +bool CIFile::seek (sint32 offset, IStream::TSeekOrigin origin) const { if ((_CacheFileOnOpen) && (_Cache == NULL)) return false; @@ -485,7 +485,7 @@ bool CIFile::seek (sint32 offset, IStream::TSeekOrigin origin) const throw(EStr } // ====================================================================================================== -sint32 CIFile::getPos () const throw(EStream) +sint32 CIFile::getPos () const { return _ReadPos; } @@ -652,7 +652,7 @@ void COFile::flush() // ====================================================================================================== -void COFile::serialBuffer(uint8 *buf, uint len) throw(EWriteError) +void COFile::serialBuffer(uint8 *buf, uint len) { if(!_F) throw EFileNotOpened(_FileName); @@ -667,14 +667,14 @@ void COFile::serialBuffer(uint8 *buf, uint len) throw(EWriteError) } } // ====================================================================================================== -void COFile::serialBit(bool &bit) throw(EWriteError) +void COFile::serialBit(bool &bit) { // Simple for now. uint8 v=bit; serialBuffer(&v, 1); } // ====================================================================================================== -bool COFile::seek (sint32 offset, IStream::TSeekOrigin origin) const throw(EStream) +bool COFile::seek (sint32 offset, IStream::TSeekOrigin origin) const { if (_F) { @@ -701,7 +701,7 @@ bool COFile::seek (sint32 offset, IStream::TSeekOrigin origin) const throw(EStr return false; } // ====================================================================================================== -sint32 COFile::getPos () const throw(EStream) +sint32 COFile::getPos () const { if (_F) { diff --git a/code/nel/src/misc/mem_stream.cpp b/code/nel/src/misc/mem_stream.cpp index 49e19f523..dd81334d1 100644 --- a/code/nel/src/misc/mem_stream.cpp +++ b/code/nel/src/misc/mem_stream.cpp @@ -107,7 +107,7 @@ void CMemStream::serialBit(bool &bit) * (to prevent from an "inside serial" to increment it). * Then a seek(end) would get back to the pointer. */ -bool CMemStream::seek (sint32 offset, TSeekOrigin origin) const throw(EStream) +bool CMemStream::seek (sint32 offset, TSeekOrigin origin) const { switch (origin) { diff --git a/code/nel/src/misc/string_mapper.cpp b/code/nel/src/misc/string_mapper.cpp index 6e59f7bab..39931efd2 100644 --- a/code/nel/src/misc/string_mapper.cpp +++ b/code/nel/src/misc/string_mapper.cpp @@ -211,7 +211,7 @@ void CStaticStringMapper::clear() } // **************************************************************************** -void CStaticStringMapper::serial(IStream &f, TSStringId &strId) throw(EStream) +void CStaticStringMapper::serial(IStream &f, TSStringId &strId) { std::string tmp; if (f.isReading()) @@ -227,7 +227,7 @@ void CStaticStringMapper::serial(IStream &f, TSStringId &strId) throw(EStream) } // **************************************************************************** -void CStaticStringMapper::serial(IStream &f, std::vector &strIdVect) throw(EStream) +void CStaticStringMapper::serial(IStream &f, std::vector &strIdVect) { std::vector vsTmp; std::string sTmp; diff --git a/code/nel/src/misc/system_info.cpp b/code/nel/src/misc/system_info.cpp index 2afa8da09..75d9707b3 100644 --- a/code/nel/src/misc/system_info.cpp +++ b/code/nel/src/misc/system_info.cpp @@ -1470,9 +1470,9 @@ uint64 CSystemInfo::availableHDSpace (const string &filename) uint64 CSystemInfo::availablePhysicalMemory () { #ifdef NL_OS_WINDOWS - MEMORYSTATUS ms; - GlobalMemoryStatus (&ms); - return uint64(ms.dwAvailPhys); + MEMORYSTATUSEX ms; + GlobalMemoryStatusEx(&ms); + return ms.ullAvailPhys; #elif defined NL_OS_MAC return uint64(getsysctlnum64("hw.usermem")); #elif defined NL_OS_UNIX @@ -1485,9 +1485,9 @@ uint64 CSystemInfo::availablePhysicalMemory () uint64 CSystemInfo::totalPhysicalMemory () { #ifdef NL_OS_WINDOWS - MEMORYSTATUS ms; - GlobalMemoryStatus (&ms); - return uint64(ms.dwTotalPhys); + MEMORYSTATUSEX ms; + GlobalMemoryStatusEx(&ms); + return ms.ullTotalPhys; #elif defined NL_OS_MAC return uint64(getsysctlnum64("hw.physmem")); #elif defined NL_OS_UNIX @@ -1867,9 +1867,9 @@ bool CSystemInfo::getVideoInfo (std::string &deviceName, uint64 &driverVersion) uint64 CSystemInfo::virtualMemory () { #ifdef NL_OS_WINDOWS - MEMORYSTATUS ms; - GlobalMemoryStatus (&ms); - return uint64(ms.dwTotalVirtual - ms.dwAvailVirtual); + MEMORYSTATUSEX ms; + GlobalMemoryStatusEx(&ms); + return ms.ullTotalVirtual - ms.ullAvailVirtual; #else return 0; #endif diff --git a/code/nel/src/net/module.cpp b/code/nel/src/net/module.cpp index 1b5e03bec..23f618973 100644 --- a/code/nel/src/net/module.cpp +++ b/code/nel/src/net/module.cpp @@ -397,7 +397,7 @@ namespace NLNET } - void CModuleBase::plugModule(IModuleSocket *moduleSocket) throw (EModuleAlreadyPluggedHere) + void CModuleBase::plugModule(IModuleSocket *moduleSocket) { CModuleSocket *sock = dynamic_cast(moduleSocket); nlassert(sock != NULL); @@ -415,7 +415,7 @@ namespace NLNET _ModuleSockets.insert(moduleSocket); } - void CModuleBase::unplugModule(IModuleSocket *moduleSocket) throw (EModuleNotPluggedHere) + void CModuleBase::unplugModule(IModuleSocket *moduleSocket) { CModuleSocket *sock = dynamic_cast(moduleSocket); nlassert(sock != NULL); @@ -443,7 +443,7 @@ namespace NLNET * The call is blocking until receptions of the operation * result message (or a module down) */ - void CModuleBase::invokeModuleOperation(IModuleProxy *destModule, const NLNET::CMessage &opMsg, NLNET::CMessage &resultMsg) throw (EInvokeFailed) + void CModuleBase::invokeModuleOperation(IModuleProxy *destModule, const NLNET::CMessage &opMsg, NLNET::CMessage &resultMsg) { H_AUTO(CModuleBase_invokeModuleOperation); @@ -867,7 +867,6 @@ namespace NLNET } void CModuleProxy::sendModuleMessage(IModule *senderModule, const NLNET::CMessage &message) - throw (EModuleNotReachable) { H_AUTO(CModuleProxy_sendModuleMessage); diff --git a/code/nel/src/net/module_gateway.cpp b/code/nel/src/net/module_gateway.cpp index 81ba76859..d4d07ea61 100644 --- a/code/nel/src/net/module_gateway.cpp +++ b/code/nel/src/net/module_gateway.cpp @@ -448,7 +448,6 @@ namespace NLNET /// Activate/stop firewalling mode on a transport virtual void setTransportFirewallMode(const std::string &transportInstanceName, bool firewalled) - throw (EGatewayFirewallBreak) { TTransportList::iterator it(_Transports.find(transportInstanceName)); if (it == _Transports.end()) @@ -1246,7 +1245,6 @@ namespace NLNET } virtual void discloseModule(IModuleProxy *moduleProxy) - throw (EGatewayNotConnected) { nlassert(moduleProxy->getModuleGateway() == this); @@ -1560,8 +1558,7 @@ namespace NLNET return getModuleName(); } - void _sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message ) - throw (EModuleNotReachable, EModuleNotPluggedHere) + void _sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message) { // the socket implementation already checked that the module is plugged here // just check that the destination module effectively from here @@ -1585,7 +1582,6 @@ namespace NLNET } virtual void _broadcastModuleMessage(IModule *senderModule, const NLNET::CMessage &message) - throw (EModuleNotPluggedHere) { H_AUTO(CModuleGetaway__broadcastModuleMessage); // send the message to all proxies (except the sender module) diff --git a/code/nel/src/net/module_gateway_transport.cpp b/code/nel/src/net/module_gateway_transport.cpp index d9029285f..08ff51eeb 100644 --- a/code/nel/src/net/module_gateway_transport.cpp +++ b/code/nel/src/net/module_gateway_transport.cpp @@ -184,13 +184,13 @@ namespace NLNET } } - void onCommand(const CMessage &/* command */) throw (EInvalidCommand) + void onCommand(const CMessage &/* command */) { // nothing done for now throw EInvalidCommand(); } /// The gateway send a textual command to the transport - bool onCommand(const TParsedCommandLine &command) throw (EInvalidCommand) + bool onCommand(const TParsedCommandLine &command) { if (command.SubParams.size() < 1) throw EInvalidCommand(); @@ -218,7 +218,7 @@ namespace NLNET } /// Open the server by starting listing for incoming connection on the specified port - void openServer(uint16 port) throw (ETransportError) + void openServer(uint16 port) { if (_CallbackServer.get() != NULL) throw ETransportError("openServer : The server is already open"); @@ -607,13 +607,13 @@ namespace NLNET } } - void onCommand(const CMessage &/* command */) throw (EInvalidCommand) + void onCommand(const CMessage &/* command */) { // nothing done for now throw EInvalidCommand(); } /// The gateway send a textual command to the transport - bool onCommand(const TParsedCommandLine &command) throw (EInvalidCommand) + bool onCommand(const TParsedCommandLine &command) { if (command.SubParams.size() < 1) throw EInvalidCommand(); diff --git a/code/nel/src/net/module_l5_transport.cpp b/code/nel/src/net/module_l5_transport.cpp index 5eddabc9f..e902263c7 100644 --- a/code/nel/src/net/module_l5_transport.cpp +++ b/code/nel/src/net/module_l5_transport.cpp @@ -218,13 +218,13 @@ namespace NLNET } } - void onCommand(const CMessage &/* command */) throw (EInvalidCommand) + void onCommand(const CMessage &/* command */) { // nothing done for now throw EInvalidCommand(); } /// The gateway send a textual command to the transport - bool onCommand(const TParsedCommandLine &command) throw (EInvalidCommand) + bool onCommand(const TParsedCommandLine &command) { if (command.SubParams.size() < 1) throw EInvalidCommand(); @@ -255,7 +255,7 @@ namespace NLNET /// Open the server by establishing route with all known services - void open(const std::string &subNetName) throw (ETransportError) + void open(const std::string &subNetName) { H_AUTO(L5_open); diff --git a/code/nel/src/net/module_local_gateway.cpp b/code/nel/src/net/module_local_gateway.cpp index 3446c0663..0782c2d2c 100644 --- a/code/nel/src/net/module_local_gateway.cpp +++ b/code/nel/src/net/module_local_gateway.cpp @@ -102,7 +102,6 @@ namespace NLNET /// Activate/stop firewalling mode on a transport virtual void setTransportFirewallMode(const std::string &/* transportInstanceName */, bool /* firewalled */) - throw (EGatewayFirewallBreak) { // unsupported nlstop; @@ -174,12 +173,10 @@ namespace NLNET // return; // } // virtual void openGatewayServer(uint16 listeningPort) -// throw (EGatewayAlreadyOpen, EGatewayPortInUse) // { // nlstop; // } // virtual void closeGatewayServer() -// throw (EGatewayNotOpen) // { // nlstop; // } @@ -233,7 +230,6 @@ namespace NLNET { } virtual void discloseModule(IModuleProxy *moduleProxy) - throw (EGatewayNotConnected) { // check that the module is plugged here nlassert(_ModuleProxies.getB(moduleProxy) != NULL); @@ -364,8 +360,7 @@ namespace NLNET return getModuleName(); } - void _sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message ) - throw (EModuleNotReachable, EModuleNotPluggedHere) + void _sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message) { TModuleProxies::TAToBMap::const_iterator first(_ModuleProxies.getAToBMap().begin()), last(_ModuleProxies.getAToBMap().end()); for (; first != last && first->first->getModuleProxyId() != destModuleProxyId; ++first) {} @@ -373,7 +368,6 @@ namespace NLNET throw EModuleNotReachable(); } virtual void _broadcastModuleMessage(IModule * /* senderModule */, const NLNET::CMessage &/* message */) - throw (EModuleNotPluggedHere) { nlstop; } diff --git a/code/nel/src/net/module_socket.cpp b/code/nel/src/net/module_socket.cpp index 068567761..6ea16e8d6 100644 --- a/code/nel/src/net/module_socket.cpp +++ b/code/nel/src/net/module_socket.cpp @@ -85,8 +85,7 @@ namespace NLNET _PluggedModules.removeWithB(pluggedModule); } - void CModuleSocket::sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message ) - throw (EModuleNotPluggedHere) + void CModuleSocket::sendModuleMessage(IModule *senderModule, TModuleId destModuleProxyId, const NLNET::CMessage &message) { TPluggedModules::TBToAMap::const_iterator it(_PluggedModules.getBToAMap().find(senderModule)); if (it == _PluggedModules.getBToAMap().end()) @@ -100,7 +99,6 @@ namespace NLNET } void CModuleSocket::broadcastModuleMessage(IModule *senderModule, const NLNET::CMessage &message) - throw (EModuleNotPluggedHere) { TPluggedModules::TBToAMap::const_iterator it(_PluggedModules.getBToAMap().find(senderModule)); if (it == _PluggedModules.getBToAMap().end()) diff --git a/code/nel/tools/3d/object_viewer/particle_workspace.cpp b/code/nel/tools/3d/object_viewer/particle_workspace.cpp index 43be30812..1a289d2b0 100644 --- a/code/nel/tools/3d/object_viewer/particle_workspace.cpp +++ b/code/nel/tools/3d/object_viewer/particle_workspace.cpp @@ -357,7 +357,7 @@ void CParticleWorkspace::setName(const std::string &name) //*********************************************************************************************** -CParticleWorkspace::CNode *CParticleWorkspace::addNode(const std::string &filenameWithFullPath) throw( NLMISC::EStream) +CParticleWorkspace::CNode *CParticleWorkspace::addNode(const std::string &filenameWithFullPath) { nlassert(_OV); // Check that file is not already inserted diff --git a/code/nel/tools/3d/object_viewer/particle_workspace.h b/code/nel/tools/3d/object_viewer/particle_workspace.h index 694aab986..3508746d5 100644 --- a/code/nel/tools/3d/object_viewer/particle_workspace.h +++ b/code/nel/tools/3d/object_viewer/particle_workspace.h @@ -186,7 +186,7 @@ public: * * \return pointer to new node, or NULL if already inserted */ - CNode *addNode(const std::string &filenameWithFullPath) throw( NLMISC::Exception); + CNode *addNode(const std::string &filenameWithFullPath); // remove a node by its index void removeNode(uint index); // remove a node by its pointer diff --git a/code/nel/tools/pacs/build_rbank/build_surf.cpp b/code/nel/tools/pacs/build_rbank/build_surf.cpp index 7e873f15f..465f5f94f 100644 --- a/code/nel/tools/pacs/build_rbank/build_surf.cpp +++ b/code/nel/tools/pacs/build_rbank/build_surf.cpp @@ -671,7 +671,7 @@ bool NLPACS::CComputableSurface::checkConsistency() CComputableSurfaceBorder& border = (*BorderKeeper)[BorderIds[i]]; for (j=0; j+1(border.Vertices[j], border.Vertices[j+1])); + edges.push_back(std::make_pair(border.Vertices[j], border.Vertices[j+1])); } for (i=0; i+1 - + @@ -114,6 +119,11 @@ fontsize="10" fontweight="" fontstyle="" + shadow="true" + shadow_x="1" + shadow_y="1" + shadow_color="0 0 0 255" + shadow_outline="false" backup_father_container_pos="false" want_return="false" color="255 255 255 255" @@ -124,7 +134,7 @@ - + @@ -153,6 +163,11 @@ keep="true" max_historic="40" fontsize="10" + shadow="true" + shadow_x="1" + shadow_y="1" + shadow_color="0 0 0 255" + shadow_outline="false" backup_father_container_pos="false" want_return="false" color="255 255 255 255" @@ -162,7 +177,7 @@ - + @@ -397,6 +412,11 @@ keep="true" max_historic="40" fontsize="10" + shadow="true" + shadow_x="1" + shadow_y="1" + shadow_color="0 0 0 255" + shadow_outline="false" backup_father_container_pos="false" want_return="false" color="255 255 255 255" @@ -407,7 +427,7 @@ - + @@ -435,6 +455,11 @@ keep="true" max_historic="40" fontsize="10" + shadow="true" + shadow_x="1" + shadow_y="1" + shadow_color="0 0 0 255" + shadow_outline="false" backup_father_container_pos="false" want_return="false" color="255 255 255 255" @@ -444,7 +469,7 @@ - + diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml b/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml index e5ece5680..62c202815 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml @@ -2653,6 +2653,11 @@ keep="true" max_historic="40" fontsize="10" + shadow="true" + shadow_x="1" + shadow_y="1" + shadow_color="0 0 0 255" + shadow_outline="false" backup_father_container_pos="false" want_return="false" clear_on_escape="false" @@ -2722,7 +2727,11 @@ multi_line_space="0" fontsize="#fontsize" color="#color" - shadow="true" + shadow="#shadow" + shadow_x="#shadow_x" + shadow_y="#shadow_y" + shadow_color="#shadow_color" + shadow_outline="#shadow_outline" hardtext="" global_color="false" /> @@ -2826,6 +2835,11 @@ keep="true" max_historic="40" fontsize="10" + shadow="true" + shadow_x="1" + shadow_y="1" + shadow_color="0 0 0 255" + shadow_outline="false" backup_father_container_pos="false" want_return="false" color="255 255 255 255" @@ -2886,7 +2900,11 @@ multi_min_line="#multi_min_line" fontsize="#fontsize" color="#color" - shadow="true" + shadow="#shadow" + shadow_x="#shadow_x" + shadow_y="#shadow_y" + shadow_color="#shadow_color" + shadow_outline="#shadow_outline" hardtext="" global_color="false" render_layer="#render_layer" /> diff --git a/code/ryzom/client/src/camera_recorder.cpp b/code/ryzom/client/src/camera_recorder.cpp index 12cd4ff01..8f427c321 100644 --- a/code/ryzom/client/src/camera_recorder.cpp +++ b/code/ryzom/client/src/camera_recorder.cpp @@ -56,7 +56,7 @@ public: CVector Heading; //CVMatrix Matrix; public: - void serial(NLMISC::IStream &f) throw(EStream) + void serial(NLMISC::IStream &f) { f.serial(Date); f.serial(Pos); diff --git a/code/ryzom/client/src/gateway_fec_transport.cpp b/code/ryzom/client/src/gateway_fec_transport.cpp index 26104216e..fa15c465b 100644 --- a/code/ryzom/client/src/gateway_fec_transport.cpp +++ b/code/ryzom/client/src/gateway_fec_transport.cpp @@ -216,13 +216,13 @@ public: } } - void onCommand(const CMessage &/* command */) throw (IGatewayTransport::EInvalidCommand) + void onCommand(const CMessage &/* command */) { // nothing done for now throw EInvalidCommand(); } /// The gateway send a textual command to the transport - bool onCommand(const TParsedCommandLine &command) throw (IGatewayTransport::EInvalidCommand) + bool onCommand(const TParsedCommandLine &command) { if (command.SubParams.size() < 1) throw EInvalidCommand(); @@ -256,7 +256,7 @@ public: } /// Open the connection by intercepting client gateway message - void open() throw (ETransportError) + void open() { if (_Open) { diff --git a/code/ryzom/client/src/http_client_curl.cpp b/code/ryzom/client/src/http_client_curl.cpp index 2fd5bad81..16436516b 100644 --- a/code/ryzom/client/src/http_client_curl.cpp +++ b/code/ryzom/client/src/http_client_curl.cpp @@ -19,8 +19,7 @@ #include -#include -#include +#include "nel/gui/curl_certificates.h" using namespace NLMISC; using namespace NLNET; @@ -64,135 +63,20 @@ bool CCurlHttpClient::authenticate(const std::string &user, const std::string &p return true; } -const char *CAFilename = "ssl_ca_cert.pem"; // this is the certificate "Thawte Server CA" - -// *************************************************************************** -static CURLcode sslctx_function(CURL * /* curl */, void *sslctx, void * /* parm */) -{ - // look for certificate in search paths - string path = CPath::lookup(CAFilename); - nlinfo("Cert path '%s'", path.c_str()); - - if (path.empty()) - { - nlwarning("Unable to find %s", CAFilename); - return CURLE_SSL_CACERT; - } - - CIFile file; - - // open certificate - if (!file.open(path)) - { - nlwarning("Unable to open %s", path.c_str()); - return CURLE_SSL_CACERT; - } - - CURLcode res = CURLE_OK; - - // load certificate content into memory - std::vector buffer(file.getFileSize()); - file.serialBuffer(&buffer[0], file.getFileSize()); - - // get a BIO - BIO *bio = BIO_new_mem_buf(&buffer[0], file.getFileSize()); - - char errorBuffer[1024]; - - if (bio) - { - // get a pointer to the X509 certificate store (which may be empty!) - X509_STORE *store = SSL_CTX_get_cert_store((SSL_CTX *)sslctx); - - // use it to read the PEM formatted certificate from memory into an X509 - // structure that SSL can use - STACK_OF(X509_INFO) *info = PEM_X509_INFO_read_bio(bio, NULL, NULL, NULL); - - if (info) - { - // iterate over all entries from the PEM file, add them to the x509_store one by one - for (sint i = 0; i < sk_X509_INFO_num(info); ++i) - { - X509_INFO *itmp = sk_X509_INFO_value(info, i); - - if (itmp && itmp->x509) - { - X509_NAME *subject = X509_get_subject_name(itmp->x509); - - std::string name; - unsigned char *tmp = NULL; - - // construct a multiline string with name - for (int i = 0, ilen = X509_NAME_entry_count(subject); i < ilen; ++i) - { - X509_NAME_ENTRY *e = X509_NAME_get_entry(subject, i); - ASN1_STRING *d = X509_NAME_ENTRY_get_data(e); - - if (ASN1_STRING_to_UTF8(&tmp, d) > 0) - { - name += NLMISC::toString("%s\n", tmp); - - OPENSSL_free(tmp); - } - } - - // add our certificate to this store - if (X509_STORE_add_cert(store, itmp->x509) == 0) - { - uint errCode = ERR_get_error(); - - // ignore already in hash table errors - if (ERR_GET_LIB(errCode) != ERR_LIB_X509 || ERR_GET_REASON(errCode) != X509_R_CERT_ALREADY_IN_HASH_TABLE) - { - ERR_error_string_n(errCode, errorBuffer, 1024); - nlwarning("Error adding certificate %s: %s", name.c_str(), errorBuffer); - res = CURLE_SSL_CACERT; - } - } - else - { - nlinfo("Added certificate %s", name.c_str()); - } - } - } - - // cleanup - sk_X509_INFO_pop_free(info, X509_INFO_free); - } - else - { - nlwarning("Unable to read PEM info"); - res = CURLE_SSL_CACERT; - } - - // decrease reference counts - BIO_free(bio); - } - else - { - nlwarning("Unable to allocate BIO buffer for certificates"); - res = CURLE_SSL_CACERT; - } - - // all set to go - return res; -} +static const std::string CAFilename = "ssl_ca_cert.pem"; // this is the certificate "Thawte Server CA" // *************************************************************************** bool CCurlHttpClient::verifyServer(bool verify) { curl_easy_setopt(_Curl, CURLOPT_SSL_VERIFYHOST, verify ? 2 : 0); curl_easy_setopt(_Curl, CURLOPT_SSL_VERIFYPEER, verify ? 1 : 0); - curl_easy_setopt(_Curl, CURLOPT_SSLCERTTYPE, "PEM"); - // would allow to provide the CA in memory instead of using CURLOPT_CAINFO, but needs to include and link OpenSSL - if (curl_easy_setopt(_Curl, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function) != CURLE_OK) - { - nlwarning("Unable to support CURLOPT_SSL_CTX_FUNCTION, curl not compiled with OpenSSL ?"); - } - // set both CURLOPT_CAINFO and CURLOPT_CAPATH to NULL to be sure we won't use default values (these files can be missing and generate errors) - curl_easy_setopt(_Curl, CURLOPT_CAINFO, NULL); - curl_easy_setopt(_Curl, CURLOPT_CAPATH, NULL); + // specify custom CA certs + NLGUI::CCurlCertificates::addCertificateFile(CAFilename); + + // if supported, use custom SSL context function to load certificates + NLGUI::CCurlCertificates::useCertificates(_Curl); + return true; } diff --git a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp index e21872018..a9a682bf1 100644 --- a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -187,7 +187,21 @@ static inline bool isUrlTag(const ucstring &s, ucstring::size_type index, ucstri if (isUrl && i > 0 && !markdown) { // '}' is in the list because of color tags, ie "@{FFFF}http://..." - const vector chars {' ', '"', '\'', '(', '[', '}'}; +#ifdef NL_ISO_CPP0X_AVAILABLE + const vector chars{ ' ', '"', '\'', '(', '[', '}' }; +#else + static std::vector chars; + + if (chars.empty()) + { + chars.push_back(' '); + chars.push_back('"'); + chars.push_back('\''); + chars.push_back('('); + chars.push_back('['); + chars.push_back('}'); + } +#endif isUrl = std::find(chars.begin(), chars.end(), s[i - 1]) != chars.end(); } return isUrl; diff --git a/code/ryzom/client/src/interface_v3/group_html_webig.cpp b/code/ryzom/client/src/interface_v3/group_html_webig.cpp index 58d27c851..fe2fa5229 100644 --- a/code/ryzom/client/src/interface_v3/group_html_webig.cpp +++ b/code/ryzom/client/src/interface_v3/group_html_webig.cpp @@ -28,6 +28,8 @@ #include "../net_manager.h" #include "../connection.h" +#include + using namespace std; using namespace NLMISC; diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 7fbda32a1..ae6d0e538 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -113,6 +113,8 @@ #include "nel/gui/lua_helper.h" using namespace NLGUI; #include "nel/gui/lua_ihm.h" +#include "nel/gui/curl_certificates.h" + #include "lua_ihm_ryzom.h" #include "add_on_manager.h" @@ -471,15 +473,11 @@ CInterfaceManager::CInterfaceManager() CGroupHTML::options.appName = getUserAgentName(); CGroupHTML::options.appVersion = getUserAgentVersion(); CGroupHTML::options.curlMaxConnections = ClientCfg.CurlMaxConnections; + if (!ClientCfg.CurlCABundle.empty()) { - string filename = CPath::lookup(ClientCfg.CurlCABundle, false); - if (!filename.empty()) - { - filename = CPath::getFullPath(filename, false); - CGroupHTML::options.curlCABundle = filename; - nlinfo("curl ca bundle '%s'", filename.c_str()); - } + // specify custom CA certs, lookup will be made in this function + NLGUI::CCurlCertificates::addCertificateFile(ClientCfg.CurlCABundle); } NLGUI::CDBManager::getInstance()->resizeBanks( NB_CDB_BANKS ); diff --git a/code/ryzom/client/src/item_group_manager.cpp b/code/ryzom/client/src/item_group_manager.cpp index e72f2d730..fddba873f 100644 --- a/code/ryzom/client/src/item_group_manager.cpp +++ b/code/ryzom/client/src/item_group_manager.cpp @@ -83,8 +83,8 @@ void CItemGroup::addItem(sint32 createTime, sint32 serial, SLOT_EQUIPMENT::TSlot nldebug("Not adding duplicate item, createTime: %d, serial: %d", createTime, serial); //In this case, we are adding the duplicate item for a 2 hands item //If it's saved as a left hand item, save it as a right hand item instead (so we have only 1 correct item) - if(Items[i].slot == SLOT_EQUIPMENT::TSlotEquipment::HANDL && slot == SLOT_EQUIPMENT::TSlotEquipment::HANDR) - Items[i].slot = SLOT_EQUIPMENT::TSlotEquipment::HANDR; + if(Items[i].slot == SLOT_EQUIPMENT::HANDL && slot == SLOT_EQUIPMENT::HANDR) + Items[i].slot = SLOT_EQUIPMENT::HANDR; return; } } @@ -389,7 +389,7 @@ CItemGroup CItemGroupManager::migrateGroup(CItemGroup group) //Get all matching items from all inventory CItemGroup out; out.name = group.name; - for (int i=0; i < INVENTORIES::TInventory::NUM_ALL_INVENTORY; i++) + for (int i=0; i < INVENTORIES::NUM_ALL_INVENTORY; i++) { INVENTORIES::TInventory inventory = (INVENTORIES::TInventory)i; std::vector items = matchingItems(&group, inventory); @@ -501,7 +501,7 @@ bool CItemGroupManager::moveGroup(std::string name, INVENTORIES::TInventory dst) std::string moveParams = "to=lists|nblist=1|listsheet0=" + toDbPath(dst); // Grab all matching item from all available inventory and put it in dst - for (int i=0; i< INVENTORIES::TInventory::NUM_ALL_INVENTORY; i ++) + for (int i=0; i< INVENTORIES::NUM_ALL_INVENTORY; i ++) { INVENTORIES::TInventory inventory = (INVENTORIES::TInventory)i; if (inventory != dst && pIM->isInventoryAvailable(inventory)) @@ -531,7 +531,7 @@ bool CItemGroupManager::equipGroup(std::string name, bool pullBefore) return false; } - if(pullBefore) moveGroup(name, INVENTORIES::TInventory::bag); + if(pullBefore) moveGroup(name, INVENTORIES::bag); //Start by unequipping all slot that user wants to unequip for(int i=0; i < group->removeBeforeEquip.size(); i++) { @@ -547,6 +547,7 @@ bool CItemGroupManager::equipGroup(std::string name, bool pullBefore) uint32 maxEquipTime = 0; +#ifdef NL_ISO_CPP0X_AVAILABLE std::map possiblyDual = { {ITEM_TYPE::ANKLET, false}, @@ -554,8 +555,17 @@ bool CItemGroupManager::equipGroup(std::string name, bool pullBefore) {ITEM_TYPE::EARING, false}, {ITEM_TYPE::RING, false}, }; +#else + std::map possiblyDual; + + possiblyDual[ITEM_TYPE::ANKLET] = false; + possiblyDual[ITEM_TYPE::BRACELET] = false; + possiblyDual[ITEM_TYPE::EARING] = false; + possiblyDual[ITEM_TYPE::RING] = false; +#endif + std::vector duals; - std::vector items = matchingItems(group, INVENTORIES::TInventory::bag); + std::vector items = matchingItems(group, INVENTORIES::bag); for(int i=0; i < items.size(); i++) { CInventoryItem item = items[i]; @@ -713,19 +723,19 @@ std::string CItemGroupManager::toDbPath(INVENTORIES::TInventory inventory) { switch(inventory) { - case INVENTORIES::TInventory::bag: + case INVENTORIES::bag: return LIST_BAG_TEXT; break; - case INVENTORIES::TInventory::pet_animal1: + case INVENTORIES::pet_animal1: return LIST_PA0_TEXT; break; - case INVENTORIES::TInventory::pet_animal2: + case INVENTORIES::pet_animal2: return LIST_PA1_TEXT; break; - case INVENTORIES::TInventory::pet_animal3: + case INVENTORIES::pet_animal3: return LIST_PA2_TEXT; break; - case INVENTORIES::TInventory::pet_animal4: + case INVENTORIES::pet_animal4: return LIST_PA3_TEXT; break; - case INVENTORIES::TInventory::player_room: + case INVENTORIES::player_room: return LIST_ROOM_TEXT;break; - case INVENTORIES::TInventory::guild: + case INVENTORIES::guild: return ClientCfg.ItemGroupAllowGuild ? LIST_GUILD_TEXT : ""; break; default: return ""; diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index 5cf77aae7..f4e7e237f 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -101,7 +101,7 @@ struct EPatchDownloadException : public Exception { EPatchDownloadException() : Exception( "Download Error" ) {} EPatchDownloadException( const std::string& str ) : Exception( str ) {} - virtual ~EPatchDownloadException() throw() {} + virtual ~EPatchDownloadException() throw(){} }; diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index fe96d4da3..4657f1dff 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -80,6 +80,7 @@ #include "world_database_manager.h" #include "continent_manager.h" #include "ig_callback.h" +#include "release.h" //#include "fog_map.h" #include "movie_shooter.h" #include "sound_manager.h" @@ -2555,6 +2556,9 @@ bool mainLoop() if ( ! FarTP.isReselectingChar() ) // skip some parts if the user wants to quit in the middle of a char reselect { + // Saving ingame resolution when in windowed mode + saveIngameResolution(); + // Release the structure for the ping. Ping.release (); diff --git a/code/ryzom/client/src/r2/dmc/client_edition_module.cpp b/code/ryzom/client/src/r2/dmc/client_edition_module.cpp index a3da447dc..66dd94c9f 100644 --- a/code/ryzom/client/src/r2/dmc/client_edition_module.cpp +++ b/code/ryzom/client/src/r2/dmc/client_edition_module.cpp @@ -1312,8 +1312,8 @@ void CClientEditionModule::onUserComponentDownloaded(NLNET::IModuleProxy *sender if (decompressionState != Z_OK) { - delete component; - nlwarning("Error: the downloaded user component is corrupted '%s' ", component->Filename.c_str()); + nlwarning("Error: the downloaded user component is corrupted '%s'", component->Filename.c_str()); + delete component; return; } component->UncompressedData[component->UncompressedDataLength] = '\0'; diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index dc81eeb38..68214151c 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -4370,7 +4370,7 @@ void CEditor::setCurrentTool(CTool *tool) } // ********************************************************************************************************* -CLuaObject CEditor::getClasses() throw(ELuaError) +CLuaObject CEditor::getClasses() { //H_AUTO(R2_getClasses_throw) CHECK_EDITOR diff --git a/code/ryzom/client/src/r2/editor.h b/code/ryzom/client/src/r2/editor.h index 48a9c6a50..cd19f6c71 100644 --- a/code/ryzom/client/src/r2/editor.h +++ b/code/ryzom/client/src/r2/editor.h @@ -421,7 +421,7 @@ public: // get table for registry in lua environment CLuaObject &getRegistry() { return _Registry; } // get lua classes (the r2.Classes table) - CLuaObject getClasses() throw(ELuaError); + CLuaObject getClasses(); // get R2 environment (the 'r2' table into lua global environment) CLuaObject &getEnv(); // get the config table (that is the 'r2.Config' table) diff --git a/code/ryzom/client/src/release.cpp b/code/ryzom/client/src/release.cpp index ff569b22a..d5c16bf47 100644 --- a/code/ryzom/client/src/release.cpp +++ b/code/ryzom/client/src/release.cpp @@ -136,7 +136,7 @@ extern void selectTipsOfTheDay (uint tips); // *************************************************************************** // Saving ingame resolution when in windowed mode -static void saveIngameResolution() +void saveIngameResolution() { if (ClientCfg.Windowed) { @@ -382,8 +382,6 @@ void releaseMainLoop(bool closeConnection) { ProgressBar.release(); - saveIngameResolution(); - // Release R2 editor if applicable R2::getEditor().autoConfigRelease(IsInRingSession); diff --git a/code/ryzom/client/src/release.h b/code/ryzom/client/src/release.h index 02eae2fa7..56ceca73d 100644 --- a/code/ryzom/client/src/release.h +++ b/code/ryzom/client/src/release.h @@ -22,7 +22,8 @@ #include "nel/misc/types_nl.h" - +// Saving ingame resolution when in windowed mode +void saveIngameResolution(); // called from farTP at reselection void releaseMainLoopReselect(); // Release InGame Data diff --git a/code/ryzom/common/CMakeLists.txt b/code/ryzom/common/CMakeLists.txt index 00eec3097..82e5030a7 100644 --- a/code/ryzom/common/CMakeLists.txt +++ b/code/ryzom/common/CMakeLists.txt @@ -1,7 +1,4 @@ -# only compile game_share for Ryzom client, server and tools -IF(WITH_RYZOM_CLIENT OR WITH_RYZOM_SERVER OR WITH_RYZOM_TOOLS) - ADD_SUBDIRECTORY(src) -ENDIF() +ADD_SUBDIRECTORY(src) #ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_BINARY_DIR}/share/data_common.bnp" # COMMAND bnp_make -p ${CMAKE_CURRENT_SOURCE_DIR}/data_common ${CMAKE_BINARY_DIR}/share > /dev/null) diff --git a/code/ryzom/common/src/game_share/CMakeLists.txt b/code/ryzom/common/src/game_share/CMakeLists.txt index 547b1a470..1a0b0da3f 100644 --- a/code/ryzom/common/src/game_share/CMakeLists.txt +++ b/code/ryzom/common/src/game_share/CMakeLists.txt @@ -1,5 +1,12 @@ -FILE(GLOB SRC *.cpp time_weather_season/*.cpp) -FILE(GLOB PRIV_H *.h time_weather_season/*.h) +FIND_PACKAGE(ZLIB REQUIRED) + +FILE(GLOB SRC *.cpp) +FILE(GLOB SRC_TIME time_weather_season/*.cpp) + +FILE(GLOB PRIV_H *.h) +FILE(GLOB PRIV_TIME_H time_weather_season/*.h) + +SET(HEADER ${PRIV_H}) FILE(GLOB R2 dms.h dms.cpp @@ -17,20 +24,21 @@ FILE(GLOB R2 ring_*.h ring_*.cpp) LIST(REMOVE_ITEM SRC R2) -LIST(REMOVE_ITEM PRIV_H R2) +LIST(REMOVE_ITEM HEADER R2) -SOURCE_GROUP("" FILES ${SRC} ${PRIV_H}) +SOURCE_GROUP("" FILES ${SRC} ${HEADER}) +SOURCE_GROUP("time_weather_season" FILES ${SRC_TIME} ${PRIV_TIME_H}) SOURCE_GROUP("R2" FILES ${R2}) # Filter out the source files not actually compiled. LIST(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/enum_template.cpp) -LIST(REMOVE_ITEM PRIV_H ${CMAKE_CURRENT_SOURCE_DIR}/enum_template.h) +LIST(REMOVE_ITEM HEADER ${CMAKE_CURRENT_SOURCE_DIR}/enum_template.h) -NL_TARGET_LIB(ryzom_gameshare ${PRIV_H} ${SRC} ${R2}) +NL_TARGET_LIB(ryzom_gameshare ${HEADER} ${PRIV_TIME_H} ${SRC} ${SRC_TIME} ${R2}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) +INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -TARGET_LINK_LIBRARIES(ryzom_gameshare nelmisc nelnet nelligo nelgeorges) +TARGET_LINK_LIBRARIES(ryzom_gameshare ${NELMISC_LIBRARIES} ${NELNET_LIBRARIES} ${NELLIGO_LIBRARIES} ${NELGEORGES_LIBRARIES}) NL_DEFAULT_PROPS(ryzom_gameshare "Ryzom, Library: Game Share") NL_ADD_RUNTIME_FLAGS(ryzom_gameshare) NL_ADD_LIB_SUFFIX(ryzom_gameshare) @@ -44,3 +52,9 @@ ENDIF() IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) INSTALL(TARGETS ryzom_gameshare LIBRARY DESTINATION ${RYZOM_LIB_PREFIX} ARCHIVE DESTINATION ${RYZOM_LIB_PREFIX} COMPONENT libraries) ENDIF() + +IF(WITH_INSTALL_LIBRARIES) + INSTALL(FILES ${PRIV_H} DESTINATION include/ryzom/game_share COMPONENT headers) + INSTALL(FILES ${PRIV_TIME_H} DESTINATION include/ryzom/game_share/time_weather_season COMPONENT headers) +ENDIF() + diff --git a/code/ryzom/server/src/ags_test/command_event_manager.h b/code/ryzom/server/src/ags_test/command_event_manager.h index 06d97c726..d66361e9f 100644 --- a/code/ryzom/server/src/ags_test/command_event_manager.h +++ b/code/ryzom/server/src/ags_test/command_event_manager.h @@ -70,7 +70,7 @@ public: /// Set the value of a var const std::string &set(const std::string &var, const std::string &value) { - std::pair res = _Map.insert(std::make_pair(var, value)); + std::pair res = _Map.insert(std::make_pair(var, value)); if (!res.second) (*(res.first)).second = value; return (*(res.first)).second; diff --git a/code/ryzom/server/src/ags_test/move_manager.h b/code/ryzom/server/src/ags_test/move_manager.h index 9987b0169..ab78cecd4 100644 --- a/code/ryzom/server/src/ags_test/move_manager.h +++ b/code/ryzom/server/src/ags_test/move_manager.h @@ -95,7 +95,7 @@ public: { if (PrimZoneMap.find(primZone.getName()) == PrimZoneMap.end()) { - PrimZoneMap.insert(std::make_pair(primZone.getName(), primZone)); + PrimZoneMap.insert(std::make_pair(primZone.getName(), primZone)); nlinfo("Using PrimZone '%s'", primZone.getName().c_str()); } else diff --git a/code/ryzom/server/src/ai_service/ai_bot.cpp b/code/ryzom/server/src/ai_service/ai_bot.cpp index 2fb47023a..6698de755 100644 --- a/code/ryzom/server/src/ai_service/ai_bot.cpp +++ b/code/ryzom/server/src/ai_service/ai_bot.cpp @@ -88,7 +88,6 @@ void CSpawnBot::setVisualPropertiesName() return; // the npc name is displayed as a fauna } - CVisualPropertiesInterface::setName(dataSetRow(), name); } diff --git a/code/ryzom/server/src/ai_service/ai_grp_npc.h b/code/ryzom/server/src/ai_service/ai_grp_npc.h index bac75d1a9..1f838584d 100644 --- a/code/ryzom/server/src/ai_service/ai_grp_npc.h +++ b/code/ryzom/server/src/ai_service/ai_grp_npc.h @@ -190,7 +190,7 @@ public: uint32 getAggroDist() { return _AggroDist; } uint32& despawnTime() { return _DespawnTime; } - uint32& respawnTime() { return _RespawnTime; } + uint32& respawnTime() { return _RespawnTime; } AITYPES::CPropertySetWithExtraList& faction() { return _faction; } AITYPES::CPropertySetWithExtraList& ennemyFaction() { return _ennemyFaction; } diff --git a/code/ryzom/server/src/ai_service/ai_instance.cpp b/code/ryzom/server/src/ai_service/ai_instance.cpp index ef7c4aea9..a4da91956 100644 --- a/code/ryzom/server/src/ai_service/ai_instance.cpp +++ b/code/ryzom/server/src/ai_service/ai_instance.cpp @@ -1566,3 +1566,5 @@ NLMISC_COMMAND(simulateMsgDespawnEasterEgg, "", " params; explodeSubStrings(inStr, params, -1); @@ -151,7 +151,7 @@ public: CFightOnceReader() {} virtual ~CFightOnceReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { vector params; explodeSubStrings(inStr, params, -1); @@ -229,7 +229,7 @@ public: CFightTimedFilterReader() {} virtual ~CFightTimedFilterReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { vector params; explodeSubStrings(inStr, params, -1); @@ -302,7 +302,7 @@ public: CFightHPLessFilterReader() {} virtual ~CFightHPLessFilterReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { vector params; explodeSubStrings(inStr, params, -1); @@ -372,7 +372,7 @@ public: CFightHPMoreFilterReader() {} virtual ~CFightHPMoreFilterReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { vector params; explodeSubStrings(inStr, params, -1); @@ -443,7 +443,7 @@ public: CFightRandomFilterReader() {} virtual ~CFightRandomFilterReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { vector params; explodeSubStrings(inStr, params, -1); @@ -523,7 +523,7 @@ public: CFightSendActionReader() {} virtual ~CFightSendActionReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { vector strings; explodeSubStrings(inStr, strings, -1); @@ -588,7 +588,7 @@ public: CFightSendSelfActionReader() {} virtual ~CFightSendSelfActionReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { vector strings; explodeSubStrings(inStr, strings, -1); @@ -647,7 +647,7 @@ public: CFightAggroBlockReader() {} virtual ~CFightAggroBlockReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { vector strings; explodeSubStrings(inStr, strings, -1); @@ -705,7 +705,7 @@ public: CFightAggroChangeReader() {} virtual ~CFightAggroChangeReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { return new CFightAggroChange(); } @@ -751,7 +751,7 @@ public: CFightDamageCoefReader() {} virtual ~CFightDamageCoefReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { vector strings; explodeSubStrings(inStr, strings, -1); @@ -818,7 +818,7 @@ public: CFightGroupDamageCoefReader() {} virtual ~CFightGroupDamageCoefReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { vector strings; explodeSubStrings(inStr, strings, -1); @@ -871,7 +871,7 @@ public: CFightDamageSpeedCoefReader() {} virtual ~CFightDamageSpeedCoefReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { vector strings; explodeSubStrings(inStr, strings, -1); @@ -933,7 +933,7 @@ public: CFightSetRandomTargetReader() {} virtual ~CFightSetRandomTargetReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { vector strings; explodeSubStrings(inStr, strings, -1); @@ -1003,7 +1003,7 @@ public: CFightMultReader() {} virtual ~CFightMultReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) + CFightScriptComp *create (const std::string &inStr) { vector params; explodeSubStrings(inStr, params, -1); @@ -1066,7 +1066,7 @@ void CFightScript::add(CFightScriptCompReader *reader) } -CFightScriptCompReader *CFightScriptCompReader::getScriptReader (const string &str) throw (ReadFightActionException) +CFightScriptCompReader *CFightScriptCompReader::getScriptReader (const string &str) { CFightScript::TFightScriptMap::iterator it=CFightScript::_ScriptCompList.find(str); if (it==CFightScript::_ScriptCompList.end()) @@ -1075,7 +1075,7 @@ CFightScriptCompReader *CFightScriptCompReader::getScriptReader (const string &s return &(*(it->second)); } -CFightScriptComp *CFightScriptCompReader::createScriptComp (const string &str) throw (ReadFightActionException) +CFightScriptComp *CFightScriptCompReader::createScriptComp (const string &str) { string scriptCompName; { diff --git a/code/ryzom/server/src/ai_service/ai_script_comp.h b/code/ryzom/server/src/ai_service/ai_script_comp.h index 834bbacd7..d4782ac18 100644 --- a/code/ryzom/server/src/ai_service/ai_script_comp.h +++ b/code/ryzom/server/src/ai_service/ai_script_comp.h @@ -51,14 +51,12 @@ public: {} virtual ~CFightScriptCompReader() {} - virtual CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException) = 0; + virtual CFightScriptComp *create (const std::string &inStr) = 0; virtual std::string getName () const =0; - static CFightScriptCompReader *getScriptReader (const std::string &str) throw (ReadFightActionException); + static CFightScriptCompReader *getScriptReader (const std::string &str); - static CFightScriptComp *createScriptComp (const std::string &str) throw (ReadFightActionException); -protected: -private: + static CFightScriptComp *createScriptComp(const std::string &str); }; @@ -74,8 +72,6 @@ public: typedef CHashMap > TFightScriptMap; static TFightScriptMap _ScriptCompList; -protected: -private: }; @@ -116,7 +112,7 @@ public: CFightSelectFilterReader() {} virtual ~CFightSelectFilterReader() {} - CFightScriptComp *create (const std::string &inStr) throw (ReadFightActionException); + CFightScriptComp *create(const std::string &inStr); std::string getName () const { return std::string("SELECT"); diff --git a/code/ryzom/server/src/ai_service/event_reaction.h b/code/ryzom/server/src/ai_service/event_reaction.h index 1f92d3047..31689f613 100644 --- a/code/ryzom/server/src/ai_service/event_reaction.h +++ b/code/ryzom/server/src/ai_service/event_reaction.h @@ -90,7 +90,7 @@ public: // the following routine shouldn't be needed it should be superceded by a better alternative // in the event manager template - bool testCompatibility(CStateInstance *const stateInstance, const TState *const state) const; + bool testCompatibility(CStateInstance *const stateInstance, const TState *const state) const; protected: // protected data --------------------------------------------------- diff --git a/code/ryzom/server/src/ai_service/fx_entity.h b/code/ryzom/server/src/ai_service/fx_entity.h index 74ea07f91..028ee3ad9 100644 --- a/code/ryzom/server/src/ai_service/fx_entity.h +++ b/code/ryzom/server/src/ai_service/fx_entity.h @@ -32,7 +32,7 @@ public: NLMISC::CEntityId const& id() const; bool spawn(); void despawn(); - bool update() { } + bool update() { return false; } void set(std::string const& prop, std::string const& value, bool reportChange=false) { } std::string get(std::string const& prop); std::string getIndexString() const { return _EntityId.toString(); } diff --git a/code/ryzom/server/src/ai_service/script_compiler.cpp b/code/ryzom/server/src/ai_service/script_compiler.cpp index 7ba10f149..bafdefd92 100644 --- a/code/ryzom/server/src/ai_service/script_compiler.cpp +++ b/code/ryzom/server/src/ai_service/script_compiler.cpp @@ -1279,7 +1279,7 @@ static void displayErrorLinesForIndex(const string &text, size_t &index) } -bool CCompiler::getNextToken(const string &text, size_t &index, string &tokenName, string &textValue) throw (EScriptError) +bool CCompiler::getNextToken(const string &text, size_t &index, string &tokenName, string &textValue) { char c=text.at(index); while (c==' '||c=='\n'||c=='\r'||c=='\t') // to avoid blanks, returns and Tabs. diff --git a/code/ryzom/server/src/ai_service/script_compiler.h b/code/ryzom/server/src/ai_service/script_compiler.h index 80d83a860..a03de1f8d 100644 --- a/code/ryzom/server/src/ai_service/script_compiler.h +++ b/code/ryzom/server/src/ai_service/script_compiler.h @@ -298,7 +298,7 @@ public: static CToken* getToken (std::string const& tokenName); static NLMISC::CSmartPtr getRule (std::string const& ruleName); - static bool getNextToken (std::string const& text, size_t& index, std::string& tokenName, std::string& textValue) throw (EScriptError); + static bool getNextToken (std::string const& text, size_t& index, std::string& tokenName, std::string& textValue); static std::string const& getOpcodeName (AIVM::CScriptVM::EOpcode const& op); static AIVM::CScriptVM::EOpcode getOpcodeAndValue (std::string const& str, std::string& value); static CScriptNativeFuncParams* getNativeFunc (std::string const& funcName, std::string const& inparams, std::string const& outparams); diff --git a/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.cpp b/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.cpp index 374b00295..069933e2b 100644 --- a/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.cpp +++ b/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.cpp @@ -394,7 +394,7 @@ void CEntityBase::setTarget( const NLMISC::CEntityId& targetId, bool sendMessage // lookupStat : // //--------------------------------------------------- -sint32& CEntityBase::lookupStat( const string& var ) throw (CEntityBase::EInvalidStat) +sint32& CEntityBase::lookupStat( const string& var) { // TODO Alain: optimize this... uint i; @@ -562,7 +562,7 @@ sint32& CEntityBase::lookupStat( const string& var ) throw (CEntityBase::EInvali // lookupStat for Characteristics: // //--------------------------------------------------- -sint32& CEntityBase::lookupStat( CHARACTERISTICS::TCharacteristics c, SCharacteristicsAndScores::TCharacteristicsAndScoreSubType st ) throw (CEntityBase::EInvalidStat) +sint32& CEntityBase::lookupStat( CHARACTERISTICS::TCharacteristics c, SCharacteristicsAndScores::TCharacteristicsAndScoreSubType st) { if( c < CHARACTERISTICS::NUM_CHARACTERISTICS ) { @@ -601,7 +601,7 @@ sint32& CEntityBase::lookupStat( CHARACTERISTICS::TCharacteristics c, SCharacter // lookupStat for Scores: // //--------------------------------------------------- -sint32& CEntityBase::lookupStat( SCORES::TScores score, SCharacteristicsAndScores::TCharacteristicsAndScoreSubType st ) throw (CEntityBase::EInvalidStat) +sint32& CEntityBase::lookupStat( SCORES::TScores score, SCharacteristicsAndScores::TCharacteristicsAndScoreSubType st) { if( score < SCORES::NUM_SCORES ) { @@ -640,7 +640,7 @@ sint32& CEntityBase::lookupStat( SCORES::TScores score, SCharacteristicsAndScore // lookupStat for Skills: // //--------------------------------------------------- -sint32& CEntityBase::lookupStat( SKILLS::ESkills skill, SSkill::ESkillSubType st ) throw (CEntityBase::EInvalidStat) +sint32& CEntityBase::lookupStat( SKILLS::ESkills skill, SSkill::ESkillSubType st) { /* enum ESkillSubType { @@ -675,7 +675,7 @@ sint32& CEntityBase::lookupStat( SKILLS::ESkills skill, SSkill::ESkillSubType st // lookupStat for SpecialModifiers: // //--------------------------------------------------- -sint32& CEntityBase::lookupStat( CSpecialModifiers::ESpecialModifiers sm ) throw (CEntityBase::EInvalidStat) +sint32& CEntityBase::lookupStat( CSpecialModifiers::ESpecialModifiers sm) { switch( sm ) { @@ -738,7 +738,7 @@ sint32& CEntityBase::lookupStat( CSpecialModifiers::ESpecialModifiers sm ) throw throw CEntityBase::EInvalidStat() ; } // lookupStat // -const sint32& CEntityBase::lookupStat( CSpecialModifiers::ESpecialModifiers sm ) const throw (CEntityBase::EInvalidStat) +const sint32& CEntityBase::lookupStat( CSpecialModifiers::ESpecialModifiers sm) const { return const_cast(this)->lookupStat(sm); } diff --git a/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.h b/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.h index 05342be92..89d3271ae 100644 --- a/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.h +++ b/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.h @@ -521,36 +521,36 @@ public: * \param var is the name of the variable * \return ref on the stat value */ - sint32& lookupStat( const std::string& stat ) throw (EInvalidStat); + sint32& lookupStat( const std::string& stat); /** * get a reference on a characterristics value * \param c is enum of characteristic, st is enum of subtype of characterisitics (like max, current..) * \return ref on the stat value */ - sint32& lookupStat( CHARACTERISTICS::TCharacteristics c, SCharacteristicsAndScores::TCharacteristicsAndScoreSubType st ) throw (CEntityBase::EInvalidStat); + sint32& lookupStat( CHARACTERISTICS::TCharacteristics c, SCharacteristicsAndScores::TCharacteristicsAndScoreSubType st); /** * get a reference on a scores value * \param score is enum of score, st is enum of subtype of score (like max, current..) * \return ref on the stat value */ - sint32& lookupStat( SCORES::TScores score, SCharacteristicsAndScores::TCharacteristicsAndScoreSubType st ) throw (CEntityBase::EInvalidStat); + sint32& lookupStat( SCORES::TScores score, SCharacteristicsAndScores::TCharacteristicsAndScoreSubType st); /** * get a reference on a skill value * \param skill is enum of Skills, st is enum of subtype of skill (like base, current..) * \return ref on the stat value */ - sint32& lookupStat( SKILLS::ESkills skill, SSkill::ESkillSubType st ) throw (CEntityBase::EInvalidStat); + sint32& lookupStat( SKILLS::ESkills skill, SSkill::ESkillSubType st); /** * get a reference on a SpecialModifiers value * \param sm is enum of SpecialModifiers * \return ref on the stat value */ - sint32& lookupStat( CSpecialModifiers::ESpecialModifiers sm ) throw (CEntityBase::EInvalidStat); - const sint32& lookupStat( CSpecialModifiers::ESpecialModifiers sm ) const throw (CEntityBase::EInvalidStat); + sint32& lookupStat( CSpecialModifiers::ESpecialModifiers sm); + const sint32& lookupStat( CSpecialModifiers::ESpecialModifiers sm) const; /// accessors on hp (read only) inline sint32 currentHp() const { return _PhysScores._PhysicalScores[SCORES::hit_points].Current;} diff --git a/code/ryzom/server/src/entities_game_service/shop_type/item_for_sale.cpp b/code/ryzom/server/src/entities_game_service/shop_type/item_for_sale.cpp index 2844db92c..c2464c0ee 100644 --- a/code/ryzom/server/src/entities_game_service/shop_type/item_for_sale.cpp +++ b/code/ryzom/server/src/entities_game_service/shop_type/item_for_sale.cpp @@ -93,7 +93,7 @@ void CItemForSale::setAvailable( bool a ) } //----------------------------------------------------------------------------- -//void CItemForSale::serial(NLMISC::IStream &f) throw(NLMISC::EStream ) +//void CItemForSale::serial(NLMISC::IStream &f) //{ // f.serial( _PriceInfo ); // f.serial( _RetirePrice ); diff --git a/code/ryzom/server/src/entities_game_service/shop_type/item_for_sale.h b/code/ryzom/server/src/entities_game_service/shop_type/item_for_sale.h index 834c27dd1..7387a9a10 100644 --- a/code/ryzom/server/src/entities_game_service/shop_type/item_for_sale.h +++ b/code/ryzom/server/src/entities_game_service/shop_type/item_for_sale.h @@ -83,7 +83,7 @@ public: virtual void setContinent( CONTINENT::TContinent continent ) = 0; // // serial -// virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream ) = 0; +// virtual void serial(NLMISC::IStream &f) = 0; // set item for sale virtual void itemForSale( uint32 price, uint32 retirePrice, CGameItemPtr item, uint32 quantity, const NLMISC::CEntityId& id, CONTINENT::TContinent continent, uint32 identifier ) = 0; @@ -190,7 +190,7 @@ public: void itemForSale( uint32 price, uint32 retirePrice, CGameItemPtr item, uint32 quantity, const NLMISC::CEntityId& id, CONTINENT::TContinent continent, uint32 identifier ); // serial -// void serial(NLMISC::IStream &f) throw(NLMISC::EStream ); +// void serial(NLMISC::IStream &f); // cast operator // const IItemTrade * operator = ( CItemForSale * i ) const { return (IItemTrade *) i; } @@ -312,7 +312,7 @@ public: void setContinent( CONTINENT::TContinent ) {} // serial - void serial(NLMISC::IStream &f) throw(NLMISC::EStream ) {} + void serial(NLMISC::IStream &f) {} // set item for sale void itemForSale( uint32 price, uint32 retirePrice, CGameItemPtr item, uint32 quantity, const NLMISC::CEntityId& id, CONTINENT::TContinent continent, uint32 identifier ) {} diff --git a/code/ryzom/server/src/entities_game_service/shop_type/items_for_sale.cpp b/code/ryzom/server/src/entities_game_service/shop_type/items_for_sale.cpp index c247b93ac..61538b674 100644 --- a/code/ryzom/server/src/entities_game_service/shop_type/items_for_sale.cpp +++ b/code/ryzom/server/src/entities_game_service/shop_type/items_for_sale.cpp @@ -96,7 +96,7 @@ NLMISC::CSmartPtr< IItemTrade > CItemsForSale::removeItem( uint32 identifier, ui } //----------------------------------------------------------------------------- -void CItemsForSale::serial(NLMISC::IStream &f) throw(NLMISC::EStream ) +void CItemsForSale::serial(NLMISC::IStream &f) { // YOYO: we should not be here. OLD serial was very buggy. // AlainS ensure me this code is no more called (no write, use PDS instead, and old version diff --git a/code/ryzom/server/src/entities_game_service/shop_type/items_for_sale.h b/code/ryzom/server/src/entities_game_service/shop_type/items_for_sale.h index d8e02b4f6..6de4e8380 100644 --- a/code/ryzom/server/src/entities_game_service/shop_type/items_for_sale.h +++ b/code/ryzom/server/src/entities_game_service/shop_type/items_for_sale.h @@ -55,7 +55,7 @@ public: const std::vector< TItemTradePtr >& getContent() const { return _ItemsForSale; } // serial - void serial(NLMISC::IStream &f) throw(NLMISC::EStream ); + void serial(NLMISC::IStream &f); // check coherency between CDynamicItems and CItemsForSale of character, assume CItemsForSale is a reference void checkSellStore( NLMISC::CEntityId charId ); diff --git a/code/ryzom/server/src/entity_view_service/entity_view_service.h b/code/ryzom/server/src/entity_view_service/entity_view_service.h index 2b7e47ca1..5656d86eb 100644 --- a/code/ryzom/server/src/entity_view_service/entity_view_service.h +++ b/code/ryzom/server/src/entity_view_service/entity_view_service.h @@ -179,7 +179,7 @@ public: { nlinfo("Create entity %s", id.toString().c_str()); - std::pair res = _Entities.insert(std::make_pair(id, CEntity())); + std::pair res = _Entities.insert(std::make_pair(id, CEntity())); TEntityMap::iterator ite = res.first; nlassert(ite != _Entities.end() && res.second); diff --git a/code/ryzom/server/src/frontend_service/gateway_fes_transport.cpp b/code/ryzom/server/src/frontend_service/gateway_fes_transport.cpp index a24fd8d51..40cb4dde2 100644 --- a/code/ryzom/server/src/frontend_service/gateway_fes_transport.cpp +++ b/code/ryzom/server/src/frontend_service/gateway_fes_transport.cpp @@ -179,13 +179,13 @@ public: } } - void onCommand(const CMessage &command) throw (EInvalidCommand) + void onCommand(const CMessage &command) { // nothing done for now throw EInvalidCommand(); } /// The gateway send a textual command to the transport - bool onCommand(const TParsedCommandLine &command) throw (EInvalidCommand) + bool onCommand(const TParsedCommandLine &command) { if (command.SubParams.size() < 1) throw EInvalidCommand(); @@ -212,7 +212,7 @@ public: } /// Open the server by intercepting client gateway message - void openServer() throw (ETransportError) + void openServer() { if (OpenTransport() != NULL) throw ETransportError("openServer : a transport is already open !"); diff --git a/code/ryzom/server/src/input_output_service/chat_manager.h b/code/ryzom/server/src/input_output_service/chat_manager.h index 544dbfa2c..a64b68d52 100644 --- a/code/ryzom/server/src/input_output_service/chat_manager.h +++ b/code/ryzom/server/src/input_output_service/chat_manager.h @@ -101,7 +101,7 @@ public : * Get the client infos * \param id is the client character id */ - CChatClient& getClient( const TDataSetRow& id ); //throw (EChatClient); + CChatClient& getClient( const TDataSetRow& id ); /** * Return a reference on the static database @@ -145,7 +145,7 @@ public : * \param gId is the group's id * \return the group */ - CChatGroup& getGroup( const TGroupId& gId );// throw (EChatGroup); + CChatGroup& getGroup( const TGroupId& gId ); /** * Transmit a chat message diff --git a/code/ryzom/tools/pd_parser/parser.cpp b/code/ryzom/tools/pd_parser/parser.cpp index e1c564c33..d4ae04508 100644 --- a/code/ryzom/tools/pd_parser/parser.cpp +++ b/code/ryzom/tools/pd_parser/parser.cpp @@ -4512,11 +4512,11 @@ void CDeclarationNode::generateSetContent(CCallContext *context) if (useReference) { FetchId.add(Type+"*\t"+objectVariable+" = static_cast<"+Type+"*>("+pdslibFunc("create")+"(tableIndex));"); - FetchId.add(cppName()+".insert(std::make_pair<"+keyType->getName()+","+Type+"*>("+keyVariable+", "+objectVariable+"));"); + FetchId.add(cppName()+".insert(std::make_pair("+keyVariable+", "+objectVariable+"));"); } else { - FetchId.add(cppName()+".insert(std::make_pair<"+keyType->getName()+","+Type+">("+keyVariable+", "+Type+"()));"); + FetchId.add(cppName()+".insert(std::make_pair("+keyVariable+", "+Type+"()));"); FetchId.add(Type+"*\t"+objectVariable+" = &("+cppName()+"["+keyVariable+"]);"); } FetchId.add(pdslibFunc("setRowIndex")+"(rowIndex, "+objectVariable+");"); diff --git a/code/ryzom/tools/pd_parser/parser_rules.h b/code/ryzom/tools/pd_parser/parser_rules.h index 9fbc28899..01d7310e6 100644 --- a/code/ryzom/tools/pd_parser/parser_rules.h +++ b/code/ryzom/tools/pd_parser/parser_rules.h @@ -161,7 +161,7 @@ CParseNode *parse##nodename(CTokenizer &tokenizer) \ PARSE_FAIL \ CTokenizer::CToken t2 = tokenizer.currentToken(); \ tokenizer.next(); \ - main->savein.push_back(std::make_pair(tokenizer.get(t1), tokenizer.get(t2))); \ + main->savein.push_back(std::make_pair(tokenizer.get(t1), tokenizer.get(t2))); \ } /* diff --git a/code/ryzom/tools/server/build_spell_sheet/build_spell_sheet.cpp b/code/ryzom/tools/server/build_spell_sheet/build_spell_sheet.cpp index 5e892410b..6a8383485 100644 --- a/code/ryzom/tools/server/build_spell_sheet/build_spell_sheet.cpp +++ b/code/ryzom/tools/server/build_spell_sheet/build_spell_sheet.cpp @@ -65,7 +65,7 @@ public: return true; } public: - void serial(IStream &f) throw(EStream) + void serial(IStream &f) { for(uint k = 0; k < NumUserParams; ++k) { @@ -87,7 +87,7 @@ public: { return PSName.empty() && UserParams.empty(); } - void serial(IStream &f) throw(EStream) + void serial(IStream &f) { if (!PSName.empty()) writeAtom(f, "PSName", PSName); UserParams.serial(f); @@ -111,7 +111,7 @@ public: } return true; } - void serial(IStream &f) throw(EStream) + void serial(IStream &f) { for(uint k = 0; k < NumFX; ++k) { diff --git a/code/snowballs2/bin/snowballs_client_default.cfg b/code/snowballs2/bin/snowballs_client_default.cfg index 49ec9e4d5..f8af00386 100755 --- a/code/snowballs2/bin/snowballs_client_default.cfg +++ b/code/snowballs2/bin/snowballs_client_default.cfg @@ -57,6 +57,9 @@ ScreenFull = 1; // Start position of the player (the z is always 0) StartPoint = { 1840.0, -970.0, 0.0 }; +// Anti-Aliasing +EnableFXAA = 0; + ////////////////////////////////////////////////////////////////////////////// // HMD Variables ///////////////////////////////////////////////////////////// diff --git a/code/snowballs2/client/src/configuration.cpp b/code/snowballs2/client/src/configuration.cpp index 303db63ce..bc37448b2 100644 --- a/code/snowballs2/client/src/configuration.cpp +++ b/code/snowballs2/client/src/configuration.cpp @@ -37,7 +37,15 @@ namespace SBCLIENT { void CConfiguration::setAndCallback(const std::string &varName, void (*cb)(CConfigFile::CVar &var)) { ConfigFile->setCallback(varName, cb); - cb(*ConfigFile->getVarPtr(varName)); + CConfigFile::CVar *varPtr = ConfigFile->getVarPtr(varName); + if (!varPtr) + { + nlwarning("Missing config variable '%s'", varName.c_str()); + } + else + { + cb(*varPtr); + } } void CConfiguration::dropCallback(const std::string &varName) diff --git a/code/studio/src/plugins/object_viewer/particle_system/particle_node.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_node.cpp index 7bffe2fa3..d8a7573ec 100644 --- a/code/studio/src/plugins/object_viewer/particle_system/particle_node.cpp +++ b/code/studio/src/plugins/object_viewer/particle_system/particle_node.cpp @@ -340,7 +340,7 @@ std::string CParticleWorkspace::getFilename() const return CFile::getFilename(_Filename); } -CWorkspaceNode *CParticleWorkspace::addNode(const std::string &filenameWithFullPath) throw( NLMISC::Exception) +CWorkspaceNode *CParticleWorkspace::addNode(const std::string &filenameWithFullPath) { // Check that file is not already inserted std::string fileName = NLMISC::CFile::getFilename(filenameWithFullPath); diff --git a/code/studio/src/plugins/object_viewer/particle_system/particle_node.h b/code/studio/src/plugins/object_viewer/particle_system/particle_node.h index 033802a44..7b164580d 100644 --- a/code/studio/src/plugins/object_viewer/particle_system/particle_node.h +++ b/code/studio/src/plugins/object_viewer/particle_system/particle_node.h @@ -283,7 +283,7 @@ public: /// The node is in the 'unloaded' state, so caller must load it afterward. /// NB : no lookup is done, full path must be provided. /// @return pointer to new node, or NULL if already inserted - CWorkspaceNode *addNode(const std::string &filenameWithFullPath) throw( NLMISC::Exception); + CWorkspaceNode *addNode(const std::string &filenameWithFullPath); /// Remove a node by it's index void removeNode(uint index);