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/>.
#include <windows.h>
#include <tchar.h>
#include <string>
#include <stdio.h>
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;
if (filename = strstr (lpCmdLine, "-f "))

View file

@ -40,7 +40,7 @@ void pump ()
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
HWND hwnd = CreateDialog (hInstance, MAKEINTRESOURCE(IDD_WAIT), NULL, MyDialogProc);

View file

@ -130,10 +130,10 @@ bool CDataBase::init (const string &Path, CZoneBank &zb)
string sDirBackup = NLMISC::CPath::getCurrentPath();
// "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());
string ss = NLMISC::CPath::getFullPath(Path);
NLMISC::CPath::setCurrentPath (ss.c_str());
NLMISC::CPath::setCurrentPath(ss.c_str());
uint32 i, m, n, o, p;
uint8 k, l;
@ -623,7 +623,7 @@ bool CBuilderZone::refresh ()
{
unload (_ZoneRegionSelected);
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;
}
@ -1600,25 +1600,25 @@ bool CBuilderZone::initZoneBank (const string &sPathName)
{
// TODO: replace by NeL methods
TCHAR sDirBackup[512];
GetCurrentDirectory (512, sDirBackup);
SetCurrentDirectory (utf8ToTStr(sPathName));
GetCurrentDirectory(512, sDirBackup);
SetCurrentDirectory(nlUtf8ToTStr(sPathName));
WIN32_FIND_DATA findData;
HANDLE hFind;
hFind = FindFirstFile (_T("*.ligozone"), &findData);
hFind = FindFirstFile(_T("*.ligozone"), &findData);
while (hFind != INVALID_HANDLE_VALUE)
{
// If the name of the file is not . or .. then its a valid entry in the DataBase
if (!((_tcscmp (findData.cFileName, _T(".")) == 0) || (_tcscmp (findData.cFileName, _T("..")) == 0)))
if (!((_tcscmp(findData.cFileName, _T(".")) == 0) || (_tcscmp(findData.cFileName, _T("..")) == 0)))
{
string error;
if (!_ZoneBank.addElement (tStrToUtf8(findData.cFileName), error))
theApp.errorMessage (error.c_str());
if (!_ZoneBank.addElement(NLMISC::tStrToUtf8(findData.cFileName), error))
theApp.errorMessage(error.c_str());
}
if (FindNextFile (hFind, &findData) == 0)
if (FindNextFile(hFind, &findData) == 0)
break;
}
SetCurrentDirectory (sDirBackup);
SetCurrentDirectory(sDirBackup);
return true;
}

View file

@ -352,7 +352,7 @@ void CDialogProperties::addWidget (const CPrimitiveClass::CParameter &parameter,
string Name = widget.Parameter.Name;
// 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 ());
}
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)
{
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)
{
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 ();
break;
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.InsertString( -1, utf8ToTStr(propString->String));
ComboBox.SelectString(-1, utf8ToTStr(propString->String));
ComboBox.SetWindowText(nlUtf8ToTStr(propString->String));
ComboBox.InsertString(-1, nlUtf8ToTStr(propString->String));
ComboBox.SelectString(-1, nlUtf8ToTStr(propString->String));
}
OriginalString = propString->String.c_str();
updateCombo ();
@ -953,7 +953,7 @@ bool CDialogProperties::CWidget::fromParameter (const IProperty *property, const
updateBoolean ();
break;
case CPrimitiveClass::CParameter::ConstString:
ComboBox.SelectString(-1, utf8ToTStr(result));
ComboBox.SelectString(-1, nlUtf8ToTStr(result));
OriginalString = result.c_str();
updateCombo ();
break;
@ -1282,7 +1282,7 @@ void CDialogProperties::CWidget::updateCombo ()
DialogProperties->setDefaultValue (this, value);
if (value != "")
{
int index = ComboBox.FindString (-1, utf8ToTStr(value));
int index = ComboBox.FindString(-1, nlUtf8ToTStr(value));
if (index != CB_ERR)
ComboBox.SetCurSel (index);
}
@ -1621,14 +1621,14 @@ BOOL CDialogProperties::OnCommand(WPARAM wParam, LPARAM lParam)
/* todo hulud remove
CString oldValue;
widget->EditBox.GetWindowText (oldValue);*/
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("default"), TRUE, utf8ToTStr(widget->Parameter.FileExtension), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
utf8ToTStr(widget->Parameter.FileExtension+" (*."+widget->Parameter.FileExtension+")|*."+widget->Parameter.FileExtension+"|All Files (*.*)|*.*||"), getMainFrame ());
CFileDialogEx dialog(BASE_REGISTRY_KEY, _T("default"), TRUE, nlUtf8ToTStr(widget->Parameter.FileExtension), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
nlUtf8ToTStr(widget->Parameter.FileExtension + " (*." + widget->Parameter.FileExtension + ")|*." + widget->Parameter.FileExtension + "|All Files (*.*)|*.*||"), getMainFrame());
TCHAR temp[MAX_PATH];
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;
}
@ -1636,7 +1636,7 @@ BOOL CDialogProperties::OnCommand(WPARAM wParam, LPARAM lParam)
{
CString str;
str = dialog.GetFileTitle();
setWindowTextUTF8 (widget->EditBox, tStrToUtf8(str));
setWindowTextUTF8 (widget->EditBox, NLMISC::tStrToUtf8(str));
/* todo hulud remove
if ((const char*)oldValue != str)
@ -2305,7 +2305,7 @@ void CDialogProperties::rebuildDialog ()
m_ScrollBar.MoveWindow(&scrollRect, TRUE);
// 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
// ::CRect clientRect;
@ -2982,13 +2982,12 @@ void CDialogProperties::SelectFolder(CWidget *widget)
LPITEMIDLIST pidlRoot = NULL;
LPSHELLFOLDER desktop;
ULONG ulDummy;
SHGetDesktopFolder (&desktop);
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;
@ -3454,7 +3453,7 @@ void CMyComboBox::reloadData()
SetRedraw(FALSE);
InsertString(-1, _T(""));
for (vector<string>::iterator it=_data.begin(), itEnd=_data.end(); it!=itEnd; ++it)
InsertString(-1, utf8ToTStr(*it));
InsertString(-1, nlUtf8ToTStr(*it));
loaded = true;
SetRedraw(TRUE);
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 ();
if (dir.empty()) dir = _MainFrame->_ExeDir;
dir += "\\collisionmap\\";
SetCurrentDirectory (utf8ToTStr(dir));
SetCurrentDirectory(nlUtf8ToTStr(dir));
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
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
if (saved)

View file

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

View file

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

View file

@ -100,7 +100,7 @@ void CImageListEx::addResourceIcon (const char *filename)
int height = imageInfo.rcImage.bottom - imageInfo.rcImage.top;
// 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)
{
// Copy the icon

View file

@ -759,11 +759,11 @@ void CMainFrame::displayStatusBarInfo ()
string text;
if (dispWnd->getActionHelp (text))
{
m_wndStatusBar.SetPaneText (0, utf8ToTStr(text));
m_wndStatusBar.SetPaneText(0, nlUtf8ToTStr(text));
}
else
{
m_wndStatusBar.SetPaneText (0, utf8ToTStr(sTmp));
m_wndStatusBar.SetPaneText(0, nlUtf8ToTStr(sTmp));
}
//for (uint32 i = sTmp.size(); i < 10; ++i)
// sTmp += " ";
@ -771,12 +771,12 @@ void CMainFrame::displayStatusBarInfo ()
// Write zone reference name
if (dispWnd->getActionText (text))
{
m_wndStatusBar.SetPaneText (1, utf8ToTStr(text));
m_wndStatusBar.SetPaneText(1, nlUtf8ToTStr(text));
}
else
{
sTmp = _ZoneBuilder->getZoneName (x, y);
m_wndStatusBar.SetPaneText (1, utf8ToTStr(sTmp));
m_wndStatusBar.SetPaneText(1, nlUtf8ToTStr(sTmp));
}
// Write coordinates
@ -784,15 +784,15 @@ void CMainFrame::displayStatusBarInfo ()
sprintf(temp, "(%.3f , %.3f)", v.x, v.y);
sTmp = temp;
// sTmp = "( " + toString(v.x) + " , " + toString(v.y) + " )";
m_wndStatusBar.SetPaneText (2, utf8ToTStr(sTmp));
m_wndStatusBar.SetPaneText(2, nlUtf8ToTStr(sTmp));
// Write rot
sTmp = "Rot(" + toString(_ZoneBuilder->getRot(x, y)) + ")";
m_wndStatusBar.SetPaneText (3, utf8ToTStr(sTmp));
m_wndStatusBar.SetPaneText(3, nlUtf8ToTStr(sTmp));
// Write flip
sTmp = "Flip(" + toString(_ZoneBuilder->getFlip(x, y)) + ")";
m_wndStatusBar.SetPaneText (4, utf8ToTStr(sTmp));
m_wndStatusBar.SetPaneText(4, nlUtf8ToTStr(sTmp));
// Write selection
if (Selection.size ())
@ -804,7 +804,7 @@ void CMainFrame::displayStatusBarInfo ()
}
else
sTmp = "No selected primitive";
m_wndStatusBar.SetPaneText (5, utf8ToTStr(sTmp));
m_wndStatusBar.SetPaneText(5, nlUtf8ToTStr(sTmp));
// Write path of selected primitive
if (Selection.size())
@ -812,14 +812,14 @@ void CMainFrame::displayStatusBarInfo ()
else
sTmp.clear();
m_wndStatusBar.SetPaneText (6, utf8ToTStr(sTmp));
m_wndStatusBar.SetPaneText(6, nlUtf8ToTStr(sTmp));
}
// ***************************************************************************
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)
{
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 (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 (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++)
{
// 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
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];
_tcscpy(path, utf8ToTStr(var->asString()));
_tcscpy(path, nlUtf8ToTStr(var->asString()));
SHELLEXECUTEINFO ExecuteInfo;
memset(&ExecuteInfo, 0, sizeof(ExecuteInfo));

View file

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

View file

@ -88,7 +88,7 @@ BOOL CNameDlg::OnInitDialog()
// print the data directory
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
int tab_stop1[1] = {160};
@ -156,18 +156,18 @@ void CNameDlg::updateSearchList()
{
// no filter
m_listToName.insert(std::make_pair(j, i));
m_searchList.InsertString(j++, utf8ToTStr(s));
m_searchList.InsertString(j++, nlUtf8ToTStr(s));
}
else
{
std::string filter(tStrToUtf8(m_nameFilter.LockBuffer()));
std::string filter(NLMISC::tStrToUtf8(m_nameFilter.LockBuffer()));
m_nameFilter.UnlockBuffer();
// filter
if (NLMISC::toLower(ig).find(NLMISC::toLower(filter)) != std::string::npos)
{
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_idList.InsertString(i++, utf8ToTStr(s));
m_idList.InsertString(i++, nlUtf8ToTStr(s));
}
}
@ -251,8 +251,8 @@ void CNameDlg::OnBtnAssign()
// get strings
ucstring id;
std::string gn = tStrToUtf8(m_assignGn);
std::string ig = tStrToUtf8(m_assignIg);
std::string gn = NLMISC::tStrToUtf8(m_assignGn);
std::string ig = NLMISC::tStrToUtf8(m_assignIg);
for (uint i=0 ; i<sel.size() ; i++)
{
@ -268,7 +268,7 @@ void CNameDlg::OnBtnAssign()
uint n = m_idList.GetTextLen(i);
m_idList.GetText(i, str.GetBuffer(n));
str.ReleaseBuffer();
id.fromUtf8(tStrToUtf8(str));
id.fromUtf8(NLMISC::tStrToUtf8(str));
}
// 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
CWnd* pWnd = GetDlgItem(IDC_NAME_NEWGN);
std::string s = tStrToUtf8(m_assignGn);
std::string s = NLMISC::tStrToUtf8(m_assignGn);
uint rowIndex;
if (s == "")
{

View file

@ -114,7 +114,7 @@ BOOL CPrimitiveConfigurationDlg::OnInitDialog()
uint 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 ());
}

View file

@ -75,9 +75,9 @@ void CProjectSettings::OnBrowse()
{
UpdateData ();
BROWSEINFO bi;
TCHAR str[MAX_PATH];
ITEMIDLIST* pidl;
BROWSEINFO bi;
TCHAR str[MAX_PATH];
LPITEMIDLIST pidl;
TCHAR sTemp[1024];
bi.hwndOwner = this->m_hWnd;
@ -133,11 +133,11 @@ BOOL CProjectSettings::OnInitDialog()
for (uint i=0; i<contexts.size (); i++)
{
// Add the string
Context.InsertString (-1, utf8ToTStr(contexts[i]));
Context.InsertString(-1, nlUtf8ToTStr(contexts[i]));
}
// 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
// EXCEPTION: OCX Property Pages should return FALSE

View file

@ -1231,7 +1231,7 @@ BOOL CCreateDialog::OnInitDialog ()
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)
@ -1264,10 +1264,10 @@ void CCreateDialog::OnOK()
UpdateData ();
// 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];
_tcscpy (sTmp, utf8ToTStr(RegionPost));
_tcscpy(sTmp, nlUtf8ToTStr(RegionPost));
_tcscat (sTmp, Name);
_tcscpy (Name, sTmp);
UpdateData (false);
@ -1303,11 +1303,11 @@ void CCreateDialog::OnSelChange ()
if (PropType == tStrToUtf8(sTmp))
{
_tcscpy (Name, utf8ToTStr(PropName));
_tcscpy(Name, nlUtf8ToTStr(PropName));
}
else
{
_tcscpy(Name, utf8ToTStr(RegionPost));
_tcscpy(Name, nlUtf8ToTStr(RegionPost));
_tcscat (Name, (LPCTSTR)sTmp);
_tcscat (Name, _T("-"));
}

View file

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

View file

@ -77,7 +77,7 @@ void CTypeManagerDlg::OnAddtype()
if (typeDlg.DoModal() == IDOK)
{
SType typeTmp;
typeTmp.Name = tStrToUtf8(typeDlg.EditName);
typeTmp.Name = NLMISC::tStrToUtf8(typeDlg.EditName);
typeTmp.Color = typeDlg.ButtonColorValue;
// Check if the name of the new type is the same as an existing one
bool bFound = false;
@ -91,7 +91,7 @@ void CTypeManagerDlg::OnAddtype()
if (!bFound)
{
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)
{
SType typeTmp;
typeTmp.Name = tStrToUtf8(typeDlg.EditName);
typeTmp.Name = NLMISC::tStrToUtf8(typeDlg.EditName);
typeTmp.Color = typeDlg.ButtonColorValue;
LocalTypes[cursel] = typeTmp;
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
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

View file

@ -60,7 +60,7 @@ void CTypeSelDlg::OnOK()
CString sTmp;
TypeList.GetText(TypeList.GetCurSel(), sTmp);
_TypeSelected = tStrToUtf8(sTmp);
_TypeSelected = NLMISC::tStrToUtf8(sTmp);
CDialog::OnOK();
}
@ -72,7 +72,7 @@ BOOL CTypeSelDlg::OnInitDialog()
// TODO: Add extra initialization here
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

View file

@ -170,7 +170,7 @@ BOOL CWorldEditorApp::InitInstance()
}
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
Config.CellSize = 160.0f;
@ -292,7 +292,7 @@ BOOL CWorldEditorApp::InitInstance()
{
IPluginCallback* test=Plugins[k];
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);
}
@ -444,7 +444,7 @@ bool CWorldEditorApp::yesNoMessage (const char *format, ... )
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, ... )
@ -463,7 +463,7 @@ void CWorldEditorApp::errorMessage (const char *format, ... )
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, ... )
@ -482,7 +482,7 @@ void CWorldEditorApp::infoMessage (const char *format, ... )
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, ...)
@ -813,7 +813,7 @@ void setEditTextMultiLine (CListBox &listBox, const std::vector<std::string> &ve
listBox.ResetContent();
uint 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] == ' ') )
{
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)
{
// Create a dialog file
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("image"), TRUE, utf8ToTStr(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 ());
CFileDialogEx dialog(BASE_REGISTRY_KEY, _T("image"), TRUE, nlUtf8ToTStr(primClass->FileExtension), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
nlUtf8ToTStr(toString("%s (*.%s)|*.%s|All Files (*.*)|*.*||", primClass->FileType.c_str(), primClass->FileExtension.c_str(), primClass->FileExtension.c_str())), getMainFrame());
if (dialog.DoModal() == IDOK)
{
// Save filename