mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-15 14:08:42 +00:00
Merge with feature-export-assimp
This commit is contained in:
commit
5072b040b2
172 changed files with 3720 additions and 1232 deletions
|
@ -106,6 +106,7 @@ ENDIF(WIN32)
|
||||||
|
|
||||||
FIND_PACKAGE(LibXml2 REQUIRED)
|
FIND_PACKAGE(LibXml2 REQUIRED)
|
||||||
FIND_PACKAGE(PNG REQUIRED)
|
FIND_PACKAGE(PNG REQUIRED)
|
||||||
|
FIND_PACKAGE(GIF)
|
||||||
FIND_PACKAGE(Jpeg)
|
FIND_PACKAGE(Jpeg)
|
||||||
|
|
||||||
IF(WITH_STATIC_LIBXML2)
|
IF(WITH_STATIC_LIBXML2)
|
||||||
|
@ -161,9 +162,9 @@ IF(WITH_NEL)
|
||||||
|
|
||||||
IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
|
IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
|
||||||
SET(CURL_STATIC ON)
|
SET(CURL_STATIC ON)
|
||||||
ELSE((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
|
ELSE()
|
||||||
SET(CURL_STATIC OFF)
|
SET(CURL_STATIC OFF)
|
||||||
ENDIF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
|
ENDIF()
|
||||||
|
|
||||||
IF(CURL_STATIC)
|
IF(CURL_STATIC)
|
||||||
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
|
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
|
||||||
|
@ -175,15 +176,23 @@ IF(WITH_NEL)
|
||||||
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES})
|
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES})
|
||||||
ENDIF(OPENSSL_FOUND)
|
ENDIF(OPENSSL_FOUND)
|
||||||
|
|
||||||
# CURL Macports version depends on libidn, libintl and libiconv too
|
IF(UNIX)
|
||||||
IF(APPLE)
|
# CURL depends on libidn
|
||||||
FIND_LIBRARY(IDN_LIBRARY idn)
|
FIND_LIBRARY(IDN_LIBRARY idn)
|
||||||
FIND_LIBRARY(INTL_LIBRARY intl)
|
IF(IDN_LIBRARY)
|
||||||
|
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY})
|
||||||
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY})
|
ENDIF()
|
||||||
ENDIF(APPLE)
|
|
||||||
ENDIF(CURL_STATIC)
|
# CURL Macports version depends on libidn, libintl and libiconv too
|
||||||
ENDIF(WITH_GUI)
|
IF(APPLE)
|
||||||
|
FIND_LIBRARY(INTL_LIBRARY intl)
|
||||||
|
IF(INTL_LIBRARY)
|
||||||
|
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${INTL_LIBRARY})
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include ${LIBXML2_INCLUDE_DIR})
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include ${LIBXML2_INCLUDE_DIR})
|
||||||
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
|
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
# EXTERNAL_FOUND - True if the external libraries are available
|
# EXTERNAL_FOUND - True if the external libraries are available
|
||||||
|
|
||||||
SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH})
|
SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH})
|
||||||
SET(EXTERNAL_TEMP_FILE "include/wwwconf.h")
|
SET(EXTERNAL_TEMP_FILE "include/zlib.h")
|
||||||
SET(EXTERNAL_NAME "external")
|
SET(EXTERNAL_NAME "external")
|
||||||
|
|
||||||
# If using STLport preprend external_stlport
|
# If using STLport preprend external_stlport
|
||||||
|
@ -38,35 +38,35 @@ IF(EXTERNAL_PATH)
|
||||||
# Using 32 or 64 bits binaries
|
# Using 32 or 64 bits binaries
|
||||||
IF(TARGET_X64 AND WIN32)
|
IF(TARGET_X64 AND WIN32)
|
||||||
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin64")
|
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin64")
|
||||||
ELSE(TARGET_X64 AND WIN32)
|
ELSE()
|
||||||
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin")
|
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin")
|
||||||
ENDIF(TARGET_X64 AND WIN32)
|
ENDIF()
|
||||||
|
|
||||||
# Using 32 or 64 bits libraries
|
# Using 32 or 64 bits libraries
|
||||||
IF(TARGET_X64 AND WIN32)
|
IF(TARGET_X64 AND WIN32)
|
||||||
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64")
|
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64")
|
||||||
ELSE(TARGET_X64 AND WIN32)
|
ELSE()
|
||||||
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib")
|
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib")
|
||||||
ENDIF(TARGET_X64 AND WIN32)
|
ENDIF()
|
||||||
|
|
||||||
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}")
|
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}")
|
||||||
# Stupid hack for FindOpenAL.cmake
|
# Stupid hack for FindOpenAL.cmake
|
||||||
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}")
|
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}")
|
||||||
SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}")
|
SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}")
|
||||||
ENDIF(EXTERNAL_PATH)
|
ENDIF()
|
||||||
|
|
||||||
IF(EXTERNAL_FOUND)
|
IF(EXTERNAL_FOUND)
|
||||||
IF(NOT External_FIND_QUIETLY)
|
IF(NOT External_FIND_QUIETLY)
|
||||||
MESSAGE(STATUS "Found ${EXTERNAL_NAME}: ${EXTERNAL_PATH}")
|
MESSAGE(STATUS "Found ${EXTERNAL_NAME}: ${EXTERNAL_PATH}")
|
||||||
ENDIF(NOT External_FIND_QUIETLY)
|
ENDIF()
|
||||||
ELSE(EXTERNAL_FOUND)
|
ELSE(EXTERNAL_FOUND)
|
||||||
IF(External_FIND_REQUIRED)
|
IF(External_FIND_REQUIRED)
|
||||||
MESSAGE(FATAL_ERROR "Unable to find ${EXTERNAL_NAME}!")
|
MESSAGE(FATAL_ERROR "Unable to find ${EXTERNAL_NAME}!")
|
||||||
ELSE(External_FIND_REQUIRED)
|
ELSE()
|
||||||
IF(NOT External_FIND_QUIETLY)
|
IF(NOT External_FIND_QUIETLY)
|
||||||
MESSAGE(STATUS "Warning: Unable to find ${EXTERNAL_NAME}!")
|
MESSAGE(STATUS "Warning: Unable to find ${EXTERNAL_NAME}!")
|
||||||
ENDIF(NOT External_FIND_QUIETLY)
|
ENDIF()
|
||||||
ENDIF(External_FIND_REQUIRED)
|
ENDIF()
|
||||||
ENDIF(EXTERNAL_FOUND)
|
ENDIF()
|
||||||
|
|
||||||
MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_BINARY_PATH EXTERNAL_LIBRARY_PATH)
|
MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_BINARY_PATH EXTERNAL_LIBRARY_PATH)
|
||||||
|
|
81
code/CMakeModules/FindLua53.cmake
Normal file
81
code/CMakeModules/FindLua53.cmake
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
# Locate Lua library
|
||||||
|
# This module defines
|
||||||
|
# LUA53_FOUND, if false, do not try to link to Lua
|
||||||
|
# LUA_LIBRARIES
|
||||||
|
# LUA_INCLUDE_DIR, where to find lua.h
|
||||||
|
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
|
||||||
|
#
|
||||||
|
# Note that the expected include convention is
|
||||||
|
# #include "lua.h"
|
||||||
|
# and not
|
||||||
|
# #include <lua/lua.h>
|
||||||
|
# This is because, the lua location is not standardized and may exist
|
||||||
|
# in locations other than lua/
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2007-2009 Kitware, Inc.
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
find_path(LUA_INCLUDE_DIR lua.h
|
||||||
|
HINTS
|
||||||
|
ENV LUA_DIR
|
||||||
|
PATH_SUFFIXES include/lua53 include/lua5.3 include/lua-5.3 include/lua include
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/sw # Fink
|
||||||
|
/opt/local # DarwinPorts
|
||||||
|
/opt/csw # Blastwave
|
||||||
|
/opt
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(LUA_LIBRARY
|
||||||
|
NAMES lua53 lua5.3 lua-5.3 lua
|
||||||
|
HINTS
|
||||||
|
ENV LUA_DIR
|
||||||
|
PATH_SUFFIXES lib
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/sw
|
||||||
|
/opt/local
|
||||||
|
/opt/csw
|
||||||
|
/opt
|
||||||
|
)
|
||||||
|
|
||||||
|
if(LUA_LIBRARY)
|
||||||
|
# include the math library for Unix
|
||||||
|
if(UNIX AND NOT APPLE AND NOT BEOS)
|
||||||
|
find_library(LUA_MATH_LIBRARY m)
|
||||||
|
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||||
|
# For Windows and Mac, don't need to explicitly include the math library
|
||||||
|
else()
|
||||||
|
set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
|
||||||
|
file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
|
||||||
|
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
|
||||||
|
unset(lua_version_str)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
|
||||||
|
# all listed variables are TRUE
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua52
|
||||||
|
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
|
||||||
|
VERSION_VAR LUA_VERSION_STRING)
|
||||||
|
|
||||||
|
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
|
||||||
|
|
|
@ -42,20 +42,22 @@ MACRO(FIND_CORRECT_LUA_VERSION)
|
||||||
ENDIF(LUALIB_FOUND)
|
ENDIF(LUALIB_FOUND)
|
||||||
ELSE(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
|
ELSE(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
|
||||||
# TODO: find a way to detect Lua version
|
# TODO: find a way to detect Lua version
|
||||||
IF(WITH_LUA52)
|
IF(WITH_LUA53)
|
||||||
|
FIND_PACKAGE(Lua53 REQUIRED)
|
||||||
|
ELSEIF(WITH_LUA52)
|
||||||
FIND_PACKAGE(Lua52 REQUIRED)
|
FIND_PACKAGE(Lua52 REQUIRED)
|
||||||
ELSEIF(WITH_LUA51)
|
ELSEIF(WITH_LUA51)
|
||||||
FIND_PACKAGE(Lua51 REQUIRED)
|
FIND_PACKAGE(Lua51 REQUIRED)
|
||||||
ELSE(WITH_LUA52)
|
ELSE()
|
||||||
FIND_PACKAGE(Lua50 REQUIRED)
|
FIND_PACKAGE(Lua50 REQUIRED)
|
||||||
ENDIF(WITH_LUA52)
|
ENDIF()
|
||||||
ENDIF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
|
ENDIF()
|
||||||
ENDMACRO(FIND_CORRECT_LUA_VERSION)
|
ENDMACRO()
|
||||||
|
|
||||||
IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
|
IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
|
||||||
# in cache already
|
# in cache already
|
||||||
SET(Luabind_FIND_QUIETLY TRUE)
|
SET(Luabind_FIND_QUIETLY TRUE)
|
||||||
ENDIF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
|
ENDIF()
|
||||||
|
|
||||||
FIND_PATH(LUABIND_INCLUDE_DIR
|
FIND_PATH(LUABIND_INCLUDE_DIR
|
||||||
luabind/luabind.hpp
|
luabind/luabind.hpp
|
||||||
|
@ -72,11 +74,21 @@ FIND_PATH(LUABIND_INCLUDE_DIR
|
||||||
SET(LIBRARY_NAME_RELEASE)
|
SET(LIBRARY_NAME_RELEASE)
|
||||||
SET(LIBRARY_NAME_DEBUG)
|
SET(LIBRARY_NAME_DEBUG)
|
||||||
|
|
||||||
|
IF(WITH_LUA53)
|
||||||
|
IF(WITH_STLPORT)
|
||||||
|
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua53)
|
||||||
|
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua53d)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua53)
|
||||||
|
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua53d)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF(WITH_LUA52)
|
IF(WITH_LUA52)
|
||||||
IF(WITH_STLPORT)
|
IF(WITH_STLPORT)
|
||||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua52)
|
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua52)
|
||||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua52d)
|
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua52d)
|
||||||
ENDIF(WITH_STLPORT)
|
ENDIF()
|
||||||
|
|
||||||
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua52)
|
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua52)
|
||||||
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua52d)
|
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua52d)
|
||||||
|
|
|
@ -251,10 +251,10 @@ MACRO(USE_CURRENT_WINSDK)
|
||||||
SET(WINSDK_VERSION "6.1")
|
SET(WINSDK_VERSION "6.1")
|
||||||
ELSEIF(WINSDK6.0_FOUND)
|
ELSEIF(WINSDK6.0_FOUND)
|
||||||
SET(WINSDK_VERSION "6.0")
|
SET(WINSDK_VERSION "6.0")
|
||||||
ELSE(WINSDK7.1_FOUND)
|
ELSE()
|
||||||
MESSAGE(FATAL_ERROR "You have no compatible Windows SDK installed.")
|
MESSAGE(FATAL_ERROR "You have no compatible Windows SDK installed.")
|
||||||
ENDIF(WINSDK7.1_FOUND)
|
ENDIF()
|
||||||
ENDIF(NOT WINSDK_VERSION)
|
ENDIF()
|
||||||
|
|
||||||
# Look for correct registered Windows SDK version
|
# Look for correct registered Windows SDK version
|
||||||
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
|
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
|
||||||
|
|
|
@ -10,22 +10,22 @@
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET(PCHSupport_FOUND TRUE)
|
SET(PCHSupport_FOUND TRUE)
|
||||||
ELSE(MSVC)
|
ELSE()
|
||||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
|
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
|
||||||
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||||
OUTPUT_VARIABLE gcc_compiler_version)
|
OUTPUT_VARIABLE gcc_compiler_version)
|
||||||
|
|
||||||
IF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?")
|
IF(gcc_compiler_version VERSION_LESS "4.2")
|
||||||
SET(PCHSupport_FOUND FALSE)
|
SET(PCHSupport_FOUND FALSE)
|
||||||
ELSEIF(gcc_compiler_version MATCHES "^4\\.[0-9]+(\\.[0-9]+)?")
|
ELSE()
|
||||||
SET(PCHSupport_FOUND TRUE)
|
SET(PCHSupport_FOUND TRUE)
|
||||||
ENDIF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?")
|
ENDIF()
|
||||||
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
ELSE()
|
||||||
# TODO: make tests for other compilers than GCC
|
# TODO: make tests for other compilers than GCC
|
||||||
SET(PCHSupport_FOUND TRUE)
|
SET(PCHSupport_FOUND TRUE)
|
||||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
ENDIF()
|
||||||
ENDIF(MSVC)
|
ENDIF()
|
||||||
|
|
||||||
# Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs
|
# Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs
|
||||||
MACRO(PCH_SET_COMPILE_FLAGS _target)
|
MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
|
@ -40,19 +40,19 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
|
|
||||||
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
||||||
|
|
||||||
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY")
|
||||||
LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
|
LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
|
||||||
ELSE(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
ELSE()
|
||||||
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
|
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
|
||||||
IF(_pic)
|
IF(_pic)
|
||||||
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
|
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
|
||||||
ENDIF(_pic)
|
ENDIF()
|
||||||
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
ENDIF()
|
||||||
|
|
||||||
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
|
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
|
||||||
FOREACH(item ${DIRINC})
|
FOREACH(item ${DIRINC})
|
||||||
LIST(APPEND _FLAGS " -I\"${item}\"")
|
LIST(APPEND _FLAGS " -I\"${item}\"")
|
||||||
ENDFOREACH(item)
|
ENDFOREACH()
|
||||||
|
|
||||||
# Required for CMake 2.6
|
# Required for CMake 2.6
|
||||||
SET(GLOBAL_DEFINITIONS)
|
SET(GLOBAL_DEFINITIONS)
|
||||||
|
@ -60,61 +60,64 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||||
ENDFOREACH(item)
|
ENDFOREACH()
|
||||||
ENDIF(DEFINITIONS)
|
ENDIF()
|
||||||
|
|
||||||
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||||
ENDFOREACH(item)
|
ENDFOREACH()
|
||||||
ENDIF(DEFINITIONS)
|
ENDIF()
|
||||||
|
|
||||||
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
|
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
|
||||||
IF(oldProps)
|
IF(oldProps)
|
||||||
LIST(APPEND _FLAGS " ${oldProps}")
|
LIST(APPEND _FLAGS " ${oldProps}")
|
||||||
ENDIF(oldProps)
|
ENDIF()
|
||||||
|
|
||||||
GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD})
|
GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD})
|
||||||
IF(oldPropsBuild)
|
IF(oldPropsBuild)
|
||||||
LIST(APPEND _FLAGS " ${oldPropsBuild}")
|
LIST(APPEND _FLAGS " ${oldPropsBuild}")
|
||||||
ENDIF(oldPropsBuild)
|
ENDIF()
|
||||||
|
|
||||||
GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES)
|
GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES)
|
||||||
IF(DIRINC)
|
IF(DIRINC)
|
||||||
FOREACH(item ${DIRINC})
|
FOREACH(item ${DIRINC})
|
||||||
LIST(APPEND _FLAGS " -I\"${item}\"")
|
LIST(APPEND _FLAGS " -I\"${item}\"")
|
||||||
ENDFOREACH(item)
|
ENDFOREACH()
|
||||||
ENDIF(DIRINC)
|
ENDIF()
|
||||||
|
|
||||||
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
|
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||||
ENDFOREACH(item)
|
ENDFOREACH()
|
||||||
ENDIF(DEFINITIONS)
|
ENDIF()
|
||||||
|
|
||||||
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||||
ENDFOREACH(item)
|
ENDFOREACH()
|
||||||
ENDIF(DEFINITIONS)
|
ENDIF()
|
||||||
|
|
||||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
|
||||||
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
|
|
||||||
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
|
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
|
||||||
LIST(APPEND _FLAGS " ${_directory_flags}")
|
|
||||||
LIST(APPEND _FLAGS " ${_directory_definitions}")
|
IF(CMAKE_VERSION VERSION_LESS "3.3.0")
|
||||||
|
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||||
|
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
|
||||||
|
LIST(APPEND _FLAGS " ${_directory_flags}")
|
||||||
|
LIST(APPEND _FLAGS " ${_directory_definitions}")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
# Format definitions
|
# Format definitions
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
# Fix path with space
|
# Fix path with space
|
||||||
SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}")
|
SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}")
|
||||||
ELSE(MSVC)
|
ELSE()
|
||||||
STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS})
|
STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS})
|
||||||
SEPARATE_ARGUMENTS(_FLAGS)
|
SEPARATE_ARGUMENTS(_FLAGS)
|
||||||
ENDIF(MSVC)
|
ENDIF()
|
||||||
|
|
||||||
IF(CLANG)
|
IF(CLANG)
|
||||||
# Determining all architectures and get common flags
|
# Determining all architectures and get common flags
|
||||||
|
@ -127,11 +130,11 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
LIST(APPEND PCH_ARCHS ${item})
|
LIST(APPEND PCH_ARCHS ${item})
|
||||||
STRING(TOUPPER "${item}" _UPPER_ARCH)
|
STRING(TOUPPER "${item}" _UPPER_ARCH)
|
||||||
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
|
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
|
||||||
ENDIF(ITEM_FOUND EQUAL -1)
|
ENDIF()
|
||||||
SET(_ARCH_NEXT OFF)
|
SET(_ARCH_NEXT OFF)
|
||||||
ELSEIF(_XARCH_NEXT)
|
ELSEIF(_XARCH_NEXT)
|
||||||
SET(_XARCH_NEXT OFF)
|
SET(_XARCH_NEXT OFF)
|
||||||
ELSE(_ARCH_NEXT)
|
ELSE()
|
||||||
IF(item MATCHES "^-arch")
|
IF(item MATCHES "^-arch")
|
||||||
SET(_ARCH_NEXT ON)
|
SET(_ARCH_NEXT ON)
|
||||||
ELSEIF(item MATCHES "^-Xarch_")
|
ELSEIF(item MATCHES "^-Xarch_")
|
||||||
|
@ -141,13 +144,13 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
LIST(APPEND PCH_ARCHS ${item})
|
LIST(APPEND PCH_ARCHS ${item})
|
||||||
STRING(TOUPPER "${item}" _UPPER_ARCH)
|
STRING(TOUPPER "${item}" _UPPER_ARCH)
|
||||||
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
|
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
|
||||||
ENDIF(ITEM_FOUND EQUAL -1)
|
ENDIF()
|
||||||
SET(_XARCH_NEXT ON)
|
SET(_XARCH_NEXT ON)
|
||||||
ELSE(item MATCHES "^-arch")
|
ELSE()
|
||||||
LIST(APPEND PCH_FLAGS ${item})
|
LIST(APPEND PCH_FLAGS ${item})
|
||||||
ENDIF(item MATCHES "^-arch")
|
ENDIF()
|
||||||
ENDIF(_ARCH_NEXT)
|
ENDIF()
|
||||||
ENDFOREACH(item)
|
ENDFOREACH()
|
||||||
|
|
||||||
# Get architcture specific flags
|
# Get architcture specific flags
|
||||||
SET(_XARCH_NEXT)
|
SET(_XARCH_NEXT)
|
||||||
|
@ -156,25 +159,25 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
STRING(TOUPPER "${_XARCH_NEXT}" _UPPER_XARCH)
|
STRING(TOUPPER "${_XARCH_NEXT}" _UPPER_XARCH)
|
||||||
LIST(APPEND PCH_ARCH_${_UPPER_XARCH}_FLAGS ${item})
|
LIST(APPEND PCH_ARCH_${_UPPER_XARCH}_FLAGS ${item})
|
||||||
SET(_XARCH_NEXT OFF)
|
SET(_XARCH_NEXT OFF)
|
||||||
ELSE(_XARCH_NEXT)
|
ELSE()
|
||||||
IF(item MATCHES "^-Xarch_")
|
IF(item MATCHES "^-Xarch_")
|
||||||
STRING(SUBSTRING "${item}" 7 -1 _XARCH_NEXT)
|
STRING(SUBSTRING "${item}" 7 -1 _XARCH_NEXT)
|
||||||
ENDIF(item MATCHES "^-Xarch_")
|
ENDIF()
|
||||||
ENDIF(_XARCH_NEXT)
|
ENDIF()
|
||||||
ENDFOREACH(item)
|
ENDFOREACH()
|
||||||
|
|
||||||
# Remove duplicated architectures
|
# Remove duplicated architectures
|
||||||
IF(_ARCHS AND PCH_ARCHS)
|
IF(_ARCHS AND PCH_ARCHS)
|
||||||
LIST(REMOVE_DUPLICATES PCH_ARCHS)
|
LIST(REMOVE_DUPLICATES PCH_ARCHS)
|
||||||
ENDIF(_ARCHS AND PCH_ARCHS)
|
ENDIF()
|
||||||
ELSE(CLANG)
|
ELSE()
|
||||||
SET(PCH_FLAGS ${_FLAGS})
|
SET(PCH_FLAGS ${_FLAGS})
|
||||||
ENDIF(CLANG)
|
ENDIF()
|
||||||
|
|
||||||
IF(PCH_FLAGS)
|
IF(PCH_FLAGS)
|
||||||
LIST(REMOVE_DUPLICATES PCH_FLAGS)
|
LIST(REMOVE_DUPLICATES PCH_FLAGS)
|
||||||
ENDIF(PCH_FLAGS)
|
ENDIF()
|
||||||
ENDMACRO(PCH_SET_COMPILE_FLAGS)
|
ENDMACRO()
|
||||||
|
|
||||||
MACRO(GET_PDB_FILENAME _out_filename _target)
|
MACRO(GET_PDB_FILENAME _out_filename _target)
|
||||||
# determine output directory based on target type
|
# determine output directory based on target type
|
||||||
|
@ -201,9 +204,9 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
|
||||||
IF(CMAKE_CXX_COMPILER_ARG1)
|
IF(CMAKE_CXX_COMPILER_ARG1)
|
||||||
# remove leading space in compiler argument
|
# remove leading space in compiler argument
|
||||||
STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1})
|
STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1})
|
||||||
ELSE(CMAKE_CXX_COMPILER_ARG1)
|
ELSE()
|
||||||
SET(pchsupport_compiler_cxx_arg1 "")
|
SET(pchsupport_compiler_cxx_arg1 "")
|
||||||
ENDIF(CMAKE_CXX_COMPILER_ARG1)
|
ENDIF()
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target})
|
GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target})
|
||||||
|
@ -211,16 +214,16 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
|
||||||
# Ninja PCH Support
|
# Ninja PCH Support
|
||||||
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
|
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
|
||||||
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj")
|
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj")
|
||||||
ELSE(MSVC)
|
ELSE()
|
||||||
SET(HEADER_FORMAT "c++-header")
|
SET(HEADER_FORMAT "c++-header")
|
||||||
SET(_FLAGS "")
|
SET(_FLAGS "")
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
|
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
|
||||||
SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch)
|
SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch)
|
||||||
ENDIF(APPLE)
|
ENDIF()
|
||||||
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT})
|
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT})
|
||||||
ENDIF(MSVC)
|
ENDIF()
|
||||||
ENDMACRO(PCH_SET_COMPILE_COMMAND)
|
ENDMACRO()
|
||||||
|
|
||||||
MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
|
MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
|
||||||
SET(_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch")
|
SET(_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch")
|
||||||
|
@ -230,14 +233,14 @@ MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
|
||||||
GET_FILENAME_COMPONENT(_name ${_input} NAME_WE)
|
GET_FILENAME_COMPONENT(_name ${_input} NAME_WE)
|
||||||
SET(PCH_INPUT ${_input})
|
SET(PCH_INPUT ${_input})
|
||||||
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.pch")
|
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.pch")
|
||||||
ELSE(MSVC)
|
ELSE()
|
||||||
IF(NOT "${_arch}" STREQUAL "")
|
IF(NOT "${_arch}" STREQUAL "")
|
||||||
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_arch}")
|
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_arch}")
|
||||||
ENDIF(NOT "${_arch}" STREQUAL "")
|
ENDIF()
|
||||||
|
|
||||||
IF(NOT "${_language}" STREQUAL "")
|
IF(NOT "${_language}" STREQUAL "")
|
||||||
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_language}")
|
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_language}")
|
||||||
ENDIF(NOT "${_language}" STREQUAL "")
|
ENDIF()
|
||||||
|
|
||||||
GET_FILENAME_COMPONENT(_name ${_input} NAME)
|
GET_FILENAME_COMPONENT(_name ${_input} NAME)
|
||||||
|
|
||||||
|
@ -251,14 +254,14 @@ MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
|
||||||
|
|
||||||
IF(CLANG)
|
IF(CLANG)
|
||||||
SET(PCH_EXT "pth")
|
SET(PCH_EXT "pth")
|
||||||
ELSE(CLANG)
|
ELSE()
|
||||||
SET(PCH_EXT "gch")
|
SET(PCH_EXT "gch")
|
||||||
ENDIF(CLANG)
|
ENDIF()
|
||||||
|
|
||||||
# For GCC and Clang, PCH needs to be in the same directory as .h
|
# For GCC and Clang, PCH needs to be in the same directory as .h
|
||||||
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.${PCH_EXT}")
|
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.${PCH_EXT}")
|
||||||
ENDIF(MSVC)
|
ENDIF()
|
||||||
ENDMACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT)
|
ENDMACRO()
|
||||||
|
|
||||||
# Add common flags
|
# Add common flags
|
||||||
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
|
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
|
||||||
|
@ -266,7 +269,7 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
|
||||||
|
|
||||||
IF(${oldProps} MATCHES NOTFOUND)
|
IF(${oldProps} MATCHES NOTFOUND)
|
||||||
SET(oldProps "")
|
SET(oldProps "")
|
||||||
ENDIF(${oldProps} MATCHES NOTFOUND)
|
ENDIF()
|
||||||
|
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"")
|
SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"")
|
||||||
|
@ -279,17 +282,17 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
|
||||||
GET_TARGET_PROPERTY(_STATIC_LIBRARY_FLAGS ${_targetName} STATIC_LIBRARY_FLAGS)
|
GET_TARGET_PROPERTY(_STATIC_LIBRARY_FLAGS ${_targetName} STATIC_LIBRARY_FLAGS)
|
||||||
IF(NOT _STATIC_LIBRARY_FLAGS)
|
IF(NOT _STATIC_LIBRARY_FLAGS)
|
||||||
SET(_STATIC_LIBRARY_FLAGS)
|
SET(_STATIC_LIBRARY_FLAGS)
|
||||||
ENDIF(NOT _STATIC_LIBRARY_FLAGS)
|
ENDIF()
|
||||||
SET(_STATIC_LIBRARY_FLAGS "${PCH_OUTPUT}.obj ${_STATIC_LIBRARY_FLAGS}")
|
SET(_STATIC_LIBRARY_FLAGS "${PCH_OUTPUT}.obj ${_STATIC_LIBRARY_FLAGS}")
|
||||||
|
|
||||||
GET_TARGET_PROPERTY(_LINK_FLAGS ${_targetName} LINK_FLAGS)
|
GET_TARGET_PROPERTY(_LINK_FLAGS ${_targetName} LINK_FLAGS)
|
||||||
IF(NOT _LINK_FLAGS)
|
IF(NOT _LINK_FLAGS)
|
||||||
SET(_LINK_FLAGS)
|
SET(_LINK_FLAGS)
|
||||||
ENDIF(NOT _LINK_FLAGS)
|
ENDIF()
|
||||||
SET(_LINK_FLAGS "${PCH_OUTPUT}.obj ${_LINK_FLAGS}")
|
SET(_LINK_FLAGS "${PCH_OUTPUT}.obj ${_LINK_FLAGS}")
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES STATIC_LIBRARY_FLAGS ${_STATIC_LIBRARY_FLAGS} LINK_FLAGS ${_LINK_FLAGS})
|
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES STATIC_LIBRARY_FLAGS ${_STATIC_LIBRARY_FLAGS} LINK_FLAGS ${_LINK_FLAGS})
|
||||||
ELSE(MSVC)
|
ELSE()
|
||||||
# for use with distcc and gcc >4.0.1 if preprocessed files are accessible
|
# for use with distcc and gcc >4.0.1 if preprocessed files are accessible
|
||||||
# on all remote machines set
|
# on all remote machines set
|
||||||
# PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess
|
# PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess
|
||||||
|
@ -299,21 +302,21 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
|
||||||
# If no arch is specified, create common flags
|
# If no arch is specified, create common flags
|
||||||
IF(PCH_ARCHS_COUNT LESS 2)
|
IF(PCH_ARCHS_COUNT LESS 2)
|
||||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-include ${PCH_INPUT} ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-include ${PCH_INPUT} ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||||
ENDIF(PCH_ARCHS_COUNT LESS 2)
|
ENDIF()
|
||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||||
ENDIF(APPLE)
|
ENDIF()
|
||||||
|
|
||||||
IF(WITH_PCH_DEBUG)
|
IF(WITH_PCH_DEBUG)
|
||||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-H ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-H ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||||
ENDIF(WITH_PCH_DEBUG)
|
ENDIF()
|
||||||
|
|
||||||
SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch")
|
SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch")
|
||||||
ENDIF(MSVC)
|
ENDIF()
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags})
|
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags})
|
||||||
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET)
|
ENDMACRO()
|
||||||
|
|
||||||
# Add specific flags for an arch
|
# Add specific flags for an arch
|
||||||
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch)
|
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch)
|
||||||
|
@ -324,19 +327,19 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch)
|
||||||
|
|
||||||
IF(${_FLAGS} MATCHES NOTFOUND)
|
IF(${_FLAGS} MATCHES NOTFOUND)
|
||||||
SET(_FLAGS "")
|
SET(_FLAGS "")
|
||||||
ENDIF(${_FLAGS} MATCHES NOTFOUND)
|
ENDIF()
|
||||||
|
|
||||||
SET(_FLAGS "${_FLAGS} -Xarch_${_arch} -include${PCH_INPUT}")
|
SET(_FLAGS "${_FLAGS} -Xarch_${_arch} -include${PCH_INPUT}")
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_FLAGS})
|
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_FLAGS})
|
||||||
ENDIF(PCH_ARCHS_COUNT GREATER 1)
|
ENDIF()
|
||||||
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH)
|
ENDMACRO()
|
||||||
|
|
||||||
MACRO(PCH_CREATE_TARGET _targetName _targetNamePCH)
|
MACRO(PCH_CREATE_TARGET _targetName _targetNamePCH)
|
||||||
ADD_CUSTOM_COMMAND(OUTPUT ${PCH_OUTPUT} COMMAND ${PCH_COMMAND} COMMENT "Generating ${_targetNamePCH}" DEPENDS ${PCH_INPUT})
|
ADD_CUSTOM_COMMAND(OUTPUT ${PCH_OUTPUT} COMMAND ${PCH_COMMAND} COMMENT "Generating ${_targetNamePCH}" DEPENDS ${PCH_INPUT})
|
||||||
ADD_CUSTOM_TARGET(${_targetNamePCH} DEPENDS ${PCH_INPUT} ${PCH_OUTPUT})
|
ADD_CUSTOM_TARGET(${_targetNamePCH} DEPENDS ${PCH_INPUT} ${PCH_OUTPUT})
|
||||||
ADD_DEPENDENCIES(${_targetName} ${_targetNamePCH})
|
ADD_DEPENDENCIES(${_targetName} ${_targetNamePCH})
|
||||||
ENDMACRO(PCH_CREATE_TARGET _targetName _inputh _inputcpp)
|
ENDMACRO()
|
||||||
|
|
||||||
MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||||
SET(_PCH_current_target ${_targetName})
|
SET(_PCH_current_target ${_targetName})
|
||||||
|
@ -346,7 +349,7 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||||
"This is the ADD_PRECOMPILED_HEADER macro. "
|
"This is the ADD_PRECOMPILED_HEADER macro. "
|
||||||
"You must set CMAKE_BUILD_TYPE!"
|
"You must set CMAKE_BUILD_TYPE!"
|
||||||
)
|
)
|
||||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
ENDIF()
|
||||||
|
|
||||||
PCH_SET_COMPILE_FLAGS(${_targetName})
|
PCH_SET_COMPILE_FLAGS(${_targetName})
|
||||||
|
|
||||||
|
@ -362,25 +365,25 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||||
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH})
|
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH})
|
||||||
|
|
||||||
ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH})
|
ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH})
|
||||||
ENDFOREACH(_ARCH)
|
ENDFOREACH()
|
||||||
ELSE(PCH_ARCHS)
|
ELSE()
|
||||||
PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "")
|
PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "")
|
||||||
LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT})
|
LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT})
|
||||||
|
|
||||||
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}")
|
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}")
|
||||||
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch)
|
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch)
|
||||||
ENDIF(PCH_ARCHS)
|
ENDIF()
|
||||||
|
|
||||||
ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName})
|
ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName})
|
||||||
|
|
||||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}")
|
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}")
|
||||||
ENDMACRO(ADD_PRECOMPILED_HEADER)
|
ENDMACRO()
|
||||||
|
|
||||||
MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||||
IF(NOT PCHSupport_FOUND)
|
IF(NOT PCHSupport_FOUND)
|
||||||
MESSAGE(STATUS "PCH disabled because compiler doesn't support them")
|
MESSAGE(STATUS "PCH disabled because compiler doesn't support them")
|
||||||
RETURN()
|
RETURN()
|
||||||
ENDIF(NOT PCHSupport_FOUND)
|
ENDIF()
|
||||||
|
|
||||||
# 0 => creating a new target for PCH, works for all makefiles
|
# 0 => creating a new target for PCH, works for all makefiles
|
||||||
# 1 => setting PCH for VC++ project, works for VC++ projects
|
# 1 => setting PCH for VC++ project, works for VC++ projects
|
||||||
|
@ -389,9 +392,9 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||||
SET(PCH_METHOD 1)
|
SET(PCH_METHOD 1)
|
||||||
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
|
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
|
||||||
SET(PCH_METHOD 2)
|
SET(PCH_METHOD 2)
|
||||||
ELSE(CMAKE_GENERATOR MATCHES "Visual Studio")
|
ELSE()
|
||||||
SET(PCH_METHOD 0)
|
SET(PCH_METHOD 0)
|
||||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
ENDIF()
|
||||||
|
|
||||||
IF(PCH_METHOD EQUAL 1)
|
IF(PCH_METHOD EQUAL 1)
|
||||||
# Auto include the precompile (useful for moc processing, since the use of
|
# Auto include the precompile (useful for moc processing, since the use of
|
||||||
|
@ -401,7 +404,7 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||||
IF(${oldProps} MATCHES NOTFOUND)
|
IF(${oldProps} MATCHES NOTFOUND)
|
||||||
SET(oldProps "")
|
SET(oldProps "")
|
||||||
ENDIF(${oldProps} MATCHES NOTFOUND)
|
ENDIF()
|
||||||
|
|
||||||
SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"")
|
SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"")
|
||||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
|
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
|
||||||
|
@ -418,12 +421,12 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
|
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
|
||||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
|
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
|
||||||
ELSE(PCH_METHOD EQUAL 1)
|
ELSE()
|
||||||
#Fallback to the "old" precompiled suppport
|
#Fallback to the "old" precompiled suppport
|
||||||
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
|
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
|
||||||
ENDIF(PCH_METHOD EQUAL 1)
|
ENDIF()
|
||||||
|
|
||||||
IF(TARGET ${_targetName}_static)
|
IF(TARGET ${_targetName}_static)
|
||||||
ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp})
|
ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp})
|
||||||
ENDIF(TARGET ${_targetName}_static)
|
ENDIF()
|
||||||
ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
|
ENDMACRO()
|
||||||
|
|
|
@ -102,10 +102,10 @@ ENDMACRO(NL_TARGET_DRIVER)
|
||||||
# Argument:
|
# Argument:
|
||||||
###
|
###
|
||||||
MACRO(NL_DEFAULT_PROPS name label)
|
MACRO(NL_DEFAULT_PROPS name label)
|
||||||
IF(HAVE_REVISION_H)
|
IF(TARGET revision)
|
||||||
# explicitly say that the target depends on revision.h
|
# explicitly say that the target depends on revision.h
|
||||||
ADD_DEPENDENCIES(${name} revision)
|
ADD_DEPENDENCIES(${name} revision)
|
||||||
ENDIF(HAVE_REVISION_H)
|
ENDIF()
|
||||||
|
|
||||||
# Note: This is just a workaround for a CMake bug generating VS10 files with a colon in the project name.
|
# Note: This is just a workaround for a CMake bug generating VS10 files with a colon in the project name.
|
||||||
# CMake Bug ID: http://www.cmake.org/Bug/view.php?id=11819
|
# CMake Bug ID: http://www.cmake.org/Bug/view.php?id=11819
|
||||||
|
@ -375,6 +375,7 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
|
||||||
###
|
###
|
||||||
OPTION(WITH_LUA51 "Build Ryzom Core using Lua 5.1" ON )
|
OPTION(WITH_LUA51 "Build Ryzom Core using Lua 5.1" ON )
|
||||||
OPTION(WITH_LUA52 "Build Ryzom Core using Lua 5.2" OFF)
|
OPTION(WITH_LUA52 "Build Ryzom Core using Lua 5.2" OFF)
|
||||||
|
OPTION(WITH_LUA53 "Build Ryzom Core using Lua 5.3" OFF)
|
||||||
OPTION(WITH_RYZOM_CLIENT_UAC "Ask to run as Administrator" OFF)
|
OPTION(WITH_RYZOM_CLIENT_UAC "Ask to run as Administrator" OFF)
|
||||||
ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
|
ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
|
||||||
|
|
||||||
|
|
|
@ -429,7 +429,7 @@ private:
|
||||||
void resetTouchFlags() {_InternalFlags &= (uint16)(~TouchedAll);}
|
void resetTouchFlags() {_InternalFlags &= (uint16)(~TouchedAll);}
|
||||||
|
|
||||||
// Force non resident memory
|
// Force non resident memory
|
||||||
void restaureNonResidentMemory();
|
void restoreNonResidentMemory();
|
||||||
|
|
||||||
// Convert current index to a serializable vector
|
// Convert current index to a serializable vector
|
||||||
void buildSerialVector(std::vector<uint32> &dest) const;
|
void buildSerialVector(std::vector<uint32> &dest) const;
|
||||||
|
|
|
@ -653,7 +653,7 @@ private:
|
||||||
void resetTouchFlags() {_InternalFlags &= (uint16)(~TouchedAll);}
|
void resetTouchFlags() {_InternalFlags &= (uint16)(~TouchedAll);}
|
||||||
|
|
||||||
// Force non resident memory
|
// Force non resident memory
|
||||||
void restaureNonResidentMemory();
|
void restoreNonResidentMemory();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -151,8 +151,12 @@ namespace NLGUI
|
||||||
// called when keyboard capture has been lost
|
// called when keyboard capture has been lost
|
||||||
virtual void onKeyboardCaptureLost() {}
|
virtual void onKeyboardCaptureLost() {}
|
||||||
|
|
||||||
|
// 'tooltip' property expects string to be ucstring or latin1 which is not possible from html page
|
||||||
|
int luaSetTooltipUtf8(CLuaState &ls);
|
||||||
|
|
||||||
REFLECT_EXPORT_START(CCtrlBase, CViewBase)
|
REFLECT_EXPORT_START(CCtrlBase, CViewBase)
|
||||||
REFLECT_UCSTRING("tooltip", getDefaultContextHelp, setDefaultContextHelp);
|
REFLECT_UCSTRING("tooltip", getDefaultContextHelp, setDefaultContextHelp);
|
||||||
|
REFLECT_LUA_METHOD("setTooltipUtf8", luaSetTooltipUtf8);
|
||||||
REFLECT_EXPORT_END
|
REFLECT_EXPORT_END
|
||||||
|
|
||||||
// special for mouse over : return true and fill the name of the cursor to display
|
// special for mouse over : return true and fill the name of the cursor to display
|
||||||
|
|
|
@ -64,8 +64,10 @@ namespace NLGUI
|
||||||
std::string languageCode;
|
std::string languageCode;
|
||||||
/// List of domains the widget can consider secure.
|
/// List of domains the widget can consider secure.
|
||||||
std::vector< std::string > trustedDomains;
|
std::vector< std::string > trustedDomains;
|
||||||
|
/// Maximum concurrent MultiCurl connections per CGroupHTML instance
|
||||||
|
sint32 curlMaxConnections;
|
||||||
|
|
||||||
SWebOptions()
|
SWebOptions(): curlMaxConnections(2)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -366,7 +368,7 @@ namespace NLGUI
|
||||||
bool _Connecting;
|
bool _Connecting;
|
||||||
double _TimeoutValue; // the timeout in seconds
|
double _TimeoutValue; // the timeout in seconds
|
||||||
double _ConnectingTimeout;
|
double _ConnectingTimeout;
|
||||||
uint32 _RedirectsRemaining;
|
sint _RedirectsRemaining;
|
||||||
|
|
||||||
// minimal embeded lua script support
|
// minimal embeded lua script support
|
||||||
// Note : any embeded script is executed immediately after the closing
|
// Note : any embeded script is executed immediately after the closing
|
||||||
|
|
|
@ -239,6 +239,7 @@ namespace NLGUI
|
||||||
bool isNil(int index = -1);
|
bool isNil(int index = -1);
|
||||||
bool isBoolean(int index = -1);
|
bool isBoolean(int index = -1);
|
||||||
bool isNumber(int index = -1);
|
bool isNumber(int index = -1);
|
||||||
|
bool isInteger(int index = -1);
|
||||||
bool isString(int index = -1);
|
bool isString(int index = -1);
|
||||||
bool isTable(int index = -1);
|
bool isTable(int index = -1);
|
||||||
bool isFunction(int index = -1);
|
bool isFunction(int index = -1);
|
||||||
|
@ -248,6 +249,7 @@ namespace NLGUI
|
||||||
// converting then getting a value from the stack
|
// converting then getting a value from the stack
|
||||||
bool toBoolean(int index = -1);
|
bool toBoolean(int index = -1);
|
||||||
lua_Number toNumber(int index = -1);
|
lua_Number toNumber(int index = -1);
|
||||||
|
lua_Integer toInteger(int index = -1);
|
||||||
const char *toString(int index = -1);
|
const char *toString(int index = -1);
|
||||||
void toString(int index, std::string &str); // convert to a std::string, with a NULL check.
|
void toString(int index, std::string &str); // convert to a std::string, with a NULL check.
|
||||||
size_t strlen(int index = -1);
|
size_t strlen(int index = -1);
|
||||||
|
@ -259,11 +261,21 @@ namespace NLGUI
|
||||||
* If conversion fails then an exception is thrown (with optional msg)
|
* If conversion fails then an exception is thrown (with optional msg)
|
||||||
*/
|
*/
|
||||||
bool getTableBooleanValue(const char *name, bool defaultValue= false);
|
bool getTableBooleanValue(const char *name, bool defaultValue= false);
|
||||||
double getTableNumberValue(const char *name, double defaultValue= 0);
|
double getTableNumberValue(const char *name, double defaultValue= 0.0);
|
||||||
|
sint64 getTableIntegerValue(const char *name, sint64 defaultValue= 0);
|
||||||
const char *getTableStringValue(const char *name, const char *defaultValue= NULL);
|
const char *getTableStringValue(const char *name, const char *defaultValue= NULL);
|
||||||
// pushing value onto the stack
|
// pushing value onto the stack
|
||||||
void push(bool value);
|
void push(bool value);
|
||||||
void push(lua_Number value);
|
void push(float value);
|
||||||
|
void push(double value);
|
||||||
|
void push(uint8 value);
|
||||||
|
void push(uint16 value);
|
||||||
|
void push(uint32 value);
|
||||||
|
void push(uint64 value);
|
||||||
|
void push(sint8 value);
|
||||||
|
void push(sint16 value);
|
||||||
|
void push(sint32 value);
|
||||||
|
void push(sint64 value);
|
||||||
void push(const char *str);
|
void push(const char *str);
|
||||||
void push(const char *str, int length);
|
void push(const char *str, int length);
|
||||||
void push(const std::string &str);
|
void push(const std::string &str);
|
||||||
|
|
|
@ -172,6 +172,18 @@ inline bool CLuaState::isNumber(int index)
|
||||||
return lua_isnumber(_State, index) != 0;
|
return lua_isnumber(_State, index) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline bool CLuaState::isInteger(int index)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_isInteger)
|
||||||
|
checkIndex(index);
|
||||||
|
#if LUA_VERSION_NUM >= 503
|
||||||
|
return lua_isinteger(_State, index) != 0;
|
||||||
|
#else
|
||||||
|
return lua_isnumber(_State, index) != 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
inline bool CLuaState::isString(int index)
|
inline bool CLuaState::isString(int index)
|
||||||
{
|
{
|
||||||
|
@ -236,6 +248,14 @@ inline lua_Number CLuaState::toNumber(int index)
|
||||||
return lua_tonumber(_State, index);
|
return lua_tonumber(_State, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline lua_Integer CLuaState::toInteger(int index)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_toInteger)
|
||||||
|
checkIndex(index);
|
||||||
|
return lua_tointeger(_State, index);
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
inline const char *CLuaState::toString(int index)
|
inline const char *CLuaState::toString(int index)
|
||||||
{
|
{
|
||||||
|
@ -302,11 +322,83 @@ inline void CLuaState::push(bool value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
inline void CLuaState::push(lua_Number value)
|
inline void CLuaState::push(float value)
|
||||||
{
|
{
|
||||||
//H_AUTO(Lua_CLuaState_push)
|
//H_AUTO(Lua_CLuaState_push)
|
||||||
nlverify( lua_checkstack(_State, 1) );
|
nlverify( lua_checkstack(_State, 1) );
|
||||||
lua_pushnumber(_State, value);
|
lua_pushnumber(_State, (lua_Number)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline void CLuaState::push(double value)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_push)
|
||||||
|
nlverify( lua_checkstack(_State, 1) );
|
||||||
|
lua_pushnumber(_State, (lua_Number)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline void CLuaState::push(uint8 value)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_push)
|
||||||
|
nlverify( lua_checkstack(_State, 1) );
|
||||||
|
lua_pushinteger(_State, (lua_Integer)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline void CLuaState::push(uint16 value)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_push)
|
||||||
|
nlverify( lua_checkstack(_State, 1) );
|
||||||
|
lua_pushinteger(_State, (lua_Integer)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline void CLuaState::push(uint32 value)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_push)
|
||||||
|
nlverify( lua_checkstack(_State, 1) );
|
||||||
|
lua_pushinteger(_State, (lua_Integer)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline void CLuaState::push(uint64 value)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_push)
|
||||||
|
nlverify( lua_checkstack(_State, 1) );
|
||||||
|
lua_pushinteger(_State, (lua_Integer)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline void CLuaState::push(sint8 value)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_push)
|
||||||
|
nlverify( lua_checkstack(_State, 1) );
|
||||||
|
lua_pushinteger(_State, (lua_Integer)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline void CLuaState::push(sint16 value)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_push)
|
||||||
|
nlverify( lua_checkstack(_State, 1) );
|
||||||
|
lua_pushinteger(_State, (lua_Integer)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline void CLuaState::push(sint32 value)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_push)
|
||||||
|
nlverify( lua_checkstack(_State, 1) );
|
||||||
|
lua_pushinteger(_State, (lua_Integer)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
inline void CLuaState::push(sint64 value)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_push)
|
||||||
|
nlverify( lua_checkstack(_State, 1) );
|
||||||
|
lua_pushinteger(_State, (lua_Integer)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
|
@ -31,8 +31,8 @@ namespace NLGUI
|
||||||
class CLuaManager
|
class CLuaManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~CLuaManager();
|
|
||||||
|
|
||||||
|
/// Get or create singleton
|
||||||
static CLuaManager& getInstance()
|
static CLuaManager& getInstance()
|
||||||
{
|
{
|
||||||
if( instance == NULL )
|
if( instance == NULL )
|
||||||
|
@ -42,6 +42,9 @@ namespace NLGUI
|
||||||
return *instance;
|
return *instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Release singleton
|
||||||
|
static void releaseInstance();
|
||||||
|
|
||||||
/// Enables attaching the Lua debugger in the CLuaState instance, only matters on startup.
|
/// Enables attaching the Lua debugger in the CLuaState instance, only matters on startup.
|
||||||
static void enableLuaDebugging(){ debugLua = true; }
|
static void enableLuaDebugging(){ debugLua = true; }
|
||||||
|
|
||||||
|
@ -65,6 +68,7 @@ namespace NLGUI
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CLuaManager();
|
CLuaManager();
|
||||||
|
~CLuaManager();
|
||||||
|
|
||||||
static CLuaManager *instance;
|
static CLuaManager *instance;
|
||||||
static bool debugLua;
|
static bool debugLua;
|
||||||
|
|
|
@ -80,6 +80,7 @@ namespace NLGUI
|
||||||
const char *getTypename() const;
|
const char *getTypename() const;
|
||||||
bool isNil() const;
|
bool isNil() const;
|
||||||
bool isNumber() const;
|
bool isNumber() const;
|
||||||
|
bool isInteger() const;
|
||||||
bool isBoolean() const;
|
bool isBoolean() const;
|
||||||
bool isString() const;
|
bool isString() const;
|
||||||
bool isFunction() const;
|
bool isFunction() const;
|
||||||
|
@ -94,6 +95,7 @@ namespace NLGUI
|
||||||
NLMISC::CRGBA toRGBA() const; // default to black if not a crgba
|
NLMISC::CRGBA toRGBA() const; // default to black if not a crgba
|
||||||
bool toBoolean() const;
|
bool toBoolean() const;
|
||||||
lua_Number toNumber() const;
|
lua_Number toNumber() const;
|
||||||
|
lua_Integer toInteger() const;
|
||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
lua_CFunction toCFunction() const;
|
lua_CFunction toCFunction() const;
|
||||||
void *toUserData() const;
|
void *toUserData() const;
|
||||||
|
@ -102,6 +104,8 @@ namespace NLGUI
|
||||||
operator bool() const;
|
operator bool() const;
|
||||||
operator float() const;
|
operator float() const;
|
||||||
operator double() const;
|
operator double() const;
|
||||||
|
operator sint32() const;
|
||||||
|
operator sint64() const;
|
||||||
operator std::string() const;
|
operator std::string() const;
|
||||||
/** create a sub table for this object, with a string as a key
|
/** create a sub table for this object, with a string as a key
|
||||||
* This object must be a table or an exception if thrown
|
* This object must be a table or an exception if thrown
|
||||||
|
@ -121,6 +125,9 @@ namespace NLGUI
|
||||||
void setValue(const char *key, bool 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, TLuaWrappedFunction value) throw(ELuaNotATable);
|
||||||
void setValue(const char *key, double 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 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 char *key) throw(ELuaNotATable);
|
||||||
void setNil(const std::string &key) throw(ELuaNotATable) { setNil(key.c_str()); }
|
void setNil(const std::string &key) throw(ELuaNotATable) { setNil(key.c_str()); }
|
||||||
|
|
|
@ -569,7 +569,7 @@ namespace NLGUI
|
||||||
std::vector< CInterfaceGroup* > _GroupsUnderPointer;
|
std::vector< CInterfaceGroup* > _GroupsUnderPointer;
|
||||||
|
|
||||||
// view that should be notified from clock msg
|
// view that should be notified from clock msg
|
||||||
std::vector<CCtrlBase*> _ClockMsgTargets;
|
std::list<CCtrlBase*> _ClockMsgTargets;
|
||||||
|
|
||||||
NLMISC::CRGBA _GlobalColor;
|
NLMISC::CRGBA _GlobalColor;
|
||||||
NLMISC::CRGBA _GlobalColorForContent;
|
NLMISC::CRGBA _GlobalColorForContent;
|
||||||
|
|
|
@ -44,6 +44,7 @@ const uint32 DDS_HEADER = NL_MAKEFOURCC('D', 'D', 'S', ' ');
|
||||||
const uint32 DXT_HEADER = NL_MAKEFOURCC('D', 'X', 'T', '\0');
|
const uint32 DXT_HEADER = NL_MAKEFOURCC('D', 'X', 'T', '\0');
|
||||||
const uint32 PNG_HEADER = NL_MAKEFOURCC(0x89, 'P', 'N', 'G');
|
const uint32 PNG_HEADER = NL_MAKEFOURCC(0x89, 'P', 'N', 'G');
|
||||||
const uint32 JPG_HEADER = NL_MAKEFOURCC(0xff, 0xd8, 0xff, 0xe0);
|
const uint32 JPG_HEADER = NL_MAKEFOURCC(0xff, 0xd8, 0xff, 0xe0);
|
||||||
|
const uint32 GIF_HEADER = NL_MAKEFOURCC('G', 'I', 'F', '8');
|
||||||
|
|
||||||
|
|
||||||
// dwLinearSize is valid
|
// dwLinearSize is valid
|
||||||
|
@ -132,6 +133,15 @@ private :
|
||||||
uint8 readJPG( NLMISC::IStream &f );
|
uint8 readJPG( NLMISC::IStream &f );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read a GIF from an IStream.
|
||||||
|
* GIF pictures are all converted to 32bit
|
||||||
|
* \param f IStream (must be a reading stream)
|
||||||
|
* \return image depth if succeed, 0 else
|
||||||
|
*/
|
||||||
|
uint8 readGIF( NLMISC::IStream &f );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change bitmap format
|
* Change bitmap format
|
||||||
*
|
*
|
||||||
|
|
|
@ -104,6 +104,11 @@ public:
|
||||||
*/
|
*/
|
||||||
static const std::vector<std::string> &getLanguageCodes();
|
static const std::vector<std::string> &getLanguageCodes();
|
||||||
|
|
||||||
|
/** Check if a language code is supported.
|
||||||
|
* Code are ISO 639-2 compliant.
|
||||||
|
*/
|
||||||
|
static bool isLanguageCodeSupported(const std::string &lang);
|
||||||
|
|
||||||
/// Load a language file depending of the language code("en", "fr", ...). Code are ISO 639-2 compliant.
|
/// Load a language file depending of the language code("en", "fr", ...). Code are ISO 639-2 compliant.
|
||||||
static void load (const std::string &languageCode, const std::string &fallbackLanguageCode="");
|
static void load (const std::string &languageCode, const std::string &fallbackLanguageCode="");
|
||||||
|
|
||||||
|
@ -119,6 +124,9 @@ public:
|
||||||
/// Returns the code of the language ("fr", "en", ...)
|
/// Returns the code of the language ("fr", "en", ...)
|
||||||
static std::string getCurrentLanguageCode ();
|
static std::string getCurrentLanguageCode ();
|
||||||
|
|
||||||
|
/// Returns the code of the language ("fr", "en", ...) defined on system
|
||||||
|
static std::string getSystemLanguageCode ();
|
||||||
|
|
||||||
/// Find a string in the selected language and return his association.
|
/// Find a string in the selected language and return his association.
|
||||||
static const ucstring &get (const std::string &label);
|
static const ucstring &get (const std::string &label);
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ void CCloud::generate (CNoise3d &noise)
|
||||||
_Driver->activeVertexBuffer (rVB);
|
_Driver->activeVertexBuffer (rVB);
|
||||||
_Driver->renderRawQuads (_CloudTexClamp->ToClamp, 0, 1);
|
_Driver->renderRawQuads (_CloudTexClamp->ToClamp, 0, 1);
|
||||||
|
|
||||||
// Restaure render target
|
// Restore render target
|
||||||
_Driver->setRenderTarget (NULL);
|
_Driver->setRenderTarget (NULL);
|
||||||
|
|
||||||
_CloudTexTmp->Tex->setFilterMode (ITexture::Nearest, ITexture::NearestMipMapOff);
|
_CloudTexTmp->Tex->setFilterMode (ITexture::Nearest, ITexture::NearestMipMapOff);
|
||||||
|
@ -685,7 +685,7 @@ void CCloud::genBill (CCamera *pCam, uint32 nBillSize)
|
||||||
|
|
||||||
dispXYZ (&_CloudTexTmp->ToBill);
|
dispXYZ (&_CloudTexTmp->ToBill);
|
||||||
|
|
||||||
// Restaure render target
|
// Restore render target
|
||||||
_Driver->setRenderTarget (NULL);
|
_Driver->setRenderTarget (NULL);
|
||||||
|
|
||||||
// This is the end of render to texture like so reset all stuff
|
// This is the end of render to texture like so reset all stuff
|
||||||
|
|
|
@ -1912,7 +1912,7 @@ bool CDriverD3D::clear2D(CRGBA rgba)
|
||||||
|
|
||||||
bool result = _DeviceInterface->Clear( 0, NULL, D3DCLEAR_TARGET, NL_D3DCOLOR_RGBA(rgba), 1.0f, 0 ) == D3D_OK;
|
bool result = _DeviceInterface->Clear( 0, NULL, D3DCLEAR_TARGET, NL_D3DCOLOR_RGBA(rgba), 1.0f, 0 ) == D3D_OK;
|
||||||
|
|
||||||
// Restaure the old viewport
|
// Restore the old viewport
|
||||||
setupViewport (oldViewport);
|
setupViewport (oldViewport);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1931,7 +1931,7 @@ bool CDriverD3D::clearZBuffer(float zval)
|
||||||
|
|
||||||
bool result = _DeviceInterface->Clear( 0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0,0,0,0), zval, 0 ) == D3D_OK;
|
bool result = _DeviceInterface->Clear( 0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_ARGB(0,0,0,0), zval, 0 ) == D3D_OK;
|
||||||
|
|
||||||
// Restaure the old viewport
|
// Restore the old viewport
|
||||||
setupViewport (oldViewport);
|
setupViewport (oldViewport);
|
||||||
|
|
||||||
// NVidia driver 56.72 needs to reset the vertex buffer after a clear Z
|
// NVidia driver 56.72 needs to reset the vertex buffer after a clear Z
|
||||||
|
@ -1954,7 +1954,7 @@ bool CDriverD3D::clearStencilBuffer(float stencilval)
|
||||||
|
|
||||||
bool result = _DeviceInterface->Clear( 0, NULL, D3DCLEAR_STENCIL, D3DCOLOR_ARGB(0,0,0,0), 1.0f, (unsigned long)stencilval ) == D3D_OK;
|
bool result = _DeviceInterface->Clear( 0, NULL, D3DCLEAR_STENCIL, D3DCOLOR_ARGB(0,0,0,0), 1.0f, (unsigned long)stencilval ) == D3D_OK;
|
||||||
|
|
||||||
// Restaure the old viewport
|
// Restore the old viewport
|
||||||
setupViewport (oldViewport);
|
setupViewport (oldViewport);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -2526,7 +2526,7 @@ bool CDriverD3D::reset (const GfxMode& mode)
|
||||||
_CurrentMaterial = NULL;
|
_CurrentMaterial = NULL;
|
||||||
_CurrentMaterialInfo = NULL;
|
_CurrentMaterialInfo = NULL;
|
||||||
|
|
||||||
// Restaure non managed vertex buffer in system memory
|
// Restore non managed vertex buffer in system memory
|
||||||
ItVBDrvInfoPtrList iteVb = _VBDrvInfos.begin();
|
ItVBDrvInfoPtrList iteVb = _VBDrvInfos.begin();
|
||||||
while (iteVb != _VBDrvInfos.end())
|
while (iteVb != _VBDrvInfos.end())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
LIBRARY nel_drv_direct3d_win_r
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
NL3D_createIDriverInstance
|
NL3D_createIDriverInstance
|
||||||
NL3D_interfaceVersion
|
NL3D_interfaceVersion
|
|
@ -49,7 +49,7 @@ uint indexCount=0;
|
||||||
CIBDrvInfosD3D::~CIBDrvInfosD3D()
|
CIBDrvInfosD3D::~CIBDrvInfosD3D()
|
||||||
{
|
{
|
||||||
H_AUTO_D3D(CIBDrvInfosD3D_CIBDrvInfosD3DDtor);
|
H_AUTO_D3D(CIBDrvInfosD3D_CIBDrvInfosD3DDtor);
|
||||||
// Restaure non resident memory
|
// Restore non resident memory
|
||||||
if (IndexBufferPtr)
|
if (IndexBufferPtr)
|
||||||
{
|
{
|
||||||
IndexBufferPtr->setLocation(CIndexBuffer::NotResident);
|
IndexBufferPtr->setLocation(CIndexBuffer::NotResident);
|
||||||
|
|
|
@ -818,7 +818,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
|
||||||
if (_CurrentMaterial != &mat)
|
if (_CurrentMaterial != &mat)
|
||||||
{
|
{
|
||||||
// Material has changed ?
|
// Material has changed ?
|
||||||
// Restaure fog state to its current value
|
// Restore fog state to its current value
|
||||||
{
|
{
|
||||||
H_AUTO_D3D(CDriverD3D_setupMaterial_updateFog)
|
H_AUTO_D3D(CDriverD3D_setupMaterial_updateFog)
|
||||||
setRenderState (D3DRS_FOGENABLE, _FogEnabled?TRUE:FALSE);
|
setRenderState (D3DRS_FOGENABLE, _FogEnabled?TRUE:FALSE);
|
||||||
|
|
|
@ -63,7 +63,7 @@ CVBDrvInfosD3D::~CVBDrvInfosD3D()
|
||||||
{
|
{
|
||||||
H_AUTO_D3D(CVBDrvInfosD3D_CVBDrvInfosD3D)
|
H_AUTO_D3D(CVBDrvInfosD3D_CVBDrvInfosD3D)
|
||||||
CDriverD3D *driver = static_cast<CDriverD3D*>(_Driver);
|
CDriverD3D *driver = static_cast<CDriverD3D*>(_Driver);
|
||||||
// Restaure non resident memory
|
// Restore non resident memory
|
||||||
if (VertexBufferPtr)
|
if (VertexBufferPtr)
|
||||||
{
|
{
|
||||||
VertexBufferPtr->setLocation(CVertexBuffer::NotResident);
|
VertexBufferPtr->setLocation(CVertexBuffer::NotResident);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,7 +6,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Copyright (c) 2013-2014 The Khronos Group Inc.
|
** Copyright (c) 2013-2015 The Khronos Group Inc.
|
||||||
**
|
**
|
||||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
** copy of this software and/or associated documentation files (the
|
** copy of this software and/or associated documentation files (the
|
||||||
|
@ -33,10 +33,10 @@ extern "C" {
|
||||||
** used to make the header, and the header can be found at
|
** used to make the header, and the header can be found at
|
||||||
** http://www.opengl.org/registry/
|
** http://www.opengl.org/registry/
|
||||||
**
|
**
|
||||||
** Khronos $Revision: 26290 $ on $Date: 2014-04-16 05:35:38 -0700 (Wed, 16 Apr 2014) $
|
** Khronos $Revision: 31597 $ on $Date: 2015-06-25 16:32:35 -0400 (Thu, 25 Jun 2015) $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define GLX_GLXEXT_VERSION 20140416
|
#define GLX_GLXEXT_VERSION 20150623
|
||||||
|
|
||||||
/* Generated C header for:
|
/* Generated C header for:
|
||||||
* API: glx
|
* API: glx
|
||||||
|
@ -158,6 +158,13 @@ __GLXextFuncPtr glXGetProcAddress (const GLubyte *procName);
|
||||||
#endif
|
#endif
|
||||||
#endif /* GLX_VERSION_1_4 */
|
#endif /* GLX_VERSION_1_4 */
|
||||||
|
|
||||||
|
#ifndef GLX_ARB_context_flush_control
|
||||||
|
#define GLX_ARB_context_flush_control 1
|
||||||
|
#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
|
||||||
|
#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
|
||||||
|
#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
|
||||||
|
#endif /* GLX_ARB_context_flush_control */
|
||||||
|
|
||||||
#ifndef GLX_ARB_create_context
|
#ifndef GLX_ARB_create_context
|
||||||
#define GLX_ARB_create_context 1
|
#define GLX_ARB_create_context 1
|
||||||
#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||||
|
@ -243,6 +250,26 @@ __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);
|
||||||
#define GLX_GPU_NUM_SIMD_AMD 0x21A6
|
#define GLX_GPU_NUM_SIMD_AMD 0x21A6
|
||||||
#define GLX_GPU_NUM_RB_AMD 0x21A7
|
#define GLX_GPU_NUM_RB_AMD 0x21A7
|
||||||
#define GLX_GPU_NUM_SPI_AMD 0x21A8
|
#define GLX_GPU_NUM_SPI_AMD 0x21A8
|
||||||
|
typedef unsigned int ( *PFNGLXGETGPUIDSAMDPROC) (unsigned int maxCount, unsigned int *ids);
|
||||||
|
typedef int ( *PFNGLXGETGPUINFOAMDPROC) (unsigned int id, int property, GLenum dataType, unsigned int size, void *data);
|
||||||
|
typedef unsigned int ( *PFNGLXGETCONTEXTGPUIDAMDPROC) (GLXContext ctx);
|
||||||
|
typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC) (unsigned int id, GLXContext share_list);
|
||||||
|
typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (unsigned int id, GLXContext share_context, const int *attribList);
|
||||||
|
typedef Bool ( *PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC) (GLXContext ctx);
|
||||||
|
typedef Bool ( *PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (GLXContext ctx);
|
||||||
|
typedef GLXContext ( *PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
|
||||||
|
typedef void ( *PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC) (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||||
|
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||||
|
unsigned int glXGetGPUIDsAMD (unsigned int maxCount, unsigned int *ids);
|
||||||
|
int glXGetGPUInfoAMD (unsigned int id, int property, GLenum dataType, unsigned int size, void *data);
|
||||||
|
unsigned int glXGetContextGPUIDAMD (GLXContext ctx);
|
||||||
|
GLXContext glXCreateAssociatedContextAMD (unsigned int id, GLXContext share_list);
|
||||||
|
GLXContext glXCreateAssociatedContextAttribsAMD (unsigned int id, GLXContext share_context, const int *attribList);
|
||||||
|
Bool glXDeleteAssociatedContextAMD (GLXContext ctx);
|
||||||
|
Bool glXMakeAssociatedContextCurrentAMD (GLXContext ctx);
|
||||||
|
GLXContext glXGetCurrentAssociatedContextAMD (void);
|
||||||
|
void glXBlitContextFramebufferAMD (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||||
|
#endif
|
||||||
#endif /* GLX_AMD_gpu_association */
|
#endif /* GLX_AMD_gpu_association */
|
||||||
|
|
||||||
#ifndef GLX_EXT_buffer_age
|
#ifndef GLX_EXT_buffer_age
|
||||||
|
@ -468,6 +495,16 @@ Bool glXSet3DfxModeMESA (int mode);
|
||||||
#endif
|
#endif
|
||||||
#endif /* GLX_MESA_set_3dfx_mode */
|
#endif /* GLX_MESA_set_3dfx_mode */
|
||||||
|
|
||||||
|
#ifndef GLX_NV_copy_buffer
|
||||||
|
#define GLX_NV_copy_buffer 1
|
||||||
|
typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
|
||||||
|
typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
|
||||||
|
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||||
|
void glXCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
|
||||||
|
void glXNamedCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
|
||||||
|
#endif
|
||||||
|
#endif /* GLX_NV_copy_buffer */
|
||||||
|
|
||||||
#ifndef GLX_NV_copy_image
|
#ifndef GLX_NV_copy_image
|
||||||
#define GLX_NV_copy_image 1
|
#define GLX_NV_copy_image 1
|
||||||
typedef void ( *PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
typedef void ( *PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||||
|
@ -544,8 +581,8 @@ void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV devic
|
||||||
#endif
|
#endif
|
||||||
#endif /* GLX_NV_video_capture */
|
#endif /* GLX_NV_video_capture */
|
||||||
|
|
||||||
#ifndef GLX_NV_video_output
|
#ifndef GLX_NV_video_out
|
||||||
#define GLX_NV_video_output 1
|
#define GLX_NV_video_out 1
|
||||||
typedef unsigned int GLXVideoDeviceNV;
|
typedef unsigned int GLXVideoDeviceNV;
|
||||||
#define GLX_VIDEO_OUT_COLOR_NV 0x20C3
|
#define GLX_VIDEO_OUT_COLOR_NV 0x20C3
|
||||||
#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4
|
#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4
|
||||||
|
@ -571,7 +608,7 @@ int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf);
|
||||||
int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
|
int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
|
||||||
int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||||
#endif
|
#endif
|
||||||
#endif /* GLX_NV_video_output */
|
#endif /* GLX_NV_video_out */
|
||||||
|
|
||||||
#ifndef GLX_OML_swap_method
|
#ifndef GLX_OML_swap_method
|
||||||
#define GLX_OML_swap_method 1
|
#define GLX_OML_swap_method 1
|
||||||
|
|
|
@ -6,7 +6,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Copyright (c) 2013-2014 The Khronos Group Inc.
|
** Copyright (c) 2013-2015 The Khronos Group Inc.
|
||||||
**
|
**
|
||||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
** copy of this software and/or associated documentation files (the
|
** copy of this software and/or associated documentation files (the
|
||||||
|
@ -33,7 +33,7 @@ extern "C" {
|
||||||
** used to make the header, and the header can be found at
|
** used to make the header, and the header can be found at
|
||||||
** http://www.opengl.org/registry/
|
** http://www.opengl.org/registry/
|
||||||
**
|
**
|
||||||
** Khronos $Revision: 26290 $ on $Date: 2014-04-16 05:35:38 -0700 (Wed, 16 Apr 2014) $
|
** Khronos $Revision: 31597 $ on $Date: 2015-06-25 16:32:35 -0400 (Thu, 25 Jun 2015) $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||||
|
@ -41,7 +41,7 @@ extern "C" {
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define WGL_WGLEXT_VERSION 20140416
|
#define WGL_WGLEXT_VERSION 20150623
|
||||||
|
|
||||||
/* Generated C header for:
|
/* Generated C header for:
|
||||||
* API: wgl
|
* API: wgl
|
||||||
|
@ -70,6 +70,13 @@ BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width,
|
||||||
#endif
|
#endif
|
||||||
#endif /* WGL_ARB_buffer_region */
|
#endif /* WGL_ARB_buffer_region */
|
||||||
|
|
||||||
|
#ifndef WGL_ARB_context_flush_control
|
||||||
|
#define WGL_ARB_context_flush_control 1
|
||||||
|
#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
|
||||||
|
#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
|
||||||
|
#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
|
||||||
|
#endif /* WGL_ARB_context_flush_control */
|
||||||
|
|
||||||
#ifndef WGL_ARB_create_context
|
#ifndef WGL_ARB_create_context
|
||||||
#define WGL_ARB_create_context 1
|
#define WGL_ARB_create_context 1
|
||||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||||
|
|
|
@ -234,7 +234,7 @@ CDriverGL::CDriverGL()
|
||||||
_CursorScale = 1.f;
|
_CursorScale = 1.f;
|
||||||
_MouseCaptured = false;
|
_MouseCaptured = false;
|
||||||
|
|
||||||
_NeedToRestaureGammaRamp = false;
|
_NeedToRestoreGammaRamp = false;
|
||||||
|
|
||||||
_win = EmptyWindow;
|
_win = EmptyWindow;
|
||||||
_WindowX = 0;
|
_WindowX = 0;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
LIBRARY nel_drv_opengl_win_r
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
NL3D_createIDriverInstance
|
NL3D_createIDriverInstance
|
||||||
NL3D_interfaceVersion
|
NL3D_interfaceVersion
|
|
@ -1558,7 +1558,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
// Monitor color parameters backup
|
// Monitor color parameters backup
|
||||||
bool _NeedToRestaureGammaRamp;
|
bool _NeedToRestoreGammaRamp;
|
||||||
uint16 _GammaRampBackuped[3*256];
|
uint16 _GammaRampBackuped[3*256];
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -519,6 +519,14 @@ PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC nwglMakeAssociatedContextCurrentAMD;
|
||||||
PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD;
|
PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD;
|
||||||
PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC nwglBlitContextFramebufferAMD;
|
PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC nwglBlitContextFramebufferAMD;
|
||||||
|
|
||||||
|
// WGL_NV_gpu_affinity
|
||||||
|
//====================
|
||||||
|
PFNWGLENUMGPUSNVPROC nwglEnumGpusNV;
|
||||||
|
PFNWGLENUMGPUDEVICESNVPROC nwglEnumGpuDevicesNV;
|
||||||
|
PFNWGLCREATEAFFINITYDCNVPROC nwglCreateAffinityDCNV;
|
||||||
|
PFNWGLENUMGPUSFROMAFFINITYDCNVPROC nwglEnumGpusFromAffinityDCNV;
|
||||||
|
PFNWGLDELETEDCNVPROC nwglDeleteDCNV;
|
||||||
|
|
||||||
#elif defined(NL_OS_MAC)
|
#elif defined(NL_OS_MAC)
|
||||||
#elif defined(NL_OS_UNIX)
|
#elif defined(NL_OS_UNIX)
|
||||||
|
|
||||||
|
@ -1553,12 +1561,20 @@ static bool setupATIMeminfo(const char *glext)
|
||||||
void registerGlExtensions(CGlExtensions &ext)
|
void registerGlExtensions(CGlExtensions &ext)
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(registerGlExtensions);
|
H_AUTO_OGL(registerGlExtensions);
|
||||||
|
|
||||||
// OpenGL 1.2 ??
|
// OpenGL 1.2 ??
|
||||||
const char *nglVersion= (const char *)glGetString (GL_VERSION);
|
const char *nglVersion= (const char *)glGetString (GL_VERSION);
|
||||||
sint a=0, b=0;
|
sint a=0, b=0;
|
||||||
|
|
||||||
// 1.2*** ???
|
// 1.2*** ???
|
||||||
sscanf(nglVersion, "%d.%d", &a, &b);
|
sscanf(nglVersion, "%d.%d", &a, &b);
|
||||||
ext.Version1_2= (a==1 && b>=2) || (a>=2);
|
ext.Version1_2 = (a==1 && b>=2) || (a>=2);
|
||||||
|
|
||||||
|
const char *vendor = (const char *) glGetString (GL_VENDOR);
|
||||||
|
const char *renderer = (const char *) glGetString (GL_RENDERER);
|
||||||
|
|
||||||
|
// Log GPU details
|
||||||
|
nlinfo("3D: OpenGL %s / %s / %s", nglVersion, vendor, renderer);
|
||||||
|
|
||||||
// Extensions.
|
// Extensions.
|
||||||
const char *glext= (const char*)glGetString(GL_EXTENSIONS);
|
const char *glext= (const char*)glGetString(GL_EXTENSIONS);
|
||||||
|
@ -1777,17 +1793,30 @@ void registerGlExtensions(CGlExtensions &ext)
|
||||||
|
|
||||||
if (ext.NVXGPUMemoryInfo)
|
if (ext.NVXGPUMemoryInfo)
|
||||||
{
|
{
|
||||||
// GPU_MEMORY_INFO_EVICTION_COUNT_NVX;
|
GLint nEvictionCount = 0;
|
||||||
// GPU_MEMORY_INFO_EVICTED_MEMORY_NVX;
|
#ifdef GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX
|
||||||
|
glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX, &nEvictionCount);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
GLint nEvictionMemory = 0;
|
||||||
|
#ifdef GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX
|
||||||
|
glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX, &nEvictionMemory);
|
||||||
|
#endif
|
||||||
|
|
||||||
GLint nDedicatedMemoryInKB = 0;
|
GLint nDedicatedMemoryInKB = 0;
|
||||||
|
#ifdef GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX
|
||||||
glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &nDedicatedMemoryInKB);
|
glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &nDedicatedMemoryInKB);
|
||||||
|
#endif
|
||||||
|
|
||||||
GLint nTotalMemoryInKB = 0;
|
GLint nTotalMemoryInKB = 0;
|
||||||
|
#ifdef GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX
|
||||||
glGetIntegerv(GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &nTotalMemoryInKB);
|
glGetIntegerv(GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &nTotalMemoryInKB);
|
||||||
|
#endif
|
||||||
|
|
||||||
GLint nCurAvailMemoryInKB = 0;
|
GLint nCurAvailMemoryInKB = 0;
|
||||||
|
#ifdef GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX
|
||||||
glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &nCurAvailMemoryInKB);
|
glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &nCurAvailMemoryInKB);
|
||||||
|
#endif
|
||||||
|
|
||||||
nlinfo("Memory: total: %d available: %d dedicated: %d", nTotalMemoryInKB, nCurAvailMemoryInKB, nDedicatedMemoryInKB);
|
nlinfo("Memory: total: %d available: %d dedicated: %d", nTotalMemoryInKB, nCurAvailMemoryInKB, nDedicatedMemoryInKB);
|
||||||
}
|
}
|
||||||
|
@ -1840,7 +1869,23 @@ static bool setupWGLAMDGPUAssociation(const char *glext)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// *********************************
|
// ***************************************************************************
|
||||||
|
static bool setupWGLNVGPUAssociation(const char *glext)
|
||||||
|
{
|
||||||
|
H_AUTO_OGL(setupWGLNVGPUAssociation);
|
||||||
|
CHECK_EXT("WGL_NV_gpu_affinity");
|
||||||
|
|
||||||
|
#if !defined(USE_OPENGLES) && defined(NL_OS_WINDOWS)
|
||||||
|
CHECK_ADDRESS(PFNWGLENUMGPUSNVPROC, wglEnumGpusNV);
|
||||||
|
CHECK_ADDRESS(PFNWGLENUMGPUDEVICESNVPROC, wglEnumGpuDevicesNV);
|
||||||
|
CHECK_ADDRESS(PFNWGLCREATEAFFINITYDCNVPROC, wglCreateAffinityDCNV);
|
||||||
|
CHECK_ADDRESS(PFNWGLENUMGPUSFROMAFFINITYDCNVPROC, wglEnumGpusFromAffinityDCNV);
|
||||||
|
CHECK_ADDRESS(PFNWGLDELETEDCNVPROC, wglDeleteDCNV);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool setupGLXEXTSwapControl(const char *glext)
|
static bool setupGLXEXTSwapControl(const char *glext)
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(setupGLXEXTSwapControl);
|
H_AUTO_OGL(setupGLXEXTSwapControl);
|
||||||
|
@ -1966,6 +2011,31 @@ bool registerWGlExtensions(CGlExtensions &ext, HDC hDC)
|
||||||
delete [] uGPUIDs;
|
delete [] uGPUIDs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ext.WGLNVGPUAffinity = setupWGLNVGPUAssociation(glext);
|
||||||
|
|
||||||
|
if (ext.WGLNVGPUAffinity)
|
||||||
|
{
|
||||||
|
uint i = 0;
|
||||||
|
|
||||||
|
HGPUNV hGPU;
|
||||||
|
|
||||||
|
while(nwglEnumGpusNV(i, &hGPU))
|
||||||
|
{
|
||||||
|
uint j = 0;
|
||||||
|
|
||||||
|
PGPU_DEVICE lpGpuDevice = NULL;
|
||||||
|
|
||||||
|
while(nwglEnumGpuDevicesNV(hGPU, j, lpGpuDevice))
|
||||||
|
{
|
||||||
|
nlinfo("Device: %s - %s - flags: %u", lpGpuDevice->DeviceName, lpGpuDevice->DeviceString, lpGpuDevice->Flags);
|
||||||
|
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#elif defined(NL_OS_MAC)
|
#elif defined(NL_OS_MAC)
|
||||||
|
|
|
@ -123,6 +123,9 @@ struct CGlExtensions
|
||||||
// WGL_AMD_gpu_association
|
// WGL_AMD_gpu_association
|
||||||
bool WGLAMDGPUAssociation;
|
bool WGLAMDGPUAssociation;
|
||||||
|
|
||||||
|
// WGL_NV_gpu_affinity
|
||||||
|
bool WGLNVGPUAffinity;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// \name Disable Hardware feature. False by default. setuped by IDriver
|
/// \name Disable Hardware feature. False by default. setuped by IDriver
|
||||||
|
@ -793,6 +796,13 @@ extern PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC nwglMakeAssociatedContextCurren
|
||||||
extern PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD;
|
extern PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD;
|
||||||
extern PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC nwglBlitContextFramebufferAMD;
|
extern PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC nwglBlitContextFramebufferAMD;
|
||||||
|
|
||||||
|
// WGL_NV_gpu_affinity
|
||||||
|
//====================
|
||||||
|
extern PFNWGLENUMGPUSNVPROC nwglEnumGpusNV;
|
||||||
|
extern PFNWGLENUMGPUDEVICESNVPROC nwglEnumGpuDevicesNV;
|
||||||
|
extern PFNWGLCREATEAFFINITYDCNVPROC nwglCreateAffinityDCNV;
|
||||||
|
extern PFNWGLENUMGPUSFROMAFFINITYDCNVPROC nwglEnumGpusFromAffinityDCNV;
|
||||||
|
extern PFNWGLDELETEDCNVPROC nwglDeleteDCNV;
|
||||||
|
|
||||||
#elif defined(NL_OS_MAC)
|
#elif defined(NL_OS_MAC)
|
||||||
#elif defined(NL_OS_UNIX)
|
#elif defined(NL_OS_UNIX)
|
||||||
|
|
|
@ -532,7 +532,7 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Restaure fog state to its current value
|
// Restore fog state to its current value
|
||||||
_DriverGLStates.enableFog(_FogEnabled);
|
_DriverGLStates.enableFog(_FogEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ CVBDrvInfosGL::CVBDrvInfosGL(CDriverGL *drv, ItVBDrvInfoPtrList it, CVertexBuffe
|
||||||
CVBDrvInfosGL::~CVBDrvInfosGL()
|
CVBDrvInfosGL::~CVBDrvInfosGL()
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(CVBDrvInfosGL_CVBDrvInfosGLDtor)
|
H_AUTO_OGL(CVBDrvInfosGL_CVBDrvInfosGLDtor)
|
||||||
// Restaure non resident memory
|
// Restore non resident memory
|
||||||
if (VertexBufferPtr)
|
if (VertexBufferPtr)
|
||||||
{
|
{
|
||||||
VertexBufferPtr->setLocation(CVertexBuffer::NotResident);
|
VertexBufferPtr->setLocation(CVertexBuffer::NotResident);
|
||||||
|
|
|
@ -329,7 +329,7 @@ bool CDriverGL::init (uintptr_t windowIcon, emptyProc exitFunc)
|
||||||
HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL);
|
HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL);
|
||||||
if (dc)
|
if (dc)
|
||||||
{
|
{
|
||||||
_NeedToRestaureGammaRamp = GetDeviceGammaRamp (dc, _GammaRampBackuped) != FALSE;
|
_NeedToRestoreGammaRamp = GetDeviceGammaRamp (dc, _GammaRampBackuped) != FALSE;
|
||||||
|
|
||||||
// Release the DC
|
// Release the DC
|
||||||
ReleaseDC (NULL, dc);
|
ReleaseDC (NULL, dc);
|
||||||
|
@ -465,8 +465,8 @@ bool CDriverGL::unInit()
|
||||||
}
|
}
|
||||||
_Registered = 0;
|
_Registered = 0;
|
||||||
|
|
||||||
// Restaure monitor color parameters
|
// Restore monitor color parameters
|
||||||
if (_NeedToRestaureGammaRamp)
|
if (_NeedToRestoreGammaRamp)
|
||||||
{
|
{
|
||||||
HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL);
|
HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL);
|
||||||
if (dc)
|
if (dc)
|
||||||
|
@ -1738,7 +1738,9 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle)
|
||||||
}
|
}
|
||||||
else if (windowStyle == EWSFullscreen)
|
else if (windowStyle == EWSFullscreen)
|
||||||
{
|
{
|
||||||
|
#ifndef _DEBUG
|
||||||
dwNewStyle |= WS_POPUP;
|
dwNewStyle |= WS_POPUP;
|
||||||
|
#endif
|
||||||
isVisible = true;
|
isVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1756,14 +1758,14 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle)
|
||||||
#elif defined(NL_OS_MAC)
|
#elif defined(NL_OS_MAC)
|
||||||
|
|
||||||
// leave fullscreen mode, enter windowed mode
|
// leave fullscreen mode, enter windowed mode
|
||||||
if(windowStyle == EWSWindowed && [containerView() isInFullScreenMode])
|
if (windowStyle == EWSWindowed && [containerView() isInFullScreenMode])
|
||||||
{
|
{
|
||||||
// disable manual setting of back buffer size, cocoa handles this
|
// disable manual setting of back buffer size, cocoa handles this
|
||||||
// automatically as soon as the view gets resized
|
// automatically as soon as the view gets resized
|
||||||
CGLError error = CGLDisable((CGLContextObj)[_ctx CGLContextObj],
|
CGLError error = CGLDisable((CGLContextObj)[_ctx CGLContextObj],
|
||||||
kCGLCESurfaceBackingSize);
|
kCGLCESurfaceBackingSize);
|
||||||
|
|
||||||
if(error != kCGLNoError)
|
if (error != kCGLNoError)
|
||||||
nlerror("cannot disable kCGLCESurfaceBackingSize (%s)",
|
nlerror("cannot disable kCGLCESurfaceBackingSize (%s)",
|
||||||
CGLErrorString(error));
|
CGLErrorString(error));
|
||||||
|
|
||||||
|
@ -1778,20 +1780,20 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle)
|
||||||
}
|
}
|
||||||
|
|
||||||
// enter fullscreen, leave windowed mode
|
// enter fullscreen, leave windowed mode
|
||||||
else if(windowStyle == EWSFullscreen && ![containerView() isInFullScreenMode])
|
else if (windowStyle == EWSFullscreen && ![containerView() isInFullScreenMode])
|
||||||
{
|
{
|
||||||
// enable manual back buffer size for mode setting in fullscreen
|
// enable manual back buffer size for mode setting in fullscreen
|
||||||
CGLError error = CGLEnable((CGLContextObj)[_ctx CGLContextObj],
|
CGLError error = CGLEnable((CGLContextObj)[_ctx CGLContextObj],
|
||||||
kCGLCESurfaceBackingSize);
|
kCGLCESurfaceBackingSize);
|
||||||
|
|
||||||
if(error != kCGLNoError)
|
if (error != kCGLNoError)
|
||||||
nlerror("cannot enable kCGLCESurfaceBackingSize (%s)",
|
nlerror("cannot enable kCGLCESurfaceBackingSize (%s)",
|
||||||
CGLErrorString(error));
|
CGLErrorString(error));
|
||||||
|
|
||||||
// put the view in fullscreen mode, hiding the dock but enabling the menubar
|
// put the view in fullscreen mode, hiding the dock but enabling the menubar
|
||||||
// to pop up if the mouse hits the top screen border.
|
// to pop up if the mouse hits the top screen border.
|
||||||
// NOTE: withOptions:nil disables <CMD>+<Tab> application switching!
|
// NOTE: withOptions:nil disables <CMD>+<Tab> application switching!
|
||||||
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
#ifdef NL_MAC_VERSION_10_6_UP
|
||||||
[containerView() enterFullScreenMode:[NSScreen mainScreen] withOptions:
|
[containerView() enterFullScreenMode:[NSScreen mainScreen] withOptions:
|
||||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
[NSNumber numberWithInt:
|
[NSNumber numberWithInt:
|
||||||
|
@ -1915,8 +1917,9 @@ bool CDriverGL::setMode(const GfxMode& mode)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(NL_OS_MAC) && defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
#ifdef NL_OS_MAC
|
||||||
|
|
||||||
|
#ifdef NL_MAC_VERSION_10_6_UP
|
||||||
|
|
||||||
/// helper to extract bits per pixel value from screen mode, only 16 or 32 bits
|
/// helper to extract bits per pixel value from screen mode, only 16 or 32 bits
|
||||||
static int bppFromDisplayMode(CGDisplayModeRef mode)
|
static int bppFromDisplayMode(CGDisplayModeRef mode)
|
||||||
|
@ -1934,7 +1937,7 @@ static int bppFromDisplayMode(CGDisplayModeRef mode)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(NL_OS_MAC)
|
#else
|
||||||
|
|
||||||
long GetDictionaryLong(CFDictionaryRef theDict, const void* key)
|
long GetDictionaryLong(CFDictionaryRef theDict, const void* key)
|
||||||
{
|
{
|
||||||
|
@ -1951,7 +1954,9 @@ long GetDictionaryLong(CFDictionaryRef theDict, const void* key)
|
||||||
#define GetModeHeight(mode) GetDictionaryLong((mode), kCGDisplayHeight)
|
#define GetModeHeight(mode) GetDictionaryLong((mode), kCGDisplayHeight)
|
||||||
#define GetModeBitsPerPixel(mode) GetDictionaryLong((mode), kCGDisplayBitsPerPixel)
|
#define GetModeBitsPerPixel(mode) GetDictionaryLong((mode), kCGDisplayBitsPerPixel)
|
||||||
|
|
||||||
#endif // defined(NL_OS_MAC)
|
#endif
|
||||||
|
|
||||||
|
#endif // NL_OS_MAC
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
bool CDriverGL::getModes(std::vector<GfxMode> &modes)
|
bool CDriverGL::getModes(std::vector<GfxMode> &modes)
|
||||||
|
@ -1998,7 +2003,7 @@ bool CDriverGL::getModes(std::vector<GfxMode> &modes)
|
||||||
{
|
{
|
||||||
CGDirectDisplayID dspy = display[i];
|
CGDirectDisplayID dspy = display[i];
|
||||||
|
|
||||||
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
#ifdef NL_MAC_VERSION_10_6_UP
|
||||||
CFArrayRef modeList = CGDisplayCopyAllDisplayModes(dspy, NULL);
|
CFArrayRef modeList = CGDisplayCopyAllDisplayModes(dspy, NULL);
|
||||||
#else
|
#else
|
||||||
CFArrayRef modeList = CGDisplayAvailableModes(dspy);
|
CFArrayRef modeList = CGDisplayAvailableModes(dspy);
|
||||||
|
@ -2012,7 +2017,7 @@ bool CDriverGL::getModes(std::vector<GfxMode> &modes)
|
||||||
|
|
||||||
for (CFIndex j = 0; j < CFArrayGetCount(modeList); ++j)
|
for (CFIndex j = 0; j < CFArrayGetCount(modeList); ++j)
|
||||||
{
|
{
|
||||||
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
#ifdef NL_MAC_VERSION_10_6_UP
|
||||||
CGDisplayModeRef mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modeList, j);
|
CGDisplayModeRef mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modeList, j);
|
||||||
uint8 bpp = bppFromDisplayMode(mode);
|
uint8 bpp = bppFromDisplayMode(mode);
|
||||||
#else
|
#else
|
||||||
|
@ -2022,7 +2027,7 @@ bool CDriverGL::getModes(std::vector<GfxMode> &modes)
|
||||||
|
|
||||||
if (bpp >= 16)
|
if (bpp >= 16)
|
||||||
{
|
{
|
||||||
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
#ifdef NL_MAC_VERSION_10_6_UP
|
||||||
uint16 w = CGDisplayModeGetWidth(mode);
|
uint16 w = CGDisplayModeGetWidth(mode);
|
||||||
uint16 h = CGDisplayModeGetHeight(mode);
|
uint16 h = CGDisplayModeGetHeight(mode);
|
||||||
#else
|
#else
|
||||||
|
@ -2045,6 +2050,10 @@ bool CDriverGL::getModes(std::vector<GfxMode> &modes)
|
||||||
// nldebug(" Display 0x%x: Mode %dx%d, %d BPP", dspy, w, h, bpp);
|
// nldebug(" Display 0x%x: Mode %dx%d, %d BPP", dspy, w, h, bpp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NL_MAC_VERSION_10_6_UP
|
||||||
|
CFRelease(modeList);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined (NL_OS_UNIX)
|
#elif defined (NL_OS_UNIX)
|
||||||
|
|
|
@ -27,7 +27,7 @@ using NL3D::CDriverGL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@interface CocoaApplicationDelegate : NSObject
|
@interface CocoaApplicationDelegate : NSObject
|
||||||
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
#ifdef NL_MAC_VERSION_10_6_UP
|
||||||
<NSApplicationDelegate>
|
<NSApplicationDelegate>
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "../stdopengl.h"
|
||||||
#include "cocoa_event_emitter.h"
|
#include "cocoa_event_emitter.h"
|
||||||
|
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
|
@ -380,7 +381,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
||||||
case NSOtherMouseDown:break;
|
case NSOtherMouseDown:break;
|
||||||
case NSOtherMouseUp:break;
|
case NSOtherMouseUp:break;
|
||||||
case NSOtherMouseDragged:break;
|
case NSOtherMouseDragged:break;
|
||||||
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
#ifdef NL_MAC_VERSION_10_6_UP
|
||||||
case NSEventTypeGesture:break;
|
case NSEventTypeGesture:break;
|
||||||
case NSEventTypeMagnify:break;
|
case NSEventTypeMagnify:break;
|
||||||
case NSEventTypeSwipe:break;
|
case NSEventTypeSwipe:break;
|
||||||
|
|
|
@ -47,7 +47,7 @@ static void viewDidResize(NSView* view, CDriverGL* driver)
|
||||||
|
|
||||||
-(void)keyDown:(NSEvent*)event
|
-(void)keyDown:(NSEvent*)event
|
||||||
{
|
{
|
||||||
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
#ifdef NL_MAC_VERSION_10_6_UP
|
||||||
[[self inputContext] handleEvent:event];
|
[[self inputContext] handleEvent:event];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ using NL3D::CDriverGL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@interface CocoaWindowDelegate : NSObject
|
@interface CocoaWindowDelegate : NSObject
|
||||||
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
#ifdef NL_MAC_VERSION_10_6_UP
|
||||||
<NSWindowDelegate>
|
<NSWindowDelegate>
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,8 +31,7 @@ static void windowDidMove(NSWindow* window, CDriverGL* driver)
|
||||||
driver->_WindowX = windowRect.origin.x;
|
driver->_WindowX = windowRect.origin.x;
|
||||||
|
|
||||||
// map y from cocoa to NeL coordinates before setting in driver
|
// map y from cocoa to NeL coordinates before setting in driver
|
||||||
driver->_WindowY =
|
driver->_WindowY = screenRect.size.height - windowRect.size.height - windowRect.origin.y;
|
||||||
screenRect.size.height - windowRect.size.height - windowRect.origin.y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@implementation CocoaWindowDelegate
|
@implementation CocoaWindowDelegate
|
||||||
|
|
|
@ -100,4 +100,11 @@
|
||||||
#include "nel/3d/light.h"
|
#include "nel/3d/light.h"
|
||||||
#include "nel/3d/index_buffer.h"
|
#include "nel/3d/index_buffer.h"
|
||||||
|
|
||||||
|
#ifdef NL_OS_MAC
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
|
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
|
||||||
|
#define NL_MAC_VERSION_10_6_UP
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -106,7 +106,7 @@ CIndexBuffer::~CIndexBuffer()
|
||||||
|
|
||||||
// Single value
|
// Single value
|
||||||
if (DrvInfos)
|
if (DrvInfos)
|
||||||
DrvInfos->IndexBufferPtr = NULL; // Tell the driver info to not restaure memory when it will die
|
DrvInfos->IndexBufferPtr = NULL; // Tell the driver info to not restore memory when it will die
|
||||||
|
|
||||||
// Must kill the drv mirror of this VB.
|
// Must kill the drv mirror of this VB.
|
||||||
DrvInfos.kill();
|
DrvInfos.kill();
|
||||||
|
@ -144,7 +144,7 @@ void CIndexBuffer::setPreferredMemory (TPreferredMemory preferredMemory, bool ke
|
||||||
_KeepLocalMemory = keepLocalMemory;
|
_KeepLocalMemory = keepLocalMemory;
|
||||||
|
|
||||||
// Force non resident
|
// Force non resident
|
||||||
restaureNonResidentMemory();
|
restoreNonResidentMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ void CIndexBuffer::reserve(uint32 n)
|
||||||
_NbIndexes=std::min (_NbIndexes,_Capacity);
|
_NbIndexes=std::min (_NbIndexes,_Capacity);
|
||||||
|
|
||||||
// Force non resident
|
// Force non resident
|
||||||
restaureNonResidentMemory();
|
restoreNonResidentMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ void CIndexBuffer::deleteAllIndexes()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force non resident
|
// Force non resident
|
||||||
restaureNonResidentMemory();
|
restoreNonResidentMemory();
|
||||||
|
|
||||||
// Delete driver info
|
// Delete driver info
|
||||||
nlassert (DrvInfos == NULL);
|
nlassert (DrvInfos == NULL);
|
||||||
|
@ -276,12 +276,12 @@ void CIndexBuffer::setLocation (TLocation newLocation)
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
void CIndexBuffer::restaureNonResidentMemory()
|
void CIndexBuffer::restoreNonResidentMemory()
|
||||||
{
|
{
|
||||||
setLocation (NotResident);
|
setLocation (NotResident);
|
||||||
|
|
||||||
if (DrvInfos)
|
if (DrvInfos)
|
||||||
DrvInfos->IndexBufferPtr = NULL; // Tell the driver info to not restaure memory when it will die
|
DrvInfos->IndexBufferPtr = NULL; // Tell the driver info to not restore memory when it will die
|
||||||
|
|
||||||
// Must kill the drv mirror of this VB.
|
// Must kill the drv mirror of this VB.
|
||||||
DrvInfos.kill();
|
DrvInfos.kill();
|
||||||
|
@ -407,7 +407,7 @@ void CIndexBuffer::serial(NLMISC::IStream &f)
|
||||||
if (f.isReading())
|
if (f.isReading())
|
||||||
{
|
{
|
||||||
// Force non resident
|
// Force non resident
|
||||||
restaureNonResidentMemory();
|
restoreNonResidentMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ CVertexBuffer::~CVertexBuffer()
|
||||||
* ***********************************************/
|
* ***********************************************/
|
||||||
|
|
||||||
if (DrvInfos)
|
if (DrvInfos)
|
||||||
DrvInfos->VertexBufferPtr = NULL; // Tell the driver info to not restaure memory when it will die
|
DrvInfos->VertexBufferPtr = NULL; // Tell the driver info to not restore memory when it will die
|
||||||
|
|
||||||
// Must kill the drv mirror of this VB.
|
// Must kill the drv mirror of this VB.
|
||||||
DrvInfos.kill();
|
DrvInfos.kill();
|
||||||
|
@ -302,7 +302,7 @@ bool CVertexBuffer::setVertexFormat(uint32 flags)
|
||||||
initEx ();
|
initEx ();
|
||||||
|
|
||||||
// Force non resident
|
// Force non resident
|
||||||
restaureNonResidentMemory();
|
restoreNonResidentMemory();
|
||||||
|
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
@ -468,7 +468,7 @@ void CVertexBuffer::initEx ()
|
||||||
_Capacity = 0;
|
_Capacity = 0;
|
||||||
|
|
||||||
// Force non resident
|
// Force non resident
|
||||||
restaureNonResidentMemory();
|
restoreNonResidentMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
@ -482,7 +482,7 @@ void CVertexBuffer::reserve(uint32 n)
|
||||||
_NbVerts=std::min (_NbVerts,_Capacity);
|
_NbVerts=std::min (_NbVerts,_Capacity);
|
||||||
|
|
||||||
// Force non resident
|
// Force non resident
|
||||||
restaureNonResidentMemory();
|
restoreNonResidentMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ void CVertexBuffer::deleteAllVertices()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force non resident
|
// Force non resident
|
||||||
restaureNonResidentMemory();
|
restoreNonResidentMemory();
|
||||||
|
|
||||||
// Delete driver info
|
// Delete driver info
|
||||||
nlassert (DrvInfos == NULL);
|
nlassert (DrvInfos == NULL);
|
||||||
|
@ -725,7 +725,7 @@ void CVertexBuffer::serialOldV1Minus(NLMISC::IStream &f, sint ver)
|
||||||
if(f.isReading())
|
if(f.isReading())
|
||||||
{
|
{
|
||||||
// Force non resident
|
// Force non resident
|
||||||
restaureNonResidentMemory();
|
restoreNonResidentMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -979,7 +979,7 @@ void CVertexBuffer::serialSubset(NLMISC::IStream &f, uint vertexStart, uint ver
|
||||||
if(f.isReading())
|
if(f.isReading())
|
||||||
{
|
{
|
||||||
// Force non resident
|
// Force non resident
|
||||||
restaureNonResidentMemory();
|
restoreNonResidentMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1029,7 +1029,7 @@ bool CVertexBuffer::setVertexColorFormat (TVertexColorType format)
|
||||||
_VertexColorFormat = (uint8)format;
|
_VertexColorFormat = (uint8)format;
|
||||||
|
|
||||||
// Force non resident
|
// Force non resident
|
||||||
restaureNonResidentMemory();
|
restoreNonResidentMemory();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1044,7 +1044,7 @@ void CVertexBuffer::setPreferredMemory (TPreferredMemory preferredMemory, bool k
|
||||||
_KeepLocalMemory = keepLocalMemory;
|
_KeepLocalMemory = keepLocalMemory;
|
||||||
|
|
||||||
// Force non resident
|
// Force non resident
|
||||||
restaureNonResidentMemory();
|
restoreNonResidentMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1110,12 +1110,12 @@ void CVertexBuffer::setLocation (TLocation newLocation)
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
void CVertexBuffer::restaureNonResidentMemory()
|
void CVertexBuffer::restoreNonResidentMemory()
|
||||||
{
|
{
|
||||||
setLocation (NotResident);
|
setLocation (NotResident);
|
||||||
|
|
||||||
if (DrvInfos)
|
if (DrvInfos)
|
||||||
DrvInfos->VertexBufferPtr = NULL; // Tell the driver info to not restaure memory when it will die
|
DrvInfos->VertexBufferPtr = NULL; // Tell the driver info to not restore memory when it will die
|
||||||
|
|
||||||
// Must kill the drv mirror of this VB.
|
// Must kill the drv mirror of this VB.
|
||||||
DrvInfos.kill();
|
DrvInfos.kill();
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "libxml/globals.h"
|
#include "libxml/globals.h"
|
||||||
#include "nel/misc/debug.h"
|
#include "nel/misc/debug.h"
|
||||||
#include "nel/misc/xml_auto_ptr.h"
|
#include "nel/misc/xml_auto_ptr.h"
|
||||||
|
#include "nel/gui/lua_ihm.h"
|
||||||
#include "nel/gui/ctrl_base.h"
|
#include "nel/gui/ctrl_base.h"
|
||||||
#include "nel/gui/interface_group.h"
|
#include "nel/gui/interface_group.h"
|
||||||
#include "nel/gui/widget_manager.h"
|
#include "nel/gui/widget_manager.h"
|
||||||
|
@ -556,5 +557,17 @@ namespace NLGUI
|
||||||
return itr2->second;
|
return itr2->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
int CCtrlBase::luaSetTooltipUtf8(CLuaState &ls)
|
||||||
|
{
|
||||||
|
const char *funcName = "setTooltipUtf8";
|
||||||
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING);
|
||||||
|
std::string tooltip = ls.toString(1);
|
||||||
|
|
||||||
|
setDefaultContextHelp(ucstring::makeFromUtf8(tooltip));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,25 +169,25 @@ namespace NLGUI
|
||||||
if( _ColSelR.getNodePtr() != NULL )
|
if( _ColSelR.getNodePtr() != NULL )
|
||||||
s = _ColSelR.getNodePtr()->getFullName();
|
s = _ColSelR.getNodePtr()->getFullName();
|
||||||
else
|
else
|
||||||
s = "";
|
s.clear();
|
||||||
xmlSetProp( node, BAD_CAST "dbcolr", BAD_CAST s.c_str() );
|
xmlSetProp( node, BAD_CAST "dbcolr", BAD_CAST s.c_str() );
|
||||||
|
|
||||||
if( _ColSelG.getNodePtr() != NULL )
|
if( _ColSelG.getNodePtr() != NULL )
|
||||||
s = _ColSelG.getNodePtr()->getFullName();
|
s = _ColSelG.getNodePtr()->getFullName();
|
||||||
else
|
else
|
||||||
s = "";
|
s.clear();
|
||||||
xmlSetProp( node, BAD_CAST "dbcolg", BAD_CAST s.c_str() );
|
xmlSetProp( node, BAD_CAST "dbcolg", BAD_CAST s.c_str() );
|
||||||
|
|
||||||
if( _ColSelB.getNodePtr() != NULL )
|
if( _ColSelB.getNodePtr() != NULL )
|
||||||
s = _ColSelB.getNodePtr()->getFullName();
|
s = _ColSelB.getNodePtr()->getFullName();
|
||||||
else
|
else
|
||||||
s = "";
|
s.clear();
|
||||||
xmlSetProp( node, BAD_CAST "dbcolb", BAD_CAST s.c_str() );
|
xmlSetProp( node, BAD_CAST "dbcolb", BAD_CAST s.c_str() );
|
||||||
|
|
||||||
if( _ColSelA.getNodePtr() != NULL )
|
if( _ColSelA.getNodePtr() != NULL )
|
||||||
s = _ColSelA.getNodePtr()->getFullName();
|
s = _ColSelA.getNodePtr()->getFullName();
|
||||||
else
|
else
|
||||||
s = "";
|
s.clear();
|
||||||
xmlSetProp( node, BAD_CAST "dbcola", BAD_CAST s.c_str() );
|
xmlSetProp( node, BAD_CAST "dbcola", BAD_CAST s.c_str() );
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|
|
@ -519,17 +519,17 @@ namespace NLGUI
|
||||||
|
|
||||||
// Read Action handlers
|
// Read Action handlers
|
||||||
prop = (char*) xmlGetProp( node, (xmlChar*)"onscroll" );
|
prop = (char*) xmlGetProp( node, (xmlChar*)"onscroll" );
|
||||||
if (prop) _AHOnScroll = NLMISC::strlwr(prop.str());
|
if (prop) _AHOnScroll = NLMISC::toLower(prop.str());
|
||||||
prop = (char*) xmlGetProp( node, (xmlChar*)"params" );
|
prop = (char*) xmlGetProp( node, (xmlChar*)"params" );
|
||||||
if (prop) _AHOnScrollParams = string((const char*)prop);
|
if (prop) _AHOnScrollParams = string((const char*)prop);
|
||||||
//
|
//
|
||||||
prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollend" );
|
prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollend" );
|
||||||
if (prop) _AHOnScrollEnd = NLMISC::strlwr(prop.str());
|
if (prop) _AHOnScrollEnd = NLMISC::toLower(prop.str());
|
||||||
prop = (char*) xmlGetProp( node, (xmlChar*)"end_params" );
|
prop = (char*) xmlGetProp( node, (xmlChar*)"end_params" );
|
||||||
if (prop) _AHOnScrollEndParams = string((const char*)prop);
|
if (prop) _AHOnScrollEndParams = string((const char*)prop);
|
||||||
//
|
//
|
||||||
prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollcancel" );
|
prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollcancel" );
|
||||||
if (prop) _AHOnScrollCancel = NLMISC::strlwr(prop.str());
|
if (prop) _AHOnScrollCancel = NLMISC::toLower(prop.str());
|
||||||
prop = (char*) xmlGetProp( node, (xmlChar*)"cancel_params" );
|
prop = (char*) xmlGetProp( node, (xmlChar*)"cancel_params" );
|
||||||
if (prop) _AHOnScrollCancelParams = string((const char*)prop);
|
if (prop) _AHOnScrollCancelParams = string((const char*)prop);
|
||||||
|
|
||||||
|
|
|
@ -543,7 +543,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgTypeUCString(ls, funcName, 2);
|
CLuaIHM::checkArgTypeUCString(ls, funcName, 2);
|
||||||
ucstring text;
|
ucstring text;
|
||||||
nlverify(CLuaIHM::pop(ls, text));
|
nlverify(CLuaIHM::pop(ls, text));
|
||||||
setText((uint) ls.toNumber(1), text);
|
setText((uint) ls.toInteger(1), text);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgTypeUCString(ls, funcName, 2);
|
CLuaIHM::checkArgTypeUCString(ls, funcName, 2);
|
||||||
ucstring text;
|
ucstring text;
|
||||||
nlverify(CLuaIHM::pop(ls, text));
|
nlverify(CLuaIHM::pop(ls, text));
|
||||||
insertText((uint) ls.toNumber(1), text);
|
insertText((uint) ls.toInteger(1), text);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgTypeUCString(ls, funcName, 2);
|
CLuaIHM::checkArgTypeUCString(ls, funcName, 2);
|
||||||
ucstring texture;
|
ucstring texture;
|
||||||
nlverify(CLuaIHM::pop(ls, texture));
|
nlverify(CLuaIHM::pop(ls, texture));
|
||||||
setTexture((uint) ls.toNumber(1), texture);
|
setTexture((uint) ls.toInteger(1), texture);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +579,7 @@ namespace NLGUI
|
||||||
const char *funcName = "setText";
|
const char *funcName = "setText";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CLuaIHM::push(ls, getText((uint) ls.toNumber(1)));
|
CLuaIHM::push(ls, getText((uint) ls.toInteger(1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,7 +589,7 @@ namespace NLGUI
|
||||||
const char *funcName = "removeText";
|
const char *funcName = "removeText";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
removeText((uint) ls.toNumber(1));
|
removeText((uint) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,7 +598,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
const char *funcName = "getNumTexts";
|
const char *funcName = "getNumTexts";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 0);
|
CLuaIHM::checkArgCount(ls, funcName, 0);
|
||||||
ls.push((double) getNumTexts());
|
ls.push(getNumTexts());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4820,7 +4820,7 @@ namespace NLGUI
|
||||||
const char *funcName = "blink";
|
const char *funcName = "blink";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
enableBlink((uint) ls.toNumber(1));
|
enableBlink((uint) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -606,11 +606,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_r" );
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"menu_r" );
|
||||||
if (prop)
|
if (prop) _ListMenuRight = toLower((const char *) prop);
|
||||||
{
|
|
||||||
string tmp = (const char *) prop;
|
|
||||||
_ListMenuRight = strlwr(tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"max_historic" );
|
prop = (char*) xmlGetProp( cur, (xmlChar*)"max_historic" );
|
||||||
if (prop) fromString((const char*)prop, _MaxHistoric);
|
if (prop) fromString((const char*)prop, _MaxHistoric);
|
||||||
|
|
|
@ -202,7 +202,7 @@ namespace NLGUI
|
||||||
const char *funcName = "enlargeColumns";
|
const char *funcName = "enlargeColumns";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
enlargeColumns((sint32) ls.toNumber(1));
|
enlargeColumns((sint32) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ namespace NLGUI
|
||||||
const char *funcName = "resizeColumnsAndContainer";
|
const char *funcName = "resizeColumnsAndContainer";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
resizeColumnsAndContainer((sint32) ls.toNumber(1));
|
resizeColumnsAndContainer((sint32) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -772,8 +772,7 @@ namespace NLGUI
|
||||||
cellParams.NoWrap = true; \
|
cellParams.NoWrap = true; \
|
||||||
if (present[prefix##_ALIGN] && value[prefix##_ALIGN]) \
|
if (present[prefix##_ALIGN] && value[prefix##_ALIGN]) \
|
||||||
{ \
|
{ \
|
||||||
string align = value[prefix##_ALIGN]; \
|
string align = toLower(value[prefix##_ALIGN]); \
|
||||||
align = strlwr(align); \
|
|
||||||
if (align == "left") \
|
if (align == "left") \
|
||||||
cellParams.Align = CGroupCell::Left; \
|
cellParams.Align = CGroupCell::Left; \
|
||||||
if (align == "center") \
|
if (align == "center") \
|
||||||
|
@ -783,8 +782,7 @@ namespace NLGUI
|
||||||
} \
|
} \
|
||||||
if (present[prefix##_VALIGN] && value[prefix##_VALIGN]) \
|
if (present[prefix##_VALIGN] && value[prefix##_VALIGN]) \
|
||||||
{ \
|
{ \
|
||||||
string align = value[prefix##_VALIGN]; \
|
string align = toLower(value[prefix##_VALIGN]); \
|
||||||
align = strlwr(align); \
|
|
||||||
if (align == "top") \
|
if (align == "top") \
|
||||||
cellParams.VAlign = CGroupCell::Top; \
|
cellParams.VAlign = CGroupCell::Top; \
|
||||||
if (align == "middle") \
|
if (align == "middle") \
|
||||||
|
@ -1182,7 +1180,7 @@ namespace NLGUI
|
||||||
if (it != styles.end())
|
if (it != styles.end())
|
||||||
{
|
{
|
||||||
string image = it->second;
|
string image = it->second;
|
||||||
string::size_type texExt = strlwr(image).find("url(");
|
string::size_type texExt = toLower(image).find("url(");
|
||||||
// Url image
|
// Url image
|
||||||
if (texExt != string::npos)
|
if (texExt != string::npos)
|
||||||
// Remove url()
|
// Remove url()
|
||||||
|
@ -1321,8 +1319,7 @@ namespace NLGUI
|
||||||
if (present[MY_HTML_INPUT_ALT] && value[MY_HTML_INPUT_ALT])
|
if (present[MY_HTML_INPUT_ALT] && value[MY_HTML_INPUT_ALT])
|
||||||
tooltip = value[MY_HTML_INPUT_ALT];
|
tooltip = value[MY_HTML_INPUT_ALT];
|
||||||
|
|
||||||
string type = value[MY_HTML_INPUT_TYPE];
|
string type = toLower(value[MY_HTML_INPUT_TYPE]);
|
||||||
type = strlwr (type);
|
|
||||||
if (type == "image")
|
if (type == "image")
|
||||||
{
|
{
|
||||||
// The submit button
|
// The submit button
|
||||||
|
@ -1668,7 +1665,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
nlinfo("found background-image %s", it->second.c_str());
|
nlinfo("found background-image %s", it->second.c_str());
|
||||||
string image = (*it).second;
|
string image = (*it).second;
|
||||||
string::size_type texExt = strlwr(image).find("url(");
|
string::size_type texExt = toLower(image).find("url(");
|
||||||
// Url image
|
// Url image
|
||||||
if (texExt != string::npos)
|
if (texExt != string::npos)
|
||||||
{
|
{
|
||||||
|
@ -2090,6 +2087,14 @@ namespace NLGUI
|
||||||
clearContext();
|
clearContext();
|
||||||
|
|
||||||
MultiCurl = curl_multi_init();
|
MultiCurl = curl_multi_init();
|
||||||
|
if (MultiCurl)
|
||||||
|
{
|
||||||
|
#ifdef CURLMOPT_MAX_HOST_CONNECTIONS
|
||||||
|
// added in libcurl 7.30.0
|
||||||
|
curl_multi_setopt(MultiCurl, CURLMOPT_MAX_HOST_CONNECTIONS, options.curlMaxConnections);
|
||||||
|
#endif
|
||||||
|
curl_multi_setopt(MultiCurl, CURLMOPT_PIPELINING, 1);
|
||||||
|
}
|
||||||
RunningCurls = 0;
|
RunningCurls = 0;
|
||||||
_CurlWWW = NULL;
|
_CurlWWW = NULL;
|
||||||
|
|
||||||
|
@ -3613,7 +3618,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ctrlButton->setDefaultContextHelp(ucstring(tooltip));
|
ctrlButton->setDefaultContextHelp(ucstring::makeFromUtf8(tooltip));
|
||||||
//ctrlButton->setOnContextHelp(string(tooltip));
|
//ctrlButton->setOnContextHelp(string(tooltip));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3818,7 +3823,7 @@ namespace NLGUI
|
||||||
// folder used for images cache
|
// folder used for images cache
|
||||||
static const string cacheDir = "cache";
|
static const string cacheDir = "cache";
|
||||||
|
|
||||||
string::size_type protocolPos = strlwr(result).find("://");
|
string::size_type protocolPos = toLower(result).find("://");
|
||||||
|
|
||||||
if (protocolPos != string::npos)
|
if (protocolPos != string::npos)
|
||||||
{
|
{
|
||||||
|
@ -3832,7 +3837,7 @@ namespace NLGUI
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Url is a file ?
|
// Url is a file ?
|
||||||
if (strlwr(result).find("file:") == 0)
|
if (toLower(result).find("file:") == 0)
|
||||||
{
|
{
|
||||||
result = result.substr(5, result.size()-5);
|
result = result.substr(5, result.size()-5);
|
||||||
}
|
}
|
||||||
|
@ -3849,7 +3854,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
// Normalize the path
|
// Normalize the path
|
||||||
if (isUrl)
|
if (isUrl)
|
||||||
//result = "file:"+strlwr(CPath::standardizePath (CPath::getFullPath (CFile::getPath(result)))+CFile::getFilename(result));*/
|
//result = "file:"+toLower(CPath::standardizePath (CPath::getFullPath (CFile::getPath(result)))+CFile::getFilename(result));*/
|
||||||
result = "file:/"+tmp;
|
result = "file:/"+tmp;
|
||||||
else
|
else
|
||||||
result = tmp;
|
result = tmp;
|
||||||
|
@ -4106,7 +4111,7 @@ namespace NLGUI
|
||||||
void CGroupHTML::doBrowseLocalFile(const std::string &uri)
|
void CGroupHTML::doBrowseLocalFile(const std::string &uri)
|
||||||
{
|
{
|
||||||
std::string filename;
|
std::string filename;
|
||||||
if (strlwr(uri).find("file:/") == 0)
|
if (toLower(uri).find("file:/") == 0)
|
||||||
{
|
{
|
||||||
filename = uri.substr(6, uri.size() - 6);
|
filename = uri.substr(6, uri.size() - 6);
|
||||||
}
|
}
|
||||||
|
@ -4720,7 +4725,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TTABLE);
|
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TTABLE);
|
||||||
|
|
||||||
uint element_number = (uint)ls.toNumber(1);
|
uint element_number = (uint)ls.toInteger(1);
|
||||||
std::vector<bool> present;
|
std::vector<bool> present;
|
||||||
std::vector<const char *> value;
|
std::vector<const char *> value;
|
||||||
present.resize(30, false);
|
present.resize(30, false);
|
||||||
|
@ -4733,7 +4738,7 @@ namespace NLGUI
|
||||||
|
|
||||||
ENUM_LUA_TABLE(params, it)
|
ENUM_LUA_TABLE(params, it)
|
||||||
{
|
{
|
||||||
if (!it.nextKey().isNumber())
|
if (!it.nextKey().isInteger())
|
||||||
{
|
{
|
||||||
nlwarning("%s : bad key encountered with type %s, number expected.", funcName, it.nextKey().getTypename());
|
nlwarning("%s : bad key encountered with type %s, number expected.", funcName, it.nextKey().getTypename());
|
||||||
continue;
|
continue;
|
||||||
|
@ -4743,16 +4748,16 @@ namespace NLGUI
|
||||||
nlwarning("%s : bad value encountered with type %s for key %s, string expected.", funcName, it.nextValue().getTypename(), it.nextKey().toString().c_str());
|
nlwarning("%s : bad value encountered with type %s for key %s, string expected.", funcName, it.nextValue().getTypename(), it.nextKey().toString().c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
uint idx = (uint)it.nextKey().toNumber();
|
uint idx = (uint)it.nextKey().toInteger();
|
||||||
|
|
||||||
present.insert(present.begin() + (uint)it.nextKey().toNumber(), true);
|
present.insert(present.begin() + (uint)it.nextKey().toInteger(), true);
|
||||||
|
|
||||||
string str = it.nextValue().toString();
|
string str = it.nextValue().toString();
|
||||||
size_t size = str.size() + 1;
|
size_t size = str.size() + 1;
|
||||||
char * buffer = new char[ size ];
|
char * buffer = new char[ size ];
|
||||||
strncpy(buffer, str.c_str(), size );
|
strncpy(buffer, str.c_str(), size );
|
||||||
|
|
||||||
value.insert(value.begin() + (uint)it.nextKey().toNumber(), buffer);
|
value.insert(value.begin() + (uint)it.nextKey().toInteger(), buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
beginElement(element_number, present, value);
|
beginElement(element_number, present, value);
|
||||||
|
@ -4770,7 +4775,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
|
|
||||||
uint element_number = (uint)ls.toNumber(1);
|
uint element_number = (uint)ls.toInteger(1);
|
||||||
endElement(element_number);
|
endElement(element_number);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4970,7 +4975,7 @@ namespace NLGUI
|
||||||
else
|
else
|
||||||
if (it->first == "text-decoration" || it->first == "text-decoration-line")
|
if (it->first == "text-decoration" || it->first == "text-decoration-line")
|
||||||
{
|
{
|
||||||
std::string prop(strlwr(it->second));
|
std::string prop(toLower(it->second));
|
||||||
style.Underlined = (prop.find("underline") != std::string::npos);
|
style.Underlined = (prop.find("underline") != std::string::npos);
|
||||||
style.StrikeThrough = (prop.find("line-through") != std::string::npos);
|
style.StrikeThrough = (prop.find("line-through") != std::string::npos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1145,7 +1145,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CLuaIHM::checkArgCount(ls, "getElementIndex", 1);
|
CLuaIHM::checkArgCount(ls, "getElementIndex", 1);
|
||||||
CViewBase * viewBase = dynamic_cast<CViewBase *>(CLuaIHM::getUIOnStack(ls, 1));
|
CViewBase * viewBase = dynamic_cast<CViewBase *>(CLuaIHM::getUIOnStack(ls, 1));
|
||||||
ls.push((double) getElementIndex(viewBase));
|
ls.push(getElementIndex(viewBase));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1224,7 +1224,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getChild";
|
const char *funcName = "getChild";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
sint index = (sint) ls.toNumber(1);
|
sint index = (sint) ls.toInteger(1);
|
||||||
if(index < 0 || index >= (sint) _Elements.size())
|
if(index < 0 || index >= (sint) _Elements.size())
|
||||||
{
|
{
|
||||||
CLuaIHM::fails(ls, "getChild : trying to access element %d in list '%s', which has %d elements",
|
CLuaIHM::fails(ls, "getChild : trying to access element %d in list '%s', which has %d elements",
|
||||||
|
@ -1304,10 +1304,10 @@ namespace NLGUI
|
||||||
ucstring ucText;
|
ucstring ucText;
|
||||||
ucText.fromUtf8(text);
|
ucText.fromUtf8(text);
|
||||||
|
|
||||||
uint r = (uint) ls.toNumber(2);
|
uint r = (uint) ls.toInteger(2);
|
||||||
uint g = (uint) ls.toNumber(3);
|
uint g = (uint) ls.toInteger(3);
|
||||||
uint b = (uint) ls.toNumber(4);
|
uint b = (uint) ls.toInteger(4);
|
||||||
uint a = (uint) ls.toNumber(5);
|
uint a = (uint) ls.toInteger(5);
|
||||||
|
|
||||||
addTextChild(ucText, CRGBA(r, g, b, a));
|
addTextChild(ucText, CRGBA(r, g, b, a));
|
||||||
|
|
||||||
|
@ -1344,7 +1344,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addChildAtIndex(vb, (uint) ls.toNumber(2));
|
addChildAtIndex(vb, (uint) ls.toInteger(2));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1702,7 +1702,7 @@ namespace NLGUI
|
||||||
int CGroupSubMenu::luaGetNumLine(CLuaState &ls)
|
int CGroupSubMenu::luaGetNumLine(CLuaState &ls)
|
||||||
{
|
{
|
||||||
CLuaIHM::checkArgCount(ls, "getNumLine", 0);
|
CLuaIHM::checkArgCount(ls, "getNumLine", 0);
|
||||||
ls.push((double) getNumLine());
|
ls.push(getNumLine());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1712,7 +1712,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getSubMenu";
|
const char *funcName = "getSubMenu";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CLuaIHM::pushUIOnStack(ls, getSubMenu((uint) ls.toNumber(1)));
|
CLuaIHM::pushUIOnStack(ls, getSubMenu((uint) ls.toInteger(1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1722,8 +1722,8 @@ namespace NLGUI
|
||||||
const char *funcName = "addSubMenu";
|
const char *funcName = "addSubMenu";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
setSubMenu((uint) ls.toNumber(1), new CGroupSubMenu(CViewText::TCtorParam()));
|
setSubMenu((uint) ls.toInteger(1), new CGroupSubMenu(CViewText::TCtorParam()));
|
||||||
CLuaIHM::pushUIOnStack(ls, getSubMenu((uint) ls.toNumber(1)));
|
CLuaIHM::pushUIOnStack(ls, getSubMenu((uint) ls.toInteger(1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1733,7 +1733,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getLineId";
|
const char *funcName = "getLineId";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
std::string id = getLineId((uint) ls.toNumber(1));
|
std::string id = getLineId((uint) ls.toInteger(1));
|
||||||
CLuaIHM::push(ls, id);
|
CLuaIHM::push(ls, id);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1744,7 +1744,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getLineFromId";
|
const char *funcName = "getLineFromId";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING);
|
||||||
ls.push((double) getLineFromId(ls.toString(1)));
|
ls.push(getLineFromId(ls.toString(1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1754,7 +1754,7 @@ namespace NLGUI
|
||||||
const char *funcName = "isSeparator";
|
const char *funcName = "isSeparator";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
ls.push(isSeparator((uint) ls.toNumber(1)));
|
ls.push(isSeparator((uint) ls.toInteger(1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1785,7 +1785,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING);
|
CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING);
|
||||||
ucstring arg2;
|
ucstring arg2;
|
||||||
nlverify(CLuaIHM::getUCStringOnStack(ls, 2, arg2));
|
nlverify(CLuaIHM::getUCStringOnStack(ls, 2, arg2));
|
||||||
addLineAtIndex((uint) ls.toNumber(1), arg2, ls.toString(3), ls.toString(4), ls.toString(5));
|
addLineAtIndex((uint) ls.toInteger(1), arg2, ls.toString(3), ls.toString(4), ls.toString(5));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1803,7 +1803,7 @@ namespace NLGUI
|
||||||
const char *funcName = "addSeparatorAtIndex";
|
const char *funcName = "addSeparatorAtIndex";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
addSeparatorAtIndex((uint) ls.toNumber(1));
|
addSeparatorAtIndex((uint) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1813,7 +1813,7 @@ namespace NLGUI
|
||||||
const char *funcName = "removeLine";
|
const char *funcName = "removeLine";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
removeLine((uint) ls.toNumber(1));
|
removeLine((uint) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1833,7 +1833,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CLuaIHM::fails(ls, "%s : Group required as argument 2", funcName);
|
CLuaIHM::fails(ls, "%s : Group required as argument 2", funcName);
|
||||||
}
|
}
|
||||||
setUserGroupRight((uint) ls.toNumber(1), group, true);
|
setUserGroupRight((uint) ls.toInteger(1), group, true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1853,7 +1853,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CLuaIHM::fails(ls, "%s : Group required as argument 2", funcName);
|
CLuaIHM::fails(ls, "%s : Group required as argument 2", funcName);
|
||||||
}
|
}
|
||||||
setUserGroupLeft((uint) ls.toNumber(1), group, true);
|
setUserGroupLeft((uint) ls.toInteger(1), group, true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1864,7 +1864,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getUserGroupRight";
|
const char *funcName = "getUserGroupRight";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CLuaIHM::pushUIOnStack(ls, getUserGroupRight((uint) ls.toNumber(1)));
|
CLuaIHM::pushUIOnStack(ls, getUserGroupRight((uint) ls.toInteger(1)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1875,7 +1875,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getUserGroupLeft";
|
const char *funcName = "getUserGroupLeft";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CInterfaceElement *pIE = getUserGroupLeft((uint) ls.toNumber(1));
|
CInterfaceElement *pIE = getUserGroupLeft((uint) ls.toInteger(1));
|
||||||
if (pIE)
|
if (pIE)
|
||||||
{
|
{
|
||||||
CLuaIHM::pushUIOnStack(ls, pIE);
|
CLuaIHM::pushUIOnStack(ls, pIE);
|
||||||
|
@ -1890,7 +1890,7 @@ namespace NLGUI
|
||||||
const char *funcName = "setMaxVisibleLine";
|
const char *funcName = "setMaxVisibleLine";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
setMaxVisibleLine((uint) ls.toNumber(1));
|
setMaxVisibleLine((uint) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2566,7 +2566,7 @@ namespace NLGUI
|
||||||
const char *funcName = "setMinW";
|
const char *funcName = "setMinW";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
setMinW((sint32) ls.toNumber(1));
|
setMinW((sint32) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,7 +316,7 @@ namespace NLGUI
|
||||||
if (tabB)
|
if (tabB)
|
||||||
{
|
{
|
||||||
// don't use addTab to avoid selection of new tab
|
// don't use addTab to avoid selection of new tab
|
||||||
addTab(tabB, (sint) ls.toNumber(2));
|
addTab(tabB, (sint) ls.toInteger(2));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ namespace NLGUI
|
||||||
const char *funcName = "removeTab";
|
const char *funcName = "removeTab";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
removeTab((uint) ls.toNumber(1));
|
removeTab((uint) ls.toInteger(1));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getTabButton";
|
const char *funcName = "getTabButton";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CCtrlTabButton* tab = getTabButton((uint) ls.toNumber(1));
|
CCtrlTabButton* tab = getTabButton((uint) ls.toInteger(1));
|
||||||
if(tab != NULL)
|
if(tab != NULL)
|
||||||
{
|
{
|
||||||
CLuaIHM::pushUIOnStack(ls, tab);
|
CLuaIHM::pushUIOnStack(ls, tab);
|
||||||
|
@ -562,7 +562,7 @@ namespace NLGUI
|
||||||
const char *funcName = "showTabButton";
|
const char *funcName = "showTabButton";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
sint showTab = (sint)ls.toNumber(1);
|
sint showTab = (sint)ls.toInteger(1);
|
||||||
|
|
||||||
if(showTab>=0 && showTab<(sint)_Buttons.size())
|
if(showTab>=0 && showTab<(sint)_Buttons.size())
|
||||||
{
|
{
|
||||||
|
@ -770,7 +770,7 @@ namespace NLGUI
|
||||||
const char *funcName = "getGroup";
|
const char *funcName = "getGroup";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
CInterfaceGroup* group = getGroup((uint) ls.toNumber(1));
|
CInterfaceGroup* group = getGroup((uint) ls.toInteger(1));
|
||||||
if(group != NULL)
|
if(group != NULL)
|
||||||
{
|
{
|
||||||
CLuaIHM::pushUIOnStack(ls, group);
|
CLuaIHM::pushUIOnStack(ls, group);
|
||||||
|
|
|
@ -1815,7 +1815,7 @@ namespace NLGUI
|
||||||
const char *funcName = "CGroupTree::SNode::luaAddChildAtIndex";
|
const char *funcName = "CGroupTree::SNode::luaAddChildAtIndex";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 2);
|
CLuaIHM::checkArgCount(ls, funcName, 2);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER);
|
||||||
addChildAtIndex(luaGetNodeOnStack(ls, funcName), (sint) ls.toNumber(2));
|
addChildAtIndex(luaGetNodeOnStack(ls, funcName), (sint) ls.toInteger(2));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1836,7 +1836,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
const char *funcName = "CGroupTree::SNode::luaGetNumChildren";
|
const char *funcName = "CGroupTree::SNode::luaGetNumChildren";
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 0);
|
CLuaIHM::checkArgCount(ls, funcName, 0);
|
||||||
ls.push((double) Children.size());
|
ls.push((uint)Children.size());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1847,7 +1847,7 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
//
|
//
|
||||||
sint index = (sint) ls.toNumber(1);
|
sint index = (sint) ls.toInteger(1);
|
||||||
if (index < 0 || index >= (sint) Children.size())
|
if (index < 0 || index >= (sint) Children.size())
|
||||||
{
|
{
|
||||||
std::string range = Children.empty() ? "<empty>" : toString("[0, %d]", Children.size() - 1);
|
std::string range = Children.empty() ? "<empty>" : toString("[0, %d]", Children.size() - 1);
|
||||||
|
@ -1890,7 +1890,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CLuaIHM::checkArgType(ls, "CGroupTree::selectLine", 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, "CGroupTree::selectLine", 1, LUA_TNUMBER);
|
||||||
CLuaIHM::checkArgType(ls, "CGroupTree::selectLine", 2, LUA_TBOOLEAN);
|
CLuaIHM::checkArgType(ls, "CGroupTree::selectLine", 2, LUA_TBOOLEAN);
|
||||||
selectLine((uint) ls.toNumber(1), ls.toBoolean(2));
|
selectLine((uint) ls.toInteger(1), ls.toBoolean(2));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,7 @@ namespace NLGUI
|
||||||
if (ptr) _Dynamic = CInterfaceElement::convertBool (ptr);
|
if (ptr) _Dynamic = CInterfaceElement::convertBool (ptr);
|
||||||
|
|
||||||
ptr = xmlGetProp (cur, (xmlChar*)"type");
|
ptr = xmlGetProp (cur, (xmlChar*)"type");
|
||||||
string sTmp = ptr.str();
|
string sTmp = toLower(ptr.str());
|
||||||
sTmp = strlwr(sTmp);
|
|
||||||
if (sTmp == "linear")
|
if (sTmp == "linear")
|
||||||
_Type = Track_Linear;
|
_Type = Track_Linear;
|
||||||
else if (sTmp == "bezier")
|
else if (sTmp == "bezier")
|
||||||
|
|
|
@ -312,8 +312,7 @@ namespace NLGUI
|
||||||
ptr = (char*) xmlGetProp( cur, (xmlChar*)"max_sizeparent" );
|
ptr = (char*) xmlGetProp( cur, (xmlChar*)"max_sizeparent" );
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
string idparent = ptr.str();
|
string idparent = NLMISC::toLower(ptr.str());
|
||||||
idparent = NLMISC::strlwr(idparent);
|
|
||||||
if (idparent != "parent")
|
if (idparent != "parent")
|
||||||
{
|
{
|
||||||
if (parentGroup)
|
if (parentGroup)
|
||||||
|
@ -1174,7 +1173,7 @@ namespace NLGUI
|
||||||
int CInterfaceGroup::luaGetNumGroups(CLuaState &ls)
|
int CInterfaceGroup::luaGetNumGroups(CLuaState &ls)
|
||||||
{
|
{
|
||||||
CLuaIHM::checkArgCount(ls, "CInterfaceGroup::getNumGroups", 0);
|
CLuaIHM::checkArgCount(ls, "CInterfaceGroup::getNumGroups", 0);
|
||||||
ls.push((double) _ChildrenGroups.size());
|
ls.push((uint)_ChildrenGroups.size());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1184,7 +1183,7 @@ namespace NLGUI
|
||||||
const char *funcName = "CInterfaceGroup::getGroup";
|
const char *funcName = "CInterfaceGroup::getGroup";
|
||||||
CLuaIHM::checkArgCount(ls, "CInterfaceGroup::getGroup", 1);
|
CLuaIHM::checkArgCount(ls, "CInterfaceGroup::getGroup", 1);
|
||||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
|
||||||
uint index = (uint) ls.toNumber(1);
|
uint index = (uint) ls.toInteger(1);
|
||||||
if (index >= _ChildrenGroups.size())
|
if (index >= _ChildrenGroups.size())
|
||||||
{
|
{
|
||||||
CLuaIHM::fails(ls, "getGroup : try to index group %s, but there are only %d son groups", ls.toString(1), (int) _ChildrenGroups.size());
|
CLuaIHM::fails(ls, "getGroup : try to index group %s, but there are only %d son groups", ls.toString(1), (int) _ChildrenGroups.size());
|
||||||
|
@ -2140,7 +2139,8 @@ namespace NLGUI
|
||||||
std::string typeName = "???";
|
std::string typeName = "???";
|
||||||
if (_ChildrenGroups[k])
|
if (_ChildrenGroups[k])
|
||||||
{
|
{
|
||||||
const type_info &ti = typeid(*_ChildrenGroups[k]);
|
NLGUI::CInterfaceGroup *group = _ChildrenGroups[k];
|
||||||
|
const type_info &ti = typeid(*group);
|
||||||
typeName = ti.name();
|
typeName = ti.name();
|
||||||
}
|
}
|
||||||
nlinfo("Group %d, name = %s, type=%s", k, _ChildrenGroups[k] ? _ChildrenGroups[k]->getId().c_str() : "???", typeName.c_str());
|
nlinfo("Group %d, name = %s, type=%s", k, _ChildrenGroups[k] ? _ChildrenGroups[k]->getId().c_str() : "???", typeName.c_str());
|
||||||
|
@ -2156,7 +2156,8 @@ namespace NLGUI
|
||||||
std::string typeName = "???";
|
std::string typeName = "???";
|
||||||
if (_ChildrenGroups[k])
|
if (_ChildrenGroups[k])
|
||||||
{
|
{
|
||||||
const type_info &ti = typeid(*_EltOrder[k]);
|
NLGUI::CViewBase *view = _EltOrder[k];
|
||||||
|
const type_info &ti = typeid(*view);
|
||||||
typeName = ti.name();
|
typeName = ti.name();
|
||||||
}
|
}
|
||||||
CInterfaceElement *el = _EltOrder[k];
|
CInterfaceElement *el = _EltOrder[k];
|
||||||
|
|
|
@ -127,8 +127,7 @@ namespace NLGUI
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
const CInterfaceOptionValue &CInterfaceOptions::getValue(const string &sParamName) const
|
const CInterfaceOptionValue &CInterfaceOptions::getValue(const string &sParamName) const
|
||||||
{
|
{
|
||||||
string sLwrParamName = strlwr (sParamName);
|
std::map<std::string, CInterfaceOptionValue>::const_iterator it = _ParamValue.find (toLower(sParamName));
|
||||||
std::map<std::string, CInterfaceOptionValue>::const_iterator it = _ParamValue.find (sLwrParamName);
|
|
||||||
if (it != _ParamValue.end())
|
if (it != _ParamValue.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
else
|
else
|
||||||
|
|
|
@ -1359,6 +1359,9 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" ));
|
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" ));
|
||||||
if (!ptr) return false;
|
if (!ptr) return false;
|
||||||
|
|
||||||
|
string stmp2 = toLower(string((const char*)ptr));
|
||||||
|
|
||||||
CInterfaceElement *pEltFound = NULL;
|
CInterfaceElement *pEltFound = NULL;
|
||||||
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
||||||
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
||||||
|
@ -1367,8 +1370,8 @@ namespace NLGUI
|
||||||
for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j)
|
for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j)
|
||||||
{
|
{
|
||||||
CInterfaceGroup *pIG = rMG.Group->getGroups()[j];
|
CInterfaceGroup *pIG = rMG.Group->getGroups()[j];
|
||||||
string stmp = strlwr(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size()));
|
string stmp = toLower(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size()));
|
||||||
string stmp2 = strlwr(string((const char*)ptr));
|
|
||||||
if (stmp == stmp2)
|
if (stmp == stmp2)
|
||||||
{
|
{
|
||||||
pEltFound = pIG;
|
pEltFound = pIG;
|
||||||
|
@ -1408,6 +1411,9 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" ));
|
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" ));
|
||||||
if (!ptr) return false;
|
if (!ptr) return false;
|
||||||
|
|
||||||
|
string stmp2 = toLower(string((const char*)ptr));
|
||||||
|
|
||||||
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
||||||
CInterfaceElement *pEltFound = NULL;
|
CInterfaceElement *pEltFound = NULL;
|
||||||
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
||||||
|
@ -1416,8 +1422,7 @@ namespace NLGUI
|
||||||
for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j)
|
for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j)
|
||||||
{
|
{
|
||||||
CInterfaceGroup *pIG = rMG.Group->getGroups()[j];
|
CInterfaceGroup *pIG = rMG.Group->getGroups()[j];
|
||||||
string stmp = strlwr(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size()));
|
string stmp = toLower(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size()));
|
||||||
string stmp2 = strlwr(string((const char*)ptr));
|
|
||||||
if (stmp == stmp2)
|
if (stmp == stmp2)
|
||||||
{
|
{
|
||||||
pEltFound = pIG;
|
pEltFound = pIG;
|
||||||
|
@ -1600,6 +1605,9 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" ));
|
CXMLAutoPtr ptr((const char*) xmlGetProp( cur, (xmlChar*)"node" ));
|
||||||
if (!ptr) return false;
|
if (!ptr) return false;
|
||||||
|
|
||||||
|
string stmp2 = toLower(string((const char*)ptr));
|
||||||
|
|
||||||
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
|
||||||
CInterfaceElement *pEltFound = NULL;
|
CInterfaceElement *pEltFound = NULL;
|
||||||
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
for (uint32 i = 0; i < _MasterGroups.size(); ++i)
|
||||||
|
@ -1608,8 +1616,8 @@ namespace NLGUI
|
||||||
for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j)
|
for (uint32 j = 0; j < rMG.Group->getGroups().size(); ++j)
|
||||||
{
|
{
|
||||||
CInterfaceGroup *pIG = rMG.Group->getGroups()[j];
|
CInterfaceGroup *pIG = rMG.Group->getGroups()[j];
|
||||||
string stmp = strlwr(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size()));
|
string stmp = toLower(pIG->getId().substr(pIG->getId().rfind(':')+1,pIG->getId().size()));
|
||||||
string stmp2 = strlwr(string((const char*)ptr));
|
|
||||||
if (stmp == stmp2)
|
if (stmp == stmp2)
|
||||||
{
|
{
|
||||||
pEltFound = pIG;
|
pEltFound = pIG;
|
||||||
|
|
|
@ -623,6 +623,23 @@ namespace NLGUI
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
sint64 CLuaState::getTableIntegerValue(const char *name, sint64 defaultValue)
|
||||||
|
{
|
||||||
|
//H_AUTO(Lua_CLuaState_getTableIntegerValue)
|
||||||
|
nlassert(name);
|
||||||
|
push(name);
|
||||||
|
getTable(-2);
|
||||||
|
if (isNil())
|
||||||
|
{
|
||||||
|
pop();
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
sint64 result = toInteger(-1);
|
||||||
|
pop();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
const char *CLuaState::getTableStringValue(const char *name, const char *defaultValue)
|
const char *CLuaState::getTableStringValue(const char *name, const char *defaultValue)
|
||||||
{
|
{
|
||||||
|
|
|
@ -231,20 +231,24 @@ namespace NLGUI
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LUA_VERSION_NUM < 503
|
||||||
|
#define lua_isinteger(a, b) lua_isnumber(a, b)
|
||||||
|
#endif
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
#define LUA_REGISTER_BASIC(_type_) \
|
#define LUA_REGISTER_BASIC(_type_) \
|
||||||
luabind::detail::yes_t is_user_defined(luabind::detail::by_value<_type_>); \
|
luabind::detail::yes_t is_user_defined(luabind::detail::by_value<_type_>); \
|
||||||
_type_ convert_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \
|
_type_ convert_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \
|
||||||
{ \
|
{ \
|
||||||
return (_type_)lua_tonumber(L, index); \
|
return (_type_)lua_tointeger(L, index); \
|
||||||
} \
|
} \
|
||||||
int match_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \
|
int match_lua_to_cpp(lua_State* L, luabind::detail::by_value<_type_>, int index) \
|
||||||
{ \
|
{ \
|
||||||
if (lua_isnumber(L, index)) return 0; else return -1; \
|
if (lua_isinteger(L, index)) return 0; else return -1; \
|
||||||
} \
|
} \
|
||||||
void convert_cpp_to_lua(lua_State* L, const _type_& v) \
|
void convert_cpp_to_lua(lua_State* L, const _type_& v) \
|
||||||
{ \
|
{ \
|
||||||
lua_pushnumber(L, (double)v); \
|
lua_pushinteger(L, (double)v); \
|
||||||
}
|
}
|
||||||
|
|
||||||
// Basic LUA types
|
// Basic LUA types
|
||||||
|
@ -258,8 +262,6 @@ namespace NLGUI
|
||||||
LUA_REGISTER_BASIC(uint16)
|
LUA_REGISTER_BASIC(uint16)
|
||||||
LUA_REGISTER_BASIC(sint32)
|
LUA_REGISTER_BASIC(sint32)
|
||||||
LUA_REGISTER_BASIC(uint32)
|
LUA_REGISTER_BASIC(uint32)
|
||||||
// LUA_REGISTER_BASIC(sint)
|
|
||||||
// LUA_REGISTER_BASIC(uint)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -942,8 +944,8 @@ namespace NLGUI
|
||||||
CLuaIHM::checkArgCount(ls, "getWindowSize", 0);
|
CLuaIHM::checkArgCount(ls, "getWindowSize", 0);
|
||||||
uint32 w, h;
|
uint32 w, h;
|
||||||
CViewRenderer::getInstance()->getScreenSize(w, h);
|
CViewRenderer::getInstance()->getScreenSize(w, h);
|
||||||
ls.push((double) w);
|
ls.push(w);
|
||||||
ls.push((double) h);
|
ls.push(h);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -974,8 +976,8 @@ namespace NLGUI
|
||||||
CIFile fs(CPath::lookup(textureName).c_str());
|
CIFile fs(CPath::lookup(textureName).c_str());
|
||||||
bitmap.load(fs);
|
bitmap.load(fs);
|
||||||
|
|
||||||
ls.push((double) bitmap.getWidth());
|
ls.push(bitmap.getWidth());
|
||||||
ls.push((double) bitmap.getHeight());
|
ls.push(bitmap.getHeight());
|
||||||
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
@ -1098,7 +1100,7 @@ namespace NLGUI
|
||||||
ls.push(value.getBool());
|
ls.push(value.getBool());
|
||||||
break;
|
break;
|
||||||
case CInterfaceExprValue::Integer:
|
case CInterfaceExprValue::Integer:
|
||||||
ls.push((double)value.getInteger());
|
ls.push(value.getInteger());
|
||||||
break;
|
break;
|
||||||
case CInterfaceExprValue::Double:
|
case CInterfaceExprValue::Double:
|
||||||
ls.push(value.getDouble());
|
ls.push(value.getDouble());
|
||||||
|
@ -1361,7 +1363,7 @@ namespace NLGUI
|
||||||
ls.newTable();
|
ls.newTable();
|
||||||
for(uint k = 0; k < files.size(); ++k)
|
for(uint k = 0; k < files.size(); ++k)
|
||||||
{
|
{
|
||||||
ls.push((double) k);
|
ls.push(k);
|
||||||
ls.push(files[k]);
|
ls.push(files[k]);
|
||||||
ls.setTable(-3);
|
ls.setTable(-3);
|
||||||
}
|
}
|
||||||
|
@ -1381,10 +1383,10 @@ namespace NLGUI
|
||||||
ls.push( (reflectedObject.*(property.GetMethod.GetBool))() );
|
ls.push( (reflectedObject.*(property.GetMethod.GetBool))() );
|
||||||
break;
|
break;
|
||||||
case CReflectedProperty::SInt32:
|
case CReflectedProperty::SInt32:
|
||||||
ls.push( (lua_Number)(reflectedObject.*(property.GetMethod.GetSInt32))() );
|
ls.push( (reflectedObject.*(property.GetMethod.GetSInt32))() );
|
||||||
break;
|
break;
|
||||||
case CReflectedProperty::Float:
|
case CReflectedProperty::Float:
|
||||||
ls.push( (lua_Number)(reflectedObject.*(property.GetMethod.GetFloat))() );
|
ls.push( (reflectedObject.*(property.GetMethod.GetFloat))() );
|
||||||
break;
|
break;
|
||||||
case CReflectedProperty::String:
|
case CReflectedProperty::String:
|
||||||
ls.push( (reflectedObject.*(property.GetMethod.GetString))() );
|
ls.push( (reflectedObject.*(property.GetMethod.GetString))() );
|
||||||
|
@ -1447,13 +1449,13 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
case CReflectedProperty::SInt32:
|
case CReflectedProperty::SInt32:
|
||||||
{
|
{
|
||||||
sint32 val= (sint32)ls.toNumber(stackIndex);
|
sint32 val= (sint32)ls.toInteger(stackIndex);
|
||||||
(target.*(property.SetMethod.SetSInt32))(val);
|
(target.*(property.SetMethod.SetSInt32))(val);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case CReflectedProperty::UInt32:
|
case CReflectedProperty::UInt32:
|
||||||
{
|
{
|
||||||
uint32 val= (uint32)ls.toNumber(stackIndex);
|
uint32 val= (uint32)ls.toInteger(stackIndex);
|
||||||
(target.*(property.SetMethod.SetUInt32))(val);
|
(target.*(property.SetMethod.SetUInt32))(val);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1474,7 +1476,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
ucstring val;
|
ucstring val;
|
||||||
// Additionaly return of CInterfaceExpr may be std::string... test std string too
|
// Additionaly return of CInterfaceExpr may be std::string... test std string too
|
||||||
if(ls.isString() || ls.isNumber())
|
if(ls.isString() || ls.isNumber() || ls.isInteger())
|
||||||
{
|
{
|
||||||
std::string str;
|
std::string str;
|
||||||
ls.toString(stackIndex, str);
|
ls.toString(stackIndex, str);
|
||||||
|
|
|
@ -33,8 +33,20 @@ namespace NLGUI
|
||||||
|
|
||||||
CLuaManager::~CLuaManager()
|
CLuaManager::~CLuaManager()
|
||||||
{
|
{
|
||||||
delete luaState;
|
if (luaState)
|
||||||
luaState = NULL;
|
{
|
||||||
|
delete luaState;
|
||||||
|
luaState = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaManager::releaseInstance()
|
||||||
|
{
|
||||||
|
if (instance)
|
||||||
|
{
|
||||||
|
delete instance;
|
||||||
|
instance = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CLuaManager::executeLuaScript( const std::string &luaScript, bool smallScript )
|
bool CLuaManager::executeLuaScript( const std::string &luaScript, bool smallScript )
|
||||||
|
@ -60,7 +72,8 @@ namespace NLGUI
|
||||||
|
|
||||||
void CLuaManager::ResetLuaState()
|
void CLuaManager::ResetLuaState()
|
||||||
{
|
{
|
||||||
delete luaState;
|
if (luaState) delete luaState;
|
||||||
|
|
||||||
luaState = new CLuaState( debugLua );
|
luaState = new CLuaState( debugLua );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,8 @@ namespace NLGUI
|
||||||
// *************************************************
|
// *************************************************
|
||||||
bool CLuaObject::isNil() const { push(); bool result = _LuaState->isNil(); _LuaState->pop(); return result; }
|
bool CLuaObject::isNil() const { push(); bool result = _LuaState->isNil(); _LuaState->pop(); return result; }
|
||||||
bool CLuaObject::isNumber() const { push(); bool result = _LuaState->isNumber(); _LuaState->pop(); return result; }
|
bool CLuaObject::isNumber() const { push(); bool result = _LuaState->isNumber(); _LuaState->pop(); return result; }
|
||||||
bool CLuaObject::isBoolean() const { push(); bool result = _LuaState->isBoolean(); _LuaState->pop(); return result; }
|
bool CLuaObject::isInteger() const { push(); bool result = _LuaState->isInteger(); _LuaState->pop(); return result; }
|
||||||
|
bool CLuaObject::isBoolean() const { push(); bool result = _LuaState->isBoolean(); _LuaState->pop(); return result; }
|
||||||
bool CLuaObject::isString() const { push(); bool result = _LuaState->isString(); _LuaState->pop(); return result; }
|
bool CLuaObject::isString() const { push(); bool result = _LuaState->isString(); _LuaState->pop(); return result; }
|
||||||
bool CLuaObject::isFunction() const { push(); bool result = _LuaState->isFunction(); _LuaState->pop(); return result; }
|
bool CLuaObject::isFunction() const { push(); bool result = _LuaState->isFunction(); _LuaState->pop(); return result; }
|
||||||
bool CLuaObject::isCFunction() const { push(); bool result = _LuaState->isCFunction(); _LuaState->pop(); return result; }
|
bool CLuaObject::isCFunction() const { push(); bool result = _LuaState->isCFunction(); _LuaState->pop(); return result; }
|
||||||
|
@ -168,6 +169,7 @@ namespace NLGUI
|
||||||
// *************************************************
|
// *************************************************
|
||||||
bool CLuaObject::toBoolean() const { push(); bool result = _LuaState->toBoolean(); _LuaState->pop(); return result; }
|
bool CLuaObject::toBoolean() const { push(); bool result = _LuaState->toBoolean(); _LuaState->pop(); return result; }
|
||||||
lua_Number CLuaObject::toNumber() const { push(); lua_Number result = _LuaState->toNumber(); _LuaState->pop(); return result; }
|
lua_Number CLuaObject::toNumber() const { push(); lua_Number result = _LuaState->toNumber(); _LuaState->pop(); return result; }
|
||||||
|
lua_Integer CLuaObject::toInteger() const { push(); lua_Integer result = _LuaState->toInteger(); _LuaState->pop(); return result; }
|
||||||
std::string CLuaObject::toString() const
|
std::string CLuaObject::toString() const
|
||||||
{
|
{
|
||||||
push();
|
push();
|
||||||
|
@ -194,6 +196,8 @@ namespace NLGUI
|
||||||
CLuaObject::operator bool() const { return toBoolean(); }
|
CLuaObject::operator bool() const { return toBoolean(); }
|
||||||
CLuaObject::operator float() const { return (float) toNumber(); }
|
CLuaObject::operator float() const { return (float) toNumber(); }
|
||||||
CLuaObject::operator double() const { return (double) toNumber(); }
|
CLuaObject::operator double() const { return (double) toNumber(); }
|
||||||
|
CLuaObject::operator sint32() const { return (sint32) toInteger(); }
|
||||||
|
CLuaObject::operator sint64() const { return (sint64) toInteger(); }
|
||||||
CLuaObject::operator std::string() const { return toString(); }
|
CLuaObject::operator std::string() const { return toString(); }
|
||||||
|
|
||||||
|
|
||||||
|
@ -385,6 +389,48 @@ namespace NLGUI
|
||||||
_LuaState->pop();
|
_LuaState->pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *************************************************
|
||||||
|
void CLuaObject::setValue(const char *key, uint32 value) throw(ELuaNotATable)
|
||||||
|
{
|
||||||
|
nlassert(key);
|
||||||
|
nlassert(isValid());
|
||||||
|
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%u' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename()));
|
||||||
|
CLuaStackChecker lsc(_LuaState);
|
||||||
|
push();
|
||||||
|
_LuaState->push(key);
|
||||||
|
_LuaState->push(value);
|
||||||
|
_LuaState->setTable(-3);
|
||||||
|
_LuaState->pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
// *************************************************
|
||||||
|
void CLuaObject::setValue(const char *key, sint32 value) throw(ELuaNotATable)
|
||||||
|
{
|
||||||
|
nlassert(key);
|
||||||
|
nlassert(isValid());
|
||||||
|
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%d' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename()));
|
||||||
|
CLuaStackChecker lsc(_LuaState);
|
||||||
|
push();
|
||||||
|
_LuaState->push(key);
|
||||||
|
_LuaState->push(value);
|
||||||
|
_LuaState->setTable(-3);
|
||||||
|
_LuaState->pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
// *************************************************
|
||||||
|
void CLuaObject::setValue(const char *key, sint64 value) throw(ELuaNotATable)
|
||||||
|
{
|
||||||
|
nlassert(key);
|
||||||
|
nlassert(isValid());
|
||||||
|
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%d"NL_I64"' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename()));
|
||||||
|
CLuaStackChecker lsc(_LuaState);
|
||||||
|
push();
|
||||||
|
_LuaState->push(key);
|
||||||
|
_LuaState->push(value);
|
||||||
|
_LuaState->setTable(-3);
|
||||||
|
_LuaState->pop();
|
||||||
|
}
|
||||||
|
|
||||||
// *************************************************
|
// *************************************************
|
||||||
void CLuaObject::eraseValue(const char *key) throw(ELuaNotATable)
|
void CLuaObject::eraseValue(const char *key) throw(ELuaNotATable)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,9 @@ namespace NLGUI
|
||||||
_TxIdPanR2 = -2;
|
_TxIdPanR2 = -2;
|
||||||
_TxIdCanPanR2 = -2;
|
_TxIdCanPanR2 = -2;
|
||||||
|
|
||||||
|
_OffsetX = 0;
|
||||||
|
_OffsetY = 0;
|
||||||
|
|
||||||
// The pointer must be draw over ALL layers
|
// The pointer must be draw over ALL layers
|
||||||
_RenderLayer= VR_LAYER_MAX;
|
_RenderLayer= VR_LAYER_MAX;
|
||||||
_Color = CRGBA(255,255,255,255);
|
_Color = CRGBA(255,255,255,255);
|
||||||
|
@ -59,6 +62,7 @@ namespace NLGUI
|
||||||
_StringMode = false;
|
_StringMode = false;
|
||||||
_ForceStringMode = false;
|
_ForceStringMode = false;
|
||||||
_StringCursor = NULL;
|
_StringCursor = NULL;
|
||||||
|
_StringCursorHardware = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CViewPointer::forceLink()
|
void CViewPointer::forceLink()
|
||||||
|
@ -80,56 +84,43 @@ namespace NLGUI
|
||||||
_OffsetY = getY();
|
_OffsetY = getY();
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_default");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_default");
|
||||||
if (prop) _TxDefault = (const char *) prop;
|
if (prop) _TxDefault = NLMISC::toLower ((const char *) prop);
|
||||||
_TxDefault = NLMISC::strlwr (_TxDefault);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_move_window");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_move_window");
|
||||||
if (prop) _TxMoveWindow = (const char *) prop;
|
if (prop) _TxMoveWindow = NLMISC::toLower ((const char *) prop);
|
||||||
_TxMoveWindow = NLMISC::strlwr (_TxMoveWindow);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_BR_TL");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_BR_TL");
|
||||||
if (prop) _TxResizeBRTL = (const char *) prop;
|
if (prop) _TxResizeBRTL = NLMISC::toLower ((const char *) prop);
|
||||||
_TxResizeBRTL = NLMISC::strlwr (_TxResizeBRTL);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_BL_TR");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_BL_TR");
|
||||||
if (prop) _TxResizeBLTR = (const char *) prop;
|
if (prop) _TxResizeBLTR = NLMISC::toLower ((const char *) prop);
|
||||||
_TxResizeBLTR = NLMISC::strlwr (_TxResizeBLTR);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_TB");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_TB");
|
||||||
if (prop) _TxResizeTB = (const char *) prop;
|
if (prop) _TxResizeTB = NLMISC::toLower ((const char *) prop);
|
||||||
_TxResizeTB = NLMISC::strlwr (_TxResizeTB);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_LR");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_resize_LR");
|
||||||
if (prop) _TxResizeLR = (const char *) prop;
|
if (prop) _TxResizeLR = NLMISC::toLower ((const char *) prop);
|
||||||
_TxResizeLR = NLMISC::strlwr (_TxResizeLR);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_rotate");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_rotate");
|
||||||
if (prop) _TxRotate = (const char *) prop;
|
if (prop) _TxRotate = NLMISC::toLower ((const char *) prop);
|
||||||
_TxRotate = NLMISC::strlwr (_TxRotate);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_scale");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_scale");
|
||||||
if (prop) _TxScale = (const char *) prop;
|
if (prop) _TxScale = NLMISC::toLower ((const char *) prop);
|
||||||
_TxScale = NLMISC::strlwr (_TxScale);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_colpick");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_colpick");
|
||||||
if (prop) _TxColPick = (const char *) prop;
|
if (prop) _TxColPick = NLMISC::toLower ((const char *) prop);
|
||||||
_TxColPick = NLMISC::strlwr (_TxColPick);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_pan");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_pan");
|
||||||
if (prop) _TxPan = (const char *) prop;
|
if (prop) _TxPan = NLMISC::toLower ((const char *) prop);
|
||||||
_TxPan = NLMISC::strlwr (_TxPan);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_can_pan");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_can_pan");
|
||||||
if (prop) _TxCanPan = (const char *) prop;
|
if (prop) _TxCanPan = NLMISC::toLower ((const char *) prop);
|
||||||
_TxCanPan = NLMISC::strlwr (_TxCanPan);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_pan_r2");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_pan_r2");
|
||||||
if (prop) _TxPanR2 = (const char *) prop;
|
if (prop) _TxPanR2 = NLMISC::toLower ((const char *) prop);
|
||||||
_TxPanR2 = NLMISC::strlwr (_TxPanR2);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_can_pan_r2");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_can_pan_r2");
|
||||||
if (prop) _TxCanPanR2 = (const char *) prop;
|
if (prop) _TxCanPanR2 = NLMISC::toLower ((const char *) prop);
|
||||||
_TxCanPanR2 = NLMISC::strlwr (_TxCanPanR2);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"color");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"color");
|
||||||
if (prop) _Color = convertColor(prop);
|
if (prop) _Color = convertColor(prop);
|
||||||
|
|
|
@ -854,12 +854,11 @@ namespace NLGUI
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Look if already existing
|
// Look if already existing
|
||||||
string sLwrGTName = strlwr(sGlobalTextureName);
|
string sLwrGTName = toLower(sGlobalTextureName);
|
||||||
TGlobalTextureList::iterator ite = _GlobalTextures.begin();
|
TGlobalTextureList::iterator ite = _GlobalTextures.begin();
|
||||||
while (ite != _GlobalTextures.end())
|
while (ite != _GlobalTextures.end())
|
||||||
{
|
{
|
||||||
std::string sText = strlwr(ite->Name);
|
if (toLower(ite->Name) == sLwrGTName)
|
||||||
if (sText == sLwrGTName)
|
|
||||||
break;
|
break;
|
||||||
ite++;
|
ite++;
|
||||||
}
|
}
|
||||||
|
@ -984,11 +983,11 @@ namespace NLGUI
|
||||||
*/
|
*/
|
||||||
NL3D::UTexture *CViewRenderer::getGlobalTexture(const std::string &name)
|
NL3D::UTexture *CViewRenderer::getGlobalTexture(const std::string &name)
|
||||||
{
|
{
|
||||||
string sLwrGTName = strlwr(name);
|
string sLwrGTName = NLMISC::toLower(name);
|
||||||
TGlobalTextureList::iterator ite = _GlobalTextures.begin();
|
TGlobalTextureList::iterator ite = _GlobalTextures.begin();
|
||||||
while (ite != _GlobalTextures.end())
|
while (ite != _GlobalTextures.end())
|
||||||
{
|
{
|
||||||
std::string sText = strlwr(ite->Name);
|
std::string sText = NLMISC::toLower(ite->Name);
|
||||||
if (sText == sLwrGTName)
|
if (sText == sLwrGTName)
|
||||||
break;
|
break;
|
||||||
ite++;
|
ite++;
|
||||||
|
|
|
@ -42,6 +42,8 @@ namespace NLGUI
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CViewText::setupDefault ()
|
void CViewText::setupDefault ()
|
||||||
{
|
{
|
||||||
|
_ParentElm = NULL;
|
||||||
|
|
||||||
_CaseMode = CaseNormal;
|
_CaseMode = CaseNormal;
|
||||||
_Underlined = false;
|
_Underlined = false;
|
||||||
_StrikeThrough = false;
|
_StrikeThrough = false;
|
||||||
|
@ -2650,6 +2652,10 @@ namespace NLGUI
|
||||||
void CViewText::onInvalidateContent()
|
void CViewText::onInvalidateContent()
|
||||||
{
|
{
|
||||||
_InvalidTextContext= true;
|
_InvalidTextContext= true;
|
||||||
|
|
||||||
|
if (_ParentElm)
|
||||||
|
_ParentElm->invalidateCoords();
|
||||||
|
|
||||||
invalidateCoords();
|
invalidateCoords();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1026,7 +1026,7 @@ namespace NLGUI
|
||||||
void CWidgetManager::reset()
|
void CWidgetManager::reset()
|
||||||
{
|
{
|
||||||
setCurContextHelp( NULL );
|
setCurContextHelp( NULL );
|
||||||
|
|
||||||
_ViewsUnderPointer.clear();
|
_ViewsUnderPointer.clear();
|
||||||
_CtrlsUnderPointer.clear();
|
_CtrlsUnderPointer.clear();
|
||||||
_GroupsUnderPointer.clear();
|
_GroupsUnderPointer.clear();
|
||||||
|
@ -1254,7 +1254,7 @@ namespace NLGUI
|
||||||
sint32 wParent, sint32 hParent )
|
sint32 wParent, sint32 hParent )
|
||||||
{
|
{
|
||||||
CCtrlBase::TToolTipParentType parentType= newCtrl->getToolTipParent();
|
CCtrlBase::TToolTipParentType parentType= newCtrl->getToolTipParent();
|
||||||
CInterfaceGroup *groupContextHelp =
|
CInterfaceGroup *groupContextHelp =
|
||||||
getWindowForActiveMasterGroup(newCtrl->getContextHelpWindowName());
|
getWindowForActiveMasterGroup(newCtrl->getContextHelpWindowName());
|
||||||
|
|
||||||
uint32 _ScreenH, _ScreenW;
|
uint32 _ScreenH, _ScreenW;
|
||||||
|
@ -1383,7 +1383,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
if (!newCtrl) return;
|
if (!newCtrl) return;
|
||||||
if (!newCtrl->getInvalidCoords()) return;
|
if (!newCtrl->getInvalidCoords()) return;
|
||||||
|
|
||||||
CInterfaceGroup *groupContextHelp =
|
CInterfaceGroup *groupContextHelp =
|
||||||
getWindowForActiveMasterGroup(newCtrl->getContextHelpWindowName());
|
getWindowForActiveMasterGroup(newCtrl->getContextHelpWindowName());
|
||||||
|
|
||||||
|
@ -1450,7 +1450,7 @@ namespace NLGUI
|
||||||
|
|
||||||
|
|
||||||
// **** resolve auto posref
|
// **** resolve auto posref
|
||||||
uint clampCount =
|
uint clampCount =
|
||||||
adjustTooltipPosition( newCtrl, win, newCtrl->getToolTipParentPosRef(),
|
adjustTooltipPosition( newCtrl, win, newCtrl->getToolTipParentPosRef(),
|
||||||
newCtrl->getToolTipPosRef(), xParent, yParent,
|
newCtrl->getToolTipPosRef(), xParent, yParent,
|
||||||
wParent, hParent);
|
wParent, hParent);
|
||||||
|
@ -1458,7 +1458,7 @@ namespace NLGUI
|
||||||
if (clampCount != 0)
|
if (clampCount != 0)
|
||||||
{
|
{
|
||||||
// try to fallback on alternate tooltip posref
|
// try to fallback on alternate tooltip posref
|
||||||
uint altClampCount =
|
uint altClampCount =
|
||||||
adjustTooltipPosition( newCtrl, win, newCtrl->getToolTipParentPosRefAlt(),
|
adjustTooltipPosition( newCtrl, win, newCtrl->getToolTipParentPosRefAlt(),
|
||||||
newCtrl->getToolTipPosRefAlt(), xParent, yParent,
|
newCtrl->getToolTipPosRefAlt(), xParent, yParent,
|
||||||
wParent, hParent);
|
wParent, hParent);
|
||||||
|
@ -1961,6 +1961,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
while (cb);
|
while (cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if screen size changed
|
// Check if screen size changed
|
||||||
uint32 w, h;
|
uint32 w, h;
|
||||||
CViewRenderer::getInstance()->checkNewScreenSize ();
|
CViewRenderer::getInstance()->checkNewScreenSize ();
|
||||||
|
@ -1974,7 +1975,7 @@ namespace NLGUI
|
||||||
setScreenWH( w, h );
|
setScreenWH( w, h );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update global color from database
|
// Update global color from database
|
||||||
if (!_RProp)
|
if (!_RProp)
|
||||||
{
|
{
|
||||||
|
@ -1983,6 +1984,7 @@ namespace NLGUI
|
||||||
_BProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B");
|
_BProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B");
|
||||||
_AProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A");
|
_AProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A");
|
||||||
}
|
}
|
||||||
|
|
||||||
setGlobalColor(NLMISC::CRGBA(
|
setGlobalColor(NLMISC::CRGBA(
|
||||||
(uint8)_RProp->getValue32(),
|
(uint8)_RProp->getValue32(),
|
||||||
(uint8)_GProp->getValue32(),
|
(uint8)_GProp->getValue32(),
|
||||||
|
@ -1996,7 +1998,7 @@ namespace NLGUI
|
||||||
c.B = gc.B;
|
c.B = gc.B;
|
||||||
c.A = (uint8) (( (uint16) c.A * (uint16) getContentAlpha() ) >> 8);
|
c.A = (uint8) (( (uint16) c.A * (uint16) getContentAlpha() ) >> 8);
|
||||||
setGlobalColorForContent( c );
|
setGlobalColorForContent( c );
|
||||||
|
|
||||||
// Update global alphaS from database
|
// Update global alphaS from database
|
||||||
updateGlobalAlphas();
|
updateGlobalAlphas();
|
||||||
|
|
||||||
|
@ -2005,7 +2007,7 @@ namespace NLGUI
|
||||||
Computed String are rendered in on big drawQuads at last part of each layer
|
Computed String are rendered in on big drawQuads at last part of each layer
|
||||||
*/
|
*/
|
||||||
CDBManager::getInstance()->flushObserverCalls();
|
CDBManager::getInstance()->flushObserverCalls();
|
||||||
|
|
||||||
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
|
||||||
{
|
{
|
||||||
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
|
||||||
|
@ -2158,7 +2160,7 @@ namespace NLGUI
|
||||||
bool CWidgetManager::handleKeyboardEvent( const CEventDescriptor &evnt )
|
bool CWidgetManager::handleKeyboardEvent( const CEventDescriptor &evnt )
|
||||||
{
|
{
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
||||||
CEventDescriptorKey &eventDesc = (CEventDescriptorKey&)evnt;
|
CEventDescriptorKey &eventDesc = (CEventDescriptorKey&)evnt;
|
||||||
|
|
||||||
//_LastEventKeyDesc = eventDesc;
|
//_LastEventKeyDesc = eventDesc;
|
||||||
|
@ -2541,7 +2543,7 @@ namespace NLGUI
|
||||||
|
|
||||||
|
|
||||||
if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightup)
|
if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightup)
|
||||||
{
|
{
|
||||||
if (!handled)
|
if (!handled)
|
||||||
if (pNewCurrentWnd != NULL)
|
if (pNewCurrentWnd != NULL)
|
||||||
pNewCurrentWnd->handleEvent(evnt);
|
pNewCurrentWnd->handleEvent(evnt);
|
||||||
|
@ -2589,7 +2591,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
_CapturedView = NULL;
|
_CapturedView = NULL;
|
||||||
|
|
||||||
if( CInterfaceElement::getEditorMode() )
|
if( CInterfaceElement::getEditorMode() )
|
||||||
stopDragging();
|
stopDragging();
|
||||||
}
|
}
|
||||||
|
@ -2634,7 +2636,7 @@ namespace NLGUI
|
||||||
if( eventDesc.getType() != CEventDescriptor::mouse )
|
if( eventDesc.getType() != CEventDescriptor::mouse )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const CEventDescriptorMouse &e = static_cast< const CEventDescriptorMouse& >( eventDesc );
|
const CEventDescriptorMouse &e = static_cast< const CEventDescriptorMouse& >( eventDesc );
|
||||||
|
|
||||||
if( e.getEventTypeExtended() != CEventDescriptorMouse::mousemove )
|
if( e.getEventTypeExtended() != CEventDescriptorMouse::mousemove )
|
||||||
return false;
|
return false;
|
||||||
|
@ -2699,7 +2701,7 @@ namespace NLGUI
|
||||||
|
|
||||||
e->setParent( NULL );
|
e->setParent( NULL );
|
||||||
draggedElement = e;
|
draggedElement = e;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2715,7 +2717,7 @@ namespace NLGUI
|
||||||
g = tw;
|
g = tw;
|
||||||
|
|
||||||
std::string oldid = e->getId();
|
std::string oldid = e->getId();
|
||||||
|
|
||||||
e->setParent( g );
|
e->setParent( g );
|
||||||
e->setIdRecurse( e->getShortId() );
|
e->setIdRecurse( e->getShortId() );
|
||||||
e->setParentPos( g );
|
e->setParentPos( g );
|
||||||
|
@ -2730,7 +2732,7 @@ namespace NLGUI
|
||||||
onWidgetMoved( oldid, e->getId() );
|
onWidgetMoved( oldid, e->getId() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CWidgetManager::movePointer (sint32 dx, sint32 dy)
|
void CWidgetManager::movePointer (sint32 dx, sint32 dy)
|
||||||
{
|
{
|
||||||
|
@ -2866,17 +2868,19 @@ namespace NLGUI
|
||||||
void CWidgetManager::unregisterClockMsgTarget(CCtrlBase *vb)
|
void CWidgetManager::unregisterClockMsgTarget(CCtrlBase *vb)
|
||||||
{
|
{
|
||||||
if (!vb) return;
|
if (!vb) return;
|
||||||
std::vector<CCtrlBase*>::iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb);
|
std::list<CCtrlBase*>::iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb);
|
||||||
if (it != _ClockMsgTargets.end())
|
if (it != _ClockMsgTargets.end())
|
||||||
{
|
{
|
||||||
_ClockMsgTargets.erase(it);
|
// instead of deleting, just mark as deleted incase we are inside iterating loop,
|
||||||
|
// it will be removed in sendClockTickEvent
|
||||||
|
(*it) = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
bool CWidgetManager::isClockMsgTarget(CCtrlBase *vb) const
|
bool CWidgetManager::isClockMsgTarget(CCtrlBase *vb) const
|
||||||
{
|
{
|
||||||
std::vector<CCtrlBase*>::const_iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb);
|
std::list<CCtrlBase*>::const_iterator it = std::find(_ClockMsgTargets.begin(), _ClockMsgTargets.end(), vb);
|
||||||
return it != _ClockMsgTargets.end();
|
return it != _ClockMsgTargets.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2895,10 +2899,16 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
|
|
||||||
// and send clock tick msg to ctrl that are registered
|
// and send clock tick msg to ctrl that are registered
|
||||||
std::vector<CCtrlBase*> clockMsgTarget = _ClockMsgTargets;
|
for(std::list<CCtrlBase*>::iterator it = _ClockMsgTargets.begin(); it != _ClockMsgTargets.end();)
|
||||||
for(std::vector<CCtrlBase*>::iterator it = clockMsgTarget.begin(); it != clockMsgTarget.end(); ++it)
|
|
||||||
{
|
{
|
||||||
(*it)->handleEvent(clockTick);
|
CCtrlBase* ctrl = *it;
|
||||||
|
if (ctrl)
|
||||||
|
{
|
||||||
|
ctrl->handleEvent(clockTick);
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
it = _ClockMsgTargets.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3083,7 +3093,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
const SMasterGroup &mg = _MasterGroups[ i ];
|
const SMasterGroup &mg = _MasterGroups[ i ];
|
||||||
|
|
||||||
std::vector< CInterfaceGroup* >::size_type j;
|
std::vector< CInterfaceGroup* >::size_type j;
|
||||||
for( j = 0; j < mg.Group->getNumGroup(); j++ )
|
for( j = 0; j < mg.Group->getNumGroup(); j++ )
|
||||||
{
|
{
|
||||||
CInterfaceGroup *g = mg.Group->getGroup( j );
|
CInterfaceGroup *g = mg.Group->getGroup( j );
|
||||||
|
@ -3098,8 +3108,8 @@ namespace NLGUI
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CWidgetManager::enableMouseHandling( bool handle )
|
void CWidgetManager::enableMouseHandling( bool handle )
|
||||||
{
|
{
|
||||||
|
@ -3108,7 +3118,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
if(!getPointer())
|
if(!getPointer())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If Left captured, reset
|
// If Left captured, reset
|
||||||
if( getCapturePointerLeft() )
|
if( getCapturePointerLeft() )
|
||||||
setCapturePointerLeft( NULL );
|
setCapturePointerLeft( NULL );
|
||||||
|
@ -3116,12 +3126,12 @@ namespace NLGUI
|
||||||
// Same for Right
|
// Same for Right
|
||||||
if( getCapturePointerRight() )
|
if( getCapturePointerRight() )
|
||||||
setCapturePointerRight( NULL );
|
setCapturePointerRight( NULL );
|
||||||
|
|
||||||
// Avoid any problem with modals
|
// Avoid any problem with modals
|
||||||
disableModalWindow();
|
disableModalWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
uint CWidgetManager::getUserDblClickDelay()
|
uint CWidgetManager::getUserDblClickDelay()
|
||||||
{
|
{
|
||||||
|
@ -3129,11 +3139,11 @@ namespace NLGUI
|
||||||
NLMISC::CCDBNodeLeaf *pNL = CDBManager::getInstance()->getDbProp("UI:SAVE:DOUBLE_CLICK_SPEED");
|
NLMISC::CCDBNodeLeaf *pNL = CDBManager::getInstance()->getDbProp("UI:SAVE:DOUBLE_CLICK_SPEED");
|
||||||
if( pNL != NULL )
|
if( pNL != NULL )
|
||||||
nVal = pNL->getValue32();
|
nVal = pNL->getValue32();
|
||||||
|
|
||||||
uint dbclickDelay = (uint)(DOUBLE_CLICK_MIN + (DOUBLE_CLICK_MAX-DOUBLE_CLICK_MIN) * (float)nVal / 100.0f);
|
uint dbclickDelay = (uint)(DOUBLE_CLICK_MIN + (DOUBLE_CLICK_MAX-DOUBLE_CLICK_MIN) * (float)nVal / 100.0f);
|
||||||
return dbclickDelay;
|
return dbclickDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CWidgetManager::setupOptions()
|
void CWidgetManager::setupOptions()
|
||||||
{
|
{
|
||||||
|
@ -3157,9 +3167,9 @@ namespace NLGUI
|
||||||
_SystemOptions[OptionTimeoutContext]= opt->getValue("context_timeout");
|
_SystemOptions[OptionTimeoutContext]= opt->getValue("context_timeout");
|
||||||
_SystemOptions[OptionTimeoutContextHtml]= opt->getValue("context_html_timeout");
|
_SystemOptions[OptionTimeoutContextHtml]= opt->getValue("context_html_timeout");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the alpha roll over speed
|
// Get the alpha roll over speed
|
||||||
float CWidgetManager::getAlphaRolloverSpeed()
|
float CWidgetManager::getAlphaRolloverSpeed()
|
||||||
{
|
{
|
||||||
|
@ -3173,7 +3183,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
_AlphaRolloverSpeedDB = NULL;
|
_AlphaRolloverSpeedDB = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWidgetManager::setContainerAlpha(uint8 alpha)
|
void CWidgetManager::setContainerAlpha(uint8 alpha)
|
||||||
{
|
{
|
||||||
_ContainerAlpha = alpha;
|
_ContainerAlpha = alpha;
|
||||||
|
@ -3368,11 +3378,11 @@ namespace NLGUI
|
||||||
|
|
||||||
void CWidgetManager::selectWidget( const std::string &name )
|
void CWidgetManager::selectWidget( const std::string &name )
|
||||||
{
|
{
|
||||||
std::vector< std::string >::iterator itr
|
std::vector< std::string >::iterator itr
|
||||||
= std::find( editorSelection.begin(), editorSelection.end(), name );
|
= std::find( editorSelection.begin(), editorSelection.end(), name );
|
||||||
|
|
||||||
CInterfaceElement *e = getElementFromId( name );
|
CInterfaceElement *e = getElementFromId( name );
|
||||||
|
|
||||||
if( itr != editorSelection.end() )
|
if( itr != editorSelection.end() )
|
||||||
{
|
{
|
||||||
// If multiselection is on unselect if already selected
|
// If multiselection is on unselect if already selected
|
||||||
|
@ -3397,7 +3407,7 @@ namespace NLGUI
|
||||||
e->setEditorSelected( true );
|
e->setEditorSelected( true );
|
||||||
editorSelection.push_back( name );
|
editorSelection.push_back( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
notifySelectionWatchers();
|
notifySelectionWatchers();
|
||||||
|
@ -3414,7 +3424,7 @@ namespace NLGUI
|
||||||
std::vector< IEditorSelectionWatcher* >::iterator itr = selectionWatchers.begin();
|
std::vector< IEditorSelectionWatcher* >::iterator itr = selectionWatchers.begin();
|
||||||
while( itr != selectionWatchers.end() )
|
while( itr != selectionWatchers.end() )
|
||||||
{
|
{
|
||||||
(*itr)->selectionChanged();
|
(*itr)->selectionChanged();
|
||||||
++itr;
|
++itr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3423,7 +3433,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
std::vector< IEditorSelectionWatcher* >::iterator itr =
|
std::vector< IEditorSelectionWatcher* >::iterator itr =
|
||||||
std::find( selectionWatchers.begin(), selectionWatchers.end(), watcher );
|
std::find( selectionWatchers.begin(), selectionWatchers.end(), watcher );
|
||||||
|
|
||||||
// We already have this watcher
|
// We already have this watcher
|
||||||
if( itr != selectionWatchers.end() )
|
if( itr != selectionWatchers.end() )
|
||||||
return;
|
return;
|
||||||
|
@ -3435,7 +3445,7 @@ namespace NLGUI
|
||||||
{
|
{
|
||||||
std::vector< IEditorSelectionWatcher* >::iterator itr =
|
std::vector< IEditorSelectionWatcher* >::iterator itr =
|
||||||
std::find( selectionWatchers.begin(), selectionWatchers.end(), watcher );
|
std::find( selectionWatchers.begin(), selectionWatchers.end(), watcher );
|
||||||
|
|
||||||
// We don't have this watcher
|
// We don't have this watcher
|
||||||
if( itr == selectionWatchers.end() )
|
if( itr == selectionWatchers.end() )
|
||||||
return;
|
return;
|
||||||
|
@ -3465,7 +3475,7 @@ namespace NLGUI
|
||||||
|
|
||||||
void CWidgetManager::registerWidgetWatcher( IWidgetWatcher *watcher )
|
void CWidgetManager::registerWidgetWatcher( IWidgetWatcher *watcher )
|
||||||
{
|
{
|
||||||
std::vector< IWidgetWatcher* >::const_iterator itr
|
std::vector< IWidgetWatcher* >::const_iterator itr
|
||||||
= std::find( widgetWatchers.begin(), widgetWatchers.end(), watcher );
|
= std::find( widgetWatchers.begin(), widgetWatchers.end(), watcher );
|
||||||
// already exists
|
// already exists
|
||||||
if( itr != widgetWatchers.end() )
|
if( itr != widgetWatchers.end() )
|
||||||
|
@ -3516,7 +3526,7 @@ namespace NLGUI
|
||||||
g->addView( v );
|
g->addView( v );
|
||||||
|
|
||||||
onWidgetAdded( v->getId() );
|
onWidgetAdded( v->getId() );
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3560,7 +3570,7 @@ namespace NLGUI
|
||||||
e->setParent( g );
|
e->setParent( g );
|
||||||
e->setParentPos( g );
|
e->setParentPos( g );
|
||||||
e->setParentSize( g );
|
e->setParentSize( g );
|
||||||
e->setIdRecurse( e->getShortId() );
|
e->setIdRecurse( e->getShortId() );
|
||||||
|
|
||||||
onWidgetMoved( oldId, e->getId() );
|
onWidgetMoved( oldId, e->getId() );
|
||||||
}
|
}
|
||||||
|
@ -3572,9 +3582,9 @@ namespace NLGUI
|
||||||
g->alignElements();
|
g->alignElements();
|
||||||
// Align the new group to the top window
|
// Align the new group to the top window
|
||||||
g->alignTo( getTopWindow() );
|
g->alignTo( getTopWindow() );
|
||||||
|
|
||||||
g->setActive( true );
|
g->setActive( true );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3626,7 +3636,7 @@ namespace NLGUI
|
||||||
|
|
||||||
SMasterGroup mg;
|
SMasterGroup mg;
|
||||||
mg.Group = root;
|
mg.Group = root;
|
||||||
|
|
||||||
root->setIdRecurse( project );
|
root->setIdRecurse( project );
|
||||||
root->setW( 1024 );
|
root->setW( 1024 );
|
||||||
root->setH( 768 );
|
root->setH( 768 );
|
||||||
|
@ -3658,7 +3668,7 @@ namespace NLGUI
|
||||||
VariableData v;
|
VariableData v;
|
||||||
v.type = "sint32";
|
v.type = "sint32";
|
||||||
v.value = "255";
|
v.value = "255";
|
||||||
|
|
||||||
v.entry = "UI:SAVE:COLOR:R";
|
v.entry = "UI:SAVE:COLOR:R";
|
||||||
parser->setVariable( v );
|
parser->setVariable( v );
|
||||||
|
|
||||||
|
@ -3670,7 +3680,7 @@ namespace NLGUI
|
||||||
|
|
||||||
v.entry = "UI:SAVE:COLOR:A";
|
v.entry = "UI:SAVE:COLOR:A";
|
||||||
parser->setVariable( v );
|
parser->setVariable( v );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ void xmlCheckNodeName (xmlNodePtr &node, const char *nodeName)
|
||||||
// Make an error message
|
// Make an error message
|
||||||
char tmp[512];
|
char tmp[512];
|
||||||
smprintf (tmp, 512, "LogicStateMachine STATE_MACHINE XML Syntax error in block line %d, node %s should be %s",
|
smprintf (tmp, 512, "LogicStateMachine STATE_MACHINE XML Syntax error in block line %d, node %s should be %s",
|
||||||
(int)node->line, node->name, nodeName);
|
node ? (int)node->line:-1, node->name, nodeName);
|
||||||
|
|
||||||
nlinfo (tmp);
|
nlinfo (tmp);
|
||||||
nlstop;
|
nlstop;
|
||||||
|
|
|
@ -187,6 +187,12 @@ IF(JPEG_FOUND)
|
||||||
TARGET_LINK_LIBRARIES(nelmisc ${JPEG_LIBRARY})
|
TARGET_LINK_LIBRARIES(nelmisc ${JPEG_LIBRARY})
|
||||||
ENDIF(JPEG_FOUND)
|
ENDIF(JPEG_FOUND)
|
||||||
|
|
||||||
|
IF(GIF_FOUND)
|
||||||
|
INCLUDE_DIRECTORIES(${GIF_INCLUDE_DIR})
|
||||||
|
ADD_DEFINITIONS(-DUSE_GIF)
|
||||||
|
TARGET_LINK_LIBRARIES(nelmisc ${GIF_LIBRARY})
|
||||||
|
ENDIF(GIF_FOUND)
|
||||||
|
|
||||||
IF(WITH_STATIC OR WIN32)
|
IF(WITH_STATIC OR WIN32)
|
||||||
TARGET_LINK_LIBRARIES(nelmisc ${PNG_LIBRARIES})
|
TARGET_LINK_LIBRARIES(nelmisc ${PNG_LIBRARIES})
|
||||||
ELSE(WITH_STATIC OR WIN32)
|
ELSE(WITH_STATIC OR WIN32)
|
||||||
|
|
|
@ -134,6 +134,19 @@ uint8 CBitmap::load(NLMISC::IStream &f, uint mipMapSkip)
|
||||||
}
|
}
|
||||||
#endif // USE_JPEG
|
#endif // USE_JPEG
|
||||||
|
|
||||||
|
#ifdef USE_GIF
|
||||||
|
if (fileType == GIF_HEADER)
|
||||||
|
{
|
||||||
|
#ifdef NEL_ALL_BITMAP_WHITE
|
||||||
|
uint8 result = readGIF(f);
|
||||||
|
MakeWhite (*this);
|
||||||
|
return result;
|
||||||
|
#else // NEL_ALL_BITMAP_WHITE
|
||||||
|
return readGIF(f);
|
||||||
|
#endif // NEL_ALL_BITMAP_WHITE
|
||||||
|
}
|
||||||
|
#endif // USE_GIF
|
||||||
|
|
||||||
// assuming it's TGA
|
// assuming it's TGA
|
||||||
NLMISC::IStream::TSeekOrigin origin= f.begin;
|
NLMISC::IStream::TSeekOrigin origin= f.begin;
|
||||||
if(!f.seek (0, origin))
|
if(!f.seek (0, origin))
|
||||||
|
@ -3149,6 +3162,25 @@ void CBitmap::loadSize(NLMISC::IStream &f, uint32 &retWidth, uint32 &retHeight)
|
||||||
}
|
}
|
||||||
while(!eof);
|
while(!eof);
|
||||||
}
|
}
|
||||||
|
else if(fileType == GIF_HEADER)
|
||||||
|
{
|
||||||
|
// check second part of header ("7a" or "9a" in 'GIF89a')
|
||||||
|
uint16 s;
|
||||||
|
f.serial(s);
|
||||||
|
if (s != 0x6137 && s != 0x6139)
|
||||||
|
{
|
||||||
|
nlwarning("Invalid GIF header, expected GIF87a or GIF89a");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16 lsWidth;
|
||||||
|
uint16 lsHeight;
|
||||||
|
f.serial(lsWidth);
|
||||||
|
f.serial(lsHeight);
|
||||||
|
|
||||||
|
retWidth = lsWidth;
|
||||||
|
retHeight = lsHeight;
|
||||||
|
}
|
||||||
// assuming it's TGA
|
// assuming it's TGA
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
315
code/nel/src/misc/bitmap_gif.cpp
Normal file
315
code/nel/src/misc/bitmap_gif.cpp
Normal file
|
@ -0,0 +1,315 @@
|
||||||
|
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "stdmisc.h"
|
||||||
|
#include "nel/misc/bitmap.h"
|
||||||
|
|
||||||
|
#ifdef USE_GIF
|
||||||
|
#include <gif_lib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
namespace NLMISC
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef USE_GIF
|
||||||
|
|
||||||
|
// GIFLIB_MAJOR is defined from version 5
|
||||||
|
#ifndef GIFLIB_MAJOR
|
||||||
|
#define GIFLIB_MAJOR 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static uint8 GIF_TRANSPARENT_MASK = 0x01;
|
||||||
|
static uint8 GIF_DISPOSE_MASK = 0x07;
|
||||||
|
static sint8 GIF_NOT_TRANSPARENT = -1;
|
||||||
|
|
||||||
|
static uint8 GIF_DISPOSE_NONE = 0;
|
||||||
|
static uint8 GIF_DISPOSE_LEAVE = 1;
|
||||||
|
static uint8 GIF_DISPOSE_BACKGROUND = 2;
|
||||||
|
static uint8 GIF_DISPOSE_RESTORE = 3;
|
||||||
|
|
||||||
|
static NLMISC::IStream *GIFStream = NULL;
|
||||||
|
|
||||||
|
#if GIFLIB_MAJOR < 5
|
||||||
|
static uint8 INTERLACED_OFFSET[] = { 0, 4, 2, 1 };
|
||||||
|
static uint8 INTERLACED_JUMP[] = { 8, 8, 4, 2 };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int readGIFData(GifFileType *gif, GifByteType *data, int length){
|
||||||
|
NLMISC::IStream *f = static_cast<NLMISC::IStream *>(gif->UserData);
|
||||||
|
|
||||||
|
if(!f->isReading()) return 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
f->serialBuffer((uint8*) data, length);
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
nlwarning("error while reading JPEG image");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------------------------------*\
|
||||||
|
readGIF
|
||||||
|
\*-------------------------------------------------------------------*/
|
||||||
|
uint8 CBitmap::readGIF( NLMISC::IStream &f )
|
||||||
|
{
|
||||||
|
if(!f.isReading()) return false;
|
||||||
|
|
||||||
|
{
|
||||||
|
// check gif canvas dimension
|
||||||
|
uint16 ver;
|
||||||
|
uint16 width;
|
||||||
|
uint16 height;
|
||||||
|
|
||||||
|
f.serial(ver);
|
||||||
|
f.serial(width);
|
||||||
|
f.serial(height);
|
||||||
|
|
||||||
|
// limit image size as we are using 32bit pixels
|
||||||
|
// 4000x4000x4 ~ 61MiB
|
||||||
|
if (width*height > 4000*4000)
|
||||||
|
{
|
||||||
|
nlwarning("GIF image size is too big (width=%d, height=%d)", width, height);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// rewind for gif decoder
|
||||||
|
f.seek(-10, IStream::current);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if GIFLIB_MAJOR >= 5
|
||||||
|
sint32 errorCode;
|
||||||
|
GifFileType *gif = DGifOpen(&f, readGIFData, &errorCode);
|
||||||
|
if (gif == NULL)
|
||||||
|
{
|
||||||
|
nlwarning("failed to open gif, error=%d", errorCode);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
GifFileType *gif = DGifOpen(&f, readGIFData);
|
||||||
|
if (gif == NULL)
|
||||||
|
{
|
||||||
|
nlwarning("failed to open gif, error=%d", GifLastError());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// this will read and decode all frames
|
||||||
|
sint32 ret = DGifSlurp(gif);
|
||||||
|
if (ret != GIF_OK)
|
||||||
|
{
|
||||||
|
nlwarning("failed to read gif, error=%d", ret);
|
||||||
|
#if GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1
|
||||||
|
DGifCloseFile(gif, &errorCode);
|
||||||
|
#else
|
||||||
|
DGifCloseFile(gif);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// resize target buffer
|
||||||
|
uint32 dstChannels = 4; // RGBA
|
||||||
|
resize (gif->SWidth, gif->SHeight, RGBA);
|
||||||
|
|
||||||
|
// make transparent
|
||||||
|
_Data[0].fill(0);
|
||||||
|
|
||||||
|
// make sure background color index exists in global colormap
|
||||||
|
if (gif->SColorMap && gif->SColorMap->ColorCount < gif->SBackGroundColor)
|
||||||
|
{
|
||||||
|
gif->SBackGroundColor = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// merge all frames one by one into single target
|
||||||
|
ColorMapObject *ColorMap;
|
||||||
|
sint32 transparency = GIF_NOT_TRANSPARENT;
|
||||||
|
uint8 r, g, b, a;
|
||||||
|
uint32 offset_x, offset_y, width, height;
|
||||||
|
|
||||||
|
// disable loop as we only interested in first frame
|
||||||
|
// for (uint32 frame = 0; frame < gif->ImageCount; frame++)
|
||||||
|
{
|
||||||
|
uint32 frame = 0;
|
||||||
|
SavedImage *curFrame = &gif->SavedImages[frame];
|
||||||
|
|
||||||
|
if (curFrame->ExtensionBlockCount > 0)
|
||||||
|
{
|
||||||
|
for(uint e=0; e<curFrame->ExtensionBlockCount; e++){
|
||||||
|
ExtensionBlock *ext = &curFrame->ExtensionBlocks[e];
|
||||||
|
|
||||||
|
if (ext->Function == GRAPHICS_EXT_FUNC_CODE) {
|
||||||
|
uint8 flag = ext->Bytes[0];
|
||||||
|
//delay = (ext.Bytes[1] << 8) | ext.Bytes[2];
|
||||||
|
transparency = (flag & GIF_TRANSPARENT_MASK) ? ext->Bytes[3] : GIF_NOT_TRANSPARENT;
|
||||||
|
//dispose = ((flag >> 2) & GIF_DISPOSE_MASK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// select color map for frame
|
||||||
|
if (curFrame->ImageDesc.ColorMap)
|
||||||
|
{
|
||||||
|
ColorMap = curFrame->ImageDesc.ColorMap;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (gif->SColorMap)
|
||||||
|
{
|
||||||
|
ColorMap = gif->SColorMap;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlwarning("GIF has no global or local color map");
|
||||||
|
ColorMap = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy frame to canvas
|
||||||
|
offset_x = curFrame->ImageDesc.Left;
|
||||||
|
offset_y = curFrame->ImageDesc.Top;
|
||||||
|
width = curFrame->ImageDesc.Width;
|
||||||
|
height = curFrame->ImageDesc.Height;
|
||||||
|
|
||||||
|
#if GIFLIB_MAJOR < 5
|
||||||
|
// giflib 4 does not handle interlaced images, so we must do it
|
||||||
|
if (curFrame->ImageDesc.Interlace)
|
||||||
|
{
|
||||||
|
uint32 srcOffset = 0;
|
||||||
|
for (uint8 pass = 0; pass < 4; pass++)
|
||||||
|
{
|
||||||
|
uint32 nextLine = INTERLACED_OFFSET[pass];
|
||||||
|
|
||||||
|
// y is destination row
|
||||||
|
for (uint32 y = 0; y < height; y++)
|
||||||
|
{
|
||||||
|
if (y != nextLine)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
uint32 dstOffset = (y + offset_y)*gif->SWidth*dstChannels + offset_x*dstChannels;
|
||||||
|
nextLine += INTERLACED_JUMP[pass];
|
||||||
|
|
||||||
|
for (uint32 x = 0; x < width; x++)
|
||||||
|
{
|
||||||
|
srcOffset++;
|
||||||
|
dstOffset+= dstChannels;
|
||||||
|
|
||||||
|
uint32 index = curFrame->RasterBits[srcOffset];
|
||||||
|
if (index != transparency)
|
||||||
|
{
|
||||||
|
// make sure color index is not outside colormap
|
||||||
|
if (ColorMap)
|
||||||
|
{
|
||||||
|
if (index > ColorMap->ColorCount)
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
r = ColorMap->Colors[index].Red;
|
||||||
|
g = ColorMap->Colors[index].Green;
|
||||||
|
b = ColorMap->Colors[index].Blue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// broken gif, no colormap
|
||||||
|
r = g = b = 0;
|
||||||
|
}
|
||||||
|
a = 255;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// transparent
|
||||||
|
r = g = b = a = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_Data[0][dstOffset] = r;
|
||||||
|
_Data[0][dstOffset+1] = g;
|
||||||
|
_Data[0][dstOffset+2] = b;
|
||||||
|
_Data[0][dstOffset+3] = a;
|
||||||
|
} // x loop
|
||||||
|
} // y loop
|
||||||
|
} // pass loop
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
for (uint32 y = 0; y < height; y++)
|
||||||
|
{
|
||||||
|
uint32 srcOffset = y*width;
|
||||||
|
uint32 dstOffset = (y + offset_y)*gif->SWidth*dstChannels + offset_x*dstChannels;
|
||||||
|
for (uint32 x = 0; x < width; x++)
|
||||||
|
{
|
||||||
|
srcOffset++;
|
||||||
|
dstOffset+= dstChannels;
|
||||||
|
|
||||||
|
uint32 index = curFrame->RasterBits[srcOffset];
|
||||||
|
if (index != transparency)
|
||||||
|
{
|
||||||
|
// make sure color index is not outside colormap
|
||||||
|
if (ColorMap)
|
||||||
|
{
|
||||||
|
if (index > ColorMap->ColorCount)
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
r = ColorMap->Colors[index].Red;
|
||||||
|
g = ColorMap->Colors[index].Green;
|
||||||
|
b = ColorMap->Colors[index].Blue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// broken gif, no colormap
|
||||||
|
r = g = b = 0;
|
||||||
|
}
|
||||||
|
a = 255;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// transparent
|
||||||
|
r = g = b = a = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_Data[0][dstOffset] = r;
|
||||||
|
_Data[0][dstOffset+1] = g;
|
||||||
|
_Data[0][dstOffset+2] = b;
|
||||||
|
_Data[0][dstOffset+3] = a;
|
||||||
|
} // x loop
|
||||||
|
} // y loop
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean up after the read, and free any memory allocated
|
||||||
|
#if GIFLIB_MAJOR >= 5 && GIFLIB_MINOR >= 1
|
||||||
|
DGifCloseFile(gif, &errorCode);
|
||||||
|
#else
|
||||||
|
DGifCloseFile(gif);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//return the size of a pixel as 32bits
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
uint8 CBitmap::readGIF( NLMISC::IStream &/* f */)
|
||||||
|
{
|
||||||
|
nlwarning ("You must compile NLMISC with USE_GIF if you want gif support");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}//namespace
|
|
@ -440,7 +440,7 @@ NLMISC_CATEGORISED_COMMAND(nel,hrtob, "Convert a human readable number into a by
|
||||||
string secondsToHumanReadable (uint32 time)
|
string secondsToHumanReadable (uint32 time)
|
||||||
{
|
{
|
||||||
static const char *divTable[] = { "s", "mn", "h", "d" };
|
static const char *divTable[] = { "s", "mn", "h", "d" };
|
||||||
static uint divCoef[] = { 60, 60, 24 };
|
static uint divCoef[] = { 60, 60, 24 };
|
||||||
uint div = 0;
|
uint div = 0;
|
||||||
uint32 res = time;
|
uint32 res = time;
|
||||||
uint32 newres = res;
|
uint32 newres = res;
|
||||||
|
@ -671,13 +671,13 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
STARTUPINFOA si;
|
STARTUPINFOA si;
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
|
|
||||||
memset(&si, 0, sizeof(si));
|
memset(&si, 0, sizeof(si));
|
||||||
memset(&pi, 0, sizeof(pi));
|
memset(&pi, 0, sizeof(pi));
|
||||||
|
|
||||||
si.cb = sizeof(si);
|
si.cb = sizeof(si);
|
||||||
|
|
||||||
/* SECURITY_ATTRIBUTES sa;
|
/* SECURITY_ATTRIBUTES sa;
|
||||||
sa.nLength = sizeof (sa);
|
sa.nLength = sizeof (sa);
|
||||||
|
@ -781,7 +781,7 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
|
||||||
nlwarning("LAUNCH: Failed launched '%s' with arg '%s' err %d: '%s'", programName.c_str(), arguments.c_str(), errno, err);
|
nlwarning("LAUNCH: Failed launched '%s' with arg '%s' err %d: '%s'", programName.c_str(), arguments.c_str(), errno, err);
|
||||||
}
|
}
|
||||||
else if (status == 0)
|
else if (status == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Exec (the only allowed instruction after vfork)
|
// Exec (the only allowed instruction after vfork)
|
||||||
status = execvp(programName.c_str(), &argv.front());
|
status = execvp(programName.c_str(), &argv.front());
|
||||||
|
@ -1009,50 +1009,87 @@ NLMISC_CATEGORISED_COMMAND(nel, killProgram, "kill a program given the pid", "<p
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
LONG GetRegKey(HKEY key, LPCSTR subkey, LPSTR retdata)
|
LONG GetRegKey(HKEY key, LPCSTR subkey, LPSTR retdata)
|
||||||
{
|
{
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
LONG retval = RegOpenKeyExA(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
|
LONG retval = RegOpenKeyExA(key, subkey, 0, KEY_QUERY_VALUE, &hkey);
|
||||||
|
|
||||||
if (retval == ERROR_SUCCESS)
|
if (retval == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
long datasize = MAX_PATH;
|
long datasize = MAX_PATH;
|
||||||
char data[MAX_PATH];
|
char data[MAX_PATH];
|
||||||
RegQueryValueA(hkey, NULL, data, &datasize);
|
RegQueryValueA(hkey, NULL, data, &datasize);
|
||||||
lstrcpyA(retdata,data);
|
lstrcpyA(retdata,data);
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
static bool openDocWithExtension (const char *document, const char *ext)
|
||||||
|
{
|
||||||
|
#ifdef NL_OS_WINDOWS
|
||||||
|
// First try ShellExecute()
|
||||||
|
HINSTANCE result = ShellExecuteA(NULL, "open", document, NULL, NULL, SW_SHOWDEFAULT);
|
||||||
|
|
||||||
|
// If it failed, get the .htm regkey and lookup the program
|
||||||
|
if ((uintptr_t)result <= HINSTANCE_ERROR)
|
||||||
|
{
|
||||||
|
char key[MAX_PATH + MAX_PATH];
|
||||||
|
|
||||||
|
if (GetRegKey(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
lstrcatA(key, "\\shell\\open\\command");
|
||||||
|
|
||||||
|
if (GetRegKey(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
char *pos = strstr(key, "\"%1\"");
|
||||||
|
|
||||||
|
if (pos == NULL)
|
||||||
|
{
|
||||||
|
// No quotes found
|
||||||
|
// Check for %1, without quotes
|
||||||
|
pos = strstr(key, "%1");
|
||||||
|
|
||||||
|
if (pos == NULL)
|
||||||
|
{
|
||||||
|
// No parameter at all...
|
||||||
|
pos = key+lstrlenA(key)-1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Remove the parameter
|
||||||
|
*pos = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Remove the parameter
|
||||||
|
*pos = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
lstrcatA(pos, " ");
|
||||||
|
lstrcatA(pos, document);
|
||||||
|
int res = WinExec(key, SW_SHOWDEFAULT);
|
||||||
|
return (res>31);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// TODO: implement for Linux and Mac OS X
|
||||||
|
nlunreferenced(document);
|
||||||
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool openURL (const char *url)
|
bool openURL (const char *url)
|
||||||
{
|
{
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
char key[1024];
|
return openDocWithExtension(url, "htm");
|
||||||
if (GetRegKey(HKEY_CLASSES_ROOT, ".html", key) == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
lstrcatA(key, "\\shell\\open\\command");
|
|
||||||
|
|
||||||
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
char *pos;
|
|
||||||
pos = strstr(key, "\"%1\"");
|
|
||||||
if (pos == NULL) { // No quotes found
|
|
||||||
pos = strstr(key, "%1"); // Check for %1, without quotes
|
|
||||||
if (pos == NULL) // No parameter at all...
|
|
||||||
pos = key+lstrlenA(key)-1;
|
|
||||||
else
|
|
||||||
*pos = '\0'; // Remove the parameter
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*pos = '\0'; // Remove the parameter
|
|
||||||
|
|
||||||
lstrcatA(pos, " ");
|
|
||||||
lstrcatA(pos, url);
|
|
||||||
int res = WinExec(key,SW_SHOWDEFAULT);
|
|
||||||
return (res>31);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif defined(NL_OS_MAC)
|
#elif defined(NL_OS_MAC)
|
||||||
return launchProgram("open", url);
|
return launchProgram("open", url);
|
||||||
#elif defined(NL_OS_UNIX)
|
#elif defined(NL_OS_UNIX)
|
||||||
|
@ -1060,53 +1097,17 @@ bool openURL (const char *url)
|
||||||
#else
|
#else
|
||||||
nlwarning("openURL() is not implemented for this OS");
|
nlwarning("openURL() is not implemented for this OS");
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool openDoc (const char *document)
|
bool openDoc (const char *document)
|
||||||
{
|
{
|
||||||
#ifdef NL_OS_WINDOWS
|
// get extension from document fullpath
|
||||||
string ext = CFile::getExtension (document);
|
string ext = CFile::getExtension(document);
|
||||||
char key[MAX_PATH + MAX_PATH];
|
|
||||||
|
|
||||||
// First try ShellExecute()
|
// try to open document
|
||||||
HINSTANCE result = ShellExecuteA(NULL, "open", document, NULL,NULL, SW_SHOWDEFAULT);
|
return openDocWithExtension(document, ext.c_str());
|
||||||
|
|
||||||
// If it failed, get the .htm regkey and lookup the program
|
|
||||||
if ((uintptr_t)result <= HINSTANCE_ERROR)
|
|
||||||
{
|
|
||||||
if (GetRegKey(HKEY_CLASSES_ROOT, ext.c_str(), key) == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
lstrcatA(key, "\\shell\\open\\command");
|
|
||||||
|
|
||||||
if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
char *pos;
|
|
||||||
pos = strstr(key, "\"%1\"");
|
|
||||||
if (pos == NULL) { // No quotes found
|
|
||||||
pos = strstr(key, "%1"); // Check for %1, without quotes
|
|
||||||
if (pos == NULL) // No parameter at all...
|
|
||||||
pos = key+lstrlenA(key)-1;
|
|
||||||
else
|
|
||||||
*pos = '\0'; // Remove the parameter
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*pos = '\0'; // Remove the parameter
|
|
||||||
|
|
||||||
lstrcatA(pos, " ");
|
|
||||||
lstrcatA(pos, document);
|
|
||||||
int res = WinExec(key,SW_SHOWDEFAULT);
|
|
||||||
return (res>31);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
// TODO: implement for Linux and Mac OS X
|
|
||||||
nlunreferenced(document);
|
|
||||||
#endif // NL_OS_WINDOWS
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // NLMISC
|
} // NLMISC
|
||||||
|
|
|
@ -79,8 +79,7 @@ using namespace std;
|
||||||
#define LOG_IN_FILE NEL_LOG_IN_FILE
|
#define LOG_IN_FILE NEL_LOG_IN_FILE
|
||||||
|
|
||||||
// If true, debug system will trap crash even if the application is in debugger
|
// If true, debug system will trap crash even if the application is in debugger
|
||||||
//static const bool TrapCrashInDebugger = false;
|
static const bool TrapCrashInDebugger = false;
|
||||||
static const bool TrapCrashInDebugger = true;
|
|
||||||
|
|
||||||
#ifdef DEBUG_NEW
|
#ifdef DEBUG_NEW
|
||||||
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
||||||
|
|
|
@ -700,6 +700,9 @@ void CMsgBoxDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *m
|
||||||
# endif
|
# endif
|
||||||
abort();
|
abort();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no more sent mail for crash
|
// no more sent mail for crash
|
||||||
|
|
|
@ -20,6 +20,12 @@
|
||||||
#include "nel/misc/path.h"
|
#include "nel/misc/path.h"
|
||||||
#include "nel/misc/i18n.h"
|
#include "nel/misc/i18n.h"
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
#ifdef NL_OS_MAC
|
||||||
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#ifdef DEBUG_NEW
|
#ifdef DEBUG_NEW
|
||||||
|
@ -52,11 +58,13 @@ void CI18N::initLanguages()
|
||||||
_LanguageCodes.push_back("fr");
|
_LanguageCodes.push_back("fr");
|
||||||
_LanguageCodes.push_back("de");
|
_LanguageCodes.push_back("de");
|
||||||
_LanguageCodes.push_back("ru");
|
_LanguageCodes.push_back("ru");
|
||||||
|
_LanguageCodes.push_back("es");
|
||||||
|
|
||||||
_LanguageNames.push_back(ucstring("English"));
|
_LanguageNames.push_back(ucstring("English"));
|
||||||
_LanguageNames.push_back(ucstring("French"));
|
_LanguageNames.push_back(ucstring("French"));
|
||||||
_LanguageNames.push_back(ucstring("German"));
|
_LanguageNames.push_back(ucstring("German"));
|
||||||
_LanguageNames.push_back(ucstring("Russian"));
|
_LanguageNames.push_back(ucstring("Russian"));
|
||||||
|
_LanguageNames.push_back(ucstring("Spanish"));
|
||||||
|
|
||||||
_LanguagesNamesLoaded = true;
|
_LanguagesNamesLoaded = true;
|
||||||
}
|
}
|
||||||
|
@ -226,6 +234,108 @@ string CI18N::getCurrentLanguageCode ()
|
||||||
return _SelectedLanguageCode;
|
return _SelectedLanguageCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CI18N::isLanguageCodeSupported(const std::string &lang)
|
||||||
|
{
|
||||||
|
initLanguages();
|
||||||
|
|
||||||
|
for (sint i = 0, ilen = _LanguageCodes.size(); i < ilen; ++i)
|
||||||
|
{
|
||||||
|
if (lang == _LanguageCodes[i]) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CI18N::getSystemLanguageCode ()
|
||||||
|
{
|
||||||
|
static std::string s_cachedSystemLanguage;
|
||||||
|
|
||||||
|
if (!s_cachedSystemLanguage.empty())
|
||||||
|
return s_cachedSystemLanguage;
|
||||||
|
|
||||||
|
#ifdef NL_OS_MAC
|
||||||
|
// under OS X, locale is only defined in console, not in UI
|
||||||
|
// so we need to use CoreFoundation API to retrieve it
|
||||||
|
|
||||||
|
// get an array with all preferred languages
|
||||||
|
CFArrayRef langs = CFLocaleCopyPreferredLanguages();
|
||||||
|
|
||||||
|
if (langs)
|
||||||
|
{
|
||||||
|
// get languages count
|
||||||
|
sint languagesCount = CFArrayGetCount(langs);
|
||||||
|
|
||||||
|
// process each language
|
||||||
|
for (sint i = 0; i < languagesCount; ++i)
|
||||||
|
{
|
||||||
|
std::string lang;
|
||||||
|
|
||||||
|
// get language CFString
|
||||||
|
CFStringRef langCF = (CFStringRef)CFArrayGetValueAtIndex(langs, i);
|
||||||
|
|
||||||
|
if (langCF)
|
||||||
|
{
|
||||||
|
// get a C string from CFString
|
||||||
|
const char *langStr = CFStringGetCStringPtr(langCF, kCFStringEncodingASCII);
|
||||||
|
|
||||||
|
if (!langStr)
|
||||||
|
{
|
||||||
|
// get length of the CFString
|
||||||
|
CFIndex length = CFStringGetLength(langCF);
|
||||||
|
|
||||||
|
// allocate a temporary buffer to hold converted string
|
||||||
|
char *tmp = new char[length+1];
|
||||||
|
|
||||||
|
// use alternative function to get a C string from CFString
|
||||||
|
if (CFStringGetCString(langCF, tmp, length+1, kCFStringEncodingASCII))
|
||||||
|
{
|
||||||
|
lang = std::string(tmp, length);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlerror("Unable to convert CFStringRef to string");
|
||||||
|
}
|
||||||
|
|
||||||
|
delete [] tmp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lang = std::string(langStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRelease(langCF);
|
||||||
|
}
|
||||||
|
|
||||||
|
// only keep language code if supported by NeL
|
||||||
|
if (!lang.empty() && isLanguageCodeSupported(lang))
|
||||||
|
{
|
||||||
|
s_cachedSystemLanguage = lang;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't need languages array anymore
|
||||||
|
CFRelease(langs);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// use system locale (works under Linux and Windows)
|
||||||
|
if (s_cachedSystemLanguage.empty())
|
||||||
|
{
|
||||||
|
std::string lang = NLMISC::toLower(std::string(setlocale(LC_CTYPE, "")));
|
||||||
|
|
||||||
|
// only keep 2 first characters
|
||||||
|
if (lang.size() > 1)
|
||||||
|
s_cachedSystemLanguage = lang.substr(0, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// english is default language
|
||||||
|
if (s_cachedSystemLanguage.empty())
|
||||||
|
s_cachedSystemLanguage = "en";
|
||||||
|
|
||||||
|
return s_cachedSystemLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
void CI18N::removeCComment(ucstring &commentedString)
|
void CI18N::removeCComment(ucstring &commentedString)
|
||||||
{
|
{
|
||||||
ucstring temp;
|
ucstring temp;
|
||||||
|
|
|
@ -677,7 +677,7 @@ void CFairMutex::debugEndEnter()
|
||||||
if (_Mutex == (void*)0x88)
|
if (_Mutex == (void*)0x88)
|
||||||
{
|
{
|
||||||
OutputDebugString (str);
|
OutputDebugString (str);
|
||||||
if (entered) __asm int 3;
|
if (entered) __debugbreak();
|
||||||
entered = true;
|
entered = true;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -704,7 +704,7 @@ void CFairMutex::debugLeave()
|
||||||
if (_Mutex == (void*)0x88)
|
if (_Mutex == (void*)0x88)
|
||||||
{
|
{
|
||||||
OutputDebugString (str);
|
OutputDebugString (str);
|
||||||
if (!entered) __asm int 3;
|
if (!entered) __debugbreak();
|
||||||
entered = false;
|
entered = false;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -298,7 +298,8 @@ void CRGBA::modulateColors(CRGBA *dest, const CRGBA *src1, const CRGBA *src2, ui
|
||||||
uint64 blank = 0;
|
uint64 blank = 0;
|
||||||
/// well, this could be further optimized when stride is 4
|
/// well, this could be further optimized when stride is 4
|
||||||
if (dup == 1)
|
if (dup == 1)
|
||||||
{ __asm
|
{
|
||||||
|
__asm
|
||||||
{
|
{
|
||||||
push ebp
|
push ebp
|
||||||
movq mm2, blank
|
movq mm2, blank
|
||||||
|
@ -733,17 +734,23 @@ void CRGBA::buildFromHLS(float h, float l, float s)
|
||||||
|
|
||||||
CRGBA CRGBA::stringToRGBA( const char *ptr )
|
CRGBA CRGBA::stringToRGBA( const char *ptr )
|
||||||
{
|
{
|
||||||
if (!ptr)
|
if (ptr)
|
||||||
return NLMISC::CRGBA::White;
|
{
|
||||||
|
int r = 255, g = 255, b = 255, a = 255;
|
||||||
|
|
||||||
|
// we need at least 3 integer values to consider string is valid
|
||||||
|
if (sscanf( ptr, "%d %d %d %d", &r, &g, &b, &a ) >= 3)
|
||||||
|
{
|
||||||
|
clamp( r, 0, 255 );
|
||||||
|
clamp( g, 0, 255 );
|
||||||
|
clamp( b, 0, 255 );
|
||||||
|
clamp( a, 0, 255 );
|
||||||
|
|
||||||
int r = 255, g = 255, b = 255, a = 255;
|
return CRGBA( r,g,b,a );
|
||||||
sscanf( ptr, "%d %d %d %d", &r, &g, &b, &a );
|
}
|
||||||
clamp( r, 0, 255 );
|
}
|
||||||
clamp( g, 0, 255 );
|
|
||||||
clamp( b, 0, 255 );
|
return NLMISC::CRGBA::White;
|
||||||
clamp( a, 0, 255 );
|
|
||||||
|
|
||||||
return CRGBA( r,g,b,a );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CRGBA::toString() const
|
std::string CRGBA::toString() const
|
||||||
|
|
|
@ -185,11 +185,12 @@ string CSystemInfo::getOS()
|
||||||
|
|
||||||
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
|
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
|
||||||
typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
|
typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
|
||||||
|
typedef LONG (WINAPI* pRtlGetVersion)(OSVERSIONINFOEXA*);
|
||||||
|
|
||||||
SYSTEM_INFO si;
|
SYSTEM_INFO si;
|
||||||
PGNSI pGNSI;
|
PGNSI pGNSI;
|
||||||
PGPI pGPI;
|
PGPI pGPI;
|
||||||
OSVERSIONINFOEX osvi;
|
OSVERSIONINFOEXA osvi;
|
||||||
BOOL bOsVersionInfoEx;
|
BOOL bOsVersionInfoEx;
|
||||||
const int BUFSIZE = 80;
|
const int BUFSIZE = 80;
|
||||||
|
|
||||||
|
@ -197,15 +198,26 @@ string CSystemInfo::getOS()
|
||||||
// If that fails, try using the OSVERSIONINFO structure.
|
// If that fails, try using the OSVERSIONINFO structure.
|
||||||
|
|
||||||
ZeroMemory(&si, sizeof(SYSTEM_INFO));
|
ZeroMemory(&si, sizeof(SYSTEM_INFO));
|
||||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
|
ZeroMemory(&osvi, sizeof(osvi));
|
||||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
||||||
|
|
||||||
bOsVersionInfoEx = GetVersionExA ((OSVERSIONINFO *) &osvi);
|
HMODULE hNtDll = GetModuleHandleA("ntdll.dll");
|
||||||
|
pRtlGetVersion RtlGetVersion = (pRtlGetVersion)GetProcAddress(hNtDll, "RtlGetVersion");
|
||||||
|
|
||||||
|
if (RtlGetVersion)
|
||||||
|
{
|
||||||
|
bOsVersionInfoEx = RtlGetVersion(&osvi) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(!bOsVersionInfoEx)
|
if(!bOsVersionInfoEx)
|
||||||
{
|
{
|
||||||
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
|
bOsVersionInfoEx = GetVersionExA ((OSVERSIONINFOA *) &osvi);
|
||||||
if (! GetVersionExA ( (OSVERSIONINFO *) &osvi) )
|
}
|
||||||
|
|
||||||
|
if(!bOsVersionInfoEx)
|
||||||
|
{
|
||||||
|
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOA);
|
||||||
|
if (! GetVersionExA ( (OSVERSIONINFOA *) &osvi) )
|
||||||
return OSString+" Can't GetVersionEx()";
|
return OSString+" Can't GetVersionEx()";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,13 +235,24 @@ string CSystemInfo::getOS()
|
||||||
{
|
{
|
||||||
OSString = "Microsoft";
|
OSString = "Microsoft";
|
||||||
|
|
||||||
if ( osvi.dwMajorVersion > 6 )
|
if ( osvi.dwMajorVersion > 10 )
|
||||||
{
|
{
|
||||||
OSString += " Windows (not released)";
|
OSString += " Windows (not released)";
|
||||||
}
|
}
|
||||||
|
else if ( osvi.dwMajorVersion == 10 )
|
||||||
|
{
|
||||||
|
OSString += " Windows 10";
|
||||||
|
}
|
||||||
else if ( osvi.dwMajorVersion == 6 )
|
else if ( osvi.dwMajorVersion == 6 )
|
||||||
{
|
{
|
||||||
if ( osvi.dwMinorVersion == 2 )
|
if ( osvi.dwMinorVersion == 3 )
|
||||||
|
{
|
||||||
|
if( osvi.wProductType == VER_NT_WORKSTATION )
|
||||||
|
OSString += " Windows 8.1";
|
||||||
|
else
|
||||||
|
OSString += " Windows Server 2012 R2";
|
||||||
|
}
|
||||||
|
else if ( osvi.dwMinorVersion == 2 )
|
||||||
{
|
{
|
||||||
if( osvi.wProductType == VER_NT_WORKSTATION )
|
if( osvi.wProductType == VER_NT_WORKSTATION )
|
||||||
OSString += " Windows 8";
|
OSString += " Windows 8";
|
||||||
|
|
|
@ -114,7 +114,7 @@ void *CCallbackNetBase::getUserData()
|
||||||
*/
|
*/
|
||||||
void CCallbackNetBase::addCallbackArray (const TCallbackItem *callbackarray, sint arraysize)
|
void CCallbackNetBase::addCallbackArray (const TCallbackItem *callbackarray, sint arraysize)
|
||||||
{
|
{
|
||||||
if (arraysize == 1 && callbackarray[0].Callback == NULL && string("") == callbackarray[0].Key)
|
if (arraysize == 1 && callbackarray[0].Callback == NULL && strlen(callbackarray[0].Key) == 0)
|
||||||
{
|
{
|
||||||
// it's an empty array, ignore it
|
// it's an empty array, ignore it
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -752,7 +752,7 @@ sint32 NLPACS::CGlobalRetriever::getIdentifier(const string &id) const
|
||||||
|
|
||||||
const string &NLPACS::CGlobalRetriever::getIdentifier(const NLPACS::UGlobalPosition &position) const
|
const string &NLPACS::CGlobalRetriever::getIdentifier(const NLPACS::UGlobalPosition &position) const
|
||||||
{
|
{
|
||||||
static const string nullString = string("");
|
static const string nullString;
|
||||||
|
|
||||||
if (position.InstanceId == -1)
|
if (position.InstanceId == -1)
|
||||||
return nullString;
|
return nullString;
|
||||||
|
@ -784,7 +784,7 @@ bool NLPACS::CGlobalRetriever::buildInstance(const string &id, const NLMISC::C
|
||||||
const CRetrieverInstance &instance = makeInstance(retrieverId, 0, CVector(position));
|
const CRetrieverInstance &instance = makeInstance(retrieverId, 0, CVector(position));
|
||||||
|
|
||||||
// check make instance success
|
// check make instance success
|
||||||
if (&instance == NULL || instance.getInstanceId() == -1 || instance.getRetrieverId() != retrieverId)
|
if (instance.getInstanceId() == -1 || instance.getRetrieverId() != retrieverId)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// links new instance to its neighbors
|
// links new instance to its neighbors
|
||||||
|
|
|
@ -124,7 +124,12 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st
|
||||||
/// Get audio/container extensions that are currently supported by the nel sound library.
|
/// Get audio/container extensions that are currently supported by the nel sound library.
|
||||||
void IAudioDecoder::getMusicExtensions(std::vector<std::string> &extensions)
|
void IAudioDecoder::getMusicExtensions(std::vector<std::string> &extensions)
|
||||||
{
|
{
|
||||||
extensions.push_back("ogg");
|
// only add ogg format if not already in extensions list
|
||||||
|
if (std::find(extensions.begin(), extensions.end(), "ogg") == extensions.end())
|
||||||
|
{
|
||||||
|
extensions.push_back("ogg");
|
||||||
|
}
|
||||||
|
|
||||||
// extensions.push_back("wav"); // TODO: Easy.
|
// extensions.push_back("wav"); // TODO: Easy.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
#include "nel/sound/sound_bank.h"
|
#include "nel/sound/sound_bank.h"
|
||||||
#include "nel/sound/group_controller.h"
|
#include "nel/sound/group_controller.h"
|
||||||
#include "nel/sound/containers.h"
|
#include "nel/sound/containers.h"
|
||||||
|
#include "nel/sound/audio_decoder.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
@ -2689,21 +2690,30 @@ bool CAudioMixerUser::getSongTitle(const std::string &filename, std::string &res
|
||||||
{
|
{
|
||||||
std::string artist;
|
std::string artist;
|
||||||
std::string title;
|
std::string title;
|
||||||
if (_SoundDriver->getMusicInfo(filename, artist, title))
|
|
||||||
|
if (!_SoundDriver->getMusicInfo(filename, artist, title))
|
||||||
{
|
{
|
||||||
if (!title.empty())
|
// use 3rd party libraries supported formats
|
||||||
{
|
IAudioDecoder::getInfo(filename, artist, title);
|
||||||
if (!artist.empty()) result = artist + " - " + title;
|
|
||||||
else result = title;
|
|
||||||
}
|
|
||||||
else if (!artist.empty())
|
|
||||||
{
|
|
||||||
result = artist + " - " + CFile::getFilename(filename);
|
|
||||||
}
|
|
||||||
else result = CFile::getFilename(filename);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!title.empty())
|
||||||
|
{
|
||||||
|
if (!artist.empty()) result = artist + " - " + title;
|
||||||
|
else result = title;
|
||||||
|
}
|
||||||
|
else if (!artist.empty())
|
||||||
|
{
|
||||||
|
result = artist + " - " + CFile::getFilename(filename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = CFile::getFilename(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = "???";
|
result = "???";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2751,7 +2761,14 @@ bool CAudioMixerUser::isEventMusicEnded()
|
||||||
/// Get audio/container extensions that are currently supported by nel or the used driver implementation.
|
/// Get audio/container extensions that are currently supported by nel or the used driver implementation.
|
||||||
void CAudioMixerUser::getMusicExtensions(std::vector<std::string> &extensions)
|
void CAudioMixerUser::getMusicExtensions(std::vector<std::string> &extensions)
|
||||||
{
|
{
|
||||||
_SoundDriver->getMusicExtensions(extensions);
|
if (_SoundDriver)
|
||||||
|
{
|
||||||
|
// add file formats supported by driver
|
||||||
|
_SoundDriver->getMusicExtensions(extensions);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add 3rd party libraries support file formats
|
||||||
|
IAudioDecoder::getMusicExtensions(extensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a reverb environment
|
/// Add a reverb environment
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
LIBRARY nel_drv_openal_win_r
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
NLSOUND_createISoundDriverInstance
|
NLSOUND_createISoundDriverInstance
|
||||||
NLSOUND_interfaceVersion
|
NLSOUND_interfaceVersion
|
||||||
|
|
|
@ -630,7 +630,11 @@ void CSoundDriverAL::commit3DChanges()
|
||||||
/// Write information about the driver to the output stream.
|
/// Write information about the driver to the output stream.
|
||||||
void CSoundDriverAL::writeProfile(std::string& out)
|
void CSoundDriverAL::writeProfile(std::string& out)
|
||||||
{
|
{
|
||||||
// TODO
|
out = toString("OpenAL\n");
|
||||||
|
out += toString("Source size: %u\n", (uint32)_Sources.size());
|
||||||
|
out += toString("Effects size: %u\n", (uint32)_Effects.size());
|
||||||
|
|
||||||
|
// TODO: write other useful information like OpenAL version and supported extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does not create a sound loader .. what does it do then?
|
// Does not create a sound loader .. what does it do then?
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
LIBRARY nel_drv_xaudio2_win_r
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
NLSOUND_createISoundDriverInstance
|
NLSOUND_createISoundDriverInstance
|
||||||
NLSOUND_interfaceVersion
|
NLSOUND_interfaceVersion
|
||||||
|
|
|
@ -179,7 +179,7 @@ CSoundDriverXAudio2::CSoundDriverXAudio2(ISoundDriver::IStringMapperProvider * /
|
||||||
|
|
||||||
uint32 flags = 0;
|
uint32 flags = 0;
|
||||||
#ifdef NL_DEBUG
|
#ifdef NL_DEBUG
|
||||||
flags |= XAUDIO2_DEBUG_ENGINE; // comment when done using this :)
|
// flags |= XAUDIO2_DEBUG_ENGINE; // comment when done using this :)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// XAudio2
|
// XAudio2
|
||||||
|
|
|
@ -32,7 +32,7 @@ using namespace NLMISC;
|
||||||
namespace NLSOUND {
|
namespace NLSOUND {
|
||||||
|
|
||||||
CSourceXAudio2::CSourceXAudio2(CSoundDriverXAudio2 *soundDriver)
|
CSourceXAudio2::CSourceXAudio2(CSoundDriverXAudio2 *soundDriver)
|
||||||
: _SoundDriver(soundDriver), _SourceVoice(NULL), _StaticBuffer(NULL), _OperationSet(soundDriver->getUniqueOperationSet()),
|
: _SoundDriver(soundDriver), _SourceVoice(NULL), _StaticBuffer(NULL), _LastPreparedBuffer(NULL), _OperationSet(soundDriver->getUniqueOperationSet()),
|
||||||
_Format(IBuffer::FormatUnknown), _Frequency(0), _PlayStart(0),
|
_Format(IBuffer::FormatUnknown), _Frequency(0), _PlayStart(0),
|
||||||
_Doppler(1.0f), _Pos(0.0f, 0.0f, 0.0f), _Relative(false), _Alpha(1.0),
|
_Doppler(1.0f), _Pos(0.0f, 0.0f, 0.0f), _Relative(false), _Alpha(1.0),
|
||||||
_DirectDryVoice(NULL), _DirectFilterVoice(NULL), _EffectDryVoice(NULL), _EffectFilterVoice(NULL),
|
_DirectDryVoice(NULL), _DirectFilterVoice(NULL), _EffectDryVoice(NULL), _EffectFilterVoice(NULL),
|
||||||
|
@ -407,6 +407,7 @@ void CSourceXAudio2::submitStreamingBuffer(IBuffer *buffer)
|
||||||
uint32 frequency;
|
uint32 frequency;
|
||||||
buffer->getFormat(bufferFormat, channels, bitsPerSample, frequency);
|
buffer->getFormat(bufferFormat, channels, bitsPerSample, frequency);
|
||||||
preparePlay(bufferFormat, channels, bitsPerSample, frequency);
|
preparePlay(bufferFormat, channels, bitsPerSample, frequency);
|
||||||
|
_LastPreparedBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
submitBuffer(static_cast<CBufferXAudio2 *>(buffer));
|
submitBuffer(static_cast<CBufferXAudio2 *>(buffer));
|
||||||
|
@ -455,7 +456,8 @@ void CSourceXAudio2::setLooping(bool l)
|
||||||
if (FAILED(_SourceVoice->FlushSourceBuffers()))
|
if (FAILED(_SourceVoice->FlushSourceBuffers()))
|
||||||
nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED FlushSourceBuffers");
|
nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED FlushSourceBuffers");
|
||||||
// resubmit with updated looping settings
|
// resubmit with updated looping settings
|
||||||
submitBuffer(_StaticBuffer);
|
if (_LastPreparedBuffer == _StaticBuffer)
|
||||||
|
submitBuffer(_StaticBuffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -478,7 +480,8 @@ void CSourceXAudio2::setLooping(bool l)
|
||||||
if (FAILED(_SourceVoice->FlushSourceBuffers()))
|
if (FAILED(_SourceVoice->FlushSourceBuffers()))
|
||||||
nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED FlushSourceBuffers");
|
nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED FlushSourceBuffers");
|
||||||
// queue buffer with correct looping parameters
|
// queue buffer with correct looping parameters
|
||||||
submitBuffer(_StaticBuffer);
|
if (_LastPreparedBuffer == _StaticBuffer)
|
||||||
|
submitBuffer(_StaticBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -635,6 +638,7 @@ bool CSourceXAudio2::play()
|
||||||
_StaticBuffer->getChannels(),
|
_StaticBuffer->getChannels(),
|
||||||
_StaticBuffer->getBitsPerSample(),
|
_StaticBuffer->getBitsPerSample(),
|
||||||
_StaticBuffer->getFrequency());
|
_StaticBuffer->getFrequency());
|
||||||
|
_LastPreparedBuffer = _StaticBuffer;
|
||||||
submitBuffer(_StaticBuffer);
|
submitBuffer(_StaticBuffer);
|
||||||
_PlayStart = CTime::getLocalTime();
|
_PlayStart = CTime::getLocalTime();
|
||||||
if (SUCCEEDED(_SourceVoice->Start(0))) _IsPlaying = true;
|
if (SUCCEEDED(_SourceVoice->Start(0))) _IsPlaying = true;
|
||||||
|
@ -663,6 +667,8 @@ void CSourceXAudio2::stop()
|
||||||
|
|
||||||
// stop source voice and remove pending buffers
|
// stop source voice and remove pending buffers
|
||||||
_SoundDriver->getXAudio2()->CommitChanges(_OperationSet);
|
_SoundDriver->getXAudio2()->CommitChanges(_OperationSet);
|
||||||
|
if (FAILED(_SourceVoice->ExitLoop()))
|
||||||
|
nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED ExitLoop");
|
||||||
if (FAILED(_SourceVoice->Stop(0)))
|
if (FAILED(_SourceVoice->Stop(0)))
|
||||||
nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED Stop");
|
nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED Stop");
|
||||||
if (FAILED(_SourceVoice->FlushSourceBuffers()))
|
if (FAILED(_SourceVoice->FlushSourceBuffers()))
|
||||||
|
|
|
@ -41,6 +41,8 @@ private:
|
||||||
CSoundDriverXAudio2 *_SoundDriver;
|
CSoundDriverXAudio2 *_SoundDriver;
|
||||||
/// Buffer that should be playing.
|
/// Buffer that should be playing.
|
||||||
CBufferXAudio2 *_StaticBuffer;
|
CBufferXAudio2 *_StaticBuffer;
|
||||||
|
/// Last buffer that was prepared for playing.
|
||||||
|
CBufferXAudio2 *_LastPreparedBuffer;
|
||||||
|
|
||||||
// -- Pointers --
|
// -- Pointers --
|
||||||
/// Source voice, can be NULL!
|
/// Source voice, can be NULL!
|
||||||
|
|
|
@ -53,7 +53,7 @@ using namespace NL3D;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Out a string to the stdout and log.log
|
// Out a string to the stdout and log.log
|
||||||
void outString (string &sText)
|
void outString (const string &sText)
|
||||||
{
|
{
|
||||||
createDebug ();
|
createDebug ();
|
||||||
InfoLog->displayRaw(sText.c_str());
|
InfoLog->displayRaw(sText.c_str());
|
||||||
|
|
|
@ -483,7 +483,7 @@ XMLR2EDInterfaceFiles =
|
||||||
{
|
{
|
||||||
"r2ed.xml",
|
"r2ed.xml",
|
||||||
"r2_triggers.xml",
|
"r2_triggers.xml",
|
||||||
"r2_logic_entities.xml",
|
"r2_logic_entities.xml",
|
||||||
"r2ed_acts.xml",
|
"r2ed_acts.xml",
|
||||||
"r2ed_scenario.xml",
|
"r2ed_scenario.xml",
|
||||||
"r2ed_connect.xml"
|
"r2ed_connect.xml"
|
||||||
|
|
|
@ -19,7 +19,7 @@ end
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
|
||||||
-- WIDGET TO CHOOSE A COLOR
|
-- WIDGET TO CHOOSE A COLOR
|
||||||
------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
|
||||||
------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -29,14 +29,14 @@ function game:mcwChooseColor(title, pal)
|
||||||
|
|
||||||
local ui = getUICaller();
|
local ui = getUICaller();
|
||||||
|
|
||||||
-- get the color of the button and store it in temporary db location
|
-- get the color of the button and store it in temporary db location
|
||||||
local rgba = ui.col_normal_rgba;
|
local rgba = ui.col_normal_rgba;
|
||||||
game.ColorPicker.r = rgba.R;
|
game.ColorPicker.r = rgba.R;
|
||||||
game.ColorPicker.g = rgba.G;
|
game.ColorPicker.g = rgba.G;
|
||||||
game.ColorPicker.b = rgba.B;
|
game.ColorPicker.b = rgba.B;
|
||||||
game.ColorPicker.button = ui;
|
game.ColorPicker.button = ui;
|
||||||
game.ColorPicker.pal = pal;
|
game.ColorPicker.pal = pal;
|
||||||
|
|
||||||
-- setup the color picker window
|
-- setup the color picker window
|
||||||
local uiModalWin = getUI('ui:interface:define_mcw_color');
|
local uiModalWin = getUI('ui:interface:define_mcw_color');
|
||||||
if (game.ColorPicker.pal == 0) then
|
if (game.ColorPicker.pal == 0) then
|
||||||
|
@ -64,8 +64,8 @@ end
|
||||||
-- called when we have finished choosing the color in the modal window and the chosen color is valid
|
-- called when we have finished choosing the color in the modal window and the chosen color is valid
|
||||||
function game:mcwValidateColor()
|
function game:mcwValidateColor()
|
||||||
|
|
||||||
if (game.ColorPicker.button == nil) then
|
if (game.ColorPicker.button == nil) then
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
game.ColorPicker.button.col_normal = game.ColorPicker.r .. ' ' .. game.ColorPicker.g .. ' ' .. game.ColorPicker.b;
|
game.ColorPicker.button.col_normal = game.ColorPicker.r .. ' ' .. game.ColorPicker.g .. ' ' .. game.ColorPicker.b;
|
||||||
--debugInfo(game.ColorPicker.button.col_normal)
|
--debugInfo(game.ColorPicker.button.col_normal)
|
||||||
|
@ -108,10 +108,10 @@ end
|
||||||
-- hide all the pages of the config window
|
-- hide all the pages of the config window
|
||||||
function game:configHideAll()
|
function game:configHideAll()
|
||||||
|
|
||||||
local uiList = {
|
local uiList = {
|
||||||
'explanation', 'general', 'landscape', 'fx', 'char', 'hud', 'language', 'alpha_colors',
|
'explanation', 'general', 'landscape', 'fx', 'char', 'hud', 'language', 'alpha_colors',
|
||||||
'chat_colors', 'entity_colors', 'in_scene_user', 'in_scene_friend', 'in_scene_enemy',
|
'chat_colors', 'entity_colors', 'in_scene_user', 'in_scene_friend', 'in_scene_enemy',
|
||||||
'in_scene_chat_messages', 'win_colors', 'win_colors_r2', 'mouse', 'keyb', 'vr', 'sound', 'landmark_colors', 'help'
|
'in_scene_chat_messages', 'win_colors', 'win_colors_r2', 'mouse', 'keyb', 'vr', 'sound', 'landmark_colors', 'help'
|
||||||
};
|
};
|
||||||
|
|
||||||
for k,v in pairs(uiList) do
|
for k,v in pairs(uiList) do
|
||||||
|
@ -127,19 +127,19 @@ function game:configShowOne(strUIToShow)
|
||||||
game:configHideAll();
|
game:configHideAll();
|
||||||
-- special case : if the display tab was shown, update the aspect ratio if needed
|
-- special case : if the display tab was shown, update the aspect ratio if needed
|
||||||
local generalGrp = getUI('ui:interface:game_config:content:general');
|
local generalGrp = getUI('ui:interface:game_config:content:general');
|
||||||
local uiGrp = getUI('ui:interface:game_config:content:' .. strUIToShow);
|
local uiGrp = getUI('ui:interface:game_config:content:' .. strUIToShow);
|
||||||
-- Removed the following code to solve RT n°14720
|
-- Removed the following code to solve RT n°14720
|
||||||
-- The 'game_config_change_screen_ratio_custom' action handler
|
-- The 'game_config_change_screen_ratio_custom' action handler
|
||||||
-- should only be called if the user changed the apect ratio himself
|
-- should only be called if the user changed the apect ratio himself
|
||||||
-- (else the edit box containing the aspect ratio may not have been initiliazed here)
|
-- (else the edit box containing the aspect ratio may not have been initiliazed here)
|
||||||
--if uiGrp ~= generalGrp then
|
--if uiGrp ~= generalGrp then
|
||||||
-- runAH(nil, 'game_config_change_screen_ratio_custom', '')
|
-- runAH(nil, 'game_config_change_screen_ratio_custom', '')
|
||||||
--end
|
--end
|
||||||
uiGrp.active = true;
|
uiGrp.active = true;
|
||||||
end
|
end
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
|
||||||
--
|
--
|
||||||
function game:configInit()
|
function game:configInit()
|
||||||
|
|
||||||
-- init language
|
-- init language
|
||||||
|
@ -187,9 +187,9 @@ function game:configInit()
|
||||||
winActive("wc_r2_dialogs", r2WinOn)
|
winActive("wc_r2_dialogs", r2WinOn)
|
||||||
winActive("wc_r2_events", r2WinOn)
|
winActive("wc_r2_events", r2WinOn)
|
||||||
winActive("wc_r2_activities", r2WinOn)
|
winActive("wc_r2_activities", r2WinOn)
|
||||||
winActive("wc_r2_feature_help", r2WinOn)
|
winActive("wc_r2_feature_help", r2WinOn)
|
||||||
winActive("wc_r2_connect", not r2WinOn)
|
winActive("wc_r2_connect", not r2WinOn)
|
||||||
winActive("wc_r2_session_browser", not r2WinOn)
|
winActive("wc_r2_session_browser", not r2WinOn)
|
||||||
winActive("wc_r2_scenario_control", true)
|
winActive("wc_r2_scenario_control", true)
|
||||||
winActive("wc_r2_player_tracking", r2WinOn)
|
winActive("wc_r2_player_tracking", r2WinOn)
|
||||||
end
|
end
|
||||||
|
|
|
@ -61,8 +61,7 @@ void CAnimationFX::buildTrack(NL3D::UAnimationSet *as)
|
||||||
nlassert(Sheet != NULL);
|
nlassert(Sheet != NULL);
|
||||||
if (!as) return;
|
if (!as) return;
|
||||||
if (Sheet->TrajectoryAnim.empty()) return;
|
if (Sheet->TrajectoryAnim.empty()) return;
|
||||||
std::string animName = Sheet->TrajectoryAnim;
|
std::string animName = NLMISC::toLower(Sheet->TrajectoryAnim);
|
||||||
NLMISC::strlwr(animName);
|
|
||||||
uint id = as->getAnimationIdByName(animName);
|
uint id = as->getAnimationIdByName(animName);
|
||||||
NL3D::UAnimation *anim = NULL;
|
NL3D::UAnimation *anim = NULL;
|
||||||
if (id != NL3D::UAnimationSet::NotFound)
|
if (id != NL3D::UAnimationSet::NotFound)
|
||||||
|
|
|
@ -17,53 +17,57 @@
|
||||||
#include "stdpch.h"
|
#include "stdpch.h"
|
||||||
#include "app_bundle_utils.h"
|
#include "app_bundle_utils.h"
|
||||||
|
|
||||||
#if defined(NL_OS_MAC)
|
#ifdef NL_OS_MAC
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string getAppBundlePath()
|
std::string getAppBundlePath()
|
||||||
{
|
{
|
||||||
static std::string cachedPathToBundle;
|
static std::string s_cachedPathToBundle;
|
||||||
|
|
||||||
if(cachedPathToBundle.size())
|
if (!s_cachedPathToBundle.empty())
|
||||||
return cachedPathToBundle;
|
return s_cachedPathToBundle;
|
||||||
|
|
||||||
#if defined(NL_OS_MAC)
|
#if defined(NL_OS_MAC)
|
||||||
// get the bundle
|
// get the bundle
|
||||||
CFBundleRef bundle = CFBundleGetMainBundle();
|
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||||
|
|
||||||
if(bundle)
|
if (bundle)
|
||||||
{
|
{
|
||||||
// get the url to the bundles root
|
// get the url to the bundles root
|
||||||
CFURLRef url = CFBundleCopyBundleURL(bundle);
|
CFURLRef url = CFBundleCopyBundleURL(bundle);
|
||||||
|
|
||||||
if(url)
|
if (url)
|
||||||
{
|
{
|
||||||
// get the file system path
|
// get the file system path
|
||||||
CFStringRef str;
|
CFStringRef str;
|
||||||
str = CFURLCopyFileSystemPath(
|
str = CFURLCopyFileSystemPath(CFURLCopyAbsoluteURL(url), kCFURLPOSIXPathStyle);
|
||||||
CFURLCopyAbsoluteURL(url), kCFURLPOSIXPathStyle);
|
|
||||||
CFRelease(url);
|
CFRelease(url);
|
||||||
|
|
||||||
if(str)
|
if (str)
|
||||||
{
|
{
|
||||||
cachedPathToBundle = CFStringGetCStringPtr(
|
s_cachedPathToBundle = CFStringGetCStringPtr(str, CFStringGetSmallestEncoding(str));
|
||||||
str, CFStringGetSmallestEncoding(str));
|
|
||||||
CFRelease(str);
|
CFRelease(str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
nlerror("CFStringGetCStringPtr");
|
nlerror("CFStringGetCStringPtr");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
nlerror("CFBundleCopyBundleURL");
|
nlerror("CFBundleCopyBundleURL");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
nlerror("CFBundleGetMainBundle");
|
nlerror("CFBundleGetMainBundle");
|
||||||
|
}
|
||||||
#elif defined(NL_OS_WINDOWS)
|
#elif defined(NL_OS_WINDOWS)
|
||||||
char buffer[MAX_PATH+1];
|
char buffer[MAX_PATH+1];
|
||||||
if (GetModuleFileNameA(NULL, buffer, MAX_PATH))
|
if (GetModuleFileNameA(NULL, buffer, MAX_PATH))
|
||||||
cachedPathToBundle = NLMISC::CPath::standardizePath(NLMISC::CFile::getPath(buffer), false);
|
s_cachedPathToBundle = NLMISC::CPath::standardizePath(NLMISC::CFile::getPath(buffer), false);
|
||||||
#endif // defined(NL_OS_MAC)
|
#endif // defined(NL_OS_MAC)
|
||||||
|
|
||||||
return cachedPathToBundle;
|
return s_cachedPathToBundle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ void initAutoAnimation()
|
||||||
file.getline(line, 512);
|
file.getline(line, 512);
|
||||||
|
|
||||||
// Read the animation file
|
// Read the animation file
|
||||||
string animName = strlwr (CFile::getFilenameWithoutExtension(line));
|
string animName = toLower(CFile::getFilenameWithoutExtension(line));
|
||||||
uint id = AutoAnimSet->addAnimation (line, animName.c_str ());
|
uint id = AutoAnimSet->addAnimation (line, animName.c_str ());
|
||||||
if (id == UAnimationSet::NotFound)
|
if (id == UAnimationSet::NotFound)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,21 +24,26 @@ void browseFAQ(NLMISC::CConfigFile &cf)
|
||||||
std::string url;
|
std::string url;
|
||||||
std::string languageCode = "wk";
|
std::string languageCode = "wk";
|
||||||
CConfigFile::CVar *languageCodeVarPtr = cf.getVarPtr("LanguageCode");
|
CConfigFile::CVar *languageCodeVarPtr = cf.getVarPtr("LanguageCode");
|
||||||
|
|
||||||
if (languageCodeVarPtr)
|
if (languageCodeVarPtr)
|
||||||
{
|
{
|
||||||
languageCode = languageCodeVarPtr->asString();
|
languageCode = languageCodeVarPtr->asString();
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfigFile::CVar *helpPages = cf.getVarPtr("HelpPages");
|
CConfigFile::CVar *helpPages = cf.getVarPtr("HelpPages");
|
||||||
|
|
||||||
if (helpPages)
|
if (helpPages)
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < helpPages->size(); ++i)
|
for (uint i = 0; i < helpPages->size(); ++i)
|
||||||
{
|
{
|
||||||
std::string entry = helpPages->asString(i);
|
std::string entry = helpPages->asString(i);
|
||||||
|
|
||||||
if (entry.size() >= languageCode.size())
|
if (entry.size() >= languageCode.size())
|
||||||
{
|
{
|
||||||
if (nlstricmp(entry.substr(0, languageCode.size()), languageCode) == 0)
|
if (nlstricmp(entry.substr(0, languageCode.size()), languageCode) == 0)
|
||||||
{
|
{
|
||||||
std::string::size_type pos = entry.find("=");
|
std::string::size_type pos = entry.find("=");
|
||||||
|
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
{
|
{
|
||||||
url = entry.substr(pos + 1);
|
url = entry.substr(pos + 1);
|
||||||
|
|
|
@ -610,7 +610,7 @@ uint32 CCharacterCL::buildEquipment(const CCharacterSheet::CEquipment &slot, SLO
|
||||||
{
|
{
|
||||||
// IS the item a valid one ?
|
// IS the item a valid one ?
|
||||||
CSheetId itemId;
|
CSheetId itemId;
|
||||||
if(itemId.buildSheetId(NLMISC::strlwr(slot.getItem())))
|
if(itemId.buildSheetId(NLMISC::toLower(slot.getItem())))
|
||||||
{
|
{
|
||||||
// Is it stored in the database ?
|
// Is it stored in the database ?
|
||||||
CEntitySheet *entitySheet = SheetMngr.get(itemId);
|
CEntitySheet *entitySheet = SheetMngr.get(itemId);
|
||||||
|
@ -1098,7 +1098,7 @@ string CCharacterCL::automatonType() const // virtual
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
void CCharacterCL::computeAutomaton()
|
void CCharacterCL::computeAutomaton()
|
||||||
{
|
{
|
||||||
_CurrentAutomaton = automatonType() + "_" + NLMISC::strlwr(MBEHAV::modeToString(_Mode)) + ".automaton";
|
_CurrentAutomaton = automatonType() + "_" + NLMISC::toLower(MBEHAV::modeToString(_Mode)) + ".automaton";
|
||||||
}// computeAutomaton //
|
}// computeAutomaton //
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,6 @@
|
||||||
#define FINAL_VERSION 1
|
#define FINAL_VERSION 1
|
||||||
#endif // TEST_CRASH_COUNTER
|
#endif // TEST_CRASH_COUNTER
|
||||||
|
|
||||||
// game share
|
|
||||||
#include "game_share/ryzom_version.h"
|
|
||||||
|
|
||||||
// Client
|
// Client
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
|
@ -124,6 +121,12 @@ static void sigHandler(int Sig)
|
||||||
//---------------------------------------------------
|
//---------------------------------------------------
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
|
||||||
|
// enable optimus for NVIDIA cards
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||||
|
}
|
||||||
|
|
||||||
void pump ()
|
void pump ()
|
||||||
{
|
{
|
||||||
// Display the window
|
// Display the window
|
||||||
|
@ -363,6 +366,11 @@ int main(int argc, char **argv)
|
||||||
// init the Nel context
|
// init the Nel context
|
||||||
CApplicationContext *appContext = new CApplicationContext;
|
CApplicationContext *appContext = new CApplicationContext;
|
||||||
|
|
||||||
|
// disable nldebug messages in logs in Release
|
||||||
|
#ifdef NL_RELEASE
|
||||||
|
DisableNLDebug = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
createDebug();
|
createDebug();
|
||||||
|
|
||||||
INelContext::getInstance().setWindowedApplication(true);
|
INelContext::getInstance().setWindowedApplication(true);
|
||||||
|
@ -443,10 +451,9 @@ int main(int argc, char **argv)
|
||||||
if (string(cmdline) == "/crash")
|
if (string(cmdline) == "/crash")
|
||||||
volatile int toto = *(int*)0;
|
volatile int toto = *(int*)0;
|
||||||
if (string(cmdline) == "/break")
|
if (string(cmdline) == "/break")
|
||||||
__asm
|
{
|
||||||
{
|
__debugbreak();
|
||||||
int 3
|
}
|
||||||
};
|
|
||||||
#endif // TEST_CRASH_COUNTER
|
#endif // TEST_CRASH_COUNTER
|
||||||
|
|
||||||
HInstance = hInstance;
|
HInstance = hInstance;
|
||||||
|
@ -513,7 +520,7 @@ int main(int argc, char **argv)
|
||||||
uint i;
|
uint i;
|
||||||
for (i=0; i<files.size(); i++)
|
for (i=0; i<files.size(); i++)
|
||||||
{
|
{
|
||||||
if (strlwr (CFile::getExtension (files[i])) == "ttf")
|
if (toLower(CFile::getExtension (files[i])) == "ttf")
|
||||||
CFile::deleteFile (files[i]);
|
CFile::deleteFile (files[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ END
|
||||||
|
|
||||||
// Icon with lowest ID value placed first to ensure application icon
|
// Icon with lowest ID value placed first to ensure application icon
|
||||||
// remains consistent on all systems.
|
// remains consistent on all systems.
|
||||||
IDI_MAIN_ICON ICON DISCARDABLE "ryzom_small.ico"
|
IDI_MAIN_ICON ICON DISCARDABLE "ryzom.ico"
|
||||||
#endif // English (U.S.) resources
|
#endif // English (U.S.) resources
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,6 @@
|
||||||
#include "app_bundle_utils.h"
|
#include "app_bundle_utils.h"
|
||||||
#endif // NL_OS_MAC
|
#endif // NL_OS_MAC
|
||||||
|
|
||||||
#include <locale.h>
|
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// MACRO //
|
// MACRO //
|
||||||
///////////
|
///////////
|
||||||
|
@ -295,8 +293,8 @@ CClientConfig::CClientConfig()
|
||||||
SelectedSlot = 0; // Default is slot 0
|
SelectedSlot = 0; // Default is slot 0
|
||||||
|
|
||||||
Windowed = false; // Default is windowed mode.
|
Windowed = false; // Default is windowed mode.
|
||||||
Width = 800; // Default Width for the window.
|
Width = 0; // Default Width for the window (0 = current screen resolution).
|
||||||
Height = 600; // Default Height for the window.
|
Height = 0; // Default Height for the window (0 = current screen resolution).
|
||||||
Depth = 32; // Default Bit per Pixel.
|
Depth = 32; // Default Bit per Pixel.
|
||||||
Driver3D = DrvAuto; // Select best driver depending on hardware.
|
Driver3D = DrvAuto; // Select best driver depending on hardware.
|
||||||
Contrast = 0.f; // Default Monitor Contrast.
|
Contrast = 0.f; // Default Monitor Contrast.
|
||||||
|
@ -431,6 +429,8 @@ CClientConfig::CClientConfig()
|
||||||
WebIgMainDomain = "shard.ryzomcore.org";
|
WebIgMainDomain = "shard.ryzomcore.org";
|
||||||
WebIgTrustedDomains.push_back(WebIgMainDomain);
|
WebIgTrustedDomains.push_back(WebIgMainDomain);
|
||||||
|
|
||||||
|
CurlMaxConnections = 2;
|
||||||
|
|
||||||
RingReleaseNotePath = "http://" + WebIgMainDomain + "/releasenotes_ring/index.php";
|
RingReleaseNotePath = "http://" + WebIgMainDomain + "/releasenotes_ring/index.php";
|
||||||
ReleaseNotePath = "http://" + WebIgMainDomain + "/releasenotes/index.php";
|
ReleaseNotePath = "http://" + WebIgMainDomain + "/releasenotes/index.php";
|
||||||
|
|
||||||
|
@ -680,7 +680,6 @@ CClientConfig::CClientConfig()
|
||||||
DamageShieldEnabled = false;
|
DamageShieldEnabled = false;
|
||||||
|
|
||||||
AllowDebugLua = false;
|
AllowDebugLua = false;
|
||||||
LoadLuaDebugger = false;
|
|
||||||
DisplayLuaDebugInfo = false;
|
DisplayLuaDebugInfo = false;
|
||||||
BeepWhenLaunched = false;
|
BeepWhenLaunched = false;
|
||||||
|
|
||||||
|
@ -1076,6 +1075,9 @@ void CClientConfig::setValues()
|
||||||
// WEBIG //
|
// WEBIG //
|
||||||
READ_STRING_FV(WebIgMainDomain);
|
READ_STRING_FV(WebIgMainDomain);
|
||||||
READ_STRINGVECTOR_FV(WebIgTrustedDomains);
|
READ_STRINGVECTOR_FV(WebIgTrustedDomains);
|
||||||
|
READ_INT_FV(CurlMaxConnections);
|
||||||
|
if (ClientCfg.CurlMaxConnections < 0)
|
||||||
|
ClientCfg.CurlMaxConnections = 2;
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// ANIMATION //
|
// ANIMATION //
|
||||||
|
@ -1747,7 +1749,7 @@ void CClientConfig::setValues()
|
||||||
// Allow warning display only first time.
|
// Allow warning display only first time.
|
||||||
DisplayCFGWarning= false;
|
DisplayCFGWarning= false;
|
||||||
|
|
||||||
// If it is the load time, bkup the ClientCfg into LastClientCfg
|
// If it is the load time, backup the ClientCfg into LastClientCfg
|
||||||
if(firstTimeSetValues)
|
if(firstTimeSetValues)
|
||||||
LastClientCfg = ClientCfg;
|
LastClientCfg = ClientCfg;
|
||||||
|
|
||||||
|
@ -1761,7 +1763,6 @@ void CClientConfig::setValues()
|
||||||
READ_BOOL_DEV(DamageShieldEnabled)
|
READ_BOOL_DEV(DamageShieldEnabled)
|
||||||
|
|
||||||
READ_BOOL_DEV(AllowDebugLua)
|
READ_BOOL_DEV(AllowDebugLua)
|
||||||
READ_BOOL_DEV(LoadLuaDebugger)
|
|
||||||
READ_BOOL_DEV(DisplayLuaDebugInfo)
|
READ_BOOL_DEV(DisplayLuaDebugInfo)
|
||||||
|
|
||||||
READ_BOOL_DEV(LuaDebugInfoGotoButtonEnabled)
|
READ_BOOL_DEV(LuaDebugInfoGotoButtonEnabled)
|
||||||
|
@ -1934,8 +1935,7 @@ void CClientConfig::init(const string &configFileName)
|
||||||
nlwarning("CFG::init: creating '%s' with default values", configFileName.c_str ());
|
nlwarning("CFG::init: creating '%s' with default values", configFileName.c_str ());
|
||||||
|
|
||||||
// get current locale
|
// get current locale
|
||||||
std::string lang = toLower(std::string(setlocale(LC_CTYPE, "")));
|
std::string lang = CI18N::getSystemLanguageCode();
|
||||||
lang = lang.substr(0, 2);
|
|
||||||
|
|
||||||
const std::vector<std::string> &languages = CI18N::getLanguageCodes();
|
const std::vector<std::string> &languages = CI18N::getLanguageCodes();
|
||||||
|
|
||||||
|
|
|
@ -304,6 +304,7 @@ struct CClientConfig
|
||||||
std::string WebIgMainDomain;
|
std::string WebIgMainDomain;
|
||||||
std::vector<string> WebIgTrustedDomains;
|
std::vector<string> WebIgTrustedDomains;
|
||||||
|
|
||||||
|
sint32 CurlMaxConnections;
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// ANIMATION //
|
// ANIMATION //
|
||||||
|
@ -765,7 +766,6 @@ struct CClientConfig
|
||||||
|
|
||||||
/// Allow Lua commands (commands beginning with Lua)
|
/// Allow Lua commands (commands beginning with Lua)
|
||||||
bool AllowDebugLua;
|
bool AllowDebugLua;
|
||||||
bool LoadLuaDebugger;
|
|
||||||
|
|
||||||
bool LuaDebugInfoGotoButtonEnabled;
|
bool LuaDebugInfoGotoButtonEnabled;
|
||||||
std::string LuaDebugInfoGotoButtonTemplate;
|
std::string LuaDebugInfoGotoButtonTemplate;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue