diff --git a/code/CMakeModules/FindMercurial.cmake b/code/CMakeModules/FindMercurial.cmake index 9c252ad17..a18e50c43 100644 --- a/code/CMakeModules/FindMercurial.cmake +++ b/code/CMakeModules/FindMercurial.cmake @@ -60,7 +60,7 @@ IF(Mercurial_HG_EXECUTABLE) "\\1" Mercurial_VERSION_HG "${Mercurial_VERSION_HG}") MACRO(Mercurial_WC_INFO dir prefix) - EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip + EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip --template "{rev};{node};{tags};{author}" WORKING_DIRECTORY ${dir} OUTPUT_VARIABLE ${prefix}_WC_INFO ERROR_VARIABLE Mercurial_hg_info_error @@ -70,18 +70,18 @@ IF(Mercurial_HG_EXECUTABLE) IF(NOT ${Mercurial_hg_info_result} EQUAL 0) MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}") ELSE(NOT ${Mercurial_hg_info_result} EQUAL 0) - - STRING(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*" - "\\2" ${prefix}_WC_ROOT "${${prefix}_WC_INFO}") - STRING(REGEX REPLACE "^(.*\n)?changeset: *([0-9]+).*" - "\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}") - STRING(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*" - "\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}") - STRING(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*" - "\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}") - STRING(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*" - "\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}") - + LIST(LENGTH ${prefix}_WC_INFO _COUNT) + IF(_COUNT EQUAL 4) + LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION) + LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET) + LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH) + LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR) + ELSE(_COUNT EQUAL 4) + MESSAGE(STATUS "Bad output from HG") + SET(${prefix}_WC_REVISION "unknown") + SET(${prefix}_WC_CHANGESET "unknown") + SET(${prefix}_WC_BRANCH "unknown") + ENDIF(_COUNT EQUAL 4) ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0) ENDMACRO(Mercurial_WC_INFO) diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index 25903be14..9d9b91777 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -2,47 +2,86 @@ # Find the Windows includes # # WINSDK_INCLUDE_DIR - where to find Windows.h +# WINSDK_INCLUDE_DIRS - where to find all Windows headers +# WINSDK_LIBRARY_DIR - where to find libraries # WINSDK_FOUND - True if Windows SDK found. IF(WINSDK_INCLUDE_DIR) # Already in cache, be silent - SET(WINSDK_FIND_QUIETLY TRUE) + SET(WindowsSDK_FIND_QUIETLY TRUE) ENDIF(WINSDK_INCLUDE_DIR) +# TODO: add the possibility to use a specific Windows SDK + +IF(MSVC11) + GET_FILENAME_COMPONENT(WINSDK8_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]" ABSOLUTE CACHE) + GET_FILENAME_COMPONENT(WINSDK8_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;ProductVersion]" NAME) + + IF(WINSDK8_DIR) + IF(NOT WindowsSDK_FIND_QUIETLY) + MESSAGE(STATUS "Found Windows SDK ${WINSDK8_VERSION} in ${WINSDK8_DIR}") + ENDIF(NOT WindowsSDK_FIND_QUIETLY) + IF(TARGET_ARM) + SET(WINSDK8_SUFFIX "arm") + ELSEIF(TARGET_X64) + SET(WINSDK8_SUFFIX "x64") + ELSEIF(TARGET_X86) + SET(WINSDK8_SUFFIX "x86") + ENDIF(TARGET_ARM) + ENDIF(WINSDK8_DIR) +ENDIF(MSVC11) + GET_FILENAME_COMPONENT(WINSDK71_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;InstallationFolder]" ABSOLUTE CACHE) GET_FILENAME_COMPONENT(WINSDK71_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;ProductVersion]" NAME) IF(WINSDK71_DIR) - IF(NOT WINSDK_FIND_QUIETLY) + IF(NOT WindowsSDK_FIND_QUIETLY) MESSAGE(STATUS "Found Windows SDK ${WINSDK71_VERSION} in ${WINSDK71_DIR}") - ENDIF(NOT WINSDK_FIND_QUIETLY) + ENDIF(NOT WindowsSDK_FIND_QUIETLY) ENDIF(WINSDK71_DIR) GET_FILENAME_COMPONENT(WINSDKCURRENT_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE) GET_FILENAME_COMPONENT(WINSDKCURRENT_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentVersion]" NAME) IF(WINSDKCURRENT_DIR) - IF(NOT WINSDK_FIND_QUIETLY) + IF(NOT WindowsSDK_FIND_QUIETLY) MESSAGE(STATUS "Found Windows SDK ${WINSDKCURRENT_VERSION} in ${WINSDKCURRENT_DIR}") - ENDIF(NOT WINSDK_FIND_QUIETLY) + ENDIF(NOT WindowsSDK_FIND_QUIETLY) ENDIF(WINSDKCURRENT_DIR) FIND_PATH(WINSDK_INCLUDE_DIR Windows.h - PATHS + HINTS + ${WINSDK8_DIR}/Include/um ${WINSDK71_DIR}/Include ${WINSDKCURRENT_DIR}/Include ) +FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h + HINTS + ${WINSDK8_DIR}/Include/shared + ${WINSDK71_DIR}/Include + ${WINSDKCURRENT_DIR}/Include +) + +FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib + HINTS + ${WINSDK8_DIR}/Lib/win8/um/${WINSDK8_SUFFIX} + ${WINSDK71_DIR}/Lib + ${WINSDKCURRENT_DIR}/Lib +) + FIND_PROGRAM(WINSDK_SIGNTOOL signtool - PATHS + HINTS + ${WINSDK8_DIR}/Bin/x86 ${WINSDK71_DIR}/Bin ${WINSDKCURRENT_DIR}/Bin ) IF(WINSDK_INCLUDE_DIR) SET(WINSDK_FOUND TRUE) + SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR}) ELSE(WINSDK_INCLUDE_DIR) - IF(NOT WINSDK_FIND_QUIETLY) + IF(NOT WindowsSDK_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Windows SDK!") - ENDIF(NOT WINSDK_FIND_QUIETLY) + ENDIF(NOT WindowsSDK_FIND_QUIETLY) ENDIF(WINSDK_INCLUDE_DIR) diff --git a/code/CMakeModules/GetRevision.cmake b/code/CMakeModules/GetRevision.cmake index 52f443d5f..18e997af2 100644 --- a/code/CMakeModules/GetRevision.cmake +++ b/code/CMakeModules/GetRevision.cmake @@ -3,20 +3,24 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3) # ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory) # SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt) -# Replace spaces by semi-columns -IF(CMAKE_MODULE_PATH) - STRING(REPLACE " " ";" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) -ENDIF(CMAKE_MODULE_PATH) +IF(SOURCE_DIR) + # Replace spaces by semi-columns + IF(CMAKE_MODULE_PATH) + STRING(REPLACE " " ";" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) + ENDIF(CMAKE_MODULE_PATH) -SET(CMAKE_MODULE_PATH ${SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH}) + SET(CMAKE_MODULE_PATH ${SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH}) -IF(NOT ROOT_DIR AND SOURCE_DIR) - SET(ROOT_DIR ${SOURCE_DIR}) -ENDIF(NOT ROOT_DIR AND SOURCE_DIR) + IF(NOT ROOT_DIR AND SOURCE_DIR) + SET(ROOT_DIR ${SOURCE_DIR}) + ENDIF(NOT ROOT_DIR AND SOURCE_DIR) -IF(NOT SOURCE_DIR AND ROOT_DIR) - SET(SOURCE_DIR ${ROOT_DIR}) -ENDIF(NOT SOURCE_DIR AND ROOT_DIR) + IF(NOT SOURCE_DIR AND ROOT_DIR) + SET(SOURCE_DIR ${ROOT_DIR}) + ENDIF(NOT SOURCE_DIR AND ROOT_DIR) +ELSE(SOURCE_DIR) + SET(ROOT_DIR ${CMAKE_SOURCE_DIR}) +ENDIF(SOURCE_DIR) MACRO(NOW RESULT) IF (WIN32) @@ -53,10 +57,11 @@ IF(EXISTS "${ROOT_DIR}/.hg/") ENDIF(MERCURIAL_FOUND) ENDIF(EXISTS "${ROOT_DIR}/.hg/") -IF(DEFINED REVISION) +IF(SOURCE_DIR AND DEFINED REVISION) IF(EXISTS ${SOURCE_DIR}/revision.h.in) + MESSAGE(STATUS "Revision: ${REVISION}") NOW(BUILD_DATE) CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt) EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different ENDIF(EXISTS ${SOURCE_DIR}/revision.h.in) -ENDIF(DEFINED REVISION) +ENDIF(SOURCE_DIR AND DEFINED REVISION) diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index 0ef2243d6..d444bfa3d 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -9,250 +9,384 @@ # ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp IF(MSVC) - SET(PCHSupport_FOUND TRUE) - SET(_PCH_include_prefix "/I") + SET(PCHSupport_FOUND TRUE) + SET(_PCH_include_prefix "/I") ELSE(MSVC) - IF(CMAKE_COMPILER_IS_GNUCXX) - EXEC_PROGRAM(${CMAKE_CXX_COMPILER} - ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion - OUTPUT_VARIABLE gcc_compiler_version) + IF(CMAKE_COMPILER_IS_GNUCXX) + EXEC_PROGRAM(${CMAKE_CXX_COMPILER} + ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion + OUTPUT_VARIABLE gcc_compiler_version) - IF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") - SET(PCHSupport_FOUND TRUE) - ELSE(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") - IF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]") - SET(PCHSupport_FOUND TRUE) - ENDIF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]") - ENDIF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]") - ELSE(CMAKE_COMPILER_IS_GNUCXX) - # TODO: make tests for other compilers than GCC - SET(PCHSupport_FOUND TRUE) - ENDIF(CMAKE_COMPILER_IS_GNUCXX) + IF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?") + SET(PCHSupport_FOUND FALSE) + ELSEIF(gcc_compiler_version MATCHES "^4\\.[0-9]+(\\.[0-9]+)?") + SET(PCHSupport_FOUND TRUE) + ENDIF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?") + ELSE(CMAKE_COMPILER_IS_GNUCXX) + # TODO: make tests for other compilers than GCC + SET(PCHSupport_FOUND TRUE) + ENDIF(CMAKE_COMPILER_IS_GNUCXX) - SET(_PCH_include_prefix "-I") + SET(_PCH_include_prefix "-I") ENDIF(MSVC) -MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags) - STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name) - SET(_FLAGS ${${_flags_var_name}} ) +# 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) + SET(PCH_FLAGS) + SET(PCH_ARCHS) - IF(NOT MSVC) - GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE) - IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) - LIST(APPEND _FLAGS "-fPIC") - ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) - ENDIF(NOT MSVC) + SET(FLAGS) + LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS}) - GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES ) - FOREACH(item ${DIRINC}) - LIST(APPEND _FLAGS " ${_PCH_include_prefix}\"${item}\"") - ENDFOREACH(item) + STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD) + LIST(APPEND _FLAGS " ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}}") - # Required for CMake 2.6 - SET(GLOBAL_DEFINITIONS "") - GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS) - FOREACH(item ${DEFINITIONS}) - LIST(APPEND GLOBAL_DEFINITIONS -D${item}) - ENDFOREACH(item) + IF(NOT MSVC) + GET_TARGET_PROPERTY(_targetType ${_target} TYPE) + IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) + LIST(APPEND _FLAGS " -fPIC") + ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) + ENDIF(NOT MSVC) - GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS) - GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS) - LIST(APPEND _FLAGS ${GLOBAL_DEFINITIONS}) - LIST(APPEND _FLAGS ${_directory_flags}) - LIST(APPEND _FLAGS ${_directory_definitions}) - LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS}) + GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES) + FOREACH(item ${DIRINC}) + LIST(APPEND _FLAGS " ${_PCH_include_prefix}\"${item}\"") + ENDFOREACH(item) - # Format definitions - SEPARATE_ARGUMENTS(_FLAGS) + # Required for CMake 2.6 + SET(GLOBAL_DEFINITIONS) + GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS) + FOREACH(item ${DEFINITIONS}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + ENDFOREACH(item) - IF(CLANG) - SET(_IGNORE_NEXT OFF) - FOREACH(item ${_FLAGS}) - IF(_IGNORE_NEXT) - SET(_IGNORE_NEXT OFF) - ELSE(_IGNORE_NEXT) - IF(item MATCHES "^-Xarch") - SET(_IGNORE_NEXT ON) - ELSEIF(item MATCHES "^-arch") - SET(_IGNORE_NEXT ON) - ELSE(item MATCHES "^-Xarch") - LIST(APPEND ${_out_compile_flags} ${item}) - ENDIF(item MATCHES "^-Xarch") - ENDIF(_IGNORE_NEXT) - ENDFOREACH(item) - ELSE(CLANG) - SET(${_out_compile_flags} ${_FLAGS}) - ENDIF(CLANG) -ENDMACRO(_PCH_GET_COMPILE_FLAGS) + GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD}) + FOREACH(item ${DEFINITIONS}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + ENDFOREACH(item) -MACRO(_PCH_GET_PDB_FILENAME out_filename _target) - # determine output directory based on target type - GET_TARGET_PROPERTY(_targetType ${_target} TYPE) - IF(${_targetType} STREQUAL EXECUTABLE) - SET(_targetOutput ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - ELSEIF(${_targetType} STREQUAL STATIC_LIBRARY) - SET(_targetOutput ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) - ELSE(${_targetType} STREQUAL EXECUTABLE) - SET(_targetOutput ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - ENDIF(${_targetType} STREQUAL EXECUTABLE) + GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS) + IF(oldProps) + LIST(APPEND _FLAGS " ${oldProps}") + ENDIF(oldProps) - # determine target postfix - STRING(TOUPPER "${CMAKE_BUILD_TYPE}_POSTFIX" _postfix_var_name) - GET_TARGET_PROPERTY(_targetPostfix ${_target} ${_postfix_var_name}) - IF(${_targetPostfix} MATCHES NOTFOUND) - SET(_targetPostfix "") - ENDIF(${_targetPostfix} MATCHES NOTFOUND) + GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD}) + IF(oldPropsBuild) + LIST(APPEND _FLAGS " ${oldPropsBuild}") + ENDIF(oldPropsBuild) - SET(${out_filename} "${_targetOutput}/${_target}${_targetPostfix}.pdb") -ENDMACRO(_PCH_GET_PDB_FILENAME) + GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS) + GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS) + LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}") + LIST(APPEND _FLAGS " ${_directory_flags}") + LIST(APPEND _FLAGS " ${_directory_definitions}") -MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _inputcpp _output) - IF(CMAKE_CXX_COMPILER_ARG1) - # remove leading space in compiler argument - STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1}) - ELSE(CMAKE_CXX_COMPILER_ARG1) - SET(pchsupport_compiler_cxx_arg1 "") - ENDIF(CMAKE_CXX_COMPILER_ARG1) + STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS}) - IF(MSVC) - _PCH_GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target}) - SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp\"${_output}\" ${_inputcpp} /c /Fd\"${PDB_FILE}\") - ELSE(MSVC) - SET(HEADER_FORMAT "c++-header") - IF(APPLE) - SET(HEADER_FORMAT "objective-${HEADER_FORMAT}") - ENDIF(APPLE) - SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} -x ${HEADER_FORMAT} -o ${_output} -c ${_input}) - ENDIF(MSVC) -ENDMACRO(_PCH_GET_COMPILE_COMMAND) + # Format definitions + SEPARATE_ARGUMENTS(_FLAGS) -MACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input _output) - IF(MSVC) - GET_FILENAME_COMPONENT(_name ${_input} NAME_WE) - SET(_output "${CMAKE_CURRENT_BINARY_DIR}/${_name}.pch") - ELSE(MSVC) - GET_FILENAME_COMPONENT(_name ${_input} NAME) - SET(_output "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gch") - ENDIF(MSVC) -ENDMACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input) + IF(CLANG) + # Determining all architectures and get common flags + SET(_ARCH_NEXT) + SET(_XARCH_NEXT) + FOREACH(item ${_FLAGS}) + IF(_ARCH_NEXT) + LIST(FIND PCH_ARCHS ${item} ITEM_FOUND) + IF(ITEM_FOUND EQUAL -1) + LIST(APPEND PCH_ARCHS ${item}) + STRING(TOUPPER "${item}" _UPPER_ARCH) + SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item}) + ENDIF(ITEM_FOUND EQUAL -1) + SET(_ARCH_NEXT OFF) + ELSEIF(_XARCH_NEXT) + SET(_XARCH_NEXT OFF) + ELSE(_ARCH_NEXT) + IF(item MATCHES "^-arch") + SET(_ARCH_NEXT ON) + ELSEIF(item MATCHES "^-Xarch_") + STRING(REGEX REPLACE "-Xarch_([a-z0-9_]+)" "\\1" item ${item}) + LIST(FIND PCH_ARCHS ${item} ITEM_FOUND) + IF(ITEM_FOUND EQUAL -1) + LIST(APPEND PCH_ARCHS ${item}) + STRING(TOUPPER "${item}" _UPPER_ARCH) + SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item}) + ENDIF(ITEM_FOUND EQUAL -1) + SET(_XARCH_NEXT ON) + ELSE(item MATCHES "^-arch") + LIST(APPEND PCH_FLAGS ${item}) + ENDIF(item MATCHES "^-arch") + ENDIF(_ARCH_NEXT) + ENDFOREACH(item) -MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use ) - GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) - IF(${oldProps} MATCHES NOTFOUND) - SET(oldProps "") - ENDIF(${oldProps} MATCHES NOTFOUND) + # Get architcture specific flags + SET(_XARCH_NEXT) + FOREACH(item ${_FLAGS}) + IF(_XARCH_NEXT) + STRING(TOUPPER "${_XARCH_NEXT}" _UPPER_XARCH) + LIST(APPEND PCH_ARCH_${_UPPER_XARCH}_FLAGS ${item}) + SET(_XARCH_NEXT OFF) + ELSE(_XARCH_NEXT) + IF(item MATCHES "^-Xarch_") + STRING(SUBSTRING "${item}" 7 -1 _XARCH_NEXT) + ENDIF(item MATCHES "^-Xarch_") + ENDIF(_XARCH_NEXT) + ENDFOREACH(item) - IF(MSVC) - SET(_target_cflags "${oldProps} /Yu\"${_input}\" /FI\"${_input}\" /Fp\"${_pch_output_to_use}\"") - ELSE(MSVC) - # to do: test whether compiler flags match between target _targetName - # and _pch_output_to_use - FILE(TO_NATIVE_PATH ${_pch_output_to_use} _native_pch_path) + # Remove duplicated architectures + IF(_ARCHS AND PCH_ARCHS) + LIST(REMOVE_DUPLICATES PCH_ARCHS) + ENDIF(_ARCHS AND PCH_ARCHS) + ELSE(CLANG) + SET(PCH_FLAGS ${_FLAGS}) + ENDIF(CLANG) - # for use with distcc and gcc >4.0.1 if preprocessed files are accessible - # on all remote machines set - # PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess - SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS}-include ${_input} -Winvalid-pch") - ENDIF(MSVC) + IF(PCH_FLAGS) + LIST(REMOVE_DUPLICATES PCH_FLAGS) + ENDIF(PCH_FLAGS) +ENDMACRO(PCH_SET_COMPILE_FLAGS) - SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags}) - IF(oldProps) - SET_TARGET_PROPERTIES(${_targetName}_pch_dephelp PROPERTIES COMPILE_FLAGS ${oldProps}) - ENDIF(oldProps) - ADD_CUSTOM_TARGET(pch_Generate_${_targetName} DEPENDS ${_pch_output_to_use}) - ADD_DEPENDENCIES(${_targetName} pch_Generate_${_targetName}) +MACRO(GET_PDB_FILENAME _out_filename _target) + # determine output directory based on target type + GET_TARGET_PROPERTY(_targetType ${_target} TYPE) + IF(${_targetType} STREQUAL EXECUTABLE) + SET(_targetOutput ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + ELSEIF(${_targetType} STREQUAL STATIC_LIBRARY) + SET(_targetOutput ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) + ELSE(${_targetType} STREQUAL EXECUTABLE) + SET(_targetOutput ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + ENDIF(${_targetType} STREQUAL EXECUTABLE) + + # determine target postfix + STRING(TOUPPER "${CMAKE_BUILD_TYPE}_POSTFIX" _postfix_var_name) + GET_TARGET_PROPERTY(_targetPostfix ${_target} ${_postfix_var_name}) + IF(${_targetPostfix} MATCHES NOTFOUND) + SET(_targetPostfix "") + ENDIF(${_targetPostfix} MATCHES NOTFOUND) + + SET(${_out_filename} "${_targetOutput}/${_target}${_targetPostfix}.pdb") +ENDMACRO(GET_PDB_FILENAME) + +MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS) + IF(CMAKE_CXX_COMPILER_ARG1) + # remove leading space in compiler argument + STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1}) + ELSE(CMAKE_CXX_COMPILER_ARG1) + SET(pchsupport_compiler_cxx_arg1 "") + ENDIF(CMAKE_CXX_COMPILER_ARG1) + + IF(MSVC) + GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target}) + SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj") + ELSE(MSVC) + SET(HEADER_FORMAT "c++-header") + SET(_FLAGS "") + IF(APPLE) + SET(HEADER_FORMAT "objective-${HEADER_FORMAT}") + SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch) + ENDIF(APPLE) + SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT}) + ENDIF(MSVC) +ENDMACRO(PCH_SET_COMPILE_COMMAND) + +MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language) + SET(_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch") + + IF(MSVC) + FILE(MAKE_DIRECTORY ${_OUTPUT_DIR}) + GET_FILENAME_COMPONENT(_name ${_input} NAME_WE) + SET(PCH_INPUT ${_input}) + SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.pch") + ELSE(MSVC) + IF(NOT "${_arch}" STREQUAL "") + SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_arch}") + ENDIF(NOT "${_arch}" STREQUAL "") + + IF(NOT "${_language}" STREQUAL "") + SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_language}") + ENDIF(NOT "${_language}" STREQUAL "") + + GET_FILENAME_COMPONENT(_name ${_input} NAME) + + # Copy .h to output dir + SET(PCH_INPUT "${_OUTPUT_DIR}/${_name}") + ADD_CUSTOM_COMMAND(OUTPUT ${PCH_INPUT} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_input} ${PCH_INPUT} + DEPENDS ${_input} + COMMENT "[${_targetName}] Update precompiled header - done" + ) + + IF(CLANG) + SET(PCH_EXT "pth") + ELSE(CLANG) + SET(PCH_EXT "gch") + ENDIF(CLANG) + + # For GCC and Clang, PCH needs to be in the same directory as .h + SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.${PCH_EXT}") + ENDIF(MSVC) +ENDMACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT) + +# Add common flags +MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName) + GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) + + IF(${oldProps} MATCHES NOTFOUND) + SET(oldProps "") + ENDIF(${oldProps} MATCHES NOTFOUND) + + IF(MSVC) + SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"") + ELSE(MSVC) + # for use with distcc and gcc >4.0.1 if preprocessed files are accessible + # on all remote machines set + # PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess + SET(PCH_ADDITIONAL_COMPILER_FLAGS) + LIST(LENGTH PCH_ARCHS PCH_ARCHS_COUNT) + + # If no arch is specified, create common flags + IF(PCH_ARCHS_COUNT LESS 2) + SET(PCH_ADDITIONAL_COMPILER_FLAGS "-include ${PCH_INPUT} ${PCH_ADDITIONAL_COMPILER_FLAGS}") + ENDIF(PCH_ARCHS_COUNT LESS 2) + + IF(APPLE) + SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}") + ENDIF(APPLE) + + IF(WITH_PCH_DEBUG) + SET(PCH_ADDITIONAL_COMPILER_FLAGS "-H ${PCH_ADDITIONAL_COMPILER_FLAGS}") + ENDIF(WITH_PCH_DEBUG) + + SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch") + ENDIF(MSVC) + + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags}) ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET) +# Add specific flags for an arch +MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch) + LIST(LENGTH PCH_ARCHS PCH_ARCHS_COUNT) + + IF(PCH_ARCHS_COUNT GREATER 1) + GET_TARGET_PROPERTY(_FLAGS ${_targetName} COMPILE_FLAGS) + + IF(${_FLAGS} MATCHES NOTFOUND) + SET(_FLAGS "") + ENDIF(${_FLAGS} MATCHES NOTFOUND) + + SET(_FLAGS "${_FLAGS} -Xarch_${_arch} -include${PCH_INPUT}") + + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_FLAGS}) + ENDIF(PCH_ARCHS_COUNT GREATER 1) +ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH) + +MACRO(PCH_CREATE_TARGET _targetName _targetNamePCH) + 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_DEPENDENCIES(${_targetName} ${_targetNamePCH}) +ENDMACRO(PCH_CREATE_TARGET _targetName _inputh _inputcpp) + MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp) + SET(_PCH_current_target ${_targetName}) - SET(_PCH_current_target ${_targetName}) + IF(NOT CMAKE_BUILD_TYPE) + MESSAGE(FATAL_ERROR + "This is the ADD_PRECOMPILED_HEADER macro. " + "You must set CMAKE_BUILD_TYPE!" + ) + ENDIF(NOT CMAKE_BUILD_TYPE) - IF(NOT CMAKE_BUILD_TYPE) - MESSAGE(FATAL_ERROR - "This is the ADD_PRECOMPILED_HEADER macro. " - "You must set CMAKE_BUILD_TYPE!" - ) - ENDIF(NOT CMAKE_BUILD_TYPE) + PCH_SET_COMPILE_FLAGS(${_targetName}) - GET_PRECOMPILED_HEADER_OUTPUT( ${_targetName} ${_inputh} _output) + IF(PCH_ARCHS) + SET(PCH_OUTPUTS) + FOREACH(_ARCH ${PCH_ARCHS}) + STRING(TOUPPER "${_ARCH}" _UPPER_ARCH) - GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE) + PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} ${_ARCH} "") + LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT}) - # always build static library because it doesn't need linking - ADD_LIBRARY(${_targetName}_pch_dephelp STATIC ${_inputcpp}) + PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_ARCH_${_UPPER_ARCH}_FLAGS};${PCH_FLAGS}") + PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH}) - _PCH_GET_COMPILE_FLAGS(_compile_FLAGS) + ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH}) + ENDFOREACH(_ARCH) + ELSE(PCH_ARCHS) + PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "") + LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT}) - SET_SOURCE_FILES_PROPERTIES(${_inputh} PROPERTIES GENERATED 1) + PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}") + PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch) + ENDIF(PCH_ARCHS) - _PCH_GET_COMPILE_COMMAND(_command ${_inputh} ${_inputcpp} ${_output}) + ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName}) - ADD_CUSTOM_COMMAND( - OUTPUT ${_output} - COMMAND ${_command} - DEPENDS ${_inputh} ${_targetName}_pch_dephelp - ) - - ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName} ${_inputh} ${_output}) + SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}") ENDMACRO(ADD_PRECOMPILED_HEADER) # Macro to move PCH creation file to the front of files list +# or remove .cpp from library/executable to avoid warning MACRO(FIX_PRECOMPILED_HEADER _files _pch) - # Remove .cpp creating PCH from the list - LIST(REMOVE_ITEM ${_files} ${_pch}) - # Prepend .cpp creating PCH to the list - LIST(INSERT ${_files} 0 ${_pch}) + # Remove .cpp creating PCH from the list + LIST(REMOVE_ITEM ${_files} ${_pch}) + IF(MSVC) + # Prepend .cpp creating PCH to the list + LIST(INSERT ${_files} 0 ${_pch}) + ENDIF(MSVC) ENDMACRO(FIX_PRECOMPILED_HEADER) MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) - SET(PCH_METHOD 0) + IF(NOT PCHSupport_FOUND) + MESSAGE(STATUS "PCH disabled because compiler doesn't support them") + RETURN() + ENDIF(NOT PCHSupport_FOUND) - # 0 => creating a new target for PCH, works for all makefiles - # 1 => setting PCH for VC++ project, works for VC++ projects - # 2 => setting PCH for XCode project, works for XCode projects - IF(CMAKE_GENERATOR MATCHES "Visual Studio") - SET(PCH_METHOD 1) - ELSEIF(CMAKE_GENERATOR MATCHES "NMake Makefiles" AND MFC_FOUND AND CMAKE_MFC_FLAG) - # To fix a bug with MFC - # Don't forget to use FIX_PRECOMPILED_HEADER before creating the target -# SET(PCH_METHOD 1) - ELSEIF(CMAKE_GENERATOR MATCHES "Xcode") - SET(PCH_METHOD 2) - ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio") + # 0 => creating a new target for PCH, works for all makefiles + # 1 => setting PCH for VC++ project, works for VC++ projects + # 2 => setting PCH for XCode project, works for XCode projects + IF(CMAKE_GENERATOR MATCHES "Visual Studio") + SET(PCH_METHOD 1) + ELSEIF(CMAKE_GENERATOR MATCHES "NMake Makefiles" AND MFC_FOUND AND CMAKE_MFC_FLAG) + # To fix a bug with MFC + # Don't forget to use FIX_PRECOMPILED_HEADER before creating the target +# SET(PCH_METHOD 1) + ELSEIF(CMAKE_GENERATOR MATCHES "Xcode") + SET(PCH_METHOD 2) + ELSE(CMAKE_GENERATOR MATCHES "Visual Studio") + SET(PCH_METHOD 0) + ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio") - IF(PCH_METHOD EQUAL 1) - # Auto include the precompile (useful for moc processing, since the use of - # precompiled is specified at the target level - # and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt) + IF(PCH_METHOD EQUAL 1) + # Auto include the precompile (useful for moc processing, since the use of + # precompiled is specified at the target level + # and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt) - GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) - IF(${oldProps} MATCHES NOTFOUND) - SET(oldProps "") - ENDIF(${oldProps} MATCHES NOTFOUND) + GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) + IF(${oldProps} MATCHES NOTFOUND) + SET(oldProps "") + ENDIF(${oldProps} MATCHES NOTFOUND) - SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"") - SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}") + SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"") + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}") - #also inlude ${oldProps} to have the same compile options - SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"") - ELSEIF(PCH_METHOD EQUAL 2) - # For Xcode, cmake needs my patch to process - # GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties + #also inlude ${oldProps} to have the same compile options + SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"") + ELSEIF(PCH_METHOD EQUAL 2) + # For Xcode, cmake needs my patch to process + # GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties - GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS) - IF(${oldProps} MATCHES NOTFOUND) - SET(oldProps "") - ENDIF(${oldProps} MATCHES NOTFOUND) + # When buiding out of the tree, precompiled may not be located + # Use full path instead. + GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE) - # When buiding out of the tree, precompiled may not be located - # Use full path instead. - GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE) - - SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}") - SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") - ELSE(PCH_METHOD EQUAL 1) - #Fallback to the "old" precompiled suppport - ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp}) - ENDIF(PCH_METHOD EQUAL 1) + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}") + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") + ELSE(PCH_METHOD EQUAL 1) + #Fallback to the "old" precompiled suppport + ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp}) + ENDIF(PCH_METHOD EQUAL 1) + IF(TARGET ${_targetName}_static) + ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp}) + ENDIF(TARGET ${_targetName}_static) ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index b8f74e4de..1c339fef8 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -22,32 +22,52 @@ ENDMACRO(NL_GEN_PC) ### MACRO(NL_GEN_REVISION_H) IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in) - INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) - ADD_DEFINITIONS(-DHAVE_REVISION_H) - SET(HAVE_REVISION_H ON) + SET(TOOL_FOUND OFF) + + IF(EXISTS "${CMAKE_SOURCE_DIR}/../.svn/") + FIND_PACKAGE(Subversion) + + IF(SUBVERSION_FOUND) + SET(TOOL_FOUND ON) + ENDIF(SUBVERSION_FOUND) + ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/../.svn/") + + IF(EXISTS "${CMAKE_SOURCE_DIR}/../.hg/") + FIND_PACKAGE(Mercurial) + + IF(MERCURIAL_FOUND) + SET(TOOL_FOUND ON) + ENDIF(MERCURIAL_FOUND) + ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/../.hg/") # if already generated IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h) # copy it MESSAGE(STATUS "Copying provided revision.h...") FILE(COPY ${CMAKE_SOURCE_DIR}/revision.h DESTINATION ${CMAKE_BINARY_DIR}) - ELSE(EXISTS ${CMAKE_SOURCE_DIR}/revision.h) + SET(HAVE_REVISION_H ON) + ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h) + + IF(TOOL_FOUND) # a custom target that is always built ADD_CUSTOM_TARGET(revision ALL - DEPENDS ${CMAKE_BINARY_DIR}/revision.h) - - # creates revision.h using cmake script - ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/revision.h COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR} -DROOT_DIR=${CMAKE_SOURCE_DIR}/.. + -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/CMakeModules -P ${CMAKE_SOURCE_DIR}/CMakeModules/GetRevision.cmake) # revision.h is a generated file SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/revision.h PROPERTIES GENERATED TRUE HEADER_FILE_ONLY TRUE) - ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h) + SET(HAVE_REVISION_H ON) + ENDIF(TOOL_FOUND) + + IF(HAVE_REVISION_H) + INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) + ADD_DEFINITIONS(-DHAVE_REVISION_H) + ENDIF(HAVE_REVISION_H) ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in) ENDMACRO(NL_GEN_REVISION_H) @@ -79,6 +99,11 @@ ENDMACRO(NL_TARGET_DRIVER) # Argument: ### MACRO(NL_DEFAULT_PROPS name label) + IF(HAVE_REVISION_H) + # explicitly say that the target depends on revision.h + ADD_DEPENDENCIES(${name} revision) + ENDIF(HAVE_REVISION_H) + # 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 STRING(REGEX REPLACE "\\:" " -" proj_label ${label}) @@ -386,7 +411,7 @@ MACRO(NL_SETUP_BUILD) ENDIF(CMAKE_GENERATOR MATCHES "Xcode") # If target and host CPU are the same - IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}") + IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING) # x86-compatible CPU IF(HOST_CPU MATCHES "x86") IF(NOT CMAKE_SIZEOF_VOID_P) @@ -407,9 +432,9 @@ MACRO(NL_SETUP_BUILD) MESSAGE(STATUS "Unknown architecture: ${HOST_CPU}") ENDIF(HOST_CPU MATCHES "x86") # TODO: add checks for PPC - ELSE("${HOST_CPU}" STREQUAL "${TARGET_CPU}") + ELSE("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING) MESSAGE(STATUS "Compiling on ${HOST_CPU} for ${TARGET_CPU}") - ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}") + ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING) # Use values from environment variables SET(PLATFORM_CFLAGS "$ENV{CFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CFLAGS}") @@ -430,6 +455,7 @@ MACRO(NL_SETUP_BUILD) IF(NOT CMAKE_OSX_ARCHITECTURES) IF(TARGET_CPU STREQUAL "x86_64") SET(TARGET_X64 1) + SET(TARGET_X86 1) ELSEIF(TARGET_CPU STREQUAL "x86") SET(TARGET_X86 1) ELSEIF(TARGET_CPU STREQUAL "armv7s") @@ -446,7 +472,37 @@ MACRO(NL_SETUP_BUILD) SET(TARGET_ARMV5 1) ELSEIF(TARGET_CPU STREQUAL "arm") SET(TARGET_ARM 1) + ELSEIF(TARGET_CPU STREQUAL "mips") + SET(TARGET_MIPS 1) ENDIF(TARGET_CPU STREQUAL "x86_64") + + IF(TARGET_ARM) + IF(TARGET_ARMV7S) + ADD_PLATFORM_FLAGS("-DHAVE_ARMV7S") + ENDIF(TARGET_ARMV7S) + + IF(TARGET_ARMV7) + ADD_PLATFORM_FLAGS("-DHAVE_ARMV7") + ENDIF(TARGET_ARMV7) + + IF(TARGET_ARMV6) + ADD_PLATFORM_FLAGS("-HAVE_ARMV6") + ENDIF(TARGET_ARMV6) + + ADD_PLATFORM_FLAGS("-DHAVE_ARM") + ENDIF(TARGET_ARM) + + IF(TARGET_X86) + ADD_PLATFORM_FLAGS("-DHAVE_X86") + ENDIF(TARGET_X86) + + IF(TARGET_X64) + ADD_PLATFORM_FLAGS("-DHAVE_X64 -DHAVE_X86_64") + ENDIF(TARGET_X64) + + IF(TARGET_MIPS) + ADD_PLATFORM_FLAGS("-DHAVE_MIPS") + ENDIF(TARGET_MIPS) ENDIF(NOT CMAKE_OSX_ARCHITECTURES) # Fix library paths suffixes for Debian MultiArch @@ -454,10 +510,9 @@ MACRO(NL_SETUP_BUILD) SET(CMAKE_LIBRARY_PATH /lib/${LIBRARY_ARCHITECTURE} /usr/lib/${LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_PATH}) IF(TARGET_X64) SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib64 /usr/lib64) - ENDIF(TARGET_X64) - IF(TARGET_X86) + ELSEIF(TARGET_X86) SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib32 /usr/lib32) - ENDIF(TARGET_X86) + ENDIF(TARGET_X64) ENDIF(LIBRARY_ARCHITECTURE) IF(APPLE AND NOT IOS) @@ -465,32 +520,22 @@ MACRO(NL_SETUP_BUILD) SET(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH}) ENDIF(APPLE AND NOT IOS) - IF(TARGET_ARM) - IF(TARGET_ARMV7) - ADD_PLATFORM_FLAGS("-DHAVE_ARMV7") - ENDIF(TARGET_ARMV7) - - IF(TARGET_ARMV6) - ADD_PLATFORM_FLAGS("-HAVE_ARMV6") - ENDIF(TARGET_ARMV6) - - ADD_PLATFORM_FLAGS("-DHAVE_ARM") - ENDIF(TARGET_ARM) - - IF(TARGET_X86) - ADD_PLATFORM_FLAGS("-DHAVE_X86") - ENDIF(TARGET_X86) - - IF(TARGET_X64) - ADD_PLATFORM_FLAGS("-DHAVE_X64 -DHAVE_X86_64") - ENDIF(TARGET_X64) - IF(WITH_LOGGING) ADD_PLATFORM_FLAGS("-DENABLE_LOGS") ENDIF(WITH_LOGGING) IF(MSVC) - IF(MSVC10) + IF(MSVC_VERSION EQUAL "1700" AND NOT MSVC11) + SET(MSVC11 ON) + ENDIF(MSVC_VERSION EQUAL "1700" AND NOT MSVC11) + + IF(MSVC11) + ADD_PLATFORM_FLAGS("/Gy- /MP") + # /Ox is working with VC++ 2010, but custom optimizations don't exist + SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") + # without inlining it's unusable, use custom optimizations again + SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") + ELSEIF(MSVC10) ADD_PLATFORM_FLAGS("/Gy- /MP") # /Ox is working with VC++ 2010, but custom optimizations don't exist SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") @@ -508,9 +553,9 @@ MACRO(NL_SETUP_BUILD) SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}") - ELSE(MSVC10) + ELSE(MSVC11) MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}") - ENDIF(MSVC10) + ENDIF(MSVC11) ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250") @@ -553,13 +598,10 @@ MACRO(NL_SETUP_BUILD) ENDIF(CLANG) ENDIF(WIN32) - IF(TARGET_ARM) - ADD_PLATFORM_FLAGS("-mthumb") - ENDIF(TARGET_ARM) - IF(APPLE) IF(IOS) - SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE PATH "" FORCE) + # Disable CMAKE_OSX_DEPLOYMENT_TARGET for iOS + SET(CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE PATH "" FORCE) ELSE(IOS) IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET) SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE PATH "" FORCE) @@ -585,6 +627,11 @@ MACRO(NL_SETUP_BUILD) SET(_ARCHS "${_ARCHS} x86_64") SET(TARGET_X64 1) MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1") + ELSEIF(_ARCH STREQUAL "armv7s") + SET(_ARCHS "${_ARCHS} armv7s") + SET(TARGET_ARMV7S 1) + SET(TARGET_ARM 1) + MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1") ELSEIF(_ARCH STREQUAL "armv7") SET(_ARCHS "${_ARCHS} armv7") SET(TARGET_ARMV7 1) @@ -595,16 +642,51 @@ MACRO(NL_SETUP_BUILD) SET(TARGET_ARMV6 1) SET(TARGET_ARM 1) MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1") + ELSEIF(_ARCH STREQUAL "mips") + SET(_ARCHS "${_ARCHS} mips") + SET(TARGET_MIPS 1) + MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1") ELSE(_ARCH STREQUAL "i386") SET(_ARCHS "${_ARCHS} unknwon(${_ARCH})") ENDIF(_ARCH STREQUAL "i386") ENDFOREACH(_ARCH) MESSAGE(STATUS "Compiling under Mac OS X for ${TARGETS_COUNT} architectures: ${_ARCHS}") ELSE(CMAKE_OSX_ARCHITECTURES) - SET(TARGETS_COUNT 1) + SET(TARGETS_COUNT 0) ENDIF(CMAKE_OSX_ARCHITECTURES) IF(TARGETS_COUNT EQUAL 1) + IF(TARGET_ARM) + IF(TARGET_ARMV7S) + ADD_PLATFORM_FLAGS("-arch armv7s -DHAVE_ARMV7S") + ENDIF(TARGET_ARMV7S) + + IF(TARGET_ARMV7) + ADD_PLATFORM_FLAGS("-arch armv7 -DHAVE_ARMV7") + ENDIF(TARGET_ARMV7) + + IF(TARGET_ARMV6) + ADD_PLATFORM_FLAGS("-arch armv6 -DHAVE_ARMV6") + ENDIF(TARGET_ARMV6) + + IF(TARGET_ARMV5) + ADD_PLATFORM_FLAGS("-arch armv5 -DHAVE_ARMV5") + ENDIF(TARGET_ARMV5) + + ADD_PLATFORM_FLAGS("-mthumb -DHAVE_ARM") + ENDIF(TARGET_ARM) + + IF(TARGET_X64) + ADD_PLATFORM_FLAGS("-arch x86_64 -DHAVE_X64 -DHAVE_X86_64 -DHAVE_X86") + ELSEIF(TARGET_X86) + ADD_PLATFORM_FLAGS("-arch i386 -DHAVE_X86") + ENDIF(TARGET_X64) + + IF(TARGET_MIPS) + ADD_PLATFORM_FLAGS("-arch mips -DHAVE_MIPS") + ENDIF(TARGET_MIPS) + ELSEIF(TARGETS_COUNT EQUAL 0) + # Not using CMAKE_OSX_ARCHITECTURES, HAVE_XXX already defined before IF(TARGET_ARM) IF(TARGET_ARMV7S) ADD_PLATFORM_FLAGS("-arch armv7s") @@ -621,15 +703,19 @@ MACRO(NL_SETUP_BUILD) IF(TARGET_ARMV5) ADD_PLATFORM_FLAGS("-arch armv5") ENDIF(TARGET_ARMV5) - ENDIF(TARGET_ARM) - IF(TARGET_X86) - ADD_PLATFORM_FLAGS("-arch i386") - ENDIF(TARGET_X86) + ADD_PLATFORM_FLAGS("-mthumb") + ENDIF(TARGET_ARM) IF(TARGET_X64) ADD_PLATFORM_FLAGS("-arch x86_64") + ELSEIF(TARGET_X86) + ADD_PLATFORM_FLAGS("-arch i386") ENDIF(TARGET_X64) + + IF(TARGET_MIPS) + ADD_PLATFORM_FLAGS("-arch mips") + ENDIF(TARGET_MIPS) ELSE(TARGETS_COUNT EQUAL 1) IF(TARGET_ARMV6) ADD_PLATFORM_FLAGS("-Xarch_armv6 -mthumb -Xarch_armv6 -DHAVE_ARM -Xarch_armv6 -DHAVE_ARMV6") @@ -640,15 +726,21 @@ MACRO(NL_SETUP_BUILD) ENDIF(TARGET_ARMV7) IF(TARGET_X86) - ADD_PLATFORM_FLAGS("-arch i386 -Xarch_i386 -DHAVE_X86") + ADD_PLATFORM_FLAGS("-Xarch_i386 -DHAVE_X86") ENDIF(TARGET_X86) IF(TARGET_X64) - ADD_PLATFORM_FLAGS("-arch x86_64 -Xarch_x86_64 -DHAVE_X64 -Xarch_x86_64 -DHAVE_X86_64") + ADD_PLATFORM_FLAGS("-Xarch_x86_64 -DHAVE_X64 -Xarch_x86_64 -DHAVE_X86_64") ENDIF(TARGET_X64) + + IF(TARGET_MIPS) + ADD_PLATFORM_FLAGS("-Xarch_mips -DHAVE_MIPS") + ENDIF(TARGET_MIPS) ENDIF(TARGETS_COUNT EQUAL 1) IF(IOS) + SET(CMAKE_OSX_SYSROOT "" CACHE PATH "" FORCE) + IF(IOS_VERSION) PARSE_VERSION_STRING(${IOS_VERSION} IOS_VERSION_MAJOR IOS_VERSION_MINOR IOS_VERSION_PATCH) CONVERT_VERSION_NUMBER(${IOS_VERSION_MAJOR} ${IOS_VERSION_MINOR} ${IOS_VERSION_PATCH} IOS_VERSION_NUMBER) @@ -657,20 +749,44 @@ MACRO(NL_SETUP_BUILD) ENDIF(IOS_VERSION) IF(CMAKE_IOS_SYSROOT) - ADD_PLATFORM_FLAGS("-isysroot${CMAKE_IOS_SYSROOT}") - ADD_PLATFORM_FLAGS("-miphoneos-version-min=${IOS_VERSION}") - SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-iphoneos_version_min,${IOS_VERSION}") + IF(TARGET_ARMV7S) + IF(TARGETS_COUNT GREATER 1) + SET(XARCH "-Xarch_armv7s ") + ENDIF(TARGETS_COUNT GREATER 1) + + ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}") + ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}") + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}") + ENDIF(TARGET_ARMV7S) + + IF(TARGET_ARMV7) + IF(TARGETS_COUNT GREATER 1) + SET(XARCH "-Xarch_armv7 ") + ENDIF(TARGETS_COUNT GREATER 1) + + ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}") + ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}") + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}") + ENDIF(TARGET_ARMV7) + + IF(TARGET_ARMV6) + IF(TARGETS_COUNT GREATER 1) + SET(XARCH "-Xarch_armv6 ") + ENDIF(TARGETS_COUNT GREATER 1) + + ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}") + ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}") + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}") + ENDIF(TARGET_ARMV6) ENDIF(CMAKE_IOS_SYSROOT) IF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86) - IF(TARGETS_COUNT EQUAL 1) - ADD_PLATFORM_FLAGS("-arch i386") - ELSE(TARGETS_COUNT EQUAL 1) + IF(TARGETS_COUNT GREATER 1) SET(XARCH "-Xarch_i386 ") - ENDIF(TARGETS_COUNT EQUAL 1) + ENDIF(TARGETS_COUNT GREATER 1) - # Always force -mmacosx-version-min to override environement variable - ADD_PLATFORM_FLAGS("${XARCH}-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") + ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SIMULATOR_SYSROOT}") + ADD_PLATFORM_FLAGS("${XARCH}-mios-simulator-version-min=${IOS_VERSION}") SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}") ENDIF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86) ELSE(IOS) @@ -722,6 +838,46 @@ MACRO(NL_SETUP_BUILD) ENDIF(CLANG) ENDIF(WITH_WARNINGS) + IF(ANDROID) + ADD_PLATFORM_FLAGS("--sysroot=${PLATFORM_ROOT}") + ADD_PLATFORM_FLAGS("-ffunction-sections -funwind-tables") + ADD_PLATFORM_FLAGS("-DANDROID") + ADD_PLATFORM_FLAGS("-Wa,--noexecstack") + + IF(TARGET_ARM) + ADD_PLATFORM_FLAGS("-fpic -fstack-protector") + ADD_PLATFORM_FLAGS("-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__") + + IF(TARGET_ARMV7) + ADD_PLATFORM_FLAGS("-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16") + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -march=armv7-a -Wl,--fix-cortex-a8") + ELSEIF(TARGET_ARMV5) + ADD_PLATFORM_FLAGS("-march=armv5te -mtune=xscale -msoft-float") + ENDIF(TARGET_ARMV7) + + SET(TARGET_THUMB ON) + IF(TARGET_THUMB) + ADD_PLATFORM_FLAGS("-mthumb -fno-strict-aliasing -finline-limit=64") + SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -marm") + ELSE(TARGET_THUMB) + ADD_PLATFORM_FLAGS("-funswitch-loops -finline-limit=300") + SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -fno-strict-aliasing") + SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -fstrict-aliasing") + ENDIF(TARGET_THUMB) + ELSEIF(TARGET_X86) + # Optimizations for Intel Atom + ADD_PLATFORM_FLAGS("-march=i686 -mtune=atom -mstackrealign -msse3 -mfpmath=sse -m32 -flto -ffast-math -funroll-loops") + ADD_PLATFORM_FLAGS("-fstack-protector -funswitch-loops -finline-limit=300") + SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -fstrict-aliasing") + SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -fno-strict-aliasing") + ELSEIF(TARGET_MIPS) + ADD_PLATFORM_FLAGS("-fpic -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -fno-strict-aliasing") + SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -funswitch-loops -finline-limit=300") + ENDIF(TARGET_ARM) + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now") + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -L${PLATFORM_ROOT}/usr/lib") + ENDIF(ANDROID) + IF(APPLE) ADD_PLATFORM_FLAGS("-gdwarf-2") ENDIF(APPLE) @@ -775,7 +931,7 @@ ENDMACRO(NL_SETUP_BUILD_FLAGS) MACRO(NL_MAKE_ABSOLUTE_PREFIX NAME_RELATIVE NAME_ABSOLUTE) IF(IS_ABSOLUTE "${${NAME_RELATIVE}}") SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}}) - ELSE(IS_ABSOLUTE "${${{NAME_RELATIVE}}") + ELSE(IS_ABSOLUTE "${${NAME_RELATIVE}}") IF(WIN32) SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}}) ELSE(WIN32) @@ -922,11 +1078,41 @@ MACRO(SETUP_EXTERNAL) IF(WIN32) FIND_PACKAGE(External REQUIRED) - IF(MSVC10) - IF(NOT MSVC10_REDIST_DIR) + IF(NOT VC_DIR) + SET(VC_DIR $ENV{VC_DIR}) + ENDIF(NOT VC_DIR) + + IF(MSVC11) + IF(NOT MSVC_REDIST_DIR) + # If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist + SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist") + ENDIF(NOT MSVC_REDIST_DIR) + + IF(NOT VC_DIR) + IF(NOT VC_ROOT_DIR) + GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\11.0_Config;InstallDir]" ABSOLUTE) + # VC_ROOT_DIR is set to "registry" when a key is not found + IF(VC_ROOT_DIR MATCHES "registry") + GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\WDExpress\\11.0_Config\\Setup\\VC;InstallDir]" ABSOLUTE) + IF(VC_ROOT_DIR MATCHES "registry") + SET(VS110COMNTOOLS $ENV{VS110COMNTOOLS}) + IF(VS110COMNTOOLS) + FILE(TO_CMAKE_PATH ${VS110COMNTOOLS} VC_ROOT_DIR) + ENDIF(VS110COMNTOOLS) + IF(NOT VC_ROOT_DIR) + MESSAGE(FATAL_ERROR "Unable to find VC++ 2012 directory!") + ENDIF(NOT VC_ROOT_DIR) + ENDIF(VC_ROOT_DIR MATCHES "registry") + ENDIF(VC_ROOT_DIR MATCHES "registry") + ENDIF(NOT VC_ROOT_DIR) + # convert IDE fullpath to VC++ path + STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR}) + ENDIF(NOT VC_DIR) + ELSEIF(MSVC10) + IF(NOT MSVC_REDIST_DIR) # If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist - SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF(NOT MSVC10_REDIST_DIR) + SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist") + ENDIF(NOT MSVC_REDIST_DIR) IF(NOT VC_DIR) IF(NOT VC_ROOT_DIR) @@ -948,7 +1134,7 @@ MACRO(SETUP_EXTERNAL) # convert IDE fullpath to VC++ path STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR}) ENDIF(NOT VC_DIR) - ELSE(MSVC10) + ELSE(MSVC11) IF(NOT VC_DIR) IF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") # convert IDE fullpath to VC++ path @@ -958,7 +1144,7 @@ MACRO(SETUP_EXTERNAL) STRING(REGEX REPLACE "VC/bin/.+" "VC" VC_DIR ${CMAKE_CXX_COMPILER}) ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") ENDIF(NOT VC_DIR) - ENDIF(MSVC10) + ENDIF(MSVC11) ELSE(WIN32) IF(APPLE) IF(WITH_STATIC_EXTERNAL) @@ -983,7 +1169,7 @@ MACRO(SETUP_EXTERNAL) FIND_PACKAGE(WindowsSDK REQUIRED) # use VC++ and Windows SDK include paths - INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIR}) + INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIRS}) ENDIF(MSVC) ENDIF(WITH_STLPORT) ENDMACRO(SETUP_EXTERNAL) diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index 630cbcb01..d090d77da 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -293,6 +293,11 @@ public: */ virtual void forceDXTCCompression(bool dxtcComp)=0; + /** if different from 0, enable anisotropic filter on textures. -1 enables max value. + * Default is 0. + */ + virtual void setAnisotropicFilter(sint filter)=0; + /** if !=1, force mostly all the textures (but TextureFonts lightmaps, interfaces etc..) * to be divided by Divisor (2, 4, 8...) * Default is 1. diff --git a/code/nel/include/nel/3d/driver_user.h b/code/nel/include/nel/3d/driver_user.h index a7f6ac7a5..bfe4c1755 100644 --- a/code/nel/include/nel/3d/driver_user.h +++ b/code/nel/include/nel/3d/driver_user.h @@ -471,6 +471,7 @@ public: virtual void delete3dMouseListener (U3dMouseListener *listener); virtual TPolygonMode getPolygonMode (); virtual void forceDXTCCompression(bool dxtcComp); + virtual void setAnisotropicFilter(sint filter); virtual void forceTextureResize(uint divisor); virtual void forceNativeFragmentPrograms(bool nativeOnly); virtual bool setMonitorColorProperties (const CMonitorColorProperties &properties); diff --git a/code/nel/include/nel/3d/landscape_def.h b/code/nel/include/nel/3d/landscape_def.h index 783846d12..ce90c5b4a 100644 --- a/code/nel/include/nel/3d/landscape_def.h +++ b/code/nel/include/nel/3d/landscape_def.h @@ -158,7 +158,7 @@ public: // *************************************************************************** -// Out of CLandscapeGlobals, because myabe used in __asm{} +// Out of CLandscapeGlobals, because maybe used in __asm{} extern uint NL3D_LandscapeGlobals_PassNTri; extern void *NL3D_LandscapeGlobals_PassTriCurPtr; extern CIndexBuffer::TFormat NL3D_LandscapeGlobals_PassTriFormat; diff --git a/code/nel/include/nel/3d/u_driver.h b/code/nel/include/nel/3d/u_driver.h index 9b9eac656..d66a72e47 100644 --- a/code/nel/include/nel/3d/u_driver.h +++ b/code/nel/include/nel/3d/u_driver.h @@ -660,6 +660,11 @@ public: */ virtual void forceDXTCCompression(bool dxtcComp)=0; + /** if different from 0, enable anisotropic filter on textures. -1 enables max value. + * Default is 0. + */ + virtual void setAnisotropicFilter(sint filter)=0; + /** if !=1, force mostly all the textures (but TextureFonts lightmaps, interfaces etc..) * to be divided by Divisor (2, 4, 8...) * Default is 1. diff --git a/code/nel/include/nel/georges/header.h b/code/nel/include/nel/georges/header.h index 769cc0568..3733f0707 100644 --- a/code/nel/include/nel/georges/header.h +++ b/code/nel/include/nel/georges/header.h @@ -19,6 +19,9 @@ #include "nel/misc/types_nl.h" +// Include from libxml2 +#include + namespace NLGEORGES { diff --git a/code/nel/include/nel/misc/big_file.h b/code/nel/include/nel/misc/big_file.h index 3043295a2..4c11b01b0 100644 --- a/code/nel/include/nel/misc/big_file.h +++ b/code/nel/include/nel/misc/big_file.h @@ -19,6 +19,7 @@ #include "types_nl.h" #include "tds.h" +#include "singleton.h" namespace NLMISC { diff --git a/code/nel/include/nel/misc/contiguous_block_allocator.h b/code/nel/include/nel/misc/contiguous_block_allocator.h index 2cdeeade9..7a15d296d 100644 --- a/code/nel/include/nel/misc/contiguous_block_allocator.h +++ b/code/nel/include/nel/misc/contiguous_block_allocator.h @@ -17,6 +17,7 @@ #ifndef NL_CONTIGUOUS_BLOCK_ALLOCATOR_H #define NL_CONTIGUOUS_BLOCK_ALLOCATOR_H +#include "types_nl.h" namespace NLMISC { diff --git a/code/nel/include/nel/misc/debug.h b/code/nel/include/nel/misc/debug.h index dcd9fe68d..8d469b133 100644 --- a/code/nel/include/nel/misc/debug.h +++ b/code/nel/include/nel/misc/debug.h @@ -17,14 +17,14 @@ #ifndef NL_DEBUG_H #define NL_DEBUG_H -#include - #include "common.h" #include "log.h" #include "mutex.h" #include "mem_displayer.h" #include "displayer.h" #include "app_context.h" + +#include #include namespace NLMISC @@ -169,7 +169,7 @@ void setCrashAlreadyReported(bool state); *\endcode */ #ifdef NL_NO_DEBUG -# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10) +# if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 71 # define nldebug __noop # else # define nldebug 0&& @@ -184,7 +184,7 @@ void setCrashAlreadyReported(bool state); * Same as nldebug but it will be display in debug and in release mode. */ #ifdef NL_NO_DEBUG -# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10) +# if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 71 # define nlinfo __noop # else # define nlinfo 0&& @@ -212,7 +212,7 @@ void setCrashAlreadyReported(bool state); */ #ifdef NL_NO_DEBUG -# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10) +# if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 71 # define nlwarning __noop # else # define nlwarning 0&& diff --git a/code/nel/include/nel/misc/file.h b/code/nel/include/nel/misc/file.h index 51d9d6cbc..17154e6be 100644 --- a/code/nel/include/nel/misc/file.h +++ b/code/nel/include/nel/misc/file.h @@ -17,6 +17,7 @@ #ifndef NL_FILE_H #define NL_FILE_H +#include "types_nl.h" #include "stream.h" diff --git a/code/nel/include/nel/misc/fixed_size_allocator.h b/code/nel/include/nel/misc/fixed_size_allocator.h index 02e4573a2..9eb1d8a10 100644 --- a/code/nel/include/nel/misc/fixed_size_allocator.h +++ b/code/nel/include/nel/misc/fixed_size_allocator.h @@ -17,6 +17,7 @@ #ifndef NL_FIXED_SIZE_ALLOCATOR_H #define NL_FIXED_SIZE_ALLOCATOR_H +#include "types_nl.h" namespace NLMISC { diff --git a/code/nel/include/nel/misc/grid_traversal.h b/code/nel/include/nel/misc/grid_traversal.h index 2e3f76a1e..893b3978a 100644 --- a/code/nel/include/nel/misc/grid_traversal.h +++ b/code/nel/include/nel/misc/grid_traversal.h @@ -17,6 +17,8 @@ #ifndef _GRID_TRAVERSAL_H #define _GRID_TRAVERSAL_H +#include "types_nl.h" + namespace NLMISC { diff --git a/code/nel/include/nel/misc/input_device_manager.h b/code/nel/include/nel/misc/input_device_manager.h index bb5e01e87..a23437696 100644 --- a/code/nel/include/nel/misc/input_device_manager.h +++ b/code/nel/include/nel/misc/input_device_manager.h @@ -19,7 +19,7 @@ #include "types_nl.h" #include "game_device.h" - +#include "common.h" namespace NLMISC { diff --git a/code/nel/include/nel/misc/inter_window_msg_queue.h b/code/nel/include/nel/misc/inter_window_msg_queue.h index 90fb720b4..f65767bce 100644 --- a/code/nel/include/nel/misc/inter_window_msg_queue.h +++ b/code/nel/include/nel/misc/inter_window_msg_queue.h @@ -17,6 +17,7 @@ #ifndef RY_INTER_WINDOW_MSG_QUEUE_H #define RY_INTER_WINDOW_MSG_QUEUE_H +#include "types_nl.h" #ifdef NL_OS_WINDOWS diff --git a/code/nel/include/nel/misc/mutex.h b/code/nel/include/nel/misc/mutex.h index 7659d05e6..adbc7e7e5 100644 --- a/code/nel/include/nel/misc/mutex.h +++ b/code/nel/include/nel/misc/mutex.h @@ -586,7 +586,7 @@ extern uint32 NbMutexes; /** - * This class ensure that the Value is accessed by only one thread. First you have to create a CSynchronized class with you type. + * This class ensure that the Value is accessed by only one thread. First you have to create a CSynchronized class with your type. * Then, if a thread want to modify or do anything on it, you create a CAccessor in a \b sub \b scope. You can modify the value * of the CUnfairSynchronized using the value() function \b until the end of the scope. So you have to put the smaller scope as you can. * diff --git a/code/nel/include/nel/misc/object_arena_allocator.h b/code/nel/include/nel/misc/object_arena_allocator.h index 6370b9834..6d318aca8 100644 --- a/code/nel/include/nel/misc/object_arena_allocator.h +++ b/code/nel/include/nel/misc/object_arena_allocator.h @@ -17,6 +17,7 @@ #ifndef NL_OBJECT_ARENA_ALLOCATOR_H #define NL_OBJECT_ARENA_ALLOCATOR_H +#include "types_nl.h" #include "singleton.h" namespace NLMISC diff --git a/code/nel/include/nel/misc/p_thread.h b/code/nel/include/nel/misc/p_thread.h index 0ef221760..4f0a9aa63 100644 --- a/code/nel/include/nel/misc/p_thread.h +++ b/code/nel/include/nel/misc/p_thread.h @@ -17,9 +17,10 @@ #ifndef NL_P_THREAD_H #define NL_P_THREAD_H +#include "types_nl.h" + #ifdef NL_OS_UNIX -#include "types_nl.h" #include "thread.h" #include diff --git a/code/nel/include/nel/misc/path.h b/code/nel/include/nel/misc/path.h index 2ac69c4e7..73652a581 100644 --- a/code/nel/include/nel/misc/path.h +++ b/code/nel/include/nel/misc/path.h @@ -19,14 +19,13 @@ #include "types_nl.h" #include "time_nl.h" +#include "common.h" +#include "string_mapper.h" #include #include #include -#include "common.h" -#include "string_mapper.h" - namespace NLMISC { /// Exception throw when a find is not found in a lookup() call diff --git a/code/nel/include/nel/misc/polygon.h b/code/nel/include/nel/misc/polygon.h index 9be40c189..a0183d20d 100644 --- a/code/nel/include/nel/misc/polygon.h +++ b/code/nel/include/nel/misc/polygon.h @@ -21,6 +21,7 @@ #include "matrix.h" #include "stream.h" #include "vector_2f.h" + #include diff --git a/code/nel/include/nel/misc/pool_memory.h b/code/nel/include/nel/misc/pool_memory.h index 05103a569..def4125dc 100644 --- a/code/nel/include/nel/misc/pool_memory.h +++ b/code/nel/include/nel/misc/pool_memory.h @@ -18,6 +18,7 @@ #define NL_POOL_MEMORY_H #include "types_nl.h" + #include #include diff --git a/code/nel/include/nel/misc/quat.h b/code/nel/include/nel/misc/quat.h index 73e6a43d3..3e8a70d5c 100644 --- a/code/nel/include/nel/misc/quat.h +++ b/code/nel/include/nel/misc/quat.h @@ -20,6 +20,7 @@ #include "types_nl.h" #include "vector.h" #include "stream.h" + #include namespace NLMISC diff --git a/code/nel/include/nel/misc/resource_ptr_inline.h b/code/nel/include/nel/misc/resource_ptr_inline.h index fde8da963..b287e9b18 100644 --- a/code/nel/include/nel/misc/resource_ptr_inline.h +++ b/code/nel/include/nel/misc/resource_ptr_inline.h @@ -18,6 +18,8 @@ #ifndef NL_RESOURCE_PTR_INLINE_H #define NL_RESOURCE_PTR_INLINE_H +#include "types_nl.h" + namespace NLMISC { diff --git a/code/nel/include/nel/misc/rgba.h b/code/nel/include/nel/misc/rgba.h index 944b453d8..7eeadaf99 100644 --- a/code/nel/include/nel/misc/rgba.h +++ b/code/nel/include/nel/misc/rgba.h @@ -17,11 +17,11 @@ #ifndef NL_RGBA_H #define NL_RGBA_H -#include - #include "types_nl.h" #include "common.h" +#include + namespace NLMISC { diff --git a/code/nel/include/nel/misc/sha1.h b/code/nel/include/nel/misc/sha1.h index 6fab640d3..d4c630c22 100644 --- a/code/nel/include/nel/misc/sha1.h +++ b/code/nel/include/nel/misc/sha1.h @@ -17,11 +17,12 @@ #ifndef NL_SHA1_H #define NL_SHA1_H -#include - +#include "types_nl.h" #include "common.h" #include "stream.h" +#include + struct CHashKey { CHashKey () { HashKeyString.resize(20); } diff --git a/code/nel/include/nel/misc/smart_ptr.h b/code/nel/include/nel/misc/smart_ptr.h index f345f7f6c..2bfb57cc3 100644 --- a/code/nel/include/nel/misc/smart_ptr.h +++ b/code/nel/include/nel/misc/smart_ptr.h @@ -352,7 +352,7 @@ public: } }; -#if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10) +#if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 80 // This operator only purpose is to compare with NULL value template diff --git a/code/nel/include/nel/misc/smart_ptr_inline.h b/code/nel/include/nel/misc/smart_ptr_inline.h index 6ea1f9bd4..f6665825a 100644 --- a/code/nel/include/nel/misc/smart_ptr_inline.h +++ b/code/nel/include/nel/misc/smart_ptr_inline.h @@ -18,6 +18,8 @@ #ifndef NL_SMARTPTR_INLINE_H #define NL_SMARTPTR_INLINE_H +#include "types_nl.h" + namespace NLMISC { diff --git a/code/nel/include/nel/misc/stl_block_list.h b/code/nel/include/nel/misc/stl_block_list.h index f901e516c..ccd207187 100644 --- a/code/nel/include/nel/misc/stl_block_list.h +++ b/code/nel/include/nel/misc/stl_block_list.h @@ -19,6 +19,7 @@ #include "types_nl.h" #include "stl_block_allocator.h" + #include diff --git a/code/nel/include/nel/misc/stop_watch.h b/code/nel/include/nel/misc/stop_watch.h index a3a56d51d..b519f4c82 100644 --- a/code/nel/include/nel/misc/stop_watch.h +++ b/code/nel/include/nel/misc/stop_watch.h @@ -19,6 +19,7 @@ #include "types_nl.h" #include "time_nl.h" + #include diff --git a/code/nel/include/nel/misc/stream.h b/code/nel/include/nel/misc/stream.h index b198bc890..ad0e8ddd4 100644 --- a/code/nel/include/nel/misc/stream.h +++ b/code/nel/include/nel/misc/stream.h @@ -21,6 +21,7 @@ #include "ucstring.h" #include "class_registry.h" #include "common.h" + #include #include #include diff --git a/code/nel/include/nel/misc/stream_inline.h b/code/nel/include/nel/misc/stream_inline.h index b36d1eae7..f0b1e3603 100644 --- a/code/nel/include/nel/misc/stream_inline.h +++ b/code/nel/include/nel/misc/stream_inline.h @@ -17,10 +17,11 @@ #ifndef NL_STREAM_INLINE_H #define NL_STREAM_INLINE_H -#include - +#include "types_nl.h" #include "debug.h" +#include + namespace NLMISC { diff --git a/code/nel/include/nel/misc/string_conversion.h b/code/nel/include/nel/misc/string_conversion.h index 0b1aa5487..2c19e0a80 100644 --- a/code/nel/include/nel/misc/string_conversion.h +++ b/code/nel/include/nel/misc/string_conversion.h @@ -19,6 +19,7 @@ #include "types_nl.h" #include "common.h" + #include namespace NLMISC diff --git a/code/nel/include/nel/misc/string_id_array.h b/code/nel/include/nel/misc/string_id_array.h index c1a1739e4..9ca01695e 100644 --- a/code/nel/include/nel/misc/string_id_array.h +++ b/code/nel/include/nel/misc/string_id_array.h @@ -18,6 +18,7 @@ #define NL_STRING_ID_ARRAY_H #include "types_nl.h" +#include "debug.h" #include #include @@ -25,8 +26,6 @@ #include #include -#include "debug.h" - namespace NLMISC { diff --git a/code/nel/include/nel/misc/string_mapper.h b/code/nel/include/nel/misc/string_mapper.h index c3ae832c4..36a73ed4d 100644 --- a/code/nel/include/nel/misc/string_mapper.h +++ b/code/nel/include/nel/misc/string_mapper.h @@ -18,13 +18,12 @@ #define STRING_MAPPER_H #include "types_nl.h" +#include "stream.h" +#include "mutex.h" #include #include -#include "stream.h" -#include "mutex.h" - namespace NLMISC { diff --git a/code/nel/include/nel/misc/types_nl.h b/code/nel/include/nel/misc/types_nl.h index 40d89f879..6485960f7 100644 --- a/code/nel/include/nel/misc/types_nl.h +++ b/code/nel/include/nel/misc/types_nl.h @@ -48,32 +48,44 @@ # define NL_OS_WINDOWS # define NL_LITTLE_ENDIAN # define NL_CPU_INTEL -# ifndef _WIN32_WINNT +# ifndef _WIN32_WINNT # define _WIN32_WINNT 0x0500 // Minimal OS = Windows 2000 (NeL is not supported on Windows 95/98) -# endif -# if _MSC_VER >= 1600 -# define NL_COMP_VC10 -# elif _MSC_VER >= 1500 -# define NL_COMP_VC9 -# elif _MSC_VER >= 1400 -# define NL_COMP_VC8 -# undef nl_time -# define nl_time _time32 // use the old 32 bit time function -# undef nl_mktime -# define nl_mktime _mktime32 // use the old 32 bit time function -# undef nl_gmtime -# define nl_gmtime _gmtime32 // use the old 32 bit time function -# undef nl_localtime -# define nl_localtime _localtime32 // use the old 32 bit time function -# undef nl_difftime -# define nl_difftime _difftime32 // use the old 32 bit time function -# elif _MSC_VER >= 1310 -# define NL_COMP_VC71 -# elif _MSC_VER >= 1300 -# define NL_COMP_VC7 -# elif _MSC_VER >= 1200 -# define NL_COMP_VC6 -# define NL_COMP_NEED_PARAM_ON_METHOD +# endif +# ifdef _MSC_VER +# define NL_COMP_VC +# if _MSC_VER >= 1700 +# define NL_COMP_VC11 +# define NL_COMP_VC_VERSION 110 +# elif _MSC_VER >= 1600 +# define NL_COMP_VC10 +# define NL_COMP_VC_VERSION 100 +# elif _MSC_VER >= 1500 +# define NL_COMP_VC9 +# define NL_COMP_VC_VERSION 90 +# elif _MSC_VER >= 1400 +# define NL_COMP_VC8 +# define NL_COMP_VC_VERSION 80 +# undef nl_time +# define nl_time _time32 // use the old 32 bit time function +# undef nl_mktime +# define nl_mktime _mktime32 // use the old 32 bit time function +# undef nl_gmtime +# define nl_gmtime _gmtime32 // use the old 32 bit time function +# undef nl_localtime +# define nl_localtime _localtime32 // use the old 32 bit time function +# undef nl_difftime +# define nl_difftime _difftime32 // use the old 32 bit time function +# elif _MSC_VER >= 1310 +# define NL_COMP_VC71 +# define NL_COMP_VC_VERSION 71 +# elif _MSC_VER >= 1300 +# define NL_COMP_VC7 +# define NL_COMP_VC_VERSION 70 +# elif _MSC_VER >= 1200 +# define NL_COMP_VC6 +# define NL_COMP_VC_VERSION 60 +# define NL_COMP_NEED_PARAM_ON_METHOD +# endif # endif # if defined(_HAS_TR1) && (_HAS_TR1 + 0) // VC9 TR1 feature pack or later # define NL_ISO_STDTR1_AVAILABLE @@ -320,7 +332,7 @@ typedef unsigned int uint; // at least 32bits (depend of processor) # define CHashMap std::tr1::unordered_map # define CHashSet std::tr1::unordered_set # define CHashMultiMap std::tr1::unordered_multimap -#elif defined(NL_COMP_VC7) || defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) // VC7 through 9 +#elif defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 70 && NL_COMP_VC_VERSION <= 90) // VC7 through 9 # include # include # define CHashMap stdext::hash_map @@ -366,7 +378,7 @@ typedef uint16 ucchar; // To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234) #ifdef NL_OS_WINDOWS -# if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10) +# if defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 80) # define INT64_CONSTANT(c) (c##LL) # define SINT64_CONSTANT(c) (c##LL) # define UINT64_CONSTANT(c) (c##LL) diff --git a/code/nel/include/nel/misc/win32_util.h b/code/nel/include/nel/misc/win32_util.h index 67fe69883..d040458c1 100644 --- a/code/nel/include/nel/misc/win32_util.h +++ b/code/nel/include/nel/misc/win32_util.h @@ -17,6 +17,7 @@ #ifndef NL_WIN32_UTIL_H #define NL_WIN32_UTIL_H +#include "types_nl.h" #ifdef NL_OS_WINDOWS diff --git a/code/nel/src/pacs/build_indoor.h b/code/nel/include/nel/pacs/build_indoor.h similarity index 100% rename from code/nel/src/pacs/build_indoor.h rename to code/nel/include/nel/pacs/build_indoor.h diff --git a/code/nel/src/pacs/chain.h b/code/nel/include/nel/pacs/chain.h similarity index 100% rename from code/nel/src/pacs/chain.h rename to code/nel/include/nel/pacs/chain.h diff --git a/code/nel/src/pacs/chain_quad.h b/code/nel/include/nel/pacs/chain_quad.h similarity index 100% rename from code/nel/src/pacs/chain_quad.h rename to code/nel/include/nel/pacs/chain_quad.h diff --git a/code/nel/src/pacs/collision_callback.h b/code/nel/include/nel/pacs/collision_callback.h similarity index 100% rename from code/nel/src/pacs/collision_callback.h rename to code/nel/include/nel/pacs/collision_callback.h diff --git a/code/nel/src/pacs/collision_desc.h b/code/nel/include/nel/pacs/collision_desc.h similarity index 100% rename from code/nel/src/pacs/collision_desc.h rename to code/nel/include/nel/pacs/collision_desc.h diff --git a/code/nel/src/pacs/collision_mesh_build.h b/code/nel/include/nel/pacs/collision_mesh_build.h similarity index 100% rename from code/nel/src/pacs/collision_mesh_build.h rename to code/nel/include/nel/pacs/collision_mesh_build.h diff --git a/code/nel/src/pacs/collision_ot.h b/code/nel/include/nel/pacs/collision_ot.h similarity index 100% rename from code/nel/src/pacs/collision_ot.h rename to code/nel/include/nel/pacs/collision_ot.h diff --git a/code/nel/src/pacs/collision_surface_temp.h b/code/nel/include/nel/pacs/collision_surface_temp.h similarity index 100% rename from code/nel/src/pacs/collision_surface_temp.h rename to code/nel/include/nel/pacs/collision_surface_temp.h diff --git a/code/nel/src/pacs/edge_collide.h b/code/nel/include/nel/pacs/edge_collide.h similarity index 100% rename from code/nel/src/pacs/edge_collide.h rename to code/nel/include/nel/pacs/edge_collide.h diff --git a/code/nel/src/pacs/edge_quad.h b/code/nel/include/nel/pacs/edge_quad.h similarity index 100% rename from code/nel/src/pacs/edge_quad.h rename to code/nel/include/nel/pacs/edge_quad.h diff --git a/code/nel/src/pacs/exterior_mesh.h b/code/nel/include/nel/pacs/exterior_mesh.h similarity index 100% rename from code/nel/src/pacs/exterior_mesh.h rename to code/nel/include/nel/pacs/exterior_mesh.h diff --git a/code/nel/src/pacs/face_grid.h b/code/nel/include/nel/pacs/face_grid.h similarity index 100% rename from code/nel/src/pacs/face_grid.h rename to code/nel/include/nel/pacs/face_grid.h diff --git a/code/nel/src/pacs/global_retriever.h b/code/nel/include/nel/pacs/global_retriever.h similarity index 100% rename from code/nel/src/pacs/global_retriever.h rename to code/nel/include/nel/pacs/global_retriever.h diff --git a/code/nel/src/pacs/local_retriever.h b/code/nel/include/nel/pacs/local_retriever.h similarity index 100% rename from code/nel/src/pacs/local_retriever.h rename to code/nel/include/nel/pacs/local_retriever.h diff --git a/code/nel/src/pacs/move_cell.h b/code/nel/include/nel/pacs/move_cell.h similarity index 100% rename from code/nel/src/pacs/move_cell.h rename to code/nel/include/nel/pacs/move_cell.h diff --git a/code/nel/src/pacs/move_container.h b/code/nel/include/nel/pacs/move_container.h similarity index 100% rename from code/nel/src/pacs/move_container.h rename to code/nel/include/nel/pacs/move_container.h diff --git a/code/nel/src/pacs/move_container_inline.h b/code/nel/include/nel/pacs/move_container_inline.h similarity index 100% rename from code/nel/src/pacs/move_container_inline.h rename to code/nel/include/nel/pacs/move_container_inline.h diff --git a/code/nel/src/pacs/move_element.h b/code/nel/include/nel/pacs/move_element.h similarity index 100% rename from code/nel/src/pacs/move_element.h rename to code/nel/include/nel/pacs/move_element.h diff --git a/code/nel/src/pacs/move_element_inline.h b/code/nel/include/nel/pacs/move_element_inline.h similarity index 100% rename from code/nel/src/pacs/move_element_inline.h rename to code/nel/include/nel/pacs/move_element_inline.h diff --git a/code/nel/src/pacs/move_primitive.h b/code/nel/include/nel/pacs/move_primitive.h similarity index 100% rename from code/nel/src/pacs/move_primitive.h rename to code/nel/include/nel/pacs/move_primitive.h diff --git a/code/nel/src/pacs/primitive_block.h b/code/nel/include/nel/pacs/primitive_block.h similarity index 100% rename from code/nel/src/pacs/primitive_block.h rename to code/nel/include/nel/pacs/primitive_block.h diff --git a/code/nel/src/pacs/primitive_world_image.h b/code/nel/include/nel/pacs/primitive_world_image.h similarity index 100% rename from code/nel/src/pacs/primitive_world_image.h rename to code/nel/include/nel/pacs/primitive_world_image.h diff --git a/code/nel/src/pacs/quad_grid.h b/code/nel/include/nel/pacs/quad_grid.h similarity index 100% rename from code/nel/src/pacs/quad_grid.h rename to code/nel/include/nel/pacs/quad_grid.h diff --git a/code/nel/src/pacs/retrievable_surface.h b/code/nel/include/nel/pacs/retrievable_surface.h similarity index 100% rename from code/nel/src/pacs/retrievable_surface.h rename to code/nel/include/nel/pacs/retrievable_surface.h diff --git a/code/nel/src/pacs/retriever_bank.h b/code/nel/include/nel/pacs/retriever_bank.h similarity index 100% rename from code/nel/src/pacs/retriever_bank.h rename to code/nel/include/nel/pacs/retriever_bank.h diff --git a/code/nel/src/pacs/retriever_instance.h b/code/nel/include/nel/pacs/retriever_instance.h similarity index 100% rename from code/nel/src/pacs/retriever_instance.h rename to code/nel/include/nel/pacs/retriever_instance.h diff --git a/code/nel/src/pacs/surface_quad.h b/code/nel/include/nel/pacs/surface_quad.h similarity index 100% rename from code/nel/src/pacs/surface_quad.h rename to code/nel/include/nel/pacs/surface_quad.h diff --git a/code/nel/src/pacs/vector_2s.h b/code/nel/include/nel/pacs/vector_2s.h similarity index 100% rename from code/nel/src/pacs/vector_2s.h rename to code/nel/include/nel/pacs/vector_2s.h diff --git a/code/nel/src/3d/driver.cpp b/code/nel/src/3d/driver.cpp index 13e76cfa1..fa48649ae 100644 --- a/code/nel/src/3d/driver.cpp +++ b/code/nel/src/3d/driver.cpp @@ -33,7 +33,7 @@ namespace NL3D { // *************************************************************************** -const uint32 IDriver::InterfaceVersion = 0x6a; // added cursors methods +const uint32 IDriver::InterfaceVersion = 0x6b; // added anisotropic filter // *************************************************************************** IDriver::IDriver() : _SyncTexDrvInfos( "IDriver::_SyncTexDrvInfos" ) diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 2b18c8698..412cb52da 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -292,6 +292,11 @@ CDriverD3D::CDriverD3D() _CurrIndexBufferFormat = CIndexBuffer::IndicesUnknownFormat; _IsGeforce = false; _NonPowerOfTwoTexturesSupported = false; + _MaxAnisotropy = 0; + _AnisotropicMinSupported = false; + _AnisotropicMagSupported = false; + _AnisotropicMinCubeSupported = false; + _AnisotropicMagCubeSupported = false; _FrustumLeft= -1.f; _FrustumRight= 1.f; @@ -1493,6 +1498,11 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r _MaxVertexIndex = caps.MaxVertexIndex; _IsGeforce = !(caps.DevCaps & D3DDEVCAPS_NPATCHES) && (caps.PixelShaderVersion >= D3DPS_VERSION(2, 0) || caps.PixelShaderVersion < D3DPS_VERSION(1, 4)); _NonPowerOfTwoTexturesSupported = !(caps.TextureCaps & D3DPTEXTURECAPS_POW2) || (caps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL); + _MaxAnisotropy = caps.MaxAnisotropy; + _AnisotropicMinSupported = (caps.TextureFilterCaps & D3DPTFILTERCAPS_MINFANISOTROPIC) != 0; + _AnisotropicMagSupported = (caps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFANISOTROPIC) != 0; + _AnisotropicMinCubeSupported = (caps.CubeTextureFilterCaps & D3DPTFILTERCAPS_MINFANISOTROPIC) != 0; + _AnisotropicMagCubeSupported = (caps.CubeTextureFilterCaps & D3DPTFILTERCAPS_MAGFANISOTROPIC) != 0; } else { @@ -1506,6 +1516,11 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r _MaxVertexIndex = 0xffff; _IsGeforce = false; _NonPowerOfTwoTexturesSupported = false; + _MaxAnisotropy = 0; + _AnisotropicMinSupported = false; + _AnisotropicMagSupported = false; + _AnisotropicMinCubeSupported = false; + _AnisotropicMagCubeSupported = false; } // If 16 bits vertices only, build a vb for quads rendering if (_MaxVertexIndex <= 0xffff) @@ -1607,6 +1622,7 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r // Init some variables _ForceDXTCCompression = false; + _AnisotropicFilter = 0; _ForceTextureResizePower = 0; _FogEnabled = false; @@ -2049,6 +2065,25 @@ void CDriverD3D::forceDXTCCompression(bool dxtcComp) // *************************************************************************** +void CDriverD3D::setAnisotropicFilter(sint filter) +{ + H_AUTO_D3D(CDriverD3D_setAnisotropicFilter); + + // anisotropic filter not supported + if (_MaxAnisotropy < 2) return; + + if (filter < 0 || filter > _MaxAnisotropy) + { + _AnisotropicFilter = _MaxAnisotropy; + } + else + { + _AnisotropicFilter = filter; + } +} + +// *************************************************************************** + void CDriverD3D::forceTextureResize(uint divisor) { H_AUTO_D3D(CDriverD3D_forceTextureResize); diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.h b/code/nel/src/3d/driver/direct3d/driver_direct3d.h index c1b05cc67..351cf10d0 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -777,6 +777,7 @@ public: virtual void disableHardwareVertexArrayAGP(); virtual void disableHardwareTextureShader(); virtual void forceDXTCCompression(bool dxtcComp); + virtual void setAnisotropicFilter(sint filter); virtual void forceTextureResize(uint divisor); virtual void forceNativeFragmentPrograms(bool /* nativeOnly */) {} // ignored @@ -1521,6 +1522,7 @@ public: setSamplerState (stage, D3DSAMP_MAGFILTER, d3dtext->MagFilter); setSamplerState (stage, D3DSAMP_MINFILTER, d3dtext->MinFilter); setSamplerState (stage, D3DSAMP_MIPFILTER, d3dtext->MipFilter); + setSamplerState (stage, D3DSAMP_MAXANISOTROPY, _AnisotropicFilter); // Profile, log the use of this texture if (_SumTextureMemoryUsed) @@ -2205,6 +2207,11 @@ private: bool _CubbedMipMapSupported; bool _IsGeforce; bool _NonPowerOfTwoTexturesSupported; + uint _MaxAnisotropy; + bool _AnisotropicMinSupported; + bool _AnisotropicMagSupported; + bool _AnisotropicMinCubeSupported; + bool _AnisotropicMagCubeSupported; uint _NbNeLTextureStages; // Number of texture stage for NeL (max IDRV_MAT_MAXTEXTURES) uint _MaxVerticesByVertexBufferHard; uint _MaxLight; @@ -2411,6 +2418,7 @@ private: bool _MustRestoreLight; D3DXMATRIX _D3DMatrixIdentity; DWORD _FogColor; + uint _AnisotropicFilter; // stencil buffer bool _CurStencilTest; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp index 419027577..b9b757de1 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp @@ -355,8 +355,8 @@ bool CDriverD3D::activeShader(CShader *shd) // Assemble the shader LPD3DXBUFFER pErrorMsgs; - if (D3DXCreateEffect(_DeviceInterface, shd->getText(), (UINT)strlen(shd->getText())+1, NULL, NULL, 0, NULL, &(shaderInfo->Effect), &pErrorMsgs) - == D3D_OK) + HRESULT hr = D3DXCreateEffect(_DeviceInterface, shd->getText(), (UINT)strlen(shd->getText())+1, NULL, NULL, 0, NULL, &(shaderInfo->Effect), &pErrorMsgs); + if (hr == D3D_OK) { // Get the texture handle uint i; @@ -374,7 +374,7 @@ bool CDriverD3D::activeShader(CShader *shd) } else { - nlwarning ("Can't create shader '%s':", shd->getName()); + nlwarning ("Can't create shader '%s' (0x%x):", shd->getName(), hr); if (pErrorMsgs) nlwarning ((const char*)pErrorMsgs->GetBufferPointer()); shd->_ShaderChanged = false; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp index cfafaf5f9..7922b30ea 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp @@ -454,6 +454,7 @@ bool CDriverD3D::generateD3DTexture (ITexture& tex, bool textureDegradation, D3D } else { +/* // textures with mipmaps doesn't support not power of two sizes // only DXTC formats are beginning with a 'D' if (supportNonPowerOfTwoTextures() && (!isPowerOf2(width) || !isPowerOf2(height)) && levels == 1) @@ -464,6 +465,7 @@ bool CDriverD3D::generateD3DTexture (ITexture& tex, bool textureDegradation, D3D _DeviceInterface->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP); _DeviceInterface->SetSamplerState(0, D3DSAMP_ADDRESSW, D3DTADDRESS_CLAMP); } +*/ HRESULT hr = _DeviceInterface->CreateTexture (width, height, levels, renderTarget?D3DUSAGE_RENDERTARGET:0, destFormat, renderTarget?D3DPOOL_DEFAULT:D3DPOOL_MANAGED, &(d3dtext->Texture2d), NULL); @@ -506,6 +508,19 @@ inline void CDriverD3D::setupTextureWrapMode(ITexture& tex) d3dtext->MagFilter = RemapMagTextureFilterTypeNeL2D3D[tex.getMagFilter()]; d3dtext->MinFilter = RemapMinTextureFilterTypeNeL2D3D[tex.getMinFilter()]; d3dtext->MipFilter = RemapMipTextureFilterTypeNeL2D3D[tex.getMinFilter()]; + + // only enable for min filter, because it's never supported for mag filter + if (_AnisotropicFilter > 1 && tex.getMinFilter() > ITexture::NearestMipMapLinear) + { + if (tex.isTextureCube()) + { + if (_AnisotropicMinCubeSupported) d3dtext->MinFilter = D3DTEXF_ANISOTROPIC; + } + else + { + if (_AnisotropicMinSupported) d3dtext->MinFilter = D3DTEXF_ANISOTROPIC; + } + } } diff --git a/code/nel/src/3d/driver/opengl/CMakeLists.txt b/code/nel/src/3d/driver/opengl/CMakeLists.txt index 8fa99d488..aea202e8b 100644 --- a/code/nel/src/3d/driver/opengl/CMakeLists.txt +++ b/code/nel/src/3d/driver/opengl/CMakeLists.txt @@ -27,7 +27,7 @@ ENDIF(WIN32) NL_TARGET_DRIVER(${NLDRV_OGL_LIB} ${SRC}) -INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) +INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} nel3d nelmisc ${OPENGL_gl_LIBRARY}) NL_DEFAULT_PROPS(${NLDRV_OGL_LIB} "NeL, Driver, Video: OpenGL") diff --git a/code/nel/src/3d/driver/opengl/EGL/eglext.h b/code/nel/src/3d/driver/opengl/EGL/eglext.h index 0d318b258..a28f5b88e 100644 --- a/code/nel/src/3d/driver/opengl/EGL/eglext.h +++ b/code/nel/src/3d/driver/opengl/EGL/eglext.h @@ -34,8 +34,8 @@ extern "C" { /* Header file version number */ /* Current version at http://www.khronos.org/registry/egl/ */ -/* $Revision: 17614 $ on $Date: 2012-04-26 06:56:02 -0700 (Thu, 26 Apr 2012) $ */ -#define EGL_EGLEXT_VERSION 12 +/* $Revision: 19332 $ on $Date: 2012-09-28 17:56:20 -0700 (Fri, 28 Sep 2012) $ */ +#define EGL_EGLEXT_VERSION 14 #ifndef EGL_KHR_config_attribs #define EGL_KHR_config_attribs 1 @@ -293,6 +293,25 @@ EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface sur typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); #endif +#ifndef EGL_ANDROID_image_native_buffer +#define EGL_ANDROID_image_native_buffer 1 +struct ANativeWindowBuffer; +#define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */ +#endif + +#ifndef EGL_ANDROID_swap_rectangle +#define EGL_ANDROID_swap_rectangle 1 +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSetSwapRectangleANDROID (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSWAPRECTANGLEANDROIDPROC) (EGLDisplay dpy, EGLSurface draw, EGLint left, EGLint top, EGLint width, EGLint height); +#endif + +#ifndef EGL_ANDROID_recordable +#define EGL_ANDROID_recordable 1 +#define EGL_RECORDABLE_ANDROID 0x3142 /* EGLConfig attribute */ +#endif + #ifndef EGL_ANGLE_query_surface_pointer #define EGL_ANGLE_query_surface_pointer 1 #ifdef EGL_EGLEXT_PROTOTYPES @@ -333,38 +352,38 @@ typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void); #define EGL_KHR_stream 1 typedef void* EGLStreamKHR; typedef khronos_uint64_t EGLuint64KHR; -#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0) -#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210 -#define EGL_PRODUCER_FRAME_KHR 0x3212 -#define EGL_CONSUMER_FRAME_KHR 0x3213 -#define EGL_STREAM_STATE_KHR 0x3214 -#define EGL_STREAM_STATE_CREATED_KHR 0x3215 -#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 -#define EGL_STREAM_STATE_EMPTY_KHR 0x3217 +#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0) +#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210 +#define EGL_PRODUCER_FRAME_KHR 0x3212 +#define EGL_CONSUMER_FRAME_KHR 0x3213 +#define EGL_STREAM_STATE_KHR 0x3214 +#define EGL_STREAM_STATE_CREATED_KHR 0x3215 +#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 +#define EGL_STREAM_STATE_EMPTY_KHR 0x3217 #define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218 #define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219 -#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A -#define EGL_BAD_STREAM_KHR 0x321B -#define EGL_BAD_STATE_KHR 0x321C +#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A +#define EGL_BAD_STREAM_KHR 0x321B +#define EGL_BAD_STATE_KHR 0x321C #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream); EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryStream64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); #endif /* EGL_EGLEXT_PROTOTYPES */ typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC)(EGLDisplay dpy, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream); typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAM64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); #endif #endif #ifdef EGL_KHR_stream /* Requires KHR_stream extension */ #ifndef EGL_KHR_stream_consumer_gltexture #define EGL_KHR_stream_consumer_gltexture 1 -#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E +#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream); EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream); @@ -379,7 +398,7 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay #ifdef EGL_KHR_stream /* Requires KHR_stream extension */ #ifndef EGL_KHR_stream_producer_eglsurface #define EGL_KHR_stream_producer_eglsurface 1 -#define EGL_STREAM_BIT_KHR 0x0800 +#define EGL_STREAM_BIT_KHR 0x0800 #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); #endif /* EGL_EGLEXT_PROTOTYPES */ @@ -397,10 +416,10 @@ typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDi #ifndef EGL_KHR_stream_fifo #define EGL_KHR_stream_fifo 1 /* reuse EGLTimeKHR */ -#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC -#define EGL_STREAM_TIME_NOW_KHR 0x31FD -#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE -#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF +#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC +#define EGL_STREAM_TIME_NOW_KHR 0x31FD +#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE +#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); #endif /* EGL_EGLEXT_PROTOTYPES */ @@ -421,6 +440,47 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, E /* reuse EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE */ #endif +#ifndef EGL_KHR_create_context +#define EGL_KHR_create_context 1 +#define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION +#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB +#define EGL_CONTEXT_FLAGS_KHR 0x30FC +#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD +#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF +#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 +#define EGL_OPENGL_ES3_BIT_KHR 0x00000040 +#endif + +#ifndef EGL_KHR_surfaceless_context +#define EGL_KHR_surfaceless_context 1 +/* No tokens/entry points, just relaxes an error condition */ +#endif + +#ifdef EGL_KHR_stream /* Requires KHR_stream extension */ +#ifndef EGL_KHR_stream_cross_process_fd +#define EGL_KHR_stream_cross_process_fd 1 +typedef int EGLNativeFileDescriptorKHR; +#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1)) +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); +#endif +#endif + +#ifndef EGL_EXT_multiview_window +#define EGL_EXT_multiview_window 1 +#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134 +#endif + #ifdef __cplusplus } #endif diff --git a/code/nel/src/3d/driver/opengl/GL/glext.h b/code/nel/src/3d/driver/opengl/GL/glext.h index bd7b9b863..44ab7c62e 100644 --- a/code/nel/src/3d/driver/opengl/GL/glext.h +++ b/code/nel/src/3d/driver/opengl/GL/glext.h @@ -29,9 +29,9 @@ extern "C" { */ /* Header file version number, required by OpenGL ABI for Linux */ -/* glext.h last updated $Date: 2012-04-26 00:59:42 -0700 (Thu, 26 Apr 2012) $ */ +/* glext.h last updated $Date: 2012-09-19 19:02:24 -0700 (Wed, 19 Sep 2012) $ */ /* Current version at http://www.opengl.org/registry/ */ -#define GL_GLEXT_VERSION 81 +#define GL_GLEXT_VERSION 85 /* Function declaration macros - to move into glplatform.h */ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) @@ -88,9 +88,6 @@ extern "C" { #define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 #define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#endif - -#ifndef GL_VERSION_1_2_DEPRECATED #define GL_RESCALE_NORMAL 0x803A #define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 #define GL_SINGLE_COLOR 0x81F9 @@ -110,9 +107,6 @@ extern "C" { #define GL_BLEND_EQUATION 0x8009 #define GL_FUNC_SUBTRACT 0x800A #define GL_FUNC_REVERSE_SUBTRACT 0x800B -#endif - -#ifndef GL_ARB_imaging_DEPRECATED #define GL_CONVOLUTION_1D 0x8010 #define GL_CONVOLUTION_2D 0x8011 #define GL_SEPARABLE_2D 0x8012 @@ -239,9 +233,6 @@ extern "C" { #define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 #define GL_CLAMP_TO_BORDER 0x812D -#endif - -#ifndef GL_VERSION_1_3_DEPRECATED #define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 #define GL_MAX_TEXTURE_UNITS 0x84E2 #define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 @@ -298,9 +289,6 @@ extern "C" { #define GL_TEXTURE_DEPTH_SIZE 0x884A #define GL_TEXTURE_COMPARE_MODE 0x884C #define GL_TEXTURE_COMPARE_FUNC 0x884D -#endif - -#ifndef GL_VERSION_1_4_DEPRECATED #define GL_POINT_SIZE_MIN 0x8126 #define GL_POINT_SIZE_MAX 0x8127 #define GL_POINT_DISTANCE_ATTENUATION 0x8129 @@ -354,9 +342,7 @@ extern "C" { #define GL_DYNAMIC_READ 0x88E9 #define GL_DYNAMIC_COPY 0x88EA #define GL_SAMPLES_PASSED 0x8914 -#endif - -#ifndef GL_VERSION_1_5_DEPRECATED +#define GL_SRC1_ALPHA 0x8589 #define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 #define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 #define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 @@ -378,7 +364,6 @@ extern "C" { #define GL_SRC1_RGB 0x8581 #define GL_SRC2_RGB 0x8582 #define GL_SRC0_ALPHA 0x8588 -#define GL_SRC1_ALPHA 0x8589 #define GL_SRC2_ALPHA 0x858A #endif @@ -463,9 +448,6 @@ extern "C" { #define GL_STENCIL_BACK_REF 0x8CA3 #define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 #define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#endif - -#ifndef GL_VERSION_2_0_DEPRECATED #define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 #define GL_POINT_SPRITE 0x8861 #define GL_COORD_REPLACE 0x8862 @@ -489,9 +471,6 @@ extern "C" { #define GL_SRGB8_ALPHA8 0x8C43 #define GL_COMPRESSED_SRGB 0x8C48 #define GL_COMPRESSED_SRGB_ALPHA 0x8C49 -#endif - -#ifndef GL_VERSION_2_1_DEPRECATED #define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F #define GL_SLUMINANCE_ALPHA 0x8C44 #define GL_SLUMINANCE8_ALPHA8 0x8C45 @@ -726,9 +705,6 @@ extern "C" { /* reuse GL_RG32UI */ /* Reuse tokens from ARB_vertex_array_object */ /* reuse GL_VERTEX_ARRAY_BINDING */ -#endif - -#ifndef GL_VERSION_3_0_DEPRECATED #define GL_CLAMP_VERTEX_COLOR 0x891A #define GL_CLAMP_FRAGMENT_COLOR 0x891B #define GL_ALPHA_INTEGER 0x8D97 @@ -749,7 +725,6 @@ extern "C" { #define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B #define GL_TEXTURE_BINDING_BUFFER 0x8C2C #define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D -#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E #define GL_TEXTURE_RECTANGLE 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 @@ -1015,6 +990,7 @@ extern "C" { /* reuse GL_MEDIUM_INT */ /* reuse GL_HIGH_INT */ /* reuse GL_SHADER_COMPILER */ +/* reuse GL_SHADER_BINARY_FORMATS */ /* reuse GL_NUM_SHADER_BINARY_FORMATS */ /* reuse GL_MAX_VERTEX_UNIFORM_VECTORS */ /* reuse GL_MAX_VARYING_VECTORS */ @@ -1164,6 +1140,290 @@ extern "C" { /* reuse GL_TEXTURE_IMMUTABLE_FORMAT */ #endif +#ifndef GL_VERSION_4_3 +#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 +#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E +/* Reuse tokens from ARB_arrays_of_arrays (none, GLSL only) */ +/* Reuse tokens from ARB_fragment_layer_viewport (none, GLSL only) */ +/* Reuse tokens from ARB_shader_image_size (none, GLSL only) */ +/* Reuse tokens from ARB_ES3_compatibility */ +/* reuse GL_COMPRESSED_RGB8_ETC2 */ +/* reuse GL_COMPRESSED_SRGB8_ETC2 */ +/* reuse GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 */ +/* reuse GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 */ +/* reuse GL_COMPRESSED_RGBA8_ETC2_EAC */ +/* reuse GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC */ +/* reuse GL_COMPRESSED_R11_EAC */ +/* reuse GL_COMPRESSED_SIGNED_R11_EAC */ +/* reuse GL_COMPRESSED_RG11_EAC */ +/* reuse GL_COMPRESSED_SIGNED_RG11_EAC */ +/* reuse GL_PRIMITIVE_RESTART_FIXED_INDEX */ +/* reuse GL_ANY_SAMPLES_PASSED_CONSERVATIVE */ +/* reuse GL_MAX_ELEMENT_INDEX */ +/* Reuse tokens from ARB_clear_buffer_object (none) */ +/* Reuse tokens from ARB_compute_shader */ +/* reuse GL_COMPUTE_SHADER */ +/* reuse GL_MAX_COMPUTE_UNIFORM_BLOCKS */ +/* reuse GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS */ +/* reuse GL_MAX_COMPUTE_IMAGE_UNIFORMS */ +/* reuse GL_MAX_COMPUTE_SHARED_MEMORY_SIZE */ +/* reuse GL_MAX_COMPUTE_UNIFORM_COMPONENTS */ +/* reuse GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS */ +/* reuse GL_MAX_COMPUTE_ATOMIC_COUNTERS */ +/* reuse GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS */ +/* reuse GL_MAX_COMPUTE_LOCAL_INVOCATIONS */ +/* reuse GL_MAX_COMPUTE_WORK_GROUP_COUNT */ +/* reuse GL_MAX_COMPUTE_WORK_GROUP_SIZE */ +/* reuse GL_COMPUTE_LOCAL_WORK_SIZE */ +/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER */ +/* reuse GL_DISPATCH_INDIRECT_BUFFER */ +/* reuse GL_DISPATCH_INDIRECT_BUFFER_BINDING */ +/* Reuse tokens from ARB_copy_image (none) */ +/* Reuse tokens from KHR_debug */ +/* reuse GL_DEBUG_OUTPUT_SYNCHRONOUS */ +/* reuse GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH */ +/* reuse GL_DEBUG_CALLBACK_FUNCTION */ +/* reuse GL_DEBUG_CALLBACK_USER_PARAM */ +/* reuse GL_DEBUG_SOURCE_API */ +/* reuse GL_DEBUG_SOURCE_WINDOW_SYSTEM */ +/* reuse GL_DEBUG_SOURCE_SHADER_COMPILER */ +/* reuse GL_DEBUG_SOURCE_THIRD_PARTY */ +/* reuse GL_DEBUG_SOURCE_APPLICATION */ +/* reuse GL_DEBUG_SOURCE_OTHER */ +/* reuse GL_DEBUG_TYPE_ERROR */ +/* reuse GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR */ +/* reuse GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR */ +/* reuse GL_DEBUG_TYPE_PORTABILITY */ +/* reuse GL_DEBUG_TYPE_PERFORMANCE */ +/* reuse GL_DEBUG_TYPE_OTHER */ +/* reuse GL_MAX_DEBUG_MESSAGE_LENGTH */ +/* reuse GL_MAX_DEBUG_LOGGED_MESSAGES */ +/* reuse GL_DEBUG_LOGGED_MESSAGES */ +/* reuse GL_DEBUG_SEVERITY_HIGH */ +/* reuse GL_DEBUG_SEVERITY_MEDIUM */ +/* reuse GL_DEBUG_SEVERITY_LOW */ +/* reuse GL_DEBUG_TYPE_MARKER */ +/* reuse GL_DEBUG_TYPE_PUSH_GROUP */ +/* reuse GL_DEBUG_TYPE_POP_GROUP */ +/* reuse GL_DEBUG_SEVERITY_NOTIFICATION */ +/* reuse GL_MAX_DEBUG_GROUP_STACK_DEPTH */ +/* reuse GL_DEBUG_GROUP_STACK_DEPTH */ +/* reuse GL_BUFFER */ +/* reuse GL_SHADER */ +/* reuse GL_PROGRAM */ +/* reuse GL_QUERY */ +/* reuse GL_PROGRAM_PIPELINE */ +/* reuse GL_SAMPLER */ +/* reuse GL_DISPLAY_LIST */ +/* reuse GL_MAX_LABEL_LENGTH */ +/* reuse GL_DEBUG_OUTPUT */ +/* reuse GL_CONTEXT_FLAG_DEBUG_BIT */ +/* reuse GL_STACK_UNDERFLOW */ +/* reuse GL_STACK_OVERFLOW */ +/* Reuse tokens from ARB_explicit_uniform_location */ +/* reuse GL_MAX_UNIFORM_LOCATIONS */ +/* Reuse tokens from ARB_framebuffer_no_attachments */ +/* reuse GL_FRAMEBUFFER_DEFAULT_WIDTH */ +/* reuse GL_FRAMEBUFFER_DEFAULT_HEIGHT */ +/* reuse GL_FRAMEBUFFER_DEFAULT_LAYERS */ +/* reuse GL_FRAMEBUFFER_DEFAULT_SAMPLES */ +/* reuse GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS */ +/* reuse GL_MAX_FRAMEBUFFER_WIDTH */ +/* reuse GL_MAX_FRAMEBUFFER_HEIGHT */ +/* reuse GL_MAX_FRAMEBUFFER_LAYERS */ +/* reuse GL_MAX_FRAMEBUFFER_SAMPLES */ +/* Reuse tokens from ARB_internalformat_query2 */ +/* reuse GL_INTERNALFORMAT_SUPPORTED */ +/* reuse GL_INTERNALFORMAT_PREFERRED */ +/* reuse GL_INTERNALFORMAT_RED_SIZE */ +/* reuse GL_INTERNALFORMAT_GREEN_SIZE */ +/* reuse GL_INTERNALFORMAT_BLUE_SIZE */ +/* reuse GL_INTERNALFORMAT_ALPHA_SIZE */ +/* reuse GL_INTERNALFORMAT_DEPTH_SIZE */ +/* reuse GL_INTERNALFORMAT_STENCIL_SIZE */ +/* reuse GL_INTERNALFORMAT_SHARED_SIZE */ +/* reuse GL_INTERNALFORMAT_RED_TYPE */ +/* reuse GL_INTERNALFORMAT_GREEN_TYPE */ +/* reuse GL_INTERNALFORMAT_BLUE_TYPE */ +/* reuse GL_INTERNALFORMAT_ALPHA_TYPE */ +/* reuse GL_INTERNALFORMAT_DEPTH_TYPE */ +/* reuse GL_INTERNALFORMAT_STENCIL_TYPE */ +/* reuse GL_MAX_WIDTH */ +/* reuse GL_MAX_HEIGHT */ +/* reuse GL_MAX_DEPTH */ +/* reuse GL_MAX_LAYERS */ +/* reuse GL_MAX_COMBINED_DIMENSIONS */ +/* reuse GL_COLOR_COMPONENTS */ +/* reuse GL_DEPTH_COMPONENTS */ +/* reuse GL_STENCIL_COMPONENTS */ +/* reuse GL_COLOR_RENDERABLE */ +/* reuse GL_DEPTH_RENDERABLE */ +/* reuse GL_STENCIL_RENDERABLE */ +/* reuse GL_FRAMEBUFFER_RENDERABLE */ +/* reuse GL_FRAMEBUFFER_RENDERABLE_LAYERED */ +/* reuse GL_FRAMEBUFFER_BLEND */ +/* reuse GL_READ_PIXELS */ +/* reuse GL_READ_PIXELS_FORMAT */ +/* reuse GL_READ_PIXELS_TYPE */ +/* reuse GL_TEXTURE_IMAGE_FORMAT */ +/* reuse GL_TEXTURE_IMAGE_TYPE */ +/* reuse GL_GET_TEXTURE_IMAGE_FORMAT */ +/* reuse GL_GET_TEXTURE_IMAGE_TYPE */ +/* reuse GL_MIPMAP */ +/* reuse GL_MANUAL_GENERATE_MIPMAP */ +/* reuse GL_AUTO_GENERATE_MIPMAP */ +/* reuse GL_COLOR_ENCODING */ +/* reuse GL_SRGB_READ */ +/* reuse GL_SRGB_WRITE */ +/* reuse GL_FILTER */ +/* reuse GL_VERTEX_TEXTURE */ +/* reuse GL_TESS_CONTROL_TEXTURE */ +/* reuse GL_TESS_EVALUATION_TEXTURE */ +/* reuse GL_GEOMETRY_TEXTURE */ +/* reuse GL_FRAGMENT_TEXTURE */ +/* reuse GL_COMPUTE_TEXTURE */ +/* reuse GL_TEXTURE_SHADOW */ +/* reuse GL_TEXTURE_GATHER */ +/* reuse GL_TEXTURE_GATHER_SHADOW */ +/* reuse GL_SHADER_IMAGE_LOAD */ +/* reuse GL_SHADER_IMAGE_STORE */ +/* reuse GL_SHADER_IMAGE_ATOMIC */ +/* reuse GL_IMAGE_TEXEL_SIZE */ +/* reuse GL_IMAGE_COMPATIBILITY_CLASS */ +/* reuse GL_IMAGE_PIXEL_FORMAT */ +/* reuse GL_IMAGE_PIXEL_TYPE */ +/* reuse GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST */ +/* reuse GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST */ +/* reuse GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE */ +/* reuse GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE */ +/* reuse GL_TEXTURE_COMPRESSED_BLOCK_WIDTH */ +/* reuse GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT */ +/* reuse GL_TEXTURE_COMPRESSED_BLOCK_SIZE */ +/* reuse GL_CLEAR_BUFFER */ +/* reuse GL_TEXTURE_VIEW */ +/* reuse GL_VIEW_COMPATIBILITY_CLASS */ +/* reuse GL_FULL_SUPPORT */ +/* reuse GL_CAVEAT_SUPPORT */ +/* reuse GL_IMAGE_CLASS_4_X_32 */ +/* reuse GL_IMAGE_CLASS_2_X_32 */ +/* reuse GL_IMAGE_CLASS_1_X_32 */ +/* reuse GL_IMAGE_CLASS_4_X_16 */ +/* reuse GL_IMAGE_CLASS_2_X_16 */ +/* reuse GL_IMAGE_CLASS_1_X_16 */ +/* reuse GL_IMAGE_CLASS_4_X_8 */ +/* reuse GL_IMAGE_CLASS_2_X_8 */ +/* reuse GL_IMAGE_CLASS_1_X_8 */ +/* reuse GL_IMAGE_CLASS_11_11_10 */ +/* reuse GL_IMAGE_CLASS_10_10_10_2 */ +/* reuse GL_VIEW_CLASS_128_BITS */ +/* reuse GL_VIEW_CLASS_96_BITS */ +/* reuse GL_VIEW_CLASS_64_BITS */ +/* reuse GL_VIEW_CLASS_48_BITS */ +/* reuse GL_VIEW_CLASS_32_BITS */ +/* reuse GL_VIEW_CLASS_24_BITS */ +/* reuse GL_VIEW_CLASS_16_BITS */ +/* reuse GL_VIEW_CLASS_8_BITS */ +/* reuse GL_VIEW_CLASS_S3TC_DXT1_RGB */ +/* reuse GL_VIEW_CLASS_S3TC_DXT1_RGBA */ +/* reuse GL_VIEW_CLASS_S3TC_DXT3_RGBA */ +/* reuse GL_VIEW_CLASS_S3TC_DXT5_RGBA */ +/* reuse GL_VIEW_CLASS_RGTC1_RED */ +/* reuse GL_VIEW_CLASS_RGTC2_RG */ +/* reuse GL_VIEW_CLASS_BPTC_UNORM */ +/* reuse GL_VIEW_CLASS_BPTC_FLOAT */ +/* Reuse tokens from ARB_invalidate_subdata (none) */ +/* Reuse tokens from ARB_multi_draw_indirect (none) */ +/* Reuse tokens from ARB_program_interface_query */ +/* reuse GL_UNIFORM */ +/* reuse GL_UNIFORM_BLOCK */ +/* reuse GL_PROGRAM_INPUT */ +/* reuse GL_PROGRAM_OUTPUT */ +/* reuse GL_BUFFER_VARIABLE */ +/* reuse GL_SHADER_STORAGE_BLOCK */ +/* reuse GL_VERTEX_SUBROUTINE */ +/* reuse GL_TESS_CONTROL_SUBROUTINE */ +/* reuse GL_TESS_EVALUATION_SUBROUTINE */ +/* reuse GL_GEOMETRY_SUBROUTINE */ +/* reuse GL_FRAGMENT_SUBROUTINE */ +/* reuse GL_COMPUTE_SUBROUTINE */ +/* reuse GL_VERTEX_SUBROUTINE_UNIFORM */ +/* reuse GL_TESS_CONTROL_SUBROUTINE_UNIFORM */ +/* reuse GL_TESS_EVALUATION_SUBROUTINE_UNIFORM */ +/* reuse GL_GEOMETRY_SUBROUTINE_UNIFORM */ +/* reuse GL_FRAGMENT_SUBROUTINE_UNIFORM */ +/* reuse GL_COMPUTE_SUBROUTINE_UNIFORM */ +/* reuse GL_TRANSFORM_FEEDBACK_VARYING */ +/* reuse GL_ACTIVE_RESOURCES */ +/* reuse GL_MAX_NAME_LENGTH */ +/* reuse GL_MAX_NUM_ACTIVE_VARIABLES */ +/* reuse GL_MAX_NUM_COMPATIBLE_SUBROUTINES */ +/* reuse GL_NAME_LENGTH */ +/* reuse GL_TYPE */ +/* reuse GL_ARRAY_SIZE */ +/* reuse GL_OFFSET */ +/* reuse GL_BLOCK_INDEX */ +/* reuse GL_ARRAY_STRIDE */ +/* reuse GL_MATRIX_STRIDE */ +/* reuse GL_IS_ROW_MAJOR */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_INDEX */ +/* reuse GL_BUFFER_BINDING */ +/* reuse GL_BUFFER_DATA_SIZE */ +/* reuse GL_NUM_ACTIVE_VARIABLES */ +/* reuse GL_ACTIVE_VARIABLES */ +/* reuse GL_REFERENCED_BY_VERTEX_SHADER */ +/* reuse GL_REFERENCED_BY_TESS_CONTROL_SHADER */ +/* reuse GL_REFERENCED_BY_TESS_EVALUATION_SHADER */ +/* reuse GL_REFERENCED_BY_GEOMETRY_SHADER */ +/* reuse GL_REFERENCED_BY_FRAGMENT_SHADER */ +/* reuse GL_REFERENCED_BY_COMPUTE_SHADER */ +/* reuse GL_TOP_LEVEL_ARRAY_SIZE */ +/* reuse GL_TOP_LEVEL_ARRAY_STRIDE */ +/* reuse GL_LOCATION */ +/* reuse GL_LOCATION_INDEX */ +/* reuse GL_IS_PER_PATCH */ +/* Reuse tokens from ARB_robust_buffer_access_behavior (none) */ +/* Reuse tokens from ARB_shader_storage_buffer_object */ +/* reuse GL_SHADER_STORAGE_BUFFER */ +/* reuse GL_SHADER_STORAGE_BUFFER_BINDING */ +/* reuse GL_SHADER_STORAGE_BUFFER_START */ +/* reuse GL_SHADER_STORAGE_BUFFER_SIZE */ +/* reuse GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS */ +/* reuse GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS */ +/* reuse GL_MAX_SHADER_STORAGE_BLOCK_SIZE */ +/* reuse GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT */ +/* reuse GL_SHADER_STORAGE_BARRIER_BIT */ +/* reuse GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES */ +/* Reuse tokens from ARB_stencil_texturing */ +/* reuse GL_DEPTH_STENCIL_TEXTURE_MODE */ +/* Reuse tokens from ARB_texture_buffer_range */ +/* reuse GL_TEXTURE_BUFFER_OFFSET */ +/* reuse GL_TEXTURE_BUFFER_SIZE */ +/* reuse GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT */ +/* Reuse tokens from ARB_texture_query_levels (none) */ +/* Reuse tokens from ARB_texture_storage_multisample (none) */ +/* Reuse tokens from ARB_texture_view */ +/* reuse GL_TEXTURE_VIEW_MIN_LEVEL */ +/* reuse GL_TEXTURE_VIEW_NUM_LEVELS */ +/* reuse GL_TEXTURE_VIEW_MIN_LAYER */ +/* reuse GL_TEXTURE_VIEW_NUM_LAYERS */ +/* reuse GL_TEXTURE_IMMUTABLE_LEVELS */ +/* Reuse tokens from ARB_vertex_attrib_binding */ +/* reuse GL_VERTEX_ATTRIB_BINDING */ +/* reuse GL_VERTEX_ATTRIB_RELATIVE_OFFSET */ +/* reuse GL_VERTEX_BINDING_DIVISOR */ +/* reuse GL_VERTEX_BINDING_OFFSET */ +/* reuse GL_VERTEX_BINDING_STRIDE */ +/* reuse GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET */ +/* reuse GL_MAX_VERTEX_ATTRIB_BINDINGS */ +#endif + #ifndef GL_ARB_multitexture #define GL_TEXTURE0_ARB 0x84C0 #define GL_TEXTURE1_ARB 0x84C1 @@ -1746,9 +2006,6 @@ extern "C" { #define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 #define GL_MAX_SAMPLES 0x8D57 -#endif - -#ifndef GL_ARB_framebuffer_object_DEPRECATED #define GL_INDEX 0x8222 #define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 #define GL_TEXTURE_INTENSITY_TYPE 0x8C15 @@ -1980,6 +2237,7 @@ extern "C" { #ifndef GL_ARB_texture_gather #define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E #define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F +#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F #endif #ifndef GL_ARB_texture_query_lod @@ -2157,6 +2415,7 @@ extern "C" { #define GL_MEDIUM_INT 0x8DF4 #define GL_HIGH_INT 0x8DF5 #define GL_SHADER_COMPILER 0x8DFA +#define GL_SHADER_BINARY_FORMATS 0x8DF8 #define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 #define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB #define GL_MAX_VARYING_VECTORS 0x8DFC @@ -2399,6 +2658,386 @@ extern "C" { #define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F #endif +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#endif + +#ifndef GL_KHR_debug +#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245 +#define GL_DEBUG_SOURCE_API 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION 0x824A +#define GL_DEBUG_SOURCE_OTHER 0x824B +#define GL_DEBUG_TYPE_ERROR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE 0x8250 +#define GL_DEBUG_TYPE_OTHER 0x8251 +#define GL_DEBUG_TYPE_MARKER 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D +#define GL_BUFFER 0x82E0 +#define GL_SHADER 0x82E1 +#define GL_PROGRAM 0x82E2 +#define GL_QUERY 0x82E3 +#define GL_PROGRAM_PIPELINE 0x82E4 +#define GL_SAMPLER 0x82E6 +#define GL_DISPLAY_LIST 0x82E7 +/* DISPLAY_LIST used in compatibility profile only */ +#define GL_MAX_LABEL_LENGTH 0x82E8 +#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES 0x9145 +#define GL_DEBUG_SEVERITY_HIGH 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM 0x9147 +#define GL_DEBUG_SEVERITY_LOW 0x9148 +#define GL_DEBUG_OUTPUT 0x92E0 +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +/* reuse GL_STACK_UNDERFLOW */ +/* reuse GL_STACK_OVERFLOW */ +#endif + +#ifndef GL_ARB_arrays_of_arrays +#endif + +#ifndef GL_ARB_clear_buffer_object +#endif + +#ifndef GL_ARB_compute_shader +#define GL_COMPUTE_SHADER 0x91B9 +#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB +#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC +#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD +#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 +#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 +#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 +#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 +#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 +#define GL_MAX_COMPUTE_LOCAL_INVOCATIONS 0x90EB +#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE +#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF +#define GL_COMPUTE_LOCAL_WORK_SIZE 0x8267 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED +#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE +#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF +#define GL_COMPUTE_SHADER_BIT 0x00000020 +#endif + +#ifndef GL_ARB_copy_image +#endif + +#ifndef GL_ARB_texture_view +#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +#endif + +#ifndef GL_ARB_vertex_attrib_binding +#define GL_VERTEX_ATTRIB_BINDING 0x82D4 +#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 +#define GL_VERTEX_BINDING_DIVISOR 0x82D6 +#define GL_VERTEX_BINDING_OFFSET 0x82D7 +#define GL_VERTEX_BINDING_STRIDE 0x82D8 +#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 +#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA +#endif + +#ifndef GL_ARB_robustness_isolation +#endif + +#ifndef GL_ARB_ES3_compatibility +#define GL_COMPRESSED_RGB8_ETC2 0x9274 +#define GL_COMPRESSED_SRGB8_ETC2 0x9275 +#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 +#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 +#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 +#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 +#define GL_COMPRESSED_R11_EAC 0x9270 +#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 +#define GL_COMPRESSED_RG11_EAC 0x9272 +#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 +#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A +#define GL_MAX_ELEMENT_INDEX 0x8D6B +#endif + +#ifndef GL_ARB_explicit_uniform_location +#define GL_MAX_UNIFORM_LOCATIONS 0x826E +#endif + +#ifndef GL_ARB_fragment_layer_viewport +#endif + +#ifndef GL_ARB_framebuffer_no_attachments +#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 +#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312 +#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 +#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314 +#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315 +#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 +#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317 +#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 +#endif + +#ifndef GL_ARB_internalformat_query2 +/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_TYPE */ +/* reuse GL_NUM_SAMPLE_COUNTS */ +/* reuse GL_RENDERBUFFER */ +/* reuse GL_SAMPLES */ +/* reuse GL_TEXTURE_1D */ +/* reuse GL_TEXTURE_1D_ARRAY */ +/* reuse GL_TEXTURE_2D */ +/* reuse GL_TEXTURE_2D_ARRAY */ +/* reuse GL_TEXTURE_3D */ +/* reuse GL_TEXTURE_CUBE_MAP */ +/* reuse GL_TEXTURE_CUBE_MAP_ARRAY */ +/* reuse GL_TEXTURE_RECTANGLE */ +/* reuse GL_TEXTURE_BUFFER */ +/* reuse GL_TEXTURE_2D_MULTISAMPLE */ +/* reuse GL_TEXTURE_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_TEXTURE_COMPRESSED */ +#define GL_INTERNALFORMAT_SUPPORTED 0x826F +#define GL_INTERNALFORMAT_PREFERRED 0x8270 +#define GL_INTERNALFORMAT_RED_SIZE 0x8271 +#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272 +#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273 +#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274 +#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275 +#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276 +#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277 +#define GL_INTERNALFORMAT_RED_TYPE 0x8278 +#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279 +#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A +#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B +#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C +#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D +#define GL_MAX_WIDTH 0x827E +#define GL_MAX_HEIGHT 0x827F +#define GL_MAX_DEPTH 0x8280 +#define GL_MAX_LAYERS 0x8281 +#define GL_MAX_COMBINED_DIMENSIONS 0x8282 +#define GL_COLOR_COMPONENTS 0x8283 +#define GL_DEPTH_COMPONENTS 0x8284 +#define GL_STENCIL_COMPONENTS 0x8285 +#define GL_COLOR_RENDERABLE 0x8286 +#define GL_DEPTH_RENDERABLE 0x8287 +#define GL_STENCIL_RENDERABLE 0x8288 +#define GL_FRAMEBUFFER_RENDERABLE 0x8289 +#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A +#define GL_FRAMEBUFFER_BLEND 0x828B +#define GL_READ_PIXELS 0x828C +#define GL_READ_PIXELS_FORMAT 0x828D +#define GL_READ_PIXELS_TYPE 0x828E +#define GL_TEXTURE_IMAGE_FORMAT 0x828F +#define GL_TEXTURE_IMAGE_TYPE 0x8290 +#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291 +#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292 +#define GL_MIPMAP 0x8293 +#define GL_MANUAL_GENERATE_MIPMAP 0x8294 +#define GL_AUTO_GENERATE_MIPMAP 0x8295 +#define GL_COLOR_ENCODING 0x8296 +#define GL_SRGB_READ 0x8297 +#define GL_SRGB_WRITE 0x8298 +#define GL_SRGB_DECODE_ARB 0x8299 +#define GL_FILTER 0x829A +#define GL_VERTEX_TEXTURE 0x829B +#define GL_TESS_CONTROL_TEXTURE 0x829C +#define GL_TESS_EVALUATION_TEXTURE 0x829D +#define GL_GEOMETRY_TEXTURE 0x829E +#define GL_FRAGMENT_TEXTURE 0x829F +#define GL_COMPUTE_TEXTURE 0x82A0 +#define GL_TEXTURE_SHADOW 0x82A1 +#define GL_TEXTURE_GATHER 0x82A2 +#define GL_TEXTURE_GATHER_SHADOW 0x82A3 +#define GL_SHADER_IMAGE_LOAD 0x82A4 +#define GL_SHADER_IMAGE_STORE 0x82A5 +#define GL_SHADER_IMAGE_ATOMIC 0x82A6 +#define GL_IMAGE_TEXEL_SIZE 0x82A7 +#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8 +#define GL_IMAGE_PIXEL_FORMAT 0x82A9 +#define GL_IMAGE_PIXEL_TYPE 0x82AA +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD +#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE +#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF +#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1 +#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2 +#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3 +#define GL_CLEAR_BUFFER 0x82B4 +#define GL_TEXTURE_VIEW 0x82B5 +#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6 +#define GL_FULL_SUPPORT 0x82B7 +#define GL_CAVEAT_SUPPORT 0x82B8 +#define GL_IMAGE_CLASS_4_X_32 0x82B9 +#define GL_IMAGE_CLASS_2_X_32 0x82BA +#define GL_IMAGE_CLASS_1_X_32 0x82BB +#define GL_IMAGE_CLASS_4_X_16 0x82BC +#define GL_IMAGE_CLASS_2_X_16 0x82BD +#define GL_IMAGE_CLASS_1_X_16 0x82BE +#define GL_IMAGE_CLASS_4_X_8 0x82BF +#define GL_IMAGE_CLASS_2_X_8 0x82C0 +#define GL_IMAGE_CLASS_1_X_8 0x82C1 +#define GL_IMAGE_CLASS_11_11_10 0x82C2 +#define GL_IMAGE_CLASS_10_10_10_2 0x82C3 +#define GL_VIEW_CLASS_128_BITS 0x82C4 +#define GL_VIEW_CLASS_96_BITS 0x82C5 +#define GL_VIEW_CLASS_64_BITS 0x82C6 +#define GL_VIEW_CLASS_48_BITS 0x82C7 +#define GL_VIEW_CLASS_32_BITS 0x82C8 +#define GL_VIEW_CLASS_24_BITS 0x82C9 +#define GL_VIEW_CLASS_16_BITS 0x82CA +#define GL_VIEW_CLASS_8_BITS 0x82CB +#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC +#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD +#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE +#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF +#define GL_VIEW_CLASS_RGTC1_RED 0x82D0 +#define GL_VIEW_CLASS_RGTC2_RG 0x82D1 +#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2 +#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3 +#endif + +#ifndef GL_ARB_invalidate_subdata +#endif + +#ifndef GL_ARB_multi_draw_indirect +#endif + +#ifndef GL_ARB_program_interface_query +#define GL_UNIFORM 0x92E1 +#define GL_UNIFORM_BLOCK 0x92E2 +#define GL_PROGRAM_INPUT 0x92E3 +#define GL_PROGRAM_OUTPUT 0x92E4 +#define GL_BUFFER_VARIABLE 0x92E5 +#define GL_SHADER_STORAGE_BLOCK 0x92E6 +/* reuse GL_ATOMIC_COUNTER_BUFFER */ +#define GL_VERTEX_SUBROUTINE 0x92E8 +#define GL_TESS_CONTROL_SUBROUTINE 0x92E9 +#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA +#define GL_GEOMETRY_SUBROUTINE 0x92EB +#define GL_FRAGMENT_SUBROUTINE 0x92EC +#define GL_COMPUTE_SUBROUTINE 0x92ED +#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE +#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF +#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0 +#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1 +#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2 +#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3 +#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4 +#define GL_ACTIVE_RESOURCES 0x92F5 +#define GL_MAX_NAME_LENGTH 0x92F6 +#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7 +#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8 +#define GL_NAME_LENGTH 0x92F9 +#define GL_TYPE 0x92FA +#define GL_ARRAY_SIZE 0x92FB +#define GL_OFFSET 0x92FC +#define GL_BLOCK_INDEX 0x92FD +#define GL_ARRAY_STRIDE 0x92FE +#define GL_MATRIX_STRIDE 0x92FF +#define GL_IS_ROW_MAJOR 0x9300 +#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301 +#define GL_BUFFER_BINDING 0x9302 +#define GL_BUFFER_DATA_SIZE 0x9303 +#define GL_NUM_ACTIVE_VARIABLES 0x9304 +#define GL_ACTIVE_VARIABLES 0x9305 +#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308 +#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309 +#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A +#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B +#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C +#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D +#define GL_LOCATION 0x930E +#define GL_LOCATION_INDEX 0x930F +#define GL_IS_PER_PATCH 0x92E7 +/* reuse GL_NUM_COMPATIBLE_SUBROUTINES */ +/* reuse GL_COMPATIBLE_SUBROUTINES */ +#endif + +#ifndef GL_ARB_robust_buffer_access_behavior +#endif + +#ifndef GL_ARB_shader_image_size +#endif + +#ifndef GL_ARB_shader_storage_buffer_object +#define GL_SHADER_STORAGE_BUFFER 0x90D2 +#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 +#define GL_SHADER_STORAGE_BUFFER_START 0x90D4 +#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 +#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7 +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9 +#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA +#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB +#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC +#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD +#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE +#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF +#define GL_SHADER_STORAGE_BARRIER_BIT 0x2000 +#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS +/* reuse GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS */ +#endif + +#ifndef GL_ARB_stencil_texturing +#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA +#endif + +#ifndef GL_ARB_texture_buffer_range +#define GL_TEXTURE_BUFFER_OFFSET 0x919D +#define GL_TEXTURE_BUFFER_SIZE 0x919E +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F +#endif + +#ifndef GL_ARB_texture_query_levels +#endif + +#ifndef GL_ARB_texture_storage_multisample +#endif + #ifndef GL_EXT_abgr #define GL_ABGR_EXT 0x8000 #endif @@ -4255,6 +4894,8 @@ extern "C" { #define GL_RGB4_S3TC 0x83A1 #define GL_RGBA_S3TC 0x83A2 #define GL_RGBA4_S3TC 0x83A3 +#define GL_RGBA_DXT5_S3TC 0x83A4 +#define GL_RGBA4_DXT5_S3TC 0x83A5 #endif #ifndef GL_ATI_draw_buffers @@ -4278,7 +4919,7 @@ extern "C" { #endif #ifndef GL_ATI_pixel_format_float -#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 +#define GL_RGBA_FLOAT_MODE_ATI 0x8820 #define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 #endif @@ -4738,7 +5379,7 @@ extern "C" { #define GL_PRIMITIVES_GENERATED_NV 0x8C87 #define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 #define GL_RASTERIZER_DISCARD_NV 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A #define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B #define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C #define GL_SEPARATE_ATTRIBS_NV 0x8C8D @@ -5255,6 +5896,7 @@ extern "C" { #endif #ifndef GL_AMD_debug_output +#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143 #define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144 #define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145 #define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146 @@ -5478,6 +6120,24 @@ extern "C" { #ifndef GL_NV_shader_atomic_float #endif +#ifndef GL_AMD_query_buffer_object +#define GL_QUERY_BUFFER_AMD 0x9192 +#define GL_QUERY_BUFFER_BINDING_AMD 0x9193 +#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194 +#endif + +#ifndef GL_AMD_sparse_texture +#define GL_VIRTUAL_PAGE_SIZE_X_AMD 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_AMD 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_AMD 0x9197 +#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A +#define GL_MIN_SPARSE_LEVEL_AMD 0x919B +#define GL_MIN_LOD_WARNING_AMD 0x919C +#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001 +#endif + /*************************************************************/ @@ -5502,9 +6162,7 @@ typedef ptrdiff_t GLsizeiptrARB; #ifndef GL_ARB_shader_objects /* GL types for program/shader text and shader object handles */ typedef char GLcharARB; -//#if !defined(MAC_OS_X_VERSION_10_7) typedef unsigned int GLhandleARB; -//#endif #endif /* GL type for "half" precision (s10e5) float data in host memory */ @@ -5579,6 +6237,10 @@ typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLen typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); #endif +#ifndef GL_KHR_debug +typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); +#endif + #ifndef GL_NV_vdpau_interop typedef GLintptr GLvdpauSurfaceNV; #endif @@ -5592,18 +6254,6 @@ GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); -typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -#endif - -#ifndef GL_VERSION_1_2_DEPRECATED -#define GL_VERSION_1_2_DEPRECATED 1 -#ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); GLAPI void APIENTRY glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params); GLAPI void APIENTRY glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params); @@ -5637,6 +6287,12 @@ GLAPI void APIENTRY glMinmax (GLenum target, GLenum internalformat, GLboolean si GLAPI void APIENTRY glResetHistogram (GLenum target); GLAPI void APIENTRY glResetMinmax (GLenum target); #endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); @@ -5683,21 +6339,6 @@ GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); -#endif - -#ifndef GL_VERSION_1_3_DEPRECATED -#define GL_VERSION_1_3_DEPRECATED 1 -#ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glClientActiveTexture (GLenum texture); GLAPI void APIENTRY glMultiTexCoord1d (GLenum target, GLdouble s); GLAPI void APIENTRY glMultiTexCoord1dv (GLenum target, const GLdouble *v); @@ -5736,6 +6377,15 @@ GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *m); GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *m); GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m); #endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); @@ -5779,25 +6429,12 @@ typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); #define GL_VERSION_1_4 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount); +GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount); GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param); GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param); GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); -#endif - -#ifndef GL_VERSION_1_4_DEPRECATED -#define GL_VERSION_1_4_DEPRECATED 1 -#ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glFogCoordf (GLfloat coord); GLAPI void APIENTRY glFogCoordfv (const GLfloat *coord); GLAPI void APIENTRY glFogCoordd (GLdouble coord); @@ -5837,6 +6474,13 @@ GLAPI void APIENTRY glWindowPos3iv (const GLint *v); GLAPI void APIENTRY glWindowPos3s (GLshort x, GLshort y, GLshort z); GLAPI void APIENTRY glWindowPos3sv (const GLshort *v); #endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); @@ -6263,13 +6907,13 @@ typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint ind /* ARB_copy_buffer */ /* ARB_uniform_buffer_object */ #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount); GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer); GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount); typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); #endif @@ -6364,6 +7008,33 @@ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, /* ARB_texture_storage */ #endif +#ifndef GL_VERSION_4_3 +#define GL_VERSION_4_3 1 +/* OpenGL 4.3 reuses entry points from these extensions: */ +/* ARB_arrays_of_arrays (no entry points, GLSL only) */ +/* ARB_fragment_layer_viewport (no entry points, GLSL only) */ +/* ARB_shader_image_size (no entry points, GLSL only) */ +/* ARB_ES3_compatibility (no entry points) */ +/* ARB_clear_buffer_object */ +/* ARB_compute_shader */ +/* ARB_copy_image */ +/* KHR_debug (includes ARB_debug_output commands promoted to KHR without suffixes) */ +/* ARB_explicit_uniform_location (no entry points) */ +/* ARB_framebuffer_no_attachments */ +/* ARB_internalformat_query2 */ +/* ARB_invalidate_subdata */ +/* ARB_multi_draw_indirect */ +/* ARB_program_interface_query */ +/* ARB_robust_buffer_access_behavior (no entry points) */ +/* ARB_shader_storage_buffer_object */ +/* ARB_stencil_texturing (no entry points) */ +/* ARB_texture_buffer_range */ +/* ARB_texture_query_levels (no entry points) */ +/* ARB_texture_storage_multisample */ +/* ARB_texture_view */ +/* ARB_vertex_attrib_binding */ +#endif + #ifndef GL_ARB_multitexture #define GL_ARB_multitexture 1 #ifdef GL_GLEXT_PROTOTYPES @@ -7118,13 +7789,13 @@ typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum w #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); -GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex); -GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, const GLint *basevertex); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex); +GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, const GLint *basevertex); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex); #endif #ifndef GL_ARB_fragment_coord_conventions @@ -7802,13 +8473,13 @@ typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint locati #ifndef GL_ARB_base_instance #define GL_ARB_base_instance 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance); -GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLuint baseinstance); -GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex, GLuint baseinstance); +GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLuint baseinstance); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); #endif #ifndef GL_ARB_shading_language_420pack @@ -7818,11 +8489,11 @@ typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (G #ifndef GL_ARB_transform_feedback_instanced #define GL_ARB_transform_feedback_instanced 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei primcount); -GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei primcount); +GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount); +GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei primcount); -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); #endif #ifndef GL_ARB_compressed_texture_pixel_storage @@ -7885,6 +8556,242 @@ typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum ta typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); #endif +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_KHR_texture_compression_astc_ldr 1 +#endif + +#ifndef GL_KHR_debug +#define GL_KHR_debug 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message); +GLAPI void APIENTRY glPopDebugGroup (void); +GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label); +GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); +typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void); +typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); +typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif + +#ifndef GL_ARB_arrays_of_arrays +#define GL_ARB_arrays_of_arrays 1 +#endif + +#ifndef GL_ARB_clear_buffer_object +#define GL_ARB_clear_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data); +#endif + +#ifndef GL_ARB_compute_shader +#define GL_ARB_compute_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); +#endif + +#ifndef GL_ARB_copy_image +#define GL_ARB_copy_image 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#endif + +#ifndef GL_ARB_texture_view +#define GL_ARB_texture_view 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#endif + +#ifndef GL_ARB_vertex_attrib_binding +#define GL_ARB_vertex_attrib_binding 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor); +GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor); +#endif + +#ifndef GL_ARB_robustness_isolation +#define GL_ARB_robustness_isolation 1 +#endif + +#ifndef GL_ARB_ES3_compatibility +#define GL_ARB_ES3_compatibility 1 +#endif + +#ifndef GL_ARB_explicit_uniform_location +#define GL_ARB_explicit_uniform_location 1 +#endif + +#ifndef GL_ARB_fragment_layer_viewport +#define GL_ARB_fragment_layer_viewport 1 +#endif + +#ifndef GL_ARB_framebuffer_no_attachments +#define GL_ARB_framebuffer_no_attachments 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glNamedFramebufferParameteriEXT (GLuint framebuffer, GLenum pname, GLint param); +GLAPI void APIENTRY glGetNamedFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params); +#endif + +#ifndef GL_ARB_internalformat_query2 +#define GL_ARB_internalformat_query2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +#endif + +#ifndef GL_ARB_invalidate_subdata +#define GL_ARB_invalidate_subdata 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level); +GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer); +GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments); +GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_ARB_multi_draw_indirect +#define GL_ARB_multi_draw_indirect 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +#endif + +#ifndef GL_ARB_program_interface_query +#define GL_ARB_program_interface_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); +GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +#endif + +#ifndef GL_ARB_robust_buffer_access_behavior +#define GL_ARB_robust_buffer_access_behavior 1 +#endif + +#ifndef GL_ARB_shader_image_size +#define GL_ARB_shader_image_size 1 +#endif + +#ifndef GL_ARB_shader_storage_buffer_object +#define GL_ARB_shader_storage_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +#endif + +#ifndef GL_ARB_stencil_texturing +#define GL_ARB_stencil_texturing 1 +#endif + +#ifndef GL_ARB_texture_buffer_range +#define GL_ARB_texture_buffer_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +GLAPI void APIENTRY glTextureBufferRangeEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#endif + +#ifndef GL_ARB_texture_query_levels +#define GL_ARB_texture_query_levels 1 +#endif + +#ifndef GL_ARB_texture_storage_multisample +#define GL_ARB_texture_storage_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureStorage2DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +GLAPI void APIENTRY glTextureStorage3DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#endif + #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 #endif @@ -8626,11 +9533,15 @@ GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum target, GLenum pname, GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum target, GLenum pname, GLfloat param); GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum target, GLenum pname, const GLint *params); GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetPixelTransformParameterivEXT (GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetPixelTransformParameterfvEXT (GLenum target, GLenum pname, GLfloat *params); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); #endif #ifndef GL_EXT_pixel_transform_color_table @@ -8982,11 +9893,11 @@ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLen #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glVertexWeightfEXT (GLfloat weight); GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *weight); -GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glVertexWeightPointerEXT (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); -typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); #endif #ifndef GL_NV_light_max_exponent @@ -10050,10 +10961,10 @@ typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, c #ifndef GL_NV_pixel_data_range #define GL_NV_pixel_data_range 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, GLvoid *pointer); +GLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, const GLvoid *pointer); GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum target); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, const GLvoid *pointer); typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); #endif @@ -11562,7 +12473,7 @@ typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glVDPAUInitNV (const GLvoid *vdpDevice, const GLvoid *getProcAddress); GLAPI void APIENTRY glVDPAUFiniNV (void); -GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (const GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); GLAPI void APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface); GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface); @@ -11573,7 +12484,7 @@ GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSur #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const GLvoid *vdpDevice, const GLvoid *getProcAddress); typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void); -typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); typedef void (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface); @@ -11807,6 +12718,20 @@ typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle) #define GL_NV_shader_atomic_float 1 #endif +#ifndef GL_AMD_query_buffer_object +#define GL_AMD_query_buffer_object 1 +#endif + +#ifndef GL_AMD_sparse_texture +#define GL_AMD_sparse_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexStorageSparseAMD (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +GLAPI void APIENTRY glTextureStorageSparseAMD (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXSTORAGESPARSEAMDPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +typedef void (APIENTRYP PFNGLTEXTURESTORAGESPARSEAMDPROC) (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags); +#endif + #ifdef __cplusplus } diff --git a/code/nel/src/3d/driver/opengl/GL/glxext.h b/code/nel/src/3d/driver/opengl/GL/glxext.h index e640ff7e3..580ba347d 100644 --- a/code/nel/src/3d/driver/opengl/GL/glxext.h +++ b/code/nel/src/3d/driver/opengl/GL/glxext.h @@ -444,6 +444,10 @@ extern "C" { #define GLX_LATE_SWAPS_TEAR_EXT 0x20F3 #endif +#ifndef GLX_EXT_buffer_age +#define GLX_BACK_BUFFER_AGE_EXT 0x20F4 +#endif + /*************************************************************/ @@ -993,6 +997,10 @@ typedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, #define GLX_EXT_swap_control_tear 1 #endif +#ifndef GLX_EXT_buffer_age +#define GLX_EXT_buffer_age 1 +#endif + #ifdef __cplusplus } diff --git a/code/nel/src/3d/driver/opengl/GLES/glext.h b/code/nel/src/3d/driver/opengl/GLES/glext.h index d591832bf..5b46ae6d0 100644 --- a/code/nel/src/3d/driver/opengl/GLES/glext.h +++ b/code/nel/src/3d/driver/opengl/GLES/glext.h @@ -1,7 +1,7 @@ #ifndef __glext_h_ #define __glext_h_ -/* $Revision: 16481 $ on $Date:: 2012-01-04 10:43:56 -0800 #$ */ +/* $Revision: 19260 $ on $Date:: 2012-09-20 11:30:36 -0700 #$ */ #ifdef __cplusplus extern "C" { @@ -165,6 +165,9 @@ typedef void* GLeglImageOES; #define GL_DEPTH24_STENCIL8_OES 0x88F0 #endif +/* GL_OES_required_internalformat */ +/* No new tokens introduced by this extension. */ + /* GL_OES_rgb8_rgba8 */ #ifndef GL_OES_rgb8_rgba8 #define GL_RGB8_OES 0x8051 @@ -240,7 +243,7 @@ typedef void* GLeglImageOES; * APPLE extension tokens *------------------------------------------------------------------------*/ -/* GL_APPLE_texture_2D_limited_npot */ +/* GL_APPLE_copy_texture_levels */ /* No new tokens introduced by this extension. */ /* GL_APPLE_framebuffer_multisample */ @@ -254,6 +257,41 @@ typedef void* GLeglImageOES; #define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA #endif +/* GL_APPLE_sync */ +#ifndef GL_APPLE_sync + +/* These types are defined with reference to + * in the Apple extension spec, but here we use the Khronos + * portable types in khrplatform.h, and assume those types + * are always defined. + * If any other extensions using these types are defined, + * the typedefs must move out of this block and be shared. + */ +typedef khronos_int64_t GLint64; +typedef khronos_uint64_t GLuint64; +typedef struct __GLsync *GLsync; + +#define GL_SYNC_OBJECT_APPLE 0x8A53 +#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111 +#define GL_OBJECT_TYPE_APPLE 0x9112 +#define GL_SYNC_CONDITION_APPLE 0x9113 +#define GL_SYNC_STATUS_APPLE 0x9114 +#define GL_SYNC_FLAGS_APPLE 0x9115 +#define GL_SYNC_FENCE_APPLE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117 +#define GL_UNSIGNALED_APPLE 0x9118 +#define GL_SIGNALED_APPLE 0x9119 +#define GL_ALREADY_SIGNALED_APPLE 0x911A +#define GL_TIMEOUT_EXPIRED_APPLE 0x911B +#define GL_CONDITION_SATISFIED_APPLE 0x911C +#define GL_WAIT_FAILED_APPLE 0x911D +#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001 +#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull +#endif + +/* GL_APPLE_texture_2D_limited_npot */ +/* No new tokens introduced by this extension. */ + /* GL_APPLE_texture_format_BGRA8888 */ #ifndef GL_APPLE_texture_format_BGRA8888 #define GL_BGRA_EXT 0x80E1 @@ -288,12 +326,23 @@ typedef void* GLeglImageOES; #define GL_STENCIL_EXT 0x1802 #endif +/* GL_EXT_map_buffer_range */ +#ifndef GL_EXT_map_buffer_range +#define GL_MAP_READ_BIT_EXT 0x0001 +#define GL_MAP_WRITE_BIT_EXT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020 +#endif + /* GL_EXT_multisampled_render_to_texture */ #ifndef GL_EXT_multisampled_render_to_texture #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C -#define GL_RENDERBUFFER_SAMPLES_EXT 0x9133 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x9134 -#define GL_MAX_SAMPLES_EXT 0x9135 +/* reuse values from GL_EXT_framebuffer_multisample (desktop extension) */ +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 #endif /* GL_EXT_multi_draw_arrays */ @@ -353,10 +402,10 @@ typedef void* GLeglImageOES; /* GL_EXT_texture_storage */ #ifndef GL_EXT_texture_storage #define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F -#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA8_EXT 0x803C #define GL_LUMINANCE8_EXT 0x8040 #define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_RGBA32F_EXT 0x8814 +#define GL_RGBA32F_EXT 0x8814 #define GL_RGB32F_EXT 0x8815 #define GL_ALPHA32F_EXT 0x8816 #define GL_LUMINANCE32F_EXT 0x8818 @@ -366,7 +415,7 @@ typedef void* GLeglImageOES; #define GL_ALPHA16F_EXT 0x881C #define GL_LUMINANCE16F_EXT 0x881E #define GL_LUMINANCE_ALPHA16F_EXT 0x881F -#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGB10_A2_EXT 0x8059 #define GL_RGB10_EXT 0x8052 #define GL_BGRA8_EXT 0x93A1 #endif @@ -771,6 +820,11 @@ typedef void (GL_APIENTRYP PFNGLWEIGHTPOINTEROESPROC) (GLint size, GLenum type, #define GL_OES_packed_depth_stencil 1 #endif +/* GL_OES_required_internalformat */ +#ifndef GL_OES_required_internalformat +#define GL_OES_required_internalformat 1 +#endif + /* GL_OES_query_matrix */ #ifndef GL_OES_query_matrix #define GL_OES_query_matrix 1 @@ -892,9 +946,13 @@ typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); * APPLE extension functions *------------------------------------------------------------------------*/ -/* GL_APPLE_texture_2D_limited_npot */ -#ifndef GL_APPLE_texture_2D_limited_npot -#define GL_APPLE_texture_2D_limited_npot 1 +/* GL_APPLE_copy_texture_levels */ +#ifndef GL_APPLE_copy_texture_levels +#define GL_APPLE_copy_texture_levels 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); +#endif +typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); #endif /* GL_APPLE_framebuffer_multisample */ @@ -908,6 +966,32 @@ typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); #endif +/* GL_APPLE_sync */ +#ifndef GL_APPLE_sync +#define GL_APPLE_sync 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags); +GL_API GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync); +GL_API void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync); +GL_API GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); +GL_API void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); +GL_API void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params); +GL_API void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#endif +typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync); +typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync); +typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params); +typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#endif + +/* GL_APPLE_texture_2D_limited_npot */ +#ifndef GL_APPLE_texture_2D_limited_npot +#define GL_APPLE_texture_2D_limited_npot 1 +#endif + /* GL_APPLE_texture_format_BGRA8888 */ #ifndef GL_APPLE_texture_format_BGRA8888 #define GL_APPLE_texture_format_BGRA8888 1 @@ -945,6 +1029,17 @@ GL_API void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttac typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); #endif +/* GL_EXT_map_buffer_range */ +#ifndef GL_EXT_map_buffer_range +#define GL_EXT_map_buffer_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY *glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GL_API void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length); +#endif +typedef void* (GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +#endif + /* GL_EXT_multisampled_render_to_texture */ #ifndef GL_EXT_multisampled_render_to_texture #define GL_EXT_multisampled_render_to_texture 1 @@ -1068,8 +1163,8 @@ typedef void (GL_APIENTRYP PFNGLCLIPPLANEXIMGPROC) (GLenum p, const GLfixed *eqn GL_API void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei); GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); #endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); #endif /*------------------------------------------------------------------------* diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index b4cff6121..29e14a1a0 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -161,21 +161,12 @@ const uint CDriverGL::_EVSNumConstant = 97; GLenum CDriverGL::NLCubeFaceToGLCubeFace[6] = { -#ifdef USE_OPENGLES - GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES, - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES, - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES, - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES -#else GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB -#endif }; // *************************************************************************** @@ -305,6 +296,8 @@ CDriverGL::CDriverGL() _NVTextureShaderEnabled = false; + _AnisotropicFilter = 0.f; + // Compute the Flag which say if one texture has been changed in CMaterial. _MaterialAllTextureTouchedFlag= 0; for(i=0; i < IDRV_MAT_MAXTEXTURES; i++) @@ -1337,11 +1330,7 @@ void CDriverGL::copyFrameBufferToTexture(ITexture *tex, { if(_Extensions.ARBTextureCubeMap) { -#ifdef USE_OPENGLES - glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID); -#else glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID); -#endif glCopyTexSubImage2D(NLCubeFaceToGLCubeFace[cubeFace], level, offsetx, offsety, x, y, width, height); } } @@ -2626,11 +2615,10 @@ void CDriverGL::checkTextureOn() const GLboolean flagCM; GLboolean flagTR; glGetBooleanv(GL_TEXTURE_2D, &flag2D); + glGetBooleanv(GL_TEXTURE_CUBE_MAP_ARB, &flagCM); #ifdef USE_OPENGLES - glGetBooleanv(GL_TEXTURE_CUBE_MAP_OES, &flagCM); flagTR = true; // always true in OpenGL ES #else - glGetBooleanv(GL_TEXTURE_CUBE_MAP_ARB, &flagCM); glGetBooleanv(GL_TEXTURE_RECTANGLE_NV, &flagTR); #endif switch(dgs.getTextureMode()) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.h b/code/nel/src/3d/driver/opengl/driver_opengl.h index 66e0b1325..bfe73492d 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl.h @@ -364,6 +364,7 @@ public: virtual bool uploadTextureCube (ITexture& tex, NLMISC::CRect& rect, uint8 nNumMipMap, uint8 nNumFace); virtual void forceDXTCCompression(bool dxtcComp); + virtual void setAnisotropicFilter(sint filter); virtual void forceTextureResize(uint divisor); @@ -955,6 +956,8 @@ private: bool _NVTextureShaderEnabled; // Which stages support EMBM bool _StageSupportEMBM[IDRV_MAT_MAXTEXTURES]; + // Anisotropic filtering value + float _AnisotropicFilter; // Prec settings for material. CDriverGLStates _DriverGLStates; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index 770e273dc..d38ff8f51 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -628,7 +628,7 @@ static bool setupARBTextureNonPowerOfTwo(const char *glext) { H_AUTO_OGL(setupARBTextureCompression); -#ifndef USE_OPENGL_ES +#ifndef USE_OPENGLES CHECK_EXT("GL_ARB_texture_non_power_of_two"); #endif @@ -805,20 +805,20 @@ static bool setupARBTextureCubeMap(const char *glext) #ifdef USE_OPENGLES CHECK_EXT("OES_texture_cube_map"); + + CHECK_ADDRESS(NEL_PFNGLTEXGENFOESPROC, glTexGenfOES); + CHECK_ADDRESS(NEL_PFNGLTEXGENFVOESPROC, glTexGenfvOES); + CHECK_ADDRESS(NEL_PFNGLTEXGENIOESPROC, glTexGeniOES); + CHECK_ADDRESS(NEL_PFNGLTEXGENIVOESPROC, glTexGenivOES); + CHECK_ADDRESS(NEL_PFNGLTEXGENXOESPROC, glTexGenxOES); + CHECK_ADDRESS(NEL_PFNGLTEXGENXVOESPROC, glTexGenxvOES); + CHECK_ADDRESS(NEL_PFNGLGETTEXGENFVOESPROC, glGetTexGenfvOES); + CHECK_ADDRESS(NEL_PFNGLGETTEXGENIVOESPROC, glGetTexGenivOES); + CHECK_ADDRESS(NEL_PFNGLGETTEXGENXVOESPROC, glGetTexGenxvOES); #else CHECK_EXT("GL_ARB_texture_cube_map"); #endif -// CHECK_ADDRESS(NEL_PFNGLTEXGENFOESPROC, glTexGenfOES); -// CHECK_ADDRESS(NEL_PFNGLTEXGENFVOESPROC, glTexGenfvOES); -// CHECK_ADDRESS(NEL_PFNGLTEXGENIOESPROC, glTexGeniOES); -// CHECK_ADDRESS(NEL_PFNGLTEXGENIVOESPROC, glTexGenivOES); -// CHECK_ADDRESS(NEL_PFNGLTEXGENXOESPROC, glTexGenxOES); -// CHECK_ADDRESS(NEL_PFNGLTEXGENXVOESPROC, glTexGenxvOES); -// CHECK_ADDRESS(NEL_PFNGLGETTEXGENFVOESPROC, glGetTexGenfvOES); -// CHECK_ADDRESS(NEL_PFNGLGETTEXGENIVOESPROC, glGetTexGenivOES); -// CHECK_ADDRESS(NEL_PFNGLGETTEXGENXVOESPROC, glGetTexGenxvOES); - return true; } @@ -1499,11 +1499,7 @@ void registerGlExtensions(CGlExtensions &ext) ext.ARBMultiTexture= setupARBMultiTexture(glext); if(ext.ARBMultiTexture) { -#ifdef USE_OPENGLES - glGetIntegerv(GL_MAX_TEXTURE_UNITS, &ntext); -#else glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &ntext); -#endif // We could have more than IDRV_MAT_MAXTEXTURES but the interface only // support IDRV_MAT_MAXTEXTURES texture stages so take min ext.NbTextureStages= (ntext<((GLint)IDRV_MAT_MAXTEXTURES)?ntext:IDRV_MAT_MAXTEXTURES); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.h b/code/nel/src/3d/driver/opengl/driver_opengl_extension.h index 5d58840c1..9d28a15ab 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.h @@ -55,12 +55,12 @@ struct CGlExtensions bool NVTextureEnvCombine4; bool ARBTextureCubeMap; bool NVVertexProgram; - bool EXTVertexShader; + bool EXTVertexShader; bool NVTextureShader; - bool NVOcclusionQuery; + bool NVOcclusionQuery; bool NVTextureRectangle; - bool EXTTextureRectangle; - bool ARBTextureRectangle; + bool EXTTextureRectangle; + bool ARBTextureRectangle; bool FrameBufferObject; bool FrameBufferBlit; bool FrameBufferMultisample; @@ -89,10 +89,10 @@ struct CGlExtensions // ATI Extensions. bool ATIVertexArrayObject; - bool ATIMapObjectBuffer; + bool ATIMapObjectBuffer; bool ATITextureEnvCombine3; - bool ATIEnvMapBumpMap; - bool ATIFragmentShader; + bool ATIEnvMapBumpMap; + bool ATIFragmentShader; bool ATIXTextureEnvRoute; bool ATIVertexAttribArrayObject; // ARB Extensions @@ -157,7 +157,7 @@ public: NVTextureRectangle = false; EXTTextureRectangle = false; EXTTextureFilterAnisotropic = false; - EXTTextureFilterAnisotropicMaximum = 1.f; + EXTTextureFilterAnisotropicMaximum = 0.f; ARBTextureRectangle = false; ARBTextureNonPowerOfTwo = false; ARBMultisample = false; @@ -781,3 +781,4 @@ extern NEL_PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB; #endif // USE_OPENGLES #endif // NL_OPENGL_EXTENSION_H + diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h b/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h index d8862ff14..a11d0cd1c 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h @@ -63,6 +63,27 @@ typedef void (APIENTRY * NEL_PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pnam typedef void (APIENTRY * NEL_PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params); typedef void (APIENTRY * NEL_PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params); +#define GL_MULTISAMPLE_ARB GL_MULTISAMPLE +#define GL_TEXTURE_CUBE_MAP_ARB GL_TEXTURE_CUBE_MAP_OES +#define GL_NONE 0 +#define GL_MAX_TEXTURE_UNITS_ARB GL_MAX_TEXTURE_UNITS +#define GL_REFLECTION_MAP_ARB GL_REFLECTION_MAP_OES +#define GL_RGB_SCALE_EXT GL_RGB_SCALE +#define GL_REFLECTION_MAP_ARB GL_REFLECTION_MAP_OES +#define GL_PREVIOUS_EXT GL_PREVIOUS +#define GL_PRIMARY_COLOR_EXT GL_PRIMARY_COLOR +#define GL_CONSTANT_EXT GL_CONSTANT +#define GL_ADD_SIGNED_EXT GL_ADD_SIGNED +#define GL_INTERPOLATE_EXT GL_INTERPOLATE +#define GL_BUMP_ENVMAP_ATI GL_INTERPOLATE + +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES + #else // *************************************************************************** diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp index ff73eb480..6d9dbb247 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp @@ -87,10 +87,9 @@ static inline void convTexAddr(ITexture *tex, CMaterial::TTexAddressingMode mode nlassert(mode < CMaterial::TexAddrCount); static const GLenum glTex2dAddrModesNV[] = { -#ifdef USE_OPENGLES - 0, GL_TEXTURE_2D -#else - GL_NONE, GL_TEXTURE_2D, GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV, + GL_NONE, GL_TEXTURE_2D, +#ifndef USE_OPENGLES + GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV, GL_OFFSET_TEXTURE_2D_NV, GL_OFFSET_TEXTURE_2D_SCALE_NV, GL_DEPENDENT_AR_TEXTURE_2D_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV, GL_DOT_PRODUCT_NV, GL_DOT_PRODUCT_TEXTURE_2D_NV, GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV, @@ -101,10 +100,9 @@ static inline void convTexAddr(ITexture *tex, CMaterial::TTexAddressingMode mode static const GLenum glTexCubeAddrModesNV[] = { -#ifdef USE_OPENGLES - 0, GL_TEXTURE_CUBE_MAP_OES -#else - GL_NONE, GL_TEXTURE_CUBE_MAP_ARB, GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV, + GL_NONE, GL_TEXTURE_CUBE_MAP_ARB, +#ifndef USE_OPENGLES + GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV, GL_OFFSET_TEXTURE_2D_NV, GL_OFFSET_TEXTURE_2D_SCALE_NV, GL_DEPENDENT_AR_TEXTURE_2D_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV, GL_DOT_PRODUCT_NV, GL_DOT_PRODUCT_TEXTURE_2D_NV, GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV, @@ -147,11 +145,7 @@ void CDriverGL::setTextureEnvFunction(uint stage, CMaterial& mat) { // Cubic or normal ? if (text->isTextureCube ()) -#ifdef USE_OPENGLES - _DriverGLStates.setTexGenMode (stage, GL_REFLECTION_MAP_OES); -#else _DriverGLStates.setTexGenMode (stage, GL_REFLECTION_MAP_ARB); -#endif else #ifdef USE_OPENGLES _DriverGLStates.setTexGenMode (stage, GL_TEXTURE_CUBE_MAP_OES); @@ -974,11 +968,7 @@ void CDriverGL::setupLightMapPass(uint pass) if (mat._LightMapsMulx2) { // Multiply x 2 -#ifdef USE_OPENGLES - glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 2); -#else glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2); -#endif } } } @@ -1087,11 +1077,7 @@ void CDriverGL::endLightMapMultiPass() for (uint32 i = 0; i < (_NLightMapPerPass+1); ++i) { _DriverGLStates.activeTextureARB(i); -#ifdef USE_OPENGLES - glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 1); -#else glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1); -#endif } } } @@ -1165,12 +1151,7 @@ void CDriverGL::setupSpecularBegin() // todo hulud remove // _DriverGLStates.setTextureMode(CDriverGLStates::TextureCubeMap); - -#ifdef USE_OPENGLES - _DriverGLStates.setTexGenMode (1, GL_REFLECTION_MAP_OES); -#else _DriverGLStates.setTexGenMode (1, GL_REFLECTION_MAP_ARB); -#endif // setup the good matrix for stage 1. glMatrixMode(GL_TEXTURE); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp index 1d517d0fc..60a0609dc 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp @@ -165,11 +165,9 @@ void CDriverGLStates::forceDefaults(uint nbStages) if(_TextureCubeMapSupported) { -#ifdef USE_OPENGLES - glDisable(GL_TEXTURE_CUBE_MAP_OES); - glDisable(GL_TEXTURE_GEN_STR_OES); -#else glDisable(GL_TEXTURE_CUBE_MAP_ARB); +#ifdef USE_OPENGLES + glDisable(GL_TEXTURE_GEN_STR_OES); #endif } @@ -393,6 +391,7 @@ void CDriverGLStates::enableMultisample(bool enable) { // new state. _CurMultisample= enable; + // Setup GLState. if(_CurMultisample) glEnable(GL_MULTISAMPLE_ARB); @@ -686,7 +685,7 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode) else { #ifdef USE_OPENGLES -// nglTexGeniOES(GL_TEXTURE_GEN_STR_OES, GL_TEXTURE_GEN_MODE_OES, mode); + nglTexGeniOES(GL_TEXTURE_GEN_STR_OES, GL_TEXTURE_GEN_MODE_OES, mode); #else glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, mode); glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, mode); @@ -702,8 +701,8 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode) #ifdef USE_OPENGLES // if(mode==GL_OBJECT_LINEAR || mode==GL_EYE_LINEAR) // { - nglTexGeniOES(GL_TEXTURE_GEN_STR_OES, GL_TEXTURE_GEN_MODE_OES, mode); - glEnable(GL_TEXTURE_GEN_STR_OES); +// nglTexGeniOES(GL_TEXTURE_GEN_STR_OES, GL_TEXTURE_GEN_MODE_OES, mode); +// glEnable(GL_TEXTURE_GEN_STR_OES); // } // else // { @@ -742,11 +741,7 @@ void CDriverGLStates::resetTextureMode() if (_TextureCubeMapSupported) { -#ifdef USE_OPENGLES - glDisable(GL_TEXTURE_CUBE_MAP_OES); -#else glDisable(GL_TEXTURE_CUBE_MAP_ARB); -#endif } #ifndef USE_OPENGLES @@ -789,11 +784,7 @@ void CDriverGLStates::setTextureMode(TTextureMode texMode) { if(_TextureCubeMapSupported) { -#ifdef USE_OPENGLES - glDisable(GL_TEXTURE_CUBE_MAP_OES); -#else glDisable(GL_TEXTURE_CUBE_MAP_ARB); -#endif } else { @@ -823,11 +814,7 @@ void CDriverGLStates::setTextureMode(TTextureMode texMode) { if(_TextureCubeMapSupported) { -#ifdef USE_OPENGLES - glEnable(GL_TEXTURE_CUBE_MAP_OES); -#else glEnable(GL_TEXTURE_CUBE_MAP_ARB); -#endif } else { @@ -872,11 +859,11 @@ void CDriverGLStates::forceActiveTextureARB(uint stage) _CurrentActiveTextureARB= stage; } - // *************************************************************************** void CDriverGLStates::enableVertexArray(bool enable) { - H_AUTO_OGL(CDriverGLStates_enableVertexArray) + H_AUTO_OGL(CDriverGLStates_enableVertexArray); + if(_VertexArrayEnabled != enable) { if(enable) @@ -1038,7 +1025,7 @@ void CDriverGLStates::enableVertexAttribArrayARB(uint glIndex,bool enable) // *************************************************************************** void CDriverGLStates::enableVertexAttribArrayForEXTVertexShader(uint glIndex, bool enable, uint *variants) { - H_AUTO_OGL(CDriverGLStates_enableVertexAttribArrayForEXTVertexShader) + H_AUTO_OGL(CDriverGLStates_enableVertexAttribArrayForEXTVertexShader); if(_VertexAttribArrayEnabled[glIndex] != enable) { diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp index f0aab8938..77954a8e3 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp @@ -781,11 +781,7 @@ void CDriverGL::bindTextureWithMode(ITexture &tex) { _DriverGLStates.setTextureMode(CDriverGLStates::TextureCubeMap); // Bind this texture -#ifdef USE_OPENGLES - glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID); -#else glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID); -#endif } } else @@ -820,19 +816,16 @@ void CDriverGL::setupTextureBasicParameters(ITexture &tex) { if (_Extensions.ARBTextureCubeMap) { -#ifdef USE_OPENGLES - glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_S, translateWrapToGl(ITexture::Clamp, _Extensions)); - glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_T, translateWrapToGl(ITexture::Clamp, _Extensions)); -// glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_R, translateWrapToGl(ITexture::Clamp, _Extensions)); - glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext)); - glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext)); -#else glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_S, translateWrapToGl(ITexture::Clamp, _Extensions)); glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_T, translateWrapToGl(ITexture::Clamp, _Extensions)); +#ifndef USE_OPENGLES glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_R, translateWrapToGl(ITexture::Clamp, _Extensions)); +#endif glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext)); glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext)); -#endif + + if (_AnisotropicFilter > 1.f && gltext->MinFilter > ITexture::NearestMipMapLinear) + glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAX_ANISOTROPY_EXT, _AnisotropicFilter); } } else @@ -841,6 +834,9 @@ void CDriverGL::setupTextureBasicParameters(ITexture &tex) glTexParameteri(gltext->TextureMode,GL_TEXTURE_WRAP_T, translateWrapToGl(gltext->WrapT, _Extensions)); glTexParameteri(gltext->TextureMode,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext)); glTexParameteri(gltext->TextureMode,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext)); + + if (_AnisotropicFilter > 1.f && gltext->MinFilter > ITexture::NearestMipMapLinear) + glTexParameteri(gltext->TextureMode, GL_TEXTURE_MAX_ANISOTROPY_EXT, _AnisotropicFilter); } // tex.clearFilterOrWrapModeTouched(); @@ -1516,31 +1512,19 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex) _CurrentTextureInfoGL[stage]= gltext; // setup this texture -#ifdef USE_OPENGLES - glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID); -#else glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID); -#endif // Change parameters of texture, if necessary. //============================================ if(gltext->MagFilter!= tex->getMagFilter()) { gltext->MagFilter= tex->getMagFilter(); -#ifdef USE_OPENGLES - glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext)); -#else glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext)); -#endif } if(gltext->MinFilter!= tex->getMinFilter()) { gltext->MinFilter= tex->getMinFilter(); -#ifdef USE_OPENGLES - glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext)); -#else glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext)); -#endif } } } @@ -1617,34 +1601,16 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex) // This maps the CMaterial::TTexOperator -static const GLenum OperatorLUT[9]= { GL_REPLACE, GL_MODULATE, GL_ADD, -#ifdef USE_OPENGLES - GL_ADD_SIGNED, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE -#else - GL_ADD_SIGNED_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_BUMP_ENVMAP_ATI -#endif -}; +static const GLenum OperatorLUT[9]= { GL_REPLACE, GL_MODULATE, GL_ADD, GL_ADD_SIGNED_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_BUMP_ENVMAP_ATI }; // This maps the CMaterial::TTexSource -static const GLenum SourceLUT[4]= { GL_TEXTURE, -#ifdef USE_OPENGLES - GL_PREVIOUS, GL_PRIMARY_COLOR, GL_CONSTANT -#else - GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT -#endif -}; +static const GLenum SourceLUT[4]= { GL_TEXTURE, GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT }; // This maps the CMaterial::TTexOperand static const GLenum OperandLUT[4]= { GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA }; // This maps the CMaterial::TTexOperator, used for openGL Arg2 setup. -static const GLenum InterpolateSrcLUT[8]= { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, -#ifdef USE_OPENGLES - GL_PREVIOUS, GL_PRIMARY_COLOR, GL_CONSTANT -#else - GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT -#endif -}; +static const GLenum InterpolateSrcLUT[8]= { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT }; #ifndef USE_OPENGLES @@ -2224,6 +2190,25 @@ void CDriverGL::forceDXTCCompression(bool dxtcComp) _ForceDXTCCompression= dxtcComp; } +// *************************************************************************** +void CDriverGL::setAnisotropicFilter(sint filtering) +{ + H_AUTO_OGL(CDriverGL_setAnisotropicFiltering); + + if (!_Extensions.EXTTextureFilterAnisotropic) return; + + if (filtering < 0 || filtering > _Extensions.EXTTextureFilterAnisotropicMaximum) + { + // set maximum value for anisotropic filter + _AnisotropicFilter = _Extensions.EXTTextureFilterAnisotropicMaximum; + } + else + { + // set specified value for anisotropic filter + _AnisotropicFilter = filtering; + } +} + // *************************************************************************** void CDriverGL::forceTextureResize(uint divisor) { diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp index 06ebafab0..60109cfb6 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp @@ -1542,7 +1542,7 @@ void CVertexBufferHardARB::unlock() #ifdef NL_DEBUG _Unmapping = true; #endif - GLboolean unmapOk = false; + GLboolean unmapOk = GL_FALSE; #ifdef USE_OPENGLES if (_Driver->_Extensions.OESMapBuffer) @@ -1671,3 +1671,4 @@ void CVertexBufferHardARB::invalidate() #endif } // NL3D + diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp index dc2a4243a..5392bcbdd 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp @@ -205,8 +205,8 @@ bool CDriverGL::activeNVVertexProgram (CVertexProgram *program) return false; } - // *************************************************************************** +#ifndef USE_OPENGLES static inline GLenum convSwizzleToGLFormat(CVPSwizzle::EComp comp, bool negate) { @@ -216,16 +216,11 @@ inline GLenum convSwizzleToGLFormat(CVPSwizzle::EComp comp, bool negate) { switch(comp) { -#ifdef USE_OPENGLES - case CVPSwizzle::X: return GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES; - case CVPSwizzle::Y: return GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES; - case CVPSwizzle::Z: return GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES; -#else case CVPSwizzle::X: return GL_X_EXT; case CVPSwizzle::Y: return GL_Y_EXT; case CVPSwizzle::Z: return GL_Z_EXT; case CVPSwizzle::W: return GL_W_EXT; -#endif + default: nlstop; return 0; @@ -236,16 +231,11 @@ inline GLenum convSwizzleToGLFormat(CVPSwizzle::EComp comp, bool negate) { switch(comp) { -#ifdef USE_OPENGLES - case CVPSwizzle::X: return GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES; - case CVPSwizzle::Y: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES; - case CVPSwizzle::Z: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES; -#else case CVPSwizzle::X: return GL_NEGATIVE_X_EXT; case CVPSwizzle::Y: return GL_NEGATIVE_Y_EXT; case CVPSwizzle::Z: return GL_NEGATIVE_Z_EXT; case CVPSwizzle::W: return GL_NEGATIVE_W_EXT; -#endif + default: nlstop; return 0; @@ -253,6 +243,7 @@ inline GLenum convSwizzleToGLFormat(CVPSwizzle::EComp comp, bool negate) } } } +#endif // *************************************************************************** /** Convert an output register to a EXTVertexShader register diff --git a/code/nel/src/3d/driver_user.cpp b/code/nel/src/3d/driver_user.cpp index df66f99d0..b45ebbd37 100644 --- a/code/nel/src/3d/driver_user.cpp +++ b/code/nel/src/3d/driver_user.cpp @@ -1469,12 +1469,21 @@ UDriver::TPolygonMode CDriverUser::getPolygonMode () return umode; } + void CDriverUser::forceDXTCCompression(bool dxtcComp) { NL3D_HAUTO_UI_DRIVER; _Driver->forceDXTCCompression(dxtcComp); } + +void CDriverUser::setAnisotropicFilter(sint filter) +{ + NL3D_HAUTO_UI_DRIVER; + + _Driver->setAnisotropicFilter(filter); +} + void CDriverUser::forceTextureResize(uint divisor) { NL3D_HAUTO_UI_DRIVER; diff --git a/code/nel/src/3d/fasthls_modifier.cpp b/code/nel/src/3d/fasthls_modifier.cpp index 3203587c0..5195ddb5a 100644 --- a/code/nel/src/3d/fasthls_modifier.cpp +++ b/code/nel/src/3d/fasthls_modifier.cpp @@ -109,7 +109,7 @@ CRGBA CFastHLSModifier::convert(uint H, uint L, uint S) return col; } -#if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10) +#if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 71 # pragma warning( push ) # pragma warning( disable : 4799 ) #endif @@ -262,7 +262,7 @@ uint16 CFastHLSModifier::applyHLSMod(uint16 colorIn, uint8 dHue, uint dLum, uin #pragma managed(pop) #endif -#if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10) +#if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 71 # pragma warning( pop ) #endif diff --git a/code/nel/src/3d/zone.cpp b/code/nel/src/3d/zone.cpp index b075e477e..4acca80f5 100644 --- a/code/nel/src/3d/zone.cpp +++ b/code/nel/src/3d/zone.cpp @@ -127,7 +127,7 @@ void CZone::build(const CZoneInfo &zoneInfo, uint32 numVertices) // Compute the bbox and the bias/scale. //===================================== CAABBox bb; - if(patchs.size()) + if(!patchs.empty()) bb.setCenter(patchs[0].Patch.Vertices[0]); bb.setHalfSize(CVector::Null); for(j=0;j<(sint)patchs.size();j++) diff --git a/code/nel/src/georges/type.cpp b/code/nel/src/georges/type.cpp index 344ba50f9..5b18c65c5 100644 --- a/code/nel/src/georges/type.cpp +++ b/code/nel/src/georges/type.cpp @@ -25,7 +25,6 @@ #include "nel/georges/form.h" #include "nel/georges/form_elm.h" #include "nel/georges/form_loader.h" - #include "nel/georges/type.h" using namespace NLMISC; diff --git a/code/nel/src/misc/aabbox.cpp b/code/nel/src/misc/aabbox.cpp index 6e1a9e428..3636552d1 100644 --- a/code/nel/src/misc/aabbox.cpp +++ b/code/nel/src/misc/aabbox.cpp @@ -21,6 +21,10 @@ #include "nel/misc/bsphere.h" #include "nel/misc/matrix.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/algo.cpp b/code/nel/src/misc/algo.cpp index 71fd14347..6a3ef62dd 100644 --- a/code/nel/src/misc/algo.cpp +++ b/code/nel/src/misc/algo.cpp @@ -21,6 +21,9 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/app_context.cpp b/code/nel/src/misc/app_context.cpp index 1213a6559..a0b35b35a 100644 --- a/code/nel/src/misc/app_context.cpp +++ b/code/nel/src/misc/app_context.cpp @@ -19,6 +19,10 @@ #include "nel/misc/dynloadlib.h" #include "nel/misc/command.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/async_file_manager.cpp b/code/nel/src/misc/async_file_manager.cpp index b9be77f45..366237722 100644 --- a/code/nel/src/misc/async_file_manager.cpp +++ b/code/nel/src/misc/async_file_manager.cpp @@ -23,6 +23,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/big_file.cpp b/code/nel/src/misc/big_file.cpp index e2d64d052..f5ee067f4 100644 --- a/code/nel/src/misc/big_file.cpp +++ b/code/nel/src/misc/big_file.cpp @@ -22,6 +22,9 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/bit_mem_stream.cpp b/code/nel/src/misc/bit_mem_stream.cpp index c8ae37163..ed282786e 100644 --- a/code/nel/src/misc/bit_mem_stream.cpp +++ b/code/nel/src/misc/bit_mem_stream.cpp @@ -25,6 +25,9 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/bit_set.cpp b/code/nel/src/misc/bit_set.cpp index c19b8d35d..79eda0c13 100644 --- a/code/nel/src/misc/bit_set.cpp +++ b/code/nel/src/misc/bit_set.cpp @@ -20,6 +20,9 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/bitmap.cpp b/code/nel/src/misc/bitmap.cpp index aa426d47a..cfe8cab89 100644 --- a/code/nel/src/misc/bitmap.cpp +++ b/code/nel/src/misc/bitmap.cpp @@ -26,6 +26,9 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/bitmap_jpeg.cpp b/code/nel/src/misc/bitmap_jpeg.cpp index cae1f9700..799d659d6 100644 --- a/code/nel/src/misc/bitmap_jpeg.cpp +++ b/code/nel/src/misc/bitmap_jpeg.cpp @@ -32,6 +32,9 @@ extern "C" using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/bitmap_png.cpp b/code/nel/src/misc/bitmap_png.cpp index 768619e76..cea0b7d0c 100644 --- a/code/nel/src/misc/bitmap_png.cpp +++ b/code/nel/src/misc/bitmap_png.cpp @@ -27,6 +27,9 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/block_memory.cpp b/code/nel/src/misc/block_memory.cpp index d6abdffe6..d7c8e445c 100644 --- a/code/nel/src/misc/block_memory.cpp +++ b/code/nel/src/misc/block_memory.cpp @@ -21,6 +21,9 @@ // remove stupid VC6 warnings void foo_block_memory_cpp() {} +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/bsphere.cpp b/code/nel/src/misc/bsphere.cpp index 8e3494514..1fcf359e7 100644 --- a/code/nel/src/misc/bsphere.cpp +++ b/code/nel/src/misc/bsphere.cpp @@ -21,6 +21,9 @@ using namespace NLMISC; using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/buf_fifo.cpp b/code/nel/src/misc/buf_fifo.cpp index 2f39bd098..6c377f078 100644 --- a/code/nel/src/misc/buf_fifo.cpp +++ b/code/nel/src/misc/buf_fifo.cpp @@ -26,6 +26,10 @@ using namespace std; // if 0, don't stat the time of different function #define STAT_FIFO 1 +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { #ifdef BUFFIFO_TRACK_ALL_BUFFERS diff --git a/code/nel/src/misc/class_id.cpp b/code/nel/src/misc/class_id.cpp index e705c26a8..72d9cc43b 100644 --- a/code/nel/src/misc/class_id.cpp +++ b/code/nel/src/misc/class_id.cpp @@ -20,6 +20,9 @@ +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/class_registry.cpp b/code/nel/src/misc/class_registry.cpp index 74e3e24b9..91c603c90 100644 --- a/code/nel/src/misc/class_registry.cpp +++ b/code/nel/src/misc/class_registry.cpp @@ -17,9 +17,14 @@ #include "stdmisc.h" #include "nel/misc/class_registry.h" +#include "nel/misc/debug.h" using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/cmd_args.cpp b/code/nel/src/misc/cmd_args.cpp index c42473027..2ef32a6c9 100644 --- a/code/nel/src/misc/cmd_args.cpp +++ b/code/nel/src/misc/cmd_args.cpp @@ -24,6 +24,10 @@ #include "nel/misc/cmd_args.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/command.cpp b/code/nel/src/misc/command.cpp index 1fff9627b..30e3defe2 100644 --- a/code/nel/src/misc/command.cpp +++ b/code/nel/src/misc/command.cpp @@ -22,6 +22,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { //ICommand::TCategorySet* ICommand::_Categories; diff --git a/code/nel/src/misc/cpu_time_stat.cpp b/code/nel/src/misc/cpu_time_stat.cpp index a1f9bc23f..861ab8e56 100644 --- a/code/nel/src/misc/cpu_time_stat.cpp +++ b/code/nel/src/misc/cpu_time_stat.cpp @@ -15,9 +15,10 @@ // along with this program. If not, see . #include "stdmisc.h" -#include "nel/misc/cpu_time_stat.h" +#include "nel/misc/cpu_time_stat.h" #include "nel/misc/common.h" +#include "nel/misc/debug.h" #ifdef NL_OS_UNIX #include @@ -27,6 +28,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index f2dd31290..b37f16d57 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -53,6 +53,8 @@ # include #endif +#define NL_NO_DEBUG_FILES 1 + using namespace std; // If you don't want to add default displayer, put 0 instead of 1. In this case, you diff --git a/code/nel/src/misc/di_event_emitter.cpp b/code/nel/src/misc/di_event_emitter.cpp index c0894e381..8f41f6453 100644 --- a/code/nel/src/misc/di_event_emitter.cpp +++ b/code/nel/src/misc/di_event_emitter.cpp @@ -28,7 +28,9 @@ #ifdef NL_OS_WINDOWS - +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/di_game_device.cpp b/code/nel/src/misc/di_game_device.cpp index 22a9d57fd..6574b5cde 100644 --- a/code/nel/src/misc/di_game_device.cpp +++ b/code/nel/src/misc/di_game_device.cpp @@ -21,6 +21,10 @@ #ifdef NL_OS_WINDOWS +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/di_keyboard_device.cpp b/code/nel/src/misc/di_keyboard_device.cpp index dffc1f4da..0802019a4 100644 --- a/code/nel/src/misc/di_keyboard_device.cpp +++ b/code/nel/src/misc/di_keyboard_device.cpp @@ -27,6 +27,10 @@ #include "Mmsystem.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/di_mouse_device.cpp b/code/nel/src/misc/di_mouse_device.cpp index cce2650dc..2dfcf95f0 100644 --- a/code/nel/src/misc/di_mouse_device.cpp +++ b/code/nel/src/misc/di_mouse_device.cpp @@ -23,6 +23,10 @@ #ifdef NL_OS_WINDOWS +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/diff_tool.cpp b/code/nel/src/misc/diff_tool.cpp index 9422e2a79..15a91cdb8 100644 --- a/code/nel/src/misc/diff_tool.cpp +++ b/code/nel/src/misc/diff_tool.cpp @@ -22,6 +22,9 @@ using namespace NLMISC; using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace STRING_MANAGER { diff --git a/code/nel/src/misc/dummy_window.cpp b/code/nel/src/misc/dummy_window.cpp index 90c36d55b..a0d807ac5 100644 --- a/code/nel/src/misc/dummy_window.cpp +++ b/code/nel/src/misc/dummy_window.cpp @@ -21,6 +21,10 @@ #ifdef NL_OS_WINDOWS +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/dynloadlib.cpp b/code/nel/src/misc/dynloadlib.cpp index 7153643fc..6dcb7e4cf 100644 --- a/code/nel/src/misc/dynloadlib.cpp +++ b/code/nel/src/misc/dynloadlib.cpp @@ -21,6 +21,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/eid_translator.cpp b/code/nel/src/misc/eid_translator.cpp index 710acb440..acf4046e5 100644 --- a/code/nel/src/misc/eid_translator.cpp +++ b/code/nel/src/misc/eid_translator.cpp @@ -31,6 +31,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { // diff --git a/code/nel/src/misc/entity_id.cpp b/code/nel/src/misc/entity_id.cpp index b90a25ea3..b62bf1f1c 100644 --- a/code/nel/src/misc/entity_id.cpp +++ b/code/nel/src/misc/entity_id.cpp @@ -20,6 +20,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { const uint64 CEntityId::MaxEntityId = ((uint64)1 << (CEntityId::ID_SIZE + 1)) - (uint64)1; diff --git a/code/nel/src/misc/eval_num_expr.cpp b/code/nel/src/misc/eval_num_expr.cpp index de7f3b2bf..c47309498 100644 --- a/code/nel/src/misc/eval_num_expr.cpp +++ b/code/nel/src/misc/eval_num_expr.cpp @@ -17,6 +17,11 @@ #include "stdmisc.h" #include "nel/misc/eval_num_expr.h" +#include "nel/misc/debug.h" + +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/event_emitter.cpp b/code/nel/src/misc/event_emitter.cpp index 946efd75c..0cf3aad72 100644 --- a/code/nel/src/misc/event_emitter.cpp +++ b/code/nel/src/misc/event_emitter.cpp @@ -19,6 +19,10 @@ // remove stupid VC6 warnings void foo_event_emitter_cpp() {} +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/event_emitter_multi.cpp b/code/nel/src/misc/event_emitter_multi.cpp index f119601f5..52bc235cd 100644 --- a/code/nel/src/misc/event_emitter_multi.cpp +++ b/code/nel/src/misc/event_emitter_multi.cpp @@ -18,6 +18,10 @@ #include "nel/misc/event_emitter_multi.h" #include "nel/misc/system_utils.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/event_listener.cpp b/code/nel/src/misc/event_listener.cpp index 1b8b29017..14bb5d73d 100644 --- a/code/nel/src/misc/event_listener.cpp +++ b/code/nel/src/misc/event_listener.cpp @@ -20,6 +20,9 @@ #include "nel/misc/event_server.h" #include "nel/misc/events.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/event_server.cpp b/code/nel/src/misc/event_server.cpp index 21ed8c576..eceb783fe 100644 --- a/code/nel/src/misc/event_server.cpp +++ b/code/nel/src/misc/event_server.cpp @@ -21,6 +21,9 @@ #include "nel/misc/event_emitter.h" #include "nel/misc/events.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/events.cpp b/code/nel/src/misc/events.cpp index 1d88be177..daa651ed7 100644 --- a/code/nel/src/misc/events.cpp +++ b/code/nel/src/misc/events.cpp @@ -19,6 +19,9 @@ #include "nel/misc/events.h" #include "nel/misc/string_conversion.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/fast_floor.cpp b/code/nel/src/misc/fast_floor.cpp index 614ad3474..29411492b 100644 --- a/code/nel/src/misc/fast_floor.cpp +++ b/code/nel/src/misc/fast_floor.cpp @@ -18,6 +18,10 @@ #include "nel/misc/fast_floor.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { int OptFastFloorCWStack[OptFastFloorCWStackSize]; diff --git a/code/nel/src/misc/fast_id_map.cpp b/code/nel/src/misc/fast_id_map.cpp index 3d434066c..5ba919b09 100644 --- a/code/nel/src/misc/fast_id_map.cpp +++ b/code/nel/src/misc/fast_id_map.cpp @@ -35,6 +35,10 @@ // Project includes +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { void dummytoavoidthecompilerwarningfastidmap() { } diff --git a/code/nel/src/misc/fast_mem.cpp b/code/nel/src/misc/fast_mem.cpp index 6d7ca97ff..c957195b3 100644 --- a/code/nel/src/misc/fast_mem.cpp +++ b/code/nel/src/misc/fast_mem.cpp @@ -19,6 +19,9 @@ #include "nel/misc/fast_mem.h" #include "nel/misc/system_info.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/file.cpp b/code/nel/src/misc/file.cpp index 4c8501a17..842d9ea51 100644 --- a/code/nel/src/misc/file.cpp +++ b/code/nel/src/misc/file.cpp @@ -15,9 +15,7 @@ // along with this program. If not, see . #include "stdmisc.h" -#ifndef NL_OS_WINDOWS -#include -#endif + #include "nel/misc/file.h" #include "nel/misc/debug.h" #include "nel/misc/big_file.h" @@ -26,10 +24,18 @@ #include "nel/misc/sstring.h" #include "nel/misc/xml_pack.h" +#ifndef NL_OS_WINDOWS +#include +#endif + using namespace std; #define NLMISC_DONE_FILE_OPENED 40 +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/game_device.cpp b/code/nel/src/misc/game_device.cpp index ee0924a1a..2ba49367f 100644 --- a/code/nel/src/misc/game_device.cpp +++ b/code/nel/src/misc/game_device.cpp @@ -17,6 +17,10 @@ #include "stdmisc.h" #include "nel/misc/game_device.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/game_device_events.cpp b/code/nel/src/misc/game_device_events.cpp index 59cc115d5..bf64a1c4b 100644 --- a/code/nel/src/misc/game_device_events.cpp +++ b/code/nel/src/misc/game_device_events.cpp @@ -18,6 +18,10 @@ #include "nel/misc/game_device_events.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/geom_ext.cpp b/code/nel/src/misc/geom_ext.cpp index 0b1735099..32dba1d60 100644 --- a/code/nel/src/misc/geom_ext.cpp +++ b/code/nel/src/misc/geom_ext.cpp @@ -24,6 +24,10 @@ void dummyToAvoidStupidCompilerWarning_misc_geom_ext_cpp() { } +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/grid_traversal.cpp b/code/nel/src/misc/grid_traversal.cpp index 19e59e7c2..a88267331 100644 --- a/code/nel/src/misc/grid_traversal.cpp +++ b/code/nel/src/misc/grid_traversal.cpp @@ -19,6 +19,10 @@ #include "nel/misc/grid_traversal.h" #include "nel/misc/vector_2f.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/gtk_displayer.cpp b/code/nel/src/misc/gtk_displayer.cpp index d348bab79..f558a4909 100644 --- a/code/nel/src/misc/gtk_displayer.cpp +++ b/code/nel/src/misc/gtk_displayer.cpp @@ -15,6 +15,7 @@ // along with this program. If not, see . #include "stdmisc.h" +#include "nel/misc/gtk_displayer.h" #ifdef NL_USE_GTK @@ -35,10 +36,12 @@ #include "nel/misc/command.h" #include "nel/misc/thread.h" -#include "nel/misc/gtk_displayer.h" - using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { // diff --git a/code/nel/src/misc/hierarchical_timer.cpp b/code/nel/src/misc/hierarchical_timer.cpp index 9d3c40c44..62dc0786a 100644 --- a/code/nel/src/misc/hierarchical_timer.cpp +++ b/code/nel/src/misc/hierarchical_timer.cpp @@ -26,6 +26,10 @@ #include "nel/misc/time_nl.h" #endif +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/i18n.cpp b/code/nel/src/misc/i18n.cpp index c68b190c5..cf1803c76 100644 --- a/code/nel/src/misc/i18n.cpp +++ b/code/nel/src/misc/i18n.cpp @@ -22,6 +22,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { CI18N::StrMapContainer CI18N::_StrMap; diff --git a/code/nel/src/misc/i_xml.cpp b/code/nel/src/misc/i_xml.cpp index 6cd675ace..d8925ddef 100644 --- a/code/nel/src/misc/i_xml.cpp +++ b/code/nel/src/misc/i_xml.cpp @@ -28,6 +28,10 @@ using namespace std; #define NLMISC_READ_BUFFER_SIZE 1024 +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/input_device.cpp b/code/nel/src/misc/input_device.cpp index 03e8f8c39..3825935a6 100644 --- a/code/nel/src/misc/input_device.cpp +++ b/code/nel/src/misc/input_device.cpp @@ -20,6 +20,10 @@ // remove stupid VC6 warnings void foo_input_device_cpp() {} +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/input_device_server.cpp b/code/nel/src/misc/input_device_server.cpp index 2b713d836..253b68e71 100644 --- a/code/nel/src/misc/input_device_server.cpp +++ b/code/nel/src/misc/input_device_server.cpp @@ -15,10 +15,14 @@ // along with this program. If not, see . #include "stdmisc.h" + #include "nel/misc/input_device_server.h" #include "nel/misc/input_device.h" +#include "nel/misc/debug.h" - +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/inter_window_msg_queue.cpp b/code/nel/src/misc/inter_window_msg_queue.cpp index 2526f1449..77e72e654 100644 --- a/code/nel/src/misc/inter_window_msg_queue.cpp +++ b/code/nel/src/misc/inter_window_msg_queue.cpp @@ -16,12 +16,16 @@ #include "stdmisc.h" -#ifdef NL_OS_WINDOWS #include "nel/misc/inter_window_msg_queue.h" -// + +#ifdef NL_OS_WINDOWS #include "nel/misc/mem_stream.h" #include "nel/misc/shared_memory.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/keyboard_device.cpp b/code/nel/src/misc/keyboard_device.cpp index 3fc0e07a1..4c7f353bc 100644 --- a/code/nel/src/misc/keyboard_device.cpp +++ b/code/nel/src/misc/keyboard_device.cpp @@ -18,6 +18,9 @@ //#include "nel/3d/u_keyboard_device.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NL3D { diff --git a/code/nel/src/misc/line.cpp b/code/nel/src/misc/line.cpp index b8148dfb5..aba33734c 100644 --- a/code/nel/src/misc/line.cpp +++ b/code/nel/src/misc/line.cpp @@ -18,6 +18,10 @@ #include "nel/misc/line.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/matrix.cpp b/code/nel/src/misc/matrix.cpp index 6fac71aa2..dd884f4d5 100644 --- a/code/nel/src/misc/matrix.cpp +++ b/code/nel/src/misc/matrix.cpp @@ -23,6 +23,9 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/md5.cpp b/code/nel/src/misc/md5.cpp index 363bc09f4..eaf9df6cc 100644 --- a/code/nel/src/misc/md5.cpp +++ b/code/nel/src/misc/md5.cpp @@ -52,6 +52,10 @@ documentation and/or software. using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { // **************************************************************************** diff --git a/code/nel/src/misc/mem_displayer.cpp b/code/nel/src/misc/mem_displayer.cpp index 1dc156913..52d399350 100644 --- a/code/nel/src/misc/mem_displayer.cpp +++ b/code/nel/src/misc/mem_displayer.cpp @@ -37,6 +37,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/mem_stream.cpp b/code/nel/src/misc/mem_stream.cpp index 7396dbbab..49e19f523 100644 --- a/code/nel/src/misc/mem_stream.cpp +++ b/code/nel/src/misc/mem_stream.cpp @@ -18,6 +18,10 @@ #include "nel/misc/mem_stream.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/mouse_smoother.cpp b/code/nel/src/misc/mouse_smoother.cpp index e8389119d..a92cbca6e 100644 --- a/code/nel/src/misc/mouse_smoother.cpp +++ b/code/nel/src/misc/mouse_smoother.cpp @@ -17,6 +17,10 @@ #include "stdmisc.h" #include "nel/misc/mouse_smoother.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/mutex.cpp b/code/nel/src/misc/mutex.cpp index fb337fab6..f8a75d2ea 100644 --- a/code/nel/src/misc/mutex.cpp +++ b/code/nel/src/misc/mutex.cpp @@ -22,6 +22,7 @@ #include "nel/misc/mutex.h" #include "nel/misc/time_nl.h" +#include "nel/misc/debug.h" using namespace std; @@ -47,6 +48,9 @@ using namespace std; #define NOMINMAX #include +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/noise_value.cpp b/code/nel/src/misc/noise_value.cpp index 5b6507be3..28fe24001 100644 --- a/code/nel/src/misc/noise_value.cpp +++ b/code/nel/src/misc/noise_value.cpp @@ -20,6 +20,9 @@ #include "nel/misc/fast_floor.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/o_xml.cpp b/code/nel/src/misc/o_xml.cpp index 1bd5d3d7b..005ef8000 100644 --- a/code/nel/src/misc/o_xml.cpp +++ b/code/nel/src/misc/o_xml.cpp @@ -25,6 +25,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/object_vector.cpp b/code/nel/src/misc/object_vector.cpp index c547dfc8d..7a863342b 100644 --- a/code/nel/src/misc/object_vector.cpp +++ b/code/nel/src/misc/object_vector.cpp @@ -23,6 +23,9 @@ void dummyToAvoidStupidCompilerWarning_misc_object_vector_cpp() { } +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/p_thread.cpp b/code/nel/src/misc/p_thread.cpp index ab5530342..e4deab4ca 100644 --- a/code/nel/src/misc/p_thread.cpp +++ b/code/nel/src/misc/p_thread.cpp @@ -24,6 +24,10 @@ #include #include +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { /* Key for thread specific storage holding IThread pointer. */ diff --git a/code/nel/src/misc/path.cpp b/code/nel/src/misc/path.cpp index bcef9bdeb..c59aabf0c 100644 --- a/code/nel/src/misc/path.cpp +++ b/code/nel/src/misc/path.cpp @@ -17,8 +17,8 @@ #include "stdmisc.h" -#include "nel/misc/big_file.h" #include "nel/misc/path.h" +#include "nel/misc/big_file.h" #include "nel/misc/hierarchical_timer.h" #include "nel/misc/progress_callback.h" #include "nel/misc/file.h" @@ -48,6 +48,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { // diff --git a/code/nel/src/misc/plane.cpp b/code/nel/src/misc/plane.cpp index 505a5cb62..7da917459 100644 --- a/code/nel/src/misc/plane.cpp +++ b/code/nel/src/misc/plane.cpp @@ -19,6 +19,9 @@ #include "nel/misc/plane.h" #include "nel/misc/uv.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/polygon.cpp b/code/nel/src/misc/polygon.cpp index 2942fb66b..b541d2eba 100644 --- a/code/nel/src/misc/polygon.cpp +++ b/code/nel/src/misc/polygon.cpp @@ -24,6 +24,9 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/progress_callback.cpp b/code/nel/src/misc/progress_callback.cpp index 965f25ec1..c4d4841ea 100644 --- a/code/nel/src/misc/progress_callback.cpp +++ b/code/nel/src/misc/progress_callback.cpp @@ -15,8 +15,13 @@ // along with this program. If not, see . #include "stdmisc.h" -#include "nel/misc/progress_callback.h" +#include "nel/misc/progress_callback.h" +#include "nel/misc/debug.h" + +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/quad.cpp b/code/nel/src/misc/quad.cpp index 6486bb5c1..8fced3318 100644 --- a/code/nel/src/misc/quad.cpp +++ b/code/nel/src/misc/quad.cpp @@ -24,6 +24,10 @@ void dummyToAvoidStupidCompilerWarning_misc_quad_cpp() { } +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/quat.cpp b/code/nel/src/misc/quat.cpp index 950870842..c1b441df9 100644 --- a/code/nel/src/misc/quat.cpp +++ b/code/nel/src/misc/quat.cpp @@ -18,6 +18,9 @@ #include "nel/misc/quat.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/reader_writer.cpp b/code/nel/src/misc/reader_writer.cpp index 22019aaa3..57c5c517d 100644 --- a/code/nel/src/misc/reader_writer.cpp +++ b/code/nel/src/misc/reader_writer.cpp @@ -18,6 +18,9 @@ #include "nel/misc/reader_writer.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/rect.cpp b/code/nel/src/misc/rect.cpp index 40acd9456..d4347b7e9 100644 --- a/code/nel/src/misc/rect.cpp +++ b/code/nel/src/misc/rect.cpp @@ -19,6 +19,9 @@ #include "nel/misc/rect.h" #include "nel/misc/vector_2f.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/report.cpp b/code/nel/src/misc/report.cpp index 1c7888a2c..64871e6a3 100644 --- a/code/nel/src/misc/report.cpp +++ b/code/nel/src/misc/report.cpp @@ -29,8 +29,14 @@ # include #endif // NL_OS_WINDOWS +#define NL_NO_DEBUG_FILES 1 + using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/rgba.cpp b/code/nel/src/misc/rgba.cpp index 1d7a88f6b..8075d78b2 100644 --- a/code/nel/src/misc/rgba.cpp +++ b/code/nel/src/misc/rgba.cpp @@ -21,6 +21,9 @@ #include "nel/misc/system_info.h" #include "nel/misc/common.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/sha1.cpp b/code/nel/src/misc/sha1.cpp index 64c94ee6f..19e8a440a 100644 --- a/code/nel/src/misc/sha1.cpp +++ b/code/nel/src/misc/sha1.cpp @@ -31,6 +31,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + // // Types // diff --git a/code/nel/src/misc/shared_memory.cpp b/code/nel/src/misc/shared_memory.cpp index 544ba882a..2a7f85a8b 100644 --- a/code/nel/src/misc/shared_memory.cpp +++ b/code/nel/src/misc/shared_memory.cpp @@ -15,7 +15,9 @@ // along with this program. If not, see . #include "stdmisc.h" + #include "nel/misc/shared_memory.h" +#include "nel/misc/debug.h" #ifdef NL_OS_WINDOWS # define NOMINMAX @@ -28,6 +30,9 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/sheet_id.cpp b/code/nel/src/misc/sheet_id.cpp index 9a9b8813f..7bc9c7c61 100644 --- a/code/nel/src/misc/sheet_id.cpp +++ b/code/nel/src/misc/sheet_id.cpp @@ -29,6 +29,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { CSheetId::CChar CSheetId::_AllStrings; diff --git a/code/nel/src/misc/smart_ptr.cpp b/code/nel/src/misc/smart_ptr.cpp index a85edfbe9..e5c31fcd7 100644 --- a/code/nel/src/misc/smart_ptr.cpp +++ b/code/nel/src/misc/smart_ptr.cpp @@ -18,6 +18,9 @@ #include "nel/misc/smart_ptr.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/stl_block_allocator.cpp b/code/nel/src/misc/stl_block_allocator.cpp index 3b519f736..f57d0c238 100644 --- a/code/nel/src/misc/stl_block_allocator.cpp +++ b/code/nel/src/misc/stl_block_allocator.cpp @@ -21,6 +21,9 @@ // remove stupid VC6 warnings void foo_stl_block_allocator_cpp() {} +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/stl_block_list.cpp b/code/nel/src/misc/stl_block_list.cpp index a4474d65f..628b79371 100644 --- a/code/nel/src/misc/stl_block_list.cpp +++ b/code/nel/src/misc/stl_block_list.cpp @@ -21,6 +21,10 @@ // remove stupid VC6 warnings void foo_stl_block_list_cpp() {} +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/stop_watch.cpp b/code/nel/src/misc/stop_watch.cpp index 420f29914..59b62150e 100644 --- a/code/nel/src/misc/stop_watch.cpp +++ b/code/nel/src/misc/stop_watch.cpp @@ -20,6 +20,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/stream.cpp b/code/nel/src/misc/stream.cpp index e592e4d4a..c652d6fe9 100644 --- a/code/nel/src/misc/stream.cpp +++ b/code/nel/src/misc/stream.cpp @@ -21,6 +21,9 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/string_common.cpp b/code/nel/src/misc/string_common.cpp index f06258893..dd8d1fe96 100644 --- a/code/nel/src/misc/string_common.cpp +++ b/code/nel/src/misc/string_common.cpp @@ -20,6 +20,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/string_id_array.cpp b/code/nel/src/misc/string_id_array.cpp index 5dfc5d318..b9489e3f9 100644 --- a/code/nel/src/misc/string_id_array.cpp +++ b/code/nel/src/misc/string_id_array.cpp @@ -24,6 +24,10 @@ void dummyToAvoidStupidCompilerWarning_misc_string_id_array_cpp() { } +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/string_mapper.cpp b/code/nel/src/misc/string_mapper.cpp index 9b896f206..cf8a38e49 100644 --- a/code/nel/src/misc/string_mapper.cpp +++ b/code/nel/src/misc/string_mapper.cpp @@ -20,6 +20,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/system_info.cpp b/code/nel/src/misc/system_info.cpp index a6c1c4bf3..7ef96ec58 100644 --- a/code/nel/src/misc/system_info.cpp +++ b/code/nel/src/misc/system_info.cpp @@ -16,6 +16,8 @@ #include "stdmisc.h" +#include "nel/misc/system_info.h" + #ifdef NL_OS_WINDOWS # define NOMINMAX # include @@ -42,6 +44,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { #ifdef NL_OS_UNIX diff --git a/code/nel/src/misc/system_utils.cpp b/code/nel/src/misc/system_utils.cpp index c62f0b46d..c60364741 100644 --- a/code/nel/src/misc/system_utils.cpp +++ b/code/nel/src/misc/system_utils.cpp @@ -28,6 +28,10 @@ #endif #endif +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + using namespace std; // Key in registry diff --git a/code/nel/src/misc/task_manager.cpp b/code/nel/src/misc/task_manager.cpp index 13af3e4ac..4cdb16bd0 100644 --- a/code/nel/src/misc/task_manager.cpp +++ b/code/nel/src/misc/task_manager.cpp @@ -23,6 +23,10 @@ using namespace std; #define NLMISC_DONE_TASK_SIZE 20 +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { /* diff --git a/code/nel/src/misc/tds.cpp b/code/nel/src/misc/tds.cpp index bfc3b6af0..13105f98d 100644 --- a/code/nel/src/misc/tds.cpp +++ b/code/nel/src/misc/tds.cpp @@ -17,12 +17,17 @@ #include "stdmisc.h" #include "nel/misc/tds.h" +#include "nel/misc/debug.h" #ifdef NL_OS_WINDOWS # define NOMINMAX # include #endif // NL_OS_WINDOWS +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/time_nl.cpp b/code/nel/src/misc/time_nl.cpp index 422ba192f..0ba60c8e2 100644 --- a/code/nel/src/misc/time_nl.cpp +++ b/code/nel/src/misc/time_nl.cpp @@ -16,6 +16,10 @@ #include "stdmisc.h" +#include "nel/misc/time_nl.h" +#include "nel/misc/sstring.h" +#include "nel/misc/thread.h" + #ifdef NL_OS_WINDOWS # define NOMINMAX # include @@ -29,10 +33,9 @@ #include #endif -#include "nel/misc/time_nl.h" -#include "nel/misc/sstring.h" - -#include +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/triangle.cpp b/code/nel/src/misc/triangle.cpp index 3fcde2ec9..234eb0506 100644 --- a/code/nel/src/misc/triangle.cpp +++ b/code/nel/src/misc/triangle.cpp @@ -20,6 +20,9 @@ #include "nel/misc/plane.h" #include "nel/misc/matrix.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/unicode.cpp b/code/nel/src/misc/unicode.cpp index ac58580ee..00bf6a226 100644 --- a/code/nel/src/misc/unicode.cpp +++ b/code/nel/src/misc/unicode.cpp @@ -17,6 +17,10 @@ #include "stdmisc.h" #include "nel/misc/ucstring.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/uv.cpp b/code/nel/src/misc/uv.cpp index f25643300..9926efcc7 100644 --- a/code/nel/src/misc/uv.cpp +++ b/code/nel/src/misc/uv.cpp @@ -24,6 +24,10 @@ void dummyToAvoidStupidCompilerWarning_misc_uv_cpp() { } +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/variable.cpp b/code/nel/src/misc/variable.cpp index 48c775c9c..16953f990 100644 --- a/code/nel/src/misc/variable.cpp +++ b/code/nel/src/misc/variable.cpp @@ -21,6 +21,10 @@ using namespace std; using namespace NLMISC; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/vector.cpp b/code/nel/src/misc/vector.cpp index 7230a75c6..dc64925b7 100644 --- a/code/nel/src/misc/vector.cpp +++ b/code/nel/src/misc/vector.cpp @@ -20,6 +20,9 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/vector_2d.cpp b/code/nel/src/misc/vector_2d.cpp index 5ab0ffdec..939e41239 100644 --- a/code/nel/src/misc/vector_2d.cpp +++ b/code/nel/src/misc/vector_2d.cpp @@ -24,6 +24,10 @@ void dummyToAvoidStupidCompilerWarning_misc_vector_2d_cpp() { } +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/vector_2f.cpp b/code/nel/src/misc/vector_2f.cpp index 0e9621601..08bd0d096 100644 --- a/code/nel/src/misc/vector_2f.cpp +++ b/code/nel/src/misc/vector_2f.cpp @@ -18,6 +18,9 @@ #include "nel/misc/vector_2f.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/vector_h.cpp b/code/nel/src/misc/vector_h.cpp index 528f5f4cc..67eb41f6b 100644 --- a/code/nel/src/misc/vector_h.cpp +++ b/code/nel/src/misc/vector_h.cpp @@ -24,6 +24,10 @@ void dummyToAvoidStupidCompilerWarning_misc_vector_h_cpp() { } +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/vectord.cpp b/code/nel/src/misc/vectord.cpp index 1273f190a..aa14a3828 100644 --- a/code/nel/src/misc/vectord.cpp +++ b/code/nel/src/misc/vectord.cpp @@ -18,6 +18,9 @@ #include "nel/misc/vectord.h" +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/win32_util.cpp b/code/nel/src/misc/win32_util.cpp index 17601797b..63315e1b2 100644 --- a/code/nel/src/misc/win32_util.cpp +++ b/code/nel/src/misc/win32_util.cpp @@ -22,6 +22,10 @@ #include +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { diff --git a/code/nel/src/misc/win_displayer.cpp b/code/nel/src/misc/win_displayer.cpp index d016b4106..f5c0d9545 100644 --- a/code/nel/src/misc/win_displayer.cpp +++ b/code/nel/src/misc/win_displayer.cpp @@ -15,6 +15,7 @@ // along with this program. If not, see . #include "stdmisc.h" +#include "nel/misc/win_displayer.h" #ifdef NL_OS_WINDOWS @@ -33,10 +34,12 @@ #include "nel/misc/thread.h" #include "nel/misc/ucstring.h" -#include "nel/misc/win_displayer.h" - using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { static CHARFORMAT2 CharFormat; diff --git a/code/nel/src/misc/win_event_emitter.cpp b/code/nel/src/misc/win_event_emitter.cpp index cf3ff2197..b330d7e57 100644 --- a/code/nel/src/misc/win_event_emitter.cpp +++ b/code/nel/src/misc/win_event_emitter.cpp @@ -32,6 +32,9 @@ */ #include +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/misc/win_thread.cpp b/code/nel/src/misc/win_thread.cpp index eec462d3c..d90d081ff 100644 --- a/code/nel/src/misc/win_thread.cpp +++ b/code/nel/src/misc/win_thread.cpp @@ -15,16 +15,20 @@ // along with this program. If not, see . #include "stdmisc.h" +#include "nel/misc/win_thread.h" #ifdef NL_OS_WINDOWS -#include "nel/misc/win_thread.h" #include "nel/misc/path.h" #define NOMINMAX #include #include +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { CWinThread MainThread ((void*)GetCurrentThread (), GetCurrentThreadId()); diff --git a/code/nel/src/misc/window_displayer.cpp b/code/nel/src/misc/window_displayer.cpp index f54c82505..5c9227933 100644 --- a/code/nel/src/misc/window_displayer.cpp +++ b/code/nel/src/misc/window_displayer.cpp @@ -24,6 +24,10 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { class CUpdateThread : public IRunnable diff --git a/code/nel/src/misc/words_dictionary.cpp b/code/nel/src/misc/words_dictionary.cpp index f35c41abe..e2113e62d 100644 --- a/code/nel/src/misc/words_dictionary.cpp +++ b/code/nel/src/misc/words_dictionary.cpp @@ -25,6 +25,10 @@ using namespace std; const string DefaultColTitle = "name"; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif + namespace NLMISC { NL_INSTANCE_COUNTER_IMPL(CWordsDictionary); diff --git a/code/nel/src/misc/xml_pack.cpp b/code/nel/src/misc/xml_pack.cpp index feab06775..4494be062 100644 --- a/code/nel/src/misc/xml_pack.cpp +++ b/code/nel/src/misc/xml_pack.cpp @@ -20,6 +20,9 @@ using namespace std; +#ifdef DEBUG_NEW + #define new DEBUG_NEW +#endif namespace NLMISC { diff --git a/code/nel/src/net/login_server.cpp b/code/nel/src/net/login_server.cpp index 736f0f7ef..5bd6dfd34 100644 --- a/code/nel/src/net/login_server.cpp +++ b/code/nel/src/net/login_server.cpp @@ -53,7 +53,7 @@ static string ListenAddr; static bool AcceptInvalidCookie = false; -static string DefaultUserPriv = ""; +static string DefaultUserPriv; static TDisconnectClientCallback DisconnectClientCallback = NULL; diff --git a/code/nel/src/pacs/build_indoor.cpp b/code/nel/src/pacs/build_indoor.cpp index 51dbdf4c0..b4bad19a6 100644 --- a/code/nel/src/pacs/build_indoor.cpp +++ b/code/nel/src/pacs/build_indoor.cpp @@ -15,11 +15,11 @@ // along with this program. If not, see . #include "stdpacs.h" -#include "build_indoor.h" +#include "nel/pacs/build_indoor.h" -#include "collision_mesh_build.h" -#include "local_retriever.h" -#include "exterior_mesh.h" +#include "nel/pacs/collision_mesh_build.h" +#include "nel/pacs/local_retriever.h" +#include "nel/pacs/exterior_mesh.h" using namespace std; using namespace NLMISC; diff --git a/code/nel/src/pacs/chain.cpp b/code/nel/src/pacs/chain.cpp index 1543d68ab..f908cc875 100644 --- a/code/nel/src/pacs/chain.cpp +++ b/code/nel/src/pacs/chain.cpp @@ -16,7 +16,7 @@ #include "stdpacs.h" -#include "chain.h" +#include "nel/pacs/chain.h" using namespace std; using namespace NLMISC; diff --git a/code/nel/src/pacs/chain_quad.cpp b/code/nel/src/pacs/chain_quad.cpp index 29468fa1f..321761953 100644 --- a/code/nel/src/pacs/chain_quad.cpp +++ b/code/nel/src/pacs/chain_quad.cpp @@ -16,7 +16,7 @@ #include "stdpacs.h" -#include "chain_quad.h" +#include "nel/pacs/chain_quad.h" using namespace std; using namespace NLMISC; diff --git a/code/nel/src/pacs/collision_callback.cpp b/code/nel/src/pacs/collision_callback.cpp index 2d5fc2485..016cda262 100644 --- a/code/nel/src/pacs/collision_callback.cpp +++ b/code/nel/src/pacs/collision_callback.cpp @@ -16,7 +16,7 @@ #include "stdpacs.h" -#include "collision_callback.h" +#include "nel/pacs/collision_callback.h" namespace NLPACS diff --git a/code/nel/src/pacs/collision_desc.cpp b/code/nel/src/pacs/collision_desc.cpp index e501dd716..c38049623 100644 --- a/code/nel/src/pacs/collision_desc.cpp +++ b/code/nel/src/pacs/collision_desc.cpp @@ -16,7 +16,7 @@ #include "stdpacs.h" -#include "collision_desc.h" +#include "nel/pacs/collision_desc.h" namespace NLPACS diff --git a/code/nel/src/pacs/collision_ot.cpp b/code/nel/src/pacs/collision_ot.cpp index 95f15359c..74f93f498 100644 --- a/code/nel/src/pacs/collision_ot.cpp +++ b/code/nel/src/pacs/collision_ot.cpp @@ -16,8 +16,8 @@ #include "stdpacs.h" -#include "collision_ot.h" -#include "move_primitive.h" +#include "nel/pacs/collision_ot.h" +#include "nel/pacs/move_primitive.h" namespace NLPACS diff --git a/code/nel/src/pacs/collision_surface_temp.cpp b/code/nel/src/pacs/collision_surface_temp.cpp index 92f869c2c..4033cc33f 100644 --- a/code/nel/src/pacs/collision_surface_temp.cpp +++ b/code/nel/src/pacs/collision_surface_temp.cpp @@ -16,7 +16,7 @@ #include "stdpacs.h" -#include "collision_surface_temp.h" +#include "nel/pacs/collision_surface_temp.h" namespace NLPACS diff --git a/code/nel/src/pacs/edge_collide.cpp b/code/nel/src/pacs/edge_collide.cpp index f785e97db..700935947 100644 --- a/code/nel/src/pacs/edge_collide.cpp +++ b/code/nel/src/pacs/edge_collide.cpp @@ -16,7 +16,7 @@ #include "stdpacs.h" -#include "edge_collide.h" +#include "nel/pacs/edge_collide.h" using namespace NLMISC; using namespace std; diff --git a/code/nel/src/pacs/edge_quad.cpp b/code/nel/src/pacs/edge_quad.cpp index 9bd60b54b..1515af075 100644 --- a/code/nel/src/pacs/edge_quad.cpp +++ b/code/nel/src/pacs/edge_quad.cpp @@ -16,8 +16,8 @@ #include "stdpacs.h" -#include "edge_quad.h" -#include "global_retriever.h" +#include "nel/pacs/edge_quad.h" +#include "nel/pacs/global_retriever.h" using namespace std; using namespace NLMISC; diff --git a/code/nel/src/pacs/exterior_mesh.cpp b/code/nel/src/pacs/exterior_mesh.cpp index a53873e77..d7c72c96f 100644 --- a/code/nel/src/pacs/exterior_mesh.cpp +++ b/code/nel/src/pacs/exterior_mesh.cpp @@ -16,9 +16,9 @@ #include "stdpacs.h" -#include "exterior_mesh.h" -#include "local_retriever.h" -#include "collision_desc.h" +#include "nel/pacs/exterior_mesh.h" +#include "nel/pacs/local_retriever.h" +#include "nel/pacs/collision_desc.h" using namespace std; diff --git a/code/nel/src/pacs/global_retriever.cpp b/code/nel/src/pacs/global_retriever.cpp index b21b199ec..115fac0e6 100644 --- a/code/nel/src/pacs/global_retriever.cpp +++ b/code/nel/src/pacs/global_retriever.cpp @@ -16,8 +16,8 @@ #include "stdpacs.h" -#include "global_retriever.h" -#include "retriever_bank.h" +#include "nel/pacs/global_retriever.h" +#include "nel/pacs/retriever_bank.h" #include "nel/misc/async_file_manager.h" #include "nel/misc/common.h" diff --git a/code/nel/src/pacs/local_retriever.cpp b/code/nel/src/pacs/local_retriever.cpp index af087219f..7158cee0a 100644 --- a/code/nel/src/pacs/local_retriever.cpp +++ b/code/nel/src/pacs/local_retriever.cpp @@ -18,9 +18,9 @@ #include "nel/misc/plane.h" -#include "local_retriever.h" -#include "collision_desc.h" -#include "retriever_instance.h" +#include "nel/pacs/local_retriever.h" +#include "nel/pacs/collision_desc.h" +#include "nel/pacs/retriever_instance.h" #include "nel/misc/hierarchical_timer.h" diff --git a/code/nel/src/pacs/move_cell.cpp b/code/nel/src/pacs/move_cell.cpp index 2dcb1d987..436808754 100644 --- a/code/nel/src/pacs/move_cell.cpp +++ b/code/nel/src/pacs/move_cell.cpp @@ -16,9 +16,9 @@ #include "stdpacs.h" -#include "move_cell.h" -#include "move_element.h" -#include "move_primitive.h" +#include "nel/pacs/move_cell.h" +#include "nel/pacs/move_element.h" +#include "nel/pacs/move_primitive.h" namespace NLPACS { diff --git a/code/nel/src/pacs/move_container.cpp b/code/nel/src/pacs/move_container.cpp index 6e456a9e1..93e05794a 100644 --- a/code/nel/src/pacs/move_container.cpp +++ b/code/nel/src/pacs/move_container.cpp @@ -16,9 +16,9 @@ #include "stdpacs.h" -#include "move_primitive.h" -#include "move_element.h" -#include "primitive_block.h" +#include "nel/pacs/move_primitive.h" +#include "nel/pacs/move_element.h" +#include "nel/pacs/primitive_block.h" #include "nel/misc/hierarchical_timer.h" diff --git a/code/nel/src/pacs/move_element.cpp b/code/nel/src/pacs/move_element.cpp index e21162ab8..b64285769 100644 --- a/code/nel/src/pacs/move_element.cpp +++ b/code/nel/src/pacs/move_element.cpp @@ -16,8 +16,8 @@ #include "stdpacs.h" -#include "move_element.h" -#include "move_element_inline.h" +#include "nel/pacs/move_element.h" +#include "nel/pacs/move_element_inline.h" // leave not static else this workaround don't work diff --git a/code/nel/src/pacs/move_primitive.cpp b/code/nel/src/pacs/move_primitive.cpp index 661ffa1a4..08da7ac38 100644 --- a/code/nel/src/pacs/move_primitive.cpp +++ b/code/nel/src/pacs/move_primitive.cpp @@ -16,9 +16,9 @@ #include "stdpacs.h" -#include "move_primitive.h" -#include "collision_desc.h" -#include "move_element.h" +#include "nel/pacs/move_primitive.h" +#include "nel/pacs/collision_desc.h" +#include "nel/pacs/move_element.h" #include "nel/misc/hierarchical_timer.h" using namespace NLMISC; diff --git a/code/nel/src/pacs/primitive_block_pacs.cpp b/code/nel/src/pacs/primitive_block_pacs.cpp index 8cbf47c39..0681d2eea 100644 --- a/code/nel/src/pacs/primitive_block_pacs.cpp +++ b/code/nel/src/pacs/primitive_block_pacs.cpp @@ -16,7 +16,7 @@ #include "stdpacs.h" #include "nel/misc/i_xml.h" -#include "primitive_block.h" +#include "nel/pacs/primitive_block.h" namespace NLPACS diff --git a/code/nel/src/pacs/primitive_world_image.cpp b/code/nel/src/pacs/primitive_world_image.cpp index 050b8dd9f..e8d0378e6 100644 --- a/code/nel/src/pacs/primitive_world_image.cpp +++ b/code/nel/src/pacs/primitive_world_image.cpp @@ -18,9 +18,9 @@ #include "nel/misc/hierarchical_timer.h" -#include "primitive_world_image.h" -#include "move_primitive.h" -#include "move_element.h" +#include "nel/pacs/primitive_world_image.h" +#include "nel/pacs/move_primitive.h" +#include "nel/pacs/move_element.h" using namespace NLMISC; diff --git a/code/nel/src/pacs/retrievable_surface.cpp b/code/nel/src/pacs/retrievable_surface.cpp index 65ce01e55..308034083 100644 --- a/code/nel/src/pacs/retrievable_surface.cpp +++ b/code/nel/src/pacs/retrievable_surface.cpp @@ -16,7 +16,7 @@ #include "stdpacs.h" -#include "retrievable_surface.h" +#include "nel/pacs/retrievable_surface.h" using namespace std; using namespace NLMISC; diff --git a/code/nel/src/pacs/retriever_bank.cpp b/code/nel/src/pacs/retriever_bank.cpp index ab98323ad..03691aca2 100644 --- a/code/nel/src/pacs/retriever_bank.cpp +++ b/code/nel/src/pacs/retriever_bank.cpp @@ -20,7 +20,7 @@ #include "nel/misc/path.h" #include "nel/misc/progress_callback.h" -#include "retriever_bank.h" +#include "nel/pacs/retriever_bank.h" using namespace std; using namespace NLMISC; diff --git a/code/nel/src/pacs/retriever_instance.cpp b/code/nel/src/pacs/retriever_instance.cpp index 04b902ef9..d5d96510c 100644 --- a/code/nel/src/pacs/retriever_instance.cpp +++ b/code/nel/src/pacs/retriever_instance.cpp @@ -16,8 +16,8 @@ #include "stdpacs.h" -#include "retriever_instance.h" -#include "global_retriever.h" +#include "nel/pacs/retriever_instance.h" +#include "nel/pacs/global_retriever.h" using namespace std; using namespace NLMISC; diff --git a/code/nel/src/pacs/surface_quad.cpp b/code/nel/src/pacs/surface_quad.cpp index a7d22e1c2..dade8462c 100644 --- a/code/nel/src/pacs/surface_quad.cpp +++ b/code/nel/src/pacs/surface_quad.cpp @@ -15,7 +15,7 @@ // along with this program. If not, see . #include "stdpacs.h" -#include "surface_quad.h" +#include "nel/pacs/surface_quad.h" #include "nel/misc/file.h" diff --git a/code/nel/src/pacs/vector_2s.cpp b/code/nel/src/pacs/vector_2s.cpp index f63ba0c72..57e635f5d 100644 --- a/code/nel/src/pacs/vector_2s.cpp +++ b/code/nel/src/pacs/vector_2s.cpp @@ -16,7 +16,7 @@ #include "stdpacs.h" -#include "vector_2s.h" +#include "nel/pacs/vector_2s.h" namespace NLPACS { diff --git a/code/nel/src/sound/CMakeLists.txt b/code/nel/src/sound/CMakeLists.txt index 9d2e0dd82..2cf570f69 100644 --- a/code/nel/src/sound/CMakeLists.txt +++ b/code/nel/src/sound/CMakeLists.txt @@ -1,4 +1,3 @@ - FILE(GLOB SRC *.cpp *.h) FILE(GLOB HEADERS ../../include/nel/sound/*.h) diff --git a/code/nel/src/sound/audio_mixer_user.cpp b/code/nel/src/sound/audio_mixer_user.cpp index da3c7d177..3a75433f4 100644 --- a/code/nel/src/sound/audio_mixer_user.cpp +++ b/code/nel/src/sound/audio_mixer_user.cpp @@ -35,7 +35,6 @@ #include "nel/sound/driver/buffer.h" #include "nel/sound/driver/effect.h" -#include "nel/sound/background_sound_manager.h" #include "nel/sound/background_sound_manager.h" #include "nel/sound/music_sound_manager.h" #include "nel/sound/background_source.h" diff --git a/code/nel/src/sound/background_source.cpp b/code/nel/src/sound/background_source.cpp index b6177999d..d8cb4a7a4 100644 --- a/code/nel/src/sound/background_source.cpp +++ b/code/nel/src/sound/background_source.cpp @@ -16,7 +16,6 @@ #include "stdsound.h" #include "nel/sound/background_sound_manager.h" - #include "nel/sound/background_source.h" using namespace std; diff --git a/code/nel/src/sound/driver/dsound/buffer_dsound.h b/code/nel/src/sound/driver/dsound/buffer_dsound.h index 0a1b100c5..fed09c413 100644 --- a/code/nel/src/sound/driver/dsound/buffer_dsound.h +++ b/code/nel/src/sound/driver/dsound/buffer_dsound.h @@ -17,7 +17,7 @@ #ifndef NL_BUFFER_DSOUND_H #define NL_BUFFER_DSOUND_H -#include +#include "nel/sound/driver/buffer.h" namespace NLSOUND { diff --git a/code/nel/src/sound/driver/dsound/listener_dsound.h b/code/nel/src/sound/driver/dsound/listener_dsound.h index 33e97a66b..fe8872cc2 100644 --- a/code/nel/src/sound/driver/dsound/listener_dsound.h +++ b/code/nel/src/sound/driver/dsound/listener_dsound.h @@ -17,7 +17,7 @@ #ifndef NL_LISTENER_DSOUND_H #define NL_LISTENER_DSOUND_H -#include +#include "nel/sound/driver/listener.h" namespace NLSOUND { diff --git a/code/nel/src/sound/driver/dsound/sound_driver_dsound.h b/code/nel/src/sound/driver/dsound/sound_driver_dsound.h index b094776f0..14872c1e1 100644 --- a/code/nel/src/sound/driver/dsound/sound_driver_dsound.h +++ b/code/nel/src/sound/driver/dsound/sound_driver_dsound.h @@ -17,7 +17,7 @@ #ifndef NL_SOUND_DRIVER_DSOUND_H #define NL_SOUND_DRIVER_DSOUND_H -#include +#include "nel/sound/driver/sound_driver.h" #include "source_dsound.h" #include "buffer_dsound.h" diff --git a/code/nel/src/sound/driver/dsound/source_dsound.cpp b/code/nel/src/sound/driver/dsound/source_dsound.cpp index 2ef01f8c4..c3bff3289 100644 --- a/code/nel/src/sound/driver/dsound/source_dsound.cpp +++ b/code/nel/src/sound/driver/dsound/source_dsound.cpp @@ -616,7 +616,6 @@ void CSourceDSound::fadeOut(const TLockedBufferInfo &lbi) ptr = lbi.Ptr2; count = lbi.Size2/2; - while (fade && count) { alpha = (fade<<16) / _XFadeSize; diff --git a/code/nel/src/sound/driver/dsound/source_dsound.h b/code/nel/src/sound/driver/dsound/source_dsound.h index 86130c800..81174c1a0 100644 --- a/code/nel/src/sound/driver/dsound/source_dsound.h +++ b/code/nel/src/sound/driver/dsound/source_dsound.h @@ -17,9 +17,9 @@ #ifndef NL_SOURCE_DSOUND_H #define NL_SOURCE_DSOUND_H -#include -#include -#include +#include "nel/sound/driver/source.h" +#include "nel/sound/driver/sound_driver.h" +#include "nel/sound/driver/buffer.h" namespace NLSOUND { diff --git a/code/nel/src/sound/driver/fmod/buffer_fmod.h b/code/nel/src/sound/driver/fmod/buffer_fmod.h index 1678fb426..64d8cf592 100644 --- a/code/nel/src/sound/driver/fmod/buffer_fmod.h +++ b/code/nel/src/sound/driver/fmod/buffer_fmod.h @@ -18,7 +18,7 @@ #define NL_BUFFER_FMOD_H -#include +#include "nel/sound/driver/buffer.h" namespace NLSOUND { diff --git a/code/nel/src/sound/driver/fmod/music_channel_fmod.h b/code/nel/src/sound/driver/fmod/music_channel_fmod.h index abaa9c510..28ffef6ce 100644 --- a/code/nel/src/sound/driver/fmod/music_channel_fmod.h +++ b/code/nel/src/sound/driver/fmod/music_channel_fmod.h @@ -17,7 +17,7 @@ #ifndef NL_MUSIC_CHANNEL_FMOD_H #define NL_MUSIC_CHANNEL_FMOD_H -#include +#include "nel/sound/driver/music_channel.h" struct FSOUND_STREAM; diff --git a/code/nel/src/sound/driver/fmod/sound_driver_fmod.h b/code/nel/src/sound/driver/fmod/sound_driver_fmod.h index bcf75ece6..8beabe562 100644 --- a/code/nel/src/sound/driver/fmod/sound_driver_fmod.h +++ b/code/nel/src/sound/driver/fmod/sound_driver_fmod.h @@ -17,7 +17,7 @@ #ifndef NL_SOUND_DRIVER_FMOD_H #define NL_SOUND_DRIVER_FMOD_H -#include +#include "nel/sound/driver/sound_driver.h" namespace NLSOUND { class IListener; diff --git a/code/nel/src/sound/driver/fmod/source_fmod.h b/code/nel/src/sound/driver/fmod/source_fmod.h index 34e3168d0..a8ef4fb57 100644 --- a/code/nel/src/sound/driver/fmod/source_fmod.h +++ b/code/nel/src/sound/driver/fmod/source_fmod.h @@ -17,9 +17,9 @@ #ifndef NL_SOURCE_FMOD_H #define NL_SOURCE_FMOD_H -#include -#include -#include +#include "nel/sound/driver/source.h" +#include "nel/sound/driver/sound_driver.h" +#include "nel/sound/driver/buffer.h" namespace NLSOUND { class CBufferFMod; diff --git a/code/nel/src/sound/driver/fmod/stdfmod.h b/code/nel/src/sound/driver/fmod/stdfmod.h index 9afe2bef1..afb1af3f1 100644 --- a/code/nel/src/sound/driver/fmod/stdfmod.h +++ b/code/nel/src/sound/driver/fmod/stdfmod.h @@ -24,22 +24,22 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "nel/misc/common.h" +#include "nel/misc/time_nl.h" +#include "nel/misc/singleton.h" +#include "nel/misc/fast_mem.h" +#include "nel/misc/debug.h" +#include "nel/misc/vector.h" +#include "nel/misc/path.h" +#include "nel/misc/file.h" +#include "nel/misc/matrix.h" +#include "nel/misc/big_file.h" +#include "nel/misc/hierarchical_timer.h" +#include "nel/misc/dynloadlib.h" -#include -#include -#include -#include +#include "nel/sound/driver/sound_driver.h" +#include "nel/sound/driver/buffer.h" +#include "nel/sound/driver/source.h" +#include "nel/sound/driver/listener.h" /* end of file */ diff --git a/code/nel/src/sound/driver/openal/buffer_al.cpp b/code/nel/src/sound/driver/openal/buffer_al.cpp index 7714abc67..b63e39fa2 100644 --- a/code/nel/src/sound/driver/openal/buffer_al.cpp +++ b/code/nel/src/sound/driver/openal/buffer_al.cpp @@ -117,10 +117,10 @@ bool CBufferAL::unlock(uint size) _DataPtr = NULL; _Capacity = 0; } - + // Error handling if (alGetError() == AL_NO_ERROR) - _IsLoaded = true; + _IsLoaded = true; // ->lock() set it to false return _IsLoaded; } @@ -159,10 +159,9 @@ bool CBufferAL::fill(const uint8 *src, uint size) // Fill buffer (OpenAL one) alBufferData(_BufferName, _SampleFormat, src, size, _Frequency); - + // Error handling - if (alGetError() == AL_NO_ERROR) - _IsLoaded = true; + _IsLoaded = (alGetError() == AL_NO_ERROR); return _IsLoaded; } diff --git a/code/nel/src/sound/driver/openal/buffer_al.h b/code/nel/src/sound/driver/openal/buffer_al.h index 4564f5be3..b2abf2036 100644 --- a/code/nel/src/sound/driver/openal/buffer_al.h +++ b/code/nel/src/sound/driver/openal/buffer_al.h @@ -17,7 +17,7 @@ #ifndef NL_BUFFER_AL_H #define NL_BUFFER_AL_H -#include +#include "nel/sound/driver/buffer.h" namespace NLSOUND { diff --git a/code/nel/src/sound/driver/openal/sound_driver_al.h b/code/nel/src/sound/driver/openal/sound_driver_al.h index 49150f31e..a58d5418e 100644 --- a/code/nel/src/sound/driver/openal/sound_driver_al.h +++ b/code/nel/src/sound/driver/openal/sound_driver_al.h @@ -17,7 +17,7 @@ #ifndef NL_SOUND_DRIVER_AL_H #define NL_SOUND_DRIVER_AL_H -#include +#include "nel/sound/driver/sound_driver.h" namespace NLSOUND { class CBufferAL; @@ -126,7 +126,7 @@ public: virtual void startBench(); virtual void endBench(); - virtual void displayBench(NLMISC::CLog * /* log */); + virtual void displayBench(NLMISC::CLog *log); /// Change the rolloff factor and apply to all sources @@ -136,7 +136,7 @@ public: virtual void commit3DChanges(); /// Write information about the driver to the output stream. - virtual void writeProfile(std::string& /* out */); + virtual void writeProfile(std::string& out); /// Remove a buffer void removeBuffer(CBufferAL *buffer); diff --git a/code/nel/src/sound/driver/openal/source_al.cpp b/code/nel/src/sound/driver/openal/source_al.cpp index 4d5bcfa47..1f8d2219f 100644 --- a/code/nel/src/sound/driver/openal/source_al.cpp +++ b/code/nel/src/sound/driver/openal/source_al.cpp @@ -162,6 +162,13 @@ void CSourceAL::submitStreamingBuffer(IBuffer *buffer) CBufferAL *bufferAL = static_cast(buffer); ALuint bufferName = bufferAL->bufferName(); nlassert(bufferName); + + if (!bufferAL->isBufferLoaded()) + { + nlwarning("AL: MUSICBUG: Streaming buffer was not loaded, skipping buffer. This should not happen."); + return; + } + alSourceQueueBuffers(_Source, 1, &bufferName); alTestError(); _QueuedBuffers.push(bufferAL); @@ -242,11 +249,31 @@ bool CSourceAL::play() else if (_IsStreaming) { _IsPaused = false; + /* NEW */ + // called by user as well as by code to resume after buffer underrun + if (!_IsPlaying) // set start time if not playing yet + _StartTime = CTime::getLocalTime(); + _IsPlaying = true; // this play always virtually succeed but may not actually be playing + if (_QueuedBuffers.size()) // ensure buffers have actually queued + { + alSourcePlay(_Source); + if (alGetError() != AL_NO_ERROR) + { + nlwarning("AL: MUSICBUG: Unknown error while trying to play streaming source."); + } + } + else + { + nlwarning("AL: MUSICBUG: Trying to play stream with no buffers queued."); + } + return true; + /* OLD alSourcePlay(_Source); _IsPlaying = (alGetError() == AL_NO_ERROR); if (_IsPlaying) _StartTime = CTime::getLocalTime(); // TODO: Played time should freeze when buffering fails, and be calculated based on the number of buffers played plus passed time. This is necessary for synchronizing animation with sound. return _IsPlaying; + */ // Streaming mode //nlwarning("AL: Cannot play null buffer; streaming not implemented" ); //nlstop; @@ -375,7 +402,7 @@ bool CSourceAL::isPaused() const uint32 CSourceAL::getTime() { if (!_StartTime) return 0; - return (uint32)(CTime::getLocalTime() - _StartTime); + return (uint32)(CTime::getLocalTime() - _StartTime); } /// Set the position vector. diff --git a/code/nel/src/sound/driver/openal/source_al.h b/code/nel/src/sound/driver/openal/source_al.h index d3c08bf41..22cb3d67d 100644 --- a/code/nel/src/sound/driver/openal/source_al.h +++ b/code/nel/src/sound/driver/openal/source_al.h @@ -17,7 +17,7 @@ #ifndef NL_SOURCE_AL_H #define NL_SOURCE_AL_H -#include +#include "nel/sound/driver/source.h" namespace NLSOUND { class IBuffer; diff --git a/code/nel/src/sound/driver/xaudio2/adpcm_xaudio2.h b/code/nel/src/sound/driver/xaudio2/adpcm_xaudio2.h index 19a1b0486..6655c57a8 100644 --- a/code/nel/src/sound/driver/xaudio2/adpcm_xaudio2.h +++ b/code/nel/src/sound/driver/xaudio2/adpcm_xaudio2.h @@ -17,7 +17,7 @@ #ifndef NLSOUND_ADPCM_XAUDIO2_H #define NLSOUND_ADPCM_XAUDIO2_H -#include +#include "nel/sound/driver/buffer.h" namespace NLSOUND { class CBufferXAudio2; diff --git a/code/nel/src/sound/driver/xaudio2/buffer_xaudio2.h b/code/nel/src/sound/driver/xaudio2/buffer_xaudio2.h index 54f802978..0094494ed 100644 --- a/code/nel/src/sound/driver/xaudio2/buffer_xaudio2.h +++ b/code/nel/src/sound/driver/xaudio2/buffer_xaudio2.h @@ -17,7 +17,7 @@ #ifndef NLSOUND_BUFFER_XAUDIO2_H #define NLSOUND_BUFFER_XAUDIO2_H -#include +#include "nel/sound/driver/buffer.h" namespace NLSOUND { class CSoundDriverXAudio2; diff --git a/code/nel/src/sound/driver/xaudio2/listener_xaudio2.h b/code/nel/src/sound/driver/xaudio2/listener_xaudio2.h index 146611de9..10a39ffe5 100644 --- a/code/nel/src/sound/driver/xaudio2/listener_xaudio2.h +++ b/code/nel/src/sound/driver/xaudio2/listener_xaudio2.h @@ -17,8 +17,8 @@ #ifndef NLSOUND_LISTENER_XAUDIO2_H #define NLSOUND_LISTENER_XAUDIO2_H -#include -#include +#include "nel/sound/driver/listener.h" +#include "nel/sound/driver/sound_driver.h" namespace NLSOUND { class CSoundDriverXAudio2; diff --git a/code/nel/src/sound/driver/xaudio2/source_xaudio2.h b/code/nel/src/sound/driver/xaudio2/source_xaudio2.h index f5050c12f..a2d542349 100644 --- a/code/nel/src/sound/driver/xaudio2/source_xaudio2.h +++ b/code/nel/src/sound/driver/xaudio2/source_xaudio2.h @@ -17,9 +17,9 @@ #ifndef NLSOUND_SOURCE_XAUDIO2_H #define NLSOUND_SOURCE_XAUDIO2_H -#include -#include -#include +#include "nel/sound/driver/source.h" +#include "nel/sound/driver/sound_driver.h" +#include "nel/sound/driver/buffer.h" namespace NLSOUND { class CSoundDriverXAudio2; diff --git a/code/nel/tools/3d/ig_lighter/ig_lighter.cpp b/code/nel/tools/3d/ig_lighter/ig_lighter.cpp index 3041d3b49..a243ad7bc 100644 --- a/code/nel/tools/3d/ig_lighter/ig_lighter.cpp +++ b/code/nel/tools/3d/ig_lighter/ig_lighter.cpp @@ -27,9 +27,9 @@ #include "nel/3d/shape.h" #include "nel/3d/transform_shape.h" #include "nel/3d/register_3d.h" -#include "../../../src/pacs/global_retriever.h" -#include "../../../src/pacs/local_retriever.h" -#include "../../../src/pacs/retriever_bank.h" +#include "nel/pacs/global_retriever.h" +#include "nel/pacs/local_retriever.h" +#include "nel/pacs/retriever_bank.h" #include "../ig_lighter_lib/ig_lighter_lib.h" diff --git a/code/nel/tools/3d/ig_lighter_lib/ig_lighter_lib.cpp b/code/nel/tools/3d/ig_lighter_lib/ig_lighter_lib.cpp index c933947ed..4365eab9b 100644 --- a/code/nel/tools/3d/ig_lighter_lib/ig_lighter_lib.cpp +++ b/code/nel/tools/3d/ig_lighter_lib/ig_lighter_lib.cpp @@ -16,8 +16,8 @@ #include "ig_lighter_lib.h" #include "nel/misc/path.h" -#include "nel/../../src/pacs/retriever_bank.h" -#include "nel/../../src/pacs/global_retriever.h" +#include "nel/pacs/retriever_bank.h" +#include "nel/pacs/global_retriever.h" #include "nel/3d/scene_group.h" diff --git a/code/nel/tools/3d/ligo/plugin_max/ligoscape_utility.def b/code/nel/tools/3d/ligo/plugin_max/ligoscape_utility.def index 18beb72e0..c3f1a6b7c 100644 --- a/code/nel/tools/3d/ligo/plugin_max/ligoscape_utility.def +++ b/code/nel/tools/3d/ligo/plugin_max/ligoscape_utility.def @@ -1,4 +1,4 @@ -LIBRARY nelligoscapeutility.dlx +;LIBRARY nelligoscapeutility.dlx EXPORTS LibDescription @1 LibNumberClasses @2 diff --git a/code/nel/tools/3d/ligo/plugin_max/script.cpp b/code/nel/tools/3d/ligo/plugin_max/script.cpp index 7763a0126..41740bcbe 100644 --- a/code/nel/tools/3d/ligo/plugin_max/script.cpp +++ b/code/nel/tools/3d/ligo/plugin_max/script.cpp @@ -18,6 +18,14 @@ #include +#ifdef _STLPORT_VERSION +namespace std +{ + float fabsf(float f); + double fabsl(double f); +} +#endif + // Various MAX and MXS includes #include #if MAX_VERSION_MAJOR >= 14 diff --git a/code/nel/tools/3d/object_viewer/object_viewer.cpp b/code/nel/tools/3d/object_viewer/object_viewer.cpp index 71aba41df..19490309b 100644 --- a/code/nel/tools/3d/object_viewer/object_viewer.cpp +++ b/code/nel/tools/3d/object_viewer/object_viewer.cpp @@ -54,7 +54,7 @@ #include "nel/3d/ps_util.h" -#include "nel/../../src/pacs/global_retriever.h" +#include "nel/pacs/global_retriever.h" diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp index 6c5b8a36c..9b9da508b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp @@ -54,7 +54,7 @@ void PluginManager::addObject(QObject *obj) nlwarning("trying to add duplicate object"); return; } - nlinfo(QString("addObject: " + obj->objectName()).toStdString().c_str()); + nlinfo("addObject: %s", obj->objectName().toUtf8().constData()); m_allObjects.append(obj); @@ -71,10 +71,10 @@ void PluginManager::removeObject(QObject *obj) if (!m_allObjects.contains(obj)) { - nlinfo(QString("object not in list: " + obj->objectName()).toStdString().c_str()); + nlinfo("object not in list: %s", obj->objectName().toUtf8().constData()); return; } - nlinfo(QString("removeObject: " + obj->objectName()).toStdString().c_str()); + nlinfo("removeObject: %s", obj->objectName().toUtf8().constData()); Q_EMIT aboutToRemoveObject(obj); QWriteLocker lock(&m_lock); diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp index fea606af2..89f8046bb 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp @@ -186,7 +186,7 @@ bool PluginSpec::setFileName(const QString &fileName) #endif - nlinfo(m_filePath.toStdString().c_str()); + nlinfo(m_filePath.toUtf8().constData()); if (!exists) return reportError(QCoreApplication::translate("PluginSpec", "File does not exist: %1").arg(file.fileName())); diff --git a/code/nel/tools/3d/object_viewer_qt/src/main.cpp b/code/nel/tools/3d/object_viewer_qt/src/main.cpp index ea78905fa..d7569bda8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/main.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/main.cpp @@ -149,7 +149,7 @@ sint main(int argc, char **argv) #if defined(NL_OS_MAC) QDir::setCurrent(qApp->applicationDirPath() + QString("/../Resources")); - NLMISC::CLibrary::addLibPath((qApp->applicationDirPath() + QString("/../PlugIns/nel")).toStdString()); + NLMISC::CLibrary::addLibPath((qApp->applicationDirPath() + QString("/../PlugIns/nel")).toUtf8().constData()); #endif ExtensionSystem::PluginManager pluginManager; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.cpp index 42106e864..ebeb07bd8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.cpp @@ -79,7 +79,7 @@ bool BnpFileListDialog::loadTable(const QString filePath) int row = 0; // read the header from the bnp file - if (!myBNPFileHandle.readHeader( filePath.toStdString()) ) + if (!myBNPFileHandle.readHeader( filePath.toUtf8().constData()) ) { return false; } @@ -125,7 +125,7 @@ void BnpFileListDialog::getSelections(TSelectionList& SelectionList) { QVariant data = model->data(index); QString filename = data.toString(); - SelectionList.push_back( filename.toStdString() ); + SelectionList.push_back( filename.toUtf8().constData() ); } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.cpp index edeb30bc4..04b4fd628 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.cpp @@ -94,7 +94,7 @@ void BNPManagerWindow::createDialogs() { // create dialog to list the contents of the specified // bnp data file directory - m_BnpDirTreeDialog = new CBnpDirTreeDialog(tr(m_DataPath.toStdString().c_str()),this); + m_BnpDirTreeDialog = new CBnpDirTreeDialog(tr(m_DataPath.toUtf8().constData()),this); addDockWidget(Qt::LeftDockWidgetArea, m_BnpDirTreeDialog); m_BnpDirTreeDialog->setVisible(true); restoreDockWidget(m_BnpDirTreeDialog); @@ -187,7 +187,7 @@ void BNPManagerWindow::newFile() m_openedBNPFile = filePath; m_BnpFileListDialog->setWindowTitle (filePath); - myBNPFileHandle.createFile ( filePath.toStdString() ); + myBNPFileHandle.createFile ( filePath.toUtf8().constData() ); } // *************************************************************************** @@ -196,7 +196,7 @@ void BNPManagerWindow::open() QString fileName; // file dialog to select with file should be opened fileName = QFileDialog::getOpenFileName(this, - tr("Open BNP file"), tr(m_DataPath.toStdString().c_str()), tr("BNP Files (*.bnp)")); + tr("Open BNP file"), tr(m_DataPath.toUtf8().constData()), tr("BNP Files (*.bnp)")); // Check if filename is empty if (fileName.isNull()) @@ -234,7 +234,7 @@ void BNPManagerWindow::addFiles() QStringList::iterator it_list = FileList.begin(); while (it_list != FileList.end() ) { - string fileName = CFile::getFilename (it_list->toStdString() ); + string fileName = CFile::getFilename (it_list->toUtf8().constData() ); if ( std::find(currentFiles.begin(), currentFiles.end(), fileName ) != currentFiles.end() ) { // Ask the user if he wants to override the existing file @@ -246,7 +246,7 @@ void BNPManagerWindow::addFiles() } else { - addFiles.push_back( it_list->toStdString() ); + addFiles.push_back( it_list->toUtf8().constData() ); // log it nlinfo("Add file %s", fileName.c_str() ); } @@ -277,7 +277,7 @@ void BNPManagerWindow::addFiles( QStringList FileList ) QStringList::iterator it_list = FileList.begin(); while (it_list != FileList.end() ) { - string fileName = CFile::getFilename (it_list->toStdString() ); + string fileName = CFile::getFilename (it_list->toUtf8().constData() ); if ( std::find(currentFiles.begin(), currentFiles.end(), fileName ) != currentFiles.end() ) { // Ask the user if he wants to override the existing file @@ -289,7 +289,7 @@ void BNPManagerWindow::addFiles( QStringList FileList ) } else { - addFiles.push_back( it_list->toStdString() ); + addFiles.push_back( it_list->toUtf8().constData() ); // log it nlinfo("Add file %s", fileName.c_str() ); } @@ -346,7 +346,7 @@ void BNPManagerWindow::unpackFiles() } QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), - tr(m_DataPath.toStdString().c_str()), + tr(m_DataPath.toUtf8().constData()), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); @@ -354,7 +354,7 @@ void BNPManagerWindow::unpackFiles() if ( dir.isEmpty() ) return; - if (myBNPFileHandle.unpack(dir.toStdString(),selectedrows)) + if (myBNPFileHandle.unpack(dir.toUtf8().constData(),selectedrows)) { QMessageBox::information(this, tr("BNP Manager"), tr("All files has been exported successfully."), @@ -426,7 +426,7 @@ void BNPManagerWindow::dropEvent(QDropEvent *event) filePath = it->toLocalFile(); if ( filePath.endsWith(".bnp") ) { - nlwarning("Could not add a bnp file!", filePath.toStdString().c_str() ); + nlwarning("Could not add bnp file %s!", filePath.toUtf8().constData() ); } else { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/context_manager.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/context_manager.cpp index d82cdb63b..8355b5cb8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/context_manager.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/context_manager.cpp @@ -1,167 +1,167 @@ -// Object Viewer Qt - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// Copyright (C) 2011 Dzmitry Kamiahin -// -// 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 . - -// Project includes -#include "context_manager.h" -#include "icontext.h" -#include "main_window.h" - -// NeL includes -#include - -// Qt includes -#include -#include - -namespace Core -{ - -struct ContextManagerPrivate -{ - explicit ContextManagerPrivate(Core::MainWindow *mainWindow, QTabWidget *tabWidget); - Core::MainWindow *m_mainWindow; - QTabWidget *m_tabWidget; - QVector m_contexts; - int m_oldCurrent; -}; - -ContextManagerPrivate::ContextManagerPrivate(Core::MainWindow *mainWindow, QTabWidget *tabWidget) - : m_mainWindow(mainWindow), - m_tabWidget(tabWidget), - m_oldCurrent(-1) -{ -} - -ContextManager::ContextManager(Core::MainWindow *mainWindow, QTabWidget *tabWidget) - : d(new ContextManagerPrivate(mainWindow, tabWidget)) -{ - QObject::connect(d->m_mainWindow->pluginManager(), SIGNAL(objectAdded(QObject *)), - this, SLOT(objectAdded(QObject *))); - QObject::connect(d->m_mainWindow->pluginManager(), SIGNAL(aboutToRemoveObject(QObject *)), - this, SLOT(aboutToRemoveObject(QObject *))); - - QObject::connect(d->m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int))); -} - -ContextManager::~ContextManager() -{ - delete d; -} - -Core::IContext *ContextManager::currentContext() const -{ - int currentIndex = d->m_tabWidget->currentIndex(); - if (currentIndex < 0) - return 0; - return d->m_contexts.at(currentIndex); -} - -Core::IContext *ContextManager::context(const QString &id) const -{ - const int index = indexOf(id); - if (index >= 0) - return d->m_contexts.at(index); - return 0; -} - +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Dzmitry Kamiahin +// +// 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 . + +// Project includes +#include "context_manager.h" +#include "icontext.h" +#include "main_window.h" + +// NeL includes +#include + +// Qt includes +#include +#include + +namespace Core +{ + +struct ContextManagerPrivate +{ + explicit ContextManagerPrivate(Core::MainWindow *mainWindow, QTabWidget *tabWidget); + Core::MainWindow *m_mainWindow; + QTabWidget *m_tabWidget; + QVector m_contexts; + int m_oldCurrent; +}; + +ContextManagerPrivate::ContextManagerPrivate(Core::MainWindow *mainWindow, QTabWidget *tabWidget) + : m_mainWindow(mainWindow), + m_tabWidget(tabWidget), + m_oldCurrent(-1) +{ +} + +ContextManager::ContextManager(Core::MainWindow *mainWindow, QTabWidget *tabWidget) + : d(new ContextManagerPrivate(mainWindow, tabWidget)) +{ + QObject::connect(d->m_mainWindow->pluginManager(), SIGNAL(objectAdded(QObject *)), + this, SLOT(objectAdded(QObject *))); + QObject::connect(d->m_mainWindow->pluginManager(), SIGNAL(aboutToRemoveObject(QObject *)), + this, SLOT(aboutToRemoveObject(QObject *))); + + QObject::connect(d->m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int))); +} + +ContextManager::~ContextManager() +{ + delete d; +} + +Core::IContext *ContextManager::currentContext() const +{ + int currentIndex = d->m_tabWidget->currentIndex(); + if (currentIndex < 0) + return 0; + return d->m_contexts.at(currentIndex); +} + +Core::IContext *ContextManager::context(const QString &id) const +{ + const int index = indexOf(id); + if (index >= 0) + return d->m_contexts.at(index); + return 0; +} + void ContextManager::registerUndoStack(QUndoStack *stack) { nlassert(stack); d->m_mainWindow->undoGroup()->addStack(stack); } -void ContextManager::unregisterUndoStack(QUndoStack *stack) -{ +void ContextManager::unregisterUndoStack(QUndoStack *stack) +{ nlassert(stack); d->m_mainWindow->undoGroup()->removeStack(stack); -} - -void ContextManager::activateContext(const QString &id) -{ - const int index = indexOf(id); - if (index >= 0) - d->m_tabWidget->setCurrentIndex(index); -} - -void ContextManager::updateCurrentContext() -{ - d->m_mainWindow->updateContext(currentContext()); -} - -void ContextManager::objectAdded(QObject *obj) -{ - IContext *context = qobject_cast(obj); - if (context) - addContextObject(context); -} - -void ContextManager::aboutToRemoveObject(QObject *obj) -{ - IContext *context = qobject_cast(obj); - if (context) - removeContextObject(context); -} - -void ContextManager::addContextObject(IContext *context) -{ - d->m_contexts.push_back(context); - d->m_mainWindow->addContextObject(context); - - QWidget *tabWidget = new QWidget(d->m_tabWidget); - d->m_tabWidget->addTab(tabWidget, context->icon(), context->trName()); - QGridLayout *gridLayout = new QGridLayout(tabWidget); - gridLayout->setObjectName(QString::fromUtf8("gridLayout_") + context->id()); - gridLayout->setContentsMargins(0, 0, 0, 0); - gridLayout->addWidget(context->widget(), 0, 0, 1, 1); -} - -void ContextManager::removeContextObject(IContext *context) -{ - d->m_mainWindow->removeContextObject(context); - - const int index = indexOf(context->id()); - QWidget *widget = d->m_tabWidget->widget(index); - d->m_tabWidget->removeTab(index); - d->m_contexts.remove(index); - delete widget; -} - -void ContextManager::currentTabChanged(int index) -{ - if (index >= 0) - { - IContext *context = d->m_contexts.at(index); - IContext *oldContext = 0; - if (d->m_oldCurrent >= 0) - oldContext = d->m_contexts.at(d->m_oldCurrent); - d->m_oldCurrent = index; - Q_EMIT currentContextChanged(context, oldContext); - } -} - -int ContextManager::indexOf(const QString &id) const -{ - for (int i = 0; i < d->m_contexts.count(); ++i) - { - if (d->m_contexts.at(i)->id() == id) - return i; - } - nlwarning(QString("Warning, no such context: %1").arg(id).toStdString().c_str()); - return -1; -} - +} + +void ContextManager::activateContext(const QString &id) +{ + const int index = indexOf(id); + if (index >= 0) + d->m_tabWidget->setCurrentIndex(index); +} + +void ContextManager::updateCurrentContext() +{ + d->m_mainWindow->updateContext(currentContext()); +} + +void ContextManager::objectAdded(QObject *obj) +{ + IContext *context = qobject_cast(obj); + if (context) + addContextObject(context); +} + +void ContextManager::aboutToRemoveObject(QObject *obj) +{ + IContext *context = qobject_cast(obj); + if (context) + removeContextObject(context); +} + +void ContextManager::addContextObject(IContext *context) +{ + d->m_contexts.push_back(context); + d->m_mainWindow->addContextObject(context); + + QWidget *tabWidget = new QWidget(d->m_tabWidget); + d->m_tabWidget->addTab(tabWidget, context->icon(), context->trName()); + QGridLayout *gridLayout = new QGridLayout(tabWidget); + gridLayout->setObjectName(QString::fromUtf8("gridLayout_") + context->id()); + gridLayout->setContentsMargins(0, 0, 0, 0); + gridLayout->addWidget(context->widget(), 0, 0, 1, 1); +} + +void ContextManager::removeContextObject(IContext *context) +{ + d->m_mainWindow->removeContextObject(context); + + const int index = indexOf(context->id()); + QWidget *widget = d->m_tabWidget->widget(index); + d->m_tabWidget->removeTab(index); + d->m_contexts.remove(index); + delete widget; +} + +void ContextManager::currentTabChanged(int index) +{ + if (index >= 0) + { + IContext *context = d->m_contexts.at(index); + IContext *oldContext = 0; + if (d->m_oldCurrent >= 0) + oldContext = d->m_contexts.at(d->m_oldCurrent); + d->m_oldCurrent = index; + Q_EMIT currentContextChanged(context, oldContext); + } +} + +int ContextManager::indexOf(const QString &id) const +{ + for (int i = 0; i < d->m_contexts.count(); ++i) + { + if (d->m_contexts.at(i)->id() == id) + return i; + } + nlwarning(QString("Warning, no such context: %1").arg(id).toUtf8().constData()); + return -1; +} + } /* namespace Core */ \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp index e21edafec..bfbb06d66 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp @@ -99,10 +99,10 @@ void GeneralSettingsPage::applyGeneralSettings() QString primitivePath = settings->value(Core::Constants::PRIMITIVES_PATH, QString("%1/primitives").arg(levelDesignPrefix)).toString(); QString ligoConfigFile = settings->value(Core::Constants::LIGOCONFIG_FILE, QString("%1/leveldesign/world_editor_files/world_editor_classes.xml").arg(levelDesignPrefix)).toString(); QString leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, QString("%1/leveldesign").arg(levelDesignPrefix)).toString(); - NLMISC::CPath::addSearchPath(primitivePath.toStdString(), true, false); + NLMISC::CPath::addSearchPath(primitivePath.toUtf8().constData(), true, false); NLMISC::CPath::display(); - NLMISC::CPath::addSearchFile(ligoConfigFile.toStdString()); - NLMISC::CPath::addSearchPath(leveldesignPath.toStdString(), true, false); + NLMISC::CPath::addSearchFile(ligoConfigFile.toUtf8().constData()); + NLMISC::CPath::addSearchPath(leveldesignPath.toUtf8().constData(), true, false); settings->endGroup(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.cpp index 68a8e3080..3e6272f0a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.cpp @@ -62,7 +62,7 @@ QMenu *MenuManager::menu(const QString &id) const { QMenu *result = 0; if (!d->m_menuMap.contains(id)) - nlwarning("QMenu %s not found", id.toStdString().c_str()); + nlwarning("QMenu %s not found", id.toUtf8().constData()); else result = d->m_menuMap.value(id); return result; @@ -72,7 +72,7 @@ QAction *MenuManager::action(const QString &id) const { QAction *result = 0; if (!d->m_actionMap.contains(id)) - nlwarning("QAction %s not found", id.toStdString().c_str()); + nlwarning("QAction %s not found", id.toUtf8().constData()); else result = d->m_actionMap.value(id); return result; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp index 1a2ac3eef..e76d6c796 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp @@ -116,11 +116,11 @@ void SearchPathsSettingsPage::applySearchPaths() settings->endGroup(); for (int i = 1; i < remapExt.size(); i += 2) - NLMISC::CPath::remapExtension(remapExt.at(i - 1).toStdString(), remapExt.at(i).toStdString(), true); + NLMISC::CPath::remapExtension(remapExt.at(i - 1).toUtf8().constData(), remapExt.at(i).toUtf8().constData(), true); Q_FOREACH(QString path, paths) { - NLMISC::CPath::addSearchPath(path.toStdString(), m_recurse, false); + NLMISC::CPath::addSearchPath(path.toUtf8().constData(), m_recurse, false); } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt index 514657535..9f705e604 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt @@ -47,3 +47,6 @@ ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS} INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_georges_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +IF(WITH_PCH) + ADD_NATIVE_PRECOMPILED_HEADER(ovqt_plugin_georges_editor ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) +ENDIF(WITH_PCH) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.cpp index 731fa8d16..cbe4bc0d7 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" // Project includes #include "expandable_headerview.h" diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp index 7f21fa072..91f62c24b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "formdelegate.h" // NeL includes @@ -95,7 +96,7 @@ namespace GeorgesQt //QString min = QString(type->getMin().c_str()); //QString max = QString(type->getMax().c_str()); //QString inc = QString(type->getIncrement().c_str()); - //nldebug(QString("min %1 max %2 inc %3").arg(min).arg(max).arg(inc).toStdString().c_str()); + //nldebug(QString("min %1 max %2 inc %3").arg(min).arg(max).arg(inc).toUtf8().constData()); // TODO: use saved min/max values editor->setMinimum(-99999); @@ -110,7 +111,7 @@ namespace GeorgesQt //QString min = QString(type->getMin().c_str()); //QString max = QString(type->getMax().c_str()); //QString inc = QString(type->getIncrement().c_str()); - //nldebug(QString("min %1 max %2 inc %3").arg(min).arg(max).arg(inc).toStdString().c_str()); + //nldebug(QString("min %1 max %2 inc %3").arg(min).arg(max).arg(inc).toUtf8().constData()); // TODO: use saved min/max values editor->setMinimum(-99999); @@ -201,7 +202,7 @@ namespace GeorgesQt else { nldebug(QString("setModelData from %1 to %2") - .arg(oldValue).arg(value).toStdString().c_str()); + .arg(oldValue).arg(value).toUtf8().constData()); model->setData(index, value, Qt::EditRole); } } @@ -222,7 +223,7 @@ namespace GeorgesQt else { nldebug(QString("setModelData from %1 to %2") - .arg(oldValue).arg(value).toStdString().c_str()); + .arg(oldValue).arg(value).toUtf8().constData()); model->setData(index, value, Qt::EditRole); } break; @@ -239,7 +240,7 @@ namespace GeorgesQt else { nldebug(QString("setModelData from %1 to %2") - .arg(oldValue).arg(value).toStdString().c_str()); + .arg(oldValue).arg(value).toUtf8().constData()); model->setData(index, value, Qt::EditRole); } break; @@ -260,7 +261,7 @@ namespace GeorgesQt else { nldebug(QString("setModelData from %1 to %2") - .arg(oldValue).arg(value).toStdString().c_str()); + .arg(oldValue).arg(value).toUtf8().constData()); model->setData(index, value, Qt::EditRole); } break; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp index e6e526631..744bb58da 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "formitem.h" // Qt includes @@ -118,10 +119,10 @@ namespace GeorgesQt { if (elmt->isAtom()) { - ((NLGEORGES::CFormElmAtom*)elmt)->setValue(value.toString().toStdString().c_str()); + ((NLGEORGES::CFormElmAtom*)elmt)->setValue(value.toString().toUtf8().constData()); nldebug(QString("array element string %1 %2") .arg(itemData[0].toString()).arg(value.toString()) - .toStdString().c_str()); + .toUtf8().constData()); } } } @@ -129,18 +130,18 @@ namespace GeorgesQt else { if(parentItem->formElm->setValueByName( - value.toString().toStdString().c_str(), - itemData[0].toString().toStdString().c_str())) + value.toString().toUtf8().constData(), + itemData[0].toString().toUtf8().constData())) { nldebug(QString("string %1 %2") .arg(itemData[0].toString()).arg(value.toString()) - .toStdString().c_str()); + .toUtf8().constData()); } else { nldebug(QString("FAILED string %1 %2") .arg(itemData[0].toString()).arg(value.toString()) - .toStdString().c_str()); + .toUtf8().constData()); } } break; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.cpp index b340869ad..ce577bfab 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "georges.h" #include "nel/misc/o_xml.h" diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp index 264026b1f..0a467aac5 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" // Project includes #include "georges_dirtree_dialog.h" diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp index a36f411e0..6c46d4964 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp @@ -15,6 +15,7 @@ // along with this program. If not, see . // Project includes +#include "stdpch.h" #include "georges_editor_form.h" #include "georges_editor_constants.h" #include "georges_dirtree_dialog.h" @@ -253,7 +254,7 @@ namespace GeorgesQt } else { - nlwarning("Failed to load form: %s", info.fileName().toStdString().c_str()); + nlwarning("Failed to load form: %s", info.fileName().toUtf8().constData()); m_dockedWidgets.last()->close(); } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp index ec20e6b35..075ac41b2 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp @@ -15,6 +15,7 @@ // along with this program. If not, see . // Project includes +#include "stdpch.h" #include "georges_editor_plugin.h" #include "georges_editor_form.h" @@ -22,7 +23,7 @@ #include "../core/core_constants.h" // NeL includes -#include "nel/misc/debug.h" +#include // Qt includes #include diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp index 762d79ff4..56a5856ae 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "georges_filesystem_model.h" #include diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp index 3bdc680ff..0dda2c9a9 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp @@ -14,7 +14,14 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "georges_treeview_dialog.h" +#include "georges.h" +#include "georgesform_model.h" +#include "georgesform_proxy_model.h" +#include "formitem.h" +#include "formdelegate.h" +#include "expandable_headerview.h" // Qt includes #include @@ -36,14 +43,6 @@ #include "../core/icore.h" #include "../core/core_constants.h" -// Project includes -#include "georges.h" -#include "georgesform_model.h" -#include "georgesform_proxy_model.h" -#include "formitem.h" -#include "formdelegate.h" -#include "expandable_headerview.h" - using namespace NLMISC; using namespace NLGEORGES; @@ -117,30 +116,30 @@ namespace GeorgesQt NLGEORGES::CForm* CGeorgesTreeViewDialog::getFormByName(const QString formName) { - if(NLMISC::CPath::exists(formName.toStdString())) + if(NLMISC::CPath::exists(formName.toUtf8().constData())) { - //NLGEORGES::CForm *form = dynamic_cast(m_georges->loadForm(formName.toStdString())); - return (NLGEORGES::CForm *)m_georges->loadForm(formName.toStdString()); + //NLGEORGES::CForm *form = dynamic_cast(m_georges->loadForm(formName.toUtf8())); + return (NLGEORGES::CForm *)m_georges->loadForm(formName.toUtf8().constData()); } //else //{ // CForm *form = 0; // // Load the DFN - // std::string extStr = NLMISC::CFile::getExtension( formName.toStdString() ); + // std::string extStr = NLMISC::CFile::getExtension( formName.toUtf8() ); // QString dfnName = QString("%1.dfn").arg(extStr.c_str()); // UFormDfn *formdfn; - // if (NLMISC::CPath::exists(dfnName.toStdString())) + // if (NLMISC::CPath::exists(dfnName.toUtf8())) // { - // formdfn = _georges->loadFormDfn (dfnName.toStdString()); + // formdfn = _georges->loadFormDfn (dfnName.toUtf8()); // if (!formdfn) // { - // nlwarning("Failed to load dfn: %s", dfnName.toStdString().c_str()); + // nlwarning("Failed to load dfn: %s", dfnName.toUtf8()); // return 0; // } // } // else // { - // nlwarning("Cannot find dfn: %s", dfnName.toStdString().c_str()); + // nlwarning("Cannot find dfn: %s", dfnName.toUtf8()); // return 0; // } @@ -156,20 +155,20 @@ namespace GeorgesQt // } // return form; //} - nlinfo("File '%s' does not exist!", formName.toStdString().c_str()); + nlinfo("File '%s' does not exist!", formName.toUtf8().constData()); return 0; } NLGEORGES::CForm* CGeorgesTreeViewDialog::getFormByDfnName(const QString dfnName) { - if(NLMISC::CPath::exists(dfnName.toStdString())) + if(NLMISC::CPath::exists(dfnName.toUtf8().constData())) { // Create a new form object. NLGEORGES::CForm *form = new NLGEORGES::CForm(); m_form = form; // Retrieve a copy of the root definition. - NLGEORGES::CFormDfn *formDfn = dynamic_cast(m_georges->loadFormDfn(dfnName.toStdString())); + NLGEORGES::CFormDfn *formDfn = dynamic_cast(m_georges->loadFormDfn(dfnName.toUtf8().constData())); // Next we'll use the root node to build a new form. NLGEORGES::CFormElmStruct *fes = dynamic_cast(getRootNode(0)); @@ -184,7 +183,7 @@ namespace GeorgesQt return form; } - nlinfo("File '%s' does not exist!", dfnName.toStdString().c_str()); + nlinfo("File '%s' does not exist!", dfnName.toUtf8().constData()); return NULL; } @@ -250,7 +249,7 @@ namespace GeorgesQt nlinfo("typ's %d",deps["typ"].count()); nlinfo("dfn's %d",deps["dfn"].count()); - //nlwarning(strList.join(";").toStdString().c_str()); + //nlwarning(strList.join(";").toUtf8()); if (root) { loadedForm = m_form->getFilename().c_str(); @@ -277,7 +276,7 @@ namespace GeorgesQt void CGeorgesTreeViewDialog::addParentForm(QString parentFormNm) { // Try to load the form - NLGEORGES::UForm *uParentForm = m_georges->loadForm(parentFormNm.toStdString()); + NLGEORGES::UForm *uParentForm = m_georges->loadForm(parentFormNm.toUtf8().constData()); NLGEORGES::CForm *parentForm = dynamic_cast(uParentForm); NLGEORGES::CForm *mainForm = static_cast(m_form); @@ -292,11 +291,11 @@ namespace GeorgesQt if (parentForm->Elements.FormDfn == mainForm->Elements.FormDfn) { // This is the parent form selector - if(!mainForm->insertParent(mainForm->getParentCount(),parentFormNm.toStdString().c_str(), parentForm)) - nlwarning("Failed to add parent form: %s", parentFormNm.toStdString().c_str()); + if(!mainForm->insertParent(mainForm->getParentCount(),parentFormNm.toUtf8(), parentForm)) + nlwarning("Failed to add parent form: %s", parentFormNm.toUtf8().constData()); else { - nlinfo("Successfullyadded parent form: %s", parentFormNm.toStdString().c_str()); + nlinfo("Successfullyadded parent form: %s", parentFormNm.toUtf8().constData()); model->addParentForm(parentFormNm); } } @@ -318,7 +317,7 @@ namespace GeorgesQt { NLMISC::COFile file; - std::string s = NLMISC::CPath::lookup(loadedForm.toStdString(), false); + std::string s = NLMISC::CPath::lookup(loadedForm.toUtf8().constData(), false); if(file.open (s)) { try @@ -406,7 +405,7 @@ namespace GeorgesQt if (item->parent() && item->parent()->data(0) == "parents") { - Q_EMIT changeFile(CPath::lookup(item->data(0).toString().toStdString(),false).c_str()); + Q_EMIT changeFile(CPath::lookup(item->data(0).toString().toUtf8().constData(),false).c_str()); } //// col containing additional stuff like icons @@ -416,7 +415,7 @@ namespace GeorgesQt // CFormItem *item = m->getItem(in2); // QString value = item->data(1).toString(); - // QString path = CPath::lookup(value.toStdString(),false).c_str(); + // QString path = CPath::lookup(value.toUtf8(),false).c_str(); // if(value.contains(".tga") || value.contains(".png")) // { @@ -444,7 +443,7 @@ namespace GeorgesQt // { // Modules::objViewInt()->resetScene(); // //Modules::config().configRemapExtensions(); - // Modules::objViewInt()->loadMesh(path.toStdString(),""); + // Modules::objViewInt()->loadMesh(path.toUtf8(),""); // } // return; // } @@ -551,7 +550,7 @@ namespace GeorgesQt file = file.remove(0,file.indexOf(".")+1); QString filePattern = "Parent Sheets (*."+file+")"; - nlinfo("parent defn name '%s'", file.toStdString().c_str()); + nlinfo("parent defn name '%s'", file.toUtf8().constData()); QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select parent sheets..."), m_lastSheetDir, filePattern); if(!fileNames.isEmpty()) { @@ -561,7 +560,7 @@ namespace GeorgesQt QFileInfo pathInfo( fileToParent ); QString tmpFileName( pathInfo.fileName() ); - nlinfo("requesting to add parent form '%s'", tmpFileName.toStdString().c_str()); + nlinfo("requesting to add parent form '%s'", tmpFileName.toUtf8().constData()); // Call to add the form and load it into the Georges form. addParentForm(tmpFileName); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp index 9e3f97c48..dd0220bbf 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "georgesform_model.h" +#include "formitem.h" // NeL includes #include @@ -35,9 +37,6 @@ #include #include -// project includes -#include "formitem.h" - using namespace NLGEORGES; namespace GeorgesQt @@ -140,13 +139,13 @@ namespace GeorgesQt CFormItem *item = getItem(in); QString value = item->data(1).toString(); - //QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str(); + //QString path = NLMISC::CPath::lookup(value.toUtf8().constData(),false).c_str(); /*if (value.contains(".shape")) { if (Modules::objViewInt()) { - QIcon *icon = Modules::objViewInt()->saveOneImage(value.toStdString()); + QIcon *icon = Modules::objViewInt()->saveOneImage(value.toUtf8().constData()); if (icon) { if(icon->isNull()) @@ -162,7 +161,7 @@ namespace GeorgesQt }*/ if(value.contains(".tga") || value.contains(".png")) { - QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str(); + QString path = NLMISC::CPath::lookup(value.toUtf8().constData(),false).c_str(); if(path.isEmpty()) { path = ":/images/pqrticles.png"; @@ -185,7 +184,7 @@ namespace GeorgesQt { if (Modules::objViewInt()) { - QIcon *icon = Modules::objViewInt()->saveOneImage(value.toStdString()); + QIcon *icon = Modules::objViewInt()->saveOneImage(value.toUtf8().constData()); if (icon) { if(icon->isNull()) @@ -201,7 +200,7 @@ namespace GeorgesQt }*/ if(value.contains(".tga") || value.contains(".png")) { - QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str(); + QString path = NLMISC::CPath::lookup(value.toUtf8().constData(),false).c_str(); if(path.isEmpty()) { path = ":/images/pqrticles.png"; @@ -406,7 +405,7 @@ namespace GeorgesQt //uint value_uint; //sint value_sint; //double value_double; - QString elmtType = ""; + QString elmtType; UFormElm *elmt = 0; if(root->getNodeByName(&elmt, elmName.c_str(), whereN, true)) { @@ -428,13 +427,23 @@ namespace GeorgesQt switch (type->getType()) { case UType::UnsignedInt: - value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toStdString(); + { + uint v; + NLMISC::fromString(value, v); + value = NLMISC::toString(v); elmtType.append("_uint");break; + } case UType::SignedInt: - value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toStdString(); + { + sint v; + NLMISC::fromString(value, v); + value = NLMISC::toString(v); elmtType.append("_sint");break; + } case UType::Double: - value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble(),0,'f',1).toStdString(); + float v; + NLMISC::fromString(value, v); + value = NLMISC::toString(v); elmtType.append("_double");break; case UType::String: elmtType.append("_string");break; @@ -569,7 +578,7 @@ namespace GeorgesQt { QList columnData; std::string value; - QString elmtType = ""; + QString elmtType; UFormElm *elmt = 0; if(root->getArrayNode(&elmt,0) && elmt) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp index 8b13ca8ba..2792699b0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp @@ -14,15 +14,15 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" +#include "georgesform_proxy_model.h" +#include "formitem.h" +#include "georgesform_model.h" + // NeL includes #include #include -// project includes -#include "formitem.h" -#include "georgesform_proxy_model.h" -#include "georgesform_model.h" - namespace GeorgesQt { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/stdpch.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/stdpch.cpp new file mode 100644 index 000000000..85c10995f --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/stdpch.cpp @@ -0,0 +1,17 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// 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 . + +#include "stdpch.h" diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/stdpch.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/stdpch.h new file mode 100644 index 000000000..e5279839b --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/stdpch.h @@ -0,0 +1,39 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// 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 . + +#ifndef NL_STDPCH_H +#define NL_STDPCH_H + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp index 0c791aa7c..e01f5f617 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp @@ -239,11 +239,11 @@ void MissionCompilerMainWindow::compileMission(bool publish) try { CMissionCompiler mc; - mc.compileMissions(primDoc.RootNode, filename.toStdString()); + mc.compileMissions(primDoc.RootNode, filename.toUtf8().constData()); m_compileLog.append("Found "+QString::number(mc.getMissionsCount())+" valid missions\n"); updateCompileLog(); - mc.installCompiledMission(m_ligoConfig, filename.toStdString()); + mc.installCompiledMission(m_ligoConfig, filename.toUtf8().constData()); nbMission += mc.getMissionsCount(); // publish files to selected servers @@ -296,7 +296,7 @@ void MissionCompilerMainWindow::compileMission(bool publish) { m_compileLog.append(" "+QString(NLMISC::CFile::getFilename(mc.getFileToPublish(j)).c_str())+"\n"); } - mc.publishFiles(primPath.toStdString(), textPath.toStdString(), localPath.toStdString()); + mc.publishFiles(primPath.toUtf8().constData(), textPath.toUtf8().constData(), localPath.toUtf8().constData()); } column++; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/CMakeLists.txt index b5af7f1e9..0ebc8a0b1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/CMakeLists.txt @@ -1,129 +1,149 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${LIBXML2_INCLUDE_DIR} - ${QT_INCLUDES}) + ${QT_INCLUDES} + ${CMAKE_CURRENT_SOURCE_DIR}/scene/ + ${CMAKE_CURRENT_SOURCE_DIR}/particle_system/ + ${CMAKE_CURRENT_SOURCE_DIR}/vegetable/ + ${CMAKE_CURRENT_SOURCE_DIR}/widgets/ +) FILE(GLOB SRC *.cpp *.h) +FILE(GLOB OVQT_SCENE_SRC scene/*.cpp scene/*.h) +FILE(GLOB OVQT_PS_SRC particle_system/*.h particle_system/*.cpp) +FILE(GLOB OVQT_VEGETABLE_SRC vegetable/*.h vegetable/*.cpp) +FILE(GLOB OVQT_WIDGETS_SRC widgets/*.h widgets/*.cpp) + SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h) -SET(OBJECT_VIEWER_PLUGIN_HDR object_viewer_plugin.h - main_window.h - graphics_viewport.h - animation_dialog.h - animation_set_dialog.h - setup_fog_dialog.h - slot_manager_dialog.h - particle_control_dialog.h - particle_workspace_dialog.h - particle_tree_model.h - particle_system_page.h - particle_workspace_page.h - edit_range_widget.h - emitter_page.h - attrib_widget.h - located_bindable_page.h - located_page.h - particle_force_page.h - particle_light_page.h - particle_zone_page.h - particle_sound_page.h - basic_edit_widget.h - direction_widget.h - color_edit_widget.h - particle_property_dialog.h - ps_mover_page.h - value_blender_dialog.h - value_gradient_dialog.h - value_from_emitter_dialog.h - curve_dialog.h - bin_op_dialog.h - hoverpoints.h - mesh_widget.h - morph_mesh_dialog.h - constraint_mesh_widget.h - tail_particle_widget.h - auto_lod_dialog.h - particle_texture_widget.h - particle_texture_anim_widget.h - multi_tex_dialog.h - spinner_dialog.h - follow_path_dialog.h - water_pool_dialog.h - skeleton_scale_dialog.h - skeleton_tree_model.h - particle_link_skeleton_dialog.h - vegetable_dialog.h - global_wind_dialog.h - day_night_dialog.h - sun_color_dialog.h - vegetable_noise_value_widget.h - vegetable_density_page.h - vegetable_landscape_page.h - vegetable_scale_page.h - vegetable_appearance_page.h - vegetable_rotate_page.h - tune_mrm_dialog.h - tune_timer_dialog.h - camera_control.h +SET(OBJECT_VIEWER_PLUGIN_QT_HDR object_viewer_plugin.h + main_window.h + graphics_viewport.h graphics_settings_page.h sound_settings_page.h vegetable_settings_page.h - scheme_bank_dialog.h) -SET(OBJECT_VIEWER_PLUGIN_UIS animation_form.ui - animation_set_form.ui - setup_fog_form.ui - slot_form.ui - particle_control_form.ui - particle_workspace_form.ui - edit_range_float_form.ui - edit_range_uint_form.ui - particle_system_form.ui - workspace_form.ui - attrib_form.ui - emitter_form.ui - located_bindable_form.ui - located_form.ui - particle_force_form.ui - particle_light_form.ui - particle_zone_form.ui - particle_sound_form.ui - basic_edit_form.ui - direction_form.ui - color_edit_form.ui - ps_mover_form.ui - curve_form.ui - mesh_form.ui - morph_mesh_form.ui - constraint_mesh_form.ui - tail_form.ui - auto_lod_form.ui - particle_texture_form.ui - particle_texture_anim_form.ui - multi_tex_form.ui - skeleton_scale_form.ui - particle_link_skeleton_form.ui - water_pool_form.ui - vegetable_dialog_form.ui - vegetable_noise_value_form.ui - global_wind_form.ui - sun_color_form.ui - day_night_form.ui - vegetable_density_form.ui - vegetable_apperance_form.ui - vegetable_landscape_form.ui - vegetable_rotate_form.ui - vegetable_scale_form.ui - tune_mrm_form.ui - tune_timer_form.ui + scene/animation_dialog.h + scene/animation_set_dialog.h + scene/setup_fog_dialog.h + scene/slot_manager_dialog.h + scene/water_pool_dialog.h + scene/skeleton_scale_dialog.h + scene/skeleton_tree_model.h + scene/global_wind_dialog.h + scene/day_night_dialog.h + scene/sun_color_dialog.h + scene/tune_mrm_dialog.h + scene/tune_timer_dialog.h + scene/camera_control.h + + particle_system/particle_control_dialog.h + particle_system/particle_workspace_dialog.h + particle_system/particle_tree_model.h + particle_system/particle_system_page.h + particle_system/particle_workspace_page.h + particle_system/emitter_page.h + particle_system/attrib_widget.h + particle_system/located_bindable_page.h + particle_system/located_page.h + particle_system/particle_force_page.h + particle_system/particle_light_page.h + particle_system/particle_zone_page.h + particle_system/particle_sound_page.h + particle_system/basic_edit_widget.h + particle_system/direction_widget.h + particle_system/scheme_bank_dialog.h + particle_system/particle_property_dialog.h + particle_system/ps_mover_page.h + particle_system/value_blender_dialog.h + particle_system/value_gradient_dialog.h + particle_system/value_from_emitter_dialog.h + particle_system/curve_dialog.h + particle_system/bin_op_dialog.h + particle_system/mesh_widget.h + particle_system/morph_mesh_dialog.h + particle_system/constraint_mesh_widget.h + particle_system/tail_particle_widget.h + particle_system/auto_lod_dialog.h + particle_system/particle_texture_widget.h + particle_system/particle_texture_anim_widget.h + particle_system/multi_tex_dialog.h + particle_system/spinner_dialog.h + particle_system/follow_path_dialog.h + particle_system/particle_link_skeleton_dialog.h + + vegetable/vegetable_dialog.h + vegetable/vegetable_noise_value_widget.h + vegetable/vegetable_density_page.h + vegetable/vegetable_landscape_page.h + vegetable/vegetable_scale_page.h + vegetable/vegetable_appearance_page.h + vegetable/vegetable_rotate_page.h + + widgets/edit_range_widget.h + widgets/color_edit_widget.h + widgets/hoverpoints.h +) + +SET(OBJECT_VIEWER_PLUGIN_UIS scene/animation_form.ui + scene/animation_set_form.ui + scene/setup_fog_form.ui + scene/slot_form.ui + scene/skeleton_scale_form.ui + scene/water_pool_form.ui + scene/global_wind_form.ui + scene/sun_color_form.ui + scene/day_night_form.ui + scene/tune_mrm_form.ui + scene/tune_timer_form.ui + + particle_system/particle_control_form.ui + particle_system/particle_workspace_form.ui + particle_system/particle_system_form.ui + particle_system/workspace_form.ui + particle_system/attrib_form.ui + particle_system/emitter_form.ui + particle_system/located_bindable_form.ui + particle_system/located_form.ui + particle_system/particle_force_form.ui + particle_system/particle_light_form.ui + particle_system/particle_zone_form.ui + particle_system/particle_sound_form.ui + particle_system/basic_edit_form.ui + particle_system/direction_form.ui + particle_system/ps_mover_form.ui + particle_system/curve_form.ui + particle_system/mesh_form.ui + particle_system/morph_mesh_form.ui + particle_system/constraint_mesh_form.ui + particle_system/tail_form.ui + particle_system/auto_lod_form.ui + particle_system/particle_texture_form.ui + particle_system/particle_texture_anim_form.ui + particle_system/multi_tex_form.ui + particle_system/particle_link_skeleton_form.ui + particle_system/scheme_bank_form.ui + particle_system/value_gradient_form.ui + + vegetable/vegetable_dialog_form.ui + vegetable/vegetable_noise_value_form.ui + vegetable/vegetable_density_form.ui + vegetable/vegetable_apperance_form.ui + vegetable/vegetable_landscape_form.ui + vegetable/vegetable_rotate_form.ui + vegetable/vegetable_scale_form.ui + + widgets/color_edit_form.ui + widgets/edit_range_float_form.ui + widgets/edit_range_uint_form.ui + graphics_settings_page.ui sound_settings_page.ui vegetable_settings_page.ui - scheme_bank_form.ui - value_gradient_form.ui) +) SET(OBJECT_VIEWER_PLUGIN_RCS object_viewer.qrc) @@ -131,16 +151,29 @@ SET(QT_USE_QTGUI TRUE) SET(QT_USE_QTOPENGL TRUE) QT4_ADD_RESOURCES(OBJECT_VIEWER_PLUGIN_RC_SRCS ${OBJECT_VIEWER_PLUGIN_RCS}) -QT4_WRAP_CPP(OBJECT_VIEWER_PLUGIN_MOC_SRC ${OBJECT_VIEWER_PLUGIN_HDR}) +QT4_WRAP_CPP(OBJECT_VIEWER_PLUGIN_MOC_SRC ${OBJECT_VIEWER_PLUGIN_QT_HDR}) QT4_WRAP_UI(OBJECT_VIEWER_PLUGIN_UI_HDRS ${OBJECT_VIEWER_PLUGIN_UIS}) SOURCE_GROUP(QtResources FILES ${OBJECT_VIEWER_PLUGIN_UIS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${OBJECT_VIEWER_PLUGIN_UI_HDRS}) SOURCE_GROUP(QtGeneratedMocSrc FILES ${OBJECT_VIEWER_PLUGIN_MOC_SRC}) -SOURCE_GROUP("Object Viewer Plugin" FILES ${SRC}) -SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) -ADD_LIBRARY(ovqt_plugin_object_viewer MODULE ${SRC} ${OBJECT_VIEWER_PLUGIN_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OBJECT_VIEWER_PLUGIN_UI_HDRS} ${OBJECT_VIEWER_PLUGIN_RC_SRCS}) +SOURCE_GROUP("ovqt Extension System" FILES ${OVQT_EXT_SYS_SRC}) +SOURCE_GROUP("ovqt Plugin Src" FILES ${SRC}) +SOURCE_GROUP("ovqt Plugin Scene Src" FILES ${OVQT_SCENE_SRC}) +SOURCE_GROUP("ovqt Plugin PS Src" FILES ${OVQT_PS_SRC}) +SOURCE_GROUP("ovqt Plugin Vegetable Src" FILES ${OVQT_VEGETABLE_SRC}) +SOURCE_GROUP("ovqt Plugin Widgets Src" FILES ${OVQT_WIDGETS_SRC}) + +ADD_LIBRARY(ovqt_plugin_object_viewer MODULE ${SRC} + ${OVQT_SCENE_SRC} + ${OVQT_PS_SRC} + ${OVQT_VEGETABLE_SRC} + ${OVQT_WIDGETS_SRC} + ${OBJECT_VIEWER_PLUGIN_MOC_SRC} + ${OVQT_EXT_SYS_SRC} + ${OBJECT_VIEWER_PLUGIN_UI_HDRS} + ${OBJECT_VIEWER_PLUGIN_RC_SRCS}) TARGET_LINK_LIBRARIES(ovqt_plugin_object_viewer ovqt_plugin_core @@ -154,15 +187,15 @@ TARGET_LINK_LIBRARIES(ovqt_plugin_object_viewer NL_DEFAULT_PROPS(ovqt_plugin_object_viewer "NeL, Tools, 3D: Object Viewer Qt Plugin: Object Viewer") -IF(WITH_PCH) - ADD_NATIVE_PRECOMPILED_HEADER(ovqt_plugin_object_viewer ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) -ENDIF(WITH_PCH) - NL_ADD_RUNTIME_FLAGS(ovqt_plugin_object_viewer) NL_ADD_LIB_SUFFIX(ovqt_plugin_object_viewer) ADD_DEFINITIONS(-DQT_NO_KEYWORDS ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) +IF(WITH_PCH) + ADD_NATIVE_PRECOMPILED_HEADER(ovqt_plugin_object_viewer ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) +ENDIF(WITH_PCH) + INSTALL(TARGETS ovqt_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_object_viewer.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp index a65f510c4..2d45f0fb3 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp @@ -449,9 +449,9 @@ bool CMainWindow::loadFile(const QString &fileName, const QString &skelName) QFileInfo fileInfo(fileName); bool loaded; if (fileInfo.suffix() == "ig") - loaded = Modules::objView().loadInstanceGroup(fileName.toStdString()); + loaded = Modules::objView().loadInstanceGroup(fileName.toUtf8().constData()); else - loaded = Modules::objView().loadMesh(fileName.toStdString(), skelName.toStdString()); + loaded = Modules::objView().loadMesh(fileName.toUtf8().constData(), skelName.toUtf8().constData()); if (!loaded) { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.cpp index 4b0509018..48c679455 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.cpp @@ -468,7 +468,7 @@ void CObjectViewer::loadConfig() #endif _CameraFocal = settings->value("CameraFocal", 75).toInt(); - _FontName = settings->value(Constants::FONT, "andbasr.ttf").toString().toStdString(); + _FontName = settings->value(Constants::FONT, "andbasr.ttf").toString().toUtf8().constData(); _BloomEffect = settings->value(Constants::ENABLE_BLOOM, false).toBool(); _BloomDensity = settings->value(Constants::BLOOM_DENSITY, 0).toInt(); _BloomSquare = settings->value(Constants::ENABLE_SQUARE_BLOOM, false).toBool(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/attrib_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/attrib_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/attrib_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/attrib_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/attrib_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/attrib_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/attrib_widget.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/attrib_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/attrib_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/attrib_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/attrib_widget.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/attrib_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/auto_lod_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/auto_lod_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/auto_lod_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/auto_lod_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/auto_lod_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/auto_lod_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/auto_lod_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/auto_lod_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/auto_lod_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/auto_lod_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/auto_lod_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/auto_lod_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/basic_edit_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/basic_edit_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/basic_edit_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/basic_edit_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/basic_edit_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/basic_edit_widget.cpp similarity index 99% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/basic_edit_widget.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/basic_edit_widget.cpp index b3816a034..771568550 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/basic_edit_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/basic_edit_widget.cpp @@ -202,15 +202,15 @@ void CBasicEditWidget::updateGraphics() } bool CBasicEditWidget::eventFilter(QObject *object, QEvent *event) -{ - if( event->type() == QEvent::Paint ) - { +{ + if( event->type() == QEvent::Paint ) + { QPainter painter(_ui.graphicsWidget); painter.setRenderHint(QPainter::Antialiasing, true); painter.setBrush(QBrush(Qt::white)); painter.setPen(QPen(Qt::black, 2, Qt::SolidLine)); - painter.drawRoundedRect(QRect(3, 3, _ui.graphicsWidget->width() - 6, _ui.graphicsWidget->height() - 6), 3.0, 3.0); - } + painter.drawRoundedRect(QRect(3, 3, _ui.graphicsWidget->width() - 6, _ui.graphicsWidget->height() - 6), 3.0, 3.0); + } return QWidget::eventFilter(object, event); } -} /* namespace NLQT */ \ No newline at end of file +} /* namespace NLQT */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/basic_edit_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/basic_edit_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/basic_edit_widget.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/basic_edit_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/bin_op_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/bin_op_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/bin_op_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/bin_op_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/bin_op_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/bin_op_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/bin_op_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/bin_op_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/constraint_mesh_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/constraint_mesh_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/constraint_mesh_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/constraint_mesh_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/constraint_mesh_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/constraint_mesh_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/constraint_mesh_widget.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/constraint_mesh_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/constraint_mesh_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/constraint_mesh_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/constraint_mesh_widget.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/constraint_mesh_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/curve_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/curve_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/curve_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/curve_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/curve_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/curve_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/curve_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/curve_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/curve_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/curve_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/curve_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/curve_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/direction_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/direction_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/direction_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/direction_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/direction_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/direction_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/direction_widget.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/direction_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/direction_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/direction_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/direction_widget.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/direction_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/dup_ps.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/dup_ps.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/dup_ps.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/dup_ps.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/dup_ps.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/dup_ps.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/dup_ps.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/dup_ps.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/emitter_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/emitter_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/emitter_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/emitter_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/emitter_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/emitter_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/emitter_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/emitter_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/emitter_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/emitter_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/emitter_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/emitter_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/follow_path_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/follow_path_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/follow_path_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/follow_path_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/follow_path_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/follow_path_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/follow_path_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/follow_path_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/located_bindable_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_bindable_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/located_bindable_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_bindable_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/located_bindable_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_bindable_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/located_bindable_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_bindable_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/located_bindable_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_bindable_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/located_bindable_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_bindable_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/located_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/located_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/located_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/located_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/located_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/located_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/mesh_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/mesh_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/mesh_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/mesh_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/mesh_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/mesh_widget.cpp similarity index 99% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/mesh_widget.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/mesh_widget.cpp index debb0f157..e92ca7e20 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/mesh_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/mesh_widget.cpp @@ -86,10 +86,10 @@ void CMeshWidget::browseShape() setCursor(Qt::WaitCursor); if (!fileName.isEmpty()) { - NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(fileName.toStdString())); + NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(fileName.toUtf8().constData())); try { - std::string shapeName = NLMISC::CFile::getFilename(fileName.toStdString()); + std::string shapeName = NLMISC::CFile::getFilename(fileName.toUtf8().constData()); _ShapeParticle->setShape(shapeName); _ui.meshLineEdit->setText(shapeName.c_str()); touchPSState(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/mesh_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/mesh_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/mesh_widget.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/mesh_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/morph_mesh_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/morph_mesh_dialog.cpp similarity index 96% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/morph_mesh_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/morph_mesh_dialog.cpp index de88d14c8..20e19b539 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/morph_mesh_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/morph_mesh_dialog.cpp @@ -110,7 +110,7 @@ void CMorphMeshDialog::add() shapeNames.resize(_CM->getNumShapes() + 1); _CM->getShapesNames(&shapeNames[0]); uint index = (uint)shapeNames.size() - 1; - shapeNames[index] = fileName.toStdString(); + shapeNames[index] = fileName.toUtf8().constData(); _CM->setShapes(&shapeNames[0], (uint)shapeNames.size()); std::vector numVerts; _CM->getShapeNumVerts(numVerts); @@ -152,7 +152,7 @@ void CMorphMeshDialog::insert() std::vector shapeNames; shapeNames.resize(_CM->getNumShapes()); _CM->getShapesNames(&shapeNames[0]); - shapeNames.insert(shapeNames.begin() + row, fileName.toStdString()); + shapeNames.insert(shapeNames.begin() + row, fileName.toUtf8().constData()); _CM->setShapes(&shapeNames[0], (uint)shapeNames.size()); touchPSState(); updateMeshList(); @@ -172,7 +172,7 @@ void CMorphMeshDialog::change() if (!fileName.isEmpty()) { sint row = _ui.listWidget->currentRow(); - _CM->setShape(row, fileName.toStdString()); + _CM->setShape(row, fileName.toUtf8().constData()); updateMeshList(); touchPSState(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/morph_mesh_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/morph_mesh_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/morph_mesh_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/morph_mesh_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/morph_mesh_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/morph_mesh_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/morph_mesh_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/morph_mesh_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/multi_tex_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/multi_tex_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/multi_tex_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/multi_tex_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/multi_tex_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/multi_tex_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/multi_tex_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/multi_tex_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/multi_tex_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/multi_tex_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/multi_tex_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/multi_tex_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_control_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_control_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_control_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_control_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_control_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_control_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_control_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_control_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_control_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_control_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_control_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_control_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_editor.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_editor.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_editor.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_editor.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_editor.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_editor.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_editor.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_editor.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_force_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_force_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_force_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_force_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_force_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_force_page.cpp similarity index 97% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_force_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_force_page.cpp index e7e19abc9..2f9135e3d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_force_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_force_page.cpp @@ -185,11 +185,11 @@ void CForcePage::setDir(const NLMISC::CVector &value) void CForcePage::setGlobalName(const QString &globalName) { nlassert(_LBTarget); - dynamic_cast(_LBTarget)->enableGlobalVectorValue(globalName.toStdString()); + dynamic_cast(_LBTarget)->enableGlobalVectorValue(globalName.toUtf8().constData()); if (!globalName.isEmpty()) { // take a non NULL value for the direction - NL3D::CParticleSystem::setGlobalVectorValue(globalName.toStdString(), NLMISC::CVector::I); + NL3D::CParticleSystem::setGlobalVectorValue(globalName.toUtf8().constData(), NLMISC::CVector::I); } updateModifiedFlag(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_force_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_force_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_force_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_force_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_light_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_light_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_light_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_light_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_light_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_light_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_light_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_light_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_light_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_light_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_light_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_light_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_link_skeleton_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_link_skeleton_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_link_skeleton_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_link_skeleton_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_link_skeleton_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_link_skeleton_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_link_skeleton_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_link_skeleton_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_node.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_node.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_node.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_node.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_node.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_node.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_node.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_node.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_property_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_property_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_property_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_property_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_property_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_property_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_property_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_property_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_sound_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_sound_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_sound_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_sound_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_sound_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_sound_page.cpp similarity index 96% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_sound_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_sound_page.cpp index ce7034e56..ee9e77466 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_sound_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_sound_page.cpp @@ -122,7 +122,7 @@ void CSoundPage::browse() void CSoundPage::play() { - Modules::sound().play(_ui.soundNameLineEdit->text().toStdString()); + Modules::sound().play(_ui.soundNameLineEdit->text().toUtf8().constData()); } void CSoundPage::setSpawn(bool state) @@ -162,7 +162,7 @@ void CSoundPage::setKeepPitch(bool state) void CSoundPage::setSoundName(const QString &text) { - _Sound->setSoundName(NLMISC::CSheetId(text.toStdString())); + _Sound->setSoundName(NLMISC::CSheetId(text.toUtf8().constData())); } void CSoundPage::setEmissionPercent(float value) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_sound_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_sound_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_sound_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_sound_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_system_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_system_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_system_page.cpp similarity index 99% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_system_page.cpp index 072297437..7cdf0895b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_system_page.cpp @@ -50,7 +50,7 @@ static void chooseGlobalUserParam(uint userParam, NL3D::CParticleSystem *ps, QWi QString(ps->getGlobalValueName(userParam).c_str()), &ok); if (ok) - ps->bindGlobalValueToUserParam(text.toStdString(), userParam); + ps->bindGlobalValueToUserParam(text.toUtf8().constData(), userParam); } CParticleSystemPage::CParticleSystemPage(QWidget *parent) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_system_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_system_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_texture_anim_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_anim_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_texture_anim_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_anim_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_texture_anim_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_anim_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_texture_anim_widget.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_anim_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_texture_anim_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_anim_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_texture_anim_widget.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_anim_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_texture_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_texture_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_texture_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_widget.cpp similarity index 96% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_texture_widget.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_widget.cpp index f09e752da..82e171f19 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_texture_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_widget.cpp @@ -76,10 +76,10 @@ void CParticleTextureWidget::chooseTexture() if (!fileName.isEmpty()) { // Add search path for the texture - NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(fileName.toStdString())); + NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(fileName.toUtf8().constData())); try { - texName = NLMISC::CFile::getFilename(fileName.toStdString()); + texName = NLMISC::CFile::getFilename(fileName.toUtf8().constData()); NL3D::CTextureFile *tf = new NL3D::CTextureFile(texName); _Wrapper->setAndUpdateModifiedFlag(tf); _Texture = tf; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_texture_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_texture_widget.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_tree_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_tree_model.cpp similarity index 99% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_tree_model.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_tree_model.cpp index 2daebd6e4..1d9574b6d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_tree_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_tree_model.cpp @@ -319,7 +319,7 @@ bool CParticleTreeModel::setData(const QModelIndex &index, const QVariant &value QList listData; listData << value; item->replace(listData); - std::string name = value.toString().toStdString(); + std::string name = value.toString().toUtf8().constData(); if (item->itemType() == ItemType::Located) item->getLoc()->setName(name); else diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_tree_model.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_tree_model.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_tree_model.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_tree_model.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_dialog.cpp similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_dialog.cpp index 74182120c..4c92a5fc4 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_dialog.cpp @@ -348,7 +348,7 @@ void CParticleWorkspaceDialog::saveAsPS() tr("ps files (*.ps)")); // after check if (!fileName.isEmpty()) - node->savePSAs(fileName.toStdString()); + node->savePSAs(fileName.toUtf8().constData()); } } @@ -546,7 +546,7 @@ void CParticleWorkspaceDialog::bindNewLocatedBindable(int id) std::string name = toCreate->getName(); if (_PSElementIdentifiers.count(name)) { - name += (QString("%1").arg(++_PSElementIdentifiers[name])).toStdString(); + name += NLMISC::toString("%u", ++_PSElementIdentifiers[name]); toCreate->setName(name); } else @@ -770,12 +770,13 @@ NL3D::CPSLocated *CParticleWorkspaceDialog::createLocated(NL3D::CParticleSystem { // build new name std::string name; - if (_PSElementIdentifiers.count(std::string("located"))) - name = (QString("located %1").arg(++_PSElementIdentifiers[std::string("located")])).toStdString(); - + if (_PSElementIdentifiers.count("located")) + { + name = NLMISC::toString("located %u", ++_PSElementIdentifiers["located"]); + } else { - name = std::string("located 0"); + name = "located 0"; _PSElementIdentifiers["located"] = 0; } NL3D::CPSLocated *loc = new NL3D::CPSLocated; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_page.cpp similarity index 94% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_page.cpp index 3f2dd1657..62ffb6d3b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_page.cpp @@ -63,7 +63,7 @@ void CWorkspacePage::newWP() tr("pws files (*.pws)")); if (!fileName.isEmpty()) { - Modules::psEdit().createNewWorkspace(fileName.toStdString()); + Modules::psEdit().createNewWorkspace(fileName.toUtf8().constData()); _treeModel->setupModelFromWorkSpace(); _ui.saveToolButton->setEnabled(true); _ui.saveAsToolButton->setEnabled(true); @@ -83,7 +83,7 @@ void CWorkspacePage::loadWP() setCursor(Qt::WaitCursor); if (!fileName.isEmpty()) { - Modules::psEdit().loadWorkspace(fileName.toStdString()); + Modules::psEdit().loadWorkspace(fileName.toUtf8().constData()); _treeModel->setupModelFromWorkSpace(); _ui.unloadToolButton->setEnabled(true); _ui.saveToolButton->setEnabled(true); @@ -109,7 +109,7 @@ void CWorkspacePage::saveAsWP() tr("pws files (*.pws)")); if (!fileName.isEmpty()) { - Modules::psEdit().getParticleWorkspace()->setFileName(fileName.toStdString()); + Modules::psEdit().getParticleWorkspace()->setFileName(fileName.toUtf8().constData()); Modules::psEdit().saveWorkspaceStructure(); Modules::psEdit().saveWorkspaceContent(); _treeModel->setupModelFromWorkSpace(); @@ -125,7 +125,7 @@ void CWorkspacePage::insertPS() if (!fileName.isEmpty()) { // TODO: create method particle editor insertNewPS and multiple add - CWorkspaceNode *node = Modules::psEdit().getParticleWorkspace()->addNode(NLMISC::CFile::getFilename(fileName.toStdString())); + CWorkspaceNode *node = Modules::psEdit().getParticleWorkspace()->addNode(NLMISC::CFile::getFilename(fileName.toUtf8().constData())); if (node != 0) { try @@ -158,14 +158,14 @@ void CWorkspacePage::createPS() { // TODO: create method particle editor createNewPS - if (Modules::psEdit().getParticleWorkspace()->containsFile(NLMISC::CFile::getFilename(fileName.toStdString()))) + if (Modules::psEdit().getParticleWorkspace()->containsFile(NLMISC::CFile::getFilename(fileName.toUtf8().constData()))) { QMessageBox::critical(this, tr("NeL particle system editor"), tr("Failed to create new particle system"), QMessageBox::Ok); return; } - CWorkspaceNode *node = Modules::psEdit().getParticleWorkspace()->addNode(NLMISC::CFile::getFilename(fileName.toStdString())); + CWorkspaceNode *node = Modules::psEdit().getParticleWorkspace()->addNode(NLMISC::CFile::getFilename(fileName.toUtf8().constData())); // should always succeed because we tested if file already exists nlassert(node); node->createEmptyPS(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_zone_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_zone_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_zone_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_zone_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_zone_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_zone_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_zone_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_zone_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_zone_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_zone_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_zone_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_zone_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ps_initial_pos.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_initial_pos.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ps_initial_pos.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_initial_pos.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ps_initial_pos.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_initial_pos.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ps_initial_pos.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_initial_pos.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ps_mover_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_mover_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ps_mover_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_mover_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ps_mover_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_mover_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ps_mover_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_mover_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ps_mover_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_mover_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ps_mover_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_mover_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ps_wrapper.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_wrapper.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ps_wrapper.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_wrapper.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_bank_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_bank_dialog.cpp similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_bank_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_bank_dialog.cpp index bca0f4879..af8a4829f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_bank_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_bank_dialog.cpp @@ -61,7 +61,7 @@ void CSchemeBankDialog::createScheme() if (ok && !text.isEmpty()) { NL3D::CPSAttribMakerBase *attribMakerBase = _attribWidget->getCurrentSchemePtr()->clone(); - Modules::psEdit().getSchemeManager()->insertScheme(text.toStdString(), attribMakerBase); + Modules::psEdit().getSchemeManager()->insertScheme(text.toUtf8().constData(), attribMakerBase); CSchemeItem *item = new CSchemeItem(text, _ui.listWidget); item->setUserData(attribMakerBase); @@ -108,7 +108,7 @@ void CSchemeBankDialog::saveBank() try { NLMISC::COFile iF; - iF.open(fileName.toStdString()); + iF.open(fileName.toUtf8().constData()); NLQT::CSchemeManager *schemeManager = Modules::psEdit().getSchemeManager(); iF.serial(*schemeManager); } @@ -132,7 +132,7 @@ void CSchemeBankDialog::loadBank() try { NLMISC::CIFile iF; - iF.open(fileName.toStdString()); + iF.open(fileName.toUtf8().constData()); iF.serial(sm); Modules::psEdit().getSchemeManager()->swap(sm); } @@ -152,7 +152,7 @@ void CSchemeBankDialog::changeNameScheme(QListWidgetItem *item) NL3D::CPSAttribMakerBase *attrib = schemeItem->getUserData(); nlassert(attrib); - Modules::psEdit().getSchemeManager()->rename(attrib, item->text().toStdString()); + Modules::psEdit().getSchemeManager()->rename(attrib, item->text().toUtf8().constData()); } void CSchemeBankDialog::enableButtons() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_bank_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_bank_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_bank_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_bank_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_bank_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_bank_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_bank_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_bank_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_manager.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_manager.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_manager.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scheme_manager.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/spinner_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/spinner_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/spinner_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/spinner_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/spinner_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/spinner_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/spinner_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/spinner_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tail_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/tail_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tail_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/tail_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tail_particle_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/tail_particle_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tail_particle_widget.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/tail_particle_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tail_particle_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/tail_particle_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tail_particle_widget.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/tail_particle_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_blender_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_blender_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_blender_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_blender_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_blender_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_blender_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_blender_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_blender_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_from_emitter_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_from_emitter_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_from_emitter_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_from_emitter_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_gradient_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_gradient_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_gradient_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_gradient_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_gradient_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/value_gradient_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_gradient_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/workspace_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/workspace_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/workspace_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/workspace_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_dialog.cpp similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_dialog.cpp index 0ff05e5dd..01f4c434b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_dialog.cpp @@ -90,7 +90,7 @@ void CAnimationDialog::setCurrentShape(const QString &name) { if (name.isEmpty()) return; - CEntity &entity = Modules::objView().getEntity(name.toStdString()); + CEntity &entity = Modules::objView().getEntity(name.toUtf8().constData()); _ui.inPlaceCheckBox->setChecked(entity.getInPlace()); _ui.incPosCheckBox->setChecked(entity.getIncPos()); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_set_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_set_dialog.cpp similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_set_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_set_dialog.cpp index fa779d63a..f2d5e6567 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_set_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_set_dialog.cpp @@ -57,7 +57,7 @@ void CAnimationSetDialog::setCurrentShape(const QString &name) if (name.isEmpty()) return; - Modules::objView().setCurrentObject(name.toStdString()); + Modules::objView().setCurrentObject(name.toUtf8().constData()); updateListAnim(); @@ -161,8 +161,7 @@ void CAnimationSetDialog::loadAnim() QStringList::Iterator it = list.begin(); while(it != list.end()) { - std::string animName = it->toStdString(); - entity.loadAnimation(animName); + entity.loadAnimation(it->toUtf8().constData()); ++it; } updateListAnim(); @@ -187,8 +186,7 @@ void CAnimationSetDialog::loadSwt() QStringList::Iterator it = list.begin(); while(it != list.end()) { - std::string swtName = it->toStdString(); - entity.loadSWT(swtName); + entity.loadSWT(it->toUtf8().constData()); ++it; } updateListAnim(); @@ -212,8 +210,7 @@ void CAnimationSetDialog::addAnim() Q_FOREACH(QTreeWidgetItem *item, list) { - std::string animName = item->text(0).toStdString(); - entity.addAnimToPlayList(animName); + entity.addAnimToPlayList(item->text(0).toUtf8().constData()); ui.animPlaylistWidget->addItem(item->text(0)); } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_set_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_set_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_set_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_set_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_set_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_set_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/animation_set_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_set_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/camera_control.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/camera_control.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/camera_control.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/camera_control.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/camera_control.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/camera_control.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/camera_control.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/camera_control.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/day_night_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/day_night_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/day_night_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/day_night_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/day_night_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/day_night_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/day_night_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/day_night_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/day_night_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/day_night_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/day_night_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/day_night_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/entity.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/entity.cpp similarity index 97% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/entity.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/entity.cpp index 1aaacbf6e..f5a1b5094 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/entity.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/entity.cpp @@ -117,7 +117,7 @@ CEntity::~CEntity(void) } } -void CEntity::loadAnimation(std::string &fileName) +void CEntity::loadAnimation(const std::string &fileName) { uint id = _AnimationSet->addAnimation(fileName.c_str(),CFile::getFilenameWithoutExtension(fileName).c_str()); _AnimationList.push_back(_AnimationSet->getAnimationName(id)); @@ -128,13 +128,13 @@ void CEntity::loadAnimation(std::string &fileName) _PlayList->registerTransform(_Instance); } -void CEntity::loadSWT(std::string &fileName) +void CEntity::loadSWT(const std::string &fileName) { uint id = _AnimationSet->addSkeletonWeight(fileName.c_str(),CFile::getFilenameWithoutExtension(fileName).c_str()); _SWTList.push_back(_AnimationSet->getSkeletonWeightName(id)); } -void CEntity::addAnimToPlayList(std::string &name) +void CEntity::addAnimToPlayList(const std::string &name) { _PlayListAnimation.push_back(name); @@ -176,7 +176,7 @@ void CEntity::reset() _PlayList->resetAllChannels(); } -float CEntity::getPlayListLength() +float CEntity::getPlayListLength() const { // Accumul all the time float time = 0; @@ -185,7 +185,7 @@ float CEntity::getPlayListLength() return time; } -float CEntity::getAnimLength(std::string name) +float CEntity::getAnimLength(const std::string &name) const { uint id = _AnimationSet->getAnimationIdByName(name.c_str()); NL3D::UAnimation *anim = _AnimationSet->getAnimation(id); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/entity.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/entity.h similarity index 93% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/entity.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/entity.h index ea1d53e25..47dad0386 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/entity.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/entity.h @@ -109,14 +109,14 @@ public: /// Loads a file animations /// @param fileName - name animation file - void loadAnimation(std::string &fileName); + void loadAnimation(const std::string &fileName); /// Loads a file skeleton weight - void loadSWT(std::string &fileName); + void loadSWT(const std::string &fileName); /// Adds an animation to a playlist /// @param name - name loaded animations - void addAnimToPlayList(std::string &name); + void addAnimToPlayList(const std::string &name); /// Removes the animation from a playlist /// @param row - number of animations in the playlist @@ -135,10 +135,10 @@ public: /// Get the total time of animation playlist /// @return total time of animation - float getPlayListLength(); + float getPlayListLength() const; /// get time length single animation - float getAnimLength(std::string name); + float getAnimLength(const std::string &name) const; /// Get slot infomation void setSlotInfo(uint num, CSlotInfo &slotInfo) @@ -159,7 +159,7 @@ public: } /// Get in place mode - bool getInPlace() + bool getInPlace() const { return _inPlace; } @@ -171,35 +171,35 @@ public: } /// Get inc position - bool getIncPos() + bool getIncPos() const { return _incPos; } /// Get information about the current status of playing a playlist /// @return struct containing current information playback - SAnimationStatus getStatus() + SAnimationStatus getStatus() const { return _AnimationStatus; } /// Get name entity /// @return name entity - std::string getName() + std::string getName() const { return _Name; } /// Get file name shape /// @return file name shape - std::string getFileNameShape() + std::string getFileNameShape() const { return _FileNameShape; } /// Get file name skeleton /// @return file name skeleton - std::string getFileNameSkeleton() + std::string getFileNameSkeleton() const { return _FileNameSkeleton; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/global_wind_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/global_wind_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/global_wind_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/global_wind_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/global_wind_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/global_wind_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/global_wind_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/setup_fog_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/setup_fog_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/setup_fog_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/setup_fog_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/setup_fog_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/setup_fog_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/setup_fog_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/setup_fog_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/setup_fog_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/setup_fog_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/setup_fog_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/setup_fog_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/skeleton_scale_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_scale_dialog.cpp similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/skeleton_scale_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_scale_dialog.cpp index a4221279e..8145c0bcc 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/skeleton_scale_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_scale_dialog.cpp @@ -93,8 +93,8 @@ void CSkeletonScaleDialog::setCurrentShape(const QString &name) if (name.isEmpty()) return; - _Skeleton = Modules::objView().getEntity(name.toStdString()).getSkeleton(); - _SkeletonFileName = Modules::objView().getEntity(name.toStdString()).getFileNameSkeleton(); + _Skeleton = Modules::objView().getEntity(name.toUtf8().constData()).getSkeleton(); + _SkeletonFileName = Modules::objView().getEntity(name.toUtf8().constData()).getFileNameSkeleton(); // Setup Bone mirror _Bones.clear(); @@ -290,7 +290,7 @@ void CSkeletonScaleDialog::clickSaveAsSkel() { NLMISC::COFile f; - if( f.open(fileName.toStdString()) ) + if( f.open(fileName.toUtf8().constData()) ) { if(saveCurrentInStream(f)) { @@ -300,7 +300,7 @@ void CSkeletonScaleDialog::clickSaveAsSkel() } // bkup the valid fileName (new file edited) - _SkeletonFileName = fileName.toStdString(); + _SkeletonFileName = fileName.toUtf8().constData(); } else { @@ -324,7 +324,7 @@ void CSkeletonScaleDialog::clickLoadScale() if (!fileName.isEmpty()) { NLMISC::CIFile f; - if( f.open(fileName.toStdString()) ) + if( f.open(fileName.toUtf8().constData()) ) loadSkelScaleFromStream(f); else QMessageBox::critical(this, tr("Skeleton scale editor"), tr("Failed to open file for read!"), QMessageBox::Ok); @@ -345,7 +345,7 @@ void CSkeletonScaleDialog::clickSaveScale() if (!fileName.isEmpty()) { NLMISC::COFile f; - if( f.open(fileName.toStdString()) ) + if( f.open(fileName.toUtf8().constData()) ) saveSkelScaleInStream(f); else QMessageBox::critical(this, tr("Skeleton scale editor"), tr("Failed to open file for write!"), QMessageBox::Ok); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/skeleton_scale_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_scale_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/skeleton_scale_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_scale_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/skeleton_scale_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_scale_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/skeleton_scale_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_scale_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/skeleton_tree_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_tree_model.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/skeleton_tree_model.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_tree_model.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/skeleton_tree_model.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_tree_model.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/skeleton_tree_model.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_tree_model.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/slot_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/slot_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/slot_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/slot_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/slot_manager_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/slot_manager_dialog.cpp similarity index 97% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/slot_manager_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/slot_manager_dialog.cpp index d5fc6f42b..f846bdf4a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/slot_manager_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/slot_manager_dialog.cpp @@ -111,8 +111,8 @@ void CSlotGroupBox::updateUi() void CSlotGroupBox::saveSlotInfo() { CSlotInfo slotInfo; - slotInfo.Animation = _animName.toStdString(); - slotInfo.Skeleton = _skelName.toStdString(); + slotInfo.Animation = _animName.toUtf8().constData(); + slotInfo.Skeleton = _skelName.toUtf8().constData(); slotInfo.EndBlend = _ui.endBlendSpinBox->value(); slotInfo.EndTime = float(_ui.endFrameSpinBox->value()) / Modules::mainWin().getFrameRate(); slotInfo.Offset = float(_ui.offsetSpinBox->value()) / Modules::mainWin().getFrameRate(); @@ -182,7 +182,7 @@ void CSlotGroupBox::selectAnim() _animName = item; QString title = tr("Slot %1 : ").arg(_numSlot) + _animName + " : " + _skelName; this->setTitle(title); - _ui.endFrameSpinBox->setValue(int(entity.getAnimLength(_animName.toStdString()) * Modules::mainWin().getFrameRate())); + _ui.endFrameSpinBox->setValue(int(entity.getAnimLength(_animName.toUtf8().constData()) * Modules::mainWin().getFrameRate())); saveSlotInfo(); } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/slot_manager_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/slot_manager_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/slot_manager_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/slot_manager_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sun_color_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/sun_color_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sun_color_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/sun_color_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sun_color_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/sun_color_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sun_color_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/sun_color_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sun_color_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/sun_color_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sun_color_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/sun_color_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_mrm_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_mrm_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_mrm_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_mrm_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_mrm_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_mrm_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_mrm_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_mrm_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_mrm_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_mrm_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_mrm_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_mrm_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_timer_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_timer_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_timer_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_timer_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_timer_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/tune_timer_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_timer_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/water_pool_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/water_pool_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/water_pool_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/water_pool_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/water_pool_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/water_pool_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/water_pool_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/water_pool_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/water_pool_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/water_pool_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/water_pool_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/water_pool_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.cpp index 5ca313b0f..afa315e0f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.cpp @@ -86,12 +86,12 @@ void CSoundSystem::init() QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup(Constants::OBJECT_VIEWER_SECTION); - _PackedSheetPath = settings->value(Constants::SOUND_PACKED_SHEET_PATH, "").toString().toStdString(); - _SamplePath = settings->value(Constants::SOUND_SAMPLE_PATH, "").toString().toStdString(); + _PackedSheetPath = settings->value(Constants::SOUND_PACKED_SHEET_PATH, "").toString().toUtf8().constData(); + _SamplePath = settings->value(Constants::SOUND_SAMPLE_PATH, "").toString().toUtf8().constData(); _AudioMixer->setSamplePath(_SamplePath); _AudioMixer->setPackedSheetOption(_PackedSheetPath, true); std::vector devices; - _AudioMixer->initDriver(settings->value(Constants::SOUND_DRIVER, "Auto").toString().toStdString()); + _AudioMixer->initDriver(settings->value(Constants::SOUND_DRIVER, "Auto").toString().toUtf8().constData()); _AudioMixer->getDevices(devices); NLSOUND::UAudioMixer::CInitInfo audioInfo; audioInfo.AutoLoadSample = settings->value(Constants::SOUND_AUTO_LOAD_SAMPLE, true).toBool(); @@ -101,7 +101,7 @@ void CSoundSystem::init() audioInfo.ForceSoftware = settings->value(Constants::SOUND_FORCE_SOFTWARE, false).toBool(); audioInfo.MaxTrack = settings->value(Constants::SOUND_MAX_TRACK, 48).toInt(); audioInfo.UseADPCM = settings->value(Constants::SOUND_USE_ADCPM, false).toBool(); - _AudioMixer->initDevice(settings->value(Constants::SOUND_DEVICE, "").toString().toStdString(), audioInfo, NULL); + _AudioMixer->initDevice(settings->value(Constants::SOUND_DEVICE, "").toString().toUtf8().constData(), audioInfo, NULL); _AudioMixer->setLowWaterMark(1); settings->endGroup(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/stdpch.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/stdpch.h index d9dcf4d58..fbb367fc8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/stdpch.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/stdpch.h @@ -20,7 +20,8 @@ #ifndef NL_STDPCH_H #define NL_STDPCH_H -#include +#include +#include #include #include @@ -28,6 +29,97 @@ #include #include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include #endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_appearance_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_appearance_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_appearance_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_appearance_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_appearance_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_appearance_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_appearance_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_appearance_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_apperance_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_apperance_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_apperance_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_apperance_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_density_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_density_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_density_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_density_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_density_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_density_page.cpp similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_density_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_density_page.cpp index 04d42828f..ba70b4c9f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_density_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_density_page.cpp @@ -145,13 +145,13 @@ void CVegetableDensityPage::browseShapeVeget() if (!fileName.isEmpty()) { // Add search path for the .veget - NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(fileName.toStdString())); + NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(fileName.toUtf8().constData())); try { // update shapeName and view - _Vegetable->ShapeName = NLMISC::CFile::getFilename(fileName.toStdString()); - _ui.meshLineEdit->setText(QString(NLMISC::CFile::getFilename(fileName.toStdString()).c_str())); + _Vegetable->ShapeName = NLMISC::CFile::getFilename(fileName.toUtf8().constData()); + _ui.meshLineEdit->setText(QString::fromUtf8(_Vegetable->ShapeName.c_str())); // update the name in the list-box Q_EMIT vegetNameChanged(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_density_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_density_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_density_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_density_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_dialog.cpp similarity index 96% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_dialog.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_dialog.cpp index ed7271e66..2fc621411 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_dialog.cpp @@ -68,7 +68,7 @@ void CVegetableDialog::loadVegetset() { NL3D::CTileVegetableDesc vegetSet; // if succes to load the vegetSet - if(Modules::veget().loadVegetableSet(vegetSet, fileName.toStdString())) + if(Modules::veget().loadVegetableSet(vegetSet, fileName.toUtf8().constData())) { // Delete all vegetables. Modules::veget().clearVegetables(); @@ -94,7 +94,7 @@ void CVegetableDialog::appendVegetset() { NL3D::CTileVegetableDesc vegetSet; // if succes to load the vegetSet - if(Modules::veget().loadVegetableSet(vegetSet, fileName.toStdString())) + if(Modules::veget().loadVegetableSet(vegetSet, fileName.toUtf8().constData())) { // Do not Delete any vegetables. // build them from list. @@ -124,7 +124,7 @@ void CVegetableDialog::saveVegetset() { NLMISC::COFile f; - if( f.open(fileName.toStdString()) ) + if( f.open(fileName.toUtf8().constData()) ) { try { @@ -226,7 +226,7 @@ void CVegetableDialog::loadVegetdesc() { NLMISC::CIFile f; - if( f.open(fileName.toStdString()) ) + if( f.open(fileName.toUtf8().constData()) ) { NL3D::CVegetable veget; try @@ -272,7 +272,7 @@ void CVegetableDialog::saveVegetdesc() { NLMISC::COFile f; - if( f.open(fileName.toStdString()) ) + if( f.open(fileName.toUtf8().constData()) ) { try { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_dialog.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_dialog_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_dialog_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_dialog_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_dialog_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_editor.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_editor.cpp similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_editor.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_editor.cpp index b6a3b89dc..73b639647 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_editor.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_editor.cpp @@ -596,15 +596,15 @@ void CVegetableEditor::loadLandscapeSetup() QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup(Constants::OBJECT_VIEWER_SECTION); - _VegetableLandscapeTileBank = settings->value(Constants::VEGET_TILE_BANK, "").toString().toStdString(); - _VegetableLandscapeTileFarBank = settings->value(Constants::VEGET_TILE_FAR_BANK, "").toString().toStdString(); - _CoarseMeshTexture = settings->value(Constants::COARSE_MESH_TEXTURE, "").toString().toStdString(); - _VegetableTexture = settings->value(Constants::VEGET_TEXTURE, "").toString().toStdString(); + _VegetableLandscapeTileBank = settings->value(Constants::VEGET_TILE_BANK, "").toString().toUtf8().constData(); + _VegetableLandscapeTileFarBank = settings->value(Constants::VEGET_TILE_FAR_BANK, "").toString().toUtf8().constData(); + _CoarseMeshTexture = settings->value(Constants::COARSE_MESH_TEXTURE, "").toString().toUtf8().constData(); + _VegetableTexture = settings->value(Constants::VEGET_TEXTURE, "").toString().toUtf8().constData(); QStringList list = settings->value(Constants::VEGET_LANDSCAPE_ZONES).toStringList(); _VegetableLandscapeZoneNames.clear(); for (int i = 0; i < list.size(); ++i) - _VegetableLandscapeZoneNames.push_back(list[i].toStdString()); + _VegetableLandscapeZoneNames.push_back(list[i].toUtf8().constData()); settings->endGroup(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_editor.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_editor.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_editor.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_editor.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_landscape_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_landscape_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_landscape_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_landscape_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_landscape_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_landscape_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_landscape_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_landscape_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_landscape_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_landscape_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_landscape_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_landscape_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_node.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_node.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_node.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_node.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_node.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_node.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_node.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_node.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_noise_value_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_noise_value_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_noise_value_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_noise_value_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_noise_value_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_noise_value_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_noise_value_widget.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_noise_value_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_noise_value_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_noise_value_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_noise_value_widget.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_noise_value_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_rotate_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_rotate_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_rotate_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_rotate_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_rotate_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_rotate_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_rotate_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_rotate_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_rotate_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_rotate_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_rotate_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_rotate_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_scale_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_scale_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_scale_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_scale_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_scale_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_scale_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_scale_page.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_scale_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_scale_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_scale_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_scale_page.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_scale_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/color_edit_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/color_edit_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/color_edit_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/color_edit_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/color_edit_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/color_edit_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/color_edit_widget.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/color_edit_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/color_edit_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/color_edit_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/color_edit_widget.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/color_edit_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/edit_range_float_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_float_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/edit_range_float_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_float_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/edit_range_uint_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_uint_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/edit_range_uint_form.ui rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_uint_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/edit_range_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/edit_range_widget.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/edit_range_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/edit_range_widget.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/hoverpoints.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/hoverpoints.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/hoverpoints.cpp rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/hoverpoints.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/hoverpoints.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/hoverpoints.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/hoverpoints.h rename to code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/hoverpoints.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilderdialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilderdialog.cpp index 69e5da30e..c999daa17 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilderdialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilderdialog.cpp @@ -119,7 +119,7 @@ void SheetBuilderDialog::buildSheet() bool clean = chckClean->isChecked(); - string outputFileName(outputFile.toStdString()); + string outputFileName(outputFile.toUtf8()); if (outputFileName.empty()) { @@ -129,11 +129,11 @@ void SheetBuilderDialog::buildSheet() list inputDirs; Q_FOREACH (QString str, paths) - inputDirs.push_back(str.toStdString()); + inputDirs.push_back(str.toUtf8().constData()); Q_FOREACH (QString str, extensions) { - ExtensionsAllowed.insert(str.toStdString()); + ExtensionsAllowed.insert(str.toUtf8().constData()); } // get the current associations (read the sheet_id and fill the working structures) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.cpp index 805e2361d..01ec90fe1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.cpp @@ -40,7 +40,7 @@ namespace TranslationManager void CEditorPhrase::open(QString filename) { std::vector phrases; - if(readPhraseFile(filename.toStdString(), phrases, false)) + if(readPhraseFile(filename.toUtf8().constData(), phrases, false)) { text_edit = new CTextEdit(this); text_edit->setUndoStack(current_stack); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_worksheet.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_worksheet.cpp index f9b216da6..9df0655ac 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_worksheet.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_worksheet.cpp @@ -37,7 +37,7 @@ namespace TranslationManager void CEditorWorksheet::open(QString filename) { STRING_MANAGER::TWorksheet wk_file; - if(loadExcelSheet(filename.toStdString(), wk_file, true) == true) + if(loadExcelSheet(filename.toUtf8().constData(), wk_file, true) == true) { bool hasHashValue = false; table_editor = new QTableWidget(); @@ -149,7 +149,7 @@ void CEditorWorksheet::save() void CEditorWorksheet::saveAs(QString filename) { STRING_MANAGER::TWorksheet new_file, wk_file; - loadExcelSheet(current_file.toStdString(), wk_file, true); + loadExcelSheet(current_file.toUtf8().constData(), wk_file, true); // set columns new_file.resize(new_file.size() + 1); for(unsigned int i = 0; i < wk_file.ColCount; i++) @@ -185,7 +185,7 @@ void CEditorWorksheet::saveAs(QString filename) makeHashCode(wk_file, true); } ucstring s = prepareExcelSheet(new_file); - NLMISC::CI18N::writeTextFile(filename.toStdString(), s, false); + NLMISC::CI18N::writeTextFile(filename.toUtf8().constData(), s, false); current_file = filename; setCurrentFile(filename); } @@ -299,29 +299,29 @@ void CEditorWorksheet::extractWords(QString filename, QString columnId, IWordLis // **** Load the excel sheet // load STRING_MANAGER::TWorksheet workSheet; - if(!loadExcelSheet(filename.toStdString(), workSheet, true)) + if(!loadExcelSheet(filename.toUtf8().constData(), workSheet, true)) { - nlwarning("Error reading '%s'. Aborted", filename.toStdString().c_str()); + nlwarning("Error reading '%s'. Aborted", filename.toUtf8().constData()); return; } // get the key column index uint keyColIndex = 0; - if(!workSheet.findCol(columnId.toStdString(), keyColIndex)) + if(!workSheet.findCol(ucstring(columnId.toUtf8().constData()), keyColIndex)) { - nlwarning("Error: Don't find the column '%s'. '%s' Aborted", columnId.toStdString().c_str(), filename.toStdString().c_str()); + nlwarning("Error: Don't find the column '%s'. '%s' Aborted", columnId.toUtf8().constData(), filename.toUtf8().constData()); return; } // get the name column index uint nameColIndex; if(!workSheet.findCol(ucstring("name"), nameColIndex)) { - nlwarning("Error: Don't find the column 'name'. '%s' Aborted", filename.toStdString().c_str()); + nlwarning("Error: Don't find the column 'name'. '%s' Aborted", filename.toUtf8().constData()); return; } // **** List all words with the builder given std::vector allWords; - if(!wordListBuilder.buildWordList(allWords, filename.toStdString())) + if(!wordListBuilder.buildWordList(allWords, filename.toUtf8().constData())) { return; } @@ -380,7 +380,7 @@ bool CEditorWorksheet::compareWorksheetFile(QString filename) { STRING_MANAGER::TWorksheet wk_file; int colIndex = 0; - if(loadExcelSheet(filename.toStdString(), wk_file, true) == true) + if(loadExcelSheet(filename.toUtf8().constData(), wk_file, true) == true) { if(wk_file.getData(0, 0) == ucstring("*HASH_VALUE")) { @@ -392,11 +392,12 @@ bool CEditorWorksheet::compareWorksheetFile(QString filename) } for(int i = 0; i < table_editor->columnCount(); i++) { - QString item = table_editor->horizontalHeaderItem(i)->text(); + ucstring item; + item.fromUtf8(table_editor->horizontalHeaderItem(i)->text().toUtf8().constData()); ucstring itemC = wk_file.getData(0, i+ colIndex); - if(item.toStdString() != itemC.toString()) + if(item != itemC) { - nlwarning(item.toStdString().c_str()); + nlwarning(item.toString().c_str()); nlwarning(itemC.toString().c_str()); return false; } @@ -412,7 +413,7 @@ bool CEditorWorksheet::compareWorksheetFile(QString filename) void CEditorWorksheet::mergeWorksheetFile(QString filename) { STRING_MANAGER::TWorksheet wk_file; - if(loadExcelSheet(filename.toStdString(), wk_file, true) == true) + if(loadExcelSheet(filename.toUtf8().constData(), wk_file, true) == true) { bool hasHashValue = false; int colIndex = 0; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp index 306c30ea9..9fcb9626a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp @@ -300,8 +300,8 @@ void CMainWindow::initializeSettings(bool georges = false) { if(georges == true && initialize_settings["georges"] == false) { - NLMISC::CPath::addSearchPath(level_design_path.toStdString() + "/DFN", true, false); - NLMISC::CPath::addSearchPath(level_design_path.toStdString() + "/Game_elem/Creature", true, false); + NLMISC::CPath::addSearchPath(std::string(level_design_path.toUtf8().constData()) + "/DFN", true, false); + NLMISC::CPath::addSearchPath(std::string(level_design_path.toUtf8().constData()) + "/Game_elem/Creature", true, false); initialize_settings["georges"] = true; } @@ -357,34 +357,34 @@ void CMainWindow::extractWords(QString typeq) { column_name = "item ID"; builderS.SheetExt = "sitem"; - builderS.SheetPath = level_design_path.append("/game_element/sitem").toStdString(); + builderS.SheetPath = level_design_path.append("/game_element/sitem").toUtf8().constData(); isSheet = true; } else if(typeq.toAscii() == Constants::WK_CREATURE) { column_name = "creature ID"; builderS.SheetExt = "creature"; - builderS.SheetPath = level_design_path.append("/Game_elem/Creature/fauna").toStdString(); + builderS.SheetPath = level_design_path.append("/Game_elem/Creature/fauna").toUtf8().constData(); isSheet = true; } else if(typeq.toAscii() == Constants::WK_SBRICK) { column_name = "sbrick ID"; builderS.SheetExt = "sbrick"; - builderS.SheetPath = level_design_path.append("/game_element/sbrick").toStdString(); + builderS.SheetPath = level_design_path.append("/game_element/sbrick").toUtf8().constData(); isSheet = true; } else if(typeq.toAscii() == Constants::WK_SPHRASE) { column_name = "sphrase ID"; builderS.SheetExt = "sphrase"; - builderS.SheetPath = level_design_path.append("/game_element/sphrase").toStdString(); + builderS.SheetPath = level_design_path.append("/game_element/sphrase").toUtf8().constData(); isSheet = true; } else if(typeq.toAscii() == Constants::WK_PLACE) { column_name = "placeId"; - builderP.PrimPath = primitives_path.toStdString(); + builderP.PrimPath = primitives_path.toUtf8().constData(); builderP.PrimFilter.push_back("region_*.primitive"); builderP.PrimFilter.push_back("indoors_*.primitive"); isSheet = false; @@ -428,7 +428,7 @@ void CMainWindow::extractBotNames() QApplication::setOverrideCursor(Qt::WaitCursor); initializeSettings(true); - editor_window->extractBotNames(convertQStringList(filters), level_design_path.toStdString(), ligoConfig); + editor_window->extractBotNames(convertQStringList(filters), level_design_path.toUtf8().constData(), ligoConfig); QApplication::restoreOverrideCursor(); } } @@ -627,7 +627,7 @@ std::list CMainWindow::convertQStringList(QStringList listq) Q_FOREACH(QString text, listq) { - stdlist.push_back(text.toStdString()); + stdlist.push_back(text.toUtf8().constData()); } return stdlist; } @@ -635,7 +635,7 @@ std::list CMainWindow::convertQStringList(QStringList listq) bool CMainWindow::isWorksheetEditor(QString filename) { STRING_MANAGER::TWorksheet wk_file; - if(loadExcelSheet(filename.toStdString(), wk_file, true) == true) + if(loadExcelSheet(filename.toUtf8().constData(), wk_file, true) == true) { if(wk_file.ColCount > 1) return true; @@ -646,7 +646,7 @@ bool CMainWindow::isWorksheetEditor(QString filename) bool CMainWindow::isPhraseEditor(QString filename) { vector phrases; - return readPhraseFile(filename.toStdString(), phrases, false); + return readPhraseFile(filename.toUtf8().constData(), phrases, false); } } /* namespace TranslationManager */ diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_collision.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_collision.cpp index 4aea7d654..8ff853031 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_collision.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_collision.cpp @@ -19,8 +19,8 @@ #include "nel/misc/file.h" #include "nel/misc/o_xml.h" -#include "nel/../../src/pacs/collision_mesh_build.h" -#include "nel/../../src/pacs/primitive_block.h" +#include "nel/pacs/collision_mesh_build.h" +#include "nel/pacs/primitive_block.h" #include "../nel_mesh_lib/export_nel.h" #include "../nel_mesh_lib/export_appdata.h" diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp index ae0b15263..81efc7d4c 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_view.cpp @@ -25,8 +25,8 @@ #include "nel/3d/water_pool_manager.h" #include "nel/3d/instance_lighter.h" -#include "nel/../../src/pacs/retriever_bank.h" -#include "nel/../../src/pacs/global_retriever.h" +#include "nel/pacs/retriever_bank.h" +#include "nel/pacs/global_retriever.h" #include "../../object_viewer/object_viewer_interface.h" diff --git a/code/nel/tools/3d/plugin_max/nel_export/std_afx.h b/code/nel/tools/3d/plugin_max/nel_export/std_afx.h index c9ce76d89..9b4b18357 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/std_afx.h +++ b/code/nel/tools/3d/plugin_max/nel_export/std_afx.h @@ -14,6 +14,19 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#ifndef STDAFX_H +#define STDAFX_H + +#include + +#ifdef _STLPORT_VERSION +namespace std +{ + float fabsf(float f); + double fabsl(double f); +} +#endif + #include #include #include @@ -36,7 +49,7 @@ # include # include # include -# include +# include #else # include # include @@ -58,3 +71,5 @@ #endif #include "nel/misc/bsphere.h" + +#endif diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/StdAfx.h b/code/nel/tools/3d/plugin_max/nel_mesh_lib/StdAfx.h index dfbd11915..cb2cec48f 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/StdAfx.h +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/StdAfx.h @@ -49,6 +49,7 @@ #include #include +#include #include "../nel_patch_lib/rpo.h" #include "nel/misc/time_nl.h" diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp index 16c3ae727..ecc9e8127 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_collision.cpp @@ -14,9 +14,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include -#include - #include "stdafx.h" #include "export_nel.h" #include "export_appdata.h" @@ -25,11 +22,11 @@ #include "../nel_export/nel_export.h" #include "../nel_export/nel_export_scene.h" -#include "nel/../../src/pacs/collision_mesh_build.h" -#include "nel/../../src/pacs/retriever_bank.h" -#include "nel/../../src/pacs/global_retriever.h" -#include "nel/../../src/pacs/build_indoor.h" -#include "nel/../../src/pacs/primitive_block.h" +#include "nel/pacs/collision_mesh_build.h" +#include "nel/pacs/retriever_bank.h" +#include "nel/pacs/global_retriever.h" +#include "nel/pacs/build_indoor.h" +#include "nel/pacs/primitive_block.h" #include "nel/3d/quad_grid.h" diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp index 8dbaeb56b..44f51fc75 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp @@ -27,6 +27,14 @@ using namespace NLMISC; using namespace NL3D; +#ifdef _STLPORT_VERSION +namespace std +{ + float fabsf(float f) { return ::fabsf(f); } + double fabsl(double f) { return ::fabsl(f); } +} +#endif + // *************************************************************************** // -------------------------------------------------- diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h index d9383fea2..11e762099 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_nel.h @@ -27,7 +27,7 @@ #include "nel/3d/bone.h" #include "nel/3d/animation_time.h" #include "nel/3d/animation_time.h" -#include "nel/../../src/pacs/collision_mesh_build.h" +#include "nel/pacs/collision_mesh_build.h" #define UVGEN_MISSING (-1) #define UVGEN_REFLEXION (-2) diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.def b/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.def index a6cecd424..c3a249d4a 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.def +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.def @@ -1,4 +1,4 @@ -LIBRARY nelconvertpatch.dlm +;LIBRARY nelconvertpatch.dlm EXPORTS LibDescription @1 LibNumberClasses @2 diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp b/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp index 6ee1c43f1..c2e80e06b 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp @@ -19,7 +19,19 @@ #pragma conform(forScope, push) #pragma conform(forScope, off) +#ifndef _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE +#endif + +#include + +#ifdef _STLPORT_VERSION +namespace std +{ + float fabsf(float f); + double fabsl(double f); +} +#endif #include diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/nel_patch_edit.def b/code/nel/tools/3d/plugin_max/nel_patch_edit/nel_patch_edit.def index 607869257..c01fdf4e9 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/nel_patch_edit.def +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/nel_patch_edit.def @@ -1,4 +1,4 @@ -LIBRARY neleditpatch +;LIBRARY neleditpatch EXPORTS LibDescription @1 LibNumberClasses @2 diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np.cpp index 0c4d5c935..7b1c9c644 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np.cpp @@ -96,12 +96,12 @@ //#define VMAP_DEBUG 1 // Forward references -BOOL CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchOpsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchObjSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchOpsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchObjSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); void ResetVert (PatchMesh *patch); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP.cpp index 0c4d5c935..7b1c9c644 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP.cpp @@ -96,12 +96,12 @@ //#define VMAP_DEBUG 1 // Forward references -BOOL CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchOpsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchObjSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchOpsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchObjSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); void ResetVert (PatchMesh *patch); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EPM_Selection.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EPM_Selection.cpp index e465e1345..3814a2df9 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EPM_Selection.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EPM_Selection.cpp @@ -9,9 +9,9 @@ #define PROMPT_TIME 2000 -BOOL CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); extern void ChangePatchType(PatchMesh *patch, int index, int type); extern BOOL filterVerts; // ------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EPM_Surface.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EPM_Surface.cpp index 2c475b0c7..4f72420b1 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EPM_Surface.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EPM_Surface.cpp @@ -15,7 +15,7 @@ extern int sbmParams[4]; extern DWORD sbsParams[3]; // ------------------------------------------------------------------------------------------------------------------------------------------------------ -BOOL CALLBACK SelectByMatDlgProc( +INT_PTR CALLBACK SelectByMatDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { static int *param; @@ -84,7 +84,7 @@ void SetSmoothButtonState(HWND hWnd, DWORD bits, DWORD invalid, DWORD unused = 0 // ------------------------------------------------------------------------------------------------------------------------------------------------------ -BOOL CALLBACK SelectBySmoothDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK SelectBySmoothDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { static DWORD *param; switch (msg) @@ -137,9 +137,9 @@ BOOL CALLBACK SelectBySmoothDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l // ------------------------------------------------------------------------------------------------------------------------------------------------------ -BOOL CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - EditPatchMod *ep =(EditPatchMod *)GetWindowLong(hDlg, GWL_USERDATA); + EditPatchMod *ep =(EditPatchMod *)GetWindowLongPtr(hDlg, GWLP_USERDATA); if (!ep && message != WM_INITDIALOG) return FALSE; @@ -150,7 +150,7 @@ BOOL CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP ep =(EditPatchMod *)lParam; ep->hTilePanel = hDlg; - SetWindowLong(hDlg, GWL_USERDATA, (LONG)ep); + SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ep); ep->tileNum = SetupIntSpinner(hDlg, IDC_TILE_MAT_SPIN, IDC_TILE_MAT, 0, 65535, 0); ep->tileRot = SetupIntSpinner(hDlg, IDC_TILE_ROT_SPIN, IDC_TILE_ROT, 0, 3, 0); ep->SetTileDlgEnables(); @@ -249,9 +249,9 @@ BOOL CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP // ------------------------------------------------------------------------------------------------------------------------------------------------------ -BOOL CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - EditPatchMod *ep =(EditPatchMod *)GetWindowLong(hDlg, GWL_USERDATA); + EditPatchMod *ep =(EditPatchMod *)GetWindowLongPtr(hDlg, GWLP_USERDATA); if (!ep && message != WM_INITDIALOG) return FALSE; @@ -262,7 +262,7 @@ BOOL CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP ep =(EditPatchMod *)lParam; ep->hEdgePanel = hDlg; - SetWindowLong(hDlg, GWL_USERDATA, (LONG)ep); + SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ep); ep->SetEdgeDlgEnables(); return TRUE; } @@ -324,9 +324,9 @@ BOOL CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP // ------------------------------------------------------------------------------------------------------------------------------------------------------ -BOOL CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - EditPatchMod *ep =(EditPatchMod *)GetWindowLong(hDlg, GWL_USERDATA); + EditPatchMod *ep =(EditPatchMod *)GetWindowLongPtr(hDlg, GWLP_USERDATA); if (!ep && message != WM_INITDIALOG) return FALSE; @@ -339,7 +339,7 @@ BOOL CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP for (int i = IDC_SMOOTH_GRP1; i < IDC_SMOOTH_GRP1 + 32; i++) SendMessage(GetDlgItem(hDlg, i), CC_COMMAND, CC_CMD_SET_TYPE, CBT_CHECK); - SetWindowLong(hDlg, GWL_USERDATA, (LONG)ep); + SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ep); ep->matSpin = SetupIntSpinner(hDlg, IDC_MAT_IDSPIN, IDC_MAT_ID, 1, MAX_MATID, 0); ep->tessUSpin = SetupIntSpinner(hDlg, IDC_TESS_U_SPIN, IDC_TESS_U2, 1, 4, RPO_DEFAULT_TESSEL); ep->tessVSpin = SetupIntSpinner(hDlg, IDC_TESS_V_SPIN, IDC_TESS_V2, 1, 4, RPO_DEFAULT_TESSEL); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EPM_Tess.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EPM_Tess.cpp index 3da46fee5..5a1a54cb4 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EPM_Tess.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EPM_Tess.cpp @@ -10,7 +10,7 @@ #define PROMPT_TIME 2000 extern AdvParams sParams; -BOOL CALLBACK AdvParametersDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK AdvParametersDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); // ------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -210,9 +210,9 @@ void EditPatchMod::SetTessUI(HWND hDlg, TessApprox *tess) // ------------------------------------------------------------------------------------------------------------------------------------------------------ -BOOL CALLBACK PatchObjSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK PatchObjSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - EditPatchMod *ep =(EditPatchMod *)GetWindowLong(hDlg, GWL_USERDATA); + EditPatchMod *ep =(EditPatchMod *)GetWindowLongPtr(hDlg, GWLP_USERDATA); if (!ep && message != WM_INITDIALOG) return FALSE; @@ -223,7 +223,7 @@ BOOL CALLBACK PatchObjSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM ep =(EditPatchMod *)lParam; ep->hSurfPanel = hDlg; - SetWindowLong(hDlg, GWL_USERDATA, (LONG)ep); + SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ep); if (!ep->settingViewportTess && ep->settingDisp && ep->GetProdTess().type == TESS_SET) ep->settingDisp = FALSE; TessApprox t; @@ -599,7 +599,7 @@ static ISpinnerControl* psMaxTrisSpin = NULL; // this max matches the MI max. #define MAX_SUBDIV 7 static BOOL initing = FALSE; // this is a hack but CenterWindow causes bad commands -BOOL CALLBACK +INT_PTR CALLBACK AdvParametersDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EditPatchMod.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EditPatchMod.cpp index 343699663..55825158b 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EditPatchMod.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_EditPatchMod.cpp @@ -264,7 +264,7 @@ void EditPatchMod::NewSetByOperator(TSTR &newName, Tab < int> &sets, int op) // Named selection set copy/paste methods follow... -static BOOL CALLBACK PickSetNameDlgProc( +static INT_PTR CALLBACK PickSetNameDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { static TSTR *name; @@ -328,7 +328,7 @@ BOOL EditPatchMod::GetUniqueSetName(TSTR &name) -static BOOL CALLBACK PickSetDlgProc( +static INT_PTR CALLBACK PickSetDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_Main.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_Main.cpp index 32c0eb120..a6592893b 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_Main.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_Main.cpp @@ -9,12 +9,12 @@ #define PROMPT_TIME 2000 -BOOL CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchOpsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchObjSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); -BOOL CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchOpsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchObjSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchSurfDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchTileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK PatchEdgeDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); extern void CancelEditPatchModes(IObjParam *ip); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_Rollup.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_Rollup.cpp index e550f1774..22b06376b 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_Rollup.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_Rollup.cpp @@ -33,10 +33,10 @@ extern void CancelEditPatchModes(IObjParam *ip); extern void LoadImages(); -BOOL CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { static char string[64]; - EditPatchMod *ep =(EditPatchMod *)GetWindowLong(hDlg, GWL_USERDATA); + EditPatchMod *ep =(EditPatchMod *)GetWindowLongPtr(hDlg, GWLP_USERDATA); ICustToolbar *iToolbar; if (!ep && message != WM_INITDIALOG) return FALSE; @@ -104,7 +104,7 @@ BOOL CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM ep =(EditPatchMod *)lParam; ep->hSelectPanel = hDlg; - SetWindowLong(hDlg, GWL_USERDATA, (LONG)ep); + SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ep); // Set up the editing level selector LoadImages(); iToolbar = GetICustToolbar(GetDlgItem(hDlg, IDC_SELTYPE)); @@ -349,9 +349,9 @@ void EditPatchMod::SetOpsDlgEnables() // ------------------------------------------------------------------------------------------------------------------------------------------------------ -BOOL CALLBACK PatchOpsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK PatchOpsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - EditPatchMod *ep =(EditPatchMod *)GetWindowLong(hDlg, GWL_USERDATA); + EditPatchMod *ep =(EditPatchMod *)GetWindowLongPtr(hDlg, GWLP_USERDATA); if (!ep && message != WM_INITDIALOG) return FALSE; @@ -367,7 +367,7 @@ BOOL CALLBACK PatchOpsDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa ep->hOpsPanel = hDlg; for (int i = IDC_SMOOTH_GRP1; i < IDC_SMOOTH_GRP1 + 32; i++) SendMessage(GetDlgItem(hDlg, i), CC_COMMAND, CC_CMD_SET_TYPE, CBT_CHECK); - SetWindowLong(hDlg, GWL_USERDATA, (LONG)ep); + SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ep); ICustButton *but = GetICustButton(GetDlgItem(hDlg, IDC_ATTACH)); but->SetHighlightColor(GREEN_WASH); but->SetType(CBT_CHECK); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_editpops.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_editpops.cpp index 65344b052..abbd4e34d 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_editpops.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_editpops.cpp @@ -50,7 +50,7 @@ EPTempData::EPTempData(EditPatchMod *m,EditPatchData *pd) mod = m; } -void EPTempData::Invalidate(DWORD part,BOOL patchValid) +void EPTempData::Invalidate(PartID part,BOOL patchValid) { if ( !patchValid ) { diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_mods.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_mods.cpp index 3723a8a75..4020110e3 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_mods.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/NP_mods.cpp @@ -225,11 +225,11 @@ __declspec( dllexport ) ULONG CanAutoDefer() BOOL CALLBACK DefaultSOTProc( HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { - IObjParam *ip = (IObjParam*)GetWindowLong(hWnd,GWL_USERDATA); + IObjParam *ip = (IObjParam*)GetWindowLongPtr(hWnd,GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: - SetWindowLong(hWnd,GWL_USERDATA,lParam); + SetWindowLongPtr(hWnd,GWLP_USERDATA,lParam); break; case WM_LBUTTONDOWN: diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/mods.def b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/mods.def index f3b941802..d3759424e 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/mods.def +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/mods.def @@ -1,4 +1,4 @@ -LIBRARY neleditpatchadv +;LIBRARY neleditpatchadv EXPORTS LibDescription @1 LibNumberClasses @2 diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/stdafx.h b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/stdafx.h index 14e542a3f..9045b4b53 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/stdafx.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit_adv/stdafx.h @@ -1,4 +1,6 @@ #pragma warning (disable : 4786) + +#include #include #include #include diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/stdafx.h b/code/nel/tools/3d/plugin_max/nel_patch_lib/stdafx.h index 85d489147..db03395e8 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/stdafx.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/stdafx.h @@ -17,7 +17,9 @@ #pragma conform(forScope, push) #pragma conform(forScope, off) +#ifndef _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE +#endif #pragma warning (disable : 4786) #include diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.def b/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.def index 59c2e5d46..ddb039e28 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.def +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.def @@ -1,4 +1,4 @@ -LIBRARY nelpaintpatch.dlm +;LIBRARY nelpaintpatch.dlm EXPORTS LibDescription @1 LibNumberClasses @2 diff --git a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.def b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.def index 1c3524d1c..dcd6d1e33 100644 --- a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.def +++ b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.def @@ -1,4 +1,4 @@ -LIBRARY nel_vertex_tree_paint +;LIBRARY nel_vertex_tree_paint EXPORTS LibDescription @1 LibNumberClasses @2 diff --git a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.def b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.def index 6a8b07e45..8fe710a8f 100644 --- a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.def +++ b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.def @@ -1,4 +1,4 @@ -LIBRARY neltileutility.dlu +;LIBRARY neltileutility.dlu EXPORTS LibDescription @1 LibNumberClasses @2 diff --git a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.h b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.h index ade41e486..5d5e4e298 100644 --- a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.h +++ b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.h @@ -20,7 +20,9 @@ #pragma conform(forScope, push) #pragma conform(forScope, off) +#ifndef _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE +#endif #include #include diff --git a/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp b/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp index 6423f77f2..0d2ea6a7e 100644 --- a/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp +++ b/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp @@ -67,6 +67,9 @@ static void compressMipMap(uint8 *pixSrc, sint width, sint height, vectorcheckedId()) ) + if ( ! browserModel.setTile128 ( tileId, fileName.toUtf8().constData(), (CTile::TBitmap) tileTextureButtonGroup->checkedId()) ) { browserModel.removeTile128 (tileId); break; @@ -247,7 +247,7 @@ void CTile_browser_dlg::on_actionAddTile_triggered(bool checked) { tileId = browserModel.addTile256 (); fileName = QDir::toNativeSeparators(fileNames.at(i)); - if ( ! browserModel.setTile256 ( tileId, fileName.toStdString(), (CTile::TBitmap) tileTextureButtonGroup->checkedId()) ) + if ( ! browserModel.setTile256 ( tileId, fileName.toUtf8().constData(), (CTile::TBitmap) tileTextureButtonGroup->checkedId()) ) { browserModel.removeTile256 (tileId); break; @@ -307,7 +307,7 @@ void CTile_browser_dlg::on_actionReplaceImage_triggered(bool checked) { int tileId = (ui.tileBrowserListView->selectionModel()->selectedRows().at(i).data(Qt::UserRole + 1)).toInt(); - if ( ! browserModel.setTile128 ( tileId, fileName.toStdString(), (CTile::TBitmap) tileTextureButtonGroup->checkedId()) ) + if ( ! browserModel.setTile128 ( tileId, fileName.toUtf8().constData(), (CTile::TBitmap) tileTextureButtonGroup->checkedId()) ) break; } break; @@ -315,7 +315,7 @@ void CTile_browser_dlg::on_actionReplaceImage_triggered(bool checked) for (int i=0; iselectionModel()->selectedRows().count(); i++) { int tileId = (ui.tileBrowserListView->selectionModel()->selectedRows().at(i).data(Qt::UserRole + 1)).toInt(); - if ( ! browserModel.setTile256 (tileId, fileName.toStdString(), (CTile::TBitmap) tileTextureButtonGroup->checkedId()) ) + if ( ! browserModel.setTile256 (tileId, fileName.toUtf8().constData(), (CTile::TBitmap) tileTextureButtonGroup->checkedId()) ) break; } break; @@ -325,7 +325,7 @@ void CTile_browser_dlg::on_actionReplaceImage_triggered(bool checked) int tileId = (ui.tileBrowserListView->selectionModel()->selectedRows().at(i).data(Qt::UserRole + 1)).toInt(); if ( tileTextureButtonGroup->checkedId() != Alpha ) { - if ( ! browserModel.setTileTransition (tileId, fileName.toStdString(), (CTile::TBitmap) tileTextureButtonGroup->checkedId()) ) + if ( ! browserModel.setTileTransition (tileId, fileName.toUtf8().constData(), (CTile::TBitmap) tileTextureButtonGroup->checkedId()) ) break; } else @@ -334,7 +334,7 @@ void CTile_browser_dlg::on_actionReplaceImage_triggered(bool checked) int rot = CTile_rotation_dlg::getRotation(this, &rotationOk); if (rotationOk) { - if ( ! browserModel.setTileTransitionAlpha (tileId, fileName.toStdString(), rot) ) + if ( ! browserModel.setTileTransitionAlpha (tileId, fileName.toUtf8().constData(), rot) ) break; } } @@ -344,7 +344,7 @@ void CTile_browser_dlg::on_actionReplaceImage_triggered(bool checked) for (int i=0; iselectionModel()->selectedRows().count(); i++) { int tileId = (ui.tileBrowserListView->selectionModel()->selectedRows().at(i).data(Qt::UserRole + 1)).toInt(); - if ( ! browserModel.setDisplacement (tileId, fileName.toStdString(), (CTile::TBitmap) tileTextureButtonGroup->checkedId()) ) + if ( ! browserModel.setDisplacement (tileId, fileName.toUtf8().constData(), (CTile::TBitmap) tileTextureButtonGroup->checkedId()) ) break; } break; @@ -444,13 +444,13 @@ void CTile_browser_dlg::on_batchLoadPushButton_clicked() QString batchNumber = transitionNumber.rightJustified(2, '0'); QString nextBaseName = baseName + batchNumber; QString nextFileName = QDir::toNativeSeparators(fi.absolutePath()) + QDir::separator() + nextBaseName + QString(".") + fi.suffix(); - FILE *pFile=fopen (nextFileName.toStdString().c_str(), "rb"); + FILE *pFile=fopen (nextFileName.toUtf8().constData(), "rb"); // Close the file and add the tile if opened if (pFile) { fclose (pFile); - ok=browserModel.setTileTransitionAlpha (i, nextFileName.toStdString().c_str(), (4-rot)%4); + ok=browserModel.setTileTransitionAlpha (i, nextFileName.toUtf8().constData(), (4-rot)%4); // End break; @@ -545,7 +545,7 @@ void CTile_browser_dlg::on_exportBorderPushButton_clicked() try { COFile file; - if (file.open (fileName.toStdString().c_str())) + if (file.open (fileName.toUtf8().constData())) { // Export bitmap.writeTGA (file, 32); @@ -594,7 +594,7 @@ void CTile_browser_dlg::on_importBorderPushButton_clicked() try { CIFile file; - if (file.open (fileName.toStdString().c_str())) + if (file.open (fileName.toUtf8().constData())) { // Export bitmap.load (file); diff --git a/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.cpp b/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.cpp index 1fdcb1aea..595067cd2 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.cpp +++ b/code/nel/tools/3d/tile_edit_qt/tile_edit_dlg.cpp @@ -103,7 +103,7 @@ void CTile_edit_dlg::on_addLandPushButton_clicked() } else { - tileBank.addLand( text.toStdString() ); + tileBank.addLand( text.toUtf8().constData() ); ui.landListWidget->addItem(text); ui.landListWidget->setCurrentRow(ui.landListWidget->count() - 1); @@ -138,7 +138,7 @@ void CTile_edit_dlg::on_editLandPushButton_clicked() for (int i=0; iaddTileSet( rString.toStdString().c_str() ); + tileBank.getLand(nindex)->addTileSet( rString.toUtf8().constData() ); } } } @@ -176,7 +176,7 @@ void CTile_edit_dlg::on_addTileSetPushButton_clicked() } else { - tileBank.addTileSet( text.toStdString() ); + tileBank.addTileSet( text.toUtf8().constData() ); ui.tileSetListWidget->addItem(text); ui.tileSetListWidget->setCurrentRow(ui.tileSetListWidget->count() - 1); @@ -239,7 +239,7 @@ void CTile_edit_dlg::on_chooseVegetPushButton_clicked() if (!fileName.isEmpty()) { QFileInfo fi(fileName); - tileBank.getTileSet (nindex)->setTileVegetableDescFileName (fi.fileName().toStdString()); + tileBank.getTileSet (nindex)->setTileVegetableDescFileName (fi.fileName().toUtf8().constData()); ui.chooseVegetPushButton->setText(fi.fileName()); } } @@ -347,7 +347,7 @@ void CTile_edit_dlg::on_loadPushButton_clicked() if (!fileName.isEmpty()) { CIFile stream; - if ( stream.open( fileName.toStdString().c_str() ) ) + if ( stream.open( fileName.toUtf8().constData() ) ) { ui.landListWidget->clear(); ui.tileSetListWidget->clear(); @@ -383,7 +383,7 @@ void CTile_edit_dlg::on_loadPushButton_clicked() void CTile_edit_dlg::on_savePushButton_clicked() { - string fullPath = this->mainFile.absoluteFilePath().toStdString(); + string fullPath = this->mainFile.absoluteFilePath().toUtf8().constData(); if ( !fullPath.empty() ) { COFile stream; @@ -411,7 +411,7 @@ void CTile_edit_dlg::on_saveAsPushButton_clicked() ui.savePushButton->setEnabled(true); - string fullPath = this->mainFile.absoluteFilePath().toStdString(); + string fullPath = this->mainFile.absoluteFilePath().toUtf8().constData(); if ( !fullPath.empty() ) { COFile stream; @@ -445,7 +445,7 @@ void CTile_edit_dlg::on_exportPushButton_clicked() copy.cleanUnusedData (); QFileInfo fileInfo(fileName); - string fullPath = fileInfo.absoluteFilePath().toStdString(); + string fullPath = fileInfo.absoluteFilePath().toUtf8().constData(); if ( !fullPath.empty() ) { COFile stream; @@ -524,7 +524,7 @@ void CTile_edit_dlg::on_absolutePathPushButton_clicked() if (bitmapPath!="") { // Check the path - if ( CheckPath( bitmapPath, path.toStdString().c_str() ) == false ) + if ( CheckPath( bitmapPath, path.toUtf8() ) == false ) { // Bad path goodPath=false; @@ -552,7 +552,7 @@ void CTile_edit_dlg::on_absolutePathPushButton_clicked() if (strcmp (bitmapPath, "")!=0) { // Check the path - if (CheckPath( bitmapPath, path.toStdString().c_str() )==false) + if (CheckPath( bitmapPath, path.toUtf8() )==false) { // Bad path goodPath=false; @@ -593,7 +593,7 @@ void CTile_edit_dlg::on_absolutePathPushButton_clicked() if (bitmapPath!="") { // Remove the absolute path - bool res=RemovePath (bitmapPath, path.toStdString().c_str()); + bool res=RemovePath (bitmapPath, path.toUtf8()); nlassert (res); // Set the bitmap @@ -613,7 +613,7 @@ void CTile_edit_dlg::on_absolutePathPushButton_clicked() if (bitmapPath!="") { // Remove the absolute path - bool res=RemovePath (bitmapPath, path.toStdString().c_str()); + bool res=RemovePath (bitmapPath, path.toUtf8()); nlassert (res); // Set the bitmap @@ -633,7 +633,7 @@ void CTile_edit_dlg::on_absolutePathPushButton_clicked() if (goodPath) { // Change the abs path of the bank - tileBank.setAbsPath (path.toStdString()); + tileBank.setAbsPath (path.toUtf8().constData()); // Change the bouton text ui.absolutePathPushButton->setText(path); diff --git a/code/nel/tools/misc/data_mirror/StdAfx.h b/code/nel/tools/misc/data_mirror/StdAfx.h index a065be4ed..90fe14511 100644 --- a/code/nel/tools/misc/data_mirror/StdAfx.h +++ b/code/nel/tools/misc/data_mirror/StdAfx.h @@ -10,6 +10,9 @@ #pragma once #endif // _MSC_VER > 1000 +#include "nel/misc/types_nl.h" +#include "nel/misc/file.h" + #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #include // MFC core and standard components diff --git a/code/nel/tools/misc/extract_filename/extract_filename.cpp b/code/nel/tools/misc/extract_filename/extract_filename.cpp index 33a8a7249..7708f9031 100644 --- a/code/nel/tools/misc/extract_filename/extract_filename.cpp +++ b/code/nel/tools/misc/extract_filename/extract_filename.cpp @@ -23,7 +23,7 @@ using namespace NLMISC; #ifdef NL_DEBUG #define INFO nlinfo #else // NL_DEBUG -# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10) +# if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 71 # define INFO __noop # else # define INFO 0&& diff --git a/code/nel/tools/misc/words_dic_qt/words_dicDlg.cpp b/code/nel/tools/misc/words_dic_qt/words_dicDlg.cpp index acbebd611..683755ae6 100644 --- a/code/nel/tools/misc/words_dic_qt/words_dicDlg.cpp +++ b/code/nel/tools/misc/words_dic_qt/words_dicDlg.cpp @@ -151,7 +151,7 @@ void CWords_dicDlg::on_findButton_clicked() { QString inputStr = ui.lookUpEdit->text(); bool showAll = ui.showAllCheckBox->isChecked(); - lookUp( inputStr.toStdString(), showAll ); + lookUp( inputStr.toUtf8().constData(), showAll ); } void CWords_dicDlg::on_lookUpEdit_textChanged() @@ -191,7 +191,7 @@ void CWords_dicDlg::on_fileListButton_clicked() void CWords_dicDlg::on_resultsListWidget_itemSelectionChanged() { QListWidgetItem *i = ui.resultsListWidget->currentItem(); - copyIntoClipboard( i->text().toStdString() ); + copyIntoClipboard( i->text().toUtf8().constData() ); } diff --git a/code/nel/tools/pacs/build_indoor_rbank/build_surfaces.cpp b/code/nel/tools/pacs/build_indoor_rbank/build_surfaces.cpp index f6bb4681d..f553eaf47 100644 --- a/code/nel/tools/pacs/build_indoor_rbank/build_surfaces.cpp +++ b/code/nel/tools/pacs/build_indoor_rbank/build_surfaces.cpp @@ -17,11 +17,11 @@ #include #include -#include "nel/../../src/pacs/collision_mesh_build.h" -#include "nel/../../src/pacs/local_retriever.h" -#include "nel/../../src/pacs/exterior_mesh.h" -#include "nel/../../src/pacs/surface_quad.h" -#include "nel/../../src/pacs/chain.h" +#include "nel/pacs/collision_mesh_build.h" +#include "nel/pacs/local_retriever.h" +#include "nel/pacs/exterior_mesh.h" +#include "nel/pacs/surface_quad.h" +#include "nel/pacs/chain.h" #include "build_surfaces.h" diff --git a/code/nel/tools/pacs/build_indoor_rbank/build_surfaces.h b/code/nel/tools/pacs/build_indoor_rbank/build_surfaces.h index a3e86dd09..fdfbb2c21 100644 --- a/code/nel/tools/pacs/build_indoor_rbank/build_surfaces.h +++ b/code/nel/tools/pacs/build_indoor_rbank/build_surfaces.h @@ -23,7 +23,7 @@ #include "nel/misc/vector.h" #include "nel/misc/file.h" -#include "nel/../../src/pacs/collision_mesh_build.h" +#include "nel/pacs/collision_mesh_build.h" // External class declaration namespace NLPACS diff --git a/code/nel/tools/pacs/build_indoor_rbank/main.cpp b/code/nel/tools/pacs/build_indoor_rbank/main.cpp index a749572f7..2e797d61d 100644 --- a/code/nel/tools/pacs/build_indoor_rbank/main.cpp +++ b/code/nel/tools/pacs/build_indoor_rbank/main.cpp @@ -23,11 +23,11 @@ #include "nel/misc/time_nl.h" #include "nel/misc/file.h" -#include "nel/../../src/pacs/collision_mesh_build.h" -#include "nel/../../src/pacs/local_retriever.h" -#include "nel/../../src/pacs/retriever_instance.h" -#include "nel/../../src/pacs/global_retriever.h" -#include "nel/../../src/pacs/retriever_bank.h" +#include "nel/pacs/collision_mesh_build.h" +#include "nel/pacs/local_retriever.h" +#include "nel/pacs/retriever_instance.h" +#include "nel/pacs/global_retriever.h" +#include "nel/pacs/retriever_bank.h" #include "nel/pacs/u_global_position.h" diff --git a/code/nel/tools/pacs/build_indoor_rbank/mouline.cpp b/code/nel/tools/pacs/build_indoor_rbank/mouline.cpp index 8322daa33..57592a431 100644 --- a/code/nel/tools/pacs/build_indoor_rbank/mouline.cpp +++ b/code/nel/tools/pacs/build_indoor_rbank/mouline.cpp @@ -17,9 +17,9 @@ #include #include -#include "nel/../../src/pacs/collision_mesh_build.h" -#include "nel/../../src/pacs/local_retriever.h" -#include "nel/../../src/pacs/exterior_mesh.h" +#include "nel/pacs/collision_mesh_build.h" +#include "nel/pacs/local_retriever.h" +#include "nel/pacs/exterior_mesh.h" #include "mouline.h" #include "build_surfaces.h" diff --git a/code/nel/tools/pacs/build_rbank/build_rbank.cpp b/code/nel/tools/pacs/build_rbank/build_rbank.cpp index 7003e93d6..2285873c0 100644 --- a/code/nel/tools/pacs/build_rbank/build_rbank.cpp +++ b/code/nel/tools/pacs/build_rbank/build_rbank.cpp @@ -35,13 +35,13 @@ #include "surface_splitter.h" -#include "nel/../../src/pacs/global_retriever.h" -#include "nel/../../src/pacs/retriever_bank.h" -#include "nel/../../src/pacs/surface_quad.h" -#include "nel/../../src/pacs/local_retriever.h" -#include "nel/../../src/pacs/retriever_instance.h" -#include "nel/../../src/pacs/chain.h" -#include "nel/../../src/pacs/collision_mesh_build.h" +#include "nel/pacs/global_retriever.h" +#include "nel/pacs/retriever_bank.h" +#include "nel/pacs/surface_quad.h" +#include "nel/pacs/local_retriever.h" +#include "nel/pacs/retriever_instance.h" +#include "nel/pacs/chain.h" +#include "nel/pacs/collision_mesh_build.h" #include #include diff --git a/code/nel/tools/pacs/build_rbank/build_surf.cpp b/code/nel/tools/pacs/build_rbank/build_surf.cpp index 7500d1083..9546e19f1 100644 --- a/code/nel/tools/pacs/build_rbank/build_surf.cpp +++ b/code/nel/tools/pacs/build_rbank/build_surf.cpp @@ -31,7 +31,7 @@ #include "nel/3d/mesh.h" #include "nel/3d/quad_grid.h" -#include "nel/../../src/pacs/vector_2s.h" +#include "nel/pacs/vector_2s.h" #include "build_surf.h" diff --git a/code/nel/tools/pacs/build_rbank/build_surf.h b/code/nel/tools/pacs/build_rbank/build_surf.h index 2e0588546..ad0342b1e 100644 --- a/code/nel/tools/pacs/build_rbank/build_surf.h +++ b/code/nel/tools/pacs/build_rbank/build_surf.h @@ -35,8 +35,8 @@ #include "nel/misc/geom_ext.h" #include "nel/misc/polygon.h" -#include "nel/../../src/pacs/surface_quad.h" -#include "nel/../../src/pacs/retrievable_surface.h" +#include "nel/pacs/surface_quad.h" +#include "nel/pacs/retrievable_surface.h" #include "prim_checker.h" diff --git a/code/nel/tools/pacs/build_rbank/main.cpp b/code/nel/tools/pacs/build_rbank/main.cpp index ef805e8e0..8421ed807 100644 --- a/code/nel/tools/pacs/build_rbank/main.cpp +++ b/code/nel/tools/pacs/build_rbank/main.cpp @@ -29,11 +29,11 @@ #include "build_rbank.h" #include "prim_checker.h" -#include "nel/../../src/pacs/global_retriever.h" -#include "nel/../../src/pacs/retriever_bank.h" -#include "nel/../../src/pacs/surface_quad.h" -#include "nel/../../src/pacs/local_retriever.h" -#include "nel/../../src/pacs/retriever_instance.h" +#include "nel/pacs/global_retriever.h" +#include "nel/pacs/retriever_bank.h" +#include "nel/pacs/surface_quad.h" +#include "nel/pacs/local_retriever.h" +#include "nel/pacs/retriever_instance.h" #include #include diff --git a/code/nel/tools/pacs/build_rbank/surface_splitter.h b/code/nel/tools/pacs/build_rbank/surface_splitter.h index 0aea88968..3cf035e9d 100644 --- a/code/nel/tools/pacs/build_rbank/surface_splitter.h +++ b/code/nel/tools/pacs/build_rbank/surface_splitter.h @@ -19,8 +19,8 @@ #include "nel/misc/types_nl.h" -#include "../../../src/pacs/local_retriever.h" -#include "../../../src/pacs/quad_grid.h" +#include "nel/pacs/local_retriever.h" +#include "nel/pacs/quad_grid.h" #include diff --git a/code/nelns/admin_service/admin_service.cpp b/code/nelns/admin_service/admin_service.cpp index 8f437adbb..6d75b6aac 100644 --- a/code/nelns/admin_service/admin_service.cpp +++ b/code/nelns/admin_service/admin_service.cpp @@ -31,9 +31,12 @@ #include #include -#if defined (NL_OS_WINDOWS) -#include +#ifdef NL_OS_WINDOWS +#include +#include +typedef unsigned long ulong; #endif + #include #include diff --git a/code/nelns/login_service/connection_client.cpp b/code/nelns/login_service/connection_client.cpp index 74269550b..37976cb24 100644 --- a/code/nelns/login_service/connection_client.cpp +++ b/code/nelns/login_service/connection_client.cpp @@ -152,7 +152,7 @@ retry: CLoginCookie c; c.set((uint32)(uintptr_t)from, rand(), uid); - reason = sqlQuery("update user set state='Authorized', Cookie='"+c.setToString()+"' where UId="+uid); + reason = sqlQuery("update user set state='Authorized', Cookie='"+c.setToString()+"' where UId=" + NLMISC::toString(uid)); if(!reason.empty()) break; reason = sqlQuery("select * from shard where Online>0 and ClientApplication='"+application+"'", nbrow, row, result); diff --git a/code/nelns/login_service/login_service.h b/code/nelns/login_service/login_service.h index d8f43219e..7c8c5a427 100644 --- a/code/nelns/login_service/login_service.h +++ b/code/nelns/login_service/login_service.h @@ -20,7 +20,9 @@ // we have to include windows.h because mysql.h uses it but not include it #ifdef NL_OS_WINDOWS # define NOMINMAX +# include # include +typedef unsigned long ulong; #endif #include diff --git a/code/nelns/login_service/mysql_helper.h b/code/nelns/login_service/mysql_helper.h index ab57b8ffa..fee1d1bf6 100644 --- a/code/nelns/login_service/mysql_helper.h +++ b/code/nelns/login_service/mysql_helper.h @@ -25,7 +25,9 @@ // we have to include windows.h because mysql.h uses it but not include it #ifdef NL_OS_WINDOWS # define NOMINMAX +# include # include +typedef unsigned long ulong; #endif #include diff --git a/code/nelns/login_system/nel_launcher_qt/nel_launcher_dlg.cpp b/code/nelns/login_system/nel_launcher_qt/nel_launcher_dlg.cpp index 28e8114c9..0e9efc2e7 100644 --- a/code/nelns/login_system/nel_launcher_qt/nel_launcher_dlg.cpp +++ b/code/nelns/login_system/nel_launcher_qt/nel_launcher_dlg.cpp @@ -72,8 +72,8 @@ void CNelLauncherDlg::clickedSignUp() void CNelLauncherDlg::clickedLogin() { - std::string username = leUsername->text().toStdString(); - std::string password = lePassword->text().toStdString(); + std::string username = leUsername->text().toUtf8(); + std::string password = lePassword->text().toUtf8(); nlinfo("received login attempt for %s with %s", username.c_str(), password.c_str()); diff --git a/code/ryzom/client/src/attached_fx.cpp b/code/ryzom/client/src/attached_fx.cpp index 0934d9a15..0f520f689 100644 --- a/code/ryzom/client/src/attached_fx.cpp +++ b/code/ryzom/client/src/attached_fx.cpp @@ -197,7 +197,7 @@ void CAttachedFX::create(CCharacterCL &parent, if (targeterInfo.StickMode.UserBoneName != 0) { CEntityCL *targeter = EntitiesMngr.entity(TargeterInfo.Slot); - if (targeter && targeter->skeleton()) + if (parent.skeleton() && targeter && targeter->skeleton()) { TargeterUserBoneID = parent.skeleton()->getBoneIdByName(NLMISC::CStringMapper::unmap(TargeterInfo.StickMode.UserBoneName)); } diff --git a/code/ryzom/client/src/attached_fx.h b/code/ryzom/client/src/attached_fx.h index faf38aeae..6f8f791cd 100644 --- a/code/ryzom/client/src/attached_fx.h +++ b/code/ryzom/client/src/attached_fx.h @@ -65,14 +65,14 @@ public: class CBuildInfo { public: - const CAnimationFX *Sheet; - const CFXStickMode *StickMode; // NULL to use default stick mode of the sheet - NLMISC::CVector StickOffset; - const NLMISC::CMatrix *StaticMatrix; // Useful if stick mode is "StaticMatrix" - uint MaxNumAnimCount; // Number of frame on which the fx can overlap when it is being shutdown - float TimeOut; - double StartTime; - float DelayBeforeStart; + const CAnimationFX* Sheet; + const CFXStickMode* StickMode; // NULL to use default stick mode of the sheet + NLMISC::CVector StickOffset; + const NLMISC::CMatrix* StaticMatrix; // Useful if stick mode is "StaticMatrix" + uint MaxNumAnimCount; // Number of frame on which the fx can overlap when it is being shutdown + float TimeOut; + double StartTime; + float DelayBeforeStart; public: CBuildInfo() { diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index 85b852e35..368afe0ee 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -104,8 +104,8 @@ static CTcpSock CrashCounterSock; void quitCrashReport () { - if (NLMISC::CFile::fileExists(getLogDirectory() + "ryzom_started")) - CFile::deleteFile (getLogDirectory() + "ryzom_started"); + //if (NLMISC::CFile::fileExists(getLogDirectory() + "ryzom_started")) + //CFile::deleteFile (getLogDirectory() + "ryzom_started"); // must disconnect now, else could crash at dtor time because nldebug -> access a new INelContext() contReset(CrashCounterSock); } @@ -148,7 +148,7 @@ INT_PTR CALLBACK MyDialogProc( HWND SlashScreen = NULL; HINSTANCE HInstance; - +/* static bool connect() { string server = "crashcounter.nevrax.com"; @@ -354,7 +354,7 @@ void initCrashReport () #ifdef TEST_CRASH_COUNTER MessageBox (NULL, res.c_str(), res.c_str(), MB_OK); #endif // TEST_CRASH_COUNTER -} +}*/ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR cmdline, int /* nCmdShow */) #else @@ -430,12 +430,12 @@ int main(int argc, char **argv) // exit (0); //} - initCrashReport (); + //initCrashReport (); #endif // FINAL_VERSION // Set default email value for reporting error #ifdef TEST_CRASH_COUNTER - initCrashReport (); + //initCrashReport (); setReportEmailFunction ((void*)sendEmail); setDefaultEmailParams ("smtp.nevrax.com", "", "hulud@nevrax.com"); @@ -637,7 +637,7 @@ int main(int argc, char **argv) //ICommand::execute("iFileAccessLogClear",*NLMISC::InfoLog); #endif - CFile::createEmptyFile(getLogDirectory() + "during_release"); + //CFile::createEmptyFile(getLogDirectory() + "during_release"); #ifdef TEST_CRASH_COUNTER if (string(cmdline) == "/release") diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index 61cfbf9ad..916e907b7 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -380,6 +380,7 @@ CClientConfig::CClientConfig() ScreenAspectRatio = 0.f; // Default commmon Screen Aspect Ratio (no relation with the resolution) - 0.f = auto FoV = 75.f; // Default value for the FoV. ForceDXTC = false; // Default is no DXTC Compression. + AnisotropicFilter = 0; // Default is disabled (-1 = maximum value, 0 = disabled, 1+ = enabled) DivideTextureSizeBy2= false; // Divide texture by 2 DisableVtxProgram = false; // Disable Hardware Vertex Program. DisableVtxAGP = false; // Disable Hardware Vertex AGP. @@ -979,6 +980,8 @@ void CClientConfig::setValues() READ_FLOAT_FV(FoV) // ForceDXTC READ_BOOL_FV(ForceDXTC) + // AnisotropicFilter + READ_INT_FV(AnisotropicFilter) // DivideTextureSizeBy2 READ_BOOL_FV(DivideTextureSizeBy2) // DisableVtxProgram diff --git a/code/ryzom/client/src/client_cfg.h b/code/ryzom/client/src/client_cfg.h index 2c448bac0..ebb972f05 100644 --- a/code/ryzom/client/src/client_cfg.h +++ b/code/ryzom/client/src/client_cfg.h @@ -230,6 +230,8 @@ struct CClientConfig float FoV; /// Force the DXTC Compression. bool ForceDXTC; + /// Set the anisotropic filter + sint AnisotropicFilter; /// Divide texture size by 2 bool DivideTextureSizeBy2; /// Disable Hardware Vertex Program. diff --git a/code/ryzom/client/src/client_sheets/attack_id_sheet.h b/code/ryzom/client/src/client_sheets/attack_id_sheet.h index 2eaaabed8..1dfe1b790 100644 --- a/code/ryzom/client/src/client_sheets/attack_id_sheet.h +++ b/code/ryzom/client/src/client_sheets/attack_id_sheet.h @@ -14,8 +14,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - - #ifndef CL_ATTACK_ID_H #define CL_ATTACK_ID_H diff --git a/code/ryzom/client/src/client_sheets/body_to_bone_sheet.cpp b/code/ryzom/client/src/client_sheets/body_to_bone_sheet.cpp index ea08a9747..fb065e6df 100644 --- a/code/ryzom/client/src/client_sheets/body_to_bone_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/body_to_bone_sheet.cpp @@ -19,6 +19,7 @@ #include "stdpch.h" // #include "body_to_bone_sheet.h" +#include "client_sheets.h" // #include "nel/georges/u_form_elm.h" diff --git a/code/ryzom/client/src/client_sheets/body_to_bone_sheet.h b/code/ryzom/client/src/client_sheets/body_to_bone_sheet.h index f71356c5b..10e59ba72 100644 --- a/code/ryzom/client/src/client_sheets/body_to_bone_sheet.h +++ b/code/ryzom/client/src/client_sheets/body_to_bone_sheet.h @@ -21,6 +21,8 @@ #include "game_share/body.h" +#include + namespace NLGEORGES { class UFormElm; diff --git a/code/ryzom/client/src/client_sheets/faction_sheet.h b/code/ryzom/client/src/client_sheets/faction_sheet.h index babdb78e9..1b1a3f3e5 100644 --- a/code/ryzom/client/src/client_sheets/faction_sheet.h +++ b/code/ryzom/client/src/client_sheets/faction_sheet.h @@ -14,11 +14,10 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - - #ifndef RY_FACTION_SHEET_H #define RY_FACTION_SHEET_H +#include "entity_sheet.h" /** Sheet of a faction * NB : it doesn't derives from CEntitySheet, because its instances are aggragated in a CContinentSheet diff --git a/code/ryzom/client/src/client_sheets/item_fx_sheet.cpp b/code/ryzom/client/src/client_sheets/item_fx_sheet.cpp index ce1912897..c58bc601f 100644 --- a/code/ryzom/client/src/client_sheets/item_fx_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/item_fx_sheet.cpp @@ -14,10 +14,10 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - - #include "stdpch.h" #include "item_fx_sheet.h" +#include "client_sheets.h" + #include "nel/georges/u_form_elm.h" // ******************************************************************************************* diff --git a/code/ryzom/client/src/client_sheets/outpost_building_sheet.h b/code/ryzom/client/src/client_sheets/outpost_building_sheet.h index f1bccc371..e753f3352 100644 --- a/code/ryzom/client/src/client_sheets/outpost_building_sheet.h +++ b/code/ryzom/client/src/client_sheets/outpost_building_sheet.h @@ -18,7 +18,7 @@ #define RY_OUTPOST_BUILDING_H #include "entity_sheet.h" - +#include "client_sheets.h" /** * Outpost building definition for client side management (buy building upgrades ...) diff --git a/code/ryzom/client/src/client_sheets/stdpch.h b/code/ryzom/client/src/client_sheets/stdpch.h index 6656b4553..3421b031d 100644 --- a/code/ryzom/client/src/client_sheets/stdpch.h +++ b/code/ryzom/client/src/client_sheets/stdpch.h @@ -14,7 +14,8 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include +#ifndef CL_STDPCH_H +#define CL_STDPCH_H #include #include @@ -33,15 +34,21 @@ #include #include +#include #include #include - #include #include #include #include #include #include +#include +#include -#include "client_sheets.h" -#include "entity_sheet.h" +#include +#include +#include +#include + +#endif diff --git a/code/ryzom/client/src/client_sheets/text_emot_list_sheet.h b/code/ryzom/client/src/client_sheets/text_emot_list_sheet.h index ccfdb8f9e..8533e14f5 100644 --- a/code/ryzom/client/src/client_sheets/text_emot_list_sheet.h +++ b/code/ryzom/client/src/client_sheets/text_emot_list_sheet.h @@ -14,8 +14,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - - #ifndef CL_TEXT_EMOT_LIST_SHEET_H #define CL_TEXT_EMOT_LIST_SHEET_H diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index fbeb2e8ef..02572d5e6 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -400,7 +400,6 @@ bool connection (const string &cookie, const string &fsaddr) nlinfo ("PROFILE: %d seconds for connection", (uint32)(ryzomGetLocalTime ()-connStart)/1000); // Init web box - nlinfo("ok"); // TMP TMP if (ClientCfg.Local) diff --git a/code/ryzom/client/src/entity_animation_manager.cpp b/code/ryzom/client/src/entity_animation_manager.cpp index d96ce431e..db1eccb01 100644 --- a/code/ryzom/client/src/entity_animation_manager.cpp +++ b/code/ryzom/client/src/entity_animation_manager.cpp @@ -179,7 +179,8 @@ void CEntityAnimationManager::load(NLMISC::IProgressCallback &/* progress */, bo release(); // Log in the animation file. - setDebugOutput(getLogDirectory() + "animation.dbg"); + //setDebugOutput(getLogDirectory() + "animation.dbg"); + setDebugOutput(""); // no log // Create the animation set for all entities. _AnimationSet = Driver->createAnimationSet(); diff --git a/code/ryzom/client/src/far_tp.cpp b/code/ryzom/client/src/far_tp.cpp index 5b4870ad1..4f5b389a8 100644 --- a/code/ryzom/client/src/far_tp.cpp +++ b/code/ryzom/client/src/far_tp.cpp @@ -160,6 +160,7 @@ const std::string& CLoginStateMachine::toString(CLoginStateMachine::TEvent event #define SM_END_EVENT_TABLE \ } \ +/* #define SM_EVENT(eventId, stateId) \ if (ev == eventId) \ { \ @@ -178,6 +179,14 @@ const std::string& CLoginStateMachine::toString(CLoginStateMachine::TEvent event _CurrentState = stateId; \ break; \ } \ +*/ + +#define SM_EVENT(eventId, stateId) \ + if (ev == eventId) \ + { \ + _CurrentState = stateId; \ + break; \ + } \ extern std::string LoginLogin, LoginPassword; extern bool noUserChar; @@ -898,7 +907,7 @@ retryJoinEdit: // Save this error (regular log file is deleted at every startup) // res = res + "\n\n"; - try +/* try { COFile outputF; if ( outputF.open( getLogDirectory() + "error_join.log", true, true ) ) @@ -913,7 +922,7 @@ retryJoinEdit: } catch (const Exception &) {} - +*/ // If the session is not a permanent session and has vanished, pop the position if ( requestRetToMainland ) { diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index ce6aa535c..f8ea4aa04 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -1067,6 +1067,9 @@ void prelogInit() // Init the DXTCCompression. Driver->forceDXTCCompression(ClientCfg.ForceDXTC); + // Set the anisotropic filter + Driver->setAnisotropicFilter(ClientCfg.AnisotropicFilter); + // Divide the texture size. if (ClientCfg.DivideTextureSizeBy2) Driver->forceTextureResize(2); diff --git a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 1b2959f1e..cb317102c 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -1620,7 +1620,6 @@ public: } } }; - REGISTER_ACTION_HANDLER(CHandlerPhraseSelectShortcutBar, "select_shortcut_bar"); diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index 844b25299..50f8aaad9 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -925,27 +925,31 @@ void CChatGroupWindow::saveFreeTeller(NLMISC::IStream &f) { f.serialVersion(2); - // Save the free teller only if it is present in the friend list to avoid the only-growing situation - // because free tellers are never deleted in game if we save/load all the free tellers, we just create more - // and more container. - - uint32 i, nNbFreeTellerSaved = 0; - for (i = 0; i < _FreeTellers.size(); ++i) - if (PeopleInterraction.FriendList.getIndexFromName(_FreeTellers[i]->getUCTitle()) != -1) - nNbFreeTellerSaved++; - + sint32 nNbFreeTellerSaved = 0; f.serial(nNbFreeTellerSaved); - for (i = 0; i < _FreeTellers.size(); ++i) - { - CGroupContainer *pGC = _FreeTellers[i]; + // Don't save the free tellers + //// Save the free teller only if it is present in the friend list to avoid the only-growing situation + //// because free tellers are never deleted in game if we save/load all the free tellers, we just create more + //// and more container. - if (PeopleInterraction.FriendList.getIndexFromName(pGC->getUCTitle()) != -1) - { - ucstring sTitle = pGC->getUCTitle(); - f.serial(sTitle); - } - } + //uint32 i, nNbFreeTellerSaved = 0; + //for (i = 0; i < _FreeTellers.size(); ++i) + // if (PeopleInterraction.FriendList.getIndexFromName(_FreeTellers[i]->getUCTitle()) != -1) + // nNbFreeTellerSaved++; + + //f.serial(nNbFreeTellerSaved); + + //for (i = 0; i < _FreeTellers.size(); ++i) + //{ + // CGroupContainer *pGC = _FreeTellers[i]; + + // if (PeopleInterraction.FriendList.getIndexFromName(pGC->getUCTitle()) != -1) + // { + // ucstring sTitle = pGC->getUCTitle(); + // f.serial(sTitle); + // } + //} } //================================================================================= @@ -974,11 +978,12 @@ void CChatGroupWindow::loadFreeTeller(NLMISC::IStream &f) ucstring sTitle; f.serial(sTitle); - CGroupContainer *pGC = createFreeTeller(sTitle, ""); + // Don't actually create the free teller + //CGroupContainer *pGC = createFreeTeller(sTitle, ""); - // With version 1 all tells are active because windows information have "title based" ids and no "sID based". - if ((ver == 1) && (pGC != NULL)) - pGC->setActive(false); + //// With version 1 all tells are active because windows information have "title based" ids and no "sID based". + //if ((ver == 1) && (pGC != NULL)) + // pGC->setActive(false); } } diff --git a/code/ryzom/client/src/interface_v3/dbgroup_combo_box.cpp b/code/ryzom/client/src/interface_v3/dbgroup_combo_box.cpp index 099016a40..94b816285 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_combo_box.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_combo_box.cpp @@ -34,6 +34,12 @@ NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupComboBox, std::string, "combo_box"); extern bool loginFinished; +// Compare strings +static inline bool lt_text(const std::pair &s1, const std::pair &s2) +{ + return toLower(s1.second) < toLower(s2.second); +} + // *************************************************************************** CDBGroupComboBox::CDBGroupComboBox(const TCtorParam ¶m) : CInterfaceGroup(param) @@ -173,7 +179,7 @@ void CDBGroupComboBox::checkCoords () } else { - _ViewText->setText(_Texts[_CacheSelection]); + _ViewText->setText(_Texts[_CacheSelection].second); } } } @@ -205,7 +211,7 @@ void CDBGroupComboBox::resetTexts() void CDBGroupComboBox::addText(const ucstring &text) { dirt(); - _Texts.push_back(text); + _Texts.push_back(make_pair(_Texts.size(), text)); _Textures.push_back(std::string()); } @@ -214,7 +220,7 @@ void CDBGroupComboBox::setText(uint i, const ucstring &text) { dirt(); if(i<_Texts.size()) - _Texts[i]= text; + _Texts[i].second= text; } // *************************************************************************** @@ -223,14 +229,14 @@ void CDBGroupComboBox::insertText(uint i, const ucstring &text) dirt(); if(i<_Texts.size()) { - addText(_Texts[_Texts.size()-1]); + addText(_Texts[_Texts.size()-1].second); for(uint t=i; t<_Texts.size()-1; t++) { _Texts[t+1] = _Texts[t]; _Textures[t+1] = _Textures[t]; } - _Texts[i]= text; + _Texts[i] = make_pair(i, text); _Textures[i] = std::string(); } else if(i==_Texts.size()) @@ -246,13 +252,13 @@ void CDBGroupComboBox::setTexture(uint i, const ucstring &texture) } // *************************************************************************** -void CDBGroupComboBox::removeText(uint i) +void CDBGroupComboBox::removeText(uint nPos) { dirt(); - if(i<_Texts.size()) + if(nPos<_Texts.size()) { - _Texts.erase( _Texts.begin()+i ); - _Textures.erase( _Textures.begin()+i ); + _Texts.erase( _Texts.begin()+nPos ); + _Textures.erase( _Textures.begin()+nPos ); } } @@ -261,11 +267,37 @@ const ucstring &CDBGroupComboBox::getText(uint i) const { static ucstring null; if(i<_Texts.size()) - return _Texts[i]; + return _Texts[i].second; else return null; } +// *************************************************************************** +const uint &CDBGroupComboBox::getTextId(uint i) const +{ + static uint null = 0; + if(i<_Texts.size()) + return _Texts[i].first; + else + return null; +} + +// *************************************************************************** +uint CDBGroupComboBox::getTextPos(uint nId) const +{ + for(uint i=0; i<_Texts.size(); i++) + { + if(nId == _Texts[i].first) {return i;} + } + return 0; +} + +// *************************************************************************** +void CDBGroupComboBox::sortText() +{ + sort(_Texts.begin(), _Texts.end(), lt_text); +} + // *************************************************************************** const ucstring &CDBGroupComboBox::getTexture(uint i) const { @@ -355,7 +387,7 @@ void CDBGroupComboBox::setViewText(const ucstring & text) // *************************************************************************** ucstring CDBGroupComboBox::getViewText() const { - return _ViewText->getText(); + return _ViewText->getText(); } // *************************************************************************** diff --git a/code/ryzom/client/src/interface_v3/dbgroup_combo_box.h b/code/ryzom/client/src/interface_v3/dbgroup_combo_box.h index fe92d19ad..4d74508ad 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_combo_box.h +++ b/code/ryzom/client/src/interface_v3/dbgroup_combo_box.h @@ -66,9 +66,12 @@ public: void setText(uint i, const ucstring &text); void insertText(uint i, const ucstring &text); const ucstring &getText(uint i) const; + const uint &getTextId(uint i) const; + uint getTextPos(uint nId) const; const ucstring &getTexture(uint i) const; - void removeText(uint i); + void removeText(uint nPos); uint getNumTexts() const {return (uint)_Texts.size();} + void sortText(); // selection void setSelection(sint32 val); @@ -125,32 +128,32 @@ public: protected: friend class CHandlerComboBoxSelectStart; - bool _LinkedToDB; // if not linked to db, then _NotLinkedToDBSelection is used instead - bool _Setuped; - bool _DirtySelection; - sint32 _CacheSelection; + bool _LinkedToDB; // if not linked to db, then _NotLinkedToDBSelection is used instead + bool _Setuped; + bool _DirtySelection; + sint32 _CacheSelection; // sint32 - CInterfaceProperty _Selection; - sint32 _NotLinkedToDBSelection; - std::vector _Texts; - std::vector _Textures; + CInterfaceProperty _Selection; + sint32 _NotLinkedToDBSelection; + std::vector > _Texts; + std::vector _Textures; // Action Handler called on combo click - std::string _AHOnSelectStart; + std::string _AHOnSelectStart; // Action handler called when the content is changed - std::string _AHOnChange; - std::string _AHOnChangeParams; - bool _CallingOnChangeActionHandler; // avoid infinite loop here + std::string _AHOnChange; + std::string _AHOnChangeParams; + bool _CallingOnChangeActionHandler; // avoid infinite loop here // Children - CViewText *_ViewText; - CCtrlBaseButton *_SelectButton; + CViewText *_ViewText; + CCtrlBaseButton *_SelectButton; - bool _IsExternViewText; - ucstring _ExternViewText; + bool _IsExternViewText; + ucstring _ExternViewText; private: diff --git a/code/ryzom/client/src/interface_v3/group_html.cpp b/code/ryzom/client/src/interface_v3/group_html.cpp index 034214d3d..65983c861 100644 --- a/code/ryzom/client/src/interface_v3/group_html.cpp +++ b/code/ryzom/client/src/interface_v3/group_html.cpp @@ -148,7 +148,7 @@ void CGroupHTML::addImageDownload(const string &url, CViewBase *img) nlwarning("add to download '%s' dest '%s' img %p", url.c_str(), dest.c_str(), img); #endif - // erase the tmp file if exists + // erase the tmp file if exists if (NLMISC::CFile::fileExists(tmpdest)) NLMISC::CFile::deleteFile(tmpdest); diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index 8f7d597fb..c20615600 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -259,8 +259,8 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) if (strnicmp(sFame.c_str(),"tribe_",6)==0) { tribeName = true; - // always display title for tribe - title = true; + //// always display title for tribe + //title = true; theTribeName = STRING_MANAGER::CStringManagerClient::getFactionLocalizedName(sFame); // tribeName stuff disable any guild name guildName= false; diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index b1c8387d7..4347a3380 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -26,6 +26,7 @@ #include "../user_entity.h" #include "ctrl_button.h" #include "group_editbox.h" +#include "dbgroup_combo_box.h" #include "../string_manager_client.h" #include "group_container.h" #include "action_handler.h" @@ -79,7 +80,8 @@ static CGroupMap *LastClickedMap = NULL; static CCtrlButton *LastSelectedLandMark = NULL; static bool UseUserPositionForLandMark = false; static const char *WIN_LANDMARK_NAME="ui:interface:enter_landmark_name"; - +// Loaded position of user landmark types +static std::vector LoadedPosition; //////////// // GLOBAL // @@ -110,6 +112,10 @@ static void popupLandMarkNameDialog() CGroupEditBox *eb = dynamic_cast(gc->getGroup("eb")); if (!eb) return; + // Load ComboBox for Landmarks & sort entries + CDBGroupComboBox *cb = dynamic_cast(gc->getGroup("landmarktypes")); + cb->sortText(); + if (LastSelectedLandMark) { CGroupMap *map = dynamic_cast(LastSelectedLandMark->getParent()); @@ -117,12 +123,12 @@ static void popupLandMarkNameDialog() const CUserLandMark userLM = map->getUserLandMark(LastSelectedLandMark); - im->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(userLM.Type); + im->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(cb->getTextPos(userLM.Type)); eb->setInputString(userLM.Title); } else { - im->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(CUserLandMark::Misc); + im->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(cb->getTextPos(CUserLandMark::Misc)); eb->setInputString(ucstring()); } @@ -132,6 +138,7 @@ static void popupLandMarkNameDialog() static void closeLandMarkNameDialog() { + LoadedPosition.clear(); CInterfaceManager *im = CInterfaceManager::getInstance(); CGroupContainer *gc = dynamic_cast(im->getElementFromId(WIN_LANDMARK_NAME)); if (!gc) return; @@ -3202,10 +3209,14 @@ class CAHValidateUserLandMarkName : public IActionHandler CGroupEditBox *eb = dynamic_cast(ig->getGroup("eb")); if (!eb) return; ig->setActive(false); + CGroupContainer *gc = dynamic_cast(im->getElementFromId(WIN_LANDMARK_NAME)); + if (!gc) return; + // Retrieve ComboBox to get the position(ordered landmark type) of the selected item + CDBGroupComboBox *cb = dynamic_cast(gc->getGroup("landmarktypes")); CUserLandMark::EUserLandMarkType landMarkType = CUserLandMark::Misc; - sint8 nLandMarkType = im->getDbProp( "UI:TEMP:LANDMARKTYPE" )->getValue8(); + sint8 nLandMarkType = cb->getTextId(im->getDbProp( "UI:TEMP:LANDMARKTYPE" )->getValue8()); if (nLandMarkType>=0 && nLandMarkType<=CUserLandMark::UserLandMarkTypeCount) { landMarkType = (CUserLandMark::EUserLandMarkType)nLandMarkType; diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index 397414deb..0e7d31c79 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -963,7 +963,6 @@ void impulseFarTell(NLMISC::CBitMemStream &impulse) ChatMngr.processFarTellString(impulse, InterfaceChatDisplayer); } - void impulseTell2(NLMISC::CBitMemStream &impulse) { ChatMngr.processTellString2(impulse, InterfaceChatDisplayer); diff --git a/code/ryzom/client/src/sheet_manager.cpp b/code/ryzom/client/src/sheet_manager.cpp index d467112b9..cdb9b4ff1 100644 --- a/code/ryzom/client/src/sheet_manager.cpp +++ b/code/ryzom/client/src/sheet_manager.cpp @@ -55,8 +55,8 @@ using namespace NLGEORGES; // Sheet manager. CSheetManager SheetMngr; UFormLoader *CSheetManager::FormLoader = NULL; -COFile fItemAssoc; -bool ItemAssocFileOpen = false; +//COFile fItemAssoc; +//bool ItemAssocFileOpen = false; // there can be several instance of CSheetManager (for reload operations) -> ctruct the loader here rather than in CSheetManager ctor class CFormLoaderInit @@ -598,17 +598,17 @@ void CSheetManager::release() void CSheetManager::load(NLMISC::IProgressCallback &callBack, bool updatePackedSheet, bool needComputeVS, bool dumpVSIndex) { // Open The Item Association File - if(!fItemAssoc.open(getLogDirectory() + "item_association.dbg", false, true)) - nlwarning("CSheetManager::load: Cannot Open the 'item_association.txt'."); - else - ItemAssocFileOpen = true; +// if(!fItemAssoc.open(getLogDirectory() + "item_association.dbg", false, true)) +// nlwarning("CSheetManager::load: Cannot Open the 'item_association.txt'."); +// else +// ItemAssocFileOpen = true; // Initialize the Sheet DB. loadAllSheet(callBack, updatePackedSheet, needComputeVS, dumpVSIndex); // Close the Item Association File. - fItemAssoc.close(); - ItemAssocFileOpen = false; +// fItemAssoc.close(); +// ItemAssocFileOpen = false; // Optimize memory taken by all strings of all sheets ClientSheetsStrings.memoryCompress(); diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index c0dec5500..51a5a9882 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -518,7 +518,7 @@ void CUserEntity::updateVisualPropertyName(const NLMISC::TGameCycle &gameCycle, html->browse("home"); } } -*/ +*/ }// updateVisualPropertyName // //----------------------------------------------- diff --git a/code/ryzom/common/src/game_share/dyn_chat.cpp b/code/ryzom/common/src/game_share/dyn_chat.cpp index b9eba4cff..aae0015d7 100644 --- a/code/ryzom/common/src/game_share/dyn_chat.cpp +++ b/code/ryzom/common/src/game_share/dyn_chat.cpp @@ -138,11 +138,12 @@ CDynChatSession *CDynChatClient::getSession(TChanID chan) const CDynChatChan::CDynChatChan() : HistoricSize(0), HideBubble(false), + UniversalChannel(false), _FirstSession(NULL), _ID(CEntityId::Unknown), _DontBroadcastPlayerInputs(false), _ForwardPlayerIntputToOwnerService(false), - _UnifyChannel(false) + _UnifyChannel(false) { } @@ -151,6 +152,7 @@ CDynChatChan::CDynChatChan() CDynChatChan::CDynChatChan(TChanID id, bool noBroadcast, bool forwardInput, bool unified) : HistoricSize(0), HideBubble(false), + UniversalChannel(false), _FirstSession(NULL), _ID(id), _DontBroadcastPlayerInputs(noBroadcast), diff --git a/code/ryzom/common/src/game_share/dyn_chat.h b/code/ryzom/common/src/game_share/dyn_chat.h index a5575a68f..081bf7434 100644 --- a/code/ryzom/common/src/game_share/dyn_chat.h +++ b/code/ryzom/common/src/game_share/dyn_chat.h @@ -131,6 +131,7 @@ public: bool Localized; // for EGS only ucstring Title; // gives the title of the channel when it is not translated (e.g Localized == false) bool HideBubble; // hide the display of bubble + bool UniversalChannel; // treat like universe channel public: CDynChatChan(); // CDynChatChan(TChanID id = NLMISC::CEntityId::Unknown, NLNET::TServiceId ownerServiceId, bool noBroadcast, bool forwadInput); diff --git a/code/ryzom/common/src/game_share/scenario.cpp b/code/ryzom/common/src/game_share/scenario.cpp index 5320f0918..6911df31a 100644 --- a/code/ryzom/common/src/game_share/scenario.cpp +++ b/code/ryzom/common/src/game_share/scenario.cpp @@ -989,7 +989,7 @@ bool CScenarioValidator::setScenarioToSave(const std::string& filename, CObject* return true; } -std::string CScenarioValidator::AutoSaveSignature = ""; +std::string CScenarioValidator::AutoSaveSignature; bool CScenarioValidator::applySave(const std::string& signature) { @@ -1252,7 +1252,7 @@ bool CUserComponentValidator::setUserComponentToSave(const std::string& filename return true; } -std::string CUserComponentValidator::AutoSaveSignature = ""; +std::string CUserComponentValidator::AutoSaveSignature; bool CUserComponentValidator::applySave(const std::string& signature) { diff --git a/code/ryzom/common/src/game_share/server_animation_module.cpp b/code/ryzom/common/src/game_share/server_animation_module.cpp index 3758dbf53..51d7ce19e 100644 --- a/code/ryzom/common/src/game_share/server_animation_module.cpp +++ b/code/ryzom/common/src/game_share/server_animation_module.cpp @@ -2017,7 +2017,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi //first <=> actId CPrimitives *primDoc = &primDocs[first]; - std::string streamFileName = ""; + std::string streamFileName; if (first==0) { streamFileName= toString("r2.%04d.base.primitive", aiInstance); diff --git a/code/ryzom/common/src/game_share/string_manager_sender.cpp b/code/ryzom/common/src/game_share/string_manager_sender.cpp index d4fa0b397..83336ecf3 100644 --- a/code/ryzom/common/src/game_share/string_manager_sender.cpp +++ b/code/ryzom/common/src/game_share/string_manager_sender.cpp @@ -117,6 +117,7 @@ namespace STRING_MANAGER case damage_type: case power_type: case classification_type: + case clan: // enum f.serial(const_cast(Enum)); break; @@ -332,6 +333,7 @@ namespace STRING_MANAGER NL_STRING_CONVERSION_TABLE_ENTRY( event_faction ) NL_STRING_CONVERSION_TABLE_ENTRY( classification_type ) NL_STRING_CONVERSION_TABLE_ENTRY( outpost ) + NL_STRING_CONVERSION_TABLE_ENTRY( clan ) NL_END_STRING_CONVERSION_TABLE(TParamType, ParamTypeConversion, NB_PARAM_TYPES) //----------------------------------------------- diff --git a/code/ryzom/common/src/game_share/string_manager_sender.h b/code/ryzom/common/src/game_share/string_manager_sender.h index 1e2b25d2d..2520c0e77 100644 --- a/code/ryzom/common/src/game_share/string_manager_sender.h +++ b/code/ryzom/common/src/game_share/string_manager_sender.h @@ -66,6 +66,7 @@ namespace STRING_MANAGER event_faction, classification_type, outpost, + clan, invalid_value, NB_PARAM_TYPES = invalid_value diff --git a/code/ryzom/common/src/game_share/welcome_service_itf.h b/code/ryzom/common/src/game_share/welcome_service_itf.h index fded04c26..410204cd8 100644 --- a/code/ryzom/common/src/game_share/welcome_service_itf.h +++ b/code/ryzom/common/src/game_share/welcome_service_itf.h @@ -6,9 +6,6 @@ #ifndef WELCOME_SERVICE_ITF #define WELCOME_SERVICE_ITF #include "nel/misc/types_nl.h" -#ifdef NL_COMP_VC8 - #include -#endif #include "nel/misc/hierarchical_timer.h" #include "nel/misc/string_conversion.h" #include "nel/net/message.h" @@ -18,7 +15,9 @@ #include "nel/net/module_gateway.h" #include "nel/net/login_cookie.h" - + +#include + namespace WS { diff --git a/code/ryzom/server/ai_service.cfg b/code/ryzom/server/ai_service.cfg index 55f168607..1a11d9507 100644 --- a/code/ryzom/server/ai_service.cfg +++ b/code/ryzom/server/ai_service.cfg @@ -13,15 +13,10 @@ SUAddress = SUHost+":"+SUPort; AESAliasName= "ais_newbyland"; -GraphVars += { "TickSpeedLoop", "0" }; GraphVars += { "TickSpeedLoop", "60000" }; -GraphVars += { "L5CallbackCount", "0" }; GraphVars += { "L5CallbackCount", "60000" }; -GraphVars += { "L5CallbackTime", "0" }; GraphVars += { "L5CallbackTime", "60000" }; -GraphVars += { "MirrorCallbackCount", "0" }; GraphVars += { "MirrorCallbackCount", "60000" }; -GraphVars += { "MirrorCallbackTime", "0" }; GraphVars += { "MirrorCallbackTime", "60000" }; Paths = { @@ -50,7 +45,7 @@ UsedPrimitives = // of the packed sheet reader GeorgePaths = { "" }; - // ---- service custom variables (used by CVariable class) +// ---- service custom variables (used by CVariable class) NbPlayersLimit = PlayerLimit; diff --git a/code/ryzom/server/data_shard/mirror_sheets/fe_temp.dataset b/code/ryzom/server/data_shard/mirror_sheets/fe_temp.dataset index 442a9a2cf..4caf2d0b2 100644 --- a/code/ryzom/server/data_shard/mirror_sheets/fe_temp.dataset +++ b/code/ryzom/server/data_shard/mirror_sheets/fe_temp.dataset @@ -292,7 +292,7 @@ - + diff --git a/code/ryzom/server/entities_game_service.cfg b/code/ryzom/server/entities_game_service.cfg index 8835d9cd2..4ec5fc63d 100644 --- a/code/ryzom/server/entities_game_service.cfg +++ b/code/ryzom/server/entities_game_service.cfg @@ -32,19 +32,12 @@ StartCommands += { "setShardExchangeLimit 302 250" }; StartCommands += { "displayShardExchangeLimits" }; StartCommands += { "EnableStlAllocatorChecker 0" }; -GraphVars += { "CharacterLoadPerTick", "0" }; GraphVars += { "CharacterLoadPerTick", "60000" }; -GraphVars += { "CharacterSavePerTick", "0" }; GraphVars += { "CharacterSavePerTick", "60000" }; -GraphVars += { "TickSpeedLoop", "0" }; GraphVars += { "TickSpeedLoop", "60000" }; -GraphVars += { "L5CallbackCount", "0" }; GraphVars += { "L5CallbackCount", "60000" }; -GraphVars += { "L5CallbackTime", "0" }; GraphVars += { "L5CallbackTime", "60000" }; -GraphVars += { "MirrorCallbackCount", "0" }; GraphVars += { "MirrorCallbackCount", "60000" }; -GraphVars += { "MirrorCallbackTime", "0" }; GraphVars += { "MirrorCallbackTime", "60000" }; NSHost = "localhost"; diff --git a/code/ryzom/server/frontend_service.cfg b/code/ryzom/server/frontend_service.cfg index c9392bd51..36a4103c5 100644 --- a/code/ryzom/server/frontend_service.cfg +++ b/code/ryzom/server/frontend_service.cfg @@ -14,15 +14,10 @@ FSListenHost = "open.ryzom.com"; AESAliasName= "fes"; -GraphVars += { "TickSpeedLoop", "0" }; GraphVars += { "TickSpeedLoop", "60000" }; -GraphVars += { "L5CallbackCount", "0" }; GraphVars += { "L5CallbackCount", "60000" }; -GraphVars += { "L5CallbackTime", "0" }; GraphVars += { "L5CallbackTime", "60000" }; -GraphVars += { "MirrorCallbackCount", "0" }; GraphVars += { "MirrorCallbackCount", "60000" }; -GraphVars += { "MirrorCallbackTime", "0" }; GraphVars += { "MirrorCallbackTime", "60000" }; Paths = { diff --git a/code/ryzom/server/gpm_service.cfg b/code/ryzom/server/gpm_service.cfg index b3d254734..3d06bf73b 100644 --- a/code/ryzom/server/gpm_service.cfg +++ b/code/ryzom/server/gpm_service.cfg @@ -8,15 +8,10 @@ AESAliasName= "gpms"; -GraphVars += { "TickSpeedLoop", "0" }; GraphVars += { "TickSpeedLoop", "60000" }; -GraphVars += { "L5CallbackCount", "0" }; GraphVars += { "L5CallbackCount", "60000" }; -GraphVars += { "L5CallbackTime", "0" }; GraphVars += { "L5CallbackTime", "60000" }; -GraphVars += { "MirrorCallbackCount", "0" }; GraphVars += { "MirrorCallbackCount", "60000" }; -GraphVars += { "MirrorCallbackTime", "0" }; GraphVars += { "MirrorCallbackTime", "60000" }; Paths = { diff --git a/code/ryzom/server/mirror_service.cfg b/code/ryzom/server/mirror_service.cfg index eafe07456..6bfaef14f 100644 --- a/code/ryzom/server/mirror_service.cfg +++ b/code/ryzom/server/mirror_service.cfg @@ -8,11 +8,8 @@ AESAliasName= "ms"; -GraphVars += { "UserSpeedLoop", "0" }; GraphVars += { "UserSpeedLoop", "60000" }; -GraphVars += { "L5CallbackCount", "0" }; GraphVars += { "L5CallbackCount", "60000" }; -GraphVars += { "L5CallbackTime", "0" }; GraphVars += { "L5CallbackTime", "60000" }; Paths = { diff --git a/code/ryzom/server/monitor_service.cfg b/code/ryzom/server/monitor_service.cfg index 478333649..91119f9f5 100644 --- a/code/ryzom/server/monitor_service.cfg +++ b/code/ryzom/server/monitor_service.cfg @@ -10,11 +10,8 @@ AESAliasName= "mos"; -GraphVars += { "UserSpeedLoop", "0" }; GraphVars += { "UserSpeedLoop", "60000" }; -GraphVars += { "L5CallbackCount", "0" }; GraphVars += { "L5CallbackCount", "60000" }; -GraphVars += { "L5CallbackTime", "0" }; GraphVars += { "L5CallbackTime", "60000" }; Paths = { diff --git a/code/ryzom/server/session_browser_server.cfg b/code/ryzom/server/session_browser_server.cfg index c784e581e..9dc54e077 100644 --- a/code/ryzom/server/session_browser_server.cfg +++ b/code/ryzom/server/session_browser_server.cfg @@ -20,11 +20,8 @@ StartCommands += "sbs.plug gw", }; -GraphVars += { "NetSpeedLoop", "0" }; GraphVars += { "NetSpeedLoop", "60000" }; -GraphVars += { "L5CallbackCount", "0" }; GraphVars += { "L5CallbackCount", "60000" }; -GraphVars += { "L5CallbackTime", "0" }; GraphVars += { "L5CallbackTime", "60000" }; Paths = { diff --git a/code/ryzom/server/shard.screen.rc b/code/ryzom/server/shard.screen.rc index ba8d7f2b7..5d7dab6d1 100644 --- a/code/ryzom/server/shard.screen.rc +++ b/code/ryzom/server/shard.screen.rc @@ -12,60 +12,62 @@ bind K kill bind I login on bind O login off +hardstatus alwayslastline "%w" + chdir $RYZOM_PATH/server -screen -t aes /bin/sh service_launcher.sh aes src/ryzom_admin_service/ryzom_admin_service -A. -C. -L. --nobreak --fulladminname=admin_executor_service --shortadminname=AES +screen -t aes /bin/sh service_launcher.sh aes $RYZOM_PATH/../build/bin/ryzom_admin_service -A. -C. -L. --nobreak --fulladminname=admin_executor_service --shortadminname=AES # bms_master -screen -t bms_master /bin/sh service_launcher.sh bms_master src/backup_service/backup_service -C. -L. --nobreak --writepid -P49990 +screen -t bms_master /bin/sh service_launcher.sh bms_master $RYZOM_PATH/../build/bin/ryzom_backup_service -C. -L. --nobreak --writepid -P49990 # bms_pd_master -#screen -t bms_pd_master /bin/sh service_launcher.sh bms_pd_master src/backup_service/backup_service -C. -L. --nobreak --writepid -P49992 +#screen -t bms_pd_master /bin/sh service_launcher.sh bms_pd_master $RYZOM_PATH/../build/bin/ryzom_backup_service -C. -L. --nobreak --writepid -P49992 # egs -screen -t egs /bin/sh service_launcher.sh egs src/entities_game_service/entities_game_service -C. -L. --nobreak --writepid +screen -t egs /bin/sh service_launcher.sh egs $RYZOM_PATH/../build/bin/ryzom_entities_game_service -C. -L. --nobreak --writepid # gpms -screen -t gpms /bin/sh service_launcher.sh gpms src/gpm_service/gpm_service -C. -L. --nobreak --writepid +screen -t gpms /bin/sh service_launcher.sh gpms $RYZOM_PATH/../build/bin/ryzom_gpm_service -C. -L. --nobreak --writepid # ios -screen -t ios /bin/sh service_launcher.sh ios src/input_output_service/input_output_service -C. -L. --nobreak --writepid +screen -t ios /bin/sh service_launcher.sh ios $RYZOM_PATH/../build/bin/ryzom_ios_service -C. -L. --nobreak --writepid # rns -screen -t rns /bin/sh service_launcher.sh rns src/ryzom_naming_service/ryzom_naming_service -C. -L. --nobreak --writepid +screen -t rns /bin/sh service_launcher.sh rns $RYZOM_PATH/../build/bin/ryzom_naming_service -C. -L. --nobreak --writepid # rws -screen -t rws /bin/sh service_launcher.sh rws src/ryzom_welcome_service/ryzom_welcome_service -C. -L. --nobreak --writepid +screen -t rws /bin/sh service_launcher.sh rws $RYZOM_PATH/../build/bin/ryzom_welcome_service -C. -L. --nobreak --writepid # ts -screen -t ts /bin/sh service_launcher.sh ts src/tick_service/tick_service -C. -L. --nobreak --writepid +screen -t ts /bin/sh service_launcher.sh ts $RYZOM_PATH/../build/bin/ryzom_tick_service -C. -L. --nobreak --writepid # ms -screen -t ms /bin/sh service_launcher.sh ms src/mirror_service/mirror_service -C. -L. --nobreak --writepid +screen -t ms /bin/sh service_launcher.sh ms $RYZOM_PATH/../build/bin/ryzom_mirror_service -C. -L. --nobreak --writepid # ais_newbyland -screen -t ais_newbyland /bin/sh service_launcher.sh ais_newbyland src/ai_service/ai_service -C. -L. --nobreak --writepid -mCommon:Newbieland:Post +screen -t ais_newbyland /bin/sh service_launcher.sh ais_newbyland $RYZOM_PATH/../build/bin/ryzom_ai_service -C. -L. --nobreak --writepid -mCommon:Newbieland:Post # mfs -screen -t mfs /bin/sh service_launcher.sh mfs src/mail_forum_service/mail_forum_service -C. -L. --nobreak --writepid +screen -t mfs /bin/sh service_launcher.sh mfs $RYZOM_PATH/../build/bin/ryzom_mail_forum_service -C. -L. --nobreak --writepid # su -screen -t su /bin/sh service_launcher.sh su src/shard_unifier_service/shard_unifier_service -C. -L. --nobreak --writepid +screen -t su /bin/sh service_launcher.sh su $RYZOM_PATH/../build/bin/ryzom_shard_unifier_service -C. -L. --nobreak --writepid # fes -screen -t fes /bin/sh service_launcher.sh fes src/frontend_service/frontend_service -C. -L. --nobreak --writepid +screen -t fes /bin/sh service_launcher.sh fes $RYZOM_PATH/../build/bin/ryzom_frontend_service -C. -L. --nobreak --writepid # sbs -screen -t sbs /bin/sh service_launcher.sh sbs src/session_browser_server/session_browser_server -C. -L. --nobreak --writepid +screen -t sbs /bin/sh service_launcher.sh sbs $RYZOM_PATH/../build/bin/ryzom_session_browser_service -C. -L. --nobreak --writepid # lgs -screen -t lgs /bin/sh service_launcher.sh lgs src/logger_service/logger_service -C. -L. --nobreak --writepid +screen -t lgs /bin/sh service_launcher.sh lgs $RYZOM_PATH/../build/bin/ryzom_logger_service -C. -L. --nobreak --writepid # mos -#screen -t mos /bin/sh service_launcher.sh mos src/monitor_service/monitor_service -C. -L. --nobreak --writepid +#screen -t mos /bin/sh service_launcher.sh mos $RYZOM_PATH/../build/bin/ryzom_monitor_service -C. -L. --nobreak --writepid # pdss -#screen -t pdss /bin/sh service_launcher.sh pdss src/pd_support_service/pd_support_service -C. -L. --nobreak --writepid +#screen -t pdss /bin/sh service_launcher.sh pdss $RYZOM_PATH/../build/bin/ryzom_pd_support_service -C. -L. --nobreak --writepid # ras -screen -t ras /bin/sh service_launcher.sh ras src/ryzom_admin_service/ryzom_admin_service --fulladminname=admin_service --shortadminname=AS -C. -L. --nobreak --writepid +screen -t ras /bin/sh service_launcher.sh ras $RYZOM_PATH/../build/bin/ryzom_admin_service --fulladminname=admin_service --shortadminname=AS -C. -L. --nobreak --writepid diff --git a/code/ryzom/server/shard_unifier_service.cfg b/code/ryzom/server/shard_unifier_service.cfg index 4e0cab244..9b37f063b 100644 --- a/code/ryzom/server/shard_unifier_service.cfg +++ b/code/ryzom/server/shard_unifier_service.cfg @@ -20,11 +20,8 @@ StartCommands += }; GraphVars += { "TotalConcurentUser", "60000" }; -GraphVars += { "NetSpeedLoop", "0" }; GraphVars += { "NetSpeedLoop", "60000" }; -GraphVars += { "L5CallbackCount", "0" }; GraphVars += { "L5CallbackCount", "60000" }; -GraphVars += { "L5CallbackTime", "0" }; GraphVars += { "L5CallbackTime", "60000" }; Paths = { diff --git a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp index c65636565..6a15900d0 100644 --- a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp +++ b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp @@ -39,7 +39,7 @@ #include "nel/pacs/u_retriever_bank.h" #include "nel/pacs/u_primitive_block.h" -#include "nel/../../src/pacs/global_retriever.h" +#include "nel/pacs/global_retriever.h" // Nel Ligo diff --git a/code/ryzom/server/src/ai_service/stdpch.h b/code/ryzom/server/src/ai_service/stdpch.h index 1dcb7b4ff..d0978b2f7 100644 --- a/code/ryzom/server/src/ai_service/stdpch.h +++ b/code/ryzom/server/src/ai_service/stdpch.h @@ -174,8 +174,8 @@ namespace MULTI_LINE_FORMATER { #include "game_share/ryzom_entity_id.h" #include "game_share/mode_and_behaviour.h" #include "game_share/player_visual_properties.h" -#include "../ai_share/ai_event.h" -#include "../server_share/msg_ai_service.h" +#include "ai_share/ai_event.h" +#include "server_share/msg_ai_service.h" //---------------------------------------------------------------- // ai share diff --git a/code/ryzom/server/src/entities_game_service/admin.cpp b/code/ryzom/server/src/entities_game_service/admin.cpp index be097a3c1..20941e77f 100644 --- a/code/ryzom/server/src/entities_game_service/admin.cpp +++ b/code/ryzom/server/src/entities_game_service/admin.cpp @@ -430,6 +430,78 @@ bool getAIInstanceFromGroupName(string& groupName, uint32& instanceNumber) return true; } +bool checkBannerPriv(const string &sheetName, CEntityId eid) +{ + + if (sheetName.find("banner") == string::npos) + { + // Not a banner + return true; + } + + CPlayer* player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) ); + + if (player == NULL) + { + return false; + } + + if (player->havePriv(":DEV:")) + { + // Dev should be able to get all banners + return true; + } + + if ( ! player->havePriv(BannerPriv)) + { + // Player has no banner privs + return false; + } + + if (sheetName.find("_gu") != string::npos) + { + if (player->havePriv(":G:")) + { + return true; + } + } + else if (sheetName.find("_sgu") != string::npos) + { + if (player->havePriv(":SG:")) + { + return true; + } + // VG uses SG banner for now + if (player->havePriv(":VG:")) + { + return true; + } + } + else if (sheetName.find("_vgu") != string::npos) + { + if (player->havePriv(":VG:")) + { + return true; + } + } + else if (sheetName.find("_gm") != string::npos) + { + if (player->havePriv(":GM:")) + { + return true; + } + } + else if (sheetName.find("_sgm") != string::npos) + { + if (player->havePriv(":SGM:")) + { + return true; + } + } + + return false; +} + CAdminCommand * findAdminCommand(const string & name) { H_AUTO(findAdminCommand); @@ -1381,18 +1453,12 @@ NLMISC_COMMAND (createItemInBag, "Create an item and put it in the player bag", } // banners are the only items in game which use privilege - if( sheetName.find("banner") != string::npos ) + // banners are the only items in game which use privilege + bool ok = checkBannerPriv(sheetName, eid); + if ( ! ok) { - CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) ); -// if (player != NULL && !player->havePriv(":DEV:") ) - if (player != NULL && player->havePriv(BannerPriv) ) - { - if( sheetName.find("_gu") != string::npos && !player->havePriv(":G:") ) return false; - if( sheetName.find("_sgu") != string::npos && !player->havePriv(":SG:") ) return false; - if( sheetName.find("_vgu") != string::npos && !player->havePriv(":VG:") ) return false; - if( sheetName.find("_gm") != string::npos && !player->havePriv(":GM:") ) return false; - if( sheetName.find("_sgm") != string::npos && !player->havePriv(":SGM:") ) return false; - } + log.displayNL("Invalid banner priviledge"); + return false; } const CStaticItem *form = CSheets::getForm (sheet); @@ -1472,17 +1538,11 @@ NLMISC_COMMAND (createItemInTmpInv, "Create an item and put it in the player tem } // banners are the only items in game which use privilege - if( sheetName.find("banner") != string::npos ) + bool ok = checkBannerPriv(sheetName, eid); + if ( ! ok) { - CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) ); - if (player != NULL && player->havePriv(BannerPriv) ) - { - if( sheetName.find("_gu") != string::npos && !player->havePriv(":G:") ) return false; - if( sheetName.find("_sgu") != string::npos && !player->havePriv(":SG:") ) return false; - if( sheetName.find("_vgu") != string::npos && !player->havePriv(":VG:") ) return false; - if( sheetName.find("_gm") != string::npos && !player->havePriv(":GM:") ) return false; - if( sheetName.find("_sgm") != string::npos && !player->havePriv(":SGM:") ) return false; - } + log.displayNL("Invalid banner priviledge"); + return false; } const CStaticItem *form = CSheets::getForm (sheet); @@ -1545,17 +1605,11 @@ NLMISC_COMMAND (createItemInInv, "Create items and put them in the given invento } // banners are the only items in game which use privilege - if( sheetName.find("banner") != string::npos ) + bool ok = checkBannerPriv(sheetName, eid); + if ( ! ok) { - CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) ); - if (player != NULL && player->havePriv(BannerPriv) ) - { - if( sheetName.find("_gu") != string::npos && !player->havePriv(":G:") ) return false; - if( sheetName.find("_sgu") != string::npos && !player->havePriv(":SG:") ) return false; - if( sheetName.find("_vgu") != string::npos && !player->havePriv(":VG:") ) return false; - if( sheetName.find("_gm") != string::npos && !player->havePriv(":GM:") ) return false; - if( sheetName.find("_sgm") != string::npos && !player->havePriv(":SGM:") ) return false; - } + log.displayNL("Invalid banner priviledge"); + return false; } const CStaticItem *form = CSheets::getForm (sheet); @@ -4629,7 +4683,7 @@ CInventoryPtr getInv(CCharacter *c, const string &inv) return inventoryPtr; } -NLMISC_COMMAND (webExecCommand, "Execute a web command", " [] [] []") +NLMISC_COMMAND (webExecCommand, "Execute a web command", " [] [] []") { if (args.size() < 5) @@ -5516,7 +5570,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " args2; - if (args.size() == 3 && args[3] != "0") + if (args.size() == 3 && args[2] != "0") { // Do the whole group args2.push_back(args[0]); diff --git a/code/ryzom/server/src/entities_game_service/building_manager/room_instance.cpp b/code/ryzom/server/src/entities_game_service/building_manager/room_instance.cpp index 6cebd81fe..518b30a23 100644 --- a/code/ryzom/server/src/entities_game_service/building_manager/room_instance.cpp +++ b/code/ryzom/server/src/entities_game_service/building_manager/room_instance.cpp @@ -91,6 +91,8 @@ void CRoomInstanceGuild::removeUser( CCharacter* user ) return; } + user->sendUrl("app_ryzhome action=quit_guild_room&room_name="+guildBuilding->getName(), ""); + --_RefCount; if ( _RefCount == 0 ) { @@ -104,9 +106,14 @@ void CRoomInstanceGuild::addUser( CCharacter* user, CCharacter* owner ) { BOMB_IF( !user, " null character!", return ); + CBuildingPhysicalGuild * guildBuilding = dynamic_cast( _Building ); + BOMB_IF( !guildBuilding, " building type does not match with room type", return ); + // open guild inventory window PlayerManager.sendImpulseToClient(user->getId(), "GUILD:OPEN_INVENTORY"); + user->sendUrl("app_ryzhome action=open_guild_room&owner="+ owner->getName().toString()+"&room_name="+guildBuilding->getName(), ""); + ++_RefCount; } @@ -141,21 +148,8 @@ void CRoomInstancePlayer::removeUser( CCharacter* user ) return; } - TVectorParamCheck titleParams; - TVectorParamCheck textParams; - uint32 userId = PlayerManager.getPlayerId( user->getId() ); - std::string name = "CLOSE_URL"; - //send command to close webig - ucstring phrase = ucstring("CLOSE_URL(){[WEB : app_ryzhome action=quit_room]}"); - NLNET::CMessage msgout("SET_PHRASE"); - msgout.serial(name); - msgout.serial(phrase); - sendMessageViaMirror("IOS", msgout); - - uint32 titleId = STRING_MANAGER::sendStringToUser(userId, "web_transactions", titleParams); - uint32 textId = STRING_MANAGER::sendStringToUser(userId, "CLOSE_URL", textParams); - PlayerManager.sendImpulseToClient(user->getId(), "USER:POPUP", titleId, textId); - + user->sendUrl("app_ryzhome action=quit_player_room&room_name="+playerBuilding->getName(), ""); + --_RefCount; if ( _RefCount == 0 ) { @@ -170,6 +164,9 @@ void CRoomInstancePlayer::addUser( CCharacter* user, CCharacter* owner ) { BOMB_IF( !user, " null character!", return ); + CBuildingPhysicalPlayer * playerBuilding = dynamic_cast( _Building ); + BOMB_IF( !playerBuilding, " building type does not match with room type", return ); + // open room inventory window PlayerManager.sendImpulseToClient(user->getId(), "ITEM:OPEN_ROOM_INVENTORY"); if (owner) @@ -182,23 +179,7 @@ void CRoomInstancePlayer::addUser( CCharacter* user, CCharacter* owner ) // Very rare case owner = user; } - // solve bot names for title and text - TVectorParamCheck titleParams; - TVectorParamCheck textParams; - // send the popup message - uint32 userId = PlayerManager.getPlayerId( user->getId() ); - - std::string name = "RYZHOME_URL"; - ucstring phrase = "RYZHOME_URL(){[WEB : app_ryzhome user=" + owner->getName().toString() + "]}"; - NLNET::CMessage msgout("SET_PHRASE"); - msgout.serial(name); - msgout.serial(phrase); - sendMessageViaMirror("IOS", msgout); - - uint32 titleId = STRING_MANAGER::sendStringToUser(userId, "web_transactions", titleParams); - uint32 textId = STRING_MANAGER::sendStringToUser(userId, "RYZHOME_URL", textParams); - PlayerManager.sendImpulseToClient(user->getId(), "USER:POPUP", titleId, textId); - + user->sendUrl("app_ryzhome action=open_player_room&owner="+ owner->getName().toString()+"&room_name="+playerBuilding->getName(), ""); ++_RefCount; } diff --git a/code/ryzom/server/src/entities_game_service/dyn_chat_egs.cpp b/code/ryzom/server/src/entities_game_service/dyn_chat_egs.cpp index a665c6eb5..90d41820f 100644 --- a/code/ryzom/server/src/entities_game_service/dyn_chat_egs.cpp +++ b/code/ryzom/server/src/entities_game_service/dyn_chat_egs.cpp @@ -50,14 +50,14 @@ void CDynChatEGS::init() { { "DYN_CHAT:ADD_SERVICE_CHAN", CDynChatEGS::cbServiceAddChan }, { "DYN_CHAT:SET_HIDE_BUBBLE", CDynChatEGS::cbServiceSetHideBubble }, + { "DYN_CHAT:SET_UNIVERSAL_CHANNEL", CDynChatEGS::cbServiceSetUniversalChannel}, { "DYN_CHAT:SET_CHAN_HISTORY", CDynChatEGS::cbServiceSetChanHistory }, { "DYN_CHAT:REMOVE_SERVICE_CHAN", CDynChatEGS::cbServiceRemoveChan }, { "DYN_CHAT:ADD_CLIENT", CDynChatEGS::cbServiceAddClient }, { "DYN_CHAT:ADD_SESSION", CDynChatEGS::cbServiceAddSession }, { "DYN_CHAT:ADD_SESSION_ENTITY", CDynChatEGS::cbServiceAddSessionEntity }, { "DYN_CHAT:REMOVE_SESSION", CDynChatEGS::cbServiceRemoveSession }, - { "DYN_CHAT:REMOVE_SESSION_ENTITY", CDynChatEGS::cbServiceRemoveSessionEntity } - + { "DYN_CHAT:REMOVE_SESSION_ENTITY", CDynChatEGS::cbServiceRemoveSessionEntity} }; CUnifiedNetwork::getInstance()->addCallbackArray( _cbArray, sizeof(_cbArray) / sizeof(_cbArray[0]) ); @@ -315,7 +315,16 @@ bool CDynChatEGS::setHideBubble(TChanID chanID, bool hideBubble) return true; } - +//============================================================================================================ +bool CDynChatEGS::setUniversalChannel(TChanID chanID, bool universalChannel) +{ + CDynChatChan *chan = _DynChat.getChan(chanID); + if (!chan) return false; + if (universalChannel == chan->UniversalChannel) return true; // already good value + chan->UniversalChannel = universalChannel; + iosSetUniversalChannel(chanID, universalChannel); + return true; +} //============================================================================================================ void CDynChatEGS::cbServiceAddChan(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId) @@ -344,6 +353,16 @@ void CDynChatEGS::cbServiceSetHideBubble(NLNET::CMessage& msgin, const std::stri DynChatEGS.setHideBubble(chan, hideBubble); } //============================================================================================================ +void CDynChatEGS::cbServiceSetUniversalChannel(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId) +{ + TChanID chan; + bool universalChannel; + + msgin.serial(chan); + msgin.serial(universalChannel); + DynChatEGS.setUniversalChannel(chan, universalChannel); +} +//============================================================================================================ void CDynChatEGS::cbServiceAddClient(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId) { TDataSetRow dsr; @@ -484,6 +503,15 @@ void CDynChatEGS::iosSetHideBubble(TChanID chan, bool hideBubble) sendMessageViaMirror( "IOS", msg); } +//============================================================================================================ +void CDynChatEGS::iosSetUniversalChannel(TChanID chan, bool universalChannel) +{ + CMessage msg("DYN_CHAT:SET_UNIVERSAL_CHANNEL"); + msg.serial(chan); + msg.serial(universalChannel); + sendMessageViaMirror( "IOS", msg); +} + //============================================================================================================ void CDynChatEGS::iosRemoveSession(TChanID chan, const TDataSetRow &client) { diff --git a/code/ryzom/server/src/entities_game_service/dyn_chat_egs.h b/code/ryzom/server/src/entities_game_service/dyn_chat_egs.h index b24dd84ff..fb1ad9313 100644 --- a/code/ryzom/server/src/entities_game_service/dyn_chat_egs.h +++ b/code/ryzom/server/src/entities_game_service/dyn_chat_egs.h @@ -68,8 +68,14 @@ public: * \return true if success */ bool setHideBubble(TChanID chan, bool hideBubble); + + /** Change sessions in channel 'chan' so that chat is treated like universe channel + * \return true if success + */ + bool setUniversalChannel(TChanID chan, bool universalChannel); + /** Stop session in channel 'chan' for the client 'client'. - * \return true if success + * \return true if success */ bool removeSession(TChanID chan, const TDataSetRow &client); // Set 'write right' flag for a session. @@ -92,6 +98,8 @@ public: static void cbServiceAddChan(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId); /// Message from a service that need to hide bubbble of player/npc speaking in that channel static void cbServiceSetHideBubble(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId); + /// Message from a service that need to set channel to be like universe channel + static void cbServiceSetUniversalChannel(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId); /// Message from a service: remove a channel. static void cbServiceRemoveChan(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId); /// Message from a service : set the channel history @@ -116,7 +124,8 @@ private: private: // ios msg void iosAddChan(TChanID chan, bool noBroadcast, bool forwardPlayerInputs, bool unify); - void iosSetHideBubble(TChanID chan, bool hiddeBubble); + void iosSetHideBubble(TChanID chan, bool hideBubble); + void iosSetUniversalChannel(TChanID chan, bool universalChannel); void iosRemoveChan(TChanID chan); void iosAddSession(TChanID chan, const TDataSetRow &client, bool readOnly); void iosRemoveSession(TChanID chan, const TDataSetRow &client); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp index bf7f80b8c..bbf197d30 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp @@ -503,7 +503,7 @@ CCharacter::CCharacter(): CEntityBase(false), _TeamId= CTEAM::InvalidTeamId; ///init LeagueId - _LeagueId = TChanID::Unknown; + _LeagueId = DYN_CHAT_INVALID_CHAN; // init combat flags _CombatEventFlagTicks.resize(32); @@ -12494,10 +12494,15 @@ bool CCharacter::autoFillExchangeView() { invItem = playerBagInvPointer->getItem(inventoryIndex); if (invItem == NULL) - continue; + continue; + + if (invItem->getLockedByOwner()) + continue; + + if (invItem->getRefInventory() != NULL) + continue; itemsSeenCount++; - // Changed to support comparisons on sheetID masks if (invItem->getSheetId() == validateSteps[stepCounter].Sheet) { @@ -13670,9 +13675,13 @@ void CCharacter::sendUrl(const string &url, const string &salt) string control; if (!salt.empty()) { - string checksum = salt+url; control = "&hmac="+getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&salt[0], (uint32)salt.size()).toString(); } + else + { + string defaultSalt = toString(getLastConnectedDate()); + control = "&hmac="+getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&defaultSalt[0], (uint32)defaultSalt.size()).toString(); + } nlinfo(url.c_str()); TVectorParamCheck titleParams; diff --git a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp index 012877931..6beb7b1b2 100644 --- a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp +++ b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp @@ -210,6 +210,21 @@ std::vector CPVPManager2::getCharacterChannels(CCharacter * user) std::vector result; result.clear(); + // Add lang channel, should be first. + if (!user->getLangChannel().empty()) { + TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find(user->getLangChannel()); + if (it != _ExtraFactionChannel.end()) + { + result.push_back((*it).second); + } + } else { + TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("en"); + if (it != _ExtraFactionChannel.end()) + { + result.push_back((*it).second); + } + } + PVP_CLAN::TPVPClan faction = user->getAllegiance().first; if( faction != PVP_CLAN::Neutral ) { @@ -230,21 +245,6 @@ std::vector CPVPManager2::getCharacterChannels(CCharacter * user) } } - // Add lang channel - if (!user->getLangChannel().empty()) { - TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find(user->getLangChannel()); - if (it != _ExtraFactionChannel.end()) - { - result.push_back((*it).second); - } - } else { - TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("en"); - if (it != _ExtraFactionChannel.end()) - { - result.push_back((*it).second); - } - } - /* bool matis = CFameInterface::getInstance().getFameIndexed(user->getId(), 0) >= PVPFameRequired*6000; bool fyros = CFameInterface::getInstance().getFameIndexed(user->getId(), 1) >= PVPFameRequired*6000; @@ -1112,11 +1112,11 @@ void CPVPManager2::onIOSMirrorUp() */ // Community Channels - createExtraFactionChannel("en"); - createExtraFactionChannel("fr"); - createExtraFactionChannel("de"); - createExtraFactionChannel("ru"); - createExtraFactionChannel("es"); + createExtraFactionChannel("en", true); + createExtraFactionChannel("fr", true); + createExtraFactionChannel("de", true); + createExtraFactionChannel("ru", true); + createExtraFactionChannel("es", true); for (uint i = PVP_CLAN::BeginClans; i <= PVP_CLAN::EndClans; i++) { @@ -1161,7 +1161,7 @@ void CPVPManager2::createFactionChannel(PVP_CLAN::TPVPClan clan) } } -void CPVPManager2::createExtraFactionChannel(const std::string & channelName) +void CPVPManager2::createExtraFactionChannel(const std::string & channelName, bool universalChannel) { TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find(channelName); @@ -1171,6 +1171,7 @@ void CPVPManager2::createExtraFactionChannel(const std::string & channelName) TChanID factionChannelId = DynChatEGS.addLocalizedChan(name); // set historic size of the newly created channel DynChatEGS.setHistoricSize( factionChannelId, FactionChannelHistoricSize ); + DynChatEGS.setUniversalChannel( factionChannelId, universalChannel ); _ExtraFactionChannel.insert( make_pair(channelName, factionChannelId) ); } diff --git a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.h b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.h index 1207b1a11..9d24f1fe6 100644 --- a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.h +++ b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.h @@ -150,7 +150,7 @@ public: // create a faction channel if not already exist void createFactionChannel(PVP_CLAN::TPVPClan clan); // create an extra faction channel if not already exist (for marauders, agnos, urasiens and hominits) - void createExtraFactionChannel(const std::string & channelName); + void createExtraFactionChannel(const std::string & channelName, bool universalChannel = false); // create an user channel if not already exist TChanID createUserChannel(const std::string & channelName, const std::string & pass); // remove a user channel diff --git a/code/ryzom/server/src/frontend_service/entity_container.h b/code/ryzom/server/src/frontend_service/entity_container.h index d07cdbc76..75ae8250d 100644 --- a/code/ryzom/server/src/frontend_service/entity_container.h +++ b/code/ryzom/server/src/frontend_service/entity_container.h @@ -25,6 +25,7 @@ #include "game_share/tick_event_handler.h" #include "game_share/ryzom_mirror_properties.h" #include "client_id_lookup.h" +#include "fe_types.h" #include #include diff --git a/code/ryzom/server/src/frontend_service/frontend_service.h b/code/ryzom/server/src/frontend_service/frontend_service.h index 301e34506..12fa4df5c 100644 --- a/code/ryzom/server/src/frontend_service/frontend_service.h +++ b/code/ryzom/server/src/frontend_service/frontend_service.h @@ -33,6 +33,7 @@ #include "fe_receive_sub.h" #include "fe_send_sub.h" +#include "fe_types.h" #include "history.h" #include "prio_sub.h" #include "client_id_lookup.h" diff --git a/code/ryzom/server/src/frontend_service/id_impulsions.h b/code/ryzom/server/src/frontend_service/id_impulsions.h index 449a1da2c..e4cd1b407 100644 --- a/code/ryzom/server/src/frontend_service/id_impulsions.h +++ b/code/ryzom/server/src/frontend_service/id_impulsions.h @@ -19,6 +19,7 @@ #ifndef ID_IMPULSIONS_H #define ID_IMPULSIONS_H +#include "fe_types.h" // misc #include "nel/misc/types_nl.h" diff --git a/code/ryzom/server/src/frontend_service/stdpch.h b/code/ryzom/server/src/frontend_service/stdpch.h index dd904c1bc..7702d9717 100644 --- a/code/ryzom/server/src/frontend_service/stdpch.h +++ b/code/ryzom/server/src/frontend_service/stdpch.h @@ -67,7 +67,6 @@ #include "game_share/entity_types.h" -#include "fe_types.h" #ifndef NL_RELEASE #ifndef TRACE_SHARD_MESSAGES diff --git a/code/ryzom/server/src/pd_support_service/hourly_commands.cpp b/code/ryzom/server/src/pd_support_service/hourly_commands.cpp index 835bb8cb7..6f77396ae 100644 --- a/code/ryzom/server/src/pd_support_service/hourly_commands.cpp +++ b/code/ryzom/server/src/pd_support_service/hourly_commands.cpp @@ -46,7 +46,7 @@ public: } return; } - + // get the start time time_t startTime; time( &startTime ); @@ -73,7 +73,7 @@ public: // execute hourly tasks NLMISC::CConfigFile::CVar *commandsVar = NLNET::IService::getInstance()->ConfigFile.getVarPtr("HourlyCommands"); WARN_IF(commandsVar == NULL,"'HourlyCommands' not found in cfg file"); - + // if we have hourly commands... if (commandsVar!=NULL) { @@ -104,7 +104,7 @@ public: FILE* fileHandle= fopen(HourlyActivityLogFileName,"ab"); nlassert(fileHandle!=NULL); fprintf(fileHandle,"%02u/%02u/%u CHourlyTaskScheduler: Started: %02u:%02u, Finished: %02u:%02u, Executed %u commands Started %u Jobs\n", - ptm->tm_mday, ptm->tm_mon+1, ptm->tm_year+1900, startTime/3600%24, startTime/60%60, endTime/3600%24, endTime/60%60, commandsVar==NULL?0:commandsVar->size(), jobsRemaining ); + ptm->tm_mday, ptm->tm_mon+1, ptm->tm_year+1900, (uint)startTime/3600%24, (uint)startTime/60%60, (uint)endTime/3600%24, (uint)endTime/60%60, commandsVar==NULL?0:commandsVar->size(), jobsRemaining ); nlinfo("JobManager state: %s",CJobManager::getInstance()->getStatus().c_str()); fclose(fileHandle); } diff --git a/code/ryzom/server/src/server_share/char_name_mapper_itf.h b/code/ryzom/server/src/server_share/char_name_mapper_itf.h index b9d51c02f..e4abc7332 100644 --- a/code/ryzom/server/src/server_share/char_name_mapper_itf.h +++ b/code/ryzom/server/src/server_share/char_name_mapper_itf.h @@ -21,9 +21,7 @@ #ifndef CHAR_NAME_MAPPER_ITF #define CHAR_NAME_MAPPER_ITF #include "nel/misc/types_nl.h" -#ifdef NL_COMP_VC8 - #include -#endif +#include #include "nel/misc/hierarchical_timer.h" #include "nel/misc/string_conversion.h" #include "nel/net/message.h" diff --git a/code/ryzom/server/src/server_share/chat_unifier_itf.h b/code/ryzom/server/src/server_share/chat_unifier_itf.h index 2f5a62816..37f7b45b2 100644 --- a/code/ryzom/server/src/server_share/chat_unifier_itf.h +++ b/code/ryzom/server/src/server_share/chat_unifier_itf.h @@ -21,9 +21,7 @@ #ifndef CHAT_UNIFIER_ITF #define CHAT_UNIFIER_ITF #include "nel/misc/types_nl.h" -#ifdef NL_COMP_VC8 - #include -#endif +#include #include "nel/misc/hierarchical_timer.h" #include "nel/misc/string_conversion.h" #include "nel/net/message.h" diff --git a/code/ryzom/server/src/server_share/command_executor_itf.h b/code/ryzom/server/src/server_share/command_executor_itf.h index baa9a45ed..3c2feb606 100644 --- a/code/ryzom/server/src/server_share/command_executor_itf.h +++ b/code/ryzom/server/src/server_share/command_executor_itf.h @@ -21,9 +21,7 @@ #ifndef COMMAND_EXECUTOR_ITF #define COMMAND_EXECUTOR_ITF #include "nel/misc/types_nl.h" -#ifdef NL_COMP_VC8 - #include -#endif +#include #include "nel/misc/hierarchical_timer.h" #include "nel/misc/string_conversion.h" #include "nel/net/message.h" diff --git a/code/ryzom/server/src/server_share/entity_locator_itf.h b/code/ryzom/server/src/server_share/entity_locator_itf.h index c4d1ac8c9..a33e94e44 100644 --- a/code/ryzom/server/src/server_share/entity_locator_itf.h +++ b/code/ryzom/server/src/server_share/entity_locator_itf.h @@ -21,9 +21,7 @@ #ifndef ENTITY_LOCATOR_ITF #define ENTITY_LOCATOR_ITF #include "nel/misc/types_nl.h" -#ifdef NL_COMP_VC8 - #include -#endif +#include #include "nel/misc/hierarchical_timer.h" #include "nel/misc/string_conversion.h" #include "nel/net/message.h" diff --git a/code/ryzom/server/src/server_share/logger_service_itf.h b/code/ryzom/server/src/server_share/logger_service_itf.h index 01723f118..c6bda3f5c 100644 --- a/code/ryzom/server/src/server_share/logger_service_itf.h +++ b/code/ryzom/server/src/server_share/logger_service_itf.h @@ -21,9 +21,7 @@ #ifndef LOGGER_SERVICE_ITF #define LOGGER_SERVICE_ITF #include "nel/misc/types_nl.h" -#ifdef NL_COMP_VC8 - #include -#endif +#include #include "nel/misc/hierarchical_timer.h" #include "nel/misc/string_conversion.h" #include "nel/net/message.h" diff --git a/code/ryzom/tools/leveldesign/export/export.cpp b/code/ryzom/tools/leveldesign/export/export.cpp index 0380aad4d..b15e48a59 100644 --- a/code/ryzom/tools/leveldesign/export/export.cpp +++ b/code/ryzom/tools/leveldesign/export/export.cpp @@ -1793,7 +1793,6 @@ bool CExport::generateIGFromFlora (const std::string &SrcFile, std::vector -90000.0f) _FloraInsts.push_back (vi); - } // End of Generate for a point // Generate for a path @@ -2024,7 +2023,7 @@ void CExport::writeFloraIG (const string &LandFile, bool bTestForWriting) // Make the .IG - string ZoneName = ""; + string ZoneName; ZoneName += NLMISC::toString(-j) + "_"; ZoneName += 'a' + (i/26); ZoneName += 'a' + (i%26); diff --git a/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.cpp b/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.cpp index 8e565dd5e..aac663c1f 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.cpp @@ -52,7 +52,7 @@ bool CEditListCtrl::create (DWORD wStyle, RECT &rect, CWnd *parent, uint dialog_ subRect.top = 0; subRect.right = rect.right-rect.left; subRect.bottom = rect.bottom-rect.top; -#if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) +#if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 80 if (ListCtrl.CreateEx ( WS_EX_CLIENTEDGE, /*WC_LISTVIEW, "",*/ WS_CHILD|LVS_REPORT, subRect, this, 0)) #else if (ListCtrl.CreateEx ( WS_EX_CLIENTEDGE, WC_LISTVIEW, "", WS_CHILD|LVS_REPORT, subRect, this, 0)) diff --git a/code/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp b/code/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp index 9eb467b97..90b742860 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp @@ -54,7 +54,7 @@ bool CFileTreeCtrl::create( const RECT& rect, CWnd* pParentWnd, UINT nID ) if (CWnd::Create (className, "empty", WS_CHILD, rect, pParentWnd, nID )) -#if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) +#if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 80 if (_TreeCtrl.CreateEx (WS_EX_CLIENTEDGE, /*_T("SysTreeView32"), "",*/ TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_EDITLABELS|WS_CHILD|WS_TABSTOP, rect, this, 0)) #else if (_TreeCtrl.CreateEx (WS_EX_CLIENTEDGE, _T("SysTreeView32"), "", TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_EDITLABELS|WS_CHILD|WS_TABSTOP, rect, this, 0)) diff --git a/code/ryzom/tools/leveldesign/georges_dll/header_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/header_dialog.cpp index a69d481f4..6ecfe13fc 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/header_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/header_dialog.cpp @@ -263,7 +263,7 @@ void CHeaderDialog::getFromDocument (const NLGEORGES::CFileHeader &header) if (end) { // Build a string - int length = std::min (31, end-start); + int length = std::min (31, (int)(end-start)); memcpy (name, start, length); name[length] = 0; diff --git a/code/ryzom/tools/leveldesign/georges_dll/imagelist_ex.cpp b/code/ryzom/tools/leveldesign/georges_dll/imagelist_ex.cpp index 513abe109..195a44381 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/imagelist_ex.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/imagelist_ex.cpp @@ -27,8 +27,8 @@ using namespace NLMISC; #pragma warning (disable : 4786) -BOOL CALLBACK EnumResLangProc(HINSTANCE hModule, LPCTSTR lpszType, LPCTSTR lpszName, WORD wIDLanguage, - LONG lParam) +BOOL CALLBACK EnumResLangProc(HMODULE hModule, LPCSTR lpszType, LPCSTR lpszName, WORD wIDLanguage, + LONG_PTR lParam) { set *iconNames = (set*)lParam; diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/CMakeLists.txt b/code/ryzom/tools/leveldesign/georges_editor_qt/CMakeLists.txt index 3edbb69fb..96dc03d06 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/CMakeLists.txt +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/CMakeLists.txt @@ -6,12 +6,24 @@ #----------------------------------------------------------------------------- # This tells the application(s) where to find the installed data. -ADD_DEFINITIONS(-DDATA_DIR="\\"${RYZOM_SHARE_ABSOLUTE_PREFIX}/georges_editor_qt/\\"") +IF(WIN32) + SET(GEQT_DATA_DIR ".") +ELSEIF(APPLE) + # TODO: under Mac OS X, don't install but copy files in application package + SET(GEQT_DATA_DIR ".") +ELSE(WIN32) + SET(GEQT_DATA_DIR ${RYZOM_SHARE_PREFIX}/georges_editor_qt/data) + + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/geqt_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/geqt_config.h) + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) + + ADD_DEFINITIONS(-DHAVE_GEQT_CONFIG_H) +ENDIF(WIN32) ADD_SUBDIRECTORY(src) INSTALL(DIRECTORY data/ - DESTINATION ${RYZOM_SHARE_PREFIX}/georges_editor_qt/data + DESTINATION ${GEQT_DATA_DIR} COMPONENT data PATTERN "CVS" EXCLUDE PATTERN ".svn" EXCLUDE diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/geqt_config.h.cmake b/code/ryzom/tools/leveldesign/georges_editor_qt/geqt_config.h.cmake new file mode 100644 index 000000000..6f31bc7d0 --- /dev/null +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/geqt_config.h.cmake @@ -0,0 +1,6 @@ +#ifndef GEQT_CONFIG_H +#define GEQT_CONFIG_H + +#define DATA_DIR "${RYZOM_SHARE_ABSOLUTE_PREFIX}/georges_editor_qt" + +#endif diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/configuration.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/configuration.cpp index 5868220cd..6af950eae 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/configuration.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/configuration.cpp @@ -98,7 +98,7 @@ namespace NLQT { void CConfiguration::addLeveldesignPath() { std::vector list; - list.push_back(Modules::config().getValue("LeveldesignPath", QString("").toStdString())); + list.push_back(Modules::config().getValue("LeveldesignPath", std::string())); addSearchPaths(&list); } diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/formdelegate.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/formdelegate.cpp index a1e3e1d13..bb91f8b62 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/formdelegate.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/formdelegate.cpp @@ -96,7 +96,7 @@ namespace NLQT //QString min = QString(type->getMin().c_str()); //QString max = QString(type->getMax().c_str()); //QString inc = QString(type->getIncrement().c_str()); - //nldebug(QString("min %1 max %2 inc %3").arg(min).arg(max).arg(inc).toStdString().c_str()); + //nldebug(QString("min %1 max %2 inc %3").arg(min).arg(max).arg(inc).toUtf8().constData()); // TODO: use saved min/max values editor->setMinimum(-99999); @@ -203,7 +203,7 @@ namespace NLQT else { nldebug(QString("setModelData from %1 to %2") - .arg(oldValue).arg(value).toStdString().c_str()); + .arg(oldValue).arg(value).toUtf8().constData()); model->setData(index, value, Qt::EditRole); } } @@ -224,7 +224,7 @@ namespace NLQT else { nldebug(QString("setModelData from %1 to %2") - .arg(oldValue).arg(value).toStdString().c_str()); + .arg(oldValue).arg(value).toUtf8().constData()); model->setData(index, value, Qt::EditRole); } break; @@ -241,7 +241,7 @@ namespace NLQT else { nldebug(QString("setModelData from %1 to %2") - .arg(oldValue).arg(value).toStdString().c_str()); + .arg(oldValue).arg(value).toUtf8().constData()); model->setData(index, value, Qt::EditRole); } break; @@ -262,7 +262,7 @@ namespace NLQT else { nldebug(QString("setModelData from %1 to %2") - .arg(oldValue).arg(value).toStdString().c_str()); + .arg(oldValue).arg(value).toUtf8().constData()); model->setData(index, value, Qt::EditRole); } break; diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/formitem.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/formitem.cpp index 5dc0fe498..6636e944e 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/formitem.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/formitem.cpp @@ -120,10 +120,8 @@ namespace NLQT { if (elmt->isAtom()) { - ((NLGEORGES::CFormElmAtom*)elmt)->setValue(value.toString().toStdString().c_str()); - nldebug(QString("array element string %1 %2") - .arg(itemData[0].toString()).arg(value.toString()) - .toStdString().c_str()); + ((NLGEORGES::CFormElmAtom*)elmt)->setValue(value.toString().toUtf8().constData()); + nldebug("array element string %s %s", itemData[0].toString().toUtf8().constData(), value.toString().toUtf8().constData()); } } } @@ -131,18 +129,14 @@ namespace NLQT else { if(parentItem->formElm->setValueByName( - value.toString().toStdString().c_str(), - itemData[0].toString().toStdString().c_str())) + value.toString().toUtf8().constData(), + itemData[0].toString().toUtf8().constData())) { - nldebug(QString("string %1 %2") - .arg(itemData[0].toString()).arg(value.toString()) - .toStdString().c_str()); + nldebug("string %s %s", itemData[0].toString().toUtf8().constData(), value.toString().toUtf8().constData()); } else { - nldebug(QString("FAILED string %1 %2") - .arg(itemData[0].toString()).arg(value.toString()) - .toStdString().c_str()); + nldebug("FAILED string %s %s", itemData[0].toString().toUtf8().constData(), value.toString().toUtf8().constData()); } } break; diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp index cae202aa8..088170a6d 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp @@ -93,29 +93,29 @@ namespace NLQT CForm* CGeorgesTreeViewDialog::getFormByName(const QString formName) { - if(NLMISC::CPath::exists(formName.toStdString())) + if(NLMISC::CPath::exists(formName.toUtf8().constData())) { - return (CForm*)_georges->loadForm(formName.toStdString()); + return (CForm*)_georges->loadForm(formName.toUtf8().constData()); } else { CForm *form = 0; // Load the DFN - std::string extStr = NLMISC::CFile::getExtension( formName.toStdString() ); - QString dfnName = QString("%1.dfn").arg(extStr.c_str()); + std::string extStr = NLMISC::CFile::getExtension( formName.toUtf8().constData() ); + std::string dfnName = extStr + ".dfn"; UFormDfn *formdfn; - if (NLMISC::CPath::exists(dfnName.toStdString())) + if (NLMISC::CPath::exists(dfnName)) { - formdfn = _georges->loadFormDfn (dfnName.toStdString()); + formdfn = _georges->loadFormDfn (dfnName); if (!formdfn) { - nlwarning("Failed to load dfn: %s", dfnName.toStdString().c_str()); + nlwarning("Failed to load dfn: %s", dfnName.c_str()); return 0; } } else { - nlwarning("Cannot find dfn: %s", dfnName.toStdString().c_str()); + nlwarning("Cannot find dfn: %s", dfnName.c_str()); return 0; } @@ -175,7 +175,7 @@ namespace NLQT nlinfo("typ's %d",deps["typ"].count()); nlinfo("dfn's %d",deps["dfn"].count()); - //nlwarning(strList.join(";").toStdString().c_str()); + //nlwarning(strList.join(";").toUtf8().constData()); if (root) { loadedForm = _form->getFilename().c_str(); @@ -222,7 +222,7 @@ namespace NLQT { COFile file; - std::string s = CPath::lookup(loadedForm.toStdString(), false); + std::string s = CPath::lookup(loadedForm.toUtf8().constData(), false); if (file.open (s)) { try @@ -313,7 +313,7 @@ namespace NLQT CFormItem *item = m->getItem(in2); QString value = item->data(1).toString(); - QString path = CPath::lookup(value.toStdString(),false).c_str(); + QString path = CPath::lookup(value.toUtf8().constData(),false).c_str(); if(value.contains(".tga") || value.contains(".png")) { @@ -341,7 +341,7 @@ namespace NLQT { Modules::objViewInt()->resetScene(); //Modules::config().configRemapExtensions(); - Modules::objViewInt()->loadMesh(path.toStdString(),""); + Modules::objViewInt()->loadMesh(path.toUtf8().constData(),""); } return; } diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp index b16e0123c..89cba843c 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp @@ -140,13 +140,13 @@ namespace NLQT CFormItem *item = getItem(in); QString value = item->data(1).toString(); - //QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str(); + //QString path = NLMISC::CPath::lookup(value.toUtf8().constData(),false).c_str(); if (value.contains(".shape")) { if (Modules::objViewInt()) { - QIcon *icon = Modules::objViewInt()->saveOneImage(value.toStdString()); + QIcon *icon = Modules::objViewInt()->saveOneImage(value.toUtf8().constData()); if (icon) { if(icon->isNull()) @@ -162,7 +162,7 @@ namespace NLQT } else if(value.contains(".tga") || value.contains(".png")) { - QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str(); + QString path = NLMISC::CPath::lookup(value.toUtf8().constData(),false).c_str(); if(path.isEmpty()) { path = ":/images/pqrticles.png"; @@ -185,7 +185,7 @@ namespace NLQT { if (Modules::objViewInt()) { - QIcon *icon = Modules::objViewInt()->saveOneImage(value.toStdString()); + QIcon *icon = Modules::objViewInt()->saveOneImage(value.toUtf8().constData()); if (icon) { if(icon->isNull()) @@ -201,7 +201,7 @@ namespace NLQT } else if(value.contains(".tga") || value.contains(".png")) { - QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str(); + QString path = NLMISC::CPath::lookup(value.toUtf8().constData(),false).c_str(); if(path.isEmpty()) { path = ":/images/pqrticles.png"; @@ -380,7 +380,7 @@ namespace NLQT //uint value_uint; //sint value_sint; //double value_double; - QString elmtType = ""; + QString elmtType; UFormElm *elmt = 0; if(root->getNodeByName(&elmt, elmName.c_str(), whereN, true)) { @@ -401,13 +401,13 @@ namespace NLQT switch (type->getType()) { case UType::UnsignedInt: - value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toStdString(); + value = QString("%1").arg(QString(value.c_str()).toDouble()).toUtf8().constData(); elmtType.append("_uint");break; case UType::SignedInt: - value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toStdString(); + value = QString("%1").arg(QString(value.c_str()).toDouble()).toUtf8().constData(); elmtType.append("_sint");break; case UType::Double: - value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble(),0,'f',1).toStdString(); + value = QString("%1").arg(QString(value.c_str()).toDouble(),0,'f',1).toUtf8().constData(); elmtType.append("_double");break; case UType::String: elmtType.append("_string");break; @@ -542,7 +542,7 @@ namespace NLQT { QList columnData; std::string value; - QString elmtType = ""; + QString elmtType; UFormElm *elmt = 0; if(root->getArrayNode(&elmt,0) && elmt) diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_proxy_model.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_proxy_model.cpp index 0c4c5b7eb..46ee12567 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_proxy_model.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_proxy_model.cpp @@ -42,7 +42,7 @@ namespace NLQT CFormItem *item = smodel->getItem(index); //qDebug() << smodel->showParents() << (item->valueFrom() == NLGEORGES::UFormElm::NodeParentForm); - //nlinfo("%s %d %d %d %d", item->data(index.column()).toString().toStdString().c_str(), + //nlinfo("%s %d %d %d %d", item->data(index.column()).toString().toUtf8().constData(), // item->valueFrom(), // item->nodeFrom(), // smodel->showParents(), diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/main.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/main.cpp index ef8fadec0..3b0d606d3 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/main.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/main.cpp @@ -21,6 +21,10 @@ #include "modules.h" #include "georges_splash.h" +#ifdef HAVE_GEQT_CONFIG_H +#include "geqt_config.h" +#endif + // nel_qt log file name #define NLQT_LOG_FILE "nel_qt.log" @@ -96,7 +100,7 @@ sint main(int argc, char **argv) #if defined(NL_OS_MAC) QDir::setCurrent(qApp->applicationDirPath() + QString("/../Resources")); CLibrary::addLibPath( - (qApp->applicationDirPath() + QString("/../PlugIns/nel")).toStdString()); + (qApp->applicationDirPath() + QString("/../PlugIns/nel")).toUtf8().constData()); #endif // go nel! diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.cpp index 1e5959973..ef40f4dbc 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.cpp @@ -63,7 +63,7 @@ namespace NLQT // load and set leveldesign path from config _leveldesignPath = Modules::config(). - getValue("LeveldesignPath", QString("").toStdString()).c_str(); + getValue("LeveldesignPath", std::string()).c_str(); QFileInfo info(_leveldesignPath); if (!info.isDir()) _leveldesignPath = ""; @@ -229,7 +229,7 @@ namespace NLQT setCursor(Qt::WaitCursor); //TODO: if not exists open FileDialog SaveAs... - if(!CPath::exists(_currentView->loadedForm.toStdString())) + if(!CPath::exists(_currentView->loadedForm.toUtf8().constData())) { QString fileName = QFileDialog::getSaveFileName( this, @@ -239,7 +239,7 @@ namespace NLQT QFile file(fileName); file.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text); file.close(); - CPath::addSearchFile(fileName.toStdString()); + CPath::addSearchFile(fileName.toUtf8().constData()); //QFileInfo info = QFileInfo(file); //m->setData(in2, info.fileName()); } @@ -417,7 +417,7 @@ namespace NLQT //tabList = _mainWindow->findChildren(); //nlinfo(QString("%1 %2").arg(QString::number((int)this,16)). // arg(QString::number((int)_mainWindow,16)). - // toStdString().c_str()); + // toUtf8().constData()); QTabBar *tb = 0; Q_FOREACH(QTabBar *tabBar, tabList) { @@ -427,11 +427,11 @@ namespace NLQT // arg(QString::number((int)tabBar,16)). // arg(QString::number((int)tabBar->parentWidget(),16)). // arg(QString::number((int)tabBar->parent(),16)). - // toStdString().c_str()); + // toUtf8().constData()); for (int i = 0; i < tabBar->count(); i++) { QString currentTab = tabBar->tabText(i); - //nlinfo(currentTab.toStdString().c_str()); + //nlinfo(currentTab.toUtf8().constData()); } tb = tabBar; } @@ -440,7 +440,7 @@ namespace NLQT void CMainWindow::tabChanged(int index) { - nlinfo(QString("%1").arg(index).toStdString().c_str()); + nlinfo("%d", index); if (index == -1) { setWindowTitle("Qt Georges Editor"); @@ -448,7 +448,7 @@ namespace NLQT } QTabBar *tb = getTabBar(); - //nlinfo(QString("%1").arg(index).toStdString().c_str()); + //nlinfo(QString("%1").arg(index).toUtf8().constData()); Q_FOREACH(CGeorgesTreeViewDialog* dlg, _treeViewList) { @@ -456,7 +456,7 @@ namespace NLQT { //nlinfo(QString("%1 modified %2").arg(tb->tabText(index)). // arg(dlg->modified()). - // toStdString().c_str()); + // toUtf8().constData()); _currentView = dlg; setWindowTitle("Qt Georges Editor - " + tb->tabText(index)); _saveAction->setEnabled(dlg->modified()); diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/modules.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/modules.cpp index 59f596f51..e77e72772 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/modules.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/modules.cpp @@ -68,12 +68,12 @@ bool Modules::loadPlugin() // if(!QFile::exists(pluginPath + pluginFilename)) // { // nlwarning("Cannot find %s in %s, fallback to working dir", - // pluginFilename.toStdString().c_str(), pluginPath.toStdString().c_str()); + // pluginFilename.toUtf8().constData(), pluginPath.toUtf8().constData()); // // pluginPath = ""; // // Q_FOREACH (QString path, qApp->libraryPaths()) - // nlwarning("libraryPaths %s", path.toStdString().c_str()); + // nlwarning("libraryPaths %s", path.toUtf8().constData()); // } QDir pluginsDir(pluginPath); @@ -86,20 +86,20 @@ bool Modules::loadPlugin() if (_objViewerInterface) { nlinfo("Loaded %s", - pluginsDir.absoluteFilePath(pluginFilename).toStdString().c_str()); + pluginsDir.absoluteFilePath(pluginFilename).toUtf8().constData()); return true; } else { nlwarning("Loaded %s, but cannot cast to NLQT::IObjectViewer*", - pluginFilename.toStdString().c_str()); + pluginFilename.toUtf8().constData()); } } else { nlwarning("Cannot get plugin instance for %s (searched in %s)", - pluginFilename.toStdString().c_str(), - (qApp->applicationDirPath() + pluginPath).toStdString().c_str()); + pluginFilename.toUtf8().constData(), + (qApp->applicationDirPath() + pluginPath).toUtf8().constData()); } return false; diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/new_dialog.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/new_dialog.cpp index e3cbda962..499b06d94 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/new_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/new_dialog.cpp @@ -87,9 +87,9 @@ namespace NLQT QString path = Modules::mainWin().leveldesignPath(); QStringList typelist; //nlinfo ("Searching files in directory '%s'...", dir.c_str()); - NLMISC::CPath::getPathContent(path.toStdString(),true,false,true,_files); + NLMISC::CPath::getPathContent(path.toUtf8().constData(),true,false,true,_files); - getTypes( /* path.toStdString() // incompatible parameter type */ ); + getTypes( /* path.toUtf8() // incompatible parameter type */ ); //nlinfo ("%d supported file types :",FileTypeToId.size()); for ( std::map::iterator it = FileTypeToId.begin(); it != FileTypeToId.end(); ++it ) { @@ -103,8 +103,8 @@ namespace NLQT std::string extStr = NLMISC::CFile::getExtension( _files[i] ); // filter files without existing dfn - if (!NLMISC::CPath::exists(QString("%1.dfn").arg(extStr.c_str()).toStdString()) && - !NLMISC::CPath::exists(QString("%1.typ").arg(extStr.c_str()).toStdString())) + if (!NLMISC::CPath::exists(extStr + ".dfn") && + !NLMISC::CPath::exists(extStr + ".typ")) { continue; } @@ -253,7 +253,7 @@ namespace NLQT { std::string extStr = NLMISC::CFile::getExtension( fileName ); - if (!NLMISC::CPath::exists(QString("%1.dfn").arg(extStr.c_str()).toStdString())) + if (!NLMISC::CPath::exists(extStr + ".dfn")) { return; } diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/settings_dialog.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/settings_dialog.cpp index a005fdf5d..bb4fafd2e 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/settings_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/settings_dialog.cpp @@ -146,13 +146,13 @@ namespace NLQT QMessageBox::Ok);*/ // save graphics settings to config file - Modules::config().getConfigFile().getVar("GraphicsDriver").setAsString(ui.driverGraphComboBox->currentText().toStdString()); + Modules::config().getConfigFile().getVar("GraphicsDriver").setAsString(ui.driverGraphComboBox->currentText().toUtf8().constData()); // save leveldesign path to config file QString oldLdPath = Modules::config().getValue("LeveldesignPath", std::string("")).c_str(); if (oldLdPath != ui.leveldesignPath->text()) { - std::string ldPath = ui.leveldesignPath->text().toStdString(); + std::string ldPath = ui.leveldesignPath->text().toUtf8().constData(); Modules::config().getConfigFile().getVar("LeveldesignPath").forceAsString(ldPath); Q_EMIT ldPathChanged(ldPath.c_str()); // TODO: remove old Path from CPath @@ -171,8 +171,8 @@ namespace NLQT std::vector addList; for (sint i = 0; i < ui.pathsListWidget->count(); ++i) { - std::string str = ui.pathsListWidget->item(i)->text().toStdString(); - if (str != "") + std::string str = ui.pathsListWidget->item(i)->text().toUtf8().constData(); + if (!str.empty()) { list.push_back(str); if (!sl.contains(str.c_str())) diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_dialog.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_dialog.cpp index e1f6b317c..58ea1e9da 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_dialog.cpp @@ -186,7 +186,7 @@ void CSoundDialog::setPlaying(bool play) // *************************************************************************** -void CSoundDialog::OnTimer(UINT id) +void CSoundDialog::OnTimer(UINT_PTR id) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); updateTime(); diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_dialog.h b/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_dialog.h index 1b8c46e91..884c52423 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_dialog.h +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_dialog.h @@ -126,7 +126,7 @@ private: // Generated message map functions //{{AFX_MSG(CSoundDialog) - afx_msg void OnTimer(UINT id); + afx_msg void OnTimer(UINT_PTR id); afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnControlPlayback(); afx_msg void OnZoom(NMHDR* pNMHDR, LRESULT* pResult); diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp index 0e24b05e6..adcf6c680 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp @@ -282,7 +282,7 @@ public: string genCode(CMissionData &md) { - string ret = ""; + string ret; if (!_MissionName.empty()) { ret = "spawn_mission : " + _MissionName + " : " + _GiverName; @@ -1809,7 +1809,7 @@ string CContentObjective::genCode(CMissionData &md) // --------------------------------------------------------------------------- /*std::string CContentObjective::genNbGuildMembersNeededOption(CMissionData &md) { - string ret = ""; + string ret; // If we are in a guild mission we add the 'nb_guild_members_needed' option to the script if (md.isGuildMission()) { diff --git a/code/ryzom/tools/leveldesign/mp_generator/main.cpp b/code/ryzom/tools/leveldesign/mp_generator/main.cpp index 1b995fae2..7387e32d9 100644 --- a/code/ryzom/tools/leveldesign/mp_generator/main.cpp +++ b/code/ryzom/tools/leveldesign/mp_generator/main.cpp @@ -1455,7 +1455,7 @@ void GenerateDoc() AltDocs[c].write( "" + string(DataColStr[cc]) + "" ); AltDocs[c].write( "" ); string previousKey = "[NO PREVIOUS]"; // not a blank string, because it may be a valid value - string previousName = ""; + string previousName; for ( CRMData::CLookup::const_iterator isd=SortableData.lookup( c ).begin(); isd!=SortableData.lookup( c ).end(); ++isd ) { const TRMItem& item = SortableData.getRow( (*isd).second ); diff --git a/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp b/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp index 64e156909..1b0d6c078 100644 --- a/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp @@ -34,7 +34,7 @@ #include "nel/ligo/zone_region.h" #include "nel/ligo/zone_bank.h" -#include "nel/../../src/pacs/collision_mesh_build.h" +#include "nel/pacs/collision_mesh_build.h" #include "../../../leveldesign/export/tools.h" diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/file_dialog_ex.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/file_dialog_ex.cpp index 7bf850817..781e78005 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/file_dialog_ex.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/file_dialog_ex.cpp @@ -51,7 +51,7 @@ END_MESSAGE_MAP() // *************************************************************************** -int CFileDialogEx::DoModal () +INT_PTR CFileDialogEx::DoModal () { // Get the path char path[512]; diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/file_dialog_ex.h b/code/ryzom/tools/leveldesign/world_editor/world_editor/file_dialog_ex.h index f647b3add..ce367c906 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/file_dialog_ex.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/file_dialog_ex.h @@ -41,7 +41,7 @@ public: LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL); - virtual int DoModal( ); + virtual INT_PTR DoModal( ); virtual BOOL OnCommand( WPARAM wParam, LPARAM lParam ); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/imagelist_ex.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/imagelist_ex.cpp index 513abe109..195a44381 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/imagelist_ex.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/imagelist_ex.cpp @@ -27,8 +27,8 @@ using namespace NLMISC; #pragma warning (disable : 4786) -BOOL CALLBACK EnumResLangProc(HINSTANCE hModule, LPCTSTR lpszType, LPCTSTR lpszName, WORD wIDLanguage, - LONG lParam) +BOOL CALLBACK EnumResLangProc(HMODULE hModule, LPCSTR lpszType, LPCSTR lpszName, WORD wIDLanguage, + LONG_PTR lParam) { set *iconNames = (set*)lParam; diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp index df79db226..a70813f47 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp @@ -3304,7 +3304,7 @@ void CMainFrame::OnUpdateEditSelectChildren(CCmdUI* pCmdUI) // *************************************************************************** -void CMainFrame::OnTimer(UINT nIDEvent) +void CMainFrame::OnTimer(UINT_PTR nIDEvent) { if (nIDEvent == TIMER_UPDATE_FILES) { diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.h b/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.h index 5c2173186..7883c2dea 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.h @@ -470,7 +470,7 @@ public: afx_msg void OnUpdateEditCollapse(CCmdUI* pCmdUI); afx_msg void OnEditSelectChildren(); afx_msg void OnUpdateEditSelectChildren(CCmdUI* pCmdUI); - afx_msg void OnTimer(UINT nIDEvent); + afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg void OnEditExpand (); afx_msg void OnEditCollapse (); afx_msg void OnHelpFinder(); diff --git a/code/ryzom/tools/pd_parser/parse_node.h b/code/ryzom/tools/pd_parser/parse_node.h index b1c43fa4a..ad2b6a8f2 100644 --- a/code/ryzom/tools/pd_parser/parse_node.h +++ b/code/ryzom/tools/pd_parser/parse_node.h @@ -870,7 +870,7 @@ public: std::string getIndexName(uint32 value) const { - std::string result = ""; + std::string result; uint i; for (i=0; iName; return res; @@ -1078,7 +1078,7 @@ public: std::string getDebugCallStringFmt() { uint i, idx=0; - std::string res = ""; + std::string res; for (i=0; i. + */ + +$tick_cache_timeout = 60; + +function ryzom_time_tick() { + $fn = RYAPI_URL.'data/cache/game_cycle.ticks'; + $handle = fopen($fn, "r"); + $version = fread($handle, 1); + $raw_tick = fread($handle, 4); + fclose($handle); + $arr = unpack("V", $raw_tick); + $tick = $arr[1]; + return sprintf("%u", $tick & 0xffffffff); +} + + +/** + * Takes a computed ryzom time array and returns a SimpleXMLElement + */ +function ryzom_time_xml($rytime) { + global $tick_cache_timeout; + $out = ryzom_time_xml_without_cache($rytime); + $filename = RYAPI_URL.'data/cache/game_cycle.ticks'; + $cache = $out->addChild('cache'); + $cache->addAttribute('created', filemtime($filename)); + $cache->addAttribute('expire', (filemtime($filename)+$tick_cache_timeout)); + return $out; +} + +?> \ No newline at end of file diff --git a/code/web/api/common/actionPage.php b/code/web/api/common/actionPage.php new file mode 100644 index 000000000..735a33f32 --- /dev/null +++ b/code/web/api/common/actionPage.php @@ -0,0 +1,161 @@ +. + */ + +class ryActionClass { + public $classname; + public $instance; + public $args; + public $requires; + + function __construct($classname, $instance, $args, $requires) { + $this->classname = $classname; + $this->instance = $instance; + $this->args = $args; + $this->requires = $requires; + } + +} + +class ryActionPage { + + private static $classesArgs = array(); + private static $myClasses = array(); + private static $aliases = array(); + private static $messages; + private static $haveMessage; + protected static $id; + + public $instanceName; + public $myMethods = array(); + + function __construct() { + } + + function addMethods($child_class) { + if (is_array($child_class)) { + foreach ($child_class as $c_class) + $this->myMethods = array_merge($this->myMethods, get_class_methods($c_class)); + } else { + $this->myMethods = get_class_methods($child_class); + } + } + + static function addClass($name, $classname, $args=array(), $requires=NULL) { + self::$myClasses[$name] = new ryActionClass($classname, NULL, $args, $requires); + } + + static function addAlias($aliasname, $name) { + self::$aliases[$aliasname] = $name; + } + + static function initInstance($listener) { + $i = self::$myClasses[$listener]; + if (!$i->instance) { + // requires + if ($i->requires) { + self::initInstance($i->requires); + } + if ($i->args) + $i->instance = new $i->classname($listener, $i->args); + else + $i->instance = new $i->classname($listener); + $i->instance->addMethods($i->classname); + $i->instance->instanceName = $listener; + + } + return $i->instance; + } + + static function getInstance($listener) { + return self::initInstance($listener); + } + + static function _addMSG($type='OK', $message='') { + self::$messages[] = array($type, $message); + return ''; + } + + function addMSG($type='OK', $action='', $message='') { + self::$messages[] = array($type, $message); + $this->haveMessage = $action; + return ''; + } + + static function getMSGs() { + return self::$messages; + } + + static function call($action, $url_params) { + $action_params = explode('_', $action); + + if (count($action_params) != 2) + return self::_addMSG('ERR', 'Action call error : bad params of ['.$action.']'); + + list($listener, $call) = $action_params; + if (array_key_exists($listener,self::$aliases)) + $listener = self::$aliases[$listener]; + + if (!array_key_exists($listener, self::$myClasses)) + return self::_addMSG('ERR', 'Action call error : class ['. $listener .'] not found'); + + $i = self::initInstance($listener); + + if (in_array('action'.$call, $i->myMethods)) { + $i->haveMessage = NULL; + $ret = call_user_func(array($i, 'action'.$call), $url_params); + if (!isset($_SESSION['last_action']) or $action != $_SESSION['last_action']) + $_SESSION['last_action'] = $action; + $msg = $i->haveMessage; + if ($msg and ($msg != $action)) { + $ret = self::call($msg, $url_params); + return self::_addMSG('OK', $ret); + } + return self::_addMSG('OK', $ret); + } else + return self::_addMSG('ERR', 'Action call error : action ['. $call .'] of ['. $listener .'] not found'); + } +} + +function callAction($action) { + $c = ''; + ryActionPage::call($action, ryzom_get_params()); + $msgs = ryActionPage::getMSGs(); + + foreach ($msgs as $msg) { + if ($msg[0] == 'HEADER') + $c .= $msg[1]; + } + + foreach ($msgs as $msg) { + if ($msg[0] == 'ERR') + $c .= _s('message error', $msg[1]); + else if ($msg[0] == 'MSG') + $c .= _s('message', $msg[1]); + else if ($msg[0] == 'WARNING') + $c .= _s('message warning', $msg[1]); + else if ($msg[0] != 'HEADER') + $c .= $msg[1]; + } + return $c; +} + + + + +?> diff --git a/code/web/api/common/auth.php b/code/web/api/common/auth.php index 1d52c5d8e..3f06d28d5 100644 --- a/code/web/api/common/auth.php +++ b/code/web/api/common/auth.php @@ -1,37 +1,94 @@ . + */ + + +function ryzom_app_authenticate(&$user, $ask_login=true, $welcome_message='', $webprivs=true) { $name = ryzom_get_param('name'); - $authserver = ryzom_get_param('authserver'); - $authkey = ryzom_get_param('authkey'); + $urluser = ryzom_get_param('user'); // user serialization send by auth server + $urlusercheksum = ryzom_get_param('checksum'); // user serialization checksum + $authkey = ryzom_get_param('authkey'); // InGame authkey $lang = ryzom_get_param('lang'); - $cid = ryzom_get_param('cid', ''); - $is_ingame = false; + $cid = intval(ryzom_get_param('cid')); + $is_auth_ingame = false; // we have to set the $user['lang'] even for anonymous user or we cannot display the test in the right langage if($lang == '') { - $l = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); - if($l=='fr'||$l=='en'||$l=='de'||$l=='ru'||$l=='es') + $l = isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])?substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2):'en'; + if ($l=='fr'||$l=='en'||$l=='de'||$l=='ru'||$l=='es') $lang = $l; else $lang = 'en'; } + if ($lang!='fr'&&$lang!='en'&&$lang!='de'&&$lang!='ru'&&$lang!='es') + $lang = 'en'; + $user['message'] = ''; $user['lang'] = $lang; - $user['ig'] = false; - - if ((isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Ryzom')) || ryzom_get_param('ig')) { + $user['groups'] = array(); + + if ((isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Ryzom')) || ryzom_get_param('ig')) $user['ig'] = true; + else + $user['ig'] = false; + + if (isset($_SESSION['user'])) { + if (ryzom_get_param('action') == 'logout') + unset($_SESSION['user']); + else { + $_SESSION['user']['ig'] = $user['ig']; + define('RYZOM_IG', $user['ig']); + $user = $_SESSION['user']; + return true; + } + } + + if ($urluser && $urlusercheksum) { + // Check $authuser (used to test app from another server ingame) + if (hash_hmac('sha1', $urluser, RYAPI_AUTH_KEY) == $urlusercheksum) { + $ig = $user['ig']; + $user = array_merge($user, unserialize(base64_decode($urluser))); + $user['ig'] = $ig; + if (!isset($user['groups'])) + $user['groups'] = array(); + define('RYZOM_IG', $user['ig']); + $_SESSION['user'] = $user; + return true; + } + } + + if ($user['ig']) { // Ingame $shardid = ryzom_get_param('shardid'); - if (!ryzom_authenticate_ingame($shardid, $cid, $name, $authkey)) - return false; - $is_ingame = true; + $error_message = ''; + if (ryzom_authenticate_ingame($shardid, $cid, $name, $authkey) || ryzom_authenticate_with_session($name, $cid, $error_message)) { + $is_auth_ingame = true; + } } else { - // Outgame : Use session + // Outgame or bad ingame auth (external server) : Use session $error_message = ''; if (!ryzom_authenticate_with_session($name, $cid, $error_message)) { + define('RYZOM_IG', false); if ($ask_login) { - $c = ''; + + if ($error_message) + $c = '

'._t($error_message).'

'; + else + $c = ''; if (!$welcome_message) $welcome_message = 'The application '._t(APP_NAME).' require authentication. Please enter your credentials'; @@ -47,18 +104,40 @@ function ryzom_app_authenticate(&$user, $ask_login=true, $welcome_message='') { } } - if ($lang) - $_SESSION['lang'] = $lang; + $_SESSION['lang'] = $lang; + define('RYZOM_IG', $user['ig']); // get user informations - $user = ryzom_user_get_info($cid); - $user['lang'] = $_SESSION['lang']; + $ig = $user['ig']; + $user = ryzom_user_get_info($cid, $webprivs); + if (isset($user['creation_date'])) - $user['id'] = ryzom_get_user_id($cid, $user['char_name'], $user['creation_date']); - if ($is_ingame && $user['last_played_date'] != '0') - $user['ig'] = true; + $user['id'] = ryzom_get_user_id($cid, $user['char_name'], $user['creation_date'], $user); + + $user['ig'] = $ig; + $user['lang'] = $_SESSION['lang']; + if (!isset($user['groups'])) + $user['groups'] = array(); + + if ($is_auth_ingame && $user['last_played_date'] != '0') + $user['auth_ig'] = true; else - $user['ig'] = false; + $user['auth_ig'] = false; + + if (!isset($_SESSION['translater_mode']) || ryzom_get_param('translate_this') == '0') + $_SESSION['translater_mode'] = false; + + // Set/unset translation mode + if (in_array('WTRS', $user['groups']) && ryzom_get_param('translate_this') == '1') + $_SESSION['translater_mode'] = true; + + $user['translation_mode'] = $_SESSION['translater_mode']; + + ryzom_unset_url_param('translate_this'); + + if (isset($user['last_played_date'])) + $_SESSION['last_played_date'] = $user['last_played_date']; + // don't send this informations to external apps unset($user['last_played_date']); unset($user['creation_date']); return true; diff --git a/code/web/api/common/bbCode.php b/code/web/api/common/bbCode.php new file mode 100644 index 000000000..e45dfadb9 --- /dev/null +++ b/code/web/api/common/bbCode.php @@ -0,0 +1,988 @@ +. + */ + +// setup bbCode formatter + +bbCode::$ig = RYZOM_IG; + +/** + * Image proxy + */ +if(!defined('IMG_PROXY')){ + $url = 'http://'.$_SERVER['HTTP_HOST'].'/app_forum/tools/imageproxy.php'; + define('IMG_PROXY', $url); +} +if (!function_exists('proxy_image_url')) { + function proxy_image_url($href, $attrs=''){ + return IMG_PROXY.'?'.($attrs != '' ? $attrs.'&' : '').'url='.urlencode($href); + } +} + + +abstract class bbCodeParser { + + /** + * @var bool + */ + private $_ig; + + /** + * @var array + */ + private $tags_ignore; + private $tags_block_open; + private $tags_block_close; + private $tags_ignore_depth; + + /** + * @var array + */ + private $open_tags; + + /** + * @var string + */ + private $last_closed_tag; + + /** + * @var int + */ + private $current_tag; + + /** + * @var array + */ + private $state; + + /** + * @param bool $ig if true, use ingame markup + */ + function __construct($ig) { + $this->_ig = $ig; + + // ignore bbcode between these tags + $this->tags_ignore = array( + 'noparse', 'code', + 'url', 'img', 'mail', 'page', 'forum', 'topic', 'post', 'wiki', 'time', 'date' + ); + + // these create block level html code, so '\n' or ' ' or '\t' around them needs to be cleared + $this->tags_block_open = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'quote', 'list', 'p'); + $this->tags_block_close = $this->tags_block_open; + if ($this->_ig) { + // ingame

is not block level when closing, so dont strip there + $key = array_search('p', $this->tags_block_close, true); + unset($this->tags_block_close[$key]); + } + + $this->state = array(); + + // reset internals + $this->reset(); + } + + /** + * Format bbcode tag + * + * @param string $tag tag name + * @param string $open open markup + * @param string $close close markup + * @param string $attr tag attributes + * @param string $text text between tags + */ + abstract function format($tag, $open, $close, $attr, $text); + + /** + * Wrapper to call Child->format(...) + * + * @param array $tag assoc array with tag info + * @return string + */ + function handle_tag($tag) { + return $this->format($tag['tag'], $tag['open'], $tag['close'], $tag['attr'], $tag['text']); + } + + /** + * Reset internals + */ + function reset() { + $this->current_tag = 0; + $this->tags_ignore_depth = 0; + + // 0'th position is used as result + $this->open_tags = array( + 0 => array('tag' => '', 'open' => '', 'close' => '', 'attr' => '', 'text' => '') + ); + + $this->last_closed_tag = false; + } + + /** + * Save working state + */ + private function _state_save() { + $this->state[] = array($this->current_tag, $this->tags_ignore_depth, $this->open_tags, $this->last_closed_tag); + $this->reset(); + } + + /** + * Restore working state + */ + private function _state_restore() { + if (!empty($this->state)) { + list($this->current_tag, $this->tags_ignore_depth, $this->open_tags, $this->last_closed_tag) = array_pop($this->state); + } + } + + /** + * Main worker. Parse $text for bbCode tags + * + * NOTE: Text must already be safe for HTML, ie. treated with htmlspecialchars() + * + * @param string $text + * @return string formatted string + */ + function bbcode($text) { + $text = str_replace("\r\n", "\n", $text); + + $split = preg_split('/(\[[a-zA-Z0-9_\/]*?(?:[= ].*?)?\])/', $text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + + foreach ($split as $chunk) { + if (substr($chunk, 0, 1) == '[' && substr($chunk, -1, 1) == ']') { + if (substr($chunk, 0, 2) == '[/') { + $this->close($chunk); + } else { + $this->open($chunk); + } + } else { + $this->text($chunk); + } + } + + return $this->result(); + } + + /** + * Push tag with args to stack + * Do not strip whitespace because tag might be invalid + * + * @param string $chunk full tag string, eg. [tag=attr] + */ + function open($chunk) { + list($tag, $attr) = $this->split_params($chunk); + + // test for [noparse] + if ($this->tags_ignore_depth > 0) { + $this->text($chunk); + } else { + $this->current_tag++; + // remember tag, attributes and complete string that was used in markup + $this->open_tags[$this->current_tag] = array('tag' => $tag, 'attr' => $attr, 'open' => $chunk, 'close' => '', 'text' => ''); + } + + if (in_array($tag, $this->tags_ignore)) { + $this->tags_ignore_depth++; + } + } + + /** + * Close tag and call tag handler to format output + * + * @param $chunk full tag string, eg. [/tag] + */ + function close($chunk) { + // extract tag name from [/name] + $tag = strtolower(substr($chunk, 2, -1)); + + if ($this->tags_ignore_depth > 0 && in_array($tag, $this->tags_ignore)) { + $this->tags_ignore_depth--; + } + + // stack underrun + if ($this->current_tag < 0) { + $this->text($chunk); + return; + } + + // ignore block + if ($this->tags_ignore_depth > 0) { + $this->text($chunk); + return; + } + + // tag mismatch + if ($this->open_tags[$this->current_tag]['tag'] !== $tag) { + // try to find first open tag for this + $key = false; + for ($i = $this->current_tag - 1; $i > 0; $i--) { + if (isset($this->open_tags[$i]['tag']) && $this->open_tags[$i]['tag'] === $tag) { + $key = $i; + break; + } + } + if ($key === false) { + $this->text($chunk); + return; + } + + // tag is open so we need to 'rewind' a bit + for ($i = $this->current_tag; $i > $key; $i--) { + $tmp_tag = $this->pop_stack(); + $this->text($tmp_tag['open'] . $tmp_tag['text']); + } + } + + // close tag + $open = $this->pop_stack(); + + // handle bbcode + $open['close'] = $chunk; + + $block_level = false; + if (in_array($tag, $this->tags_block_open)) { + $block_level = true; + // for block level element, trim whitespace from inside tag + // [tag]...text...[/tag] + $open['text'] = $this->trim_ws($open['text']); + } + $result = $this->handle_tag($open); + + // strip whitespace from text before tag 'text...[tag]' + if ($block_level) { + $ts = $this->rtrim_ws($this->open_tags[$this->current_tag]['text']); + $this->open_tags[$this->current_tag]['text'] = $ts; + } + + $this->text($result); + + $this->last_closed_tag = $open['tag']; + } + + function text($text) { + // strip whitespace after closing '[/tag]...text' + if (in_array($this->last_closed_tag, $this->tags_block_close)) { + $text = $this->ltrim_ws($text); + } + $this->open_tags[$this->current_tag]['text'] .= $text; + + $this->last_closed_tag = false; + } + + function result() { + // close tags that are still open + while ($this->current_tag > 0) { + $open = $this->pop_stack(); + + if ($this->tags_ignore_depth > 0) { + $this->tags_ignore_depth--; + // need to reparse text that's after ignore tag + $this->_state_save(); + $text = $open['open'] . $this->bbcode($open['text']); + $this->_state_restore(); + } else { + // tag was not closed proprely, include start tag with result + $text = $open['open'] . $open['text']; + } + + $this->text($text); + }; + + return $this->open_tags[0]['text']; + } + + /** + * Pop tag and text from stack and return them + * + * @return array [0] = tag, [1] = text + */ + function pop_stack() { + // remove from stack + $open = $this->open_tags[$this->current_tag]; + unset($this->open_tags[$this->current_tag]); + $this->current_tag--; + + return $open; + } + + /** + * Trim from end of string + * 'text...\s{0,}\n{1}\s{0,}' + * + * @param string $ts + * @return string + */ + function rtrim_ws($ts){ + // we want to get rid of all spaces/tabs, but only single \n, so rtrim($ts, " \t\n\r") would not work + $ts = rtrim($ts, " \t"); + if (substr($ts, -1, 1) === "\n") { + $ts = substr($ts, 0, -1); + $ts = rtrim($ts, " \t"); + } + return $ts; + } + + /** + * Trim from start of string + * '\s{0,}\n{1}...text' + * + * @param string $ts + * @return string + */ + function ltrim_ws($ts){ + // we want to get rid of all spaces/tabs, but only single \n, so ltrim($ts, " \t\n\r") would not work + $ts = ltrim($ts, " \t"); + if (substr($ts, 0, 1) === "\n") { + $ts = substr($ts, 1); + } + return $ts; + } + + /** + * Trim from both sides + * '\s{0,}\n{1}...text...\s{0,}\n{1}\s{0,} + * + * @param string $ts + * @return string + */ + function trim_ws($ts){ + $ts = $this->ltrim_ws($ts); + $ts = $this->rtrim_ws($ts); + return $ts; + } + + /** + * Extract tag parameters from [tag=params] or [tag key1=val1 key2=val2] + * + * @param type $tag + * @return type + */ + function split_params($chunk) { + if (substr($chunk, 0, 1) == '[') { + $b = '\['; + $e = '\]'; + } else { + $b = ''; + $e = ''; + } + // [1] [2] [3] + if (preg_match('/^' . $b . '([\*a-zA-Z0-9]*?)' . '(=| )' . '(.*?)' . $e . '$/', $chunk, $match)) { + $tagName = strtolower($match[1]); + if ($match[2] == '=') { + // = means single parameter + $tagParam = $match[3]; + } else { + // means multiple parameters + $tagParam = array(); + $args = preg_split('/[ ]/', $match[3], null, PREG_SPLIT_NO_EMPTY); + foreach ($args as $arg) { + $pairs = explode('=', $arg); + // preg_replace will remove possible quotes around value + if (isset($pairs[1])) { + $tagParam[strtolower($pairs[0])] = preg_replace('@("|\'|)(.*?)\\1@', '$2', $pairs[1]); + } else { + $tagParam[] = preg_replace('@("|\'|)(.*?)\\1@', '$2', $pairs[0]); + } + } + } + } else { + if (substr($chunk, 0, 1) == '[' && substr($chunk, -1, 1) == ']') { + $chunk = substr($chunk, 1, -1); + } + $tagName = strtolower($chunk); + $tagParam = ''; + } + return array($tagName, $tagParam); + } + +} + +class bbCode extends bbCodeParser { + static $legacy_sync = 1348956841; + static $legacy_shard = array( + 'ani' => 2363920179, + 'lea' => 2437578274, + 'ari' => 2358620001, + ); + + static $ig = false; + static $timezone = 'UTC'; + static $clock12h = false; + static $shardid = false; + static $lang = 'en'; + static $disabledTags = array(); + // + const COLOR_P = '#d0d0d0'; // normal text + // + const COLOR_BBCODE_TAG = '#444444'; + + static function bbDisabled($tag) { + return in_array(strtolower($tag), self::$disabledTags); + } + + static function getFontSize($value) { + $size = 16; + switch (strtolower($value)) { + case '1': case 'xx-small': $size = 9; break; + case '2': case 'x-small' : $size = 10; break; + case '3': case 'small' : $size = 13; break; + case '4': case 'medium' : $size = 16; break; + case '5': case 'large' : $size = 18; break; + case '6': case 'x-large' : $size = 24; break; + case '7': case 'xx-large': $size = 32; break; + //case '8': case 'smaller' : break; + //case '9': case 'larger' : break; + } + return $size; + } + + static function bb_noparse($code) { + return preg_replace(array('/\[/', '/\]/'), array('[', ']'), $code); + } + + static function bb_code($code) { + return '

' . self::bb_noparse($code) . '
'; + } + + static function bb_list($list) { + $result = ''; + $list = str_replace("\n[", '[', $list); + $result = '
    ' . preg_replace('/\s*\[\*\]\s*/is', "
  • ", $list) . '
'; + return preg_replace('#
    \s*#is', '
      ', $result); + } + + static function bb_quote($author, $text) { + if (self::$ig) { + // prevents [color] tag to take over color + $author = self::bb_color(self::COLOR_P, $author); + $text = self::bb_color(self::COLOR_P, $text); + // left/right border, top/bottom border height + $l = ''; + $r = ''; + return // 98% gives bit padding on the right + '' . + '' . // top padding - no border + '' . $l . '' . $r . '' . // top border + '' . $l . '' . $r . '' . // author top padding + '' . $l . '' . $r . '' . // author + '' . $l . '' . $r . '' . // author bottom padding + '' . $l . '' . $r . '' . // quote top padding + '' . $l . '' . $r . '' . // quote + '' . $l . '' . $r . '' . // quote bottom padding + '' . $l . '' . $r . '' . // bottom border + '' . // bottom padding - no border + '
      ' . $author . '
      ' . $text . '
      '; + } else { + return '' . + '
      ' . + '' . $author . '' . + '
      ' . $text . '
      ' . + '
      '; + } + } + + static function bb_h($nr, $color, $text) { + $tag = 'h' . $nr; + + if (self::$ig) { + if ($color != '') { + $text = '' . $text . ''; + } + return '<' . $tag . '>' . $text . ''; + } else { + if ($color != '') { + $style = ' style="color: ' . $color . ';"'; + } else { + $style = ''; + } + return '<' . $tag . $style . '>' . $text . ''; + } + } + + static function bb_url($href, $text) { + // "http://..../" remove " if present + if (substr($href, 0, 6) == '"') { + if (substr($href, -6) == '"') { + $href = substr($href, 6, -6); + } else { + $href = substr($href, 6); + } + } + + if ($href == '') + $href = $text; + if ($text == '') { + $text = $href; + $text = wordwrap($text, 65, ' ', true); + } + + $disable = self::bbDisabled('url'); + // if not disabled and in ryzom and is proper url (:///) + if (!$disable && self::$ig) { + $url = @parse_url(strtolower($href)); + $disable = true; + if (!empty($url['scheme']) && !empty($url['host'])) { + if (in_array($url['scheme'], array('http', 'https'))) { + if (in_array($url['host'], array('app.ryzom.com'))) { + if (empty($url['query']) || stripos($url['query'], 'redirect') === false) { + // http://atys.ryzom.com/ + // and does not contain redirect + // - allow url in game browser + $disable = false; + } + } + } + } // !empty + }// isRYZOM + + if ($disable) { + // empty href will give proper link color without 'underline' - perfect for 'disabled' links + if ($href == '') { + $text = '' . $text . ''; + } else { + $href = wordwrap($href, 65, ' ', true); + $text = wordwrap($text, 65, ' ', true); + $text = '' . $text . ' ' . self::bb_color(self::COLOR_BBCODE_TAG, '(' . $href . ')'); + } + return $text; + } + + // make sure http:// (or ftp:// or mailto:// etc is present), if not, add it + if (!preg_match('#://#', $href)) { + $href = 'http://' . $href; + } + + return sprintf('%s', $href, $text); + } + + static function bb_img($attr, $href) { + if (self::bbDisabled('img')) { + return self::bb_noparse('[img]' . $href . '[/img]'); + } + // $href is treated with htmlspecialchars() so any & in url is & + $href = str_replace('&', '&', $href); + + // images from current server directly + if ($attr=='src' || strstr($href, $_SERVER['HTTP_HOST']) !== false){ + return ''; + } + $url = proxy_image_url($href); + return ''; + } + + static function bb_banner($lang, $ckey) { + // $lang and $ckey should already be escaped for HTML, so urlencode() in here would double escape them + // - channel it thru image proxy. proxy does caching better and uses '304 Not Modified' status + $src = 'http://atys.ryzom.com/api/banner.php?ckey=' . $ckey . '&langid=' . $lang . '&size=500'; + return self::bb_img('', $src); + } + + static function bb_mail($user) { + $url = 'http://' . $_SERVER['HTTP_HOST'] . '/app_mail/?page=compose/to/' . urlencode($user); + return '' . $user . ''; + } + + static function bb_profile($ptype, $pname) { + // types from app_profile + $types = array('user', 'player', 'npc', 'fauna', 'entity', 'source'); + $ptype = array_search($ptype, $types, true); + // if type not found, then fall back to player + if ($ptype === false) + $ptype = 1; + + $url = 'http://' . $_SERVER['HTTP_HOST'] . '/app_profile/?ptype=' . intval($ptype) . '&pname=' . urlencode($pname); + return '' . $pname . ''; + } + + static function bb_color($color, $str) { + if ($color == '') { + return $str; + } + + if (self::$ig) { + return '' . $str . ''; + } else { + return '' . $str . ''; + } + } + + static function bb_size($size, $str) { + $size = self::getFontSize($size); + + if (self::$ig) { + return '' . $str . ''; + } else { + return '' . $str . ''; + } + } + + static function bb_pre($str) { + return '
      ' . $str . '
      '; + } + + static function bb_p($str) { + return '

      ' . $str . '

      '; + } + + // Added by ulukyn. WebIg compatibility. + static function bb_center($str) { + if (self::$ig) { + return '
      ' . $str . '
      '; + } else { + return '
      ' . $str . '
      '; + } + } + + /** Table format : (added by ulukyn) + * A1| A2|A3 + * B1| B2 |B3 + * C1|C2 |C3 + */ + static function bb_table($attr, $content) { + $width = isset($attr['width'])?$attr['width']:'100%'; + $border = isset($attr['border'])?$attr['border']:'0'; + $bgcolor = isset($attr['bgcolor'])?' bgcolor="'.$attr['bgcolor'].'" ':''; + $ret = ''; + $lines = explode("\n", $content); + foreach ($lines as $line) { + if ($line) { + $ret .= ''; + $cols = explode('|', $line); + foreach ($cols as $text) { + if (!$text) + continue; + $params = array('valign' => 'middle'); + if ($text[0] == '#') { + $paramsdef = explode(' ', $text); + $paramlist = substr(array_shift($paramsdef), 1); + $paramlist = explode(',', $paramlist); + foreach ($paramlist as $p) { + list($name, $value) = explode('=', $p); + $params[ _h(str_replace('"', '', $name))] = _h(str_replace('"', '', $value)); + } + if ($paramsdef) + $text = implode(' ', $paramsdef); + } + $param_html = ''; + foreach ($params as $name => $value) + $param_html .= $name.'="'.$value.'" '; + + if ($text && $text[0] == ' ' && $text[strlen($text)-1] == ' ') + $align = 'center'; + else if ($text && $text[0] == ' ') + $align = 'right'; + else + $align = 'left'; + + $ret .= ''; + } + $ret .= ''; + } + } + + $ret .= '
      '.$text.'
      '; + return $ret; + } + + + static function bb_page_link($page, $txt) { + if ($page == '') { + $page = $txt; + } + $tmp = explode('/', $page); + foreach ($tmp as $k => $v) { + $tmp[$k] = urlencode($v); + } + $url = 'http://' . $_SERVER['HTTP_HOST'] . '/app_forum/?page=' . join('/', $tmp); + return '' . $txt . ''; + } + + static function bb_forum_link($page, $id, $txt) { + $page = $page . '/view/' . $id; + if ($id == '') { + $page.= $txt; + } + return self::bb_page_link($page, $txt); + } + + // Added by Ulukyn + static function bb_wiki_link($page, $txt) { + $need_new_txt = false; + if ($page == '') { + $page = $txt; + $need_new_txt = true; + } + + if (substr($page, 0, 22) == 'http://atys.ryzom.com/') + $url = 'http://atys.ryzom.com/start/app_wiki.php?page=' . substr($page, 21); + else { + $tmp = explode('/', $page); + if (count($tmp) != 2) { + return 'Syntax: [wiki]/[page], ex: en/Chronicles'; + } else { + $wiki = $tmp[0]; + $page = $tmp[1]; + } + if (self::$ig) { + $url = 'http://atys.ryzom.com/start/app_wiki.php?page=/projects/pub' . $wiki . '/wiki/' . $page; + } + else + $url = 'http://atys.ryzom.com/projects/pub' . $wiki . '/wiki/' . $page; + if ($need_new_txt) + $txt = 'WIKI [' . $page . ']'; + } + return '' . $txt . ''; + } + + static function bb_biu($tag, $txt) { + $tag = strtolower($tag); + if (self::$ig) { + switch ($tag) { + // FIXME: darken/lighter or tint current color + case 'b': $txt = self::bb_color('white', $txt); + break; + case 'i': $txt = self::bb_color('#ffffd0', $txt); + break; + case 'u': $txt = '' . self::bb_color(self::COLOR_P, $txt) . ''; + break; + default : $txt = self::bb_color(self::COLOR_BBCODE_TAG, $txt); + break; // fallback + } + return $txt; + } + + switch ($tag) { + case 'b': $tag = 'strong'; + break; + case 'i': $tag = 'em'; + break; + case 'u': $tag = 'u'; + break; + default: $tag = 'span'; // fallback + } + return '<' . $tag . '>' . $txt . ''; + } + + static function bb_date($attr, $txt) { + $time = strtotime($txt); + + $shardid = isset($attr['shard']) ? $attr['shard'] : self::$shardid; + if ($time === false || $shardid === false) + return 'ERR:[' . $txt . ']'; + + if (isset(self::$legacy_shard[$shardid])) { + $tick = self::$legacy_shard[$shardid]; + if (self::$legacy_sync > $time) { + // only modify game cycle when asked time is before sync + $tick = ($time - self::$legacy_sync) * 10 + $tick; + } + } else { + $tick = ryzom_time_tick($shardid); + // tick is for NOW, adjust it to match time given + $now = time(); + $tick = ($time - $now) * 10 + $tick; + } + + $rytime = ryzom_time_array($tick, $shardid); + $txt = ryzom_time_txt($rytime, self::$lang); + + return $txt; + } + + static function bb_time($options, $txt) { + $time = strtotime($txt); + + if ($time == 0) { + return $txt; + } + + $timezone = self::$timezone; + + $show_time = ''; + $show_date = ''; + $show_timer = ''; + + if (is_array($options)) { + foreach ($options as $key => $val) { + switch ($key) { + case 'timezone': + // fix some timezones for php + switch ($val) { + case 'pst': // fall thru + case 'pdt': $val = 'US/Pacific'; + break; + } + $timezone = $val; + break; + case 'date' : + $show_date = $val == 'off' ? false : $val; + break; + case 'time' : + $show_time = $val == 'off' ? false : $val; + break; + case 'timer': + $show_timer = $val == 'off' ? false : $val; + break; + }//switch + }//foreach + } + + $ret = array(); + + $old_timezone = date_default_timezone_get(); + @date_default_timezone_set($timezone); + if ($show_date !== false) { + $date = ryzom_absolute_time($time); + //ryzom_absolute_time does not have year, so we need to add it + $current_y = date('Y', time()); + $y = date('Y', $time); + if ($y != $current_y) { + $date.= ' ' . $y; + } + $ret[] = self::bb_color($show_date, $date); + } + if ($show_time !== false) { + $fmtTime = self::$clock12h ? 'g:i:s a T' : 'H:i:s T'; + $ret[] = self::bb_color($show_time, date($fmtTime, $time)); + } + date_default_timezone_set($old_timezone); + + if ($show_timer !== false) { + if ($show_time === false && $show_date === false) { + $f = '%s'; + } else { + $f = '(%s)'; + } + $ret[] = self::bb_color($show_timer, sprintf($f, ryzom_relative_time($time))); + } + + return join(' ', $ret); + } + + /** + * This function is called by bbCodeParser class + * + * @see bbCodeParser::format + */ + public function format($tag, $open, $close, $attr, $text) { + // silly functions all have different parameters + switch ($tag) { + case 'noparse' : + $result = self::bb_noparse($text); + break; + case 'code' : + $result = self::bb_code($text); + break; + case 'quote' : + $result = self::bb_quote($attr, $text); + break; + case 'h1' : // fall thru + case 'h2' : // fall thru + case 'h3' : // fall thru + case 'h4' : // fall thru + case 'h5' : // fall thru + case 'h6' : + $nr = (int) substr($tag, -1); + $color = isset($attr['color']) ? $attr['color'] : ''; + $result = self::bb_h($nr, $color, $text); + break; + case 'color' : + $result = self::bb_color($attr, $text); + break; + case 'size' : + $result = self::bb_size($attr, $text); + break; + case 'list' : + $result = self::bb_list($text); + break; + case 'img' : + $result = self::bb_img($attr, $text); + break; + case 'banner' : + $result = self::bb_banner($attr, $text); + break; + case 'pre' : + $result = self::bb_pre($text); + break; + case 'p' : + $result = self::bb_p($text); + break; + case 'table' : + $result = self::bb_table($attr, $text); + break; + case 'center' : + $result = self::bb_center($text); + break; + case 'url' : + $result = self::bb_url($attr, $text); + break; + case 'mail' : + $result = self::bb_mail($text); + break; + case 'profile' : + $result = self::bb_profile($attr, $text); + break; + case 'page' : + $result = self::bb_page_link($attr, $text); + break; + case 'forum' : // fall thru + case 'topic' : // fall thru + case 'post' : + $result = self::bb_forum_link($tag, $attr, $text); + break; + case 'wiki' : + $result = self::bb_wiki_link($attr, $text); + break; + case 'b' : // fall thru + case 'i' : // fall thru + case 'u' : + $result = self::bb_biu($tag, $text); + break; + case 'time' : + $result = self::bb_time($attr, $text); + break; + case 'date' : + $result = self::bb_date($attr, $text); + break; + default : + $result = $open . $text . $close; + break; + } + return $result; + } + + /** + * Replaces some BBcode with HTML code + * + * NOTE: $text should be already escaped for HTML + * + * @param string $text html escaped input text + * @param array $disabledTags + */ + static function parse($text, $disabledTags = array()) { + static $parser = null; + if ($parser === null) { + $parser = new self(self::$ig); + } + $parser->reset(); + + self::$disabledTags = $disabledTags; + return $parser->bbcode($text); + } + +} diff --git a/code/web/api/common/config.php.default b/code/web/api/common/config.php.default index 3a00bb04e..35202ae29 100644 --- a/code/web/api/common/config.php.default +++ b/code/web/api/common/config.php.default @@ -17,6 +17,8 @@ * along with ryzom_api. If not, see . */ + define('RYAPI_MODE', 'client'); + // Url where the api is define('RYAPI_URL', 'http://'); if (!defined('RYAPI_PATH')) @@ -24,5 +26,6 @@ if (!defined('RYAPI_PATH')) // used by "home" link if (!defined('RYAPP_URL')) define('RYAPP_URL', 'http://'); - +if (!defined('RYAPI_AUTH_KEY')) + define('RYAPI_AUTH_KEY', ''); // key gived by AUTH_SERVER ?> diff --git a/code/web/api/common/db_defs.php b/code/web/api/common/db_defs.php new file mode 100644 index 000000000..e2d9536ab --- /dev/null +++ b/code/web/api/common/db_defs.php @@ -0,0 +1,24 @@ +. + */ + +// init database table used by webig +$db = ryDB::getInstance('webig'); +$db->setDbDefs('players', array('id' => SQL_DEF_INT, 'cid' => SQL_DEF_INT, 'name' => SQL_DEF_TEXT, 'creation_date' => SQL_DEF_DATE, 'deleted' => SQL_DEF_BOOLEAN, 'last_login' => SQL_DEF_TEXT)); +$db->setDbDefs('accounts', array('uid' => SQL_DEF_INT, 'web_privs' => SQL_DEF_TEXT)); + +?> \ No newline at end of file diff --git a/code/web/api/common/db_lib.php b/code/web/api/common/db_lib.php index c3c7e8677..8d8dc936a 100644 --- a/code/web/api/common/db_lib.php +++ b/code/web/api/common/db_lib.php @@ -43,91 +43,96 @@ class ServerDatabase } if (($this->hostname != '') && ($this->username != '') && ($this->database != '')) - { - $this->_connection = mysql_connect($this->hostname, $this->username, $this->password) - or die("ERR1"); // ace . $this->get_error()); - $this->select_db($this->database); - } + $this->_connection = new mysqli($this->hostname, $this->username, $this->password, $this->database); } function close() { - @mysql_close($this->_connection); + $this->_connection->close(); } function query($sql_statement) { - $result = mysql_query($sql_statement, $this->_connection); + $result = $this->_connection->query($sql_statement); + if (!$result) + alert('MYSQL', $this->get_error(), 2); return $result; } function select_db($dbname) { $this->database = $dbname; - mysql_select_db($this->database, $this->_connection) or die("Database selection error : " . $this->get_error()); + $this->_connection->select_db($dbname); } function num_rows($result) { - return @mysql_num_rows($result); + return $result->num_rows; } - function fetch_row($result, $result_type=MYSQL_BOTH) + function fetch_row($result, $result_type=MYSQLI_BOTH) { - return @mysql_fetch_array($result, $result_type); - } - - function fetch_assoc($result) - { - return @mysql_fetch_array($result, MYSQL_ASSOC); + if (gettype($result) == "object") + return $result->fetch_array($result_type); + return NULL; } + function fetch_assoc($result) + { + if (gettype($result) == "object") + return $result->fetch_assoc(); + return NULL; + } function query_single_row($sql_statement) { $result = $this->query($sql_statement); - return @mysql_fetch_array($result); + if (gettype($result) == "object") + return $result->fetch_array(); + + return NULL; } function free_result($result) { - @mysql_free_result($result); + $result->free(); } function get_error() { - return mysql_errno($this->_connection) .": ". mysql_error($this->_connection); + return $this->_connection->errno.': '.$this->_connection->error; } function last_insert_id() { - return @mysql_insert_id(); + return $this->_connection->insert_id; + } + + function escape_string($escapestr) { + return $this->_connection->real_escape_string($escapestr); } function change_to($host,$user,$pass,$dbname) { - $this->close(); + /*$this->close(); $this->hostname = $host; $this->username = $user; $this->password = $pass; $this->database = $dbname; - $this->ServerDatabase(); + $this->ServerDatabase();*/ } } - - - class ryDB { private static $_instances = array(); private $db; private $defs = array(); private $errors = ''; - - + + private function __construct($db_name) { global $_RYZOM_API_CONFIG; - + $this->db_name = $db_name; $this->db = new ServerDatabase(RYAPI_WEBDB_HOST, RYAPI_WEBDB_LOGIN, RYAPI_WEBDB_PASS, $db_name); $this->db->query("SET NAMES utf8"); } @@ -140,20 +145,41 @@ class ryDB { return self::$_instances[$db_name]; } - function setDbDefs($table, $defs) { + function setDbDefs($table, $defs, $check=true) { + if ($check) + { + $result = $this->db->query('SHOW FIELDS FROM '.$table); + if (!$result) + die("Table $table not found in database"); + + $fields = array_keys($defs); + while ($row = $this->db->fetch_row($result)) { + if (in_array($row['Field'], $fields)) + unset($fields[array_search($row['Field'], $fields)]); + else + alert('DbLib', 'Missing field '.$row['Field']." on DbDef of table [$table] of database [$this->db_name] !", 2); + } + if ($fields) + die('Missing fields ['.implode('] [', $fields)."] in table [$table] of database [$this->db_name] !"); + } $this->defs[$table] = $defs; } - + function getDefs($table) { - if (!array_key_exists($table, $this->defs)) - die("Please add tables defs using setDbDefs('$table', \$defs)"); - return $this->defs[$table]; + if ($this->hasDbDefs($table)) + return $this->defs[$table]; + + alert('DBLIB', "Please add tables to '$this->db_name' defs using setDbDefs('$table', \$defs)", 2); } - + + function hasDbDefs($table) { + return array_key_exists($table, $this->defs); + } + function getErrors() { return $this->db->get_error(); } - + function now() { return date('Y-m-d H:i:s', time()); } @@ -169,18 +195,43 @@ class ryDB { function addDbTableProp($table, $props) { $this->props[$table] = $props; } - + + function sqlEscape($escapestr) { + return $this->db->escape_string($escapestr); + } + + function insertID() { + return $this->db->last_insert_id(); + } + + /// DIRECT QUERY - function sqlQuery($sql) { + function sqlQuery($sql, $index = false, $result_type = MYSQLI_BOTH) { $result = $this->db->query($sql); + if (!$result) + return NULL; + if($index !== false && !is_array($index)){ + $index = array($index); + } $ret = array(); - while ($row = $this->db->fetch_row($result)) { - $ret[] = $row; + while ($row = $this->db->fetch_row($result, $result_type)) { + if($index !== false) { + // if $index is ['id1', 'id2'], then this code executes as + // $ret[$row['id1']][$row['id2']] = $row + $current = &$ret; + foreach($index as $key){ + if(!isset($row[$key])) + alert('DBLIB', "Requested index field ($key) was not selected from db"); + $current = &$current[$row[$key]]; + } + $current = $row; + } else + $ret[] = $row; } return $ret; } - - + + /// QUERY /// function sqlSelect($table, $props, $values=array(), $extra='') { if ($table) { @@ -188,16 +239,16 @@ class ryDB { $params = array(); $test = array(); if (!$props) - die("Bad Select on [$table] : missing props"); - + alert('DBLIB', "Bad Select on [$table] : missing props"); + foreach($props as $name => $type) - $params[] = '`'.addslashes($name).'`'; - + $params[] = '`'.$this->sqlEscape($name).'`'; + foreach($values as $name => $value) { if ($name[0] == '=') - $test[] = '('.addslashes(substr($name, 1)).' LIKE '.var_export($value, true).')'; + $test[] = '('.$this->sqlEscape(substr($name, 1)).' LIKE '.var_export($value, true).')'; else - $test[] = '('.addslashes($name).' = '.var_export($value, true).')'; + $test[] = '('.$this->sqlEscape($name).' = '.var_export($value, true).')'; } $sql .= implode(",\n\t", $params)."\nFROM\n\t".$table."\n"; if ($test) @@ -209,39 +260,37 @@ class ryDB { return $sql.';'; } - + function querySingle($table, $values=array(), $extra='') { $sql = $this->sqlSelect($table, $this->getDefs($table), $values, $extra); - $result = $this->db->query($sql); - return $this->db->fetch_row($result); + $result = $this->sqlQuery($sql, false, MYSQLI_BOTH); + if(empty($result)) + return NULL; + return $result[0]; } - + function querySingleAssoc($table, $values=array(), $extra='') { $sql = $this->sqlSelect($table, $this->getDefs($table), $values, $extra); - $result = $this->db->query($sql); - return $this->db->fetch_row($result, MYSQL_ASSOC); + $result = $this->sqlQuery($sql, false, MYSQLI_ASSOC); + if(empty($result)) + return NULL; + return $result[0]; } - - function query($table, $values=array(), $extra='') { + + function query($table, $values=array(), $extra='', $index = false, $result_type = MYSQLI_BOTH) { $sql = $this->sqlSelect($table, $this->getDefs($table), $values, $extra); - $result = $this->db->query($sql); - $ret = array(); - while ($row = $this->db->fetch_row($result)) { - $ret[] = $row; - } - return $ret; + return $this->sqlQuery($sql, $index, $result_type); } - - function queryAssoc($table, $values=array(), $extra='') { - $sql = $this->sqlSelect($table, $this->getDefs($table), $values, $extra); - $result = $this->db->query($sql); - $ret = array(); - while ($row = $this->db->fetch_row($result, MYSQL_ASSOC)) { - $ret[] = $row; - } - return $ret; + + function queryAssoc($table, $values=array(), $extra='', $index = false) { + return $this->query($table, $values, $extra, $index, MYSQLI_ASSOC); } + function queryIndex($table, $index, $values=array(), $extra='') { + return $this->query($table, $values, $extra, $index, MYSQLI_ASSOC); + } + + /// INSERT /// function sqlInsert($table, $props, $vals) { $sql = 'INSERT INTO '.$table.' '; @@ -250,7 +299,7 @@ class ryDB { foreach($props as $name => $type) { if (!isset($vals[$name])) continue; - $params[] = $name; + $params[] = '`'.$name.'`'; switch ($type) { case SQL_DEF_BOOLEAN: $values[] = $vals[$name]?1:0; @@ -260,12 +309,12 @@ class ryDB { break; case SQL_DEF_DATE: // date if (is_string($vals[$name])) - $values[] = "'".addslashes($vals[$name])."'"; + $values[] = "'".$this->sqlEscape($vals[$name])."'"; else $values[] = "'".$this->toDate($vals[$name])."'"; break; default: - $values[] = "'".addslashes($vals[$name])."'"; + $values[] = "'".$this->sqlEscape($vals[$name])."'"; break; } } @@ -284,8 +333,8 @@ class ryDB { $sql = "DELETE FROM\n\t".$table."\n"; $test = array(); foreach($values as $name => $value) - $test[] = '('.addslashes($name).' = '.var_export($value, true).')'; - + $test[] = '('.$this->sqlEscape($name).' = '.var_export($value, true).')'; + if ($test or $where) $sql .= "WHERE\n\t"; if ($test) @@ -294,7 +343,7 @@ class ryDB { $sql .= "\n".$where; return $sql.';'; } - + function delete($table, $values=array(), $where='') { $sql = $this->sqlDelete($table, $values, $where); $result = $this->db->query($sql); @@ -316,23 +365,23 @@ class ryDB { break; case SQL_DEF_DATE: if (is_string($vals[$name])) - $values[] = '`'.$name.'` = \''.addslashes($vals[$name]).'\''; + $values[] = '`'.$name.'` = \''.$this->sqlEscape($vals[$name]).'\''; else $values[] = '`'.$name.'` = \''.$this->toDate($vals[$name]).'\''; break; default: - $values[] = '`'.$name.'` = \''.addslashes($vals[$name]).'\''; + $values[] = '`'.$name.'` = \''.$this->sqlEscape($vals[$name]).'\''; break; } } $sql .= "\n\t".implode(",\n\t", $values)."\n"; foreach($tests as $name => $value) { - $test[] = '('.addslashes($name).' = '.var_export($value, true).')'; + $test[] = '('.$this->sqlEscape($name).' = '.var_export($value, true).')'; } if ($test) $sql .= "WHERE\n\t".implode("\nAND\n\t", $test); - + $sql .= "\n".$extra; return $sql; @@ -363,17 +412,17 @@ class ryDB { continue; switch ($type) { case 'trad': - $values[] = '`'.$name."` = '".addslashes($vals[$name])."'"; + $values[] = '`'.$name."` = '".$this->sqlEscape($vals[$name])."'"; break; case 'textarea': case 'string': case 'option': - $values[] = '`'.$name."` = '".addslashes($vals[$name])."'"; + $values[] = '`'.$name."` = '".$this->sqlEscape($vals[$name])."'"; break; case 'id': case 'int': case 'float': - $values[] = '`'.$name.'` = '.addslashes($vals[$name]); + $values[] = '`'.$name.'` = '.$this->sqlEscape($vals[$name]); break; case 'bool': $values[] = '`'.$name.'` = '.($vals[$name]?'1':'0'); @@ -389,7 +438,7 @@ class ryDB { return $result; } - + /// Display function getTableHtml($name, $params, $values, $order_by='') { @@ -417,6 +466,55 @@ class ryDB { return $ret; } + /// Update Database Structure + + static function updateDatabaseStruct($defs) + { + if (file_exists(RYAPP_PATH.'database.versions')) + $versions = unserialize(file_get_contents(RYAPP_PATH.'database.versions')); + else + $versions = array(); + + $c = "Updating DB Structure...\n"; + foreach ($defs as $dbname => $tables) { + $db = new ServerDatabase(RYAPI_WEBDB_HOST, RYAPI_WEBDB_LOGIN, RYAPI_WEBDB_PASS, $dbname); + $db->query("SET NAMES utf8"); + $c .= "\n Selected DB '$dbname'\n"; + foreach ($tables as $table => $sql) + { + $version = count($sql); + if (array_key_exists($table, $versions)) + $diff = $version - $versions[$table]; + else { + $versions[$table] = 0; + $diff = $version; + } + + $c .= " Table '$table' need v$version (current v".strval($versions[$table].') => '); + + if ($diff > 0) { + $sql_to_run = array_slice($sql, $versions[$table], $diff); + foreach($sql_to_run as $sql_run) { + if ($sql_run) { + $c .= "Run sql... "; + $result = $db->query($sql_run); + } else + $c .= "KO!!!"; + } + if ($result) { + $c .= "OK"; + $versions[$table] = $version; + } + } else + $c .= "OK"; + $c .= "\n"; + } + $c .= "\n"; + $db->close(); + } + file_put_contents(RYAPP_PATH.'database.versions', serialize($versions)); + return '
      '.$c.'
      ';
      +	}
       }
       
       ?>
      diff --git a/code/web/api/common/dfm.php b/code/web/api/common/dfm.php
      new file mode 100644
      index 000000000..57bbe70d3
      --- /dev/null
      +++ b/code/web/api/common/dfm.php
      @@ -0,0 +1,151 @@
      +.
      + */
      +
      + function getDirLinks($url_params, $path, $getvar, $home) {
      +	$ret = '';
      +	$dirs = explode('/', $path);
      +	$dirpath = '';
      +	$ret .= _l($home, $url_params, array($getvar => ''));
      +	foreach($dirs as $dirname) {
      +		if ($dirname)  {
      +			$ret .= ' » '._l($dirname, $url_params, array($getvar => '/'.$dirpath.$dirname));
      +			$dirpath .= $dirname.'/';
      +		}
      +	}
      +	return $ret;
      +}
      +
      +function isEmptyDir($dir)
      +{
      +	if (($files = scandir($dir)) && count($files) <= 2) {
      +		return true;
      +	}
      +	return false;
      +}
      + 
      +class ryDataFileManager {
      +
      +	public $id;
      +	public $log_dir;
      +	public $data_dir;
      +	public $user_dir;
      +	public $app_name;
      +	
      +	function __construct($id, $app_name=APP_NAME) {
      +		$this->app_name = $app_name;
      +		$id = (strlen($id) == 0?'0':'').$id;
      +		$id = (strlen($id) == 1?'0':'').$id;
      +		$this->id = $id;
      +		$this->log_dir = RYAPP_PATH.$app_name.'/data/logs/';
      +		$this->data_dir = RYAPP_PATH.$app_name.'/data/app/';
      +		$this->user_dir =  RYAPP_PATH.$app_name.'/data/chars/'.$id[0].'/'.$id[1].'/'.$id.'/';
      +		
      +		if (!is_dir($this->user_dir))
      +			@mkdir($this->user_dir, 0777, true);
      +
      +		if (!is_dir($this->log_dir))  {
      +			@mkdir($this->log_dir, 0777, true);
      +			@mkdir($this->data_dir, 0777, true);
      +		}
      +	}	
      +	
      +	/*** Generic datafiles access methods ***/
      +
      +	function getData($name, $default=null) {
      +		if (file_exists($name))
      +			return unserialize(file_get_contents($name));
      +		if ($default !== NULL) {
      +			@file_put_contents($name, serialize($default));
      +			return $default;
      +		}
      +		return NULL;
      +	}
      +
      +	function saveData($name, $datas, $create_folders=true) {
      +		if ($create_folders) {
      +			if (!is_dir(dirname($name)))
      +				@mkdir(dirname($name), 0777, true);
      +		}
      +		if ($datas !== NULL)
      +			@file_put_contents($name, serialize($datas));
      +		else
      +			@unlink($name);
      +	}
      +	
      +	function listDataFiles($dir) {
      +		$ret = array();
      +		if ($handle = @opendir($dir)) {
      +			while (false !== ($file = readdir($handle))) {
      +				if ($file != '.' && $file != '..' && $file[0] != '.')
      +					$ret[] = $file;
      +			}
      +		}
      +		return $ret;
      +	}
      +
      +	/*** App Datas ***/
      +
      +	function loadAppData($name, $default=null) {
      +		return $this->getData($this->data_dir.$name, $default);
      +	}
      +
      +	function saveAppData($name, $datas, $create_folders=true) {
      +		return $this->saveData($this->data_dir.$name, $datas, $create_folders);
      +	}
      +
      +	function listAppDataFiles($basedir='') {
      +		return $this->listDataFiles($this->data_dir.$basedir);
      +	}
      +
      +
      +	/*** User Datas ***/
      +	
      +	function loadUserData($name, $default=null) {
      +		return $this->getData($this->user_dir.$name, $default);
      +	}
      +
      +	function saveUserData($name, $datas, $create_folders=true) {
      +		return $this->saveData($this->user_dir.$name, $datas, $create_folders);
      +	}
      +
      +	function listUserDataFiles($basedir='') {
      +		return $this->listDataFiles($this->user_dir.$basedir);
      +	}
      +
      +	function loadUserDataFromApp($name, $app, $default=null) {
      +		$id = $this->id;
      +		$file = RYAPP_PATH.$app.'/data/chars/'.$id[0].'/'.$id[1].'/'.$id.'/'.$name;
      +		if (file_exists($file))
      +			return unserialize(file_get_contents($file));
      +		if ($default !== null)
      +			return $default;
      +		return null;
      +	}
      +
      +	function saveUserDataFromApp($name, $app, $datas) {
      +		$id = $this->id;
      +		$dir = RYAPP_PATH.$app.'/data/chars/'.$id[0].'/'.$id[1].'/'.$id.'/';
      +		if (!is_dir($dir))
      +			@mkdir($dir, 0777, true);
      +		file_put_contents($dir.$name, serialize($datas));
      +	}
      +}
      +
      +
      +?>
      diff --git a/code/web/api/common/logger.php b/code/web/api/common/logger.php
      index 1e5106b54..7599c62c9 100644
      --- a/code/web/api/common/logger.php
      +++ b/code/web/api/common/logger.php
      @@ -1,9 +1,26 @@
       .
      + */
      +
       class ryLogger {
       
       	public $enable = false;
      -	private $logs;
      +	private $logs = array();
       	private static $_instance = NULL;
       	
       	public static function getInstance() {
      @@ -32,12 +49,16 @@ class ryLogger {
       
       	function getLogs() {
       		$ret = '';
      -		if ($this->logs && $this->enable)
      -			$ret = "Debug\n\n".implode("\n", $this->logs);
      -		$this->logs = array();
      +		if ($this->logs && $this->enable) {
      +			$ret = 'Debug

      '. implode('
      ', $this->logs).'
      '; + $this->logs = array(); + } return $ret; } } +function _log() { + return ryLogger::getInstance(); +} ?> diff --git a/code/web/api/common/render.php b/code/web/api/common/render.php index e086db9dd..30a68a266 100644 --- a/code/web/api/common/render.php +++ b/code/web/api/common/render.php @@ -1,4 +1,5 @@ . */ -function ryzom_app_render($title, $content, $ig=false, $bgcolor='', $javascript=array(), $homeLink=false) { +function ryzom_app_render($title, $content, $style='', $javascript=array(), $homeLink=false) { $c = ''; + + // get Lua code + $c .= ryLua::get(RYZOM_IG); + $at_end = ryLua::getEnd(RYZOM_IG); + // Render header $title_prefix = ''; if (ON_IPHONE) { $title_prefix = 'Ryzom - '; } - if (!$bgcolor) - $bgcolor = '#000000'.($ig?'00':''); - - if (!$ig) { + if (!RYZOM_IG) $c .= ''."\n"; - $c .= ' - '."\n"; - $c .= ' '.$title_prefix.(translation_exists($title)?_t($title):$title).''."\n"; + $c .= ''."\n"; + $c .= ' '.$title_prefix.(translation_exists($title)?_t($title):$title).''."\n"; + if (!RYZOM_IG) $c .= ' '."\n"; + + $events = ''; + if (!RYZOM_IG) { $c .= ryzom_render_header(); $c .= ryzom_render_header_www(); - $events = ON_IPHONE ? 'onorientationchange="updateOrientation();" ' : ''; - $c .= ' '."\n"; - $c .= ' '."\n"; + if (function_exists('newrelic_get_browser_timing_header')) + $c .= newrelic_get_browser_timing_header(); + if(ON_IPHONE) $events = 'onorientationchange="updateOrientation();" '; + } else { + #if (!$style) + $style='bgcolor="#00000000"'; + } + + if (!RYZOM_IG) { // Javascript $js_code = ''; + if (is_string($javascript)) + $javascript = array($javascript); foreach ($javascript as $js) - $js_code .= ''; + $js_code .= ' '."\n"; $c .= $js_code; - - $c .= ryzom_render_www(ryzom_render_window($title, $content, $homeLink)); - $c .= ''; - } else { - $c .= ''; - $c .= $content; - $debug = ryLogger::getInstance()->getLogs(); - if ($debug) - $c .= '
      '.$debug.'
      '; - $c .= ''; } + + $c .= ' '."\n"; + $c .= ' '."\n"; + + if (!RYZOM_IG) { + $c .= ryzom_render_www(ryzom_render_window($title, $content, $homeLink)); + $c .= ''; + if (function_exists('newrelic_get_browser_timing_header')) + $c .= newrelic_get_browser_timing_footer(); + } else { + $c .= $content.'
      '.ryLogger::getInstance()->getLogs().'
      '; + } + + $c .= ''.$at_end; + return $c; } @@ -146,7 +165,9 @@ function ryzom_render_window_begin($title, $homeLink=false) { } function ryzom_render_window_end() { + global $user; return ' +
      '.(isset( $user['groups'])?implode(':', $user['groups']):'').'
      '.ryLogger::getInstance()->getLogs().'

      powered by ryzom-api

      @@ -191,25 +212,161 @@ function ryzom_render_www_end() { return ''; } -function ryzom_render_login_form($char, $aligned=true) { + +function _s($tag, $text) { + global $ryzom_render_styles, $ryzom_render_tmpls; + if (!array_key_exists($tag, $ryzom_render_tmpls)) + return $text; + if (is_array($text)) + return $p = $text; + else + $p[0] = $text; + $p['color1'] = $ryzom_render_styles[$tag][0]; + $p['color2'] = $ryzom_render_styles[$tag][1]; + $code = '$c = "'.str_replace('"', '\"', $ryzom_render_tmpls[$tag]).'";'; + eval($code); + return $c; +} + +function ryzom_get_color_style($tag, $color=0) { + global $ryzom_render_styles; + if (!array_key_exists($tag, $ryzom_render_styles)) + return '000000'; + return $ryzom_render_styles[$tag][$color]; +} + +function ryzom_set_title($title) { + $GLOBALS['ryzom_render_title'] = $title; +} + +function ryzom_get_title() { + return $GLOBALS['ryzom_render_title']; +} + +function ryzom_font($text, $color="", $size="") { + if (RYZOM_IG) { + $color = $color?'color="'.$color.'"':''; + $size = $size?'size="'.$size.'"':''; + } else { + $color = $color?'color:'.$color.';':''; + $size = $size?'font-size:'.$size.'pt':''; + } + return (RYZOM_IG?"":"").$text.''; +} + +function ryzom_render_login_form($char, $aligned=true, $action="") { $c = ''; if ($aligned) { - $c .= '
      '; + $c .= '
      '; $c .= ''; - $c .= ''; + $c .= ''; $c .= ''; - $c .= ''; + if (RYZOM_IG) + $c .= ''; + else + $c .= ''; $c .= ''; } else { - $c .= '
      '._t('enter_char').'
      '._t('enter_password').'
      '; + $c .= '
      '; $c .= ''; - $c .= ''; + $c .= ''; $c .= ''; - $c .= ''; + if (RYZOM_IG) + $c .= ''; + else + $c .= ''; $c .= ''; } $c .= '
      '._t('login').'
      '._t('password').'
      '; return $c; } +function ryzom_dialog_yes_no($desc, $action, $name) { // will append ryzom_dialog=yes|no to url + + return '
      '.(RYZOM_IG?'':''). + $desc.'
      + + + +
      +
      '; +} + +$GLOBALS['ryzom_render_title'] = defined('APP_NAME')?APP_NAME:'Ryzom'; + +$ig = (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Ryzom')) || ryzom_get_param('ig'); // need be set using url param because auth is not done +$transparency = $ig?'':''; +$ryzom_render_styles = array(); +$ryzom_render_tmpls = array(); + +$ryzom_render_styles['main title'] = array('#222222'.$transparency, '#FFFFFF'); +$ryzom_render_tmpls['main title'] = '

       ${p[0]}

      '."\n"; + +$ryzom_render_styles['section'] = array('#555555'.$transparency, '#FFFFFF'); +$ryzom_render_tmpls['section'] = '
       ${p[0]}
      '."\n"; + +$ryzom_render_styles['color'] = array('', ''); +$ryzom_render_tmpls['color'] = ($ig?'':'').'${p[0]}'; + +$ryzom_render_styles['link'] = array('#111111', ''); +$ryzom_render_tmpls['link'] = '
       ${p[0]}
      '."\n"; + +$ryzom_render_styles['button'] = array('#000000', ''); +$ryzom_render_tmpls['button'] = '
       ${p[0]}
      '."\n"; + +$ryzom_render_styles['links'] = array('#111111'.$transparency, ''); +$ryzom_render_tmpls['links'] = '
       ${p[0]}
      '."\n"; + +$ryzom_render_styles['back'] = array('#000000'.$transparency, ''); +$ryzom_render_tmpls['back'] = '
       «'.'main'.'
       
      '; + +$ryzom_render_styles['highlight'] = array('#55ff55'.$transparency, ''); +$ryzom_render_tmpls['highlight'] = '${p[0]}'; + +$ryzom_render_styles['backlight'] = array('#272727'.$transparency, ''); +$ryzom_render_tmpls['backlight'] = '
      ${p[0]}
      '."\n"; + +$ryzom_render_styles['actionbar'] = array('#555555'.$transparency, ''); +$ryzom_render_tmpls['actionbar'] = '${p[0]}'."\n"; + +$ryzom_render_styles['table'] = array('#050505'.$transparency, '#FFFFFF'); +$ryzom_render_tmpls['table'] = '${p[0]}
      '."\n"; + +$ryzom_render_styles['t header'] = array('#111111'.$transparency, '#FFFFFF'); +$ryzom_render_tmpls['t header'] = '${p[0]}'."\n"; + +$ryzom_render_styles['t row 0'] = array('#353535'.$transparency, ''); +$ryzom_render_tmpls['t row 0'] = '${p[0]}'."\n"; + +$ryzom_render_styles['t row 1'] = array('#252525'.$transparency, ''); +$ryzom_render_tmpls['t row 1'] = '${p[0]}'."\n"; + +$ryzom_render_styles['t element'] = array('#FFFFFF'.$transparency, ''); +$ryzom_render_tmpls['t element'] = '${p[0]}'; + +$ryzom_render_styles['log'] = array('#001100'.$transparency, ''); +$ryzom_render_tmpls['log'] = '
      ${p[0]}
      '."\n"; + +$ryzom_render_styles['message'] = array('#445566'.$transparency, ''); +$ryzom_render_tmpls['message'] = '

       ${p[0]}

      '."\n"; + +$ryzom_render_styles['message warning'] = array('#AA3300'.$transparency, ''); +$ryzom_render_tmpls['message warning'] = '

       ${p[0]}

      '."\n"; + +$ryzom_render_styles['message window'] = array('#5555ff'.$transparency, '#7799ff'); +$ryzom_render_tmpls['message window'] = ''.''. + '
      ${p[0]}${p[0]}
      '."\n"; + +$ryzom_render_styles['message ask'] = array('#333333'.$transparency, ''); +$ryzom_render_tmpls['message ask'] = '
      '.($ig?'':'').'${p[0]}
      '."\n"; + +$ryzom_render_styles['message error'] = array('#AA2222'.$transparency, ''); +$ryzom_render_tmpls['message error'] = '

       ${p[0]}

      '."\n"; + +$ryzom_render_styles['message debug'] = array('#FFAA22'.$transparency, ''); +$ryzom_render_tmpls['message debug'] = '
      ${p[0]}
      '."\n"; + +$ryzom_render_styles['progress bar'] = array('#FF0000'.$transparency, '#000000'); +$ryzom_render_tmpls['progress bar'] = '${p[0]}
       ${p[0]} 
      '."\n"; + ?> diff --git a/code/web/api/common/ryform.php b/code/web/api/common/ryform.php new file mode 100644 index 000000000..9f674a8a9 --- /dev/null +++ b/code/web/api/common/ryform.php @@ -0,0 +1,678 @@ +. + */ + +include_once (RYAPI_PATH.'/common/ryformBases.php'); + +class ryVar extends basicRyForm { + public $formName = ''; + public $varName = ''; + public $varValue = ''; + + function getFormDefs() { + return array( + new ryFormDef('varName', DEF_TYPE_TEXT), + new ryFormDef('varValue', DEF_TYPE_TEXT), + ); + } + + function getHtmlRepr() { + return $this->varName.' => '.$this->varValue; + } +} + +class ryForm { + + private $name = ''; + private $defines = array(); + private $template = ''; + + static private $forms; + static private $ryformsIcons = array(); + + function __construct($dir, $name) { + $this->name = $name; + self::$forms[$dir.'/'.$name] = $this; + } + + static function addRyFormIcon($ryform_name, $icon) { + self::$ryformsIcons[$ryform_name] = $icon; + } + + function addDefine($def) { + $this->defines[$def->name] = $def; + } + + function setTemplate($template) { + $this->template = $template; + } + + function getTemplate() { + return $this->template; + } + + function addValue($name, $value) { + if (array_key_exists($name, $this->defines)) + $this->defines[$name]->value = $value; + else + return false; + return true; + } + + function addExtraValues($name, $value) { + if (array_key_exists($name, $this->defines)) + $this->defines[$name]->extraValues = $value; + else + return false; + return true; + } + + function getForm($params) { + + if (isset($params['ryform_action']) && $params['ryform_action']) { + $res = $this->doAction($params); + return $res; + } + + if (@$params['validate'] == $this->name) + return array(DATA_FORM_VALUES, $_POST); + + if (isset($params['ryform_parent'])) + $parent_ryform_name = $params['ryform_parent'].'/'; + else + $parent_ryform_name = ''; + + $action =_url(ryzom_get_params(), array('validate' => $this->name)); + $ret = ''; + $ret .= '
      '."\n"; + + if (!$this->getTemplate()) { + $ret .= ' '."\n"; + $ret .= ' '._s('t header', '')."\n"; + $tmpl = ''; + } else { + $tmpl = $this->getTemplate(); + } + + $i = 0; + + foreach ($this->defines as $def_id => $def) { + if ($def->name == 'name') + $def->name = '_name'; + + $deffullname = $def->name; + $url_params = ryzom_get_params(); + $type = $def->type; + $infos = $def->infos; + $value = ($def->value !== NULL)?$def->value:$def->defaultValue; + + if (!is_object($value) && !is_array($value)) + $str_value = _h(strval($value)); + else + $str_value = ''; + + if ($def->hidden) + $type = DEF_TYPE_HIDDEN; + + $hidden = false; + $input = ''; + switch ($type) { + + case DEF_TYPE_HIDDEN: + $input = ''."\n"; + $hidden = true; + break; + + case DEF_TYPE_TEXT: + $input = ''; + break; + case DEF_TYPE_NAMEID: + $input = ''; + break; + + case DEF_TYPE_ID: + case DEF_TYPE_INT: + case DEF_TYPE_FLOAT: + $input = ''; + break; + + case DEF_TYPE_BOOL: + $input = ''; + break; + + case DEF_TYPE_OPTION_FUNCTION: + case DEF_TYPE_OPTION: + if ($type == DEF_TYPE_OPTION) + $options = $def->params; + else { + if (is_array($def->defaultValue)) + $options = call_user_func_array($def->params, $def->defaultValue); + else + $options = call_user_func($def->params); + } + $input = ''; + break; + + case DEF_TYPE_COMBO_FUNCTION: + case DEF_TYPE_COMBO: + if ($type == DEF_TYPE_COMBO) + $options = $def->params; + else { + if (is_array($def->defaultValue)) + $options = call_user_func_array($def->params, $def->defaultValue); + else + $options = call_user_func($def->params); + } + if (_user()->ig) { + // TODO : try to do it with lua + } else { // HTML 4 + $input .= ' + '; + } + break; + + case DEF_TYPE_TEXTAREA: + if (!$value) + $value = ""; + $input = '
      '.($type == DEF_TYPE_BBCODE?'- BBCode -
      ':'').'
      '; + break; + + case DEF_TYPE_TRAD: + $base = ''; + $param = $def->name; + $value = array_merge(array('en' => '', 'fr' => '', 'de' => '', 'ru' => '', 'es' => ''), $value); + $base = ryzom_get_param('select_base', ''); + $edit = $display = $input_header = ''; + foreach (array('en', 'fr', 'de', 'ru', 'es') as $lang) { + if (_user()->lang == $lang) + $edit = _i($lang == 'en'?API_URL.'data/img/lang/us.png':API_URL.'data/img/lang/'.$lang.'.png').' '; + if ((!$base && $value[$lang]) || $base == $lang) { + $base = $lang; + $display = strtoupper($lang).' = '.str_replace("\n", '
      ', _h($value[$lang])).'
      '; + } + $input .= ''; + $input_header .= _l(_i($lang == 'en'?API_URL.'data/img/lang/us.png':API_URL.'data/img/lang/'.$lang.'.png'), $url_params, array('select_base' => $lang)).'  '; + } + + $input = $input_header.$input.'   '.$display.'
      '.$edit; + break; + + case DEF_TYPE_RYFORM: + case DEF_TYPE_RYFORMS_ARRAY: + $savedRyform = $value; + if (is_array($savedRyform)) { + $to_clean = array(); + foreach ($savedRyform as $id => $ryform) { + if (!is_object($ryform)) + $to_clean[] = $id; + } + foreach ($to_clean as $id) + unset($savedRyform[$id]); + $savedRyform = array_values($savedRyform); + } else if (is_object($savedRyform)) { + $savedRyform = array($savedRyform); + } else + $savedRyform = array(); + + $input .= '
      '._t('parameter').''._t('value').'
      '; + if ($savedRyform) { + foreach ($savedRyform as $id => $ryform) { + if (!is_object($ryform)) { + p('!!! ERROR !!!', $ryform); + continue; + } + $ryform->id = $id+1; + if (!isset($ryform->formName) || !$ryform->formName) + $ryform->formName = 'Element '.$id; + if (count($savedRyform) > 1) + $display_id = ''.strval(intval($id)+1).''; + else + $display_id = ''; + + $script_up = ($id != 0)?_l(_i('16/arrow_up', _t('up')), $url_params, array('ryform_name' => $parent_ryform_name.$deffullname.':'.$id, 'ryform_action' => 'up')).' ':''; + $script_down = ($id != count($savedRyform)-1)?_l(_i('16/arrow_down', _t('down')), $url_params, array('ryform_name' => $parent_ryform_name.$deffullname.':'.$id, 'ryform_action' => 'down')).' ':''; + + $icon = (isset(self::$ryformsIcons[get_class($ryform)]))?self::$ryformsIcons[get_class($ryform)]:_i('32/brick'); + $input .= _s('t row '.($id%2), + ''. + ''. + ''); + } + } + $input .= '
      '._l(($def->type == DEF_TYPE_RYFORM?_i('16/arrow_redo', _t('change')):_i('16/add', _t('add'))), $url_params, array('ryform_name' => $parent_ryform_name.$deffullname.':'.strval(intval($id)+1), 'ryform_action' => 'list')).' '.$display_id.''.$script_up.$script_down.' + + + +
      '.$icon.''. + _l($ryform->formName, $url_params, array('ryform_name' => $parent_ryform_name.$deffullname.':'.$id, 'ryform_action' => 'edit')).' '. + '
      '._t(get_class($ryform).'_short_description').'
      '.$ryform->getHtmlRepr().'
      '. + _l(_i('16/script_edit', _t('edit')), $url_params, array('ryform_name' => $parent_ryform_name.$deffullname.':'.$id, 'ryform_action' => 'edit')).' '. + _l(_i('16/script_code', _t('edit_source')), $url_params, array('ryform_name' => $parent_ryform_name.$deffullname.':'.$id, 'ryform_action' => 'source')).'      '. + _l(_i('16/script_delete', _t('del')), $url_params, array('ryform_name' => $parent_ryform_name.$deffullname.':'.$id, 'ryform_action' => 'del')).' 
      '; + if (count($savedRyform) == 0 || $def->type != DEF_TYPE_RYFORM) { + if (is_string($def->params)) + $infos = _l(_i('16/add', _t('add')), $url_params, array('new_ryform' => $def->params, 'ryform_name' => $parent_ryform_name.$deffullname.':0', 'ryform_action' => 'add')); + else + $infos = _l(_i('16/add', _t('add')), $url_params, array('ryform_name' => $parent_ryform_name.$deffullname.':0', 'ryform_action' => 'list')); + + if ($type == DEF_TYPE_RYFORMS_ARRAY) + $infos .= '   '._l(_i('16/application_form_add', _t('multiadd')), $url_params, array('ryform_name' => $deffullname, 'ryform_action' => 'list_multiadd')); + } + break; + + case DEF_TYPE_FUNCTION: + if (is_array($def->defaultValue)) + list($result_type, $value) = call_user_func_array($def->params, $def->defaultValue); + else + list($result_type, $value) = call_user_func($def->params); + if ($result_type == DATA_HTML_FORM) { + return array(DATA_HTML_FORM, $value); + } else { + unset($url_params[$deffullname.'_action']); + $input = $value; + } + break; + + default: + $input = ''.$value."\n"; + $hidden = true; + + } + + if ($hidden) + $ret .= $input; + else + { + if ($tmpl) { + $tmpl = str_replace('{'.$def->name.'}', 'ig?'color="orange" size="11"':'style="color:orange;"').'>'._t($def->prefixTrad.$def->name).'', $tmpl); + $tmpl = str_replace('{'.$def->name.'.input}', $input, $tmpl); + $tmpl = str_replace('{'.$def->name.'.infos}', $infos, $tmpl); + } else + $ret .= _s('t row '.strval($i % 2), ' '.(!$def->optional?'*':'').($def->superAdmin?'##':'').($def->admin?'#':'')._t($def->prefixTrad.$def->name).''.$input.''.$infos.'')."\n"; + $i++; + } + } + + if ($tmpl) { + $tmpl = str_replace('{submit.input}', '', $tmpl); + $ret .= $tmpl; + $ret .= ''._s('t row '.strval($i % 2), '').'
           '._t('required_fields').'
      '; + } else { + $ret .= _s('t row '.strval($i % 2), '     '._t('required_fields').''); + $ret .= ''; + } + $ret .= '

      '; + return array(DATA_HTML_FORM, $ret."\n"); + } + + + function doAction($url_params) { + if (!$url_params['ryform_name']) + return array(DATA_RYFORM_VALUE, array()); + $ret = ''; + $ryforms = explode('/', $url_params['ryform_name']); + $this_ryform_name = array_shift($ryforms); + list($ryform_name,$ryform_pos) = explode(':', $this_ryform_name); + if (!isset($this->defines[$ryform_name])) + return 'Bad ryform name'; + $def = $this->defines[$ryform_name]; + + if ($ryforms) { + $action = 'edit'; + $next_action = $url_params['ryform_action']; + } else { + $action = $url_params['ryform_action']; + $next_action = ''; + } + + switch ($action) { + case 'list': + if (isset($url_params['ryform_parent']) && $url_params['ryform_parent']) + $ryform_parent = $url_params['ryform_parent'].'/'; + else + $ryform_parent = ''; + $ret .= ''; + foreach ($def->params as $id => $ryform) { + if (is_array($ryform)) { + $ret .= _s('t row 1', ''); + foreach ($ryform as $subid => $subryform) { + $ret .= _s('t row '.($subid%2), ''); + } + } else + $ret .= _s('t row '.($id%2), ''); + } + $ret .= '
      '.ryzom_font(_t('ryform_cat_'.$id), '', '12').''.self::$ryformsIcons[$subryform].'  '. + _l(_t($subryform.'_short_description'), $url_params, array('ryform_name' => $ryform_parent.$url_params['ryform_name'], 'ryform_action' => 'add', 'new_ryform' => $subryform)).''.$subryform.''.self::$ryformsIcons[$ryform].'  '. + _l(_t($ryform.'_short_description'), $url_params, array('ryform_name' => $ryform_parent.$url_params['ryform_name'], 'ryform_action' => 'add', 'new_ryform' => $ryform)).''.$ryform.'
      '; + return array(DATA_HTML_FORM, $ret); + break; + + case 'list_multiadd': + // TODO + /* + unset($url_params[$deffullname.'_action']); + $ret .= ''; + foreach ($def->params as $ryform) { + $ret .= ''; + } + $ret .= '
      '._l($ryform, $url_params, array('ryform_action' => 'multiadd', 'new_ryform' => $ryform)).'
      '; + return array(DATA_HTML_FORM, $ret);*/ + break; + + case 'add': + $new_ryform = ryzom_get_param('new_ryform'); + $valid_ryform = false; + if ($new_ryform) { + + if ((is_string($def->params) && $new_ryform == $def->params) || in_array($new_ryform, $def->params)) + $valid_ryform = true; + else { + foreach ($def->params as $param) { + if (is_array($param) && in_array($new_ryform, $param)) + $valid_ryform = true; + } + } + if (!$valid_ryform) + return array(DATA_HTML_FORM, 'Bad ryform'); + + } else { + $new_ryform = $def->params; + } + $ryform = new $new_ryform($new_ryform, ''); + $ryform->preSerialization(); + if ($def->type != DEF_TYPE_RYFORM) { + p($def->value); + if (!is_array($def->value)) + $savedRyform = array($def->value); + else + $savedRyform = $def->value; + if ($ryform_pos === 0) { + $value = array_values(array_merge(array($ryform), $savedRyform)); + } else if ($ryform_pos !== NULL) { + $begin = array_slice($savedRyform, 0, $ryform_pos); + $end = array_slice($savedRyform, $ryform_pos, count($savedRyform)-$ryform_pos); + $value = array_values(array_merge($begin, array($ryform), $end)); + } else + $value[] = $ryform; + p($ryform_name, $value); + //return array(DATA_RYFORM_VALUE, array('stages' => array())); + return array(DATA_RYFORM_VALUE, array($ryform_name => $value)); + } else { + p($ryform_name, $ryform); + return array(DATA_RYFORM_VALUE, array($ryform_name => $ryform)); + } + break; + + case 'edit': + $a_ryforms = $def->value; + if (is_array($a_ryforms)) + $ryform = $a_ryforms[$ryform_pos]; + else + $ryform = $a_ryforms; + $ryform->postSerialization(); + $validate = isset($url_params['validate']) && $url_params['validate']; + + $form = new ryForm('', $def->name); + foreach ($ryform->getFormDefs() as $form_def) { + $form->addDefine($form_def); + $name = $form_def->name; + // Init form with ryfom values + if (property_exists($ryform, $name)) { + $form->addValue($form_def->name, $ryform->$name); + } + } + foreach ($ryform->getFormDefsExtraValues() as $def_name => $extra_values) + $form->addExtraValues($def_name, $extra_values); + $form->setTemplate($ryform->getTemplate()); + + list($result_type, $value) = $form->getForm(array('action' => $url_params['action'], 'script' => $url_params['script'], 'ryform_action' => $next_action, 'ryform_parent' => $this_ryform_name, 'ryform_name' => implode('/', $ryforms), 'validate' => $validate)); + if ($result_type == DATA_HTML_FORM) { + return array(DATA_HTML_FORM, $value); + } else { + if ($result_type == DATA_FORM_VALUES) + $value = $form->validateFormPost($value); + $ryform->setFormParams($value); + $ryform->preSerialization(); + + } + if (is_array($a_ryforms)) + $a_ryforms[$ryform_pos] = $ryform; + else + $a_ryforms = $ryform; + + $value = array($ryform_name => $a_ryforms); + return array(DATA_RYFORM_VALUE, $value); + break; + + + case 'del': + $id = $ryform_pos; + p($def->value); + if (!is_array($def->value)) + $def->value = array(); + else + unset($def->value[$id]); + $value = array_values($def->value); + return array(DATA_RYFORM_VALUE, array($ryform_name => $value)); + break; + + case 'up': + $a_ryforms = $def->value; + if (!is_array($a_ryforms)) + ryzom_redirect(_url($url_params, array('ryform_action' => ''))); + + $temp_ryform = $a_ryforms[$ryform_pos-1]; + $a_ryforms[$ryform_pos-1] = $a_ryforms[$ryform_pos]; + $a_ryforms[$ryform_pos] = $temp_ryform; + $a_ryforms = array_values($a_ryforms); + p($ryform_name, $a_ryforms); + return array(DATA_RYFORM_VALUE, array($ryform_name => $a_ryforms)); + break; + + case 'down': + $a_ryforms = $def->value; + if (!is_array($a_ryforms)) + ryzom_redirect(_url($url_params, array('ryform_action' => ''))); + + $temp_ryform = $a_ryforms[$ryform_pos+1]; + $a_ryforms[$ryform_pos+1] = $a_ryforms[$ryform_pos]; + $a_ryforms[$ryform_pos] = $temp_ryform; + $a_ryforms = array_values($a_ryforms); + return array(DATA_RYFORM_VALUE, array($ryform_name => $a_ryforms)); + break; + + case 'source': + $a_ryforms = $def->value; + if (is_array($a_ryforms)) + $ryform = $a_ryforms[$ryform_pos]; + else + $ryform = $a_ryforms; + $ryform->postSerialization(); + + $form = new ryForm('', $def->name); + $form->addDefine(new ryFormDef('ryform_source', DEF_TYPE_TEXTAREA, '', base64_encode(serialize($ryform)))); + $validate = isset($url_params['validate']) && $url_params['validate']; + list($result_type, $value) = $form->getForm(array('ryform_action' => $next_action, 'ryform_parent' => $this_ryform_name, 'ryform_name' => implode('/', $ryforms), 'validate' => $validate)); + if ($result_type == DATA_HTML_FORM) { + return array(DATA_HTML_FORM, $value); + } else { + if ($result_type == DATA_FORM_VALUES) + $params = $form->validateFormPost($value); + else + $params = $value; + $ryform = unserialize(base64_decode($params['ryform_source'])); + if (!is_object($ryform)) { + unset($url_params['validate']); + ryzom_redirect(_url($url_params, array('ryform_action' => '', 'message' => 'bad_paste'))); + } + + $is_valid = false; + p($def->params); + foreach ($def->params as $id => $ryform_class) { + if (is_array($ryform_class)) { + if (in_array(get_class($ryform), array_values($ryform_class))) + $is_valid = true; + } else if (get_class($ryform) == $ryform_class) + $is_valid = true; + } + if (!$is_valid) { + p(get_class($ryform), $def->params); + ryzom_redirect(_url($url_params, array($deffullname.'_action' => '', 'message' => 'not_valid_stage'))); + return; + } + if (is_array($a_ryforms)) + $a_ryforms[$ryform_pos] = $ryform; + else + $a_ryforms = $ryform; + $value = array($ryform_name => $a_ryforms); + return array(DATA_RYFORM_VALUE, $value); + } + return; + break; + } + + return $ret; + } + + function validateFormPost($params, $use_default=true) { + $final = array(); + foreach ($this->defines as $def) { + $name = $def->name; + if ($def->name == 'name') + $def->name = '_name'; + + $type = $def->type; + if ($def->hidden) + $type = DEF_TYPE_HIDDEN; + + if (isset($params[$def->name])) { + $value = $params[$def->name]; + } else if (!$use_default) { + continue; + } else { + $value = ''; + } + + + switch ($type) { + + case DEF_TYPE_HIDDEN: + case DEF_TYPE_TEXT: + case DEF_TYPE_OPTION: + case DEF_TYPE_TEXTAREA: + $final[$name] = $value; + break; + + case DEF_TYPE_TRAD: + if (!$value[_user()->lang] && $value['europeanunion']) + $value[_user()->lang] = $value['europeanunion']; + $final[$name] = $value; + break; + + case DEF_TYPE_NAMEID: + $final[$name] = cleanNameID($value); + break; + + case DEF_TYPE_COMBO: + $final[$name] = $value; + break; + + case DEF_TYPE_ID: + case DEF_TYPE_INT: // TODO + $final[$name] = intval($value); + break; + case DEF_TYPE_FLOAT: // TODO + $final[$name] = floatval($value); + break; + + case DEF_TYPE_BOOL: + $final[$name] = $value == 'on'; + break; + + case DEF_TYPE_RYFORM: + if (is_array($value)) + $final[$name] = $value[0]; + break; + case DEF_TYPE_RYFORMS_ARRAY: + break; + + default: + $final[$name] = $value; + + } + } + return $final; + } + +/* + function reset() { + + // Clean all temp files + $userDatas = _tools()->listAppDataFiles($this->dir); + foreach ($userDatas as $userData) { + if (substr($userData, 0, strlen($this->name)) == $this->name) + _tools()->saveAppData($this->dir.'/'.$userData, NULL); + } + }*/ +} + + +?> diff --git a/code/web/api/common/ryformBases.php b/code/web/api/common/ryformBases.php new file mode 100644 index 000000000..7592af511 --- /dev/null +++ b/code/web/api/common/ryformBases.php @@ -0,0 +1,177 @@ +. + */ + +define('DEF_TYPE_UNKNOWN', 0); +define('DEF_TYPE_HIDDEN', 1); +define('DEF_TYPE_TEXT', 2); +define('DEF_TYPE_ID', 3); +define('DEF_TYPE_INT', 4); +define('DEF_TYPE_FLOAT', 5); +define('DEF_TYPE_BOOL', 6); +define('DEF_TYPE_OPTION', 7); +define('DEF_TYPE_TEXTAREA', 8); +define('DEF_TYPE_TRAD', 9); +define('DEF_TYPE_FORM', 10); +define('DEF_TYPE_ICON', 11); +define('DEF_TYPE_RYFORM', 12); +define('DEF_TYPE_RYFORMS_ARRAY', 13); +define('DEF_TYPE_BBCODE', 14); +define('DEF_TYPE_FUNCTION', 15); +define('DEF_TYPE_COMBO', 16); +define('DEF_TYPE_OPTION_FUNCTION', 17); +define('DEF_TYPE_NAMEID', 18); +define('DEF_TYPE_COMBO_FUNCTION', 19); + +define('DEF_TYPE_ICON_UNKNOWN', 0); +define('DEF_TYPE_ICON_SHARED', 1); +define('DEF_TYPE_ICON_RYZITEM', 2); +define('DEF_TYPE_ICON_URL', 3); + +define('DATA_HTML_FORM', 0); +define('DATA_FORM_VALUES', 1); +define('DATA_FORM_VALID_VALUES', 2); +define('DATA_RYFORM_VALUE', 3); + +function cleanFormName($name) { + $final_name = ''; + for ($i=0; $i= ord('a')) && (ord(strtolower($c)) <= ord('z'))) || + (in_array($c, array('-', '.', '_'))) || + (ord(strtolower($c)) >= ord('0')) && (ord(strtolower($c)) <= ord('9')) ) + $final_name .= $c; + } + return $final_name; +} + +function cleanNameID($name) { + $final_name = ''; + for ($i=0; $i= ord('a')) && (ord(strtolower($c)) <= ord('z'))) || + (ord($c) >= ord('0')) && (ord($c) <= ord('9')) ) + $final_name .= $c; + } + return $final_name; +} + +function getNameId($name) { + return str_replace('_', ' ', $name); +} + +function getTrad($value) { + if ($value[_user()->lang]) + $trad = $value[_user()->lang]; + foreach (array('en', 'fr', 'de', 'ru', 'es') as $lang) { + if ($value[$lang]) { + $trad = $value[$lang]; + break; + } + } + if (substr($trad, 0, 2) == '//') + $trad = strstr(str_replace("\r", '', $trad), "\n"); + return substr($trad, 1); +} + +interface iRyForm { + function getForm($url_params); + function setFormParams($params); + function getHtmlRepr(); + function getFormDefs(); + function getFormDefsExtraValues(); + function preSerialization(); + function postSerialization($vars=array()); + function getTemplate(); +} + +class ryFormDef { + + public $name = ''; + public $type = DEF_TYPE_UNKNOWN; + public $params = array(); + public $infos = ''; + public $defaultValue = NULL; + public $value = NULL; + public $extraValues = array(); + public $hidden = false; + public $optional = false; + public $admin = false; + public $superAdmin = false; + public $prefixTrad = ''; + + function __construct($name, $type, $params=array(), $defaultValue=NULL, $optional=false, $infos='') { + $this->name = $name; + $this->type = $type; + $this->params = $params; + $this->defaultValue = $defaultValue; + $this->optional = $optional; + $this->infos = $infos; + } + +} + +class basicRyForm implements iRyForm { + public $formName = ''; // Used by Form + public $id = 0; + + function __construct($name, $title) { + } + + function getForm($url_params) { + $form = new ryForm($this->formName, $this->tools); + $form_defs = $this->getFormDefs(); + foreach ($form_defs as $def) + $form->addDefine($def); + return $form->getForm(_s('section', $this->formName.' ('.get_class($this).')')); + } + + function setFormParams($params) { + foreach ($params as $name => $value) { + if (property_exists($this, $name)) + $this->$name = $value; + } + } + + function getHtmlRepr() { + return $this->formName.' ('.get_class($this).')'; + } + + function getFormDefs() { + return array(); + } + + function getFormDefsExtraValues() { + return array(); + } + + function preSerialization() { + unset($this->tools); + } + + function postSerialization($vars=array()) { + } + + function getTemplate() { + return ''; + } +} + +?> diff --git a/code/web/api/common/time.php b/code/web/api/common/time.php new file mode 100644 index 000000000..9d2020efe --- /dev/null +++ b/code/web/api/common/time.php @@ -0,0 +1,130 @@ +. + */ + +/* Basic constants */ +/* 1 IG hour = 3 IRL minutes = 1800 ticks */ +define('RYTIME_HOUR_TICKS', 1800); +define('RYTIME_DAY_HOURS', 24); +define('RYTIME_SEASON_DAYS', 90); +define('RYTIME_MONTH_DAYS', 30); +define('RYTIME_CYCLE_MONTHS', 12); +define('RYTIME_JY_CYCLES', 4); +define('RYTIME_WEEK_DAYS', 6); +/* 0 = spring, 1 = summer, 2 = automn, 3 = winter */ +define('RYTIME_CYCLE_SEASONS', 4); +/* Tick is offset on server of 61 days. */ +define('RYTIME_TICK_OFFSET', 61 * RYTIME_DAY_HOURS * RYTIME_HOUR_TICKS); + +define('RYTIME_START_JY', 2568); + +/* Helpers */ +define('RYTIME_CYCLE_DAYS',RYTIME_CYCLE_MONTHS * RYTIME_MONTH_DAYS); +define('RYTIME_JY_DAYS', RYTIME_CYCLE_DAYS * RYTIME_JY_CYCLES); +define('RYTIME_JY_MONTHS', RYTIME_CYCLE_MONTHS * RYTIME_JY_CYCLES); + +// Takes a server tick and returns a computed array +function ryzom_time_array($tick) { + $out = array(); + $out["server_tick"] = $tick; + + $time_in_hours = ($tick-RYTIME_TICK_OFFSET) / RYTIME_HOUR_TICKS; + $day = $time_in_hours / RYTIME_DAY_HOURS; + + $out["jena_year"] = floor($day / RYTIME_JY_DAYS) + RYTIME_START_JY; + if ($day < 0) $day = RYTIME_JY_DAYS - abs($day) % RYTIME_JY_DAYS; + $out["day_of_jy"] = $day % RYTIME_JY_DAYS; + $out["month_of_jy"] = floor($out["day_of_jy"] / RYTIME_MONTH_DAYS); + + $out["cycle"] = floor($out["day_of_jy"] / RYTIME_CYCLE_DAYS); + $out["day_of_cycle"] = $day % RYTIME_CYCLE_DAYS; + $out["month_of_cycle"] = $out["month_of_jy"] % RYTIME_CYCLE_MONTHS; + + $out["day_of_month"] = $out["day_of_jy"] % RYTIME_MONTH_DAYS; + $out["day_of_week"] = $day % RYTIME_WEEK_DAYS; + + $out["season"] = ($day / RYTIME_SEASON_DAYS) % RYTIME_CYCLE_SEASONS; + $out["day_of_season"] = $day % RYTIME_SEASON_DAYS; + + $out["time_of_day"] = abs($time_in_hours) % RYTIME_DAY_HOURS; + if ($time_in_hours < 0 && $out["time_of_day"]) $out["time_of_day"] = RYTIME_DAY_HOURS - $out["time_of_day"]; + + return $out; +} + +function ryzom_time_xml_without_cache($rytime) { + $out = new SimpleXMLElement(''); + foreach($rytime as $key => $value) { + $out->addChild($key, $value); + } + return $out; +} + +/** + * Take number of the month (0-11) and returns its name + */ +function ryzom_month_name($month_number) { + if ($month_number < 0 || $month_number > 11) return "bad month"; + + $RYTIME_MONTHS = array( + 'Winderly', 'Germinally', 'Folially', 'Floris', + 'Medis', 'Thermis', 'Harvestor', 'Frutor', + 'Fallenor', 'Pluvia', 'Mystia', 'Nivia' + ); + + return $RYTIME_MONTHS[(int)$month_number]; +} + + +/** + * Take number of the day of week (0-5) and returns its name + */ +function ryzom_day_name($day_number) { + if ($day_number < 0 || $day_number > 5) return "bad day of week"; + + $RYTIME_DAYS = array( + 'Prima', 'Dua', 'Tria', + 'Quarta', 'Quinteth', 'Holeth' + ); + + return $RYTIME_DAYS[(int)$day_number]; +} + +/** + * Take a computed ryzom time array and returns the formatted date + * (Official 2004 Format without trailing JY) + */ +function ryzom_time_txt($rytime, $lang = "en") { + if ($lang != "en" && $lang != "fr" && $lang != "de") $lang = "en"; + + $RYTIME_AC = array( + "de" => array("1. AZ", "2. AZ", "3. AZ", "4. AZ"), + "en" => array("1st AC", "2nd AC", "3rd AC", "4th AC"), + "fr" => array("1er CA", "2e CA", "3e CA", "4e CA") + ); + + # Day, Month DayOfMonth, CycleNth AC JY + return sprintf("%sh - %s, %s %d, %s %d", + $rytime["time_of_day"], + ryzom_day_name($rytime["day_of_week"]), + ryzom_month_name($rytime["month_of_cycle"]), + $rytime["day_of_month"] + 1, + $RYTIME_AC[$lang][$rytime["cycle"]], + $rytime["jena_year"]); +} + +?> \ No newline at end of file diff --git a/code/web/api/common/user.php b/code/web/api/common/user.php index 62a2de0c8..ea6359454 100644 --- a/code/web/api/common/user.php +++ b/code/web/api/common/user.php @@ -1,3 +1,61 @@ . + */ + + +class ryUser { + private $infos; + + function __construct($infos) { + $this->infos = $infos; + } + + function __get($name) + { + if (array_key_exists($name, $this->infos)) { + return $this->infos[$name]; + } else { + /** TODO **/ + return NULL; + } + } + + function inGroup($groups) { + $groups = explode(':', $groups); + foreach ($groups as $group) { + if (in_array($group, $this->groups)) + return true; + } + return false; + } +} + +function ryzom_auth_user($ask_login=true, $welcome_message='') { + global $user, $_USER; + + $result = ryzom_app_authenticate($user, $ask_login, $welcome_message, true); + $_USER = new RyUser($user); + return $result; +} + +function _user() { + global $_USER; + return $_USER; +} + ?> diff --git a/code/web/api/common/utils.php b/code/web/api/common/utils.php index 9f12fdfc1..093a63ec0 100644 --- a/code/web/api/common/utils.php +++ b/code/web/api/common/utils.php @@ -1,6 +1,31 @@ . + */ + include_once('logger.php'); +include_once('dfm.php'); + +define('SERVER', 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']); + +if (ini_get('magic_quotes_gpc') == 1) { + $_POST = stripslashes_deep($_POST); + $_GET = stripslashes_deep($_GET); +} // Always use this function to get param because in game, the param can be pass by _GET or by _POST function ryzom_get_param($var, $default='') @@ -24,13 +49,30 @@ function parse_query($var) foreach($var as $val) { $x = explode('=', $val); - $arr[$x[0]] = urldecode($x[1]); + if (count($x) > 1) + $arr[$x[0]] = urldecode($x[1]); + else + $arr[$x[0]] = ''; } unset($val, $x, $var); } return $arr; } +function ryzom_get_params() +{ + if (!isset($GLOBALS['URL_PARAMS'])) + $GLOBALS['URL_PARAMS'] = parse_query($_SERVER['REQUEST_URI']); + return $GLOBALS['URL_PARAMS']; +} + +function ryzom_unset_url_param($name) { + if (!isset($GLOBALS['URL_PARAMS'])) + $GLOBALS['URL_PARAMS'] = parse_query($_SERVER['REQUEST_URI']); + unset($GLOBALS['URL_PARAMS'][$name]); + return $GLOBALS['URL_PARAMS']; +} + if (!function_exists('http_build_query')) { function http_build_query($data, $prefix='', $sep='', $key='') { $ret = array(); @@ -50,6 +92,55 @@ if (!function_exists('http_build_query')) { } } +if(!function_exists('_url')){ + function _url($base_params=null, $add_params=array()){ + if ($base_params !== null) + return SERVER.'?'.http_build_query(array_merge($base_params, $add_params)); + else + return SERVER; + } +} + + +if(!function_exists('_h')){ + function _h($s){ + return htmlspecialchars($s, ENT_QUOTES, 'UTF-8'); + } +} + +if(!function_exists('_i')){ + function _i($img, $alt=''){ + if (substr($img, strlen($img)-4) == '.tga') // img from client texture : ig only + return $img; + + if (is_file(RYAPI_PATH.'/data/icons/'.$img.'.png')) + $img = RYAPI_URL.'/data/icons/'.$img.'.png'; + else if (is_file(RYAPP_PATH.'/data/icons/'.$img.'.png')) + $img = RYAPP_URL.'/data/icons/'.$img.'.png'; + else + $img = 'view_remove'; + + if ($alt) + return ''.utf8_decode($alt).''; + else + return ''; + + } +} + +if(!function_exists('_l')){ + function _l($text, $base_params=array(), $add_params=array()) + { + return ''.$text.''; + } +} + +if(!function_exists('_b')){ + function _b($text, $base_params=array(), $add_params=array()) + { + return ''.$text.''; + } +} /*** * @@ -66,8 +157,10 @@ function translation_exists($id) { function get_translation($id, $lang, $args=array()) { global $ryzom_texts, $user; if(!isset($ryzom_texts[$id])) return '{'.$id.'}'; - if(!isset($ryzom_texts[$id][$lang])) return '{'.$id.'['.$lang.']}'; - if($ryzom_texts[$id][$lang] == '' && isset($ryzom_texts[$id]['en'])) return @vsprintf($ryzom_texts[$id]['en'], $args); + if(empty($ryzom_texts[$id][$lang])){ + if(isset($ryzom_texts[$id]['en'])) return @vsprintf($ryzom_texts[$id]['en'], $args); + return '{'.$id.'['.$lang.']}'; + } return @vsprintf($ryzom_texts[$id][$lang], $args); } @@ -87,10 +180,12 @@ function _t($id, $args=array()) { $a = ' '.strval($args); } if(!isset($ryzom_texts[$id])) return '{'.$id.$a.'}'; - if(!isset($ryzom_texts[$id][$user['lang']])) return '{'.$id.'['.$user['lang'].']'.$a.'}'; - if($ryzom_texts[$id][$user['lang']] == '' && isset($ryzom_texts[$id]['en']) && $ryzom_texts[$id]['en'] != '') return @vsprintf($ryzom_texts[$id]['en'], $args); - if($ryzom_texts[$id][$user['lang']] == '' && isset($ryzom_texts[$id]['fr']) && $ryzom_texts[$id]['fr'] != '') return '{'.$id.$a.'}'; - if($ryzom_texts[$id][$user['lang']] == '' && isset($ryzom_texts[$id]['de']) && $ryzom_texts[$id]['de'] != '') return '{'.$id.$a.'}'; + if(empty($ryzom_texts[$id][$user['lang']])){ + if(!empty($ryzom_texts[$id]['en'])) return @vsprintf($ryzom_texts[$id]['en'], $args); + if(!empty($ryzom_texts[$id]['fr'])) return '{'.$id.$a.'}'; + if(!empty($ryzom_texts[$id]['de'])) return '{'.$id.$a.'}'; + return '{'.$id.'['.$user['lang'].']'.$a.'}'; + } return @vsprintf($ryzom_texts[$id][$user['lang']], $args); } @@ -100,7 +195,20 @@ function _t($id, $args=array()) { * * ***/ - +function ryzom_timer($timestamp) { + $d = intval($timestamp / 86400); + $timestamp = $timestamp % 86400; + $h = intval($timestamp / 3600); + $timestamp = $timestamp % 3600; + $m = intval($timestamp / 60); + $s = $timestamp % 60; + if ($d>1) + return sprintf('%d'._t('days').' %02d:%02d:%02d', $d, $h, $m, $s); + else if ($d) + return sprintf('%d'._t('day').' %02d:%02d:%02d', $d, $h, $m, $s); + else + return sprintf("%02d:%02d:%02d", $h, $m, $s); +} // Get a human and translated readable time, for example "3 days ago" function ryzom_relative_time($timestamp) { @@ -133,7 +241,10 @@ function ryzom_relative_time($timestamp) { } } - $final = $ryzom_periods[$user['lang']][$form][$j]; + if(!empty($ryzom_periods[$user['lang']][$form][$j])) + $final = $ryzom_periods[$user['lang']][$form][$j]; + else + $final = $ryzom_periods['en'][$form][$j]; $text = _t('date_format', array($difference, $final, $ending)); return $text; } @@ -150,33 +261,193 @@ function ryzom_absolute_time($timestamp) { return $text; } + +/*** + * + * Ryzom utilities + * + * + * ***/ + +function ryzom_generate_password($length=8, $level=2, $oneofeach=false) { + $validchars[1] = "0123456789abcdfghjkmnpqrstvwxyz"; + $validchars[2] = "0123456789abcdfghjkmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + $validchars[3] = "0123456789_!@#$%&*()-=+/abcdfghjkmnpqrstvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_!@#$%&*()-=+/"; + + $password = ""; + $counter = 0; + + while ($counter < $length) { + $actChar = substr($validchars[$level], rand(0, strlen($validchars[$level])-1), 1); + + // if $oneofeach then All character must be different (slower) + if (!$oneofeach || !strstr($password, $actChar)) { + $password .= $actChar; + $counter++; + } + } + + return $password; +} + + +function file_get_contents_cached($fn, $cache_time=300) { + global $ryzom_bench_text; + + $lfn = 'tmp/'.strtr($fn, ':/.?&=', '____________'); + + // get the new file from internet every $cache_time (default=5min) + if (file_exists($lfn) && filesize($lfn) > 0 && time() < filemtime($lfn) + $cache_time) { + $content = file_get_contents($lfn); + } else { + $content = file_get_contents($fn); + if ($content != '') file_put_contents($lfn, $content); + } + return $content; +} + +function ryzom_redirect($url, $group='webig', $extra_lua='') { + global $user; + $lua = $extra_lua."\n"; + if ($user['ig']) { + if (!$group) + $lua .= 'getUI(__CURRENT_WINDOW__):browse("'.str_replace('&', '&', $url).'")'; + else + $lua .= 'getUI("ui:interface:'.$group.':content:html"):browse("'.str_replace('&', '&', $url).'")'; + echo ''.$lua.''; + exit(); + } else { + header('Location: '.$url); + exit(); + } +} + /*** * * Debug tools * * ***/ -function p($var, $value=NULL) { +function alert($var, $value=NULL, $level=1) { + p($var, $value, '#FF7777', $level); +} + +define('pNULL', '§$£¤*µ%ù²&#!;,;:.?/?.<>'); + +function p($var, $value=pNULL, $color='#FFFF00', $level=0) { ob_start(); debug_print_backtrace(); $bt = ob_get_contents(); ob_end_clean(); - $bt = explode("\n",$bt); - $bt = explode('[', $bt[1]); - ob_start(); - echo ''.substr($bt[count($bt)-1], 0, -1)."\n"; - if ($value !== NULL) { - echo ''.$var.' : '; + $bt = explode("\n#",$bt); + if (isset($bt[$level])) + $bt1 = explode('[', $bt[$level]); + else + $bt1 = array(''); + + if (isset($bt[$level+1])) + $bt2 = explode('[', $bt[$level+1]); + else + $bt2 = array(''); + + $c = ''; + if ($value !== pNULL) { + $c .= ''.$var.' : '; $var = $value; } - //if (is_array($var)) - echo '
      ';
      -	print_r($var);
      -	echo '
      '; -// else - // var_dump($var); - ryLogger::getInstance()->addPrint(ob_get_contents()); + $c .= ''.substr(str_replace("\n", "", $bt2[count($bt2)-1]), 0, -1).' => '.substr(str_replace("\n", "", $bt1[count($bt1)-1]), 0, -1)." "; + ryLogger::getInstance()->addPrint($c); + ob_start(); + var_dump($var); + ryLogger::getInstance()->addPrint(_h(ob_get_contents()), $color); ob_end_clean(); } + +/*** + * + * Lua tools + * + * ***/ + + class ryLua { + + static private $lua = array(); + static private $luaend = array(); + static private $indent; + static private $indentend; + static private $linkTargetId = 0; + + static function add($code, $indent=NULL) { + if ($indent !== NULL) + self::$indent += $indent; + $tabs = str_repeat(" ", self::$indent); + $a = $tabs.str_replace("\n", "\n ".$tabs, $code); + self::$lua[] = $a; + } + + static function addEnd($code, $indent=NULL) { + if ($indent !== NULL) + self::$indentend += $indent; + $tabs = str_repeat(" ", self::$indentend); + $a = $tabs.str_replace("\n", "\n ".$tabs, $code); + self::$luaend[] = $a; + } + + + static function get($ig) { + ryLogger::getInstance()->addPrint(implode("\n", self::$lua), '#FF00FF'); + $ret = ($ig)?"\n".implode("\n", self::$lua)."\n":''; + self::$lua = array(); + return $ret; + } + + static function getEnd($ig) { + ryLogger::getInstance()->addPrint(implode("\n", self::$luaend), '#FF55FF'); + $ret = ($ig)?"\n".implode("\n", self::$luaend)."\n":''; + self::$luaend = array(); + return $ret; + } + + static function url($base_params=null, $add_params=array()) { + return str_replace('&', '&', _url($base_params, $add_params)); + } + + + function openLink($text, $target='webig', $base_params=array(), $add_params=array(), $urllua='', $runlua='') + { + $url = self::url($base_params, $add_params); + if ($target == "help_browser") + $url .= "&ignore="; + $id = ryzom_generate_password(8).strval(time()).strval(self::$linkTargetId++); + $lua = <<< END +function openLink{$id}() + runAH(nil, "browse", "name=ui:interface:{$target}:content:html|url={$url}"{$urllua}) + {$runlua} +end +END; + self::add($lua); + if (RYZOM_IG) + return ''.$text.''; + return $text; + } + + static function link($id, $luacode, $text) { + $lua = <<'.$text.''; + return $text; + } + +} + + + + + ?> diff --git a/code/web/api/common/xml_utils.php b/code/web/api/common/xml_utils.php new file mode 100644 index 000000000..28d166866 --- /dev/null +++ b/code/web/api/common/xml_utils.php @@ -0,0 +1,23 @@ +. + */ + +function ryzom_display_xml_header() { + header('Content-Type: application/xml; charset=UTF-8'); +} + +?> \ No newline at end of file diff --git a/code/web/api/data/css/ryzom_ui.css b/code/web/api/data/css/ryzom_ui.css index 8342b77f8..8b8e9ed37 100644 --- a/code/web/api/data/css/ryzom_ui.css +++ b/code/web/api/data/css/ryzom_ui.css @@ -33,14 +33,18 @@ color: white; } .ryzom-ui input, .ryzom-ui select { - border-top: 1px solid #030403; - border-right: 1px solid #6e7f57; - border-bottom: 1px solid #889e6c; - border-left: 1px solid #272d1f; - background-color: #37402b; - color: #ddd; + border-bottom: 1px solid #7B7E80; + border-left: 1px solid #7B7E80; + border-top: 1px solid #101010; + border-right: 1px solid #101010; + background-color: #1D1D1D; + border-radius: 3px; + color: #BBB; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; font-size: 12px; margin: 2px 0 5px 0; + padding: 1px; } .ryzom-ui input[type=text] { width: 100%; @@ -52,27 +56,43 @@ /* input[type=submit] will make IE6 to ignore whole CSS rule, so cant combine this with .ryzom-ui-button below */ input[type=submit] { - border-bottom: 1px solid #030403; - border-left: 1px solid #6e7f57; - border-top: 1px solid #889e6c; - border-right: 1px solid #272d1f; - background-color: #435120; + border-bottom: 1px solid #7B7E80; + border-left: 1px solid #7B7E80; + border-top: 1px solid #7B7E80; + border-right: 1px solid #7B7E80; + background-color: #232323; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + color: #BBB; +} +input[type=submit]:hover { + border-bottom: 1px solid #FFFFFF; + border-left: 1px solid #FFFFFF; + border-top: 1px solid #FFFFFF; + border-right: 1px solid #FFFFFF; + color: #FFF; } input.ryzom-ui-button, .ryzom-ui-button { - border-bottom: 1px solid #030403; - border-left: 1px solid #6e7f57; - border-top: 1px solid #889e6c; - border-right: 1px solid #272d1f; - background-color: #435120; + border-bottom: 1px solid #7B7E80; + border-left: 1px solid #7B7E80; + border-top: 1px solid #7B7E80; + border-right: 1px solid #7B7E80; + background-color: #232323; + border-radius: 3px; + color: #BBB; } a.ryzom-ui-button, a.ryzom-ui-button:visited { - color: white; - padding: 0 .5em; + color: #DDD; + padding: .2em .5em; text-decoration: none; } a.ryzom-ui-button:hover { - background: #536130; - color: #ddd; + border-bottom: 1px solid #FFFFFF; + border-left: 1px solid #FFFFFF; + border-top: 1px solid #FFFFFF; + border-right: 1px solid #FFFFFF; + color: #FFF; } /* window without title - just borders */ .ryzom-ui-tl { diff --git a/code/web/api/data/icons/add_app.png b/code/web/api/data/icons/add_app.png new file mode 100755 index 000000000..12cfb5546 Binary files /dev/null and b/code/web/api/data/icons/add_app.png differ diff --git a/code/web/api/data/icons/edit.png b/code/web/api/data/icons/edit.png new file mode 100644 index 000000000..315b5d8b4 Binary files /dev/null and b/code/web/api/data/icons/edit.png differ diff --git a/code/web/api/data/icons/edit_16.png b/code/web/api/data/icons/edit_16.png new file mode 100644 index 000000000..9a0dd7a37 Binary files /dev/null and b/code/web/api/data/icons/edit_16.png differ diff --git a/code/web/api/data/icons/no_action.png b/code/web/api/data/icons/no_action.png new file mode 100755 index 000000000..93aef43b3 Binary files /dev/null and b/code/web/api/data/icons/no_action.png differ diff --git a/code/web/api/data/icons/spe_com.png b/code/web/api/data/icons/spe_com.png new file mode 100644 index 000000000..9e3f48ecc Binary files /dev/null and b/code/web/api/data/icons/spe_com.png differ diff --git a/code/web/api/data/img/bordure.png b/code/web/api/data/img/bordure.png new file mode 100644 index 000000000..6c8da76f6 Binary files /dev/null and b/code/web/api/data/img/bordure.png differ diff --git a/code/web/api/data/img/lang/de.png b/code/web/api/data/img/lang/de.png index 767abe088..787c68830 100644 Binary files a/code/web/api/data/img/lang/de.png and b/code/web/api/data/img/lang/de.png differ diff --git a/code/web/api/data/img/lang/en.png b/code/web/api/data/img/lang/en.png index 2673310cc..6505dc41b 100644 Binary files a/code/web/api/data/img/lang/en.png and b/code/web/api/data/img/lang/en.png differ diff --git a/code/web/api/data/img/lang/es.png b/code/web/api/data/img/lang/es.png new file mode 100644 index 000000000..a2e450fbc Binary files /dev/null and b/code/web/api/data/img/lang/es.png differ diff --git a/code/web/api/data/img/lang/fr.png b/code/web/api/data/img/lang/fr.png index 420474693..60ed561d4 100644 Binary files a/code/web/api/data/img/lang/fr.png and b/code/web/api/data/img/lang/fr.png differ diff --git a/code/web/api/data/img/lang/ru.png b/code/web/api/data/img/lang/ru.png index 53aaf57be..281cf66f2 100644 Binary files a/code/web/api/data/img/lang/ru.png and b/code/web/api/data/img/lang/ru.png differ diff --git a/code/web/api/data/js/combobox.js b/code/web/api/data/js/combobox.js new file mode 100644 index 000000000..0a9440909 --- /dev/null +++ b/code/web/api/data/js/combobox.js @@ -0,0 +1,17 @@ + +function comboInit(thelist) +{ + theinput = document.getElementById(theinput); + var idx = thelist.selectedIndex; + var content = thelist.options[idx].value; + if(theinput.value == "") + theinput.value = content; +} + +function combo(thelist, theinput) +{ + theinput = document.getElementById(theinput); + var idx = thelist.selectedIndex; + var content = thelist.options[idx].value; + theinput.value = content; +} diff --git a/code/web/api/data/js/jquery-1.7.1.js b/code/web/api/data/js/jquery-1.7.1.js new file mode 100644 index 000000000..8ccd0ea78 --- /dev/null +++ b/code/web/api/data/js/jquery-1.7.1.js @@ -0,0 +1,9266 @@ +/*! + * jQuery JavaScript Library v1.7.1 + * http://jquery.com/ + * + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Mon Nov 21 21:11:03 2011 -0500 + */ +(function( window, undefined ) { + +// Use the correct document accordingly with window argument (sandbox) +var document = window.document, + navigator = window.navigator, + location = window.location; +var jQuery = (function() { + +// Define a local copy of jQuery +var jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // A central reference to the root jQuery(document) + rootjQuery, + + // A simple way to check for HTML strings or ID strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, + + // Check if a string has a non-whitespace character in it + rnotwhite = /\S/, + + // Used for trimming whitespace + trimLeft = /^\s+/, + trimRight = /\s+$/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, + rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + + // Useragent RegExp + rwebkit = /(webkit)[ \/]([\w.]+)/, + ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, + rmsie = /(msie) ([\w.]+)/, + rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, + + // Matches dashed string for camelizing + rdashAlpha = /-([a-z]|[0-9])/ig, + rmsPrefix = /^-ms-/, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return ( letter + "" ).toUpperCase(); + }, + + // Keep a UserAgent string for use with jQuery.browser + userAgent = navigator.userAgent, + + // For matching the engine and version of the browser + browserMatch, + + // The deferred used on DOM ready + readyList, + + // The ready event handler + DOMContentLoaded, + + // Save a reference to some core methods + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty, + push = Array.prototype.push, + slice = Array.prototype.slice, + trim = String.prototype.trim, + indexOf = Array.prototype.indexOf, + + // [[Class]] -> type pairs + class2type = {}; + +jQuery.fn = jQuery.prototype = { + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem, ret, doc; + + // Handle $(""), $(null), or $(undefined) + if ( !selector ) { + return this; + } + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + } + + // The body element only exists once, optimize finding it + if ( selector === "body" && !context && document.body ) { + this.context = document; + this[0] = document.body; + this.selector = selector; + this.length = 1; + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + // Are we dealing with HTML string or an ID? + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = quickExpr.exec( selector ); + } + + // Verify a match, and that no context was specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + doc = ( context ? context.ownerDocument || context : document ); + + // If a single string is passed in and it's a single tag + // just do a createElement and skip the rest + ret = rsingleTag.exec( selector ); + + if ( ret ) { + if ( jQuery.isPlainObject( context ) ) { + selector = [ document.createElement( ret[1] ) ]; + jQuery.fn.attr.call( selector, context, true ); + + } else { + selector = [ doc.createElement( ret[1] ) ]; + } + + } else { + ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); + selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; + } + + return jQuery.merge( this, selector ); + + // HANDLE: $("#id") + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The current version of jQuery being used + jquery: "1.7.1", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return slice.call( this, 0 ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems, name, selector ) { + // Build a new jQuery matched element set + var ret = this.constructor(); + + if ( jQuery.isArray( elems ) ) { + push.apply( ret, elems ); + + } else { + jQuery.merge( ret, elems ); + } + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + ret.context = this.context; + + if ( name === "find" ) { + ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; + } else if ( name ) { + ret.selector = this.selector + "." + name + "(" + selector + ")"; + } + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Attach the listeners + jQuery.bindReady(); + + // Add the callback + readyList.add( fn ); + + return this; + }, + + eq: function( i ) { + i = +i; + return i === -1 ? + this.slice( i ) : + this.slice( i, i + 1 ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ), + "slice", slice.call(arguments).join(",") ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + // Either a released hold or an DOMready/load event and not yet ready + if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready, 1 ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.fireWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger( "ready" ).off( "ready" ); + } + } + }, + + bindReady: function() { + if ( readyList ) { + return; + } + + readyList = jQuery.Callbacks( "once memory" ); + + // Catch cases where $(document).ready() is called after the + // browser event has already occurred. + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + return setTimeout( jQuery.ready, 1 ); + } + + // Mozilla, Opera and webkit nightlies currently support this event + if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", jQuery.ready, false ); + + // If IE event model is used + } else if ( document.attachEvent ) { + // ensure firing before onload, + // maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", DOMContentLoaded ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", jQuery.ready ); + + // If IE and not a frame + // continually check to see if the document is ready + var toplevel = false; + + try { + toplevel = window.frameElement == null; + } catch(e) {} + + if ( document.documentElement.doScroll && toplevel ) { + doScrollCheck(); + } + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + // A crude way of determining if an object is a window + isWindow: function( obj ) { + return obj && typeof obj === "object" && "setInterval" in obj; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + return obj == null ? + String( obj ) : + class2type[ toString.call(obj) ] || "object"; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !hasOwn.call(obj, "constructor") && + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + for ( var name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + parseJSON: function( data ) { + if ( typeof data !== "string" || !data ) { + return null; + } + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + + } + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + var xml, tmp; + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && rnotwhite.test( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); + }, + + // args is for internal usage only + each: function( object, callback, args ) { + var name, i = 0, + length = object.length, + isObj = length === undefined || jQuery.isFunction( object ); + + if ( args ) { + if ( isObj ) { + for ( name in object ) { + if ( callback.apply( object[ name ], args ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.apply( object[ i++ ], args ) === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isObj ) { + for ( name in object ) { + if ( callback.call( object[ name ], name, object[ name ] ) === false ) { + break; + } + } + } else { + for ( ; i < length; ) { + if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { + break; + } + } + } + } + + return object; + }, + + // Use native String.trim function wherever possible + trim: trim ? + function( text ) { + return text == null ? + "" : + trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); + }, + + // results is for internal usage only + makeArray: function( array, results ) { + var ret = results || []; + + if ( array != null ) { + // The window, strings (and functions) also have 'length' + // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 + var type = jQuery.type( array ); + + if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { + push.call( ret, array ); + } else { + jQuery.merge( ret, array ); + } + } + + return ret; + }, + + inArray: function( elem, array, i ) { + var len; + + if ( array ) { + if ( indexOf ) { + return indexOf.call( array, elem, i ); + } + + len = array.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in array && array[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var i = first.length, + j = 0; + + if ( typeof second.length === "number" ) { + for ( var l = second.length; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var ret = [], retVal; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( var i = 0, length = elems.length; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, key, ret = [], + i = 0, + length = elems.length, + // jquery objects are treated as arrays + isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( key in elems ) { + value = callback( elems[ key ], key, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return ret.concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + if ( typeof context === "string" ) { + var tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + var args = slice.call( arguments, 2 ), + proxy = function() { + return fn.apply( context, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; + + return proxy; + }, + + // Mutifunctional method to get and set values to a collection + // The value/s can optionally be executed if it's a function + access: function( elems, key, value, exec, fn, pass ) { + var length = elems.length; + + // Setting many attributes + if ( typeof key === "object" ) { + for ( var k in key ) { + jQuery.access( elems, k, key[k], exec, fn, value ); + } + return elems; + } + + // Setting one attribute + if ( value !== undefined ) { + // Optionally, function values get executed if exec is true + exec = !pass && exec && jQuery.isFunction(value); + + for ( var i = 0; i < length; i++ ) { + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); + } + + return elems; + } + + // Getting an attribute + return length ? fn( elems[0], key ) : undefined; + }, + + now: function() { + return ( new Date() ).getTime(); + }, + + // Use of jQuery.browser is frowned upon. + // More details: http://docs.jquery.com/Utilities/jQuery.browser + uaMatch: function( ua ) { + ua = ua.toLowerCase(); + + var match = rwebkit.exec( ua ) || + ropera.exec( ua ) || + rmsie.exec( ua ) || + ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || + []; + + return { browser: match[1] || "", version: match[2] || "0" }; + }, + + sub: function() { + function jQuerySub( selector, context ) { + return new jQuerySub.fn.init( selector, context ); + } + jQuery.extend( true, jQuerySub, this ); + jQuerySub.superclass = this; + jQuerySub.fn = jQuerySub.prototype = this(); + jQuerySub.fn.constructor = jQuerySub; + jQuerySub.sub = this.sub; + jQuerySub.fn.init = function init( selector, context ) { + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { + context = jQuerySub( context ); + } + + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); + }; + jQuerySub.fn.init.prototype = jQuerySub.fn; + var rootjQuerySub = jQuerySub(document); + return jQuerySub; + }, + + browser: {} +}); + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +browserMatch = jQuery.uaMatch( userAgent ); +if ( browserMatch.browser ) { + jQuery.browser[ browserMatch.browser ] = true; + jQuery.browser.version = browserMatch.version; +} + +// Deprecated, use jQuery.browser.webkit instead +if ( jQuery.browser.webkit ) { + jQuery.browser.safari = true; +} + +// IE doesn't match non-breaking spaces with \s +if ( rnotwhite.test( "\xA0" ) ) { + trimLeft = /^[\s\xA0]+/; + trimRight = /[\s\xA0]+$/; +} + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); + +// Cleanup functions for the document ready method +if ( document.addEventListener ) { + DOMContentLoaded = function() { + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); + jQuery.ready(); + }; + +} else if ( document.attachEvent ) { + DOMContentLoaded = function() { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( document.readyState === "complete" ) { + document.detachEvent( "onreadystatechange", DOMContentLoaded ); + jQuery.ready(); + } + }; +} + +// The DOM ready check for Internet Explorer +function doScrollCheck() { + if ( jQuery.isReady ) { + return; + } + + try { + // If IE is used, use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + document.documentElement.doScroll("left"); + } catch(e) { + setTimeout( doScrollCheck, 1 ); + return; + } + + // and execute any waiting functions + jQuery.ready(); +} + +return jQuery; + +})(); + + +// String to Object flags format cache +var flagsCache = {}; + +// Convert String-formatted flags into Object-formatted ones and store in cache +function createFlags( flags ) { + var object = flagsCache[ flags ] = {}, + i, length; + flags = flags.split( /\s+/ ); + for ( i = 0, length = flags.length; i < length; i++ ) { + object[ flags[i] ] = true; + } + return object; +} + +/* + * Create a callback list using the following parameters: + * + * flags: an optional list of space-separated flags that will change how + * the callback list behaves + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible flags: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( flags ) { + + // Convert flags from String-formatted to Object-formatted + // (we check in cache first) + flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; + + var // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = [], + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list is currently firing + firing, + // First callback to fire (used internally by add and fireWith) + firingStart, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // Add one or several callbacks to the list + add = function( args ) { + var i, + length, + elem, + type, + actual; + for ( i = 0, length = args.length; i < length; i++ ) { + elem = args[ i ]; + type = jQuery.type( elem ); + if ( type === "array" ) { + // Inspect recursively + add( elem ); + } else if ( type === "function" ) { + // Add if not in unique mode and callback is not in + if ( !flags.unique || !self.has( elem ) ) { + list.push( elem ); + } + } + } + }, + // Fire callbacks + fire = function( context, args ) { + args = args || []; + memory = !flags.memory || [ context, args ]; + firing = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { + memory = true; // Mark as halted + break; + } + } + firing = false; + if ( list ) { + if ( !flags.once ) { + if ( stack && stack.length ) { + memory = stack.shift(); + self.fireWith( memory[ 0 ], memory[ 1 ] ); + } + } else if ( memory === true ) { + self.disable(); + } else { + list = []; + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + var length = list.length; + add( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away, unless previous + // firing was halted (stopOnFalse) + } else if ( memory && memory !== true ) { + firingStart = length; + fire( memory[ 0 ], memory[ 1 ] ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + var args = arguments, + argIndex = 0, + argLength = args.length; + for ( ; argIndex < argLength ; argIndex++ ) { + for ( var i = 0; i < list.length; i++ ) { + if ( args[ argIndex ] === list[ i ] ) { + // Handle firingIndex and firingLength + if ( firing ) { + if ( i <= firingLength ) { + firingLength--; + if ( i <= firingIndex ) { + firingIndex--; + } + } + } + // Remove the element + list.splice( i--, 1 ); + // If we have some unicity property then + // we only need to do this once + if ( flags.unique ) { + break; + } + } + } + } + } + return this; + }, + // Control if a given callback is in the list + has: function( fn ) { + if ( list ) { + var i = 0, + length = list.length; + for ( ; i < length; i++ ) { + if ( fn === list[ i ] ) { + return true; + } + } + } + return false; + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory || memory === true ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( stack ) { + if ( firing ) { + if ( !flags.once ) { + stack.push( [ context, args ] ); + } + } else if ( !( flags.once && memory ) ) { + fire( context, args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!memory; + } + }; + + return self; +}; + + + + +var // Static reference to slice + sliceDeferred = [].slice; + +jQuery.extend({ + + Deferred: function( func ) { + var doneList = jQuery.Callbacks( "once memory" ), + failList = jQuery.Callbacks( "once memory" ), + progressList = jQuery.Callbacks( "memory" ), + state = "pending", + lists = { + resolve: doneList, + reject: failList, + notify: progressList + }, + promise = { + done: doneList.add, + fail: failList.add, + progress: progressList.add, + + state: function() { + return state; + }, + + // Deprecated + isResolved: doneList.fired, + isRejected: failList.fired, + + then: function( doneCallbacks, failCallbacks, progressCallbacks ) { + deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); + return this; + }, + always: function() { + deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); + return this; + }, + pipe: function( fnDone, fnFail, fnProgress ) { + return jQuery.Deferred(function( newDefer ) { + jQuery.each( { + done: [ fnDone, "resolve" ], + fail: [ fnFail, "reject" ], + progress: [ fnProgress, "notify" ] + }, function( handler, data ) { + var fn = data[ 0 ], + action = data[ 1 ], + returned; + if ( jQuery.isFunction( fn ) ) { + deferred[ handler ](function() { + returned = fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); + } + }); + } else { + deferred[ handler ]( newDefer[ action ] ); + } + }); + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + if ( obj == null ) { + obj = promise; + } else { + for ( var key in promise ) { + obj[ key ] = promise[ key ]; + } + } + return obj; + } + }, + deferred = promise.promise({}), + key; + + for ( key in lists ) { + deferred[ key ] = lists[ key ].fire; + deferred[ key + "With" ] = lists[ key ].fireWith; + } + + // Handle state + deferred.done( function() { + state = "resolved"; + }, failList.disable, progressList.lock ).fail( function() { + state = "rejected"; + }, doneList.disable, progressList.lock ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( firstParam ) { + var args = sliceDeferred.call( arguments, 0 ), + i = 0, + length = args.length, + pValues = new Array( length ), + count = length, + pCount = length, + deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? + firstParam : + jQuery.Deferred(), + promise = deferred.promise(); + function resolveFunc( i ) { + return function( value ) { + args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; + if ( !( --count ) ) { + deferred.resolveWith( deferred, args ); + } + }; + } + function progressFunc( i ) { + return function( value ) { + pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; + deferred.notifyWith( promise, pValues ); + }; + } + if ( length > 1 ) { + for ( ; i < length; i++ ) { + if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { + args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); + } else { + --count; + } + } + if ( !count ) { + deferred.resolveWith( deferred, args ); + } + } else if ( deferred !== firstParam ) { + deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); + } + return promise; + } +}); + + + + +jQuery.support = (function() { + + var support, + all, + a, + select, + opt, + input, + marginDiv, + fragment, + tds, + events, + eventName, + i, + isSupported, + div = document.createElement( "div" ), + documentElement = document.documentElement; + + // Preliminary tests + div.setAttribute("className", "t"); + div.innerHTML = "
      a"; + + all = div.getElementsByTagName( "*" ); + a = div.getElementsByTagName( "a" )[ 0 ]; + + // Can't get basic test support + if ( !all || !all.length || !a ) { + return {}; + } + + // First batch of supports tests + select = document.createElement( "select" ); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName( "input" )[ 0 ]; + + support = { + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: ( div.firstChild.nodeType === 3 ), + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: ( a.getAttribute("href") === "/a" ), + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.55/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Make sure that if no value is specified for a checkbox + // that it defaults to "on". + // (WebKit defaults to "" instead) + checkOn: ( input.value === "on" ), + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // Tests for enctype support on a form(#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", + + // Will be defined later + submitBubbles: true, + changeBubbles: true, + focusinBubbles: false, + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true + }; + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Test to see if it's possible to delete an expando from an element + // Fails in Internet Explorer + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { + div.attachEvent( "onclick", function() { + // Cloning a node shouldn't copy over any + // bound event handlers (IE does this) + support.noCloneEvent = false; + }); + div.cloneNode( true ).fireEvent( "onclick" ); + } + + // Check if a radio maintains its value + // after being appended to the DOM + input = document.createElement("input"); + input.value = "t"; + input.setAttribute("type", "radio"); + support.radioValue = input.value === "t"; + + input.setAttribute("checked", "checked"); + div.appendChild( input ); + fragment = document.createDocumentFragment(); + fragment.appendChild( div.lastChild ); + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + fragment.removeChild( input ); + fragment.appendChild( div ); + + div.innerHTML = ""; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. For more + // info see bug #3333 + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + if ( window.getComputedStyle ) { + marginDiv = document.createElement( "div" ); + marginDiv.style.width = "0"; + marginDiv.style.marginRight = "0"; + div.style.width = "2px"; + div.appendChild( marginDiv ); + support.reliableMarginRight = + ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; + } + + // Technique from Juriy Zaytsev + // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ + // We only care about the case where non-standard event systems + // are used, namely in IE. Short-circuiting here helps us to + // avoid an eval call (in setAttribute) which can cause CSP + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP + if ( div.attachEvent ) { + for( i in { + submit: 1, + change: 1, + focusin: 1 + }) { + eventName = "on" + i; + isSupported = ( eventName in div ); + if ( !isSupported ) { + div.setAttribute( eventName, "return;" ); + isSupported = ( typeof div[ eventName ] === "function" ); + } + support[ i + "Bubbles" ] = isSupported; + } + } + + fragment.removeChild( div ); + + // Null elements to avoid leaks in IE + fragment = select = opt = marginDiv = div = input = null; + + // Run tests that need a body at doc ready + jQuery(function() { + var container, outer, inner, table, td, offsetSupport, + conMarginTop, ptlm, vb, style, html, + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + conMarginTop = 1; + ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"; + vb = "visibility:hidden;border:0;"; + style = "style='" + ptlm + "border:5px solid #000;padding:0;'"; + html = "
      " + + "" + + "
      "; + + container = document.createElement("div"); + container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; + body.insertBefore( container, body.firstChild ); + + // Construct the test element + div = document.createElement("div"); + container.appendChild( div ); + + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + // (only IE 8 fails this test) + div.innerHTML = "
      t
      "; + tds = div.getElementsByTagName( "td" ); + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Check if empty table cells still have offsetWidth/Height + // (IE <= 8 fail this test) + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Figure out if the W3C box model works as expected + div.innerHTML = ""; + div.style.width = div.style.paddingLeft = "1px"; + jQuery.boxModel = support.boxModel = div.offsetWidth === 2; + + if ( typeof div.style.zoom !== "undefined" ) { + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + // (IE < 8 does this) + div.style.display = "inline"; + div.style.zoom = 1; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); + + // Check if elements with layout shrink-wrap their children + // (IE 6 does this) + div.style.display = ""; + div.innerHTML = "
      "; + support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); + } + + div.style.cssText = ptlm + vb; + div.innerHTML = html; + + outer = div.firstChild; + inner = outer.firstChild; + td = outer.nextSibling.firstChild.firstChild; + + offsetSupport = { + doesNotAddBorder: ( inner.offsetTop !== 5 ), + doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) + }; + + inner.style.position = "fixed"; + inner.style.top = "20px"; + + // safari subtracts parent border width here which is 5px + offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); + inner.style.position = inner.style.top = ""; + + outer.style.overflow = "hidden"; + outer.style.position = "relative"; + + offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); + offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); + + body.removeChild( container ); + div = container = null; + + jQuery.extend( support, offsetSupport ); + }); + + return support; +})(); + + + + +var rbrace = /^(?:\{.*\}|\[.*\])$/, + rmultiDash = /([A-Z])/g; + +jQuery.extend({ + cache: {}, + + // Please use with caution + uuid: 0, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var privateCache, thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, + isEvents = name === "events"; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = ++jQuery.uuid; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + privateCache = thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Users should not attempt to inspect the internal events object using jQuery.data, + // it is undocumented and subject to change. But does anyone listen? No. + if ( isEvents && !thisCache[ name ] ) { + return privateCache.events; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; + }, + + removeData: function( elem, name, pvt /* Internal Use Only */ ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, i, l, + + // Reference to internal data cache key + internalKey = jQuery.expando, + + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + + // See jQuery.data for more information + id = isNode ? elem[ internalKey ] : internalKey; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split( " " ); + } + } + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject(cache[ id ]) ) { + return; + } + } + + // Browsers that fail expando deletion also refuse to delete expandos on + // the window, but it will allow it on all other JS objects; other browsers + // don't care + // Ensure that `cache` is not a window object #10080 + if ( jQuery.support.deleteExpando || !cache.setInterval ) { + delete cache[ id ]; + } else { + cache[ id ] = null; + } + + // We destroyed the cache and need to eliminate the expando on the node to avoid + // false lookups in the cache for entries that no longer exist + if ( isNode ) { + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( jQuery.support.deleteExpando ) { + delete elem[ internalKey ]; + } else if ( elem.removeAttribute ) { + elem.removeAttribute( internalKey ); + } else { + elem[ internalKey ] = null; + } + } + }, + + // For internal use only. + _data: function( elem, name, data ) { + return jQuery.data( elem, name, data, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + if ( elem.nodeName ) { + var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; + + if ( match ) { + return !(match === true || elem.getAttribute("classid") !== match); + } + } + + return true; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var parts, attr, name, + data = null; + + if ( typeof key === "undefined" ) { + if ( this.length ) { + data = jQuery.data( this[0] ); + + if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { + attr = this[0].attributes; + for ( var i = 0, l = attr.length; i < l; i++ ) { + name = attr[i].name; + + if ( name.indexOf( "data-" ) === 0 ) { + name = jQuery.camelCase( name.substring(5) ); + + dataAttr( this[0], name, data[ name ] ); + } + } + jQuery._data( this[0], "parsedAttrs", true ); + } + } + + return data; + + } else if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + parts = key.split("."); + parts[1] = parts[1] ? "." + parts[1] : ""; + + if ( value === undefined ) { + data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); + + // Try to fetch any internally stored data first + if ( data === undefined && this.length ) { + data = jQuery.data( this[0], key ); + data = dataAttr( this[0], key, data ); + } + + return data === undefined && parts[1] ? + this.data( parts[0] ) : + data; + + } else { + return this.each(function() { + var self = jQuery( this ), + args = [ parts[0], value ]; + + self.triggerHandler( "setData" + parts[1] + "!", args ); + jQuery.data( this, key, value ); + self.triggerHandler( "changeData" + parts[1] + "!", args ); + }); + } + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + jQuery.isNumeric( data ) ? parseFloat( data ) : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + for ( var name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} + + + + +function handleQueueMarkDefer( elem, type, src ) { + var deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + defer = jQuery._data( elem, deferDataKey ); + if ( defer && + ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && + ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { + // Give room for hard-coded callbacks to fire first + // and eventually mark/queue something else on the element + setTimeout( function() { + if ( !jQuery._data( elem, queueDataKey ) && + !jQuery._data( elem, markDataKey ) ) { + jQuery.removeData( elem, deferDataKey, true ); + defer.fire(); + } + }, 0 ); + } +} + +jQuery.extend({ + + _mark: function( elem, type ) { + if ( elem ) { + type = ( type || "fx" ) + "mark"; + jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); + } + }, + + _unmark: function( force, elem, type ) { + if ( force !== true ) { + type = elem; + elem = force; + force = false; + } + if ( elem ) { + type = type || "fx"; + var key = type + "mark", + count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); + if ( count ) { + jQuery._data( elem, key, count ); + } else { + jQuery.removeData( elem, key, true ); + handleQueueMarkDefer( elem, type, "mark" ); + } + } + }, + + queue: function( elem, type, data ) { + var q; + if ( elem ) { + type = ( type || "fx" ) + "queue"; + q = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !q || jQuery.isArray(data) ) { + q = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + q.push( data ); + } + } + return q || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + fn = queue.shift(), + hooks = {}; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + } + + if ( fn ) { + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + jQuery._data( elem, type + ".run", hooks ); + fn.call( elem, function() { + jQuery.dequeue( elem, type ); + }, hooks ); + } + + if ( !queue.length ) { + jQuery.removeData( elem, type + "queue " + type + ".run", true ); + handleQueueMarkDefer( elem, type, "queue" ); + } + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + } + + if ( data === undefined ) { + return jQuery.queue( this[0], type ); + } + return this.each(function() { + var queue = jQuery.queue( this, type, data ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, object ) { + if ( typeof type !== "string" ) { + object = type; + type = undefined; + } + type = type || "fx"; + var defer = jQuery.Deferred(), + elements = this, + i = elements.length, + count = 1, + deferDataKey = type + "defer", + queueDataKey = type + "queue", + markDataKey = type + "mark", + tmp; + function resolve() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + } + while( i-- ) { + if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || + ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || + jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && + jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { + count++; + tmp.add( resolve ); + } + } + resolve(); + return defer.promise(); + } +}); + + + + +var rclass = /[\n\t\r]/g, + rspace = /\s+/, + rreturn = /\r/g, + rtype = /^(?:button|input)$/i, + rfocusable = /^(?:button|input|object|select|textarea)$/i, + rclickable = /^a(?:rea)?$/i, + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute, + nodeHook, boolHook, fixSpecified; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, name, value, true, jQuery.attr ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, name, value, true, jQuery.prop ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classNames, i, l, elem, + setClass, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call(this, j, this.className) ); + }); + } + + if ( value && typeof value === "string" ) { + classNames = value.split( rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 ) { + if ( !elem.className && classNames.length === 1 ) { + elem.className = value; + + } else { + setClass = " " + elem.className + " "; + + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { + setClass += classNames[ c ] + " "; + } + } + elem.className = jQuery.trim( setClass ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classNames, i, l, elem, className, c, cl; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call(this, j, this.className) ); + }); + } + + if ( (value && typeof value === "string") || value === undefined ) { + classNames = ( value || "" ).split( rspace ); + + for ( i = 0, l = this.length; i < l; i++ ) { + elem = this[ i ]; + + if ( elem.nodeType === 1 && elem.className ) { + if ( value ) { + className = (" " + elem.className + " ").replace( rclass, " " ); + for ( c = 0, cl = classNames.length; c < cl; c++ ) { + className = className.replace(" " + classNames[ c ] + " ", " "); + } + elem.className = jQuery.trim( className ); + + } else { + elem.className = ""; + } + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.split( rspace ); + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space seperated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + } else if ( type === "undefined" || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // toggle whole className + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var hooks, ret, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var self = jQuery(this), val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, i, max, option, + index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type === "select-one"; + + // Nothing was selected + if ( index < 0 ) { + return null; + } + + // Loop through all the selected options + i = one ? index : 0; + max = one ? index + 1 : options.length; + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Don't return options that are disabled or in a disabled optgroup + if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && + (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + // Fixes Bug #2551 -- select.val() broken in IE after form.reset() + if ( one && !values.length && options.length ) { + return jQuery( options[ index ] ).val(); + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + attrFn: { + val: true, + css: true, + html: true, + text: true, + data: true, + width: true, + height: true, + offset: true + }, + + attr: function( elem, name, value, pass ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( pass && name in jQuery.attrFn ) { + return jQuery( elem )[ name ]( value ); + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + + } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, "" + value ); + return value; + } + + } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + ret = elem.getAttribute( name ); + + // Non-existent attributes return null, we normalize to undefined + return ret === null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var propName, attrNames, name, l, + i = 0; + + if ( value && elem.nodeType === 1 ) { + attrNames = value.toLowerCase().split( rspace ); + l = attrNames.length; + + for ( ; i < l; i++ ) { + name = attrNames[ i ]; + + if ( name ) { + propName = jQuery.propFix[ name ] || name; + + // See #9699 for explanation of this approach (setting first, then removal) + jQuery.attr( elem, name, "" ); + elem.removeAttribute( getSetAttribute ? name : propName ); + + // Set corresponding property to false for boolean attributes + if ( rboolean.test( name ) && propName in elem ) { + elem[ propName ] = false; + } + } + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + // We can't allow the type property to be changed (since it causes problems in IE) + if ( rtype.test( elem.nodeName ) && elem.parentNode ) { + jQuery.error( "type property can't be changed" ); + } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to it's default in case type is set after value + // This is for element creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + }, + // Use the value property for back compat + // Use the nodeHook for button elements in IE6/7 (#1954) + value: { + get: function( elem, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.get( elem, name ); + } + return name in elem ? + elem.value : + null; + }, + set: function( elem, value, name ) { + if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { + return nodeHook.set( elem, value, name ); + } + // Does not return so that setAttribute is also used + elem.value = value; + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } +}); + +// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) +jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + // Align boolean attributes with corresponding properties + // Fall back to attribute presence where some booleans are not supported + var attrNode, + property = jQuery.prop( elem, name ); + return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + var propName; + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + // value is true since we know at this point it's type boolean and not false + // Set boolean attributes to the same name and set the DOM property + propName = jQuery.propFix[ name ] || name; + if ( propName in elem ) { + // Only set the IDL specifically if it already exists on the element + elem[ propName ] = true; + } + + elem.setAttribute( name, name.toLowerCase() ); + } + return name; + } +}; + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + fixSpecified = { + name: true, + id: true + }; + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret; + ret = elem.getAttributeNode( name ); + return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? + ret.nodeValue : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + ret = document.createAttribute( name ); + elem.setAttributeNode( ret ); + } + return ( ret.nodeValue = value + "" ); + } + }; + + // Apply the nodeHook to tabindex + jQuery.attrHooks.tabindex.set = nodeHook.set; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + if ( value === "" ) { + value = "false"; + } + nodeHook.set( elem, value, name ); + } + }; +} + + +// Some attributes require a special call on IE +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret === null ? undefined : ret; + } + }); + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Normalize to lowercase since IE uppercases css property names + return elem.style.cssText.toLowerCase() || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = "" + value ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); + + + + +var rformElems = /^(?:textarea|input|select)$/i, + rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, + rhoverHack = /\bhover(\.\S+)?\b/, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, + quickParse = function( selector ) { + var quick = rquickIs.exec( selector ); + if ( quick ) { + // 0 1 2 3 + // [ _, tag, id, class ] + quick[1] = ( quick[1] || "" ).toLowerCase(); + quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); + } + return quick; + }, + quickIs = function( elem, m ) { + var attrs = elem.attributes || {}; + return ( + (!m[1] || elem.nodeName.toLowerCase() === m[1]) && + (!m[2] || (attrs.id || {}).value === m[2]) && + (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) + ); + }, + hoverHack = function( events ) { + return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); + }; + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + add: function( elem, types, handler, data, selector ) { + + var elemData, eventHandle, events, + t, tns, type, namespaces, handleObj, + handleObjIn, quick, handlers, special; + + // Don't attach events to noData or text/comment nodes (allow plain objects tho) + if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + events = elemData.events; + if ( !events ) { + elemData.events = events = {}; + } + eventHandle = elemData.handle; + if ( !eventHandle ) { + elemData.handle = eventHandle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = jQuery.trim( hoverHack(types) ).split( " " ); + for ( t = 0; t < types.length; t++ ) { + + tns = rtypenamespace.exec( types[t] ) || []; + type = tns[1]; + namespaces = ( tns[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: tns[1], + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + quick: quickParse( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + handlers = events[ type ]; + if ( !handlers ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + global: {}, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), + t, tns, type, origType, namespaces, origCount, + j, events, special, handle, eventType, handleObj; + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = jQuery.trim( hoverHack( types || "" ) ).split(" "); + for ( t = 0; t < types.length; t++ ) { + tns = rtypenamespace.exec( types[t] ) || []; + type = origType = tns[1]; + namespaces = tns[2]; + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector? special.delegateType : special.bindType ) || type; + eventType = events[ type ] || []; + origCount = eventType.length; + namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; + + // Remove matching events + for ( j = 0; j < eventType.length; j++ ) { + handleObj = eventType[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !namespaces || namespaces.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + eventType.splice( j--, 1 ); + + if ( handleObj.selector ) { + eventType.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( eventType.length === 0 && origCount !== eventType.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + handle = elemData.handle; + if ( handle ) { + handle.elem = null; + } + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery.removeData( elem, [ "events", "handle" ], true ); + } + }, + + // Events that are safe to short-circuit if no handlers are attached. + // Native DOM events should not be added, they may have inline handlers. + customEvent: { + "getData": true, + "setData": true, + "changeData": true + }, + + trigger: function( event, data, elem, onlyHandlers ) { + // Don't do events on text and comment nodes + if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { + return; + } + + // Event object or event type + var type = event.type || event, + namespaces = [], + cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "!" ) >= 0 ) { + // Exclusive events trigger only for the exact event (no namespaces) + type = type.slice(0, -1); + exclusive = true; + } + + if ( type.indexOf( "." ) >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + + if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { + // No jQuery handlers for this event type, and it can't have inline handlers + return; + } + + // Caller can pass in an Event, Object, or just an event type string + event = typeof event === "object" ? + // jQuery.Event object + event[ jQuery.expando ] ? event : + // Object literal + new jQuery.Event( type, event ) : + // Just the event type (string) + new jQuery.Event( type ); + + event.type = type; + event.isTrigger = true; + event.exclusive = exclusive; + event.namespace = namespaces.join( "." ); + event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; + ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; + + // Handle a global trigger + if ( !elem ) { + + // TODO: Stop taunting the data cache; remove global events and always attach to document + cache = jQuery.cache; + for ( i in cache ) { + if ( cache[ i ].events && cache[ i ].events[ type ] ) { + jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); + } + } + return; + } + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data != null ? jQuery.makeArray( data ) : []; + data.unshift( event ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + eventPath = [[ elem, special.bindType || type ]]; + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; + old = null; + for ( ; cur; cur = cur.parentNode ) { + eventPath.push([ cur, bubbleType ]); + old = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( old && old === elem.ownerDocument ) { + eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); + } + } + + // Fire handlers on the event path + for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { + + cur = eventPath[i][0]; + event.type = eventPath[i][1]; + + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + // Note that this is a bare JS function and not a jQuery handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + // IE<9 dies on focus/blur to hidden element (#1486) + if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + old = elem[ ontype ]; + + if ( old ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + elem[ type ](); + jQuery.event.triggered = undefined; + + if ( old ) { + elem[ ontype ] = old; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event || window.event ); + + var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), + delegateCount = handlers.delegateCount, + args = [].slice.call( arguments, 0 ), + run_all = !event.exclusive && !event.namespace, + handlerQueue = [], + i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Determine handlers that should run if there are delegated events + // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) + if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { + + // Pregenerate a single jQuery object for reuse with .is() + jqcur = jQuery(this); + jqcur.context = this.ownerDocument || this; + + for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { + selMatch = {}; + matches = []; + jqcur[0] = cur; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + sel = handleObj.selector; + + if ( selMatch[ sel ] === undefined ) { + selMatch[ sel ] = ( + handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) + ); + } + if ( selMatch[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, matches: matches }); + } + } + } + + // Add the remaining (directly-bound) handlers + if ( handlers.length > delegateCount ) { + handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); + } + + // Run delegates first; they may want to stop propagation beneath us + for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { + matched = handlerQueue[ i ]; + event.currentTarget = matched.elem; + + for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { + handleObj = matched.matches[ j ]; + + // Triggered event must either 1) be non-exclusive and have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { + + event.data = handleObj.data; + event.handleObj = handleObj; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + event.result = ret; + if ( ret === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + return event.result; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** + props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var eventDoc, doc, body, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, + originalEvent = event, + fixHook = jQuery.event.fixHooks[ event.type ] || {}, + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = jQuery.Event( originalEvent ); + + for ( i = copy.length; i; ) { + prop = copy[ --i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Target should not be a text node (#504, Safari) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) + if ( event.metaKey === undefined ) { + event.metaKey = event.ctrlKey; + } + + return fixHook.filter? fixHook.filter( event, originalEvent ) : event; + }, + + special: { + ready: { + // Make sure the ready event is setup + setup: jQuery.bindReady + }, + + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + + focus: { + delegateType: "focusin" + }, + blur: { + delegateType: "focusout" + }, + + beforeunload: { + setup: function( data, namespaces, eventHandle ) { + // We only want to do this special case on windows + if ( jQuery.isWindow( this ) ) { + this.onbeforeunload = eventHandle; + } + }, + + teardown: function( namespaces, eventHandle ) { + if ( this.onbeforeunload === eventHandle ) { + this.onbeforeunload = null; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +// Some plugins are using, but it's undocumented/deprecated and will be removed. +// The 1.7 special event interface should provide all the hooks needed now. +jQuery.event.handle = jQuery.event.dispatch; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + if ( elem.detachEvent ) { + elem.detachEvent( "on" + type, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +function returnFalse() { + return false; +} +function returnTrue() { + return true; +} + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + preventDefault: function() { + this.isDefaultPrevented = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + + // if preventDefault exists run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // otherwise set the returnValue property of the original event to false (IE) + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + this.isPropagationStopped = returnTrue; + + var e = this.originalEvent; + if ( !e ) { + return; + } + // if stopPropagation exists run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + // otherwise set the cancelBubble property of the original event to true (IE) + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + }, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var target = this, + related = event.relatedTarget, + handleObj = event.handleObj, + selector = handleObj.selector, + ret; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !form._submit_attached ) { + jQuery.event.add( form, "submit._submit", function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + }); + form._submit_attached = true; + } + }); + // return undefined since we don't need an event listener + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + jQuery.event.simulate( "change", this, event, true ); + } + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + elem._change_attached = true; + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on.call( this, types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + var handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( var type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + live: function( types, data, fn ) { + jQuery( this.context ).on( types, this.selector, data, fn ); + return this; + }, + die: function( types, fn ) { + jQuery( this.context ).off( types, this.selector || "**", fn ); + return this; + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + if ( this[0] ) { + return jQuery.event.trigger( type, data, this[0], true ); + } + }, + + toggle: function( fn ) { + // Save reference to arguments for access in closure + var args = arguments, + guid = fn.guid || jQuery.guid++, + i = 0, + toggler = function( event ) { + // Figure out which function to execute + var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; + jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); + + // Make sure that clicks stop + event.preventDefault(); + + // and execute the function + return args[ lastToggle ].apply( this, arguments ) || false; + }; + + // link all the functions, so any of them can unbind this click handler + toggler.guid = guid; + while ( i < args.length ) { + args[ i++ ].guid = guid; + } + + return this.click( toggler ); + }, + + hover: function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + } +}); + +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + if ( fn == null ) { + fn = data; + data = null; + } + + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; + + if ( jQuery.attrFn ) { + jQuery.attrFn[ name ] = true; + } + + if ( rkeyEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; + } + + if ( rmouseEvent.test( name ) ) { + jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; + } +}); + + + +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){ + +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, + expando = "sizcache" + (Math.random() + '').replace('.', ''), + done = 0, + toString = Object.prototype.toString, + hasDuplicate = false, + baseHasDuplicate = true, + rBackslash = /\\/g, + rReturn = /\r\n/g, + rNonWord = /\W/; + +// Here we check if the JavaScript engine is using some sort of +// optimization where it does not always call our comparision +// function. If that is the case, discard the hasDuplicate value. +// Thus far that includes Google Chrome. +[0, 0].sort(function() { + baseHasDuplicate = false; + return 0; +}); + +var Sizzle = function( selector, context, results, seed ) { + results = results || []; + context = context || document; + + var origContext = context; + + if ( context.nodeType !== 1 && context.nodeType !== 9 ) { + return []; + } + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + var m, set, checkSet, extra, ret, cur, pop, i, + prune = true, + contextXML = Sizzle.isXML( context ), + parts = [], + soFar = selector; + + // Reset the position of the chunker regexp (start from head) + do { + chunker.exec( "" ); + m = chunker.exec( soFar ); + + if ( m ) { + soFar = m[3]; + + parts.push( m[1] ); + + if ( m[2] ) { + extra = m[3]; + break; + } + } + } while ( m ); + + if ( parts.length > 1 && origPOS.exec( selector ) ) { + + if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { + set = posProcess( parts[0] + parts[1], context, seed ); + + } else { + set = Expr.relative[ parts[0] ] ? + [ context ] : + Sizzle( parts.shift(), context ); + + while ( parts.length ) { + selector = parts.shift(); + + if ( Expr.relative[ selector ] ) { + selector += parts.shift(); + } + + set = posProcess( selector, set, seed ); + } + } + + } else { + // Take a shortcut and set the context if the root selector is an ID + // (but not if it'll be faster if the inner selector is an ID) + if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && + Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { + + ret = Sizzle.find( parts.shift(), context, contextXML ); + context = ret.expr ? + Sizzle.filter( ret.expr, ret.set )[0] : + ret.set[0]; + } + + if ( context ) { + ret = seed ? + { expr: parts.pop(), set: makeArray(seed) } : + Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); + + set = ret.expr ? + Sizzle.filter( ret.expr, ret.set ) : + ret.set; + + if ( parts.length > 0 ) { + checkSet = makeArray( set ); + + } else { + prune = false; + } + + while ( parts.length ) { + cur = parts.pop(); + pop = cur; + + if ( !Expr.relative[ cur ] ) { + cur = ""; + } else { + pop = parts.pop(); + } + + if ( pop == null ) { + pop = context; + } + + Expr.relative[ cur ]( checkSet, pop, contextXML ); + } + + } else { + checkSet = parts = []; + } + } + + if ( !checkSet ) { + checkSet = set; + } + + if ( !checkSet ) { + Sizzle.error( cur || selector ); + } + + if ( toString.call(checkSet) === "[object Array]" ) { + if ( !prune ) { + results.push.apply( results, checkSet ); + + } else if ( context && context.nodeType === 1 ) { + for ( i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { + results.push( set[i] ); + } + } + + } else { + for ( i = 0; checkSet[i] != null; i++ ) { + if ( checkSet[i] && checkSet[i].nodeType === 1 ) { + results.push( set[i] ); + } + } + } + + } else { + makeArray( checkSet, results ); + } + + if ( extra ) { + Sizzle( extra, origContext, results, seed ); + Sizzle.uniqueSort( results ); + } + + return results; +}; + +Sizzle.uniqueSort = function( results ) { + if ( sortOrder ) { + hasDuplicate = baseHasDuplicate; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( var i = 1; i < results.length; i++ ) { + if ( results[i] === results[ i - 1 ] ) { + results.splice( i--, 1 ); + } + } + } + } + + return results; +}; + +Sizzle.matches = function( expr, set ) { + return Sizzle( expr, null, null, set ); +}; + +Sizzle.matchesSelector = function( node, expr ) { + return Sizzle( expr, null, null, [node] ).length > 0; +}; + +Sizzle.find = function( expr, context, isXML ) { + var set, i, len, match, type, left; + + if ( !expr ) { + return []; + } + + for ( i = 0, len = Expr.order.length; i < len; i++ ) { + type = Expr.order[i]; + + if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { + left = match[1]; + match.splice( 1, 1 ); + + if ( left.substr( left.length - 1 ) !== "\\" ) { + match[1] = (match[1] || "").replace( rBackslash, "" ); + set = Expr.find[ type ]( match, context, isXML ); + + if ( set != null ) { + expr = expr.replace( Expr.match[ type ], "" ); + break; + } + } + } + } + + if ( !set ) { + set = typeof context.getElementsByTagName !== "undefined" ? + context.getElementsByTagName( "*" ) : + []; + } + + return { set: set, expr: expr }; +}; + +Sizzle.filter = function( expr, set, inplace, not ) { + var match, anyFound, + type, found, item, filter, left, + i, pass, + old = expr, + result = [], + curLoop = set, + isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); + + while ( expr && set.length ) { + for ( type in Expr.filter ) { + if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { + filter = Expr.filter[ type ]; + left = match[1]; + + anyFound = false; + + match.splice(1,1); + + if ( left.substr( left.length - 1 ) === "\\" ) { + continue; + } + + if ( curLoop === result ) { + result = []; + } + + if ( Expr.preFilter[ type ] ) { + match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); + + if ( !match ) { + anyFound = found = true; + + } else if ( match === true ) { + continue; + } + } + + if ( match ) { + for ( i = 0; (item = curLoop[i]) != null; i++ ) { + if ( item ) { + found = filter( item, match, i, curLoop ); + pass = not ^ found; + + if ( inplace && found != null ) { + if ( pass ) { + anyFound = true; + + } else { + curLoop[i] = false; + } + + } else if ( pass ) { + result.push( item ); + anyFound = true; + } + } + } + } + + if ( found !== undefined ) { + if ( !inplace ) { + curLoop = result; + } + + expr = expr.replace( Expr.match[ type ], "" ); + + if ( !anyFound ) { + return []; + } + + break; + } + } + } + + // Improper expression + if ( expr === old ) { + if ( anyFound == null ) { + Sizzle.error( expr ); + + } else { + break; + } + } + + old = expr; + } + + return curLoop; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Utility function for retreiving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +var getText = Sizzle.getText = function( elem ) { + var i, node, + nodeType = elem.nodeType, + ret = ""; + + if ( nodeType ) { + if ( nodeType === 1 || nodeType === 9 ) { + // Use textContent || innerText for elements + if ( typeof elem.textContent === 'string' ) { + return elem.textContent; + } else if ( typeof elem.innerText === 'string' ) { + // Replace IE's carriage returns + return elem.innerText.replace( rReturn, '' ); + } else { + // Traverse it's children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + } else { + + // If no nodeType, this is expected to be an array + for ( i = 0; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + if ( node.nodeType !== 8 ) { + ret += getText( node ); + } + } + } + return ret; +}; + +var Expr = Sizzle.selectors = { + order: [ "ID", "NAME", "TAG" ], + + match: { + ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, + CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, + NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, + ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, + TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, + CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, + POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, + PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ + }, + + leftMatch: {}, + + attrMap: { + "class": "className", + "for": "htmlFor" + }, + + attrHandle: { + href: function( elem ) { + return elem.getAttribute( "href" ); + }, + type: function( elem ) { + return elem.getAttribute( "type" ); + } + }, + + relative: { + "+": function(checkSet, part){ + var isPartStr = typeof part === "string", + isTag = isPartStr && !rNonWord.test( part ), + isPartStrNotTag = isPartStr && !isTag; + + if ( isTag ) { + part = part.toLowerCase(); + } + + for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { + if ( (elem = checkSet[i]) ) { + while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} + + checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? + elem || false : + elem === part; + } + } + + if ( isPartStrNotTag ) { + Sizzle.filter( part, checkSet, true ); + } + }, + + ">": function( checkSet, part ) { + var elem, + isPartStr = typeof part === "string", + i = 0, + l = checkSet.length; + + if ( isPartStr && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + + for ( ; i < l; i++ ) { + elem = checkSet[i]; + + if ( elem ) { + var parent = elem.parentNode; + checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; + } + } + + } else { + for ( ; i < l; i++ ) { + elem = checkSet[i]; + + if ( elem ) { + checkSet[i] = isPartStr ? + elem.parentNode : + elem.parentNode === part; + } + } + + if ( isPartStr ) { + Sizzle.filter( part, checkSet, true ); + } + } + }, + + "": function(checkSet, part, isXML){ + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; + checkFn = dirNodeCheck; + } + + checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); + }, + + "~": function( checkSet, part, isXML ) { + var nodeCheck, + doneName = done++, + checkFn = dirCheck; + + if ( typeof part === "string" && !rNonWord.test( part ) ) { + part = part.toLowerCase(); + nodeCheck = part; + checkFn = dirNodeCheck; + } + + checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); + } + }, + + find: { + ID: function( match, context, isXML ) { + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }, + + NAME: function( match, context ) { + if ( typeof context.getElementsByName !== "undefined" ) { + var ret = [], + results = context.getElementsByName( match[1] ); + + for ( var i = 0, l = results.length; i < l; i++ ) { + if ( results[i].getAttribute("name") === match[1] ) { + ret.push( results[i] ); + } + } + + return ret.length === 0 ? null : ret; + } + }, + + TAG: function( match, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( match[1] ); + } + } + }, + preFilter: { + CLASS: function( match, curLoop, inplace, result, not, isXML ) { + match = " " + match[1].replace( rBackslash, "" ) + " "; + + if ( isXML ) { + return match; + } + + for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { + if ( elem ) { + if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { + if ( !inplace ) { + result.push( elem ); + } + + } else if ( inplace ) { + curLoop[i] = false; + } + } + } + + return false; + }, + + ID: function( match ) { + return match[1].replace( rBackslash, "" ); + }, + + TAG: function( match, curLoop ) { + return match[1].replace( rBackslash, "" ).toLowerCase(); + }, + + CHILD: function( match ) { + if ( match[1] === "nth" ) { + if ( !match[2] ) { + Sizzle.error( match[0] ); + } + + match[2] = match[2].replace(/^\+|\s*/g, ''); + + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' + var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( + match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || + !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); + + // calculate the numbers (first)n+(last) including if they are negative + match[2] = (test[1] + (test[2] || 1)) - 0; + match[3] = test[3] - 0; + } + else if ( match[2] ) { + Sizzle.error( match[0] ); + } + + // TODO: Move to normal caching system + match[0] = done++; + + return match; + }, + + ATTR: function( match, curLoop, inplace, result, not, isXML ) { + var name = match[1] = match[1].replace( rBackslash, "" ); + + if ( !isXML && Expr.attrMap[name] ) { + match[1] = Expr.attrMap[name]; + } + + // Handle if an un-quoted value was used + match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); + + if ( match[2] === "~=" ) { + match[4] = " " + match[4] + " "; + } + + return match; + }, + + PSEUDO: function( match, curLoop, inplace, result, not ) { + if ( match[1] === "not" ) { + // If we're dealing with a complex expression, or a simple one + if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { + match[3] = Sizzle(match[3], null, null, curLoop); + + } else { + var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); + + if ( !inplace ) { + result.push.apply( result, ret ); + } + + return false; + } + + } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { + return true; + } + + return match; + }, + + POS: function( match ) { + match.unshift( true ); + + return match; + } + }, + + filters: { + enabled: function( elem ) { + return elem.disabled === false && elem.type !== "hidden"; + }, + + disabled: function( elem ) { + return elem.disabled === true; + }, + + checked: function( elem ) { + return elem.checked === true; + }, + + selected: function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + parent: function( elem ) { + return !!elem.firstChild; + }, + + empty: function( elem ) { + return !elem.firstChild; + }, + + has: function( elem, i, match ) { + return !!Sizzle( match[3], elem ).length; + }, + + header: function( elem ) { + return (/h\d/i).test( elem.nodeName ); + }, + + text: function( elem ) { + var attr = elem.getAttribute( "type" ), type = elem.type; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); + }, + + radio: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; + }, + + checkbox: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; + }, + + file: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; + }, + + password: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; + }, + + submit: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "submit" === elem.type; + }, + + image: function( elem ) { + return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; + }, + + reset: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && "reset" === elem.type; + }, + + button: function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && "button" === elem.type || name === "button"; + }, + + input: function( elem ) { + return (/input|select|textarea|button/i).test( elem.nodeName ); + }, + + focus: function( elem ) { + return elem === elem.ownerDocument.activeElement; + } + }, + setFilters: { + first: function( elem, i ) { + return i === 0; + }, + + last: function( elem, i, match, array ) { + return i === array.length - 1; + }, + + even: function( elem, i ) { + return i % 2 === 0; + }, + + odd: function( elem, i ) { + return i % 2 === 1; + }, + + lt: function( elem, i, match ) { + return i < match[3] - 0; + }, + + gt: function( elem, i, match ) { + return i > match[3] - 0; + }, + + nth: function( elem, i, match ) { + return match[3] - 0 === i; + }, + + eq: function( elem, i, match ) { + return match[3] - 0 === i; + } + }, + filter: { + PSEUDO: function( elem, match, i, array ) { + var name = match[1], + filter = Expr.filters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + + } else if ( name === "contains" ) { + return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; + + } else if ( name === "not" ) { + var not = match[3]; + + for ( var j = 0, l = not.length; j < l; j++ ) { + if ( not[j] === elem ) { + return false; + } + } + + return true; + + } else { + Sizzle.error( name ); + } + }, + + CHILD: function( elem, match ) { + var first, last, + doneName, parent, cache, + count, diff, + type = match[1], + node = elem; + + switch ( type ) { + case "only": + case "first": + while ( (node = node.previousSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + if ( type === "first" ) { + return true; + } + + node = elem; + + case "last": + while ( (node = node.nextSibling) ) { + if ( node.nodeType === 1 ) { + return false; + } + } + + return true; + + case "nth": + first = match[2]; + last = match[3]; + + if ( first === 1 && last === 0 ) { + return true; + } + + doneName = match[0]; + parent = elem.parentNode; + + if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { + count = 0; + + for ( node = parent.firstChild; node; node = node.nextSibling ) { + if ( node.nodeType === 1 ) { + node.nodeIndex = ++count; + } + } + + parent[ expando ] = doneName; + } + + diff = elem.nodeIndex - last; + + if ( first === 0 ) { + return diff === 0; + + } else { + return ( diff % first === 0 && diff / first >= 0 ); + } + } + }, + + ID: function( elem, match ) { + return elem.nodeType === 1 && elem.getAttribute("id") === match; + }, + + TAG: function( elem, match ) { + return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; + }, + + CLASS: function( elem, match ) { + return (" " + (elem.className || elem.getAttribute("class")) + " ") + .indexOf( match ) > -1; + }, + + ATTR: function( elem, match ) { + var name = match[1], + result = Sizzle.attr ? + Sizzle.attr( elem, name ) : + Expr.attrHandle[ name ] ? + Expr.attrHandle[ name ]( elem ) : + elem[ name ] != null ? + elem[ name ] : + elem.getAttribute( name ), + value = result + "", + type = match[2], + check = match[4]; + + return result == null ? + type === "!=" : + !type && Sizzle.attr ? + result != null : + type === "=" ? + value === check : + type === "*=" ? + value.indexOf(check) >= 0 : + type === "~=" ? + (" " + value + " ").indexOf(check) >= 0 : + !check ? + value && result !== false : + type === "!=" ? + value !== check : + type === "^=" ? + value.indexOf(check) === 0 : + type === "$=" ? + value.substr(value.length - check.length) === check : + type === "|=" ? + value === check || value.substr(0, check.length + 1) === check + "-" : + false; + }, + + POS: function( elem, match, i, array ) { + var name = match[2], + filter = Expr.setFilters[ name ]; + + if ( filter ) { + return filter( elem, i, match, array ); + } + } + } +}; + +var origPOS = Expr.match.POS, + fescape = function(all, num){ + return "\\" + (num - 0 + 1); + }; + +for ( var type in Expr.match ) { + Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); + Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); +} + +var makeArray = function( array, results ) { + array = Array.prototype.slice.call( array, 0 ); + + if ( results ) { + results.push.apply( results, array ); + return results; + } + + return array; +}; + +// Perform a simple check to determine if the browser is capable of +// converting a NodeList to an array using builtin methods. +// Also verifies that the returned array holds DOM nodes +// (which is not the case in the Blackberry browser) +try { + Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; + +// Provide a fallback method if it does not work +} catch( e ) { + makeArray = function( array, results ) { + var i = 0, + ret = results || []; + + if ( toString.call(array) === "[object Array]" ) { + Array.prototype.push.apply( ret, array ); + + } else { + if ( typeof array.length === "number" ) { + for ( var l = array.length; i < l; i++ ) { + ret.push( array[i] ); + } + + } else { + for ( ; array[i]; i++ ) { + ret.push( array[i] ); + } + } + } + + return ret; + }; +} + +var sortOrder, siblingCheck; + +if ( document.documentElement.compareDocumentPosition ) { + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { + return a.compareDocumentPosition ? -1 : 1; + } + + return a.compareDocumentPosition(b) & 4 ? -1 : 1; + }; + +} else { + sortOrder = function( a, b ) { + // The nodes are identical, we can exit early + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Fallback to using sourceIndex (in IE) if it's available on both nodes + } else if ( a.sourceIndex && b.sourceIndex ) { + return a.sourceIndex - b.sourceIndex; + } + + var al, bl, + ap = [], + bp = [], + aup = a.parentNode, + bup = b.parentNode, + cur = aup; + + // If the nodes are siblings (or identical) we can do a quick check + if ( aup === bup ) { + return siblingCheck( a, b ); + + // If no parents were found then the nodes are disconnected + } else if ( !aup ) { + return -1; + + } else if ( !bup ) { + return 1; + } + + // Otherwise they're somewhere else in the tree so we need + // to build up a full list of the parentNodes for comparison + while ( cur ) { + ap.unshift( cur ); + cur = cur.parentNode; + } + + cur = bup; + + while ( cur ) { + bp.unshift( cur ); + cur = cur.parentNode; + } + + al = ap.length; + bl = bp.length; + + // Start walking down the tree looking for a discrepancy + for ( var i = 0; i < al && i < bl; i++ ) { + if ( ap[i] !== bp[i] ) { + return siblingCheck( ap[i], bp[i] ); + } + } + + // We ended someplace up the tree so do a sibling check + return i === al ? + siblingCheck( a, bp[i], -1 ) : + siblingCheck( ap[i], b, 1 ); + }; + + siblingCheck = function( a, b, ret ) { + if ( a === b ) { + return ret; + } + + var cur = a.nextSibling; + + while ( cur ) { + if ( cur === b ) { + return -1; + } + + cur = cur.nextSibling; + } + + return 1; + }; +} + +// Check to see if the browser returns elements by name when +// querying by getElementById (and provide a workaround) +(function(){ + // We're going to inject a fake input element with a specified name + var form = document.createElement("div"), + id = "script" + (new Date()).getTime(), + root = document.documentElement; + + form.innerHTML = ""; + + // Inject it into the root element, check its status, and remove it quickly + root.insertBefore( form, root.firstChild ); + + // The workaround has to do additional checks after a getElementById + // Which slows things down for other browsers (hence the branching) + if ( document.getElementById( id ) ) { + Expr.find.ID = function( match, context, isXML ) { + if ( typeof context.getElementById !== "undefined" && !isXML ) { + var m = context.getElementById(match[1]); + + return m ? + m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? + [m] : + undefined : + []; + } + }; + + Expr.filter.ID = function( elem, match ) { + var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); + + return elem.nodeType === 1 && node && node.nodeValue === match; + }; + } + + root.removeChild( form ); + + // release memory in IE + root = form = null; +})(); + +(function(){ + // Check to see if the browser returns only elements + // when doing getElementsByTagName("*") + + // Create a fake element + var div = document.createElement("div"); + div.appendChild( document.createComment("") ); + + // Make sure no comments are found + if ( div.getElementsByTagName("*").length > 0 ) { + Expr.find.TAG = function( match, context ) { + var results = context.getElementsByTagName( match[1] ); + + // Filter out possible comments + if ( match[1] === "*" ) { + var tmp = []; + + for ( var i = 0; results[i]; i++ ) { + if ( results[i].nodeType === 1 ) { + tmp.push( results[i] ); + } + } + + results = tmp; + } + + return results; + }; + } + + // Check to see if an attribute returns normalized href attributes + div.innerHTML = ""; + + if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && + div.firstChild.getAttribute("href") !== "#" ) { + + Expr.attrHandle.href = function( elem ) { + return elem.getAttribute( "href", 2 ); + }; + } + + // release memory in IE + div = null; +})(); + +if ( document.querySelectorAll ) { + (function(){ + var oldSizzle = Sizzle, + div = document.createElement("div"), + id = "__sizzle__"; + + div.innerHTML = "

      "; + + // Safari can't handle uppercase or unicode characters when + // in quirks mode. + if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { + return; + } + + Sizzle = function( query, context, extra, seed ) { + context = context || document; + + // Only use querySelectorAll on non-XML documents + // (ID selectors don't work in non-HTML documents) + if ( !seed && !Sizzle.isXML(context) ) { + // See if we find a selector to speed up + var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); + + if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { + // Speed-up: Sizzle("TAG") + if ( match[1] ) { + return makeArray( context.getElementsByTagName( query ), extra ); + + // Speed-up: Sizzle(".CLASS") + } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { + return makeArray( context.getElementsByClassName( match[2] ), extra ); + } + } + + if ( context.nodeType === 9 ) { + // Speed-up: Sizzle("body") + // The body element only exists once, optimize finding it + if ( query === "body" && context.body ) { + return makeArray( [ context.body ], extra ); + + // Speed-up: Sizzle("#ID") + } else if ( match && match[3] ) { + var elem = context.getElementById( match[3] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id === match[3] ) { + return makeArray( [ elem ], extra ); + } + + } else { + return makeArray( [], extra ); + } + } + + try { + return makeArray( context.querySelectorAll(query), extra ); + } catch(qsaError) {} + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + var oldContext = context, + old = context.getAttribute( "id" ), + nid = old || id, + hasParent = context.parentNode, + relativeHierarchySelector = /^\s*[+~]/.test( query ); + + if ( !old ) { + context.setAttribute( "id", nid ); + } else { + nid = nid.replace( /'/g, "\\$&" ); + } + if ( relativeHierarchySelector && hasParent ) { + context = context.parentNode; + } + + try { + if ( !relativeHierarchySelector || hasParent ) { + return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); + } + + } catch(pseudoError) { + } finally { + if ( !old ) { + oldContext.removeAttribute( "id" ); + } + } + } + } + + return oldSizzle(query, context, extra, seed); + }; + + for ( var prop in oldSizzle ) { + Sizzle[ prop ] = oldSizzle[ prop ]; + } + + // release memory in IE + div = null; + })(); +} + +(function(){ + var html = document.documentElement, + matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; + + if ( matches ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9 fails this) + var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), + pseudoWorks = false; + + try { + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( document.documentElement, "[test!='']:sizzle" ); + + } catch( pseudoError ) { + pseudoWorks = true; + } + + Sizzle.matchesSelector = function( node, expr ) { + // Make sure that attribute selectors are quoted + expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); + + if ( !Sizzle.isXML( node ) ) { + try { + if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { + var ret = matches.call( node, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || !disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9, so check for that + node.document && node.document.nodeType !== 11 ) { + return ret; + } + } + } catch(e) {} + } + + return Sizzle(expr, null, null, [node]).length > 0; + }; + } +})(); + +(function(){ + var div = document.createElement("div"); + + div.innerHTML = "
      "; + + // Opera can't find a second classname (in 9.6) + // Also, make sure that getElementsByClassName actually exists + if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { + return; + } + + // Safari caches class attributes, doesn't catch changes (in 3.2) + div.lastChild.className = "e"; + + if ( div.getElementsByClassName("e").length === 1 ) { + return; + } + + Expr.order.splice(1, 0, "CLASS"); + Expr.find.CLASS = function( match, context, isXML ) { + if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { + return context.getElementsByClassName(match[1]); + } + }; + + // release memory in IE + div = null; +})(); + +function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + + if ( elem ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem[ expando ] === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 && !isXML ){ + elem[ expando ] = doneName; + elem.sizset = i; + } + + if ( elem.nodeName.toLowerCase() === cur ) { + match = elem; + break; + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { + for ( var i = 0, l = checkSet.length; i < l; i++ ) { + var elem = checkSet[i]; + + if ( elem ) { + var match = false; + + elem = elem[dir]; + + while ( elem ) { + if ( elem[ expando ] === doneName ) { + match = checkSet[elem.sizset]; + break; + } + + if ( elem.nodeType === 1 ) { + if ( !isXML ) { + elem[ expando ] = doneName; + elem.sizset = i; + } + + if ( typeof cur !== "string" ) { + if ( elem === cur ) { + match = true; + break; + } + + } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { + match = elem; + break; + } + } + + elem = elem[dir]; + } + + checkSet[i] = match; + } + } +} + +if ( document.documentElement.contains ) { + Sizzle.contains = function( a, b ) { + return a !== b && (a.contains ? a.contains(b) : true); + }; + +} else if ( document.documentElement.compareDocumentPosition ) { + Sizzle.contains = function( a, b ) { + return !!(a.compareDocumentPosition(b) & 16); + }; + +} else { + Sizzle.contains = function() { + return false; + }; +} + +Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; + + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +var posProcess = function( selector, context, seed ) { + var match, + tmpSet = [], + later = "", + root = context.nodeType ? [context] : context; + + // Position selectors must be done after the filter + // And so must :not(positional) so we move all PSEUDOs to the end + while ( (match = Expr.match.PSEUDO.exec( selector )) ) { + later += match[0]; + selector = selector.replace( Expr.match.PSEUDO, "" ); + } + + selector = Expr.relative[selector] ? selector + "*" : selector; + + for ( var i = 0, l = root.length; i < l; i++ ) { + Sizzle( selector, root[i], tmpSet, seed ); + } + + return Sizzle.filter( later, tmpSet ); +}; + +// EXPOSE +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +Sizzle.selectors.attrMap = {}; +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.filters; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})(); + + +var runtil = /Until$/, + rparentsprev = /^(?:parents|prevUntil|prevAll)/, + // Note: This RegExp should be improved, or likely pulled from Sizzle + rmultiselector = /,/, + isSimple = /^.[^:#\[\.,]*$/, + slice = Array.prototype.slice, + POS = jQuery.expr.match.POS, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var self = this, + i, l; + + if ( typeof selector !== "string" ) { + return jQuery( selector ).filter(function() { + for ( i = 0, l = self.length; i < l; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }); + } + + var ret = this.pushStack( "", "find", selector ), + length, n, r; + + for ( i = 0, l = this.length; i < l; i++ ) { + length = ret.length; + jQuery.find( selector, this[i], ret ); + + if ( i > 0 ) { + // Make sure that the results are unique + for ( n = length; n < ret.length; n++ ) { + for ( r = 0; r < length; r++ ) { + if ( ret[r] === ret[n] ) { + ret.splice(n--, 1); + break; + } + } + } + } + } + + return ret; + }, + + has: function( target ) { + var targets = jQuery( target ); + return this.filter(function() { + for ( var i = 0, l = targets.length; i < l; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false), "not", selector); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true), "filter", selector ); + }, + + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + POS.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var ret = [], i, l, cur = this[0]; + + // Array (deprecated as of jQuery 1.7) + if ( jQuery.isArray( selectors ) ) { + var level = 1; + + while ( cur && cur.ownerDocument && cur !== context ) { + for ( i = 0; i < selectors.length; i++ ) { + + if ( jQuery( cur ).is( selectors[ i ] ) ) { + ret.push({ selector: selectors[ i ], elem: cur, level: level }); + } + } + + cur = cur.parentNode; + level++; + } + + return ret; + } + + // String + var pos = POS.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( i = 0, l = this.length; i < l; i++ ) { + cur = this[i]; + + while ( cur ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + + } else { + cur = cur.parentNode; + if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { + break; + } + } + } + } + + ret = ret.length > 1 ? jQuery.unique( ret ) : ret; + + return this.pushStack( ret, "closest", selectors ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? + all : + jQuery.unique( all ) ); + }, + + andSelf: function() { + return this.add( this.prevObject ); + } +}); + +// A painfully simple check to see if an element is disconnected +// from a document (should be improved, where feasible). +function isDisconnected( node ) { + return !node || !node.parentNode || node.parentNode.nodeType === 11; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return jQuery.nth( elem, 2, "nextSibling" ); + }, + prev: function( elem ) { + return jQuery.nth( elem, 2, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( elem.parentNode.firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.makeArray( elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret, name, slice.call( arguments ).join(",") ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + nth: function( cur, result, dir, elem ) { + result = result || 1; + var num = 0; + + for ( ; cur; cur = cur[dir] ) { + if ( cur.nodeType === 1 && ++num === result ) { + break; + } + } + + return cur; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem, i ) { + return ( elem === qualifier ) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem, i ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); +} + + + + +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, + rtagName = /<([\w:]+)/, + rtbody = /", "" ], + legend: [ 1, "
      ", "
      " ], + thead: [ 1, "", "
      " ], + tr: [ 2, "", "
      " ], + td: [ 3, "", "
      " ], + col: [ 2, "", "
      " ], + area: [ 1, "", "" ], + _default: [ 0, "", "" ] + }, + safeFragment = createSafeFragment( document ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// IE can't serialize and