Cleaning up unicode conversion

This commit is contained in:
kaetemi 2019-05-01 06:28:49 +08:00
parent 842deeaa69
commit cf370eb03c
48 changed files with 239 additions and 239 deletions

View file

@ -2644,7 +2644,7 @@ IDriver::TMessageBoxId CDriverGL::systemMessageBox (const char* message, const c
{ {
H_AUTO_OGL(CDriverGL_systemMessageBox) H_AUTO_OGL(CDriverGL_systemMessageBox)
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
switch (::MessageBoxW (NULL, utf8ToWide(message), utf8ToWide(title), ((type==retryCancelType)?MB_RETRYCANCEL: switch (::MessageBoxW(NULL, nlUtf8ToWide(message), nlUtf8ToWide(title), ((type == retryCancelType) ? MB_RETRYCANCEL :
(type==yesNoCancelType)?MB_YESNOCANCEL: (type==yesNoCancelType)?MB_YESNOCANCEL:
(type==okCancelType)?MB_OKCANCEL: (type==okCancelType)?MB_OKCANCEL:
(type==abortRetryIgnoreType)?MB_ABORTRETRYIGNORE: (type==abortRetryIgnoreType)?MB_ABORTRETRYIGNORE:

View file

@ -226,7 +226,7 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD
*/ */
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
wchar_t buffer[1024], *ptr; wchar_t buffer[1024], *ptr;
uint len = SearchPathW (NULL, utf8ToWide(dllName), NULL, 1023, buffer, &ptr); uint len = SearchPathW (NULL, nlUtf8ToWide(dllName), NULL, 1023, buffer, &ptr);
if( len ) if( len )
nlinfo ("Using the library '%s' that is in the directory: '%s'", dllName.c_str(), wideToUtf8(buffer).c_str()); nlinfo ("Using the library '%s' that is in the directory: '%s'", dllName.c_str(), wideToUtf8(buffer).c_str());
#endif #endif

View file

@ -158,7 +158,7 @@ void CAnimationSetDlg::OnAddAnimation ()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox (nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION);
} }
} }
} }
@ -199,7 +199,7 @@ void CAnimationSetDlg::OnAddSkelWt()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
} }
@ -234,7 +234,7 @@ void CAnimationSetDlg::refresh (BOOL update)
for (i=0; i<_ObjView->getNumInstance (); i++) for (i=0; i<_ObjView->getNumInstance (); i++)
{ {
std::string name = NLMISC::CFile::getFilenameWithoutExtension(_ObjView->getInstance(i)->Saved.ShapeFilename); std::string name = NLMISC::CFile::getFilenameWithoutExtension(_ObjView->getInstance(i)->Saved.ShapeFilename);
EditedObject.InsertString (-1, utf8ToTStr(name)); EditedObject.InsertString(-1, nlUtf8ToTStr(name));
} }
// Get edited object // Get edited object
@ -268,7 +268,7 @@ void CAnimationSetDlg::refresh (BOOL update)
CAnimation *anim = object->AnimationSet.getAnimation (object->AnimationSet.getAnimationIdByName (name)); CAnimation *anim = object->AnimationSet.getAnimation (object->AnimationSet.getAnimationIdByName (name));
// Insert an intem // Insert an intem
HTREEITEM item=Tree.InsertItem(utf8ToTStr(name)); HTREEITEM item = Tree.InsertItem(nlUtf8ToTStr(name));
Tree.SetItemData (item, i); Tree.SetItemData (item, i);
nlassert (item!=NULL); nlassert (item!=NULL);
@ -279,7 +279,7 @@ void CAnimationSetDlg::refresh (BOOL update)
while (ite!=setString.end()) while (ite!=setString.end())
{ {
// Add this string // Add this string
HTREEITEM newItem = Tree.InsertItem (utf8ToTStr(*ite), item); HTREEITEM newItem = Tree.InsertItem(nlUtf8ToTStr(*ite), item);
Tree.SetItemData (newItem, 0xffffffff); Tree.SetItemData (newItem, 0xffffffff);
// Get the track // Get the track
@ -303,7 +303,7 @@ void CAnimationSetDlg::refresh (BOOL update)
name = toString("%s (%f - %f)", typeid(*track).name(), track->getBeginTime(), track->getEndTime()); name = toString("%s (%f - %f)", typeid(*track).name(), track->getBeginTime(), track->getEndTime());
} }
HTREEITEM keyItem = Tree.InsertItem(utf8ToTStr(name), newItem); HTREEITEM keyItem = Tree.InsertItem(nlUtf8ToTStr(name), newItem);
Tree.SetItemData(keyItem, 0xffffffff); Tree.SetItemData(keyItem, 0xffffffff);
ite++; ite++;
@ -320,7 +320,7 @@ void CAnimationSetDlg::refresh (BOOL update)
CSkeletonWeight *swt = object->AnimationSet.getSkeletonWeight(object->AnimationSet.getSkeletonWeightIdByName(name)); CSkeletonWeight *swt = object->AnimationSet.getSkeletonWeight(object->AnimationSet.getSkeletonWeightIdByName(name));
// Insert an intem // Insert an intem
HTREEITEM item=SkelTree.InsertItem(utf8ToTStr(name)); HTREEITEM item = SkelTree.InsertItem(nlUtf8ToTStr(name));
nlassert (item!=NULL); nlassert (item!=NULL);
// Get number of node in this skeleton weight // Get number of node in this skeleton weight
@ -332,7 +332,7 @@ void CAnimationSetDlg::refresh (BOOL update)
std::string percent = toString("%s (%f%%)", swt->getNodeName(n).c_str(), swt->getNodeWeight(n)*100); std::string percent = toString("%s (%f%%)", swt->getNodeName(n).c_str(), swt->getNodeWeight(n)*100);
// Add this string // Add this string
SkelTree.InsertItem (utf8ToTStr(percent), item); SkelTree.InsertItem(nlUtf8ToTStr(percent), item);
} }
} }
@ -340,7 +340,7 @@ void CAnimationSetDlg::refresh (BOOL update)
for (i=0; i<object->Saved.PlayList.size(); i++) for (i=0; i<object->Saved.PlayList.size(); i++)
{ {
// Insert an intem // Insert an intem
int item=PlayList.InsertString (-1, utf8ToTStr(object->Saved.PlayList[i])); int item = PlayList.InsertString(-1, nlUtf8ToTStr(object->Saved.PlayList[i]));
nlassert (item!=LB_ERR); nlassert (item!=LB_ERR);
} }
} }

View file

@ -355,7 +355,7 @@ void CAttribDlg::init(HBITMAP bitmap, sint x, sint y, CWnd *pParent)
for (uint k = 0; k < getNumScheme(); ++k) for (uint k = 0; k < getNumScheme(); ++k)
{ {
m_Scheme.InsertString(k, utf8ToTStr(getSchemeName(k))); m_Scheme.InsertString(k, nlUtf8ToTStr(getSchemeName(k)));
} }

View file

@ -33,7 +33,7 @@ CChooseName::CChooseName(const CString &initialName, CWnd* pParent /*=NULL*/)
std::string CChooseName::getName() std::string CChooseName::getName()
{ {
return tStrToUtf8(m_Name); return NLMISC::tStrToUtf8(m_Name);
} }
void CChooseName::DoDataExchange(CDataExchange* pDX) void CChooseName::DoDataExchange(CDataExchange* pDX)

View file

@ -53,10 +53,10 @@ void CChoosePoolID::OnOK()
CString val; CString val;
GetDlgItem(IDC_POOL_ID)->GetWindowText(val); GetDlgItem(IDC_POOL_ID)->GetWindowText(val);
if (NLMISC::fromString(tStrToUtf8(val), PoolID)) if (NLMISC::fromString(NLMISC::tStrToUtf8(val), PoolID))
{ {
GetDlgItem(IDC_POOL_NAME)->GetWindowText(val); GetDlgItem(IDC_POOL_NAME)->GetWindowText(val);
Name = tStrToUtf8(val); Name = NLMISC::tStrToUtf8(val);
CDialog::OnOK(); CDialog::OnOK();
} }
else else
@ -71,8 +71,8 @@ BOOL CChoosePoolID::OnInitDialog()
std::string val = NLMISC::toString(PoolID); std::string val = NLMISC::toString(PoolID);
GetDlgItem(IDC_POOL_ID)->SetWindowText(utf8ToTStr(val)); GetDlgItem(IDC_POOL_ID)->SetWindowText(nlUtf8ToTStr(val));
GetDlgItem(IDC_POOL_NAME)->SetWindowText(utf8ToTStr(Name)); GetDlgItem(IDC_POOL_NAME)->SetWindowText(nlUtf8ToTStr(Name));
if (_FreezeID) if (_FreezeID)
{ {

View file

@ -72,7 +72,7 @@ BOOL CCreateFileDlg::OnInitDialog()
{ {
CDialog::OnInitDialog(); CDialog::OnInitDialog();
SetWindowText((LPCTSTR) _Title); SetWindowText((LPCTSTR) _Title);
GetDlgItem(IDC_LOCATION)->SetWindowText(utf8ToTStr(_DefaultBasePath)); GetDlgItem(IDC_LOCATION)->SetWindowText(nlUtf8ToTStr(_DefaultBasePath));
if (!_DefaultBasePath.empty()) if (!_DefaultBasePath.empty())
{ {
GetDlgItem(IDC_FILENAME)->SetFocus(); GetDlgItem(IDC_FILENAME)->SetFocus();
@ -90,10 +90,10 @@ void CCreateFileDlg::OnOK()
{ {
CString filename; CString filename;
GetDlgItem(IDC_FILENAME)->GetWindowText(filename); GetDlgItem(IDC_FILENAME)->GetWindowText(filename);
_Filename = tStrToUtf8(filename); _Filename = NLMISC::tStrToUtf8(filename);
CString location; CString location;
GetDlgItem(IDC_LOCATION)->GetWindowText(location); GetDlgItem(IDC_LOCATION)->GetWindowText(location);
_Path = tStrToUtf8(location); _Path = NLMISC::tStrToUtf8(location);
if (_Path.empty()) if (_Path.empty())
{ {
localizedMessageBox(*this, IDS_EMPTY_PATH, IDS_ERROR, MB_ICONEXCLAMATION); localizedMessageBox(*this, IDS_EMPTY_PATH, IDS_ERROR, MB_ICONEXCLAMATION);

View file

@ -173,7 +173,7 @@ void CDirectionAttr::OnDestroy()
void CDirectionAttr::OnGlobalDirection() void CDirectionAttr::OnGlobalDirection()
{ {
nlassert(_DirectionWrapper); nlassert(_DirectionWrapper);
CChooseName chooseName(utf8ToTStr(_DirectionWrapper->getGlobalVectorValueName())); CChooseName chooseName(nlUtf8ToTStr(_DirectionWrapper->getGlobalVectorValueName()));
if (chooseName.DoModal() == IDOK) if (chooseName.DoModal() == IDOK)
{ {

View file

@ -76,7 +76,7 @@ std::string CEditEx::getString() const
{ {
TCHAR buf[128]; TCHAR buf[128];
GetWindowText(buf, sizeof(buf)); GetWindowText(buf, sizeof(buf));
return tStrToUtf8(buf); return NLMISC::tStrToUtf8(buf);
} }
void CEditEx::setSInt(sint value) void CEditEx::setSInt(sint value)

View file

@ -89,7 +89,7 @@ bool CEditMorphMeshDlg::getShapeNameFromDlg(std::string &name)
NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName())); NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()));
*/ */
name = tStrToUtf8(fd.GetPathName()); name = NLMISC::tStrToUtf8(fd.GetPathName());
return true; return true;
} }
@ -123,7 +123,7 @@ void CEditMorphMeshDlg::OnAdd()
_CM->setShapes(&shapeNames[0], (uint)shapeNames.size()); _CM->setShapes(&shapeNames[0], (uint)shapeNames.size());
std::vector<sint> numVerts; std::vector<sint> numVerts;
_CM->getShapeNumVerts(numVerts); _CM->getShapeNumVerts(numVerts);
m_MeshList.AddString(utf8ToTStr(getShapeDescStr(index, numVerts[index]))); m_MeshList.AddString(nlUtf8ToTStr(getShapeDescStr(index, numVerts[index])));
GetDlgItem(IDC_REMOVE)->EnableWindow(TRUE); GetDlgItem(IDC_REMOVE)->EnableWindow(TRUE);
} }
touchPSState(); touchPSState();
@ -253,7 +253,7 @@ void CEditMorphMeshDlg::updateMeshList()
m_MeshList.ResetContent(); m_MeshList.ResetContent();
for (uint k = 0; k < _CM->getNumShapes(); ++k) for (uint k = 0; k < _CM->getNumShapes(); ++k)
{ {
m_MeshList.AddString(utf8ToTStr(getShapeDescStr(k, numVerts[k]))); m_MeshList.AddString(nlUtf8ToTStr(getShapeDescStr(k, numVerts[k])));
} }
m_MeshList.SetCurSel(0); m_MeshList.SetCurSel(0);
updateValidFlag(); updateValidFlag();
@ -310,12 +310,12 @@ std::string CEditMorphMeshDlg::getShapeDescStr(uint shapeIndex, sint numVerts) c
{ {
CString verts; CString verts;
verts.LoadString(IDS_VERTICES); verts.LoadString(IDS_VERTICES);
std::string msg = _CM->getShape(shapeIndex) + " (" + NLMISC::toString(numVerts) + " " + tStrToUtf8(verts) + ")"; std::string msg = _CM->getShape(shapeIndex) + " (" + NLMISC::toString(numVerts) + " " + NLMISC::tStrToUtf8(verts) + ")";
return msg; return msg;
} }
else else
{ {
std::string result = _CM->getShape(shapeIndex) + " (" + tStrToUtf8(CMeshDlg::getShapeErrorString(numVerts)) + ")"; std::string result = _CM->getShape(shapeIndex) + " (" + NLMISC::tStrToUtf8(CMeshDlg::getShapeErrorString(numVerts)) + ")";
return result; return result;
} }
} }

View file

@ -195,7 +195,7 @@ void CEditPSSound::OnChangeSoundName()
{ {
nlassert(_Sound); nlassert(_Sound);
UpdateData(); UpdateData();
_Sound->setSoundName(NLMISC::CSheetId(tStrToUtf8(m_SoundName), "sound")); _Sound->setSoundName(NLMISC::CSheetId(NLMISC::tStrToUtf8(m_SoundName), "sound"));
updateModifiedFlag(); updateModifiedFlag();
} }
@ -209,7 +209,7 @@ void CEditPSSound::OnSpawn()
// play the currently selected sound // play the currently selected sound
void CEditPSSound::OnPlaySound() void CEditPSSound::OnPlaySound()
{ {
CSoundSystem::play(tStrToUtf8(m_SoundName)); CSoundSystem::play(NLMISC::tStrToUtf8(m_SoundName));
} }
void CEditPSSound::OnMute() void CEditPSSound::OnMute()

View file

@ -317,7 +317,7 @@ inline void CEditableRangeT<float>::value2CString(float value, CString &dest)
inline const TCHAR *CEditableRangeT<float>::string2value(const CString &value, float &result) inline const TCHAR *CEditableRangeT<float>::string2value(const CString &value, float &result)
{ {
if (NLMISC::fromString(tStrToUtf8(value), result)) if (NLMISC::fromString(NLMISC::tStrToUtf8(value), result))
{ {
return NULL; return NULL;
} }
@ -344,7 +344,7 @@ inline void CEditableRangeT<uint32>::value2CString(uint32 value, CString &dest)
inline const TCHAR *CEditableRangeT<uint32>::string2value(const CString &value, uint32 &result) inline const TCHAR *CEditableRangeT<uint32>::string2value(const CString &value, uint32 &result)
{ {
sint32 tmp; sint32 tmp;
if (NLMISC::fromString(tStrToUtf8(value), tmp)) if (NLMISC::fromString(NLMISC::tStrToUtf8(value), tmp))
{ {
if (value.Find(_T("-")) > -1) if (value.Find(_T("-")) > -1)
{ {
@ -380,7 +380,7 @@ inline void CEditableRangeT<sint32>::value2CString(sint32 value, CString &dest)
inline const TCHAR *CEditableRangeT<sint32>::string2value(const CString &value, sint32 &result) inline const TCHAR *CEditableRangeT<sint32>::string2value(const CString &value, sint32 &result)
{ {
sint32 tmp; sint32 tmp;
if (NLMISC::fromString(tStrToUtf8(value), tmp)) if (NLMISC::fromString(NLMISC::tStrToUtf8(value), tmp))
{ {
result = tmp; result = tmp;
return NULL; return NULL;

View file

@ -85,7 +85,7 @@ void CEmitterDlg::initEmittedType()
NL3D::CPSLocated *loc = dynamic_cast<NL3D::CPSLocated *>(ps->getProcess(k)); NL3D::CPSLocated *loc = dynamic_cast<NL3D::CPSLocated *>(ps->getProcess(k));
if (loc) // is this a located if (loc) // is this a located
{ {
m_EmittedTypeCtrl.AddString(utf8ToTStr(loc->getName())); m_EmittedTypeCtrl.AddString(nlUtf8ToTStr(loc->getName()));
_LocatedList.push_back(loc); _LocatedList.push_back(loc);
if (loc == _Emitter->getEmittedType()) if (loc == _Emitter->getEmittedType())
{ {

View file

@ -119,7 +119,7 @@ void CLBExternIDDlg::OnChangeIdValue()
TCHAR buf[6]; TCHAR buf[6];
::memset(buf, 0, 6); ::memset(buf, 0, 6);
GetDlgItem(IDC_ID_VALUE)->GetWindowText(buf, 6); GetDlgItem(IDC_ID_VALUE)->GetWindowText(buf, 6);
_ID = StringToID(tStrToUtf8(buf).c_str()); _ID = StringToID(NLMISC::tStrToUtf8(buf).c_str());
if (_ID) if (_ID)
{ {
GetDlgItem(IDOK)->EnableWindow(TRUE); GetDlgItem(IDOK)->EnableWindow(TRUE);

View file

@ -114,7 +114,7 @@ void CLocatedBindableDialog::init(CParticleDlg* pParent)
// z-test // z-test
((CButton *) GetDlgItem(IDC_ZTEST))->SetCheck(material->isZTestEnabled() ? BST_CHECKED : BST_UNCHECKED); ((CButton *) GetDlgItem(IDC_ZTEST))->SetCheck(material->isZTestEnabled() ? BST_CHECKED : BST_UNCHECKED);
// z-bias // z-bias
GetDlgItem(IDC_ZBIAS)->SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", -material->getZBias()))); GetDlgItem(IDC_ZBIAS)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", -material->getZBias())));
} }
else else
{ {

View file

@ -322,7 +322,7 @@ void CLocatedProperties::goPostRender()
_MaxNbParticles->update(); _MaxNbParticles->update();
} }
// in all cases, show the current number of particles being used // in all cases, show the current number of particles being used
GetDlgItem(IDC_CURR_NUM_PARTS)->SetWindowText(utf8ToTStr(NLMISC::toString(_Located->getSize()))); GetDlgItem(IDC_CURR_NUM_PARTS)->SetWindowText(nlUtf8ToTStr(NLMISC::toString(_Located->getSize())));
} }
//**************************************************************************************************************** //****************************************************************************************************************

View file

@ -112,7 +112,7 @@ void CLocatedTargetDlg::OnAddTarget()
nlassert(loc); nlassert(loc);
_LBTarget->attachTarget(loc); _LBTarget->attachTarget(loc);
m_AvailableTargets.DeleteString(indexs[k] - k); m_AvailableTargets.DeleteString(indexs[k] - k);
int l = m_Targets.AddString(utf8ToTStr(loc->getName())); int l = m_Targets.AddString(nlUtf8ToTStr(loc->getName()));
m_Targets.SetItemData(l, (DWORD_PTR) loc); m_Targets.SetItemData(l, (DWORD_PTR) loc);
} }
UpdateData(FALSE); UpdateData(FALSE);
@ -135,7 +135,7 @@ void CLocatedTargetDlg::OnRemoveTarget()
nlassert(loc); nlassert(loc);
_LBTarget->detachTarget(loc); _LBTarget->detachTarget(loc);
m_Targets.DeleteString(indexs[k] - k); m_Targets.DeleteString(indexs[k] - k);
int l = m_AvailableTargets.AddString(utf8ToTStr(loc->getName())); int l = m_AvailableTargets.AddString(nlUtf8ToTStr(loc->getName()));
m_AvailableTargets.SetItemData(l, (DWORD_PTR) loc); m_AvailableTargets.SetItemData(l, (DWORD_PTR) loc);
} }
@ -159,7 +159,7 @@ BOOL CLocatedTargetDlg::OnInitDialog()
// fill the box thta tells us what the target are // fill the box thta tells us what the target are
for(k = 0; k < nbTarg; ++k) for(k = 0; k < nbTarg; ++k)
{ {
m_Targets.AddString(utf8ToTStr(_LBTarget->getTarget(k)->getName())); m_Targets.AddString(nlUtf8ToTStr(_LBTarget->getTarget(k)->getName()));
m_Targets.SetItemData(k, (DWORD_PTR) _LBTarget->getTarget(k)); m_Targets.SetItemData(k, (DWORD_PTR) _LBTarget->getTarget(k));
targetSet.insert(_LBTarget->getTarget(k)); targetSet.insert(_LBTarget->getTarget(k));
}; };
@ -179,7 +179,7 @@ BOOL CLocatedTargetDlg::OnInitDialog()
{ {
if (targetSet.find(loc) == targetSet.end()) if (targetSet.find(loc) == targetSet.end())
{ {
int l = m_AvailableTargets.AddString(utf8ToTStr(loc->getName())); int l = m_AvailableTargets.AddString(nlUtf8ToTStr(loc->getName()));
m_AvailableTargets.SetItemData(l, (DWORD_PTR) loc); m_AvailableTargets.SetItemData(l, (DWORD_PTR) loc);
} }
} }

View file

@ -592,7 +592,7 @@ void CMainFrame::OnFileLoadconfig()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
else else
@ -764,7 +764,7 @@ void CMainFrame::OnFileSaveconfig()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
else else
@ -1443,7 +1443,7 @@ void CMainFrame::OnUpdateSceneCamera(CCmdUI* pCmdUI)
CInstanceInfo *instance = ObjView->getInstance (ObjView->getCameraInstance (pCmdUI->m_nID - ID_SCENE_CAMERA_FIRST)); CInstanceInfo *instance = ObjView->getInstance (ObjView->getCameraInstance (pCmdUI->m_nID - ID_SCENE_CAMERA_FIRST));
nlassert (instance->Camera); nlassert (instance->Camera);
std::string text = NLMISC::toString("Camera %s", instance->Saved.ShapeFilename.c_str()); std::string text = NLMISC::toString("Camera %s", instance->Saved.ShapeFilename.c_str());
pCmdUI->SetText(utf8ToTStr(text)); pCmdUI->SetText(nlUtf8ToTStr(text));
} }
else else
{ {

View file

@ -94,7 +94,7 @@ void CMeshDlg::OnBrowseShape()
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
// Add to the path // Add to the path
std::string fullPath = tStrToUtf8(fd.GetPathName()); std::string fullPath = NLMISC::tStrToUtf8(fd.GetPathName());
std::string fname = NLMISC::CFile::getFilenameWithoutExtension(fullPath); std::string fname = NLMISC::CFile::getFilenameWithoutExtension(fullPath);
std::string ext = NLMISC::CFile::getExtension(fullPath); std::string ext = NLMISC::CFile::getExtension(fullPath);
@ -104,12 +104,12 @@ void CMeshDlg::OnBrowseShape()
try try
{ {
_ShapeParticle->setShape(fname + "." + ext); _ShapeParticle->setShape(fname + "." + ext);
m_ShapeName = utf8ToTStr(fname + "." + ext); m_ShapeName = nlUtf8ToTStr(fname + "." + ext);
touchPSState(); touchPSState();
} }
catch (const NLMISC::Exception &e) catch (const NLMISC::Exception &e)
{ {
MessageBox(utf8ToTStr(e.what()), _T("shape loading error")); MessageBox(nlUtf8ToTStr(e.what()), _T("shape loading error"));
} }
updateMeshErrorString(); updateMeshErrorString();
@ -159,7 +159,7 @@ void CMeshDlg::updateForMorph()
GetDlgItem(IDC_SHAPE_NAME)->EnableWindow(!enable); GetDlgItem(IDC_SHAPE_NAME)->EnableWindow(!enable);
if (!enable) if (!enable)
{ {
m_ShapeName = utf8ToTStr(cm->getShape()); m_ShapeName = nlUtf8ToTStr(cm->getShape());
} }
else else
{ {

View file

@ -165,19 +165,19 @@ void CMultiTexDlg::readValues(bool alternate)
char buf[128]; char buf[128];
if (!alternate) if (!alternate)
{ {
GetDlgItem(IDC_U_SPEED_1)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).x))); GetDlgItem(IDC_U_SPEED_1)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).x)));
GetDlgItem(IDC_V_SPEED_1)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).y))); GetDlgItem(IDC_V_SPEED_1)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(0).y)));
GetDlgItem(IDC_U_SPEED_2)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).x))); GetDlgItem(IDC_U_SPEED_2)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).x)));
GetDlgItem(IDC_V_SPEED_2)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).y))); GetDlgItem(IDC_V_SPEED_2)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getScrollSpeed(1).y)));
} }
else else
{ {
if (_MTP->isAlternateTexEnabled()) if (_MTP->isAlternateTexEnabled())
{ {
GetDlgItem(IDC_U_SPEED_1_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).x))); GetDlgItem(IDC_U_SPEED_1_ALTERNATE)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).x)));
GetDlgItem(IDC_V_SPEED_1_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).y))); GetDlgItem(IDC_V_SPEED_1_ALTERNATE)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(0).y)));
GetDlgItem(IDC_U_SPEED_2_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).x))); GetDlgItem(IDC_U_SPEED_2_ALTERNATE)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).x)));
GetDlgItem(IDC_V_SPEED_2_ALTERNATE)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).y))); GetDlgItem(IDC_V_SPEED_2_ALTERNATE)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getAlternateScrollSpeed(1).y)));
} }
else else
{ {
@ -188,7 +188,7 @@ void CMultiTexDlg::readValues(bool alternate)
} }
} }
GetDlgItem(IDC_BUMP_FACTOR)->SetWindowText(utf8ToTStr(NLMISC::toString("%.3f", _MTP->getBumpFactor()))); GetDlgItem(IDC_BUMP_FACTOR)->SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.3f", _MTP->getBumpFactor())));
} }

View file

@ -535,7 +535,7 @@ void CObjectViewer::loadConfigFile()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
::MessageBox (NULL, utf8ToTStr(e.what()), _T("Objectviewer.cfg"), MB_OK|MB_ICONEXCLAMATION); ::MessageBox(NULL, nlUtf8ToTStr(e.what()), _T("Objectviewer.cfg"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
@ -823,7 +823,7 @@ bool CObjectViewer::initUI (HWND parent)
catch (const NLMISC::EStream &e) catch (const NLMISC::EStream &e)
{ {
std::string msg = toString("Unable to load the default scheme bank file : %s", e.what()); std::string msg = toString("Unable to load the default scheme bank file : %s", e.what());
::MessageBox(NULL, utf8ToTStr(msg), _T("Object Viewer"), MB_ICONEXCLAMATION); ::MessageBox(NULL, nlUtf8ToTStr(msg), _T("Object Viewer"), MB_ICONEXCLAMATION);
} }
} }
iF.close(); iF.close();
@ -840,7 +840,7 @@ bool CObjectViewer::initUI (HWND parent)
catch (const Exception& e) catch (const Exception& e)
{ {
std::string msg = toString("Error while loading default.ovcgf : %s", e.what()); std::string msg = toString("Error while loading default.ovcgf : %s", e.what());
::MessageBox (NULL, utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); ::MessageBox(NULL, nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
@ -1312,7 +1312,7 @@ void CObjectViewer::go ()
); );
// Display // Display
_MainFrame->StatusBar.SetWindowText (utf8ToTStr(msgBar)); _MainFrame->StatusBar.SetWindowText(nlUtf8ToTStr(msgBar));
// Display Vegetable info. // Display Vegetable info.
if(_VegetableDlg!=NULL) if(_VegetableDlg!=NULL)
@ -1794,7 +1794,7 @@ void CObjectViewer::serial (NLMISC::IStream& f)
{ {
// Error message // Error message
std::string message = toString("File not found %s", readed[i].ShapeFilename.c_str()); std::string message = toString("File not found %s", readed[i].ShapeFilename.c_str());
_MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(message), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
// Stop loading // Stop loading
break; break;
@ -1829,7 +1829,7 @@ void CObjectViewer::serial (NLMISC::IStream& f)
{ {
// Error message // Error message
std::string message = toString("Error loading shape %s: %s", readed[i].ShapeFilename.c_str(), e.what()); std::string message = toString("Error loading shape %s: %s", readed[i].ShapeFilename.c_str(), e.what());
_MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(message), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
// Stop loading // Stop loading
break; break;
@ -1899,7 +1899,7 @@ bool CObjectViewer::loadInstanceGroup(const std::string &igFilename)
{ {
// clean // clean
delete ig; delete ig;
_MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
return false; return false;
} }
} }
@ -1907,7 +1907,7 @@ bool CObjectViewer::loadInstanceGroup(const std::string &igFilename)
{ {
// Create a message // Create a message
std::string msg = toString("Can't open the file %s for reading.", igFilename.c_str()); std::string msg = toString("Can't open the file %s for reading.", igFilename.c_str());
_MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
return false; return false;
} }
@ -1962,7 +1962,7 @@ bool CObjectViewer::loadMesh (std::vector<std::string> &meshFilename, const std:
} }
catch (const Exception& e) catch (const Exception& e)
{ {
_MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
// error // error
skelError=true; skelError=true;
@ -1972,7 +1972,7 @@ bool CObjectViewer::loadMesh (std::vector<std::string> &meshFilename, const std:
{ {
// Create a message // Create a message
std::string msg = NLMISC::toString("Can't open the file %s for reading.", skeleton.c_str()); std::string msg = NLMISC::toString("Can't open the file %s for reading.", skeleton.c_str());
_MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
// error // error
skelError=true; skelError=true;
@ -2015,7 +2015,7 @@ bool CObjectViewer::loadMesh (std::vector<std::string> &meshFilename, const std:
} }
catch (const Exception& e) catch (const Exception& e)
{ {
_MainFrame->MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
continue; continue;
} }
} }
@ -2023,7 +2023,7 @@ bool CObjectViewer::loadMesh (std::vector<std::string> &meshFilename, const std:
{ {
// Create a message // Create a message
std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str()); std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str());
_MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
continue; continue;
} }
@ -2848,7 +2848,7 @@ void CObjectViewer::enableDynamicObjectLightingTest(NLPACS::CGlobalRetriever *gl
if (!_ObjectLightTestShape.empty()) if (!_ObjectLightTestShape.empty())
{ {
string str= string("Path not found for Light Test Shape: ") + _ObjectLightTestShape; string str= string("Path not found for Light Test Shape: ") + _ObjectLightTestShape;
::MessageBox(NULL, utf8ToTStr(str.c_str()), _T("Dynamic Object Light Test"), MB_OK|MB_ICONEXCLAMATION); ::MessageBox(NULL, nlUtf8ToTStr(str.c_str()), _T("Dynamic Object Light Test"), MB_OK | MB_ICONEXCLAMATION);
} }
// disable. // disable.
_ObjectLightTest= NULL; _ObjectLightTest= NULL;
@ -3223,7 +3223,7 @@ bool CObjectViewer::createVegetableLandscape()
// close the progress dialog // close the progress dialog
dlgProgress.DestroyWindow(); dlgProgress.DestroyWindow();
MessageBox(_MainFrame->m_hWnd, utf8ToTStr(e.what()), _T("Failed to Load landscape"), MB_OK | MB_APPLMODAL); MessageBox(_MainFrame->m_hWnd, nlUtf8ToTStr(e.what()), _T("Failed to Load landscape"), MB_OK | MB_APPLMODAL);
// remove first possibly created collisions objects. // remove first possibly created collisions objects.
if(_VegetableCollisionEntity) if(_VegetableCollisionEntity)
@ -3557,7 +3557,7 @@ void CObjectViewer::loadAnimation(const std::string &fileName, uint instance)
{ {
// Create a message // Create a message
std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str()); std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str());
_MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
@ -3587,7 +3587,7 @@ void CObjectViewer::loadSWT (const std::string &fileName, uint instance)
{ {
// Create a message // Create a message
std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str()); std::string msg = NLMISC::toString("Can't open the file %s for reading.", fileName.c_str());
_MainFrame->MessageBox (utf8ToTStr(msg), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(msg), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
@ -3771,14 +3771,14 @@ void CObjectViewer::shootScene()
else else
{ {
std::string message = toString("Can't open the file %s for writing.", filenamefinal.c_str()); std::string message = toString("Can't open the file %s for writing.", filenamefinal.c_str());
_MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(message), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
break; break;
} }
} }
catch (const Exception &e) catch (const Exception &e)
{ {
std::string message = toString("Error during writing of the file %s: %s", filenamefinal.c_str(), e.what()); std::string message = toString("Error during writing of the file %s: %s", filenamefinal.c_str(), e.what());
_MainFrame->MessageBox (utf8ToTStr(message), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); _MainFrame->MessageBox(nlUtf8ToTStr(message), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
break; break;
} }
} }

View file

@ -428,7 +428,7 @@ bool CParticleDlg::savePSAs(HWND parent, CParticleWorkspace::CNode &psNode ,cons
} }
else else
{ {
::MessageBox(parent, utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); ::MessageBox(parent, nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION);
return false; return false;
} }
} }
@ -474,7 +474,7 @@ bool CParticleDlg::loadPS(HWND parent, CParticleWorkspace::CNode &psNode, TLoadP
{ {
case Silent: return false; // no op case Silent: return false; // no op
case ReportError: case ReportError:
::MessageBox(parent, utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); ::MessageBox(parent, nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK | MB_ICONEXCLAMATION);
return true; return true;
break; break;
case ReportErrorSkippable: case ReportErrorSkippable:
@ -549,7 +549,7 @@ void CParticleDlg::OnCreateNewPsWorkspace()
} }
catch(const NLMISC::EStream &e) catch(const NLMISC::EStream &e)
{ {
MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION);
} }
closeWorkspace(); closeWorkspace();
_PW = newPW; _PW = newPW;
@ -567,7 +567,7 @@ void CParticleDlg::OnLoadPSWorkspace()
CFileDialog fd( TRUE, _T(".pws"), _T("*.pws"), 0, szFilter); CFileDialog fd( TRUE, _T(".pws"), _T("*.pws"), 0, szFilter);
INT_PTR result = fd.DoModal(); INT_PTR result = fd.DoModal();
if (result != IDOK) return; if (result != IDOK) return;
loadWorkspace(tStrToUtf8(fd.GetPathName())); loadWorkspace(NLMISC::tStrToUtf8(fd.GetPathName()));
} }
//************************************************************************************************************************** //**************************************************************************************************************************
@ -585,7 +585,7 @@ void CParticleDlg::loadWorkspace(const std::string &fullPath)
} }
catch(const NLMISC::EStream &e) catch(const NLMISC::EStream &e)
{ {
MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_ICONEXCLAMATION);
setStatusBarText(CString(e.what())); setStatusBarText(CString(e.what()));
return; return;
} }
@ -635,7 +635,7 @@ void CParticleDlg::saveWorkspaceStructure()
} }
catch(const NLMISC::EStream &e) catch(const NLMISC::EStream &e)
{ {
localizedMessageBox(*this, utf8ToTStr(e.what()), IDS_ERROR, MB_ICONEXCLAMATION); localizedMessageBox(*this, nlUtf8ToTStr(e.what()), IDS_ERROR, MB_ICONEXCLAMATION);
setStatusBarText(CString(e.what())); setStatusBarText(CString(e.what()));
} }
} }

View file

@ -213,7 +213,7 @@ HTREEITEM CParticleTreeCtrl::buildTreeFromPS(CParticleWorkspace::CNode &node, H
if (node.isLoaded()) if (node.isLoaded())
{ {
// bind particle system icon // bind particle system icon
HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, utf8ToTStr(computeCaption(node)), PSIconParticleSystem, PSIconParticleSystem, 0, 0, NULL, rootHandle, prevSibling); HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, nlUtf8ToTStr(computeCaption(node)), PSIconParticleSystem, PSIconParticleSystem, 0, 0, NULL, rootHandle, prevSibling);
// set the param (doesn't seems to work during first creation) // set the param (doesn't seems to work during first creation)
SetItemData(psRoot, (LPARAM) nt); SetItemData(psRoot, (LPARAM) nt);
// now, create each located // now, create each located
@ -228,7 +228,7 @@ HTREEITEM CParticleTreeCtrl::buildTreeFromPS(CParticleWorkspace::CNode &node, H
else else
{ {
// bind a bitmap that say that the PS hasn't been loaded // bind a bitmap that say that the PS hasn't been loaded
HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, utf8ToTStr(computeCaption(node)), PSIconParticleSystemNotLoaded, PSIconParticleSystemNotLoaded, 0, 0, NULL, rootHandle, prevSibling); HTREEITEM psRoot = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, nlUtf8ToTStr(computeCaption(node)), PSIconParticleSystemNotLoaded, PSIconParticleSystemNotLoaded, 0, 0, NULL, rootHandle, prevSibling);
SetItemData(psRoot, (LPARAM) nt); SetItemData(psRoot, (LPARAM) nt);
return psRoot; return psRoot;
} }
@ -242,7 +242,7 @@ void CParticleTreeCtrl::buildTreeFromWorkSpace(CParticleWorkspace &ws)
CNodeType *nt = new CNodeType(&ws); CNodeType *nt = new CNodeType(&ws);
_NodeTypes.push_back(nt); _NodeTypes.push_back(nt);
// bind particle system icon // bind particle system icon
HTREEITEM rootHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, utf8ToTStr(computeCaption(ws)), PSIconWorkspace, PSIconWorkspace, 0, 0, NULL, NULL, TVI_LAST); HTREEITEM rootHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_TEXT, nlUtf8ToTStr(computeCaption(ws)), PSIconWorkspace, PSIconWorkspace, 0, 0, NULL, NULL, TVI_LAST);
// set the param (doesn't seems to work during first creation) // set the param (doesn't seems to work during first creation)
SetItemData(rootHandle, (LPARAM) nt); SetItemData(rootHandle, (LPARAM) nt);
// now, create each particle system // now, create each particle system
@ -259,7 +259,7 @@ void CParticleTreeCtrl::createNodeFromLocated(NL3D::CPSLocated *loc, HTREEITEM
CNodeType *nt = new CNodeType(loc); CNodeType *nt = new CNodeType(loc);
_NodeTypes.push_back(nt); _NodeTypes.push_back(nt);
// bind located icon // bind located icon
HTREEITEM nodeHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM |TVIF_TEXT, utf8ToTStr(loc->getName()) , PSIconLocated, PSIconLocated, 0, 0, (LPARAM) nt, rootHandle, TVI_LAST); HTREEITEM nodeHandle = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, nlUtf8ToTStr(loc->getName()), PSIconLocated, PSIconLocated, 0, 0, (LPARAM)nt, rootHandle, TVI_LAST);
// now, insert each object that is bound to the located // now, insert each object that is bound to the located
for (uint l = 0; l < loc->getNbBoundObjects(); ++l) for (uint l = 0; l < loc->getNbBoundObjects(); ++l)
{ {
@ -273,7 +273,7 @@ void CParticleTreeCtrl::createNodeFromLocatedBindable(NL3D::CPSLocatedBindable *
// we ordered the image so that they match the type for a located bindable (force, particles, collision zones...) // we ordered the image so that they match the type for a located bindable (force, particles, collision zones...)
CNodeType *nt = new CNodeType(lb); CNodeType *nt = new CNodeType(lb);
_NodeTypes.push_back(nt); _NodeTypes.push_back(nt);
InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT , utf8ToTStr(lb->getName()) , lb->getType(), lb->getType(), PSIconForce, PSIconForce, (LPARAM) nt, rootHandle, TVI_LAST); InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, nlUtf8ToTStr(lb->getName()), lb->getType(), lb->getType(), PSIconForce, PSIconForce, (LPARAM)nt, rootHandle, TVI_LAST);
} }
@ -1004,7 +1004,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
nlassert(ownerNode); nlassert(ownerNode);
// Add search path for the texture // Add search path for the texture
NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName())));
CUniquePtr<NL3D::CShapeBank> sb(new NL3D::CShapeBank); CUniquePtr<NL3D::CShapeBank> sb(new NL3D::CShapeBank);
CParticleSystemModel *psm = NULL; CParticleSystemModel *psm = NULL;
@ -1012,9 +1012,9 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
{ {
NL3D::CShapeStream ss; NL3D::CShapeStream ss;
NLMISC::CIFile inputFile; NLMISC::CIFile inputFile;
inputFile.open(tStrToUtf8(fd.GetPathName())); inputFile.open(NLMISC::tStrToUtf8(fd.GetPathName()));
ss.serial(inputFile); ss.serial(inputFile);
std::string shapeName = NLMISC::CFile::getFilename(tStrToUtf8(fd.GetPathName())); std::string shapeName = NLMISC::CFile::getFilename(NLMISC::tStrToUtf8(fd.GetPathName()));
sb->add(shapeName, ss.getShapePointer()); sb->add(shapeName, ss.getShapePointer());
NL3D::CShapeBank *oldSB = CNELU::Scene->getShapeBank(); NL3D::CShapeBank *oldSB = CNELU::Scene->getShapeBank();
CNELU::Scene->setShapeBank(sb.get()); CNELU::Scene->setShapeBank(sb.get());
@ -1039,7 +1039,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
} }
catch(const NLMISC::EStream &e) catch(const NLMISC::EStream &e)
{ {
MessageBox(utf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), getStrRsc(IDS_ERROR), MB_OK | MB_ICONEXCLAMATION);
return TRUE; return TRUE;
} }
ownerNode->setResetAutoCountFlag(false); ownerNode->setResetAutoCountFlag(false);
@ -1096,10 +1096,10 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
_ParticleDlg->StartStopDlg->stop(); _ParticleDlg->StartStopDlg->stop();
std::string fileName = nt->PS->getFilename(); std::string fileName = nt->PS->getFilename();
static TCHAR BASED_CODE szFilter[] = _T("ps & shapes files(*.ps;*.shape)|*.ps; *.shape||"); static TCHAR BASED_CODE szFilter[] = _T("ps & shapes files(*.ps;*.shape)|*.ps; *.shape||");
CFileDialog fd(FALSE, _T(".ps"), utf8ToTStr(fileName), OFN_OVERWRITEPROMPT, szFilter, this); CFileDialog fd(FALSE, _T(".ps"), nlUtf8ToTStr(fileName), OFN_OVERWRITEPROMPT, szFilter, this);
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
_ParticleDlg->savePSAs(*this, *nt->PS, tStrToUtf8(fd.GetPathName()), false); _ParticleDlg->savePSAs(*this, *nt->PS, NLMISC::tStrToUtf8(fd.GetPathName()), false);
} }
} }
} }
@ -1249,7 +1249,7 @@ BOOL CParticleTreeCtrl::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHA
} }
getOwnerNode(nt)->setModified(true); getOwnerNode(nt)->setModified(true);
// TODO : an enum for CPSLocatedBindable::getType would be better... // TODO : an enum for CPSLocatedBindable::getType would be better...
InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, utf8ToTStr(toCreate->getName()), toCreate->getType(), toCreate->getType(), 0, 0, (LPARAM) newNt, father, lastSon); InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, nlUtf8ToTStr(toCreate->getName()), toCreate->getType(), toCreate->getType(), 0, 0, (LPARAM)newNt, father, lastSon);
touchPSState(nt); touchPSState(nt);
Invalidate(); Invalidate();
_ParticleDlg->StartStopDlg->resetAutoCount(getOwnerNode(nt)); _ParticleDlg->StartStopDlg->resetAutoCount(getOwnerNode(nt));
@ -1280,7 +1280,7 @@ std::pair<CParticleTreeCtrl::CNodeType *, HTREEITEM> CParticleTreeCtrl::createL
CNodeType *newNt = new CNodeType(loc); CNodeType *newNt = new CNodeType(loc);
_NodeTypes.push_back(newNt); _NodeTypes.push_back(newNt);
// insert item in tree // insert item in tree
HTREEITEM insertedItem = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, utf8ToTStr(name), PSIconLocated, PSIconLocated, 0, 0, (LPARAM) newNt, headItem, TVI_LAST); HTREEITEM insertedItem = InsertItem(TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM | TVIF_TEXT, nlUtf8ToTStr(name), PSIconLocated, PSIconLocated, 0, 0, (LPARAM)newNt, headItem, TVI_LAST);
touchPSState(newNt); touchPSState(newNt);
return std::make_pair(newNt, insertedItem); return std::make_pair(newNt, insertedItem);
} }
@ -1299,7 +1299,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
{ {
case CNodeType::workspace: case CNodeType::workspace:
{ {
nt->WS->setName(tStrToUtf8(info->item.pszText)); nt->WS->setName(NLMISC::tStrToUtf8(info->item.pszText));
workspaceModifiedFlagChanged(*nt->WS); // change name (this may be called twice because of the modification callback, but this doesn't matter) workspaceModifiedFlagChanged(*nt->WS); // change name (this may be called twice because of the modification callback, but this doesn't matter)
} }
break; break;
@ -1311,10 +1311,10 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
} }
else else
{ {
nt->PS->getPSPointer()->setName(tStrToUtf8(info->item.pszText)); nt->PS->getPSPointer()->setName(NLMISC::tStrToUtf8(info->item.pszText));
nt->PS->setModified(true); nt->PS->setModified(true);
} }
this->SetItemText(info->item.hItem, utf8ToTStr(computeCaption(*nt->PS))); this->SetItemText(info->item.hItem, nlUtf8ToTStr(computeCaption(*nt->PS)));
} }
break; break;
case CNodeType::located: case CNodeType::located:
@ -1322,7 +1322,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
nlassert(getOwnerNode(nt)); nlassert(getOwnerNode(nt));
getOwnerNode(nt)->setModified(true); getOwnerNode(nt)->setModified(true);
this->SetItemText(info->item.hItem, info->item.pszText); this->SetItemText(info->item.hItem, info->item.pszText);
nt->Loc->setName(tStrToUtf8(info->item.pszText)); nt->Loc->setName(NLMISC::tStrToUtf8(info->item.pszText));
} }
break; break;
case CNodeType::locatedBindable: case CNodeType::locatedBindable:
@ -1330,7 +1330,7 @@ void CParticleTreeCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
nlassert(getOwnerNode(nt)); nlassert(getOwnerNode(nt));
getOwnerNode(nt)->setModified(true); getOwnerNode(nt)->setModified(true);
this->SetItemText(info->item.hItem, info->item.pszText); this->SetItemText(info->item.hItem, info->item.pszText);
nt->Bind->setName(tStrToUtf8(info->item.pszText)); nt->Bind->setName(NLMISC::tStrToUtf8(info->item.pszText));
} }
break; break;
} }
@ -1466,7 +1466,7 @@ void CParticleTreeCtrl::updateCaption(CParticleWorkspace::CNode &node)
HTREEITEM item = getTreeItem(&node); HTREEITEM item = getTreeItem(&node);
if (!item) return; if (!item) return;
// update name of ps to dipslay a star in front of it (this tells that the ps has been modified) // update name of ps to dipslay a star in front of it (this tells that the ps has been modified)
SetItemText(item, utf8ToTStr(computeCaption(node))); SetItemText(item, nlUtf8ToTStr(computeCaption(node)));
} }
//**************************************************************************************************************** //****************************************************************************************************************
@ -1545,7 +1545,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws)
while (pos) while (pos)
{ {
CString path = fd.GetNextPathName(pos); CString path = fd.GetNextPathName(pos);
CParticleWorkspace::CNode *node = pws.addNode(tStrToUtf8(path)); CParticleWorkspace::CNode *node = pws.addNode(NLMISC::tStrToUtf8(path));
if (!node) if (!node)
{ {
if (diplayNodeAlreadyInserted) if (diplayNodeAlreadyInserted)
@ -1558,7 +1558,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws)
} }
else else
{ {
MessageBox(CString(utf8ToTStr(NLMISC::CFile::getFilename(tStrToUtf8(path)))) + getStrRsc(IDS_PS_ALREADY_INSERTED), getStrRsc(IDS_ERROR), MB_OK|MB_ICONEXCLAMATION); MessageBox(CString(nlUtf8ToTStr(NLMISC::CFile::getFilename(NLMISC::tStrToUtf8(path)))) + getStrRsc(IDS_PS_ALREADY_INSERTED), getStrRsc(IDS_ERROR), MB_OK | MB_ICONEXCLAMATION);
} }
} }
continue; continue;
@ -1593,7 +1593,7 @@ void CParticleTreeCtrl::insertNewPS(CParticleWorkspace &pws)
} }
} }
// update modified state // update modified state
SetItemText(GetRootItem(), utf8ToTStr(computeCaption(pws))); SetItemText(GetRootItem(), nlUtf8ToTStr(computeCaption(pws)));
} }
} }
@ -1736,7 +1736,7 @@ void CParticleTreeCtrl::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
switch (nt->Type) switch (nt->Type)
{ {
case CNodeType::workspace: case CNodeType::workspace:
pEdit->SetWindowText(utf8ToTStr(nt->WS->getName())); pEdit->SetWindowText(nlUtf8ToTStr(nt->WS->getName()));
break; break;
case CNodeType::particleSystem: case CNodeType::particleSystem:
{ {
@ -1747,18 +1747,18 @@ void CParticleTreeCtrl::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
} }
else else
{ {
pEdit->SetWindowText(utf8ToTStr(nt->PS->getPSPointer()->getName())); pEdit->SetWindowText(nlUtf8ToTStr(nt->PS->getPSPointer()->getName()));
} }
} }
break; break;
case CNodeType::located: case CNodeType::located:
{ {
pEdit->SetWindowText(utf8ToTStr(nt->Loc->getName())); pEdit->SetWindowText(nlUtf8ToTStr(nt->Loc->getName()));
} }
break; break;
case CNodeType::locatedBindable: case CNodeType::locatedBindable:
{ {
pEdit->SetWindowText(utf8ToTStr(nt->Bind->getName())); pEdit->SetWindowText(nlUtf8ToTStr(nt->Bind->getName()));
} }
break; break;
} }
@ -1855,10 +1855,10 @@ void CParticleTreeCtrl::updateAllCaptions()
switch(nt->Type) switch(nt->Type)
{ {
case CNodeType::particleSystem: case CNodeType::particleSystem:
SetItemText(curr, utf8ToTStr(computeCaption(*nt->PS))); SetItemText(curr, nlUtf8ToTStr(computeCaption(*nt->PS)));
break; break;
case CNodeType::workspace: case CNodeType::workspace:
SetItemText(curr, utf8ToTStr(computeCaption(*nt->WS))); SetItemText(curr, nlUtf8ToTStr(computeCaption(*nt->WS)));
break; break;
case CNodeType::located: case CNodeType::located:
case CNodeType::locatedBindable: case CNodeType::locatedBindable:

View file

@ -371,13 +371,13 @@ CParticleWorkspace::CNode *CParticleWorkspace::addNode(const std::string &filena
TCHAR resultPath[MAX_PATH]; TCHAR resultPath[MAX_PATH];
std::string dosPath = NLMISC::CPath::standardizeDosPath(getPath()); std::string dosPath = NLMISC::CPath::standardizeDosPath(getPath());
std::string relativePath; std::string relativePath;
if (!PathRelativePathTo(resultPath, utf8ToTStr(dosPath), FILE_ATTRIBUTE_DIRECTORY, utf8ToTStr(filenameWithFullPath), 0)) if (!PathRelativePathTo(resultPath, nlUtf8ToTStr(dosPath), FILE_ATTRIBUTE_DIRECTORY, nlUtf8ToTStr(filenameWithFullPath), 0))
{ {
relativePath = filenameWithFullPath; relativePath = filenameWithFullPath;
} }
else else
{ {
relativePath = tStrToUtf8(resultPath); relativePath = NLMISC::tStrToUtf8(resultPath);
} }
if (relativePath.size() >= 2) if (relativePath.size() >= 2)

View file

@ -74,7 +74,7 @@ BOOL CPickSound::OnInitDialog()
for (TNameVect::iterator it = _Names.begin(); it != _Names.end(); ++it) for (TNameVect::iterator it = _Names.begin(); it != _Names.end(); ++it)
{ {
m_NameList.AddString(utf8ToTStr((*it).toString())); m_NameList.AddString(nlUtf8ToTStr((*it).toString()));
} }
_Timer = SetTimer (1, 100, NULL); _Timer = SetTimer (1, 100, NULL);
@ -111,7 +111,7 @@ void CPickSound::OnSelchange()
nlassert(m_NameList.GetTextLen(m_NameList.GetCurSel()) < 1024); nlassert(m_NameList.GetTextLen(m_NameList.GetCurSel()) < 1024);
m_NameList.GetText(m_NameList.GetCurSel(), str); m_NameList.GetText(m_NameList.GetCurSel(), str);
_CurrName = NLMISC::CSheetId(tStrToUtf8(str), "sound"); _CurrName = NLMISC::CSheetId(NLMISC::tStrToUtf8(str), "sound");
} }
@ -123,7 +123,7 @@ void CPickSound::OnPlaySound()
stopCurrSource(); stopCurrSource();
CString sName; CString sName;
m_NameList.GetText(curSel, sName); m_NameList.GetText(curSel, sName);
CSoundSystem::create(tStrToUtf8(sName)); CSoundSystem::create(NLMISC::tStrToUtf8(sName));
} }
//======================================================================================== //========================================================================================
@ -159,7 +159,7 @@ void CPickSound::OnDblclkList()
stopCurrSource(); stopCurrSource();
CString sName; CString sName;
m_NameList.GetText(curSel, sName); m_NameList.GetText(curSel, sName);
_CurrSource = CSoundSystem::create(tStrToUtf8(sName)); _CurrSource = CSoundSystem::create(NLMISC::tStrToUtf8(sName));
} }
//======================================================================================== //========================================================================================

View file

@ -126,7 +126,7 @@ void CPrecomputedRotationsDlg::OnUpdateMinRotSpeed()
nlassert(_RotatedParticle); nlassert(_RotatedParticle);
UpdateData(); UpdateData();
float newValue, valueMin, valueMax; float newValue, valueMin, valueMax;
if (NLMISC::fromString(tStrToUtf8(m_RotSpeedMin), newValue)) if (NLMISC::fromString(NLMISC::tStrToUtf8(m_RotSpeedMin), newValue))
{ {
uint32 nbModels = _RotatedParticle->checkHintRotateTheSame(valueMin, valueMax); uint32 nbModels = _RotatedParticle->checkHintRotateTheSame(valueMin, valueMax);
valueMin = newValue; valueMin = newValue;
@ -146,7 +146,7 @@ void CPrecomputedRotationsDlg::OnUpdateMaxRotSpeed()
nlassert(_RotatedParticle); nlassert(_RotatedParticle);
UpdateData(); UpdateData();
float newValue, valueMin, valueMax; float newValue, valueMin, valueMax;
if (NLMISC::fromString(tStrToUtf8(m_RotSpeedMax), newValue)) if (NLMISC::fromString(NLMISC::tStrToUtf8(m_RotSpeedMax), newValue))
{ {
uint32 nbModels = _RotatedParticle->checkHintRotateTheSame(valueMin, valueMax); uint32 nbModels = _RotatedParticle->checkHintRotateTheSame(valueMin, valueMax);
valueMax = newValue; valueMax = newValue;
@ -167,7 +167,7 @@ void CPrecomputedRotationsDlg::OnUpdateNbModels()
UpdateData(); UpdateData();
float valueMin, valueMax; float valueMin, valueMax;
sint32 newNbModels; sint32 newNbModels;
bool valid = (NLMISC::fromString(tStrToUtf8(m_NbModels), newNbModels) && newNbModels > 0); bool valid = (NLMISC::fromString(NLMISC::tStrToUtf8(m_NbModels), newNbModels) && newNbModels > 0);
if (dynamic_cast<NL3D::CPSConstraintMesh *>(_RotatedParticle)) if (dynamic_cast<NL3D::CPSConstraintMesh *>(_RotatedParticle))
{ {
valid &= (newNbModels < NL3D::ConstraintMeshMaxNumPrerotatedModels); valid &= (newNbModels < NL3D::ConstraintMeshMaxNumPrerotatedModels);

View file

@ -120,7 +120,7 @@ void CPSMoverDlg::OnUpdateXpos()
UpdateData(); UpdateData();
NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex];
float x; float x;
if (NLMISC::fromString(tStrToUtf8(m_X), x)) if (NLMISC::fromString(NLMISC::tStrToUtf8(m_X), x))
{ {
pos.x = x; pos.x = x;
updateListener(); updateListener();
@ -137,7 +137,7 @@ void CPSMoverDlg::OnUpdateYpos()
UpdateData(); UpdateData();
NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex];
float y; float y;
if (NLMISC::fromString(tStrToUtf8(m_Y), y)) if (NLMISC::fromString(NLMISC::tStrToUtf8(m_Y), y))
{ {
pos.y = y; pos.y = y;
updateListener(); updateListener();
@ -154,7 +154,7 @@ void CPSMoverDlg::OnUpdateZpos()
UpdateData(); UpdateData();
NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex]; NLMISC::CVector &pos = _EditedLocated->getPos()[_EditedLocatedIndex];
float z; float z;
if (NLMISC::fromString(tStrToUtf8(m_Z), z)) if (NLMISC::fromString(NLMISC::tStrToUtf8(m_Z), z))
{ {
pos.z = z; pos.z = z;
updateListener(); updateListener();
@ -178,7 +178,7 @@ BOOL CPSMoverDlg::OnInitDialog()
{ {
if (dynamic_cast<NL3D::IPSMover *>(_EditedLocated->getBoundObject(k))) if (dynamic_cast<NL3D::IPSMover *>(_EditedLocated->getBoundObject(k)))
{ {
uint insertedLine = m_SubComponentCtrl.AddString(utf8ToTStr(_EditedLocated->getBoundObject(k)->getName())); uint insertedLine = m_SubComponentCtrl.AddString(nlUtf8ToTStr(_EditedLocated->getBoundObject(k)->getName()));
m_SubComponentCtrl.SetItemData(insertedLine, (DWORD_PTR) _EditedLocated->getBoundObject(k)); m_SubComponentCtrl.SetItemData(insertedLine, (DWORD_PTR) _EditedLocated->getBoundObject(k));
++nbCandidates; ++nbCandidates;
} }

View file

@ -84,7 +84,7 @@ void CSchemeBankDlg::buildList()
SchemeManager.getSchemes(_Type, schemes); SchemeManager.getSchemes(_Type, schemes);
for (TSchemeVect::const_iterator it = schemes.begin(); it != schemes.end(); ++it) for (TSchemeVect::const_iterator it = schemes.begin(); it != schemes.end(); ++it)
{ {
int index = m_SchemeList.AddString(utf8ToTStr(it->first)); int index = m_SchemeList.AddString(nlUtf8ToTStr(it->first));
m_SchemeList.SetItemData(index, (DWORD_PTR) it->second); m_SchemeList.SetItemData(index, (DWORD_PTR) it->second);
} }
@ -99,18 +99,18 @@ void CSchemeBankDlg::OnSaveBank()
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
// Add search path for the texture // Add search path for the texture
NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName())));
try try
{ {
NLMISC::COFile iF; NLMISC::COFile iF;
iF.open(tStrToUtf8(fd.GetFileName())); iF.open(NLMISC::tStrToUtf8(fd.GetFileName()));
iF.serial(SchemeManager); iF.serial(SchemeManager);
} }
catch (const std::exception &e) catch (const std::exception &e)
{ {
std::string message = NLMISC::toString("Error saving scheme bank : %s", e.what()); std::string message = NLMISC::toString("Error saving scheme bank : %s", e.what());
MessageBox(utf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK); MessageBox(nlUtf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK);
return; return;
} }
} }
@ -124,20 +124,20 @@ void CSchemeBankDlg::OnLoadBank()
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
// Add search path for the texture // Add search path for the texture
NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName())));
CSchemeManager sm; CSchemeManager sm;
try try
{ {
NLMISC::CIFile iF; NLMISC::CIFile iF;
iF.open(NLMISC::CPath::lookup(tStrToUtf8(fd.GetFileName()))); iF.open(NLMISC::CPath::lookup(NLMISC::tStrToUtf8(fd.GetFileName())));
iF.serial(sm); iF.serial(sm);
SchemeManager.swap(sm); SchemeManager.swap(sm);
} }
catch (const std::exception &e) catch (const std::exception &e)
{ {
std::string message = NLMISC::toString("Error loading scheme bank : %s", e.what()); std::string message = NLMISC::toString("Error loading scheme bank : %s", e.what());
MessageBox(utf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK); MessageBox(nlUtf8ToTStr(message), _T("Object viewer"), MB_ICONEXCLAMATION | MB_OK);
return; return;
} }
buildList(); buildList();
@ -167,7 +167,7 @@ void CSchemeBankDlg::OnRename()
SchemeManager.rename(scheme, cn.getName()); SchemeManager.rename(scheme, cn.getName());
int curSel = m_SchemeList.GetCurSel(); int curSel = m_SchemeList.GetCurSel();
m_SchemeList.DeleteString(curSel); m_SchemeList.DeleteString(curSel);
int insertedPos = m_SchemeList.InsertString(curSel, utf8ToTStr(cn.getName())); int insertedPos = m_SchemeList.InsertString(curSel, nlUtf8ToTStr(cn.getName()));
m_SchemeList.SetCurSel(insertedPos); m_SchemeList.SetCurSel(insertedPos);
m_SchemeList.Invalidate(); m_SchemeList.Invalidate();
} }

View file

@ -77,14 +77,14 @@ BOOL CSelectString::OnInitDialog()
CDialog::OnInitDialog(); CDialog::OnInitDialog();
// Change title // Change title
SetWindowText (utf8ToTStr(Title)); SetWindowText(nlUtf8ToTStr(Title));
// Empty button ? // Empty button ?
EmptyCtrl.ShowWindow (Empty?SW_SHOW:SW_HIDE); EmptyCtrl.ShowWindow (Empty?SW_SHOW:SW_HIDE);
// Add string // Add string
for (uint s=0; s<Strings.size(); s++) for (uint s=0; s<Strings.size(); s++)
ListCtrl.InsertString (-1, utf8ToTStr(Strings[s])); ListCtrl.InsertString(-1, nlUtf8ToTStr(Strings[s]));
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE // EXCEPTION: OCX Property Pages should return FALSE

View file

@ -209,7 +209,7 @@ void CSkeletonScaleDlg::setSkeletonToEdit(NL3D::CSkeletonModel *skel, const std
name = tabStr + name; name = tabStr + name;
// append to the list // append to the list
_BoneList.AddString(utf8ToTStr(name)); _BoneList.AddString(nlUtf8ToTStr(name));
} }
} }
@ -404,7 +404,7 @@ void CSkeletonScaleDlg::applyScaleSlider(sint scrollValue)
// update marker text // update marker text
std::string str = NLMISC::toString("%d%%", (sint)(factor*100)); std::string str = NLMISC::toString("%d%%", (sint)(factor*100));
_StaticScaleMarkers[_SliderEdited]->SetWindowText(utf8ToTStr(str)); _StaticScaleMarkers[_SliderEdited]->SetWindowText(nlUtf8ToTStr(str));
} }
// *************************************************************************** // ***************************************************************************
@ -717,7 +717,7 @@ void CSkeletonScaleDlg::updateScalesFromText(UINT ctrlId)
return; return;
// get the scale info // get the scale info
std::string str = tStrToUtf8(*_ScaleEdits[sid]); std::string str = NLMISC::tStrToUtf8(*_ScaleEdits[sid]);
if(str.empty()) if(str.empty())
return; return;
float f; float f;
@ -846,13 +846,13 @@ void CSkeletonScaleDlg::OnSsdButtonSaveas()
return; return;
// choose the file // choose the file
CFileDialog fd(FALSE, _T("skel"), utf8ToTStr(_SkeletonFileName), OFN_OVERWRITEPROMPT, _T("SkelFiles (*.skel)|*.skel|All Files (*.*)|*.*||"), this) ; CFileDialog fd(FALSE, _T("skel"), nlUtf8ToTStr(_SkeletonFileName), OFN_OVERWRITEPROMPT, _T("SkelFiles (*.skel)|*.skel|All Files (*.*)|*.*||"), this);
fd.m_ofn.lpstrTitle = _T("Save As Skeleton"); fd.m_ofn.lpstrTitle = _T("Save As Skeleton");
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
NLMISC::COFile f; NLMISC::COFile f;
if( f.open(tStrToUtf8(fd.GetPathName())) ) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
if(saveCurrentInStream(f)) if(saveCurrentInStream(f))
{ {
@ -862,7 +862,7 @@ void CSkeletonScaleDlg::OnSsdButtonSaveas()
} }
// bkup the valid fileName (new file edited) // bkup the valid fileName (new file edited)
_SkeletonFileName= tStrToUtf8(fd.GetPathName()); _SkeletonFileName = NLMISC::tStrToUtf8(fd.GetPathName());
_StaticFileName= _SkeletonFileName.c_str(); _StaticFileName= _SkeletonFileName.c_str();
UpdateData(FALSE); UpdateData(FALSE);
} }
@ -1228,13 +1228,13 @@ void CSkeletonScaleDlg::OnSsdButtonSaveScale()
std::string defaultFileName = _SkeletonFileName; std::string defaultFileName = _SkeletonFileName;
NLMISC::strFindReplace(defaultFileName, ".skel", ".scale"); NLMISC::strFindReplace(defaultFileName, ".skel", ".scale");
CFileDialog fd(FALSE, _T("scale"), utf8ToTStr(defaultFileName), OFN_OVERWRITEPROMPT, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this) ; CFileDialog fd(FALSE, _T("scale"), nlUtf8ToTStr(defaultFileName), OFN_OVERWRITEPROMPT, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this);
fd.m_ofn.lpstrTitle = _T("Save As Skeleton Scale File"); fd.m_ofn.lpstrTitle = _T("Save As Skeleton Scale File");
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
NLMISC::COFile f; NLMISC::COFile f;
if (f.open(tStrToUtf8(fd.GetPathName()))) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
saveSkelScaleInStream(f); saveSkelScaleInStream(f);
} }
@ -1256,13 +1256,13 @@ void CSkeletonScaleDlg::OnSsdButtonLoadScale()
std::string defaultFileName= _SkeletonFileName; std::string defaultFileName= _SkeletonFileName;
NLMISC::strFindReplace(defaultFileName, ".skel", ".scale"); NLMISC::strFindReplace(defaultFileName, ".skel", ".scale");
CFileDialog fd(TRUE, _T("scale"), utf8ToTStr(defaultFileName), 0, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this) ; CFileDialog fd(TRUE, _T("scale"), nlUtf8ToTStr(defaultFileName), 0, _T("SkelScaleFiles (*.scale)|*.scale|All Files (*.*)|*.*||"), this);
fd.m_ofn.lpstrTitle= _T("Load a Skeleton Scale File"); fd.m_ofn.lpstrTitle= _T("Load a Skeleton Scale File");
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
NLMISC::CIFile f; NLMISC::CIFile f;
if (f.open(tStrToUtf8(fd.GetPathName()))) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
loadSkelScaleFromStream(f); loadSkelScaleFromStream(f);
} }

View file

@ -472,7 +472,7 @@ void CSlotDlg::setWindowName ()
} }
} }
GetDlgItem (IDC_SLOT_NAME)->SetWindowText (utf8ToTStr(tmp)); GetDlgItem(IDC_SLOT_NAME)->SetWindowText(nlUtf8ToTStr(tmp));
} }
// *************************************************************************** // ***************************************************************************

View file

@ -183,7 +183,7 @@ void CSnapshotToolDlg::fromRegistry()
for (uint k = 0; k < filterList.size(); ++k) for (uint k = 0; k < filterList.size(); ++k)
{ {
m_Filters.AddString(utf8ToTStr(filterList[k])); m_Filters.AddString(nlUtf8ToTStr(filterList[k]));
} }
integralTypeFromRegistry(hKey, _T("RecurseSubFolder"), (int &) m_RecurseSubFolder, FALSE); integralTypeFromRegistry(hKey, _T("RecurseSubFolder"), (int &) m_RecurseSubFolder, FALSE);
@ -597,7 +597,7 @@ void CSnapshotToolDlg::OnTimer(UINT_PTR nIDEvent)
try try
{ {
CShapeStream ss; CShapeStream ss;
m_Log.AddString(utf8ToTStr(_FilteredFiles[0])); m_Log.AddString(nlUtf8ToTStr(_FilteredFiles[0]));
CIFile stream(_FilteredFiles[0]); CIFile stream(_FilteredFiles[0]);
ss.serial(stream); ss.serial(stream);
nlassert(ss.getShapePointer()); nlassert(ss.getShapePointer());

View file

@ -78,7 +78,7 @@ void CSoundAnimDlg::handle()
{ {
float sec = _AnimationDlg->getTime(); float sec = _AnimationDlg->getTime();
std::string text = toString("time: %.3f", sec); std::string text = toString("time: %.3f", sec);
GetDlgItem(IDC_SOUNDANIMINFO)->SetWindowText(utf8ToTStr(text)); GetDlgItem(IDC_SOUNDANIMINFO)->SetWindowText(nlUtf8ToTStr(text));
_AnimView.updateCursor(); _AnimView.updateCursor();
} }
@ -136,7 +136,7 @@ void CSoundAnimDlg::updateSounds()
for (iter = sounds.begin(); iter != sounds.end(); iter++) for (iter = sounds.begin(); iter != sounds.end(); iter++)
{ {
list->AddString(utf8ToTStr((*iter).toString())); list->AddString(nlUtf8ToTStr((*iter).toString()));
} }
list->UpdateData(); list->UpdateData();

View file

@ -217,7 +217,7 @@ void CSoundAnimView::save()
// Create a dialog // Create a dialog
TCHAR BASED_CODE szFilter[] = _T("NeL Sound Animations (*.sound_anim)|*.sound_anim|All Files (*.*)|*.*||"); TCHAR BASED_CODE szFilter[] = _T("NeL Sound Animations (*.sound_anim)|*.sound_anim|All Files (*.*)|*.*||");
CFileDialog fileDlg( FALSE, _T(".sound_anim"), utf8ToTStr(filename), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); CFileDialog fileDlg(FALSE, _T(".sound_anim"), nlUtf8ToTStr(filename), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);
if (fileDlg.DoModal() == IDOK) if (fileDlg.DoModal() == IDOK)
{ {
@ -236,7 +236,7 @@ void CSoundAnimView::save()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
} }

View file

@ -231,13 +231,13 @@ void CStartStopParticleSystem::updateUIFromState()
{ {
if (!_ActiveNode->getParentSkelName().empty()) if (!_ActiveNode->getParentSkelName().empty())
{ {
GetDlgItem(IDC_STICK_BONE)->SetWindowText(utf8ToTStr(_ActiveNode->getParentBoneName() + "." + _ActiveNode->getParentBoneName())); GetDlgItem(IDC_STICK_BONE)->SetWindowText(nlUtf8ToTStr(_ActiveNode->getParentBoneName() + "." + _ActiveNode->getParentBoneName()));
} }
else else
{ {
GetDlgItem(IDC_STICK_BONE)->SetWindowText(_T("")); GetDlgItem(IDC_STICK_BONE)->SetWindowText(_T(""));
} }
GetDlgItem(IDC_ACTIVE_PS)->SetWindowText(utf8ToTStr(_ActiveNode->getFilename())); GetDlgItem(IDC_ACTIVE_PS)->SetWindowText(nlUtf8ToTStr(_ActiveNode->getFilename()));
GetDlgItem(IDC_ENABLE_AUTO_COUNT)->EnableWindow(TRUE); GetDlgItem(IDC_ENABLE_AUTO_COUNT)->EnableWindow(TRUE);
((CButton *) GetDlgItem(IDC_ENABLE_AUTO_COUNT))->SetCheck(getCurrPS()->getAutoCountFlag() ? 1 : 0); ((CButton *) GetDlgItem(IDC_ENABLE_AUTO_COUNT))->SetCheck(getCurrPS()->getAutoCountFlag() ? 1 : 0);
GetDlgItem(IDC_RESET_COUNT)->EnableWindow((_ActiveNode->getPSPointer()->getAutoCountFlag() && !_ActiveNode->getResetAutoCountFlag()) ? TRUE : FALSE); GetDlgItem(IDC_RESET_COUNT)->EnableWindow((_ActiveNode->getPSPointer()->getAutoCountFlag() && !_ActiveNode->getResetAutoCountFlag()) ? TRUE : FALSE);
@ -844,7 +844,7 @@ void CStartStopParticleSystem::OnLinkToSkeleton()
uint boneIndex; uint boneIndex;
std::string parentSkelName; std::string parentSkelName;
std::string parentBoneName; std::string parentBoneName;
if (ov->chooseBone(tStrToUtf8(chooseBoneForPS), skel, boneIndex, &parentSkelName, &parentBoneName)) if (ov->chooseBone(NLMISC::tStrToUtf8(chooseBoneForPS), skel, boneIndex, &parentSkelName, &parentBoneName))
{ {
_ParticleDlg->stickPSToSkeleton(_ActiveNode, skel, boneIndex, parentSkelName, parentBoneName); _ParticleDlg->stickPSToSkeleton(_ActiveNode, skel, boneIndex, parentSkelName, parentBoneName);
} }
@ -1017,11 +1017,11 @@ void CStartStopParticleSystem::OnBrowseAnim()
} }
} }
std::vector<std::string> animList(animSet.begin(), animSet.end()); std::vector<std::string> animList(animSet.begin(), animSet.end());
CSelectString st(animList, tStrToUtf8(getStrRsc(IDS_SELECT_ANIMATION)), this, false); CSelectString st(animList, NLMISC::tStrToUtf8(getStrRsc(IDS_SELECT_ANIMATION)), this, false);
if (st.DoModal() == IDOK && st.Selection != -1) if (st.DoModal() == IDOK && st.Selection != -1)
{ {
m_TriggerAnim = animList[st.Selection].c_str(); m_TriggerAnim = animList[st.Selection].c_str();
_ActiveNode->setTriggerAnim(tStrToUtf8(m_TriggerAnim)); _ActiveNode->setTriggerAnim(NLMISC::tStrToUtf8(m_TriggerAnim));
GetDlgItem(IDC_CLEAR_ANIM)->EnableWindow(!_ActiveNode->getTriggerAnim().empty()); GetDlgItem(IDC_CLEAR_ANIM)->EnableWindow(!_ActiveNode->getTriggerAnim().empty());
} }
_ParticleDlg->ParticleTreeCtrl->updateCaption(*_ActiveNode); _ParticleDlg->ParticleTreeCtrl->updateCaption(*_ActiveNode);

View file

@ -179,22 +179,22 @@ void CTextureChooser::OnBrowseTexture()
{ {
texName = (static_cast<NL3D::CTextureFile *>(_Wrapper->get()))->getFileName(); texName = (static_cast<NL3D::CTextureFile *>(_Wrapper->get()))->getFileName();
} }
CFileDialog fd(TRUE, _T(".tga"), utf8ToTStr(texName), 0, NULL, this); CFileDialog fd(TRUE, _T(".tga"), nlUtf8ToTStr(texName), 0, NULL, this);
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
// Add search path for the texture // Add search path for the texture
NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()))); NLMISC::CPath::addSearchPath(NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName())));
try try
{ {
NL3D::CTextureFile *tf = new NL3D::CTextureFile(tStrToUtf8(fd.GetFileName())); NL3D::CTextureFile *tf = new NL3D::CTextureFile(NLMISC::tStrToUtf8(fd.GetFileName()));
_Wrapper->setAndUpdateModifiedFlag(tf); _Wrapper->setAndUpdateModifiedFlag(tf);
_Texture = tf; _Texture = tf;
textureToBitmap(); textureToBitmap();
} }
catch (const NLMISC::Exception &e) catch (const NLMISC::Exception &e)
{ {
MessageBox(utf8ToTStr(e.what()), _T("error loading texture")); MessageBox(nlUtf8ToTStr(e.what()), _T("error loading texture"));
} }
} }

View file

@ -249,7 +249,7 @@ BOOL CVegetableCopyDlg::OnInitDialog()
uint num= _VegetableDlg->getNumVegetables(); uint num= _VegetableDlg->getNumVegetables();
for(uint i=0; i<num; i++) for(uint i=0; i<num; i++)
{ {
VegetableList.AddString(utf8ToTStr(_VegetableDlg->getVegetableName(i))); VegetableList.AddString(nlUtf8ToTStr(_VegetableDlg->getVegetableName(i)));
} }

View file

@ -100,7 +100,7 @@ void CVegetableDensityPage::setVegetableToEdit(NL3D::CVegetable *vegetable)
{ {
// Init ShapeName // Init ShapeName
// ---------- // ----------
StaticVegetableShape.SetWindowText(utf8ToTStr(_Vegetable->ShapeName)); StaticVegetableShape.SetWindowText(nlUtf8ToTStr(_Vegetable->ShapeName));
// init Creation Distance. // init Creation Distance.
// ---------- // ----------
@ -228,7 +228,7 @@ void CVegetableDensityPage::updateAngleMinFromEditText()
TCHAR stmp[256]; TCHAR stmp[256];
AngleMinEdit.GetWindowText(stmp, 256); AngleMinEdit.GetWindowText(stmp, 256);
float angleMin; float angleMin;
NLMISC::fromString(tStrToUtf8(stmp), angleMin); NLMISC::fromString(NLMISC::tStrToUtf8(stmp), angleMin);
NLMISC::clamp(angleMin, -90, 90); NLMISC::clamp(angleMin, -90, 90);
// make a sinus, because 90 => 1, and -90 =>-1 // make a sinus, because 90 => 1, and -90 =>-1
float cosAngleMin= (float)sin(angleMin*NLMISC::Pi/180.f); float cosAngleMin= (float)sin(angleMin*NLMISC::Pi/180.f);
@ -252,7 +252,7 @@ void CVegetableDensityPage::updateAngleMaxFromEditText()
TCHAR stmp[256]; TCHAR stmp[256];
AngleMaxEdit.GetWindowText(stmp, 256); AngleMaxEdit.GetWindowText(stmp, 256);
float angleMax; float angleMax;
NLMISC::fromString(tStrToUtf8(stmp), angleMax); NLMISC::fromString(NLMISC::tStrToUtf8(stmp), angleMax);
NLMISC::clamp(angleMax, -90, 90); NLMISC::clamp(angleMax, -90, 90);
// make a sinus, because 90 => 1, and -90 =>-1 // make a sinus, because 90 => 1, and -90 =>-1
float cosAngleMax= (float)sin(angleMax*NLMISC::Pi/180.f); float cosAngleMax= (float)sin(angleMax*NLMISC::Pi/180.f);
@ -523,10 +523,10 @@ void CVegetableDensityPage::OnButtonVegetableBrowse()
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
// Add to the path // Add to the path
std::string fileName = tStrToUtf8(fd.GetFileName()); std::string fileName = NLMISC::tStrToUtf8(fd.GetFileName());
// Add search path for the .veget // Add search path for the .veget
std::string path = NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName())); std::string path = NLMISC::CFile::getPath(NLMISC::tStrToUtf8(fd.GetPathName()));
NLMISC::CPath::addSearchPath (path); NLMISC::CPath::addSearchPath (path);
try try
@ -546,7 +546,7 @@ void CVegetableDensityPage::OnButtonVegetableBrowse()
} }
catch (const NLMISC::EPathNotFound &ep) catch (const NLMISC::EPathNotFound &ep)
{ {
MessageBox(utf8ToTStr(ep.what()), _T("Can't open file")); MessageBox(nlUtf8ToTStr(ep.what()), _T("Can't open file"));
} }
} }
} }

View file

@ -196,7 +196,7 @@ void CVegetableDlg::updateCurSelVegetableName()
_Vegetables[id].updateVegetableName(); _Vegetables[id].updateVegetableName();
// replace name in the listBox: must delete, and re-insert // replace name in the listBox: must delete, and re-insert
VegetableList.DeleteString(id); VegetableList.DeleteString(id);
VegetableList.InsertString(id, utf8ToTStr(_Vegetables[id].VegetableName)); VegetableList.InsertString(id, nlUtf8ToTStr(_Vegetables[id].VegetableName));
VegetableList.SetCurSel(id); VegetableList.SetCurSel(id);
} }
} }
@ -349,14 +349,14 @@ bool CVegetableDlg::loadVegetableSet(NL3D::CTileVegetableDesc &vegetSet, const
ok= true; ok= true;
if( f.open(tStrToUtf8(fd.GetPathName()))) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
try try
{ {
// read the vegetable // read the vegetable
f.serial(vegetSet); f.serial(vegetSet);
// bkup fileName. // bkup fileName.
_LastVegetSetName = tStrToUtf8(fd.GetFileName()); _LastVegetSetName = NLMISC::tStrToUtf8(fd.GetFileName());
} }
catch(const NLMISC::EStream &) catch(const NLMISC::EStream &)
{ {
@ -439,7 +439,7 @@ void CVegetableDlg::appendVegetableSet(NL3D::CTileVegetableDesc &vegetSet)
_Vegetables[id].initVegetable(veget); _Vegetables[id].initVegetable(veget);
// update view // update view
VegetableList.AddString(utf8ToTStr(_Vegetables[id].VegetableName)); VegetableList.AddString(nlUtf8ToTStr(_Vegetables[id].VegetableName));
} }
} }
} }
@ -529,7 +529,7 @@ void CVegetableDlg::OnButtonVegetableAdd()
_Vegetables[id].initDefaultVegetable(); _Vegetables[id].initDefaultVegetable();
// update view // update view
VegetableList.AddString(utf8ToTStr(_Vegetables[id].VegetableName)); VegetableList.AddString(nlUtf8ToTStr(_Vegetables[id].VegetableName));
// update 3D view // update 3D view
refreshVegetableDisplay(); refreshVegetableDisplay();
@ -559,7 +559,7 @@ void CVegetableDlg::OnButtonVegetableInsert()
_Vegetables[id].initDefaultVegetable(); _Vegetables[id].initDefaultVegetable();
// update view // update view
VegetableList.InsertString(id, utf8ToTStr(_Vegetables[id].VegetableName)); VegetableList.InsertString(id, nlUtf8ToTStr(_Vegetables[id].VegetableName));
// update 3D view // update 3D view
refreshVegetableDisplay(); refreshVegetableDisplay();
@ -611,7 +611,7 @@ void CVegetableDlg::OnButtonVegetableLoadDesc()
{ {
NLMISC::CIFile f; NLMISC::CIFile f;
if( f.open(tStrToUtf8(fd.GetPathName())) ) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
NL3D::CVegetable veget; NL3D::CVegetable veget;
try try
@ -624,7 +624,7 @@ void CVegetableDlg::OnButtonVegetableLoadDesc()
_Vegetables[id].initVegetable(veget); _Vegetables[id].initVegetable(veget);
// update view // update view
VegetableList.AddString(utf8ToTStr(_Vegetables[id].VegetableName)); VegetableList.AddString(nlUtf8ToTStr(_Vegetables[id].VegetableName));
// update 3D view // update 3D view
refreshVegetableDisplay(); refreshVegetableDisplay();
@ -651,13 +651,13 @@ void CVegetableDlg::OnButtonVegetableSaveDesc()
std::string fileName= _Vegetables[id].VegetableName + ".vegetdesc"; std::string fileName= _Vegetables[id].VegetableName + ".vegetdesc";
CFileDialog fd(FALSE, _T("vegetdesc"), utf8ToTStr(fileName), OFN_OVERWRITEPROMPT, _T("VegetDescFiles (*.vegetdesc)|*.vegetdesc|All Files (*.*)|*.*||"), this) ; CFileDialog fd(FALSE, _T("vegetdesc"), nlUtf8ToTStr(fileName), OFN_OVERWRITEPROMPT, _T("VegetDescFiles (*.vegetdesc)|*.vegetdesc|All Files (*.*)|*.*||"), this);
fd.m_ofn.lpstrTitle = _T("Save Vegetable Descriptor"); fd.m_ofn.lpstrTitle = _T("Save Vegetable Descriptor");
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
NLMISC::COFile f; NLMISC::COFile f;
if( f.open(tStrToUtf8(fd.GetPathName())) ) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
try try
{ {
@ -722,13 +722,13 @@ void CVegetableDlg::OnButtonVegetableSaveSet()
buildVegetableSet(vegetSet); buildVegetableSet(vegetSet);
// Then try to save it. // Then try to save it.
CFileDialog fd(FALSE, _T("vegetset"), utf8ToTStr(_LastVegetSetName), OFN_OVERWRITEPROMPT, _T("VegetSetFiles (*.vegetset)|*.vegetset|All Files (*.*)|*.*||"), this) ; CFileDialog fd(FALSE, _T("vegetset"), nlUtf8ToTStr(_LastVegetSetName), OFN_OVERWRITEPROMPT, _T("VegetSetFiles (*.vegetset)|*.vegetset|All Files (*.*)|*.*||"), this);
fd.m_ofn.lpstrTitle = _T("Save Vegetable Set"); fd.m_ofn.lpstrTitle = _T("Save Vegetable Set");
if (fd.DoModal() == IDOK) if (fd.DoModal() == IDOK)
{ {
NLMISC::COFile f; NLMISC::COFile f;
if( f.open(tStrToUtf8(fd.GetPathName())) ) if (f.open(NLMISC::tStrToUtf8(fd.GetPathName())))
{ {
try try
{ {

View file

@ -33,7 +33,7 @@ void CDirectEditableRangeFloat::init(uint32 x, uint32 y, CWnd *pParent)
CRect rect; CRect rect;
rect.SetRect(x, y+10, x+dx, y+25); rect.SetRect(x, y+10, x+dx, y+25);
_StaticText.Create(utf8ToTStr(_Title), WS_CHILD | WS_VISIBLE, rect, pParent); _StaticText.Create(nlUtf8ToTStr(_Title), WS_CHILD | WS_VISIBLE, rect, pParent);
_StaticText.SetFont(pParent->GetFont()); _StaticText.SetFont(pParent->GetFont());
} }

View file

@ -154,7 +154,7 @@ BOOL CVegetableNoiseValueDlg::OnInitDialog()
// Set the name. // Set the name.
NoiseValueName.SetWindowText(utf8ToTStr(_TitleName)); NoiseValueName.SetWindowText(nlUtf8ToTStr(_TitleName));
// if previously setuped, setup now the noiseValue. // if previously setuped, setup now the noiseValue.
@ -264,5 +264,5 @@ void CVegetableNoiseValueDlg::applyScaleSlider(sint scrollValue)
_RandValue->updateValueFromReader(); _RandValue->updateValueFromReader();
// update marker text // update marker text
StaticScaleMarker.SetWindowText(utf8ToTStr(NLMISC::toString("%d%%", (sint)(factor * 100)))); StaticScaleMarker.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%d%%", (sint)(factor * 100))));
} }

View file

@ -63,7 +63,7 @@ BOOL CVegetableSelectDlg::OnInitDialog()
uint num= _VegetableDlg->getNumVegetables(); uint num= _VegetableDlg->getNumVegetables();
for(uint i=0; i<num; i++) for(uint i=0; i<num; i++)
{ {
VegetableList.AddString(utf8ToTStr(_VegetableDlg->getVegetableName(i))); VegetableList.AddString(nlUtf8ToTStr(_VegetableDlg->getVegetableName(i)));
} }
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control

View file

@ -73,19 +73,19 @@ void CVegetableWindDlg::updateView()
// update Power. // update Power.
a= _ObjViewer->getVegetableWindPower(); a= _ObjViewer->getVegetableWindPower();
StaticPower.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); StaticPower.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_POWER); NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_POWER);
SliderPower.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_POWER)); SliderPower.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_POWER));
// update BendStart. // update BendStart.
a= _ObjViewer->getVegetableWindBendStart(); a= _ObjViewer->getVegetableWindBendStart();
StaticBendStart.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); StaticBendStart.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART); NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART);
SliderBendStart.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART)); SliderBendStart.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART));
// update Frequency. // update Frequency.
a= _ObjViewer->getVegetableWindFrequency(); a= _ObjViewer->getVegetableWindFrequency();
StaticFrequency.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); StaticFrequency.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY); NLMISC::clamp(a, 0, NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY);
SliderFrequency.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY)); SliderFrequency.SetPos((sint)(a*NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE / NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY));
@ -129,20 +129,20 @@ void CVegetableWindDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBa
{ {
a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_POWER / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE; a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_POWER / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE;
_ObjViewer->setVegetableWindPower(a); _ObjViewer->setVegetableWindPower(a);
StaticPower.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); StaticPower.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
} }
else if(sliderCtrl == &SliderBendStart) else if(sliderCtrl == &SliderBendStart)
{ {
a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE; a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_BENDSTART / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE;
_ObjViewer->setVegetableWindBendStart(a); _ObjViewer->setVegetableWindBendStart(a);
StaticBendStart.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); StaticBendStart.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
} }
else if(sliderCtrl == &SliderFrequency) else if(sliderCtrl == &SliderFrequency)
{ {
a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE; a= (float)nPos * NL_VEGETABLE_EDIT_WIND_MAX_FREQUENCY / NL_VEGETABLE_EDIT_WIND_SLIDER_RANGE;
_ObjViewer->setVegetableWindFrequency(a); _ObjViewer->setVegetableWindFrequency(a);
StaticFrequency.SetWindowText(utf8ToTStr(NLMISC::toString("%.2f", a))); StaticFrequency.SetWindowText(nlUtf8ToTStr(NLMISC::toString("%.2f", a)));
} }
} }
else else

View file

@ -166,7 +166,7 @@ BOOL CWaterPoolEditor::OnInitDialog()
int CWaterPoolEditor::addPool(uint32 ID) int CWaterPoolEditor::addPool(uint32 ID)
{ {
std::string poolId = NLMISC::toString("%d (%s)", ID, _Wpm->getPoolByID(ID).getName().c_str()); std::string poolId = NLMISC::toString("%d (%s)", ID, _Wpm->getPoolByID(ID).getName().c_str());
int index = m_PoolList.AddString(utf8ToTStr(poolId)); int index = m_PoolList.AddString(nlUtf8ToTStr(poolId));
nlassert(index != LB_ERR); nlassert(index != LB_ERR);
m_PoolList.SetItemData(index, ID); m_PoolList.SetItemData(index, ID);
return index; return index;
@ -357,7 +357,7 @@ void CWaterPoolEditor::OnLoadPool()
{ {
NLMISC::CIXml iXml; NLMISC::CIXml iXml;
NLMISC::CIFile iF; NLMISC::CIFile iF;
if (iF.open(tStrToUtf8(fileDlg.GetPathName()))) if (iF.open(NLMISC::tStrToUtf8(fileDlg.GetPathName())))
{ {
if (iXml.init (iF)) if (iXml.init (iF))
{ {
@ -369,17 +369,17 @@ void CWaterPoolEditor::OnLoadPool()
else else
{ {
iF.close(); iF.close();
MessageBox (utf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", NLMISC::tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
else else
{ {
MessageBox (utf8ToTStr(NLMISC::toString("Unable to open file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(NLMISC::toString("Unable to open file: %s", NLMISC::tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
catch (const NLMISC::Exception& e) catch (const NLMISC::Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
} }
@ -395,7 +395,7 @@ void CWaterPoolEditor::OnSavePool()
{ {
NLMISC::COXml oXml; NLMISC::COXml oXml;
NLMISC::COFile oF; NLMISC::COFile oF;
if (oF.open(tStrToUtf8(fileDlg.GetPathName()))) if (oF.open(NLMISC::tStrToUtf8(fileDlg.GetPathName())))
{ {
if (oXml.init (&oF)) if (oXml.init (&oF))
{ {
@ -406,17 +406,17 @@ void CWaterPoolEditor::OnSavePool()
else else
{ {
oF.close(); oF.close();
MessageBox (utf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(NLMISC::toString("Unable to init xml stream from file: %s", NLMISC::tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
else else
{ {
MessageBox (utf8ToTStr(NLMISC::toString("Unable to open file: %s", tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(NLMISC::toString("Unable to open file: %s", NLMISC::tStrToUtf8(fileDlg.GetPathName()).c_str())), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
catch (const NLMISC::Exception& e) catch (const NLMISC::Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(e.what()), _T("NeL object viewer"), MB_OK | MB_ICONEXCLAMATION);
} }
} }

View file

@ -1417,7 +1417,7 @@ void Browse::OnExportBorder()
{ {
// Error message // Error message
std::string tmp = toString("Can't write bitmap %s", tStrToUtf8(pathName).c_str()); std::string tmp = toString("Can't write bitmap %s", tStrToUtf8(pathName).c_str());
MessageBox (utf8ToTStr(tmp), _T("Export border"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(tmp), _T("Export border"), MB_OK | MB_ICONEXCLAMATION);
} }
} }
} }
@ -1460,7 +1460,7 @@ void Browse::OnImportBorder()
{ {
// Error message // Error message
std::string tmp = toString("Can't read bitmap %s", tStrToUtf8(pathName).c_str()); std::string tmp = toString("Can't read bitmap %s", tStrToUtf8(pathName).c_str());
MessageBox (utf8ToTStr(tmp), _T("Import border"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(tmp), _T("Import border"), MB_OK | MB_ICONEXCLAMATION);
} }
// Get pixel // Get pixel
@ -1484,7 +1484,7 @@ void Browse::OnImportBorder()
{ {
// Error message // Error message
std::string tmp = toString("The bitmap must have a size of 128x128 (%s)", tStrToUtf8(pathName).c_str()); std::string tmp = toString("The bitmap must have a size of 128x128 (%s)", tStrToUtf8(pathName).c_str());
MessageBox (utf8ToTStr(tmp), _T("Import border"), MB_OK|MB_ICONEXCLAMATION); MessageBox(nlUtf8ToTStr(tmp), _T("Import border"), MB_OK | MB_ICONEXCLAMATION);
} }
// 256 or 128 ? // 256 or 128 ?

View file

@ -120,13 +120,13 @@ private:
{ {
UpdateData (); UpdateData ();
TCHAR sTitle[512]; TCHAR sTitle[512];
_stprintf(sTitle, _T("Tile sets use by %s"), utf8ToTStr(tileBank.getLand(_land)->getName())); _stprintf(sTitle, _T("Tile sets use by %s"), nlUtf8ToTStr(tileBank.getLand(_land)->getName()));
SetWindowText (sTitle); SetWindowText (sTitle);
for (int i=0; i<tileBank.getTileSetCount(); i++) for (int i=0; i<tileBank.getTileSetCount(); i++)
{ {
m_ctrlCombo.InsertString (-1, utf8ToTStr(tileBank.getTileSet(i)->getName())); m_ctrlCombo.InsertString(-1, nlUtf8ToTStr(tileBank.getTileSet(i)->getName()));
if (tileBank.getLand(_land)->isTileSet (tileBank.getTileSet(i)->getName())) if (tileBank.getLand(_land)->isTileSet (tileBank.getTileSet(i)->getName()))
m_ctrlList.InsertString (-1, utf8ToTStr(tileBank.getTileSet(i)->getName())); m_ctrlList.InsertString(-1, nlUtf8ToTStr(tileBank.getTileSet(i)->getName()));
} }
UpdateData (FALSE); UpdateData (FALSE);
} }
@ -219,15 +219,15 @@ private:
{ {
UpdateData (); UpdateData ();
TCHAR sTitle[512]; TCHAR sTitle[512];
_stprintf(sTitle, _T("Children of the tile set %s"), utf8ToTStr(tileBank.getTileSet(_tileSet)->getName())); _stprintf(sTitle, _T("Children of the tile set %s"), nlUtf8ToTStr(tileBank.getTileSet(_tileSet)->getName()));
SetWindowText (sTitle); SetWindowText (sTitle);
for (int i=0; i<tileBank.getTileSetCount(); i++) for (int i=0; i<tileBank.getTileSetCount(); i++)
{ {
if (i!=_tileSet) if (i!=_tileSet)
m_ctrlCombo.InsertString (-1, utf8ToTStr(tileBank.getTileSet(i)->getName())); m_ctrlCombo.InsertString(-1, nlUtf8ToTStr(tileBank.getTileSet(i)->getName()));
if (tileBank.getTileSet(_tileSet)->isChild (tileBank.getTileSet(i)->getName())) if (tileBank.getTileSet(_tileSet)->isChild (tileBank.getTileSet(i)->getName()))
m_ctrlList.InsertString (-1, utf8ToTStr(tileBank.getTileSet(i)->getName())); m_ctrlList.InsertString(-1, nlUtf8ToTStr(tileBank.getTileSet(i)->getName()));
} }
UpdateData (FALSE); UpdateData (FALSE);
@ -379,17 +379,17 @@ void SelectionTerritoire::OnSelect()
for (i=0; i<tileBank.getLandCount(); i++) for (i=0; i<tileBank.getLandCount(); i++)
{ {
// Add to the list // Add to the list
list->AddString(utf8ToTStr(tileBank.getLand(i)->getName())); list->AddString(nlUtf8ToTStr(tileBank.getLand(i)->getName()));
} }
for (i=0; i<tileBank.getTileSetCount(); i++) for (i=0; i<tileBank.getTileSetCount(); i++)
{ {
// Add to the list // Add to the list
list2->AddString(utf8ToTStr(tileBank.getTileSet(i)->getName())); list2->AddString(nlUtf8ToTStr(tileBank.getTileSet(i)->getName()));
} }
MainFileName = CString(utf8ToTStr(NLMISC::CFile::getFilename(temp))); MainFileName = CString(nlUtf8ToTStr(NLMISC::CFile::getFilename(temp)));
DefautPath = CString(utf8ToTStr(NLMISC::CFile::getPath(temp))); DefautPath = CString(nlUtf8ToTStr(NLMISC::CFile::getPath(temp)));
MainFileOk = 1; MainFileOk = 1;
CButton *button = (CButton*)GetDlgItem(IDC_ADD_TERRITOIRE); CButton *button = (CButton*)GetDlgItem(IDC_ADD_TERRITOIRE);
@ -402,7 +402,7 @@ void SelectionTerritoire::OnSelect()
button->EnableWindow(true); button->EnableWindow(true);
// Change the bouton text path // Change the bouton text path
GetDlgItem (IDC_PATH)->SetWindowText (utf8ToTStr(tileBank.getAbsPath())); GetDlgItem(IDC_PATH)->SetWindowText(nlUtf8ToTStr(tileBank.getAbsPath()));
} }
} }
@ -468,8 +468,8 @@ void SelectionTerritoire::OnSaveAs()
// Create a file name // Create a file name
std::string temp = tStrToUtf8(sFile.GetPathName()); std::string temp = tStrToUtf8(sFile.GetPathName());
MainFileName = CString(utf8ToTStr(NLMISC::CFile::getFilename(temp))); MainFileName = CString(nlUtf8ToTStr(NLMISC::CFile::getFilename(temp)));
DefautPath = CString(utf8ToTStr(NLMISC::CFile::getPath(temp))); DefautPath = CString(nlUtf8ToTStr(NLMISC::CFile::getPath(temp)));
} }
} }
@ -582,7 +582,7 @@ void SelectionTerritoire::OnPath()
goodPath=false; goodPath=false;
// Make a message // Make a message
_stprintf(msg, _T("Path '%s' can't be found in bitmap '%s'. Continue ?"), path, utf8ToTStr(bitmapPath)); _stprintf(msg, _T("Path '%s' can't be found in bitmap '%s'. Continue ?"), path, nlUtf8ToTStr(bitmapPath));
// Message // Message
if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO) if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO)
@ -611,7 +611,7 @@ void SelectionTerritoire::OnPath()
goodPath=false; goodPath=false;
// Make a message // Make a message
_stprintf(msg, _T("Path '%s' can't be found in bitmap '%s'. Continue ?"), path, utf8ToTStr(bitmapPath)); _stprintf(msg, _T("Path '%s' can't be found in bitmap '%s'. Continue ?"), path, nlUtf8ToTStr(bitmapPath));
// Message // Message
if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO) if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO)

View file

@ -242,7 +242,7 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma
{ {
std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?"; std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?";
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO | MB_ICONEXCLAMATION) == IDYES);
} }
else else
{ {
@ -261,7 +261,7 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma
static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""}; static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""};
std::string msg = NLMISC::toString("%s\nPixel: %d (%s)\nContinue ?", CTileSet::getErrorMessage (error), pixel, comp[composante]); std::string msg = NLMISC::toString("%s\nPixel: %d (%s)\nContinue ?", CTileSet::getErrorMessage (error), pixel, comp[composante]);
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't add tile"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES);
} }
else else
{ {
@ -289,7 +289,7 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma
{ {
// Error: bitmap not in the absolute path.. // Error: bitmap not in the absolute path..
std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.\nContinue ?", name.c_str(), tileBank2.getAbsPath ().c_str()); std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.\nContinue ?", name.c_str(), tileBank2.getAbsPath ().c_str());
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Load error"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Load error"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES);
} }
return 1; return 1;
@ -307,7 +307,7 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
{ {
std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?"; std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?";
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO | MB_ICONEXCLAMATION) == IDYES);
} }
else else
{ {
@ -326,7 +326,7 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma
{ {
static const char* comp[] = { "Red", "Green", "Blue", "Alpha", "" }; static const char* comp[] = { "Red", "Green", "Blue", "Alpha", "" };
std::string msg = NLMISC::toString("%s\nPixel: %d (%s)\nContinue ?", CTileSet::getErrorMessage (error), pixel, comp[composante]); std::string msg = NLMISC::toString("%s\nPixel: %d (%s)\nContinue ?", CTileSet::getErrorMessage (error), pixel, comp[composante]);
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't add tile"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES);
} }
else else
{ {
@ -351,7 +351,7 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma
{ {
// Error: bitmap not in the absolute path.. // Error: bitmap not in the absolute path..
std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.\nContinue ?", name.c_str(), tileBank2.getAbsPath ().c_str()); std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.\nContinue ?", name.c_str(), tileBank2.getAbsPath ().c_str());
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Load error"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Load error"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES);
} }
return 1; return 1;
@ -372,7 +372,7 @@ int TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile:
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
{ {
std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?"; std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?";
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES); return (int)(MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO | MB_ICONEXCLAMATION) == IDYES);
} }
else else
{ {
@ -390,7 +390,7 @@ int TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile:
{ {
static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""}; static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""};
std::string msg = NLMISC::toString("%s\nPixel: %d (%s)\nContinue ?", CTileSet::getErrorMessage(error), pixel, comp[composante]); std::string msg = NLMISC::toString("%s\nPixel: %d (%s)\nContinue ?", CTileSet::getErrorMessage(error), pixel, comp[composante]);
return MessageBox (NULL, utf8ToTStr(msg), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES; return MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't add tile"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES;
} }
else else
{ {
@ -418,7 +418,7 @@ int TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile:
{ {
// Error: bitmap not in the absolute path.. // Error: bitmap not in the absolute path..
std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str()); std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str());
MessageBox (NULL, utf8ToTStr(msg), _T("Load error"), MB_OK|MB_ICONEXCLAMATION); MessageBox(NULL, nlUtf8ToTStr(msg), _T("Load error"), MB_OK | MB_ICONEXCLAMATION);
} }
return 1; return 1;
@ -439,7 +439,7 @@ int TileList::setDisplacement (int tile, const std::string& name)
if (!_LoadBitmap(tileBank2.getAbsPath() + troncated, &theListDisplacement[tile].BmpInfo, theListDisplacement[tile].Bits, NULL, 0)) if (!_LoadBitmap(tileBank2.getAbsPath() + troncated, &theListDisplacement[tile].BmpInfo, theListDisplacement[tile].Bits, NULL, 0))
{ {
std::string msg = tileBank2.getAbsPath() + troncated; std::string msg = tileBank2.getAbsPath() + troncated;
MessageBox(NULL, utf8ToTStr(msg), _T("Can't load file"), MB_OK | MB_ICONEXCLAMATION); MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't load file"), MB_OK | MB_ICONEXCLAMATION);
} }
else else
{ {
@ -447,7 +447,7 @@ int TileList::setDisplacement (int tile, const std::string& name)
if ((theListDisplacement[tile].BmpInfo.bmiHeader.biWidth!=32)||(-theListDisplacement[tile].BmpInfo.bmiHeader.biHeight!=32)) if ((theListDisplacement[tile].BmpInfo.bmiHeader.biWidth!=32)||(-theListDisplacement[tile].BmpInfo.bmiHeader.biHeight!=32))
{ {
// Error message // Error message
MessageBox (NULL, _T("Invalid size: displacement map must be 32x32 8 bits."), utf8ToTStr(troncated), MessageBox(NULL, _T("Invalid size: displacement map must be 32x32 8 bits."), nlUtf8ToTStr(troncated),
MB_OK|MB_ICONEXCLAMATION); MB_OK|MB_ICONEXCLAMATION);
// Free the bitmap // Free the bitmap
@ -468,7 +468,7 @@ int TileList::setDisplacement (int tile, const std::string& name)
{ {
// Error: bitmap not in the absolute path.. // Error: bitmap not in the absolute path..
std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str()); std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str());
MessageBox (NULL, utf8ToTStr(msg), _T("Load error"), MB_OK|MB_ICONEXCLAMATION); MessageBox(NULL, nlUtf8ToTStr(msg), _T("Load error"), MB_OK | MB_ICONEXCLAMATION);
} }
return 1; return 1;
@ -486,7 +486,7 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
{ {
std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?"; std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?";
return MessageBox (NULL, utf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES; return MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO | MB_ICONEXCLAMATION) == IDYES;
} }
else else
{ {
@ -528,7 +528,7 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot
msg += "\nContinue ?"; msg += "\nContinue ?";
return MessageBox (NULL, utf8ToTStr(msg), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES; return MessageBox(NULL, nlUtf8ToTStr(msg), _T("Can't add tile"), MB_YESNO | MB_ICONEXCLAMATION) == IDYES;
} }
else else
{ {
@ -542,7 +542,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..
TCHAR msg[512]; TCHAR msg[512];
_stprintf(msg, _T("The bitmap %s is not in the absolute path %s."), utf8ToTStr(name), utf8ToTStr(tileBank2.getAbsPath ())); _stprintf(msg, _T("The bitmap %s is not in the absolute path %s."), nlUtf8ToTStr(name), nlUtf8ToTStr(tileBank2.getAbsPath()));
MessageBox (NULL, msg, _T("Load error"), MB_OK|MB_ICONEXCLAMATION); MessageBox (NULL, msg, _T("Load error"), MB_OK|MB_ICONEXCLAMATION);
} }
@ -681,7 +681,7 @@ bool TileInfo::Load (int index, std::vector<NLMISC::CBGRA>* Alpha)
if (!_LoadBitmap(tileBank2.getAbsPath() + getRelativeFileName (CTile::diffuse, index), &BmpInfo, Bits, Alpha, 0)) if (!_LoadBitmap(tileBank2.getAbsPath() + getRelativeFileName (CTile::diffuse, index), &BmpInfo, Bits, Alpha, 0))
{ {
bRes=false; bRes=false;
MessageBox (NULL, utf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName (CTile::diffuse, index)), _T("Can't load file"), MB_OK|MB_ICONEXCLAMATION); MessageBox(NULL, nlUtf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName(CTile::diffuse, index)), _T("Can't load file"), MB_OK | MB_ICONEXCLAMATION);
} }
else else
loaded=1; loaded=1;
@ -691,7 +691,7 @@ bool TileInfo::Load (int index, std::vector<NLMISC::CBGRA>* Alpha)
if (!_LoadBitmap(tileBank2.getAbsPath() + getRelativeFileName (CTile::additive, index), &nightBmpInfo, nightBits, Alpha, 0)) if (!_LoadBitmap(tileBank2.getAbsPath() + getRelativeFileName (CTile::additive, index), &nightBmpInfo, nightBits, Alpha, 0))
{ {
bRes=false; bRes=false;
MessageBox (NULL, utf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName (CTile::additive, index)), _T("Can't load file"), MB_OK|MB_ICONEXCLAMATION); MessageBox(NULL, nlUtf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName(CTile::additive, index)), _T("Can't load file"), MB_OK | MB_ICONEXCLAMATION);
} }
else else
nightLoaded=1; nightLoaded=1;
@ -702,7 +702,7 @@ bool TileInfo::Load (int index, std::vector<NLMISC::CBGRA>* Alpha)
tileBank2.getTile (index)->getRotAlpha ())) tileBank2.getTile (index)->getRotAlpha ()))
{ {
bRes=false; bRes=false;
MessageBox (NULL, utf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName (CTile::alpha, index)), _T("Can't load file"), MB_OK|MB_ICONEXCLAMATION); MessageBox(NULL, nlUtf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName(CTile::alpha, index)), _T("Can't load file"), MB_OK | MB_ICONEXCLAMATION);
} }
else else
alphaLoaded=1; alphaLoaded=1;
@ -1145,7 +1145,7 @@ void CTView::OnDropFiles(HDROP hDropInfo)
case 0: case 0:
{ {
int index=InfoList.addTile128 (); int index=InfoList.addTile128 ();
if (InfoList.setTile128 (index, tStrToUtf8(FileName), Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha))) if (InfoList.setTile128 (index, NLMISC::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--;
@ -1159,7 +1159,7 @@ void CTView::OnDropFiles(HDROP hDropInfo)
case 1: case 1:
{ {
int index=InfoList.addTile256 (); int index=InfoList.addTile256 ();
if (InfoList.setTile256 (index, tStrToUtf8(FileName), Texture==1?CTile::diffuse:(Texture==2?CTile::additive:CTile::alpha))) if (InfoList.setTile256(index, NLMISC::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--;
@ -1534,7 +1534,7 @@ 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, utf8ToTStr(LastPath), OFN_ENABLESIZING | OFN_ALLOWMULTISELECT, _T("PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||"), NULL); CFileDialog load(true, NULL, nlUtf8ToTStr(LastPath), OFN_ENABLESIZING | OFN_ALLOWMULTISELECT, _T("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 TCHAR[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...
@ -1551,12 +1551,12 @@ LRESULT CTView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
CString str = load.GetNextPathName(p); CString str = load.GetNextPathName(p);
LastPath = NLMISC::CFile::getPath(tStrToUtf8(str)); LastPath = NLMISC::CFile::getPath(NLMISC::tStrToUtf8(str));
if (!str.IsEmpty()) if (!str.IsEmpty())
{ {
int index=0; int index=0;
std::string pathname = tStrToUtf8(str); std::string pathname = NLMISC::tStrToUtf8(str);
// Add mode, to the end of the list // Add mode, to the end of the list
if (id==ID_MENU_ADD) if (id==ID_MENU_ADD)

View file

@ -68,8 +68,8 @@ void CChooseVegetSet::OnBrowse()
if (dialog.DoModal() == IDOK) if (dialog.DoModal() == IDOK)
{ {
// Get the file name // Get the file name
FileName = tStrToUtf8(dialog.GetFileName ()); FileName = NLMISC::tStrToUtf8(dialog.GetFileName());
Name.SetWindowText (utf8ToTStr(FileName)); Name.SetWindowText(nlUtf8ToTStr(FileName));
} }
} }
@ -78,7 +78,7 @@ BOOL CChooseVegetSet::OnInitDialog()
CDialog::OnInitDialog(); CDialog::OnInitDialog();
if (!FileName.empty()) if (!FileName.empty())
Name.SetWindowText (utf8ToTStr(FileName)); Name.SetWindowText(nlUtf8ToTStr(FileName));
else else
Name.SetWindowText (_T("Browse...")); Name.SetWindowText (_T("Browse..."));