From 44b7adb5698779be432999f755e2a8084112023f Mon Sep 17 00:00:00 2001 From: kaetemi Date: Wed, 1 May 2019 07:35:00 +0800 Subject: [PATCH] Cleaning up unicode conversion and fixing 64bit issues --- code/nel/include/nel/net/service.h | 8 +- code/nel/tools/3d/cluster_viewer/view_cs.cpp | 4 +- code/nel/tools/3d/shapes_exporter/main.cpp | 2 +- code/nel/tools/3d/zviewer/zviewer.cpp | 9 +- .../logic/logic_editor_dll/Condition.cpp | 8 +- .../tools/logic/logic_editor_dll/Counter.cpp | 2 +- .../tools/logic/logic_editor_dll/State.cpp | 10 +- .../logic_editor_exe/logic_editor_exe.cpp | 5 +- .../tools/misc/message_box/message_box.cpp | 6 +- .../multi_cd_setup_fix/multi_cd_setup_fix.cpp | 6 +- .../leveldesign/georges_dll/base_dialog.cpp | 2 +- .../leveldesign/georges_dll/dfn_dialog.cpp | 22 ++--- .../leveldesign/georges_dll/dfn_dialog.h | 4 +- .../georges_dll/edit_list_ctrl.cpp | 22 ++--- .../georges_dll/file_browser_dialog.cpp | 6 +- .../georges_dll/file_tree_view.cpp | 22 ++--- .../leveldesign/georges_dll/file_tree_view.h | 2 +- .../leveldesign/georges_dll/form_dialog.cpp | 44 ++++----- .../georges_dll/georges_edit_doc.cpp | 8 +- .../georges_dll/georges_edit_view.cpp | 2 +- .../georges_dll/georges_implementation.cpp | 4 +- .../leveldesign/georges_dll/header_dialog.cpp | 2 +- .../leveldesign/georges_dll/imagelist_ex.cpp | 2 +- .../leveldesign/georges_dll/left_view.cpp | 6 +- .../leveldesign/georges_dll/main_frm.cpp | 8 +- .../georges_dll/memory_combo_box.h | 2 +- .../georges_dll/output_console_dlg.cpp | 2 +- .../georges_dll/settings_dialog.cpp | 28 +++--- .../leveldesign/georges_dll/type_dialog.cpp | 96 +++++++++---------- .../leveldesign/georges_exe/georges_exe.cpp | 8 +- .../georges_plugin_sound/PageBgFades.cpp | 16 ++-- .../georges_plugin_sound/PageBgFlags.cpp | 4 +- .../georges_plugin_sound/PageComtext.cpp | 4 +- .../georges_plugin_sound.cpp | 5 +- .../georges_plugin_sound/listener_view.cpp | 6 +- .../georges_plugin_sound/sound_dialog.cpp | 10 +- .../georges_plugin_sound/sound_plugin.cpp | 13 ++- 37 files changed, 196 insertions(+), 214 deletions(-) diff --git a/code/nel/include/nel/net/service.h b/code/nel/include/nel/net/service.h index 02967d317..bdabb48a1 100644 --- a/code/nel/include/nel/net/service.h +++ b/code/nel/include/nel/net/service.h @@ -117,11 +117,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,11 +132,11 @@ 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; \ - scn->setArgs (argc, argv); \ + scn->setArgs (argc, nlTStrToUtf8(argv)); \ createDebug(NULL,!scn->haveLongArg("nolog"));\ scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \ sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__ " " __TIME__); \ 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/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/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 */) +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 { -#else -int main(int /* argc */, char ** /* argv */) -{ -#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_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/message_box/message_box.cpp b/code/nel/tools/misc/message_box/message_box.cpp index dd2ced825..ae8866a16 100644 --- a/code/nel/tools/misc/message_box/message_box.cpp +++ b/code/nel/tools/misc/message_box/message_box.cpp @@ -19,11 +19,7 @@ #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 9e20c09a0..9d9e9b590 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 @@ -40,11 +40,7 @@ void pump () DispatchMessage(&msg); } } - -int APIENTRY _tWinMain(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); diff --git a/code/ryzom/tools/leveldesign/georges_dll/base_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/base_dialog.cpp index ffacde032..923d69c6b 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/base_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/base_dialog.cpp @@ -232,7 +232,7 @@ BOOL CBaseDialog::PreTranslateMessage(MSG* pMsg) 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/dfn_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/dfn_dialog.cpp index 72a446870..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("")); @@ -472,7 +472,7 @@ void CDfnDialog::onOpenSelected () if (str != "") { // Look for the file - CString name = utf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false)); + CString name = nlUtf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false)); if (name.IsEmpty()) name = str; @@ -494,7 +494,7 @@ void CDfnDialog::onOpenSelected () if (str != "") { // Look for the file - CString name = utf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false)); + CString name = nlUtf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false)); if (name.IsEmpty()) name = str; @@ -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::tstring &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 785d64539..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::tstring &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::tstring &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 bad4b8a1e..3e4d02046 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.cpp @@ -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 d86cc21bd..8979d9237 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp @@ -832,7 +832,7 @@ 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, utf8ToTStr(ext), utf8ToTStr(ext), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, utf8ToTStr(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 (); @@ -1316,16 +1316,16 @@ void IFormWidget::updateLabel () switch (where) { case UFormElm::ValueForm: - Label.SetWindowText(utf8ToTStr(SavedLabel + comp)); + Label.SetWindowText(nlUtf8ToTStr(SavedLabel + comp)); break; case UFormElm::ValueParentForm: - Label.SetWindowText(utf8ToTStr(SavedLabel + " (in parent form)" + comp)); + Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (in parent form)" + comp)); break; case UFormElm::ValueDefaultDfn: - Label.SetWindowText(utf8ToTStr(SavedLabel + " (default DFN value)" + comp)); + Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (default DFN value)" + comp)); break; case UFormElm::ValueDefaultType: - Label.SetWindowText(utf8ToTStr(SavedLabel + " (default TYPE value)" + comp)); + 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)); } // *************************************************************************** @@ -1569,7 +1569,7 @@ void CFormMemCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, // Create the type combo parent->setStaticSize (currentPos); - Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent); + Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent); parent->initWidget (Label); parent->getNextPosLabel (currentPos); @@ -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 (utf8ToTStr(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 (utf8ToTStr(label), WS_VISIBLE, currentPos, parent); + Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent); parent->initWidget (Label); parent->getNextPosLabel (currentPos); @@ -1921,7 +1921,7 @@ void CFormCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, ui Combo.InsertString (0, _T("")); for (uint predef=0; predefDefinitions.size(); predef++) { - Combo.InsertString (predef+1, utf8ToTStr(nodeType->Definitions[predef].Label)); + Combo.InsertString(predef + 1, nlUtf8ToTStr(nodeType->Definitions[predef].Label)); } } @@ -2088,7 +2088,7 @@ void CFormBigEdit::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, // Create the type combo parent->setStaticSize (currentPos); - Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent); + Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent); parent->initWidget (Label); parent->getNextPosLabel (currentPos); @@ -2262,7 +2262,7 @@ void CColorEdit::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, ui // Create the type combo parent->setStaticSize (currentPos); - Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent); + Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent); parent->initWidget (Label); parent->getNextPosLabel (currentPos); @@ -2492,7 +2492,7 @@ void CListWidget::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, u // Create the type combo parent->setStaticSize (currentPos); - Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent); + Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent); parent->initWidget (Label); parent->getNextPosLabel (currentPos); @@ -2515,7 +2515,7 @@ void CListWidget::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, u void CListWidget::addColumn (const char *name) { - ListCtrl.insertColumn (0, utf8ToTStr(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, utf8ToTStr(filename)); + ListCtrl.ListCtrl.InsertItem(parent, nlUtf8ToTStr(filename)); ListCtrl.ListCtrl.UpdateData (FALSE); updateLabel (); @@ -2709,7 +2709,7 @@ void CListWidget::onOpenSelected () if (str != "") { // Look for the file - CString name = utf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false)); + CString name = nlUtf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false)); if (name.IsEmpty()) name = str; @@ -2750,7 +2750,7 @@ void CIconWidget::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, u // Create the type combo parent->setStaticSize (currentPos); - Label.Create (utf8ToTStr(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/georges_edit_doc.cpp b/code/ryzom/tools/leveldesign/georges_dll/georges_edit_doc.cpp index 01f7b6f8e..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,7 +223,7 @@ BOOL CGeorgesEditDocForm::OnNewDocument() string defFilename = theApp.RootSearchPath; defFilename += "*.dfn"; - CFileDialog dlgFile(TRUE, _T("*.dfn"), utf8ToTStr(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(tStrToUtf8(dlgFile.GetFileName()).c_str(), true)) @@ -1331,7 +1331,7 @@ void CGeorgesEditDoc::setModifiedState (bool modified) if ( (title.size ()>=2) && (title[title.size()-1] == '*') && (title[title.size()-2] == ' ') ) { title.resize (title.size () - 2); - SetTitle (utf8ToTStr(title)); + 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 9e0b30f6e..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(utf8ToTStr(_sxfullname)); + theApp.OpenDocumentFile(nlUtf8ToTStr(_sxfullname)); } catch (const NLMISC::Exception &e) { std::string tmp = std::string(e.what()) + "(" + _sxfullname + ")"; - theApp.m_pMainWnd->MessageBox(utf8ToTStr(tmp), _T("Georges_Lib"), MB_ICONERROR | MB_OK); + theApp.m_pMainWnd->MessageBox(nlUtf8ToTStr(tmp), _T("Georges_Lib"), MB_ICONERROR | MB_OK); } } diff --git a/code/ryzom/tools/leveldesign/georges_dll/header_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/header_dialog.cpp index ee1385216..0ef0e4aad 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/header_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/header_dialog.cpp @@ -109,7 +109,7 @@ BOOL CHeaderDialog::OnInitDialog() ComboState.Create (WS_VISIBLE|CBS_DROPDOWNLIST|WS_TABSTOP, pos, this, CbState); uint item; for (item=0; itemgetItemImage (GetDocument()); - item = TreeCtrl.InsertItem (utf8ToTStr(subObject->getName()), itemImage, itemImage, parent); + item = TreeCtrl.InsertItem(nlUtf8ToTStr(subObject->getName()), itemImage, itemImage, parent); } // Set name - TreeCtrl.SetItemText (item, utf8ToTStr(subObject->getName())); + 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); diff --git a/code/ryzom/tools/leveldesign/georges_dll/main_frm.cpp b/code/ryzom/tools/leveldesign/georges_dll/main_frm.cpp index 7239d0f69..9203fb605 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/main_frm.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/main_frm.cpp @@ -436,7 +436,7 @@ void CMainFrame::OnUpdateModules0(CCmdUI* pCmdUI) pCmdUI->Enable (); string name; theApp.PluginArray[0].PluginInterface->getPluginName (name); - pCmdUI->SetText (utf8ToTStr(name)); + 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 (utf8ToTStr(name)); + 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 (utf8ToTStr(name)); + 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 (utf8ToTStr(name)); + pCmdUI->SetText(nlUtf8ToTStr(name)); pCmdUI->SetCheck (theApp.PluginArray[3].Activated); } else diff --git a/code/ryzom/tools/leveldesign/georges_dll/memory_combo_box.h b/code/ryzom/tools/leveldesign/georges_dll/memory_combo_box.h index e0fb2d679..e06d72d0c 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/memory_combo_box.h +++ b/code/ryzom/tools/leveldesign/georges_dll/memory_combo_box.h @@ -59,7 +59,7 @@ public: bool isWnd (const CWnd *wnd) const; void enableAutoCompleteExtension (bool enable, const char * ext); - std::tstring RegisterAdress; + NLMISC::tstring RegisterAdress; int MemoryCount; UINT Id; diff --git a/code/ryzom/tools/leveldesign/georges_dll/output_console_dlg.cpp b/code/ryzom/tools/leveldesign/georges_dll/output_console_dlg.cpp index 4577f6de8..247725513 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/output_console_dlg.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/output_console_dlg.cpp @@ -98,7 +98,7 @@ void COutputConsoleDlg::outputString (const char *message) { int index = edit->LineIndex(edit->GetLineCount( )-1) + edit->LineLength(edit->GetLineCount( )-1); edit->SetSel (index, index); - edit->ReplaceSel (utf8ToTStr(message)); + edit->ReplaceSel(nlUtf8ToTStr(message)); } } 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/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); } }