Cleaning up unicode conversion

This commit is contained in:
kaetemi 2019-05-01 07:51:59 +08:00
parent 44b7adb569
commit 09225503fc
20 changed files with 123 additions and 122 deletions

View file

@ -15,11 +15,13 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <windows.h> #include <windows.h>
#include <tchar.h>
#include <string> #include <string>
#include <stdio.h> #include <stdio.h>
using namespace std; using namespace std;
int APIENTRY _tWinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPTSTR /* lpCmdLine */, int /* nCmdShow */) int APIENTRY _tWinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPTSTR lpCmdLine, int /* nCmdShow */)
{ {
char *filename; char *filename;
if (filename = strstr (lpCmdLine, "-f ")) if (filename = strstr (lpCmdLine, "-f "))

View file

@ -40,7 +40,7 @@ void pump ()
DispatchMessage(&msg); DispatchMessage(&msg);
} }
} }
int APIENTRY _tWinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPTSTR /* lpCmdLine */, int /* nCmdShow */) int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPTSTR /* lpCmdLine */, int /* nCmdShow */)
{ {
// Windows // Windows
HWND hwnd = CreateDialog (hInstance, MAKEINTRESOURCE(IDD_WAIT), NULL, MyDialogProc); HWND hwnd = CreateDialog (hInstance, MAKEINTRESOURCE(IDD_WAIT), NULL, MyDialogProc);

View file

@ -130,7 +130,7 @@ bool CDataBase::init (const string &Path, CZoneBank &zb)
string sDirBackup = NLMISC::CPath::getCurrentPath(); string sDirBackup = NLMISC::CPath::getCurrentPath();
// "Path" can be relative to the doc path so we have to be first in the doc path // "Path" can be relative to the doc path so we have to be first in the doc path
string s2 = NLMISC::CFile::getPath (tStrToUtf8(getMainFrame()->getDocument()->GetPathName())); string s2 = NLMISC::CFile::getPath(NLMISC::tStrToUtf8(getMainFrame()->getDocument()->GetPathName()));
NLMISC::CPath::setCurrentPath(s2.c_str()); NLMISC::CPath::setCurrentPath(s2.c_str());
string ss = NLMISC::CPath::getFullPath(Path); string ss = NLMISC::CPath::getFullPath(Path);
NLMISC::CPath::setCurrentPath(ss.c_str()); NLMISC::CPath::setCurrentPath(ss.c_str());
@ -623,7 +623,7 @@ bool CBuilderZone::refresh ()
{ {
unload (_ZoneRegionSelected); unload (_ZoneRegionSelected);
std::string msg = NLMISC::toString("Cannot add this zone :\n%s", error.c_str()); std::string msg = NLMISC::toString("Cannot add this zone :\n%s", error.c_str());
MessageBox (NULL, utf8ToTStr(msg), _T("Error"), MB_ICONERROR|MB_OK); MessageBox (NULL, nlUtf8ToTStr(msg), _T("Error"), MB_ICONERROR|MB_OK);
return false; return false;
} }
@ -1601,7 +1601,7 @@ bool CBuilderZone::initZoneBank (const string &sPathName)
// TODO: replace by NeL methods // TODO: replace by NeL methods
TCHAR sDirBackup[512]; TCHAR sDirBackup[512];
GetCurrentDirectory(512, sDirBackup); GetCurrentDirectory(512, sDirBackup);
SetCurrentDirectory (utf8ToTStr(sPathName)); SetCurrentDirectory(nlUtf8ToTStr(sPathName));
WIN32_FIND_DATA findData; WIN32_FIND_DATA findData;
HANDLE hFind; HANDLE hFind;
hFind = FindFirstFile(_T("*.ligozone"), &findData); hFind = FindFirstFile(_T("*.ligozone"), &findData);
@ -1612,7 +1612,7 @@ bool CBuilderZone::initZoneBank (const string &sPathName)
if (!((_tcscmp(findData.cFileName, _T(".")) == 0) || (_tcscmp(findData.cFileName, _T("..")) == 0))) if (!((_tcscmp(findData.cFileName, _T(".")) == 0) || (_tcscmp(findData.cFileName, _T("..")) == 0)))
{ {
string error; string error;
if (!_ZoneBank.addElement (tStrToUtf8(findData.cFileName), error)) if (!_ZoneBank.addElement(NLMISC::tStrToUtf8(findData.cFileName), error))
theApp.errorMessage(error.c_str()); theApp.errorMessage(error.c_str());
} }
if (FindNextFile(hFind, &findData) == 0) if (FindNextFile(hFind, &findData) == 0)

View file

@ -352,7 +352,7 @@ void CDialogProperties::addWidget (const CPrimitiveClass::CParameter &parameter,
string Name = widget.Parameter.Name; string Name = widget.Parameter.Name;
// Create a check box // Create a check box
nlverify (widget.CheckBox.Create (utf8ToTStr(Name), BS_3STATE|WS_VISIBLE|WS_TABSTOP|(enabled?0:WS_DISABLED), widgetPos, &m_PropertyCont, id)); nlverify(widget.CheckBox.Create(nlUtf8ToTStr(Name), BS_3STATE | WS_VISIBLE | WS_TABSTOP | (enabled ? 0 : WS_DISABLED), widgetPos, &m_PropertyCont, id));
widget.CheckBox.SetFont (GetFont ()); widget.CheckBox.SetFont (GetFont ());
} }
else if (widget.Parameter.Type == CPrimitiveClass::CParameter::ConstString) else if (widget.Parameter.Type == CPrimitiveClass::CParameter::ConstString)
@ -522,7 +522,7 @@ void CDialogProperties::addWidget (const CPrimitiveClass::CParameter &parameter,
for (vector<string>::iterator it=PathList.begin(), itEnd=PathList.end(); it!=itEnd; ++it) for (vector<string>::iterator it=PathList.begin(), itEnd=PathList.end(); it!=itEnd; ++it)
{ {
widget.ListEditBox.StringSelectComboBox.InsertString( -1, utf8ToTStr(*it)); widget.ListEditBox.StringSelectComboBox.InsertString( -1, nlUtf8ToTStr(*it));
} }
} }
@ -549,7 +549,7 @@ void CDialogProperties::addWidget (const CPrimitiveClass::CParameter &parameter,
for (vector<string>::iterator it=PathList.begin(), itEnd=PathList.end(); it!=itEnd; ++it) for (vector<string>::iterator it=PathList.begin(), itEnd=PathList.end(); it!=itEnd; ++it)
{ {
widget.ListEditBox.StringSelectComboBox.InsertString( -1, utf8ToTStr(*it)); widget.ListEditBox.StringSelectComboBox.InsertString(-1, nlUtf8ToTStr(*it));
} }
} }
} }
@ -915,11 +915,11 @@ bool CDialogProperties::CWidget::fromParameter (const IProperty *property, const
updateBoolean (); updateBoolean ();
break; break;
case CPrimitiveClass::CParameter::ConstString: case CPrimitiveClass::CParameter::ConstString:
if (Parameter.Editable || ComboBox.SelectString(-1, utf8ToTStr(propString->String)) == CB_ERR) if (Parameter.Editable || ComboBox.SelectString(-1, nlUtf8ToTStr(propString->String)) == CB_ERR)
{ {
ComboBox.SetWindowText(utf8ToTStr(propString->String)); ComboBox.SetWindowText(nlUtf8ToTStr(propString->String));
ComboBox.InsertString( -1, utf8ToTStr(propString->String)); ComboBox.InsertString(-1, nlUtf8ToTStr(propString->String));
ComboBox.SelectString(-1, utf8ToTStr(propString->String)); ComboBox.SelectString(-1, nlUtf8ToTStr(propString->String));
} }
OriginalString = propString->String.c_str(); OriginalString = propString->String.c_str();
updateCombo (); updateCombo ();
@ -953,7 +953,7 @@ bool CDialogProperties::CWidget::fromParameter (const IProperty *property, const
updateBoolean (); updateBoolean ();
break; break;
case CPrimitiveClass::CParameter::ConstString: case CPrimitiveClass::CParameter::ConstString:
ComboBox.SelectString(-1, utf8ToTStr(result)); ComboBox.SelectString(-1, nlUtf8ToTStr(result));
OriginalString = result.c_str(); OriginalString = result.c_str();
updateCombo (); updateCombo ();
break; break;
@ -1282,7 +1282,7 @@ void CDialogProperties::CWidget::updateCombo ()
DialogProperties->setDefaultValue (this, value); DialogProperties->setDefaultValue (this, value);
if (value != "") if (value != "")
{ {
int index = ComboBox.FindString (-1, utf8ToTStr(value)); int index = ComboBox.FindString(-1, nlUtf8ToTStr(value));
if (index != CB_ERR) if (index != CB_ERR)
ComboBox.SetCurSel (index); ComboBox.SetCurSel (index);
} }
@ -1621,14 +1621,14 @@ BOOL CDialogProperties::OnCommand(WPARAM wParam, LPARAM lParam)
/* todo hulud remove /* todo hulud remove
CString oldValue; CString oldValue;
widget->EditBox.GetWindowText (oldValue);*/ widget->EditBox.GetWindowText (oldValue);*/
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("default"), TRUE, utf8ToTStr(widget->Parameter.FileExtension), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, CFileDialogEx dialog(BASE_REGISTRY_KEY, _T("default"), TRUE, nlUtf8ToTStr(widget->Parameter.FileExtension), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
utf8ToTStr(widget->Parameter.FileExtension+" (*."+widget->Parameter.FileExtension+")|*."+widget->Parameter.FileExtension+"|All Files (*.*)|*.*||"), getMainFrame ()); nlUtf8ToTStr(widget->Parameter.FileExtension + " (*." + widget->Parameter.FileExtension + ")|*." + widget->Parameter.FileExtension + "|All Files (*.*)|*.*||"), getMainFrame());
TCHAR temp[MAX_PATH]; TCHAR temp[MAX_PATH];
if (!widget->Parameter.Folder.empty()) if (!widget->Parameter.Folder.empty())
{ {
_tcscpy_s(temp, MAX_PATH, utf8ToTStr(widget->Parameter.Folder)); _tcscpy_s(temp, MAX_PATH, nlUtf8ToTStr(widget->Parameter.Folder));
dialog.m_ofn.lpstrInitialDir = temp; dialog.m_ofn.lpstrInitialDir = temp;
} }
@ -1636,7 +1636,7 @@ BOOL CDialogProperties::OnCommand(WPARAM wParam, LPARAM lParam)
{ {
CString str; CString str;
str = dialog.GetFileTitle(); str = dialog.GetFileTitle();
setWindowTextUTF8 (widget->EditBox, tStrToUtf8(str)); setWindowTextUTF8 (widget->EditBox, NLMISC::tStrToUtf8(str));
/* todo hulud remove /* todo hulud remove
if ((const char*)oldValue != str) if ((const char*)oldValue != str)
@ -2305,7 +2305,7 @@ void CDialogProperties::rebuildDialog ()
m_ScrollBar.MoveWindow(&scrollRect, TRUE); m_ScrollBar.MoveWindow(&scrollRect, TRUE);
// set the name of the dlg according to displayed class // set the name of the dlg according to displayed class
SetWindowText( CString(_T("Properties for : ")) + utf8ToTStr(windowName) ); SetWindowText(CString(_T("Properties for : ")) + nlUtf8ToTStr(windowName));
// // JC: added scrolling properties // // JC: added scrolling properties
// ::CRect clientRect; // ::CRect clientRect;
@ -2982,13 +2982,12 @@ void CDialogProperties::SelectFolder(CWidget *widget)
LPITEMIDLIST pidlRoot = NULL; LPITEMIDLIST pidlRoot = NULL;
LPSHELLFOLDER desktop; LPSHELLFOLDER desktop;
ULONG ulDummy;
SHGetDesktopFolder (&desktop); SHGetDesktopFolder (&desktop);
if (widget->Parameter.Folder != "") if (widget->Parameter.Folder != "")
{ {
desktop->ParseDisplayName (NULL, NULL, utf8ToTStr(widget->Parameter.Folder), &ulDummy, &pidlRoot, &ulDummy); desktop->ParseDisplayName(NULL, NULL, (LPTSTR)nlUtf8ToTStr(widget->Parameter.Folder), NULL, &pidlRoot, NULL);
} }
bi.pidlRoot = pidlRoot; bi.pidlRoot = pidlRoot;
@ -3454,7 +3453,7 @@ void CMyComboBox::reloadData()
SetRedraw(FALSE); SetRedraw(FALSE);
InsertString(-1, _T("")); InsertString(-1, _T(""));
for (vector<string>::iterator it=_data.begin(), itEnd=_data.end(); it!=itEnd; ++it) for (vector<string>::iterator it=_data.begin(), itEnd=_data.end(); it!=itEnd; ++it)
InsertString(-1, utf8ToTStr(*it)); InsertString(-1, nlUtf8ToTStr(*it));
loaded = true; loaded = true;
SetRedraw(TRUE); SetRedraw(TRUE);
if(n != CB_ERR) SelectString(-1, s); if(n != CB_ERR) SelectString(-1, s);

View file

@ -318,7 +318,7 @@ void CDisplay::init (CMainFrame *pMF)
} }
} }
SetCurrentDirectory (utf8ToTStr(pMF->_ExeDir)); SetCurrentDirectory (nlUtf8ToTStr(pMF->_ExeDir));
} }
// *************************************************************************** // ***************************************************************************
@ -3554,7 +3554,7 @@ void CDisplay::DrawCollisionTexture(sint32 count, float x1, float y1)
string dir = getDocument ()->getDataDir (); string dir = getDocument ()->getDataDir ();
if (dir.empty()) dir = _MainFrame->_ExeDir; if (dir.empty()) dir = _MainFrame->_ExeDir;
dir += "\\collisionmap\\"; dir += "\\collisionmap\\";
SetCurrentDirectory (utf8ToTStr(dir)); SetCurrentDirectory(nlUtf8ToTStr(dir));
if(NLMISC::CFile::fileExists(Name+".tga") || NLMISC::CFile::fileExists(Name+".png")) if(NLMISC::CFile::fileExists(Name+".tga") || NLMISC::CFile::fileExists(Name+".png"))
{ {

View file

@ -58,7 +58,7 @@ bool EditExternalText (const std::string &editor, std::string &text, const std::
} }
// Hide the file // Hide the file
SetFileAttributes (utf8ToTStr(tempFilename), FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM); SetFileAttributes(nlUtf8ToTStr(tempFilename), FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM);
// Open the temp file with a text editor // Open the temp file with a text editor
if (saved) if (saved)

View file

@ -112,7 +112,7 @@ void CFindPrimitiveDlg::OnFindNext()
// || ( _Locator.Primitive->getPropertyByName ("selected", property) // || ( _Locator.Primitive->getPropertyByName ("selected", property)
|| ( getPrimitiveEditor(_Locator.Primitive)->getSelected())) || ( getPrimitiveEditor(_Locator.Primitive)->getSelected()))
// && property) ) // && property) )
&& _Locator.Primitive->getPropertyByName (tStrToUtf8(Property), property) && _Locator.Primitive->getPropertyByName (NLMISC::tStrToUtf8(Property), property)
&& property) && property)
{ {
// Kind of primitive ? // Kind of primitive ?
@ -120,7 +120,7 @@ void CFindPrimitiveDlg::OnFindNext()
if (propString) if (propString)
{ {
// Good value ? // Good value ?
if (propString->String.find(tStrToUtf8(Value))!=std::string::npos) if (propString->String.find(NLMISC::tStrToUtf8(Value)) != std::string::npos)
{ {
found = true; found = true;
} }
@ -135,7 +135,7 @@ void CFindPrimitiveDlg::OnFindNext()
uint i; uint i;
for (i=0; i<propStringArray->StringArray.size (); i++) for (i=0; i<propStringArray->StringArray.size (); i++)
{ {
if (propStringArray->StringArray[i].find(tStrToUtf8(Value))!=std::string::npos) if (propStringArray->StringArray[i].find(NLMISC::tStrToUtf8(Value)) != std::string::npos)
{ {
found = true; found = true;
} }
@ -230,7 +230,7 @@ void CFindPrimitiveDlg::replace(bool all)
// || ( _Locator.Primitive->getPropertyByName ("selected", property) // || ( _Locator.Primitive->getPropertyByName ("selected", property)
|| ( getPrimitiveEditor(_Locator.Primitive)->getSelected())) || ( getPrimitiveEditor(_Locator.Primitive)->getSelected()))
// && property) ) // && property) )
&& _Locator.Primitive->getPropertyByName (tStrToUtf8(Property), property) && _Locator.Primitive->getPropertyByName(NLMISC::tStrToUtf8(Property), property)
&& property ) && property )
{ {
// Kind of primitive ? // Kind of primitive ?
@ -238,14 +238,14 @@ void CFindPrimitiveDlg::replace(bool all)
if (propString) if (propString)
{ {
// Good value ? // Good value ?
if (propString->String.find(tStrToUtf8(Value))!=std::string::npos) if (propString->String.find(NLMISC::tStrToUtf8(Value)) != std::string::npos)
{ {
if (!firstTime && !all) if (!firstTime && !all)
break; break;
CString tmp(propString->String.c_str()); CString tmp(propString->String.c_str());
tmp.Replace(Value, ReplaceText); tmp.Replace(Value, ReplaceText);
doc->addModification (new CActionSetPrimitivePropertyString (_Locator, tStrToUtf8(Property), tStrToUtf8(tmp), false)); doc->addModification(new CActionSetPrimitivePropertyString(_Locator, NLMISC::tStrToUtf8(Property), NLMISC::tStrToUtf8(tmp), false));
doc->addModification (new CActionSelect (_Locator)); doc->addModification (new CActionSelect (_Locator));
firstTime=false; firstTime=false;
@ -265,7 +265,7 @@ void CFindPrimitiveDlg::replace(bool all)
for (i=0; i<propStringArray->StringArray.size (); i++) for (i=0; i<propStringArray->StringArray.size (); i++)
{ {
// todo. // todo.
if (propStringArray->StringArray[i].find(tStrToUtf8(Value))!=std::string::npos) if (propStringArray->StringArray[i].find(NLMISC::tStrToUtf8(Value)) != std::string::npos)
{ {
if ( !firstTime if ( !firstTime
&& !all) && !all)
@ -281,7 +281,7 @@ void CFindPrimitiveDlg::replace(bool all)
newStrings=propStringArray->StringArray; newStrings=propStringArray->StringArray;
firstChange=false; firstChange=false;
} }
newStrings[i] = tStrToUtf8(tmp); newStrings[i] = NLMISC::tStrToUtf8(tmp);
} }
firstTime=false; firstTime=false;
} }
@ -290,7 +290,7 @@ void CFindPrimitiveDlg::replace(bool all)
if (!firstChange) // have to make a change if (!firstChange) // have to make a change
{ {
doc->addModification (new CActionSetPrimitivePropertyStringArray (_Locator, tStrToUtf8(Property), newStrings, false)); doc->addModification(new CActionSetPrimitivePropertyStringArray(_Locator, NLMISC::tStrToUtf8(Property), newStrings, false));
doc->addModification (new CActionSelect (_Locator)); doc->addModification (new CActionSelect (_Locator));
} }

View file

@ -75,7 +75,7 @@ BOOL CGenerateDlg::OnInitDialog()
// TODO: Add extra initialization here // TODO: Add extra initialization here
for (uint32 i = 0; i < AllMaterials.size(); ++i) for (uint32 i = 0; i < AllMaterials.size(); ++i)
ComboMaterial.InsertString(-1, utf8ToTStr(AllMaterials[i])); ComboMaterial.InsertString(-1, nlUtf8ToTStr(AllMaterials[i]));
ComboMaterial.SetCurSel (0); ComboMaterial.SetCurSel (0);

View file

@ -100,7 +100,7 @@ void CImageListEx::addResourceIcon (const char *filename)
int height = imageInfo.rcImage.bottom - imageInfo.rcImage.top; int height = imageInfo.rcImage.bottom - imageInfo.rcImage.top;
// Load the icon // Load the icon
HICON handle = (HICON) LoadImage (NULL, utf8ToTStr(filename), IMAGE_ICON, width, height, LR_COLOR|LR_LOADFROMFILE); HICON handle = (HICON) LoadImage (NULL, nlUtf8ToTStr(filename), IMAGE_ICON, width, height, LR_COLOR|LR_LOADFROMFILE);
if (handle) if (handle)
{ {
// Copy the icon // Copy the icon

View file

@ -759,11 +759,11 @@ void CMainFrame::displayStatusBarInfo ()
string text; string text;
if (dispWnd->getActionHelp (text)) if (dispWnd->getActionHelp (text))
{ {
m_wndStatusBar.SetPaneText (0, utf8ToTStr(text)); m_wndStatusBar.SetPaneText(0, nlUtf8ToTStr(text));
} }
else else
{ {
m_wndStatusBar.SetPaneText (0, utf8ToTStr(sTmp)); m_wndStatusBar.SetPaneText(0, nlUtf8ToTStr(sTmp));
} }
//for (uint32 i = sTmp.size(); i < 10; ++i) //for (uint32 i = sTmp.size(); i < 10; ++i)
// sTmp += " "; // sTmp += " ";
@ -771,12 +771,12 @@ void CMainFrame::displayStatusBarInfo ()
// Write zone reference name // Write zone reference name
if (dispWnd->getActionText (text)) if (dispWnd->getActionText (text))
{ {
m_wndStatusBar.SetPaneText (1, utf8ToTStr(text)); m_wndStatusBar.SetPaneText(1, nlUtf8ToTStr(text));
} }
else else
{ {
sTmp = _ZoneBuilder->getZoneName (x, y); sTmp = _ZoneBuilder->getZoneName (x, y);
m_wndStatusBar.SetPaneText (1, utf8ToTStr(sTmp)); m_wndStatusBar.SetPaneText(1, nlUtf8ToTStr(sTmp));
} }
// Write coordinates // Write coordinates
@ -784,15 +784,15 @@ void CMainFrame::displayStatusBarInfo ()
sprintf(temp, "(%.3f , %.3f)", v.x, v.y); sprintf(temp, "(%.3f , %.3f)", v.x, v.y);
sTmp = temp; sTmp = temp;
// sTmp = "( " + toString(v.x) + " , " + toString(v.y) + " )"; // sTmp = "( " + toString(v.x) + " , " + toString(v.y) + " )";
m_wndStatusBar.SetPaneText (2, utf8ToTStr(sTmp)); m_wndStatusBar.SetPaneText(2, nlUtf8ToTStr(sTmp));
// Write rot // Write rot
sTmp = "Rot(" + toString(_ZoneBuilder->getRot(x, y)) + ")"; sTmp = "Rot(" + toString(_ZoneBuilder->getRot(x, y)) + ")";
m_wndStatusBar.SetPaneText (3, utf8ToTStr(sTmp)); m_wndStatusBar.SetPaneText(3, nlUtf8ToTStr(sTmp));
// Write flip // Write flip
sTmp = "Flip(" + toString(_ZoneBuilder->getFlip(x, y)) + ")"; sTmp = "Flip(" + toString(_ZoneBuilder->getFlip(x, y)) + ")";
m_wndStatusBar.SetPaneText (4, utf8ToTStr(sTmp)); m_wndStatusBar.SetPaneText(4, nlUtf8ToTStr(sTmp));
// Write selection // Write selection
if (Selection.size ()) if (Selection.size ())
@ -804,7 +804,7 @@ void CMainFrame::displayStatusBarInfo ()
} }
else else
sTmp = "No selected primitive"; sTmp = "No selected primitive";
m_wndStatusBar.SetPaneText (5, utf8ToTStr(sTmp)); m_wndStatusBar.SetPaneText(5, nlUtf8ToTStr(sTmp));
// Write path of selected primitive // Write path of selected primitive
if (Selection.size()) if (Selection.size())
@ -812,14 +812,14 @@ void CMainFrame::displayStatusBarInfo ()
else else
sTmp.clear(); sTmp.clear();
m_wndStatusBar.SetPaneText (6, utf8ToTStr(sTmp)); m_wndStatusBar.SetPaneText(6, nlUtf8ToTStr(sTmp));
} }
// *************************************************************************** // ***************************************************************************
void CMainFrame::displayInfo (const std::string &info) void CMainFrame::displayInfo (const std::string &info)
{ {
m_wndStatusBar.SetPaneText (6, utf8ToTStr(info)); m_wndStatusBar.SetPaneText(6, nlUtf8ToTStr(info));
} }
// *************************************************************************** // ***************************************************************************
@ -858,7 +858,7 @@ void CMainFrame::uninit ()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
MessageBox (utf8ToTStr(e.what()), _T("Warning")); MessageBox(nlUtf8ToTStr(e.what()), _T("Warning"));
} }
} }
@ -2710,7 +2710,7 @@ void CMainFrame::createContextMenu (CWnd *parent, const CPoint &point, bool tran
// For each child, add a create method // For each child, add a create method
for (uint i=0; i<primClass->DynamicChildren.size (); i++) for (uint i=0; i<primClass->DynamicChildren.size (); i++)
{ {
pMenu->AppendMenu (MF_STRING, ID_EDIT_CREATE_BEGIN+i, utf8ToTStr("Add " + primClass->DynamicChildren[i].ClassName)); pMenu->AppendMenu(MF_STRING, ID_EDIT_CREATE_BEGIN + i, nlUtf8ToTStr("Add " + primClass->DynamicChildren[i].ClassName));
} }
} }
@ -2723,7 +2723,7 @@ void CMainFrame::createContextMenu (CWnd *parent, const CPoint &point, bool tran
// For each child, add a create method // For each child, add a create method
for (uint i=0; i<primClass->GeneratedChildren.size (); i++) for (uint i=0; i<primClass->GeneratedChildren.size (); i++)
{ {
pMenu->AppendMenu (MF_STRING, ID_EDIT_GENERATE_BEGIN+i, utf8ToTStr("Generate "+primClass->GeneratedChildren[i].ClassName)); pMenu->AppendMenu(MF_STRING, ID_EDIT_GENERATE_BEGIN + i, nlUtf8ToTStr("Generate " + primClass->GeneratedChildren[i].ClassName));
} }
} }
@ -2747,7 +2747,7 @@ void CMainFrame::createContextMenu (CWnd *parent, const CPoint &point, bool tran
for (i=0; i<filenames.size (); i++) for (i=0; i<filenames.size (); i++)
{ {
// Add a menu entry // Add a menu entry
pMenu->AppendMenu (MF_STRING, ID_EDIT_OPEN_FILE_BEGIN+i, utf8ToTStr("Open " + NLMISC::CFile::getFilename (filenames[i]))); pMenu->AppendMenu(MF_STRING, ID_EDIT_OPEN_FILE_BEGIN + i, nlUtf8ToTStr("Open " + NLMISC::CFile::getFilename(filenames[i])));
} }
} }
} }
@ -3717,7 +3717,7 @@ void CMainFrame::OnProjectForceiduniqueness()
// End modifications // End modifications
doc->endModification (); doc->endModification ();
AfxMessageBox(utf8ToTStr(NLMISC::toString("%u ids checked, %u non unique ID regenerated", ids.size()+nonUnique.size(), nonUnique.size())), MB_OK); AfxMessageBox(nlUtf8ToTStr(NLMISC::toString("%u ids checked, %u non unique ID regenerated", ids.size() + nonUnique.size(), nonUnique.size())), MB_OK);
} }
// *************************************************************************** // ***************************************************************************
@ -4351,7 +4351,7 @@ void CMainFrame::OnMissionCompiler()
} }
TCHAR path[MAX_PATH]; TCHAR path[MAX_PATH];
_tcscpy(path, utf8ToTStr(var->asString())); _tcscpy(path, nlUtf8ToTStr(var->asString()));
SHELLEXECUTEINFO ExecuteInfo; SHELLEXECUTEINFO ExecuteInfo;
memset(&ExecuteInfo, 0, sizeof(ExecuteInfo)); memset(&ExecuteInfo, 0, sizeof(ExecuteInfo));

View file

@ -69,7 +69,7 @@ BOOL CMyListBox::OnCommand(WPARAM wParam, LPARAM lParam)
std::string str; std::string str;
getWindowTextUTF8 (StringSelectComboBox, str); getWindowTextUTF8 (StringSelectComboBox, str);
DeleteString(_EditingItem); DeleteString(_EditingItem);
InsertString(_EditingItem, utf8ToTStr(str)); InsertString(_EditingItem, nlUtf8ToTStr(str));
SetCurSel (_SelectAfter); SetCurSel (_SelectAfter);
_EditingItem = LB_ERR; _EditingItem = LB_ERR;
notifyParent (); notifyParent ();

View file

@ -88,7 +88,7 @@ BOOL CNameDlg::OnInitDialog()
// print the data directory // print the data directory
CWnd* pWnd = GetDlgItem(IDC_NAME_DIR); CWnd* pWnd = GetDlgItem(IDC_NAME_DIR);
pWnd->SetWindowText(CString(_T("Data directory: ")) + utf8ToTStr(m_dataDir)); pWnd->SetWindowText(CString(_T("Data directory: ")) + nlUtf8ToTStr(m_dataDir));
// tab stops to simulate multi-columns edit boxes // tab stops to simulate multi-columns edit boxes
int tab_stop1[1] = {160}; int tab_stop1[1] = {160};
@ -156,18 +156,18 @@ void CNameDlg::updateSearchList()
{ {
// no filter // no filter
m_listToName.insert(std::make_pair(j, i)); m_listToName.insert(std::make_pair(j, i));
m_searchList.InsertString(j++, utf8ToTStr(s)); m_searchList.InsertString(j++, nlUtf8ToTStr(s));
} }
else else
{ {
std::string filter(tStrToUtf8(m_nameFilter.LockBuffer())); std::string filter(NLMISC::tStrToUtf8(m_nameFilter.LockBuffer()));
m_nameFilter.UnlockBuffer(); m_nameFilter.UnlockBuffer();
// filter // filter
if (NLMISC::toLower(ig).find(NLMISC::toLower(filter)) != std::string::npos) if (NLMISC::toLower(ig).find(NLMISC::toLower(filter)) != std::string::npos)
{ {
m_listToName.insert(std::make_pair(j, i)); m_listToName.insert(std::make_pair(j, i));
m_searchList.InsertString(j++, utf8ToTStr(s)); m_searchList.InsertString(j++, nlUtf8ToTStr(s));
} }
} }
} }
@ -214,7 +214,7 @@ void CNameDlg::updateSelectList()
m_listToId.insert(std::make_pair(i, row)); m_listToId.insert(std::make_pair(i, row));
} }
m_idList.InsertString(i++, utf8ToTStr(s)); m_idList.InsertString(i++, nlUtf8ToTStr(s));
} }
} }
@ -251,8 +251,8 @@ void CNameDlg::OnBtnAssign()
// get strings // get strings
ucstring id; ucstring id;
std::string gn = tStrToUtf8(m_assignGn); std::string gn = NLMISC::tStrToUtf8(m_assignGn);
std::string ig = tStrToUtf8(m_assignIg); std::string ig = NLMISC::tStrToUtf8(m_assignIg);
for (uint i=0 ; i<sel.size() ; i++) for (uint i=0 ; i<sel.size() ; i++)
{ {
@ -268,7 +268,7 @@ void CNameDlg::OnBtnAssign()
uint n = m_idList.GetTextLen(i); uint n = m_idList.GetTextLen(i);
m_idList.GetText(i, str.GetBuffer(n)); m_idList.GetText(i, str.GetBuffer(n));
str.ReleaseBuffer(); str.ReleaseBuffer();
id.fromUtf8(tStrToUtf8(str)); id.fromUtf8(NLMISC::tStrToUtf8(str));
} }
// assign name to selected id // assign name to selected id
@ -359,7 +359,7 @@ void CNameDlg::checkNewGn()
{ {
// print a message if a new gn will be added to the list // print a message if a new gn will be added to the list
CWnd* pWnd = GetDlgItem(IDC_NAME_NEWGN); CWnd* pWnd = GetDlgItem(IDC_NAME_NEWGN);
std::string s = tStrToUtf8(m_assignGn); std::string s = NLMISC::tStrToUtf8(m_assignGn);
uint rowIndex; uint rowIndex;
if (s == "") if (s == "")
{ {

View file

@ -114,7 +114,7 @@ BOOL CPrimitiveConfigurationDlg::OnInitDialog()
uint i; uint i;
for (i=0; i<configurations.size(); i++) for (i=0; i<configurations.size(); i++)
{ {
ListCtrl.InsertItem (i, utf8ToTStr(configurations[i].Name)); ListCtrl.InsertItem(i, nlUtf8ToTStr(configurations[i].Name));
// setItemTextUTF8 (List, nItem, subString++, entry.Strings[CEntryFile::OldSize].c_str ()); // setItemTextUTF8 (List, nItem, subString++, entry.Strings[CEntryFile::OldSize].c_str ());
} }

View file

@ -77,7 +77,7 @@ void CProjectSettings::OnBrowse()
BROWSEINFO bi; BROWSEINFO bi;
TCHAR str[MAX_PATH]; TCHAR str[MAX_PATH];
ITEMIDLIST* pidl; LPITEMIDLIST pidl;
TCHAR sTemp[1024]; TCHAR sTemp[1024];
bi.hwndOwner = this->m_hWnd; bi.hwndOwner = this->m_hWnd;
@ -133,11 +133,11 @@ BOOL CProjectSettings::OnInitDialog()
for (uint i=0; i<contexts.size (); i++) for (uint i=0; i<contexts.size (); i++)
{ {
// Add the string // Add the string
Context.InsertString (-1, utf8ToTStr(contexts[i])); Context.InsertString(-1, nlUtf8ToTStr(contexts[i]));
} }
// Select the string // Select the string
Context.SelectString (-1, utf8ToTStr(doc->getContext ())); Context.SelectString(-1, nlUtf8ToTStr(doc->getContext()));
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

@ -1231,7 +1231,7 @@ BOOL CCreateDialog::OnInitDialog ()
for (uint32 i = 0; i < TypesForInit->size(); ++i) for (uint32 i = 0; i < TypesForInit->size(); ++i)
{ {
ComboType.InsertString (-1, utf8ToTStr(TypesForInit->operator[](i).Name)); ComboType.InsertString(-1, nlUtf8ToTStr(TypesForInit->operator[](i).Name));
} }
if (TypesForInit->size()>0) if (TypesForInit->size()>0)
@ -1264,10 +1264,10 @@ void CCreateDialog::OnOK()
UpdateData (); UpdateData ();
// If the "region_" do not exist add it // If the "region_" do not exist add it
if (_tcsnccmp(utf8ToTStr(RegionPost), Name, strlen(RegionPost.c_str())) != 0) if (_tcsnccmp(nlUtf8ToTStr(RegionPost), Name, strlen(RegionPost.c_str())) != 0)
{ {
TCHAR sTmp[128]; TCHAR sTmp[128];
_tcscpy (sTmp, utf8ToTStr(RegionPost)); _tcscpy(sTmp, nlUtf8ToTStr(RegionPost));
_tcscat (sTmp, Name); _tcscat (sTmp, Name);
_tcscpy (Name, sTmp); _tcscpy (Name, sTmp);
UpdateData (false); UpdateData (false);
@ -1303,11 +1303,11 @@ void CCreateDialog::OnSelChange ()
if (PropType == tStrToUtf8(sTmp)) if (PropType == tStrToUtf8(sTmp))
{ {
_tcscpy (Name, utf8ToTStr(PropName)); _tcscpy(Name, nlUtf8ToTStr(PropName));
} }
else else
{ {
_tcscpy(Name, utf8ToTStr(RegionPost)); _tcscpy(Name, nlUtf8ToTStr(RegionPost));
_tcscat (Name, (LPCTSTR)sTmp); _tcscat (Name, (LPCTSTR)sTmp);
_tcscat (Name, _T("-")); _tcscat (Name, _T("-"));
} }

View file

@ -105,7 +105,7 @@ void CToolsZoneList::reset()
void CToolsZoneList::addItem (const string &itemName) void CToolsZoneList::addItem (const string &itemName)
{ {
_ItemNames.push_back (itemName); _ItemNames.push_back (itemName);
InsertString (-1, utf8ToTStr(itemName)); InsertString(-1, nlUtf8ToTStr(itemName));
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -261,13 +261,13 @@ void CToolsZone::addToAllCatTypeCB (const string &Name)
{ {
CComboBox *pCB; CComboBox *pCB;
pCB = (CComboBox *)GetDlgItem(IDC_CATTYPE1); pCB = (CComboBox *)GetDlgItem(IDC_CATTYPE1);
pCB->AddString (utf8ToTStr(Name)); pCB->AddString(nlUtf8ToTStr(Name));
pCB = (CComboBox *)GetDlgItem(IDC_CATTYPE2); pCB = (CComboBox *)GetDlgItem(IDC_CATTYPE2);
pCB->AddString (utf8ToTStr(Name)); pCB->AddString(nlUtf8ToTStr(Name));
pCB = (CComboBox *)GetDlgItem(IDC_CATTYPE3); pCB = (CComboBox *)GetDlgItem(IDC_CATTYPE3);
pCB->AddString (utf8ToTStr(Name)); pCB->AddString(nlUtf8ToTStr(Name));
pCB = (CComboBox *)GetDlgItem(IDC_CATTYPE4); pCB = (CComboBox *)GetDlgItem(IDC_CATTYPE4);
pCB->AddString (utf8ToTStr(Name)); pCB->AddString(nlUtf8ToTStr(Name));
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -285,26 +285,26 @@ void CToolsZone::init (CMainFrame *pMF)
// Select right category types // Select right category types
CComboBox* pCB; CComboBox* pCB;
pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE1); pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE1);
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType1)); pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType1));
pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE2); pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE2);
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType2)); pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType2));
pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE3); pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE3);
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType3)); pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType3));
pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE4); pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE4);
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType4)); pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType4));
updateComboPairAndFilter (IDC_CATTYPE1, IDC_CATVALUE1, &_MainFrame->_ZoneBuilder->_FilterType1); updateComboPairAndFilter (IDC_CATTYPE1, IDC_CATVALUE1, &_MainFrame->_ZoneBuilder->_FilterType1);
pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE1); pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE1);
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue1)); pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue1));
updateComboPairAndFilter (IDC_CATTYPE2, IDC_CATVALUE2, &_MainFrame->_ZoneBuilder->_FilterType2); updateComboPairAndFilter (IDC_CATTYPE2, IDC_CATVALUE2, &_MainFrame->_ZoneBuilder->_FilterType2);
pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE2); pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE2);
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue2)); pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue2));
updateComboPairAndFilter (IDC_CATTYPE3, IDC_CATVALUE3, &_MainFrame->_ZoneBuilder->_FilterType3); updateComboPairAndFilter (IDC_CATTYPE3, IDC_CATVALUE3, &_MainFrame->_ZoneBuilder->_FilterType3);
pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE3); pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE3);
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue3)); pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue3));
updateComboPairAndFilter (IDC_CATTYPE4, IDC_CATVALUE4, &_MainFrame->_ZoneBuilder->_FilterType4); updateComboPairAndFilter (IDC_CATTYPE4, IDC_CATVALUE4, &_MainFrame->_ZoneBuilder->_FilterType4);
pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE4); pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE4);
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue4)); pCB->SelectString(-1, nlUtf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue4));
// Select right operators // Select right operators
CButton *pButAnd, *pButOr; CButton *pButAnd, *pButOr;
@ -436,7 +436,7 @@ void CToolsZone::updateComboPairAndFilter (int CatTypeId, int CatValueId, string
CComboBox *pCBType, *pCBValue; CComboBox *pCBType, *pCBValue;
pCBType = (CComboBox*)GetDlgItem (CatTypeId); pCBType = (CComboBox*)GetDlgItem (CatTypeId);
pCBType->GetLBText (pCBType->GetCurSel(), sTmp); pCBType->GetLBText (pCBType->GetCurSel(), sTmp);
*pFilterType = tStrToUtf8(sTmp); *pFilterType = NLMISC::tStrToUtf8(sTmp);
pCBValue = (CComboBox*)GetDlgItem (CatValueId); pCBValue = (CComboBox*)GetDlgItem (CatValueId);
pCBValue->ResetContent (); pCBValue->ResetContent ();
@ -446,7 +446,7 @@ void CToolsZone::updateComboPairAndFilter (int CatTypeId, int CatValueId, string
vector<string> allCategoryValues; vector<string> allCategoryValues;
_MainFrame->_ZoneBuilder->getZoneBank().getCategoryValues (*pFilterType, allCategoryValues); _MainFrame->_ZoneBuilder->getZoneBank().getCategoryValues (*pFilterType, allCategoryValues);
for(i = 0; i < allCategoryValues.size(); ++i) for(i = 0; i < allCategoryValues.size(); ++i)
pCBValue->AddString (utf8ToTStr(allCategoryValues[i])); pCBValue->AddString(nlUtf8ToTStr(allCategoryValues[i]));
pCBValue->SetCurSel (0); pCBValue->SetCurSel (0);
} }
@ -488,7 +488,7 @@ void CToolsZone::OnSelectCatValue1()
TCHAR sTmp[256]; TCHAR sTmp[256];
CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE1); CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE1);
pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp); pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp);
_MainFrame->_ZoneBuilder->_FilterValue1 = tStrToUtf8(sTmp); _MainFrame->_ZoneBuilder->_FilterValue1 = NLMISC::tStrToUtf8(sTmp);
_MainFrame->_ZoneBuilder->updateToolsZone (); _MainFrame->_ZoneBuilder->updateToolsZone ();
} }
@ -498,7 +498,7 @@ void CToolsZone::OnSelectCatValue2()
TCHAR sTmp[256]; TCHAR sTmp[256];
CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE2); CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE2);
pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp); pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp);
_MainFrame->_ZoneBuilder->_FilterValue2 = tStrToUtf8(sTmp); _MainFrame->_ZoneBuilder->_FilterValue2 = NLMISC::tStrToUtf8(sTmp);
_MainFrame->_ZoneBuilder->updateToolsZone (); _MainFrame->_ZoneBuilder->updateToolsZone ();
} }
@ -508,7 +508,7 @@ void CToolsZone::OnSelectCatValue3()
TCHAR sTmp[256]; TCHAR sTmp[256];
CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE3); CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE3);
pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp); pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp);
_MainFrame->_ZoneBuilder->_FilterValue3 = tStrToUtf8(sTmp); _MainFrame->_ZoneBuilder->_FilterValue3 = NLMISC::tStrToUtf8(sTmp);
_MainFrame->_ZoneBuilder->updateToolsZone (); _MainFrame->_ZoneBuilder->updateToolsZone ();
} }
@ -518,7 +518,7 @@ void CToolsZone::OnSelectCatValue4()
TCHAR sTmp[256]; TCHAR sTmp[256];
CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE4); CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE4);
pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp); pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp);
_MainFrame->_ZoneBuilder->_FilterValue4 = tStrToUtf8(sTmp); _MainFrame->_ZoneBuilder->_FilterValue4 = NLMISC::tStrToUtf8(sTmp);
_MainFrame->_ZoneBuilder->updateToolsZone (); _MainFrame->_ZoneBuilder->updateToolsZone ();
} }

View file

@ -77,7 +77,7 @@ void CTypeManagerDlg::OnAddtype()
if (typeDlg.DoModal() == IDOK) if (typeDlg.DoModal() == IDOK)
{ {
SType typeTmp; SType typeTmp;
typeTmp.Name = tStrToUtf8(typeDlg.EditName); typeTmp.Name = NLMISC::tStrToUtf8(typeDlg.EditName);
typeTmp.Color = typeDlg.ButtonColorValue; typeTmp.Color = typeDlg.ButtonColorValue;
// Check if the name of the new type is the same as an existing one // Check if the name of the new type is the same as an existing one
bool bFound = false; bool bFound = false;
@ -91,7 +91,7 @@ void CTypeManagerDlg::OnAddtype()
if (!bFound) if (!bFound)
{ {
LocalTypes.push_back (typeTmp); LocalTypes.push_back (typeTmp);
ListType.InsertString(-1, utf8ToTStr(typeTmp.Name)); ListType.InsertString(-1, nlUtf8ToTStr(typeTmp.Name));
} }
} }
} }
@ -111,11 +111,11 @@ void CTypeManagerDlg::OnEdittype()
if (typeDlg.DoModal() == IDOK) if (typeDlg.DoModal() == IDOK)
{ {
SType typeTmp; SType typeTmp;
typeTmp.Name = tStrToUtf8(typeDlg.EditName); typeTmp.Name = NLMISC::tStrToUtf8(typeDlg.EditName);
typeTmp.Color = typeDlg.ButtonColorValue; typeTmp.Color = typeDlg.ButtonColorValue;
LocalTypes[cursel] = typeTmp; LocalTypes[cursel] = typeTmp;
ListType.DeleteString (ListType.GetCurSel()); ListType.DeleteString (ListType.GetCurSel());
ListType.InsertString (cursel, utf8ToTStr(typeTmp.Name)); ListType.InsertString(cursel, nlUtf8ToTStr(typeTmp.Name));
} }
} }
@ -138,7 +138,7 @@ BOOL CTypeManagerDlg::OnInitDialog()
// TODO: Add extra initialization here // TODO: Add extra initialization here
for (uint32 i = 0; i < LocalTypes.size(); ++i) for (uint32 i = 0; i < LocalTypes.size(); ++i)
{ {
ListType.InsertString(-1, utf8ToTStr(LocalTypes[i].Name)); ListType.InsertString(-1, nlUtf8ToTStr(LocalTypes[i].Name));
} }
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

@ -60,7 +60,7 @@ void CTypeSelDlg::OnOK()
CString sTmp; CString sTmp;
TypeList.GetText(TypeList.GetCurSel(), sTmp); TypeList.GetText(TypeList.GetCurSel(), sTmp);
_TypeSelected = tStrToUtf8(sTmp); _TypeSelected = NLMISC::tStrToUtf8(sTmp);
CDialog::OnOK(); CDialog::OnOK();
} }
@ -72,7 +72,7 @@ BOOL CTypeSelDlg::OnInitDialog()
// TODO: Add extra initialization here // TODO: Add extra initialization here
for (uint32 i = 0; i < _TypesInit->size(); ++i) for (uint32 i = 0; i < _TypesInit->size(); ++i)
{ {
TypeList.InsertString(-1, utf8ToTStr(_TypesInit->operator[](i).Name)); TypeList.InsertString(-1, nlUtf8ToTStr(_TypesInit->operator[](i).Name));
} }
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

@ -170,7 +170,7 @@ BOOL CWorldEditorApp::InitInstance()
} }
catch (const Exception& e) catch (const Exception& e)
{ {
::MessageBox (NULL, utf8ToTStr(e.what()), _T("Warning"), MB_OK|MB_ICONEXCLAMATION); ::MessageBox(NULL, nlUtf8ToTStr(e.what()), _T("Warning"), MB_OK | MB_ICONEXCLAMATION);
// Can't found the module put some default values // Can't found the module put some default values
Config.CellSize = 160.0f; Config.CellSize = 160.0f;
@ -292,7 +292,7 @@ BOOL CWorldEditorApp::InitInstance()
{ {
IPluginCallback* test=Plugins[k]; IPluginCallback* test=Plugins[k];
string retest=test->getName(); string retest=test->getName();
menu->InsertMenu( k, MF_BYPOSITION | MF_POPUP, ID_WINDOWS_PLUGINS+1 + k, utf8ToTStr(retest) ); menu->InsertMenu(k, MF_BYPOSITION | MF_POPUP, ID_WINDOWS_PLUGINS + 1 + k, nlUtf8ToTStr(retest));
menu->CheckMenuItem(ID_WINDOWS_PLUGINS+1 +k, MF_CHECKED); menu->CheckMenuItem(ID_WINDOWS_PLUGINS+1 +k, MF_CHECKED);
} }
@ -444,7 +444,7 @@ bool CWorldEditorApp::yesNoMessage (const char *format, ... )
strcpy(buffer, "Unknown error"); strcpy(buffer, "Unknown error");
} }
return MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, utf8ToTStr(buffer), _T("NeL World Editor"), MB_YESNO|MB_ICONQUESTION) == IDYES; return MessageBox(m_pMainWnd ? m_pMainWnd->m_hWnd : NULL, nlUtf8ToTStr(buffer), _T("NeL World Editor"), MB_YESNO | MB_ICONQUESTION) == IDYES;
} }
void CWorldEditorApp::errorMessage (const char *format, ... ) void CWorldEditorApp::errorMessage (const char *format, ... )
@ -463,7 +463,7 @@ void CWorldEditorApp::errorMessage (const char *format, ... )
strcpy(buffer, "Unknown error"); strcpy(buffer, "Unknown error");
} }
MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, utf8ToTStr(buffer), _T("NeL World Editor"), MB_OK|MB_ICONEXCLAMATION); MessageBox(m_pMainWnd ? m_pMainWnd->m_hWnd : NULL, nlUtf8ToTStr(buffer), _T("NeL World Editor"), MB_OK | MB_ICONEXCLAMATION);
} }
void CWorldEditorApp::infoMessage (const char *format, ... ) void CWorldEditorApp::infoMessage (const char *format, ... )
@ -482,7 +482,7 @@ void CWorldEditorApp::infoMessage (const char *format, ... )
strcpy(buffer, "Unknown error"); strcpy(buffer, "Unknown error");
} }
MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, utf8ToTStr(buffer), _T("NeL World Editor"), MB_OK|MB_ICONINFORMATION); MessageBox(m_pMainWnd ? m_pMainWnd->m_hWnd : NULL, nlUtf8ToTStr(buffer), _T("NeL World Editor"), MB_OK | MB_ICONINFORMATION);
} }
void CWorldEditorApp::syntaxError (const std::string &filename, xmlNodePtr xmlNode, const char *format, ...) void CWorldEditorApp::syntaxError (const std::string &filename, xmlNodePtr xmlNode, const char *format, ...)
@ -813,7 +813,7 @@ void setEditTextMultiLine (CListBox &listBox, const std::vector<std::string> &ve
listBox.ResetContent(); listBox.ResetContent();
uint i; uint i;
for (i=0; i<vect.size (); i++) for (i=0; i<vect.size (); i++)
nlverify (listBox.InsertString( -1, utf8ToTStr(vect[i])) != LB_ERR); nlverify(listBox.InsertString(-1, nlUtf8ToTStr(vect[i])) != LB_ERR);
} }
// *************************************************************************** // ***************************************************************************

View file

@ -830,7 +830,7 @@ void CWorldEditorDoc::updateModifiedState ()
if ( (title.size ()>=2) && (title[title.size()-1] == '*') && (title[title.size()-2] == ' ') ) if ( (title.size ()>=2) && (title[title.size()-1] == '*') && (title[title.size()-2] == ' ') )
{ {
title.resize (title.size () - 2); title.resize (title.size () - 2);
SetTitle (utf8ToTStr(title)); SetTitle(nlUtf8ToTStr(title));
} }
} }
} }
@ -1532,8 +1532,8 @@ const NLLIGO::IPrimitive *CWorldEditorDoc::createPrimitive (const CDatabaseLocat
if (primClass->Type == CPrimitiveClass::Bitmap) if (primClass->Type == CPrimitiveClass::Bitmap)
{ {
// Create a dialog file // Create a dialog file
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("image"), TRUE, utf8ToTStr(primClass->FileExtension), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, CFileDialogEx dialog(BASE_REGISTRY_KEY, _T("image"), TRUE, nlUtf8ToTStr(primClass->FileExtension), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
utf8ToTStr(toString("%s (*.%s)|*.%s|All Files (*.*)|*.*||", primClass->FileType.c_str(), primClass->FileExtension.c_str(), primClass->FileExtension.c_str())), getMainFrame ()); nlUtf8ToTStr(toString("%s (*.%s)|*.%s|All Files (*.*)|*.*||", primClass->FileType.c_str(), primClass->FileExtension.c_str(), primClass->FileExtension.c_str())), getMainFrame());
if (dialog.DoModal() == IDOK) if (dialog.DoModal() == IDOK)
{ {
// Save filename // Save filename