diff --git a/code/.clang-format b/code/.clang-format new file mode 100644 index 000000000..90f4ab553 --- /dev/null +++ b/code/.clang-format @@ -0,0 +1,24 @@ +--- +BasedOnStyle: WebKit +AllowShortFunctionsOnASingleLine: All +BraceWrapping: + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: true + AfterStruct: true + AfterUnion: true + BeforeCatch: true + BeforeElse: true + IndentBraces: false +BreakBeforeBraces: Custom +BreakConstructorInitializersBeforeComma: 'false' +NamespaceIndentation: None +PointerAlignment: Right +SortIncludes: 'false' +TabWidth: '4' +UseTab: ForIndentation + +... diff --git a/code/.editorconfig b/code/.editorconfig new file mode 100644 index 000000000..e4aef2c53 --- /dev/null +++ b/code/.editorconfig @@ -0,0 +1,23 @@ +; Top-most EditorConfig file +root = true + +; 4-column tab indentation +[*.cpp] +indent_style = tab +indent_size = 4 + +[*.c] +indent_style = tab +indent_size = 4 + +[*.h] +indent_style = tab +indent_size = 4 + +[*.py] +indent_style = tab +indent_size = 4 + +[*.config] +indent_style = space +indent_size = 2 diff --git a/code/CMakeModules/Find3dsMaxSDK.cmake b/code/CMakeModules/Find3dsMaxSDK.cmake index cf49a90d3..cb00df78e 100644 --- a/code/CMakeModules/Find3dsMaxSDK.cmake +++ b/code/CMakeModules/Find3dsMaxSDK.cmake @@ -11,18 +11,56 @@ if(MAXSDK_INCLUDE_DIR) SET(MAXSDK_FIND_QUIETLY TRUE) endif() +set(_pf_x86 "PROGRAMFILES(x86)") + FIND_PATH(MAXSDK_DIR "include/maxversion.h" HINTS "$ENV{MAXSDK_DIR}" PATHS + "$ENV{ADSK_3DSMAX_SDK_2021}/maxsdk" + "$ENV{ADSK_3DSMAX_SDK_2020}/maxsdk" + "$ENV{ADSK_3DSMAX_SDK_2019}/maxsdk" + "$ENV{ADSK_3DSMAX_SDK_2018}/maxsdk" + "$ENV{ADSK_3DSMAX_SDK_2017}/maxsdk" + "$ENV{ADSK_3DSMAX_SDK_2016}/maxsdk" + "$ENV{ADSK_3DSMAX_SDK_2015}/maxsdk" + "$ENV{ADSK_3DSMAX_SDK_2014}/maxsdk" + "$ENV{ADSK_3DSMAX_SDK_2013}/maxsdk" "$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk" "$ENV{3DSMAX_2011_SDK_PATH}/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2021 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2020 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2019 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2018 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2017 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2016 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2015 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2014 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2013 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2012 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2011 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2010 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2009 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 2008 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3ds Max 9 SDK/maxsdk" + "$ENV{${_pf_x86}}/Autodesk/3dsMax8/maxsdk" + "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2021 SDK/maxsdk" + "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2020 SDK/maxsdk" + "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2019 SDK/maxsdk" + "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2018 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2017 SDK/maxsdk" + "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2016 SDK/maxsdk" + "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2015 SDK/maxsdk" + "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2014 SDK/maxsdk" + "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2013 SDK/maxsdk" + "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2012 SDK/maxsdk" + "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2011 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk" + "$ENV{PROGRAMFILES}/Autodesk/3dsMax8/maxsdk" ) FIND_PATH(MAXSDK_INCLUDE_DIR diff --git a/code/CMakeModules/FindMySQL.cmake b/code/CMakeModules/FindMySQL.cmake index 8a92cb0c4..631a96224 100644 --- a/code/CMakeModules/FindMySQL.cmake +++ b/code/CMakeModules/FindMySQL.cmake @@ -16,10 +16,12 @@ IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) ELSE() FIND_PATH(MYSQL_INCLUDE_DIR mysql.h - PATH_SUFFIXES mysql + PATH_SUFFIXES mysql mariadb PATHS /usr/include/mysql + /usr/include/mariadb /usr/local/include/mysql + /usr/local/include/mariadb /opt/local/include/mysql5/mysql /opt/local/include/mysql55/mysql /opt/local/include/mysql51/mysql @@ -27,28 +29,29 @@ ELSE() $ENV{SystemDrive}/MySQL/*/include) IF(WIN32 AND MSVC) - FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES libmysql mysqlclient + FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES libmysql mysqlclient libmariadb mariadbclient PATHS $ENV{ProgramFiles}/MySQL/*/lib/opt $ENV{SystemDrive}/MySQL/*/lib/opt) - - FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES libmysqld mysqlclientd + FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES libmysqld mysqlclientd libmariadb mariadbclient PATHS $ENV{ProgramFiles}/MySQL/*/lib/opt $ENV{SystemDrive}/MySQL/*/lib/opt) ELSE() - FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient + FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient mariadbclient PATHS /usr/lib /usr/local/lib + /usr/lib/mariadb /usr/lib/mysql /usr/local/lib/mysql + /usr/local/lib/mariadb /opt/local/lib/mysql5/mysql /opt/local/lib/mysql55/mysql /opt/local/lib/mysql51/mysql ) - FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd + FIND_LIBRARY(MYSQL_LIBRARY_DEBUG NAMES mysqlclientd mariadbclientd PATHS /usr/lib /usr/local/lib @@ -80,6 +83,10 @@ ELSE() IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) SET(MYSQL_FOUND TRUE) MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}") + IF (MYSQL_LIBRARIES MATCHES "libmariadb" OR MYSQL_LIBRARIES MATCHES "mariadbclient") + SET(MARIADB_FOUND TRUE) + MESSAGE(STATUS "Found MariaDB.") + ENDIF() ELSE() SET(MYSQL_FOUND FALSE) MESSAGE(STATUS "MySQL not found.") diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index b216eb1e4..bd70dd2ff 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -568,6 +568,11 @@ MACRO(NL_SETUP_BUILD) ADD_PLATFORM_FLAGS("-DENABLE_LOGS") ENDIF() + SET(CUSTOM_FLAGS "" CACHE STRING "Custom compile flags (useful for /MPn)") + IF(NOT ${CUSTOM_FLAGS} STREQUAL "") + ADD_PLATFORM_FLAGS(${CUSTOM_FLAGS}) + ENDIF() + IF(MSVC) # Ignore default include paths ADD_PLATFORM_FLAGS("/X") diff --git a/code/nel/include/nel/misc/common.h b/code/nel/include/nel/misc/common.h index d7f5ce581..4b1e2e260 100644 --- a/code/nel/include/nel/misc/common.h +++ b/code/nel/include/nel/misc/common.h @@ -290,7 +290,7 @@ template T trimSeparators (const T &str) } // if both first and last char are quotes (' or "), then remove them -template T trimQuotes (const T&str) +template T trimQuotes (const T &str) { typename T::size_type size = str.size(); if (size == 0) @@ -327,28 +327,23 @@ inline sint nlstricmp(const std::string &lhs, const std::string &rhs) { return s inline sint nlstricmp(const std::string &lhs, const char *rhs) { return stricmp(lhs.c_str(),rhs); } inline sint nlstricmp(const char *lhs, const std::string &rhs) { return stricmp(lhs,rhs.c_str()); } -// macros helper to convert UTF-8 std::string and wchar_t* -#define wideToUtf8(str) (ucstring((ucchar*)str).toUtf8()) -#define utf8ToWide(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str()) - -// macros helper to convert UTF-8 std::string and TCHAR* -#ifdef _UNICODE -#define tStrToUtf8(str) (ucstring((ucchar*)(LPCWSTR)str).toUtf8()) -#define utf8ToTStr(str) ((wchar_t*)ucstring::makeFromUtf8(str).c_str()) -#else -#define tStrToUtf8(str) (std::string((LPCSTR)str)) -#define utf8ToTStr(str) (str.c_str()) +#if (NL_COMP_VC_VERSION <= 90) +inline float nlroundf(float x) +{ + return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f); +} +#define roundf(x) NLMISC::nlroundf(x) #endif -// wrapper for fopen to be able to open files with an UTF-8 filename -FILE* nlfopen(const std::string &filename, const std::string &mode); +// Wrapper for fopen to be able to open files with an UTF-8 filename +FILE *nlfopen(const std::string &filename, const std::string &mode); /** Signed 64 bit fseek. Same interface as fseek */ -int nlfseek64( FILE *stream, sint64 offset, int origin ); +int nlfseek64(FILE *stream, sint64 offset, int origin); // Retrieve position in a file, same interface as ftell -sint64 nlftell64(FILE *stream); +sint64 nlftell64(FILE *stream); /** * Base class for all NeL exception. diff --git a/code/nel/include/nel/misc/string_common.h b/code/nel/include/nel/misc/string_common.h index 2839c2bfc..bb972a4eb 100644 --- a/code/nel/include/nel/misc/string_common.h +++ b/code/nel/include/nel/misc/string_common.h @@ -242,54 +242,11 @@ inline bool fromString(const std::string &str, sint64 &val) { bool ret = sscanf( inline bool fromString(const std::string &str, float &val) { bool ret = sscanf(str.c_str(), "%f", &val) == 1; if (!ret) val = 0.0f; return ret; } inline bool fromString(const std::string &str, double &val) { bool ret = sscanf(str.c_str(), "%lf", &val) == 1; if (!ret) val = 0.0; return ret; } -inline bool fromString(const std::string &str, bool &val) -{ - if (str.length() == 1) - { - const char c = str[0]; - - switch(c) - { - case '1': - case 't': - case 'T': - case 'y': - case 'Y': - val = true; - break; - - case '0': - case 'f': - case 'F': - case 'n': - case 'N': - val = false; - break; - - default: - val = false; - return false; - } - } - else - { - if (str == "true" || str == "yes") - { - val = true; - } - else if (str == "false" || str == "no") - { - val = false; - } - else - { - val = false; - return false; - } - } +// Fast string to bool, reliably defined for strings starting with 0, 1, t, T, f, F, y, Y, n, N, anything else is undefined. +// (str[0] == '1' || (str[0] & 0xD2) == 0x50) +// - Kaetemi - return true; -} +bool fromString(const std::string &str, bool &val); inline bool fromString(const std::string &str, std::string &val) { val = str; return true; } @@ -300,6 +257,105 @@ inline bool fromString(const std::string &str, uint &val) { return sscanf(str.c_ inline bool fromString(const std::string &str, sint &val) { return sscanf(str.c_str(), "%d", &val) == 1; } #endif // NL_COMP_VC6 +// Convert local codepage to UTF-8 +// On Windows, the local codepage is undetermined +// On Linux, the local codepage is always UTF-8 (no-op) +std::string mbcsToUtf8(const char *str, size_t len = 0); +std::string mbcsToUtf8(const std::string &str); + +// Convert wide codepage to UTF-8 +// On Windows, the wide codepage is UTF-16 +// On Linux, the wide codepage is UTF-32 +std::string wideToUtf8(const wchar_t *str, size_t len = 0); +std::string wideToUtf8(const std::wstring &str); + +// Convert UTF-8 to wide character set +std::wstring utf8ToWide(const char *str, size_t len = 0); +std::wstring utf8ToWide(const std::string &str); + +// Convert UTF-8 to local multibyte character set +std::string utf8ToMbcs(const char *str, size_t len = 0); +std::string utf8ToMbcs(const std::string &str); + +// Convert wide to local multibyte character set +std::string wideToMbcs(const wchar_t *str, size_t len = 0); +std::string wideToMbcs(const std::wstring &str); + +// Convert local multibyte to wide character set +std::wstring mbcsToWide(const char *str, size_t len = 0); +std::wstring mbcsToWide(const std::string &str); + +inline const char *asCStr(const char *str) { return str; } +inline const char *asCStr(const std::string &str) { return str.c_str(); } +inline const wchar_t *asCStr(const wchar_t *str) { return str; } +inline const wchar_t *asCStr(const std::wstring &str) { return str.c_str(); } + +#if defined(NL_OS_WINDOWS) +#define nlUtf8ToMbcs(str) (NLMISC::utf8ToMbcs(str).c_str()) +#define nlMbcsToUtf8(str) (NLMISC::mbcsToUtf8(str).c_str()) +#else +#define nlUtf8ToMbcs(str) (NLMISC::asCStr(str)) +#define nlMbcsToUtf8(str) (NLMISC::asCStr(str)) +#endif +#define nlWideToUtf8(str) (NLMISC::wideToUtf8(str).c_str()) +#define nlUtf8ToWide(str) (NLMISC::utf8ToWide(str).c_str()) +#define nlWideToMbcs(str) (NLMISC::wideToMbcs(str).c_str()) +#define nlMbcsToWide(str) (NLMISC::mbcsToWide(str).c_str()) + +// On Windows, tstring is either local multibyte or utf-16 wide +// On Linux, tstring is always utf-8 + +#if defined(NL_OS_WINDOWS) && (defined(UNICODE) || defined(_UNICODE)) +typedef std::wstring tstring; +typedef wchar_t tchar; +inline std::string tStrToUtf8(const tchar *str) { return wideToUtf8((const wchar_t *)str); } +inline std::string tStrToUtf8(const tstring &str) { return wideToUtf8((const std::wstring &)str); } +inline std::wstring tStrToWide(const tchar *str) { return (const wchar_t *)str; } +inline std::wstring tStrToWide(const tstring &str) { return (const std::wstring &)str; } +inline std::string tStrToMbcs(const tchar *str) { return wideToMbcs((const wchar_t *)str); } +inline std::string tStrToMbcs(const tstring &str) { return wideToMbcs((const std::wstring &)str); } +#define nlTStrToUtf8(str) (NLMISC::tStrToUtf8(str).c_str()) +#define nlTStrToWide(str) ((const wchar_t *)NLMISC::asCStr(str)) +#define nlTStrToMbcs(str) (NLMISC::tStrToMbcs(str).c_str()) +inline tstring utf8ToTStr(const char *str) {return (const tstring &)utf8ToWide(str); } +inline tstring utf8ToTStr(const std::string &str) { return (const tstring &)utf8ToWide(str); } +inline tstring wideToTStr(const wchar_t *str) { return (const tchar *)str; } +inline tstring wideToTStr(const std::wstring &str) { return (const tstring &)str; } +inline tstring mbcsToTStr(const char *str) { return (const tstring &)mbcsToWide(str); } +inline tstring mbcsToTStr(const std::string &str) { return (const tstring &)mbcsToWide(str); } +#define nlUtf8ToTStr(str) (NLMISC::utf8ToTStr(str).c_str()) +#define nlWideToTStr(str) ((const tchar *)NLMISC::asCStr(str)) +#define nlMbcsToTStr(str) (NLMISC::mbcsToTStr(str).c_str()) +#else +typedef std::string tstring; +typedef char tchar; +inline std::string tStrToUtf8(const tchar *str) { return mbcsToUtf8((const char *)str); } +inline std::string tStrToUtf8(const tstring &str) { return mbcsToUtf8((const std::string &)str); } +inline std::wstring tStrToWide(const tchar *str) { return mbcsToWide((const char *)str); } +inline std::wstring tStrToWide(const tstring &str) { return mbcsToWide((const std::string &)str); } +inline std::string tStrToMbcs(const tchar *str) { return (const char *)str; } +inline std::string tStrToMbcs(const tstring &str) { return (const std::string &)str; } +#if defined(NL_OS_WINDOWS) +#define nlTStrToUtf8(str) (NLMISC::tStrToUtf8(str).c_str()) +#else +#define nlTStrToUtf8(str) ((const char *)NLMISC::asCStr(str)) +#endif +#define nlTStrToWide(str) (NLMISC::tStrToWide(str).c_str()) +#define nlTStrToMbcs(str) ((const char *)NLMISC::asCStr(str)) +inline tstring utf8ToTStr(const char *str) { return (const tstring &)utf8ToMbcs(str); } +inline tstring utf8ToTStr(const std::string &str) { return (const tstring &)utf8ToMbcs(str); } +inline tstring wideToTStr(const wchar_t *str) { return (const tstring &)wideToMbcs(str); } +inline tstring wideToTStr(const std::wstring &str) { return (const tstring &)wideToMbcs(str); } +inline tstring mbcsToTStr(const char *str) { return (const tchar *)str; } +inline tstring mbcsToTStr(const std::string &str) { return (const tstring &)str; } +#if defined(NL_OS_WINDOWS) +#define nlUtf8ToTStr(str) (NLMISC::utf8ToTStr(str).c_str()) +#else +#define nlUtf8ToTStr(str) ((const tchar *)NLMISC::asCStr(str)) +#endif +#define nlWideToTStr(str) (NLMISC::wideToTStr(str).c_str()) +#define nlMbcsToTStr(str) ((const tchar *)NLMISC::asCStr(str)) +#endif } // NLMISC diff --git a/code/nel/include/nel/misc/system_utils.h b/code/nel/include/nel/misc/system_utils.h index b6f121d94..c51a5ab99 100644 --- a/code/nel/include/nel/misc/system_utils.h +++ b/code/nel/include/nel/misc/system_utils.h @@ -70,10 +70,10 @@ public: static void setRootKey(const std::string &root); /// Read a value from registry. - static std::string getRegKey(const std::string &Entry); + static std::string getRegKey(const std::string &entry); /// Write a value to registry. - static bool setRegKey(const std::string &ValueName, const std::string &Value); + static bool setRegKey(const std::string &valueName, const std::string &value); /// Get desktop current color depth without using UDriver. static uint getCurrentColorDepth(); diff --git a/code/nel/include/nel/misc/types_nl.h b/code/nel/include/nel/misc/types_nl.h index 6431701fe..353f50490 100644 --- a/code/nel/include/nel/misc/types_nl.h +++ b/code/nel/include/nel/misc/types_nl.h @@ -173,6 +173,12 @@ # define NL_NO_EXCEPTION_SPECS #endif +#if defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 140) +#define nlmove(v) std::move(v) +#else +#define nlmove(v) (v) +#endif + // gcc 3.4 introduced ISO C++ with tough template rules // // NL_ISO_SYNTAX can be used using #if NL_ISO_SYNTAX or #if !NL_ISO_SYNTAX @@ -220,6 +226,7 @@ # if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10) # pragma warning (disable : 4005) // don't warn on redefinitions caused by xp platform sdk # endif // NL_COMP_VC8 || NL_COMP_VC9 +# pragma warning (disable : 26495) // Variable is uninitialized. Always initialize a member variable. (On purpose for performance.) #endif // NL_OS_WINDOWS @@ -519,6 +526,15 @@ template<> struct hash */ typedef uint16 ucchar; +#if defined(NL_OS_WINDOWS) && (defined(UNICODE) || defined(_UNICODE)) +#define nltmain wmain +#define nltWinMain wWinMain +#else +#define nltmain main +#if defined(NL_OS_WINDOWS) +#define nltWinMain WinMain +#endif +#endif // To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234) #ifdef NL_COMP_VC diff --git a/code/nel/include/nel/net/service.h b/code/nel/include/nel/net/service.h index 02967d317..5d99477ff 100644 --- a/code/nel/include/nel/net/service.h +++ b/code/nel/include/nel/net/service.h @@ -54,7 +54,17 @@ struct HINSTANCE__; typedef struct HINSTANCE__ *HINSTANCE; typedef char CHAR; +typedef wchar_t WCHAR; + typedef CHAR *LPSTR; +typedef WCHAR *LPWSTR; + +#if defined(UNICODE) || defined(_UNICODE) +typedef LPWSTR LPTSTR; +#else +typedef LPSTR LPTSTR; +#endif + #endif namespace NLNET @@ -117,11 +127,11 @@ class IServiceUpdatable; #if defined(NL_OS_WINDOWS) && defined(_WINDOWS) #define NLNET_SERVICE_MAIN(__ServiceClassName, __ServiceShortName, __ServiceLongName, __ServicePort, __ServiceCallbackArray, __ConfigDir, __LogDir) \ \ -int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) \ +int APIENTRY nltWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) \ { \ NLMISC::CApplicationContext serviceContext; \ __ServiceClassName *scn = new __ServiceClassName; \ - scn->setArgs (lpCmdLine); \ + scn->setArgs (nlTStrToUtf8(lpCmdLine)); \ createDebug(NULL,!scn->haveLongArg("nolog"));\ scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \ sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__ " " __TIME__); \ @@ -132,7 +142,7 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL #else #define NLNET_SERVICE_MAIN(__ServiceClassName, __ServiceShortName, __ServiceLongName, __ServicePort, __ServiceCallbackArray, __ConfigDir, __LogDir) \ \ -int main(int argc, const char **argv) \ +int nltmain(int argc, const NLMISC::tchar **argv) \ { \ NLMISC::CApplicationContext serviceContext; \ __ServiceClassName *scn = new __ServiceClassName; \ @@ -340,6 +350,9 @@ public: /// Sets the command line and init _Args variable. You must call this before calling main() void setArgs (int argc, const char **argv); + /// Sets the command line and init _Args variable. You must call this before calling main() + void setArgs (int argc, const wchar_t **argv); + /// Sets the command line and init _Args variable. You must call this before calling main() void setArgs (const char *args); diff --git a/code/nel/include/nel/sound/audio_decoder_mp3.h b/code/nel/include/nel/sound/audio_decoder_mp3.h index fac2e2693..e6ef91326 100644 --- a/code/nel/include/nel/sound/audio_decoder_mp3.h +++ b/code/nel/include/nel/sound/audio_decoder_mp3.h @@ -18,6 +18,8 @@ #define NLSOUND_AUDIO_DECODER_MP3_H #include +#if (NL_COMP_VC_VERSION > 90) /* VS2008 does not have stdint.h */ + #include // disable drmp3_init_file() @@ -91,6 +93,8 @@ public: } /* namespace NLSOUND */ +#endif /* (NL_COMP_VC_VERSION > 90) */ + #endif // NLSOUND_AUDIO_DECODER_MP3_H /* end of file */ diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 7a4618683..43d33d081 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -1810,7 +1810,7 @@ emptyProc CDriverD3D::getWindowProc() IDriver::TMessageBoxId CDriverD3D::systemMessageBox (const char* message, const char* title, TMessageBoxType type, TMessageBoxIcon icon) { - switch (::MessageBoxW (_HWnd, utf8ToWide(message), utf8ToWide(title), ((type==retryCancelType)?MB_RETRYCANCEL: + switch (::MessageBoxW(_HWnd, nlUtf8ToWide(message), nlUtf8ToWide(title), ((type == retryCancelType) ? MB_RETRYCANCEL : (type==yesNoCancelType)?MB_YESNOCANCEL: (type==okCancelType)?MB_OKCANCEL: (type==abortRetryIgnoreType)?MB_ABORTRETRYIGNORE: diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 3d1803a2a..2e0f2e7a5 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -2644,7 +2644,7 @@ IDriver::TMessageBoxId CDriverGL::systemMessageBox (const char* message, const c { H_AUTO_OGL(CDriverGL_systemMessageBox) #ifdef NL_OS_WINDOWS - switch (::MessageBoxW (NULL, utf8ToWide(message), utf8ToWide(title), ((type==retryCancelType)?MB_RETRYCANCEL: + switch (::MessageBoxW(NULL, nlUtf8ToWide(message), nlUtf8ToWide(title), ((type == retryCancelType) ? MB_RETRYCANCEL : (type==yesNoCancelType)?MB_YESNOCANCEL: (type==okCancelType)?MB_OKCANCEL: (type==abortRetryIgnoreType)?MB_ABORTRETRYIGNORE: diff --git a/code/nel/src/3d/vertex_buffer_heap.cpp b/code/nel/src/3d/vertex_buffer_heap.cpp index e33a6757c..ad46d33d8 100644 --- a/code/nel/src/3d/vertex_buffer_heap.cpp +++ b/code/nel/src/3d/vertex_buffer_heap.cpp @@ -25,6 +25,8 @@ using namespace NLMISC; #define new DEBUG_NEW #endif +void vertex_buffer_heap_dummy_cpp() { } + // This code is not used actually and doesn't compile // just preproc comment it #if 0 diff --git a/code/nel/src/gui/lua_ihm.cpp b/code/nel/src/gui/lua_ihm.cpp index 4a51d221f..b36b9cca8 100644 --- a/code/nel/src/gui/lua_ihm.cpp +++ b/code/nel/src/gui/lua_ihm.cpp @@ -115,7 +115,7 @@ namespace NLGUI { #if !FINAL_VERSION #ifdef NL_OS_WINDOWS - ShellExecuteW(NULL, utf8ToWide(operation), utf8ToWide(fileName), utf8ToWide(parameters), NULL, SW_SHOWDEFAULT); + ShellExecuteW(NULL, nlUtf8ToWide(operation), nlUtf8ToWide(fileName), nlUtf8ToWide(parameters), NULL, SW_SHOWDEFAULT); #endif #endif } diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 72f29eb82..bb7cf0bcd 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -911,7 +911,7 @@ static bool createProcess(const std::string &programName, const std::string &arg } // or 0 for a window - BOOL res = CreateProcessW(sProgramName, utf8ToWide(args), NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, NULL, NULL /* current dir */, &si, &pi); + BOOL res = CreateProcessW(sProgramName, (LPWSTR)nlUtf8ToWide(args), NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NO_WINDOW, NULL, NULL /* current dir */, &si, &pi); if (sProgramName) { @@ -1453,7 +1453,7 @@ void displayDwordBits( uint32 b, uint nbits, sint beginpos, bool displayBegin, N FILE* nlfopen(const std::string &filename, const std::string &mode) { #ifdef NL_OS_WINDOWS - return _wfopen(utf8ToWide(filename), utf8ToWide(mode)); + return _wfopen(nlUtf8ToWide(filename), nlUtf8ToWide(mode)); #else return fopen(filename.c_str(), mode.c_str()); #endif @@ -1632,7 +1632,7 @@ static bool openDocWithExtension (const std::string &document, const std::string { #ifdef NL_OS_WINDOWS // First try ShellExecute() - HINSTANCE result = ShellExecuteW(NULL, L"open", utf8ToWide(document), NULL, NULL, SW_SHOWDEFAULT); + HINSTANCE result = ShellExecuteW(NULL, L"open", nlUtf8ToWide(document), NULL, NULL, SW_SHOWDEFAULT); // If it failed, get the .htm regkey and lookup the program if ((uintptr_t)result <= HINSTANCE_ERROR) @@ -1640,7 +1640,7 @@ static bool openDocWithExtension (const std::string &document, const std::string wchar_t key[MAX_PATH + MAX_PATH]; // get the type of the extension - if (GetRegKey(HKEY_CLASSES_ROOT, utf8ToWide("." + ext), key) == ERROR_SUCCESS) + if (GetRegKey(HKEY_CLASSES_ROOT, nlUtf8ToWide("." + ext), key) == ERROR_SUCCESS) { lstrcatW(key, L"\\shell\\open\\command"); diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index c6d10b700..260834200 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -1431,7 +1431,7 @@ int getLastError() std::string formatErrorMessage(int errorCode) { #ifdef NL_OS_WINDOWS - LPVOID lpMsgBuf = NULL; + LPWSTR lpMsgBuf = NULL; DWORD len = FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | @@ -1439,7 +1439,7 @@ std::string formatErrorMessage(int errorCode) NULL, errorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPWSTR) &lpMsgBuf, + (LPWSTR)(&lpMsgBuf), 0, NULL ); diff --git a/code/nel/src/misc/displayer.cpp b/code/nel/src/misc/displayer.cpp index 8feaa9358..ba5cc85d0 100644 --- a/code/nel/src/misc/displayer.cpp +++ b/code/nel/src/misc/displayer.cpp @@ -286,14 +286,14 @@ void CStdDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mess // WARNING: READ THIS !!!!!!!!!!!!!!!! /////////////////////////// // If at the release time, it freezes here, it's a microsoft bug: // http://support.microsoft.com/support/kb/articles/q173/2/60.asp - OutputDebugStringW(utf8ToWide(str2)); + OutputDebugStringW(nlUtf8ToWide(str2)); } else { sint count = 0; uint n = (uint)strlen(message); std::string s(&str2.c_str()[0], (str2.size() - n)); - OutputDebugStringW(utf8ToWide(s)); + OutputDebugStringW(nlUtf8ToWide(s)); for(;;) { @@ -301,14 +301,14 @@ void CStdDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mess if((n - count) < maxOutString ) { s = std::string(&message[count], (n - count)); - OutputDebugStringW(utf8ToWide(s)); + OutputDebugStringW(nlUtf8ToWide(s)); OutputDebugStringW(L"\n"); break; } else { s = std::string(&message[count] , count + maxOutString); - OutputDebugStringW(utf8ToWide(s)); + OutputDebugStringW(nlUtf8ToWide(s)); OutputDebugStringW(L"\n\t\t\t"); count += maxOutString; } @@ -323,13 +323,13 @@ void CStdDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mess if (pos+1000 < args.CallstackAndLog.size ()) { splited = args.CallstackAndLog.substr (pos, 1000); - OutputDebugStringW(utf8ToWide(splited)); + OutputDebugStringW(nlUtf8ToWide(splited)); pos += 1000; } else { splited = args.CallstackAndLog.substr (pos); - OutputDebugStringW(utf8ToWide(splited)); + OutputDebugStringW(nlUtf8ToWide(splited)); break; } } diff --git a/code/nel/src/misc/dynloadlib.cpp b/code/nel/src/misc/dynloadlib.cpp index 66f774fa2..a36c02f17 100644 --- a/code/nel/src/misc/dynloadlib.cpp +++ b/code/nel/src/misc/dynloadlib.cpp @@ -32,7 +32,7 @@ NL_LIB_HANDLE nlLoadLibrary(const std::string &libName) { NL_LIB_HANDLE res = 0; #ifdef NL_OS_WINDOWS - res = LoadLibraryW(utf8ToWide(libName)); + res = LoadLibraryW(nlUtf8ToWide(libName)); #elif defined(NL_OS_UNIX) res = dlopen(libName.c_str(), RTLD_NOW); #else diff --git a/code/nel/src/misc/path.cpp b/code/nel/src/misc/path.cpp index c6f9786f4..0c650918f 100644 --- a/code/nel/src/misc/path.cpp +++ b/code/nel/src/misc/path.cpp @@ -700,7 +700,7 @@ bool CFileContainer::setCurrentPath (const std::string &path) int res; //nldebug("Change current path to '%s' (current path is '%s')", path.c_str(), getCurrentPath().c_str()); #ifdef NL_OS_WINDOWS - res = _wchdir(utf8ToWide(path)); + res = _wchdir(nlUtf8ToWide(path)); #else res = chdir(path.c_str()); #endif @@ -792,7 +792,7 @@ dirent *readdir (DIR *dir) // first visit in this directory : FindFirstFile() if (hFind == NULL) { - hFind = FindFirstFileW (utf8ToWide(CPath::standardizePath(sDir) + "*"), &findData); + hFind = FindFirstFileW(nlUtf8ToWide(CPath::standardizePath(sDir) + "*"), &findData); } // directory already visited : FindNextFile() else @@ -1914,7 +1914,7 @@ string CFile::getPath (const string &filename) bool CFile::isDirectory (const string &filename) { #ifdef NL_OS_WINDOWS - DWORD res = GetFileAttributesW(utf8ToWide(filename)); + DWORD res = GetFileAttributesW(nlUtf8ToWide(filename)); if (res == INVALID_FILE_ATTRIBUTES) { // nlwarning ("PATH: '%s' is not a valid file or directory name", filename.c_str ()); @@ -1937,7 +1937,7 @@ bool CFile::isDirectory (const string &filename) bool CFile::isExists (const string &filename) { #ifdef NL_OS_WINDOWS - return GetFileAttributesW(utf8ToWide(filename)) != INVALID_FILE_ATTRIBUTES; + return GetFileAttributesW(nlUtf8ToWide(filename)) != INVALID_FILE_ATTRIBUTES; #else // NL_OS_WINDOWS struct stat buf; return stat (filename.c_str (), &buf) == 0; @@ -2017,7 +2017,7 @@ uint32 CFile::getFileSize (const std::string &filename) { #if defined (NL_OS_WINDOWS) struct _stat buf; - int result = _wstat (utf8ToWide(filename), &buf); + int result = _wstat(nlUtf8ToWide(filename), &buf); #elif defined (NL_OS_UNIX) struct stat buf; int result = stat (filename.c_str (), &buf); @@ -2068,7 +2068,7 @@ uint32 CFile::getFileModificationDate(const std::string &filename) // Use the WIN32 API to read the file times in UTC // create a file handle (this does not open the file) - HANDLE h = CreateFileW(utf8ToWide(fn), 0, 0, NULL, OPEN_EXISTING, 0, 0); + HANDLE h = CreateFileW(nlUtf8ToWide(fn), 0, 0, NULL, OPEN_EXISTING, 0, 0); if (h == INVALID_HANDLE_VALUE) { nlwarning("Can't get modification date on file '%s' : %s", fn.c_str(), NLMISC::formatErrorMessage(NLMISC::getLastError()).c_str()); @@ -2138,7 +2138,7 @@ bool CFile::setFileModificationDate(const std::string &filename, uint32 modTime) // Use the WIN32 API to set the file times in UTC // create a file handle (this does not open the file) - HANDLE h = CreateFileW(utf8ToWide(fn), GENERIC_WRITE|GENERIC_READ, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); + HANDLE h = CreateFileW(nlUtf8ToWide(fn), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); if (h == INVALID_HANDLE_VALUE) { nlwarning("Can't set modification date on file '%s' (error accessing file) : %s", fn.c_str(), NLMISC::formatErrorMessage(NLMISC::getLastError()).c_str()); @@ -2223,7 +2223,7 @@ uint32 CFile::getFileCreationDate(const std::string &filename) #if defined (NL_OS_WINDOWS) struct _stat buf; - int result = _wstat(utf8ToWide(fn), &buf); + int result = _wstat(nlUtf8ToWide(fn), &buf); #elif defined (NL_OS_UNIX) struct stat buf; int result = stat(fn.c_str (), &buf); @@ -2357,7 +2357,7 @@ static bool CopyMoveFile(const std::string &dest, const std::string &src, bool c else { #ifdef NL_OS_WINDOWS - if (MoveFileW(utf8ToWide(ssrc), utf8ToWide(sdest)) == 0) + if (MoveFileW(nlUtf8ToWide(ssrc), nlUtf8ToWide(sdest)) == 0) { sint lastError = NLMISC::getLastError(); nlwarning ("PATH: CopyMoveFile error: can't link/move '%s' into '%s', error %u (%s)", @@ -2482,7 +2482,7 @@ bool CFile::moveFile(const std::string &dest, const std::string &src) bool CFile::createDirectory(const std::string &filename) { #ifdef NL_OS_WINDOWS - return _wmkdir(utf8ToWide(filename))==0; + return _wmkdir(nlUtf8ToWide(filename)) == 0; #else // Set full permissions.... return mkdir(filename.c_str(), 0xFFFF)==0; @@ -2751,7 +2751,7 @@ bool CFile::deleteFile(const std::string &filename) { setRWAccess(filename); #ifdef NL_OS_WINDOWS - sint res = _wunlink(utf8ToWide(filename)); + sint res = _wunlink(nlUtf8ToWide(filename)); #else sint res = unlink(filename.c_str()); #endif @@ -2770,7 +2770,7 @@ bool CFile::deleteDirectory(const std::string &filename) { setRWAccess(filename); #ifdef NL_OS_WINDOWS - sint res = _wrmdir(utf8ToWide(filename)); + sint res = _wrmdir(nlUtf8ToWide(filename)); #else sint res = rmdir(filename.c_str()); #endif diff --git a/code/nel/src/misc/string_common.cpp b/code/nel/src/misc/string_common.cpp index 9c9085e4e..ba911c1bc 100644 --- a/code/nel/src/misc/string_common.cpp +++ b/code/nel/src/misc/string_common.cpp @@ -17,23 +17,24 @@ #include "stdmisc.h" #include "nel/misc/string_common.h" +#include "nel/misc/sstring.h" using namespace std; #ifdef DEBUG_NEW - #define new DEBUG_NEW +#define new DEBUG_NEW #endif namespace NLMISC { -string addSlashR (const string &str) +string addSlashR(const string &str) { string formatedStr; // replace \n with \r\n for (uint i = 0; i < str.size(); i++) { - if (str[i] == '\n' && i > 0 && str[i-1] != '\r') + if (str[i] == '\n' && i > 0 && str[i - 1] != '\r') { formatedStr += '\r'; } @@ -42,7 +43,7 @@ string addSlashR (const string &str) return formatedStr; } -string removeSlashR (const string &str) +string removeSlashR(const string &str) { string formatedStr; // remove \r @@ -54,4 +55,267 @@ string removeSlashR (const string &str) return formatedStr; } +bool fromString(const std::string &str, bool &val) +{ + if (str.length() == 1) + { + const char c = str[0]; + + switch (c) + { + case '1': + case 't': + case 'T': + case 'y': + case 'Y': + val = true; + break; + + case '0': + case 'f': + case 'F': + case 'n': + case 'N': + val = false; + break; + + default: + val = false; + return false; + } + } + else + { + std::string strl = toLower(str); + if (strl == "true" || strl == "yes") + { + val = true; + } + else if (strl == "false" || strl == "no") + { + val = false; + } + else + { + val = false; + return false; + } + } + + return true; +} + +#if defined(NL_OS_WINDOWS) + +std::string winWideToCp(const wchar_t *str, size_t len, UINT cp) +{ + if (!len) + len = wcslen(str); + if (!len) + return std::string(); + + // Convert from wide to codepage + char *tmp = (char *)_malloca((len + 1) * 4); + if (!tmp) + return std::string(); + int tmpLen = WideCharToMultiByte(cp, 0, + str, (int)(len + 1), + tmp, (int)((len + 1) * 4), + NULL, NULL); + if (tmpLen <= 1) + { + _freea(tmp); + return std::string(); + } + + std::string res = tmp; + _freea(tmp); + return res; +} + +std::string winCpToCp(const char *str, size_t len, UINT srcCp, UINT dstCp) +{ + if (!len) + len = strlen(str); + if (!len) + return std::string(); + + // First convert from codepage to wide + wchar_t *tmp = (wchar_t *)_malloca((len + 1) * 4); + if (!tmp) + return std::string(); + int tmpLen = MultiByteToWideChar(srcCp, MB_PRECOMPOSED, + str, (int)(len + 1), /* include null-termination */ + tmp, (int)((len + 1) * 4)); + if (tmpLen <= 1) + { + _freea(tmp); + return std::string(); + } + + // Then convert from wide to codepage + std::string res = winWideToCp(tmp, (size_t)tmpLen - 1, dstCp); /* tmpLen includes null-term */ + _freea(tmp); + return res; +} + +std::wstring winCpToWide(const char *str, size_t len, UINT cp) +{ + if (!len) + len = strlen(str); + if (!len) + return std::wstring(); + + // Convert from codepage to wide + wchar_t *tmp = (wchar_t *)_malloca((len + 1) * 4); + if (!tmp) + return std::wstring(); + int tmpLen = MultiByteToWideChar(cp, MB_PRECOMPOSED, + str, (int)(len + 1), /* include null-termination */ + tmp, (int)((len + 1) * 4)); + if (tmpLen <= 1) + { + _freea(tmp); + return std::wstring(); + } + + std::wstring res = tmp; + _freea(tmp); + return res; +} + +#endif + +// Convert local codepage to UTF-8 +// On Windows, the local codepage is undetermined +// On Linux, the local codepage is always UTF-8 (no-op) +std::string mbcsToUtf8(const char *str, size_t len) +{ +#if defined(NL_OS_WINDOWS) + UINT codePage = GetACP(); + // Windows 10 allows setting the local codepage to UTF-8 + if (codePage == CP_UTF8) /* 65001 */ + return str; + return winCpToCp(str, len, CP_ACP, CP_UTF8); +#else + return str; /* no-op */ +#endif +} + +std::string mbcsToUtf8(const std::string &str) +{ +#if defined(NL_OS_WINDOWS) + if (str.empty()) + return str; + UINT codePage = GetACP(); + // Windows 10 allows setting the local codepage to UTF-8 + if (codePage == CP_UTF8) /* 65001 */ + return str; + return winCpToCp(str.c_str(), str.size(), CP_ACP, CP_UTF8); +#else + return str; /* no-op */ +#endif +} + +// Convert wide codepage to UTF-8 +// On Windows, the wide codepage is UTF-16 +// On Linux, the wide codepage is UTF-32 +std::string wideToUtf8(const wchar_t *str, size_t len) +{ +#if defined(NL_OS_WINDOWS) + return winWideToCp(str, len, CP_UTF8); +#else + // TODO: UTF-32 to UTF-8 + nlassert(false); +#endif +} + +std::string wideToUtf8(const std::wstring &str) +{ + return wideToUtf8(str.c_str(), str.size()); +} + +// Convert UTF-8 to wide character set +std::wstring utf8ToWide(const char *str, size_t len) +{ +#if defined(NL_OS_WINDOWS) + return winCpToWide(str, len, CP_UTF8); +#else + // TODO: UTF-32 to UTF-8 + nlassert(false); +#endif +} + +std::wstring utf8ToWide(const std::string &str) +{ + return utf8ToWide(str.c_str(), str.size()); +} + +// Convert UTF-8 to local multibyte character set +std::string utf8ToMbcs(const char *str, size_t len) +{ +#if defined(NL_OS_WINDOWS) + UINT codePage = GetACP(); + // Windows 10 allows setting the local codepage to UTF-8 + if (codePage == CP_UTF8) /* 65001 */ + return str; + return winCpToCp(str, len, CP_UTF8, CP_ACP); +#else + return str; /* no-op */ +#endif +} + +std::string utf8ToMbcs(const std::string &str) +{ +#if defined(NL_OS_WINDOWS) + if (str.empty()) + return str; + UINT codePage = GetACP(); + // Windows 10 allows setting the local codepage to UTF-8 + if (codePage == CP_UTF8) /* 65001 */ + return str; + return winCpToCp(str.c_str(), str.size(), CP_UTF8, CP_ACP); +#else + return str; /* no-op */ +#endif +} + +// Convert wide to local multibyte character set +std::string wideToMbcs(const wchar_t *str, size_t len) +{ +#if defined(NL_OS_WINDOWS) + return winWideToCp(str, len, CP_ACP); +#else + return wideToUtf8(str, len); +#endif +} + +std::string wideToMbcs(const std::wstring &str) +{ +#if defined(NL_OS_WINDOWS) + return winWideToCp(str.c_str(), str.size(), CP_ACP); +#else + return wideToUtf8(str); +#endif +} + +// Convert local multibyte to wide character set +std::wstring mbcsToWide(const char *str, size_t len) +{ +#if defined(NL_OS_WINDOWS) + return winCpToWide(str, len, CP_ACP); +#else + return utf8ToWide(str, len); +#endif +} + +std::wstring mbcsToWide(const std::string &str) +{ +#if defined(NL_OS_WINDOWS) + return winCpToWide(str.c_str(), str.size(), CP_ACP); +#else + return utf8ToWide(str); +#endif +} + } diff --git a/code/nel/src/misc/system_info.cpp b/code/nel/src/misc/system_info.cpp index 75d9707b3..3e8c296d3 100644 --- a/code/nel/src/misc/system_info.cpp +++ b/code/nel/src/misc/system_info.cpp @@ -1460,7 +1460,7 @@ uint64 CSystemInfo::availableHDSpace (const string &filename) return (uint64)stfs.f_bavail * (uint64)stfs.f_bsize; #else ULARGE_INTEGER freeSpace = {0}; - BOOL bRes = ::GetDiskFreeSpaceExW(utf8ToWide(path), &freeSpace, NULL, NULL); + BOOL bRes = ::GetDiskFreeSpaceExW(nlUtf8ToWide(path), &freeSpace, NULL, NULL); if (!bRes) return 0; return (uint64)freeSpace.QuadPart; diff --git a/code/nel/src/misc/system_utils.cpp b/code/nel/src/misc/system_utils.cpp index 480e1c9a1..3655bc70c 100644 --- a/code/nel/src/misc/system_utils.cpp +++ b/code/nel/src/misc/system_utils.cpp @@ -323,58 +323,55 @@ void CSystemUtils::setRootKey(const std::string &root) RootKey = root; } -string CSystemUtils::getRegKey(const string &Entry) +string CSystemUtils::getRegKey(const string &entry) { string ret; #ifdef NL_OS_WINDOWS HKEY hkey; - if (RegOpenKeyExW(HKEY_CURRENT_USER, utf8ToWide(RootKey), 0, KEY_READ, &hkey) == ERROR_SUCCESS) + if (RegOpenKeyExW(HKEY_CURRENT_USER, nlUtf8ToWide(RootKey), 0, KEY_READ, &hkey) == ERROR_SUCCESS) { DWORD dwType = 0L; DWORD dwSize = KeyMaxLength; - wchar_t Buffer[KeyMaxLength]; + wchar_t buffer[KeyMaxLength]; - if (RegQueryValueExW(hkey, utf8ToWide(Entry), NULL, &dwType, (LPBYTE)Buffer, &dwSize) != ERROR_SUCCESS) + if (RegQueryValueExW(hkey, nlUtf8ToWide(entry), NULL, &dwType, (LPBYTE)buffer, &dwSize) != ERROR_SUCCESS) { - nlwarning("Can't get the reg key '%s'", Entry.c_str()); + nlwarning("Can't get the reg key '%s'", entry.c_str()); } else { - ret = wideToUtf8(Buffer); + ret = wideToUtf8(buffer); } RegCloseKey(hkey); } else { - nlwarning("Can't get the reg key '%s'", Entry.c_str()); + nlwarning("Can't get the reg key '%s'", entry.c_str()); } #endif return ret; } -bool CSystemUtils::setRegKey(const string &ValueName, const string &Value) +bool CSystemUtils::setRegKey(const string &valueName, const string &value) { bool res = false; #ifdef NL_OS_WINDOWS HKEY hkey; DWORD dwDisp; - if (RegCreateKeyExW(HKEY_CURRENT_USER, utf8ToWide(RootKey), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwDisp) == ERROR_SUCCESS) + if (RegCreateKeyExW(HKEY_CURRENT_USER, nlUtf8ToWide(RootKey), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwDisp) == ERROR_SUCCESS) { - ucstring utf16Value = ucstring::makeFromUtf8(Value); - // we must use the real Unicode string size in bytes - DWORD size = (utf16Value.length() + 1) * 2; - - if (RegSetValueExW(hkey, utf8ToWide(ValueName), 0L, REG_SZ, (const BYTE *)utf16Value.c_str(), size) == ERROR_SUCCESS) + std::wstring wvalue = nlUtf8ToWide(value); + if (RegSetValueExW(hkey, nlUtf8ToWide(valueName), 0, REG_SZ, (const BYTE *)wvalue.c_str(), (wvalue.size() + 1) * sizeof(WCHAR)) == ERROR_SUCCESS) res = true; RegCloseKey(hkey); } else { - nlwarning("Can't set the reg key '%s' '%s'", ValueName.c_str(), Value.c_str()); + nlwarning("Can't set the reg key '%s' '%s'", valueName.c_str(), value.c_str()); } #endif diff --git a/code/nel/src/misc/win_displayer.cpp b/code/nel/src/misc/win_displayer.cpp index d350f25f3..03e1265b9 100644 --- a/code/nel/src/misc/win_displayer.cpp +++ b/code/nel/src/misc/win_displayer.cpp @@ -298,7 +298,7 @@ void CWinDisplayer::updateLabels () } } - SendMessageW ((HWND)access.value()[i].Hwnd, WM_SETTEXT, 0, (LPARAM) utf8ToWide(n)); + SendMessageW((HWND)access.value()[i].Hwnd, WM_SETTEXT, 0, (LPARAM)nlUtf8ToWide(n)); access.value()[i].NeedUpdate = false; } } diff --git a/code/nel/src/net/service.cpp b/code/nel/src/net/service.cpp index 24064db55..b0242bb86 100644 --- a/code/nel/src/net/service.cpp +++ b/code/nel/src/net/service.cpp @@ -492,6 +492,13 @@ void IService::setArgs (int argc, const char **argv) } } +void IService::setArgs(int argc, const wchar_t **argv) +{ + for (sint i = 0; i < argc; i++) + { + _Args.push_back(nlWideToUtf8(argv[i])); + } +} void cbLogFilter (CConfigFile::CVar &var) { diff --git a/code/nel/src/sound/audio_decoder.cpp b/code/nel/src/sound/audio_decoder.cpp index d849ed770..f56f16a2e 100644 --- a/code/nel/src/sound/audio_decoder.cpp +++ b/code/nel/src/sound/audio_decoder.cpp @@ -103,10 +103,12 @@ IAudioDecoder *IAudioDecoder::createAudioDecoder(const std::string &type, NLMISC { return new CAudioDecoderVorbis(stream, loop); } +#if (NL_COMP_VC_VERSION > 90) /* VS2008 does not have stdint.h */ else if (type_lower == "mp3") { return new CAudioDecoderMP3(stream, loop); } +#endif else { nlwarning("Music file type unknown: '%s'", type_lower.c_str()); @@ -144,6 +146,7 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st nlwarning("Unable to open: '%s'", filepath.c_str()); } +#if (NL_COMP_VC_VERSION > 90) /* VS2008 does not have stdint.h */ else if (type_lower == "mp3") { CIFile ifile; @@ -154,6 +157,7 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st nlwarning("Unable to open: '%s'", filepath.c_str()); } +#endif else { nlwarning("Music file type unknown: '%s'", type_lower.c_str()); diff --git a/code/nel/src/sound/audio_decoder_mp3.cpp b/code/nel/src/sound/audio_decoder_mp3.cpp index dc740bec0..fd8b1721c 100644 --- a/code/nel/src/sound/audio_decoder_mp3.cpp +++ b/code/nel/src/sound/audio_decoder_mp3.cpp @@ -17,6 +17,8 @@ #include "stdsound.h" +#if (NL_COMP_VC_VERSION > 90) /* VS2008 does not have stdint.h */ + #include #define DR_MP3_IMPLEMENTATION @@ -221,4 +223,6 @@ void CAudioDecoderMP3::setLooping(bool loop) } /* namespace NLSOUND */ +#endif /* (NL_COMP_VC_VERSION > 90) */ + /* end of file */ diff --git a/code/nel/src/sound/driver/openal/CMakeLists.txt b/code/nel/src/sound/driver/openal/CMakeLists.txt index 911214a57..22b3f4348 100644 --- a/code/nel/src/sound/driver/openal/CMakeLists.txt +++ b/code/nel/src/sound/driver/openal/CMakeLists.txt @@ -36,8 +36,11 @@ NL_ADD_LIB_SUFFIX(${NLDRV_AL_LIB}) IF(WIN32) # Find and include EFX-Util on Windows. FIND_PACKAGE(EFXUtil) - INCLUDE_DIRECTORIES(${EFXUTIL_INCLUDE_DIR}) - TARGET_LINK_LIBRARIES(${NLDRV_AL_LIB} ${EFXUTIL_LIBRARY}) + IF(EFXUTIL_FOUND) + INCLUDE_DIRECTORIES(${EFXUTIL_INCLUDE_DIR}) + TARGET_LINK_LIBRARIES(${NLDRV_AL_LIB} ${EFXUTIL_LIBRARY}) + ADD_DEFINITIONS(-DEFX_CREATIVE_AVAILABLE=1) + ENDIF() ENDIF() IF(WITH_PCH) diff --git a/code/nel/src/sound/driver/openal/ext_al.h b/code/nel/src/sound/driver/openal/ext_al.h index 0b7eaa2bf..b87cf48f2 100644 --- a/code/nel/src/sound/driver/openal/ext_al.h +++ b/code/nel/src/sound/driver/openal/ext_al.h @@ -17,12 +17,12 @@ #ifndef NL_EXT_AL_H #define NL_EXT_AL_H -#ifdef NL_OS_WINDOWS -# define EFX_CREATIVE_AVAILABLE 1 -# define EAX_AVAILABLE 0 -#else -# define EFX_CREATIVE_AVAILABLE 0 -# define EAX_AVAILABLE 0 +#ifndef EFX_CREATIVE_AVAILABLE +#define EFX_CREATIVE_AVAILABLE 0 +#endif + +#ifndef EAX_AVAILABLE +#define EAX_AVAILABLE 0 #endif #if EAX_AVAILABLE diff --git a/code/nel/src/sound/driver/sound_driver.cpp b/code/nel/src/sound/driver/sound_driver.cpp index 4c83d5a0d..04a16509b 100644 --- a/code/nel/src/sound/driver/sound_driver.cpp +++ b/code/nel/src/sound/driver/sound_driver.cpp @@ -226,7 +226,7 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD */ #ifdef NL_OS_WINDOWS wchar_t buffer[1024], *ptr; - uint len = SearchPathW (NULL, utf8ToWide(dllName), NULL, 1023, buffer, &ptr); + uint len = SearchPathW (NULL, nlUtf8ToWide(dllName), NULL, 1023, buffer, &ptr); if( len ) nlinfo ("Using the library '%s' that is in the directory: '%s'", dllName.c_str(), wideToUtf8(buffer).c_str()); #endif diff --git a/code/nel/tools/3d/cluster_viewer/view_cs.cpp b/code/nel/tools/3d/cluster_viewer/view_cs.cpp index fa5485ca0..b08cab749 100644 --- a/code/nel/tools/3d/cluster_viewer/view_cs.cpp +++ b/code/nel/tools/3d/cluster_viewer/view_cs.cpp @@ -201,9 +201,9 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector &D // Main // --------------------------------------------------------------------------- #ifdef NL_OS_WINDOWS -int CALLBACK WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) +int APIENTRY nltWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd) #else // NL_OS_WINDOWS -int main(int argc, char **argv) +int nltmain(int argc, NLMISC::tchar **argv) #endif // NL_OS_WINDOWS { double rGlobalTime = 0; diff --git a/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp b/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp index 44b43beed..a4d41649f 100644 --- a/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp +++ b/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp @@ -38,6 +38,8 @@ #include "nel/ligo/ligo_error.h" #include "nel/misc/path.h" +#include "../../plugin_max/nel_3dsmax_shared/string_common.h" + using namespace std; using namespace NLMISC; extern HINSTANCE hInstance; @@ -126,13 +128,13 @@ bool CMaxToLigo::loadLigoConfigFile (CLigoConfig& config, Interface& it, bool di { // Get the path TCHAR sModulePath[256]; - int res=GetModuleFileName(hModule, sModulePath, 256); + int res = GetModuleFileName(hModule, sModulePath, 256); // Success ? if (res) { // Path - std::string path = NLMISC::CFile::getPath(tStrToUtf8(sModulePath) + "ligoscape.cfg"); + std::string path = NLMISC::CFile::getPath(MCharStrToUtf8(sModulePath) + "ligoscape.cfg"); try { @@ -164,16 +166,19 @@ void CMaxToLigo::errorMessage(const std::string &msg, const std::string &title, if (dialog) { // Dialog message - MessageBox (it.GetMAXHWnd(), utf8ToTStr(msg), utf8ToTStr(title), MB_OK|MB_ICONEXCLAMATION); + ucstring ucmsg, uctitle; + ucmsg.fromUtf8(msg); + uctitle.fromUtf8(title); + MessageBoxW(it.GetMAXHWnd(), (LPCWSTR)ucmsg.c_str(), (LPCWSTR)uctitle.c_str(), MB_OK | MB_ICONEXCLAMATION); } else { // Text message - mprintf (utf8ToTStr(msg + "\n")); + mprintf(_M("%s\n"), MaxTStrFromUtf8(msg).data()); } // Output in log - nlwarning ("LIGO ERROR : %s", msg.c_str()); + nlwarning("LIGO ERROR : %s", msg.c_str()); } // *************************************************************************** diff --git a/code/nel/tools/3d/ligo/plugin_max/script.cpp b/code/nel/tools/3d/ligo/plugin_max/script.cpp index 7083a22a7..15c180192 100644 --- a/code/nel/tools/3d/ligo/plugin_max/script.cpp +++ b/code/nel/tools/3d/ligo/plugin_max/script.cpp @@ -155,7 +155,7 @@ Value* export_material_cf (Value** arg_list, int count) nlassert (node); // The second arg - const std::string fileName = tStrToUtf8(arg_list[1]->to_string()); + const std::string fileName = MCharStrToUtf8(arg_list[1]->to_string()); // The third arg bool checkOnly = (arg_list[2]->to_bool() != FALSE); @@ -321,12 +321,12 @@ Value* export_transition_cf (Value** arg_list, int count) nlassert (is_array(nodes)); // The second arg - std::string fileName = tStrToUtf8(arg_list[1]->to_string()); + std::string fileName = MCharStrToUtf8(arg_list[1]->to_string()); // The second arg string matFilename[2]; - matFilename[0] = tStrToUtf8(arg_list[2]->to_string()); - matFilename[1] = tStrToUtf8(arg_list[3]->to_string()); + matFilename[0] = MCharStrToUtf8(arg_list[2]->to_string()); + matFilename[1] = MCharStrToUtf8(arg_list[3]->to_string()); // The third arg bool checkOnly = (arg_list[4]->to_bool() != FALSE); @@ -696,7 +696,7 @@ Value* check_zone_with_material_cf (Value** arg_list, int count) nlassert (node); // The second arg - string fileName = tStrToUtf8(arg_list[1]->to_string()); + string fileName = MCharStrToUtf8(arg_list[1]->to_string()); // The fourth arg bool errorInDialog = (arg_list[2]->to_bool() != FALSE); @@ -830,7 +830,7 @@ Value* check_zone_with_transition_cf (Value** arg_list, int count) nlassert (node); // The second arg - string fileName = tStrToUtf8(arg_list[1]->to_string()); + string fileName = MCharStrToUtf8(arg_list[1]->to_string()); // The second arg int transitionNumber = arg_list[2]->to_int(); @@ -998,7 +998,7 @@ Value* export_zone_cf (Value** arg_list, int count) nlassert (node); // The second arg - string fileName = tStrToUtf8(arg_list[1]->to_string()); + string fileName = MCharStrToUtf8(arg_list[1]->to_string()); // The thrid arg Array *array = (Array*)arg_list[2]; @@ -1043,8 +1043,8 @@ Value* export_zone_cf (Value** arg_list, int count) type_check (cell->get(2), String, message); // Get the strings - categories[i].first = tStrToUtf8(cell->get(1)->to_string()); - categories[i].second = tStrToUtf8(cell->get(2)->to_string()); + categories[i].first = MCharStrToUtf8(cell->get(1)->to_string()); + categories[i].second = MCharStrToUtf8(cell->get(2)->to_string()); } // Get a Object pointer @@ -1352,7 +1352,7 @@ Value* get_error_string_cf (Value** arg_list, int count) int errorCode = arg_list[0]->to_int()-1; // Error code - return new String (utf8ToTStr(CLigoError::getStringError ((CLigoError::TError)errorCode))); + return new String(MaxTStrFromUtf8(CLigoError::getStringError ((CLigoError::TError)errorCode))); } // *************************************************************************** @@ -1367,7 +1367,7 @@ Value* set_directory_cf (Value** arg_list, int count) type_check(arg_list[0], String, message); // The first arg - const std::string dir = tStrToUtf8(arg_list[0]->to_string()); + const std::string dir = MCharStrToUtf8(arg_list[0]->to_string()); // Set the directory return (chdir (dir.c_str())==0)?&true_value:&false_value; @@ -1859,7 +1859,7 @@ Value* make_snapshot_cf (Value** arg_list, int count) nlassert (node); // The second arg - string fileName = tStrToUtf8(arg_list[1]->to_string()); + string fileName = MCharStrToUtf8(arg_list[1]->to_string()); // The thrid arg int xMin = arg_list[2]->to_int(); diff --git a/code/nel/tools/3d/object_viewer/animation_set_dlg.cpp b/code/nel/tools/3d/object_viewer/animation_set_dlg.cpp index a815a83a6..743bb6b32 100644 --- a/code/nel/tools/3d/object_viewer/animation_set_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/animation_set_dlg.cpp @@ -158,7 +158,7 @@ void CAnimationSetDlg::OnAddAnimation () } catch (const Exception& e) { - MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + MessageBox (nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -199,7 +199,7 @@ void CAnimationSetDlg::OnAddSkelWt() } catch (const Exception& e) { - MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); } } } @@ -234,7 +234,7 @@ void CAnimationSetDlg::refresh (BOOL update) for (i=0; i<_ObjView->getNumInstance (); i++) { std::string name = NLMISC::CFile::getFilenameWithoutExtension(_ObjView->getInstance(i)->Saved.ShapeFilename); - EditedObject.InsertString (-1, utf8ToTStr(name)); + EditedObject.InsertString(-1, nlUtf8ToTStr(name)); } // Get edited object @@ -268,7 +268,7 @@ void CAnimationSetDlg::refresh (BOOL update) CAnimation *anim = object->AnimationSet.getAnimation (object->AnimationSet.getAnimationIdByName (name)); // Insert an intem - HTREEITEM item=Tree.InsertItem(utf8ToTStr(name)); + HTREEITEM item = Tree.InsertItem(nlUtf8ToTStr(name)); Tree.SetItemData (item, i); nlassert (item!=NULL); @@ -279,7 +279,7 @@ void CAnimationSetDlg::refresh (BOOL update) while (ite!=setString.end()) { // Add this string - HTREEITEM newItem = Tree.InsertItem (utf8ToTStr(*ite), item); + HTREEITEM newItem = Tree.InsertItem(nlUtf8ToTStr(*ite), item); Tree.SetItemData (newItem, 0xffffffff); // Get the track @@ -303,7 +303,7 @@ void CAnimationSetDlg::refresh (BOOL update) name = toString("%s (%f - %f)", typeid(*track).name(), track->getBeginTime(), track->getEndTime()); } - HTREEITEM keyItem = Tree.InsertItem(utf8ToTStr(name), newItem); + HTREEITEM keyItem = Tree.InsertItem(nlUtf8ToTStr(name), newItem); Tree.SetItemData(keyItem, 0xffffffff); ite++; @@ -320,7 +320,7 @@ void CAnimationSetDlg::refresh (BOOL update) CSkeletonWeight *swt = object->AnimationSet.getSkeletonWeight(object->AnimationSet.getSkeletonWeightIdByName(name)); // Insert an intem - HTREEITEM item=SkelTree.InsertItem(utf8ToTStr(name)); + HTREEITEM item = SkelTree.InsertItem(nlUtf8ToTStr(name)); nlassert (item!=NULL); // Get number of node in this skeleton weight @@ -332,7 +332,7 @@ void CAnimationSetDlg::refresh (BOOL update) std::string percent = toString("%s (%f%%)", swt->getNodeName(n).c_str(), swt->getNodeWeight(n)*100); // Add this string - SkelTree.InsertItem (utf8ToTStr(percent), item); + SkelTree.InsertItem(nlUtf8ToTStr(percent), item); } } @@ -340,7 +340,7 @@ void CAnimationSetDlg::refresh (BOOL update) for (i=0; iSaved.PlayList.size(); i++) { // Insert an intem - int item=PlayList.InsertString (-1, utf8ToTStr(object->Saved.PlayList[i])); + int item = PlayList.InsertString(-1, nlUtf8ToTStr(object->Saved.PlayList[i])); nlassert (item!=LB_ERR); } } diff --git a/code/nel/tools/3d/object_viewer/attrib_dlg.cpp b/code/nel/tools/3d/object_viewer/attrib_dlg.cpp index 674e7f307..93ac94209 100644 --- a/code/nel/tools/3d/object_viewer/attrib_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/attrib_dlg.cpp @@ -355,7 +355,7 @@ void CAttribDlg::init(HBITMAP bitmap, sint x, sint y, CWnd *pParent) for (uint k = 0; k < getNumScheme(); ++k) { - m_Scheme.InsertString(k, utf8ToTStr(getSchemeName(k))); + m_Scheme.InsertString(k, nlUtf8ToTStr(getSchemeName(k))); } diff --git a/code/nel/tools/3d/object_viewer/choose_name.cpp b/code/nel/tools/3d/object_viewer/choose_name.cpp index 91dbf8d40..4f26140a4 100644 --- a/code/nel/tools/3d/object_viewer/choose_name.cpp +++ b/code/nel/tools/3d/object_viewer/choose_name.cpp @@ -33,7 +33,7 @@ CChooseName::CChooseName(const CString &initialName, CWnd* pParent /*=NULL*/) std::string CChooseName::getName() { - return tStrToUtf8(m_Name); + return NLMISC::tStrToUtf8(m_Name); } void CChooseName::DoDataExchange(CDataExchange* pDX) diff --git a/code/nel/tools/3d/object_viewer/choose_pool_id.cpp b/code/nel/tools/3d/object_viewer/choose_pool_id.cpp index 3653e72d1..2423bc70a 100644 --- a/code/nel/tools/3d/object_viewer/choose_pool_id.cpp +++ b/code/nel/tools/3d/object_viewer/choose_pool_id.cpp @@ -53,10 +53,10 @@ void CChoosePoolID::OnOK() CString val; GetDlgItem(IDC_POOL_ID)->GetWindowText(val); - if (NLMISC::fromString(tStrToUtf8(val), PoolID)) + if (NLMISC::fromString(NLMISC::tStrToUtf8(val), PoolID)) { GetDlgItem(IDC_POOL_NAME)->GetWindowText(val); - Name = tStrToUtf8(val); + Name = NLMISC::tStrToUtf8(val); CDialog::OnOK(); } else @@ -71,8 +71,8 @@ BOOL CChoosePoolID::OnInitDialog() std::string val = NLMISC::toString(PoolID); - GetDlgItem(IDC_POOL_ID)->SetWindowText(utf8ToTStr(val)); - GetDlgItem(IDC_POOL_NAME)->SetWindowText(utf8ToTStr(Name)); + GetDlgItem(IDC_POOL_ID)->SetWindowText(nlUtf8ToTStr(val)); + GetDlgItem(IDC_POOL_NAME)->SetWindowText(nlUtf8ToTStr(Name)); if (_FreezeID) { diff --git a/code/nel/tools/3d/object_viewer/create_file_dlg.cpp b/code/nel/tools/3d/object_viewer/create_file_dlg.cpp index 64a404f88..28b058bfb 100644 --- a/code/nel/tools/3d/object_viewer/create_file_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/create_file_dlg.cpp @@ -72,7 +72,7 @@ BOOL CCreateFileDlg::OnInitDialog() { CDialog::OnInitDialog(); SetWindowText((LPCTSTR) _Title); - GetDlgItem(IDC_LOCATION)->SetWindowText(utf8ToTStr(_DefaultBasePath)); + GetDlgItem(IDC_LOCATION)->SetWindowText(nlUtf8ToTStr(_DefaultBasePath)); if (!_DefaultBasePath.empty()) { GetDlgItem(IDC_FILENAME)->SetFocus(); @@ -90,10 +90,10 @@ void CCreateFileDlg::OnOK() { CString filename; GetDlgItem(IDC_FILENAME)->GetWindowText(filename); - _Filename = tStrToUtf8(filename); + _Filename = NLMISC::tStrToUtf8(filename); CString location; GetDlgItem(IDC_LOCATION)->GetWindowText(location); - _Path = tStrToUtf8(location); + _Path = NLMISC::tStrToUtf8(location); if (_Path.empty()) { localizedMessageBox(*this, IDS_EMPTY_PATH, IDS_ERROR, MB_ICONEXCLAMATION); diff --git a/code/nel/tools/3d/object_viewer/direction_attr.cpp b/code/nel/tools/3d/object_viewer/direction_attr.cpp index 047457390..6f422f97c 100644 --- a/code/nel/tools/3d/object_viewer/direction_attr.cpp +++ b/code/nel/tools/3d/object_viewer/direction_attr.cpp @@ -173,7 +173,7 @@ void CDirectionAttr::OnDestroy() void CDirectionAttr::OnGlobalDirection() { nlassert(_DirectionWrapper); - CChooseName chooseName(utf8ToTStr(_DirectionWrapper->getGlobalVectorValueName())); + CChooseName chooseName(nlUtf8ToTStr(_DirectionWrapper->getGlobalVectorValueName())); if (chooseName.DoModal() == IDOK) { diff --git a/code/nel/tools/3d/object_viewer/edit_ex.cpp b/code/nel/tools/3d/object_viewer/edit_ex.cpp index 97df943f2..7bf13c3e3 100644 --- a/code/nel/tools/3d/object_viewer/edit_ex.cpp +++ b/code/nel/tools/3d/object_viewer/edit_ex.cpp @@ -76,7 +76,7 @@ std::string CEditEx::getString() const { TCHAR buf[128]; GetWindowText(buf, sizeof(buf)); - return tStrToUtf8(buf); + return NLMISC::tStrToUtf8(buf); } void CEditEx::setSInt(sint value) diff --git a/code/nel/tools/3d/object_viewer/edit_morph_mesh_dlg.cpp b/code/nel/tools/3d/object_viewer/edit_morph_mesh_dlg.cpp index 0c7def7e9..43c80fb80 100644 --- a/code/nel/tools/3d/object_viewer/edit_morph_mesh_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/edit_morph_mesh_dlg.cpp @@ -89,7 +89,7 @@ bool CEditMorphMeshDlg::getShapeNameFromDlg(std::string &name) NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName())); */ - name = tStrToUtf8(fd.GetPathName()); + name = NLMISC::tStrToUtf8(fd.GetPathName()); return true; } @@ -123,7 +123,7 @@ void CEditMorphMeshDlg::OnAdd() _CM->setShapes(&shapeNames[0], (uint)shapeNames.size()); std::vector numVerts; _CM->getShapeNumVerts(numVerts); - m_MeshList.AddString(utf8ToTStr(getShapeDescStr(index, numVerts[index]))); + m_MeshList.AddString(nlUtf8ToTStr(getShapeDescStr(index, numVerts[index]))); GetDlgItem(IDC_REMOVE)->EnableWindow(TRUE); } touchPSState(); @@ -253,7 +253,7 @@ void CEditMorphMeshDlg::updateMeshList() m_MeshList.ResetContent(); for (uint k = 0; k < _CM->getNumShapes(); ++k) { - m_MeshList.AddString(utf8ToTStr(getShapeDescStr(k, numVerts[k]))); + m_MeshList.AddString(nlUtf8ToTStr(getShapeDescStr(k, numVerts[k]))); } m_MeshList.SetCurSel(0); updateValidFlag(); @@ -310,12 +310,12 @@ std::string CEditMorphMeshDlg::getShapeDescStr(uint shapeIndex, sint numVerts) c { CString verts; verts.LoadString(IDS_VERTICES); - std::string msg = _CM->getShape(shapeIndex) + " (" + NLMISC::toString(numVerts) + " " + tStrToUtf8(verts) + ")"; + std::string msg = _CM->getShape(shapeIndex) + " (" + NLMISC::toString(numVerts) + " " + NLMISC::tStrToUtf8(verts) + ")"; return msg; } else { - std::string result = _CM->getShape(shapeIndex) + " (" + tStrToUtf8(CMeshDlg::getShapeErrorString(numVerts)) + ")"; + std::string result = _CM->getShape(shapeIndex) + " (" + NLMISC::tStrToUtf8(CMeshDlg::getShapeErrorString(numVerts)) + ")"; return result; } } diff --git a/code/nel/tools/3d/object_viewer/edit_ps_sound.cpp b/code/nel/tools/3d/object_viewer/edit_ps_sound.cpp index 40406c2fa..d74c1fdf8 100644 --- a/code/nel/tools/3d/object_viewer/edit_ps_sound.cpp +++ b/code/nel/tools/3d/object_viewer/edit_ps_sound.cpp @@ -195,7 +195,7 @@ void CEditPSSound::OnChangeSoundName() { nlassert(_Sound); UpdateData(); - _Sound->setSoundName(NLMISC::CSheetId(tStrToUtf8(m_SoundName), "sound")); + _Sound->setSoundName(NLMISC::CSheetId(NLMISC::tStrToUtf8(m_SoundName), "sound")); updateModifiedFlag(); } @@ -209,7 +209,7 @@ void CEditPSSound::OnSpawn() // play the currently selected sound void CEditPSSound::OnPlaySound() { - CSoundSystem::play(tStrToUtf8(m_SoundName)); + CSoundSystem::play(NLMISC::tStrToUtf8(m_SoundName)); } void CEditPSSound::OnMute() diff --git a/code/nel/tools/3d/object_viewer/editable_range.h b/code/nel/tools/3d/object_viewer/editable_range.h index 5a4b6263c..1ba763cbb 100644 --- a/code/nel/tools/3d/object_viewer/editable_range.h +++ b/code/nel/tools/3d/object_viewer/editable_range.h @@ -317,7 +317,7 @@ inline void CEditableRangeT::value2CString(float value, CString &dest) inline const TCHAR *CEditableRangeT::string2value(const CString &value, float &result) { - if (NLMISC::fromString(tStrToUtf8(value), result)) + if (NLMISC::fromString(NLMISC::tStrToUtf8(value), result)) { return NULL; } @@ -344,7 +344,7 @@ inline void CEditableRangeT::value2CString(uint32 value, CString &dest) inline const TCHAR *CEditableRangeT::string2value(const CString &value, uint32 &result) { sint32 tmp; - if (NLMISC::fromString(tStrToUtf8(value), tmp)) + if (NLMISC::fromString(NLMISC::tStrToUtf8(value), tmp)) { if (value.Find(_T("-")) > -1) { @@ -380,7 +380,7 @@ inline void CEditableRangeT::value2CString(sint32 value, CString &dest) inline const TCHAR *CEditableRangeT::string2value(const CString &value, sint32 &result) { sint32 tmp; - if (NLMISC::fromString(tStrToUtf8(value), tmp)) + if (NLMISC::fromString(NLMISC::tStrToUtf8(value), tmp)) { result = tmp; return NULL; diff --git a/code/nel/tools/3d/object_viewer/emitter_dlg.cpp b/code/nel/tools/3d/object_viewer/emitter_dlg.cpp index e4864cfe6..df67f68b1 100644 --- a/code/nel/tools/3d/object_viewer/emitter_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/emitter_dlg.cpp @@ -85,7 +85,7 @@ void CEmitterDlg::initEmittedType() NL3D::CPSLocated *loc = dynamic_cast(ps->getProcess(k)); if (loc) // is this a located { - m_EmittedTypeCtrl.AddString(utf8ToTStr(loc->getName())); + m_EmittedTypeCtrl.AddString(nlUtf8ToTStr(loc->getName())); _LocatedList.push_back(loc); if (loc == _Emitter->getEmittedType()) { diff --git a/code/nel/tools/3d/object_viewer/lb_extern_id_dlg.cpp b/code/nel/tools/3d/object_viewer/lb_extern_id_dlg.cpp index 9ea2d51a9..9b0432a9b 100644 --- a/code/nel/tools/3d/object_viewer/lb_extern_id_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/lb_extern_id_dlg.cpp @@ -119,7 +119,7 @@ void CLBExternIDDlg::OnChangeIdValue() TCHAR buf[6]; ::memset(buf, 0, 6); GetDlgItem(IDC_ID_VALUE)->GetWindowText(buf, 6); - _ID = StringToID(tStrToUtf8(buf).c_str()); + _ID = StringToID(NLMISC::tStrToUtf8(buf).c_str()); if (_ID) { GetDlgItem(IDOK)->EnableWindow(TRUE); diff --git a/code/nel/tools/3d/object_viewer/located_bindable_dialog.cpp b/code/nel/tools/3d/object_viewer/located_bindable_dialog.cpp index 2242c0684..98ad0794b 100644 --- a/code/nel/tools/3d/object_viewer/located_bindable_dialog.cpp +++ b/code/nel/tools/3d/object_viewer/located_bindable_dialog.cpp @@ -114,7 +114,7 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent) // z-test ((CButton *) GetDlgItem(IDC_ZTEST))->SetCheck(material->isZTestEnabled() ? BST_CHECKED : BST_UNCHECKED); // z-bias - GetDlgItem(IDC_ZBIAS)->SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", -material->getZBias()))); + GetDlgItem(IDC_ZBIAS)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", -material->getZBias()))); } else { diff --git a/code/nel/tools/3d/object_viewer/located_properties.cpp b/code/nel/tools/3d/object_viewer/located_properties.cpp index b270e9d7f..ad77243bc 100644 --- a/code/nel/tools/3d/object_viewer/located_properties.cpp +++ b/code/nel/tools/3d/object_viewer/located_properties.cpp @@ -322,7 +322,7 @@ void CLocatedProperties::goPostRender() _MaxNbParticles->update(); } // in all cases, show the current number of particles being used - GetDlgItem(IDC_CURR_NUM_PARTS)->SetWindowText(utf8ToTStr(NLMISC::toString(_Located->getSize()))); + GetDlgItem(IDC_CURR_NUM_PARTS)->SetWindowText(nlUtf8ToTStr(NLMISC::toString(_Located->getSize()))); } //**************************************************************************************************************** diff --git a/code/nel/tools/3d/object_viewer/located_target_dlg.cpp b/code/nel/tools/3d/object_viewer/located_target_dlg.cpp index 03fcb226c..4de7dbe37 100644 --- a/code/nel/tools/3d/object_viewer/located_target_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/located_target_dlg.cpp @@ -112,7 +112,7 @@ void CLocatedTargetDlg::OnAddTarget() nlassert(loc); _LBTarget->attachTarget(loc); m_AvailableTargets.DeleteString(indexs[k] - k); - int l = m_Targets.AddString(utf8ToTStr(loc->getName())); + int l = m_Targets.AddString(nlUtf8ToTStr(loc->getName())); m_Targets.SetItemData(l, (DWORD_PTR) loc); } UpdateData(FALSE); @@ -135,7 +135,7 @@ void CLocatedTargetDlg::OnRemoveTarget() nlassert(loc); _LBTarget->detachTarget(loc); m_Targets.DeleteString(indexs[k] - k); - int l = m_AvailableTargets.AddString(utf8ToTStr(loc->getName())); + int l = m_AvailableTargets.AddString(nlUtf8ToTStr(loc->getName())); m_AvailableTargets.SetItemData(l, (DWORD_PTR) loc); } @@ -159,7 +159,7 @@ BOOL CLocatedTargetDlg::OnInitDialog() // fill the box thta tells us what the target are for(k = 0; k < nbTarg; ++k) { - m_Targets.AddString(utf8ToTStr(_LBTarget->getTarget(k)->getName())); + m_Targets.AddString(nlUtf8ToTStr(_LBTarget->getTarget(k)->getName())); m_Targets.SetItemData(k, (DWORD_PTR) _LBTarget->getTarget(k)); targetSet.insert(_LBTarget->getTarget(k)); }; @@ -179,7 +179,7 @@ BOOL CLocatedTargetDlg::OnInitDialog() { if (targetSet.find(loc) == targetSet.end()) { - int l = m_AvailableTargets.AddString(utf8ToTStr(loc->getName())); + int l = m_AvailableTargets.AddString(nlUtf8ToTStr(loc->getName())); m_AvailableTargets.SetItemData(l, (DWORD_PTR) loc); } } diff --git a/code/nel/tools/3d/object_viewer/main_frame.cpp b/code/nel/tools/3d/object_viewer/main_frame.cpp index aa24efa36..7e3b81486 100644 --- a/code/nel/tools/3d/object_viewer/main_frame.cpp +++ b/code/nel/tools/3d/object_viewer/main_frame.cpp @@ -592,7 +592,7 @@ void CMainFrame::OnFileLoadconfig() } catch (const Exception& e) { - MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); } } else @@ -764,7 +764,7 @@ void CMainFrame::OnFileSaveconfig() } catch (const Exception& e) { - MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); } } else @@ -1443,7 +1443,7 @@ void CMainFrame::OnUpdateSceneCamera(CCmdUI* pCmdUI) CInstanceInfo *instance = ObjView->getInstance (ObjView->getCameraInstance (pCmdUI->m_nID - ID_SCENE_CAMERA_FIRST)); nlassert (instance->Camera); std::string text = NLMISC::toString("Camera %s", instance->Saved.ShapeFilename.c_str()); - pCmdUI->SetText(utf8ToTStr(text)); + pCmdUI->SetText(nlUtf8ToTStr(text)); } else { diff --git a/code/nel/tools/3d/object_viewer/mesh_dlg.cpp b/code/nel/tools/3d/object_viewer/mesh_dlg.cpp index a35b7fe71..b83552ab0 100644 --- a/code/nel/tools/3d/object_viewer/mesh_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/mesh_dlg.cpp @@ -94,7 +94,7 @@ void CMeshDlg::OnBrowseShape() if (fd.DoModal() == IDOK) { // Add to the path - std::string fullPath = tStrToUtf8(fd.GetPathName()); + std::string fullPath = NLMISC::tStrToUtf8(fd.GetPathName()); std::string fname = NLMISC::CFile::getFilenameWithoutExtension(fullPath); std::string ext = NLMISC::CFile::getExtension(fullPath); @@ -104,12 +104,12 @@ void CMeshDlg::OnBrowseShape() try { _ShapeParticle->setShape(fname + "." + ext); - m_ShapeName = utf8ToTStr(fname + "." + ext); + m_ShapeName = nlUtf8ToTStr(fname + "." + ext); touchPSState(); } catch (const NLMISC::Exception &e) { - MessageBox(utf8ToTStr(e.what()), _T("shape loading error")); + MessageBox(nlUtf8ToTStr(e.what()), _T("shape loading error")); } updateMeshErrorString(); @@ -159,7 +159,7 @@ void CMeshDlg::updateForMorph() GetDlgItem(IDC_SHAPE_NAME)->EnableWindow(!enable); if (!enable) { - m_ShapeName = utf8ToTStr(cm->getShape()); + m_ShapeName = nlUtf8ToTStr(cm->getShape()); } else { diff --git a/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp b/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp index 58d67bd0b..ce7162ff8 100644 --- a/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/multi_tex_dlg.cpp @@ -165,19 +165,19 @@ void CMultiTexDlg::readValues(bool alternate) char buf[128]; if (!alternate) { - GetDlgItem(IDC_U_SPEED_1)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).x))); - GetDlgItem(IDC_V_SPEED_1)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).y))); - GetDlgItem(IDC_U_SPEED_2)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).x))); - GetDlgItem(IDC_V_SPEED_2)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).y))); + GetDlgItem(IDC_U_SPEED_1)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).x))); + GetDlgItem(IDC_V_SPEED_1)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).y))); + GetDlgItem(IDC_U_SPEED_2)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).x))); + GetDlgItem(IDC_V_SPEED_2)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).y))); } else { if (_MTP->isAlternateTexEnabled()) { - GetDlgItem(IDC_U_SPEED_1_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).x))); - GetDlgItem(IDC_V_SPEED_1_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).y))); - GetDlgItem(IDC_U_SPEED_2_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).x))); - GetDlgItem(IDC_V_SPEED_2_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).y))); + GetDlgItem(IDC_U_SPEED_1_ALTERNATE)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).x))); + GetDlgItem(IDC_V_SPEED_1_ALTERNATE)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).y))); + GetDlgItem(IDC_U_SPEED_2_ALTERNATE)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).x))); + GetDlgItem(IDC_V_SPEED_2_ALTERNATE)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).y))); } else { @@ -188,7 +188,7 @@ void CMultiTexDlg::readValues(bool alternate) } } - GetDlgItem(IDC_BUMP_FACTOR)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getBumpFactor()))); + GetDlgItem(IDC_BUMP_FACTOR)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getBumpFactor()))); } diff --git a/code/nel/tools/3d/object_viewer/object_viewer.cpp b/code/nel/tools/3d/object_viewer/object_viewer.cpp index f1f663e38..be20979b6 100644 --- a/code/nel/tools/3d/object_viewer/object_viewer.cpp +++ b/code/nel/tools/3d/object_viewer/object_viewer.cpp @@ -535,7 +535,7 @@ void CObjectViewer::loadConfigFile() } catch (const Exception& e) { - ::MessageBox (NULL, utf8ToTStr(e.what()), _T("Objectviewer.cfg"), MB_OK|MB_ICONEXCLAMATION); + ::MessageBox(NULL, nlUtf8ToTStr(e.what()), _T("Objectviewer.cfg"), MB_OK | MB_ICONEXCLAMATION); } } @@ -823,7 +823,7 @@ bool CObjectViewer::initUI (HWND parent) catch (const NLMISC::EStream &e) { std::string msg = toString("Unable to load the default scheme bank file : %s", e.what()); - ::MessageBox(NULL, utf8ToTStr(msg), _T("Object Viewer"), MB_ICONEXCLAMATION); + ::MessageBox(NULL, nlUtf8ToTStr(msg), _T("Object Viewer"), MB_ICONEXCLAMATION); } } iF.close(); @@ -840,7 +840,7 @@ bool CObjectViewer::initUI (HWND parent) catch (const Exception& e) { std::string msg = toString("Error while loading default.ovcgf : %s", e.what()); - ::MessageBox (NULL, utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + ::MessageBox(NULL, nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); } } @@ -1312,7 +1312,7 @@ void CObjectViewer::go () ); // Display - _MainFrame->StatusBar.SetWindowText (utf8ToTStr(msgBar)); + _MainFrame->StatusBar.SetWindowText(nlUtf8ToTStr(msgBar)); // Display Vegetable info. if(_VegetableDlg!=NULL) @@ -1794,7 +1794,7 @@ void CObjectViewer::serial (NLMISC::IStream& f) { // Error message std::string message = toString("File not found %s", readed[i].ShapeFilename.c_str()); - _MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox(nlUtf8ToTStr(message), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); // Stop loading break; @@ -1829,7 +1829,7 @@ void CObjectViewer::serial (NLMISC::IStream& f) { // Error message std::string message = toString("Error loading shape %s: %s", readed[i].ShapeFilename.c_str(), e.what()); - _MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox(nlUtf8ToTStr(message), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); // Stop loading break; @@ -1899,7 +1899,7 @@ bool CObjectViewer::loadInstanceGroup(const std::string &igFilename) { // clean delete ig; - _MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); return false; } } @@ -1907,7 +1907,7 @@ bool CObjectViewer::loadInstanceGroup(const std::string &igFilename) { // Create a message std::string msg = toString("Can't open the file %s for reading.", igFilename.c_str()); - _MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); return false; } @@ -1962,7 +1962,7 @@ bool CObjectViewer::loadMesh (std::vector &meshFilename, const std: } catch (const Exception& e) { - _MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); // error skelError=true; @@ -1972,7 +1972,7 @@ bool CObjectViewer::loadMesh (std::vector &meshFilename, const std: { // Create a message std::string msg = NLMISC::toString("Can't open the file %s for reading.", skeleton.c_str()); - _MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); // error skelError=true; @@ -2015,7 +2015,7 @@ bool CObjectViewer::loadMesh (std::vector &meshFilename, const std: } catch (const Exception& e) { - _MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); continue; } } @@ -2023,7 +2023,7 @@ bool CObjectViewer::loadMesh (std::vector &meshFilename, const std: { // Create a message std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str()); - _MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); continue; } @@ -2848,7 +2848,7 @@ void CObjectViewer::enableDynamicObjectLightingTest(NLPACS::CGlobalRetriever *gl if (!_ObjectLightTestShape.empty()) { string str= string("Path not found for Light Test Shape: ") + _ObjectLightTestShape; - ::MessageBox(NULL, utf8ToTStr(str.c_str()), _T("Dynamic Object Light Test"), MB_OK|MB_ICONEXCLAMATION); + ::MessageBox(NULL, nlUtf8ToTStr(str.c_str()), _T("Dynamic Object Light Test"), MB_OK | MB_ICONEXCLAMATION); } // disable. _ObjectLightTest= NULL; @@ -3223,7 +3223,7 @@ bool CObjectViewer::createVegetableLandscape() // close the progress dialog dlgProgress.DestroyWindow(); - MessageBox(_MainFrame->m_hWnd, utf8ToTStr(e.what()), _T("Failed to Load landscape"), MB_OK | MB_APPLMODAL); + MessageBox(_MainFrame->m_hWnd, nlUtf8ToTStr(e.what()), _T("Failed to Load landscape"), MB_OK | MB_APPLMODAL); // remove first possibly created collisions objects. if(_VegetableCollisionEntity) @@ -3557,7 +3557,7 @@ void CObjectViewer::loadAnimation(const std::string &fileName, uint instance) { // Create a message std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str()); - _MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); } } @@ -3587,7 +3587,7 @@ void CObjectViewer::loadSWT (const std::string &fileName, uint instance) { // Create a message std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str()); - _MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); } } @@ -3771,14 +3771,14 @@ void CObjectViewer::shootScene() else { std::string message = toString("Can't open the file %s for writing.", filenamefinal.c_str()); - _MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox(nlUtf8ToTStr(message), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); break; } } catch (const Exception &e) { std::string message = toString("Error during writing of the file %s: %s", filenamefinal.c_str(), e.what()); - _MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + _MainFrame->MessageBox(nlUtf8ToTStr(message), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); break; } } diff --git a/code/nel/tools/3d/object_viewer/particle_dlg.cpp b/code/nel/tools/3d/object_viewer/particle_dlg.cpp index f50fe53a2..b7dd9dab3 100644 --- a/code/nel/tools/3d/object_viewer/particle_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/particle_dlg.cpp @@ -428,7 +428,7 @@ bool CParticleDlg::savePSAs(HWND parent, CParticleWorkspace::CNode &psNode ,cons } else { - ::MessageBox(parent, utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); + ::MessageBox(parent, nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); return false; } } @@ -474,7 +474,7 @@ bool CParticleDlg::loadPS(HWND parent, CParticleWorkspace::CNode &psNode, TLoadP { case Silent: return false; // no op case ReportError: - ::MessageBox(parent, utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); + ::MessageBox(parent, nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK | MB_ICONEXCLAMATION); return true; break; case ReportErrorSkippable: @@ -549,7 +549,7 @@ void CParticleDlg::OnCreateNewPsWorkspace() } catch(const NLMISC::EStream &e) { - MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); } closeWorkspace(); _PW = newPW; @@ -567,7 +567,7 @@ void CParticleDlg::OnLoadPSWorkspace() CFileDialog fd( TRUE, _T(".pws"), _T("*.pws"), 0, szFilter); INT_PTR result = fd.DoModal(); if (result != IDOK) return; - loadWorkspace(tStrToUtf8(fd.GetPathName())); + loadWorkspace(NLMISC::tStrToUtf8(fd.GetPathName())); } //************************************************************************************************************************** @@ -585,7 +585,7 @@ void CParticleDlg::loadWorkspace(const std::string &fullPath) } catch(const NLMISC::EStream &e) { - MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); setStatusBarText(CString(e.what())); return; } @@ -635,7 +635,7 @@ void CParticleDlg::saveWorkspaceStructure() } catch(const NLMISC::EStream &e) { - localizedMessageBox(*this, utf8ToTStr(e.what()), IDS_ERROR, MB_ICONEXCLAMATION); + localizedMessageBox(*this, nlUtf8ToTStr(e.what()), IDS_ERROR, MB_ICONEXCLAMATION); setStatusBarText(CString(e.what())); } } diff --git a/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp b/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp index daad7864a..00793a2c4 100644 --- a/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp +++ b/code/nel/tools/3d/object_viewer/particle_tree_ctrl.cpp @@ -213,7 +213,7 @@ HTREEITEM CParticleTreeCtrl::buildTreeFromPS(CParticleWorkspace::CNode &node, H if (node.isLoaded()) { // bind particle system icon - HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, utf8ToTStr(computeCaption(node)), PSIconParticleSystem, PSIconParticleSystem, 0, 0, NULL, rootHandle, prevSibling); + HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, nlUtf8ToTStr(computeCaption(node)), PSIconParticleSystem, PSIconParticleSystem, 0, 0, NULL, rootHandle, prevSibling); // set the param (doesn't seems to work during first creation) SetItemData(psRoot, (LPARAM) nt); // now, create each located @@ -228,7 +228,7 @@ HTREEITEM CParticleTreeCtrl::buildTreeFromPS(CParticleWorkspace::CNode &node, H else { // bind a bitmap that say that the PS hasn't been loaded - HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, utf8ToTStr(computeCaption(node)), PSIconParticleSystemNotLoaded, PSIconParticleSystemNotLoaded, 0, 0, NULL, rootHandle, prevSibling); + HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, nlUtf8ToTStr(computeCaption(node)), PSIconParticleSystemNotLoaded, PSIconParticleSystemNotLoaded, 0, 0, NULL, rootHandle, prevSibling); SetItemData(psRoot, (LPARAM) nt); return psRoot; } @@ -242,7 +242,7 @@ void CParticleTreeCtrl::buildTreeFromWorkSpace(CParticleWorkspace &ws) CNodeType *nt = new CNodeType(&ws); _NodeTypes.push_back(nt); // bind particle system icon - HTREEITEM rootHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, utf8ToTStr(computeCaption(ws)), PSIconWorkspace, PSIconWorkspace, 0, 0, NULL, NULL, TVI_LAST); + HTREEITEM rootHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, nlUtf8ToTStr(computeCaption(ws)), PSIconWorkspace, PSIconWorkspace, 0, 0, NULL, NULL, TVI_LAST); // set the param (doesn't seems to work during first creation) SetItemData(rootHandle, (LPARAM) nt); // now, create each particle system @@ -259,7 +259,7 @@ void CParticleTreeCtrl::createNodeFromLocated(NL3D::CPSLocated *loc, HTREEITEM CNodeType *nt = new CNodeType(loc); _NodeTypes.push_back(nt); // bind located icon - HTREEITEM nodeHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM |TVIF_TEXT, utf8ToTStr(loc->getName()) , PSIconLocated, PSIconLocated, 0, 0, (LPARAM) nt, rootHandle, TVI_LAST); + HTREEITEM nodeHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, nlUtf8ToTStr(loc->getName()), PSIconLocated, PSIconLocated, 0, 0, (LPARAM)nt, rootHandle, TVI_LAST); // now, insert each object that is bound to the located for (uint l = 0; l < loc->getNbBoundObjects(); ++l) { @@ -273,7 +273,7 @@ void CParticleTreeCtrl::createNodeFromLocatedBindable(NL3D::CPSLocatedBindable * // we ordered the image so that they match the type for a located bindable (force, particles, collision zones...) CNodeType *nt = new CNodeType(lb); _NodeTypes.push_back(nt); - InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT , utf8ToTStr(lb->getName()) , lb->getType(), lb->getType(), PSIconForce, PSIconForce, (LPARAM) nt, rootHandle, TVI_LAST); + InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, nlUtf8ToTStr(lb->getName()), lb->getType(), lb->getType(), PSIconForce, PSIconForce, (LPARAM)nt, rootHandle, TVI_LAST); } @@ -1004,7 +1004,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA nlassert(ownerNode); // Add search path for the texture - NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); + NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName()))); CUniquePtr sb(new NL3D::CShapeBank); CParticleSystemModel *psm = NULL; @@ -1012,9 +1012,9 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA { NL3D::CShapeStream ss; NLMISC::CIFile inputFile; - inputFile.open(tStrToUtf8(fd.GetPathName())); + inputFile.open(NLMISC::tStrToUtf8(fd.GetPathName())); ss.serial(inputFile); - std::string shapeName = NLMISC::CFile::getFilename(tStrToUtf8(fd.GetPathName())); + std::string shapeName = NLMISC::CFile::getFilename(NLMISC::tStrToUtf8(fd.GetPathName())); sb->add(shapeName, ss.getShapePointer()); NL3D::CShapeBank *oldSB = CNELU::Scene->getShapeBank(); CNELU::Scene->setShapeBank(sb.get()); @@ -1039,7 +1039,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA } catch(const NLMISC::EStream &e) { - MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK | MB_ICONEXCLAMATION); return TRUE; } ownerNode->setResetAutoCountFlag(false); @@ -1096,10 +1096,10 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA _ParticleDlg->StartStopDlg->stop(); std::string fileName = nt->PS->getFilename(); static TCHAR BASED_CODE szFilter[] = _T("ps & shapes files(*.ps;*.shape)|*.ps; *.shape||"); - CFileDialog fd(FALSE, _T(".ps"), utf8ToTStr(fileName), OFN_OVERWRITEPROMPT, szFilter, this); + CFileDialog fd(FALSE, _T(".ps"), nlUtf8ToTStr(fileName), OFN_OVERWRITEPROMPT, szFilter, this); if (fd.DoModal() == IDOK) { - _ParticleDlg->savePSAs(*this, *nt->PS, tStrToUtf8(fd.GetPathName()), false); + _ParticleDlg->savePSAs(*this, *nt->PS, NLMISC::tStrToUtf8(fd.GetPathName()), false); } } } @@ -1249,7 +1249,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA } getOwnerNode(nt)->setModified(true); // TODO : an enum for CPSLocatedBindable::getType would be better... - InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, utf8ToTStr(toCreate->getName()), toCreate->getType(), toCreate->getType(), 0, 0, (LPARAM) newNt, father, lastSon); + InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, nlUtf8ToTStr(toCreate->getName()), toCreate->getType(), toCreate->getType(), 0, 0, (LPARAM)newNt, father, lastSon); touchPSState(nt); Invalidate(); _ParticleDlg->StartStopDlg->resetAutoCount(getOwnerNode(nt)); @@ -1280,7 +1280,7 @@ std::pair CParticleTreeCtrl::createL CNodeType *newNt = new CNodeType(loc); _NodeTypes.push_back(newNt); // insert item in tree - HTREEITEM insertedItem = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, utf8ToTStr(name), PSIconLocated, PSIconLocated, 0, 0, (LPARAM) newNt, headItem, TVI_LAST); + HTREEITEM insertedItem = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, nlUtf8ToTStr(name), PSIconLocated, PSIconLocated, 0, 0, (LPARAM)newNt, headItem, TVI_LAST); touchPSState(newNt); return std::make_pair(newNt, insertedItem); } @@ -1299,7 +1299,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult) { case CNodeType::workspace: { - nt->WS->setName(tStrToUtf8(info->item.pszText)); + nt->WS->setName(NLMISC::tStrToUtf8(info->item.pszText)); workspaceModifiedFlagChanged(*nt->WS); // change name (this may be called twice because of the modification callback, but this doesn't matter) } break; @@ -1311,10 +1311,10 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult) } else { - nt->PS->getPSPointer()->setName(tStrToUtf8(info->item.pszText)); + nt->PS->getPSPointer()->setName(NLMISC::tStrToUtf8(info->item.pszText)); nt->PS->setModified(true); } - this->SetItemText(info->item.hItem, utf8ToTStr(computeCaption(*nt->PS))); + this->SetItemText(info->item.hItem, nlUtf8ToTStr(computeCaption(*nt->PS))); } break; case CNodeType::located: @@ -1322,7 +1322,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult) nlassert(getOwnerNode(nt)); getOwnerNode(nt)->setModified(true); this->SetItemText(info->item.hItem, info->item.pszText); - nt->Loc->setName(tStrToUtf8(info->item.pszText)); + nt->Loc->setName(NLMISC::tStrToUtf8(info->item.pszText)); } break; case CNodeType::locatedBindable: @@ -1330,7 +1330,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult) nlassert(getOwnerNode(nt)); getOwnerNode(nt)->setModified(true); this->SetItemText(info->item.hItem, info->item.pszText); - nt->Bind->setName(tStrToUtf8(info->item.pszText)); + nt->Bind->setName(NLMISC::tStrToUtf8(info->item.pszText)); } break; } @@ -1466,7 +1466,7 @@ void CParticleTreeCtrl::updateCaption(CParticleWorkspace::CNode &node) HTREEITEM item = getTreeItem(&node); if (!item) return; // update name of ps to dipslay a star in front of it (this tells that the ps has been modified) - SetItemText(item, utf8ToTStr(computeCaption(node))); + SetItemText(item, nlUtf8ToTStr(computeCaption(node))); } //**************************************************************************************************************** @@ -1545,7 +1545,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws) while (pos) { CString path = fd.GetNextPathName(pos); - CParticleWorkspace::CNode *node = pws.addNode(tStrToUtf8(path)); + CParticleWorkspace::CNode *node = pws.addNode(NLMISC::tStrToUtf8(path)); if (!node) { if (diplayNodeAlreadyInserted) @@ -1558,7 +1558,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws) } else { - MessageBox(CString(utf8ToTStr(NLMISC::CFile::getFilename(tStrToUtf8(path)))) + getStrRsc(IDS_PS_ALREADY_INSERTED), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); + MessageBox(CString(nlUtf8ToTStr(NLMISC::CFile::getFilename(NLMISC::tStrToUtf8(path)))) + getStrRsc(IDS_PS_ALREADY_INSERTED), getStrRsc(IDS_ERROR), MB_OK | MB_ICONEXCLAMATION); } } continue; @@ -1593,7 +1593,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws) } } // update modified state - SetItemText(GetRootItem(), utf8ToTStr(computeCaption(pws))); + SetItemText(GetRootItem(), nlUtf8ToTStr(computeCaption(pws))); } } @@ -1736,7 +1736,7 @@ void CParticleTreeCtrl::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult) switch (nt->Type) { case CNodeType::workspace: - pEdit->SetWindowText(utf8ToTStr(nt->WS->getName())); + pEdit->SetWindowText(nlUtf8ToTStr(nt->WS->getName())); break; case CNodeType::particleSystem: { @@ -1747,18 +1747,18 @@ void CParticleTreeCtrl::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult) } else { - pEdit->SetWindowText(utf8ToTStr(nt->PS->getPSPointer()->getName())); + pEdit->SetWindowText(nlUtf8ToTStr(nt->PS->getPSPointer()->getName())); } } break; case CNodeType::located: { - pEdit->SetWindowText(utf8ToTStr(nt->Loc->getName())); + pEdit->SetWindowText(nlUtf8ToTStr(nt->Loc->getName())); } break; case CNodeType::locatedBindable: { - pEdit->SetWindowText(utf8ToTStr(nt->Bind->getName())); + pEdit->SetWindowText(nlUtf8ToTStr(nt->Bind->getName())); } break; } @@ -1855,10 +1855,10 @@ void CParticleTreeCtrl::updateAllCaptions() switch(nt->Type) { case CNodeType::particleSystem: - SetItemText(curr, utf8ToTStr(computeCaption(*nt->PS))); + SetItemText(curr, nlUtf8ToTStr(computeCaption(*nt->PS))); break; case CNodeType::workspace: - SetItemText(curr, utf8ToTStr(computeCaption(*nt->WS))); + SetItemText(curr, nlUtf8ToTStr(computeCaption(*nt->WS))); break; case CNodeType::located: case CNodeType::locatedBindable: diff --git a/code/nel/tools/3d/object_viewer/particle_workspace.cpp b/code/nel/tools/3d/object_viewer/particle_workspace.cpp index 1a289d2b0..d5b3869c1 100644 --- a/code/nel/tools/3d/object_viewer/particle_workspace.cpp +++ b/code/nel/tools/3d/object_viewer/particle_workspace.cpp @@ -371,13 +371,13 @@ CParticleWorkspace::CNode *CParticleWorkspace::addNode(const std::string &filena TCHAR resultPath[MAX_PATH]; std::string dosPath = NLMISC::CPath::standardizeDosPath(getPath()); std::string relativePath; - if (!PathRelativePathTo(resultPath, utf8ToTStr(dosPath), FILE_ATTRIBUTE_DIRECTORY, utf8ToTStr(filenameWithFullPath), 0)) + if (!PathRelativePathTo(resultPath, nlUtf8ToTStr(dosPath), FILE_ATTRIBUTE_DIRECTORY, nlUtf8ToTStr(filenameWithFullPath), 0)) { relativePath = filenameWithFullPath; } else { - relativePath = tStrToUtf8(resultPath); + relativePath = NLMISC::tStrToUtf8(resultPath); } if (relativePath.size() >= 2) diff --git a/code/nel/tools/3d/object_viewer/pick_sound.cpp b/code/nel/tools/3d/object_viewer/pick_sound.cpp index 0e6c175d0..0877564d2 100644 --- a/code/nel/tools/3d/object_viewer/pick_sound.cpp +++ b/code/nel/tools/3d/object_viewer/pick_sound.cpp @@ -74,7 +74,7 @@ BOOL CPickSound::OnInitDialog() for (TNameVect::iterator it = _Names.begin(); it != _Names.end(); ++it) { - m_NameList.AddString(utf8ToTStr((*it).toString())); + m_NameList.AddString(nlUtf8ToTStr((*it).toString())); } _Timer = SetTimer (1, 100, NULL); @@ -111,7 +111,7 @@ void CPickSound::OnSelchange() nlassert(m_NameList.GetTextLen(m_NameList.GetCurSel()) < 1024); m_NameList.GetText(m_NameList.GetCurSel(), str); - _CurrName = NLMISC::CSheetId(tStrToUtf8(str), "sound"); + _CurrName = NLMISC::CSheetId(NLMISC::tStrToUtf8(str), "sound"); } @@ -123,7 +123,7 @@ void CPickSound::OnPlaySound() stopCurrSource(); CString sName; m_NameList.GetText(curSel, sName); - CSoundSystem::create(tStrToUtf8(sName)); + CSoundSystem::create(NLMISC::tStrToUtf8(sName)); } //======================================================================================== @@ -159,7 +159,7 @@ void CPickSound::OnDblclkList() stopCurrSource(); CString sName; m_NameList.GetText(curSel, sName); - _CurrSource = CSoundSystem::create(tStrToUtf8(sName)); + _CurrSource = CSoundSystem::create(NLMISC::tStrToUtf8(sName)); } //======================================================================================== diff --git a/code/nel/tools/3d/object_viewer/precomputed_rotations_dlg.cpp b/code/nel/tools/3d/object_viewer/precomputed_rotations_dlg.cpp index 4f1374eb2..8897955f5 100644 --- a/code/nel/tools/3d/object_viewer/precomputed_rotations_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/precomputed_rotations_dlg.cpp @@ -126,7 +126,7 @@ void CPrecomputedRotationsDlg::OnUpdateMinRotSpeed() nlassert(_RotatedParticle); UpdateData(); float newValue, valueMin, valueMax; - if (NLMISC::fromString(tStrToUtf8(m_RotSpeedMin), newValue)) + if (NLMISC::fromString(NLMISC::tStrToUtf8(m_RotSpeedMin), newValue)) { uint32 nbModels = _RotatedParticle->checkHintRotateTheSame(valueMin, valueMax); valueMin = newValue; @@ -146,7 +146,7 @@ void CPrecomputedRotationsDlg::OnUpdateMaxRotSpeed() nlassert(_RotatedParticle); UpdateData(); float newValue, valueMin, valueMax; - if (NLMISC::fromString(tStrToUtf8(m_RotSpeedMax), newValue)) + if (NLMISC::fromString(NLMISC::tStrToUtf8(m_RotSpeedMax), newValue)) { uint32 nbModels = _RotatedParticle->checkHintRotateTheSame(valueMin, valueMax); valueMax = newValue; @@ -167,7 +167,7 @@ void CPrecomputedRotationsDlg::OnUpdateNbModels() UpdateData(); float valueMin, valueMax; sint32 newNbModels; - bool valid = (NLMISC::fromString(tStrToUtf8(m_NbModels), newNbModels) && newNbModels > 0); + bool valid = (NLMISC::fromString(NLMISC::tStrToUtf8(m_NbModels), newNbModels) && newNbModels > 0); if (dynamic_cast(_RotatedParticle)) { valid &= (newNbModels < NL3D::ConstraintMeshMaxNumPrerotatedModels); diff --git a/code/nel/tools/3d/object_viewer/ps_mover_dlg.cpp b/code/nel/tools/3d/object_viewer/ps_mover_dlg.cpp index cdd88ea70..e1ac67c30 100644 --- a/code/nel/tools/3d/object_viewer/ps_mover_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/ps_mover_dlg.cpp @@ -120,7 +120,7 @@ void CPSMoverDlg::OnUpdateXpos() UpdateData(); NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; float x; - if (NLMISC::fromString(tStrToUtf8(m_X), x)) + if (NLMISC::fromString(NLMISC::tStrToUtf8(m_X), x)) { pos.x = x; updateListener(); @@ -137,7 +137,7 @@ void CPSMoverDlg::OnUpdateYpos() UpdateData(); NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; float y; - if (NLMISC::fromString(tStrToUtf8(m_Y), y)) + if (NLMISC::fromString(NLMISC::tStrToUtf8(m_Y), y)) { pos.y = y; updateListener(); @@ -154,7 +154,7 @@ void CPSMoverDlg::OnUpdateZpos() UpdateData(); NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; float z; - if (NLMISC::fromString(tStrToUtf8(m_Z), z)) + if (NLMISC::fromString(NLMISC::tStrToUtf8(m_Z), z)) { pos.z = z; updateListener(); @@ -178,7 +178,7 @@ BOOL CPSMoverDlg::OnInitDialog() { if (dynamic_cast(_EditedLocated->getBoundObject(k))) { - uint insertedLine = m_SubComponentCtrl.AddString(utf8ToTStr(_EditedLocated->getBoundObject(k)->getName())); + uint insertedLine = m_SubComponentCtrl.AddString(nlUtf8ToTStr(_EditedLocated->getBoundObject(k)->getName())); m_SubComponentCtrl.SetItemData(insertedLine, (DWORD_PTR) _EditedLocated->getBoundObject(k)); ++nbCandidates; } diff --git a/code/nel/tools/3d/object_viewer/scheme_bank_dlg.cpp b/code/nel/tools/3d/object_viewer/scheme_bank_dlg.cpp index 2db27bc35..10ebbbfcb 100644 --- a/code/nel/tools/3d/object_viewer/scheme_bank_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/scheme_bank_dlg.cpp @@ -84,7 +84,7 @@ void CSchemeBankDlg::buildList() SchemeManager.getSchemes(_Type, schemes); for (TSchemeVect::const_iterator it = schemes.begin(); it != schemes.end(); ++it) { - int index = m_SchemeList.AddString(utf8ToTStr(it->first)); + int index = m_SchemeList.AddString(nlUtf8ToTStr(it->first)); m_SchemeList.SetItemData(index, (DWORD_PTR) it->second); } @@ -99,18 +99,18 @@ void CSchemeBankDlg::OnSaveBank() if (fd.DoModal() == IDOK) { // Add search path for the texture - NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); + NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName()))); try { NLMISC::COFile iF; - iF.open(tStrToUtf8(fd.GetFileName())); + iF.open(NLMISC::tStrToUtf8(fd.GetFileName())); iF.serial(SchemeManager); } catch (const std::exception &e) { std::string message = NLMISC::toString("Error saving scheme bank : %s", e.what()); - MessageBox(utf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK); + MessageBox(nlUtf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK); return; } } @@ -124,20 +124,20 @@ void CSchemeBankDlg::OnLoadBank() if (fd.DoModal() == IDOK) { // Add search path for the texture - NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); + NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName()))); CSchemeManager sm; try { NLMISC::CIFile iF; - iF.open(NLMISC::CPath::lookup(tStrToUtf8(fd.GetFileName()))); + iF.open(NLMISC::CPath::lookup(NLMISC::tStrToUtf8(fd.GetFileName()))); iF.serial(sm); SchemeManager.swap(sm); } catch (const std::exception &e) { std::string message = NLMISC::toString("Error loading scheme bank : %s", e.what()); - MessageBox(utf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK); + MessageBox(nlUtf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK); return; } buildList(); @@ -167,7 +167,7 @@ void CSchemeBankDlg::OnRename() SchemeManager.rename(scheme, cn.getName()); int curSel = m_SchemeList.GetCurSel(); m_SchemeList.DeleteString(curSel); - int insertedPos = m_SchemeList.InsertString(curSel, utf8ToTStr(cn.getName())); + int insertedPos = m_SchemeList.InsertString(curSel, nlUtf8ToTStr(cn.getName())); m_SchemeList.SetCurSel(insertedPos); m_SchemeList.Invalidate(); } diff --git a/code/nel/tools/3d/object_viewer/select_string.cpp b/code/nel/tools/3d/object_viewer/select_string.cpp index f506d905b..d38285a70 100644 --- a/code/nel/tools/3d/object_viewer/select_string.cpp +++ b/code/nel/tools/3d/object_viewer/select_string.cpp @@ -77,14 +77,14 @@ BOOL CSelectString::OnInitDialog() CDialog::OnInitDialog(); // Change title - SetWindowText (utf8ToTStr(Title)); + SetWindowText(nlUtf8ToTStr(Title)); // Empty button ? EmptyCtrl.ShowWindow (Empty?SW_SHOW:SW_HIDE); // Add string for (uint s=0; sSetWindowText(utf8ToTStr(str)); + _StaticScaleMarkers[_SliderEdited]->SetWindowText(nlUtf8ToTStr(str)); } // *************************************************************************** @@ -717,7 +717,7 @@ void CSkeletonScaleDlg::updateScalesFromText(UINT ctrlId) return; // get the scale info - std::string str = tStrToUtf8(*_ScaleEdits[sid]); + std::string str = NLMISC::tStrToUtf8(*_ScaleEdits[sid]); if(str.empty()) return; float f; @@ -846,13 +846,13 @@ void CSkeletonScaleDlg::OnSsdButtonSaveas() return; // choose the file - CFileDialog fd(FALSE, _T("skel"), utf8ToTStr(_SkeletonFileName), OFN_OVERWRITEPROMPT, _T("SkelFiles (*.skel)|*.skel|All Files (*.*)|*.*||"), this) ; + CFileDialog fd(FALSE, _T("skel"), nlUtf8ToTStr(_SkeletonFileName), OFN_OVERWRITEPROMPT, _T("SkelFiles (*.skel)|*.skel|All Files (*.*)|*.*||"), this); fd.m_ofn.lpstrTitle = _T("Save As Skeleton"); if (fd.DoModal() == IDOK) { NLMISC::COFile f; - if( f.open(tStrToUtf8(fd.GetPathName())) ) + if (f.open(NLMISC::tStrToUtf8(fd.GetPathName()))) { if(saveCurrentInStream(f)) { @@ -862,7 +862,7 @@ void CSkeletonScaleDlg::OnSsdButtonSaveas() } // bkup the valid fileName (new file edited) - _SkeletonFileName= tStrToUtf8(fd.GetPathName()); + _SkeletonFileName = NLMISC::tStrToUtf8(fd.GetPathName()); _StaticFileName= _SkeletonFileName.c_str(); UpdateData(FALSE); } @@ -1228,13 +1228,13 @@ void CSkeletonScaleDlg::OnSsdButtonSaveScale() std::string defaultFileName = _SkeletonFileName; NLMISC::strFindReplace(defaultFileName, ".skel", ".scale"); - CFileDialog fd(FALSE, _T("scale"), utf8ToTStr(defaultFileName), OFN_OVERWRITEPROMPT, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this) ; + CFileDialog fd(FALSE, _T("scale"), nlUtf8ToTStr(defaultFileName), OFN_OVERWRITEPROMPT, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this); fd.m_ofn.lpstrTitle = _T("Save As Skeleton Scale File"); if (fd.DoModal() == IDOK) { NLMISC::COFile f; - if (f.open(tStrToUtf8(fd.GetPathName()))) + if (f.open(NLMISC::tStrToUtf8(fd.GetPathName()))) { saveSkelScaleInStream(f); } @@ -1256,13 +1256,13 @@ void CSkeletonScaleDlg::OnSsdButtonLoadScale() std::string defaultFileName= _SkeletonFileName; NLMISC::strFindReplace(defaultFileName, ".skel", ".scale"); - CFileDialog fd(TRUE, _T("scale"), utf8ToTStr(defaultFileName), 0, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this) ; + CFileDialog fd(TRUE, _T("scale"), nlUtf8ToTStr(defaultFileName), 0, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this); fd.m_ofn.lpstrTitle= _T("Load a Skeleton Scale File"); if (fd.DoModal() == IDOK) { NLMISC::CIFile f; - if (f.open(tStrToUtf8(fd.GetPathName()))) + if (f.open(NLMISC::tStrToUtf8(fd.GetPathName()))) { loadSkelScaleFromStream(f); } diff --git a/code/nel/tools/3d/object_viewer/slot_dlg.cpp b/code/nel/tools/3d/object_viewer/slot_dlg.cpp index 507c9b4e8..374ac99de 100644 --- a/code/nel/tools/3d/object_viewer/slot_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/slot_dlg.cpp @@ -472,7 +472,7 @@ void CSlotDlg::setWindowName () } } - GetDlgItem (IDC_SLOT_NAME)->SetWindowText (utf8ToTStr(tmp)); + GetDlgItem(IDC_SLOT_NAME)->SetWindowText(nlUtf8ToTStr(tmp)); } // *************************************************************************** diff --git a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp index a85b8ae9f..ca5b7f549 100644 --- a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp @@ -183,7 +183,7 @@ void CSnapshotToolDlg::fromRegistry() for (uint k = 0; k < filterList.size(); ++k) { - m_Filters.AddString(utf8ToTStr(filterList[k])); + m_Filters.AddString(nlUtf8ToTStr(filterList[k])); } integralTypeFromRegistry(hKey, _T("RecurseSubFolder"), (int &) m_RecurseSubFolder, FALSE); @@ -597,7 +597,7 @@ void CSnapshotToolDlg::OnTimer(UINT_PTR nIDEvent) try { CShapeStream ss; - m_Log.AddString(utf8ToTStr(_FilteredFiles[0])); + m_Log.AddString(nlUtf8ToTStr(_FilteredFiles[0])); CIFile stream(_FilteredFiles[0]); ss.serial(stream); nlassert(ss.getShapePointer()); diff --git a/code/nel/tools/3d/object_viewer/sound_anim_dlg.cpp b/code/nel/tools/3d/object_viewer/sound_anim_dlg.cpp index 893a6a011..80b0d8507 100644 --- a/code/nel/tools/3d/object_viewer/sound_anim_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/sound_anim_dlg.cpp @@ -78,7 +78,7 @@ void CSoundAnimDlg::handle() { float sec = _AnimationDlg->getTime(); std::string text = toString("time: %.3f", sec); - GetDlgItem(IDC_SOUNDANIMINFO)->SetWindowText(utf8ToTStr(text)); + GetDlgItem(IDC_SOUNDANIMINFO)->SetWindowText(nlUtf8ToTStr(text)); _AnimView.updateCursor(); } @@ -136,7 +136,7 @@ void CSoundAnimDlg::updateSounds() for (iter = sounds.begin(); iter != sounds.end(); iter++) { - list->AddString(utf8ToTStr((*iter).toString())); + list->AddString(nlUtf8ToTStr((*iter).toString())); } list->UpdateData(); diff --git a/code/nel/tools/3d/object_viewer/sound_anim_view.cpp b/code/nel/tools/3d/object_viewer/sound_anim_view.cpp index 72591a4b4..acc7828c0 100644 --- a/code/nel/tools/3d/object_viewer/sound_anim_view.cpp +++ b/code/nel/tools/3d/object_viewer/sound_anim_view.cpp @@ -217,7 +217,7 @@ void CSoundAnimView::save() // Create a dialog TCHAR BASED_CODE szFilter[] = _T("NeL Sound Animations (*.sound_anim)|*.sound_anim|All Files (*.*)|*.*||"); - CFileDialog fileDlg( FALSE, _T(".sound_anim"), utf8ToTStr(filename), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); + CFileDialog fileDlg(FALSE, _T(".sound_anim"), nlUtf8ToTStr(filename), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter); if (fileDlg.DoModal() == IDOK) { @@ -236,7 +236,7 @@ void CSoundAnimView::save() } catch (const Exception& e) { - MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); } } } diff --git a/code/nel/tools/3d/object_viewer/start_stop_particle_system.cpp b/code/nel/tools/3d/object_viewer/start_stop_particle_system.cpp index 923c35ed1..3fbf5b29a 100644 --- a/code/nel/tools/3d/object_viewer/start_stop_particle_system.cpp +++ b/code/nel/tools/3d/object_viewer/start_stop_particle_system.cpp @@ -231,13 +231,13 @@ void CStartStopParticleSystem::updateUIFromState() { if (!_ActiveNode->getParentSkelName().empty()) { - GetDlgItem(IDC_STICK_BONE)->SetWindowText(utf8ToTStr(_ActiveNode->getParentBoneName() + "." + _ActiveNode->getParentBoneName())); + GetDlgItem(IDC_STICK_BONE)->SetWindowText(nlUtf8ToTStr(_ActiveNode->getParentBoneName() + "." + _ActiveNode->getParentBoneName())); } else { GetDlgItem(IDC_STICK_BONE)->SetWindowText(_T("")); } - GetDlgItem(IDC_ACTIVE_PS)->SetWindowText(utf8ToTStr(_ActiveNode->getFilename())); + GetDlgItem(IDC_ACTIVE_PS)->SetWindowText(nlUtf8ToTStr(_ActiveNode->getFilename())); GetDlgItem(IDC_ENABLE_AUTO_COUNT)->EnableWindow(TRUE); ((CButton *) GetDlgItem(IDC_ENABLE_AUTO_COUNT))->SetCheck(getCurrPS()->getAutoCountFlag() ? 1 : 0); GetDlgItem(IDC_RESET_COUNT)->EnableWindow((_ActiveNode->getPSPointer()->getAutoCountFlag() && !_ActiveNode->getResetAutoCountFlag()) ? TRUE : FALSE); @@ -844,7 +844,7 @@ void CStartStopParticleSystem::OnLinkToSkeleton() uint boneIndex; std::string parentSkelName; std::string parentBoneName; - if (ov->chooseBone(tStrToUtf8(chooseBoneForPS), skel, boneIndex, &parentSkelName, &parentBoneName)) + if (ov->chooseBone(NLMISC::tStrToUtf8(chooseBoneForPS), skel, boneIndex, &parentSkelName, &parentBoneName)) { _ParticleDlg->stickPSToSkeleton(_ActiveNode, skel, boneIndex, parentSkelName, parentBoneName); } @@ -1017,11 +1017,11 @@ void CStartStopParticleSystem::OnBrowseAnim() } } std::vector animList(animSet.begin(), animSet.end()); - CSelectString st(animList, tStrToUtf8(getStrRsc(IDS_SELECT_ANIMATION)), this, false); + CSelectString st(animList, NLMISC::tStrToUtf8(getStrRsc(IDS_SELECT_ANIMATION)), this, false); if (st.DoModal() == IDOK && st.Selection != -1) { m_TriggerAnim = animList[st.Selection].c_str(); - _ActiveNode->setTriggerAnim(tStrToUtf8(m_TriggerAnim)); + _ActiveNode->setTriggerAnim(NLMISC::tStrToUtf8(m_TriggerAnim)); GetDlgItem(IDC_CLEAR_ANIM)->EnableWindow(!_ActiveNode->getTriggerAnim().empty()); } _ParticleDlg->ParticleTreeCtrl->updateCaption(*_ActiveNode); diff --git a/code/nel/tools/3d/object_viewer/std_afx.h b/code/nel/tools/3d/object_viewer/std_afx.h index 0cf664508..7bee59e2f 100644 --- a/code/nel/tools/3d/object_viewer/std_afx.h +++ b/code/nel/tools/3d/object_viewer/std_afx.h @@ -23,8 +23,13 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include // MFC core and standard components #include // MFC extensions diff --git a/code/nel/tools/3d/object_viewer/texture_chooser.cpp b/code/nel/tools/3d/object_viewer/texture_chooser.cpp index 70cc151b0..e87a33315 100644 --- a/code/nel/tools/3d/object_viewer/texture_chooser.cpp +++ b/code/nel/tools/3d/object_viewer/texture_chooser.cpp @@ -179,22 +179,22 @@ void CTextureChooser::OnBrowseTexture() { texName = (static_cast(_Wrapper->get()))->getFileName(); } - CFileDialog fd(TRUE, _T(".tga"), utf8ToTStr(texName), 0, NULL, this); + CFileDialog fd(TRUE, _T(".tga"), nlUtf8ToTStr(texName), 0, NULL, this); if (fd.DoModal() == IDOK) { // Add search path for the texture - NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); + NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName()))); try { - NL3D::CTextureFile *tf = new NL3D::CTextureFile(tStrToUtf8(fd.GetFileName())); + NL3D::CTextureFile *tf = new NL3D::CTextureFile(NLMISC::tStrToUtf8(fd.GetFileName())); _Wrapper->setAndUpdateModifiedFlag(tf); _Texture = tf; textureToBitmap(); } catch (const NLMISC::Exception &e) { - MessageBox(utf8ToTStr(e.what()), _T("error loading texture")); + MessageBox(nlUtf8ToTStr(e.what()), _T("error loading texture")); } } diff --git a/code/nel/tools/3d/object_viewer/vegetable_copy_dlg.cpp b/code/nel/tools/3d/object_viewer/vegetable_copy_dlg.cpp index 05e0ab1fd..d0015d26d 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_copy_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_copy_dlg.cpp @@ -249,7 +249,7 @@ BOOL CVegetableCopyDlg::OnInitDialog() uint num= _VegetableDlg->getNumVegetables(); for(uint i=0; igetVegetableName(i))); + VegetableList.AddString(nlUtf8ToTStr(_VegetableDlg->getVegetableName(i))); } diff --git a/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp b/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp index d8f9c2d75..f86e681a7 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp @@ -100,7 +100,7 @@ void CVegetableDensityPage::setVegetableToEdit(NL3D::CVegetable *vegetable) { // Init ShapeName // ---------- - StaticVegetableShape.SetWindowText(utf8ToTStr(_Vegetable->ShapeName)); + StaticVegetableShape.SetWindowText(nlUtf8ToTStr(_Vegetable->ShapeName)); // init Creation Distance. // ---------- @@ -228,7 +228,7 @@ void CVegetableDensityPage::updateAngleMinFromEditText() TCHAR stmp[256]; AngleMinEdit.GetWindowText(stmp, 256); float angleMin; - NLMISC::fromString(tStrToUtf8(stmp), angleMin); + NLMISC::fromString(NLMISC::tStrToUtf8(stmp), angleMin); NLMISC::clamp(angleMin, -90, 90); // make a sinus, because 90 => 1, and -90 =>-1 float cosAngleMin= (float)sin(angleMin*NLMISC::Pi/180.f); @@ -252,7 +252,7 @@ void CVegetableDensityPage::updateAngleMaxFromEditText() TCHAR stmp[256]; AngleMaxEdit.GetWindowText(stmp, 256); float angleMax; - NLMISC::fromString(tStrToUtf8(stmp), angleMax); + NLMISC::fromString(NLMISC::tStrToUtf8(stmp), angleMax); NLMISC::clamp(angleMax, -90, 90); // make a sinus, because 90 => 1, and -90 =>-1 float cosAngleMax= (float)sin(angleMax*NLMISC::Pi/180.f); @@ -523,10 +523,10 @@ void CVegetableDensityPage::OnButtonVegetableBrowse() if (fd.DoModal() == IDOK) { // Add to the path - std::string fileName = tStrToUtf8(fd.GetFileName()); + std::string fileName = NLMISC::tStrToUtf8(fd.GetFileName()); // Add search path for the .veget - std::string path = NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName())); + std::string path = NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName())); NLMISC::CPath::addSearchPath (path); try @@ -546,7 +546,7 @@ void CVegetableDensityPage::OnButtonVegetableBrowse() } catch (const NLMISC::EPathNotFound &ep) { - MessageBox(utf8ToTStr(ep.what()), _T("Can't open file")); + MessageBox(nlUtf8ToTStr(ep.what()), _T("Can't open file")); } } } diff --git a/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp b/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp index 09a2079e5..d9799408a 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp @@ -196,7 +196,7 @@ void CVegetableDlg::updateCurSelVegetableName() _Vegetables[id].updateVegetableName(); // replace name in the listBox: must delete, and re-insert VegetableList.DeleteString(id); - VegetableList.InsertString(id, utf8ToTStr(_Vegetables[id].VegetableName)); + VegetableList.InsertString(id, nlUtf8ToTStr(_Vegetables[id].VegetableName)); VegetableList.SetCurSel(id); } } @@ -349,14 +349,14 @@ bool CVegetableDlg::loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const ok= true; - if( f.open(tStrToUtf8(fd.GetPathName()))) + if (f.open(NLMISC::tStrToUtf8(fd.GetPathName()))) { try { // read the vegetable f.serial(vegetSet); // bkup fileName. - _LastVegetSetName = tStrToUtf8(fd.GetFileName()); + _LastVegetSetName = NLMISC::tStrToUtf8(fd.GetFileName()); } catch(const NLMISC::EStream &) { @@ -439,7 +439,7 @@ void CVegetableDlg::appendVegetableSet(NL3D::CTileVegetableDesc &vegetSet) _Vegetables[id].initVegetable(veget); // update view - VegetableList.AddString(utf8ToTStr(_Vegetables[id].VegetableName)); + VegetableList.AddString(nlUtf8ToTStr(_Vegetables[id].VegetableName)); } } } @@ -529,7 +529,7 @@ void CVegetableDlg::OnButtonVegetableAdd() _Vegetables[id].initDefaultVegetable(); // update view - VegetableList.AddString(utf8ToTStr(_Vegetables[id].VegetableName)); + VegetableList.AddString(nlUtf8ToTStr(_Vegetables[id].VegetableName)); // update 3D view refreshVegetableDisplay(); @@ -559,7 +559,7 @@ void CVegetableDlg::OnButtonVegetableInsert() _Vegetables[id].initDefaultVegetable(); // update view - VegetableList.InsertString(id, utf8ToTStr(_Vegetables[id].VegetableName)); + VegetableList.InsertString(id, nlUtf8ToTStr(_Vegetables[id].VegetableName)); // update 3D view refreshVegetableDisplay(); @@ -611,7 +611,7 @@ void CVegetableDlg::OnButtonVegetableLoadDesc() { NLMISC::CIFile f; - if( f.open(tStrToUtf8(fd.GetPathName())) ) + if (f.open(NLMISC::tStrToUtf8(fd.GetPathName()))) { NL3D::CVegetable veget; try @@ -624,7 +624,7 @@ void CVegetableDlg::OnButtonVegetableLoadDesc() _Vegetables[id].initVegetable(veget); // update view - VegetableList.AddString(utf8ToTStr(_Vegetables[id].VegetableName)); + VegetableList.AddString(nlUtf8ToTStr(_Vegetables[id].VegetableName)); // update 3D view refreshVegetableDisplay(); @@ -651,13 +651,13 @@ void CVegetableDlg::OnButtonVegetableSaveDesc() std::string fileName= _Vegetables[id].VegetableName + ".vegetdesc"; - CFileDialog fd(FALSE, _T("vegetdesc"), utf8ToTStr(fileName), OFN_OVERWRITEPROMPT, _T("VegetDescFiles (*.vegetdesc)|*.vegetdesc|All Files (*.*)|*.*||"), this) ; + CFileDialog fd(FALSE, _T("vegetdesc"), nlUtf8ToTStr(fileName), OFN_OVERWRITEPROMPT, _T("VegetDescFiles (*.vegetdesc)|*.vegetdesc|All Files (*.*)|*.*||"), this); fd.m_ofn.lpstrTitle = _T("Save Vegetable Descriptor"); if (fd.DoModal() == IDOK) { NLMISC::COFile f; - if( f.open(tStrToUtf8(fd.GetPathName())) ) + if (f.open(NLMISC::tStrToUtf8(fd.GetPathName()))) { try { @@ -722,13 +722,13 @@ void CVegetableDlg::OnButtonVegetableSaveSet() buildVegetableSet(vegetSet); // Then try to save it. - CFileDialog fd(FALSE, _T("vegetset"), utf8ToTStr(_LastVegetSetName), OFN_OVERWRITEPROMPT, _T("VegetSetFiles (*.vegetset)|*.vegetset|All Files (*.*)|*.*||"), this) ; + CFileDialog fd(FALSE, _T("vegetset"), nlUtf8ToTStr(_LastVegetSetName), OFN_OVERWRITEPROMPT, _T("VegetSetFiles (*.vegetset)|*.vegetset|All Files (*.*)|*.*||"), this); fd.m_ofn.lpstrTitle = _T("Save Vegetable Set"); if (fd.DoModal() == IDOK) { NLMISC::COFile f; - if( f.open(tStrToUtf8(fd.GetPathName())) ) + if (f.open(NLMISC::tStrToUtf8(fd.GetPathName()))) { try { diff --git a/code/nel/tools/3d/object_viewer/vegetable_edit_tools.cpp b/code/nel/tools/3d/object_viewer/vegetable_edit_tools.cpp index b0508cca9..072d319d7 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_edit_tools.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_edit_tools.cpp @@ -33,7 +33,7 @@ void CDirectEditableRangeFloat::init(uint32 x, uint32 y, CWnd *pParent) CRect rect; rect.SetRect(x, y+10, x+dx, y+25); - _StaticText.Create(utf8ToTStr(_Title), WS_CHILD | WS_VISIBLE, rect, pParent); + _StaticText.Create(nlUtf8ToTStr(_Title), WS_CHILD | WS_VISIBLE, rect, pParent); _StaticText.SetFont(pParent->GetFont()); } diff --git a/code/nel/tools/3d/object_viewer/vegetable_noise_value_dlg.cpp b/code/nel/tools/3d/object_viewer/vegetable_noise_value_dlg.cpp index 12bfe4050..5b3360898 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_noise_value_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_noise_value_dlg.cpp @@ -154,7 +154,7 @@ BOOL CVegetableNoiseValueDlg::OnInitDialog() // Set the name. - NoiseValueName.SetWindowText(utf8ToTStr(_TitleName)); + NoiseValueName.SetWindowText(nlUtf8ToTStr(_TitleName)); // if previously setuped, setup now the noiseValue. @@ -264,5 +264,5 @@ void CVegetableNoiseValueDlg::applyScaleSlider(sint scrollValue) _RandValue->updateValueFromReader(); // update marker text - StaticScaleMarker.SetWindowText(utf8ToTStr(NLMISC::toString("%d%%", (sint)(factor * 100)))); + StaticScaleMarker.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%d%%", (sint)(factor * 100)))); } diff --git a/code/nel/tools/3d/object_viewer/vegetable_select_dlg.cpp b/code/nel/tools/3d/object_viewer/vegetable_select_dlg.cpp index d7be7bcb3..b6e6df97a 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_select_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_select_dlg.cpp @@ -63,7 +63,7 @@ BOOL CVegetableSelectDlg::OnInitDialog() uint num= _VegetableDlg->getNumVegetables(); for(uint i=0; igetVegetableName(i))); + VegetableList.AddString(nlUtf8ToTStr(_VegetableDlg->getVegetableName(i))); } return TRUE; // return TRUE unless you set the focus to a control diff --git a/code/nel/tools/3d/object_viewer/vegetable_wind_dlg.cpp b/code/nel/tools/3d/object_viewer/vegetable_wind_dlg.cpp index 0b2084863..79533b623 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_wind_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_wind_dlg.cpp @@ -73,19 +73,19 @@ void CVegetableWindDlg::updateView() // update Power. a= _ObjViewer->getVegetableWindPower(); - StaticPower.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); + StaticPower.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a))); NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_POWER); SliderPower.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_POWER)); // update BendStart. a= _ObjViewer->getVegetableWindBendStart(); - StaticBendStart.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); + StaticBendStart.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a))); NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART); SliderBendStart.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART)); // update Frequency. a= _ObjViewer->getVegetableWindFrequency(); - StaticFrequency.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); + StaticFrequency.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a))); NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY); SliderFrequency.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY)); @@ -129,20 +129,20 @@ void CVegetableWindDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBa { a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_POWER / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE; _ObjViewer->setVegetableWindPower(a); - StaticPower.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); + StaticPower.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a))); } else if(sliderCtrl == &SliderBendStart) { a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE; _ObjViewer->setVegetableWindBendStart(a); - StaticBendStart.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); + StaticBendStart.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a))); } else if(sliderCtrl == &SliderFrequency) { a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE; _ObjViewer->setVegetableWindFrequency(a); - StaticFrequency.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); + StaticFrequency.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a))); } } else diff --git a/code/nel/tools/3d/object_viewer/water_pool_editor.cpp b/code/nel/tools/3d/object_viewer/water_pool_editor.cpp index bf6f461bf..5f5c0cc24 100644 --- a/code/nel/tools/3d/object_viewer/water_pool_editor.cpp +++ b/code/nel/tools/3d/object_viewer/water_pool_editor.cpp @@ -166,7 +166,7 @@ BOOL CWaterPoolEditor::OnInitDialog() int CWaterPoolEditor::addPool(uint32 ID) { std::string poolId = NLMISC::toString("%d (%s)", ID, _Wpm->getPoolByID(ID).getName().c_str()); - int index = m_PoolList.AddString(utf8ToTStr(poolId)); + int index = m_PoolList.AddString(nlUtf8ToTStr(poolId)); nlassert(index != LB_ERR); m_PoolList.SetItemData(index, ID); return index; @@ -357,7 +357,7 @@ void CWaterPoolEditor::OnLoadPool() { NLMISC::CIXml iXml; NLMISC::CIFile iF; - if (iF.open(tStrToUtf8(fileDlg.GetPathName()))) + if (iF.open(NLMISC::tStrToUtf8(fileDlg.GetPathName()))) { if (iXml.init (iF)) { @@ -369,17 +369,17 @@ void CWaterPoolEditor::OnLoadPool() else { iF.close(); - MessageBox (utf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", NLMISC::tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); } } else { - MessageBox (utf8ToTStr(NLMISC::toString("Unable to open file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(NLMISC::toString("Unable to open file: %s", NLMISC::tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); } } catch (const NLMISC::Exception& e) { - MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); } } } @@ -395,7 +395,7 @@ void CWaterPoolEditor::OnSavePool() { NLMISC::COXml oXml; NLMISC::COFile oF; - if (oF.open(tStrToUtf8(fileDlg.GetPathName()))) + if (oF.open(NLMISC::tStrToUtf8(fileDlg.GetPathName()))) { if (oXml.init (&oF)) { @@ -406,17 +406,17 @@ void CWaterPoolEditor::OnSavePool() else { oF.close(); - MessageBox (utf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", NLMISC::tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); } } else { - MessageBox (utf8ToTStr(NLMISC::toString("Unable to open file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(NLMISC::toString("Unable to open file: %s", NLMISC::tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); } } catch (const NLMISC::Exception& e) { - MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION); } } diff --git a/code/nel/tools/3d/object_viewer_exe/std_afx.h b/code/nel/tools/3d/object_viewer_exe/std_afx.h index 953342427..f99ca7a0c 100644 --- a/code/nel/tools/3d/object_viewer_exe/std_afx.h +++ b/code/nel/tools/3d/object_viewer_exe/std_afx.h @@ -23,8 +23,13 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include diff --git a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/StdAfx.cpp b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/StdAfx.cpp index ea4148a46..e0a8e62f6 100644 --- a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/StdAfx.cpp +++ b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/StdAfx.cpp @@ -18,3 +18,5 @@ // and not in this file #include "stdafx.h" + +void nlmax_shared_stdafx_dummy() { } diff --git a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.cpp b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.cpp index 76592f556..3b73a3533 100644 --- a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.cpp +++ b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.cpp @@ -72,3 +72,5 @@ NEL_3DSMAX_SHARED_API NLMISC::INelContext &GetSharedNelContext() } return NLMISC::INelContext::getInstance(); } + +/* end of file */ diff --git a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.h b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.h index 1d7b4ceba..19ebdf817 100644 --- a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.h +++ b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.h @@ -25,3 +25,5 @@ class CPatchAllocator; extern NEL_3DSMAX_SHARED_API CPatchAllocator& GetAllocator(); extern NEL_3DSMAX_SHARED_API NLMISC::INelContext &GetSharedNelContext(); + +/* end of file */ diff --git a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/string_common.h b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/string_common.h new file mode 100644 index 000000000..72ae6adee --- /dev/null +++ b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/string_common.h @@ -0,0 +1,75 @@ +// NeL - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef NLMAX_STRING_COMMON_H +#define NLMAX_STRING_COMMON_H + +#include + +#if (MAX_VERSION_MAJOR < 15) +#define GET_OBJECT_NAME_CONST +#define NOTIFY_REF_PARAMS Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message +#define NOTIFY_REF_PROPAGATE , BOOL propagate +#define nl_p_end end +#else +#define GET_OBJECT_NAME_CONST const +#define NOTIFY_REF_PARAMS const Interval &changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate +#define nl_p_end p_end +#endif + +static TSTR MaxTStrFromUtf8(const std::string &src) +{ + TSTR dst; +#if (MAX_VERSION_MAJOR < 15) + ucstring uc; + uc.fromUtf8(src); + dst = (const mwchar_t *)uc.c_str(); +#else + dst.FromUTF8(src.c_str()); +#endif + return dst; +} + +static std::string MaxTStrToUtf8(const TSTR& src) +{ +#if (MAX_VERSION_MAJOR < 15) +#ifdef _UNICODE + ucstring uc(src.data()); + return uc.toUtf8(); +#else + WStr ws = src; + ucstring uc((const ucchar *)ws.data()); + return uc.toUtf8(); +#endif +#else + return src.ToUTF8().data(); +#endif +} + +static std::string MCharStrToUtf8(const MCHAR *src) +{ +#ifdef _UNICODE + ucstring uc((const ucchar *)src); + return uc.toUtf8(); +#else + ucstring uc((const ucchar *)WStr(src).data()); + return uc.toUtf8(); +#endif +} + +#endif /* #ifndef NLMAX_STRING_COMMON_H */ + +/* end of file */ diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp index 4482ab51f..a44167294 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp @@ -94,7 +94,7 @@ INT_PTR CALLBACK OptionsDialogCallback ( else SendMessage( GetDlgItem(hwndDlg,IDC_SHADOW), BM_SETCHECK, BST_UNCHECKED, 0 ); - SendMessage( GetDlgItem(hwndDlg,IDC_EDITEXPORTLIGHTING), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(theExportSceneStruct.sExportLighting)); + SendMessage( GetDlgItem(hwndDlg,IDC_EDITEXPORTLIGHTING), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(theExportSceneStruct.sExportLighting).data()); if( theExportSceneStruct.nExportLighting == 0 ) SendMessage( GetDlgItem(hwndDlg,IDC_RADIONORMALEXPORTLIGHTING), BM_SETCHECK, BST_CHECKED, 0 ); @@ -102,7 +102,7 @@ INT_PTR CALLBACK OptionsDialogCallback ( if( theExportSceneStruct.nExportLighting == 1 ) SendMessage( GetDlgItem(hwndDlg,IDC_RADIORADIOSITYEXPORTLIGHTING), BM_SETCHECK, BST_CHECKED, 0 ); - SendMessage( GetDlgItem(hwndDlg,IDC_EDITLUMELSIZE), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(toString(theExportSceneStruct.rLumelSize))); + SendMessage( GetDlgItem(hwndDlg,IDC_EDITLUMELSIZE), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(toString(theExportSceneStruct.rLumelSize)).data()); if( theExportSceneStruct.nOverSampling == 1 ) SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS1), BM_SETCHECK, BST_CHECKED, 0 ); @@ -132,8 +132,8 @@ INT_PTR CALLBACK OptionsDialogCallback ( else SendMessage( GetDlgItem(hwndDlg,IDC_TEST_SURFACE_LIGHT), BM_SETCHECK, BST_UNCHECKED, 0 ); - SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(toString(theExportSceneStruct.SurfaceLightingCellSize))); - SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(toString(theExportSceneStruct.SurfaceLightingDeltaZ))); + SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(toString(theExportSceneStruct.SurfaceLightingCellSize)).data()); + SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(toString(theExportSceneStruct.SurfaceLightingDeltaZ)).data()); } break; @@ -148,7 +148,7 @@ INT_PTR CALLBACK OptionsDialogCallback ( if( theCNelExport.SelectDir(hwndDlg, _T("LightMaps Directory"), sTemp ) ) { theExportSceneStruct.sExportLighting = sTemp; - SendMessage( GetDlgItem(hwndDlg, IDC_EDITEXPORTLIGHTING), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(theExportSceneStruct.sExportLighting) ); + SendMessage(GetDlgItem(hwndDlg, IDC_EDITEXPORTLIGHTING), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(theExportSceneStruct.sExportLighting).data()); } } break; @@ -180,7 +180,7 @@ INT_PTR CALLBACK OptionsDialogCallback ( TCHAR tmp[1024]; SendMessage( GetDlgItem(hwndDlg,IDC_EDITEXPORTLIGHTING), WM_GETTEXT, 1024, (LPARAM)tmp ); - theExportSceneStruct.sExportLighting = tStrToUtf8(tmp); + theExportSceneStruct.sExportLighting = MCharStrToUtf8(tmp); if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIONORMALEXPORTLIGHTING), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.nExportLighting = 0; @@ -189,7 +189,7 @@ INT_PTR CALLBACK OptionsDialogCallback ( theExportSceneStruct.nExportLighting = 1; SendMessage( GetDlgItem(hwndDlg,IDC_EDITLUMELSIZE), WM_GETTEXT, 1024, (LPARAM)tmp ); - NLMISC::fromString(tStrToUtf8(tmp), theExportSceneStruct.rLumelSize); + NLMISC::fromString(MCharStrToUtf8(tmp), theExportSceneStruct.rLumelSize); if( SendMessage( GetDlgItem(hwndDlg,IDC_RADIOSS1), BM_GETCHECK, 0, 0 ) == BST_CHECKED ) theExportSceneStruct.nOverSampling = 1; @@ -214,10 +214,10 @@ INT_PTR CALLBACK OptionsDialogCallback ( theExportSceneStruct.bTestSurfaceLighting= (SendMessage( GetDlgItem(hwndDlg,IDC_TEST_SURFACE_LIGHT), BM_GETCHECK, 0, 0 ) == BST_CHECKED); SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLSIZE), WM_GETTEXT, 1024, (LPARAM)tmp ); - NLMISC::fromString(tStrToUtf8(tmp), theExportSceneStruct.SurfaceLightingCellSize); + NLMISC::fromString(MCharStrToUtf8(tmp), theExportSceneStruct.SurfaceLightingCellSize); SendMessage( GetDlgItem(hwndDlg,IDC_EDITCELLDELTAZ), WM_GETTEXT, 1024, (LPARAM)tmp ); - NLMISC::fromString(tStrToUtf8(tmp), theExportSceneStruct.SurfaceLightingDeltaZ); + NLMISC::fromString(MCharStrToUtf8(tmp), theExportSceneStruct.SurfaceLightingDeltaZ); // End the dialog EndDialog(hwndDlg, TRUE); @@ -354,7 +354,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP if (RPO::isZone (*pNode, time)) { // Save path - std::string sSavePath = tStrToUtf8(pNode->GetName()); + std::string sSavePath = MCharStrToUtf8(pNode->GetName()); // Choose a file to export if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) @@ -364,15 +364,15 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP if (!theCNelExport.exportZone (sSavePath, *pNode, time)) { // Error message - std::string sErrorMsg = toString("Error exporting the zone %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); - MessageBox (hWnd, utf8ToTStr(sErrorMsg), L"NeL export", MB_OK|MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting the zone %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); + MessageBox (hWnd, MaxTStrFromUtf8(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); } } } else if (CExportNel::isVegetable (*pNode, time)) { // Save path - std::string sSavePath = tStrToUtf8(pNode->GetName()); + std::string sSavePath = MCharStrToUtf8(pNode->GetName()); // Choose a file to export if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) @@ -382,8 +382,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP if (!theCNelExport.exportVegetable (sSavePath.c_str(), *pNode, time)) { // Error message - std::string sErrorMsg = toString("Error exporting the vegetable %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); - MessageBox (hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting the vegetable %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); + MessageBox (hWnd, MaxTStrFromUtf8(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -391,7 +391,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP else if (CExportNel::isLodCharacter (*pNode, time)) { // Save path - std::string sSavePath = tStrToUtf8(pNode->GetName()); + std::string sSavePath = MCharStrToUtf8(pNode->GetName()); // Choose a file to export if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) @@ -401,8 +401,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP if (!theCNelExport.exportLodCharacter (sSavePath, *pNode, time)) { // Error message - std::string sErrorMsg = toString("Error exporting the lod character %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); - MessageBox (hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting the lod character %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); + MessageBox (hWnd, MaxTStrFromUtf8(sErrorMsg).data(), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -410,7 +410,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP else if (CExportNel::isMesh (*pNode, time)) { // Save path - std::string sSavePath = tStrToUtf8(pNode->GetName()); + std::string sSavePath = MCharStrToUtf8(pNode->GetName()); // Choose a file to export if (!CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_DONTEXPORT, 0)) @@ -424,8 +424,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP if (!theCNelExport.exportMesh (sSavePath, *pNode, time)) { // Error message - std::string sErrorMsg = toString("Error exporting the mesh %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); - MessageBox (hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting the mesh %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); + MessageBox (hWnd, MaxTStrFromUtf8(sErrorMsg).data(), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); } // Delete the skeleton pointer if (pSkinShape) @@ -463,7 +463,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Name of the node // Save path - std::string sSavePath = tStrToUtf8((*vectNode.begin())->GetName()); + std::string sSavePath = MCharStrToUtf8((*vectNode.begin())->GetName()); // Choose a file to export if (theCNelExport.SelectFileForSave (hWnd, _T("Save animations..."), (LOWORD(wParam)==ID_SAVE_MODEL_ANIM)?animModelFilter:animModelFilter, @@ -473,8 +473,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP if (!theCNelExport.exportAnim (sSavePath, vectNode, time, LOWORD(wParam)==ID_SAVE_SCENE_ANIM)) { // Error message - std::string sErrorMsg = toString("Error exporting animation %s in the file\n%s", tStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str()); - MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting animation %s in the file\n%s", MCharStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str()); + MessageBox(hWnd, MaxTStrFromUtf8(sErrorMsg).data(), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); } } } @@ -566,7 +566,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP nlassert (vectNode.size()!=0); // Save path - std::string sSavePath = tStrToUtf8((*vectNode.begin())->GetName()); + std::string sSavePath = MCharStrToUtf8((*vectNode.begin())->GetName()); if (theCNelExport.SelectFileForSave (hWnd, _T("Save SWT..."), SWTFilter, sSavePath)) { @@ -574,8 +574,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP if (!theCNelExport.exportSWT (sSavePath, vectNode)) { // Error message - std::string sErrorMsg = toString("Error exporting SWT %s in the file\n%s", tStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str()); - MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting SWT %s in the file\n%s", MCharStrToUtf8((*vectNode.begin())->GetName()).c_str(), sSavePath.c_str()); + MessageBox(hWnd, MaxTStrFromUtf8(sErrorMsg).data(), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); } } } @@ -588,7 +588,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP nlassert (theIP); theCNelExport.init (false, true, theIP, true); - std::string sConfigFileName = tStrToUtf8(theCNelExport._Ip->GetDir(APP_PLUGCFG_DIR)) + "\\NelExportScene.cfg"; + std::string sConfigFileName = MCharStrToUtf8(theCNelExport._Ip->GetDir(APP_PLUGCFG_DIR)) + "\\NelExportScene.cfg"; // Do a modal dialog box to choose the scene export options if( DialogBox( hInstance, @@ -647,7 +647,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP theCNelExport.getSelectedNode (vectNode); nlassert (vectNode.size()!=0); - std::string sSavePath = tStrToUtf8((*vectNode.begin())->GetName()); + std::string sSavePath = MCharStrToUtf8((*vectNode.begin())->GetName()); if (theCNelExport.SelectFileForSave (hWnd, _T("Save Instance group"), InstanceGroupFilter, sSavePath)) { @@ -656,7 +656,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP { // Error message std::string sErrorMsg = toString("Error exporting instance group %s", sSavePath.c_str()); - MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); + MessageBox(hWnd, MaxTStrFromUtf8(sErrorMsg).data(), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); } } } @@ -690,8 +690,8 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP if (!theCNelExport.exportSkeleton (sSavePath, pNode, theCNelExport._Ip->GetTime())) { // Error message - std::string sErrorMsg = toString("Error exporting skeleton %s in the file\n%s", tStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); - MessageBox(hWnd, utf8ToTStr(sErrorMsg), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); + std::string sErrorMsg = toString("Error exporting skeleton %s in the file\n%s", MCharStrToUtf8(pNode->GetName()).c_str(), sSavePath.c_str()); + MessageBox(hWnd, MaxTStrFromUtf8(sErrorMsg).data(), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); } } } @@ -736,7 +736,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP } catch(const std::exception &e) { - ::MessageBox(hWnd, utf8ToTStr(e.what()), _T("Error"), MB_OK | MB_ICONEXCLAMATION); + ::MessageBoxA(hWnd, e.what(), "Error", MB_OK | MB_ICONEXCLAMATION); } } } @@ -820,7 +820,7 @@ void CNelExport::getSelectedNode (std::vector& vectNode) void CNelExport::initOptions() { // Initialization of theExportSceneStruct - std::string sConfigFileName = tStrToUtf8(theCNelExport._Ip->GetDir(APP_PLUGCFG_DIR)) + "\\NelExportScene.cfg"; + std::string sConfigFileName = MCharStrToUtf8(theCNelExport._Ip->GetDir(APP_PLUGCFG_DIR)) + "\\NelExportScene.cfg"; // MessageBox (hWnd, sConfigFileName, "sConfigFileName", MB_OK|MB_ICONEXCLAMATION); if( CFile::fileExists(sConfigFileName) ) diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp index 3be72a9bb..49e1e5ea3 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_export.cpp @@ -329,7 +329,7 @@ bool CNelExport::exportAnim (const std::string &sPath, std::vector& vect catch (const Exception& e) { if (_ErrorInDialog) - MessageBox (NULL, utf8ToTStr(e.what()), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); + MessageBoxA (NULL, e.what(), "NeL export", MB_OK|MB_ICONEXCLAMATION); else nlwarning ("ERROR : %s", e.what ()); } diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_filetools.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_filetools.cpp index 11020e4fc..ea5444fca 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_filetools.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_filetools.cpp @@ -50,8 +50,8 @@ ULONG CNelExport::SelectFileForSave(HWND Parent, const TCHAR* Title, const TCHAR } // copy path and filename to temporary buffers - _tcscpy_s(curdir, MAX_PATH, utf8ToTStr(path)); - _tcscpy_s(fname, MAX_PATH, utf8ToTStr(filename)); + _tcscpy_s(curdir, MAX_PATH, MaxTStrFromUtf8(path).data()); + _tcscpy_s(fname, MAX_PATH, MaxTStrFromUtf8(filename).data()); OPENFILENAME ofn; memset(&ofn,0,sizeof(OPENFILENAME)); @@ -69,7 +69,7 @@ ULONG CNelExport::SelectFileForSave(HWND Parent, const TCHAR* Title, const TCHAR ofn.lpstrInitialDir = curdir; BOOL r = GetSaveFileName ( &ofn ); - FileName = tStrToUtf8(fname); + FileName = MCharStrToUtf8(fname); return r; } @@ -79,7 +79,7 @@ ULONG CNelExport::SelectFileForSave(HWND Parent, const TCHAR* Title, const TCHAR ULONG CNelExport::SelectDir(HWND Parent, const TCHAR* Title, std::string &Path) { TCHAR str[MAX_PATH]; - _tcscpy_s(str, MAX_PATH, utf8ToTStr(Path)); + _tcscpy_s(str, MAX_PATH, MaxTStrFromUtf8(Path).data()); BROWSEINFO bi; bi.hwndOwner=Parent; @@ -98,7 +98,7 @@ ULONG CNelExport::SelectDir(HWND Parent, const TCHAR* Title, std::string &Path) return 0; } - Path = tStrToUtf8(str); + Path = MCharStrToUtf8(str); return 1; } diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp index 949395d14..ef5e4c7e7 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_node_properties.cpp @@ -90,11 +90,11 @@ class addSubLodNodeHitCallBack : public HitByNameDlgCallback public: INodeTab NodeTab; private: - virtual const MCHAR *dialogTitle() + virtual GET_OBJECT_NAME_CONST MCHAR *dialogTitle() { return _M("Select sub lod objects to add"); } - virtual const MCHAR *buttonText() + virtual GET_OBJECT_NAME_CONST MCHAR *buttonText() { return _M("Add"); } @@ -522,27 +522,27 @@ INT_PTR CALLBACK AccelDialogCallback ( std::set::iterator first(_KnownSoundGroups.begin()), last(_KnownSoundGroups.end()); for (; first != last; ++first) { - SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_ADDSTRING, 0, (LPARAM)utf8ToTStr(*first)); + SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_ADDSTRING, 0, (LPARAM)MaxTStrFromUtf8(*first).data()); } } // set the combo and edit box - if (SendMessage (GetDlgItem (hwndDlg, IDC_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)utf8ToTStr(currentParam->OcclusionModel)) == CB_ERR) + if (SendMessage (GetDlgItem (hwndDlg, IDC_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)MaxTStrFromUtf8(currentParam->OcclusionModel).data()) == CB_ERR) { // nlassert(false); } - if (SendMessage (GetDlgItem (hwndDlg, IDC_OPEN_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)utf8ToTStr(currentParam->OpenOcclusionModel)) == CB_ERR) + if (SendMessage (GetDlgItem (hwndDlg, IDC_OPEN_OCC_MODEL), CB_SELECTSTRING, -1, (LPARAM)MaxTStrFromUtf8(currentParam->OpenOcclusionModel).data()) == CB_ERR) { // nlassert(false); } - if (SendMessage (GetDlgItem (hwndDlg, IDC_ENV_FX), CB_SELECTSTRING, -1, (LPARAM)utf8ToTStr(currentParam->EnvironmentFX)) == CB_ERR) + if (SendMessage (GetDlgItem (hwndDlg, IDC_ENV_FX), CB_SELECTSTRING, -1, (LPARAM)MaxTStrFromUtf8(currentParam->EnvironmentFX).data()) == CB_ERR) { // nlassert(false); } - if (SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_SELECTSTRING, -1, (LPARAM)utf8ToTStr(currentParam->SoundGroup)) == CB_ERR) + if (SendMessage (GetDlgItem (hwndDlg, IDC_SOUND_GROUP), CB_SELECTSTRING, -1, (LPARAM)MaxTStrFromUtf8(currentParam->SoundGroup).data()) == CB_ERR) { // nlassert(false); } -// SendMessage(GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(currentParam->SoundGroup)); +// SendMessage(GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(currentParam->SoundGroup).data()); bool accelerator = (currentParam->AcceleratorType != -1); CheckRadioButton (hwndDlg, IDC_RADIOACCELNO, IDC_RADIOACCELCLUSTER, accelerator?(IDC_RADIOACCELNO+(currentParam->AcceleratorType&NEL3D_APPDATA_ACCEL_TYPE)):0); @@ -583,14 +583,14 @@ INT_PTR CALLBACK AccelDialogCallback ( // get the strings params TCHAR tmp[256]; SendMessage (GetDlgItem(hwndDlg, IDC_OCC_MODEL), WM_GETTEXT, 256, (LPARAM)tmp); - currentParam->OcclusionModel = tStrToUtf8(tmp); + currentParam->OcclusionModel = MCharStrToUtf8(tmp); SendMessage (GetDlgItem(hwndDlg, IDC_OPEN_OCC_MODEL), WM_GETTEXT, 256, (LPARAM)tmp); - currentParam->OpenOcclusionModel = tStrToUtf8(tmp); + currentParam->OpenOcclusionModel = MCharStrToUtf8(tmp); SendMessage (GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_GETTEXT, 256, (LPARAM)tmp); - currentParam->SoundGroup = tStrToUtf8(tmp); + currentParam->SoundGroup = MCharStrToUtf8(tmp); _KnownSoundGroups.insert(currentParam->SoundGroup); SendMessage (GetDlgItem(hwndDlg, IDC_ENV_FX), WM_GETTEXT, 256, (LPARAM)tmp); - currentParam->EnvironmentFX = tStrToUtf8(tmp); + currentParam->EnvironmentFX = MCharStrToUtf8(tmp); // Quit EndDialog(hwndDlg, IDOK); @@ -653,9 +653,9 @@ INT_PTR CALLBACK MRMDialogCallback ( currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); // Window text - std::string winName= tStrToUtf8((*(currentParam->ListNode->begin()))->GetName()); + std::string winName= MCharStrToUtf8((*(currentParam->ListNode->begin()))->GetName()); winName="Node properties ("+winName+((currentParam->ListNode->size()>1)?" ...)":")"); - SetWindowText (hwndDlg, utf8ToTStr(winName)); + SetWindowText (hwndDlg, MaxTStrFromUtf8(winName).data()); // Set default state SendMessage (GetDlgItem (hwndDlg, IDC_BLEND_IN), BM_SETCHECK, currentParam->BlendIn, 0); @@ -669,8 +669,8 @@ INT_PTR CALLBACK MRMDialogCallback ( EnableWindow (GetDlgItem (hwndDlg, IDC_UP), currentParam->ListActived); EnableWindow (GetDlgItem (hwndDlg, IDC_DOWN), currentParam->ListActived); - SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), utf8ToTStr(currentParam->DistMax)); - SetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), utf8ToTStr(currentParam->BlendLength)); + SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), MaxTStrFromUtf8(currentParam->DistMax).data()); + SetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), MaxTStrFromUtf8(currentParam->BlendLength).data()); SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_SETCHECK, currentParam->MRM, 0); CoarseStateChanged (hwndDlg); @@ -678,12 +678,12 @@ INT_PTR CALLBACK MRMDialogCallback ( if (currentParam->SkinReduction!=-1) CheckRadioButton (hwndDlg, IDC_SKIN_REDUCTION_MIN, IDC_SKIN_REDUCTION_BEST, IDC_SKIN_REDUCTION_MIN+currentParam->SkinReduction); - SetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), utf8ToTStr(currentParam->NbLod)); - SetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), utf8ToTStr(currentParam->Divisor)); - SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), utf8ToTStr(currentParam->DistanceFinest)); - SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), utf8ToTStr(currentParam->DistanceMiddle)); - SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), utf8ToTStr(currentParam->DistanceCoarsest)); - SetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), utf8ToTStr(currentParam->BoneLodDistance)); + SetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), MaxTStrFromUtf8(currentParam->NbLod).data()); + SetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), MaxTStrFromUtf8(currentParam->Divisor).data()); + SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), MaxTStrFromUtf8(currentParam->DistanceFinest).data()); + SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), MaxTStrFromUtf8(currentParam->DistanceMiddle).data()); + SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), MaxTStrFromUtf8(currentParam->DistanceCoarsest).data()); + SetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), MaxTStrFromUtf8(currentParam->BoneLodDistance).data()); // Iterate list HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1); @@ -719,9 +719,9 @@ INT_PTR CALLBACK MRMDialogCallback ( TCHAR tmp[512]; GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), tmp, 512); - currentParam->DistMax = tStrToUtf8(tmp); + currentParam->DistMax = MCharStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), tmp, 512); - currentParam->BlendLength = tStrToUtf8(tmp); + currentParam->BlendLength = MCharStrToUtf8(tmp); currentParam->MRM=SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_GETCHECK, 0, 0); @@ -734,17 +734,17 @@ INT_PTR CALLBACK MRMDialogCallback ( currentParam->SkinReduction=2; GetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), tmp, 512); - currentParam->NbLod = tStrToUtf8(tmp); + currentParam->NbLod = MCharStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), tmp, 512); - currentParam->Divisor = tStrToUtf8(tmp); + currentParam->Divisor = MCharStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), tmp, 512); - currentParam->DistanceFinest = tStrToUtf8(tmp); + currentParam->DistanceFinest = MCharStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), tmp, 512); - currentParam->DistanceMiddle = tStrToUtf8(tmp); + currentParam->DistanceMiddle = MCharStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), tmp, 512); - currentParam->DistanceCoarsest = tStrToUtf8(tmp); + currentParam->DistanceCoarsest = MCharStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), tmp, 512); - currentParam->BoneLodDistance = tStrToUtf8(tmp); + currentParam->BoneLodDistance = MCharStrToUtf8(tmp); // Iterate list HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1); @@ -758,7 +758,7 @@ INT_PTR CALLBACK MRMDialogCallback ( SendMessage (hwndList, LB_GETTEXT, item, (LPARAM) tmp); // Push it back - currentParam->ListLodName.push_back (tStrToUtf8(tmp)); + currentParam->ListLodName.push_back (MCharStrToUtf8(tmp)); } // default LodCharacter @@ -920,8 +920,8 @@ INT_PTR CALLBACK InstanceDialogCallback ( LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), utf8ToTStr(currentParam->InstanceShape)); - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), utf8ToTStr(currentParam->InstanceName)); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), MaxTStrFromUtf8(currentParam->InstanceShape).data()); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), MaxTStrFromUtf8(currentParam->InstanceName).data()); SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_SETCHECK, currentParam->DontAddToScene, 0); @@ -930,7 +930,7 @@ INT_PTR CALLBACK InstanceDialogCallback ( SendMessage (GetDlgItem (hwndDlg, IDC_CHECK_COLLISION), BM_SETCHECK, currentParam->Collision, 0); SendMessage (GetDlgItem (hwndDlg, IDC_CHECK_COLLISION_EXTERIOR), BM_SETCHECK, currentParam->CollisionExterior, 0); - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), utf8ToTStr(currentParam->InstanceGroupName)); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), MaxTStrFromUtf8(currentParam->InstanceGroupName).data()); bool colOk = currentParam->CollisionMeshGeneration>=0 && currentParam->CollisionMeshGeneration<4; CheckRadioButton (hwndDlg, IDC_CAMERA_COL_RADIO1, IDC_CAMERA_COL_RADIO4, colOk?(IDC_CAMERA_COL_RADIO1+(currentParam->CollisionMeshGeneration)):0); @@ -952,14 +952,14 @@ INT_PTR CALLBACK InstanceDialogCallback ( { TCHAR tmp[512]; GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), tmp, 512); - currentParam->InstanceShape = tStrToUtf8(tmp); + currentParam->InstanceShape = MCharStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), tmp, 512); - currentParam->InstanceName = tStrToUtf8(tmp); + currentParam->InstanceName = MCharStrToUtf8(tmp); currentParam->DontAddToScene=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_GETCHECK, 0, 0); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), tmp, 512); - currentParam->InstanceGroupName = tStrToUtf8(tmp); + currentParam->InstanceGroupName = MCharStrToUtf8(tmp); currentParam->DontExport=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_EXPORT), BM_GETCHECK, 0, 0); @@ -1036,9 +1036,9 @@ INT_PTR CALLBACK LightmapDialogCallback ( LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), utf8ToTStr(currentParam->LumelSizeMul)); - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), utf8ToTStr(currentParam->SoftShadowRadius)); - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), utf8ToTStr(currentParam->SoftShadowConeLength)); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), MaxTStrFromUtf8(currentParam->LumelSizeMul).data()); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), MaxTStrFromUtf8(currentParam->SoftShadowRadius).data()); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), MaxTStrFromUtf8(currentParam->SoftShadowConeLength).data()); // Lighting SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_SETCHECK, currentParam->ExportRealTimeLight, 0); @@ -1048,7 +1048,7 @@ INT_PTR CALLBACK LightmapDialogCallback ( SendMessage (GetDlgItem (hwndDlg, IDC_USE_LIGHT_LOCAL_ATTENUATION), BM_SETCHECK, currentParam->UseLightingLocalAttenuation, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_INTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowInterior, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowExterior, 0); - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), utf8ToTStr(currentParam->ExportLightMapName)); + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), MaxTStrFromUtf8(currentParam->ExportLightMapName).data()); SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_SETCHECK, currentParam->RealTimeAmbientLightAddSun, 0); // Set enable disable @@ -1075,11 +1075,11 @@ INT_PTR CALLBACK LightmapDialogCallback ( // Set default state TCHAR tmp[512]; GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), tmp, 512); - currentParam->LumelSizeMul = tStrToUtf8(tmp); + currentParam->LumelSizeMul = MCharStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), tmp, 512); - currentParam->SoftShadowRadius = tStrToUtf8(tmp); + currentParam->SoftShadowRadius = MCharStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), tmp, 512); - currentParam->SoftShadowConeLength = tStrToUtf8(tmp); + currentParam->SoftShadowConeLength = MCharStrToUtf8(tmp); // RealTime light currentParam->ExportRealTimeLight = SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_GETCHECK, 0, 0); @@ -1090,7 +1090,7 @@ INT_PTR CALLBACK LightmapDialogCallback ( currentParam->LightDontCastShadowExterior = SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_GETCHECK, 0, 0); currentParam->ExportLightMapAnimated = SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_ANIMATED), BM_GETCHECK, 0, 0); GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), tmp, 512); - currentParam->ExportLightMapName = tStrToUtf8(tmp); + currentParam->ExportLightMapName = MCharStrToUtf8(tmp); currentParam->RealTimeAmbientLightAddSun= SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_GETCHECK, 0, 0); // Get the acceleration type @@ -1679,7 +1679,7 @@ INT_PTR CALLBACK VegetableDialogCallback ( CheckRadioButton(hwndDlg, IDC_CENTER_NULL, IDC_CENTER_Z, IDC_CENTER_NULL+currentParam->VegetableBendCenter); - SetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), utf8ToTStr(currentParam->VegetableBendFactor)); + SetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), MaxTStrFromUtf8(currentParam->VegetableBendFactor).data()); VegetableStateChanged (hwndDlg); } @@ -1734,7 +1734,7 @@ INT_PTR CALLBACK VegetableDialogCallback ( TCHAR tmp[512]; GetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), tmp, 512); - currentParam->VegetableBendFactor = tStrToUtf8(tmp); + currentParam->VegetableBendFactor = MCharStrToUtf8(tmp); } break; case IDC_VEGETABLE: @@ -2290,34 +2290,34 @@ INT_PTR CALLBACK MiscDialogCallback ( // Ligoscape SendMessage (GetDlgItem (hwndDlg, IDC_LIGO_SYMMETRY), BM_SETCHECK, currentParam->LigoSymmetry, 0); - SetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), utf8ToTStr(currentParam->LigoRotate)); + SetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), MaxTStrFromUtf8(currentParam->LigoRotate).data()); // SWT SendMessage (GetDlgItem (hwndDlg, IDC_SWT), BM_SETCHECK, currentParam->SWT, 0); - SetWindowText (GetDlgItem (hwndDlg, IDC_SWT_WEIGHT), utf8ToTStr(currentParam->SWTWeight)); + SetWindowText (GetDlgItem (hwndDlg, IDC_SWT_WEIGHT), MaxTStrFromUtf8(currentParam->SWTWeight).data()); // Radial normals for (uint smoothGroup=0; smoothGroupRadialNormals[smoothGroup])); + SetWindowText (GetDlgItem (hwndDlg, IDC_RADIAL_NORMAL_29+smoothGroup), MaxTStrFromUtf8(currentParam->RadialNormals[smoothGroup]).data()); // Mesh interfaces - SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), utf8ToTStr(currentParam->InterfaceFileName)); + SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), MaxTStrFromUtf8(currentParam->InterfaceFileName).data()); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), - currentParam->InterfaceThreshold != -1.f ? utf8ToTStr(toStringMax(currentParam->InterfaceThreshold)) + currentParam->InterfaceThreshold != -1.f ? MaxTStrFromUtf8(toStringMax(currentParam->InterfaceThreshold)).data() : _T("") ); SendMessage(GetDlgItem(hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_SETCHECK, currentParam->GetInterfaceNormalsFromSceneObjects, 0); // Skeleton Scale SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_SETCHECK, currentParam->ExportBoneScale, 0); - SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), utf8ToTStr(currentParam->ExportBoneScaleNameExt)); + SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), MaxTStrFromUtf8(currentParam->ExportBoneScaleNameExt).data()); // Remanence SendMessage (GetDlgItem (hwndDlg, IDC_USE_REMANENCE), BM_SETCHECK, currentParam->UseRemanence, 0); SendMessage (GetDlgItem (hwndDlg, IDC_REMANENCE_SHIFTING_TEXTURE), BM_SETCHECK, currentParam->RemanenceShiftingTexture, 0); - SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), currentParam->RemanenceSliceNumber != - 1 ? utf8ToTStr(toStringMax(currentParam->RemanenceSliceNumber)) : _T("")); - SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SAMPLING_PERIOD), currentParam->RemanenceSamplingPeriod != -1 ? utf8ToTStr(toStringMax(currentParam->RemanenceSamplingPeriod)) : _T("")); - SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_ROLLUP_RATIO), currentParam->RemanenceRollupRatio != -1 ? utf8ToTStr(toStringMax(currentParam->RemanenceRollupRatio)) : _T("")); + SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), currentParam->RemanenceSliceNumber != - 1 ? MaxTStrFromUtf8(toStringMax(currentParam->RemanenceSliceNumber)).data() : _T("")); + SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SAMPLING_PERIOD), currentParam->RemanenceSamplingPeriod != -1 ? MaxTStrFromUtf8(toStringMax(currentParam->RemanenceSamplingPeriod)).data() : _T("")); + SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_ROLLUP_RATIO), currentParam->RemanenceRollupRatio != -1 ? MaxTStrFromUtf8(toStringMax(currentParam->RemanenceRollupRatio)).data() : _T("")); } break; @@ -2338,24 +2338,24 @@ INT_PTR CALLBACK MiscDialogCallback ( currentParam->LigoSymmetry = SendMessage (GetDlgItem (hwndDlg, IDC_LIGO_SYMMETRY), BM_GETCHECK, 0, 0); TCHAR tmp[512]; GetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), tmp, 512); - currentParam->LigoRotate = tStrToUtf8(tmp); + currentParam->LigoRotate = MCharStrToUtf8(tmp); // SWT currentParam->SWT = SendMessage (GetDlgItem (hwndDlg, IDC_SWT), BM_GETCHECK, 0, 0); GetWindowText (GetDlgItem (hwndDlg, IDC_SWT_WEIGHT), tmp, 512); - currentParam->SWTWeight = tStrToUtf8(tmp); + currentParam->SWTWeight = MCharStrToUtf8(tmp); // Radial normals for (uint smoothGroup=0; smoothGroupRadialNormals[smoothGroup] = tStrToUtf8(tmp); + currentParam->RadialNormals[smoothGroup] = MCharStrToUtf8(tmp); } // mesh interfaces GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), tmp, 512); - currentParam->InterfaceFileName = tStrToUtf8(tmp); + currentParam->InterfaceFileName = MCharStrToUtf8(tmp); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), tmp, 512); if (_tcslen(tmp) != 0) currentParam->InterfaceThreshold = toFloatMax(tmp); @@ -2365,7 +2365,7 @@ INT_PTR CALLBACK MiscDialogCallback ( // Skeleton Scale currentParam->ExportBoneScale= SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_GETCHECK, 0, 0); GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), tmp, 512); - currentParam->ExportBoneScaleNameExt = tStrToUtf8(tmp); + currentParam->ExportBoneScaleNameExt = MCharStrToUtf8(tmp); // remanence currentParam->UseRemanence = SendMessage (GetDlgItem (hwndDlg, IDC_USE_REMANENCE), BM_GETCHECK, 0, 0); @@ -2374,7 +2374,7 @@ INT_PTR CALLBACK MiscDialogCallback ( GetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), tmp, 512); uint rsn; - if (NLMISC::fromString(tStrToUtf8(tmp), rsn)) + if (NLMISC::fromString(MCharStrToUtf8(tmp), rsn)) { currentParam->RemanenceSliceNumber = rsn; } @@ -2489,12 +2489,12 @@ INT_PTR CALLBACK LodDialogCallback ( { // Param pointers LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); - currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + currentParam = (CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); // Window text - std::string winName = tStrToUtf8((*(currentParam->ListNode->begin()))->GetName()); - winName="Node properties ("+winName+((currentParam->ListNode->size()>1)?" ...)":")"); - SetWindowText (hwndDlg, utf8ToTStr(winName)); + TSTR winName = (*(currentParam->ListNode->begin()))->GetName(); + winName = TSTR(_M("Node properties (")) + winName + ((currentParam->ListNode->size() > 1) ? _M(", ...)") : _M(")")); + SetWindowText(hwndDlg, winName.data()); // Move dialog RECT windowRect, desktopRect; diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_scene.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_scene.cpp index b50903324..9a57dfeeb 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_scene.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_scene.cpp @@ -59,7 +59,7 @@ bool CNelExport::exportInstanceGroup(string filename, vector& vectNode) catch (const Exception &c) { // Cannot save the file - MessageBox (NULL, utf8ToTStr(c.what()), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL, MaxTStrFromUtf8(c.what()).data(), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); return false; } } diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp index dfdbdec08..d28cb48b0 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp @@ -91,7 +91,7 @@ Value* export_shape_cf (Value** arg_list, int count) theCNelExport.init (false, false, ip, true); // Export path - std::string sPath = tStrToUtf8(arg_list[1]->to_string()); + std::string sPath = MCharStrToUtf8(arg_list[1]->to_string()); // Ok ? Boolean *ret=&false_value; @@ -154,12 +154,12 @@ Value* export_shape_ex_cf (Value** arg_list, int count) nlassert(node->GetName()); // Export path - std::string sPath = tStrToUtf8(arg_list[1]->to_string()); + std::string sPath = MCharStrToUtf8(arg_list[1]->to_string()); // Ex argu theExportSceneStruct.bShadow = arg_list[2]->to_bool()!=FALSE; theExportSceneStruct.bExportLighting = arg_list[3]->to_bool()!=FALSE; - theExportSceneStruct.sExportLighting = tStrToUtf8(arg_list[4]->to_string()); + theExportSceneStruct.sExportLighting = MCharStrToUtf8(arg_list[4]->to_string()); theExportSceneStruct.nExportLighting = arg_list[5]->to_int(); theExportSceneStruct.rLumelSize = arg_list[6]->to_float(); theExportSceneStruct.nOverSampling = arg_list[7]->to_int(); @@ -220,7 +220,7 @@ Value* export_skeleton_cf (Value** arg_list, int count) nlassert (node); // Export path - std::string sPath = tStrToUtf8(arg_list[1]->to_string()); + std::string sPath = MCharStrToUtf8(arg_list[1]->to_string()); // Ok ? Boolean *ret=&false_value; @@ -260,7 +260,7 @@ Value* export_animation_cf (Value** arg_list, int count) theCNelExport.init (false, false, ip, true); // Export path - std::string sPath = tStrToUtf8(arg_list[1]->to_string()); + std::string sPath = MCharStrToUtf8(arg_list[1]->to_string()); // Get time TimeValue time=MAXScript_interface->GetTime(); @@ -298,7 +298,7 @@ Value* export_animation_cf (Value** arg_list, int count) else { // Error message - mprintf (_M("Error exporting animation %s in the file\n%s\n"), (*vectNode.begin())->GetName(), utf8ToTStr(sPath)); + mprintf(_M("Error exporting animation %s in the file\n%s\n"), (*vectNode.begin())->GetName(), MaxTStrFromUtf8(sPath).data()); } } } @@ -352,7 +352,7 @@ Value* export_ig_cf (Value** arg_list, int count) vect.push_back (array->get (i+1)->to_node()); // Export path - std::string sPath = tStrToUtf8(arg_list[1]->to_string()); + std::string sPath = MCharStrToUtf8(arg_list[1]->to_string()); // Export if (theCNelExport.exportInstanceGroup (sPath, vect)) @@ -411,7 +411,7 @@ Value* export_skeleton_weight_cf (Value** arg_list, int count) vect.push_back (array->get (i+1)->to_node()); // Export path - std::string sPath = tStrToUtf8(arg_list[1]->to_string()); + std::string sPath = MCharStrToUtf8(arg_list[1]->to_string()); // Export if (theCNelExport.exportSWT (sPath, vect)) @@ -462,8 +462,8 @@ Value* test_file_date_cf (Value** arg_list, int count) // Make sure we have the correct number of arguments (2) check_arg_count(view_shape, 2, count); - type_check (arg_list[0], String, _M("NeLTestFileDate [DestFilename] [SrcFilename]")); - type_check (arg_list[1], String, _M("NeLTestFileDate [DestFilename] [SrcFilename]")); + type_check(arg_list[0], String, _M("NeLTestFileDate [DestFilename] [SrcFilename]")); + type_check(arg_list[1], String, _M("NeLTestFileDate [DestFilename] [SrcFilename]")); // Get a good interface pointer Interface *ip = MAXScript_interface; @@ -471,11 +471,11 @@ Value* test_file_date_cf (Value** arg_list, int count) theCNelExport.init (false, false, ip, true); // The 2 filenames - string file0 = tStrToUtf8(arg_list[0]->to_string()); - string file1 = tStrToUtf8(arg_list[1]->to_string()); + WStr file0 = arg_list[0]->to_string(); + WStr file1 = arg_list[1]->to_string(); // Open it - FILE *file=nlfopen (file0.c_str(), "r"); + FILE *file= nlfopen(ucstring((const ucchar *)file0.data()).toUtf8().c_str(), "r"); if (file == NULL) return &true_value; @@ -486,10 +486,10 @@ Value* test_file_date_cf (Value** arg_list, int count) Value *ret = &undefined; // Create first file - HANDLE h0 = CreateFile (utf8ToTStr(file0), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE h0 = CreateFileW((LPCWSTR)file0.data(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h0!=INVALID_HANDLE_VALUE) { - HANDLE h1 = CreateFile (utf8ToTStr(file1), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE h1 = CreateFileW((LPCWSTR)file1.data(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h1!=INVALID_HANDLE_VALUE) { // Get file time @@ -536,7 +536,7 @@ Value* export_vegetable_cf (Value** arg_list, int count) nlassert (node); // Export path - std::string sPath = tStrToUtf8(arg_list[1]->to_string()); + std::string sPath = MCharStrToUtf8(arg_list[1]->to_string()); // Message in dialog bool dialogMessage = arg_list[2]->to_bool() != FALSE; @@ -615,7 +615,7 @@ Value* export_collision_cf (Value** arg_list, int count) theCNelExport.init (false, false, ip, true); // Export path - string sPath = tStrToUtf8(arg_list[1]->to_string()); + string sPath = MCharStrToUtf8(arg_list[1]->to_string()); // Get time TimeValue time = MAXScript_interface->GetTime(); @@ -674,7 +674,7 @@ Value* export_pacs_primitives_cf (Value** arg_list, int count) theCNelExport.init (false, false, ip, true); // Export path - string sPath = tStrToUtf8(arg_list[1]->to_string()); + string sPath = MCharStrToUtf8(arg_list[1]->to_string()); // Get time TimeValue time = MAXScript_interface->GetTime(); @@ -733,7 +733,7 @@ Value* export_lod_character_cf (Value** arg_list, int count) nlassert (node); // Export path - std::string sPath = tStrToUtf8(arg_list[1]->to_string()); + std::string sPath = MCharStrToUtf8(arg_list[1]->to_string()); // Message in dialog bool dialogMessage = arg_list[2]->to_bool() != FALSE; @@ -879,18 +879,18 @@ Value* get_file_modification_date_cf (Value** arg_list, int count) type_check (arg_list[0], String, message); // get the node - string sPath = tStrToUtf8(arg_list[0]->to_string()); + WStr sPath = arg_list[0]->to_string(); // get vertices indices string result; - HANDLE file = CreateFile (utf8ToTStr(sPath), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFileW((LPCWSTR)sPath.data(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (file) { FILETIME lastWriteTime; if (GetFileTime(file, NULL, NULL, &lastWriteTime)) { char number[512]; - sprintf (number, "%08x%08x", lastWriteTime.dwHighDateTime, lastWriteTime.dwLowDateTime); + sprintf(number, "%08x%08x", lastWriteTime.dwHighDateTime, lastWriteTime.dwLowDateTime); result = number; } CloseHandle (file); @@ -899,7 +899,7 @@ Value* get_file_modification_date_cf (Value** arg_list, int count) if (result.empty()) return &undefined; else - return new String(utf8ToTStr(result)); + return new String(MaxTStrFromUtf8(result)); } // *************************************************************************** @@ -914,24 +914,24 @@ Value* set_file_modification_date_cf (Value** arg_list, int count) MCHAR *message = _M("bool NeLSetFileModificationDate [filename] [date] - If an error occurred, returns false."); //type_check - type_check (arg_list[0], String, message); - type_check (arg_list[1], String, message); + type_check(arg_list[0], String, message); + type_check(arg_list[1], String, message); // get the node - string sPath = tStrToUtf8(arg_list[0]->to_string()); - string sDate = tStrToUtf8(arg_list[1]->to_string()); + WStr sPath = arg_list[0]->to_string(); + WStr sDate = arg_list[1]->to_string(); // get vertices indices string result; - HANDLE file = CreateFile (utf8ToTStr(sPath), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFileW(sPath.data(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (file) { FILETIME lastWriteTime; - if (sscanf (sDate.c_str(), "%08x%08x", &lastWriteTime.dwHighDateTime, &lastWriteTime.dwLowDateTime) == 2) + if (swscanf(sDate.data(), L"%08x%08x", &lastWriteTime.dwHighDateTime, &lastWriteTime.dwLowDateTime) == 2) { if (SetFileTime(file, NULL, NULL, &lastWriteTime)) { - CloseHandle (file); + CloseHandle(file); return &true_value; } } diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_swt.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_swt.cpp index c466b7055..e9ca83451 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_swt.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_swt.cpp @@ -55,15 +55,15 @@ bool CNelExport::exportSWT(const std::string &sPath, std::vector& vectNo // Store them in the temporary list aSWNodes.resize(nNumNode+3); - aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName()); + aSWNodes[nNumNode].Name = MCharStrToUtf8(pNode->GetName()); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getRotQuatValueName(); aSWNodes[nNumNode].Weight = rRotValue; ++nNumNode; - aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName()); + aSWNodes[nNumNode].Name = MCharStrToUtf8(pNode->GetName()); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getPosValueName (); aSWNodes[nNumNode].Weight = rPosValue; ++nNumNode; - aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName()); + aSWNodes[nNumNode].Name = MCharStrToUtf8(pNode->GetName()); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getScaleValueName(); aSWNodes[nNumNode].Weight = rScaleValue; ++nNumNode; 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 adfba5a98..431155929 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 @@ -113,7 +113,7 @@ void regsiterOVPath () int res = GetModuleFileName(hModule, sModulePath, 256); if (!res) { ::MessageBox(NULL, _T("'res' failed at '") __FUNCTION__ _T("' in file '") __FILE__ _T(" on line ") NL_MACRO_TO_STR(__LINE__), _T("NeL Export"), MB_OK | MB_ICONERROR); return; } - std::string modulePath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)) + "object_viewer.cfg"; + std::string modulePath = NLMISC::CFile::getPath(MCharStrToUtf8(sModulePath)) + "object_viewer.cfg"; // Load the config file CConfigFile cf; @@ -300,7 +300,7 @@ void CNelExport::viewMesh (TimeValue time) _ExportNel->buildSkeletonShape (*skelShape, *skeletonRoot, &(iteSkeleton->second), mapId, time); // Add the shape in the view - uint instance = view->addSkel (skelShape, tStrToUtf8(skeletonRoot->GetName())); + uint instance = view->addSkel (skelShape, MCharStrToUtf8(skeletonRoot->GetName())); // Add tracks CAnimation *anim=new CAnimation; @@ -365,7 +365,7 @@ void CNelExport::viewMesh (TimeValue time) INode* pNode=_Ip->GetSelNode (nNode); string sTmp = "Object Name: "; - sTmp += tStrToUtf8(pNode->GetName()); + sTmp += MCharStrToUtf8(pNode->GetName()); ProgBar.setLine (0, sTmp); sTmp.clear(); for (uint32 i = 1; i < 10; ++i) @@ -410,7 +410,7 @@ void CNelExport::viewMesh (TimeValue time) if (pShape) { // Add the shape in the view - uint instance = view->addMesh (pShape, tStrToUtf8(pNode->GetName()).c_str(), iteSkelShape->second.SkeletonInstance); + uint instance = view->addMesh (pShape, MCharStrToUtf8(pNode->GetName()), iteSkelShape->second.SkeletonInstance); // Add tracks CAnimation *anim=new CAnimation; diff --git a/code/nel/tools/3d/plugin_max/nel_export/progress.cpp b/code/nel/tools/3d/plugin_max/nel_export/progress.cpp index 17b3fab2a..495c4687d 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/progress.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/progress.cpp @@ -70,7 +70,7 @@ INT_PTR CALLBACK CalculatingDialogCallback ( string all; for (uint32 i = 0; i < 14; ++i) all += pClass->sInfoProgress[i] + "\n"; - SendMessage (GetDlgItem (hwndDlg, IDC_STATICINFO), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(all)); + SendMessage (GetDlgItem (hwndDlg, IDC_STATICINFO), WM_SETTEXT, 0, (LPARAM)MaxTStrFromUtf8(all).data()); } break; diff --git a/code/nel/tools/3d/plugin_max/nel_export/std_afx.cpp b/code/nel/tools/3d/plugin_max/nel_export/std_afx.cpp index 6d0ee506b..424138cda 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/std_afx.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/std_afx.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 "std_afx.h" +void nlmax_nel_export_std_afx_dummy() { } + 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 ba7b4b4c0..27dd8372a 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 @@ -73,4 +73,6 @@ namespace std #include "nel/misc/bsphere.h" #include "nel/misc/path.h" +#include "../nel_3dsmax_shared/string_common.h" + #endif diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/StdAfx.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/StdAfx.cpp index 37a79dbb5..e9230c36b 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/StdAfx.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/StdAfx.cpp @@ -17,3 +17,5 @@ #include "stdafx.h" +void nlmax_mesh_library_stdafx_dummy() { } + diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp index 5ccc223f9..30d1f929c 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp @@ -128,7 +128,7 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime) if (maxLight->EvalLightState(tvTime, valid, &ls)!=REF_SUCCEED) return; - this->Name = tStrToUtf8(node->GetName()); + this->Name = MCharStrToUtf8(node->GetName()); // Retrieve the correct light Group Name this->AnimatedLight = CExportNel::getAnimatedLight (node); @@ -295,7 +295,7 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime) INode *exclNode = exclusionList[i]; if (exclNode) // Crashfix // FIXME: Why is this NULL? { - string tmp = tStrToUtf8(exclNode->GetName()); + string tmp = MCharStrToUtf8(exclNode->GetName()); this->setExclusion.insert(tmp); } } @@ -1930,7 +1930,7 @@ void supprLightNoInteractOne( vector &vLights, CMesh::CMeshBuild* p { bool bInteract = false; - if( vLights[i].setExclusion.find(tStrToUtf8(node.GetName()) ) != vLights[i].setExclusion.end() ) + if( vLights[i].setExclusion.find(MCharStrToUtf8(node.GetName()) ) != vLights[i].setExclusion.end() ) { bInteract = false; } @@ -2005,7 +2005,7 @@ void CExportNel::deleteLM(INode& ZeNode) string sSaveName; sSaveName = _Options.sExportLighting; if( sSaveName[sSaveName.size()-1] != '\\' ) sSaveName += "\\"; - sSaveName += tStrToUtf8(ZeNode.GetName()); + sSaveName += MCharStrToUtf8(ZeNode.GetName()); char tmp[32]; sprintf( tmp, "%d", i ); sSaveName += tmp; @@ -2276,7 +2276,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB { string thetext; thetext = "Warning "; - thetext += tStrToUtf8(ZeNode.GetName()); + thetext += MCharStrToUtf8(ZeNode.GetName()); thetext = "have all faces NOT mapped (UV2)"; if (gOptions.FeedBack != NULL) { @@ -2325,11 +2325,11 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB { // Make an error message string sTmp = "Warning : "; - sTmp += tStrToUtf8(ZeNode.GetName()); + sTmp += MCharStrToUtf8(ZeNode.GetName()); sTmp += " has mapping problem"; // Script trace - mprintf (utf8ToTStr((sTmp+"\n"))); + mprintf(_M("%s\n"), MaxTStrFromUtf8(sTmp).data()); // Feedback is here ? if (gOptions.FeedBack != NULL) @@ -2524,13 +2524,13 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB // Assign the name of the lightmap and get the complete save name // Get the name of the max project - char projectName[512]; - _wsplitpath (_Ip->GetCurFileName(), NULL, NULL, utf8ToTStr(projectName), NULL); + ucchar projectName[512]; + _wsplitpath(WStr(_Ip->GetCurFileName()), NULL, NULL, (wchar_t *)projectName, NULL); // Add lightmap information in the lightmap log COFile outputLog; if (outputLightmapLog) - createLightmapLog (outputLog, gOptions.sExportLighting.c_str(), projectName, tStrToUtf8(ZeNode.GetName()).c_str()); + createLightmapLog(outputLog, gOptions.sExportLighting.c_str(), ucstring(projectName).toUtf8().c_str(), MaxTStrToUtf8(ZeNode.GetName()).c_str()); // Update UV coords to Texture space PutFaceUV1InTextureCoord( LightMap.w, LightMap.h, AllFaces.begin(), AllFaces.size() ); @@ -2559,7 +2559,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB { CTextureFile *pLightMap = new CTextureFile(); //string sSaveName = AllMeshBuilds[nNode].second->GetName(); - string sSaveName = tStrToUtf8(ZeNode.GetName()); + string sSaveName = MCharStrToUtf8(ZeNode.GetName()); char tmp[32]; sSaveName += "_"; sprintf( tmp, "%d", nLightMapNb ); @@ -2633,7 +2633,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB if (gOptions.FeedBack != NULL) { std::string message = toString("Can't write the file %s : %s", sSaveName.c_str(), e.what()); - mprintf (utf8ToTStr(message)); + mprintf(_M("%s\n"), MaxTStrFromUtf8(message).data()); } } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp index 1a89c8d31..c35ff796e 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp @@ -113,7 +113,7 @@ void CRTWorld::build (vector &AllLights, CVector &trans, bool bExcl pLAP->create( 64 ); // width of each grid in number of square for( j = 0; j < vMB.size(); ++j ) { - if (rLight.setExclusion.find (tStrToUtf8(vINode[j]->GetName())) != rLight.setExclusion.end()) + if (rLight.setExclusion.find (MCharStrToUtf8(vINode[j]->GetName())) != rLight.setExclusion.end()) continue; for (k = 0; k < vMB[j]->Faces.size(); ++k) @@ -142,7 +142,7 @@ void CRTWorld::build (vector &AllLights, CVector &trans, bool bExcl pLAD->create (64, rLight.rDirRadius/64.0f, rLight.Direction); for( j = 0; j < vMB.size(); ++j ) { - if (rLight.setExclusion.find (tStrToUtf8(vINode[j]->GetName())) != rLight.setExclusion.end()) + if (rLight.setExclusion.find (MCharStrToUtf8(vINode[j]->GetName())) != rLight.setExclusion.end()) continue; for (k = 0; k < vMB[j]->Faces.size(); ++k) diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_anim.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_anim.cpp index d55312af6..d3ef46de3 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_anim.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_anim.cpp @@ -189,7 +189,7 @@ void CExportNel::addSSSTrack(CSSSBuild &ssBuilder, INode& node) if(note) { CSSSBuild::CKey ks; - ks.Value = note->note.ToUTF8(); + ks.Value = MaxTStrToUtf8(note->note); ks.Time= CExportNel::convertTime (note->time); bs.Track.push_back(ks); } @@ -228,7 +228,7 @@ NL3D::CTrackKeyFramerConstString* CExportNel::buildFromNoteTrack(INode& node) { firstDate = CExportNel::convertTime (note->time); } - ks.Value = note->note.ToUTF8(); + ks.Value = MaxTStrToUtf8(note->note); lastDate = CExportNel::convertTime (note->time); st->addKey(ks , lastDate ); @@ -609,7 +609,7 @@ void CExportNel::addMorphTracks (NL3D::CAnimation& animation, INode& node, const if (pNode == NULL) continue; std::string name = parentName; - name += tStrToUtf8(pNode->GetName()); + name += MCharStrToUtf8(pNode->GetName()); name += "MorphFactor"; IParamBlock *pb = (IParamBlock*)(pMorphMod->SubAnim (i+1)); 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 d9657cd68..58f0db1d7 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 @@ -73,7 +73,7 @@ CCollisionMeshBuild* CExportNel::createCollisionMeshBuild(std::vector & { // get the mesh name uint meshId = rootMeshNames.size(); - rootMeshNames.push_back(tStrToUtf8(nodes[node]->GetName())); + rootMeshNames.push_back(MCharStrToUtf8(nodes[node]->GetName())); bool collision = getScriptAppData (nodes[node], NEL3D_APPDATA_COLLISION, 0) != 0; bool exterior = getScriptAppData (nodes[node], NEL3D_APPDATA_COLLISION_EXTERIOR, 0) != 0; diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_material.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_material.cpp index f7c8135ad..89e8a8aa2 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_material.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_material.cpp @@ -768,7 +768,7 @@ void CExportNel::buildAMaterial (NL3D::CMaterial& material, CMaxMaterialInfo& ma // Set material name TSTR name=mtl.GetName(); - materialInfo.MaterialName = name.ToUTF8(); + materialInfo.MaterialName = MaxTStrToUtf8(name); } else { @@ -1120,7 +1120,7 @@ void CExportNel::buildAMaterial (NL3D::CMaterial& material, CMaxMaterialInfo& ma // Set material name TSTR name=mtl.GetName(); - materialInfo.MaterialName = name.ToUTF8(); + materialInfo.MaterialName = MaxTStrToUtf8(name); } } @@ -1255,7 +1255,7 @@ ITexture* CExportNel::buildATexture (Texmap& texmap, CMaterialDesc &remap3dsTexC else // standard texture { srcTex = new CTextureFile; - std::string mapName = tStrToUtf8(pBitmap->GetMapName()); + std::string mapName = MCharStrToUtf8(pBitmap->GetMapName()); static_cast(srcTex)->setFileName (ConvertTexFileName(mapName, _AbsolutePath)); } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp index d39020a64..208e2c4fc 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh.cpp @@ -266,7 +266,7 @@ NL3D::IShape *CExportNel::buildShape (INode& node, TimeValue time, const TInodeP std::string nodeName=getScriptAppData (&node, NEL3D_APPDATA_LOD_NAME+lod, ""); // Get the node - INode *lodNode=_Ip->GetINodeByName(utf8ToTStr(nodeName)); + INode *lodNode=_Ip->GetINodeByName(MaxTStrFromUtf8(nodeName).data()); if (lodNode) { // Index of the lod in the build structure @@ -611,7 +611,7 @@ void CExportNel::buildBaseMeshInterface (NL3D::CMeshBase::CMeshBaseBuild& buildM continue; // get factor here ! buildMesh.DefaultBSFactors.push_back(0.0f); - std::string sTemp = tStrToUtf8(pNode->GetName()); + std::string sTemp = MCharStrToUtf8(pNode->GetName()); buildMesh.BSNames.push_back (sTemp); } @@ -1045,7 +1045,7 @@ void CExportNel::buildMeshInterface (TriObject &tri, CMesh::CMeshBuild& buildMes if (!vpColorVertex) { uint8 alphaBackup = pCorner->Color.A; - pCorner->Color.modulateFromColor (pCorner->Color, isLighted ? diffuse : color); + pCorner->Color.modulateFromColor(pCorner->Color, isLighted ? diffuse : color); pCorner->Color.A = alphaBackup; } } @@ -1058,18 +1058,18 @@ void CExportNel::buildMeshInterface (TriObject &tri, CMesh::CMeshBuild& buildMes if (skined) { // Add skinning information to the buildMesh struct - uint error=buildSkinning (buildMesh, *nodeMap, node); + uint error = buildSkinning (buildMesh, *nodeMap, node); // Error code ? if (error!=NoError) { - std::string msg = toString("%s skin: %s", getName (node).c_str(), ErrorMessage[error]); - MessageBoxW (NULL, utf8ToTStr(msg), L"NeL export", MB_OK|MB_ICONEXCLAMATION); + std::string msg = toString("%s skin: %s", getName(node).c_str(), ErrorMessage[error]); + MessageBox(NULL, MaxTStrFromUtf8(msg).data(), _T("NeL export"), MB_OK | MB_ICONEXCLAMATION); } else { // Active skinning - buildMesh.VertexFlags|=CVertexBuffer::PaletteSkinFlag; + buildMesh.VertexFlags |= CVertexBuffer::PaletteSkinFlag; } } @@ -1082,7 +1082,7 @@ void CExportNel::buildMeshInterface (TriObject &tri, CMesh::CMeshBuild& buildMes buildMesh.InterfaceLinks.clear(); // don't do it for morph target (unusefull and slow) - if(!isMorphTarget) + if (!isMorphTarget) { // Apply normal correction if there is a mesh interface if (skined) @@ -1118,41 +1118,41 @@ void CExportNel::buildMeshInterface (TriObject &tri, CMesh::CMeshBuild& buildMes else // standard case { // What Vertexprogram is used?? - int vpId= CExportNel::getScriptAppData (&node, NEL3D_APPDATA_VERTEXPROGRAM_ID, 0); + int vpId = CExportNel::getScriptAppData (&node, NEL3D_APPDATA_VERTEXPROGRAM_ID, 0); // Setup vertexProgram switch(vpId) { case 0: - buildMesh.MeshVertexProgram= NULL; + buildMesh.MeshVertexProgram = NULL; break; case 1: { // smartPtr set it. - buildMesh.MeshVertexProgram= new CMeshVPWindTree; - CMeshVPWindTree &vpwt= *(CMeshVPWindTree*)(IMeshVertexProgram*)buildMesh.MeshVertexProgram; + buildMesh.MeshVertexProgram = new CMeshVPWindTree; + CMeshVPWindTree &vpwt = *(CMeshVPWindTree*)(IMeshVertexProgram*)buildMesh.MeshVertexProgram; // Read the AppData - CVPWindTreeAppData apd; - getScriptAppDataVPWT (&node, apd); + CVPWindTreeAppData apd; + getScriptAppDataVPWT(&node, apd); // transform it to the vpwt. nlassert(CVPWindTreeAppData::HrcDepth == CMeshVPWindTree::HrcDepth); vpwt.SpecularLighting= apd.SpecularLighting == BST_CHECKED; // read all levels. - float nticks= CVPWindTreeAppData::NumTicks; - for(uint i=0; iGetName()); + bs.Name = MCharStrToUtf8(pNode->GetName()); bool bIsDeltaPos = false; bs.deltaPos.resize (nNbVertVB, CVector::Null); diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp index 0cbd8fbe1..6dd2e1ee4 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp @@ -316,7 +316,7 @@ static void AddNodeToQuadGrid(const NLMISC::CAABBox &delimiter, TNodeFaceQG &des { if (delimiter.intersect(nodeBBox)) { - nldebug("Adding %s to mesh interface quad grid", tStrToUtf8(node.GetName()).c_str()); + nldebug("Adding %s to mesh interface quad grid", MCharStrToUtf8(node.GetName()).c_str()); // add this node tris ObjectState os = node.EvalWorldState(time); Object *obj = os.obj; @@ -578,10 +578,10 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vectorGetName ().ToUTF8(); + string newName = "NelAutoMergeRenamedTmp" + toString(i); + string originalName = MaxTStrToUtf8((*lib)[i]->GetName()); renameMap.insert (map::value_type (newName, originalName)); - (*lib)[i]->SetName (utf8ToTStr(newName)); + (*lib)[i]->SetName (MaxTStrFromUtf8(newName)); } // Merge the interface project @@ -604,7 +604,7 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vectorGetName ().ToUTF8(); + string key = MaxTStrToUtf8((*lib)[i]->GetName()); map::iterator ite = renameMap.find (key); // Not found ? This is a merged material @@ -612,9 +612,9 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vectorGetName ().ToUTF8(); + string originalName = MaxTStrToUtf8((*lib)[i]->GetName()); renameMap.insert (map::value_type (newName, originalName)); - (*lib)[i]->SetName (utf8ToTStr(newName)); + (*lib)[i]->SetName (MaxTStrFromUtf8(newName)); } } @@ -622,12 +622,12 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vectorGetName ().ToUTF8(); + string key = MaxTStrToUtf8((*lib)[i]->GetName()); map::iterator ite = renameMap.find (key); if (ite != renameMap.end ()) { // Rename the material with its original name - (*lib)[i]->SetName (utf8ToTStr(ite->second)); + (*lib)[i]->SetName (MaxTStrFromUtf8(ite->second)); } } 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 7af1a7bc5..7ef95260d 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 @@ -223,7 +223,7 @@ Animatable* CExportNel::getSubAnimByName (Animatable& node, const char* sName) TSTR sSubName=node.SubAnimName(nSub); // Good name? - if (strcmp (sSubName.ToUTF8(), sName)==0) + if (strcmp (MaxTStrToUtf8(sSubName).c_str(), sName)==0) { // ok, return this subanim return node.SubAnim(nSub); @@ -265,7 +265,7 @@ Control* CExportNel::getControlerByName (Animatable& node, const char* sName) ParamDef& paramDef=param->GetParamDef(id); // Good name? - if (strcmp (tStrToUtf8(paramDef.int_name).c_str(), sName)==0) + if (strcmp (MCharStrToUtf8(paramDef.int_name).c_str(), sName)==0) { // ok, return this subanim #if MAX_VERSION_MAJOR >= 14 @@ -288,7 +288,7 @@ Control* CExportNel::getControlerByName (Animatable& node, const char* sName) { // Sub anim name TSTR name=node.SubAnimName (s); - if (strcmp (name.ToUTF8(), sName)==0) + if (strcmp (MaxTStrToUtf8(name).c_str(), sName)==0) { // Get the controller pointer of this sub anim Control* c=GetControlInterface (node.SubAnim(s)); @@ -332,7 +332,7 @@ bool getValueByNameUsingParamBlock2Internal (Animatable& node, const char* sName ParamDef& paramDef=param->GetParamDef(id); // Good name? - if (strcmp (tStrToUtf8(paramDef.int_name).c_str(), sName)==0) + if (strcmp (MCharStrToUtf8(paramDef.int_name).c_str(), sName)==0) { // Check this value is good type ParamType2 paramType = param->GetParameterType(id); @@ -372,7 +372,7 @@ bool getValueByNameUsingParamBlock2Internal (Animatable& node, const char* sName break; case TYPE_FILENAME: case TYPE_STRING: - *(std::string*)pValue = tStrToUtf8(param->GetStr (id, tvTime)); + *(std::string*)pValue = MCharStrToUtf8(param->GetStr (id, tvTime)); bRes = TRUE; break; case TYPE_FILENAME_TAB: @@ -382,7 +382,7 @@ bool getValueByNameUsingParamBlock2Internal (Animatable& node, const char* sName uint total = param->Count (id); rTab.resize(total); for( uint i = 0; i < total; ++i ) - rTab[i] = tStrToUtf8(param->GetStr (id, tvTime, i)); + rTab[i] = MCharStrToUtf8(param->GetStr (id, tvTime, i)); bRes = TRUE; } break; @@ -502,7 +502,7 @@ std::string CExportNel::getName (MtlBase& mtl) // Return its name TSTR name; name=mtl.GetName(); - return std::string((const char*)name.ToUTF8()); + return MaxTStrToUtf8(name); } // -------------------------------------------------- @@ -511,8 +511,8 @@ std::string CExportNel::getName (MtlBase& mtl) std::string CExportNel::getName(INode& node) { // Return its name - const MCHAR* name = node.GetName(); - return tStrToUtf8(name); + const MCHAR *name = node.GetName(); + return MCharStrToUtf8(name); } // -------------------------------------------------- @@ -549,7 +549,7 @@ std::string CExportNel::getNelObjectName (INode& node) } else { - return tStrToUtf8(node.GetName()); + return MCharStrToUtf8(node.GetName()); } } else @@ -564,23 +564,23 @@ std::string CExportNel::getNelObjectName (INode& node) if (_tcslen((const TCHAR *) ad->data) != 0) { // get file name only - return NLMISC::CFile::getFilename(tStrToUtf8((const TCHAR*)ad->data)); + return NLMISC::CFile::getFilename(MCharStrToUtf8((const MCHAR*)ad->data)); } else { - return tStrToUtf8(node.GetName()); + return MCharStrToUtf8(node.GetName()); } } else { // Extract the node name - return tStrToUtf8(node.GetName()); + return MCharStrToUtf8(node.GetName()); } } else { // Extract the node name - return tStrToUtf8(node.GetName()); + return MCharStrToUtf8(node.GetName()); } } } @@ -764,28 +764,26 @@ void CExportNel::outputErrorMessage(const std::string &message) { if (_ErrorInDialog) { - MessageBoxW (_Ip->GetMAXHWnd(), utf8ToTStr(message), utf8ToTStr(_ErrorTitle), MB_OK|MB_ICONEXCLAMATION); + MessageBoxW(_Ip->GetMAXHWnd(), nlUtf8ToWide(message), nlUtf8ToWide(_ErrorTitle), MB_OK|MB_ICONEXCLAMATION); } - mprintf (utf8ToTStr(message)); - mprintf (_T("\n")); + mprintf(_M("%s\n"), MaxTStrFromUtf8(message).data()); - nlwarning ("Error in max file %s : ", _Ip->GetCurFilePath()); - nlwarning (message.c_str()); + nlwarning("Error in max file %s : ", _Ip->GetCurFilePath()); + nlwarning("%s", message.c_str()); } // -------------------------------------------------- -void CExportNel::outputWarningMessage (const std::string &message) +void CExportNel::outputWarningMessage(const std::string &message) { if (_ErrorInDialog) { - MessageBox (_Ip->GetMAXHWnd(), utf8ToTStr(message), utf8ToTStr(_ErrorTitle), MB_OK|MB_ICONEXCLAMATION); + MessageBoxW(_Ip->GetMAXHWnd(), nlUtf8ToWide(message), nlUtf8ToWide(_ErrorTitle), MB_OK|MB_ICONEXCLAMATION); } - mprintf (utf8ToTStr(message)); - mprintf (_M("\n")); + mprintf(_M("%s\n"), MaxTStrFromUtf8(message).data()); - nlwarning ("Warning in max file %s : ", _Ip->GetCurFilePath()); - nlwarning (message.c_str()); + nlwarning("Warning in max file %s : ", _Ip->GetCurFilePath()); + nlwarning("%s", message.c_str()); } // -------------------------------------------------- @@ -819,7 +817,7 @@ void CExportNel::addChildLodNode (std::set &lodListToExclude, INode *cur if (lodName != "") { // Get the lod by name - INode *lodNode = _Ip->GetINodeByName (utf8ToTStr(lodName)); + INode *lodNode = _Ip->GetINodeByName(MaxTStrFromUtf8(lodName)); if (lodNode) { // Insert it in the set @@ -850,7 +848,7 @@ void CExportNel::addParentLodNode (INode &child, std::set &lodListToExcl if (lodName != "") { // Get the lod by name - INode *lodNode = _Ip->GetINodeByName (utf8ToTStr(lodName)); + INode *lodNode = _Ip->GetINodeByName(MaxTStrFromUtf8(lodName)); if (lodNode == &child) { // Insert it in the set @@ -1111,7 +1109,7 @@ static void restoreDecimalSeparator() float toFloatMax(const TCHAR *src) { float result = 0.f; - if (toFloatMax(tStrToUtf8(src), result)) return result; + if (toFloatMax(MCharStrToUtf8(src), result)) return result; return 0.f; } @@ -1124,7 +1122,7 @@ float toFloatMax(const std::string &src) bool toFloatMax(const TCHAR *src, float &dest) { - return toFloatMax(tStrToUtf8(src), dest); + return toFloatMax(MCharStrToUtf8(src), dest); } bool toFloatMax(const std::string &src, float &dest) diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_particle_system.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_particle_system.cpp index 4b17b17d3..02e3f9018 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_particle_system.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_particle_system.cpp @@ -51,7 +51,7 @@ IShape* CExportNel::buildParticleSystem(INode& node, TimeValue time) iF.serial(ss); if (!dynamic_cast(ss.getShapePointer())) { - mprintf(_T("Error : Object shape %s isn't a particle system"), utf8ToTStr(shapeName)); + mprintf(_M("Error : Object shape %s isn't a particle system\n"), MaxTStrFromUtf8(shapeName).data()); return NULL; } @@ -78,7 +78,7 @@ IShape* CExportNel::buildParticleSystem(INode& node, TimeValue time) } else { - mprintf(_T("Error : Can't find %s while exporting a particle system \n"), utf8ToTStr(shapeName)); + mprintf(_M("Error : Can't find %s while exporting a particle system\n"), MaxTStrFromUtf8(shapeName).data()); return NULL; } } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_radial_normal.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_radial_normal.cpp index 80f57bfb4..91fcd99db 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_radial_normal.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_radial_normal.cpp @@ -62,7 +62,7 @@ void CRadialVertices::init (INode *node, Mesh *mesh, TimeValue time, Interface & _SmoothingGroupMask |= (1<& vectNode, v resultInstanceNode[nNumIG] = pNode; if (aIGArray[nNumIG].InstanceName == "") // no instance name was set, takes the node name instead { - aIGArray[nNumIG].InstanceName = tStrToUtf8(pNode->GetName()); + aIGArray[nNumIG].InstanceName = MCharStrToUtf8(pNode->GetName()); } // Visible? always true, but if special flag for camera collision @@ -236,7 +236,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v pMB->Vertices[pMB->Faces[j].Corner[2].Vertex]) ) { // ERROR : The volume is not convex !!! - nlwarning("ERROR: The cluster %s is not convex.", tStrToUtf8(vectNode[i]->GetName()).c_str()); + nlwarning("ERROR: The cluster %s is not convex.", MCharStrToUtf8(vectNode[i]->GetName()).c_str()); } } @@ -244,7 +244,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v clusterTemp.VisibleFromFather = bVisibleFromFather; clusterTemp.FatherAudible = bFatherAudible; clusterTemp.AudibleFromFather = bAudibleFromFather; - clusterTemp.Name = tStrToUtf8(pNode->GetName()); + clusterTemp.Name = MCharStrToUtf8(pNode->GetName()); vClusters.push_back (clusterTemp); delete pMB; pMB = NULL; @@ -333,7 +333,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v if (!portalTemp.setPoly (polyv)) { // ERROR : Poly not convex, or set of vertices not plane - nlwarning("ERROR: The portal %s is not convex.", tStrToUtf8(vectNode[i]->GetName()).c_str()); + nlwarning("ERROR: The portal %s is not convex.", MCharStrToUtf8(vectNode[i]->GetName()).c_str()); } if (nAccelType&16) // is dynamic portal ? @@ -342,7 +342,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v if (!InstanceName.empty()) portalTemp.setName (InstanceName); else - portalTemp.setName (tStrToUtf8(pNode->GetName())); + portalTemp.setName (MCharStrToUtf8(pNode->GetName())); } // Check if portal has 2 cluster @@ -362,7 +362,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v if (nNbCluster != 2) { // ERROR - nlwarning("ERROR: The portal %s has not 2 clusters but %d", tStrToUtf8(vectNode[i]->GetName()).c_str(), nNbCluster); + nlwarning("ERROR: The portal %s has not 2 clusters but %d", MCharStrToUtf8(vectNode[i]->GetName()).c_str(), nNbCluster); } @@ -504,7 +504,7 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v if (!vClusters.empty()) if (aIGArray[nNumIG].Clusters.empty()) { - nlwarning("ERROR: Object %s is not attached to any cluster\nbut his flag clusterize is set", tStrToUtf8(pNode->GetName()).c_str()); + nlwarning("ERROR: Object %s is not attached to any cluster\nbut his flag clusterize is set", MCharStrToUtf8(pNode->GetName()).c_str()); } // debug purpose : to remove @@ -700,7 +700,7 @@ void CExportNel::buildScene (NL3D::CScene &scene, NL3D::CShapeBank &shapeBank, I if ( (!pNode->IsHidden () || buildHidden) && (pNode->Selected () || !onlySelected) ) { string sTmp = "Object Name: "; - sTmp += tStrToUtf8(pNode->GetName()); + sTmp += MCharStrToUtf8(pNode->GetName()); if (progress) progress->setLine (0, sTmp); sTmp.clear(); diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_script.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_script.cpp index cf99e2c0c..1d495abc7 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_script.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_script.cpp @@ -36,7 +36,7 @@ bool CExportNel::scriptEvaluate (const char *script, void *out, TNelScriptValueT four_typed_value_locals(Parser* parser,Value* code,Value* result,StringStream* source); vl.parser = new Parser; - vl.source = new StringStream (utf8ToTStr(script)); + vl.source = new StringStream(MaxTStrFromUtf8(script)); vl.source->log_to(NULL); #if MAX_VERSION_MAJOR < 19 diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp index d5030ee9d..e099dc1c3 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_skinning.cpp @@ -114,7 +114,7 @@ INode *CExportNel::getNELScaleReferenceNode(INode &node) { std::string boneScaleName= getName(node) + boneScaleNameExt; // Get the reference node - referenceNode= _Ip->GetINodeByName(utf8ToTStr(boneScaleName)); + referenceNode= _Ip->GetINodeByName(MaxTStrFromUtf8(boneScaleName)); } } @@ -455,7 +455,7 @@ uint CExportNel::buildSkinning (CMesh::CMeshBuild& buildMesh, const TInodePtrInt nlassert ((uint)ite->secondsecond] = tStrToUtf8(ite->first->GetName()); + buildMesh.BonesNames[ite->second] = MCharStrToUtf8(ite->first->GetName()); // Next ite++; @@ -1306,7 +1306,7 @@ static sint getBoneSide(INode *bone, std::string &mirrorName) { sint side= 0; sint pos; - mirrorName = tStrToUtf8(bone->GetName()); + mirrorName = MCharStrToUtf8(bone->GetName()); if((pos= mirrorName.find(" R "))!=std::string::npos) { @@ -1335,7 +1335,7 @@ static INode *getMirrorBone(const std::vector &skeletonNodes, INode *bon // find for(uint i=0;iGetName())) + if(mirrorName == MCharStrToUtf8(skeletonNodes[i]->GetName())) return skeletonNodes[i]; } } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/PO2RPO.h b/code/nel/tools/3d/plugin_max/nel_patch_converter/PO2RPO.h index 77c2c03ca..34e3da363 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/PO2RPO.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/PO2RPO.h @@ -33,14 +33,14 @@ #undef max #endif +#include "../nel_3dsmax_shared/string_common.h" + #define PO2RPO_CLASS_ID Class_ID(0x43bb65e6, 0x68935530) extern TCHAR *GetString(int id); extern HINSTANCE hInstance; - - class PO2RPO : public Modifier { public: // Parameter block @@ -50,7 +50,7 @@ class PO2RPO : public Modifier { HWND hRollup; // From Animatable - const MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } + GET_OBJECT_NAME_CONST MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } //From Modifier //TODO: Add the channels that the modifier needs to perform its modification @@ -87,7 +87,7 @@ class PO2RPO : public Modifier { void GetClassName(TSTR& s) {s = GetString(IDS_CLASS_NAME);} RefTargetHandle Clone( RemapDir &remap ); - RefResult NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate); + RefResult NotifyRefChanged(NOTIFY_REF_PARAMS); int NumSubs() { return 0; } TSTR SubAnimName(int i) { return GetString(IDS_PARAMS); } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.cpp b/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.cpp index ee75bc152..4b7483057 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/nel_patch_converter.cpp @@ -44,8 +44,8 @@ static ParamBlockDesc2 po2rpo_param_blk ( po2rpo_params, _T("params"), 0, &PO2R p_default, 0.1f, p_range, 0.0f,1000.0f, p_ui, TYPE_SPINNER, EDITTYPE_FLOAT, IDC_EDIT, IDC_SPIN, 0.01f, - p_end, - p_end + nl_p_end, + nl_p_end ); IObjParam *PO2RPO::ip = NULL; @@ -142,7 +142,7 @@ INT_PTR CALLBACK DlgProc_Panel(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP if (versionInfoSize) { // Alloc the buffer (size in bytes) - uint8_t *buffer = new uint8_t[versionInfoSize]; + uint8 *buffer = new uint8[versionInfoSize]; // Find the verion resource if (GetFileVersionInfo(moduldeFileName, 0, versionInfoSize, buffer)) @@ -174,7 +174,7 @@ INT_PTR CALLBACK DlgProc_Panel(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("GetFileVersionInfo failed")); // Free the buffer - delete [] buffer; + delete[] buffer; } else SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("GetFileVersionInfoSize failed")); @@ -221,7 +221,7 @@ void PO2RPO::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next) // ----------------------------------------------------------------------------------------------------------------------------------------------------------- //From ReferenceMaker -RefResult PO2RPO::NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) +RefResult PO2RPO::NotifyRefChanged(NOTIFY_REF_PARAMS) { //TODO: Add code to handle the various reference changed messages return REF_SUCCEED; 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 7ce6c3068..8ceaddb6e 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 @@ -216,7 +216,7 @@ export_zone_cf (Value** arg_list, int count) if (tri->rpatch->exportZone (node, &tri->patch, zone, zoneSymmetry, nZone, 160, 1, false)) { // Export path - const std::string sPath = tStrToUtf8(arg_list[1]->to_string()); + const std::string sPath = MCharStrToUtf8(arg_list[1]->to_string()); COFile file; if (file.open (sPath)) @@ -246,7 +246,7 @@ Value* import_zone_cf (Value** arg_list, int count) Interface *ip = MAXScript_interface; // Get the filename - string filename = tStrToUtf8(arg_list[0]->to_string()); + string filename = MCharStrToUtf8(arg_list[0]->to_string()); // Get the flip bool dialog = arg_list[1]->to_bool ()!=FALSE; @@ -289,14 +289,14 @@ Value* import_zone_cf (Value** arg_list, int count) { // Error message std::string msg = toString("Error when loading file %s: %s", filename.c_str(), e.what()); - errorMessage (utf8ToTStr(msg), _T("NeL import zone"), *ip, dialog); + errorMessage (MaxTStrFromUtf8(msg), _M("NeL import zone"), *ip, dialog); } } else { // Error message std::string msg = toString("Can't open the file %s for reading.", filename.c_str()); - errorMessage (utf8ToTStr(msg), _T("NeL import zone"), *ip, dialog); + errorMessage (MaxTStrFromUtf8(msg), _M("NeL import zone"), *ip, dialog); } return ret; @@ -1708,7 +1708,7 @@ Value* set_tile_bank_cf (Value** arg_list, int count) type_check(arg_list[0], String, _M("NelSetTileBank [tile bank pathname]")); // ok ? - const std::string pathname = tStrToUtf8(arg_list[0]->to_string()); + const std::string pathname = MCharStrToUtf8(arg_list[0]->to_string()); // Get tile number SetBankPathName (pathname); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/editpat.h b/code/nel/tools/3d/plugin_max/nel_patch_edit/editpat.h index b6fe7adb1..ea70bc788 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/editpat.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/editpat.h @@ -574,7 +574,7 @@ class EditPatchMod : public Modifier, IPatchOps, IPatchSelect, ISubMtlAPI, Attac static bool additiveTile; static bool automaticLighting; - RefResult NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) { return REF_SUCCEED; } + RefResult NotifyRefChanged(NOTIFY_REF_PARAMS) { return REF_SUCCEED; } int selLevel; @@ -751,7 +751,7 @@ class EditPatchMod : public Modifier, IPatchOps, IPatchSelect, ISubMtlAPI, Attac void BeginEditParams( IObjParam *ip, ULONG flags, Animatable *prev ); void EndEditParams( IObjParam *ip, ULONG flags, Animatable *next ); RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir()); - const MCHAR *GetObjectName() { return GetString(IDS_TH_EDITPATCH); } + GET_OBJECT_NAME_CONST MCHAR *GetObjectName() { return GetString(IDS_TH_EDITPATCH); } void ActivateSubobjSel(int level, XFormModes& modes ); int NeedUseSubselButton() { return 0; } void SelectSubPatch(int index); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_edit_patch_mod.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_edit_patch_mod.cpp index 4306cfd0b..3fb6aaefb 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_edit_patch_mod.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_edit_patch_mod.cpp @@ -338,7 +338,7 @@ static INT_PTR CALLBACK PickSetDlgProc( Tab &names = *((Tab < TSTR*>*)lParam); for (int i = 0; i < names.Count(); i++) { - int pos = SendDlgItemMessage(hWnd, IDC_NS_LIST, LB_ADDSTRING, 0, (LPARAM)(TCHAR*)*names[i]->ToMCHAR()); + int pos = SendDlgItemMessage(hWnd, IDC_NS_LIST, LB_ADDSTRING, 0, (LPARAM)(*names[i]->data())); SendDlgItemMessage(hWnd, IDC_NS_LIST, LB_SETITEMDATA, pos, i); } break; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/stdafx.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/stdafx.cpp index 62eecad20..a849e7019 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/stdafx.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/stdafx.cpp @@ -1 +1,3 @@ #include "stdafx.h" + +void nlmax_patch_edit_stdafx_dummy() { } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.cpp b/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.cpp index 90803fad1..72d31a85d 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.cpp @@ -104,11 +104,14 @@ std::string GetBankPathName () if (RegOpenKeyEx(HKEY_CURRENT_USER, REGKEY_TILEDIT, 0, KEY_READ, &hKey)==ERROR_SUCCESS) { TCHAR path[256]; - DWORD len=256 * sizeof(TCHAR); + DWORD len = 256 * sizeof(TCHAR); DWORD type; if (RegQueryValueEx(hKey, _T("Bank Path"), 0, &type, (LPBYTE)path, &len)==ERROR_SUCCESS) - return tStrToUtf8(path); - RegCloseKey (hKey); + { + RegCloseKey(hKey); + return MCharStrToUtf8(path); + } + RegCloseKey(hKey); } return ""; } @@ -119,11 +122,14 @@ int GetBankTileSetSet () if (RegOpenKeyEx(HKEY_CURRENT_USER, REGKEY_TILEDIT, 0, KEY_READ, &hKey)==ERROR_SUCCESS) { int tileSetSet; - DWORD len=256; + DWORD len = 256; DWORD type; if (RegQueryValueEx(hKey, _T("Tileset Set"), 0, &type, (LPBYTE)&tileSetSet, &len)==ERROR_SUCCESS) + { + RegCloseKey(hKey); return tileSetSet; - RegCloseKey (hKey); + } + RegCloseKey(hKey); } return -1; } @@ -134,8 +140,7 @@ void SetBankPathName (const std::string& path) if (RegCreateKey(HKEY_CURRENT_USER, REGKEY_TILEDIT, &hKey)==ERROR_SUCCESS) { TCHAR buffer[MAX_PATH]; - _tcscpy_s(buffer, MAX_PATH, utf8ToTStr(path)); - + _tcscpy_s(buffer, MAX_PATH, MaxTStrFromUtf8(path).data()); RegSetValueEx(hKey, _T("Bank Path"), 0, REG_SZ, (LPBYTE)buffer, (_tcslen(buffer)+1)*sizeof(TCHAR)); RegCloseKey (hKey); } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h b/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h index f0ed9601c..e8cdf079b 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/nel_patch_mesh.h @@ -30,6 +30,7 @@ #include "nel/misc/file.h" #include "nel/misc/rgba.h" #include "path_mesh_alloc.h" +#include "../nel_3dsmax_shared/string_common.h" //#define USE_CACHE @@ -451,7 +452,7 @@ public: } catch (const NLMISC::EStream& excp) { - MessageBox (NULL, utf8ToTStr(excp.what()), _T("Load error"), MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, MaxTStrFromUtf8(excp.what()).data(), _T("Load error"), MB_OK|MB_ICONEXCLAMATION); } } return _bank; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.cpp b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.cpp index 9216d4155..318b2902d 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.cpp @@ -304,7 +304,7 @@ void RPO::GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel ) // ------------------------------------------------------------------------------------------------------------------------------------------------ //From ReferenceMaker -RefResult RPO::NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget,PartID& partID, RefMessage message, BOOL propagate ) +RefResult RPO::NotifyRefChanged(NOTIFY_REF_PARAMS) { //TODO: Implement, if the object makes references to other things //return PatchObject::NotifyRefChanged( changeInt, hTarget, partID, message, propagate); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.h b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.h index 0faa95aa6..0f4ead01c 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo.h @@ -83,7 +83,7 @@ class RPO : public PatchObject int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt); void Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt); //TODO: Return the name that will appear in the history browser (modifier stack) - const MCHAR *GetObjectName() { return _M("Rykol Patch Object");} + GET_OBJECT_NAME_CONST MCHAR *GetObjectName() { return _M("Rykol Patch Object");} void GetWorldBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box ); void GetLocalBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box ); @@ -206,10 +206,10 @@ class RPO : public PatchObject ? true : PatchObject::IsSubClassOf(classID); } SClass_ID SuperClassID() { return GEOMOBJECT_CLASS_ID; } - void GetClassName(TSTR& s) {s.FromUTF8("Rykol Patch Object");} + void GetClassName(TSTR& s) { s = _T("Rykol Patch Object");} RefTargetHandle Clone ( RemapDir &remap ); - RefResult NotifyRefChanged (const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate); + RefResult NotifyRefChanged (NOTIFY_REF_PARAMS); int NumSubs() { diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp index ea21e8fbe..6fe193a30 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp @@ -193,7 +193,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo } catch (const EStream& e) { - MessageBox (NULL, utf8ToTStr(e.what()), _T("Error"), MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, MaxTStrFromUtf8(e.what()).data(), _T("Error"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -267,8 +267,8 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo } // Show the message - mprintf (utf8ToTStr(error)); - nlwarning (error.c_str()); + mprintf(_M("%s\n"), MaxTStrFromUtf8(error).data()); + nlwarning("%s", error.c_str()); // Error return false; @@ -395,8 +395,8 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo icv=getCommonVertex(pPM,idstpatch,isrcpatch,&orderdstvtx); if (icv==-1) { - mprintf (_T("Invalid bind")); - nlwarning ("Invalid bind"); + mprintf(_M("Invalid bind\n")); + nlwarning("Invalid bind"); return false; } if (idstedge==orderdstvtx) @@ -419,7 +419,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo icv=getCommonVertex(pPM,idstpatch,isrcpatch); if (icv==-1) { - mprintf (_T("Invalid bind")); + mprintf(_M("Invalid bind\n")); nlwarning ("Invalid bind"); return false; } @@ -436,7 +436,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo icv=getCommonVertex(pPM,idstpatch,isrcpatch); if (icv==-1) { - mprintf (_T("Invalid bind")); + mprintf(_M("Invalid bind\n")); nlwarning ("Invalid bind"); return false; } @@ -448,8 +448,8 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo isrcedge=getEdge(pPM,srcpatch,srcpatch->v[nv],icv); if (isrcedge==-1) { - mprintf (_T("Invalid edge")); - nlwarning ("Invalid bind"); + mprintf(_M("Invalid edge\n")); + nlwarning("Invalid edge"); return false; } // let's fill the dst patch (n is important here... it's the order) @@ -592,8 +592,8 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo sym.invert (); if (!CPatchInfo::transform (patchinfo, zoneSymmetry, bank, symmetry, rotate, snapCell, weldThreshold, sym)) { - mprintf (_T("Can't transform the zone")); - nlwarning ("Invalid bind"); + mprintf(_M("Can't transform the zone\n")); + nlwarning("Can't transform the zone"); return false; } } @@ -609,7 +609,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo uint i; for (i=0; i. -#include "stdafx.h" \ No newline at end of file +#include "stdafx.h" + +void nlmax_patch_library_stdafx_dummy() { } diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.h b/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.h index d0e16bd11..2fa666295 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.h @@ -422,7 +422,7 @@ class PaintPatchMod : public Modifier static bool automaticLighting; static bool lockBorders; - RefResult NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) { return REF_SUCCEED; } + RefResult NotifyRefChanged(NOTIFY_REF_PARAMS) { return REF_SUCCEED; } bool includeMeshes; bool preloadTiles; @@ -481,7 +481,7 @@ class PaintPatchMod : public Modifier void BeginEditParams( IObjParam *ip, ULONG flags, Animatable *prev ); void EndEditParams( IObjParam *ip, ULONG flags, Animatable *next ); RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir()); - const MCHAR *GetObjectName() { return _M("NeL Patch Painter"); } + GET_OBJECT_NAME_CONST MCHAR *GetObjectName() { return _M("NeL Patch Painter"); } void RescaleWorldUnits(float f); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp index 98bc67305..8f3912b0e 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp @@ -2839,7 +2839,7 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi if (GetOpenFileName(&openFile)) { // Load the file - paintColor.loadBrush (tStrToUtf8(buffer)); + paintColor.loadBrush (MCharStrToUtf8(buffer)); paintColor.setBrushMode (true); } } @@ -3720,7 +3720,7 @@ void EPM_PaintCMode::DoPaint () { std::string error = NLMISC::toString("Invalid edge '%i' with value '%i' in patch '%i' in PatchMesh", p, mYedge, e); nlwarning(error.c_str()); - MessageBox(NULL, utf8ToTStr(error), _T("NeL Patch Painter"), MB_OK | MB_ICONSTOP); + MessageBox(NULL, MaxTStrFromUtf8(error).data(), _T("NeL Patch Painter"), MB_OK | MB_ICONSTOP); return; } #if (MAX_RELEASE < 4000) @@ -3883,8 +3883,8 @@ void EPM_PaintCMode::DoPaint () } if (patchVoisin.patch!=-1) { - std::string first = tStrToUtf8(vectMesh[i].Node->GetName()); - std::string second = tStrToUtf8(vectMesh[patchVoisin.Mesh].Node->GetName()); + std::string first = MCharStrToUtf8(vectMesh[i].Node->GetName()); + std::string second = MCharStrToUtf8(vectMesh[patchVoisin.Mesh].Node->GetName()); int rot = (2-((vectMesh[i].Symmetry)?(2-e):e)+((vectMesh[patchVoisin.Mesh].Symmetry)?(2-edgeVoisin):edgeVoisin))&3; int nU = 1 << rpatch->getUIPatch (p).NbTilesU; int nV = 1 << rpatch->getUIPatch (p).NbTilesV; @@ -3991,7 +3991,7 @@ void EPM_PaintCMode::DoPaint () } catch (const EStream& stream) { - MessageBox (NULL, utf8ToTStr(stream.what()), _T("Error"), MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, MaxTStrFromUtf8(stream.what()).data(), _T("Error"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -4063,7 +4063,7 @@ bool loadLigoConfigFile (CLigoConfig& config, Interface& it) if (res) { // Path - std::string modulePath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)); + std::string modulePath = NLMISC::CFile::getPath(MCharStrToUtf8(sModulePath)); try { @@ -4259,8 +4259,8 @@ DWORD WINAPI myThread (LPVOID vData) } else { - std::string message = toString("Can't build the zone named %s", tStrToUtf8(pData->VectMesh[i].Node->GetName()).c_str()); - MessageBox (pData->eproc->ip->GetMAXHWnd(), utf8ToTStr(message), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); + std::string message = toString("Can't build the zone named %s", MCharStrToUtf8(pData->VectMesh[i].Node->GetName()).c_str()); + MessageBox (pData->eproc->ip->GetMAXHWnd(), MaxTStrFromUtf8(message).data(), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); } } @@ -4362,14 +4362,14 @@ DWORD WINAPI myThread (LPVOID vData) } catch (const EDru& druExcept) { - MessageBox (NULL, utf8ToTStr(druExcept.what()), _T("NeL driver utility"), MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, MaxTStrFromUtf8(druExcept.what()).data(), _T("NeL driver utility"), MB_OK|MB_ICONEXCLAMATION); } delete pData; } catch (const Exception& e) { - MessageBox (NULL, utf8ToTStr(e.what()), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, MaxTStrFromUtf8(e.what()).data(), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); } return 0; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp index 59b7897db..a60ae6ba9 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp @@ -319,7 +319,7 @@ void getColors (COLORREF *array) DWORD len=4; DWORD type; std::string regName = toString("Color%u", i); - RegQueryValueEx (hKey, utf8ToTStr(regName), 0, &type, (LPBYTE)(array+i), &len); + RegQueryValueEx (hKey, MaxTStrFromUtf8(regName).data(), 0, &type, (LPBYTE)(array+i), &len); } RegCloseKey (hKey); } @@ -337,7 +337,7 @@ void setColors (const COLORREF *array) { DWORD len=4; std::string regName = toString("Color%u", i); - RegSetValueEx (hKey, utf8ToTStr(regName), 0, REG_DWORD, (LPBYTE)(array+i), 4); + RegSetValueEx (hKey, MaxTStrFromUtf8(regName).data(), 0, REG_DWORD, (LPBYTE)(array+i), 4); } RegCloseKey (hKey); } @@ -412,7 +412,7 @@ void LoadKeyCfg () if (res) { // Make a new path - std::string cfgPath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)) + "keys.cfg"; + std::string cfgPath = NLMISC::CFile::getPath(MCharStrToUtf8(sModulePath)) + "keys.cfg"; CConfigFile cf; @@ -455,7 +455,7 @@ void LoadVarCfg () { // Make a new path char cgfPath[256]; - std::string cfgPath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)) + "keys.cfg"; + std::string cfgPath = NLMISC::CFile::getPath(MCharStrToUtf8(sModulePath)) + "keys.cfg"; CConfigFile cf; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.cpp index 7d0a4a3df..a2e8be4b6 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_vcolor.cpp @@ -402,7 +402,7 @@ bool CPaintColor::loadBrush (const std::string &brushFileName) { // Error message std::string msg = toString("Can't open the file %s.", brushFileName.c_str()); - MessageBox ((HWND)CNELU::Driver->getDisplay(), utf8ToTStr(msg), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); + MessageBox((HWND)CNELU::Driver->getDisplay(), MaxTStrFromUtf8(msg).data(), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); // Return false return false; @@ -411,7 +411,7 @@ bool CPaintColor::loadBrush (const std::string &brushFileName) catch (const Exception &e) { // Error message - MessageBox ((HWND)CNELU::Driver->getDisplay(), utf8ToTStr(e.what()), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); + MessageBox((HWND)CNELU::Driver->getDisplay(), MaxTStrFromUtf8(e.what()).data(), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION); // Return false return false; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/stdafx.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/stdafx.cpp index 62eecad20..7f7ce72f7 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/stdafx.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/stdafx.cpp @@ -1 +1,3 @@ #include "stdafx.h" + +void nlmax_patch_painter_stdafx_dummy() { } diff --git a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp index 664ec0868..6acec0edd 100644 --- a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp +++ b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp @@ -483,7 +483,7 @@ void VertexPaint::EndEditParams(IObjParam *ip, ULONG flags, Animatable *next) //From ReferenceMaker -RefResult VertexPaint::NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) +RefResult VertexPaint::NotifyRefChanged(NOTIFY_REF_PARAMS) { return REF_SUCCEED; } diff --git a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.h b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.h index 7c751899e..991c5a628 100644 --- a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.h +++ b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.h @@ -29,6 +29,7 @@ #define NL_MAP_ASSERT #include +#include "../nel_3dsmax_shared/string_common.h" #define VERTEX_TREE_PAINT_CLASS_ID Class_ID(0x40c7005e, 0x2a95082c) #define CID_PAINT (CID_USER+0x439c) @@ -131,7 +132,7 @@ public: void GetClassName(TSTR& s) { s= TSTR(GetString(IDS_CLASS_NAME)); } virtual Class_ID ClassID() { return VERTEX_TREE_PAINT_CLASS_ID;} RefTargetHandle Clone(RemapDir& remap = DefaultRemapDir()); - const MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } + GET_OBJECT_NAME_CONST MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } IOResult Load(ILoad *iload); IOResult Save(ISave *isave); IOResult LoadLocalData(ILoad *iload, LocalModData **pld); @@ -161,7 +162,7 @@ public: Animatable* SubAnim(int i); TSTR SubAnimName(int i); - RefResult NotifyRefChanged(const Interval& changeInt,RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate); + RefResult NotifyRefChanged(NOTIFY_REF_PARAMS); CreateMouseCallBack* GetCreateMouseCallBack() {return NULL;} void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev); diff --git a/code/nel/tools/3d/plugin_max/tile_utility/rgbadd.cpp b/code/nel/tools/3d/plugin_max/tile_utility/rgbadd.cpp index 5f512b88e..3c44efb4d 100644 --- a/code/nel/tools/3d/plugin_max/tile_utility/rgbadd.cpp +++ b/code/nel/tools/3d/plugin_max/tile_utility/rgbadd.cpp @@ -85,7 +85,7 @@ class RGBAdd: public Texmap { int RemapRefOnLoad(int iref); RefTargetHandle Clone(RemapDir &remap = DefaultRemapDir()); - RefResult NotifyRefChanged(const Interval &changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate); + RefResult NotifyRefChanged(NOTIFY_REF_PARAMS); // IO IOResult Save(ISave *isave); @@ -130,41 +130,41 @@ enum static ParamBlockDesc2 RGBAdd_param_blk ( RGBAdd_params, _T("parameters"), 0, &maskCD, P_AUTO_CONSTRUCT + P_AUTO_UI, 0, //rollout - IDD_RGBMULT, "RGB Additif Parameters", 0, 0, NULL, + IDD_RGBMULT, _T("RGB Additif Parameters"), 0, 0, NULL, // params RGBAdd_color1, _T("color1"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_COLOR1, p_default, Color(0,0,0), p_ui, TYPE_COLORSWATCH, IDC_MULT_COL1, - p_end, + nl_p_end, RGBAdd_color2, _T("color2"), TYPE_RGBA, P_ANIMATABLE, IDS_DS_COLOR2, p_default, Color(0.5,0.5,0.5), p_ui, TYPE_COLORSWATCH, IDC_MULT_COL2, - p_end, + nl_p_end, RGBAdd_map1, _T("map1"), TYPE_TEXMAP, P_OWNERS_REF, IDS_JW_MAP1, p_refno, 1, p_subtexno, 0, p_ui, TYPE_TEXMAPBUTTON, IDC_MULT_TEX1, - p_end, + nl_p_end, RGBAdd_map2, _T("map2"), TYPE_TEXMAP, P_OWNERS_REF, IDS_JW_MAP2, p_refno, 2, p_subtexno, 1, p_ui, TYPE_TEXMAPBUTTON, IDC_MULT_TEX2, - p_end, + nl_p_end, RGBAdd_map1_on, _T("map1Enabled"), TYPE_BOOL, 0, IDS_JW_MAP1ENABLE, p_default, TRUE, p_ui, TYPE_SINGLECHEKBOX, IDC_MAPON1, - p_end, + nl_p_end, RGBAdd_map2_on, _T("map2Enabled"), TYPE_BOOL, 0, IDS_JW_MAP2ENABLE, p_default, TRUE, p_ui, TYPE_SINGLECHEKBOX, IDC_MAPON2, - p_end, + nl_p_end, RGBAdd_type, _T("alphaFrom"), TYPE_INT, 0, IDS_PW_ALPHAFROM, p_default, 2, p_range, 0, 2, p_ui, TYPE_RADIO, 3, IDC_MULT_ALPHA1, IDC_MULT_ALPHA2, IDC_MULT_ALPHA3, - p_end, + nl_p_end, - p_end + nl_p_end ); @@ -364,7 +364,7 @@ TSTR RGBAdd::SubAnimName(int i) { } } -RefResult RGBAdd::NotifyRefChanged(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate) +RefResult RGBAdd::NotifyRefChanged(NOTIFY_REF_PARAMS) { switch (message) { diff --git a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp index 893f44eea..8110dbab9 100644 --- a/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp +++ b/code/nel/tools/3d/plugin_max/tile_utility/tile_utility.cpp @@ -21,6 +21,8 @@ #include "nel/misc/file.h" #include "../nel_patch_lib/rpo.h" +#include "../nel_3dsmax_shared/string_common.h" + #define TILE_UTILITY_CLASS_ID Class_ID(0x2301c0, 0x4c156b46) extern ClassDesc* GetRGBAddDesc(); @@ -192,7 +194,7 @@ static INT_PTR CALLBACK Tile_utilityDlgProc(HWND hWnd, UINT msg, WPARAM wParam, ofn.lpTemplateName=0; if (GetOpenFileName(&ofn)) { - theTile_utility.Load (tStrToUtf8(sPath)); + theTile_utility.Load (MCharStrToUtf8(sPath)); theTile_utility.SetLand (theTile_utility.Land); theTile_utility.SetupUI (); } @@ -287,7 +289,7 @@ void Tile_utility::Load (const std::string& path) if (!file.open (path)) { std::string tmp = toString("File not found: %s", path.c_str()); - MessageBox (NULL, utf8ToTStr(tmp), _T("Error.."), MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, MaxTStrFromUtf8(tmp).data(), _T("Error.."), MB_OK|MB_ICONEXCLAMATION); } else { @@ -299,7 +301,7 @@ void Tile_utility::Load (const std::string& path) catch (const EStream &stream) { std::string tmp = toString("Error while loading %s:\n\n%s", path.c_str(), stream.what()); - MessageBox (NULL, utf8ToTStr(tmp), _T("Error.."), MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, MaxTStrFromUtf8(tmp).data(), _T("Error.."), MB_OK|MB_ICONEXCLAMATION); } } @@ -337,7 +339,7 @@ void Tile_utility::SetupUI () std::string name=Bank.getLand(nLand)->getName(); if (hCombo) { - SendMessage (hCombo, CB_INSERTSTRING, -1, (LPARAM)utf8ToTStr(name)); + SendMessage (hCombo, CB_INSERTSTRING, -1, (LPARAM)MaxTStrFromUtf8(name).data()); } } @@ -369,7 +371,7 @@ void Tile_utility::SetupUI () name[0] = upName[0]; } - SetWindowText (hwnd, utf8ToTStr(name)); + SetWindowText (hwnd, MaxTStrFromUtf8(name).data()); // Static text TCHAR sTmp[256]; @@ -451,7 +453,7 @@ bool Tile_utility::SetupMaterial () const tex->SetAlphaSource (ALPHA_NONE); tex->SetAlphaAsMono (FALSE); tex->SetAlphaAsRGB (FALSE); - tex->SetMapName (utf8ToTStr(Bank.getAbsPath() + tile->getRelativeFileName(CTile::diffuse))); + tex->SetMapName (MaxTStrFromUtf8(Bank.getAbsPath() + tile->getRelativeFileName(CTile::diffuse)).data()); // Assign BitmapTex rgb->SetSubTexmap (0, tex); @@ -471,7 +473,7 @@ bool Tile_utility::SetupMaterial () const tex->SetAlphaSource (ALPHA_NONE); tex->SetAlphaAsMono (FALSE); tex->SetAlphaAsRGB (FALSE); - tex->SetMapName (utf8ToTStr(Bank.getAbsPath() + tile->getRelativeFileName(CTile::additive))); + tex->SetMapName (MaxTStrFromUtf8(Bank.getAbsPath() + tile->getRelativeFileName(CTile::additive)).data()); // Assign BitmapTex rgb->SetSubTexmap (1, tex); 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 5d5e4e298..9736be511 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 @@ -48,4 +48,6 @@ extern HINSTANCE hInstance; #define RGBAddClassID (Class_ID(0x5621932, 0x565a6387)) +#include "../nel_3dsmax_shared/string_common.h" + #endif // __TILE_UTILITY__H diff --git a/code/nel/tools/3d/shapes_exporter/main.cpp b/code/nel/tools/3d/shapes_exporter/main.cpp index a77161849..8c42f740c 100644 --- a/code/nel/tools/3d/shapes_exporter/main.cpp +++ b/code/nel/tools/3d/shapes_exporter/main.cpp @@ -88,7 +88,7 @@ static CHashKeyMD5 getNewMD5(const std::string &filename) } #if defined(NL_OS_WINDOWS) && !defined(_CONSOLE) -sint WINAPI WinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPSTR cmdline, int /* nCmdShow */) +sint APIENTRY WinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPSTR cmdline, int /* nCmdShow */) { // we can specify several shapes on command line // so we need to process it diff --git a/code/nel/tools/3d/tile_edit/Browse.cpp b/code/nel/tools/3d/tile_edit/Browse.cpp index 89e45c62d..b96979d4d 100644 --- a/code/nel/tools/3d/tile_edit/Browse.cpp +++ b/code/nel/tools/3d/tile_edit/Browse.cpp @@ -612,7 +612,7 @@ void Browse::Init() unsigned long value; unsigned long type; int cx=-1,cy=-1,x=-1,y=-1; - char sWindowpl[256]; + TCHAR sWindowpl[256]; if (RegOpenKey(HKEY_CURRENT_USER,REGKEY_TILEDIT,®key)==ERROR_SUCCESS) { @@ -621,7 +621,7 @@ void Browse::Init() if (RegQueryValueEx(regkey,REGKEY_WNDPL,0,&type,(unsigned char *)&sWindowpl,&value)==ERROR_SUCCESS) { WINDOWPLACEMENT wndpl; - sscanf(sWindowpl,"%d %d %d %d %d %d %d %d %d %d", + _stscanf(sWindowpl,_T("%d %d %d %d %d %d %d %d %d %d"), &wndpl.flags, &wndpl.ptMaxPosition.x,&wndpl.ptMaxPosition.y, &wndpl.ptMinPosition.x,&wndpl.ptMinPosition.y, @@ -632,10 +632,10 @@ void Browse::Init() } value=256; type=REG_SZ; - if (RegQueryValueEx(regkey,REGKEY_LASTPATH,0,&type,(unsigned char *)&sWindowpl,&value)!=ERROR_SUCCESS) + if (RegQueryValueEx(regkey, REGKEY_LASTPATH, 0, &type, (unsigned char *)&sWindowpl, &value) != ERROR_SUCCESS) m_ctrl.LastPath.clear(); else - m_ctrl.LastPath=(const char*)sWindowpl; + m_ctrl.LastPath = tStrToUtf8(sWindowpl); value=4; type=REG_DWORD; if (RegQueryValueEx(regkey,REGKEY_BUTTONZOOM,0,&type,(unsigned char *)&m_ctrl.Zoom,&value)!=ERROR_SUCCESS) @@ -808,8 +808,10 @@ void Browse::OnDestroy() if (RegCreateKey(HKEY_CURRENT_USER,REGKEY_TILEDIT,®key)==ERROR_SUCCESS) { //int sel = ((CComboBox*)GetDlgItem(IDC_LISTTYPE))->GetCurSel(); - RegSetValueEx(regkey,REGKEY_WNDPL,0,REG_SZ,(const unsigned char*)sWindowpl,(DWORD)strlen(sWindowpl)); - RegSetValueEx(regkey,REGKEY_LASTPATH,0,REG_SZ,(const unsigned char*)m_ctrl.LastPath.c_str(),(DWORD)strlen(m_ctrl.LastPath.c_str())); + tstring tWindowpl = utf8ToTStr(sWindowpl); + tstring tLastPath = utf8ToTStr(m_ctrl.LastPath); + RegSetValueEx(regkey, REGKEY_WNDPL, 0, REG_SZ, (const BYTE *)tWindowpl.c_str(), (tWindowpl.size() + 1) * sizeof(TCHAR)); + RegSetValueEx(regkey, REGKEY_LASTPATH, 0, REG_SZ, (const BYTE *)tLastPath.c_str(), (tLastPath.size() + 1) * sizeof(TCHAR)); RegSetValueEx(regkey,REGKEY_BUTTONZOOM,0,REG_DWORD,(const unsigned char*)&m_ctrl.Zoom,4); RegSetValueEx(regkey,REGKEY_BUTTONVARIETY,0,REG_DWORD,(const unsigned char*)&m_128x128,4); RegSetValueEx(regkey,REGKEY_BUTTONTEXTURE,0,REG_DWORD,(const unsigned char*)&m_ctrl.Texture,4); @@ -1415,7 +1417,7 @@ void Browse::OnExportBorder() { // Error message std::string tmp = toString("Can't write bitmap %s", tStrToUtf8(pathName).c_str()); - MessageBox (utf8ToTStr(tmp), _T("Export border"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(tmp), _T("Export border"), MB_OK | MB_ICONEXCLAMATION); } } } @@ -1458,7 +1460,7 @@ void Browse::OnImportBorder() { // Error message std::string tmp = toString("Can't read bitmap %s", tStrToUtf8(pathName).c_str()); - MessageBox (utf8ToTStr(tmp), _T("Import border"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(tmp), _T("Import border"), MB_OK | MB_ICONEXCLAMATION); } // Get pixel @@ -1482,7 +1484,7 @@ void Browse::OnImportBorder() { // Error message std::string tmp = toString("The bitmap must have a size of 128x128 (%s)", tStrToUtf8(pathName).c_str()); - MessageBox (utf8ToTStr(tmp), _T("Import border"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr(tmp), _T("Import border"), MB_OK | MB_ICONEXCLAMATION); } // 256 or 128 ? diff --git a/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp b/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp index 198fd7942..a8a66e3c9 100644 --- a/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp +++ b/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp @@ -120,13 +120,13 @@ private: { UpdateData (); TCHAR sTitle[512]; - _stprintf(sTitle, _T("Tile sets use by %s"), utf8ToTStr(tileBank.getLand(_land)->getName())); + _stprintf(sTitle, _T("Tile sets use by %s"), nlUtf8ToTStr(tileBank.getLand(_land)->getName())); SetWindowText (sTitle); for (int i=0; igetName())); + m_ctrlCombo.InsertString(-1, nlUtf8ToTStr(tileBank.getTileSet(i)->getName())); if (tileBank.getLand(_land)->isTileSet (tileBank.getTileSet(i)->getName())) - m_ctrlList.InsertString (-1, utf8ToTStr(tileBank.getTileSet(i)->getName())); + m_ctrlList.InsertString(-1, nlUtf8ToTStr(tileBank.getTileSet(i)->getName())); } UpdateData (FALSE); } @@ -219,15 +219,15 @@ private: { UpdateData (); TCHAR sTitle[512]; - _stprintf(sTitle, _T("Children of the tile set %s"), utf8ToTStr(tileBank.getTileSet(_tileSet)->getName())); + _stprintf(sTitle, _T("Children of the tile set %s"), nlUtf8ToTStr(tileBank.getTileSet(_tileSet)->getName())); SetWindowText (sTitle); for (int i=0; igetName())); + m_ctrlCombo.InsertString(-1, nlUtf8ToTStr(tileBank.getTileSet(i)->getName())); if (tileBank.getTileSet(_tileSet)->isChild (tileBank.getTileSet(i)->getName())) - m_ctrlList.InsertString (-1, utf8ToTStr(tileBank.getTileSet(i)->getName())); + m_ctrlList.InsertString(-1, nlUtf8ToTStr(tileBank.getTileSet(i)->getName())); } UpdateData (FALSE); @@ -379,17 +379,17 @@ void SelectionTerritoire::OnSelect() for (i=0; iAddString(utf8ToTStr(tileBank.getLand(i)->getName())); + list->AddString(nlUtf8ToTStr(tileBank.getLand(i)->getName())); } for (i=0; iAddString(utf8ToTStr(tileBank.getTileSet(i)->getName())); + list2->AddString(nlUtf8ToTStr(tileBank.getTileSet(i)->getName())); } - MainFileName = CString(utf8ToTStr(NLMISC::CFile::getFilename(temp))); - DefautPath = CString(utf8ToTStr(NLMISC::CFile::getPath(temp))); + MainFileName = CString(nlUtf8ToTStr(NLMISC::CFile::getFilename(temp))); + DefautPath = CString(nlUtf8ToTStr(NLMISC::CFile::getPath(temp))); MainFileOk = 1; CButton *button = (CButton*)GetDlgItem(IDC_ADD_TERRITOIRE); @@ -402,7 +402,7 @@ void SelectionTerritoire::OnSelect() button->EnableWindow(true); // Change the bouton text path - GetDlgItem (IDC_PATH)->SetWindowText (utf8ToTStr(tileBank.getAbsPath())); + GetDlgItem(IDC_PATH)->SetWindowText(nlUtf8ToTStr(tileBank.getAbsPath())); } } @@ -468,8 +468,8 @@ void SelectionTerritoire::OnSaveAs() // Create a file name std::string temp = tStrToUtf8(sFile.GetPathName()); - MainFileName = CString(utf8ToTStr(NLMISC::CFile::getFilename(temp))); - DefautPath = CString(utf8ToTStr(NLMISC::CFile::getPath(temp))); + MainFileName = CString(nlUtf8ToTStr(NLMISC::CFile::getFilename(temp))); + DefautPath = CString(nlUtf8ToTStr(NLMISC::CFile::getPath(temp))); } } @@ -582,7 +582,7 @@ void SelectionTerritoire::OnPath() goodPath=false; // Make a message - _stprintf(msg, _T("Path '%s' can't be found in bitmap '%s'. Continue ?"), path, utf8ToTStr(bitmapPath)); + _stprintf(msg, _T("Path '%s' can't be found in bitmap '%s'. Continue ?"), path, nlUtf8ToTStr(bitmapPath)); // Message if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO) @@ -611,7 +611,7 @@ void SelectionTerritoire::OnPath() goodPath=false; // Make a message - _stprintf(msg, _T("Path '%s' can't be found in bitmap '%s'. Continue ?"), path, utf8ToTStr(bitmapPath)); + _stprintf(msg, _T("Path '%s' can't be found in bitmap '%s'. Continue ?"), path, nlUtf8ToTStr(bitmapPath)); // Message if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO) diff --git a/code/nel/tools/3d/tile_edit/View.cpp b/code/nel/tools/3d/tile_edit/View.cpp index cf65a527d..fb6cd6890 100644 --- a/code/nel/tools/3d/tile_edit/View.cpp +++ b/code/nel/tools/3d/tile_edit/View.cpp @@ -242,7 +242,7 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma { std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?"; - return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); + return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO | MB_ICONEXCLAMATION) == IDYES); } else { @@ -261,7 +261,7 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""}; std::string msg = NLMISC::toString("%s\nPixel: %d (%s)\nContinue ?", CTileSet::getErrorMessage (error), pixel, comp[composante]); - return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); + return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't add tile"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES); } else { @@ -289,7 +289,7 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma { // Error: bitmap not in the absolute path.. std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.\nContinue ?", name.c_str(), tileBank2.getAbsPath ().c_str()); - return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Load error"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); + return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Load error"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES); } return 1; @@ -307,7 +307,7 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) { std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?"; - return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); + return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO | MB_ICONEXCLAMATION) == IDYES); } else { @@ -326,7 +326,7 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma { static const char* comp[] = { "Red", "Green", "Blue", "Alpha", "" }; std::string msg = NLMISC::toString("%s\nPixel: %d (%s)\nContinue ?", CTileSet::getErrorMessage (error), pixel, comp[composante]); - return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); + return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't add tile"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES); } else { @@ -351,7 +351,7 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma { // Error: bitmap not in the absolute path.. std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.\nContinue ?", name.c_str(), tileBank2.getAbsPath ().c_str()); - return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Load error"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); + return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Load error"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES); } return 1; @@ -372,7 +372,7 @@ int TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile: if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) { std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?"; - return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); + return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO | MB_ICONEXCLAMATION) == IDYES); } else { @@ -390,7 +390,7 @@ int TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile: { static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""}; std::string msg = NLMISC::toString("%s\nPixel: %d (%s)\nContinue ?", CTileSet::getErrorMessage(error), pixel, comp[composante]); - return MessageBox (NULL, utf8ToTStr(msg), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES; + return MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't add tile"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES; } else { @@ -418,7 +418,7 @@ int TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile: { // Error: bitmap not in the absolute path.. std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str()); - MessageBox (NULL, utf8ToTStr(msg), _T("Load error"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL, nlUtf8ToTStr(msg), _T("Load error"), MB_OK | MB_ICONEXCLAMATION); } return 1; @@ -439,7 +439,7 @@ int TileList::setDisplacement (int tile, const std::string& name) if (!_LoadBitmap(tileBank2.getAbsPath() + troncated, &theListDisplacement[tile].BmpInfo, theListDisplacement[tile].Bits, NULL, 0)) { std::string msg = tileBank2.getAbsPath() + troncated; - MessageBox(NULL, utf8ToTStr(msg), _T("Can't load file"), MB_OK | MB_ICONEXCLAMATION); + MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't load file"), MB_OK | MB_ICONEXCLAMATION); } else { @@ -447,7 +447,7 @@ int TileList::setDisplacement (int tile, const std::string& name) if ((theListDisplacement[tile].BmpInfo.bmiHeader.biWidth!=32)||(-theListDisplacement[tile].BmpInfo.bmiHeader.biHeight!=32)) { // Error message - MessageBox (NULL, _T("Invalid size: displacement map must be 32x32 8 bits."), utf8ToTStr(troncated), + MessageBox(NULL, _T("Invalid size: displacement map must be 32x32 8 bits."), nlUtf8ToTStr(troncated), MB_OK|MB_ICONEXCLAMATION); // Free the bitmap @@ -468,7 +468,7 @@ int TileList::setDisplacement (int tile, const std::string& name) { // Error: bitmap not in the absolute path.. std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str()); - MessageBox (NULL, utf8ToTStr(msg), _T("Load error"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL, nlUtf8ToTStr(msg), _T("Load error"), MB_OK | MB_ICONEXCLAMATION); } return 1; @@ -486,7 +486,7 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) { std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?"; - return MessageBox (NULL, utf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES; + return MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO | MB_ICONEXCLAMATION) == IDYES; } else { @@ -528,7 +528,7 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot msg += "\nContinue ?"; - return MessageBox (NULL, utf8ToTStr(msg), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES; + return MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't add tile"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES; } else { @@ -542,7 +542,7 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot { // Error: bitmap not in the absolute path.. TCHAR msg[512]; - _stprintf(msg, _T("The bitmap %s is not in the absolute path %s."), utf8ToTStr(name), utf8ToTStr(tileBank2.getAbsPath ())); + _stprintf(msg, _T("The bitmap %s is not in the absolute path %s."), nlUtf8ToTStr(name), nlUtf8ToTStr(tileBank2.getAbsPath())); MessageBox (NULL, msg, _T("Load error"), MB_OK|MB_ICONEXCLAMATION); } @@ -681,7 +681,7 @@ bool TileInfo::Load (int index, std::vector* Alpha) if (!_LoadBitmap(tileBank2.getAbsPath() + getRelativeFileName (CTile::diffuse, index), &BmpInfo, Bits, Alpha, 0)) { bRes=false; - MessageBox (NULL, utf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName (CTile::diffuse, index)), _T("Can't load file"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL, nlUtf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName(CTile::diffuse, index)), _T("Can't load file"), MB_OK | MB_ICONEXCLAMATION); } else loaded=1; @@ -691,7 +691,7 @@ bool TileInfo::Load (int index, std::vector* Alpha) if (!_LoadBitmap(tileBank2.getAbsPath() + getRelativeFileName (CTile::additive, index), &nightBmpInfo, nightBits, Alpha, 0)) { bRes=false; - MessageBox (NULL, utf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName (CTile::additive, index)), _T("Can't load file"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL, nlUtf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName(CTile::additive, index)), _T("Can't load file"), MB_OK | MB_ICONEXCLAMATION); } else nightLoaded=1; @@ -702,7 +702,7 @@ bool TileInfo::Load (int index, std::vector* Alpha) tileBank2.getTile (index)->getRotAlpha ())) { bRes=false; - MessageBox (NULL, utf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName (CTile::alpha, index)), _T("Can't load file"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL, nlUtf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName(CTile::alpha, index)), _T("Can't load file"), MB_OK | MB_ICONEXCLAMATION); } else alphaLoaded=1; @@ -1145,7 +1145,7 @@ void CTView::OnDropFiles(HDROP hDropInfo) case 0: { int index=InfoList.addTile128 (); - if (InfoList.setTile128 (index, tStrToUtf8(FileName), Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha))) + if (InfoList.setTile128 (index, NLMISC::tStrToUtf8(FileName), Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha))) { tilelist::iterator it = InfoList.GetLast(parent->m_128x128); it--; @@ -1159,7 +1159,7 @@ void CTView::OnDropFiles(HDROP hDropInfo) case 1: { int index=InfoList.addTile256 (); - if (InfoList.setTile256 (index, tStrToUtf8(FileName), Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha))) + if (InfoList.setTile256(index, NLMISC::tStrToUtf8(FileName), Texture == 1 ? CTile::diffuse : (Texture == 2 ? CTile::additive : CTile::alpha))) { tilelist::iterator it = InfoList.GetLast(parent->m_128x128); it--; @@ -1534,7 +1534,7 @@ LRESULT CTView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) else if ((id==ID_MENU_ADD)||(id==ID_MENU_REPLACE)) { _chdir (LastPath.c_str()); - CFileDialog load(true, NULL, utf8ToTStr(LastPath), OFN_ENABLESIZING | OFN_ALLOWMULTISELECT, _T("PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||"), NULL); + CFileDialog load(true, NULL, nlUtf8ToTStr(LastPath), OFN_ENABLESIZING | OFN_ALLOWMULTISELECT, _T("PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||"), NULL); load.m_ofn.lpstrFile = new TCHAR[10000]; // buffer contains filenames list load.m_ofn.lpstrFile[0] = 0; // with 10 KB we should be large enough... @@ -1551,12 +1551,12 @@ LRESULT CTView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { CString str = load.GetNextPathName(p); - LastPath = NLMISC::CFile::getPath(tStrToUtf8(str)); + LastPath = NLMISC::CFile::getPath(NLMISC::tStrToUtf8(str)); if (!str.IsEmpty()) { int index=0; - std::string pathname = tStrToUtf8(str); + std::string pathname = NLMISC::tStrToUtf8(str); // Add mode, to the end of the list if (id==ID_MENU_ADD) diff --git a/code/nel/tools/3d/tile_edit/choose_veget_set.cpp b/code/nel/tools/3d/tile_edit/choose_veget_set.cpp index e1ccf4f4f..a0256bd89 100644 --- a/code/nel/tools/3d/tile_edit/choose_veget_set.cpp +++ b/code/nel/tools/3d/tile_edit/choose_veget_set.cpp @@ -68,8 +68,8 @@ void CChooseVegetSet::OnBrowse() if (dialog.DoModal() == IDOK) { // Get the file name - FileName = tStrToUtf8(dialog.GetFileName ()); - Name.SetWindowText (utf8ToTStr(FileName)); + FileName = NLMISC::tStrToUtf8(dialog.GetFileName()); + Name.SetWindowText(nlUtf8ToTStr(FileName)); } } @@ -78,7 +78,7 @@ BOOL CChooseVegetSet::OnInitDialog() CDialog::OnInitDialog(); if (!FileName.empty()) - Name.SetWindowText (utf8ToTStr(FileName)); + Name.SetWindowText(nlUtf8ToTStr(FileName)); else Name.SetWindowText (_T("Browse...")); diff --git a/code/nel/tools/3d/zviewer/zviewer.cpp b/code/nel/tools/3d/zviewer/zviewer.cpp index fc8e00a4c..3af4df8d2 100644 --- a/code/nel/tools/3d/zviewer/zviewer.cpp +++ b/code/nel/tools/3d/zviewer/zviewer.cpp @@ -953,12 +953,11 @@ void initViewerConfig(const char * configFileName) MAIN \****************************************************************/ #ifdef NL_OS_WINDOWS -int WINAPI WinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPSTR cmdline, int /* nCmdShow */) -{ -#else -int main(int /* argc */, char ** /* argv */) +int APIENTRY nltWinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPTSTR /* lpCmdLine */, int /* nCmdShow */) +#else // NL_OS_WINDOWS +int nltmain(int /* argc */, NLMISC::tchar ** /* argv */) +#endif // NL_OS_WINDOWS { -#endif try { NLMISC::CApplicationContext myApplicationContext; diff --git a/code/nel/tools/logic/logic_editor_dll/Condition.cpp b/code/nel/tools/logic/logic_editor_dll/Condition.cpp index ba248a80d..8caa9d967 100644 --- a/code/nel/tools/logic/logic_editor_dll/Condition.cpp +++ b/code/nel/tools/logic/logic_editor_dll/Condition.cpp @@ -260,8 +260,8 @@ void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicC { logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::COMPARISON; - logicConditionNode->LogicBlock.ComparisonBlock.VariableName = tStrToUtf8(conditionNode->m_sVariableName); - logicConditionNode->LogicBlock.ComparisonBlock.Operator = tStrToUtf8(conditionNode->m_sOperator); + logicConditionNode->LogicBlock.ComparisonBlock.VariableName = NLMISC::tStrToUtf8(conditionNode->m_sVariableName); + logicConditionNode->LogicBlock.ComparisonBlock.Operator = NLMISC::tStrToUtf8(conditionNode->m_sOperator); logicConditionNode->LogicBlock.ComparisonBlock.Comparand = (sint64)conditionNode->m_dComparand; } break; @@ -270,7 +270,7 @@ void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicC { logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::SUB_CONDITION; - logicConditionNode->LogicBlock.SubCondition = tStrToUtf8(conditionNode->m_sConditionName); + logicConditionNode->LogicBlock.SubCondition = NLMISC::tStrToUtf8(conditionNode->m_sConditionName); } break; } @@ -298,7 +298,7 @@ void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicC void cConditionToCLogicCondition( CCondition& condition, CLogicCondition& logicCondition ) { // condition name - logicCondition.setName(tStrToUtf8(condition.m_sName)); + logicCondition.setName(NLMISC::tStrToUtf8(condition.m_sName)); // nodes POSITION pos; diff --git a/code/nel/tools/logic/logic_editor_dll/Counter.cpp b/code/nel/tools/logic/logic_editor_dll/Counter.cpp index 52537ea08..3a6afc9a3 100644 --- a/code/nel/tools/logic/logic_editor_dll/Counter.cpp +++ b/code/nel/tools/logic/logic_editor_dll/Counter.cpp @@ -45,7 +45,7 @@ CCounter::~CCounter() void cCounterToCLogicCounter( CCounter& counter, CLogicCounter& logicCounter ) { // counter name - logicCounter.setName(tStrToUtf8(counter.m_sName)); + logicCounter.setName(NLMISC::tStrToUtf8(counter.m_sName)); // running mode if( counter.m_sMode == "Shuttle" ) diff --git a/code/nel/tools/logic/logic_editor_dll/State.cpp b/code/nel/tools/logic/logic_editor_dll/State.cpp index fbfdebb2d..306128c1f 100644 --- a/code/nel/tools/logic/logic_editor_dll/State.cpp +++ b/code/nel/tools/logic/logic_editor_dll/State.cpp @@ -70,7 +70,7 @@ bool operator==( const CEvent &ev1, const CEvent &ev2) void cEventToCLogicEvent( CEvent& event, CLogicEvent& logicEvent ) { /// condition name - logicEvent.ConditionName = tStrToUtf8(event.m_sConditionName); + logicEvent.ConditionName = NLMISC::tStrToUtf8(event.m_sConditionName); /// event action logicEvent.EventAction.IsStateChange = !event.m_bActionIsMessage; @@ -78,18 +78,18 @@ void cEventToCLogicEvent( CEvent& event, CLogicEvent& logicEvent ) if( logicEvent.EventAction.IsStateChange ) { /// state name for state change - logicEvent.EventAction.StateChange = tStrToUtf8(event.m_sStateChange); + logicEvent.EventAction.StateChange = NLMISC::tStrToUtf8(event.m_sStateChange); } else { /// message destination - logicEvent.EventAction.EventMessage.Destination = tStrToUtf8(event.m_sMessageDestination); + logicEvent.EventAction.EventMessage.Destination = NLMISC::tStrToUtf8(event.m_sMessageDestination); /// message id logicEvent.EventAction.EventMessage.MessageId = "LOGIC"; //string( (LPCSTR)event.m_sMessageID ); //TEMP!!! /// message arguments - logicEvent.EventAction.EventMessage.Arguments = tStrToUtf8(event.m_sArguments); + logicEvent.EventAction.EventMessage.Arguments = NLMISC::tStrToUtf8(event.m_sArguments); } } // cEventToCLogicEvent // @@ -176,7 +176,7 @@ BOOL CState::removeEvent( CEvent *event) void cStateToCLogicState( CState& state, CLogicState& logicState ) { /// state name - logicState.setName(tStrToUtf8(state.m_sName)); + logicState.setName(NLMISC::tStrToUtf8(state.m_sName)); POSITION pos; for( pos = state.m_evEvents.GetHeadPosition(); pos != NULL; ) diff --git a/code/nel/tools/logic/logic_editor_dll/StdAfx.h b/code/nel/tools/logic/logic_editor_dll/StdAfx.h index 7aec1acb4..e173d7608 100644 --- a/code/nel/tools/logic/logic_editor_dll/StdAfx.h +++ b/code/nel/tools/logic/logic_editor_dll/StdAfx.h @@ -11,8 +11,13 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include // MFC core and standard components #include // MFC extensions diff --git a/code/nel/tools/logic/logic_editor_exe/logic_editor_exe.cpp b/code/nel/tools/logic/logic_editor_exe/logic_editor_exe.cpp index 4871eae79..912f4fc26 100644 --- a/code/nel/tools/logic/logic_editor_exe/logic_editor_exe.cpp +++ b/code/nel/tools/logic/logic_editor_exe/logic_editor_exe.cpp @@ -28,10 +28,7 @@ //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) +int APIENTRY _tWinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPTSTR /* lpCmdLine */, int /* nCmdShow */) { // Create a logic editor ILogicEditor * logicEditor = ILogicEditor::getInterface(); diff --git a/code/nel/tools/misc/branch_patcher/StdAfx.h b/code/nel/tools/misc/branch_patcher/StdAfx.h index b85f337a0..3cd3005ba 100644 --- a/code/nel/tools/misc/branch_patcher/StdAfx.h +++ b/code/nel/tools/misc/branch_patcher/StdAfx.h @@ -22,8 +22,13 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include // MFC core and standard components #include // MFC extensions diff --git a/code/nel/tools/misc/branch_patcher/branch_patcherDlg.cpp b/code/nel/tools/misc/branch_patcher/branch_patcherDlg.cpp index 134eddebf..d185e16b6 100644 --- a/code/nel/tools/misc/branch_patcher/branch_patcherDlg.cpp +++ b/code/nel/tools/misc/branch_patcher/branch_patcherDlg.cpp @@ -208,13 +208,13 @@ int CDirDialog::DoBrowse() } BROWSEINFO bInfo; + LPITEMIDLIST pidl; ZeroMemory((PVOID)&bInfo, sizeof(BROWSEINFO)); if (!m_strInitDir.IsEmpty()) { OLECHAR olePath[MAX_PATH]; - ULONG chEaten; - ULONG dwAttributes; + ULONG dwAttributes = 0; HRESULT hr; LPSHELLFOLDER pDesktopFolder; // // Get a pointer to the Desktop's IShellFolder interface. // @@ -236,7 +236,7 @@ int CDirDialog::DoBrowse() hr = pDesktopFolder->ParseDisplayName(NULL, NULL, olePath, - &chEaten, + NULL, &pidl, &dwAttributes); @@ -248,7 +248,6 @@ int CDirDialog::DoBrowse() } bInfo.pidlRoot = pidl; - } } @@ -257,8 +256,10 @@ int CDirDialog::DoBrowse() bInfo.lpszTitle = (m_strTitle.IsEmpty()) ? "Open" : m_strTitle; bInfo.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS; - PIDLIST_ABSOLUTE pidl = ::SHBrowseForFolder(&bInfo); - if (!pidl) return 0; + if ((pidl = ::SHBrowseForFolder(&bInfo)) == NULL) + { + return 0; + } m_strPath.ReleaseBuffer(); m_iImageIndex = bInfo.iImage; @@ -288,19 +289,26 @@ BOOL SendTextToClipboard(CString source) if (OpenClipboard(NULL)) { HGLOBAL clipbuffer; - char* buffer; + TCHAR* buffer; EmptyClipboard(); // Empty whatever's already there - clipbuffer = GlobalAlloc(GMEM_DDESHARE, source.GetLength() + 1); - buffer = (char*)GlobalLock(clipbuffer); - strcpy(buffer, LPCSTR(source)); - GlobalUnlock(clipbuffer); + clipbuffer = GlobalAlloc(GMEM_DDESHARE, ((SIZE_T)source.GetLength() + 1) * sizeof(TCHAR)); + if (clipbuffer) + { + buffer = (TCHAR*)GlobalLock(clipbuffer); + if (buffer) + { + _tcscpy(buffer, LPCTSTR(source)); + GlobalUnlock(clipbuffer); - SetClipboardData(CF_TEXT, clipbuffer); // Send the data + SetClipboardData(CF_TEXT, clipbuffer); // Send the data + CloseClipboard(); // VERY IMPORTANT + return TRUE; + } + } CloseClipboard(); // VERY IMPORTANT - return TRUE; } return FALSE; } @@ -326,11 +334,11 @@ void CBranch_patcherDlg::OnButtonPatch() CString text; text.Format(_T("Get diff from directory %s?\n\nCommand (choose No to copy it into the clipboard):\n%s"), m_SrcDir, diffCmdLine); int result; - if ((result = ::MessageBox(m_hWnd, text, "Confirmation", MB_YESNOCANCEL | MB_ICONQUESTION)) == IDYES) + if ((result = ::MessageBox(m_hWnd, text, _T("Confirmation"), MB_YESNOCANCEL | MB_ICONQUESTION)) == IDYES) { - if (_chdir(m_SrcDir) == 0) + if (_tchdir(m_SrcDir) == 0) { - system(diffCmdLine); + _tsystem(diffCmdLine); displayFile(TEMP_DIFF_FILE); SaveDiff = true; colorizeDiff(); @@ -461,11 +469,11 @@ void CBranch_patcherDlg::OnDoPatch() int result; if ((result = ::MessageBox(m_hWnd, text, _T("Confirmation"), MB_YESNOCANCEL | MB_ICONQUESTION)) == IDYES) { - if (_chdir(m_DestDir) == 0) + if (_tchdir(m_DestDir) == 0) { - system(patchCmdLine); - system(concatOutput); - system(delPatchErrors); + _tsystem(patchCmdLine); + _tsystem(concatOutput); + _tsystem(delPatchErrors); displayFile(PATCH_RESULT); SaveDiff = false; m_Display->LineScroll(0); diff --git a/code/nel/tools/misc/data_mirror/StdAfx.h b/code/nel/tools/misc/data_mirror/StdAfx.h index 697fe2127..92105ec09 100644 --- a/code/nel/tools/misc/data_mirror/StdAfx.h +++ b/code/nel/tools/misc/data_mirror/StdAfx.h @@ -11,8 +11,13 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include // MFC core and standard components #include // MFC extensions diff --git a/code/nel/tools/misc/data_mirror/data_mirror.cpp b/code/nel/tools/misc/data_mirror/data_mirror.cpp index 99a87f547..344ecc1ad 100644 --- a/code/nel/tools/misc/data_mirror/data_mirror.cpp +++ b/code/nel/tools/misc/data_mirror/data_mirror.cpp @@ -73,7 +73,7 @@ BOOL CData_mirrorApp::InitInstance() { // Get the module CConfigFile cf; - string exePath = GetCommandLine (); + string exePath = nlTStrToUtf8(GetCommandLineW()); if (exePath.size()>0) { if (exePath[0] == '\"') @@ -124,7 +124,7 @@ BOOL CData_mirrorApp::InitInstance() if ((sBinaryCompare == "true") || (sBinaryCompare=="1")) BinaryCompare = true; - CurrentDir = m_lpCmdLine; + CurrentDir = nlTStrToUtf8(m_lpCmdLine); // Remove if (CurrentDir.size ()>=2) { @@ -151,7 +151,7 @@ BOOL CData_mirrorApp::InitInstance() } else { - MessageBox (NULL, (CurrentDir+" is not a directory nor a file.").c_str (), "NeL Data Mirror", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, nlUtf8ToTStr(CurrentDir+" is not a directory nor a file."), _T("NeL Data Mirror"), MB_OK|MB_ICONEXCLAMATION); return FALSE; } @@ -168,8 +168,8 @@ BOOL CData_mirrorApp::InitInstance() } else { - MessageBox (NULL, (CurrentDir+" is not a sub directory of "+MainDirectory+" or "+MirrorDirectory).c_str (), - "NeL Data Mirror", MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL, nlUtf8ToTStr(CurrentDir + " is not a sub directory of " + MainDirectory + " or " + MirrorDirectory), + _T("NeL Data Mirror"), MB_OK|MB_ICONEXCLAMATION); return FALSE; } } @@ -200,7 +200,7 @@ BOOL CData_mirrorApp::InitInstance() } catch (const Exception &e) { - MessageBox (NULL, e.what (), "NeL Data Mirror", MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL, nlUtf8ToTStr(e.what()), _T("NeL Data Mirror"), MB_OK | MB_ICONEXCLAMATION); } CData_mirrorDlg dlg; @@ -227,19 +227,21 @@ bool RegisterDirectoryAppCommand (const char *appName, const char *command, cons { // Create the app key HKEY hKey; - if (RegCreateKey (HKEY_CLASSES_ROOT, "Directory", &hKey) == ERROR_SUCCESS) + if (RegCreateKey (HKEY_CLASSES_ROOT, _T("Directory"), &hKey) == ERROR_SUCCESS) { // Create the icon char tmp[512]; smprintf (tmp, 512, "shell\\%s", appName); - if (RegCreateKey (hKey, tmp, &hKey) == ERROR_SUCCESS) + if (RegCreateKey(hKey, nlUtf8ToTStr(tmp), &hKey) == ERROR_SUCCESS) { // Set the description - RegSetValue (hKey, "", REG_SZ, command, (DWORD)strlen (command)); - if (RegCreateKey (hKey, "command", &hKey) == ERROR_SUCCESS) + tstring tcommand = utf8ToTStr(command); + RegSetValue(hKey, _T(""), REG_SZ, tcommand.c_str(), (tcommand.size() + 1) * sizeof(TCHAR)); + if (RegCreateKey (hKey, _T("command"), &hKey) == ERROR_SUCCESS) { // Set the description - RegSetValue (hKey, "", REG_SZ, app, (DWORD)strlen (app)); + tstring tapp = utf8ToTStr(app); + RegSetValue(hKey, _T(""), REG_SZ, tapp.c_str(), (tapp.size() + 1) * sizeof(TCHAR)); return true; } } diff --git a/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp b/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp index 4fb771d86..602e805b2 100644 --- a/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp +++ b/code/nel/tools/misc/data_mirror/data_mirrorDlg.cpp @@ -280,8 +280,8 @@ void CData_mirrorDlg::updateList () { // Add the items const CEntryFile &entry = *ite; - uint nItem = List.InsertItem (0, utf8ToTStr(entry.Strings[CEntryFile::Path]), entry.Image); - List.SetItemData (nItem, DWORD(new std::list::iterator (ite))); + uint nItem = List.InsertItem(0, nlUtf8ToTStr(entry.Strings[CEntryFile::Path]), entry.Image); + List.SetItemData (nItem, DWORD_PTR(new std::list::iterator (ite))); // Sub string subString = 1; @@ -289,25 +289,25 @@ void CData_mirrorDlg::updateList () // Add the sizes if (ModifiedFilter != Removed) { - List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::NewSize])); + List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::NewSize])); } if (ModifiedFilter != Added) { - List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::OldSize])); + List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::OldSize])); } // Add the dates if (ModifiedFilter != Removed) { - List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::NewDate])); + List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::NewDate])); } if (ModifiedFilter != Added) { - List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::OldDate])); + List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::OldDate])); } // Add the type - List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::Type])); + List.SetItemText(nItem, subString++, nlUtf8ToTStr(entry.Strings[CEntryFile::Type])); // Next item ite++; @@ -410,7 +410,7 @@ void createDirectory (const string &dir) bool setFileTime(const std::string &filename, const FILETIME &result) { - HANDLE handle = CreateFile (utf8ToTStr(filename), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE handle = CreateFile(nlUtf8ToTStr(filename), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (handle) { SetFileTime (handle, NULL, NULL, &result); @@ -450,18 +450,18 @@ void CData_mirrorDlg::OnOK() { // Copy it const string &itemText = modifiedList[i]; - string source = MainDirectory+itemText; - string dest = MirrorDirectory+itemText; - + string source = MainDirectory + itemText; + string dest = MirrorDirectory + itemText; + progress.DisplayString = "Copy \"" + source + "\" to \"" + dest + "\""; - progress.progress (float(currentFile++)/(float(totalCount))); + progress.progress(float(currentFile++) / (float(totalCount))); - string directory = NLMISC::CFile::getPath (dest); - createDirectory (directory.c_str ()); - if (!CopyFile (source.c_str (), dest.c_str (), FALSE)) + string directory = NLMISC::CFile::getPath(dest); + createDirectory(directory.c_str()); + if (!CopyFile(nlUtf8ToTStr(source), nlUtf8ToTStr(dest), FALSE)) { - MessageBox (("Can't copy file "+source+" in file "+dest).c_str (), _T("NeL Data Mirror"), - MB_OK|MB_ICONEXCLAMATION); + MessageBox(nlUtf8ToTStr("Can't copy file " + source + " in file " + dest), _T("NeL Data Mirror"), + MB_OK | MB_ICONEXCLAMATION); success = false; } else @@ -497,9 +497,9 @@ void CData_mirrorDlg::OnOK() progress.progress (float(currentFile++)/(float(totalCount))); createDirectory (directory.c_str ()); - if (!CopyFile (source.c_str (), dest.c_str (), FALSE)) + if (!CopyFile(nlUtf8ToTStr(source), nlUtf8ToTStr(dest), FALSE)) { - MessageBox (("Can't copy file "+source+" in file "+dest).c_str (), _T("NeL Data Mirror"), + MessageBox(nlUtf8ToTStr("Can't copy file " + source + " in file " + dest), _T("NeL Data Mirror"), MB_OK|MB_ICONEXCLAMATION); success = false; } @@ -532,9 +532,9 @@ void CData_mirrorDlg::OnOK() progress.DisplayString = "Delete \"" + dest + "\""; progress.progress (float(currentFile++)/(float(totalCount))); - if (!DeleteFile (dest.c_str ())) + if (!DeleteFile(nlUtf8ToTStr(dest))) { - MessageBox (("Can't delete the file "+dest).c_str (), _T("NeL Data Mirror"), + MessageBox(nlUtf8ToTStr("Can't delete the file " + dest), _T("NeL Data Mirror"), MB_OK|MB_ICONEXCLAMATION); success = false; } @@ -596,7 +596,7 @@ void CData_mirrorDlg::OnSize(UINT nType, int cx, int cy) bool getFileTime (const std::string &filename, FILETIME &result) { - HANDLE handle = CreateFile (utf8ToTStr(filename), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE handle = CreateFile(nlUtf8ToTStr(filename), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (handle) { FILETIME res0; @@ -700,7 +700,7 @@ void CData_mirrorDlg::buildSourceFiles () { FILETIME time; getFileTime (mainFile, time); - addEntry (Added, str, time, time); + addEntry (Added, str.c_str(), time, time); } } } @@ -812,7 +812,7 @@ void CData_mirrorDlg::addEntry (uint where, const char *filename, FILETIME &newD // Get the image SHFILEINFO sfi; TCHAR winName[512]; - _tcscpy (winName, utf8ToTStr(aFilename)); + _tcscpy(winName, nlUtf8ToTStr(aFilename)); TCHAR *ptr = winName; while (*ptr) { diff --git a/code/nel/tools/misc/log_analyser/PlugInSelector.cpp b/code/nel/tools/misc/log_analyser/PlugInSelector.cpp index 120ceacaf..abc5ec03c 100644 --- a/code/nel/tools/misc/log_analyser/PlugInSelector.cpp +++ b/code/nel/tools/misc/log_analyser/PlugInSelector.cpp @@ -147,8 +147,8 @@ void CPlugInSelector::OnSelchangeList1() AfxMessageBox( _T("Can't find function getInfoString in dll") ); return; } - GetDlgItem( IDC_GROUP_INFO )->SetWindowText( utf8ToTStr(getFilename(tStrToUtf8(dllName))) ); - GetDlgItem( IDC_PLUGIN_INFO )->SetWindowText(utf8ToTStr(infoFunc()) ); + GetDlgItem(IDC_GROUP_INFO)->SetWindowText(nlUtf8ToTStr(getFilename(NLMISC::tStrToUtf8(dllName)))); + GetDlgItem(IDC_PLUGIN_INFO)->SetWindowText(nlUtf8ToTStr(infoFunc())); // Prepare analyse func AnalyseFunc = (TAnalyseFunc)GetProcAddress( LibInst, "doAnalyse" ); diff --git a/code/nel/tools/misc/log_analyser/StdAfx.h b/code/nel/tools/misc/log_analyser/StdAfx.h index bd3d88df1..e7c2ae30d 100644 --- a/code/nel/tools/misc/log_analyser/StdAfx.h +++ b/code/nel/tools/misc/log_analyser/StdAfx.h @@ -27,8 +27,13 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include // MFC core and standard components #include // MFC extensions diff --git a/code/nel/tools/misc/log_analyser/ViewDialog.cpp b/code/nel/tools/misc/log_analyser/ViewDialog.cpp index cdc38ed08..5710795bf 100644 --- a/code/nel/tools/misc/log_analyser/ViewDialog.cpp +++ b/code/nel/tools/misc/log_analyser/ViewDialog.cpp @@ -359,7 +359,7 @@ void CViewDialog::getBookmarksAbsoluteLines( vector& bookmarksAbsoluteLine NLMISC::CIFile ifs; - if (ifs.open(tStrToUtf8(filename))) + if (ifs.open(NLMISC::tStrToUtf8(filename))) { char line [1024]; @@ -370,7 +370,7 @@ void CViewDialog::getBookmarksAbsoluteLines( vector& bookmarksAbsoluteLine if ( SessionDatePassed ) { // Stop if the session is finished - if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, tStrToUtf8(LogDateString).c_str())) ) + if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, nlTStrToUtf8(LogDateString))) ) { return; } @@ -394,7 +394,7 @@ void CViewDialog::getBookmarksAbsoluteLines( vector& bookmarksAbsoluteLine else { // Look for the session beginning - if ( strstr( line, tStrToUtf8(LogSessionStartDate).c_str()) != NULL ) + if ( strstr( line, nlTStrToUtf8(LogSessionStartDate)) != NULL ) { SessionDatePassed = true; } @@ -466,7 +466,7 @@ std::string CViewDialog::corruptedLinesString( const std::vector& vector::const_iterator ivc; for ( ivc=corruptedLines.begin(); ivc!=corruptedLines.end(); ++ivc ) { - res += NLMISC::toString("\r\n line %u : %s...", *ivc, tStrToUtf8(Buffer[*ivc].Left(20)).c_str()); + res += NLMISC::toString("\r\n line %u : %s...", *ivc, NLMISC::tStrToUtf8(Buffer[*ivc].Left(20)).c_str()); } HasCorruptedLines = true; } @@ -484,7 +484,7 @@ void CViewDialog::loadFileOrSeries( const vector& bookmarksAbsoluteLines ) if ( LogSessionStartDate.IsEmpty() ) actualFilenames += ":\r\n"; else - actualFilenames += " for Session of " + tStrToUtf8(LogSessionStartDate) + ":\r\n"; + actualFilenames += " for Session of " + NLMISC::tStrToUtf8(LogSessionStartDate) + ":\r\n"; bool corruptionDetectionEnabled = (((CButton*)(((CLog_analyserDlg*)GetParent())->GetDlgItem( IDC_DetectCorruptedLines )))->GetCheck() == 1); HasCorruptedLines = false; vector corruptedLines; @@ -505,9 +505,9 @@ void CViewDialog::loadFileOrSeries( const vector& bookmarksAbsoluteLines ) if ( SessionDatePassed ) { // Stop if the session is finished - if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, LogDateString )) ) + if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, nlTStrToUtf8(LogDateString) )) ) { - actualFilenames += string(filename) + corruptedLinesString( corruptedLines ) + "\r\n"; + actualFilenames += NLMISC::tStrToUtf8(filename) + corruptedLinesString(corruptedLines) + "\r\n"; corruptedLines.clear(); goto endOfLoading; } @@ -540,7 +540,7 @@ void CViewDialog::loadFileOrSeries( const vector& bookmarksAbsoluteLines ) else { // Look for the session beginning - if ( strstr( line, LogSessionStartDate ) != NULL ) + if ( strstr( line, nlTStrToUtf8(LogSessionStartDate) ) != NULL ) { SessionDatePassed = true; } @@ -549,15 +549,15 @@ void CViewDialog::loadFileOrSeries( const vector& bookmarksAbsoluteLines ) if ( SessionDatePassed ) { - actualFilenames += string(filename) + corruptedLinesString( corruptedLines ) + "\r\n"; + actualFilenames += NLMISC::tStrToUtf8(filename) + corruptedLinesString(corruptedLines) + "\r\n"; corruptedLines.clear(); } } else { CString s; - s.Format( "\r\n", filename ); - actualFilenames += s; + s.Format(_T( "\r\n"), filename); + actualFilenames += NLMISC::tStrToUtf8(s); } } @@ -598,7 +598,7 @@ bool CViewDialog::passFilter( const char *text, const std::vector& pos // 1. Positive filter for ( ilf=posFilter.begin(); ilf!=posFilter.end(); ++ilf ) { - found = ( strstr( text, *ilf ) != NULL ); + found = (strstr(text, nlTStrToUtf8(*ilf)) != NULL); if ( found ) { yes = true; // positive filter passed (no need to check another one) @@ -614,7 +614,7 @@ bool CViewDialog::passFilter( const char *text, const std::vector& pos // 2. Negative filter for ( ilf=negFilter.begin(); ilf!=negFilter.end(); ++ilf ) { - found = ( strstr( text, *ilf ) != NULL ); + found = (strstr(text, nlTStrToUtf8(*ilf)) != NULL); if ( found ) { return false; // negative filter not passed (no need to check another one) @@ -665,14 +665,15 @@ void CViewDialog::reloadTrace() if ( SessionDatePassed ) { // Stop if the session is finished - if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, LogDateString )) ) + if ((!LogSessionStartDate.IsEmpty()) && (strstr(line, nlTStrToUtf8(LogDateString)))) break; // Read if it's a TRACE char *pc = strstr( line, "TRACE" ); if ( pc != NULL ) { - if ( PosFilter.empty() || (strncmp( pc-PosFilter[0].GetLength(), PosFilter[0], PosFilter[0].GetLength() ) == 0) ) + std::string tposFilter0 = NLMISC::tStrToUtf8(PosFilter[0]); + if (PosFilter.empty() || (strncmp(pc - PosFilter[0].GetLength(), tposFilter0.c_str(), tposFilter0.size()) == 0)) { ((CLog_analyserDlg*)GetParent())->insertTraceLine( Index, pc+6 ); } @@ -681,7 +682,7 @@ void CViewDialog::reloadTrace() else { // Look for the session beginning - if ( strstr( line, LogSessionStartDate ) != NULL ) + if (strstr(line, nlTStrToUtf8(LogSessionStartDate)) != NULL) { SessionDatePassed = true; } @@ -974,7 +975,7 @@ BOOL CViewDialog::OnInitDialog() CDialog::OnInitDialog(); m_ListCtrl.GetHeaderCtrl()->ModifyStyle( 0, HDS_HIDDEN ); - m_ListCtrl.InsertColumn( 0, "" ); + m_ListCtrl.InsertColumn(0, _T("")); m_ListCtrl.setViewDialog( this ); m_ListCtrl.initIt(); @@ -998,11 +999,11 @@ COLORREF CViewDialog::getTextColorForLine( int index, bool selected ) return ::GetSysColor(COLOR_HIGHLIGHTTEXT); else { - if ( Buffer[index].Find( "DBG" ) != -1 ) + if ( Buffer[index].Find( _T("DBG") ) != -1 ) return RGB(0x80,0x80,0x80); - else if ( Buffer[index].Find( "WRN" ) != -1 ) + else if ( Buffer[index].Find( _T("WRN") ) != -1 ) return RGB(0x80,0,0); - else if ( (Buffer[index].Find( "ERR" ) != -1) || (Buffer[index].Find( "AST" ) != -1) ) + else if ( (Buffer[index].Find( _T("ERR") ) != -1) || (Buffer[index].Find( _T("AST") ) != -1) ) return RGB(0xFF,0,0); else // INF and others return RGB(0,0,0); @@ -1038,7 +1039,7 @@ void formatLogStr( CString& str, bool displayHeaders ) { if ( ! displayHeaders ) { - int pos = str.Find( " : " ); + int pos = str.Find( _T(" : ") ); if ( pos != -1 ) { str.Delete( 0, pos + 3 ); @@ -1156,7 +1157,7 @@ afx_msg LRESULT CViewDialog::OnFindReplace(WPARAM wParam, LPARAM lParam) //BeginFindIndex = getSelectionIndex()+1; //displayString(); CString s; - s.Format( "Found '%s' (downwards from line %d) at line %d:\r\n%s", FindStr, BeginFindIndex, lineIndex, Buffer[lineIndex] ); + s.Format( _T("Found '%s' (downwards from line %d) at line %d:\r\n%s"), FindStr, BeginFindIndex, lineIndex, Buffer[lineIndex] ); ((CLog_analyserDlg*)GetParent())->displayCurrentLine( s ); ((CLog_analyserDlg*)GetParent())->selectText( 1, matchPos, FindStr.GetLength() ); //BeginFindIndex = lineIndex+1; @@ -1176,7 +1177,7 @@ afx_msg LRESULT CViewDialog::OnFindReplace(WPARAM wParam, LPARAM lParam) //BeginFindIndex = getSelectionIndex()-1; //displayString(); CString s; - s.Format( "Found '%s' (upwards from line %d) at line %d:\r\n%s", FindStr, BeginFindIndex, lineIndex, Buffer[lineIndex] ); + s.Format( _T("Found '%s' (upwards from line %d) at line %d:\r\n%s"), FindStr, BeginFindIndex, lineIndex, Buffer[lineIndex] ); ((CLog_analyserDlg*)GetParent())->displayCurrentLine( s ); ((CLog_analyserDlg*)GetParent())->selectText( 1, matchPos, FindStr.GetLength() ); //BeginFindIndex = lineIndex-1; @@ -1185,7 +1186,7 @@ afx_msg LRESULT CViewDialog::OnFindReplace(WPARAM wParam, LPARAM lParam) } } CString s; - s.Format( "Not found (%s from line %d)", FindDialog->SearchDown() ? "downwards" : "upwards", BeginFindIndex ); + s.Format( _T("Not found (%s from line %d)"), FindDialog->SearchDown() ? _T("downwards") : _T("upwards"), BeginFindIndex ); AfxMessageBox( s ); //BeginFindIndex = 0; return 0; diff --git a/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp b/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp index e23fd2bd9..afc73018f 100644 --- a/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp +++ b/code/nel/tools/misc/log_analyser/log_analyserDlg.cpp @@ -59,7 +59,7 @@ afx_msg void CLAEdit::OnKeyDown( UINT nChar, UINT nRepCnt, UINT nFlags ) int start, end; GetSel( start, end ); str = str.Mid( start, end-start ); - int lineNum = atoi( str ); + int lineNum = atoi(nlTStrToUtf8(str)); if ( ! ((lineNum != 0) || (str == "0")) ) break; @@ -203,7 +203,7 @@ BOOL CLog_analyserDlg::OnInitDialog() SetIcon(m_hIcon, FALSE); // Set small icon // Add files given in command-line - string cmdLine = string(theApp.m_lpCmdLine); + string cmdLine = NLMISC::tStrToUtf8(theApp.m_lpCmdLine); vector v; /*int pos = cmdLine.find_first_of(' '); // TODO: handle "" with blank characters while ( pos != string::npos ) @@ -285,9 +285,9 @@ void CLog_analyserDlg::OnDropFiles( HDROP hDropInfo ) DragQueryFile( hDropInfo, i, filename.GetBufferSetLength( 200 ), 200 ); // Plug-in DLL or log file - if ( getFileExtension( string(filename) ) == "dll" ) + if ( getFileExtension( NLMISC::tStrToUtf8(filename) ) == "dll" ) { - if ( addPlugIn( string(filename) ) ) + if (addPlugIn(NLMISC::tStrToUtf8(filename))) AfxMessageBox( CString("Plugin added: ") + filename ); else AfxMessageBox( CString("Plugin already registered: ") + filename ); @@ -310,16 +310,16 @@ bool CLog_analyserDlg::addPlugIn( const std::string& dllName ) { int i = 0; char pluginN [10] = "Plugin0"; - CString pn = theApp.GetProfileString( _T(""), _T(pluginN) ); + CString pn = theApp.GetProfileString(_T(""), nlUtf8ToTStr(pluginN)); while ( ! pn.IsEmpty() ) { - if ( string(pn) == dllName ) + if (NLMISC::tStrToUtf8(pn) == dllName) return false; // already registered ++i; smprintf( pluginN, 10, "Plugin%d", i ); - pn = theApp.GetProfileString( _T(""), _T(pluginN) ); + pn = theApp.GetProfileString(_T(""), nlUtf8ToTStr(pluginN)); } - theApp.WriteProfileString( _T(""), _T(pluginN), dllName.c_str() ); + theApp.WriteProfileString(_T(""), nlUtf8ToTStr(pluginN), nlUtf8ToTStr(dllName)); Plugins.push_back( dllName.c_str() ); return true; } @@ -342,7 +342,7 @@ void CLog_analyserDlg::loadPluginConfiguration() Plugins.push_back( pn ); ++i; smprintf( pluginN, 10, "Plugin%d", i ); - pn = theApp.GetProfileString( _T(""), _T(pluginN) ); + pn = theApp.GetProfileString( _T(""), nlUtf8ToTStr(pluginN) ); } } @@ -373,7 +373,7 @@ void CLog_analyserDlg::addView( std::vector& pathNames ) { if ( pathNames.empty() ) { - CFileDialog openDialog( true, NULL, "log.log", OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT, "Log files (*.log)|*.log|All files|*.*||", this ); + CFileDialog openDialog( true, NULL, _T("log.log"), OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT, _T("Log files (*.log)|*.log|All files|*.*||"), this ); CString filenameList; openDialog.m_ofn.lpstrFile = filenameList.GetBufferSetLength( 8192 ); openDialog.m_ofn.nMaxFile = 8192; @@ -402,7 +402,7 @@ void CLog_analyserDlg::addView( std::vector& pathNames ) for ( i=0; i!=pathNames.size(); ++i ) { // Ensure that a log file without number comes *after* the ones with a number - string name = string(pathNames[i]); + string name = NLMISC::tStrToUtf8(pathNames[i]); string::size_type dotpos = name.find_last_of('.'); if ( (dotpos!=string::npos) && (dotpos > 2) ) { @@ -417,7 +417,7 @@ void CLog_analyserDlg::addView( std::vector& pathNames ) for ( i=0; i!=pathNames.size(); ++i ) { // Set the original names back - string name = pathNames[i]; + string name = NLMISC::tStrToUtf8(pathNames[i]); string::size_type tokenpos = name.find( "ZZZ." ); if ( tokenpos != string::npos ) { @@ -434,7 +434,7 @@ void CLog_analyserDlg::addView( std::vector& pathNames ) else names += "Loading files:\r\n"; for ( i=0; i!=pathNames.size(); ++i ) - names += string(pathNames[i]) + "\r\n"; + names += NLMISC::tStrToUtf8(pathNames[i]) + "\r\n"; displayCurrentLine( names.c_str() ); // Add view and browse sessions if needed @@ -457,7 +457,7 @@ void CLog_analyserDlg::addView( std::vector& pathNames ) */ void CLog_analyserDlg::OnAddtraceview() { - CFileDialog openDialog( true, NULL, "log.log", OFN_HIDEREADONLY, "Log files (*.log)|*.log|All files|*.*||", this ); + CFileDialog openDialog( true, NULL, _T("log.log"), OFN_HIDEREADONLY, _T("Log files (*.log)|*.log|All files|*.*||"), this ); if ( openDialog.DoModal() == IDOK ) { vector pathNames; @@ -534,7 +534,7 @@ CViewDialog *CLog_analyserDlg::onAddCommon( const vector& filenames ) while ( ! ifs.eof() ) { ifs.getline( line, 1024 ); - if ( strstr( line, LogDateString ) != NULL ) + if ( strstr( line, nlTStrToUtf8(LogDateString) ) != NULL ) { LogSessionsDialog.addLogSession( line ); ++nbsessions; @@ -554,19 +554,19 @@ CViewDialog *CLog_analyserDlg::onAddCommon( const vector& filenames ) case 1: { // 1 'Log Starting' => no choice if it's at the beginning (1st line, or 2nd line with blank 1st) - ifstream ifs( view->Filenames[0] ); // 1 session => ! Filename.empty() - char line [1024]; - ifs.getline( line, 1024 ); - if ( ! ifs.fail() ) + ifstream ifs(view->Filenames[0]); // 1 session => ! Filename.empty() + char line[1024]; + ifs.getline(line, 1024); + if (!ifs.fail()) { - if ( strstr( line, LogDateString ) != NULL ) + if (strstr(line, nlTStrToUtf8(LogDateString)) != NULL) needToChooseSession = false; else if ( string(line).empty() ) { - if ( ! ifs.fail() ) + if (!ifs.fail()) { - ifs.getline( line, 1024 ); - needToChooseSession = (strstr( line, LogDateString ) == NULL); + ifs.getline(line, 1024); + needToChooseSession = (strstr(line, nlTStrToUtf8(LogDateString)) == NULL); } else needToChooseSession = true; @@ -575,7 +575,7 @@ CViewDialog *CLog_analyserDlg::onAddCommon( const vector& filenames ) else needToChooseSession = true; } - break; + break; default: // Several 'Log Starting' => always choice needToChooseSession = true; @@ -620,7 +620,7 @@ void CLog_analyserDlg::getLogSeries( const CString& filenameStr, std::vector. #include +#include + #include #include using namespace std; - -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) +int APIENTRY _tWinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPTSTR lpCmdLine, int /* nCmdShow */) { char *filename; if (filename = strstr (lpCmdLine, "-f ")) diff --git a/code/nel/tools/misc/multi_cd_setup_fix/multi_cd_setup_fix.cpp b/code/nel/tools/misc/multi_cd_setup_fix/multi_cd_setup_fix.cpp index f7ef1a9fc..ee9b4b9fe 100644 --- a/code/nel/tools/misc/multi_cd_setup_fix/multi_cd_setup_fix.cpp +++ b/code/nel/tools/misc/multi_cd_setup_fix/multi_cd_setup_fix.cpp @@ -15,6 +15,7 @@ // along with this program. If not, see . #include +#include #include #include "resource.h" @@ -39,11 +40,7 @@ void pump () DispatchMessage(&msg); } } - -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) +int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPTSTR /* lpCmdLine */, int /* nCmdShow */) { // Windows HWND hwnd = CreateDialog (hInstance, MAKEINTRESOURCE(IDD_WAIT), NULL, MyDialogProc); @@ -57,68 +54,68 @@ int APIENTRY WinMain(HINSTANCE hInstance, pump (); // Get the temp directory - char tempPath[1024]; + TCHAR tempPath[1024]; if (GetTempPath(1024, tempPath)) { - char pathToDelete[1024]; - strcpy (pathToDelete, tempPath); - strcat (pathToDelete, "Ryzom"); + TCHAR pathToDelete[1024]; + _tcscpy (pathToDelete, tempPath); + _tcscat (pathToDelete, _T("Ryzom")); CreateDirectory(tempPath, NULL); - strcat (tempPath, "Ryzom\\"); + _tcscat (tempPath, _T("Ryzom\\")); CreateDirectory(tempPath, NULL); // Copy the files pump (); // Setup.dat - char setupFile[1024]; - strcpy (setupFile, tempPath); - strcat (setupFile, "setup.exe"); + TCHAR setupFile[1024]; + _tcscpy (setupFile, tempPath); + _tcscat(setupFile, _T("setup.exe")); SetFileAttributes(setupFile, GetFileAttributes(setupFile)&~FILE_ATTRIBUTE_READONLY); BOOL deleted = DeleteFile (setupFile); - if (!CopyFile ("setup.dat", setupFile, FALSE) && deleted) - MessageBox (NULL, "Not enough disk space", "Setup", MB_OK|MB_ICONERROR); + if (!CopyFile (_T("setup.dat"), setupFile, FALSE) && deleted) + MessageBox (NULL, _T("Not enough disk space"), _T("Setup"), MB_OK|MB_ICONERROR); SetFileAttributes(setupFile, GetFileAttributes(setupFile)&~FILE_ATTRIBUTE_READONLY); pump (); // Ryzom.msi - char msiFile[1024]; - strcpy (msiFile, tempPath); - strcat (msiFile, "Ryzom.msi"); + TCHAR msiFile[1024]; + _tcscpy(msiFile, tempPath); + _tcscat(msiFile, _T("Ryzom.msi")); SetFileAttributes(msiFile, GetFileAttributes(msiFile)&~FILE_ATTRIBUTE_READONLY); deleted = DeleteFile (msiFile); - if (!CopyFile ("Ryzom.msi", msiFile, FALSE) && deleted) - MessageBox (NULL, "Not enough disk space", "Setup", MB_OK|MB_ICONERROR); + if (!CopyFile (_T("Ryzom.msi"), msiFile, FALSE) && deleted) + MessageBox (NULL, _T("Not enough disk space"), _T("Setup"), MB_OK|MB_ICONERROR); SetFileAttributes(msiFile, GetFileAttributes(msiFile)&~FILE_ATTRIBUTE_READONLY); pump (); // Generate the remove bat file - char batFile[1024]; - strcpy (batFile, tempPath); - strcat (batFile, "remove.bat"); - FILE *file = fopen (batFile, "w"); - fprintf (file, "@echo off\nrmdir /S /Q \"%s\" > NUL\ndeltree /Y \"%s\" > NUL\n", pathToDelete, pathToDelete); + TCHAR batFile[1024]; + _tcscpy (batFile, tempPath); + _tcscat(batFile, _T("remove.bat")); + FILE *file = _tfopen (batFile, _T("w")); + _ftprintf (file, _T("@echo off\nrmdir /S /Q \"%s\" > NUL\ndeltree /Y \"%s\" > NUL\n"), pathToDelete, pathToDelete); fclose (file); // Register the remove bat file HKEY hKey; - RegCreateKey (HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Runonce", &hKey); - char batFileReg[1024]; - sprintf (batFileReg, "\"%s\"", batFile); - RegSetValueEx(hKey, "RyzomSetupClean", 0, REG_SZ, (const unsigned char*)batFileReg, (DWORD)strlen (batFileReg)+1); + RegCreateKey (HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Runonce"), &hKey); + TCHAR batFileReg[1024]; + _stprintf (batFileReg, _T("\"%s\""), batFile); + RegSetValueEx(hKey, _T("RyzomSetupClean"), 0, REG_SZ, (const unsigned char *)batFileReg, (DWORD)(_tcslen(batFileReg) + 1) * sizeof(TCHAR)); pump (); // Get the current path - char currentPath[1024]; + TCHAR currentPath[1024]; GetCurrentDirectory (1024, currentPath); - if (currentPath[strlen(currentPath)-1] == '\\') - currentPath[strlen(currentPath)-1] = 0; + if (currentPath[_tcslen(currentPath) - 1] == '\\') + currentPath[_tcslen(currentPath) - 1] = 0; pump (); // Build the command line : /z"f:\" - char option[1024]; - sprintf (option, "\"%s\" /z\"%s\"", setupFile, currentPath); + TCHAR option[1024]; + _stprintf(option, _T("\"%s\" /z\"%s\""), setupFile, currentPath); pump (); // Execute the setup diff --git a/code/nel/tools/misc/words_dic/StdAfx.h b/code/nel/tools/misc/words_dic/StdAfx.h index 9290bdfce..7f52b209c 100644 --- a/code/nel/tools/misc/words_dic/StdAfx.h +++ b/code/nel/tools/misc/words_dic/StdAfx.h @@ -22,8 +22,13 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include // MFC core and standard components #include // MFC extensions diff --git a/code/nel/tools/misc/words_dic/words_dicDlg.cpp b/code/nel/tools/misc/words_dic/words_dicDlg.cpp index f161e22e5..cac6c20b2 100644 --- a/code/nel/tools/misc/words_dic/words_dicDlg.cpp +++ b/code/nel/tools/misc/words_dic/words_dicDlg.cpp @@ -176,7 +176,7 @@ void CWords_dicDlg::lookUp( const CString& inputStr ) const CSString& res = (*ivs); if ( showAll || (res.find( "lvl" ) == string::npos) ) { - m_Results.AddString( utf8ToTStr(res) ); + m_Results.AddString(nlUtf8ToTStr(res)); } else lvlRemoved = true; @@ -234,7 +234,7 @@ void CWords_dicDlg::OnFileList() const vector& fileList = Dico.getFileList(); for ( vector::const_iterator ifl=fileList.begin(); ifl!=fileList.end(); ++ifl ) { - m_Results.AddString( utf8ToTStr(*ifl) ); + m_Results.AddString( nlUtf8ToTStr(*ifl) ); } } diff --git a/code/nel/tools/nel_unit_test/ut_misc_string_common.h b/code/nel/tools/nel_unit_test/ut_misc_string_common.h index 623d2d39e..b7c133e17 100644 --- a/code/nel/tools/nel_unit_test/ut_misc_string_common.h +++ b/code/nel/tools/nel_unit_test/ut_misc_string_common.h @@ -707,6 +707,12 @@ struct CUTMiscStringCommon : public Test::Suite ret = NLMISC::fromString("yes", val); TEST_ASSERT(ret && val); + ret = NLMISC::fromString("YES", val); + TEST_ASSERT(ret && val); + + ret = NLMISC::fromString("True", val); + TEST_ASSERT(ret && val); + // false values ret = NLMISC::fromString("0", val); TEST_ASSERT(ret && !val); @@ -730,14 +736,17 @@ struct CUTMiscStringCommon : public Test::Suite TEST_ASSERT(ret && !val); // wrong values - ret = NLMISC::fromString("YES", val); - TEST_ASSERT(!ret && !val); - ret = NLMISC::fromString("foo", val); TEST_ASSERT(!ret && !val); ret = NLMISC::fromString("a", val); TEST_ASSERT(!ret && !val); + + ret = NLMISC::fromString("Yesss", val); + TEST_ASSERT(!ret && !val); + + ret = NLMISC::fromString("nope", val); + TEST_ASSERT(!ret && !val); } }; diff --git a/code/ryzom/client/src/login_xdelta.cpp b/code/ryzom/client/src/login_xdelta.cpp index c70304dc2..8cb8beaa1 100644 --- a/code/ryzom/client/src/login_xdelta.cpp +++ b/code/ryzom/client/src/login_xdelta.cpp @@ -95,7 +95,7 @@ bool CXDPFileReader::init(const std::string &sFilename, sint32 nLowerBound, sint { // First open the file with a normal function #ifdef NL_OS_WINDOWS - int fd = _wopen(utf8ToWide(sFilename), _O_BINARY | _O_RDONLY); + int fd = _wopen(nlUtf8ToWide(sFilename), _O_BINARY | _O_RDONLY); #else int fd = open(sFilename.c_str(), O_RDONLY); #endif diff --git a/code/ryzom/client/src/permanent_ban.cpp b/code/ryzom/client/src/permanent_ban.cpp index dab097c79..5c9cbbb1f 100644 --- a/code/ryzom/client/src/permanent_ban.cpp +++ b/code/ryzom/client/src/permanent_ban.cpp @@ -87,9 +87,9 @@ static void setPermanentBanFileMarker(const std::string &path, bool on) { // simply touch a file COFile f(path); - #ifdef NL_OS_WINDOWS - SetFileAttributesW(utf8ToWide(path), FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM); - #endif +#ifdef NL_OS_WINDOWS + SetFileAttributesW(nlUtf8ToWide(path), FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM); +#endif } catch(const EStream &e) { diff --git a/code/ryzom/common/src/game_share/login_registry.cpp b/code/ryzom/common/src/game_share/login_registry.cpp index 7e0c68234..e30949400 100644 --- a/code/ryzom/common/src/game_share/login_registry.cpp +++ b/code/ryzom/common/src/game_share/login_registry.cpp @@ -39,7 +39,7 @@ std::string CLoginRegistry::getProductInstallId() if (RegQueryValueExW(hKey, InstallIdKeyHandle, NULL, &dwType, (BYTE *) buffer, &dwSize) == ERROR_SUCCESS && dwType == REG_SZ) { RegCloseKey(hKey); - return wideToUtf8(buffer); + return NLMISC::wideToUtf8(buffer); } RegCloseKey(hKey); } @@ -58,10 +58,9 @@ std::string CLoginRegistry::getProductInstallId() // copy wide string to a buffer const uint keyMaxLength = 16; - wchar_t buffer[keyMaxLength]; - wcscpy(buffer, utf8ToWide(id)); + std::wstring wid = NLMISC::utf8ToWide(id); - if (RegSetValueExW(hKey, InstallIdKeyHandle, 0L, REG_SZ, (const BYTE *) buffer, (DWORD)(wcslen(buffer)*2+2)) == ERROR_SUCCESS) + if (RegSetValueExW(hKey, InstallIdKeyHandle, 0L, REG_SZ, (const BYTE *)wid.c_str(), (DWORD)((wid.size() + 1) * sizeof(WCHAR))) == ERROR_SUCCESS) { return id; } diff --git a/code/ryzom/tools/CMakeLists.txt b/code/ryzom/tools/CMakeLists.txt index 9061d1e0f..b97c9be8e 100644 --- a/code/ryzom/tools/CMakeLists.txt +++ b/code/ryzom/tools/CMakeLists.txt @@ -1,3 +1,6 @@ + +FIND_PACKAGE(MySQL) + IF(WITH_RYZOM_TOOLS) ADD_SUBDIRECTORY(skill_extractor) ADD_SUBDIRECTORY(make_alias_file) @@ -17,7 +20,9 @@ IF(WITH_RYZOM_TOOLS) ADD_SUBDIRECTORY(patch_gen) IF(WIN32) - ADD_SUBDIRECTORY(sheets_packer_shard) + IF(MYSQL_FOUND) + ADD_SUBDIRECTORY(sheets_packer_shard) + ENDIF() ENDIF() ENDIF() @@ -27,7 +32,10 @@ IF(WITH_RYZOM_TOOLS) ENDIF() ADD_SUBDIRECTORY(client) -ADD_SUBDIRECTORY(server) + +IF(MYSQL_FOUND) + ADD_SUBDIRECTORY(server) +ENDIF() # Old stuff that doesn't compile anymore. #ADD_SUBDIRECTORY(occ2huff) diff --git a/code/ryzom/tools/client/CMakeLists.txt b/code/ryzom/tools/client/CMakeLists.txt index 66f8c9b48..d4f136b3c 100644 --- a/code/ryzom/tools/client/CMakeLists.txt +++ b/code/ryzom/tools/client/CMakeLists.txt @@ -14,6 +14,6 @@ IF(WITH_QT5 AND WITH_RYZOM_INSTALLER) ADD_SUBDIRECTORY(ryzom_installer) ENDIF() -IF(WITH_RYZOM_TOOLS) +IF(WITH_RYZOM_TOOLS AND MYSQL_FOUND) ADD_SUBDIRECTORY(r2_islands_textures) ENDIF() diff --git a/code/ryzom/tools/leveldesign/georges_dll/action.cpp b/code/ryzom/tools/leveldesign/georges_dll/action.cpp index 6e173756e..c2e9562fd 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/action.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/action.cpp @@ -44,7 +44,7 @@ IAction::IAction (TTypeAction type, uint selId, uint slot) // *************************************************************************** -void IAction::setLabel (const std::string &logLabel, CGeorgesEditDoc &doc) +void IAction::setLabel (const char *logLabel, CGeorgesEditDoc &doc) { _LogLabel = logLabel; @@ -75,7 +75,7 @@ bool IAction::doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, bool fi // *************************************************************************** -void IAction::update (bool updateLeftView, TUpdateRightView rightViewFlag, CGeorgesEditDoc &doc, const std::string &_FormName) +void IAction::update (bool updateLeftView, TUpdateRightView rightViewFlag, CGeorgesEditDoc &doc, const char *_FormName) { // Right and left view CGeorgesEditView *rightView = doc.getRightView (); @@ -129,7 +129,7 @@ void IAction::update (bool updateLeftView, TUpdateRightView rightViewFlag, CGeor // *************************************************************************** -CActionString::CActionString (IAction::TTypeAction type, const std::string &newValue, CGeorgesEditDoc &doc, const std::string &formName, const std::string &userData, uint selId, uint slot) : IAction (type, selId, slot) +CActionString::CActionString (IAction::TTypeAction type, const char *newValue, CGeorgesEditDoc &doc, const char *formName, const char *userData, uint selId, uint slot) : IAction (type, selId, slot) { // Set the new value _NewValue = newValue; @@ -235,7 +235,7 @@ CActionString::CActionString (IAction::TTypeAction type, const std::string &newV bool vdfnArray; CForm *form=doc.getFormPtr (); CFormElm *elm = doc.getRootNode (slot); - nlverify ( elm->getNodeByName (_FormName, &parentDfn, indexDfn, + nlverify ( elm->getNodeByName (_FormName.c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, vdfnArray, true, NLGEORGES_FIRST_ROUND) ); if (node) { @@ -364,7 +364,7 @@ bool CActionString::doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, b bool parentVDnfArray; CForm *form=doc.getFormPtr (); CFormElm *elm = doc.getRootNode (_Slot); - nlverify ( elm->getNodeByName (_FormName, &parentDfn, indexDfn, + nlverify ( elm->getNodeByName (_FormName.c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDnfArray, true, NLGEORGES_FIRST_ROUND) ); nlassert (node); CFormElmAtom *atom = safe_cast (node); @@ -437,14 +437,14 @@ bool CActionString::doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, b bool vdfnArray; CForm *form=doc.getFormPtr (); CFormElm *elm = doc.getRootNode (_Slot); - nlverify ( elm->getNodeByName (_FormName, &parentDfn, indexDfn, + nlverify ( elm->getNodeByName (_FormName.c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, vdfnArray, true, NLGEORGES_FIRST_ROUND) ); if (node) { CFormElmArray* array = safe_cast (node->getParent ()); array->Elements[idInParent].Name = _Value[index]; modified = true; - update (true, DoNothing, doc, _FormName); + update (true, DoNothing, doc, _FormName.c_str ()); } } break; @@ -716,14 +716,14 @@ bool CActionStringVector::doAction (CGeorgesEditDoc &doc, bool redo, bool &modif bool parentVDfnArray; CForm *form=doc.getFormPtr (); CFormElm *elm = doc.getRootNode (slot); - nlverify ( elm->getNodeByName (_FormName, &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true) ); + nlverify ( elm->getNodeByName (_FormName.c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true) ); // Is a type entry ? if ((type == UFormDfn::EntryType) && array) { // Create the array bool created; - nlverify ( elm->createNodeByName (_FormName, &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, created) ); + nlverify ( elm->createNodeByName (_FormName.c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, created) ); nlassert (node); // Get the atom @@ -921,7 +921,7 @@ bool CActionStringVectorVector::doAction (CGeorgesEditDoc &doc, bool redo, bool // *************************************************************************** -CActionBuffer::CActionBuffer(IAction::TTypeAction type, const uint8 *buffer, uint bufferSize, CGeorgesEditDoc &doc, const std::string &formName, const std::string &userData, uint selId, uint slot) : IAction(type, selId, slot) +CActionBuffer::CActionBuffer (IAction::TTypeAction type, const uint8 *buffer, uint bufferSize, CGeorgesEditDoc &doc, const char *formName, const char *userData, uint selId, uint slot) : IAction (type, selId, slot) { // New value _FormName = formName; diff --git a/code/ryzom/tools/leveldesign/georges_dll/action.h b/code/ryzom/tools/leveldesign/georges_dll/action.h index 95af8015e..caf49373a 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/action.h +++ b/code/ryzom/tools/leveldesign/georges_dll/action.h @@ -59,7 +59,7 @@ protected: IAction (TTypeAction type, uint selId, uint slot); // Init log label - void setLabel (const std::string &logLabel, CGeorgesEditDoc &doc); + void setLabel (const char *logLabel, CGeorgesEditDoc &doc); public: @@ -96,7 +96,7 @@ protected: UpdateValues, Redraw }; - void update (bool updateLeftView, TUpdateRightView rightView, CGeorgesEditDoc &doc, const std::string &_FormName); + void update (bool updateLeftView, TUpdateRightView rightView, CGeorgesEditDoc &doc, const char *_FormName); }; // String modification action @@ -105,7 +105,7 @@ class CActionString : public IAction public: // Constructor - CActionString(IAction::TTypeAction type, const std::string &newValue, CGeorgesEditDoc &doc, const std::string &formName, const std::string &userData, uint selId, uint slot); + CActionString (IAction::TTypeAction type, const char *newValue, CGeorgesEditDoc &doc, const char *formName, const char *userData, uint selId, uint slot); protected: @@ -165,7 +165,7 @@ class CActionBuffer : public IAction public: // Constructor - CActionBuffer (IAction::TTypeAction type, const uint8 *buffer, uint bufferSize, CGeorgesEditDoc &doc, const std::string &formName, const std::string &userData, uint selId, uint slot); + CActionBuffer (IAction::TTypeAction type, const uint8 *buffer, uint bufferSize, CGeorgesEditDoc &doc, const char *formName, const char *userData, uint selId, uint slot); protected: @@ -182,4 +182,5 @@ protected: virtual bool doAction (CGeorgesEditDoc &doc, bool redo, bool &modified, bool firstTime); }; -#endif +#endif /* GEORGES_EDIT_ACTION_H */ + diff --git a/code/ryzom/tools/leveldesign/georges_dll/base_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/base_dialog.cpp index a29c9f7d7..923d69c6b 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/base_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/base_dialog.cpp @@ -230,9 +230,9 @@ BOOL CBaseDialog::PreTranslateMessage(MSG* pMsg) return CDialog::PreTranslateMessage(pMsg); } -void CBaseDialog::setEditTextMultiLine (CEdit &edit, const std::string &text) +void CBaseDialog::setEditTextMultiLine (CEdit &edit, const char *text) { - edit.SetWindowText (utf8ToTStr(NLMISC::addSlashR(text))); + edit.SetWindowText (nlUtf8ToTStr(NLMISC::addSlashR(text))); } void CBaseDialog::onOpenSelected() diff --git a/code/ryzom/tools/leveldesign/georges_dll/base_dialog.h b/code/ryzom/tools/leveldesign/georges_dll/base_dialog.h index 6358697b7..5f96d8229 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/base_dialog.h +++ b/code/ryzom/tools/leveldesign/georges_dll/base_dialog.h @@ -126,7 +126,7 @@ public: void registerLastControl (); void unRegisterLastControl (); - static void setEditTextMultiLine(CEdit &edit, const std::string &text); + static void setEditTextMultiLine (CEdit &edit, const char *text); virtual void onOpenSelected (); virtual void setFocusLastWidget (); diff --git a/code/ryzom/tools/leveldesign/georges_dll/child_frm.cpp b/code/ryzom/tools/leveldesign/georges_dll/child_frm.cpp index 37a85329d..9f388be4f 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/child_frm.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/child_frm.cpp @@ -63,7 +63,7 @@ BOOL CChildFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/, } // Load state - theApp.loadWindowState (this, "child", true, false); + theApp.loadWindowState (this, _T("child"), true, false); return TRUE; } diff --git a/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp index 22c556faa..3958901a2 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp @@ -193,7 +193,7 @@ void CDfnDialog::getFromDocument (const NLGEORGES::CFormDfn &dfn) for (parent=0; parentStruct.ListCtrl.GetItemText (item, 2); std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(str)); if (ext == "typ") - Dialog->Struct.ListCtrl.SetItemText (item, 2, utf8ToTStr(theApp.DefaultType)); + Dialog->Struct.ListCtrl.SetItemText(item, 2, nlUtf8ToTStr(theApp.DefaultType)); } else if ((type == "Dfn") || (type == "Dfn array")) { @@ -430,7 +430,7 @@ void CDfnEditListCtrl::onItemChanged (uint item, uint subItem) str = Dialog->Struct.ListCtrl.GetItemText (item, 2); std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(str)); if (ext == "dfn") - Dialog->Struct.ListCtrl.SetItemText (item, 2, utf8ToTStr(theApp.DefaultDfn)); + Dialog->Struct.ListCtrl.SetItemText(item, 2, nlUtf8ToTStr(theApp.DefaultDfn)); // Clear default value Dialog->Struct.ListCtrl.SetItemText (item, 3, _T("")); @@ -468,16 +468,16 @@ void CDfnDialog::onOpenSelected () int nItem = Parents.ListCtrl.GetNextSelectedItem(pos); // Get the string - std::string str = tStrToUtf8(Parents.ListCtrl.GetItemText (nItem, 0)); - if (!str.empty()) + CString str = Parents.ListCtrl.GetItemText (nItem, 0); + if (str != "") { // Look for the file - string name = CPath::lookup (str, false, false); - if (name.empty ()) + CString name = nlUtf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false)); + if (name.IsEmpty()) name = str; // Open the file - theApp.OpenDocumentFile (utf8ToTStr(name)); + theApp.OpenDocumentFile(name); } } } @@ -490,16 +490,16 @@ void CDfnDialog::onOpenSelected () int nItem = Struct.ListCtrl.GetNextSelectedItem(pos); // Get the string - std::string str = tStrToUtf8(Struct.ListCtrl.GetItemText (nItem, 2)); - if (!str.empty()) + CString str = Struct.ListCtrl.GetItemText (nItem, 2); + if (str != "") { // Look for the file - string name = CPath::lookup (str, false, false); - if (name.empty ()) + CString name = nlUtf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false)); + if (name.IsEmpty()) name = str; // Open the file - theApp.OpenDocumentFile (utf8ToTStr(name)); + theApp.OpenDocumentFile(name); } } } @@ -621,7 +621,7 @@ void CDfnParentEditListCtrl::getNewItemText (uint item, uint subItem, std::strin // *************************************************************************** -void CDfnParentEditListCtrl::getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, std::string &filter) +void CDfnParentEditListCtrl::getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, NLMISC::tstring &filter) { filter = DfnFilter; defDir = theApp.RootSearchPath; diff --git a/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.h b/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.h index 174001aaa..4d7479ea6 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.h +++ b/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.h @@ -36,7 +36,7 @@ class CDfnParentEditListCtrl : public CEditListCtrl CEditListCtrl::TItemEdit getItemEditMode (uint item, uint subItem); void getMemComboBoxProp (uint item, uint subItem, std::string ®Adr, bool &browse); void getNewItemText (uint item, uint subItem, std::string &ret); - void getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, std::string &filter); + void getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, NLMISC::tstring &filter); public: class CDfnDialog *Dialog; }; @@ -47,7 +47,7 @@ class CDfnEditListCtrl : public CEditListCtrl void getComboBoxStrings (uint item, uint subItem, std::vector &retStrings); void getMemComboBoxProp (uint item, uint subItem, std::string ®Adr, bool &browse); void getNewItemText (uint item, uint subItem, std::string &ret); - void getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, std::string &filter); + void getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, NLMISC::tstring &filter); void onItemChanged (uint item, uint subItem); public: class CDfnDialog *Dialog; 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 0b16abd4f..3e4d02046 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.cpp @@ -69,7 +69,7 @@ bool CEditListCtrl::create (DWORD wStyle, RECT &rect, CWnd *parent, uint dialog_ Edit.SetFont (ListCtrl.GetFont()); Combo.Create (WS_BORDER|CBS_DROPDOWNLIST, rect, &ListCtrl, IdCombo); Combo.SetFont (ListCtrl.GetFont()); - MemCombo.create (WS_CHILD, rect, &ListCtrl, IdMemCombo, "", theApp.RememberListSize); + MemCombo.create (WS_CHILD, rect, &ListCtrl, IdMemCombo, _T(""), theApp.RememberListSize); MemCombo.SetFont (ListCtrl.GetFont()); return true; } @@ -122,11 +122,11 @@ BOOL CEditListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) // Insert an item at the end string text; getNewItemText (ListCtrl.GetItemCount (), 0, text); - ListCtrl.InsertItem (ListCtrl.GetItemCount (), utf8ToTStr(text)); + ListCtrl.InsertItem(ListCtrl.GetItemCount(), nlUtf8ToTStr(text)); for (uint i=1; igetBrowseInfo (Ctrl->Item, Ctrl->SubItem, defExt, defFilename, defDir, filter); TCHAR buffer[MAX_PATH]; - _tcscpy_s(buffer, MAX_PATH, utf8ToTStr(defDir)); + _tcscpy_s(buffer, MAX_PATH, nlUtf8ToTStr(defDir)); - CFileDialog dlgFile (TRUE, utf8ToTStr(defExt), utf8ToTStr(defFilename), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, utf8ToTStr(filter), theApp.m_pMainWnd); + CFileDialog dlgFile(TRUE, nlUtf8ToTStr(defExt), nlUtf8ToTStr(defFilename), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, nlUtf8ToTStr(filter), theApp.m_pMainWnd); dlgFile.m_ofn.lpstrInitialDir = buffer; Ctrl->OnBrowse = true; if (dlgFile.DoModal () == IDOK) @@ -453,8 +453,8 @@ void CEditListCtrl::editItem (uint item, uint subitem) getComboBoxStrings (Item, SubItem, retStrings); for (uint i=0; imkid.cb); + return (LPITEMIDLIST)(BYTE*)(((BYTE*)pidl) + pidl->mkid.cb); } else return NULL; @@ -347,7 +347,7 @@ return pidl; UINT Pidl_GetSize(LPCITEMIDLIST pidl) { UINT cbTotal = 0; - ITEMIDLIST* pidlTemp = (ITEMIDLIST*) pidl; + LPITEMIDLIST pidlTemp = (LPITEMIDLIST)pidl; if(pidlTemp) { @@ -415,12 +415,12 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) return 0; } -bool CFileTreeCtrl::enumObjects(HTREEITEM hParentItem,IShellFolder* pParentFolder, ITEMIDLIST* pidlParent) +bool CFileTreeCtrl::enumObjects(HTREEITEM hParentItem,IShellFolder* pParentFolder, LPITEMIDLIST pidlParent) { IEnumIDList* pEnum; if(SUCCEEDED(pParentFolder->EnumObjects(NULL, SHCONTF_NONFOLDERS |SHCONTF_FOLDERS|SHCONTF_INCLUDEHIDDEN, &pEnum))) { - ITEMIDLIST* pidl; + LPITEMIDLIST pidl; DWORD dwFetched = 1; TV_ITEM tvItem={0}; TV_INSERTSTRUCT tvInsert={0}; @@ -445,7 +445,7 @@ bool CFileTreeCtrl::enumObjects(HTREEITEM hParentItem,IShellFolder* pParentFolde nlverify ( SHGetPathFromIDList ( pidl, name ) ); // Save it - pItemInfo->displayName = tStrToUtf8(name); + pItemInfo->displayName = NLMISC::tStrToUtf8(name); // Is a folder ? bool folder = (pItemInfo->dwFlags&SFGAO_FOLDER) !=0; @@ -720,7 +720,7 @@ bool CFileTreeCtrl::getCurrentFilename (std::string &result) if (curSel) { CString str = _TreeCtrl.GetItemText (curSel); - result = tStrToUtf8(str); + result = NLMISC::tStrToUtf8(str); return true; } return false; diff --git a/code/ryzom/tools/leveldesign/georges_dll/file_tree_view.h b/code/ryzom/tools/leveldesign/georges_dll/file_tree_view.h index bdfb5b050..c3729e0bf 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/file_tree_view.h +++ b/code/ryzom/tools/leveldesign/georges_dll/file_tree_view.h @@ -51,7 +51,7 @@ public: bool create( const RECT& rect, CWnd* pParentWnd, UINT nID ); bool setRootDirectory (const char *dir); void setArrangeMode (TArrange arrangeMode); - bool enumObjects (HTREEITEM hParentItem,IShellFolder* pParentFolder, ITEMIDLIST* pidlParent); + bool enumObjects (HTREEITEM hParentItem,IShellFolder* pParentFolder, LPITEMIDLIST pidlParent); void doItemMenu (HWND hwndTreeView, HTREEITEM hItem, LPPOINT pptScreen); void doClick (HWND hwndTreeView, HTREEITEM hItem); void addExclusiveExtFilter (const char *ext); diff --git a/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp index f4fcf4d1d..8979d9237 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp @@ -165,7 +165,7 @@ CWnd* CFormDialog::addTypeWidget (const NLGEORGES::CType &type, uint elmIndex, c // Create a reg key string tfn = typeFilename; - string key = GEORGES_EDIT_BASE_REG_KEY"\\"+strlwr (typeFilename)+" MemCombo"; + tstring key = utf8ToTStr(GEORGES_EDIT_BASE_REG_KEY"\\"+strlwr (typeFilename)+" MemCombo"); // Create the widget memCombo->create (WS_CHILD|WS_TABSTOP, currentPos, this, WidgetIndexCount, title, key.c_str(), type.UIType==CType::EditSpin, type.UIType==CType::FileBrowser, filenameExt); @@ -251,7 +251,7 @@ void CFormDialog::getVirtualDfnFromDocument (const NLGEORGES::CFormDfn *_dfn, co // Create the widget memCombo->create (WS_CHILD|WS_TABSTOP, currentPos, this, WidgetIndexCount, "Dfn:", - GEORGES_EDIT_BASE_REG_KEY"\\Virtual Dfn MemCombo", false, true, "*.dfn"); + _T(GEORGES_EDIT_BASE_REG_KEY) _T("\\Virtual Dfn MemCombo"), false, true, "*.dfn"); // Get from document memCombo->getFromDocument (*doc->getFormPtr ()); @@ -462,7 +462,7 @@ void CFormDialog::getArrayFromDocument (const char *structName, uint structId, u // Create the widget memCombo->create (WS_CHILD|WS_TABSTOP, currentPos, this, WidgetIndexCount, "Array size:", - GEORGES_EDIT_BASE_REG_KEY"\\Array Size MemCombo", true, false, NULL); + _T(GEORGES_EDIT_BASE_REG_KEY) _T("\\Array Size MemCombo"), true, false, NULL); // Get from document memCombo->getFromDocument (*doc->getFormPtr ()); @@ -548,7 +548,7 @@ void CFormDialog::setToDocument (uint widget) bool parentVDfnArray; CForm *form=doc->getFormPtr (); CFormElm *elm = doc->getRootNode (Widgets[widget]->getSlot ()); - nlverify ( elm->getNodeByName (Widgets[widget]->getFormName (), &parentDfn, indexDfn, + nlverify ( elm->getNodeByName (Widgets[widget]->getFormName ().c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) ); // Must create array or virtual dfn ? @@ -811,7 +811,7 @@ BOOL CFormDialog::OnCommand(WPARAM wParam, LPARAM lParam) bool parentVDfnArray; CForm *form=doc->getFormPtr (); CFormElm *elm = doc->getRootNode (Widgets[widgetId]->getSlot ()); - nlverify ( elm->getNodeByName (Widgets[widgetId]->getFormName (), &parentDfn, indexDfn, + nlverify ( elm->getNodeByName (Widgets[widgetId]->getFormName ().c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) ); nlassert (parentDfn); @@ -832,11 +832,11 @@ BOOL CFormDialog::OnCommand(WPARAM wParam, LPARAM lParam) smprintf (filter, 512, "%s Files (%s)|%s|All Files(*.*)|*.*|", typeName+i, ext.c_str(), ext.c_str()); // Open the dialog - CFileDialog dlgFile (TRUE, ext.c_str (), ext.c_str (), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, filter, theApp.m_pMainWnd); + CFileDialog dlgFile(TRUE, nlUtf8ToTStr(ext), nlUtf8ToTStr(ext), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, nlUtf8ToTStr(filter), theApp.m_pMainWnd); if (dlgFile.DoModal () == IDOK) { combo->Combo.UpdateData (); - combo->Combo.SetWindowText (dlgFile.GetFileName ()); + combo->Combo.SetWindowText(dlgFile.GetFileName()); combo->Combo.UpdateData (FALSE); setToDocument (widgetId); PostMessage (CBN_CHANGED, 0, 0); @@ -850,7 +850,7 @@ BOOL CFormDialog::OnCommand(WPARAM wParam, LPARAM lParam) if (colorEdit && IsWindow (colorEdit->Color)) { colorEdit->Empty = true; - colorEdit->Edit.SetWindowText(""); + colorEdit->Edit.SetWindowText(_T("")); setToDocument (getWidget (wParam)); updateValues (); } @@ -926,7 +926,7 @@ BOOL CFormDialog::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) CString str; combo->Combo.UpdateData (); combo->Combo.GetWindowText (str); - if (sscanf (str, "%f", &value) == 1) + if (_stscanf (str, _T("%f"), &value) == 1) { CGeorgesEditDoc *doc = View->GetDocument(); if (doc) @@ -1166,14 +1166,14 @@ void CFormDialog::getFromDocument () // *************************************************************************** -void CFormDialog::getDfnName (string &result) const +void CFormDialog::getDfnName(string &result) const { CGeorgesEditDoc *doc = View->GetDocument (); if (doc) { // Get the DFN filename - CString str = doc->GetPathName (); - result NLMISC::CFile::getExtension(tStrToUtf8(str)); + CString str = doc->GetPathName(); + result = NLMISC::CFile::getExtension(tStrToUtf8(str)); } else result.clear(); @@ -1316,16 +1316,16 @@ void IFormWidget::updateLabel () switch (where) { case UFormElm::ValueForm: - Label.SetWindowText ((SavedLabel+comp).c_str()); + Label.SetWindowText(nlUtf8ToTStr(SavedLabel + comp)); break; case UFormElm::ValueParentForm: - Label.SetWindowText ((SavedLabel+" (in parent form)"+comp).c_str()); + Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (in parent form)" + comp)); break; case UFormElm::ValueDefaultDfn: - Label.SetWindowText ((SavedLabel+" (default DFN value)"+comp).c_str()); + Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (default DFN value)" + comp)); break; case UFormElm::ValueDefaultType: - Label.SetWindowText ((SavedLabel+" (default TYPE value)"+comp).c_str()); + Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (default TYPE value)" + comp)); break; } } @@ -1352,18 +1352,18 @@ void IFormWidget::updateLabel () if (node->getForm () == doc->getFormPtr ()) { // The node exist - Label.SetWindowText (utf8ToTStr(SavedLabel)); + Label.SetWindowText(nlUtf8ToTStr(SavedLabel)); } else { // The node exist in the parent form - Label.SetWindowText (utf8ToTStr(SavedLabel + " (in parent form)")); + Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (in parent form)")); } } else { // The node is empty - Label.SetWindowText (utf8ToTStr(SavedLabel + " (undefined)")); + Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (undefined)")); } } @@ -1512,7 +1512,7 @@ void IFormWidget::onOpenSelected () std::string str2 = CPath::lookup (str, false, false); if (str2.empty()) str2 = str; - theApp.OpenDocumentFile (utf8ToTStr(str2)); + theApp.OpenDocumentFile(nlUtf8ToTStr(str2)); } // *************************************************************************** @@ -1541,7 +1541,7 @@ CFormMemCombo::~CFormMemCombo () // *************************************************************************** -void CFormMemCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, uint &dialog_index, const char *label, const char *reg, bool useSpinner, bool fileBrowser, const char *filenameExt) +void CFormMemCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, uint &dialog_index, const char *label, const TCHAR *reg, bool useSpinner, bool fileBrowser, const char *filenameExt) { // Get the doc CGeorgesEditDoc *doc = Dialog->View->GetDocument (); @@ -1569,7 +1569,7 @@ void CFormMemCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, // Create the type combo parent->setStaticSize (currentPos); - Label.Create (label, WS_VISIBLE, currentPos, parent); + Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent); parent->initWidget (Label); parent->getNextPosLabel (currentPos); @@ -1603,7 +1603,7 @@ void CFormMemCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, RECT spinPos = currentPos; parent->getNextBrowsePos (spinPos); parent->setBrowseSize (spinPos); - Browse.Create ("...", WS_CHILD|WS_VISIBLE|WS_TABSTOP, spinPos, parent, dialog_index+1); + Browse.Create (_T("..."), WS_CHILD|WS_VISIBLE|WS_TABSTOP, spinPos, parent, dialog_index+1); parent->initWidget (Browse); parent->getNextPos (currentPos); @@ -1675,7 +1675,7 @@ void CFormMemCombo::getValue (std::string &result) Combo.UpdateData (FALSE); // Set the atom value - result = (const char*)str; + result = tStrToUtf8(str); } // *************************************************************************** @@ -1691,7 +1691,7 @@ void CFormMemCombo::getFromDocument (CForm &form) if (doc->getRootNode(getSlot ())->getValueByName (result, FormName, UFormElm::NoEval, NULL)) { Combo.UpdateData (); - Combo.SetWindowText (utf8ToTStr(result)); + Combo.SetWindowText(nlUtf8ToTStr(result)); Combo.UpdateData (FALSE); updateLabel (); } @@ -1720,7 +1720,7 @@ void CFormMemCombo::getFromDocument (CForm &form) CFormElmArray *arrayNode = safe_cast (node); char label[512]; smprintf (label, 512, "%d", arrayNode->Elements.size ()); - Combo.SetWindowText (label); + Combo.SetWindowText(nlUtf8ToTStr(label)); if (arrayNode->getForm () == &form) Label.SetWindowText (_T("Array size:")); @@ -1751,7 +1751,7 @@ void CFormMemCombo::getFromDocument (CForm &form) if (node) { CFormElmVirtualStruct *virtualNode = safe_cast (node); - Combo.SetWindowText (utf8ToTStr(virtualNode->DfnFilename)); + Combo.SetWindowText(nlUtf8ToTStr(virtualNode->DfnFilename)); } else { @@ -1903,7 +1903,7 @@ void CFormCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, ui // Create the type combo parent->setStaticSize (currentPos); - Label.Create (label, WS_VISIBLE, currentPos, parent); + Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent); parent->initWidget (Label); parent->getNextPosLabel (currentPos); @@ -1918,10 +1918,10 @@ void CFormCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, ui // Get predefs if (nodeType) { - Combo.InsertString (0, ""); + Combo.InsertString (0, _T("")); for (uint predef=0; predefDefinitions.size(); predef++) { - Combo.InsertString (predef+1, nodeType->Definitions[predef].Label.c_str()); + Combo.InsertString(predef + 1, nlUtf8ToTStr(nodeType->Definitions[predef].Label)); } } @@ -1973,7 +1973,7 @@ void CFormCombo::getValue (std::string &result) Combo.UpdateData (FALSE); // Set the atom value - result = (const char*)str; + result = tStrToUtf8(str); } // *************************************************************************** @@ -2088,13 +2088,13 @@ void CFormBigEdit::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, // Create the type combo parent->setStaticSize (currentPos); - Label.Create (label, WS_VISIBLE, currentPos, parent); + Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent); parent->initWidget (Label); parent->getNextPosLabel (currentPos); // Create the mem combobox parent->setBigEditSize (currentPos, parent->SmallWidget); - Edit.CreateEx (WS_EX_CLIENTEDGE, _T("EDIT"), "", WS_VSCROLL|ES_OEMCONVERT|ES_MULTILINE|ES_WANTRETURN|WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL|ES_AUTOVSCROLL, currentPos, parent, dialog_index); + Edit.CreateEx (WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), WS_VSCROLL|ES_OEMCONVERT|ES_MULTILINE|ES_WANTRETURN|WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL|ES_AUTOVSCROLL, currentPos, parent, dialog_index); parent->initWidget (Edit); parent->getNextPos (currentPos); @@ -2146,7 +2146,7 @@ void CFormBigEdit::getValue (std::string &result) Edit.UpdateData (FALSE); // Set the atom value - result = (const char*)str; + result = tStrToUtf8(str); } // *************************************************************************** @@ -2262,7 +2262,7 @@ void CColorEdit::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, ui // Create the type combo parent->setStaticSize (currentPos); - Label.Create (label, WS_VISIBLE, currentPos, parent); + Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent); parent->initWidget (Label); parent->getNextPosLabel (currentPos); @@ -2275,13 +2275,13 @@ void CColorEdit::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, ui RECT resetPos = currentPos; parent->getNextColorPos (resetPos); parent->setResetColorSize (resetPos); - Reset.Create ("Reset", WS_CHILD|WS_VISIBLE|WS_TABSTOP, resetPos, parent, dialog_index+1); + Reset.Create (_T("Reset"), WS_CHILD|WS_VISIBLE|WS_TABSTOP, resetPos, parent, dialog_index+1); parent->initWidget (Reset); parent->getNextPosLabel (currentPos); // Create the Edit parent->setBigEditSize (currentPos, parent->SmallWidget); - Edit.CreateEx (WS_EX_CLIENTEDGE, _T("EDIT"), "", ES_OEMCONVERT|ES_WANTRETURN|WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL, currentPos, parent, dialog_index+2); + Edit.CreateEx (WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), ES_OEMCONVERT|ES_WANTRETURN|WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL, currentPos, parent, dialog_index+2); parent->initWidget (Edit); parent->getNextPos (currentPos); @@ -2492,7 +2492,7 @@ void CListWidget::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, u // Create the type combo parent->setStaticSize (currentPos); - Label.Create (label, WS_VISIBLE, currentPos, parent); + Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent); parent->initWidget (Label); parent->getNextPosLabel (currentPos); @@ -2504,7 +2504,7 @@ void CListWidget::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, u // Create the assign parent parent->setButtonSize (currentPos, parent->SmallWidget); - Button.Create ("Assign parents", WS_CHILD|WS_VISIBLE|WS_TABSTOP, currentPos, parent, dialog_index+1); + Button.Create (_T("Assign parents"), WS_CHILD|WS_VISIBLE|WS_TABSTOP, currentPos, parent, dialog_index+1); parent->initWidget (Button); parent->getNextPos (currentPos); @@ -2515,7 +2515,7 @@ void CListWidget::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, u void CListWidget::addColumn (const char *name) { - ListCtrl.insertColumn (0, name); + ListCtrl.insertColumn(0, nlUtf8ToTStr(name)); ListCtrl.recalcColumn (); } @@ -2566,7 +2566,7 @@ void CListWidget::getFromDocument (NLGEORGES::CForm &form) string filename = form.getParentFilename (parent); // Insert in the list - ListCtrl.ListCtrl.InsertItem (parent, filename.c_str ()); + ListCtrl.ListCtrl.InsertItem(parent, nlUtf8ToTStr(filename)); ListCtrl.ListCtrl.UpdateData (FALSE); updateLabel (); @@ -2585,7 +2585,7 @@ uint CListWidget::getNumValue () void CListWidget::getValue (std::string &result, uint value) { CString str = ListCtrl.ListCtrl.GetItemText (value, 0); - result = str; + result = tStrToUtf8(str); } // *************************************************************************** @@ -2709,12 +2709,12 @@ void CListWidget::onOpenSelected () if (str != "") { // Look for the file - string name = CPath::lookup ((const char*)str, false, false); - if (name.empty ()) + CString name = nlUtf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false)); + if (name.IsEmpty()) name = str; // Open the file - theApp.OpenDocumentFile (name.c_str ()); + theApp.OpenDocumentFile(name); } } } @@ -2750,7 +2750,7 @@ void CIconWidget::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, u // Create the type combo parent->setStaticSize (currentPos); - Label.Create (label, WS_VISIBLE, currentPos, parent); + Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent); parent->initWidget (Label); parent->getNextPosLabel (currentPos); diff --git a/code/ryzom/tools/leveldesign/georges_dll/form_dialog.h b/code/ryzom/tools/leveldesign/georges_dll/form_dialog.h index cb9d29bab..d3afef083 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/form_dialog.h +++ b/code/ryzom/tools/leveldesign/georges_dll/form_dialog.h @@ -207,7 +207,7 @@ public: bool FileBrowser; // Create the widget - void create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, uint &dialog_index, const char *label, const char *reg, bool spinner, bool fileBrowser, const char *filenameExt); + void create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, uint &dialog_index, const char *label, const TCHAR *reg, bool spinner, bool fileBrowser, const char *filenameExt); // From IFormWidget void onOk (); diff --git a/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp b/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp index 5b1b5f72f..480fdfbe0 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/georges_edit.cpp @@ -39,8 +39,8 @@ using namespace NLGEORGES; using namespace std; -const char* TypeFilter = "Type Files (*.typ)|*.typ|All Files (*.*)|*.*||"; -const char* DfnFilter = "Form Definition Files (*.dfn)|*.dfn|All Files (*.*)|*.*||"; +const TCHAR* TypeFilter = _T("Type Files (*.typ)|*.typ|All Files (*.*)|*.*||"); +const TCHAR* DfnFilter = _T("Form Definition Files (*.dfn)|*.dfn|All Files (*.*)|*.*||"); CSplashScreen* splashScreen=new CSplashScreen; ///////////////////////////////////////////////////////////////////////////// // CGeorgesEditApp @@ -477,9 +477,9 @@ void CGeorgesEditApp::OnAppAbout() void CGeorgesEditApp::outputError (const char* message) { if (m_pMainWnd) - m_pMainWnd->MessageBox (utf8ToTStr(message), _T("Georges Edit"), MB_OK|MB_ICONEXCLAMATION); + m_pMainWnd->MessageBox(nlUtf8ToTStr(message), _T("Georges Edit"), MB_OK | MB_ICONEXCLAMATION); else - MessageBox (NULL, utf8ToTStr(message), _T("Georges Edit"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL, nlUtf8ToTStr(message), _T("Georges Edit"), MB_OK | MB_ICONEXCLAMATION); } void CGeorgesEditApp::getConfigFilePath (std::string &output) @@ -711,9 +711,9 @@ bool CGeorgesEditApp::getColor (NLMISC::CRGBA &color) bool CGeorgesEditApp::yesNo (const char* message) { if (m_pMainWnd) - return m_pMainWnd->MessageBox (message, _T("Georges Edit"), MB_YESNO|MB_ICONQUESTION) != IDNO; + return m_pMainWnd->MessageBox(nlUtf8ToTStr(message), _T("Georges Edit"), MB_YESNO | MB_ICONQUESTION) != IDNO; else - return MessageBox (NULL, message, _T("Georges Edit"), MB_YESNO|MB_ICONQUESTION) != IDNO; + return MessageBox(NULL, nlUtf8ToTStr(message), _T("Georges Edit"), MB_YESNO | MB_ICONQUESTION) != IDNO; } void CGeorgesEditApp::loadPlugins () @@ -722,7 +722,7 @@ void CGeorgesEditApp::loadPlugins () for (i=0; iSetPathName ( pathName, FALSE ); + doc->SetPathName (nlUtf8ToTStr(pathName), FALSE ); // Create the file - doc->OnSaveDocument( pathName ); + doc->OnSaveDocument(nlUtf8ToTStr(pathName)); } // Init the frame @@ -908,10 +908,10 @@ LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata) if (retval == ERROR_SUCCESS) { - long datasize = MAX_PATH; - char data[MAX_PATH]; + long datasize = MAX_PATH * sizeof(TCHAR); + TCHAR data[MAX_PATH]; RegQueryValue(hkey, NULL, data, &datasize); - lstrcpy(retdata,data); + lstrcpy(retdata, data); RegCloseKey(hkey); } @@ -925,7 +925,7 @@ void CGeorgesEditApp::gotoURL (LPCTSTR url) void CGeorgesEditApp::WinHelp(DWORD dwData, UINT nCmd) { - gotoURL(utf8ToTStr(NLMISC::CFile::getPath(ExePath) + "georges_edit.html")); + gotoURL(nlUtf8ToTStr(NLMISC::CFile::getPath(ExePath) + "georges_edit.html")); } void CGeorgesEditApp::OnViewRefresh() @@ -936,7 +936,7 @@ void CGeorgesEditApp::OnViewRefresh() } } -void CGeorgesEditApp::saveWindowState (const CWnd *wnd, const char *name, bool controlBar) +void CGeorgesEditApp::saveWindowState (const CWnd *wnd, const TCHAR *name, bool controlBar) { HKEY hKey; nlverify (RegCreateKey (HKEY_CURRENT_USER, _T(GEORGES_EDIT_BASE_REG_KEY "\\Windows states"), &hKey) == ERROR_SUCCESS); @@ -952,7 +952,7 @@ void CGeorgesEditApp::saveWindowState (const CWnd *wnd, const char *name, bool c nlverify (RegCloseKey (hKey) == ERROR_SUCCESS); } -void CGeorgesEditApp::loadWindowState (CWnd *wnd, const char *name, bool mdiChildWnd, bool controlBar) +void CGeorgesEditApp::loadWindowState (CWnd *wnd, const TCHAR *name, bool mdiChildWnd, bool controlBar) { HKEY hKey; if (RegOpenKey (HKEY_CURRENT_USER, _T(GEORGES_EDIT_BASE_REG_KEY "\\Windows states"), &hKey) == ERROR_SUCCESS) @@ -993,20 +993,20 @@ void CGeorgesEditApp::saveState () // Save the main window state nlassert (m_pMainWnd); if (ResizeMain) - saveWindowState (m_pMainWnd, "main", false); + saveWindowState (m_pMainWnd, _T("main"), false); - saveWindowState (&((CMainFrame*)m_pMainWnd)->FileBrowser, "browser", true); - saveWindowState (&((CMainFrame*)m_pMainWnd)->OutputConsole, "output", true); + saveWindowState (&((CMainFrame*)m_pMainWnd)->FileBrowser, _T("browser"), true); + saveWindowState (&((CMainFrame*)m_pMainWnd)->OutputConsole, _T("output"), true); } void CGeorgesEditApp::loadState () { nlassert (m_pMainWnd); if (ResizeMain) - loadWindowState (m_pMainWnd, "main", false, false); + loadWindowState (m_pMainWnd, _T("main"), false, false); - loadWindowState (&((CMainFrame*)m_pMainWnd)->FileBrowser, "browser", false, true); - loadWindowState (&((CMainFrame*)m_pMainWnd)->OutputConsole, "output", false, true); + loadWindowState (&((CMainFrame*)m_pMainWnd)->FileBrowser, _T("browser"), false, true); + loadWindowState (&((CMainFrame*)m_pMainWnd)->OutputConsole, _T("output"), false, true); } void CGeorgesEditApp::OnFileSaveAll() @@ -1025,7 +1025,7 @@ void CGeorgesEditApp::OnUpdateFileSaveAll(CCmdUI* pCmdUI) pCmdUI->Enable (getActiveDocument () != NULL); } -bool CGeorgesEditApp::SerialIntoMemStream (const std::string &formName, CGeorgesEditDoc *doc, uint slot, bool copyToClipboard) +bool CGeorgesEditApp::SerialIntoMemStream (const char *formName, CGeorgesEditDoc *doc, uint slot, bool copyToClipboard) { // Ok, get the node const CFormDfn *parentDfn; @@ -1060,7 +1060,7 @@ bool CGeorgesEditApp::SerialIntoMemStream (const std::string &formName, CGeorges { // Get the string CString str = doc->GetPathName (); - name = str; + name = tStrToUtf8(str); uint pos = name.rfind ('.'); if (pos != string::npos) { @@ -1228,7 +1228,7 @@ bool CGeorgesEditApp::FillMemStreamWithClipboard (const char *formName, CGeorges return false; } -bool CGeorgesEditApp::SerialFromMemStream (const std::string &formName, CGeorgesEditDoc *doc, uint slot) +bool CGeorgesEditApp::SerialFromMemStream (const char *formName, CGeorgesEditDoc *doc, uint slot) { // The form pointer CForm *form = doc->getFormPtr (); @@ -1268,7 +1268,7 @@ bool CGeorgesEditApp::SerialFromMemStream (const std::string &formName, CGeorges { // Get the string CString str = doc->GetPathName (); - nameParent = str; + nameParent = tStrToUtf8(str); uint pos = nameParent.rfind ('.'); if (pos != string::npos) { @@ -1423,24 +1423,24 @@ bool CGeorgesEditApp::SerialFromMemStream (const std::string &formName, CGeorges BOOL CGeorgesEditApp::OnDDECommand(LPTSTR lpszCommand) { - if (strncmp (lpszCommand, "Open", 4) == 0) + if (_tcsncmp (lpszCommand, _T("Open"), 4) == 0) { - string name = lpszCommand; + tstring name = lpszCommand; name = name.substr (6, name.size ()-8); OpenDocumentFile (name.c_str ()); } - else if (strncmp (lpszCommand, "Georges Copy", 4) == 0) + else if (_tcsncmp(lpszCommand, _T("Georges Copy"), 4) == 0) { // Get ext name - string name = lpszCommand; + tstring name = lpszCommand; name = name.substr (6, name.size ()-8); // Get the extension - std::string ext = NLMISC::CFile::getExtension(name); + std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(name.c_str())); string dfnName = ext + ".dfn"; // Get the doc template - CMultiDocTemplate *docTemplate = getFormDocTemplate (dfnName.c_str ()); + CMultiDocTemplate *docTemplate = getFormDocTemplate(dfnName.c_str()); if (docTemplate) { @@ -1452,7 +1452,7 @@ BOOL CGeorgesEditApp::OnDDECommand(LPTSTR lpszCommand) // Create the frame CFrameWnd* pFrame = docTemplate->CreateNewFrame(doc, NULL); nlassert (pFrame); - if (doc->loadFormFile (name.c_str ())) + if (doc->loadFormFile(tStrToUtf8(name.c_str()).c_str())) { doc->updateDocumentStructure (); @@ -1491,21 +1491,21 @@ BOOL CGeorgesEditApp::OnDDECommand(LPTSTR lpszCommand) outputError (tmp); } } - else if (strncmp (lpszCommand, "Derive", 6) == 0) + else if (_tcsncmp(lpszCommand, _T("Derive"), 6) == 0) { // Get ext name - string name = lpszCommand; + tstring name = lpszCommand; name = name.substr (8, name.size ()-10); // Get the extension - std::string ext = NLMISC::CFile::getExtension(name); + std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(name.c_str())); string dfnName = ext + ".dfn"; // Create a document CGeorgesEditDocForm *doc = (CGeorgesEditDocForm*)createDocument (dfnName.c_str (), ""); if (doc) { - std::string nameFile = NLMISC::CFile::getFilename(name); + std::string nameFile = NLMISC::CFile::getFilename(tStrToUtf8(name.c_str())); doc->addParent (nameFile.c_str()); doc->updateDocumentStructure (); doc->UpdateAllViews (NULL); @@ -1517,14 +1517,14 @@ BOOL CGeorgesEditApp::OnDDECommand(LPTSTR lpszCommand) outputError (tmp); } } - else if (strncmp (lpszCommand, "CreateForm", 10) == 0) + else if (_tcsncmp(lpszCommand, _T("CreateForm"), 10) == 0) { // Get ext name - string name = lpszCommand; + tstring name = lpszCommand; name = name.substr (10, name.size ()-12); // Get the extension - std::string dfnName = NLMISC::CFile::getFilename(name); + std::string dfnName = NLMISC::CFile::getFilename(tStrToUtf8(name.c_str())); // Create a document CGeorgesEditDocForm *doc = (CGeorgesEditDocForm*)createDocument (dfnName.c_str (), ""); diff --git a/code/ryzom/tools/leveldesign/georges_dll/georges_edit.h b/code/ryzom/tools/leveldesign/georges_dll/georges_edit.h index 747e4aec7..9232e688a 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/georges_edit.h +++ b/code/ryzom/tools/leveldesign/georges_dll/georges_edit.h @@ -41,8 +41,8 @@ #define GEORGES_EDIT_BASE_REG_KEY "Software\\Nevrax\\Georges Edit" #define GEORGES_EDIT_BROWSE_LABEL "--- Browse..." -extern const char* TypeFilter; -extern const char* DfnFilter; +extern const TCHAR* TypeFilter; +extern const TCHAR* DfnFilter; class CGeorgesEditDoc; @@ -119,11 +119,11 @@ public: public: // Memory stream NLMISC::CMemStream MemStream; - bool FillMemStreamWithClipboard (const std::string &formName, CGeorgesEditDoc *doc, uint slot); + bool FillMemStreamWithClipboard (const char *formName, CGeorgesEditDoc *doc, uint slot); void FillMemStreamWithBuffer (const uint8 *buffer, uint size); - bool SerialIntoMemStream (const std::string &formName, CGeorgesEditDoc *doc, uint slot, bool copyToClipboard); - bool SerialFromMemStream (const std::string &formName, CGeorgesEditDoc *doc, uint slot); + bool SerialIntoMemStream (const char *formName, CGeorgesEditDoc *doc, uint slot, bool copyToClipboard); + bool SerialFromMemStream (const char *formName, CGeorgesEditDoc *doc, uint slot); // Init BOOL initInstance (int nCmdShow, bool exeStandalone, int x, int y, int cx, int cy); @@ -136,7 +136,7 @@ public: // From IEdit NLGEORGES::IEditDocument *getActiveDocument (); - NLGEORGES::IEditDocument *createDocument (const std::string &dfnName, const std::string &pathName); + NLGEORGES::IEditDocument *createDocument (const char *dfnName, const char *pathName); virtual void getSearchPath (std::string &searchPath); virtual NLMISC::CConfigFile &getConfigFile() { return ConfigFile; } @@ -153,10 +153,10 @@ public: CImageListEx ImageList; // Get a template form - CMultiDocTemplate *getFormDocTemplate (const std::string &dfnName); + CMultiDocTemplate *getFormDocTemplate (const char *dfnName); - void saveWindowState (const CWnd *wnd, const std::string &name, bool controlBar); - void loadWindowState (CWnd *wnd, const std::string &name, bool changeShowWindow, bool controlBar); + void saveWindowState (const CWnd *wnd, const TCHAR *name, bool controlBar); + void loadWindowState (CWnd *wnd, const TCHAR *name, bool changeShowWindow, bool controlBar); // Overrides // ClassWizard generated virtual function overrides @@ -176,8 +176,8 @@ public: void releasePlugins (); // Dialog function - void outputError (const std::string &message); - bool yesNo (const std::string &message); + void outputError (const char* message); + bool yesNo (const char* message); bool getColor (NLMISC::CRGBA &color); // Browse an URL diff --git a/code/ryzom/tools/leveldesign/georges_dll/georges_edit_doc.cpp b/code/ryzom/tools/leveldesign/georges_dll/georges_edit_doc.cpp index 0bc32cfc9..3d374b4b1 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/georges_edit_doc.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/georges_edit_doc.cpp @@ -182,8 +182,8 @@ bool CGeorgesEditDocForm::initDocument (const char *dfnName, bool newElement) // Set file name and title std::string name2 = toLower(NLMISC::CFile::getFilenameWithoutExtension(dfnName)); - SetPathName (utf8ToTStr("*." + name2), FALSE); - SetTitle (utf8ToTStr("New " + name2 + " form")); + SetPathName(nlUtf8ToTStr("*." + name2), FALSE); + SetTitle(nlUtf8ToTStr("New " + name2 + " form")); // TMp if (newElement) @@ -223,10 +223,10 @@ BOOL CGeorgesEditDocForm::OnNewDocument() string defFilename = theApp.RootSearchPath; defFilename += "*.dfn"; - CFileDialog dlgFile (TRUE, _T("*.dfn"), defFilename.c_str (), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, DfnFilter, theApp.m_pMainWnd); + CFileDialog dlgFile(TRUE, _T("*.dfn"), nlUtf8ToTStr(defFilename.c_str()), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, DfnFilter, theApp.m_pMainWnd); if (dlgFile.DoModal () == IDOK) { - if (initDocument (dlgFile.GetFileName (), true)) + if (initDocument(tStrToUtf8(dlgFile.GetFileName()).c_str(), true)) return TRUE; } } @@ -491,7 +491,7 @@ BOOL CGeorgesEditDoc::OnOpenDocument(LPCTSTR lpszPathName) try { // Read the form with the loader - Type = FormLoader.loadType (lpszPathName); + Type = FormLoader.loadType(tStrToUtf8(lpszPathName)); if (!Type) { char msg[512]; @@ -517,11 +517,11 @@ BOOL CGeorgesEditDoc::OnOpenDocument(LPCTSTR lpszPathName) try { // Read the form with the loader - Dfn = FormLoader.loadFormDfn (lpszPathName, true); + Dfn = FormLoader.loadFormDfn (tStrToUtf8(lpszPathName), true); if (!Dfn) { char msg[512]; - smprintf (msg, 512, "Error while loading Dfn file %s", lpszPathName); + smprintf (msg, 512, "Error while loading Dfn file %s", tStrToUtf8(lpszPathName).c_str()); theApp.outputError (msg); return FALSE; } @@ -554,13 +554,13 @@ BOOL CGeorgesEditDoc::OnOpenDocument(LPCTSTR lpszPathName) if (theApp.getFormDocTemplate (dfnName.c_str ()) == NULL) { char message[512]; - smprintf (message, 512, "Can't open the file '%s'.", lpszPathName); + smprintf (message, 512, "Can't open the file '%s'.", tStrToUtf8(lpszPathName).c_str()); theApp.outputError (message); return FALSE; } // Read the form with the loader - if (!loadFormFile (lpszPathName)) + if (!loadFormFile (tStrToUtf8(lpszPathName).c_str())) return FALSE; if (theApp.ExeStandalone) @@ -743,7 +743,7 @@ BOOL CGeorgesEditDoc::OnSaveDocument(LPCTSTR lpszPathName) // Open the filt COFile file; - if (file.open (lpszPathName)) + if (file.open(tStrToUtf8(lpszPathName))) { try { @@ -778,7 +778,7 @@ BOOL CGeorgesEditDoc::OnSaveDocument(LPCTSTR lpszPathName) Dfn->Header.MinorVersion++; flushValueChange (); } - Dfn->write (xmlStream.getDocument (), lpszPathName); + Dfn->write (xmlStream.getDocument (), tStrToUtf8(lpszPathName)); modify (NULL, NULL, false); UpdateAllViews (NULL); return TRUE; @@ -793,11 +793,11 @@ BOOL CGeorgesEditDoc::OnSaveDocument(LPCTSTR lpszPathName) ((CForm*)(UForm*)Form)->Header.MinorVersion++; flushValueChange (); } - ((CForm*)(UForm*)Form)->write (xmlStream.getDocument (), lpszPathName); - if (strcmp (xmlStream.getErrorString (), "") != 0) + ((CForm*)(UForm*)Form)->write (xmlStream.getDocument (), tStrToUtf8(lpszPathName)); + if (strcmp(xmlStream.getErrorString().c_str(), "") != 0) { char message[512]; - smprintf (message, 512, "Error while saving file: %s", xmlStream.getErrorString ()); + smprintf (message, 512, "Error while saving file: %s", xmlStream.getErrorString().c_str()); theApp.outputError (message); } modify (NULL, NULL, false); @@ -1122,7 +1122,7 @@ void CGeorgesEditDoc::getFilename (std::string &pathname) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); - pathname = (const char*)GetPathName (); + pathname = tStrToUtf8(GetPathName()); } // *************************************************************************** @@ -1131,7 +1131,7 @@ void CGeorgesEditDoc::getTitle (std::string &title) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); - title = (const char*)GetTitle (); + title = tStrToUtf8(GetTitle()); } // *************************************************************************** @@ -1327,11 +1327,11 @@ void CGeorgesEditDoc::setModifiedState (bool modified) } else { - string title = (const char*)GetTitle (); + string title = tStrToUtf8(GetTitle()); if ( (title.size ()>=2) && (title[title.size()-1] == '*') && (title[title.size()-2] == ' ') ) { title.resize (title.size () - 2); - SetTitle (title.c_str()); + SetTitle(nlUtf8ToTStr(title)); } } } diff --git a/code/ryzom/tools/leveldesign/georges_dll/georges_edit_view.cpp b/code/ryzom/tools/leveldesign/georges_dll/georges_edit_view.cpp index e59fcb373..50a137006 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/georges_edit_view.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/georges_edit_view.cpp @@ -295,7 +295,7 @@ void CGeorgesEditView::updateTab () // Init the tab CGeorgesEditDocSub *child = parent->getChild (i); int image = child->getItemImage (doc); - TabCtrl.InsertItem (i, utf8ToTStr(child->getName()), image); + TabCtrl.InsertItem(i, nlUtf8ToTStr(child->getName()), image); // This is the selection ? if (subObject == child) diff --git a/code/ryzom/tools/leveldesign/georges_dll/georges_implementation.cpp b/code/ryzom/tools/leveldesign/georges_dll/georges_implementation.cpp index 2ac3ed596..d1c614834 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/georges_implementation.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/georges_implementation.cpp @@ -579,12 +579,12 @@ void CGeorgesImpl::LoadDocument( const std::string& _sxfullname ) AFX_MANAGE_STATE(AfxGetStaticModuleState()); try { - theApp.OpenDocumentFile(_sxfullname.c_str()); + theApp.OpenDocumentFile(nlUtf8ToTStr(_sxfullname)); } catch (const NLMISC::Exception &e) { std::string tmp = std::string(e.what()) + "(" + _sxfullname + ")"; - theApp.m_pMainWnd->MessageBox(tmp.c_str(), "Georges_Lib", MB_ICONERROR | MB_OK); + theApp.m_pMainWnd->MessageBox(nlUtf8ToTStr(tmp), _T("Georges_Lib"), MB_ICONERROR | MB_OK); } } @@ -666,7 +666,7 @@ IGeorges* IGeorges::getInterface (int version) // Check version number if (version != GEORGES_VERSION) { - MessageBox (NULL, "Bad version of georges.dll.", "Georges", MB_ICONEXCLAMATION|MB_OK); + MessageBox(NULL, _T("Bad version of georges.dll."), _T("Georges"), MB_ICONEXCLAMATION | MB_OK); return NULL; } else diff --git a/code/ryzom/tools/leveldesign/georges_dll/header_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/header_dialog.cpp index 8bdf3e165..0ef0e4aad 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/header_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/header_dialog.cpp @@ -86,20 +86,20 @@ BOOL CHeaderDialog::OnInitDialog() // Create the version setStaticSize (currentPos); - char versionText[512]; - smprintf (versionText, 512, "Version %d.%d", 0, 0); + CString versionText; + versionText.Format(_T("Version %d.%d"), 0, 0); LabelVersion.Create (versionText, WS_VISIBLE, currentPos, this); initWidget (LabelVersion); getNextPosLabel (currentPos); setButtonSize (currentPos, SmallWidget); - IncrementVersion.Create ("Increment Version", WS_VISIBLE|WS_TABSTOP, currentPos, this, BtIncrement); + IncrementVersion.Create (_T("Increment Version"), WS_VISIBLE|WS_TABSTOP, currentPos, this, BtIncrement); initWidget (IncrementVersion); getNextPos (currentPos); // Create the state combo setStaticSize (currentPos); - LabelState.Create ("State:", WS_VISIBLE, currentPos, this); + LabelState.Create (_T("State:"), WS_VISIBLE, currentPos, this); initWidget (LabelState); getNextPosLabel (currentPos); @@ -109,30 +109,30 @@ BOOL CHeaderDialog::OnInitDialog() ComboState.Create (WS_VISIBLE|CBS_DROPDOWNLIST|WS_TABSTOP, pos, this, CbState); uint item; for (item=0; itemmodify (new CActionString (IAction::HeaderVersion, name, *doc, "", "", + doc->modify(new CActionString(IAction::HeaderVersion, tStrToUtf8(name).c_str(), *doc, "", "", doc->getLeftView ()->getCurrentSelectionId (), 0)); } } @@ -299,7 +299,7 @@ void CHeaderDialog::setCommentsToDocument () CGeorgesEditDocSub *current = doc->getSelectedObject (); CString str; Comments.GetWindowText (str); - doc->modify (new CActionString (IAction::HeaderComments, str, *doc, "", "", + doc->modify(new CActionString(IAction::HeaderComments, tStrToUtf8(str).c_str(), *doc, "", "", doc->getLeftView ()->getCurrentSelectionId (), 0)); } } diff --git a/code/ryzom/tools/leveldesign/georges_dll/icon_wnd.cpp b/code/ryzom/tools/leveldesign/georges_dll/icon_wnd.cpp index 5a28d65e6..fd657fcc7 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/icon_wnd.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/icon_wnd.cpp @@ -85,7 +85,7 @@ void CIconWnd::create (DWORD wStyle, RECT &pos, CWnd *parent, uint dialogIndex) LPCTSTR className = AfxRegisterWndClass(CS_OWNDC); // Create this window - CWnd::Create(className, "empty", wStyle, pos, parent, dialogIndex); + CWnd::Create(className, _T("empty"), wStyle, pos, parent, dialogIndex); } bool CIconWnd::updateStr() @@ -283,14 +283,15 @@ void CIconWnd::addIconLayer(NLMISC::CBitmap &dst, const std::string iconStr, con bool CIconWnd::updateWnd(CWnd *pWnd, std::string &str) { - char buffer[512]; + TCHAR buffer[512]; if (pWnd) { pWnd->GetWindowText(buffer, 512); - if (buffer != str) + std::string buf = tStrToUtf8(buffer); + if (buf != str) { - str = buffer; + str = buf; return true; } } diff --git a/code/ryzom/tools/leveldesign/georges_dll/imagelist_ex.cpp b/code/ryzom/tools/leveldesign/georges_dll/imagelist_ex.cpp index 590e98a25..e43ed11f8 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/imagelist_ex.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/imagelist_ex.cpp @@ -27,7 +27,7 @@ using namespace NLMISC; #pragma warning (disable : 4786) -BOOL CALLBACK EnumResLangProc(HMODULE hModule, LPCSTR lpszType, LPCSTR lpszName, WORD wIDLanguage, +BOOL CALLBACK EnumResLangProc(HMODULE hModule, LPCTSTR lpszType, LPCTSTR lpszName, WORD wIDLanguage, LONG_PTR lParam) { set *iconNames = (set*)lParam; @@ -96,7 +96,7 @@ void CImageListEx::addResourceIcon (const char *filename) int height = imageInfo.rcImage.bottom - imageInfo.rcImage.top; // Load the icon - HICON handle = (HICON) LoadImage (NULL, filename, IMAGE_ICON, width, height, LR_COLOR|LR_LOADFROMFILE); + HICON handle = (HICON)LoadImage(NULL, nlUtf8ToTStr(filename), IMAGE_ICON, width, height, LR_COLOR | LR_LOADFROMFILE); if (handle) { // Copy the icon diff --git a/code/ryzom/tools/leveldesign/georges_dll/left_view.cpp b/code/ryzom/tools/leveldesign/georges_dll/left_view.cpp index 5f699dafe..8eeaebccc 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/left_view.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/left_view.cpp @@ -109,14 +109,14 @@ void CLeftView::getSubObject (CGeorgesEditDocSub *subObject, HTREEITEM parent, H if (!item) { int itemImage = subObject->getItemImage (GetDocument()); - item = TreeCtrl.InsertItem (subObject->getName ().c_str(), itemImage, itemImage, parent); + item = TreeCtrl.InsertItem(nlUtf8ToTStr(subObject->getName()), itemImage, itemImage, parent); } // Set name - TreeCtrl.SetItemText (item, subObject->getName ().c_str()); + TreeCtrl.SetItemText(item, nlUtf8ToTStr(subObject->getName())); // Set item data - TreeCtrl.SetItemData (item, (DWORD)subObject); + TreeCtrl.SetItemData (item, (DWORD_PTR)subObject); // For each children HTREEITEM child = TreeCtrl.GetChildItem (item); @@ -351,8 +351,8 @@ BOOL CLeftView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) { // Change the node name TreeCtrl.SetItemText (ptvdi->item.hItem, ptvdi->item.pszText); - doc->modify (new CActionString (IAction::FormArrayRename, ptvdi->item.pszText, *doc, - subObject->getFormName ().c_str (), toString (subObject->getIdInParent ()).c_str(), + doc->modify (new CActionString(IAction::FormArrayRename, tStrToUtf8(ptvdi->item.pszText).c_str(), *doc, + subObject->getFormName().c_str(), toString (subObject->getIdInParent()).c_str(), doc->getLeftView ()->getCurrentSelectionId (), subObject->getSlot ())); return TRUE; } @@ -878,7 +878,7 @@ void CLeftView::OnDelete() CEdit *edit = TreeCtrl.GetEditControl(); if (edit) { - edit->SetWindowText (""); + edit->SetWindowText (_T("")); } else { diff --git a/code/ryzom/tools/leveldesign/georges_dll/main_frm.cpp b/code/ryzom/tools/leveldesign/georges_dll/main_frm.cpp index 02c06fdde..9203fb605 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/main_frm.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/main_frm.cpp @@ -163,7 +163,7 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) AssertLog->addDisplayer (&Displayer); // JC: added LoadBarState - LoadBarState("Georges"); + LoadBarState(_T("Georges")); return 0; } @@ -322,7 +322,7 @@ void CMainFrame::OnClose() if (theApp.SaveAllModified()) { // JC: added save bar state - SaveBarState("Georges"); + SaveBarState(_T("Georges")); // Save state theApp.saveState (); @@ -436,7 +436,7 @@ void CMainFrame::OnUpdateModules0(CCmdUI* pCmdUI) pCmdUI->Enable (); string name; theApp.PluginArray[0].PluginInterface->getPluginName (name); - pCmdUI->SetText (name.c_str ()); + pCmdUI->SetText(nlUtf8ToTStr(name)); pCmdUI->SetCheck (theApp.PluginArray[0].Activated); } else @@ -464,7 +464,7 @@ void CMainFrame::OnUpdateModules1(CCmdUI* pCmdUI) pCmdUI->Enable (); string name; theApp.PluginArray[1].PluginInterface->getPluginName (name); - pCmdUI->SetText (name.c_str ()); + pCmdUI->SetText(nlUtf8ToTStr(name)); pCmdUI->SetCheck (theApp.PluginArray[1].Activated); } else @@ -492,7 +492,7 @@ void CMainFrame::OnUpdateModules2(CCmdUI* pCmdUI) pCmdUI->Enable (); string name; theApp.PluginArray[2].PluginInterface->getPluginName (name); - pCmdUI->SetText (name.c_str ()); + pCmdUI->SetText(nlUtf8ToTStr(name)); pCmdUI->SetCheck (theApp.PluginArray[2].Activated); } else @@ -520,7 +520,7 @@ void CMainFrame::OnUpdateModules3(CCmdUI* pCmdUI) pCmdUI->Enable (); string name; theApp.PluginArray[3].PluginInterface->getPluginName (name); - pCmdUI->SetText (name.c_str ()); + pCmdUI->SetText(nlUtf8ToTStr(name)); pCmdUI->SetCheck (theApp.PluginArray[3].Activated); } else diff --git a/code/ryzom/tools/leveldesign/georges_dll/memory_combo_box.cpp b/code/ryzom/tools/leveldesign/georges_dll/memory_combo_box.cpp index 7380a3d31..989afa15b 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/memory_combo_box.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/memory_combo_box.cpp @@ -43,7 +43,7 @@ CMemoryComboBox::~CMemoryComboBox() // *************************************************************************** -void CMemoryComboBox::create (DWORD style, const RECT &rect, CWnd *parent, UINT nId, const char *registerAdress, int memoryCount) +void CMemoryComboBox::create (DWORD style, const RECT &rect, CWnd *parent, UINT nId, const TCHAR *registerAdress, int memoryCount) { // Register a window Id = nId; @@ -52,7 +52,7 @@ void CMemoryComboBox::create (DWORD style, const RECT &rect, CWnd *parent, UINT LPCTSTR clas = AfxRegisterWndClass (0); if (clas) { - if (Create (clas, "MemoryComboBox", style, rect, parent, nId)) + if (Create (clas, _T("MemoryComboBox"), style, rect, parent, nId)) { // Create the combo box RECT comboRect; @@ -95,16 +95,16 @@ bool CMemoryComboBox::getMemory (int slot, std::string &ret) { // Open the key HKEY hKey; - if (RegOpenKey (HKEY_CURRENT_USER, RegisterAdress.c_str (), &hKey) == ERROR_SUCCESS) + if (RegOpenKey(HKEY_CURRENT_USER, RegisterAdress.c_str (), &hKey) == ERROR_SUCCESS) { // Get the value char strSrc[512]; smprintf (strSrc, 512, "%d", slot); - char str[512]; - long size = 512; - if (RegQueryValue (hKey, strSrc, str, &size) == ERROR_SUCCESS) + TCHAR str[512]; + LONG size = 512 * sizeof(TCHAR); + if (RegQueryValue(hKey, nlUtf8ToTStr(strSrc), str, &size) == ERROR_SUCCESS) { - ret = str; + ret = tStrToUtf8(str); // Close RegCloseKey (hKey); @@ -132,14 +132,14 @@ void CMemoryComboBox::scrollDown (int start, int end) // Get the old value char strSrc[512]; smprintf (strSrc, 512, "%d", i-1); - char str[512]; - long size = 512; - if (RegQueryValue (hKey, strSrc, str, &size) == ERROR_SUCCESS) + TCHAR str[512]; + LONG size = 512 * sizeof(TCHAR); + if (RegQueryValue (hKey, nlUtf8ToTStr(strSrc), str, &size) == ERROR_SUCCESS) { // Set the value char strDst[512]; smprintf (strDst, 512, "%d", i); - RegSetValue (hKey, strDst, REG_SZ, str, size); + RegSetValue (hKey, nlUtf8ToTStr(strDst), REG_SZ, str, size); } } @@ -157,7 +157,8 @@ void CMemoryComboBox::pushString (const std::string &str) if (RegCreateKey (HKEY_CURRENT_USER, RegisterAdress.c_str (), &hKey) == ERROR_SUCCESS) { // Set the value - RegSetValue (hKey, _T("0"), REG_SZ, str.c_str (), str.size ()); + tstring tstr = utf8ToTStr(str); + RegSetValue (hKey, _T("0"), REG_SZ, tstr.c_str(), (tstr.size() + 1) * sizeof(TCHAR)); // Close RegCloseKey (hKey); @@ -443,7 +444,7 @@ void CMemoryComboBox::refreshStrings () int count = Commands.size(); for (i=0; iLineIndex(edit->GetLineCount( )-1) + edit->LineLength(edit->GetLineCount( )-1); edit->SetSel (index, index); - edit->ReplaceSel (message); + edit->ReplaceSel(nlUtf8ToTStr(message)); } } diff --git a/code/ryzom/tools/leveldesign/georges_dll/reg_shell_ext.cpp b/code/ryzom/tools/leveldesign/georges_dll/reg_shell_ext.cpp index c92f2be16..ada2b9078 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/reg_shell_ext.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/reg_shell_ext.cpp @@ -21,50 +21,53 @@ using namespace std; using namespace NLMISC; -void deleteKey (HKEY hKey, const char *name) +void deleteKey(HKEY hKey, const TCHAR *name) { HKEY subKey; - if (RegOpenKey (hKey, name, &subKey) == ERROR_SUCCESS) + if (RegOpenKey(hKey, name, &subKey) == ERROR_SUCCESS) { - char subName[512]; - while (RegEnumKey (subKey, 0, subName, 512) == ERROR_SUCCESS) + TCHAR subName[512]; + while (RegEnumKey(subKey, 0, subName, 512) == ERROR_SUCCESS) { - deleteKey (subKey, subName); + deleteKey(subKey, subName); } - nlverify (RegDeleteKey (hKey, name) == ERROR_SUCCESS); + nlverify(RegDeleteKey(hKey, name) == ERROR_SUCCESS); } } // Register an application -bool RegisterApp (const char *appName, const char *appDescription, const char *icon, int iconIndex) +bool RegisterApp(const char *appName, const char *appDescription, const char *icon, int iconIndex) { // Create the app key HKEY hKey; - if (RegCreateKey (HKEY_CLASSES_ROOT, appName, &hKey) == ERROR_SUCCESS) + if (RegCreateKey(HKEY_CLASSES_ROOT, nlUtf8ToTStr(appName), &hKey) == ERROR_SUCCESS) { // Set the description - RegSetValue (hKey, "", REG_SZ, appDescription, strlen (appDescription)); - + tstring tAppDescription = utf8ToTStr(appDescription); + RegSetValue(hKey, _T(""), REG_SZ, tAppDescription.c_str(), (tAppDescription.size() + 1) * sizeof(TCHAR)); + // Create the icon HKEY hKey2; - if (RegCreateKey (hKey, "DefaultIcon", &hKey2) == ERROR_SUCCESS) + if (RegCreateKey(hKey, _T("DefaultIcon"), &hKey2) == ERROR_SUCCESS) { // Set the description char tmp[512]; - smprintf (tmp, 512, "%s,%d", icon, iconIndex); - RegSetValue (hKey2, "", REG_SZ, tmp, strlen (tmp)); + smprintf(tmp, 512, "%s,%d", icon, iconIndex); + tstring ttmp = utf8ToTStr(tmp); + RegSetValue(hKey2, _T(""), REG_SZ, ttmp.c_str(), (ttmp.size() + 1) * sizeof(TCHAR)); } // Create the shell/open/command - if (RegCreateKey (hKey, "shell", &hKey) == ERROR_SUCCESS) + if (RegCreateKey(hKey, _T("shell"), &hKey) == ERROR_SUCCESS) { - if (RegCreateKey (hKey, "open", &hKey) == ERROR_SUCCESS) + if (RegCreateKey(hKey, _T("open"), &hKey) == ERROR_SUCCESS) { - if (RegCreateKey (hKey, "command", &hKey) == ERROR_SUCCESS) + if (RegCreateKey(hKey, _T("command"), &hKey) == ERROR_SUCCESS) { // Set the description - string tmp = string(icon)+" \"%1\""; - RegSetValue (hKey, "", REG_SZ, tmp.c_str(), tmp.size()); + string tmp = string(icon) + " \"%1\""; + tstring ttmp = utf8ToTStr(tmp); + RegSetValue(hKey, _T(""), REG_SZ, ttmp.c_str(), (ttmp.size() + 1) * sizeof(TCHAR)); } } } @@ -75,43 +78,44 @@ bool RegisterApp (const char *appName, const char *appDescription, const char *i } // Unregister an application -bool UnregisterApp (const char *appName) +bool UnregisterApp(const char *appName) { // Delete the app key - deleteKey (HKEY_CLASSES_ROOT, appName); + deleteKey(HKEY_CLASSES_ROOT, nlUtf8ToTStr(appName)); return true; } // Unregister an application command -bool UnregisterAppCommand (const char *appName, const char *command) +bool UnregisterAppCommand(const char *appName, const char *command) { // Create the app key HKEY hKey; - if (RegOpenKey (HKEY_CLASSES_ROOT, appName, &hKey) == ERROR_SUCCESS) + if (RegOpenKey(HKEY_CLASSES_ROOT, nlUtf8ToTStr(appName), &hKey) == ERROR_SUCCESS) { // Create the icon char tmp[512]; - smprintf (tmp, 512, "shell\\%s", command); - deleteKey (hKey, tmp); + smprintf(tmp, 512, "shell\\%s", command); + deleteKey(hKey, nlUtf8ToTStr(tmp)); return true; } return false; } // Register an application command -bool RegisterAppCommand (const char *appName, const char *command, const char *app) +bool RegisterAppCommand(const char *appName, const char *command, const char *app) { // Create the app key HKEY hKey; - if (RegCreateKey (HKEY_CLASSES_ROOT, appName, &hKey) == ERROR_SUCCESS) + if (RegCreateKey(HKEY_CLASSES_ROOT, nlUtf8ToTStr(appName), &hKey) == ERROR_SUCCESS) { // Create the icon char tmp[512]; - smprintf (tmp, 512, "shell\\%s\\command", command); - if (RegCreateKey (hKey, tmp, &hKey) == ERROR_SUCCESS) + smprintf(tmp, 512, "shell\\%s\\command", command); + if (RegCreateKey(hKey, nlUtf8ToTStr(tmp), &hKey) == ERROR_SUCCESS) { // Set the description - RegSetValue (hKey, "", REG_SZ, app, strlen (app)); + tstring tapp = utf8ToTStr(app); + RegSetValue(hKey, _T(""), REG_SZ, tapp.c_str(), (tapp.size() + 1) * sizeof(TCHAR)); } return true; } @@ -119,41 +123,43 @@ bool RegisterAppCommand (const char *appName, const char *command, const char *a } // Unregister an application DDE command -bool UnregisterDDECommand (const char *appName, const char *command) +bool UnregisterDDECommand(const char *appName, const char *command) { // Create the app key HKEY hKey; - if (RegOpenKey (HKEY_CLASSES_ROOT, appName, &hKey) == ERROR_SUCCESS) + if (RegOpenKey(HKEY_CLASSES_ROOT, nlUtf8ToTStr(appName), &hKey) == ERROR_SUCCESS) { // Create the icon char tmp[512]; - smprintf (tmp, 512, "shell\\%s\\ddeexec", command); - deleteKey (hKey, tmp); + smprintf(tmp, 512, "shell\\%s\\ddeexec", command); + deleteKey(hKey, nlUtf8ToTStr(tmp)); } return false; } // Register an application DDE command -bool RegisterDDECommand (const char *appName, const char *command, const char *ddeCommand, const char *application) +bool RegisterDDECommand(const char *appName, const char *command, const char *ddeCommand, const char *application) { // Create the app key HKEY hKey; - if (RegCreateKey (HKEY_CLASSES_ROOT, appName, &hKey) == ERROR_SUCCESS) + if (RegCreateKey(HKEY_CLASSES_ROOT, nlUtf8ToTStr(appName), &hKey) == ERROR_SUCCESS) { // Create the icon char tmp[512]; - smprintf (tmp, 512, "shell\\%s\\ddeexec", command); - if (RegCreateKey (hKey, tmp, &hKey) == ERROR_SUCCESS) + smprintf(tmp, 512, "shell\\%s\\ddeexec", command); + if (RegCreateKey(hKey, nlUtf8ToTStr(tmp), &hKey) == ERROR_SUCCESS) { // Set the description - RegSetValue (hKey, "", REG_SZ, ddeCommand, strlen (ddeCommand)); + tstring tddeCommand = utf8ToTStr(ddeCommand); + RegSetValue(hKey, _T(""), REG_SZ, tddeCommand.c_str(), (tddeCommand.size() + 1) * sizeof(TCHAR)); HKEY hKey2; - if (RegCreateKey (hKey, "application", &hKey2) == ERROR_SUCCESS) + if (RegCreateKey(hKey, _T("application"), &hKey2) == ERROR_SUCCESS) { - RegSetValue (hKey2, "", REG_SZ, application, strlen (application)); - if (RegCreateKey (hKey, "topic", &hKey2) == ERROR_SUCCESS) + tstring tapplication = utf8ToTStr(application); + RegSetValue(hKey2, _T(""), REG_SZ, tapplication.c_str(), (tapplication.size() + 1) * sizeof(TCHAR)); + if (RegCreateKey(hKey, _T("topic"), &hKey2) == ERROR_SUCCESS) { - RegSetValue (hKey2, "", REG_SZ, "system", strlen ("system")); + RegSetValue(hKey2, _T(""), REG_SZ, _T("system"), (strlen("system") + 1) * sizeof(TCHAR)); return true; } } @@ -163,28 +169,29 @@ bool RegisterDDECommand (const char *appName, const char *command, const char *d } // Register a file extension -bool RegisterShellFileExt (const char *ext, const char *appName) +bool RegisterShellFileExt(const char *ext, const char *appName) { // Remove key in explorer registry if exist HKEY hKey; - string key = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\"+string (ext); - deleteKey (HKEY_CURRENT_USER, key.c_str ()); + string key = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\" + string(ext); + deleteKey(HKEY_CURRENT_USER, nlUtf8ToTStr(key)); // Create the app key - if (RegCreateKey (HKEY_CLASSES_ROOT, ext, &hKey) == ERROR_SUCCESS) + if (RegCreateKey(HKEY_CLASSES_ROOT, nlUtf8ToTStr(ext), &hKey) == ERROR_SUCCESS) { // Set the description - RegSetValue (hKey, "", REG_SZ, appName, strlen (appName)); + tstring tAppName = utf8ToTStr(appName); + RegSetValue(hKey, _T(""), REG_SZ, tAppName.c_str(), (tAppName.size() + 1) * sizeof(TCHAR)); return true; } return false; } // Register a file extension -bool UnregisterShellFileExt (const char *ext) +bool UnregisterShellFileExt(const char *ext) { // Delete the app key - if (RegDeleteKey (HKEY_CLASSES_ROOT, ext) == ERROR_SUCCESS) + if (RegDeleteKey(HKEY_CLASSES_ROOT, nlUtf8ToTStr(ext)) == ERROR_SUCCESS) { return true; } diff --git a/code/ryzom/tools/leveldesign/georges_dll/settings_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/settings_dialog.cpp index e57888595..55bd70607 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/settings_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/settings_dialog.cpp @@ -103,13 +103,13 @@ void CSettingsDialog::OnOK() UpdateData (); // Make a config file - theApp.RootSearchPath = RootSearchPath; - theApp.TypeDfnSubDirectory = TypeDfnSubDirectory; + theApp.RootSearchPath = NLMISC::tStrToUtf8(RootSearchPath); + theApp.TypeDfnSubDirectory = NLMISC::tStrToUtf8(TypeDfnSubDirectory); theApp.RememberListSize = RememberListSize; theApp.StartExpanded = StartExpanded ? TRUE : FALSE; theApp.MaxUndo = MaxUndo; - theApp.DefaultDfn = DefaultDfn; - theApp.DefaultType = DefaultType; + theApp.DefaultDfn = NLMISC::tStrToUtf8(DefaultDfn); + theApp.DefaultType = NLMISC::tStrToUtf8(DefaultType); theApp.saveCfg (); theApp.initCfg (); @@ -118,30 +118,30 @@ void CSettingsDialog::OnOK() void CSettingsDialog::OnBrowse() { - UpdateData (); - + UpdateData(); + // Select a directory. - char path[MAX_PATH]; + TCHAR path[MAX_PATH]; // Build the struct BROWSEINFO info; - memset (&info, 0, sizeof (BROWSEINFO)); - info.lpszTitle="Select the root search directory"; - info.ulFlags=BIF_RETURNONLYFSDIRS; + memset(&info, 0, sizeof(BROWSEINFO)); + info.lpszTitle = _T("Select the root search directory"); + info.ulFlags = BIF_RETURNONLYFSDIRS; // Select the path LPITEMIDLIST list; - if (list=SHBrowseForFolder (&info)) + if (list = SHBrowseForFolder(&info)) { // Convert item into path string - BOOL bRet=SHGetPathFromIDList(list, path); + BOOL bRet = SHGetPathFromIDList(list, path); if (bRet) { // Set the path RootSearchPath = path; } - } - UpdateData (FALSE); + } + UpdateData(FALSE); } void CSettingsDialog::OnChangeRememberListSize() diff --git a/code/ryzom/tools/leveldesign/georges_dll/stdafx.h b/code/ryzom/tools/leveldesign/georges_dll/stdafx.h index 91a0d1f9a..cd230a597 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/stdafx.h +++ b/code/ryzom/tools/leveldesign/georges_dll/stdafx.h @@ -26,8 +26,13 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include // MFC core and standard components #include // MFC extensions diff --git a/code/ryzom/tools/leveldesign/georges_dll/type_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/type_dialog.cpp index 53698ea8f..fac9c64bd 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/type_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/type_dialog.cpp @@ -88,7 +88,7 @@ BOOL CTypeDialog::OnInitDialog() // Create the type combo setStaticSize (currentPos); - LabelType.Create ("Type:", WS_VISIBLE, currentPos, this); + LabelType.Create (_T("Type:"), WS_VISIBLE, currentPos, this); initWidget (LabelType); getNextPosLabel (currentPos); @@ -101,7 +101,7 @@ BOOL CTypeDialog::OnInitDialog() uint item; ComboType.ResetContent (); for (item=0; itemGetDocument (); + CGeorgesEditDoc *doc = View->GetDocument(); if (doc) { - CGeorgesEditDocSub *current = doc->getSelectedObject (); + CGeorgesEditDocSub *current = doc->getSelectedObject(); if (current) { CString str; - Default.UpdateData (); - Default.GetWindowText (str); + Default.UpdateData(); + Default.GetWindowText(str); - doc->modify (new CActionString (IAction::TypeDefault, str, *doc, "", "", - doc->getLeftView ()->getCurrentSelectionId (), 0)); + doc->modify(new CActionString(IAction::TypeDefault, nlTStrToUtf8(str), *doc, "", "", + doc->getLeftView()->getCurrentSelectionId(), 0)); } } } void CTypeDialog::setMinToDocument () { - CGeorgesEditDoc *doc = View->GetDocument (); + CGeorgesEditDoc *doc = View->GetDocument(); if (doc) { - CGeorgesEditDocSub *current = doc->getSelectedObject (); + CGeorgesEditDocSub *current = doc->getSelectedObject(); if (current) { CString str; - Min.UpdateData (); - Min.GetWindowText (str); + Min.UpdateData(); + Min.GetWindowText(str); - doc->modify (new CActionString (IAction::TypeMin, str, *doc, "", "", - doc->getLeftView ()->getCurrentSelectionId (), 0)); + doc->modify(new CActionString(IAction::TypeMin, nlTStrToUtf8(str), *doc, "", "", + doc->getLeftView()->getCurrentSelectionId(), 0)); } } } -void CTypeDialog::setMaxToDocument () +void CTypeDialog::setMaxToDocument() { - CGeorgesEditDoc *doc = View->GetDocument (); + CGeorgesEditDoc *doc = View->GetDocument(); if (doc) { - CGeorgesEditDocSub *current = doc->getSelectedObject (); + CGeorgesEditDocSub *current = doc->getSelectedObject(); CString str; - Max.UpdateData (); - Max.GetWindowText (str); + Max.UpdateData(); + Max.GetWindowText(str); - doc->modify (new CActionString (IAction::TypeMax, str, *doc, "", "", - doc->getLeftView ()->getCurrentSelectionId (), 0)); + doc->modify(new CActionString(IAction::TypeMax, nlTStrToUtf8(str), *doc, "", "", + doc->getLeftView()->getCurrentSelectionId(), 0)); } } -void CTypeDialog::setIncrementToDocument () +void CTypeDialog::setIncrementToDocument() { - CGeorgesEditDoc *doc = View->GetDocument (); + CGeorgesEditDoc *doc = View->GetDocument(); if (doc) { - CGeorgesEditDocSub *current = doc->getSelectedObject (); + CGeorgesEditDocSub *current = doc->getSelectedObject(); CString str; - Increment.UpdateData (); - Increment.GetWindowText (str); + Increment.UpdateData(); + Increment.GetWindowText(str); - doc->modify (new CActionString (IAction::TypeIncrement, str, *doc, "", "", - doc->getLeftView ()->getCurrentSelectionId (), 0)); + doc->modify(new CActionString(IAction::TypeIncrement, nlTStrToUtf8(str), *doc, "", "", + doc->getLeftView()->getCurrentSelectionId(), 0)); } } diff --git a/code/ryzom/tools/leveldesign/georges_exe/georges_exe.cpp b/code/ryzom/tools/leveldesign/georges_exe/georges_exe.cpp index 864a74bd7..5f4fa18ca 100644 --- a/code/ryzom/tools/leveldesign/georges_exe/georges_exe.cpp +++ b/code/ryzom/tools/leveldesign/georges_exe/georges_exe.cpp @@ -31,11 +31,7 @@ using namespace std; - -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) +int APIENTRY nltWinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPTSTR lpCmdLine, int nCmdShow) { // Init the NeL application context NLMISC::CApplicationContext context; @@ -48,7 +44,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, // Init ui pGeorges->initUI(nCmdShow, true); - string cmd = lpCmdLine; + string cmd = NLMISC::tStrToUtf8(lpCmdLine); if(!cmd.empty()) { nlinfo("Using command line '%s'", cmd.c_str()); diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.cpp index 8b9092b4c..45a4985b9 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.cpp @@ -191,11 +191,11 @@ BOOL CPageBgFades::OnInitDialog() for (uint i =0; i<32; ++i) { char tmp[128]; - GetDlgItem(FILTER_NAMES[i])->SetWindowText(SoundDialog->EnvNames[i].Name.c_str()); - sprintf(tmp, "%u", SoundDialog->FilterFades.FadeIns[i]); - GetDlgItem(FILTER_FADE_IN[i])->SetWindowText(tmp); - sprintf(tmp, "%u", SoundDialog->FilterFades.FadeOuts[i]); - GetDlgItem(FILTER_FADE_OUT[i])->SetWindowText(tmp); + GetDlgItem(FILTER_NAMES[i])->SetWindowText(nlUtf8ToTStr(SoundDialog->EnvNames[i].Name)); + sprintf(tmp, "%u", (unsigned int)SoundDialog->FilterFades.FadeIns[i]); + GetDlgItem(FILTER_FADE_IN[i])->SetWindowText(nlUtf8ToTStr(tmp)); + sprintf(tmp, "%u", (unsigned int)SoundDialog->FilterFades.FadeOuts[i]); + GetDlgItem(FILTER_FADE_OUT[i])->SetWindowText(nlUtf8ToTStr(tmp)); } SoundDialog->getSoundPlugin()->getMixer()->setBackgroundFilterFades(SoundDialog->FilterFades); @@ -209,20 +209,20 @@ BOOL CPageBgFades::OnCommand(WPARAM wParam, LPARAM lParam) if (lParam != 0 && HIWORD(wParam) == EN_CHANGE) { int id = ::GetDlgCtrlID(HWND(lParam)); - char tmp[1024]; + TCHAR tmp[1024]; if (FILTER_FADE_IN_IDX.find(id) != FILTER_FADE_IN_IDX.end()) { // this is a fade in value modified ! GetDlgItem(id)->GetWindowText(tmp, 1024); - SoundDialog->FilterFades.FadeIns[FILTER_FADE_IN_IDX[id]] = atoi(tmp); + SoundDialog->FilterFades.FadeIns[FILTER_FADE_IN_IDX[id]] = atoi(nlTStrToUtf8(tmp)); SoundDialog->getSoundPlugin()->getMixer()->setBackgroundFilterFades(SoundDialog->FilterFades); } else if (FILTER_FADE_OUT_IDX.find(id) != FILTER_FADE_OUT_IDX.end()) { // this is a fade in value modified ! GetDlgItem(id)->GetWindowText(tmp, 1024); - SoundDialog->FilterFades.FadeOuts[FILTER_FADE_OUT_IDX[id]] = atoi(tmp); + SoundDialog->FilterFades.FadeOuts[FILTER_FADE_OUT_IDX[id]] = atoi(nlTStrToUtf8(tmp)); SoundDialog->getSoundPlugin()->getMixer()->setBackgroundFilterFades(SoundDialog->FilterFades); } } diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.cpp index 239c5b370..c844e7ca6 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.cpp @@ -421,8 +421,8 @@ BOOL CPageBgFlags::OnInitDialog() const NLSOUND::UAudioMixer::TBackgroundFlags &flag = SoundDialog->getSoundPlugin()->getMixer()->getBackgroundFlags(); for (uint i=0; i<32; ++i) { - GetDlgItem(FILTER_EDIT_NAME[i])->SetWindowText(SoundDialog->EnvNames[i].Name.c_str()); - GetDlgItem(FILTER_SIM_NAME[i])->SetWindowText(SoundDialog->EnvNames[i].ShortName.c_str()); + GetDlgItem(FILTER_EDIT_NAME[i])->SetWindowText(nlUtf8ToTStr(SoundDialog->EnvNames[i].Name)); + GetDlgItem(FILTER_SIM_NAME[i])->SetWindowText(nlUtf8ToTStr(SoundDialog->EnvNames[i].ShortName)); static_cast(GetDlgItem(FILTER_SIM[i]))->SetCheck(flag.Flags[i] ? 1 : 0); } diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.cpp index b3add5365..f36c3563b 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.cpp @@ -95,9 +95,9 @@ BOOL CPageComtext::OnCommand(WPARAM wParam, LPARAM lParam) if (EDIT_ARG_IDX.find(id) != EDIT_ARG_IDX.end()) { // need to update the var. - char tmp[1024]; + TCHAR tmp[1024]; GetDlgItem(id)->GetWindowText(tmp, 1024); - SoundContext.Args[EDIT_ARG_IDX[id]] = atoi(tmp); + SoundContext.Args[EDIT_ARG_IDX[id]] = atoi(nlTStrToUtf8(tmp)); } } diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/georges_plugin_sound.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/georges_plugin_sound.cpp index dd76b9f9e..a45b96f4e 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/georges_plugin_sound.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/georges_plugin_sound.cpp @@ -49,14 +49,13 @@ __declspec( dllexport ) IEditPlugin *IGeorgesEditGetInterface (int version, NLGE } catch (const std::exception &e) { - string reason = e.what(); - MessageBox (NULL, reason.c_str(), "Sound plugin", MB_OK); + MessageBox (NULL, nlUtf8ToTStr(e.what()), _T("Sound plugin"), MB_OK); return NULL; } } else { - MessageBox (NULL, "Plugin version invalid.", "Sound plugin for georges editor", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, _T("Plugin version invalid."), _T("Sound plugin for georges editor"), MB_OK|MB_ICONEXCLAMATION); return NULL; } diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/listener_view.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/listener_view.cpp index 78d8d0ce8..867f0c7a2 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/listener_view.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/listener_view.cpp @@ -68,7 +68,7 @@ bool CListenerView::registerClass() } catch (CResourceException* e) { - AfxMessageBox("Couldn't register class! (Already registered?)"); + AfxMessageBox(_T("Couldn't register class! (Already registered?)")); e->Delete(); return false; } @@ -80,7 +80,7 @@ bool CListenerView::registerClass() _VolumeCurve.CreatePen(PS_SOLID, 1, RGB(255, 0, 128)); _Font.CreateFont(14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, - CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "Arial"); + CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, _T("Arial")); return true; } @@ -99,7 +99,7 @@ void CListenerView::init(CSoundPlugin* plugin, CRect& rect, CWnd* parent) _OuterAngle = 360; _InnerAngle = 360; - if (!Create((LPCTSTR) _WndClass, "Listener", WS_CHILD | WS_VISIBLE, rect, parent, ++_WndId)) + if (!Create((LPCTSTR) _WndClass, _T("Listener"), WS_CHILD | WS_VISIBLE, rect, parent, ++_WndId)) { throw exception("failed to create the listener view"); } 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 58ea1e9da..2b60fd098 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_dialog.cpp @@ -239,7 +239,7 @@ void CSoundDialog::displayTime(uint32 msec) uint min = sec / 60; sec -= min * 60; _snprintf(s, 256, "%02d:%02d", min, sec); - GetDlgItem(IDC_TIME)->SetWindowText(s); + GetDlgItem(IDC_TIME)->SetWindowText(nlUtf8ToTStr(s)); } // *************************************************************************** @@ -285,7 +285,7 @@ void CSoundDialog::updateInfo() CPageBase::docChanged(); - SetWindowText(_Name.c_str()); + SetWindowText(nlUtf8ToTStr(_Name)); char s[256]; /* if (_Filename.empty()) @@ -342,7 +342,7 @@ void CSoundDialog::updateInfo() msec -= sec * 1000; sec -= min * 60; _snprintf(s, 256, "%02d:%02d.%03d", min, sec, msec); - GetDlgItem(IDC_DURATION)->SetWindowText(s); + GetDlgItem(IDC_DURATION)->SetWindowText(nlUtf8ToTStr(s)); updateButton(); } @@ -361,7 +361,7 @@ bool CSoundDialog::getFileInfo(string& filename, uint& sampleRate, uint& sampleS } // Open the file - HMMIO hmmio = mmioOpen((char*) path.c_str(), NULL, MMIO_READ | MMIO_DENYWRITE); + HMMIO hmmio = mmioOpen((LPTSTR)nlUtf8ToTStr(path), NULL, MMIO_READ | MMIO_DENYWRITE); if (hmmio == NULL) { return false; @@ -484,7 +484,7 @@ void CSoundDialog::OnControlPlayback() if (str == "*.sound") { - MessageBox("You must save the file before playing it !", "Warning"); + MessageBox(_T("You must save the file before playing it !"), _T("Warning")); return; } } diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_plugin.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_plugin.cpp index e7c6b844c..47c8ed239 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_plugin.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/sound_plugin.cpp @@ -362,7 +362,7 @@ void CSoundPlugin::setActiveDocument(IEditDocument *pdoc) if (invalid && !_InvalidSound) { - MessageBox(NULL, "This sound contains an infinite recursion !", "Sound Error", MB_ICONERROR); + MessageBox(NULL, _T("This sound contains an infinite recursion !"), _T("Sound Error"), MB_ICONERROR); } // pre-create the sound to force loading any missing sample bank (thus avoiding unwanted message box) @@ -410,7 +410,7 @@ void CSoundPlugin::setActiveDocument(IEditDocument *pdoc) message += (*first)+"\n"; } - MessageBox(NULL, message.c_str(), "Sound incomplete", MB_ICONWARNING); + MessageBox(NULL, nlUtf8ToTStr(message), _T("Sound incomplete"), MB_ICONWARNING); } @@ -474,12 +474,12 @@ void CSoundPlugin::onCreateDocument(IEditDocument *document) void CSoundPlugin::createNew() { AFX_MANAGE_STATE(AfxGetStaticModuleState()); - char BASED_CODE szFilter[] = "Sound (*.sound)|*.sound|All Files (*.*)|*.*||"; - CFileDialog fileDlg(FALSE, ".sound", "*.sound", OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); + TCHAR BASED_CODE szFilter[] = _T("Sound (*.sound)|*.sound|All Files (*.*)|*.*||"); + CFileDialog fileDlg(FALSE, _T(".sound"), _T("*.sound"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); if (fileDlg.DoModal() == IDOK) { - string filename = (const char*) fileDlg.GetPathName(); + string filename = NLMISC::tStrToUtf8(fileDlg.GetPathName()); _GlobalInterface->createDocument("sound.dfn", filename.c_str()); } } @@ -585,8 +585,7 @@ void CSoundPlugin::play(std::string &filename) } catch (ESoundDriver& e) { - string reason = e.what(); - MessageBox (NULL, reason.c_str(), "Sound plugin", MB_OK); + MessageBox(NULL, nlUtf8ToTStr(e.what()), _T("Sound plugin"), MB_OK); } } diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/std_sound_plugin.h b/code/ryzom/tools/leveldesign/georges_plugin_sound/std_sound_plugin.h index 8fb65c948..f03a63bdc 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/std_sound_plugin.h +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/std_sound_plugin.h @@ -18,8 +18,13 @@ #define STDAFX_H #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include // MFC core and standard components #include // MFC extensions diff --git a/code/ryzom/tools/leveldesign/mission_compiler_fe/StdAfx.h b/code/ryzom/tools/leveldesign/mission_compiler_fe/StdAfx.h index b8693c571..1d127a59b 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_fe/StdAfx.h +++ b/code/ryzom/tools/leveldesign/mission_compiler_fe/StdAfx.h @@ -27,8 +27,13 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include // MFC core and standard components #include // MFC extensions diff --git a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_fe.cpp b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_fe.cpp index 9cea31379..73ee44428 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_fe.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_fe.cpp @@ -79,7 +79,7 @@ BOOL CMissionCompilerFeApp::InitInstance() #endif // look at the command line parameters for command line mode - string cmdLine = m_lpCmdLine; + string cmdLine = NLMISC::tStrToUtf8(m_lpCmdLine); if (cmdLine.find("-c") != string::npos) { NLMISC::createDebug(); diff --git a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp index fdbf9e668..350203ae7 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_fe/mission_compiler_feDlg.cpp @@ -184,7 +184,7 @@ BOOL CMissionCompilerFeDlg::OnInitDialog() if (SearchPaths.size() > 1) { CWnd* pWnd = GetDlgItem(IDC_PATH_WARNING); - pWnd->SetWindowText("Warning ! config file contains more than one path ! Only the first is shown ! "); + pWnd->SetWindowText(_T("Warning ! config file contains more than one path ! Only the first is shown ! ")); } UpdateData(FALSE); @@ -196,16 +196,16 @@ BOOL CMissionCompilerFeDlg::OnInitDialog() // Check if the file "tmptool.txt" exists in system temp directory // It's that way world_editor pass arguments to the program // The file contains a list of primitives to select - char tmpPath[MAX_PATH]; - GetEnvironmentVariable("TMP", tmpPath, MAX_PATH); - strcat(tmpPath, "\\tmptool.txt"); + TCHAR tmpPath[MAX_PATH]; + GetEnvironmentVariable(_T ("TMP"), tmpPath, MAX_PATH); + _tcscat(tmpPath, _T("\\tmptool.txt")); - if (NLMISC::CFile::fileExists(tmpPath)) + if (NLMISC::CFile::fileExists(NLMISC::tStrToUtf8(tmpPath))) { - FILE *f = nlfopen(tmpPath, "r"); + FILE *f = _tfopen(tmpPath, _T("r")); if (f == NULL) { - nlinfo("Can't open the file for reading !\n%s", tmpPath); + nlinfo("Can't open the file for reading !\n%s", nlTStrToUtf8(tmpPath)); return TRUE; } @@ -222,7 +222,7 @@ BOOL CMissionCompilerFeDlg::OnInitDialog() fclose(f); // delete temp file - NLMISC::CFile::deleteFile(tmpPath); + NLMISC::CFile::deleteFile(NLMISC::tStrToUtf8(tmpPath)); // Test to check if the primitive is in src list // If it is, erase it form src and add it to dest @@ -240,8 +240,8 @@ BOOL CMissionCompilerFeDlg::OnInitDialog() files[i] = toUpper(CPath::standardizeDosPath(files[i])); if (srcPath != files[i]) { - ::MessageBox(NULL, "Primitive path and working directory are not the same !", - "Mission compiler", MB_OK|MB_ICONEXCLAMATION); + ::MessageBox(NULL, _T("Primitive path and working directory are not the same !"), + _T("Mission compiler"), MB_OK|MB_ICONEXCLAMATION); } else { @@ -252,8 +252,8 @@ BOOL CMissionCompilerFeDlg::OnInitDialog() else { char buffer[1024]; - sprintf(buffer, "Can't find primitive in the directory !\n%s\n", files[i].c_str(), m_dataDirectory); - ::MessageBox(NULL, buffer, "Mission compiler", MB_OK|MB_ICONEXCLAMATION); + sprintf(buffer, "Can't find primitive in the directory !\n%s\n", files[i].c_str(), nlTStrToUtf8(m_dataDirectory)); + ::MessageBox(NULL, nlUtf8ToTStr(buffer), _T("Mission compiler"), MB_OK|MB_ICONEXCLAMATION); } } @@ -274,7 +274,7 @@ void CMissionCompilerFeDlg::fillSourceList() addPath.CenterWindow(); addPath.ShowWindow(SW_SHOW); - string log(addPath.m_addPathLog); + string log = tStrToUtf8(addPath.m_addPathLog); log += "Reading config file\r\n"; addPath.m_addPathLog = log.c_str(); addPath.UpdateData(FALSE); @@ -283,7 +283,7 @@ void CMissionCompilerFeDlg::fillSourceList() // Fill the src list with available primitives for (uint i=0; iasString(); else { - AfxMessageBox("Can't find configuration var 'ligo_config', fatal", MB_OK); + AfxMessageBox(_T("Can't find configuration var 'ligo_config', fatal"), MB_OK); PostQuitMessage(-1); return false; } @@ -383,7 +383,7 @@ bool CMissionCompilerFeDlg::readConfigFile() { CWnd* pWnd = GetDlgItem(IDC_CHECK_SRV1 + i); pWnd->EnableWindow(TRUE); - pWnd->SetWindowText(names->asString(i).c_str()); + pWnd->SetWindowText(nlUtf8ToTStr(names->asString(i))); ServerName.push_back(names->asString(i)); ServerPathPrim.push_back(pathsPrim->asString(i)); @@ -412,15 +412,15 @@ void CMissionCompilerFeDlg::updateFileList() for (uint i=0; first != last; ++first) { if (m_filter.GetLength() == 0) - m_listSrc.InsertString(i++, first->first.c_str()); + m_listSrc.InsertString(i++, nlUtf8ToTStr(first->first)); else { // check the filter - string filter(m_filter.LockBuffer()); + string filter = tStrToUtf8(m_filter.LockBuffer()); m_filter.UnlockBuffer(); if (first->first.find(filter) != string::npos) - m_listSrc.InsertString(i++, first->first.c_str()); + m_listSrc.InsertString(i++, nlUtf8ToTStr(first->first)); } } } @@ -429,7 +429,7 @@ void CMissionCompilerFeDlg::updateFileList() TFileList::iterator first(_DstList.begin()), last(_DstList.end()); for (uint i=0; first != last; ++first,++i) { - m_listDst.InsertString(i, first->first.c_str()); + m_listDst.InsertString(i, nlUtf8ToTStr(first->first)); } } } @@ -493,7 +493,7 @@ void CMissionCompilerFeDlg::compile(BOOL publish) dlg.UpdateData(FALSE); // dlg.m_compileLogCtrl.SetSel(compileLog.size(), compileLog.size(), FALSE); dlg.RedrawWindow(); - AfxMessageBox(msg.c_str()); + AfxMessageBox(nlUtf8ToTStr(msg)); break; } } @@ -569,7 +569,7 @@ void CMissionCompilerFeDlg::OnAdd() { CString tmp; m_listSrc.GetText(sel[i], tmp); - string file(tmp.LockBuffer()); + string file = tStrToUtf8(tmp.LockBuffer()); tmp.UnlockBuffer(); _DstList.insert(make_pair(file, _SrcList[file])); _SrcList.erase(file); @@ -585,7 +585,7 @@ void CMissionCompilerFeDlg::OnAddAll() { CString tmp; m_listSrc.GetText(0, tmp); - string file(tmp.LockBuffer()); + string file = tStrToUtf8(tmp.LockBuffer()); tmp.UnlockBuffer(); _DstList.insert(make_pair(file, _SrcList[file])); @@ -608,7 +608,7 @@ void CMissionCompilerFeDlg::OnRemove() { CString tmp; m_listDst.GetText(sel[i], tmp); - string file(tmp.LockBuffer()); + string file = tStrToUtf8(tmp.LockBuffer()); tmp.UnlockBuffer(); _SrcList.insert(make_pair(file, _DstList[file])); _DstList.erase(file); @@ -662,7 +662,7 @@ void CMissionCompilerFeDlg::OnSpecialRuncompilertest() CMissionCompiler mc; if (!mc.compileMissions(primDoc.RootNode, sourceDocName)) { - AfxMessageBox("Error while compiling the test primitive, correct error(s) first"); + AfxMessageBox(_T("Error while compiling the test primitive, correct error(s) first")); return; } TMissionDataPtr testMission = mc.getMission(0); @@ -699,7 +699,7 @@ void CMissionCompilerFeDlg::OnSpecialRuncompilertest() { string msg = "In primitive "; msg += buildPrimPath(e.Primitive) + ": " + e.Why; - AfxMessageBox(utf8ToTStr(msg)); + AfxMessageBox(nlUtf8ToTStr(msg)); } } @@ -991,21 +991,21 @@ void CMissionCompilerFeDlg::OnChangeDir() // open a dialog to choose a directory BROWSEINFO bi; - char str[MAX_PATH]; - ITEMIDLIST* pidl; - char sTemp[1024]; + TCHAR str[MAX_PATH]; + LPITEMIDLIST pidl; + TCHAR sTemp[1024]; // fill the structure with options bi.hwndOwner = this->m_hWnd; bi.pidlRoot = NULL; bi.pidlRoot = NULL; bi.pszDisplayName = sTemp; - bi.lpszTitle = "Choose the data directory"; + bi.lpszTitle = _T("Choose the data directory"); bi.ulFlags = 0; bi.lpfn = dataDirBrowseCallbackProc; - char sDir[512]; - strcpy(sDir, m_dataDirectory); + TCHAR sDir[512]; + _tcscpy(sDir, m_dataDirectory); bi.lParam = (LPARAM)sDir; bi.iImage = 0; pidl = SHBrowseForFolder (&bi); @@ -1013,7 +1013,7 @@ void CMissionCompilerFeDlg::OnChangeDir() if (SHGetPathFromIDList(pidl, str)) { m_dataDirectory = str; - SearchPaths[0] = str; + SearchPaths[0] = tStrToUtf8(str); fillSourceList(); updateFileList(); UpdateData(FALSE); @@ -1023,7 +1023,7 @@ void CMissionCompilerFeDlg::OnChangeDir() void CMissionCompilerFeDlg::OnChangeDataDir() { UpdateData(TRUE); - SearchPaths[0] = m_dataDirectory; + SearchPaths[0] = tStrToUtf8(m_dataDirectory); fillSourceList(); updateFileList(); UpdateData(FALSE); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp index c380db296..5e6119d89 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp @@ -130,10 +130,10 @@ bool CDataBase::init (const string &Path, CZoneBank &zb) string sDirBackup = NLMISC::CPath::getCurrentPath(); // "Path" can be relative to the doc path so we have to be first in the doc path - string s2 = NLMISC::CFile::getPath (tStrToUtf8(getMainFrame()->getDocument()->GetPathName())); + string s2 = NLMISC::CFile::getPath(NLMISC::tStrToUtf8(getMainFrame()->getDocument()->GetPathName())); NLMISC::CPath::setCurrentPath(s2.c_str()); string ss = NLMISC::CPath::getFullPath(Path); - NLMISC::CPath::setCurrentPath (ss.c_str()); + NLMISC::CPath::setCurrentPath(ss.c_str()); uint32 i, m, n, o, p; uint8 k, l; @@ -623,7 +623,7 @@ bool CBuilderZone::refresh () { unload (_ZoneRegionSelected); std::string msg = NLMISC::toString("Cannot add this zone :\n%s", error.c_str()); - MessageBox (NULL, utf8ToTStr(msg), _T("Error"), MB_ICONERROR|MB_OK); + MessageBox (NULL, nlUtf8ToTStr(msg), _T("Error"), MB_ICONERROR|MB_OK); return false; } @@ -1600,25 +1600,25 @@ bool CBuilderZone::initZoneBank (const string &sPathName) { // TODO: replace by NeL methods TCHAR sDirBackup[512]; - GetCurrentDirectory (512, sDirBackup); - SetCurrentDirectory (utf8ToTStr(sPathName)); + GetCurrentDirectory(512, sDirBackup); + SetCurrentDirectory(nlUtf8ToTStr(sPathName)); WIN32_FIND_DATA findData; HANDLE hFind; - hFind = FindFirstFile (_T("*.ligozone"), &findData); - + hFind = FindFirstFile(_T("*.ligozone"), &findData); + while (hFind != INVALID_HANDLE_VALUE) { // If the name of the file is not . or .. then its a valid entry in the DataBase - if (!((_tcscmp (findData.cFileName, _T(".")) == 0) || (_tcscmp (findData.cFileName, _T("..")) == 0))) + if (!((_tcscmp(findData.cFileName, _T(".")) == 0) || (_tcscmp(findData.cFileName, _T("..")) == 0))) { string error; - if (!_ZoneBank.addElement (tStrToUtf8(findData.cFileName), error)) - theApp.errorMessage (error.c_str()); + if (!_ZoneBank.addElement(NLMISC::tStrToUtf8(findData.cFileName), error)) + theApp.errorMessage(error.c_str()); } - if (FindNextFile (hFind, &findData) == 0) + if (FindNextFile(hFind, &findData) == 0) break; } - SetCurrentDirectory (sDirBackup); + SetCurrentDirectory(sDirBackup); return true; } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/dialog_properties.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/dialog_properties.cpp index 2b0a88527..5a4ebc39e 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/dialog_properties.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/dialog_properties.cpp @@ -352,7 +352,7 @@ void CDialogProperties::addWidget (const CPrimitiveClass::CParameter ¶meter, string Name = widget.Parameter.Name; // Create a check box - nlverify (widget.CheckBox.Create (utf8ToTStr(Name), BS_3STATE|WS_VISIBLE|WS_TABSTOP|(enabled?0:WS_DISABLED), widgetPos, &m_PropertyCont, id)); + nlverify(widget.CheckBox.Create(nlUtf8ToTStr(Name), BS_3STATE | WS_VISIBLE | WS_TABSTOP | (enabled ? 0 : WS_DISABLED), widgetPos, &m_PropertyCont, id)); widget.CheckBox.SetFont (GetFont ()); } else if (widget.Parameter.Type == CPrimitiveClass::CParameter::ConstString) @@ -522,7 +522,7 @@ void CDialogProperties::addWidget (const CPrimitiveClass::CParameter ¶meter, for (vector::iterator it=PathList.begin(), itEnd=PathList.end(); it!=itEnd; ++it) { - widget.ListEditBox.StringSelectComboBox.InsertString( -1, utf8ToTStr(*it)); + widget.ListEditBox.StringSelectComboBox.InsertString( -1, nlUtf8ToTStr(*it)); } } @@ -549,7 +549,7 @@ void CDialogProperties::addWidget (const CPrimitiveClass::CParameter ¶meter, for (vector::iterator it=PathList.begin(), itEnd=PathList.end(); it!=itEnd; ++it) { - widget.ListEditBox.StringSelectComboBox.InsertString( -1, utf8ToTStr(*it)); + widget.ListEditBox.StringSelectComboBox.InsertString(-1, nlUtf8ToTStr(*it)); } } } @@ -915,11 +915,11 @@ bool CDialogProperties::CWidget::fromParameter (const IProperty *property, const updateBoolean (); break; case CPrimitiveClass::CParameter::ConstString: - if (Parameter.Editable || ComboBox.SelectString(-1, utf8ToTStr(propString->String)) == CB_ERR) + if (Parameter.Editable || ComboBox.SelectString(-1, nlUtf8ToTStr(propString->String)) == CB_ERR) { - ComboBox.SetWindowText(utf8ToTStr(propString->String)); - ComboBox.InsertString( -1, utf8ToTStr(propString->String)); - ComboBox.SelectString(-1, utf8ToTStr(propString->String)); + ComboBox.SetWindowText(nlUtf8ToTStr(propString->String)); + ComboBox.InsertString(-1, nlUtf8ToTStr(propString->String)); + ComboBox.SelectString(-1, nlUtf8ToTStr(propString->String)); } OriginalString = propString->String.c_str(); updateCombo (); @@ -953,7 +953,7 @@ bool CDialogProperties::CWidget::fromParameter (const IProperty *property, const updateBoolean (); break; case CPrimitiveClass::CParameter::ConstString: - ComboBox.SelectString(-1, utf8ToTStr(result)); + ComboBox.SelectString(-1, nlUtf8ToTStr(result)); OriginalString = result.c_str(); updateCombo (); break; @@ -1282,7 +1282,7 @@ void CDialogProperties::CWidget::updateCombo () DialogProperties->setDefaultValue (this, value); if (value != "") { - int index = ComboBox.FindString (-1, utf8ToTStr(value)); + int index = ComboBox.FindString(-1, nlUtf8ToTStr(value)); if (index != CB_ERR) ComboBox.SetCurSel (index); } @@ -1621,14 +1621,14 @@ BOOL CDialogProperties::OnCommand(WPARAM wParam, LPARAM lParam) /* todo hulud remove CString oldValue; widget->EditBox.GetWindowText (oldValue);*/ - CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("default"), TRUE, utf8ToTStr(widget->Parameter.FileExtension), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, - utf8ToTStr(widget->Parameter.FileExtension+" (*."+widget->Parameter.FileExtension+")|*."+widget->Parameter.FileExtension+"|All Files (*.*)|*.*||"), getMainFrame ()); + CFileDialogEx dialog(BASE_REGISTRY_KEY, _T("default"), TRUE, nlUtf8ToTStr(widget->Parameter.FileExtension), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + nlUtf8ToTStr(widget->Parameter.FileExtension + " (*." + widget->Parameter.FileExtension + ")|*." + widget->Parameter.FileExtension + "|All Files (*.*)|*.*||"), getMainFrame()); TCHAR temp[MAX_PATH]; if (!widget->Parameter.Folder.empty()) { - _tcscpy_s(temp, MAX_PATH, utf8ToTStr(widget->Parameter.Folder)); + _tcscpy_s(temp, MAX_PATH, nlUtf8ToTStr(widget->Parameter.Folder)); dialog.m_ofn.lpstrInitialDir = temp; } @@ -1636,7 +1636,7 @@ BOOL CDialogProperties::OnCommand(WPARAM wParam, LPARAM lParam) { CString str; str = dialog.GetFileTitle(); - setWindowTextUTF8 (widget->EditBox, tStrToUtf8(str)); + setWindowTextUTF8 (widget->EditBox, NLMISC::tStrToUtf8(str)); /* todo hulud remove if ((const char*)oldValue != str) @@ -2305,7 +2305,7 @@ void CDialogProperties::rebuildDialog () m_ScrollBar.MoveWindow(&scrollRect, TRUE); // set the name of the dlg according to displayed class - SetWindowText( CString(_T("Properties for : ")) + utf8ToTStr(windowName) ); + SetWindowText(CString(_T("Properties for : ")) + nlUtf8ToTStr(windowName)); // // JC: added scrolling properties // ::CRect clientRect; @@ -2982,13 +2982,12 @@ void CDialogProperties::SelectFolder(CWidget *widget) LPITEMIDLIST pidlRoot = NULL; LPSHELLFOLDER desktop; - ULONG ulDummy; SHGetDesktopFolder (&desktop); if (widget->Parameter.Folder != "") { - desktop->ParseDisplayName (NULL, NULL, utf8ToTStr(widget->Parameter.Folder), &ulDummy, &pidlRoot, &ulDummy); + desktop->ParseDisplayName(NULL, NULL, (LPTSTR)nlUtf8ToTStr(widget->Parameter.Folder), NULL, &pidlRoot, NULL); } bi.pidlRoot = pidlRoot; @@ -3454,7 +3453,7 @@ void CMyComboBox::reloadData() SetRedraw(FALSE); InsertString(-1, _T("")); for (vector::iterator it=_data.begin(), itEnd=_data.end(); it!=itEnd; ++it) - InsertString(-1, utf8ToTStr(*it)); + InsertString(-1, nlUtf8ToTStr(*it)); loaded = true; SetRedraw(TRUE); if(n != CB_ERR) SelectString(-1, s); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/display.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/display.cpp index 5f149f01e..7b0b9df23 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/display.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/display.cpp @@ -318,7 +318,7 @@ void CDisplay::init (CMainFrame *pMF) } } - SetCurrentDirectory (utf8ToTStr(pMF->_ExeDir)); + SetCurrentDirectory (nlUtf8ToTStr(pMF->_ExeDir)); } // *************************************************************************** @@ -3554,7 +3554,7 @@ void CDisplay::DrawCollisionTexture(sint32 count, float x1, float y1) string dir = getDocument ()->getDataDir (); if (dir.empty()) dir = _MainFrame->_ExeDir; dir += "\\collisionmap\\"; - SetCurrentDirectory (utf8ToTStr(dir)); + SetCurrentDirectory(nlUtf8ToTStr(dir)); if(NLMISC::CFile::fileExists(Name+".tga") || NLMISC::CFile::fileExists(Name+".png")) { diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/export_dlg.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/export_dlg.cpp index 7f290b784..cb58b0677 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/export_dlg.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/export_dlg.cpp @@ -162,9 +162,9 @@ int CALLBACK expBrowseCallbackProc (HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData) // \return true if not canceled bool CExportDlg::callChoosePathDlg(CString &dest) const { - BROWSEINFO bi; - TCHAR str[MAX_PATH]; - ITEMIDLIST* pidl; + BROWSEINFO bi; + TCHAR str[MAX_PATH]; + LPITEMIDLIST pidl; TCHAR sTemp[1024]; bi.hwndOwner = this->m_hWnd; diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/external_editor.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/external_editor.cpp index 8e20608e6..be0f50a08 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/external_editor.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/external_editor.cpp @@ -58,7 +58,7 @@ bool EditExternalText (const std::string &editor, std::string &text, const std:: } // Hide the file - SetFileAttributes (utf8ToTStr(tempFilename), FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM); + SetFileAttributes(nlUtf8ToTStr(tempFilename), FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM); // Open the temp file with a text editor if (saved) 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 47128cdb5..f4d203a19 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 @@ -59,9 +59,9 @@ INT_PTR CFileDialogEx::DoModal () HKEY hKey; DWORD type = REG_SZ; DWORD size = 512 * sizeof(TCHAR); - if (RegCreateKey (HKEY_CURRENT_USER, utf8ToTStr(_RegistryPath), &hKey) == ERROR_SUCCESS) + if (RegCreateKey(HKEY_CURRENT_USER, nlUtf8ToTStr(_RegistryPath), &hKey) == ERROR_SUCCESS) { - if (RegQueryValueEx (hKey, utf8ToTStr(_FileType), 0, &type, (LPBYTE)path, &size) == ERROR_SUCCESS) + if (RegQueryValueEx(hKey, nlUtf8ToTStr(_FileType), 0, &type, (LPBYTE)path, &size) == ERROR_SUCCESS) m_ofn.lpstrInitialDir = path; } @@ -76,9 +76,9 @@ INT_PTR CFileDialogEx::DoModal () std::string newPath = NLMISC::CFile::getPath (tStrToUtf8(GetPathName())); TCHAR buffer[MAX_PATH]; - _tcscpy_s(buffer, MAX_PATH, utf8ToTStr(newPath)); + _tcscpy_s(buffer, MAX_PATH, nlUtf8ToTStr(newPath)); - RegSetValueEx (hKey, utf8ToTStr(_FileType), 0, REG_SZ, (LPBYTE)buffer, (_tcslen(buffer) + 1) * sizeof(TCHAR)); + RegSetValueEx(hKey, nlUtf8ToTStr(_FileType), 0, REG_SZ, (LPBYTE)buffer, (_tcslen(buffer) + 1) * sizeof(TCHAR)); // Update the path list set oldPath; @@ -86,7 +86,7 @@ INT_PTR CFileDialogEx::DoModal () for (i=0; igetPropertyByName ("selected", property) || ( getPrimitiveEditor(_Locator.Primitive)->getSelected())) // && property) ) - && _Locator.Primitive->getPropertyByName (tStrToUtf8(Property), property) + && _Locator.Primitive->getPropertyByName (NLMISC::tStrToUtf8(Property), property) && property) { // Kind of primitive ? @@ -120,7 +120,7 @@ void CFindPrimitiveDlg::OnFindNext() if (propString) { // Good value ? - if (propString->String.find(tStrToUtf8(Value))!=std::string::npos) + if (propString->String.find(NLMISC::tStrToUtf8(Value)) != std::string::npos) { found = true; } @@ -135,7 +135,7 @@ void CFindPrimitiveDlg::OnFindNext() uint i; for (i=0; iStringArray.size (); i++) { - if (propStringArray->StringArray[i].find(tStrToUtf8(Value))!=std::string::npos) + if (propStringArray->StringArray[i].find(NLMISC::tStrToUtf8(Value)) != std::string::npos) { found = true; } @@ -230,7 +230,7 @@ void CFindPrimitiveDlg::replace(bool all) // || ( _Locator.Primitive->getPropertyByName ("selected", property) || ( getPrimitiveEditor(_Locator.Primitive)->getSelected())) // && property) ) - && _Locator.Primitive->getPropertyByName (tStrToUtf8(Property), property) + && _Locator.Primitive->getPropertyByName(NLMISC::tStrToUtf8(Property), property) && property ) { // Kind of primitive ? @@ -238,14 +238,14 @@ void CFindPrimitiveDlg::replace(bool all) if (propString) { // Good value ? - if (propString->String.find(tStrToUtf8(Value))!=std::string::npos) + if (propString->String.find(NLMISC::tStrToUtf8(Value)) != std::string::npos) { if (!firstTime && !all) break; CString tmp(propString->String.c_str()); tmp.Replace(Value, ReplaceText); - doc->addModification (new CActionSetPrimitivePropertyString (_Locator, tStrToUtf8(Property), tStrToUtf8(tmp), false)); + doc->addModification(new CActionSetPrimitivePropertyString(_Locator, NLMISC::tStrToUtf8(Property), NLMISC::tStrToUtf8(tmp), false)); doc->addModification (new CActionSelect (_Locator)); firstTime=false; @@ -265,7 +265,7 @@ void CFindPrimitiveDlg::replace(bool all) for (i=0; iStringArray.size (); i++) { // todo. - if (propStringArray->StringArray[i].find(tStrToUtf8(Value))!=std::string::npos) + if (propStringArray->StringArray[i].find(NLMISC::tStrToUtf8(Value)) != std::string::npos) { if ( !firstTime && !all) @@ -281,7 +281,7 @@ void CFindPrimitiveDlg::replace(bool all) newStrings=propStringArray->StringArray; firstChange=false; } - newStrings[i] = tStrToUtf8(tmp); + newStrings[i] = NLMISC::tStrToUtf8(tmp); } firstTime=false; } @@ -290,7 +290,7 @@ void CFindPrimitiveDlg::replace(bool all) if (!firstChange) // have to make a change { - doc->addModification (new CActionSetPrimitivePropertyStringArray (_Locator, tStrToUtf8(Property), newStrings, false)); + doc->addModification(new CActionSetPrimitivePropertyStringArray(_Locator, NLMISC::tStrToUtf8(Property), newStrings, false)); doc->addModification (new CActionSelect (_Locator)); } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/generate_dlg.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/generate_dlg.cpp index e4c5d0d8e..88131ab60 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/generate_dlg.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/generate_dlg.cpp @@ -75,7 +75,7 @@ BOOL CGenerateDlg::OnInitDialog() // TODO: Add extra initialization here for (uint32 i = 0; i < AllMaterials.size(); ++i) - ComboMaterial.InsertString(-1, utf8ToTStr(AllMaterials[i])); + ComboMaterial.InsertString(-1, nlUtf8ToTStr(AllMaterials[i])); ComboMaterial.SetCurSel (0); 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 a24ef1c07..f00181879 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 @@ -100,7 +100,7 @@ void CImageListEx::addResourceIcon (const char *filename) int height = imageInfo.rcImage.bottom - imageInfo.rcImage.top; // Load the icon - HICON handle = (HICON) LoadImage (NULL, utf8ToTStr(filename), IMAGE_ICON, width, height, LR_COLOR|LR_LOADFROMFILE); + HICON handle = (HICON) LoadImage (NULL, nlUtf8ToTStr(filename), IMAGE_ICON, width, height, LR_COLOR|LR_LOADFROMFILE); if (handle) { // Copy the icon 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 c17d81198..101903b21 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 @@ -759,11 +759,11 @@ void CMainFrame::displayStatusBarInfo () string text; if (dispWnd->getActionHelp (text)) { - m_wndStatusBar.SetPaneText (0, utf8ToTStr(text)); + m_wndStatusBar.SetPaneText(0, nlUtf8ToTStr(text)); } else { - m_wndStatusBar.SetPaneText (0, utf8ToTStr(sTmp)); + m_wndStatusBar.SetPaneText(0, nlUtf8ToTStr(sTmp)); } //for (uint32 i = sTmp.size(); i < 10; ++i) // sTmp += " "; @@ -771,12 +771,12 @@ void CMainFrame::displayStatusBarInfo () // Write zone reference name if (dispWnd->getActionText (text)) { - m_wndStatusBar.SetPaneText (1, utf8ToTStr(text)); + m_wndStatusBar.SetPaneText(1, nlUtf8ToTStr(text)); } else { sTmp = _ZoneBuilder->getZoneName (x, y); - m_wndStatusBar.SetPaneText (1, utf8ToTStr(sTmp)); + m_wndStatusBar.SetPaneText(1, nlUtf8ToTStr(sTmp)); } // Write coordinates @@ -784,15 +784,15 @@ void CMainFrame::displayStatusBarInfo () sprintf(temp, "(%.3f , %.3f)", v.x, v.y); sTmp = temp; // sTmp = "( " + toString(v.x) + " , " + toString(v.y) + " )"; - m_wndStatusBar.SetPaneText (2, utf8ToTStr(sTmp)); + m_wndStatusBar.SetPaneText(2, nlUtf8ToTStr(sTmp)); // Write rot sTmp = "Rot(" + toString(_ZoneBuilder->getRot(x, y)) + ")"; - m_wndStatusBar.SetPaneText (3, utf8ToTStr(sTmp)); + m_wndStatusBar.SetPaneText(3, nlUtf8ToTStr(sTmp)); // Write flip sTmp = "Flip(" + toString(_ZoneBuilder->getFlip(x, y)) + ")"; - m_wndStatusBar.SetPaneText (4, utf8ToTStr(sTmp)); + m_wndStatusBar.SetPaneText(4, nlUtf8ToTStr(sTmp)); // Write selection if (Selection.size ()) @@ -804,7 +804,7 @@ void CMainFrame::displayStatusBarInfo () } else sTmp = "No selected primitive"; - m_wndStatusBar.SetPaneText (5, utf8ToTStr(sTmp)); + m_wndStatusBar.SetPaneText(5, nlUtf8ToTStr(sTmp)); // Write path of selected primitive if (Selection.size()) @@ -812,14 +812,14 @@ void CMainFrame::displayStatusBarInfo () else sTmp.clear(); - m_wndStatusBar.SetPaneText (6, utf8ToTStr(sTmp)); + m_wndStatusBar.SetPaneText(6, nlUtf8ToTStr(sTmp)); } // *************************************************************************** void CMainFrame::displayInfo (const std::string &info) { - m_wndStatusBar.SetPaneText (6, utf8ToTStr(info)); + m_wndStatusBar.SetPaneText(6, nlUtf8ToTStr(info)); } // *************************************************************************** @@ -858,7 +858,7 @@ void CMainFrame::uninit () } catch (const Exception& e) { - MessageBox (utf8ToTStr(e.what()), _T("Warning")); + MessageBox(nlUtf8ToTStr(e.what()), _T("Warning")); } } @@ -2710,7 +2710,7 @@ void CMainFrame::createContextMenu (CWnd *parent, const CPoint &point, bool tran // For each child, add a create method for (uint i=0; iDynamicChildren.size (); i++) { - pMenu->AppendMenu (MF_STRING, ID_EDIT_CREATE_BEGIN+i, utf8ToTStr("Add " + primClass->DynamicChildren[i].ClassName)); + pMenu->AppendMenu(MF_STRING, ID_EDIT_CREATE_BEGIN + i, nlUtf8ToTStr("Add " + primClass->DynamicChildren[i].ClassName)); } } @@ -2723,7 +2723,7 @@ void CMainFrame::createContextMenu (CWnd *parent, const CPoint &point, bool tran // For each child, add a create method for (uint i=0; iGeneratedChildren.size (); i++) { - pMenu->AppendMenu (MF_STRING, ID_EDIT_GENERATE_BEGIN+i, utf8ToTStr("Generate "+primClass->GeneratedChildren[i].ClassName)); + pMenu->AppendMenu(MF_STRING, ID_EDIT_GENERATE_BEGIN + i, nlUtf8ToTStr("Generate " + primClass->GeneratedChildren[i].ClassName)); } } @@ -2747,7 +2747,7 @@ void CMainFrame::createContextMenu (CWnd *parent, const CPoint &point, bool tran for (i=0; iAppendMenu (MF_STRING, ID_EDIT_OPEN_FILE_BEGIN+i, utf8ToTStr("Open " + NLMISC::CFile::getFilename (filenames[i]))); + pMenu->AppendMenu(MF_STRING, ID_EDIT_OPEN_FILE_BEGIN + i, nlUtf8ToTStr("Open " + NLMISC::CFile::getFilename(filenames[i]))); } } } @@ -3717,7 +3717,7 @@ void CMainFrame::OnProjectForceiduniqueness() // End modifications doc->endModification (); - AfxMessageBox(utf8ToTStr(NLMISC::toString("%u ids checked, %u non unique ID regenerated", ids.size()+nonUnique.size(), nonUnique.size())), MB_OK); + AfxMessageBox(nlUtf8ToTStr(NLMISC::toString("%u ids checked, %u non unique ID regenerated", ids.size() + nonUnique.size(), nonUnique.size())), MB_OK); } // *************************************************************************** @@ -4351,7 +4351,7 @@ void CMainFrame::OnMissionCompiler() } TCHAR path[MAX_PATH]; - _tcscpy(path, utf8ToTStr(var->asString())); + _tcscpy(path, nlUtf8ToTStr(var->asString())); SHELLEXECUTEINFO ExecuteInfo; memset(&ExecuteInfo, 0, sizeof(ExecuteInfo)); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/my_list_box.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/my_list_box.cpp index a071a4836..3546205c4 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/my_list_box.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/my_list_box.cpp @@ -69,7 +69,7 @@ BOOL CMyListBox::OnCommand(WPARAM wParam, LPARAM lParam) std::string str; getWindowTextUTF8 (StringSelectComboBox, str); DeleteString(_EditingItem); - InsertString(_EditingItem, utf8ToTStr(str)); + InsertString(_EditingItem, nlUtf8ToTStr(str)); SetCurSel (_SelectAfter); _EditingItem = LB_ERR; notifyParent (); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/name_dlg.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/name_dlg.cpp index bfa978ee4..1f3f68087 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/name_dlg.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/name_dlg.cpp @@ -88,7 +88,7 @@ BOOL CNameDlg::OnInitDialog() // print the data directory CWnd* pWnd = GetDlgItem(IDC_NAME_DIR); - pWnd->SetWindowText(CString(_T("Data directory: ")) + utf8ToTStr(m_dataDir)); + pWnd->SetWindowText(CString(_T("Data directory: ")) + nlUtf8ToTStr(m_dataDir)); // tab stops to simulate multi-columns edit boxes int tab_stop1[1] = {160}; @@ -156,18 +156,18 @@ void CNameDlg::updateSearchList() { // no filter m_listToName.insert(std::make_pair(j, i)); - m_searchList.InsertString(j++, utf8ToTStr(s)); + m_searchList.InsertString(j++, nlUtf8ToTStr(s)); } else { - std::string filter(tStrToUtf8(m_nameFilter.LockBuffer())); + std::string filter(NLMISC::tStrToUtf8(m_nameFilter.LockBuffer())); m_nameFilter.UnlockBuffer(); // filter if (NLMISC::toLower(ig).find(NLMISC::toLower(filter)) != std::string::npos) { m_listToName.insert(std::make_pair(j, i)); - m_searchList.InsertString(j++, utf8ToTStr(s)); + m_searchList.InsertString(j++, nlUtf8ToTStr(s)); } } } @@ -214,7 +214,7 @@ void CNameDlg::updateSelectList() m_listToId.insert(std::make_pair(i, row)); } - m_idList.InsertString(i++, utf8ToTStr(s)); + m_idList.InsertString(i++, nlUtf8ToTStr(s)); } } @@ -251,8 +251,8 @@ void CNameDlg::OnBtnAssign() // get strings ucstring id; - std::string gn = tStrToUtf8(m_assignGn); - std::string ig = tStrToUtf8(m_assignIg); + std::string gn = NLMISC::tStrToUtf8(m_assignGn); + std::string ig = NLMISC::tStrToUtf8(m_assignIg); for (uint i=0 ; im_hWnd; @@ -133,11 +133,11 @@ BOOL CProjectSettings::OnInitDialog() for (uint i=0; igetContext ())); + Context.SelectString(-1, nlUtf8ToTStr(doc->getContext())); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/stdafx.h b/code/ryzom/tools/leveldesign/world_editor/world_editor/stdafx.h index d8fe8ec31..37dc0bb78 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/stdafx.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/stdafx.h @@ -25,8 +25,13 @@ #pragma once #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include // MFC core and standard components #include // MFC extensions diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/tools_logic.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/tools_logic.cpp index 7a5c25553..d8967a609 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/tools_logic.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/tools_logic.cpp @@ -1231,7 +1231,7 @@ BOOL CCreateDialog::OnInitDialog () for (uint32 i = 0; i < TypesForInit->size(); ++i) { - ComboType.InsertString (-1, utf8ToTStr(TypesForInit->operator[](i).Name)); + ComboType.InsertString(-1, nlUtf8ToTStr(TypesForInit->operator[](i).Name)); } if (TypesForInit->size()>0) @@ -1264,10 +1264,10 @@ void CCreateDialog::OnOK() UpdateData (); // If the "region_" do not exist add it - if (_tcsnccmp(utf8ToTStr(RegionPost), Name, strlen(RegionPost.c_str())) != 0) + if (_tcsnccmp(nlUtf8ToTStr(RegionPost), Name, strlen(RegionPost.c_str())) != 0) { TCHAR sTmp[128]; - _tcscpy (sTmp, utf8ToTStr(RegionPost)); + _tcscpy(sTmp, nlUtf8ToTStr(RegionPost)); _tcscat (sTmp, Name); _tcscpy (Name, sTmp); UpdateData (false); @@ -1303,11 +1303,11 @@ void CCreateDialog::OnSelChange () if (PropType == tStrToUtf8(sTmp)) { - _tcscpy (Name, utf8ToTStr(PropName)); + _tcscpy(Name, nlUtf8ToTStr(PropName)); } else { - _tcscpy(Name, utf8ToTStr(RegionPost)); + _tcscpy(Name, nlUtf8ToTStr(RegionPost)); _tcscat (Name, (LPCTSTR)sTmp); _tcscat (Name, _T("-")); } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/tools_zone.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/tools_zone.cpp index 231e57d28..bcb46cd6c 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/tools_zone.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/tools_zone.cpp @@ -105,7 +105,7 @@ void CToolsZoneList::reset() void CToolsZoneList::addItem (const string &itemName) { _ItemNames.push_back (itemName); - InsertString (-1, utf8ToTStr(itemName)); + InsertString(-1, nlUtf8ToTStr(itemName)); } // --------------------------------------------------------------------------- @@ -259,15 +259,15 @@ CToolsZoneList *CToolsZone::getListCtrl() // --------------------------------------------------------------------------- void CToolsZone::addToAllCatTypeCB (const string &Name) { - CComboBox* pCB; - pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE1); - pCB->AddString (utf8ToTStr(Name)); - pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE2); - pCB->AddString (utf8ToTStr(Name)); - pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE3); - pCB->AddString (utf8ToTStr(Name)); - pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE4); - pCB->AddString (utf8ToTStr(Name)); + CComboBox *pCB; + pCB = (CComboBox *)GetDlgItem(IDC_CATTYPE1); + pCB->AddString(nlUtf8ToTStr(Name)); + pCB = (CComboBox *)GetDlgItem(IDC_CATTYPE2); + pCB->AddString(nlUtf8ToTStr(Name)); + pCB = (CComboBox *)GetDlgItem(IDC_CATTYPE3); + pCB->AddString(nlUtf8ToTStr(Name)); + pCB = (CComboBox *)GetDlgItem(IDC_CATTYPE4); + pCB->AddString(nlUtf8ToTStr(Name)); } // --------------------------------------------------------------------------- @@ -285,26 +285,26 @@ void CToolsZone::init (CMainFrame *pMF) // Select right category types CComboBox* pCB; pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE1); - pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType1)); + pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType1)); pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE2); - pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType2)); + pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType2)); pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE3); - pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType3)); + pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType3)); pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE4); - pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType4)); + pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType4)); updateComboPairAndFilter (IDC_CATTYPE1, IDC_CATVALUE1, &_MainFrame->_ZoneBuilder->_FilterType1); pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE1); - pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue1)); + pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue1)); updateComboPairAndFilter (IDC_CATTYPE2, IDC_CATVALUE2, &_MainFrame->_ZoneBuilder->_FilterType2); pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE2); - pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue2)); + pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue2)); updateComboPairAndFilter (IDC_CATTYPE3, IDC_CATVALUE3, &_MainFrame->_ZoneBuilder->_FilterType3); pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE3); - pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue3)); + pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue3)); updateComboPairAndFilter (IDC_CATTYPE4, IDC_CATVALUE4, &_MainFrame->_ZoneBuilder->_FilterType4); pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE4); - pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue4)); + pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue4)); // Select right operators CButton *pButAnd, *pButOr; @@ -436,7 +436,7 @@ void CToolsZone::updateComboPairAndFilter (int CatTypeId, int CatValueId, string CComboBox *pCBType, *pCBValue; pCBType = (CComboBox*)GetDlgItem (CatTypeId); pCBType->GetLBText (pCBType->GetCurSel(), sTmp); - *pFilterType = tStrToUtf8(sTmp); + *pFilterType = NLMISC::tStrToUtf8(sTmp); pCBValue = (CComboBox*)GetDlgItem (CatValueId); pCBValue->ResetContent (); @@ -446,7 +446,7 @@ void CToolsZone::updateComboPairAndFilter (int CatTypeId, int CatValueId, string vector allCategoryValues; _MainFrame->_ZoneBuilder->getZoneBank().getCategoryValues (*pFilterType, allCategoryValues); for(i = 0; i < allCategoryValues.size(); ++i) - pCBValue->AddString (utf8ToTStr(allCategoryValues[i])); + pCBValue->AddString(nlUtf8ToTStr(allCategoryValues[i])); pCBValue->SetCurSel (0); } @@ -488,7 +488,7 @@ void CToolsZone::OnSelectCatValue1() TCHAR sTmp[256]; CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE1); pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp); - _MainFrame->_ZoneBuilder->_FilterValue1 = tStrToUtf8(sTmp); + _MainFrame->_ZoneBuilder->_FilterValue1 = NLMISC::tStrToUtf8(sTmp); _MainFrame->_ZoneBuilder->updateToolsZone (); } @@ -498,7 +498,7 @@ void CToolsZone::OnSelectCatValue2() TCHAR sTmp[256]; CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE2); pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp); - _MainFrame->_ZoneBuilder->_FilterValue2 = tStrToUtf8(sTmp); + _MainFrame->_ZoneBuilder->_FilterValue2 = NLMISC::tStrToUtf8(sTmp); _MainFrame->_ZoneBuilder->updateToolsZone (); } @@ -508,7 +508,7 @@ void CToolsZone::OnSelectCatValue3() TCHAR sTmp[256]; CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE3); pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp); - _MainFrame->_ZoneBuilder->_FilterValue3 = tStrToUtf8(sTmp); + _MainFrame->_ZoneBuilder->_FilterValue3 = NLMISC::tStrToUtf8(sTmp); _MainFrame->_ZoneBuilder->updateToolsZone (); } @@ -518,7 +518,7 @@ void CToolsZone::OnSelectCatValue4() TCHAR sTmp[256]; CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE4); pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp); - _MainFrame->_ZoneBuilder->_FilterValue4 = tStrToUtf8(sTmp); + _MainFrame->_ZoneBuilder->_FilterValue4 = NLMISC::tStrToUtf8(sTmp); _MainFrame->_ZoneBuilder->updateToolsZone (); } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/type_manager_dlg.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/type_manager_dlg.cpp index ed39bda8e..f66915c90 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/type_manager_dlg.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/type_manager_dlg.cpp @@ -77,7 +77,7 @@ void CTypeManagerDlg::OnAddtype() if (typeDlg.DoModal() == IDOK) { SType typeTmp; - typeTmp.Name = tStrToUtf8(typeDlg.EditName); + typeTmp.Name = NLMISC::tStrToUtf8(typeDlg.EditName); typeTmp.Color = typeDlg.ButtonColorValue; // Check if the name of the new type is the same as an existing one bool bFound = false; @@ -91,7 +91,7 @@ void CTypeManagerDlg::OnAddtype() if (!bFound) { LocalTypes.push_back (typeTmp); - ListType.InsertString(-1, utf8ToTStr(typeTmp.Name)); + ListType.InsertString(-1, nlUtf8ToTStr(typeTmp.Name)); } } } @@ -111,11 +111,11 @@ void CTypeManagerDlg::OnEdittype() if (typeDlg.DoModal() == IDOK) { SType typeTmp; - typeTmp.Name = tStrToUtf8(typeDlg.EditName); + typeTmp.Name = NLMISC::tStrToUtf8(typeDlg.EditName); typeTmp.Color = typeDlg.ButtonColorValue; LocalTypes[cursel] = typeTmp; ListType.DeleteString (ListType.GetCurSel()); - ListType.InsertString (cursel, utf8ToTStr(typeTmp.Name)); + ListType.InsertString(cursel, nlUtf8ToTStr(typeTmp.Name)); } } @@ -138,7 +138,7 @@ BOOL CTypeManagerDlg::OnInitDialog() // TODO: Add extra initialization here for (uint32 i = 0; i < LocalTypes.size(); ++i) { - ListType.InsertString(-1, utf8ToTStr(LocalTypes[i].Name)); + ListType.InsertString(-1, nlUtf8ToTStr(LocalTypes[i].Name)); } return TRUE; // return TRUE unless you set the focus to a control diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/type_sel_dlg.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/type_sel_dlg.cpp index 347fc72ad..d79e2c110 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/type_sel_dlg.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/type_sel_dlg.cpp @@ -60,7 +60,7 @@ void CTypeSelDlg::OnOK() CString sTmp; TypeList.GetText(TypeList.GetCurSel(), sTmp); - _TypeSelected = tStrToUtf8(sTmp); + _TypeSelected = NLMISC::tStrToUtf8(sTmp); CDialog::OnOK(); } @@ -72,7 +72,7 @@ BOOL CTypeSelDlg::OnInitDialog() // TODO: Add extra initialization here for (uint32 i = 0; i < _TypesInit->size(); ++i) { - TypeList.InsertString(-1, utf8ToTStr(_TypesInit->operator[](i).Name)); + TypeList.InsertString(-1, nlUtf8ToTStr(_TypesInit->operator[](i).Name)); } return TRUE; // return TRUE unless you set the focus to a control diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp index 1b3f96d04..f6e1743af 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor.cpp @@ -170,7 +170,7 @@ BOOL CWorldEditorApp::InitInstance() } catch (const Exception& e) { - ::MessageBox (NULL, utf8ToTStr(e.what()), _T("Warning"), MB_OK|MB_ICONEXCLAMATION); + ::MessageBox(NULL, nlUtf8ToTStr(e.what()), _T("Warning"), MB_OK | MB_ICONEXCLAMATION); // Can't found the module put some default values Config.CellSize = 160.0f; @@ -292,7 +292,7 @@ BOOL CWorldEditorApp::InitInstance() { IPluginCallback* test=Plugins[k]; string retest=test->getName(); - menu->InsertMenu( k, MF_BYPOSITION | MF_POPUP, ID_WINDOWS_PLUGINS+1 + k, utf8ToTStr(retest) ); + menu->InsertMenu(k, MF_BYPOSITION | MF_POPUP, ID_WINDOWS_PLUGINS + 1 + k, nlUtf8ToTStr(retest)); menu->CheckMenuItem(ID_WINDOWS_PLUGINS+1 +k, MF_CHECKED); } @@ -444,7 +444,7 @@ bool CWorldEditorApp::yesNoMessage (const char *format, ... ) strcpy(buffer, "Unknown error"); } - return MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, utf8ToTStr(buffer), _T("NeL World Editor"), MB_YESNO|MB_ICONQUESTION) == IDYES; + return MessageBox(m_pMainWnd ? m_pMainWnd->m_hWnd : NULL, nlUtf8ToTStr(buffer), _T("NeL World Editor"), MB_YESNO | MB_ICONQUESTION) == IDYES; } void CWorldEditorApp::errorMessage (const char *format, ... ) @@ -463,7 +463,7 @@ void CWorldEditorApp::errorMessage (const char *format, ... ) strcpy(buffer, "Unknown error"); } - MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, utf8ToTStr(buffer), _T("NeL World Editor"), MB_OK|MB_ICONEXCLAMATION); + MessageBox(m_pMainWnd ? m_pMainWnd->m_hWnd : NULL, nlUtf8ToTStr(buffer), _T("NeL World Editor"), MB_OK | MB_ICONEXCLAMATION); } void CWorldEditorApp::infoMessage (const char *format, ... ) @@ -482,7 +482,7 @@ void CWorldEditorApp::infoMessage (const char *format, ... ) strcpy(buffer, "Unknown error"); } - MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, utf8ToTStr(buffer), _T("NeL World Editor"), MB_OK|MB_ICONINFORMATION); + MessageBox(m_pMainWnd ? m_pMainWnd->m_hWnd : NULL, nlUtf8ToTStr(buffer), _T("NeL World Editor"), MB_OK | MB_ICONINFORMATION); } void CWorldEditorApp::syntaxError (const std::string &filename, xmlNodePtr xmlNode, const char *format, ...) @@ -813,7 +813,7 @@ void setEditTextMultiLine (CListBox &listBox, const std::vector &ve listBox.ResetContent(); uint i; for (i=0; i=2) && (title[title.size()-1] == '*') && (title[title.size()-2] == ' ') ) { title.resize (title.size () - 2); - SetTitle (utf8ToTStr(title)); + SetTitle(nlUtf8ToTStr(title)); } } } @@ -1532,8 +1532,8 @@ const NLLIGO::IPrimitive *CWorldEditorDoc::createPrimitive (const CDatabaseLocat if (primClass->Type == CPrimitiveClass::Bitmap) { // Create a dialog file - CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("image"), TRUE, utf8ToTStr(primClass->FileExtension), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, - utf8ToTStr(toString("%s (*.%s)|*.%s|All Files (*.*)|*.*||", primClass->FileType.c_str(), primClass->FileExtension.c_str(), primClass->FileExtension.c_str())), getMainFrame ()); + CFileDialogEx dialog(BASE_REGISTRY_KEY, _T("image"), TRUE, nlUtf8ToTStr(primClass->FileExtension), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, + nlUtf8ToTStr(toString("%s (*.%s)|*.%s|All Files (*.*)|*.*||", primClass->FileType.c_str(), primClass->FileExtension.c_str(), primClass->FileExtension.c_str())), getMainFrame()); if (dialog.DoModal() == IDOK) { // Save filename diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_fauna_graph_plugin/StdAfx.h b/code/ryzom/tools/leveldesign/world_editor/world_editor_fauna_graph_plugin/StdAfx.h index 58043f752..54dba15f8 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_fauna_graph_plugin/StdAfx.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_fauna_graph_plugin/StdAfx.h @@ -27,8 +27,13 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/StdAfx.h b/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/StdAfx.h index 9beea91c6..dc1d86459 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/StdAfx.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/StdAfx.h @@ -27,8 +27,13 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/graph_plugin.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/graph_plugin.cpp index d42b14eb8..aacc4a253 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/graph_plugin.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_graph_plugin/graph_plugin.cpp @@ -172,7 +172,7 @@ void CGraphPlugin::refreshPrimitives() { string msg("Can't write script file '"); msg += tmpPath+"/lang.dot'"; - AfxMessageBox(utf8ToTStr(msg)); + AfxMessageBox(nlUtf8ToTStr(msg)); } else { @@ -207,11 +207,11 @@ void CGraphPlugin::refreshPrimitives() err = toString("%s : %s", primName.c_str(), e.Why.c_str()); } - AfxMessageBox(utf8ToTStr(err)); + AfxMessageBox(nlUtf8ToTStr(err)); } catch (const exception &e) //catch a possible exception from getRootFileName { - AfxMessageBox(utf8ToTStr(e.what())); + AfxMessageBox(nlUtf8ToTStr(e.what())); } } else @@ -254,7 +254,7 @@ void CGraphPlugin::refreshMachine() { string msg("Can't write script file '"); msg += tmpPath+"/lang.dot'"; - AfxMessageBox(utf8ToTStr(msg)); + AfxMessageBox(nlUtf8ToTStr(msg)); } else { @@ -298,7 +298,7 @@ void CGraphPlugin::refreshMachine() { string msg("Can't write script file '"); msg += tmpPath+"/lang.dot'"; - AfxMessageBox(utf8ToTStr(msg)); + AfxMessageBox(nlUtf8ToTStr(msg)); } else { @@ -940,7 +940,7 @@ void CGraphPlugin::doSelection(const string& primPath) } catch(const exception &e) { - GraphDlg->MessageBox(utf8ToTStr(e.what())); + GraphDlg->MessageBox(nlUtf8ToTStr(e.what())); } } } \ No newline at end of file diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_primitive_plugin/CMakeLists.txt b/code/ryzom/tools/leveldesign/world_editor/world_editor_primitive_plugin/CMakeLists.txt index 56a7c1597..da490aa57 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_primitive_plugin/CMakeLists.txt +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_primitive_plugin/CMakeLists.txt @@ -14,9 +14,9 @@ NL_ADD_LIB_SUFFIX(world_editor_primitive_plugin) ADD_DEFINITIONS(${MFC_DEFINITIONS} -DWIN32_DLL_EXPORTS) -IF(WITH_PCH) - ADD_NATIVE_PRECOMPILED_HEADER(world_editor_primitive_plugin ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.h ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.cpp) -ENDIF() +#IF(WITH_PCH) +# ADD_NATIVE_PRECOMPILED_HEADER(world_editor_primitive_plugin ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.h ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.cpp) +#ENDIF() INSTALL(TARGETS world_editor_primitive_plugin LIBRARY DESTINATION ${RYZOM_LIB_PREFIX} RUNTIME DESTINATION ${RYZOM_BIN_PREFIX} ARCHIVE DESTINATION ${RYZOM_LIB_PREFIX} COMPONENT tools3d) diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_primitive_plugin/primitive_plugin.h b/code/ryzom/tools/leveldesign/world_editor/world_editor_primitive_plugin/primitive_plugin.h index 8b452cd80..d7a19dc10 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_primitive_plugin/primitive_plugin.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_primitive_plugin/primitive_plugin.h @@ -18,8 +18,13 @@ #define PRIMITIVE_PLUGIN_H #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include // MFC core and standard components #include // MFC extensions diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/DialogFlags.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/DialogFlags.cpp index 12c3d9b88..0dbe2849d 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/DialogFlags.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/DialogFlags.cpp @@ -301,7 +301,7 @@ void CDialogFlags::setCurrentEntityDisplayMode(TEntityDisplayMode edm) void CDialogFlags::loadEntityDisplayInfoToRegistry(TEntityDisplayInfoVect &infos, const std::string ®Id) { HKEY hKey; - if (RegOpenKeyEx(HKEY_CURRENT_USER, utf8ToTStr(tStrToUtf8(REGKEY_ENTITY_DISPLAY_INFO) + regId), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyEx(HKEY_CURRENT_USER, nlUtf8ToTStr(tStrToUtf8(REGKEY_ENTITY_DISPLAY_INFO) + regId), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) { DWORD index = 0; for(;;) @@ -338,7 +338,7 @@ void CDialogFlags::loadEntityDisplayInfoToRegistry(TEntityDisplayInfoVect &infos void CDialogFlags::saveEntityDisplayInfoToRegistry(const TEntityDisplayInfoVect &infos, const std::string ®Id) { HKEY hKey; - if (RegCreateKeyEx(HKEY_CURRENT_USER, utf8ToTStr(tStrToUtf8(REGKEY_ENTITY_DISPLAY_INFO) + regId), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) + if (RegCreateKeyEx(HKEY_CURRENT_USER, nlUtf8ToTStr(tStrToUtf8(REGKEY_ENTITY_DISPLAY_INFO) + regId), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) { for(uint k = 0; k < infos.size(); ++k) { diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/StdAfx.h b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/StdAfx.h index c62c05e5b..13e74ec50 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/StdAfx.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/StdAfx.h @@ -29,8 +29,13 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include // MFC core and standard components #include // MFC extensions diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.cpp index 09756ddbf..5f50ca065 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_shard_monitor_plugin/memory_combo_box.cpp @@ -95,14 +95,14 @@ bool CMemoryComboBox::getMemory (int slot, std::string &ret) { // Open the key HKEY hKey; - if (RegOpenKey (HKEY_CURRENT_USER, utf8ToTStr(RegisterAdress), &hKey) == ERROR_SUCCESS) + if (RegOpenKey(HKEY_CURRENT_USER, nlUtf8ToTStr(RegisterAdress), &hKey) == ERROR_SUCCESS) { // Get the value char strSrc[512]; smprintf (strSrc, 512, "%d", slot); TCHAR str[512]; long size = 512*sizeof(TCHAR); - if (RegQueryValue (hKey, utf8ToTStr(strSrc), str, &size) == ERROR_SUCCESS) + if (RegQueryValue(hKey, nlUtf8ToTStr(strSrc), str, &size) == ERROR_SUCCESS) { ret = tStrToUtf8(str); @@ -124,7 +124,7 @@ void CMemoryComboBox::scrollDown (int start, int end) { // Open the key HKEY hKey; - if (RegCreateKey (HKEY_CURRENT_USER, utf8ToTStr(RegisterAdress), &hKey) == ERROR_SUCCESS) + if (RegCreateKey (HKEY_CURRENT_USER, nlUtf8ToTStr(RegisterAdress), &hKey) == ERROR_SUCCESS) { // Scroll down the list for (int i=end-1; i>start; i--) @@ -134,12 +134,12 @@ void CMemoryComboBox::scrollDown (int start, int end) smprintf (strSrc, 512, "%d", i-1); TCHAR str[512]; long size = 512 * sizeof(TCHAR); - if (RegQueryValue (hKey, utf8ToTStr(strSrc), str, &size) == ERROR_SUCCESS) + if (RegQueryValue(hKey, nlUtf8ToTStr(strSrc), str, &size) == ERROR_SUCCESS) { // Set the value char strDst[512]; smprintf (strDst, 512, "%d", i); - RegSetValue (hKey, utf8ToTStr(strDst), REG_SZ, str, size); + RegSetValue(hKey, nlUtf8ToTStr(strDst), REG_SZ, str, size); } } @@ -154,10 +154,10 @@ void CMemoryComboBox::writeStringInRegistry (const std::string &str) { // Open the key HKEY hKey; - if (RegCreateKey (HKEY_CURRENT_USER, utf8ToTStr(RegisterAdress), &hKey) == ERROR_SUCCESS) + if (RegCreateKey(HKEY_CURRENT_USER, nlUtf8ToTStr(RegisterAdress), &hKey) == ERROR_SUCCESS) { // Set the value - RegSetValue (hKey, _T("0"), REG_SZ, utf8ToTStr(str), str.size ()); + RegSetValue(hKey, _T("0"), REG_SZ, nlUtf8ToTStr(str), str.size()); // Close RegCloseKey (hKey); @@ -428,7 +428,7 @@ void CMemoryComboBox::pushString (const std::string &str) if (i == (int)(itemCount+Commands.size()+ StaticStrings.size())) { // Insert the sting - _ComboBox.InsertString (Commands.size()+ StaticStrings.size(), utf8ToTStr(str)); + _ComboBox.InsertString(Commands.size() + StaticStrings.size(), nlUtf8ToTStr(str)); } } } @@ -449,7 +449,7 @@ void CMemoryComboBox::refreshStrings () int count = Commands.size(); for (i=0; iConnectCtrl.SetWindowText (getStringRsc(IDS_DISCONNECT)); _DialogFlag->State = (LPCTSTR) (getStringRsc(IDS_CONNECTED_TO) + _SHost.c_str()); - _DialogFlag->Sent = CString(utf8ToTStr(toString (_Client->getBytesSent ()))) + getStringRsc(IDS_BYTE_SENT); + _DialogFlag->Sent = CString(nlUtf8ToTStr(toString(_Client->getBytesSent()))) + getStringRsc(IDS_BYTE_SENT); //_DialogFlag->Received = (toString ((uint32)_Client->getBytesReceived ()) + " bytes received").c_str(); _DialogFlag->Received = (toString("%.1f", bandwidth/1024.0) + " kB/s").c_str(); _DialogFlag->DownloadValue = (toString("%.1f kB/s", _DialogFlag->Download/1024.0)).c_str(); @@ -1198,7 +1198,7 @@ void CPlugin::updateConnectionState() break; case WaitingServerParams: _DialogFlag->ConnectCtrl.SetWindowText (getStringRsc(IDS_CANCEL_CONNECT)); - _DialogFlag->State = getStringRsc(IDS_WAITING_SERVER_PARAMS) + utf8ToTStr(_SHost); + _DialogFlag->State = getStringRsc(IDS_WAITING_SERVER_PARAMS) + nlUtf8ToTStr(_SHost); break; case WaitingLoginConfirmation: { diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/DialogFlags.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/DialogFlags.cpp index 55cbbd25c..bf0857c39 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/DialogFlags.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/DialogFlags.cpp @@ -118,7 +118,7 @@ void CDialogFlags::init(CSoundPlugin *plugin) for (uint i =0; i(GetDlgItem(BG_FLAG_ID[i]))->SetCheck(flags.Flags[i] ? 1 : 0); - GetDlgItem(BG_FLAG_ID[i])->SetWindowText(utf8ToTStr(_Mixer->getBackgroundFlagName(i))); + GetDlgItem(BG_FLAG_ID[i])->SetWindowText(nlUtf8ToTStr(_Mixer->getBackgroundFlagName(i))); } @@ -229,7 +229,7 @@ void CDialogFlags::OnTimer(UINT_PTR nIDEvent) _stprintf(temp, _T("%6.2f"), SampleBanks[i].second / (1024.0f*1024.0f)); TCHAR bankName[1024]; - _tcscpy_s(bankName, 1024, utf8ToTStr(SampleBanks[i].first)); + _tcscpy_s(bankName, 1024, nlUtf8ToTStr(SampleBanks[i].first)); if (i < c) { diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/StdAfx.h b/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/StdAfx.h index 33e78a8b1..04ebecac8 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/StdAfx.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_sound_plugin/StdAfx.h @@ -29,8 +29,13 @@ #endif // _MSC_VER > 1000 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#define WIN32_LEAN_AND_MEAN #define NOMINMAX -#define _WIN32_WINNT 0x0501 +#ifdef _WIN64 +#define _WIN32_WINNT 0x0600 +#else +#define _WIN32_WINNT 0x0500 +#endif #include // MFC core and standard components #include // MFC extensions diff --git a/code/snowballs2/bin/snowballs_client.cfg b/code/snowballs2/bin/snowballs_client.cfg index 9cc10b7ad..b2432c733 100644 --- a/code/snowballs2/bin/snowballs_client.cfg +++ b/code/snowballs2/bin/snowballs_client.cfg @@ -7,10 +7,12 @@ Password = "password2"; LSHost = "opennel.org:49994"; FSHost = ""; SaveConfig = 1; -SoundEnabled = 0; -SoundDriver = "FMod"; +SoundEnabled = 1; +SoundDriver = "OpenAl"; +MusicVolume = 0.2; ScreenWidth = 1024; ScreenHeight = 768; +ScreenFull = 0; ShardId = 300; UseDirectClient = 1; ClientApplication = "snowballs"; diff --git a/code/snowballs2/bin/snowballs_client_default.cfg b/code/snowballs2/bin/snowballs_client_default.cfg index f8af00386..af099a449 100755 --- a/code/snowballs2/bin/snowballs_client_default.cfg +++ b/code/snowballs2/bin/snowballs_client_default.cfg @@ -75,12 +75,13 @@ HMDDevice = "Auto"; ////////////////////////////////////////////////////////////////////////////// // The sound driver, choose between "Auto", "FMod", "DSound" and "OpenAl" -SoundDriver = "FMod"; +SoundDriver = "OpenAl"; SoundMaxTracks = 32; SoundUseEax = 1; SoundUseADPCM = 1; SoundForceSoftware = 1; SoundEnabled = 1; +MusicVolume = 0.2; ////////////////////////////////////////////////////////////////////////////// diff --git a/code/snowballs2/client/src/CMakeLists.txt b/code/snowballs2/client/src/CMakeLists.txt index 8125eb3c2..18a2c126c 100644 --- a/code/snowballs2/client/src/CMakeLists.txt +++ b/code/snowballs2/client/src/CMakeLists.txt @@ -12,9 +12,9 @@ NL_DEFAULT_PROPS(snowballs_client "Snowballs, Client: Snowballs Client") NL_ADD_RUNTIME_FLAGS(snowballs_client) # If sound is enabled then add the definitions and link the libraries. -IF(ENABLE_SOUND) +IF(WITH_SOUND) ADD_DEFINITIONS(-DSBCLIENT_WITH_SOUND) - TARGET_LINK_LIBRARIES(snowballs_client ${NELSOUND_LIBRARY}) + TARGET_LINK_LIBRARIES(snowballs_client nelsound) ENDIF() INSTALL(TARGETS snowballs_client RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT snowballsclient) diff --git a/code/snowballs2/client/src/entities.cpp b/code/snowballs2/client/src/entities.cpp index 2972aebf1..dde6df257 100644 --- a/code/snowballs2/client/src/entities.cpp +++ b/code/snowballs2/client/src/entities.cpp @@ -762,10 +762,10 @@ void updateEntities () switch (entity.Type) { case CEntity::Self: - jdir = CVector(-(float)cos(entity.Angle), -(float)sin(entity.Angle), 0.0f); + jdir = CVector(-(float)cos(entity.Angle - (Pi * 0.5)), -(float)sin(entity.Angle - (Pi * 0.5)), 0.0f); break; case CEntity::Other: - jdir = CVector(-(float)cos(entity.Angle), -(float)sin(entity.Angle), 0.0f); + jdir = CVector(-(float)cos(entity.Angle - (Pi * 0.5)), -(float)sin(entity.Angle - (Pi * 0.5)), 0.0f); break; case CEntity::Snowball: jdir = entity.Trajectory.evalSpeed(LocalTime).normed(); diff --git a/code/snowballs2/client/src/snowballs_client.cpp b/code/snowballs2/client/src/snowballs_client.cpp index 059960922..28f957589 100644 --- a/code/snowballs2/client/src/snowballs_client.cpp +++ b/code/snowballs2/client/src/snowballs_client.cpp @@ -68,6 +68,7 @@ #include "interface.h" #include "lens_flare.h" #include "mouse_listener.h" +#include "sound.h" #include "configuration.h" #include "internationalization.h" #include "game_time.h" @@ -301,6 +302,8 @@ void initCore() LoadedCore = true; // Seed the randomizer srand(uint(time(0))); + // Sheet Id + CSheetId::initWithoutSheet(); // Temporary for sound // Load configuration file, set paths, extension remapping CConfiguration::init(); // Load language file @@ -333,11 +336,9 @@ void initCore() displayLoadingState("Initialize Loading"); initLoadingState(); // Initialize sound for loading screens etc -//#ifdef NL_OS_WINDOWS -// displayLoadingState("Initialize Sound"); -// initSound(); -// playMusic(SBCLIENT_MUSIC_WAIT); -//#endif + displayLoadingState("Initialize Sound"); + initSound(); + playMusic(SBCLIENT_MUSIC_WAIT); // Required for 3d rendering (3d nel logo etc) displayLoadingState("Initialize Light"); initLight(); @@ -366,9 +367,7 @@ void initIngame() if (!LoadedIngame) { LoadedIngame = true; -//#ifdef NL_OS_WINDOWS -// playMusic(SBCLIENT_MUSIC_WAIT); -//#endif + playMusic(SBCLIENT_MUSIC_WAIT); displayLoadingState("Initialize"); // Create a scene @@ -441,10 +440,9 @@ void initIngame() void initOnline() { - if (LoadedOnline) return; -//#ifdef NL_OS_WINDOWS -// playMusic(SBCLIENT_MUSIC_WAIT); -//#endif + if (LoadedOnline) + return; + playMusic(SBCLIENT_MUSIC_WAIT); displayLoadingState("Connecting"); @@ -460,9 +458,7 @@ void initOnline() displayLoadingState("Ready!"); -//#ifdef NL_OS_WINDOWS -// playMusic(SBCLIENT_MUSIC_BACKGROUND); -//#endif + playMusic(SBCLIENT_MUSIC_BACKGROUND); LoadedOnline = true; } @@ -471,9 +467,7 @@ void initOffline() if (!LoadedOffline) { LoadedOffline = true; -//#ifdef NL_OS_WINDOWS -// playMusic(SBCLIENT_MUSIC_WAIT); -//#endif + playMusic(SBCLIENT_MUSIC_WAIT); uint32 id = NextEID++; Login = ucstring("Entity" + toString(id)); @@ -492,9 +486,7 @@ void initOffline() displayLoadingState("Ready!"); -//#ifdef NL_OS_WINDOWS -// playMusic(SBCLIENT_MUSIC_BACKGROUND); -//#endif + playMusic(SBCLIENT_MUSIC_BACKGROUND); } } @@ -517,9 +509,7 @@ void releaseCore() // Release the loading state textures releaseLoadingState(); // Release the sound -//#ifdef NL_OS_WINDOWS -// releaseSound(); -//#endif + releaseSound(); // Release the text context Driver->deleteTextContext(TextContext); TextContext = NULL; @@ -529,11 +519,13 @@ void releaseCore() Driver = NULL; // Release timing system - CGameTime::init(); + CGameTime::release(); // Release language file - CInternationalization::init(); + CInternationalization::release(); // Release the configuration CConfiguration::release(); + // Release sheet id + CSheetId::uninit(); // Temporary for sound } } @@ -611,9 +603,7 @@ void releaseOffline() void loopLogin() { -//#ifdef NL_OS_WINDOWS -// playMusic(SBCLIENT_MUSIC_LOGIN); -//#endif + playMusic(SBCLIENT_MUSIC_LOGIN); // todo: login screen, move this stuff to a button or something displayLoadingState("Login"); if (ConfigFile->getVar("Local").asInt() == 0) @@ -730,9 +720,7 @@ void loopIngame() // ... // 11. Update Sound (sound driver) -//#ifdef NL_OS_WINDOWS -// updateSound(); // Update the sound -//#endif + updateSound(); // Update the sound // 12. Update Outgoing (network, send new position etc) // ... @@ -1118,9 +1106,7 @@ void updateLoadingState(const char *state, bool network, bool information) void updateLoadingState(ucstring state, bool network, bool information) { CGameTime::updateTime(); // important that time is updated here!!! -//#ifdef NL_OS_WINDOWS -// updateSound(); -//#endif + updateSound(); renderLoadingState(state, true); if (information) renderInformation(); if (network) updateNetwork(); diff --git a/code/snowballs2/client/src/snowballs_config.h b/code/snowballs2/client/src/snowballs_config.h index 2e6b848fb..ee216f3c5 100644 --- a/code/snowballs2/client/src/snowballs_config.h +++ b/code/snowballs2/client/src/snowballs_config.h @@ -41,7 +41,9 @@ // - Bloom // 2.2 // - OculusVR support -#define SBCLIENT_VERSION "2.2" +// 2.3 +// - Add music +#define SBCLIENT_VERSION "2.3" diff --git a/code/snowballs2/client/src/sound.cpp b/code/snowballs2/client/src/sound.cpp index 7ad802e03..f0a767825 100644 --- a/code/snowballs2/client/src/sound.cpp +++ b/code/snowballs2/client/src/sound.cpp @@ -30,8 +30,10 @@ #include #include +#include "snowballs_client.h" #include "sound.h" #include "entities.h" +#include "configuration.h" // // Namespaces @@ -41,116 +43,149 @@ using namespace std; using namespace NLMISC; using namespace NLSOUND; -#ifdef SBCLIENT_WITH_SOUND +namespace SBCLIENT +{ -//// -//// Variables -//// // -//UAudioMixer *AudioMixer = NULL; +// Variables +/// + +#ifdef SBCLIENT_WITH_SOUND +UAudioMixer *AudioMixer = NULL; //TSoundId SoundId; //const vector *SoundIdArray; -//static bool SoundEnabled; -// -//// -//// Functions -//// -// -//#ifdef NL_OS_WINDOWS -//void initSound2(); -//void releaseSound2(); -//#endif -// -//void cbConfigFileSoundMaxTracks(NLMISC::CConfigFile::CVar &var) -//{ -////#ifdef NL_OS_WINDOWS -//// AudioMixer->changeMaxTrack(var.asInt()); -////#endif -//} -// -//void cbConfigFileSoundEnabled(NLMISC::CConfigFile::CVar &var) -//{ -////#ifdef NL_OS_WINDOWS -//// if (var.asBool() != SoundEnabled) -//// { -//// if (var.asBool()) initSound2(); -//// else releaseSound2(); -//// } -////#endif -//} -// -//void cbConfigFileFail(NLMISC::CConfigFile::CVar &var) -//{ -// //nlwarning("You can't modify the config variable '%s' at runtime for now, please restart the game", var.asString().c_str()); -//} -// -////#ifdef NL_OS_WINDOWS -////void initSound2() -////{ -//// AudioMixer = UAudioMixer::createAudioMixer (); -//// std::string driverName; -//// NLSOUND::UAudioMixer::TDriver driverType; -//// if (!ConfigFile->exists("SoundDriver")) -////#ifdef NL_OS_WINDOWS -//// driverType = NLSOUND::UAudioMixer::DriverFMod; -////#elif defined (NL_OS_UNIX) -//// driverType = NLSOUND::UAudioMixer::DriverOpenAl; -////#else -//// driverType = NLSOUND::UAudioMixer::DriverAuto; -////#endif -//// else -//// { -//// driverName = ConfigFile->getVar("SoundDriver").asString(); -//// if (driverName == "Auto") driverType = NLSOUND::UAudioMixer::DriverAuto; -//// else if (driverName == "FMod") driverType = NLSOUND::UAudioMixer::DriverFMod; -//// else if (driverName == "DSound") driverType = NLSOUND::UAudioMixer::DriverDSound; -//// else if (driverName == "OpenAl") driverType = NLSOUND::UAudioMixer::DriverOpenAl; -//// else nlerror("SoundDriver value '%s' is invalid.", driverName.c_str()); -//// } -//// -//// AudioMixer->init( -//// ConfigFile->exists("SoundMaxTracks") -//// ? ConfigFile->getVar("SoundMaxTracks").asInt() : 32, -//// ConfigFile->exists("SoundUseEax") -//// ? ConfigFile->getVar("SoundUseEax").asBool() : true, -//// ConfigFile->exists("SoundUseADPCM") -//// ? ConfigFile->getVar("SoundUseADPCM").asBool() : true, -//// NULL, false, driverType, -//// ConfigFile->exists("SoundForceSoftware") -//// ? ConfigFile->getVar("SoundForceSoftware").asBool() : true); -//// -//// ConfigFile->setCallback("SoundMaxTracks", cbConfigFileSoundMaxTracks); -//// ConfigFile->setCallback("SoundUseEax", cbConfigFileFail); -//// ConfigFile->setCallback("SoundUseADPCM", cbConfigFileFail); -//// ConfigFile->setCallback("SoundForceSoftware", cbConfigFileFail); -//// ConfigFile->setCallback("SoundDriver", cbConfigFileFail); -//// -//// PlaylistManager = new SBCLIENT::CMusicPlaylistManager(AudioMixer, ConfigFile, "SoundPlaylist"); -//// -//// /* AudioMixer->loadSoundBuffers ("sounds.nss", &SoundIdArray); -//// nlassert( SoundIdArray->size() == 2 ); -//// SoundId = (*SoundIdArray)[0]; -//// // StSoundId = (*SoundIdArray)[1]; */ -//// -//// SoundEnabled = true; -////} -////#endif +static bool SoundEnabled; +#endif + // -//void initSound() -//{ -////#ifdef NL_OS_WINDOWS -//// if (ConfigFile->exists("SoundEnabled") ? ConfigFile->getVar("SoundEnabled").asBool() : false) initSound2(); -//// ConfigFile->setCallback("SoundEnabled", cbConfigFileSoundEnabled); -////#endif -//} +// Functions // + +#ifdef SBCLIENT_WITH_SOUND + +void initSound2(); +void releaseSound2(); + +void cbConfigFileSoundMaxTracks(NLMISC::CConfigFile::CVar &var) +{ + if (AudioMixer) + AudioMixer->changeMaxTrack(var.asInt()); +} + +void cbConfigFileSoundEnabled(NLMISC::CConfigFile::CVar &var) +{ + if (var.asBool() != SoundEnabled) + { + if (var.asBool()) + initSound2(); + else + releaseSound2(); + } +} + +void cbConfigFileMusicVolume(NLMISC::CConfigFile::CVar &var) +{ + if (AudioMixer) + AudioMixer->setMusicVolume(var.asFloat()); +} + +void cbConfigFileFail(NLMISC::CConfigFile::CVar &var) +{ + nlwarning("You can't modify the config variable '%s' at runtime for now, please restart the game", var.asString().c_str()); +} + +void initSound2() +{ + AudioMixer = UAudioMixer::createAudioMixer(); + std::string driverName; + NLSOUND::UAudioMixer::TDriver driverType; + if (!ConfigFile->exists("SoundDriver")) +#ifdef NL_OS_WINDOWS + driverType = NLSOUND::UAudioMixer::DriverFMod; +#elif defined(NL_OS_UNIX) + driverType = NLSOUND::UAudioMixer::DriverOpenAl; +#else + driverType = NLSOUND::UAudioMixer::DriverAuto; +#endif + else + { + driverName = ConfigFile->getVar("SoundDriver").asString(); + if (driverName == "Auto") + driverType = NLSOUND::UAudioMixer::DriverAuto; + else if (driverName == "FMod") + driverType = NLSOUND::UAudioMixer::DriverFMod; + else if (driverName == "DSound") + driverType = NLSOUND::UAudioMixer::DriverDSound; + else if (driverName == "OpenAl") + driverType = NLSOUND::UAudioMixer::DriverOpenAl; + else + nlerror("SoundDriver value '%s' is invalid.", driverName.c_str()); + } + + AudioMixer->init( + ConfigFile->exists("SoundMaxTracks") + ? ConfigFile->getVar("SoundMaxTracks").asInt() + : 32, + ConfigFile->exists("SoundUseEax") + ? ConfigFile->getVar("SoundUseEax").asBool() + : true, + ConfigFile->exists("SoundUseADPCM") + ? ConfigFile->getVar("SoundUseADPCM").asBool() + : true, + NULL, true, driverType, + ConfigFile->exists("SoundForceSoftware") + ? ConfigFile->getVar("SoundForceSoftware").asBool() + : true); + + ConfigFile->setCallback("SoundMaxTracks", cbConfigFileSoundMaxTracks); + ConfigFile->setCallback("SoundUseEax", cbConfigFileFail); + ConfigFile->setCallback("SoundUseADPCM", cbConfigFileFail); + ConfigFile->setCallback("SoundForceSoftware", cbConfigFileFail); + ConfigFile->setCallback("SoundDriver", cbConfigFileFail); + CConfiguration::setAndCallback("MusicVolume", cbConfigFileMusicVolume); + + // PlaylistManager = new SBCLIENT::CMusicPlaylistManager(AudioMixer, ConfigFile, "SoundPlaylist"); + + /* AudioMixer->loadSoundBuffers ("sounds.nss", &SoundIdArray); + nlassert( SoundIdArray->size() == 2 ); + SoundId = (*SoundIdArray)[0]; + // StSoundId = (*SoundIdArray)[1]; */ + + SoundEnabled = true; +} + +void releaseSound2() +{ + SoundEnabled = false; + ConfigFile->setCallback("SoundMaxTracks", NULL); + ConfigFile->setCallback("SoundUseEax", NULL); + ConfigFile->setCallback("SoundUseADPCM", NULL); + ConfigFile->setCallback("SoundForceSoftware", NULL); + ConfigFile->setCallback("SoundDriver", NULL); + // delete PlaylistManager; + // PlaylistManager = NULL; + delete AudioMixer; + AudioMixer = NULL; +} + +#endif + +void initSound() +{ +#ifdef SBCLIENT_WITH_SOUND + if (ConfigFile->exists("SoundEnabled") ? ConfigFile->getVar("SoundEnabled").asBool() : false) + initSound2(); + ConfigFile->setCallback("SoundEnabled", cbConfigFileSoundEnabled); +#endif +} + //void playSound (CEntity &entity, TSoundId id) //{ ///* entity.Source = AudioMixer->createSource (id); // entity.Source->setLooping (true); // entity.Source->play (); //*/} -// + //void deleteSound (CEntity &entity) //{ ///* if (entity.Source != NULL) @@ -162,42 +197,36 @@ using namespace NLSOUND; // entity.Source = NULL; // } //*/} -// -//void updateSound() -//{ -////#ifdef NL_OS_WINDOWS -//// if (SoundEnabled) -//// { -//// PlaylistManager->update(DiffTime); -//// AudioMixer->update(); -//// } -////#endif -//} -// -////#ifdef NL_OS_WINDOWS -////void releaseSound2() -////{ -//// SoundEnabled = false; -//// ConfigFile->setCallback("SoundMaxTracks", NULL); -//// ConfigFile->setCallback("SoundUseEax", NULL); -//// ConfigFile->setCallback("SoundUseADPCM", NULL); -//// ConfigFile->setCallback("SoundForceSoftware", NULL); -//// ConfigFile->setCallback("SoundDriver", NULL); -//// delete PlaylistManager; -//// PlaylistManager = NULL; -//// delete AudioMixer; -//// AudioMixer = NULL; -////} -////#endif -// -//void releaseSound() -//{ -////#ifdef NL_OS_WINDOWS -//// ConfigFile->setCallback("SoundEnabled", NULL); -//// if (SoundEnabled) releaseSound2(); -////#endif -//} -// + +void updateSound() +{ +#ifdef SBCLIENT_WITH_SOUND + if (SoundEnabled) + { + // PlaylistManager->update(DiffTime); + AudioMixer->update(); + } + #endif +} + +void releaseSound() +{ +#ifdef SBCLIENT_WITH_SOUND + ConfigFile->setCallback("SoundEnabled", NULL); + if (SoundEnabled) releaseSound2(); +#endif +} + +void playMusic(const char *file) +{ +#ifdef SBCLIENT_WITH_SOUND + if (AudioMixer) + AudioMixer->playMusic(file, 1000, true, true); +#endif +} + +} /* namespace SBCLIENT */ + ////#ifdef NL_OS_WINDOWS //// ////void playMusic(sint32 playlist, sint32 track) @@ -211,35 +240,38 @@ using namespace NLSOUND; //// if (SoundEnabled) //// PlaylistManager->setVolume(playlist, volume); ////} -//// -////NLMISC_COMMAND(music_bg,"background music","") -////{ -//// if (args.size() != 0) return false; -//// playMusic(SBCLIENT_MUSIC_BACKGROUND); -//// return true; -////} -//// -////NLMISC_COMMAND(music_bg_beat,"background music with beat","") -////{ -//// if (args.size() != 0) return false; -//// PlaylistManager->playMusic(SBCLIENT_MUSIC_BACKGROUND_BEAT); -//// return true; -////} -//// -////NLMISC_COMMAND(music_wait,"loading music","") -////{ -//// if (args.size() != 0) return false; -//// PlaylistManager->playMusic(SBCLIENT_MUSIC_WAIT); -//// return true; -////} -//// -////NLMISC_COMMAND(music_login,"login screen music","") -////{ -//// if (args.size() != 0) return false; -//// PlaylistManager->playMusic(SBCLIENT_MUSIC_LOGIN); -//// return true; -////} -//// + +NLMISC_COMMAND(music_bg,"background music","") +{ + if (args.size() != 0) return false; + SBCLIENT::playMusic(SBCLIENT_MUSIC_BACKGROUND); + return true; +} + +NLMISC_COMMAND(music_bg_beat,"background music with beat","") +{ + if (args.size() != 0) + return false; + SBCLIENT::playMusic(SBCLIENT_MUSIC_BACKGROUND_BEAT); + return true; +} + +NLMISC_COMMAND(music_wait,"loading music","") +{ + if (args.size() != 0) + return false; + SBCLIENT::playMusic(SBCLIENT_MUSIC_WAIT); + return true; +} + +NLMISC_COMMAND(music_login,"login screen music","") +{ + if (args.size() != 0) + return false; + SBCLIENT::playMusic(SBCLIENT_MUSIC_LOGIN); + return true; +} + ////#endif -#endif // SBCLIENT_WITH_SOUND +/* end of file */ diff --git a/code/snowballs2/client/src/sound.h b/code/snowballs2/client/src/sound.h index 2862d141c..34b0d6723 100644 --- a/code/snowballs2/client/src/sound.h +++ b/code/snowballs2/client/src/sound.h @@ -35,35 +35,43 @@ // Defines // -//#define SBCLIENT_MUSIC_WAIT (0), (0) -//#define SBCLIENT_MUSIC_LOGIN (1), (0) -//#define SBCLIENT_MUSIC_BACKGROUND (2), (0) -//#define SBCLIENT_MUSIC_BACKGROUND_BEAT (2), (1) +#define SBCLIENT_MUSIC_WAIT "xtarsia_evil-snowballs_wait.ogg" +#define SBCLIENT_MUSIC_LOGIN "xtarsia_evil-snowballs_login.ogg" +#define SBCLIENT_MUSIC_BACKGROUND "xtarsia_evil-snowballs_beat.ogg" /* "xtarsia_evil-snowballs_game.ogg" */ +#define SBCLIENT_MUSIC_BACKGROUND_BEAT "xtarsia_evil-snowballs_beat.ogg" + +namespace SBCLIENT { // // External variables // -//extern NLSOUND::UAudioMixer *AudioMixer; +#ifdef SBCLIENT_WITH_SOUND +extern NLSOUND::UAudioMixer *AudioMixer; //extern NLSOUND::TSoundId SoundId; +#endif + // -//// -//// External functions -//// +// External functions // + //void playMusic(sint32 playlist, sint32 track); //void setMusicVolume(sint32 playlist, float volume); -// -//void initSound(); -//void updateSound(); -//void releaseSound(); -// + +void initSound(); +void updateSound(); +void releaseSound(); + +void playMusic(const char *file); + //// Set and play a sound on an entity //void playSound(CEntity &entity, NLSOUND::TSoundId id); -// + //// Remove the sound system link to the entity //void deleteSound(CEntity &entity); +} /* namespace SBCLIENT */ + #endif // SBCLIENT_SOUND_H /* End of sound.h */ // duh