From 12d475bb7544a1ba7a670e74158dc8998f28e3ca Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 15 Nov 2016 10:39:22 +0100 Subject: [PATCH] Changed: Use _T macro and TCHAR to support UNICODE --- code/nel/tools/3d/ligo/plugin_max/script.cpp | 24 +++++----- .../3d/object_viewer/animation_set_dlg.cpp | 12 ++--- .../tools/3d/object_viewer/bound_checker.h | 8 ++-- .../tools/3d/object_viewer/choose_name.cpp | 4 +- code/nel/tools/3d/object_viewer/choose_name.h | 2 +- .../tools/3d/object_viewer/choose_pool_id.cpp | 2 +- .../tools/3d/object_viewer/editable_range.h | 46 +++++++++---------- .../3d/object_viewer/skeleton_scale_dlg.cpp | 6 +-- .../3d/object_viewer/snapshot_tool_dlg.cpp | 2 +- .../object_viewer/vegetable_density_page.cpp | 17 +++---- .../tools/3d/object_viewer/vegetable_dlg.cpp | 32 ++++++------- .../tools/3d/object_viewer/vegetable_dlg.h | 2 +- .../3d/object_viewer/vegetable_list_box.cpp | 3 +- .../3d/object_viewer/vegetable_list_color.cpp | 4 +- .../vegetable_noise_value_dlg.cpp | 2 +- .../3d/object_viewer/water_pool_editor.cpp | 12 ++--- .../nel_export/nel_export_export.cpp | 8 ++-- .../nel_export/nel_export_node_properties.cpp | 6 +-- .../plugin_max/nel_mesh_lib/export_anim.cpp | 2 +- .../tools/3d/plugin_max/nel_patch_lib/rpo.cpp | 6 +-- .../3d/plugin_max/nel_patch_lib/rpo2nel.cpp | 10 ++-- 21 files changed, 104 insertions(+), 106 deletions(-) diff --git a/code/nel/tools/3d/ligo/plugin_max/script.cpp b/code/nel/tools/3d/ligo/plugin_max/script.cpp index 8a88136c5..51335d922 100644 --- a/code/nel/tools/3d/ligo/plugin_max/script.cpp +++ b/code/nel/tools/3d/ligo/plugin_max/script.cpp @@ -137,7 +137,7 @@ Value* export_material_cf (Value** arg_list, int count) check_arg_count(export_material, 4, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoExportMaterial [Object] [Filename] [CheckOnly] [Error in dialog]"; + TCHAR *message = _T("NeLLigoExportMaterial [Object] [Filename] [CheckOnly] [Error in dialog]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], String, message); type_check(arg_list[2], Boolean, message); @@ -306,7 +306,7 @@ Value* export_transition_cf (Value** arg_list, int count) check_arg_count(export_transition, 6, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoExportTransition [Object array (count=9)] [Output filename] [First material filename] [Second material filename] [CheckOnly] [Error in dialog]"; + TCHAR *message = _T("NeLLigoExportTransition [Object array (count=9)] [Output filename] [First material filename] [Second material filename] [CheckOnly] [Error in dialog]"); type_check(arg_list[0], Array, message); type_check(arg_list[1], String, message); type_check(arg_list[2], String, message); @@ -595,7 +595,7 @@ Value* get_error_zone_template_cf (Value** arg_list, int count) check_arg_count(get_error_zone_template, 4, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoGetErrorZoneTemplate [Array error codes] [Array vertex id] [Array messages] [Error index]"; + TCHAR *message = _T("NeLLigoGetErrorZoneTemplate [Array error codes] [Array vertex id] [Array messages] [Error index]"); type_check(arg_list[0], Array, message); type_check(arg_list[1], Array, message); type_check(arg_list[2], Array, message); @@ -637,7 +637,7 @@ Value* get_error_zone_template_cf (Value** arg_list, int count) vertexId->append (Integer::intern (id+1)); // Append messages - messages->append (new String("[LIGO DEBUG] Opened edge")); + messages->append (new String(_T("[LIGO DEBUG] Opened edge"))); } // Return the main error message @@ -687,7 +687,7 @@ Value* check_zone_with_material_cf (Value** arg_list, int count) check_arg_count(check_zone_with_template, 3, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoCheckZoneWithMaterial [Object] [Material filename] [Error in dialog]"; + TCHAR *message = _T("NeLLigoCheckZoneWithMaterial [Object] [Material filename] [Error in dialog]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], String, message); type_check(arg_list[2], Boolean, message); @@ -820,7 +820,7 @@ Value* check_zone_with_transition_cf (Value** arg_list, int count) check_arg_count(check_zone_with_template, 4, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoCheckZoneWithTransition [Object] [Transition filename] [Transition number: 0~8] [Error in dialog]"; + TCHAR *message = _T("NeLLigoCheckZoneWithTransition [Object] [Transition filename] [Transition number: 0~8] [Error in dialog]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], String, message); type_check(arg_list[2], Integer, message); @@ -987,7 +987,7 @@ Value* export_zone_cf (Value** arg_list, int count) check_arg_count(check_zone_with_template, 5, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoExportZone [Object] [Ligozone filename] [Category Array] [Error in dialog] [Snapshot]"; + TCHAR *message = _T("NeLLigoExportZone [Object] [Ligozone filename] [Category Array] [Error in dialog] [Snapshot]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], String, message); type_check(arg_list[2], Array, message); @@ -1362,7 +1362,7 @@ Value* get_error_string_cf (Value** arg_list, int count) check_arg_count(get_error_string, 1, count); // Checks arg - char *message = "NeLLigoGetErrorString [error code]"; + TCHAR *message = _T("NeLLigoGetErrorString [error code]"); type_check(arg_list[0], Integer, message); // The first arg @@ -1380,7 +1380,7 @@ Value* set_directory_cf (Value** arg_list, int count) check_arg_count(set_directory, 1, count); // Checks arg - char *message = "NeLLigoDirectory [path]"; + TCHAR *message = _T("NeLLigoDirectory [path]"); type_check(arg_list[0], String, message); // The first arg @@ -1398,7 +1398,7 @@ Value* get_zone_mask_cf (Value** arg_list, int count) check_arg_count(check_zone_with_template, 5, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoGetZoneMask [Object] [Mask Array] [Width Array] [Height Array] [Error in dialog]"; + TCHAR *message = _T("NeLLigoGetZoneMask [Object] [Mask Array] [Width Array] [Height Array] [Error in dialog]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], Array, message); type_check(arg_list[2], Array, message); @@ -1558,7 +1558,7 @@ Value* get_zone_size_cf (Value** arg_list, int count) check_arg_count(check_zone_with_template, 6, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoGetZoneMask [Object] [minx Array] [maxy Array] [miny Array] [maxy Array] [Error in dialog]"; + TCHAR *message = _T("NeLLigoGetZoneMask [Object] [minx Array] [maxy Array] [miny Array] [maxy Array] [Error in dialog]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], Array, message); type_check(arg_list[2], Array, message); @@ -1859,7 +1859,7 @@ Value* make_snapshot_cf (Value** arg_list, int count) check_arg_count(NeLLigoMakeSnapShot, 7, count); // Check to see if the arguments match up to what we expect - char *message = "NeLLigoMakeSnapShot [Object] [Snapshot filename] [xMin] [xMax] [yMin] [yMax] [Error in dialog]"; + TCHAR *message = _T("NeLLigoMakeSnapShot [Object] [Snapshot filename] [xMin] [xMax] [yMin] [yMax] [Error in dialog]"); type_check(arg_list[0], MAXNode, message); type_check(arg_list[1], String, message); type_check(arg_list[2], Integer, message); 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 664256e9f..1553aa882 100644 --- a/code/nel/tools/3d/object_viewer/animation_set_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/animation_set_dlg.cpp @@ -81,12 +81,12 @@ void CAnimationSetDlg::OnAddAnimation () if (instance != 0xffffffff) { // Create a dialog - static char BASED_CODE szFilter[] = - "NeL Animation Files (*.anim)\0*.anim\0" - "All Files (*.*)\0*.*\0\0"; + static TCHAR BASED_CODE szFilter[] = + _T("NeL Animation Files (*.anim)\0*.anim\0") + _T("All Files (*.*)\0*.*\0\0"); // Filename buffer - char buffer[65535]; + TCHAR buffer[65535]; buffer[0]=0; OPENFILENAME openFile; @@ -98,7 +98,7 @@ void CAnimationSetDlg::OnAddAnimation () openFile.lpstrFile = buffer; openFile.nMaxFile = 65535; openFile.Flags = OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT|OFN_ENABLESIZING|OFN_EXPLORER; - openFile.lpstrDefExt = "*.anim"; + openFile.lpstrDefExt = _T("*.anim"); if (GetOpenFileName(&openFile)) @@ -107,7 +107,7 @@ void CAnimationSetDlg::OnAddAnimation () try { // Filename pointer - char *c=buffer; + TCHAR *c=buffer; // Read the path CString path = buffer; diff --git a/code/nel/tools/3d/object_viewer/bound_checker.h b/code/nel/tools/3d/object_viewer/bound_checker.h index 6f797b556..1c1edec0c 100644 --- a/code/nel/tools/3d/object_viewer/bound_checker.h +++ b/code/nel/tools/3d/object_viewer/bound_checker.h @@ -77,24 +77,24 @@ public: /** validate a value against upper bound. (if an upper bound was set * \return NULL if ok or an error message */ - const char *validateUpperBound(T v) + const TCHAR *validateUpperBound(T v) { if (!_UpperBoundEnabled) return NULL; if (_UpperBoundExcluded && v < _UpperBound) return NULL; if (!_UpperBoundExcluded && v <= _UpperBound) return NULL; - return "value too high"; + return _T("value too high"); } /** validate a value against lower bound. (if an lower bound was set * \return NULL if ok or an error message */ - const char *validateLowerBound(T v) + const TCHAR *validateLowerBound(T v) { if (!_LowerBoundEnabled) return NULL; if (_LowerBoundExcluded && v > _LowerBound) return NULL; if (!_LowerBoundExcluded && v >= _LowerBound) return NULL; - return "value too low"; + return _T("value too low"); } /// copy this bound checker object to another one diff --git a/code/nel/tools/3d/object_viewer/choose_name.cpp b/code/nel/tools/3d/object_viewer/choose_name.cpp index ac15d50da..787cf6f80 100644 --- a/code/nel/tools/3d/object_viewer/choose_name.cpp +++ b/code/nel/tools/3d/object_viewer/choose_name.cpp @@ -22,11 +22,11 @@ // CChooseName dialog -CChooseName::CChooseName(const char *initialName, CWnd* pParent /*=NULL*/) +CChooseName::CChooseName(const TCHAR *initialName, CWnd* pParent /*=NULL*/) : CDialog(CChooseName::IDD, pParent) { //{{AFX_DATA_INIT(CChooseName) - m_Name = _T(initialName); + m_Name = initialName; //}}AFX_DATA_INIT } diff --git a/code/nel/tools/3d/object_viewer/choose_name.h b/code/nel/tools/3d/object_viewer/choose_name.h index bcde16b76..5bccfdd16 100644 --- a/code/nel/tools/3d/object_viewer/choose_name.h +++ b/code/nel/tools/3d/object_viewer/choose_name.h @@ -32,7 +32,7 @@ class CChooseName : public CDialog { // Construction public: - CChooseName(const char *initialName, CWnd* pParent = NULL); // standard constructor + CChooseName(const TCHAR *initialName, CWnd* pParent = NULL); // standard constructor std::string getName(); 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 b15236cf0..dcb8b325b 100644 --- a/code/nel/tools/3d/object_viewer/choose_pool_id.cpp +++ b/code/nel/tools/3d/object_viewer/choose_pool_id.cpp @@ -60,7 +60,7 @@ void CChoosePoolID::OnOK() } else { - MessageBox("Invalid value", "error", MB_OK); + MessageBox(_T("Invalid value"), _T("error"), MB_OK); } } diff --git a/code/nel/tools/3d/object_viewer/editable_range.h b/code/nel/tools/3d/object_viewer/editable_range.h index 485f57659..05e52857b 100644 --- a/code/nel/tools/3d/object_viewer/editable_range.h +++ b/code/nel/tools/3d/object_viewer/editable_range.h @@ -133,7 +133,7 @@ public: // SPECIALIZE THAT. write value into the given CString static void value2CString(T value, CString &dest); // SPECIALIZE THAT. convert a CString into a value, return NULL if ok, or a pointer to an error message - static const char *string2value(const CString &value, T &result); + static const TCHAR *string2value(const CString &value, T &result); @@ -162,14 +162,13 @@ protected: void updateValueFromText(void) { T value; - const char *message = string2value(m_Value, value); + const TCHAR *message = string2value(m_Value, value); if (!message) { - const char *mess = validateUpperBound(value) - ,*mess2 = validateLowerBound(value); + const TCHAR *mess = validateUpperBound(value), *mess2 = validateLowerBound(value); if (mess || mess2) { - MessageBox(mess ? mess : mess2, "error"); + MessageBox(mess ? mess : mess2, _T("error")); return; } @@ -179,7 +178,7 @@ protected: return; } - MessageBox(message, "error"); + MessageBox(message, _T("error")); } void selectRange(void) @@ -249,24 +248,23 @@ protected: { T upT, loT; - const char *message = string2value(lo, loT); + const TCHAR *message = string2value(lo, loT); if (message) { - ::MessageBox(NULL, message, "Range selection error", MB_OK); + ::MessageBox(NULL, message, _T("Range selection error"), MB_OK); return false; } - const char *mess = validateUpperBound(loT) - ,*mess2 = validateLowerBound(loT); + const TCHAR *mess = validateUpperBound(loT), *mess2 = validateLowerBound(loT); if (mess || mess2) { - MessageBox(mess ? mess : mess2, "error"); + MessageBox(mess ? mess : mess2, _T("error")); return false; } message = string2value(up, upT); if (message) { - ::MessageBox(NULL, message, "Range selection error", MB_OK); + ::MessageBox(NULL, message, _T("Range selection error"), MB_OK); return false; } @@ -274,14 +272,14 @@ protected: mess2 = validateLowerBound(upT); if (mess || mess2) { - MessageBox(mess ? mess : mess2, "error"); + MessageBox(mess ? mess : mess2, _T("error")); return false; } if (upT <= loT) { - ::MessageBox(NULL, "upper bound must be strictly greater than lower bound", "Range selection error", MB_OK); + ::MessageBox(NULL, _T("upper bound must be strictly greater than lower bound"), _T("Range selection error"), MB_OK); return false; } @@ -314,10 +312,10 @@ CEditableRangeT::CEditableRangeT(const std::string &id, CParticleWorkspac inline void CEditableRangeT::value2CString(float value, CString &dest) { - dest.Format("%g", (double) value); + dest.Format(_T("%g"), (double) value); } -inline const char *CEditableRangeT::string2value(const CString &value, float &result) +inline const TCHAR *CEditableRangeT::string2value(const CString &value, float &result) { if (sscanf((LPCTSTR) value, "%f", &result) == 1) { @@ -325,7 +323,7 @@ inline const char *CEditableRangeT::string2value(const CString &value, fl } else { - return "invalid value"; + return _T("invalid value"); } } @@ -340,17 +338,17 @@ CEditableRangeT::CEditableRangeT(const std::string &id, CParticleWorkspa inline void CEditableRangeT::value2CString(uint32 value, CString &dest) { - dest.Format("%d", value); + dest.Format(_T("%d"), value); } -inline const char *CEditableRangeT::string2value(const CString &value, uint32 &result) +inline const TCHAR *CEditableRangeT::string2value(const CString &value, uint32 &result) { uint32 tmp; if (sscanf((LPCTSTR) value, "%d", &tmp) == 1) { if (strchr((LPCTSTR) value, '-')) { - return "negative values not allowed"; + return _T("negative values not allowed"); } else { @@ -360,7 +358,7 @@ inline const char *CEditableRangeT::string2value(const CString &value, u } else { - return "invalid value"; + return _T("invalid value"); } } @@ -376,10 +374,10 @@ CEditableRangeT::CEditableRangeT(const std::string &id, CParticleWorkspa inline void CEditableRangeT::value2CString(sint32 value, CString &dest) { - dest.Format("%d", value); + dest.Format(_T("%d"), value); } -inline const char *CEditableRangeT::string2value(const CString &value, sint32 &result) +inline const TCHAR *CEditableRangeT::string2value(const CString &value, sint32 &result) { uint32 tmp; if (sscanf((LPCTSTR) value, "%d", &tmp) == 1) @@ -389,7 +387,7 @@ inline const char *CEditableRangeT::string2value(const CString &value, s } else { - return "invalid value"; + return _T("invalid value"); } } diff --git a/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp b/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp index 75e20064f..ed26b024f 100644 --- a/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/skeleton_scale_dlg.cpp @@ -833,7 +833,7 @@ void CSkeletonScaleDlg::OnSsdButtonSave() } else { - MessageBox("Failed to open file for write!"); + MessageBox(_T("Failed to open file for write!")); } } @@ -866,7 +866,7 @@ void CSkeletonScaleDlg::OnSsdButtonSaveas() } else { - MessageBox("Failed to open file for write!"); + MessageBox(_T("Failed to open file for write!")); } } } @@ -907,7 +907,7 @@ bool CSkeletonScaleDlg::saveCurrentInStream(NLMISC::IStream &f) } catch(NLMISC::EStream &) { - MessageBox("Failed to save file!"); + MessageBox(_T("Failed to save file!")); return false; } 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 0d256573c..6c212b53e 100644 --- a/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/snapshot_tool_dlg.cpp @@ -42,7 +42,7 @@ -#define NEL_OV_SNAPSHOT_TOOL_REGKEY "Software\\Nevrax\\nel\\object_viewer\\snapshot_dlg" +#define NEL_OV_SNAPSHOT_TOOL_REGKEY _T("Software\\Nevrax\\nel\\object_viewer\\snapshot_dlg") using namespace NLMISC; 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 2db682bcd..2465c4f83 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_density_page.cpp @@ -223,7 +223,7 @@ void CVegetableDensityPage::updateViewAngleMax() void CVegetableDensityPage::updateAngleMinFromEditText() { // get angles edited. - char stmp[256]; + TCHAR stmp[256]; AngleMinEdit.GetWindowText(stmp, 256); float angleMin; NLMISC::fromString(stmp, angleMin); @@ -247,7 +247,7 @@ void CVegetableDensityPage::updateAngleMinFromEditText() void CVegetableDensityPage::updateAngleMaxFromEditText() { // get angles edited. - char stmp[256]; + TCHAR stmp[256]; AngleMaxEdit.GetWindowText(stmp, 256); float angleMax; NLMISC::fromString(stmp, angleMax); @@ -320,7 +320,7 @@ BOOL CVegetableDensityPage::OnInitDialog() // Init ShapeName - StaticVegetableShape.SetWindowText(""); + StaticVegetableShape.SetWindowText(_T("")); return TRUE; // return TRUE unless you set the focus to a control @@ -477,12 +477,12 @@ static void concatEdit2Lines(CEdit &edit) const uint lineLen= 1000; uint n; // retrieve the 2 lines. - char tmp0[2*lineLen]; - char tmp1[lineLen]; + TCHAR tmp0[2*lineLen]; + TCHAR tmp1[lineLen]; n= edit.GetLine(0, tmp0, lineLen); tmp0[n]= 0; n= edit.GetLine(1, tmp1, lineLen); tmp1[n]= 0; // concat and update the CEdit. - edit.SetWindowText(strcat(tmp0, tmp1)); + edit.SetWindowText(_tcscat(tmp0, tmp1)); } void CVegetableDensityPage::OnChangeEditAngleMin() @@ -515,8 +515,9 @@ void CVegetableDensityPage::OnChangeEditAngleMax() // *************************************************************************** void CVegetableDensityPage::OnButtonVegetableBrowse() { - CFileDialog fd(TRUE, "veget", "*.veget", 0, NULL, this) ; - fd.m_ofn.lpstrTitle= "Open Vegetable Shape"; + CFileDialog fd(TRUE, _T("veget"), _T("*.veget"), 0, NULL, this) ; + fd.m_ofn.lpstrTitle = _T("Open Vegetable Shape"); + if (fd.DoModal() == IDOK) { // Add to the path diff --git a/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp b/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp index 09aa67ea4..c7e0cf9d2 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_dlg.cpp @@ -336,13 +336,13 @@ void CVegetableDlg::clearVegetables() // *************************************************************************** -bool CVegetableDlg::loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const char *title) +bool CVegetableDlg::loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const TCHAR *title) { vegetSet.clear(); bool ok= false; - CFileDialog fd(TRUE, ".vegetset", "*.vegetset", 0, NULL, this) ; - fd.m_ofn.lpstrTitle= title; + CFileDialog fd(TRUE, _T(".vegetset"), _T("*.vegetset"), 0, NULL, this) ; + fd.m_ofn.lpstrTitle = title; if (fd.DoModal() == IDOK) { NLMISC::CIFile f; @@ -361,13 +361,13 @@ bool CVegetableDlg::loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const catch(NLMISC::EStream &) { ok= false; - MessageBox("Failed to load file!"); + MessageBox(_T("Failed to load file!")); } } else { ok= false; - MessageBox("Failed to open file!"); + MessageBox(_T("Failed to open file!")); } } @@ -540,7 +540,7 @@ void CVegetableDlg::OnButtonVegetableClear() if(_Vegetables.size()==0) return; - if( MessageBox("Clear all the list?", "Clear List", MB_OKCANCEL | MB_ICONWARNING | MB_APPLMODAL)==IDOK ) + if( MessageBox(_T("Clear all the list?"), _T("Clear List"), MB_OKCANCEL | MB_ICONWARNING | MB_APPLMODAL)==IDOK ) { clearVegetables(); @@ -605,8 +605,8 @@ void CVegetableDlg::OnButtonVegetableRemove() // *************************************************************************** void CVegetableDlg::OnButtonVegetableLoadDesc() { - CFileDialog fd(TRUE, ".vegetdesc", "*.vegetdesc", 0, NULL, this) ; - fd.m_ofn.lpstrTitle= "Open Vegetable Descriptor"; + CFileDialog fd(TRUE, _T(".vegetdesc"), _T("*.vegetdesc"), 0, NULL, this) ; + fd.m_ofn.lpstrTitle = _T("Open Vegetable Descriptor"); if (fd.DoModal() == IDOK) { NLMISC::CIFile f; @@ -631,12 +631,12 @@ void CVegetableDlg::OnButtonVegetableLoadDesc() } catch(NLMISC::EStream &) { - MessageBox("Failed to load file!"); + MessageBox(_T("Failed to load file!")); } } else { - MessageBox("Failed to open file!"); + MessageBox(_T("Failed to open file!")); } } @@ -666,12 +666,12 @@ void CVegetableDlg::OnButtonVegetableSaveDesc() } catch(NLMISC::EStream &) { - MessageBox("Failed to save file!"); + MessageBox(_T("Failed to save file!")); } } else { - MessageBox("Failed to open file for write!"); + MessageBox(_T("Failed to open file for write!")); } } } @@ -684,7 +684,7 @@ void CVegetableDlg::OnButtonVegetableLoadSet() { NL3D::CTileVegetableDesc vegetSet; // if succes to load the vegetSet - if(loadVegetableSet(vegetSet, "Load Vegetable Set")) + if(loadVegetableSet(vegetSet, _T("Load Vegetable Set"))) { // Delete all vegetables. clearVegetables(); @@ -702,7 +702,7 @@ void CVegetableDlg::OnButtonVegetableAppendSet() { NL3D::CTileVegetableDesc vegetSet; // if succes to load the vegetSet - if(loadVegetableSet(vegetSet, "Append Vegetable Set")) + if(loadVegetableSet(vegetSet, _T("Append Vegetable Set"))) { // Do not Delete any vegetables. // build them from list. @@ -737,12 +737,12 @@ void CVegetableDlg::OnButtonVegetableSaveSet() } catch(NLMISC::EStream &) { - MessageBox("Failed to save file!"); + MessageBox(_T("Failed to save file!")); } } else { - MessageBox("Failed to open file for write!"); + MessageBox(_T("Failed to open file for write!")); } } diff --git a/code/nel/tools/3d/object_viewer/vegetable_dlg.h b/code/nel/tools/3d/object_viewer/vegetable_dlg.h index 37a263630..7dc0cbf99 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_dlg.h +++ b/code/nel/tools/3d/object_viewer/vegetable_dlg.h @@ -144,7 +144,7 @@ protected: // clear all vegetables. void clearVegetables(); // load a vegetSet with a FileDialog - bool loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const char *title); + bool loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const TCHAR *title); /** build the vegetSet from the current _Vegetables * NB: transform Rotate Angle in Radians. * \param keepDefaultShapeName if true, then vegetables with a ShapeName=="" are kept. diff --git a/code/nel/tools/3d/object_viewer/vegetable_list_box.cpp b/code/nel/tools/3d/object_viewer/vegetable_list_box.cpp index f5c7a2372..41305b38c 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_list_box.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_list_box.cpp @@ -216,8 +216,7 @@ void CVegetableListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) dc.SetTextColor(::GetSysColor(COLOR_GRAYTEXT) ); } - dc.DrawText( - (const char*)str, + dc.DrawText(str, str.GetLength(), &lpDrawItemStruct->rcItem, DT_LEFT|DT_SINGLELINE|DT_VCENTER); diff --git a/code/nel/tools/3d/object_viewer/vegetable_list_color.cpp b/code/nel/tools/3d/object_viewer/vegetable_list_color.cpp index 4e272e7d3..ec27c7352 100644 --- a/code/nel/tools/3d/object_viewer/vegetable_list_color.cpp +++ b/code/nel/tools/3d/object_viewer/vegetable_list_color.cpp @@ -134,7 +134,7 @@ void CVegetableListColor::clear() void CVegetableListColor::addValue(CRGBA color) { // Append a dummy string to the list box. - AddString(" "); + AddString(_T(" ")); // append a color to the array. _Colors.push_back(color); @@ -149,7 +149,7 @@ void CVegetableListColor::insertValueBeforeCurSel(CRGBA color) else { // insert a dummy string to the list box. - InsertString(id, " "); + InsertString(id, _T(" ")); // insert a color to the array. _Colors.insert(_Colors.begin()+id, color); 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 0c04d33c8..fb9bf1a1e 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 @@ -203,7 +203,7 @@ void CVegetableNoiseValueDlg::OnReleasedcaptureSliderVegetableScaleNoise(NMHDR* // And reset SliderNoiseValue.SetPos(NL_VEGETABLE_EDIT_SLIDER_NVS_SIZE/2); _EnteringScalerSlider= false; - StaticScaleMarker.SetWindowText("100%"); + StaticScaleMarker.SetWindowText(_T("100%")); // Must update display. _VegetableRefresh->refreshVegetableDisplay(); 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 601c5c907..e9fb36cf9 100644 --- a/code/nel/tools/3d/object_viewer/water_pool_editor.cpp +++ b/code/nel/tools/3d/object_viewer/water_pool_editor.cpp @@ -304,7 +304,7 @@ void CWaterPoolEditor::OnAddPool() { if (_Wpm->hasPool(cpi.PoolID) ) { - MessageBox("Pool already exists", "error"); + MessageBox(_T("Pool already exists"), _T("error")); } else { @@ -324,7 +324,7 @@ void CWaterPoolEditor::OnDeletePool() UpdateData(); if (m_PoolList.GetCount() == 1) { - MessageBox("Must have at least one water pool", "error"); + MessageBox(_T("Must have at least one water pool"), _T("error")); } else { @@ -350,8 +350,8 @@ void CWaterPoolEditor::OnSelchangeMapSize() void CWaterPoolEditor::OnLoadPool() { - static char BASED_CODE szFilter[] = "NeL Water Pool Files (*.wpf)|*.wpf||"; - CFileDialog fileDlg( TRUE, ".wpf", "*.wpf", OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); + static TCHAR BASED_CODE szFilter[] = _T("NeL Water Pool Files (*.wpf)|*.wpf||"); + CFileDialog fileDlg( TRUE, _T(".wpf"), _T("*.wpf"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); if (fileDlg.DoModal()==IDOK) { try @@ -388,8 +388,8 @@ void CWaterPoolEditor::OnLoadPool() void CWaterPoolEditor::OnSavePool() { - static char BASED_CODE szFilter[] = "NeL Water Pool Files (*.wpf)|*.wpf||"; - CFileDialog fileDlg( TRUE, ".wpf", "*.wpf", OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); + static TCHAR BASED_CODE szFilter[] = _T("NeL Water Pool Files (*.wpf)|*.wpf||"); + CFileDialog fileDlg( TRUE, _T(".wpf"), _T("*.wpf"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); if (fileDlg.DoModal()==IDOK) { try 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 46d88757b..3143c7c66 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 @@ -36,15 +36,15 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) { // Result to return bool bRet = false; - char tempFileName[MAX_PATH] = { 0 }; - char tempPathBuffer[MAX_PATH] = { 0 }; + TCHAR tempFileName[MAX_PATH] = { 0 }; + TCHAR tempPathBuffer[MAX_PATH] = { 0 }; try { - DWORD dwRetVal = GetTempPathA(MAX_PATH, tempPathBuffer); + DWORD dwRetVal = GetTempPath(MAX_PATH, tempPathBuffer); if (dwRetVal > MAX_PATH || (dwRetVal == 0)) nlerror("GetTempPath failed"); - UINT uRetVal = GetTempFileNameA(tempPathBuffer, TEXT("_nel_export_mesh_"), 0, tempFileName); + UINT uRetVal = GetTempFileName(tempPathBuffer, _T("_nel_export_mesh_"), 0, tempFileName); if (uRetVal == 0) nlerror("GetTempFileName failed"); 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 e65449409..92522d743 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 @@ -2332,11 +2332,11 @@ INT_PTR CALLBACK MiscDialogCallback ( break; case IDOK: { - currentParam->FloatingObject=SendMessage (GetDlgItem (hwndDlg, IDC_FLOATING_OBJECT), BM_GETCHECK, 0, 0); + currentParam->FloatingObject = SendMessage (GetDlgItem (hwndDlg, IDC_FLOATING_OBJECT), BM_GETCHECK, 0, 0); // Ligoscape currentParam->LigoSymmetry = SendMessage (GetDlgItem (hwndDlg, IDC_LIGO_SYMMETRY), BM_GETCHECK, 0, 0); - char tmp[512]; + TCHAR tmp[512]; GetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), tmp, 512); currentParam->LigoRotate = 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= tmp; + currentParam->ExportBoneScaleNameExt = wideToUtf8(tmp); // remanence currentParam->UseRemanence = SendMessage (GetDlgItem (hwndDlg, IDC_USE_REMANENCE), BM_GETCHECK, 0, 0); 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 06e3c051d..1416d287f 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 @@ -1761,7 +1761,7 @@ ITrack* CExportNel::buildATrack (CAnimation& animation, Control& c, TNelValueTyp } else { - MessageBox (NULL, "Warning: no pos track exported!", "Tmp NEL", MB_OK|MB_ICONEXCLAMATION); + MessageBox (NULL, _T("Warning: no pos track exported!"), _T("Tmp NEL"), MB_OK|MB_ICONEXCLAMATION); } } } 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 c2fd487dc..3acaf28bb 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 @@ -45,7 +45,7 @@ class RPOClassDesc:public ClassDesc } const TCHAR * ClassName() { - return "RklPatch"; + return _T("RklPatch"); } SClass_ID SuperClassID() { @@ -57,7 +57,7 @@ class RPOClassDesc:public ClassDesc } const TCHAR* Category() { - return "Rykol Tools"; + return _T("Rykol Tools"); } }; @@ -381,7 +381,7 @@ void RPO::GetCollapseTypes(Tab &clist,Tab &nlist) //TODO: Append any any other collapse type the plugin supports Class_ID id = RYKOLPATCHOBJ_CLASS_ID; - TSTR *name = new TSTR("Rykol Patch Mesh"); + TSTR *name = new TSTR(_T("Rykol Patch Mesh")); clist.Append(1,&id); nlist.Append(1,&name); } 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 a80b2d0e9..955bf337f 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 @@ -202,7 +202,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo if (loaded == false) { nlwarning ("Can't load any tile bank. Select on with the tile_utility plug-in"); - mprintf ("Can't load any tile bank. Select on with the tile_utility plug-in"); + mprintf (_T("Can't load any tile bank. Select on with the tile_utility plug-in")); return false; } } @@ -422,7 +422,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo icv=getCommonVertex(pPM,idstpatch,isrcpatch); if (icv==-1) { - mprintf ("Invalid bind"); + mprintf (_T("Invalid bind")); nlwarning ("Invalid bind"); return false; } @@ -439,7 +439,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo icv=getCommonVertex(pPM,idstpatch,isrcpatch); if (icv==-1) { - mprintf ("Invalid bind"); + mprintf (_T("Invalid bind")); nlwarning ("Invalid bind"); return false; } @@ -451,7 +451,7 @@ bool RPatchMesh::exportZone(INode* pNode, PatchMesh* pPM, NL3D::CZone& zone, CZo isrcedge=getEdge(pPM,srcpatch,srcpatch->v[nv],icv); if (isrcedge==-1) { - mprintf ("Invalid edge"); + mprintf (_T("Invalid edge")); nlwarning ("Invalid bind"); return false; } @@ -595,7 +595,7 @@ 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 ("Can't transform the zone"); + mprintf (_T("Can't transform the zone")); nlwarning ("Invalid bind"); return false; }