Changed: Use _T macro, TCHAR, tStrToUtf8/utf8ToTStr, etc... to support UNICODE

--HG--
branch : develop
feature/pipeline-tools
kervala 8 years ago
parent 3e2c731444
commit d568a0eedd

@ -70,14 +70,14 @@ BOOL CAboutDialog::OnInitDialog()
{ {
uint *versionTab; uint *versionTab;
uint versionSize; uint versionSize;
if (VerQueryValue (pInfo, "\\", (void**)&versionTab, &versionSize)) if (VerQueryValue (pInfo, _T("\\"), (void**)&versionTab, &versionSize))
{ {
// Get the pointer on the structure // Get the pointer on the structure
VS_FIXEDFILEINFO *info=(VS_FIXEDFILEINFO*)versionTab; VS_FIXEDFILEINFO *info=(VS_FIXEDFILEINFO*)versionTab;
// Setup version number // Setup version number
char version[512]; TCHAR version[512];
sprintf (version, "Version %d.%d.%d.%d", _stprintf (version, _T("Version %d.%d.%d.%d"),
info->dwFileVersionMS>>16, info->dwFileVersionMS>>16,
info->dwFileVersionMS&0xffff, info->dwFileVersionMS&0xffff,
info->dwFileVersionLS>>16, info->dwFileVersionLS>>16,

@ -83,7 +83,7 @@ void CEditEx::setSInt(sint value)
{ {
nlassert(_Type == SIntType); nlassert(_Type == SIntType);
TCHAR buf[16]; TCHAR buf[16];
_tcprintf(buf, "%d", (int) value); _stprintf(buf, _T("%d"), (int) value);
setString(buf); setString(buf);
} }
@ -91,7 +91,7 @@ void CEditEx::setUInt(uint value)
{ {
nlassert(_Type == UIntType); nlassert(_Type == UIntType);
TCHAR buf[16]; TCHAR buf[16];
_tcprintf(buf, "%d", (int) value); _stprintf(buf, _T("%d"), (int) value);
setString(buf); setString(buf);
} }
@ -99,7 +99,7 @@ void CEditEx::setFloat(float value)
{ {
nlassert(_Type == FloatType); nlassert(_Type == FloatType);
TCHAR buf[16]; TCHAR buf[16];
_tcprintf(buf, "%g", (double) value); _stprintf(buf, _T("%g"), (double) value);
setString(buf); setString(buf);
} }

@ -346,7 +346,7 @@ inline const TCHAR *CEditableRangeT<uint32>::string2value(const CString &value,
sint32 tmp; sint32 tmp;
if (NLMISC::fromString(tStrToUtf8(value), tmp)) if (NLMISC::fromString(tStrToUtf8(value), tmp))
{ {
if (strchr((LPCTSTR) value, '-')) if (value.Find(_T("-")) > -1)
{ {
return _T("negative values not allowed"); return _T("negative values not allowed");
} }

@ -65,7 +65,7 @@ void CGlobalWindDlg::updateView()
// update Power. // update Power.
a= _ObjViewer->getGlobalWindPower(); a= _ObjViewer->getGlobalWindPower();
_tcprintf(str, "%.2f", a); _stprintf(str, _T("%.2f"), a);
StaticPower.SetWindowText(str); StaticPower.SetWindowText(str);
NLMISC::clamp(a, 0.f, 1.f); NLMISC::clamp(a, 0.f, 1.f);
SliderPower.SetPos((sint)(a*NL_GLOBAL_WIND_SLIDER_RANGE)); SliderPower.SetPos((sint)(a*NL_GLOBAL_WIND_SLIDER_RANGE));
@ -117,7 +117,7 @@ void CGlobalWindDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
a= (float)nPos / NL_GLOBAL_WIND_SLIDER_RANGE; a= (float)nPos / NL_GLOBAL_WIND_SLIDER_RANGE;
_ObjViewer->setGlobalWindPower(a); _ObjViewer->setGlobalWindPower(a);
_tcprintf(str, "%.2f", a); _stprintf(str, _T("%.2f"), a);
StaticPower.SetWindowText(str); StaticPower.SetWindowText(str);
} }
else else

@ -59,21 +59,21 @@ public:
bool freeExported(void); bool freeExported(void);
void getSelectedNode (std::vector<INode*>& vectNode); void getSelectedNode (std::vector<INode*>& vectNode);
bool exportZone (const char *sName, INode& node, TimeValue time); bool exportZone (const std::string &sName, INode& node, TimeValue time);
bool exportMesh (const char *sPath, INode& node, TimeValue time); bool exportMesh (const std::string &sPath, INode& node, TimeValue time);
bool exportAnim (const char *sPath, std::vector<INode*>& vectNode, TimeValue time, bool scene); bool exportAnim (const std::string &sPath, std::vector<INode*>& vectNode, TimeValue time, bool scene);
bool exportSWT (const char *sPath, std::vector<INode*>& vectNode); bool exportSWT (const std::string &sPath, std::vector<INode*>& vectNode);
bool exportInstanceGroup (std::string filename, std::vector<INode*>& vectNode); bool exportInstanceGroup (std::string filename, std::vector<INode*>& vectNode);
bool exportSkeleton (const char *sPath, INode* pNode, TimeValue time); bool exportSkeleton (const std::string &sPath, INode* pNode, TimeValue time);
bool exportCollision (const char *sPath, std::vector<INode *> &nodes, TimeValue time); bool exportCollision (const std::string &sPath, std::vector<INode *> &nodes, TimeValue time);
bool exportPACSPrimitives (const char *sPath, std::vector<INode *> &nodes, TimeValue time); bool exportPACSPrimitives (const std::string &sPath, std::vector<INode *> &nodes, TimeValue time);
bool exportVegetable (const char *sPath, INode& node, TimeValue time); bool exportVegetable (const std::string &sPath, INode& node, TimeValue time);
bool exportLodCharacter (const char *sPath, INode& node, TimeValue time); bool exportLodCharacter (const std::string &sPath, INode& node, TimeValue time);
void viewMesh (TimeValue time); void viewMesh (TimeValue time);
@ -81,16 +81,8 @@ public:
static void deleteLM(INode& ZeNode); // the export scene struct MUST be initialized before calling this fn static void deleteLM(INode& ZeNode); // the export scene struct MUST be initialized before calling this fn
void OnNodeProperties (const std::set<INode*> &listNode); void OnNodeProperties (const std::set<INode*> &listNode);
ULONG ExtractFileName(char* Path, char* Name); ULONG SelectFileForSave(HWND Parent, TCHAR* Title, const TCHAR* Mask, std::string &FileName);
ULONG ExtractPath(char* FullPath, char* Path); ULONG SelectDir(HWND Parent, TCHAR* Title, std::string &Path);
ULONG SelectFileForLoad(HWND Parent, char* Title, const char* Mask, char* FileName);
ULONG SelectFileForSave(HWND Parent, char* Title, const char* Mask, char* FileName);
ULONG SelectDir(HWND Parent, char* Title, char* Path);
static ULONG FileExists(const char* FileName);
ULONG GetFileSize(char* FileName);
ULONG ProcessDir(char* Dir, const char* Mask, unsigned long flag, ULONG Fnct(char* FileName) );
ULONG CleanFileName(char* FileName);
ULONG CreateBAKFile(char* FileName);
// The nel export objtect // The nel export objtect
CExportNel *_ExportNel; CExportNel *_ExportNel;

@ -30,7 +30,7 @@ using namespace NLPACS;
// -------------------------------------------------- // --------------------------------------------------
bool CNelExport::exportCollision (const char *sPath, std::vector<INode *> &nodes, TimeValue time) bool CNelExport::exportCollision (const std::string &sPath, std::vector<INode *> &nodes, TimeValue time)
{ {
// get list of CMB froms nodes. // get list of CMB froms nodes.
std::vector<std::pair<std::string, NLPACS::CCollisionMeshBuild*> > meshBuildList; std::vector<std::pair<std::string, NLPACS::CCollisionMeshBuild*> > meshBuildList;
@ -148,7 +148,7 @@ bool CNelExport::exportCollision (const char *sPath, INode& node, Interface& _Ip
*/ */
// -------------------------------------------------- // --------------------------------------------------
bool CNelExport::exportPACSPrimitives (const char *sPath, std::vector<INode *> &nodes, TimeValue time) bool CNelExport::exportPACSPrimitives (const std::string &sPath, std::vector<INode *> &nodes, TimeValue time)
{ {
// Build the primitive block // Build the primitive block
NLPACS::CPrimitiveBlock primitiveBlock; NLPACS::CPrimitiveBlock primitiveBlock;
@ -172,12 +172,12 @@ bool CNelExport::exportPACSPrimitives (const char *sPath, std::vector<INode *> &
} }
else else
{ {
nlwarning ("Can't init XML stream with file %s", sPath); nlwarning ("Can't init XML stream with file %s", sPath.c_str());
} }
} }
else else
{ {
nlwarning ("Can't open the file %s for writing", sPath); nlwarning ("Can't open the file %s for writing", sPath.c_str());
} }
} }
return false; return false;

@ -32,7 +32,7 @@ using namespace NLMISC;
// -------------------------------------------------- // --------------------------------------------------
bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time) bool CNelExport::exportMesh (const std::string &sPath, INode& node, TimeValue time)
{ {
// Result to return // Result to return
bool bRet = false; bool bRet = false;
@ -213,7 +213,7 @@ bool CNelExport::exportMesh (const char *sPath, INode& node, TimeValue time)
// -------------------------------------------------- // --------------------------------------------------
bool CNelExport::exportVegetable (const char *sPath, INode& node, TimeValue time) bool CNelExport::exportVegetable (const std::string &sPath, INode& node, TimeValue time)
{ {
bool bRet=false; bool bRet=false;
@ -246,7 +246,7 @@ bool CNelExport::exportVegetable (const char *sPath, INode& node, TimeValue time
// -------------------------------------------------- // --------------------------------------------------
bool CNelExport::exportAnim (const char *sPath, std::vector<INode*>& vectNode, TimeValue time, bool scene) bool CNelExport::exportAnim (const std::string &sPath, std::vector<INode*>& vectNode, TimeValue time, bool scene)
{ {
// Result to return // Result to return
bool bRet=false; bool bRet=false;
@ -343,7 +343,7 @@ bool CNelExport::exportAnim (const char *sPath, std::vector<INode*>& vectNode, T
catch (const Exception& e) catch (const Exception& e)
{ {
if (_ErrorInDialog) if (_ErrorInDialog)
MessageBox (NULL, e.what(), "NeL export", MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, utf8ToTStr(e.what()), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION);
else else
nlwarning ("ERROR : %s", e.what ()); nlwarning ("ERROR : %s", e.what ());
} }
@ -351,9 +351,9 @@ bool CNelExport::exportAnim (const char *sPath, std::vector<INode*>& vectNode, T
else else
{ {
if (_ErrorInDialog) if (_ErrorInDialog)
MessageBox (NULL, "Can't open the file for writing.", "NeL export", MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, _T("Can't open the file for writing."), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION);
else else
nlwarning ("ERROR : Can't open the file (%s) for writing", tempFileName); nlwarning ("ERROR : Can't open the file (%s) for writing", tempFileName.c_str());
if (_TerminateOnFileOpenIssues) if (_TerminateOnFileOpenIssues)
nelExportTerminateProcess(); nelExportTerminateProcess();
} }
@ -383,7 +383,7 @@ bool CNelExport::exportAnim (const char *sPath, std::vector<INode*>& vectNode, T
// -------------------------------------------------- // --------------------------------------------------
bool CNelExport::exportSkeleton (const char *sPath, INode* pNode, TimeValue time) bool CNelExport::exportSkeleton (const std::string &sPath, INode* pNode, TimeValue time)
{ {
// Result to return // Result to return
bool bRet=false; bool bRet=false;
@ -422,7 +422,7 @@ bool CNelExport::exportSkeleton (const char *sPath, INode* pNode, TimeValue time
// -------------------------------------------------- // --------------------------------------------------
bool CNelExport::exportLodCharacter (const char *sPath, INode& node, TimeValue time) bool CNelExport::exportLodCharacter (const std::string &sPath, INode& node, TimeValue time)
{ {
// Result to return // Result to return
bool bRet=false; bool bRet=false;

@ -31,50 +31,50 @@ using namespace NLMISC;
// Which dialog tab is the VerytexProgram one? // Which dialog tab is the VerytexProgram one?
#define TAB_VP_ID 5 #define TAB_VP_ID 5
char *_EnvironmentNames[] = TCHAR *_EnvironmentNames[] =
{ {
"", _T(""),
"no fx", _T("no fx"),
"GENERIC", _T("GENERIC"),
"PADDEDCELL", _T("PADDEDCELL"),
"ROOM", _T("ROOM"),
"BATHROOM", _T("BATHROOM"),
"LIVINGROOM", _T("LIVINGROOM"),
"STONEROOM", _T("STONEROOM"),
"AUDITORIUM", _T("AUDITORIUM"),
"CONCERTHALL", _T("CONCERTHALL"),
"CAVE", _T("CAVE"),
"ARENA", _T("ARENA"),
"HANGAR", _T("HANGAR"),
"CARPETEDHALLWAY", _T("CARPETEDHALLWAY"),
"HALLWAY", _T("HALLWAY"),
"STONECORRIDOR", _T("STONECORRIDOR"),
"ALLEY", _T("ALLEY"),
"FOREST", _T("FOREST"),
"CITY", _T("CITY"),
"MOUNTAINS", _T("MOUNTAINS"),
"QUARRY", _T("QUARRY"),
"PLAIN", _T("PLAIN"),
"PARKINGLOT", _T("PARKINGLOT"),
"SEWERPIPE", _T("SEWERPIPE"),
"UNDERWATER", _T("UNDERWATER"),
"DRUGGED", _T("DRUGGED"),
"DIZZY", _T("DIZZY"),
"PSYCHOTIC", _T("PSYCHOTIC"),
NULL NULL
}; };
char *_MaterialNames[] = TCHAR *_MaterialNames[] =
{ {
"", _T(""),
"no occlusion", _T("no occlusion"),
"SINGLEWINDOW", _T("SINGLEWINDOW"),
"DOUBLEWINDOW", _T("DOUBLEWINDOW"),
"THINDOOR", _T("THINDOOR"),
"THICKDOOR", _T("THICKDOOR"),
"WOODWALL", _T("WOODWALL"),
"BRICKWALL", _T("BRICKWALL"),
"STONEWALL", _T("STONEWALL"),
"CURTAIN", _T("CURTAIN"),
NULL NULL
}; };
@ -319,7 +319,7 @@ INT_PTR CALLBACK VertexProgramDialogCallBack (HWND hwndDlg, UINT uMsg, WPARAM wP
INT_PTR CALLBACK MiscDialogCallback (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK MiscDialogCallback (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK AnimationDialogCallback (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK AnimationDialogCallback (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
const char *SubText[TAB_COUNT] = {"LOD & MRM", "Accelerator", "Instance", "Lighting", "LMC", "Vegetable", "VertexProgram", "Misc", "Animation"}; const TCHAR *SubText[TAB_COUNT] = { _T("LOD & MRM"), _T("Accelerator"), _T("Instance"), _T("Lighting"), _T("LMC"), _T("Vegetable"), _T("VertexProgram"), _T("Misc"), _T("Animation")};
const int SubTab[TAB_COUNT] = {IDD_LOD, IDD_ACCEL, IDD_INSTANCE, IDD_LIGHTMAP, IDD_LIGHTMAP2, IDD_VEGETABLE, IDD_VERTEX_PROGRAM, IDD_MISC, IDD_ANIM}; const int SubTab[TAB_COUNT] = {IDD_LOD, IDD_ACCEL, IDD_INSTANCE, IDD_LIGHTMAP, IDD_LIGHTMAP2, IDD_VEGETABLE, IDD_VERTEX_PROGRAM, IDD_MISC, IDD_ANIM};
DLGPROC SubProc[TAB_COUNT] = {MRMDialogCallback, AccelDialogCallback, InstanceDialogCallback, LightmapDialogCallback, Lightmap2DialogCallback, VegetableDialogCallback, VertexProgramDialogCallBack, MiscDialogCallback, AnimationDialogCallback}; DLGPROC SubProc[TAB_COUNT] = {MRMDialogCallback, AccelDialogCallback, InstanceDialogCallback, LightmapDialogCallback, Lightmap2DialogCallback, VegetableDialogCallback, VertexProgramDialogCallBack, MiscDialogCallback, AnimationDialogCallback};
@ -581,16 +581,16 @@ INT_PTR CALLBACK AccelDialogCallback (
currentParam->AudibleFromFather=SendMessage (GetDlgItem (hwndDlg, IDC_AUDIBLE_FROM_FATHER), BM_GETCHECK, 0, 0); currentParam->AudibleFromFather=SendMessage (GetDlgItem (hwndDlg, IDC_AUDIBLE_FROM_FATHER), BM_GETCHECK, 0, 0);
// get the strings params // get the strings params
char tmp[256]; TCHAR tmp[256];
SendMessage (GetDlgItem(hwndDlg, IDC_OCC_MODEL), WM_GETTEXT, 256, (LONG)tmp); SendMessage (GetDlgItem(hwndDlg, IDC_OCC_MODEL), WM_GETTEXT, 256, (LPARAM)tmp);
currentParam->OcclusionModel = tmp; currentParam->OcclusionModel = tStrToUtf8(tmp);
SendMessage (GetDlgItem(hwndDlg, IDC_OPEN_OCC_MODEL), WM_GETTEXT, 256, (LONG)tmp); SendMessage (GetDlgItem(hwndDlg, IDC_OPEN_OCC_MODEL), WM_GETTEXT, 256, (LPARAM)tmp);
currentParam->OpenOcclusionModel = tmp; currentParam->OpenOcclusionModel = tStrToUtf8(tmp);
SendMessage (GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_GETTEXT, 256, (LONG)tmp); SendMessage (GetDlgItem(hwndDlg, IDC_SOUND_GROUP), WM_GETTEXT, 256, (LPARAM)tmp);
currentParam->SoundGroup = tmp; currentParam->SoundGroup = tStrToUtf8(tmp);
_KnownSoundGroups.insert(tmp); _KnownSoundGroups.insert(currentParam->SoundGroup);
SendMessage (GetDlgItem(hwndDlg, IDC_ENV_FX), WM_GETTEXT, 256, (LONG)tmp); SendMessage (GetDlgItem(hwndDlg, IDC_ENV_FX), WM_GETTEXT, 256, (LPARAM)tmp);
currentParam->EnvironmentFX = tmp; currentParam->EnvironmentFX = tStrToUtf8(tmp);
// Quit // Quit
EndDialog(hwndDlg, IDOK); EndDialog(hwndDlg, IDOK);
@ -653,9 +653,9 @@ INT_PTR CALLBACK MRMDialogCallback (
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
// Window text // Window text
std::string winName=(*(currentParam->ListNode->begin()))->GetName(); std::string winName= tStrToUtf8((*(currentParam->ListNode->begin()))->GetName());
winName="Node properties ("+winName+((currentParam->ListNode->size()>1)?" ...)":")"); winName="Node properties ("+winName+((currentParam->ListNode->size()>1)?" ...)":")");
SetWindowText (hwndDlg, winName.c_str()); SetWindowText (hwndDlg, utf8ToTStr(winName));
// Set default state // Set default state
SendMessage (GetDlgItem (hwndDlg, IDC_BLEND_IN), BM_SETCHECK, currentParam->BlendIn, 0); SendMessage (GetDlgItem (hwndDlg, IDC_BLEND_IN), BM_SETCHECK, currentParam->BlendIn, 0);
@ -669,8 +669,8 @@ INT_PTR CALLBACK MRMDialogCallback (
EnableWindow (GetDlgItem (hwndDlg, IDC_UP), currentParam->ListActived); EnableWindow (GetDlgItem (hwndDlg, IDC_UP), currentParam->ListActived);
EnableWindow (GetDlgItem (hwndDlg, IDC_DOWN), currentParam->ListActived); EnableWindow (GetDlgItem (hwndDlg, IDC_DOWN), currentParam->ListActived);
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), currentParam->DistMax.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), utf8ToTStr(currentParam->DistMax));
SetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), currentParam->BlendLength.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), utf8ToTStr(currentParam->BlendLength));
SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_SETCHECK, currentParam->MRM, 0); SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_SETCHECK, currentParam->MRM, 0);
CoarseStateChanged (hwndDlg); CoarseStateChanged (hwndDlg);
@ -678,12 +678,12 @@ INT_PTR CALLBACK MRMDialogCallback (
if (currentParam->SkinReduction!=-1) if (currentParam->SkinReduction!=-1)
CheckRadioButton (hwndDlg, IDC_SKIN_REDUCTION_MIN, IDC_SKIN_REDUCTION_BEST, IDC_SKIN_REDUCTION_MIN+currentParam->SkinReduction); CheckRadioButton (hwndDlg, IDC_SKIN_REDUCTION_MIN, IDC_SKIN_REDUCTION_BEST, IDC_SKIN_REDUCTION_MIN+currentParam->SkinReduction);
SetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), currentParam->NbLod.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), utf8ToTStr(currentParam->NbLod));
SetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), currentParam->Divisor.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), utf8ToTStr(currentParam->Divisor));
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), currentParam->DistanceFinest.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), utf8ToTStr(currentParam->DistanceFinest));
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), currentParam->DistanceMiddle.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), utf8ToTStr(currentParam->DistanceMiddle));
SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), currentParam->DistanceCoarsest.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), utf8ToTStr(currentParam->DistanceCoarsest));
SetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), currentParam->BoneLodDistance.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), utf8ToTStr(currentParam->BoneLodDistance));
// Iterate list // Iterate list
HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1); HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1);
@ -717,11 +717,11 @@ INT_PTR CALLBACK MRMDialogCallback (
currentParam->CoarseMesh=SendMessage (GetDlgItem (hwndDlg, IDC_COARSE_MESH), BM_GETCHECK, 0, 0); currentParam->CoarseMesh=SendMessage (GetDlgItem (hwndDlg, IDC_COARSE_MESH), BM_GETCHECK, 0, 0);
currentParam->DynamicMesh=SendMessage (GetDlgItem (hwndDlg, IDC_DYNAMIC_MESH), BM_GETCHECK, 0, 0); currentParam->DynamicMesh=SendMessage (GetDlgItem (hwndDlg, IDC_DYNAMIC_MESH), BM_GETCHECK, 0, 0);
char tmp[512]; TCHAR tmp[512];
GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MAX), tmp, 512);
currentParam->DistMax=tmp; currentParam->DistMax = tStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_BLEND_LENGTH), tmp, 512);
currentParam->BlendLength=tmp; currentParam->BlendLength = tStrToUtf8(tmp);
currentParam->MRM=SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_GETCHECK, 0, 0); currentParam->MRM=SendMessage (GetDlgItem (hwndDlg, IDC_ACTIVE_MRM), BM_GETCHECK, 0, 0);
@ -734,17 +734,17 @@ INT_PTR CALLBACK MRMDialogCallback (
currentParam->SkinReduction=2; currentParam->SkinReduction=2;
GetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_NB_LOD), tmp, 512);
currentParam->NbLod=tmp; currentParam->NbLod = tStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_DIVISOR), tmp, 512);
currentParam->Divisor=tmp; currentParam->Divisor = tStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_FINEST), tmp, 512);
currentParam->DistanceFinest=tmp; currentParam->DistanceFinest = tStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_MIDDLE), tmp, 512);
currentParam->DistanceMiddle=tmp; currentParam->DistanceMiddle = tStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_DIST_COARSEST), tmp, 512);
currentParam->DistanceCoarsest=tmp; currentParam->DistanceCoarsest = tStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_BONE_LOD_DISTANCE), tmp, 512);
currentParam->BoneLodDistance=tmp; currentParam->BoneLodDistance = tStrToUtf8(tmp);
// Iterate list // Iterate list
HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1); HWND hwndList=GetDlgItem (hwndDlg, IDC_LIST1);
@ -758,7 +758,7 @@ INT_PTR CALLBACK MRMDialogCallback (
SendMessage (hwndList, LB_GETTEXT, item, (LPARAM) tmp); SendMessage (hwndList, LB_GETTEXT, item, (LPARAM) tmp);
// Push it back // Push it back
currentParam->ListLodName.push_back (tmp); currentParam->ListLodName.push_back (tStrToUtf8(tmp));
} }
// default LodCharacter // default LodCharacter
@ -875,7 +875,7 @@ INT_PTR CALLBACK MRMDialogCallback (
if (wID!=LB_ERR) if (wID!=LB_ERR)
{ {
// Get the node name // Get the node name
char name[512]; TCHAR name[512];
SendMessage (GetDlgItem (hwndDlg, IDC_LIST1), LB_GETTEXT, wID, (LPARAM) (LPCTSTR) name); SendMessage (GetDlgItem (hwndDlg, IDC_LIST1), LB_GETTEXT, wID, (LPARAM) (LPCTSTR) name);
// Find the node // Find the node
@ -920,8 +920,8 @@ INT_PTR CALLBACK InstanceDialogCallback (
LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), currentParam->InstanceShape.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), utf8ToTStr(currentParam->InstanceShape));
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), currentParam->InstanceName.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), utf8ToTStr(currentParam->InstanceName));
SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_SETCHECK, currentParam->DontAddToScene, 0); SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_SETCHECK, currentParam->DontAddToScene, 0);
@ -930,7 +930,7 @@ INT_PTR CALLBACK InstanceDialogCallback (
SendMessage (GetDlgItem (hwndDlg, IDC_CHECK_COLLISION), BM_SETCHECK, currentParam->Collision, 0); SendMessage (GetDlgItem (hwndDlg, IDC_CHECK_COLLISION), BM_SETCHECK, currentParam->Collision, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_CHECK_COLLISION_EXTERIOR), BM_SETCHECK, currentParam->CollisionExterior, 0); SendMessage (GetDlgItem (hwndDlg, IDC_CHECK_COLLISION_EXTERIOR), BM_SETCHECK, currentParam->CollisionExterior, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), currentParam->InstanceGroupName.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), utf8ToTStr(currentParam->InstanceGroupName));
bool colOk = currentParam->CollisionMeshGeneration>=0 && currentParam->CollisionMeshGeneration<4; bool colOk = currentParam->CollisionMeshGeneration>=0 && currentParam->CollisionMeshGeneration<4;
CheckRadioButton (hwndDlg, IDC_CAMERA_COL_RADIO1, IDC_CAMERA_COL_RADIO4, colOk?(IDC_CAMERA_COL_RADIO1+(currentParam->CollisionMeshGeneration)):0); CheckRadioButton (hwndDlg, IDC_CAMERA_COL_RADIO1, IDC_CAMERA_COL_RADIO4, colOk?(IDC_CAMERA_COL_RADIO1+(currentParam->CollisionMeshGeneration)):0);
@ -950,16 +950,16 @@ INT_PTR CALLBACK InstanceDialogCallback (
break; break;
case IDOK: case IDOK:
{ {
char tmp[512]; TCHAR tmp[512];
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_SHAPE), tmp, 512);
currentParam->InstanceShape=tmp; currentParam->InstanceShape = tStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_NAME), tmp, 512);
currentParam->InstanceName=tmp; currentParam->InstanceName = tStrToUtf8(tmp);
currentParam->DontAddToScene=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_GETCHECK, 0, 0); currentParam->DontAddToScene=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_ADD_TO_SCENE), BM_GETCHECK, 0, 0);
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INSTANCE_GROUP_NAME), tmp, 512);
currentParam->InstanceGroupName=tmp; currentParam->InstanceGroupName = tStrToUtf8(tmp);
currentParam->DontExport=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_EXPORT), BM_GETCHECK, 0, 0); currentParam->DontExport=SendMessage (GetDlgItem (hwndDlg, IDC_DONT_EXPORT), BM_GETCHECK, 0, 0);
@ -1036,9 +1036,9 @@ INT_PTR CALLBACK LightmapDialogCallback (
LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); LONG_PTR res = SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), currentParam->LumelSizeMul.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), utf8ToTStr(currentParam->LumelSizeMul));
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), currentParam->SoftShadowRadius.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), utf8ToTStr(currentParam->SoftShadowRadius));
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), currentParam->SoftShadowConeLength.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), utf8ToTStr(currentParam->SoftShadowConeLength));
// Lighting // Lighting
SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_SETCHECK, currentParam->ExportRealTimeLight, 0); SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_SETCHECK, currentParam->ExportRealTimeLight, 0);
@ -1048,7 +1048,7 @@ INT_PTR CALLBACK LightmapDialogCallback (
SendMessage (GetDlgItem (hwndDlg, IDC_USE_LIGHT_LOCAL_ATTENUATION), BM_SETCHECK, currentParam->UseLightingLocalAttenuation, 0); SendMessage (GetDlgItem (hwndDlg, IDC_USE_LIGHT_LOCAL_ATTENUATION), BM_SETCHECK, currentParam->UseLightingLocalAttenuation, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_INTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowInterior, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_INTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowInterior, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowExterior, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_SETCHECK, currentParam->LightDontCastShadowExterior, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), currentParam->ExportLightMapName.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), utf8ToTStr(currentParam->ExportLightMapName));
SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_SETCHECK, currentParam->RealTimeAmbientLightAddSun, 0); SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_SETCHECK, currentParam->RealTimeAmbientLightAddSun, 0);
// Set enable disable // Set enable disable
@ -1065,7 +1065,7 @@ INT_PTR CALLBACK LightmapDialogCallback (
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDC_RESET_NAME: case IDC_RESET_NAME:
SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), "GlobalLight"); SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), _T("GlobalLight"));
break; break;
case IDCANCEL: case IDCANCEL:
EndDialog(hwndDlg, IDCANCEL); EndDialog(hwndDlg, IDCANCEL);
@ -1073,13 +1073,13 @@ INT_PTR CALLBACK LightmapDialogCallback (
case IDOK: case IDOK:
{ {
// Set default state // Set default state
char tmp[512]; TCHAR tmp[512];
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_LUMELSIZEMUL), tmp, 512);
currentParam->LumelSizeMul = tmp; currentParam->LumelSizeMul = tStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_RADIUS), tmp, 512);
currentParam->SoftShadowRadius = tmp; currentParam->SoftShadowRadius = tStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_SOFTSHADOW_CONELENGTH), tmp, 512);
currentParam->SoftShadowConeLength = tmp; currentParam->SoftShadowConeLength = tStrToUtf8(tmp);
// RealTime light // RealTime light
currentParam->ExportRealTimeLight = SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_GETCHECK, 0, 0); currentParam->ExportRealTimeLight = SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_REALTIME_LIGHT), BM_GETCHECK, 0, 0);
@ -1090,7 +1090,7 @@ INT_PTR CALLBACK LightmapDialogCallback (
currentParam->LightDontCastShadowExterior = SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_GETCHECK, 0, 0); currentParam->LightDontCastShadowExterior = SendMessage (GetDlgItem (hwndDlg, IDC_LIGHT_DONT_CAST_SHADOW_EXTERIOR), BM_GETCHECK, 0, 0);
currentParam->ExportLightMapAnimated = SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_ANIMATED), BM_GETCHECK, 0, 0); currentParam->ExportLightMapAnimated = SendMessage (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_ANIMATED), BM_GETCHECK, 0, 0);
GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_LIGHTMAP_NAME), tmp, 512);
currentParam->ExportLightMapName = tmp; currentParam->ExportLightMapName = tStrToUtf8(tmp);
currentParam->RealTimeAmbientLightAddSun= SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_GETCHECK, 0, 0); currentParam->RealTimeAmbientLightAddSun= SendMessage (GetDlgItem (hwndDlg, IDC_REALTIME_LIGHT_AMBIENT_ADD_SUN), BM_GETCHECK, 0, 0);
// Get the acceleration type // Get the acceleration type
@ -1132,7 +1132,7 @@ INT_PTR CALLBACK LightmapDialogCallback (
if (wID!=LB_ERR) if (wID!=LB_ERR)
{ {
// Get the node name // Get the node name
char name[512]; TCHAR name[512];
SendMessage (GetDlgItem (hwndDlg, IDC_LIST1), LB_GETTEXT, wID, (LPARAM) (LPCTSTR) name); SendMessage (GetDlgItem (hwndDlg, IDC_LIST1), LB_GETTEXT, wID, (LPARAM) (LPCTSTR) name);
// Find the node // Find the node
@ -1432,7 +1432,7 @@ INT_PTR CALLBACK LMCCopyFromDialogCallback(
lmcParam->SelectionDone= true; lmcParam->SelectionDone= true;
// Get the node name // Get the node name
char name[512]; TCHAR name[512];
SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_LIST), LB_GETTEXT, wID, (LPARAM) (LPCTSTR) name); SendMessage (GetDlgItem (hwndDlg, IDC_LMC_COPY_LIST), LB_GETTEXT, wID, (LPARAM) (LPCTSTR) name);
// Find the node // Find the node
@ -1679,7 +1679,7 @@ INT_PTR CALLBACK VegetableDialogCallback (
CheckRadioButton(hwndDlg, IDC_CENTER_NULL, IDC_CENTER_Z, IDC_CENTER_NULL+currentParam->VegetableBendCenter); CheckRadioButton(hwndDlg, IDC_CENTER_NULL, IDC_CENTER_Z, IDC_CENTER_NULL+currentParam->VegetableBendCenter);
SetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), currentParam->VegetableBendFactor.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), utf8ToTStr(currentParam->VegetableBendFactor));
VegetableStateChanged (hwndDlg); VegetableStateChanged (hwndDlg);
} }
@ -1732,9 +1732,9 @@ INT_PTR CALLBACK VegetableDialogCallback (
else else
currentParam->VegetableBendCenter = -1; currentParam->VegetableBendCenter = -1;
char tmp[512]; TCHAR tmp[512];
GetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_VEGETABLE_BEND_FACTOR), tmp, 512);
currentParam->VegetableBendFactor = tmp; currentParam->VegetableBendFactor = tStrToUtf8(tmp);
} }
break; break;
case IDC_VEGETABLE: case IDC_VEGETABLE:
@ -1930,7 +1930,7 @@ static int VPWTBiasStaticId[CVPWindTreeAppData::HrcDepth]=
void updateVPWTStatic(HWND hwndDlg, uint type, uint depth, const CVPWindTreeAppData &vpwt) void updateVPWTStatic(HWND hwndDlg, uint type, uint depth, const CVPWindTreeAppData &vpwt)
{ {
int sliderValue; int sliderValue;
char stmp[256]; TCHAR stmp[256];
float nticks= CVPWindTreeAppData::NumTicks; float nticks= CVPWindTreeAppData::NumTicks;
float scale; float scale;
@ -1953,29 +1953,29 @@ void updateVPWTStatic(HWND hwndDlg, uint type, uint depth, const CVPWindTreeAppD
{ {
case 0: case 0:
sliderValue= SendDlgItemMessage(hwndDlg, VPWTFreqSliderId[depth], TBM_GETPOS, 0, 0); sliderValue= SendDlgItemMessage(hwndDlg, VPWTFreqSliderId[depth], TBM_GETPOS, 0, 0);
_stprintf(stmp, "%.2f", scale * float(sliderValue)/nticks); _stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks);
SetWindowText( GetDlgItem(hwndDlg, VPWTFreqStaticId[depth]), stmp ); SetWindowText( GetDlgItem(hwndDlg, VPWTFreqStaticId[depth]), stmp );
break; break;
case 1: case 1:
sliderValue= SendDlgItemMessage(hwndDlg, VPWTFreqWDSliderId[depth], TBM_GETPOS, 0, 0); sliderValue= SendDlgItemMessage(hwndDlg, VPWTFreqWDSliderId[depth], TBM_GETPOS, 0, 0);
_stprintf(stmp, "%.2f", scale * float(sliderValue)/nticks); _stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks);
SetWindowText( GetDlgItem(hwndDlg, VPWTFreqWDStaticId[depth]), stmp ); SetWindowText( GetDlgItem(hwndDlg, VPWTFreqWDStaticId[depth]), stmp );
break; break;
case 2: case 2:
sliderValue= SendDlgItemMessage(hwndDlg, VPWTDistXYSliderId[depth], TBM_GETPOS, 0, 0); sliderValue= SendDlgItemMessage(hwndDlg, VPWTDistXYSliderId[depth], TBM_GETPOS, 0, 0);
_stprintf(stmp, "%.2f", scale * float(sliderValue)/nticks); _stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks);
SetWindowText( GetDlgItem(hwndDlg, VPWTDistXYStaticId[depth]), stmp ); SetWindowText( GetDlgItem(hwndDlg, VPWTDistXYStaticId[depth]), stmp );
break; break;
case 3: case 3:
sliderValue= SendDlgItemMessage(hwndDlg, VPWTDistZSliderId[depth], TBM_GETPOS, 0, 0); sliderValue= SendDlgItemMessage(hwndDlg, VPWTDistZSliderId[depth], TBM_GETPOS, 0, 0);
_stprintf(stmp, "%.2f", scale * float(sliderValue)/nticks); _stprintf(stmp, _T("%.2f"), scale * float(sliderValue)/nticks);
SetWindowText( GetDlgItem(hwndDlg, VPWTDistZStaticId[depth]), stmp ); SetWindowText( GetDlgItem(hwndDlg, VPWTDistZStaticId[depth]), stmp );
break; break;
case 4: case 4:
sliderValue= SendDlgItemMessage(hwndDlg, VPWTBiasSliderId[depth], TBM_GETPOS, 0, 0); sliderValue= SendDlgItemMessage(hwndDlg, VPWTBiasSliderId[depth], TBM_GETPOS, 0, 0);
// expand to -2 to 2. // expand to -2 to 2.
float biasVal= 4 * float(sliderValue)/nticks - 2; float biasVal= 4 * float(sliderValue)/nticks - 2;
_stprintf(stmp, "%.2f", biasVal); _stprintf(stmp, _T("%.2f"), biasVal);
SetWindowText( GetDlgItem(hwndDlg, VPWTBiasStaticId[depth]), stmp ); SetWindowText( GetDlgItem(hwndDlg, VPWTBiasStaticId[depth]), stmp );
break; break;
} }
@ -1987,14 +1987,14 @@ static void concatEdit2Lines(HWND edit)
const uint lineLen= 1000; const uint lineLen= 1000;
uint n; uint n;
// retrieve the 2 lines. // retrieve the 2 lines.
char tmp0[2*lineLen]; TCHAR tmp0[2*lineLen];
char tmp1[lineLen]; TCHAR tmp1[lineLen];
*(WORD*)tmp0= lineLen; *(WORD*)tmp0= lineLen;
*(WORD*)tmp1= lineLen; *(WORD*)tmp1= lineLen;
n= SendMessage(edit, EM_GETLINE, 0, (LONG)tmp0); tmp0[n]= 0; n= SendMessage(edit, EM_GETLINE, 0, (LPARAM)tmp0); tmp0[n]= 0;
n= SendMessage(edit, EM_GETLINE, 1, (LONG)tmp1); tmp1[n]= 0; n= SendMessage(edit, EM_GETLINE, 1, (LPARAM)tmp1); tmp1[n]= 0;
// concat and update the CEdit. // concat and update the CEdit.
SetWindowText(edit, strcat(tmp0, tmp1)); SetWindowText(edit, _tcscat(tmp0, tmp1));
} }
@ -2055,10 +2055,10 @@ INT_PTR CALLBACK VPWindTreeCallback (
// Init Global. editBox // Init Global. editBox
char stmp[256]; TCHAR stmp[256];
_stprintf(stmp, "%.2f", vpwt.FreqScale); _stprintf(stmp, _T("%.2f"), vpwt.FreqScale);
SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_FREQ_SCALE), stmp ); SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_FREQ_SCALE), stmp );
_stprintf(stmp, "%.2f", vpwt.DistScale); _stprintf(stmp, _T("%.2f"), vpwt.DistScale);
SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_DIST_SCALE), stmp ); SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_DIST_SCALE), stmp );
SendDlgItemMessage(hwndDlg, IDC_CHECK_VP_SPECLIGHT, BM_SETCHECK, vpwt.SpecularLighting, 0); SendDlgItemMessage(hwndDlg, IDC_CHECK_VP_SPECLIGHT, BM_SETCHECK, vpwt.SpecularLighting, 0);
@ -2102,7 +2102,7 @@ INT_PTR CALLBACK VPWindTreeCallback (
{ {
CVPWindTreeAppData &vpwt= currentParam->VertexProgramWindTree; CVPWindTreeAppData &vpwt= currentParam->VertexProgramWindTree;
int nticks= CVPWindTreeAppData::NumTicks; int nticks= CVPWindTreeAppData::NumTicks;
char stmp[256]; TCHAR stmp[256];
float val; float val;
if( HIWORD(wParam) == BN_CLICKED ) if( HIWORD(wParam) == BN_CLICKED )
@ -2195,7 +2195,7 @@ INT_PTR CALLBACK VPWindTreeCallback (
} }
} }
// Update Scale Edit text. // Update Scale Edit text.
_stprintf(stmp, "%.2f", vpwt.FreqScale); _stprintf(stmp, _T("%.2f"), vpwt.FreqScale);
SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_FREQ_SCALE), stmp ); SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_FREQ_SCALE), stmp );
} }
break; break;
@ -2216,7 +2216,7 @@ INT_PTR CALLBACK VPWindTreeCallback (
} }
} }
// Update Scale Edit text. // Update Scale Edit text.
_stprintf(stmp, "%.2f", vpwt.DistScale); _stprintf(stmp, _T("%.2f"), vpwt.DistScale);
SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_DIST_SCALE), stmp ); SetWindowText( GetDlgItem(hwndDlg, IDC_EDIT_VPWT_DIST_SCALE), stmp );
} }
break; break;
@ -2290,34 +2290,34 @@ INT_PTR CALLBACK MiscDialogCallback (
// Ligoscape // Ligoscape
SendMessage (GetDlgItem (hwndDlg, IDC_LIGO_SYMMETRY), BM_SETCHECK, currentParam->LigoSymmetry, 0); SendMessage (GetDlgItem (hwndDlg, IDC_LIGO_SYMMETRY), BM_SETCHECK, currentParam->LigoSymmetry, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), currentParam->LigoRotate.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_LIGO_ROTATE), utf8ToTStr(currentParam->LigoRotate));
// SWT // SWT
SendMessage (GetDlgItem (hwndDlg, IDC_SWT), BM_SETCHECK, currentParam->SWT, 0); SendMessage (GetDlgItem (hwndDlg, IDC_SWT), BM_SETCHECK, currentParam->SWT, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_SWT_WEIGHT), currentParam->SWTWeight.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_SWT_WEIGHT), utf8ToTStr(currentParam->SWTWeight));
// Radial normals // Radial normals
for (uint smoothGroup=0; smoothGroup<NEL3D_RADIAL_NORMAL_COUNT; smoothGroup++) for (uint smoothGroup=0; smoothGroup<NEL3D_RADIAL_NORMAL_COUNT; smoothGroup++)
SetWindowText (GetDlgItem (hwndDlg, IDC_RADIAL_NORMAL_29+smoothGroup), currentParam->RadialNormals[smoothGroup].c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_RADIAL_NORMAL_29+smoothGroup), utf8ToTStr(currentParam->RadialNormals[smoothGroup]));
// Mesh interfaces // Mesh interfaces
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), currentParam->InterfaceFileName.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), utf8ToTStr(currentParam->InterfaceFileName));
SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), SetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD),
currentParam->InterfaceThreshold != -1.f ? toStringMax(currentParam->InterfaceThreshold).c_str() currentParam->InterfaceThreshold != -1.f ? utf8ToTStr(toStringMax(currentParam->InterfaceThreshold))
: "" : _T("")
); );
SendMessage(GetDlgItem(hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_SETCHECK, currentParam->GetInterfaceNormalsFromSceneObjects, 0); SendMessage(GetDlgItem(hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_SETCHECK, currentParam->GetInterfaceNormalsFromSceneObjects, 0);
// Skeleton Scale // Skeleton Scale
SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_SETCHECK, currentParam->ExportBoneScale, 0); SendMessage( GetDlgItem(hwndDlg, IDC_EXPORT_BONE_SCALE), BM_SETCHECK, currentParam->ExportBoneScale, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), currentParam->ExportBoneScaleNameExt.c_str()); SetWindowText (GetDlgItem (hwndDlg, IDC_EXPORT_BONE_SCALE_NAME_EXT), utf8ToTStr(currentParam->ExportBoneScaleNameExt));
// Remanence // Remanence
SendMessage (GetDlgItem (hwndDlg, IDC_USE_REMANENCE), BM_SETCHECK, currentParam->UseRemanence, 0); SendMessage (GetDlgItem (hwndDlg, IDC_USE_REMANENCE), BM_SETCHECK, currentParam->UseRemanence, 0);
SendMessage (GetDlgItem (hwndDlg, IDC_REMANENCE_SHIFTING_TEXTURE), BM_SETCHECK, currentParam->RemanenceShiftingTexture, 0); SendMessage (GetDlgItem (hwndDlg, IDC_REMANENCE_SHIFTING_TEXTURE), BM_SETCHECK, currentParam->RemanenceShiftingTexture, 0);
SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), currentParam->RemanenceSliceNumber != - 1 ? toStringMax(currentParam->RemanenceSliceNumber).c_str() : ""); SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SLICE_NUMBER), currentParam->RemanenceSliceNumber != - 1 ? utf8ToTStr(toStringMax(currentParam->RemanenceSliceNumber)) : _T(""));
SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SAMPLING_PERIOD), currentParam->RemanenceSamplingPeriod != -1 ? toStringMax(currentParam->RemanenceSamplingPeriod).c_str() : ""); SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_SAMPLING_PERIOD), currentParam->RemanenceSamplingPeriod != -1 ? utf8ToTStr(toStringMax(currentParam->RemanenceSamplingPeriod)) : _T(""));
SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_ROLLUP_RATIO), currentParam->RemanenceRollupRatio != -1 ? toStringMax(currentParam->RemanenceRollupRatio).c_str() : ""); SetWindowText (GetDlgItem (hwndDlg, IDC_REMANENCE_ROLLUP_RATIO), currentParam->RemanenceRollupRatio != -1 ? utf8ToTStr(toStringMax(currentParam->RemanenceRollupRatio)) : _T(""));
} }
break; break;
@ -2357,7 +2357,7 @@ INT_PTR CALLBACK MiscDialogCallback (
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_FILE), tmp, 512);
currentParam->InterfaceFileName = tStrToUtf8(tmp); currentParam->InterfaceFileName = tStrToUtf8(tmp);
GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), tmp, 512); GetWindowText (GetDlgItem (hwndDlg, IDC_EDIT_INTERFACE_THRESHOLD), tmp, 512);
if (strlen(tmp) != 0) if (_tcslen(tmp) != 0)
currentParam->InterfaceThreshold = toFloatMax(tmp); currentParam->InterfaceThreshold = toFloatMax(tmp);
currentParam->GetInterfaceNormalsFromSceneObjects = SendMessage (GetDlgItem (hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_GETCHECK, 0, 0); currentParam->GetInterfaceNormalsFromSceneObjects = SendMessage (GetDlgItem (hwndDlg, IDC_GET_INTERFACE_NORMAL_FROM_SCENE_OBJECTS), BM_GETCHECK, 0, 0);
@ -2492,9 +2492,9 @@ INT_PTR CALLBACK LodDialogCallback (
currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); currentParam=(CLodDialogBoxParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
// Window text // Window text
std::string winName=(*(currentParam->ListNode->begin()))->GetName(); std::string winName = tStrToUtf8((*(currentParam->ListNode->begin()))->GetName());
winName="Node properties ("+winName+((currentParam->ListNode->size()>1)?" ...)":")"); winName="Node properties ("+winName+((currentParam->ListNode->size()>1)?" ...)":")");
SetWindowText (hwndDlg, winName.c_str()); SetWindowText (hwndDlg, utf8ToTStr(winName));
// Move dialog // Move dialog
RECT windowRect, desktopRect; RECT windowRect, desktopRect;
@ -2522,7 +2522,7 @@ INT_PTR CALLBACK LodDialogCallback (
// Insert a tab // Insert a tab
TCITEM tabItem; TCITEM tabItem;
tabItem.mask = TCIF_TEXT; tabItem.mask = TCIF_TEXT;
tabItem.pszText = (char*)SubText[tab]; tabItem.pszText = (LPTSTR)SubText[tab];
SendMessage (GetDlgItem (hwndDlg, IDC_TAB), TCM_INSERTITEM, SendMessage (GetDlgItem (hwndDlg, IDC_TAB), TCM_GETITEMCOUNT, 0, 0), (LPARAM)&tabItem); SendMessage (GetDlgItem (hwndDlg, IDC_TAB), TCM_INSERTITEM, SendMessage (GetDlgItem (hwndDlg, IDC_TAB), TCM_GETITEMCOUNT, 0, 0), (LPARAM)&tabItem);
// Create the dialog // Create the dialog

@ -59,7 +59,7 @@ bool CNelExport::exportInstanceGroup(string filename, vector<INode*>& vectNode)
catch (const Exception &c) catch (const Exception &c)
{ {
// Cannot save the file // Cannot save the file
MessageBox (NULL, c.what(), "NeL export", MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, utf8ToTStr(c.what()), _T("NeL export"), MB_OK|MB_ICONEXCLAMATION);
return false; return false;
} }
} }

@ -91,7 +91,7 @@ Value* export_shape_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// Export path // Export path
const char* sPath=arg_list[1]->to_string(); std::string sPath = tStrToUtf8(arg_list[1]->to_string());
// Ok ? // Ok ?
Boolean *ret=&false_value; Boolean *ret=&false_value;
@ -154,12 +154,12 @@ Value* export_shape_ex_cf (Value** arg_list, int count)
nlassert(node->GetName()); nlassert(node->GetName());
// Export path // Export path
std::string sPath=arg_list[1]->to_string(); std::string sPath = tStrToUtf8(arg_list[1]->to_string());
// Ex argu // Ex argu
theExportSceneStruct.bShadow = arg_list[2]->to_bool()!=FALSE; theExportSceneStruct.bShadow = arg_list[2]->to_bool()!=FALSE;
theExportSceneStruct.bExportLighting = arg_list[3]->to_bool()!=FALSE; theExportSceneStruct.bExportLighting = arg_list[3]->to_bool()!=FALSE;
theExportSceneStruct.sExportLighting = arg_list[4]->to_string(); theExportSceneStruct.sExportLighting = tStrToUtf8(arg_list[4]->to_string());
theExportSceneStruct.nExportLighting = arg_list[5]->to_int(); theExportSceneStruct.nExportLighting = arg_list[5]->to_int();
theExportSceneStruct.rLumelSize = arg_list[6]->to_float(); theExportSceneStruct.rLumelSize = arg_list[6]->to_float();
theExportSceneStruct.nOverSampling = arg_list[7]->to_int(); theExportSceneStruct.nOverSampling = arg_list[7]->to_int();
@ -220,7 +220,7 @@ Value* export_skeleton_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// Export path // Export path
const char* sPath=arg_list[1]->to_string(); std::string sPath = tStrToUtf8(arg_list[1]->to_string());
// Ok ? // Ok ?
Boolean *ret=&false_value; Boolean *ret=&false_value;
@ -260,7 +260,7 @@ Value* export_animation_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// Export path // Export path
const char* sPath=arg_list[1]->to_string(); std::string sPath = tStrToUtf8(arg_list[1]->to_string());
// Get time // Get time
TimeValue time=MAXScript_interface->GetTime(); TimeValue time=MAXScript_interface->GetTime();
@ -352,7 +352,7 @@ Value* export_ig_cf (Value** arg_list, int count)
vect.push_back (array->get (i+1)->to_node()); vect.push_back (array->get (i+1)->to_node());
// Export path // Export path
const char* sPath=arg_list[1]->to_string(); std::string sPath = tStrToUtf8(arg_list[1]->to_string());
// Export // Export
if (theCNelExport.exportInstanceGroup (sPath, vect)) if (theCNelExport.exportInstanceGroup (sPath, vect))
@ -411,7 +411,7 @@ Value* export_skeleton_weight_cf (Value** arg_list, int count)
vect.push_back (array->get (i+1)->to_node()); vect.push_back (array->get (i+1)->to_node());
// Export path // Export path
const char* sPath=arg_list[1]->to_string(); std::string sPath = tStrToUtf8(arg_list[1]->to_string());
// Export // Export
if (theCNelExport.exportSWT (sPath, vect)) if (theCNelExport.exportSWT (sPath, vect))
@ -471,11 +471,11 @@ Value* test_file_date_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// The 2 filenames // The 2 filenames
string file0 = arg_list[0]->to_string(); string file0 = tStrToUtf8(arg_list[0]->to_string());
string file1 = arg_list[1]->to_string(); string file1 = tStrToUtf8(arg_list[1]->to_string());
// Open it // Open it
FILE *file=fopen (file0.c_str(), "r"); FILE *file=nlfopen (file0.c_str(), "r");
if (file == NULL) if (file == NULL)
return &true_value; return &true_value;
@ -486,10 +486,10 @@ Value* test_file_date_cf (Value** arg_list, int count)
Value *ret = &undefined; Value *ret = &undefined;
// Create first file // Create first file
HANDLE h0 = CreateFile (file0.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE h0 = CreateFile (utf8ToTStr(file0), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h0!=INVALID_HANDLE_VALUE) if (h0!=INVALID_HANDLE_VALUE)
{ {
HANDLE h1 = CreateFile (file1.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE h1 = CreateFile (utf8ToTStr(file1), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h1!=INVALID_HANDLE_VALUE) if (h1!=INVALID_HANDLE_VALUE)
{ {
// Get file time // Get file time
@ -536,7 +536,7 @@ Value* export_vegetable_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// Export path // Export path
const char* sPath=arg_list[1]->to_string(); std::string sPath = tStrToUtf8(arg_list[1]->to_string());
// Message in dialog // Message in dialog
bool dialogMessage = arg_list[2]->to_bool() != FALSE; bool dialogMessage = arg_list[2]->to_bool() != FALSE;
@ -615,7 +615,7 @@ Value* export_collision_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// Export path // Export path
string sPath = arg_list[1]->to_string(); string sPath = tStrToUtf8(arg_list[1]->to_string());
// Get time // Get time
TimeValue time = MAXScript_interface->GetTime(); TimeValue time = MAXScript_interface->GetTime();
@ -674,7 +674,7 @@ Value* export_pacs_primitives_cf (Value** arg_list, int count)
theCNelExport.init (false, false, ip, true); theCNelExport.init (false, false, ip, true);
// Export path // Export path
string sPath = arg_list[1]->to_string(); string sPath = tStrToUtf8(arg_list[1]->to_string());
// Get time // Get time
TimeValue time = MAXScript_interface->GetTime(); TimeValue time = MAXScript_interface->GetTime();
@ -733,7 +733,7 @@ Value* export_lod_character_cf (Value** arg_list, int count)
nlassert (node); nlassert (node);
// Export path // Export path
const char* sPath=arg_list[1]->to_string(); std::string sPath = tStrToUtf8(arg_list[1]->to_string());
// Message in dialog // Message in dialog
bool dialogMessage = arg_list[2]->to_bool() != FALSE; bool dialogMessage = arg_list[2]->to_bool() != FALSE;
@ -879,11 +879,11 @@ Value* get_file_modification_date_cf (Value** arg_list, int count)
type_check (arg_list[0], String, message); type_check (arg_list[0], String, message);
// get the node // get the node
string sPath = arg_list[0]->to_string(); string sPath = tStrToUtf8(arg_list[0]->to_string());
// get vertices indices // get vertices indices
string result; string result;
HANDLE file = CreateFile (sPath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE file = CreateFile (utf8ToTStr(sPath), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (file) if (file)
{ {
FILETIME lastWriteTime; FILETIME lastWriteTime;
@ -899,7 +899,7 @@ Value* get_file_modification_date_cf (Value** arg_list, int count)
if (result.empty()) if (result.empty())
return &undefined; return &undefined;
else else
return new String((char*)result.c_str()); return new String(utf8ToTStr(result));
} }
// *************************************************************************** // ***************************************************************************
@ -918,12 +918,12 @@ Value* set_file_modification_date_cf (Value** arg_list, int count)
type_check (arg_list[1], String, message); type_check (arg_list[1], String, message);
// get the node // get the node
string sPath = arg_list[0]->to_string(); string sPath = tStrToUtf8(arg_list[0]->to_string());
string sDate = arg_list[1]->to_string(); string sDate = tStrToUtf8(arg_list[1]->to_string());
// get vertices indices // get vertices indices
string result; string result;
HANDLE file = CreateFile (sPath.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); HANDLE file = CreateFile (utf8ToTStr(sPath), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (file) if (file)
{ {
FILETIME lastWriteTime; FILETIME lastWriteTime;

@ -27,7 +27,7 @@
using namespace NL3D; using namespace NL3D;
using namespace NLMISC; using namespace NLMISC;
bool CNelExport::exportSWT(const char *sPath, std::vector<INode*>& vectNode) bool CNelExport::exportSWT(const std::string &sPath, std::vector<INode*>& vectNode)
{ {
float rPosValue; float rPosValue;
float rRotValue; float rRotValue;
@ -55,15 +55,15 @@ bool CNelExport::exportSWT(const char *sPath, std::vector<INode*>& vectNode)
// Store them in the temporary list // Store them in the temporary list
aSWNodes.resize(nNumNode+3); aSWNodes.resize(nNumNode+3);
aSWNodes[nNumNode].Name = pNode->GetName(); aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName());
aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getRotQuatValueName(); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getRotQuatValueName();
aSWNodes[nNumNode].Weight = rRotValue; aSWNodes[nNumNode].Weight = rRotValue;
++nNumNode; ++nNumNode;
aSWNodes[nNumNode].Name = pNode->GetName(); aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName());
aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getPosValueName (); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getPosValueName ();
aSWNodes[nNumNode].Weight = rPosValue; aSWNodes[nNumNode].Weight = rPosValue;
++nNumNode; ++nNumNode;
aSWNodes[nNumNode].Name = pNode->GetName(); aSWNodes[nNumNode].Name = tStrToUtf8(pNode->GetName());
aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getScaleValueName(); aSWNodes[nNumNode].Name += std::string (".")+ITransformable::getScaleValueName();
aSWNodes[nNumNode].Weight = rScaleValue; aSWNodes[nNumNode].Weight = rScaleValue;
++nNumNode; ++nNumNode;

@ -102,14 +102,14 @@ void regsiterOVPath ()
//#ifdef NL_DEBUG_FAST //#ifdef NL_DEBUG_FAST
// HMODULE hModule = GetModuleHandle("object_viewer_dll_df.dll"); // HMODULE hModule = GetModuleHandle("object_viewer_dll_df.dll");
#if defined (NL_DEBUG) #if defined (NL_DEBUG)
HMODULE hModule = GetModuleHandle("object_viewer_dll_d.dll"); HMODULE hModule = GetModuleHandle(_T("object_viewer_dll_d.dll"));
//#elif defined (NL_RELEASE_DEBUG) //#elif defined (NL_RELEASE_DEBUG)
// HMODULE hModule = GetModuleHandle("object_viewer_dll_rd.dll"); // HMODULE hModule = GetModuleHandle("object_viewer_dll_rd.dll");
#else #else
HMODULE hModule = GetModuleHandle("object_viewer_dll_r.dll"); HMODULE hModule = GetModuleHandle("object_viewer_dll_r.dll");
#endif #endif
if (!hModule) { ::MessageBox(NULL, "'hModule' failed at '" __FUNCTION__ "' in file '" __FILE__ " on line " NL_MACRO_TO_STR(__LINE__), "NeL Export", MB_OK | MB_ICONERROR); return; } if (!hModule) { ::MessageBox(NULL, _T("'hModule' failed at '") __FUNCTION__ _T("' in file '") __FILE__ _T(" on line ") NL_MACRO_TO_STR(__LINE__), _T("NeL Export"), MB_OK | MB_ICONERROR); return; }
char sModulePath[256]; TCHAR sModulePath[256];
int res = GetModuleFileName(hModule, sModulePath, 256); int res = GetModuleFileName(hModule, sModulePath, 256);
if (!res) { ::MessageBox(NULL, _T("'res' failed at '") __FUNCTION__ _T("' in file '") __FILE__ _T(" on line ") NL_MACRO_TO_STR(__LINE__), _T("NeL Export"), MB_OK | MB_ICONERROR); return; } if (!res) { ::MessageBox(NULL, _T("'res' failed at '") __FUNCTION__ _T("' in file '") __FILE__ _T(" on line ") NL_MACRO_TO_STR(__LINE__), _T("NeL Export"), MB_OK | MB_ICONERROR); return; }
@ -174,7 +174,7 @@ void CNelExport::viewMesh (TimeValue time)
// Check wether there's not an instance currently running // Check wether there's not an instance currently running
if (view->isInstanceRunning()) if (view->isInstanceRunning())
{ {
::MessageBox(NULL, "An instance of the viewer is currently running, please close it :)", "NeL Export", MB_OK|MB_ICONEXCLAMATION); ::MessageBox(NULL, _T("An instance of the viewer is currently running, please close it :)"), _T("NeL Export"), MB_OK|MB_ICONEXCLAMATION);
return; return;
} }
@ -191,7 +191,7 @@ void CNelExport::viewMesh (TimeValue time)
// Init it // Init it
if (!view->initUI()) if (!view->initUI())
{ {
::MessageBox(NULL, "Failed to initialize object viewer ui, this may be a driver init issue, check your log.log files", "NeL Export", MB_OK|MB_ICONEXCLAMATION); ::MessageBox(NULL, _T("Failed to initialize object viewer ui, this may be a driver init issue, check your log.log files"), _T("NeL Export"), MB_OK|MB_ICONEXCLAMATION);
IObjectViewer::releaseInterface(view); IObjectViewer::releaseInterface(view);
return; return;
} }
@ -300,7 +300,7 @@ void CNelExport::viewMesh (TimeValue time)
_ExportNel->buildSkeletonShape (*skelShape, *skeletonRoot, &(iteSkeleton->second), mapId, time); _ExportNel->buildSkeletonShape (*skelShape, *skeletonRoot, &(iteSkeleton->second), mapId, time);
// Add the shape in the view // Add the shape in the view
uint instance = view->addSkel (skelShape, skeletonRoot->GetName()); uint instance = view->addSkel (skelShape, tStrToUtf8(skeletonRoot->GetName()));
// Add tracks // Add tracks
CAnimation *anim=new CAnimation; CAnimation *anim=new CAnimation;

@ -25,7 +25,7 @@ using namespace NLMISC;
// -------------------------------------------------- // --------------------------------------------------
bool CNelExport::exportZone (const char *sPath, INode& node, TimeValue time) bool CNelExport::exportZone (const std::string &sPath, INode& node, TimeValue time)
{ {
// Result to return // Result to return
bool bRet=false; bool bRet=false;

@ -52,24 +52,24 @@ INT_PTR CALLBACK CalculatingDialogCallback (
case WM_PAINT: case WM_PAINT:
{ {
char temp[256]; TCHAR temp[256];
SendMessage( GetDlgItem( hwndDlg, IDC_PROGRESS1 ), PBM_SETPOS, (int)(pClass->rRatioCalculated*100), 0 ); SendMessage( GetDlgItem( hwndDlg, IDC_PROGRESS1 ), PBM_SETPOS, (int)(pClass->rRatioCalculated*100), 0 );
if( pClass->rRatioCalculated > 0.0 ) if( pClass->rRatioCalculated > 0.0 )
{ {
double TimeLeft = (TimeCurrent - pClass->rTimeBegin) * (1.0-pClass->rRatioCalculated); double TimeLeft = (TimeCurrent - pClass->rTimeBegin) * (1.0-pClass->rRatioCalculated);
sprintf( temp, "Time remaining : %02d h %02d m %02d s", ((uint32)TimeLeft)/3600, _stprintf( temp, _T("Time remaining : %02d h %02d m %02d s"), ((uint32)TimeLeft)/3600,
(((uint32)TimeLeft)/60)%60, (((uint32)TimeLeft)/60)%60,
(((uint32)TimeLeft))%60 ); (((uint32)TimeLeft))%60 );
if (pClass->bCancelCalculation) if (pClass->bCancelCalculation)
strcpy (temp, "INTERRUPTED - Finishing current object..."); _tcscpy (temp, _T("INTERRUPTED - Finishing current object..."));
SendMessage (GetDlgItem (hwndDlg, IDC_STATICTIMELEFT), WM_SETTEXT, 0, (long)temp); SendMessage (GetDlgItem (hwndDlg, IDC_STATICTIMELEFT), WM_SETTEXT, 0, (LPARAM)temp);
SendMessage (GetDlgItem (hwndDlg, IDC_BUTTONCANCEL), WM_PAINT, 0, 0); SendMessage (GetDlgItem (hwndDlg, IDC_BUTTONCANCEL), WM_PAINT, 0, 0);
} }
string all; string all;
for (uint32 i = 0; i < 14; ++i) for (uint32 i = 0; i < 14; ++i)
all += pClass->sInfoProgress[i] + "\n"; all += pClass->sInfoProgress[i] + "\n";
SendMessage (GetDlgItem (hwndDlg, IDC_STATICINFO), WM_SETTEXT, 0, (long)all.c_str()); SendMessage (GetDlgItem (hwndDlg, IDC_STATICINFO), WM_SETTEXT, 0, (LPARAM)utf8ToTStr(all));
} }
break; break;

@ -775,17 +775,17 @@ void CExportNel::outputErrorMessage(const std::string &message)
// -------------------------------------------------- // --------------------------------------------------
void CExportNel::outputWarningMessage (const char *message) void CExportNel::outputWarningMessage (const std::string &message)
{ {
if (_ErrorInDialog) if (_ErrorInDialog)
{ {
MessageBox (_Ip->GetMAXHWnd(), message, _ErrorTitle.c_str(), MB_OK|MB_ICONEXCLAMATION); MessageBox (_Ip->GetMAXHWnd(), utf8ToTStr(message), utf8ToTStr(_ErrorTitle), MB_OK|MB_ICONEXCLAMATION);
} }
mprintf (message); mprintf (message);
mprintf ("\n"); mprintf ("\n");
nlwarning ("Warning in max file %s : ", _Ip->GetCurFilePath()); nlwarning ("Warning in max file %s : ", _Ip->GetCurFilePath());
nlwarning (message); nlwarning (message.c_str());
} }
// -------------------------------------------------- // --------------------------------------------------
@ -819,7 +819,7 @@ void CExportNel::addChildLodNode (std::set<INode*> &lodListToExclude, INode *cur
if (lodName != "") if (lodName != "")
{ {
// Get the lod by name // Get the lod by name
INode *lodNode = _Ip->GetINodeByName (lodName.c_str()); INode *lodNode = _Ip->GetINodeByName (utf8ToTStr(lodName));
if (lodNode) if (lodNode)
{ {
// Insert it in the set // Insert it in the set
@ -850,7 +850,7 @@ void CExportNel::addParentLodNode (INode &child, std::set<INode*> &lodListToExcl
if (lodName != "") if (lodName != "")
{ {
// Get the lod by name // Get the lod by name
INode *lodNode = _Ip->GetINodeByName (lodName.c_str()); INode *lodNode = _Ip->GetINodeByName (utf8ToTStr(lodName));
if (lodNode == &child) if (lodNode == &child)
{ {
// Insert it in the set // Insert it in the set
@ -1111,12 +1111,23 @@ static void restoreDecimalSeparator()
float toFloatMax(const TCHAR *src) float toFloatMax(const TCHAR *src)
{ {
float result = 0.f; float result = 0.f;
if (toFloatMax(src, result)) return result; if (toFloatMax(tStrToUtf8(src), result)) return result;
return 0.f; return 0.f;
} }
float toFloatMax(const std::string &src)
{
float result = 0.f;
if (toFloatMax(src, result)) return result;
return 0.f;
}
bool toFloatMax(const TCHAR *src, float &dest) bool toFloatMax(const TCHAR *src, float &dest)
{
return toFloatMax(tStrToUtf8(src), dest);
}
bool toFloatMax(const std::string &src, float &dest)
{ {
setDecimalSeparatorAsPoint(); setDecimalSeparatorAsPoint();
std::string str(src); std::string str(src);

@ -1092,8 +1092,10 @@ private:
/** replacment for sprintf scanf (because of localisation in max) /** replacment for sprintf scanf (because of localisation in max)
*/ */
float toFloatMax(const std::string &src);
float toFloatMax(const TCHAR *src); float toFloatMax(const TCHAR *src);
// Same as to float max, but returns true if succeed // Same as to float max, but returns true if succeed
bool toFloatMax(const std::string &src, float &dest);
bool toFloatMax(const TCHAR *src, float &dest); bool toFloatMax(const TCHAR *src, float &dest);
std::string toStringMax(float value); std::string toStringMax(float value);
std::string toStringMax(int value); std::string toStringMax(int value);

@ -133,7 +133,7 @@ INT_PTR CALLBACK DlgProc_Panel(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
if (hModule) if (hModule)
{ {
// Get module file name // Get module file name
char moduldeFileName[512]; TCHAR moduldeFileName[512];
if (GetModuleFileName (hModule, moduldeFileName, 512)) if (GetModuleFileName (hModule, moduldeFileName, 512))
{ {
// Get version info size // Get version info size
@ -141,23 +141,23 @@ INT_PTR CALLBACK DlgProc_Panel(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
uint versionInfoSize=GetFileVersionInfoSize (moduldeFileName, &doomy); uint versionInfoSize=GetFileVersionInfoSize (moduldeFileName, &doomy);
if (versionInfoSize) if (versionInfoSize)
{ {
// Alloc the buffer // Alloc the buffer (size in bytes)
char *buffer=new char[versionInfoSize]; uint8_t *buffer = new uint8_t[versionInfoSize];
// Find the verion resource // Find the verion resource
if (GetFileVersionInfo(moduldeFileName, 0, versionInfoSize, buffer)) if (GetFileVersionInfo(moduldeFileName, 0, versionInfoSize, buffer))
{ {
uint *versionTab; uint *versionTab;
uint versionSize; uint versionSize;
if (VerQueryValue (buffer, "\\", (void**)&versionTab, &versionSize)) if (VerQueryValue (buffer, _T("\\"), (void**)&versionTab, &versionSize))
{ {
// Get the pointer on the structure // Get the pointer on the structure
VS_FIXEDFILEINFO *info=(VS_FIXEDFILEINFO*)versionTab; VS_FIXEDFILEINFO *info=(VS_FIXEDFILEINFO*)versionTab;
if (info) if (info)
{ {
// Setup version number // Setup version number
char version[512]; TCHAR version[512];
sprintf (version, "Version %d.%d.%d.%d", _stprintf (version, _T("Version %d.%d.%d.%d"),
info->dwFileVersionMS>>16, info->dwFileVersionMS>>16,
info->dwFileVersionMS&0xffff, info->dwFileVersionMS&0xffff,
info->dwFileVersionLS>>16, info->dwFileVersionLS>>16,
@ -165,25 +165,25 @@ INT_PTR CALLBACK DlgProc_Panel(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
SetWindowText (GetDlgItem (hWnd, IDC_VERSION), version); SetWindowText (GetDlgItem (hWnd, IDC_VERSION), version);
} }
else else
SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "VS_FIXEDFILEINFO * is NULL"); SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("VS_FIXEDFILEINFO * is NULL"));
} }
else else
SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "VerQueryValue failed"); SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("VerQueryValue failed"));
} }
else else
SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "GetFileVersionInfo failed"); SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("GetFileVersionInfo failed"));
// Free the buffer // Free the buffer
delete [] buffer; delete [] buffer;
} }
else else
SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "GetFileVersionInfoSize failed"); SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("GetFileVersionInfoSize failed"));
} }
else else
SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "GetModuleFileName failed"); SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("GetModuleFileName failed"));
} }
else else
SetWindowText (GetDlgItem (hWnd, IDC_VERSION), "hInstance NULL"); SetWindowText (GetDlgItem (hWnd, IDC_VERSION), _T("hInstance NULL"));
} }
// ----- // -----

@ -215,7 +215,7 @@ export_zone_cf (Value** arg_list, int count)
if (tri->rpatch->exportZone (node, &tri->patch, zone, zoneSymmetry, nZone, 160, 1, false)) if (tri->rpatch->exportZone (node, &tri->patch, zone, zoneSymmetry, nZone, 160, 1, false))
{ {
// Export path // Export path
const char* sPath=arg_list[1]->to_string(); const std::string sPath = tStrToUtf8(arg_list[1]->to_string());
COFile file; COFile file;
if (file.open (sPath)) if (file.open (sPath))
@ -245,7 +245,7 @@ Value* import_zone_cf (Value** arg_list, int count)
Interface *ip = MAXScript_interface; Interface *ip = MAXScript_interface;
// Get the filename // Get the filename
string filename = arg_list[0]->to_string(); string filename = tStrToUtf8(arg_list[0]->to_string());
// Get the flip // Get the flip
bool dialog = arg_list[1]->to_bool ()!=FALSE; bool dialog = arg_list[1]->to_bool ()!=FALSE;
@ -1705,7 +1705,7 @@ Value* set_tile_bank_cf (Value** arg_list, int count)
type_check(arg_list[0], String, "NelSetTileBank [tile bank pathname]"); type_check(arg_list[0], String, "NelSetTileBank [tile bank pathname]");
// ok ? // ok ?
const char *pathname = arg_list[0]->to_string(); const std::string pathname = tStrToUtf8(arg_list[0]->to_string());
// Get tile number // Get tile number
SetBankPathName (pathname); SetBankPathName (pathname);

@ -642,7 +642,7 @@ void EditPatchMod::DoVertWeld()
{ {
hadSel = TRUE; hadSel = TRUE;
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoVertWeld")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoVertWeld")));
// Call the patch weld function // Call the patch weld function
if (patch->Weld(weldThreshold)) if (patch->Weld(weldThreshold))
{ {
@ -716,7 +716,7 @@ void EditPatchMod::DoVertReset ()
{ {
hadSel = TRUE; hadSel = TRUE;
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoVertReset")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoVertReset")));
// Call the patch weld function // Call the patch weld function
ResetVert (patch); ResetVert (patch);
patchData->UpdateChanges(patch, rpatch); patchData->UpdateChanges(patch, rpatch);

@ -688,7 +688,7 @@ if (!TestAFlag(A_HELD))
patchData->vdelta.SetSize(*patch, FALSE); patchData->vdelta.SetSize(*patch, FALSE);
if (theHold.Holding()) if (theHold.Holding())
{ {
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "XFormHandles")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("XFormHandles")));
} }
patchData->vdelta.Zero(); // Reset all deltas patchData->vdelta.Zero(); // Reset all deltas
patchData->ClearHandleFlag(); patchData->ClearHandleFlag();
@ -946,7 +946,7 @@ for (int i = 0; i < mcList.Count(); i++)
if (theHold.Holding()) if (theHold.Holding())
{ {
// Hulud: here, i pass a NULL pointer because rpatch are not modified by xform // Hulud: here, i pass a NULL pointer because rpatch are not modified by xform
theHold.Put(new PatchRestore(patchData, this, patch, NULL, "XFormVerts")); theHold.Put(new PatchRestore(patchData, this, patch, NULL, _T("XFormVerts")));
} }
patchData->vdelta.Zero(); // Reset all deltas patchData->vdelta.Zero(); // Reset all deltas
patchData->ClearHandleFlag(); patchData->ClearHandleFlag();

@ -24,7 +24,7 @@ static void AddPatches(int type, PatchMesh *patch, RPatchMesh *rpatch, BOOL post
int edges = patch->getNumEdges(); int edges = patch->getNumEdges();
if (type==PATCH_TRI) if (type==PATCH_TRI)
MessageBox (NULL, "Rykol tools", "C'est pas cool les tripatches...", MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, _T("Rykol tools"), _T("C'est pas cool les tripatches..."), MB_OK|MB_ICONEXCLAMATION);
// Add a patch of the desired type to each selected edge that doesn't have two patches atatched! // Add a patch of the desired type to each selected edge that doesn't have two patches atatched!
for (int i = 0; i < edges; ++i) for (int i = 0; i < edges; ++i)
@ -393,7 +393,7 @@ void EditPatchMod::DoPatchAdd(int type)
{ {
altered = holdNeeded = 1; altered = holdNeeded = 1;
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoPatchAdd")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoPatchAdd")));
// Call the patch add function // Call the patch add function
AddPatches(type, patch, rpatch, TRUE); AddPatches(type, patch, rpatch, TRUE);
patchData->UpdateChanges(patch, rpatch); patchData->UpdateChanges(patch, rpatch);

@ -284,7 +284,7 @@ int EditPatchMod::DoAttach(INode *node, PatchMesh *attPatch, RPatchMesh *rattPat
// Start a restore object... // Start a restore object...
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoAttach")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoAttach")));
// Do the attach // Do the attach
patch->Attach(attPatch, mat2Offset); patch->Attach(attPatch, mat2Offset);

@ -110,7 +110,7 @@ void EditPatchMod::DoPatchDelete()
{ {
altered = holdNeeded = 1; altered = holdNeeded = 1;
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoPatchDelete")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoPatchDelete")));
// Call the patch delete function // Call the patch delete function
DeleteSelPatches(patch, rpatch); DeleteSelPatches(patch, rpatch);
patchData->UpdateChanges(patch, rpatch); patchData->UpdateChanges(patch, rpatch);
@ -211,7 +211,7 @@ void EditPatchMod::DoVertDelete()
{ {
altered = holdNeeded = 1; altered = holdNeeded = 1;
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoVertDelete")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoVertDelete")));
// Call the vertex delete function // Call the vertex delete function
DeleteSelVerts(patch, rpatch); DeleteSelVerts(patch, rpatch);
patchData->UpdateChanges(patch, rpatch); patchData->UpdateChanges(patch, rpatch);
@ -279,7 +279,7 @@ void EditPatchMod::DoEdgeDelete()
{ {
altered = holdNeeded = 1; altered = holdNeeded = 1;
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoEdgeDelete")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoEdgeDelete")));
int edges = patch->getNumEdges(); int edges = patch->getNumEdges();
int patches = patch->getNumPatches(); int patches = patch->getNumPatches();
int verts = patch->getNumVerts(); int verts = patch->getNumVerts();

@ -133,7 +133,7 @@ void EditPatchMod::DoPatchDetach(int copy, int reorient)
// Save the unmodified info. // Save the unmodified info.
if (theHold.Holding()) if (theHold.Holding())
{ {
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "DoPatchDetach")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("DoPatchDetach")));
} }
PatchMesh wpatch = *patch; PatchMesh wpatch = *patch;
RPatchMesh wrpatch = *rpatch; RPatchMesh wrpatch = *rpatch;

@ -89,7 +89,7 @@ void EditPatchMod::SetSelMatIndex(int index)
// Start a restore object... // Start a restore object...
if (theHold.Holding()) if (theHold.Holding())
{ {
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SetSelMatIndex")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SetSelMatIndex")));
} }
for (int j = 0; j < patch->getNumPatches(); j++) for (int j = 0; j < patch->getNumPatches(); j++)
@ -254,7 +254,7 @@ void EditPatchMod::SetSelTess(int nU, int nV)
// Start a restore object... // Start a restore object...
if (theHold.Holding()) if (theHold.Holding())
{ {
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SetSelTess")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SetSelTess")));
} }
for (int j = 0; j < patch->getNumPatches(); j++) for (int j = 0; j < patch->getNumPatches(); j++)
@ -391,7 +391,7 @@ void EditPatchMod::setSmoothFlags (bool smooth)
// Start a restore object... // Start a restore object...
if (theHold.Holding()) if (theHold.Holding())
{ {
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SetSmoothFlags")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SetSmoothFlags")));
} }
// For each edges // For each edges
@ -539,7 +539,7 @@ void EditPatchMod::BalanceSelPatch ()
// Start a restore object... // Start a restore object...
if (theHold.Holding()) if (theHold.Holding())
{ {
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SetSelTess")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SetSelTess")));
} }
std::set<int> visitedU; std::set<int> visitedU;

@ -149,7 +149,7 @@ void EditPatchMod::ChangeRememberedPatch(int type)
theHold.Begin(); theHold.Begin();
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "ChangeRememberedPatch")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("ChangeRememberedPatch")));
// Call the patch type change function // Call the patch type change function
ChangePatchType(patch, rememberedIndex, type); ChangePatchType(patch, rememberedIndex, type);
patchData->UpdateChanges(patch, rpatch, FALSE); patchData->UpdateChanges(patch, rpatch, FALSE);
@ -299,7 +299,7 @@ void EditPatchMod::ChangeRememberedVert(int type)
theHold.Begin(); theHold.Begin();
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "ChangeRememberedVert")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("ChangeRememberedVert")));
// Call the vertex type change function // Call the vertex type change function
patch->ChangeVertType(rememberedIndex, type); patch->ChangeVertType(rememberedIndex, type);
patchData->UpdateChanges(patch, rpatch, FALSE); patchData->UpdateChanges(patch, rpatch, FALSE);

@ -262,7 +262,7 @@ void EditPatchMod::SelectSubPatch(int index)
patchData->BeginEdit(t); patchData->BeginEdit(t);
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SelectSubComponent")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SelectSubComponent")));
patch->patchSel.Set(index); patch->patchSel.Set(index);
@ -311,7 +311,7 @@ void EditPatchMod::SelectSubPatch(int index)
patchData->BeginEdit(t); patchData->BeginEdit(t);
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SelectSubComponent")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SelectSubComponent")));
switch (selLevel) switch (selLevel)
{ {
@ -636,7 +636,7 @@ void EditPatchMod::ClearSelection(int selLevel)
patchData->BeginEdit(ip->GetTime()); patchData->BeginEdit(ip->GetTime());
if (theHold.Holding()) if (theHold.Holding())
{ {
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "ClearSelection")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("ClearSelection")));
} }
switch (selLevel) switch (selLevel)
@ -744,7 +744,7 @@ void EditPatchMod::SelectAll(int selLevel)
patchData->BeginEdit(ip->GetTime()); patchData->BeginEdit(ip->GetTime());
if (theHold.Holding()) if (theHold.Holding())
{ {
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SelectAll")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("SelectAll")));
} }
switch (selLevel) switch (selLevel)
@ -813,7 +813,7 @@ void EditPatchMod::InvertSelection(int selLevel)
patchData->BeginEdit(ip->GetTime()); patchData->BeginEdit(ip->GetTime());
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "InvertSelection")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("InvertSelection")));
switch (selLevel) switch (selLevel)
{ {
@ -1004,7 +1004,7 @@ void EditPatchMod::ChangeSelPatches(int type)
{ {
altered = holdNeeded = TRUE; altered = holdNeeded = TRUE;
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "ChangeSelPatches")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("ChangeSelPatches")));
// Call the vertex type change function // Call the vertex type change function
ChangePatchType(patch, -1, type); ChangePatchType(patch, -1, type);
patchData->UpdateChanges(patch, rpatch, FALSE); patchData->UpdateChanges(patch, rpatch, FALSE);
@ -1077,7 +1077,7 @@ void EditPatchMod::ChangeSelVerts(int type)
{ {
altered = holdNeeded = TRUE; altered = holdNeeded = TRUE;
if (theHold.Holding()) if (theHold.Holding())
theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "ChangeSelVerts")); theHold.Put(new PatchRestore(patchData, this, patch, rpatch, _T("ChangeSelVerts")));
// Call the vertex type change function // Call the vertex type change function
patch->ChangeVertType(-1, type); patch->ChangeVertType(-1, type);
patchData->UpdateChanges(patch, rpatch, FALSE); patchData->UpdateChanges(patch, rpatch, FALSE);

@ -70,7 +70,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
//------------------------------------------------------ //------------------------------------------------------
__declspec( dllexport ) const TCHAR *LibDescription() __declspec( dllexport ) const TCHAR *LibDescription()
{ {
return "NeL Patch Edit"; return _T("NeL Patch Edit");
} }
/// MUST CHANGE THIS NUMBER WHEN ADD NEW CLASS /// MUST CHANGE THIS NUMBER WHEN ADD NEW CLASS

@ -35,7 +35,7 @@ extern void LoadImages();
INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
static char string[64]; static TCHAR string[64];
EditPatchMod *ep =(EditPatchMod *)GetWindowLongPtr(hDlg, GWLP_USERDATA); EditPatchMod *ep =(EditPatchMod *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
ICustToolbar *iToolbar; ICustToolbar *iToolbar;
if (!ep && message != WM_INITDIALOG) if (!ep && message != WM_INITDIALOG)
@ -50,7 +50,7 @@ INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
if (hModule) if (hModule)
{ {
// Get module file name // Get module file name
char moduldeFileName[512]; TCHAR moduldeFileName[512];
if (GetModuleFileName (hModule, moduldeFileName, 512)) if (GetModuleFileName (hModule, moduldeFileName, 512))
{ {
// Get version info size // Get version info size
@ -59,22 +59,22 @@ INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
if (versionInfoSize) if (versionInfoSize)
{ {
// Alloc the buffer // Alloc the buffer
char *buffer=new char[versionInfoSize]; TCHAR *buffer = new TCHAR[versionInfoSize];
// Find the verion resource // Find the verion resource
if (GetFileVersionInfo(moduldeFileName, 0, versionInfoSize, buffer)) if (GetFileVersionInfo(moduldeFileName, 0, versionInfoSize, buffer))
{ {
uint *versionTab; uint *versionTab;
uint versionSize; uint versionSize;
if (VerQueryValue (buffer, "\\", (void**)&versionTab, &versionSize)) if (VerQueryValue (buffer, _T("\\"), (void**)&versionTab, &versionSize))
{ {
// Get the pointer on the structure // Get the pointer on the structure
VS_FIXEDFILEINFO *info=(VS_FIXEDFILEINFO*)versionTab; VS_FIXEDFILEINFO *info=(VS_FIXEDFILEINFO*)versionTab;
if (info) if (info)
{ {
// Setup version number // Setup version number
char version[512]; TCHAR version[512];
sprintf (version, "Version %d.%d.%d.%d", _stprintf(version, _T("Version %d.%d.%d.%d"),
info->dwFileVersionMS>>16, info->dwFileVersionMS>>16,
info->dwFileVersionMS&0xffff, info->dwFileVersionMS&0xffff,
info->dwFileVersionLS>>16, info->dwFileVersionLS>>16,
@ -82,25 +82,25 @@ INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
SetWindowText (GetDlgItem (hDlg, IDC_VERSION), version); SetWindowText (GetDlgItem (hDlg, IDC_VERSION), version);
} }
else else
SetWindowText (GetDlgItem (hDlg, IDC_VERSION), "VS_FIXEDFILEINFO * is NULL"); SetWindowText (GetDlgItem (hDlg, IDC_VERSION), _T("VS_FIXEDFILEINFO * is NULL"));
} }
else else
SetWindowText (GetDlgItem (hDlg, IDC_VERSION), "VerQueryValue failed"); SetWindowText (GetDlgItem (hDlg, IDC_VERSION), _T("VerQueryValue failed"));
} }
else else
SetWindowText (GetDlgItem (hDlg, IDC_VERSION), "GetFileVersionInfo failed"); SetWindowText (GetDlgItem (hDlg, IDC_VERSION), _T("GetFileVersionInfo failed"));
// Free the buffer // Free the buffer
delete [] buffer; delete [] buffer;
} }
else else
SetWindowText (GetDlgItem (hDlg, IDC_VERSION), "GetFileVersionInfoSize failed"); SetWindowText (GetDlgItem (hDlg, IDC_VERSION), _T("GetFileVersionInfoSize failed"));
} }
else else
SetWindowText (GetDlgItem (hDlg, IDC_VERSION), "GetModuleFileName failed"); SetWindowText (GetDlgItem (hDlg, IDC_VERSION), _T("GetModuleFileName failed"));
} }
else else
SetWindowText (GetDlgItem (hDlg, IDC_VERSION), "GetModuleHandle failed"); SetWindowText (GetDlgItem (hDlg, IDC_VERSION), _T("GetModuleHandle failed"));
ep =(EditPatchMod *)lParam; ep =(EditPatchMod *)lParam;
ep->hSelectPanel = hDlg; ep->hSelectPanel = hDlg;
@ -122,7 +122,7 @@ INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
CheckDlgButton(hDlg, IDC_LOCK_HANDLES, lockedHandles); CheckDlgButton(hDlg, IDC_LOCK_HANDLES, lockedHandles);
ep->SetSelDlgEnables(); ep->SetSelDlgEnables();
sprintf(string,"%s - %s",__DATE__,__TIME__); _stprintf(string, _T("%s - %s"), _T(__DATE__), _T(__TIME__));
SetDlgItemText(hDlg,ID_VERSION,string); SetDlgItemText(hDlg,ID_VERSION,string);
return TRUE; return TRUE;
} }
@ -224,7 +224,7 @@ INT_PTR CALLBACK PatchSelectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
lpttt->lpszText = GetString(IDS_TH_PATCH); lpttt->lpszText = GetString(IDS_TH_PATCH);
break; break;
case EP_TILE: case EP_TILE:
lpttt->lpszText = "Tile"; lpttt->lpszText = _T("Tile");
break; break;
} }
} }

@ -53,7 +53,7 @@ float bindWhere[BIND_COUNT]=
#define RK_APPDATA_TILEFILE 0 #define RK_APPDATA_TILEFILE 0
#define RK_APPDATA_LAND 1 #define RK_APPDATA_LAND 1
#define REGKEY_TILEDIT "Software\\Nevrax\\Ryzom\\Tile_Edit" #define REGKEY_TILEDIT _T("Software\\Nevrax\\Ryzom\\Tile_Edit")
//#define CHECK_VALIDITY // check validity //#define CHECK_VALIDITY // check validity
@ -103,11 +103,11 @@ std::string GetBankPathName ()
HKEY hKey; HKEY hKey;
if (RegOpenKeyEx(HKEY_CURRENT_USER, REGKEY_TILEDIT, 0, KEY_READ, &hKey)==ERROR_SUCCESS) if (RegOpenKeyEx(HKEY_CURRENT_USER, REGKEY_TILEDIT, 0, KEY_READ, &hKey)==ERROR_SUCCESS)
{ {
char path[256]; TCHAR path[256];
DWORD len=256; DWORD len=256 * sizeof(TCHAR);
DWORD type; DWORD type;
if (RegQueryValueEx(hKey, "Bank Path", 0, &type, (LPBYTE)path, &len)==ERROR_SUCCESS) if (RegQueryValueEx(hKey, _T("Bank Path"), 0, &type, (LPBYTE)path, &len)==ERROR_SUCCESS)
return std::string (path); return tStrToUtf8(path);
RegCloseKey (hKey); RegCloseKey (hKey);
} }
return ""; return "";
@ -121,7 +121,7 @@ int GetBankTileSetSet ()
int tileSetSet; int tileSetSet;
DWORD len=256; DWORD len=256;
DWORD type; DWORD type;
if (RegQueryValueEx(hKey, "Tileset Set", 0, &type, (LPBYTE)&tileSetSet, &len)==ERROR_SUCCESS) if (RegQueryValueEx(hKey, _T("Tileset Set"), 0, &type, (LPBYTE)&tileSetSet, &len)==ERROR_SUCCESS)
return tileSetSet; return tileSetSet;
RegCloseKey (hKey); RegCloseKey (hKey);
} }
@ -143,7 +143,7 @@ void SetBankTileSetSet (int tileSetSet)
HKEY hKey; HKEY hKey;
if (RegCreateKey(HKEY_CURRENT_USER, REGKEY_TILEDIT, &hKey)==ERROR_SUCCESS) if (RegCreateKey(HKEY_CURRENT_USER, REGKEY_TILEDIT, &hKey)==ERROR_SUCCESS)
{ {
RegSetValueEx(hKey, "Tileset Set", 0, REG_DWORD, (LPBYTE)&tileSetSet, 4); RegSetValueEx(hKey, _T("Tileset Set"), 0, REG_DWORD, (LPBYTE)&tileSetSet, 4);
RegCloseKey (hKey); RegCloseKey (hKey);
} }
} }

@ -47,7 +47,7 @@ using namespace NLLIGO;
#define DEPTH_SEARCH_MAX 8 #define DEPTH_SEARCH_MAX 8
#define REGKEY_EDIT_PATCH "Software\\Nevrax\\Ryzom\\edit_patch" #define REGKEY_EDIT_PATCH _T("Software\\Nevrax\\Ryzom\\edit_patch")
// Bank bitmaps // Bank bitmaps
CBankCont* bankCont; CBankCont* bankCont;
@ -77,8 +77,7 @@ void WarningInvalidTileSet ()
if (!bWarningInvalidTileSet) if (!bWarningInvalidTileSet)
{ {
bWarningInvalidTileSet=true; bWarningInvalidTileSet=true;
MessageBox (NULL, "The tile bank is not compatible with your zone.\nPlease use the good bank or erase and repaint the zone.", MessageBox (NULL, _T("The tile bank is not compatible with your zone.\nPlease use the good bank or erase and repaint the zone."), _T("Tile paint"), MB_OK|MB_ICONEXCLAMATION);
"Tile paint", MB_OK|MB_ICONEXCLAMATION);
} }
} }
@ -105,13 +104,13 @@ void enterPainter (CTileBank& banktoLoad)
{ {
DWORD len=4; DWORD len=4;
DWORD type; DWORD type;
RegQueryValueEx (hKey, "Background", 0, &type, (LPBYTE)&backGround, &len); RegQueryValueEx (hKey, _T("Background"), 0, &type, (LPBYTE)&backGround, &len);
RegQueryValueEx (hKey, "Color1", 0, &type, (LPBYTE)&color1, &len); RegQueryValueEx (hKey, _T("Color1"), 0, &type, (LPBYTE)&color1, &len);
RegQueryValueEx (hKey, "Color2", 0, &type, (LPBYTE)&color2, &len); RegQueryValueEx (hKey, _T("Color2"), 0, &type, (LPBYTE)&color2, &len);
RegQueryValueEx (hKey, "Opa1", 0, &type, (LPBYTE)&opa1, &len); RegQueryValueEx (hKey, _T("Opa1"), 0, &type, (LPBYTE)&opa1, &len);
RegQueryValueEx (hKey, "Opa2", 0, &type, (LPBYTE)&opa2, &len); RegQueryValueEx (hKey, _T("Opa2"), 0, &type, (LPBYTE)&opa2, &len);
RegQueryValueEx (hKey, "Hard1", 0, &type, (LPBYTE)&hard1, &len); RegQueryValueEx (hKey, _T("Hard1"), 0, &type, (LPBYTE)&hard1, &len);
RegQueryValueEx (hKey, "Hard2", 0, &type, (LPBYTE)&hard2, &len); RegQueryValueEx (hKey, _T("Hard2"), 0, &type, (LPBYTE)&hard2, &len);
RegCloseKey (hKey); RegCloseKey (hKey);
} }
} }
@ -126,13 +125,13 @@ void exitPainter ()
HKEY hKey; HKEY hKey;
if (RegCreateKey(HKEY_CURRENT_USER, REGKEY_EDIT_PATCH, &hKey)==ERROR_SUCCESS) if (RegCreateKey(HKEY_CURRENT_USER, REGKEY_EDIT_PATCH, &hKey)==ERROR_SUCCESS)
{ {
RegSetValueEx(hKey, "Background", 0, REG_DWORD, (LPBYTE)&backGround, 4); RegSetValueEx(hKey, _T("Background"), 0, REG_DWORD, (LPBYTE)&backGround, 4);
RegSetValueEx(hKey, "Color1", 0, REG_DWORD, (LPBYTE)&color1, 4); RegSetValueEx(hKey, _T("Color1"), 0, REG_DWORD, (LPBYTE)&color1, 4);
RegSetValueEx(hKey, "Color2", 0, REG_DWORD, (LPBYTE)&color2, 4); RegSetValueEx(hKey, _T("Color2"), 0, REG_DWORD, (LPBYTE)&color2, 4);
RegSetValueEx(hKey, "Opa1", 0, REG_DWORD, (LPBYTE)&opa1, 4); RegSetValueEx(hKey, _T("Opa1"), 0, REG_DWORD, (LPBYTE)&opa1, 4);
RegSetValueEx(hKey, "Opa2", 0, REG_DWORD, (LPBYTE)&opa2, 4); RegSetValueEx(hKey, _T("Opa2"), 0, REG_DWORD, (LPBYTE)&opa2, 4);
RegSetValueEx(hKey, "Hard1", 0, REG_DWORD, (LPBYTE)&hard1, 4); RegSetValueEx(hKey, _T("Hard1"), 0, REG_DWORD, (LPBYTE)&hard1, 4);
RegSetValueEx(hKey, "Hard2", 0, REG_DWORD, (LPBYTE)&hard2, 4); RegSetValueEx(hKey, _T("Hard2"), 0, REG_DWORD, (LPBYTE)&hard2, 4);
RegCloseKey (hKey); RegCloseKey (hKey);
} }
} }
@ -2816,12 +2815,12 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi
if (AsyncListener.isKeyPushed ((TKey)PainterKeys[SelectColorBrush])) if (AsyncListener.isKeyPushed ((TKey)PainterKeys[SelectColorBrush]))
{ {
// Create a dialog filter // Create a dialog filter
static char szFilter[] = static TCHAR szFilter[] =
"Targa Files (*.tga)\0*.tga\0" _T("Targa Files (*.tga)\0*.tga\0")
"All Files (*.*)\0*.*\0\0"; _T("All Files (*.*)\0*.*\0\0");
// Filename buffer // Filename buffer
char buffer[65535]; TCHAR buffer[65535];
buffer[0]=0; buffer[0]=0;
// Fill the (big) struct // Fill the (big) struct
@ -2834,13 +2833,13 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi
openFile.lpstrFile = buffer; openFile.lpstrFile = buffer;
openFile.nMaxFile = 65535; openFile.nMaxFile = 65535;
openFile.Flags = OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ENABLESIZING|OFN_EXPLORER; openFile.Flags = OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ENABLESIZING|OFN_EXPLORER;
openFile.lpstrDefExt = "*.tga"; openFile.lpstrDefExt = _T("*.tga");
// Open the dialog // Open the dialog
if (GetOpenFileName(&openFile)) if (GetOpenFileName(&openFile))
{ {
// Load the file // Load the file
paintColor.loadBrush (buffer); paintColor.loadBrush (tStrToUtf8(buffer));
paintColor.setBrushMode (true); paintColor.setBrushMode (true);
} }
} }
@ -3721,7 +3720,7 @@ void EPM_PaintCMode::DoPaint ()
{ {
std::string error = NLMISC::toString("Invalid edge '%i' with value '%i' in patch '%i' in PatchMesh", p, mYedge, e); std::string error = NLMISC::toString("Invalid edge '%i' with value '%i' in patch '%i' in PatchMesh", p, mYedge, e);
nlwarning(error.c_str()); nlwarning(error.c_str());
MessageBox(NULL, error.c_str(), "NeL Patch Painter", MB_OK | MB_ICONSTOP); MessageBox(NULL, utf8ToTStr(error), _T("NeL Patch Painter"), MB_OK | MB_ICONSTOP);
return; return;
} }
#if (MAX_RELEASE < 4000) #if (MAX_RELEASE < 4000)
@ -3884,8 +3883,8 @@ void EPM_PaintCMode::DoPaint ()
} }
if (patchVoisin.patch!=-1) if (patchVoisin.patch!=-1)
{ {
std::string first = vectMesh[i].Node->GetName(); std::string first = tStrToUtf8(vectMesh[i].Node->GetName());
std::string second = vectMesh[patchVoisin.Mesh].Node->GetName(); std::string second = tStrToUtf8(vectMesh[patchVoisin.Mesh].Node->GetName());
int rot = (2-((vectMesh[i].Symmetry)?(2-e):e)+((vectMesh[patchVoisin.Mesh].Symmetry)?(2-edgeVoisin):edgeVoisin))&3; int rot = (2-((vectMesh[i].Symmetry)?(2-e):e)+((vectMesh[patchVoisin.Mesh].Symmetry)?(2-edgeVoisin):edgeVoisin))&3;
int nU = 1 << rpatch->getUIPatch (p).NbTilesU; int nU = 1 << rpatch->getUIPatch (p).NbTilesU;
int nV = 1 << rpatch->getUIPatch (p).NbTilesV; int nV = 1 << rpatch->getUIPatch (p).NbTilesV;
@ -4076,9 +4075,7 @@ bool loadLigoConfigFile (CLigoConfig& config, Interface& it)
catch (const Exception& e) catch (const Exception& e)
{ {
// Print an error message // Print an error message
char msg[512]; nlwarning("Error loading the config file ligoscape.cfg: %s", e.what());
smprintf (msg, 512, "Error loading the config file ligoscape.cfg: %s", e.what());
nlwarning (msg);
} }
} }
} }
@ -4259,9 +4256,8 @@ DWORD WINAPI myThread (LPVOID vData)
} }
else else
{ {
char message[512]; std::string message = toString("Can't build the zone named %s", tStrToUtf8(pData->VectMesh[i].Node->GetName()).c_str());
smprintf (message, 512, "Can't build the zone named %s", pData->VectMesh[i].Node->GetName()); MessageBox (pData->eproc->ip->GetMAXHWnd(), utf8ToTStr(message), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION);
MessageBox (pData->eproc->ip->GetMAXHWnd(), message, "NeL Painter", MB_OK|MB_ICONEXCLAMATION);
} }
} }
@ -4363,14 +4359,14 @@ DWORD WINAPI myThread (LPVOID vData)
} }
catch (EDru& druExcept) catch (EDru& druExcept)
{ {
MessageBox (NULL, druExcept.what(), "NeL driver utility", MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, utf8ToTStr(druExcept.what()), _T("NeL driver utility"), MB_OK|MB_ICONEXCLAMATION);
} }
delete pData; delete pData;
} }
catch (const Exception& e) catch (const Exception& e)
{ {
MessageBox (NULL, e.what(), "NeL Painter", MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, utf8ToTStr(e.what()), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION);
} }
return 0; return 0;

@ -7,7 +7,7 @@
#include "nel/3d/texture_mem.h" #include "nel/3d/texture_mem.h"
#include "nel/misc/config_file.h" #include "nel/misc/config_file.h"
#define REGKEY_EDIT_PATCH "Software\\Nevrax\\Ryzom\\edit_patch" #define REGKEY_EDIT_PATCH _T("Software\\Nevrax\\Ryzom\\edit_patch")
/*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/
@ -318,9 +318,8 @@ void getColors (COLORREF *array)
{ {
DWORD len=4; DWORD len=4;
DWORD type; DWORD type;
char regName[100]; std::string regName = toString("Color%u", i);
smprintf (regName, 100, "Color%d", i); RegQueryValueEx (hKey, utf8ToTStr(regName), 0, &type, (LPBYTE)(array+i), &len);
RegQueryValueEx (hKey, regName, 0, &type, (LPBYTE)(array+i), &len);
} }
RegCloseKey (hKey); RegCloseKey (hKey);
} }
@ -337,9 +336,8 @@ void setColors (const COLORREF *array)
for (uint i=0; i<16; i++) for (uint i=0; i<16; i++)
{ {
DWORD len=4; DWORD len=4;
char regName[100]; std::string regName = toString("Color%u", i);
smprintf (regName, 100, "Color%d", i); RegSetValueEx (hKey, utf8ToTStr(regName), 0, REG_DWORD, (LPBYTE)(array+i), 4);
RegSetValueEx (hKey, regName, 0, REG_DWORD, (LPBYTE)(array+i), 4);
} }
RegCloseKey (hKey); RegCloseKey (hKey);
} }

@ -378,7 +378,7 @@ void CPaintColor::setVertexColor (int mesh, int patch, int s, int t, const CRGBA
/*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/
bool CPaintColor::loadBrush (const char *brushFileName) bool CPaintColor::loadBrush (const std::string &brushFileName)
{ {
// Open the file // Open the file
try try
@ -401,9 +401,8 @@ bool CPaintColor::loadBrush (const char *brushFileName)
else else
{ {
// Error message // Error message
char msg[512]; std::string msg = toString("Can't open the file %s.", brushFileName.c_str());
smprintf (msg, 512, "Can't open the file %s.", brushFileName); MessageBox ((HWND)CNELU::Driver->getDisplay(), utf8ToTStr(msg), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION);
MessageBox ((HWND)CNELU::Driver->getDisplay(), msg, "NeL Painter", MB_OK|MB_ICONEXCLAMATION);
// Return false // Return false
return false; return false;
@ -412,7 +411,7 @@ bool CPaintColor::loadBrush (const char *brushFileName)
catch (const Exception &e) catch (const Exception &e)
{ {
// Error message // Error message
MessageBox ((HWND)CNELU::Driver->getDisplay(), e.what(), "NeL Painter", MB_OK|MB_ICONEXCLAMATION); MessageBox ((HWND)CNELU::Driver->getDisplay(), utf8ToTStr(e.what()), _T("NeL Painter"), MB_OK|MB_ICONEXCLAMATION);
// Return false // Return false
return false; return false;

@ -81,7 +81,7 @@ public:
} }
// Load a brush // Load a brush
bool loadBrush (const char *brushFileName); bool loadBrush (const std::string &brushFileName);
private: private:

@ -120,7 +120,7 @@ static INT_PTR CALLBACK Tile_utilityDlgProc(HWND hWnd, UINT msg, WPARAM wParam,
{ {
// Setup version number // Setup version number
TCHAR version[512]; TCHAR version[512];
_tcprintf (version, "Version %d.%d.%d.%d", _stprintf (version, _T("Version %d.%d.%d.%d"),
info->dwFileVersionMS>>16, info->dwFileVersionMS>>16,
info->dwFileVersionMS&0xffff, info->dwFileVersionMS&0xffff,
info->dwFileVersionLS>>16, info->dwFileVersionLS>>16,
@ -378,9 +378,9 @@ void Tile_utility::SetupUI ()
// Static text // Static text
TCHAR sTmp[256]; TCHAR sTmp[256];
_tcprintf (sTmp, "%d diffuse tiles.", Bank.getNumBitmap (CTile::diffuse)); _stprintf (sTmp, _T("%d diffuse tiles."), Bank.getNumBitmap (CTile::diffuse));
SetWindowText (hwndStatic1, sTmp); SetWindowText (hwndStatic1, sTmp);
_tcprintf (sTmp, "%d additive tiles.", Bank.getNumBitmap (CTile::additive)); _stprintf (sTmp, _T("%d additive tiles."), Bank.getNumBitmap (CTile::additive));
SetWindowText (hwndStatic2, sTmp); SetWindowText (hwndStatic2, sTmp);
} }
else else

@ -778,7 +778,7 @@ void Browse::OnCancel()
// TODO: Add your control notification handler code here // TODO: Add your control notification handler code here
if (thread_actif) return; if (thread_actif) return;
if (::MessageBox (NULL, "Are you sure you want to cancel?", "Cancel", MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES) if (::MessageBox (NULL, _T("Are you sure you want to cancel?"), _T("Cancel"), MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES)
{ {
this->SendMessage(WM_CLOSE); this->SendMessage(WM_CLOSE);
CDialog::OnCancel(); CDialog::OnCancel();
@ -884,8 +884,7 @@ void Browse::OnChangeVariety()
void Browse::OnBatchLoad () void Browse::OnBatchLoad ()
{ {
CFileDialog sFile (true, NULL, NULL, OFN_ENABLESIZING, CFileDialog sFile (true, NULL, NULL, OFN_ENABLESIZING, _T("PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||"), NULL);
"PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL);
if (sFile.DoModal()==IDOK) if (sFile.DoModal()==IDOK)
{ {
@ -904,7 +903,8 @@ void Browse::OnBatchLoad ()
sNumber[1]=0; sNumber[1]=0;
bool rotate=false; bool rotate=false;
if (::MessageBox (NULL, "Do you want to use rotation to reuse alpha tiles ?", "Import rotated tiles", MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES)
if (::MessageBox (NULL, _T("Do you want to use rotation to reuse alpha tiles ?"), _T("Import rotated tiles"), MB_OK|MB_ICONQUESTION|MB_YESNO)==IDYES)
rotate=true; rotate=true;
for (int i=0; i<CTileSet::count; i++) for (int i=0; i<CTileSet::count; i++)
@ -1360,8 +1360,7 @@ void Browse::OnSubgroup11()
void Browse::OnExportBorder() void Browse::OnExportBorder()
{ {
// Select a file // Select a file
CFileDialog sFile (false, NULL, NULL, OFN_ENABLESIZING, CFileDialog sFile (false, NULL, NULL, OFN_ENABLESIZING, _T("PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||"), NULL);
"PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL);
if (sFile.DoModal()==IDOK) if (sFile.DoModal()==IDOK)
{ {
// Get the border of the bank // Get the border of the bank
@ -1415,9 +1414,8 @@ void Browse::OnExportBorder()
if (error) if (error)
{ {
// Error message // Error message
char tmp[512]; std::string tmp = toString("Can't write bitmap %s", tStrToUtf8(pathName).c_str());
sprintf (tmp, "Can't write bitmap %s", (const char*)pathName); MessageBox (utf8ToTStr(tmp), _T("Export border"), MB_OK|MB_ICONEXCLAMATION);
MessageBox (tmp, "Export border", MB_OK|MB_ICONEXCLAMATION);
} }
} }
} }
@ -1426,8 +1424,7 @@ void Browse::OnExportBorder()
void Browse::OnImportBorder() void Browse::OnImportBorder()
{ {
// Select a file // Select a file
CFileDialog sFile (true, NULL, NULL, OFN_ENABLESIZING, CFileDialog sFile (true, NULL, NULL, OFN_ENABLESIZING,_T("PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||"), NULL);
"PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL);
if (sFile.DoModal()==IDOK) if (sFile.DoModal()==IDOK)
{ {
// Get the border of the bank // Get the border of the bank
@ -1460,9 +1457,8 @@ void Browse::OnImportBorder()
if (error) if (error)
{ {
// Error message // Error message
char tmp[512]; std::string tmp = toString("Can't read bitmap %s", tStrToUtf8(pathName).c_str());
sprintf (tmp, "Can't read bitmap %s", (const char*)pathName); MessageBox (utf8ToTStr(tmp), _T("Import border"), MB_OK|MB_ICONEXCLAMATION);
MessageBox (tmp, "Import border", MB_OK|MB_ICONEXCLAMATION);
} }
// Get pixel // Get pixel
@ -1485,9 +1481,8 @@ void Browse::OnImportBorder()
else else
{ {
// Error message // Error message
char tmp[512]; std::string tmp = toString("The bitmap must have a size of 128x128 (%s)", tStrToUtf8(pathName).c_str());
sprintf (tmp, "The bitmap must have a size of 128x128 (%s)", (const char*)pathName); MessageBox (utf8ToTStr(tmp), _T("Import border"), MB_OK|MB_ICONEXCLAMATION);
MessageBox (tmp, "Import border", MB_OK|MB_ICONEXCLAMATION);
} }
// 256 or 128 ? // 256 or 128 ?
@ -1496,6 +1491,6 @@ void Browse::OnImportBorder()
tileBank2.getTileSet (land)->setBorder (m_ctrl.Texture==1?CTile::diffuse:CTile::additive, border); tileBank2.getTileSet (land)->setBorder (m_ctrl.Texture==1?CTile::diffuse:CTile::additive, border);
// Message // Message
MessageBox ("The border has been changed.", "Import border", MB_OK|MB_ICONINFORMATION); MessageBox (_T("The border has been changed."), _T("Import border"), MB_OK|MB_ICONINFORMATION);
} }
} }

@ -466,7 +466,7 @@ int TileList::setDisplacement (int tile, const std::string& name)
// Error: bitmap not in the absolute path.. // Error: bitmap not in the absolute path..
char msg[512]; char msg[512];
sprintf (msg, "The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str()); sprintf (msg, "The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str());
MessageBox (NULL, msg, "Load error", MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, msg, _T("Load error"), MB_OK|MB_ICONEXCLAMATION);
} }
return 1; return 1;
@ -536,7 +536,7 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot
// Error: bitmap not in the absolute path.. // Error: bitmap not in the absolute path..
char msg[512]; char msg[512];
sprintf (msg, "The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str()); sprintf (msg, "The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str());
MessageBox (NULL, msg, "Load error", MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, msg, _T("Load error"), MB_OK|MB_ICONEXCLAMATION);
} }
return 1; return 1;
@ -753,7 +753,7 @@ void CTView::Init(int _land, int n)
pImList = new CImageList; pImList = new CImageList;
pImList->Create(sizetile_x,sizetile_y,ILC_COLOR24,0,1); pImList->Create(sizetile_x,sizetile_y,ILC_COLOR24,0,1);
pImList->Add(bmp,(CBitmap*)NULL); pImList->Add(bmp,(CBitmap*)NULL);
char *defautpath = ((SelectionTerritoire*)GetParent()->GetParent())->DefautPath.GetBuffer(256); TCHAR *defautpath = ((SelectionTerritoire*)GetParent()->GetParent())->DefautPath.GetBuffer(256);
count_=1; count_=1;
} }
@ -1123,7 +1123,7 @@ void CTView::OnDropFiles(HDROP hDropInfo)
if (!lockInsertion) if (!lockInsertion)
{ {
Browse *parent = (Browse*)this->GetParent(); Browse *parent = (Browse*)this->GetParent();
char FileName[256]; TCHAR FileName[256];
int count=DragQueryFile(hDropInfo, 0xffffffff, FileName, 256); //count = files number in drop queue int count=DragQueryFile(hDropInfo, 0xffffffff, FileName, 256); //count = files number in drop queue
@ -1138,7 +1138,7 @@ void CTView::OnDropFiles(HDROP hDropInfo)
case 0: case 0:
{ {
int index=InfoList.addTile128 (); int index=InfoList.addTile128 ();
if (InfoList.setTile128 (index, FileName, Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha))) if (InfoList.setTile128 (index, tStrToUtf8(FileName), Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha)))
{ {
tilelist::iterator it = InfoList.GetLast(parent->m_128x128); tilelist::iterator it = InfoList.GetLast(parent->m_128x128);
it--; it--;
@ -1152,7 +1152,7 @@ void CTView::OnDropFiles(HDROP hDropInfo)
case 1: case 1:
{ {
int index=InfoList.addTile256 (); int index=InfoList.addTile256 ();
if (InfoList.setTile256 (index, FileName, Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha))) if (InfoList.setTile256 (index, tStrToUtf8(FileName), Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha)))
{ {
tilelist::iterator it = InfoList.GetLast(parent->m_128x128); tilelist::iterator it = InfoList.GetLast(parent->m_128x128);
it--; it--;
@ -1527,9 +1527,8 @@ LRESULT CTView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
else if ((id==ID_MENU_ADD)||(id==ID_MENU_REPLACE)) else if ((id==ID_MENU_ADD)||(id==ID_MENU_REPLACE))
{ {
_chdir (LastPath.c_str()); _chdir (LastPath.c_str());
CFileDialog load(true, NULL, LastPath.c_str(), OFN_ENABLESIZING | OFN_ALLOWMULTISELECT, CFileDialog load(true, NULL, utf8ToTStr(LastPath), OFN_ENABLESIZING | OFN_ALLOWMULTISELECT, _T("PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||"), NULL);
"PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); load.m_ofn.lpstrFile = new TCHAR[10000]; // buffer contains filenames list
load.m_ofn.lpstrFile = new char[10000]; // buffer contains filenames list
load.m_ofn.lpstrFile[0] = 0; load.m_ofn.lpstrFile[0] = 0;
// with 10 KB we should be large enough... // with 10 KB we should be large enough...
// if all files are exceeding 10000 characters, insert would be skipped // if all files are exceeding 10000 characters, insert would be skipped
@ -1684,10 +1683,10 @@ void CTView::OnRButtonDown(UINT nFlags, CPoint point)
if (!ViewTileMode) if (!ViewTileMode)
{ {
popup.AppendMenu(parent->m_128x128<2 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_ADD,"Add..."); popup.AppendMenu(parent->m_128x128<2 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_ADD, _T("Add..."));
popup.AppendMenu(c>0 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_REPLACE, "Replace..."); popup.AppendMenu(c>0 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_REPLACE, _T("Replace..."));
popup.AppendMenu(c>0 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_SUPR_BITMAP, "Del bitmap"); popup.AppendMenu(c>0 ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_SUPR_BITMAP, _T("Del bitmap"));
popup.AppendMenu((c>0 && parent->m_128x128<2) ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_SUPR_TILE, "Del tile"); popup.AppendMenu((c>0 && parent->m_128x128<2) ? MF_STRING : MF_STRING | MF_GRAYED, ID_MENU_SUPR_TILE, _T("Del tile"));
} }
else else
{ {

@ -131,10 +131,10 @@ void CPlugInSelector::OnSelchangeList1()
if ( ! LibInst ) if ( ! LibInst )
{ {
CString s; CString s;
char msg [300]; TCHAR msg [300];
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), msg, 299, NULL ); NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), msg, 299, NULL );
s.Format( "Can't load %s: %s", dllName, msg ); s.Format(_T("Can't load %s: %s"), dllName, msg );
AfxMessageBox( s ); AfxMessageBox( s );
AnalyseFunc = NULL; AnalyseFunc = NULL;
return; return;
@ -144,7 +144,7 @@ void CPlugInSelector::OnSelchangeList1()
TInfoFunc infoFunc = (TInfoFunc)GetProcAddress( LibInst, "getInfoString" ); TInfoFunc infoFunc = (TInfoFunc)GetProcAddress( LibInst, "getInfoString" );
if ( ! infoFunc ) if ( ! infoFunc )
{ {
AfxMessageBox( "Can't find function getInfoString in dll" ); AfxMessageBox( _T("Can't find function getInfoString in dll") );
return; return;
} }
GetDlgItem( IDC_GROUP_INFO )->SetWindowText( getFilename( string(dllName)).c_str() ); GetDlgItem( IDC_GROUP_INFO )->SetWindowText( getFilename( string(dllName)).c_str() );
@ -154,7 +154,7 @@ void CPlugInSelector::OnSelchangeList1()
AnalyseFunc = (TAnalyseFunc)GetProcAddress( LibInst, "doAnalyse" ); AnalyseFunc = (TAnalyseFunc)GetProcAddress( LibInst, "doAnalyse" );
if ( ! AnalyseFunc ) if ( ! AnalyseFunc )
{ {
AfxMessageBox( "Can't find function doAnalyse in dll" ); AfxMessageBox( _T("Can't find function doAnalyse in dll") );
return; return;
} }

@ -483,7 +483,7 @@ void CViewDialog::loadFileOrSeries( const vector<int>& bookmarksAbsoluteLines )
if ( LogSessionStartDate.IsEmpty() ) if ( LogSessionStartDate.IsEmpty() )
actualFilenames += ":\r\n"; actualFilenames += ":\r\n";
else else
actualFilenames += " for Session of " + LogSessionStartDate + ":\r\n"; actualFilenames += " for Session of " + tStrToUtf8(LogSessionStartDate) + ":\r\n";
bool corruptionDetectionEnabled = (((CButton*)(((CLog_analyserDlg*)GetParent())->GetDlgItem( IDC_DetectCorruptedLines )))->GetCheck() == 1); bool corruptionDetectionEnabled = (((CButton*)(((CLog_analyserDlg*)GetParent())->GetDlgItem( IDC_DetectCorruptedLines )))->GetCheck() == 1);
HasCorruptedLines = false; HasCorruptedLines = false;
vector<unsigned int> corruptedLines; vector<unsigned int> corruptedLines;

@ -254,10 +254,10 @@ void CBaseDialog::onOpenSelected()
void CBaseDialog::registerLastControl () void CBaseDialog::registerLastControl ()
{ {
RECT rect = {0, 0, 0, 0}; RECT rect = {0, 0, 0, 0};
DummyStatic0.Create ("Coucou", WS_CHILD|WS_VISIBLE|WS_TABSTOP, rect, this, 30); DummyStatic0.Create (_T("Coucou"), WS_CHILD|WS_VISIBLE|WS_TABSTOP, rect, this, 30);
DummyStatic0.Dlg = this; DummyStatic0.Dlg = this;
DummyStatic0.Index = 0; DummyStatic0.Index = 0;
DummyStatic1.Create ("Coucou", WS_CHILD|WS_VISIBLE|WS_TABSTOP, rect, this, 31); DummyStatic1.Create (_T("Coucou"), WS_CHILD|WS_VISIBLE|WS_TABSTOP, rect, this, 31);
DummyStatic1.Dlg = this; DummyStatic1.Dlg = this;
DummyStatic1.Index = 1; DummyStatic1.Index = 1;
} }

@ -78,7 +78,7 @@ void CColorWnd::create (DWORD wStyle, RECT &pos, CWnd *parent, uint dialogIndex)
LPCTSTR className = AfxRegisterWndClass(CS_DBLCLKS); LPCTSTR className = AfxRegisterWndClass(CS_DBLCLKS);
// Create this window // Create this window
if (CWnd::Create (className, "empty", wStyle, pos, parent, dialogIndex)) if (CWnd::Create (className, _T("empty"), wStyle, pos, parent, dialogIndex))
{ {
} }
} }
@ -118,8 +118,8 @@ void CColorWnd::setColor (const NLMISC::CRGBA &color)
{ {
Color = color; Color = color;
char buffer[256]; CString buffer;
sprintf(buffer, "%d,%d,%d", Color.R, Color.G, Color.B); buffer.Format(_T("%d,%d,%d"), (int)Color.R, (int)Color.G, (int)Color.B);
SetWindowText(buffer); SetWindowText(buffer);
Invalidate (); Invalidate ();
@ -160,8 +160,8 @@ void CColorWnd::colorChanged ()
updateEdit(); updateEdit();
Invalidate (); Invalidate ();
char buffer[256]; CString buffer;
sprintf(buffer, "%d,%d,%d", Color.R, Color.G, Color.B); buffer.Format(_T("%d,%d,%d"), (int)Color.R, (int)Color.G, (int)Color.B);
SetWindowText(buffer); SetWindowText(buffer);
CWnd *wnd = GetParent (); CWnd *wnd = GetParent ();
@ -174,7 +174,7 @@ void CColorWnd::colorChanged ()
void CColorWnd::updateEdit() void CColorWnd::updateEdit()
{ {
char buffer[256]; CString buffer;
sprintf(buffer, "%d,%d,%d", Color.R, Color.G, Color.B); buffer.Format(_T("%d,%d,%d"), (int)Color.R, (int)Color.G, (int)Color.B);
pEdit->SetWindowText(buffer); pEdit->SetWindowText(buffer);
} }

@ -96,7 +96,7 @@ BOOL CDfnDialog::OnInitDialog()
setListSize (currentPos, SmallWidget, ParentHeight); setListSize (currentPos, SmallWidget, ParentHeight);
Parents.create (WS_TABSTOP, currentPos, this, LtParents); Parents.create (WS_TABSTOP, currentPos, this, LtParents);
Parents.insertColumn (0, "Parent Dfn"); Parents.insertColumn (0, _T("Parent Dfn"));
Parents.Dialog = this; Parents.Dialog = this;
Parents.recalcColumn (); Parents.recalcColumn ();
initWidget (Parents); initWidget (Parents);
@ -111,11 +111,11 @@ BOOL CDfnDialog::OnInitDialog()
setListSize (currentPos, Width, DfnHeight); setListSize (currentPos, Width, DfnHeight);
Struct.create (WS_TABSTOP, currentPos, this, LtStruct); Struct.create (WS_TABSTOP, currentPos, this, LtStruct);
Struct.insertColumn (0, "Name"); Struct.insertColumn (0, _T("Name"));
Struct.insertColumn (1, "Type"); Struct.insertColumn (1, _T("Type"));
Struct.insertColumn (2, "Value"); Struct.insertColumn (2, _T("Value"));
Struct.insertColumn (3, "Default"); Struct.insertColumn (3, _T("Default"));
Struct.insertColumn (4, "FilenameExt"); Struct.insertColumn (4, _T("FilenameExt"));
Struct.Dialog = this; Struct.Dialog = this;
Struct.recalcColumn (); Struct.recalcColumn ();
initWidget (Struct); initWidget (Struct);
@ -342,7 +342,7 @@ void CDfnEditListCtrl::getMemComboBoxProp (uint item, uint subItem, std::string
if (subItem == 0) if (subItem == 0)
{ {
browse = false; browse = false;
regAdr = GEORGES_EDIT_BASE_REG_KEY"\\Label MemCombo"; regAdr = tStrToUtf8(GEORGES_EDIT_BASE_REG_KEY _T("\\Label MemCombo"));
} }
else if (subItem == 2) else if (subItem == 2)
{ {
@ -351,19 +351,19 @@ void CDfnEditListCtrl::getMemComboBoxProp (uint item, uint subItem, std::string
// Get type string // Get type string
string type = tStrToUtf8(ListCtrl.GetItemText (item, 1)); string type = tStrToUtf8(ListCtrl.GetItemText (item, 1));
if ((type == "Type") || (type == "Type array")) if ((type == "Type") || (type == "Type array"))
regAdr = GEORGES_EDIT_BASE_REG_KEY"\\Type MemCombo"; regAdr = tStrToUtf8(GEORGES_EDIT_BASE_REG_KEY _T("\\Type MemCombo"));
else if ((type == "Dfn") || (type == "Dfn array")) else if ((type == "Dfn") || (type == "Dfn array"))
regAdr = GEORGES_EDIT_BASE_REG_KEY"\\Dfn MemCombo"; regAdr = tStrToUtf8(GEORGES_EDIT_BASE_REG_KEY _T("\\Dfn MemCombo"));
} }
else if (subItem == 3) else if (subItem == 3)
{ {
browse = false; browse = false;
regAdr = GEORGES_EDIT_BASE_REG_KEY"\\Default MemCombo"; regAdr = tStrToUtf8(GEORGES_EDIT_BASE_REG_KEY _T("\\Default MemCombo"));
} }
else if (subItem == 3) else if (subItem == 3)
{ {
browse = false; browse = false;
regAdr = GEORGES_EDIT_BASE_REG_KEY"\\FilenameExt MemCombo"; regAdr = tStrToUtf8(GEORGES_EDIT_BASE_REG_KEY _T("\\FilenameExt MemCombo"));
} }
} }
@ -609,7 +609,7 @@ CEditListCtrl::TItemEdit CDfnParentEditListCtrl::getItemEditMode (uint item, uin
void CDfnParentEditListCtrl::getMemComboBoxProp (uint item, uint subItem, std::string &regAdr, bool &browse) void CDfnParentEditListCtrl::getMemComboBoxProp (uint item, uint subItem, std::string &regAdr, bool &browse)
{ {
browse = true; browse = true;
regAdr = GEORGES_EDIT_BASE_REG_KEY"\\Dfn MemCombo"; regAdr = tStrToUtf8(GEORGES_EDIT_BASE_REG_KEY _T("\\Dfn MemCombo"));
} }
// *************************************************************************** // ***************************************************************************

@ -45,7 +45,7 @@ bool CEditListCtrl::create (DWORD wStyle, RECT &rect, CWnd *parent, uint dialog_
LPCTSTR className = AfxRegisterWndClass( 0 ); LPCTSTR className = AfxRegisterWndClass( 0 );
// Create this window // Create this window
if (CWnd::Create (className, "empty", WS_CHILD|wStyle, rect, parent, dialog_index)) if (CWnd::Create (className, _T("empty"), WS_CHILD|wStyle, rect, parent, dialog_index))
{ {
RECT subRect; RECT subRect;
subRect.left = 0; subRect.left = 0;
@ -122,11 +122,11 @@ BOOL CEditListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
// Insert an item at the end // Insert an item at the end
string text; string text;
getNewItemText (ListCtrl.GetItemCount (), 0, text); getNewItemText (ListCtrl.GetItemCount (), 0, text);
ListCtrl.InsertItem (ListCtrl.GetItemCount (), text.c_str ()); ListCtrl.InsertItem (ListCtrl.GetItemCount (), utf8ToTStr(text));
for (uint i=1; i<ColumnCount; i++) for (uint i=1; i<ColumnCount; i++)
{ {
getNewItemText (ListCtrl.GetItemCount ()-1, i, text); getNewItemText (ListCtrl.GetItemCount ()-1, i, text);
ListCtrl.SetItemText (ListCtrl.GetItemCount ()-1, i, text.c_str ()); ListCtrl.SetItemText (ListCtrl.GetItemCount ()-1, i, utf8ToTStr(text));
} }
ListCtrl.SetItemState (ListCtrl.GetItemCount ()-1, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED); ListCtrl.SetItemState (ListCtrl.GetItemCount ()-1, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
@ -431,7 +431,7 @@ void CEditListCtrl::editItem (uint item, uint subitem)
{ {
// Move the editbox // Move the editbox
Edit.SetWindowPos (NULL, subItemRect.left, subItemRect.top, subItemRect.right-subItemRect.left, subItemRect.bottom-subItemRect.top, SWP_SHOWWINDOW); Edit.SetWindowPos (NULL, subItemRect.left, subItemRect.top, subItemRect.right-subItemRect.left, subItemRect.bottom-subItemRect.top, SWP_SHOWWINDOW);
char tmp[512]; TCHAR tmp[512];
ListCtrl.GetItemText (Item, SubItem, tmp, 512); ListCtrl.GetItemText (Item, SubItem, tmp, 512);
Edit.SetWindowText (tmp); Edit.SetWindowText (tmp);
Edit.SetSel( 0, -1); Edit.SetSel( 0, -1);
@ -440,7 +440,7 @@ void CEditListCtrl::editItem (uint item, uint subitem)
else if (editMode == EditFixedCombo) else if (editMode == EditFixedCombo)
{ {
// Get item string // Get item string
char tmp[512]; TCHAR tmp[512];
ListCtrl.GetItemText (Item, SubItem, tmp, 512); ListCtrl.GetItemText (Item, SubItem, tmp, 512);
// Get the combo string // Get the combo string
@ -450,8 +450,8 @@ void CEditListCtrl::editItem (uint item, uint subitem)
getComboBoxStrings (Item, SubItem, retStrings); getComboBoxStrings (Item, SubItem, retStrings);
for (uint i=0; i<retStrings.size (); i++) for (uint i=0; i<retStrings.size (); i++)
{ {
Combo.InsertString (-1, retStrings[i].c_str()); Combo.InsertString (-1, utf8ToTStr(retStrings[i]));
if (retStrings[i] == tmp) if (retStrings[i] == tStrToUtf8(tmp))
Combo.SetCurSel (i); Combo.SetCurSel (i);
} }
@ -465,7 +465,7 @@ void CEditListCtrl::editItem (uint item, uint subitem)
else if (editMode == EditMemCombo) else if (editMode == EditMemCombo)
{ {
// Get item string // Get item string
char tmp[512]; TCHAR tmp[512];
ListCtrl.GetItemText (Item, SubItem, tmp, 512); ListCtrl.GetItemText (Item, SubItem, tmp, 512);
// Get the combo strings // Get the combo strings
@ -508,7 +508,7 @@ void CEditListCtrl::OnSetFocus( CWnd* pOldWnd )
} }
} }
void CEditListCtrl::insertColumn (uint id, const char *name) void CEditListCtrl::insertColumn (uint id, const TCHAR *name)
{ {
ListCtrl.InsertColumn (id, name); ListCtrl.InsertColumn (id, name);
ColumnCount++; ColumnCount++;

@ -105,7 +105,7 @@ public:
void onCancel (); void onCancel ();
void editItem (uint item, uint subitem); void editItem (uint item, uint subitem);
void notifyParentChange (); void notifyParentChange ();
void insertColumn (uint id, const char*name); void insertColumn (uint id, const TCHAR* name);
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides

@ -38,7 +38,7 @@
// See georges_edit.cpp for the implementation of this class // See georges_edit.cpp for the implementation of this class
// //
#define GEORGES_EDIT_BASE_REG_KEY "Software\\Nevrax\\Georges Edit" #define GEORGES_EDIT_BASE_REG_KEY _T("Software\\Nevrax\\Georges Edit")
#define GEORGES_EDIT_BROWSE_LABEL "--- Browse..." #define GEORGES_EDIT_BROWSE_LABEL "--- Browse..."
extern const char* TypeFilter; extern const char* TypeFilter;

@ -223,7 +223,7 @@ BOOL CGeorgesEditDocForm::OnNewDocument()
string defFilename = theApp.RootSearchPath; string defFilename = theApp.RootSearchPath;
defFilename += "*.dfn"; defFilename += "*.dfn";
CFileDialog dlgFile (TRUE, "*.dfn", defFilename.c_str (), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, DfnFilter, theApp.m_pMainWnd); CFileDialog dlgFile (TRUE, _T("*.dfn"), defFilename.c_str (), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, DfnFilter, theApp.m_pMainWnd);
if (dlgFile.DoModal () == IDOK) if (dlgFile.DoModal () == IDOK)
{ {
if (initDocument (dlgFile.GetFileName (), true)) if (initDocument (dlgFile.GetFileName (), true))

@ -157,7 +157,7 @@ void CMemoryComboBox::pushString (const std::string &str)
if (RegCreateKey (HKEY_CURRENT_USER, RegisterAdress.c_str (), &hKey) == ERROR_SUCCESS) if (RegCreateKey (HKEY_CURRENT_USER, RegisterAdress.c_str (), &hKey) == ERROR_SUCCESS)
{ {
// Set the value // Set the value
RegSetValue (hKey, "0", REG_SZ, str.c_str (), str.size ()); RegSetValue (hKey, _T("0"), REG_SZ, str.c_str (), str.size ());
// Close // Close
RegCloseKey (hKey); RegCloseKey (hKey);
@ -366,14 +366,14 @@ void CMemoryComboBox::pushString ()
{ {
CString str; CString str;
GetWindowText (str); GetWindowText (str);
if (str != "") if (!str.IsEmpty())
{ {
// Look for an existing static // Look for an existing static
uint i; uint i;
for (i=0; i<StaticStrings.size(); i++) for (i=0; i<StaticStrings.size(); i++)
{ {
// Get the value // Get the value
if (StaticStrings[i] == (const char*)str) if (StaticStrings[i] == tStrToUtf8(str))
break; break;
} }
@ -388,7 +388,7 @@ void CMemoryComboBox::pushString ()
std::string value; std::string value;
if (getMemory (i, value)) if (getMemory (i, value))
{ {
if (value == (const char*)str) if (value == tStrToUtf8(str))
{ {
i++; i++;
break; break;
@ -401,7 +401,7 @@ void CMemoryComboBox::pushString ()
{ {
// String found ? // String found ?
scrollDown (0, i); scrollDown (0, i);
pushString ((const char*)str); pushString (tStrToUtf8(str));
} }
// Look for an existing value // Look for an existing value
@ -413,7 +413,7 @@ void CMemoryComboBox::pushString ()
if(_ComboBox.GetLBTextLen(i)>0) if(_ComboBox.GetLBTextLen(i)>0)
{ {
_ComboBox.GetLBText( i, value); _ComboBox.GetLBText( i, value);
if (value == (const char*)str) if (value == str)
break; break;
} }
} }
@ -443,7 +443,7 @@ void CMemoryComboBox::refreshStrings ()
int count = Commands.size(); int count = Commands.size();
for (i=0; i<StaticStrings.size(); i++) for (i=0; i<StaticStrings.size(); i++)
{ {
_ComboBox.InsertString (count, StaticStrings[i].c_str ()); _ComboBox.InsertString (count, utf8ToTStr(StaticStrings[i]));
count++; count++;
} }
@ -452,7 +452,7 @@ void CMemoryComboBox::refreshStrings ()
std::string ret; std::string ret;
if (getMemory (i, ret)) if (getMemory (i, ret))
{ {
_ComboBox.InsertString (count, ret.c_str ()); _ComboBox.InsertString (count, utf8ToTStr(ret));
count++; count++;
} }
} }
@ -460,7 +460,7 @@ void CMemoryComboBox::refreshStrings ()
// *************************************************************************** // ***************************************************************************
void CMemoryComboBox::setRegisterAdress (const char *registerAdress) void CMemoryComboBox::setRegisterAdress(const std::string &registerAdress)
{ {
RegisterAdress = registerAdress; RegisterAdress = registerAdress;
refreshStrings (); refreshStrings ();
@ -468,7 +468,7 @@ void CMemoryComboBox::setRegisterAdress (const char *registerAdress)
// *************************************************************************** // ***************************************************************************
void CMemoryComboBox::addCommand (const char* commandLabel, uint commandId) void CMemoryComboBox::addCommand (const std::string &commandLabel, uint commandId)
{ {
Commands.push_back (CCommand ()); Commands.push_back (CCommand ());
Commands[Commands.size()-1].Label = commandLabel; Commands[Commands.size()-1].Label = commandLabel;
@ -491,7 +491,7 @@ void CMemoryComboBox::clearCommand ()
void CMemoryComboBox::addLabelCommands (uint i) void CMemoryComboBox::addLabelCommands (uint i)
{ {
_ComboBox.InsertString (i, Commands[i].Label.c_str ()); _ComboBox.InsertString (i, utf8ToTStr(Commands[i].Label));
} }
// *************************************************************************** // ***************************************************************************
@ -576,12 +576,12 @@ LRESULT CMemoryComboBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
int curSel = _ComboBox.GetCurSel (); int curSel = _ComboBox.GetCurSel ();
if ((curSel == -1) || ((uint)curSel<Commands.size())) if ((curSel == -1) || ((uint)curSel<Commands.size()))
{ {
_ComboBox.GetWindowText ((char*)lParam, wParam); _ComboBox.GetWindowText ((TCHAR*)lParam, wParam);
return _ComboBox.GetWindowTextLength (); return _ComboBox.GetWindowTextLength ();
} }
else else
{ {
_ComboBox.GetLBText (curSel, (char*)lParam); _ComboBox.GetLBText (curSel, (TCHAR*)lParam);
return _ComboBox.GetLBTextLen (curSel); return _ComboBox.GetLBTextLen (curSel);
} }
} }
@ -678,11 +678,12 @@ BOOL CMemoryComboBox::PreTranslateMessage(MSG* pMsg)
{ {
CString str; CString str;
_ComboBox.GetWindowText (str); _ComboBox.GetWindowText (str);
string str2 = str;
if ((!str2.empty ()) && (str2.find ('.') == string::npos)) if ((!str.IsEmpty()) && (str.Find('.') == -1))
{ {
str2 += "." + _Extension; str += _T(".");
_ComboBox.SetWindowText (str2.c_str ()); str += utf8ToTStr(_Extension);
_ComboBox.SetWindowText (str);
} }
} }

@ -48,9 +48,9 @@ public:
void onCancel (); void onCancel ();
void create (DWORD style, const RECT &rect, CWnd *parent, UINT nId, const char *registerAdress, int memoryCount); void create (DWORD style, const RECT &rect, CWnd *parent, UINT nId, const char *registerAdress, int memoryCount);
void create (DWORD style, const RECT &rect, CWnd *parent, UINT nId); void create (DWORD style, const RECT &rect, CWnd *parent, UINT nId);
void setRegisterAdress (const char *registerAdress); void setRegisterAdress(const std::string &registerAdress);
void clearCommand (); void clearCommand ();
void addCommand (const char* commandLabel, uint commandId); void addCommand(const std::string &commandLabel, uint commandId);
void clearStaticStrings (); void clearStaticStrings ();
void addStaticStrings (const char* strings); void addStaticStrings (const char* strings);
uint getCommandCount () const; uint getCommandCount () const;

@ -466,7 +466,7 @@ void CMemoryComboBox::refreshStrings ()
// *************************************************************************** // ***************************************************************************
void CMemoryComboBox::setRegisterAdress (const char *registerAdress) void CMemoryComboBox::setRegisterAdress(const std::string &registerAdress)
{ {
RegisterAdress = registerAdress; RegisterAdress = registerAdress;
refreshStrings (); refreshStrings ();
@ -474,7 +474,7 @@ void CMemoryComboBox::setRegisterAdress (const char *registerAdress)
// *************************************************************************** // ***************************************************************************
void CMemoryComboBox::addCommand (const char* commandLabel, uint commandId) void CMemoryComboBox::addCommand(const std::string &commandLabel, uint commandId)
{ {
Commands.push_back (CCommand ()); Commands.push_back (CCommand ());
Commands[Commands.size()-1].Label = commandLabel; Commands[Commands.size()-1].Label = commandLabel;

@ -47,9 +47,9 @@ public:
void onCancel (); void onCancel ();
void create (DWORD style, const RECT &rect, CWnd *parent, UINT nId, const TCHAR *registerAdress, int memoryCount); void create (DWORD style, const RECT &rect, CWnd *parent, UINT nId, const TCHAR *registerAdress, int memoryCount);
void create (DWORD style, const RECT &rect, CWnd *parent, UINT nId); void create (DWORD style, const RECT &rect, CWnd *parent, UINT nId);
void setRegisterAdress (const char *registerAdress); void setRegisterAdress(const std::string &registerAdress);
void clearCommand (); void clearCommand ();
void addCommand (const char* commandLabel, uint commandId); void addCommand (const std::string &commandLabel, uint commandId);
void clearStaticStrings (); void clearStaticStrings ();
void addStaticStrings (const char* strings); void addStaticStrings (const char* strings);
uint getCommandCount () const; uint getCommandCount () const;

Loading…
Cancel
Save