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 fe6f56a57..3462928db 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 @@ -53,8 +53,8 @@ using namespace NLMISC; #define STRING_SELECT_COMBOBOX_ID 9 -#define DIFFERENT_VALUE_STRING _T("") -#define DIFFERENT_VALUE_MULTI_STRING _T("") +#define DIFFERENT_VALUE_STRING "" +#define DIFFERENT_VALUE_MULTI_STRING "" //CDialogProperties PropertyDialog; std::list PropertiesDialogs; @@ -352,7 +352,7 @@ void CDialogProperties::addWidget (const CPrimitiveClass::CParameter ¶meter, string Name = widget.Parameter.Name; // Create a check box - nlverify (widget.CheckBox.Create (Name.c_str (), BS_3STATE|WS_VISIBLE|WS_TABSTOP|(enabled?0:WS_DISABLED), widgetPos, &m_PropertyCont, id)); + nlverify (widget.CheckBox.Create (utf8ToTStr(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, it->c_str ()); + widget.ListEditBox.StringSelectComboBox.InsertString( -1, utf8ToTStr(*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, it->c_str ()); + widget.ListEditBox.StringSelectComboBox.InsertString( -1, utf8ToTStr(*it)); } } } @@ -887,16 +887,16 @@ bool CDialogProperties::CWidget::fromParameter (const IProperty *property, const case CPrimitiveClass::CParameter::ConstString: // Set as uninitialized if (!Parameter.SortEntries) - ComboBox.InsertString (-1, DIFFERENT_VALUE_STRING); + ComboBox.InsertString (-1, _T(DIFFERENT_VALUE_STRING)); else - ComboBox.AddString( DIFFERENT_VALUE_STRING); - ComboBox.SelectString(-1 ,DIFFERENT_VALUE_STRING); + ComboBox.AddString( _T(DIFFERENT_VALUE_STRING)); + ComboBox.SelectString(-1 , _T(DIFFERENT_VALUE_STRING)); OriginalString = DIFFERENT_VALUE_STRING; updateCombo (); break; case CPrimitiveClass::CParameter::String: // Set as uninitialized - EditBox.SetWindowText (DIFFERENT_VALUE_STRING); + EditBox.SetWindowText (_T(DIFFERENT_VALUE_STRING)); break; } MultipleValues = true; @@ -1631,8 +1631,8 @@ BOOL CDialogProperties::OnCommand(WPARAM wParam, LPARAM lParam) /* todo hulud remove CString oldValue; widget->EditBox.GetWindowText (oldValue);*/ - CFileDialogEx dialog (BASE_REGISTRY_KEY, "default", TRUE, widget->Parameter.FileExtension.c_str (), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, - (widget->Parameter.FileExtension+" (*."+widget->Parameter.FileExtension+")|*."+widget->Parameter.FileExtension+"|All Files (*.*)|*.*||").c_str (), getMainFrame ()); + CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("default"), TRUE, widget->Parameter.FileExtension.c_str (), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, + utf8ToTStr(widget->Parameter.FileExtension+" (*."+widget->Parameter.FileExtension+")|*."+widget->Parameter.FileExtension+"|All Files (*.*)|*.*||"), getMainFrame ()); if (widget->Parameter.Folder != "") { dialog.m_ofn.lpstrInitialDir = widget->Parameter.Folder.c_str(); @@ -1738,7 +1738,7 @@ BOOL CDialogProperties::OnCommand(WPARAM wParam, LPARAM lParam) nlassert (widget->Parameter.Type == CPrimitiveClass::CParameter::ConstString); // Remove - int index = widget->ComboBox.FindString (-1, DIFFERENT_VALUE_STRING); + int index = widget->ComboBox.FindString (-1, _T(DIFFERENT_VALUE_STRING)); if (index != CB_ERR) widget->ComboBox.DeleteString(index); @@ -2309,7 +2309,7 @@ void CDialogProperties::rebuildDialog () m_ScrollBar.MoveWindow(&scrollRect, TRUE); // set the name of the dlg according to displayed class - SetWindowText( ( std::string( "Properties for : " ) + windowName ).c_str() ); + SetWindowText( CString(_T("Properties for : ")) + utf8ToTStr(windowName) ); // // JC: added scrolling properties // ::CRect clientRect; @@ -2751,19 +2751,19 @@ void CDialogProperties::ApplyAutoname() } else if (ite->Parameter.Type == CPrimitiveClass::CParameter::ConstString) { - ite->ComboBox.SelectString(-1 , ""); + ite->ComboBox.SelectString(-1 , _T("")); ite->updateCombo (); } else if (ite->Parameter.Type == CPrimitiveClass::CParameter::String) { ite->Initializing = true; - ite->EditBox.SetWindowText(""); + ite->EditBox.SetWindowText(_T("")); ite->Initializing = false; } else if (ite->Parameter.Type == CPrimitiveClass::CParameter::StringArray) { ite->Initializing = true; - ite->MultiLineEditBox.SetWindowText(""); + ite->MultiLineEditBox.SetWindowText(_T("")); ite->Initializing = false; // ite->MultiLineEditBox.LoadText(CString()); ite->updateMultiline (); @@ -2771,7 +2771,7 @@ void CDialogProperties::ApplyAutoname() else if (ite->Parameter.Type == CPrimitiveClass::CParameter::ConstStringArray) { ite->Initializing = true; - ite->ListEditBox.SetWindowText(""); + ite->ListEditBox.SetWindowText(_T("")); ite->Initializing = false; ite->updateList (); } @@ -2986,16 +2986,13 @@ void CDialogProperties::SelectFolder(CWidget *widget) LPITEMIDLIST pidlRoot = NULL; LPSHELLFOLDER desktop; - OLECHAR olePath[_MAX_PATH + 1]; ULONG ulDummy; SHGetDesktopFolder (&desktop); if (widget->Parameter.Folder != "") { - LPTSTR szPath = (char *)widget->Parameter.Folder.c_str(); - MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, szPath, -1, olePath, _MAX_PATH); - desktop->ParseDisplayName (NULL, NULL, olePath, &ulDummy, &pidlRoot, &ulDummy); + desktop->ParseDisplayName (NULL, NULL, utf8ToTStr(widget->Parameter.Folder), &ulDummy, &pidlRoot, &ulDummy); } bi.pidlRoot = pidlRoot; @@ -3007,10 +3004,10 @@ void CDialogProperties::SelectFolder(CWidget *widget) if (pIIL != NULL) { TCHAR szInitialDir[_MAX_PATH]; - BOOL bRet = ::SHGetPathFromIDList(pIIL, (char*)&szInitialDir); + BOOL bRet = ::SHGetPathFromIDList(pIIL, szInitialDir); if (bRet) { - int s = strlen(szInitialDir); + int s = _tcslen(szInitialDir); while (s) { --s; @@ -3023,7 +3020,7 @@ void CDialogProperties::SelectFolder(CWidget *widget) std::vector tempArray; widget->getValue (tempArray); - tempArray.push_back (szInitialDir+s); + tempArray.push_back (tStrToUtf8(szInitialDir+s)); setEditTextMultiLine (widget->MultiLineEditBox, tempArray); widget->updateMultiline (); @@ -3459,9 +3456,9 @@ void CMyComboBox::reloadData() if(n != CB_ERR) GetLBText(n, s); ResetContent(); SetRedraw(FALSE); - InsertString(-1, ""); + InsertString(-1, _T("")); for (vector::iterator it=_data.begin(), itEnd=_data.end(); it!=itEnd; ++it) - InsertString(-1, it->c_str()); + InsertString(-1, utf8ToTStr(*it)); loaded = true; SetRedraw(TRUE); if(n != CB_ERR) SelectString(-1, s); @@ -3504,18 +3501,26 @@ BOOL CMyComboBox::PreTranslateMessage( MSG* pMsg ) { CString rString; GetLBText (curSel, rString); - dataToClipboard (this, CF_TEXT, (void*)(const char*)rString, rString.GetLength()+1); +#ifdef _UNICODE + dataToClipboard(this, CF_UNICODETEXT, (void*)(LPCTSTR)rString, (rString.GetLength() + 1)*2); +#else + dataToClipboard (this, CF_TEXT, (void*)(LPCTSTR)rString, rString.GetLength()+1); +#endif } } // Paste ? else if ((pMsg->message == WM_KEYDOWN) && ('V' == (int) pMsg->wParam) && (GetAsyncKeyState (VK_CONTROL) & 0x8000)) { - char text[512]; + TCHAR text[512]; +#ifdef _UNICODE + if (dataFromClipboard(this, CF_UNICODETEXT, text, 511*2)) +#else if (dataFromClipboard (this, CF_TEXT, text, 511)) +#endif { // 0 final text[511] = 0; - _LastString = text; + _LastString = tStrToUtf8(text); search = true; } } @@ -3535,7 +3540,7 @@ BOOL CMyComboBox::PreTranslateMessage( MSG* pMsg ) { CString rString; GetLBText (i, rString); - string tmp = strlwr ((const char*)rString); + string tmp = toLower(tStrToUtf8(rString)); uint size = std::min (_LastString.size(), tmp.size()); if (size > matchSize) { diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/find_primitive_dlg.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/find_primitive_dlg.cpp index f120874fa..9cf7e2dee 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/find_primitive_dlg.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/find_primitive_dlg.cpp @@ -112,7 +112,7 @@ void CFindPrimitiveDlg::OnFindNext() // || ( _Locator.Primitive->getPropertyByName ("selected", property) || ( getPrimitiveEditor(_Locator.Primitive)->getSelected())) // && property) ) - && _Locator.Primitive->getPropertyByName ((const char*)Property, property) + && _Locator.Primitive->getPropertyByName (tStrToUtf8(Property), property) && property) { // Kind of primitive ? @@ -120,7 +120,7 @@ void CFindPrimitiveDlg::OnFindNext() if (propString) { // Good value ? - if (propString->String.find(Value)!=std::string::npos) + if (propString->String.find(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(Value)!=std::string::npos) + if (propStringArray->StringArray[i].find(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 ((const char*)Property, property) + && _Locator.Primitive->getPropertyByName (tStrToUtf8(Property), property) && property ) { // Kind of primitive ? @@ -238,14 +238,14 @@ void CFindPrimitiveDlg::replace(bool all) if (propString) { // Good value ? - if (propString->String.find(Value)!=std::string::npos) + if (propString->String.find(tStrToUtf8(Value))!=std::string::npos) { if (!firstTime && !all) break; CString tmp(propString->String.c_str()); tmp.Replace(Value, ReplaceText); - doc->addModification (new CActionSetPrimitivePropertyString (_Locator,(const char*)Property,(const char*)tmp,false)); + doc->addModification (new CActionSetPrimitivePropertyString (_Locator, tStrToUtf8(Property), 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(Value)!=std::string::npos) + if (propStringArray->StringArray[i].find(tStrToUtf8(Value))!=std::string::npos) { if ( !firstTime && !all) @@ -281,7 +281,7 @@ void CFindPrimitiveDlg::replace(bool all) newStrings=propStringArray->StringArray; firstChange=false; } - newStrings[i]=std::string((const char*)tmp); + newStrings[i] = 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,(const char*)Property,newStrings,false)); + doc->addModification (new CActionSetPrimitivePropertyStringArray (_Locator, tStrToUtf8(Property), newStrings, false)); doc->addModification (new CActionSelect (_Locator)); } @@ -321,7 +321,7 @@ void CFindPrimitiveDlg::replace(bool all) if (_End) { - MessageBox ("End of the document", "Find a primitive...", MB_OK|MB_ICONEXCLAMATION); + MessageBox (_T("End of the document"), _T("Find a primitive..."), MB_OK|MB_ICONEXCLAMATION); _Locator.getRoot (0); } 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 3e6cd4d57..e4c5d0d8e 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, AllMaterials[i].c_str()); + ComboMaterial.InsertString(-1, utf8ToTStr(AllMaterials[i])); ComboMaterial.SetCurSel (0); @@ -90,12 +90,12 @@ void CGenerateDlg::OnOK() if (MinX > MaxX) { - MessageBox ("MinX > MaxX", "Error", MB_OK|MB_ICONSTOP); + MessageBox (_T("MinX > MaxX"), _T("Error"), MB_OK|MB_ICONSTOP); return; } if (MinY > MaxY) { - MessageBox ("MinY > MaxY", "Error", MB_OK|MB_ICONSTOP); + MessageBox (_T("MinY > MaxY"), _T("Error"), MB_OK|MB_ICONSTOP); return; } CDialog::OnOK(); 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 436b8d27d..a24ef1c07 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 @@ -31,7 +31,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; @@ -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, filename, IMAGE_ICON, width, height, LR_COLOR|LR_LOADFROMFILE); + HICON handle = (HICON) LoadImage (NULL, utf8ToTStr(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/my_list_box.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/my_list_box.cpp index c3df01c12..3d39ae236 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 @@ -124,7 +124,7 @@ void CMyListBox::OnLButtonDblClk(UINT nFlags, CPoint point) _SelectAfter = GetCurSel(); if ((_EditingItem == LB_ERR) || bOutside) { - _EditingItem = InsertString (-1, ""); + _EditingItem = InsertString (-1, _T("")); _DeleteItIfCancel = true; } else 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 69864affd..bfa978ee4 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(("Data directory: " + m_dataDir).c_str()); + pWnd->SetWindowText(CString(_T("Data directory: ")) + utf8ToTStr(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++, s.c_str()); + m_searchList.InsertString(j++, utf8ToTStr(s)); } else { - std::string filter(m_nameFilter.LockBuffer()); + std::string filter(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++, s.c_str()); + m_searchList.InsertString(j++, utf8ToTStr(s)); } } } @@ -214,7 +214,7 @@ void CNameDlg::updateSelectList() m_listToId.insert(std::make_pair(i, row)); } - m_idList.InsertString(i++, s.c_str()); + m_idList.InsertString(i++, utf8ToTStr(s)); } } @@ -359,19 +359,19 @@ void CNameDlg::checkNewGn() { // print a message if a new gn will be added to the list CWnd* pWnd = GetDlgItem(IDC_NAME_NEWGN); - std::string s = m_assignGn; + std::string s = tStrToUtf8(m_assignGn); uint rowIndex; if (s == "") { - pWnd->SetWindowText(" "); + pWnd->SetWindowText(_T(" ")); } else if (!m_fcts.findRow(0, s, rowIndex)) { - pWnd->SetWindowText("new gn !"); + pWnd->SetWindowText(_T("new gn !")); } else { - pWnd->SetWindowText(" "); + pWnd->SetWindowText(_T(" ")); // auto-fill ig field m_assignIg = m_fcts.getData(rowIndex, 1).toString().c_str(); } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/pacs.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/pacs.cpp index 351773cb6..08c5b7ac3 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/pacs.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/pacs.cpp @@ -51,7 +51,7 @@ void CPacsManager::loadPacs() string currentPath = 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 ((LPCTSTR)getMainFrame()->getDocument()->GetPathName()); + string s2 = NLMISC::CFile::getPath (tStrToUtf8(getMainFrame()->getDocument()->GetPathName())); CPath::setCurrentPath(s2.c_str()); string ss = CPath::getFullPath(path); CPath::setCurrentPath (ss.c_str()); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/primitive_configuration_dlg.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/primitive_configuration_dlg.cpp index b913a11f8..91346f6e7 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/primitive_configuration_dlg.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/primitive_configuration_dlg.cpp @@ -106,7 +106,7 @@ BOOL CPrimitiveConfigurationDlg::OnInitDialog() ListView_SetExtendedListViewStyle (ListCtrl, LVS_EX_CHECKBOXES); // Add the list column - ListCtrl.InsertColumn (0, "Configuration name"); + ListCtrl.InsertColumn (0, _T("Configuration name")); ListCtrl.SetColumnWidth (0, 350); // Add configurations @@ -114,7 +114,7 @@ BOOL CPrimitiveConfigurationDlg::OnInitDialog() uint i; for (i=0; i