From 079e7bdc6b07c1bf647979509246da2390b23687 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 19 Nov 2016 21:07:20 +0100 Subject: [PATCH] Changed: Use _T macro and TCHAR to support UNICODE --- .../tools/3d/object_viewer/object_viewer.cpp | 4 +- .../3d/object_viewer/sound_anim_view.cpp | 4 +- .../3d/plugin_max/nel_export/nel_export.cpp | 2 +- .../plugin_max/nel_patch_converter/PO2RPO.h | 2 +- .../tools/3d/plugin_max/nel_patch_lib/rpo.h | 6 +-- .../3d/plugin_max/nel_patch_lib/rpo2nel.cpp | 4 +- .../3d/tile_edit/SelectionTerritoire.cpp | 46 +++++++++---------- .../leveldesign/georges_dll/form_dialog.cpp | 6 +-- .../world_editor/world_editor_doc.cpp | 2 +- 9 files changed, 35 insertions(+), 41 deletions(-) diff --git a/code/nel/tools/3d/object_viewer/object_viewer.cpp b/code/nel/tools/3d/object_viewer/object_viewer.cpp index 0abd848c4..3cefbb9a5 100644 --- a/code/nel/tools/3d/object_viewer/object_viewer.cpp +++ b/code/nel/tools/3d/object_viewer/object_viewer.cpp @@ -3667,8 +3667,8 @@ float CObjectViewer::getGlobalWindPower() const void CObjectViewer::shootScene() { - static const char BASED_CODE szFilter[] = "Targa Files (*.tga)|*.tga|Jpeg Files (*.jpg)|*.jpg|All Files (*.*)|*.*||"; - CFileDialog fileDlg ( FALSE, ".tga", "*.tga", OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); + static const TCHAR BASED_CODE szFilter[] = _T("PNG Files (*.png)|*.png|Targa Files (*.tga)|*.tga|Jpeg Files (*.jpg)|*.jpg|All Files (*.*)|*.*||"); + CFileDialog fileDlg ( FALSE, _T(".tga"), _T("*.tga"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); if (fileDlg.DoModal () == IDOK) { // Choose the size 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 5d0d3e1ed..44926dfce 100644 --- a/code/nel/tools/3d/object_viewer/sound_anim_view.cpp +++ b/code/nel/tools/3d/object_viewer/sound_anim_view.cpp @@ -216,8 +216,8 @@ void CSoundAnimView::save() filename.append(anim->getName()).append(".sound_anim"); // Create a dialog - char BASED_CODE szFilter[] = "NeL Sound Animations (*.sound_anim)|*.sound_anim|All Files (*.*)|*.*||"; - CFileDialog fileDlg( FALSE, ".sound_anim", filename.c_str(), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); + 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); if (fileDlg.DoModal() == IDOK) { 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 3a3e40810..bae035740 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 @@ -364,7 +364,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Error message char sErrorMsg[512]; sprintf (sErrorMsg, "Error exporting the vegetable %s in the file\n%s", pNode->GetName(), sSavePath); - MessageBox (hWnd, sErrorMsg, "NeL export", MB_OK|MB_ICONEXCLAMATION); + MessageBox (hWnd, sErrorMsg, _T("NeL export"), MB_OK|MB_ICONEXCLAMATION); } } } 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 d91777070..5ca665591 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 @@ -50,7 +50,7 @@ class PO2RPO : public Modifier { HWND hRollup; // From Animatable - TCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } + MCHAR *GetObjectName() { return GetString(IDS_CLASS_NAME); } //From Modifier //TODO: Add the channels that the modifier needs to perform its modification 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 0dfde7454..438701d3a 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,14 +83,14 @@ 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) - TCHAR *GetObjectName() { return "Rykol Patch Object";} + const MCHAR *GetObjectName() { return _T("Rykol Patch Object");} void GetWorldBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box ); void GetLocalBoundBox(TimeValue t, INode *mat, ViewExp *vpt, Box3& box ); void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel ); //TODO: Return the default name of the node when it is created. - void InitNodeName(TSTR& s) { s = "Rykol Patch Object"; } + void InitNodeName(TSTR& s) { s.FromUTF8("Rykol Patch Object"); } // From Object BOOL HasUVW(); @@ -206,7 +206,7 @@ class RPO : public PatchObject ? true : PatchObject::IsSubClassOf(classID); } SClass_ID SuperClassID() { return GEOMOBJECT_CLASS_ID; } - void GetClassName(TSTR& s) {s = "Rykol Patch Object";} + void GetClassName(TSTR& s) {s.FromUTF8("Rykol Patch Object");} RefTargetHandle Clone ( RemapDir &remap ); RefResult NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message); 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 955bf337f..41096352e 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 (EStream& stream) { - MessageBox (NULL, stream.what(), "Error", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, stream.what(), _T("Error"), MB_OK|MB_ICONEXCLAMATION); } } } @@ -398,7 +398,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo icv=getCommonVertex(pPM,idstpatch,isrcpatch,&orderdstvtx); if (icv==-1) { - mprintf ("Invalid bind"); + mprintf (_T("Invalid bind")); nlwarning ("Invalid bind"); return false; } diff --git a/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp b/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp index f82eef8c2..2193f2892 100644 --- a/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp +++ b/code/nel/tools/3d/tile_edit/SelectionTerritoire.cpp @@ -98,7 +98,7 @@ void SelectionTerritoire::OnAddTerritoire() CListBox *list=(CListBox*)GetDlgItem(IDC_LIST_TERRITOIRE); if (list->FindStringExact(0,GetStr.name)!=LB_ERR) { - MessageBox("Ce nom existe deja","Error",MB_ICONERROR); + MessageBox(_T("Ce nom existe deja","Error"), MB_ICONERROR); } else { @@ -163,7 +163,7 @@ void SelectionTerritoire::OnEditTerritoire() } else { - MessageBox("No tilesset selected","Error",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Error"), MB_ICONERROR); } } @@ -179,7 +179,7 @@ void SelectionTerritoire::OnRemoveTerritoire() } else { - MessageBox("No tilesset selected","Chcrois kca va pas etreuu possibleuuu",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Chcrois kca va pas etreuu possibleuuu"), MB_ICONERROR); } } @@ -197,7 +197,7 @@ void SelectionTerritoire::OnAddTileSet() CListBox *list=(CListBox*)GetDlgItem(IDC_TILE_SET); if (list->FindStringExact(0,GetStr.name)!=LB_ERR) { - MessageBox("Ce nom existe deja","Error",MB_ICONERROR); + MessageBox(_T("Ce nom existe deja") , _T("Error"), MB_ICONERROR); } else { @@ -268,7 +268,7 @@ void SelectionTerritoire::OnEditTileSet() } else { - MessageBox("No tilesset selected","Error",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Error"), MB_ICONERROR); } } @@ -284,7 +284,7 @@ void SelectionTerritoire::OnRemoveTileSet() } else { - MessageBox("No tilesset selected","Chcrois kca va pas etreuu possibleuuu",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Chcrois kca va pas etreuu possibleuuu"), MB_ICONERROR); } } @@ -315,7 +315,7 @@ void SelectionTerritoire::OnMonter() } else { - MessageBox("No tilesset selected","Chcrois kca va pas etreuu possibleuuu",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Chcrois kca va pas etreuu possibleuuu"), MB_ICONERROR); } } @@ -346,7 +346,7 @@ void SelectionTerritoire::OnDescendre() } else { - MessageBox("No tilesset selected","Chcrois kca va pas etreuu possibleuuu",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Chcrois kca va pas etreuu possibleuuu"), MB_ICONERROR); } } @@ -355,9 +355,8 @@ void SelectionTerritoire::OnSelect() // TODO: Add your control notification handler code here CListBox *list=(CListBox*)GetDlgItem(IDC_LIST_TERRITOIRE); CListBox *list2=(CListBox*)GetDlgItem(IDC_TILE_SET); - static char BASED_CODE szFilter[] = - "NeL tile bank files (*.bank)|*.bank|All Files (*.*)|*.*||"; - CFileDialog sFile(true, "bank", "main.bank",0, szFilter, this); + static TCHAR BASED_CODE szFilter[] = _T("NeL tile bank files (*.bank)|*.bank|All Files (*.*)|*.*||"); + CFileDialog sFile(true, _T("bank"), _T("main.bank"), 0, szFilter, this); if (sFile.DoModal()==IDOK) { POSITION p = sFile.GetStartPosition(); @@ -425,7 +424,7 @@ LRESULT SelectionTerritoire::WindowProc(UINT message, WPARAM wParam, LPARAM lPar void SelectionTerritoire::OnOK() { // TODO: Add extra validation here - if (::MessageBox (NULL, "Are you sure you want to quit?", "Quit", MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES) + if (::MessageBox (NULL, _T("Are you sure you want to quit?"), _T("Quit"), MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES) { CDialog::OnOK(); } @@ -453,9 +452,8 @@ void SelectionTerritoire::Save(const char* path, CTileBank &toSave) void SelectionTerritoire::OnSaveAs() { // TODO: Add your control notification handler code here - static char BASED_CODE szFilter[] = - "NeL tile bank files (*.bank)|*.bank|All Files (*.*)|*.*||"; - CFileDialog sFile(false, "bank", DefautPath+MainFileName, 0, szFilter, this); + static TCHAR BASED_CODE szFilter[] = _T("NeL tile bank files (*.bank)|*.bank|All Files (*.*)|*.*||"); + CFileDialog sFile(false, _T("bank"), DefautPath+MainFileName, 0, szFilter, this); if (sFile.DoModal()==IDOK) { Save (sFile.GetPathName(), tileBank); @@ -482,7 +480,7 @@ void SelectionTerritoire::OnSaveAs() void SelectionTerritoire::OnCancel() { // TODO: Add extra cleanup here - if (::MessageBox (NULL, "Are you sure you want to quit?", "Quit", MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES) + if (::MessageBox (NULL, _T("Are you sure you want to quit?"), _T("Quit"), MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES) { CDialog::OnCancel(); } @@ -543,7 +541,7 @@ void SelectionTerritoire::OnPath() // Last check char msg[512]; sprintf (msg, "Do you really want to set %s as base path of the bank ?", path); - if (MessageBox (msg, "TileEdit", MB_YESNO|MB_ICONQUESTION)==IDYES) + if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDYES) { // Set as default path.. @@ -591,7 +589,7 @@ void SelectionTerritoire::OnPath() sprintf (msg, "Path '%s' can't be found in bitmap '%s'. Continue ?", path, bitmapPath.c_str()); // Message - if (MessageBox (msg, "TileEdit", MB_YESNO|MB_ICONQUESTION)==IDNO) + if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO) break; } } @@ -620,7 +618,7 @@ void SelectionTerritoire::OnPath() sprintf (msg, "Path '%s' can't be found in bitmap '%s'. Continue ?", path, bitmapPath); // Message - if (MessageBox (msg, "TileEdit", MB_YESNO|MB_ICONQUESTION)==IDNO) + if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO) break; } } @@ -683,7 +681,7 @@ void SelectionTerritoire::OnPath() } else // Info message - MessageBox ("Can't set the path.", "TileEdit", MB_OK|MB_ICONINFORMATION); + MessageBox (_T("Can't set the path."), _T("TileEdit"), MB_OK|MB_ICONINFORMATION); } @@ -706,9 +704,9 @@ void SelectionTerritoire::OnPath() void SelectionTerritoire::OnExport() { // TODO: Add your control notification handler code here - static char BASED_CODE szFilter[] = - "NeL tile bank files (*.smallbank)|*.smallbank|All Files (*.*)|*.*||"; - CFileDialog sFile(false, "*.smallbank", DefautPath+"*.smallbank", 0, szFilter, this); + static TCHAR BASED_CODE szFilter[] = + _T("NeL tile bank files (*.smallbank)|*.smallbank|All Files (*.*)|*.*||"); + CFileDialog sFile(false, _T("*.smallbank"), DefautPath+ _T("*.smallbank"), 0, szFilter, this); if (sFile.DoModal()==IDOK) { // Copy the bank @@ -737,7 +735,7 @@ void SelectionTerritoire::OnChooseVeget() } else { - MessageBox("No tilesset selected","Error",MB_ICONERROR); + MessageBox(_T("No tilesset selected"), _T("Error"), MB_ICONERROR); } } diff --git a/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp b/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp index a770c8b8c..4657ee369 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp @@ -864,12 +864,8 @@ BOOL CFormDialog::OnCommand(WPARAM wParam, LPARAM lParam) CGeorgesEditDoc *doc = View->GetDocument (); if (doc) { - // Build the filter string - char filter[512]; - smprintf (filter, 512, "Dfn Files (*.dfn)|*.dfn|All Files(*.*)|*.*|"); - // Open the dialog - CFileDialog dlgFile (TRUE, "*.dfn", "*.dfn", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, filter, theApp.m_pMainWnd); + CFileDialog dlgFile (TRUE, _T("*.dfn"), _T("*.dfn"), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("Dfn Files (*.dfn)|*.dfn|All Files(*.*)|*.*|"), theApp.m_pMainWnd); if (dlgFile.DoModal () == IDOK) { combo->Combo.UpdateData (); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor_doc.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor_doc.cpp index 6e9cd9d39..9eeba96b9 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor_doc.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/world_editor_doc.cpp @@ -1532,7 +1532,7 @@ const NLLIGO::IPrimitive *CWorldEditorDoc::createPrimitive (const CDatabaseLocat if (primClass->Type == CPrimitiveClass::Bitmap) { // Create a dialog file - CFileDialogEx dialog (BASE_REGISTRY_KEY, "image", TRUE, primClass->FileExtension.c_str (), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, + CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("image"), TRUE, primClass->FileExtension.c_str (), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, (primClass->FileType+" (*."+primClass->FileExtension+")|*."+primClass->FileExtension+"|All Files (*.*)|*.*||").c_str (), getMainFrame ()); if (dialog.DoModal() == IDOK) {