Cleaning up unicode conversion and fixing 64bit issues

This commit is contained in:
kaetemi 2019-05-01 07:35:00 +08:00
parent 14304c7f64
commit 44b7adb569
37 changed files with 196 additions and 214 deletions

View file

@ -117,11 +117,11 @@ class IServiceUpdatable;
#if defined(NL_OS_WINDOWS) && defined(_WINDOWS)
#define NLNET_SERVICE_MAIN(__ServiceClassName, __ServiceShortName, __ServiceLongName, __ServicePort, __ServiceCallbackArray, __ConfigDir, __LogDir) \
\
int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) \
int APIENTRY nltWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) \
{ \
NLMISC::CApplicationContext serviceContext; \
__ServiceClassName *scn = new __ServiceClassName; \
scn->setArgs (lpCmdLine); \
scn->setArgs (nlTStrToUtf8(lpCmdLine)); \
createDebug(NULL,!scn->haveLongArg("nolog"));\
scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \
sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__ " " __TIME__); \
@ -132,11 +132,11 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
#else
#define NLNET_SERVICE_MAIN(__ServiceClassName, __ServiceShortName, __ServiceLongName, __ServicePort, __ServiceCallbackArray, __ConfigDir, __LogDir) \
\
int main(int argc, const char **argv) \
int nltmain(int argc, const NLMISC::tchar **argv) \
{ \
NLMISC::CApplicationContext serviceContext; \
__ServiceClassName *scn = new __ServiceClassName; \
scn->setArgs (argc, argv); \
scn->setArgs (argc, nlTStrToUtf8(argv)); \
createDebug(NULL,!scn->haveLongArg("nolog"));\
scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \
sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__ " " __TIME__); \

View file

@ -201,9 +201,9 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector<SDispCS> &D
// Main
// ---------------------------------------------------------------------------
#ifdef NL_OS_WINDOWS
int CALLBACK WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
int APIENTRY nltWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd)
#else // NL_OS_WINDOWS
int main(int argc, char **argv)
int nltmain(int argc, NLMISC::tchar **argv)
#endif // NL_OS_WINDOWS
{
double rGlobalTime = 0;

View file

@ -88,7 +88,7 @@ static CHashKeyMD5 getNewMD5(const std::string &filename)
}
#if defined(NL_OS_WINDOWS) && !defined(_CONSOLE)
sint WINAPI WinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPSTR cmdline, int /* nCmdShow */)
sint APIENTRY WinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPSTR cmdline, int /* nCmdShow */)
{
// we can specify several shapes on command line
// so we need to process it

View file

@ -953,12 +953,11 @@ void initViewerConfig(const char * configFileName)
MAIN
\****************************************************************/
#ifdef NL_OS_WINDOWS
int WINAPI WinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPSTR cmdline, int /* nCmdShow */)
int APIENTRY nltWinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPTSTR /* lpCmdLine */, int /* nCmdShow */)
#else // NL_OS_WINDOWS
int nltmain(int /* argc */, NLMISC::tchar ** /* argv */)
#endif // NL_OS_WINDOWS
{
#else
int main(int /* argc */, char ** /* argv */)
{
#endif
try
{
NLMISC::CApplicationContext myApplicationContext;

View file

@ -260,8 +260,8 @@ void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicC
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::COMPARISON;
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = tStrToUtf8(conditionNode->m_sVariableName);
logicConditionNode->LogicBlock.ComparisonBlock.Operator = tStrToUtf8(conditionNode->m_sOperator);
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = NLMISC::tStrToUtf8(conditionNode->m_sVariableName);
logicConditionNode->LogicBlock.ComparisonBlock.Operator = NLMISC::tStrToUtf8(conditionNode->m_sOperator);
logicConditionNode->LogicBlock.ComparisonBlock.Comparand = (sint64)conditionNode->m_dComparand;
}
break;
@ -270,7 +270,7 @@ void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicC
{
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::SUB_CONDITION;
logicConditionNode->LogicBlock.SubCondition = tStrToUtf8(conditionNode->m_sConditionName);
logicConditionNode->LogicBlock.SubCondition = NLMISC::tStrToUtf8(conditionNode->m_sConditionName);
}
break;
}
@ -298,7 +298,7 @@ void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicC
void cConditionToCLogicCondition( CCondition& condition, CLogicCondition& logicCondition )
{
// condition name
logicCondition.setName(tStrToUtf8(condition.m_sName));
logicCondition.setName(NLMISC::tStrToUtf8(condition.m_sName));
// nodes
POSITION pos;

View file

@ -45,7 +45,7 @@ CCounter::~CCounter()
void cCounterToCLogicCounter( CCounter& counter, CLogicCounter& logicCounter )
{
// counter name
logicCounter.setName(tStrToUtf8(counter.m_sName));
logicCounter.setName(NLMISC::tStrToUtf8(counter.m_sName));
// running mode
if( counter.m_sMode == "Shuttle" )

View file

@ -70,7 +70,7 @@ bool operator==( const CEvent &ev1, const CEvent &ev2)
void cEventToCLogicEvent( CEvent& event, CLogicEvent& logicEvent )
{
/// condition name
logicEvent.ConditionName = tStrToUtf8(event.m_sConditionName);
logicEvent.ConditionName = NLMISC::tStrToUtf8(event.m_sConditionName);
/// event action
logicEvent.EventAction.IsStateChange = !event.m_bActionIsMessage;
@ -78,18 +78,18 @@ void cEventToCLogicEvent( CEvent& event, CLogicEvent& logicEvent )
if( logicEvent.EventAction.IsStateChange )
{
/// state name for state change
logicEvent.EventAction.StateChange = tStrToUtf8(event.m_sStateChange);
logicEvent.EventAction.StateChange = NLMISC::tStrToUtf8(event.m_sStateChange);
}
else
{
/// message destination
logicEvent.EventAction.EventMessage.Destination = tStrToUtf8(event.m_sMessageDestination);
logicEvent.EventAction.EventMessage.Destination = NLMISC::tStrToUtf8(event.m_sMessageDestination);
/// message id
logicEvent.EventAction.EventMessage.MessageId = "LOGIC"; //string( (LPCSTR)event.m_sMessageID ); //TEMP!!!
/// message arguments
logicEvent.EventAction.EventMessage.Arguments = tStrToUtf8(event.m_sArguments);
logicEvent.EventAction.EventMessage.Arguments = NLMISC::tStrToUtf8(event.m_sArguments);
}
} // cEventToCLogicEvent //
@ -176,7 +176,7 @@ BOOL CState::removeEvent( CEvent *event)
void cStateToCLogicState( CState& state, CLogicState& logicState )
{
/// state name
logicState.setName(tStrToUtf8(state.m_sName));
logicState.setName(NLMISC::tStrToUtf8(state.m_sName));
POSITION pos;
for( pos = state.m_evEvents.GetHeadPosition(); pos != NULL; )

View file

@ -28,10 +28,7 @@
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
int APIENTRY _tWinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPTSTR /* lpCmdLine */, int /* nCmdShow */)
{
// Create a logic editor
ILogicEditor * logicEditor = ILogicEditor::getInterface();

View file

@ -19,11 +19,7 @@
#include <stdio.h>
using namespace std;
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
int APIENTRY _tWinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPTSTR /* lpCmdLine */, int /* nCmdShow */)
{
char *filename;
if (filename = strstr (lpCmdLine, "-f "))

View file

@ -40,11 +40,7 @@ void pump ()
DispatchMessage(&msg);
}
}
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR 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

@ -232,7 +232,7 @@ BOOL CBaseDialog::PreTranslateMessage(MSG* pMsg)
void CBaseDialog::setEditTextMultiLine (CEdit &edit, const char *text)
{
edit.SetWindowText (utf8ToTStr(NLMISC::addSlashR(text)));
edit.SetWindowText (nlUtf8ToTStr(NLMISC::addSlashR(text)));
}
void CBaseDialog::onOpenSelected()

View file

@ -193,7 +193,7 @@ void CDfnDialog::getFromDocument (const NLGEORGES::CFormDfn &dfn)
for (parent=0; parent<dfn.getNumParent (); parent++)
{
// Add the label and value
Parents.ListCtrl.InsertItem (parent, utf8ToTStr(dfn.getParentFilename (parent)));
Parents.ListCtrl.InsertItem(parent, nlUtf8ToTStr(dfn.getParentFilename(parent)));
}
// Add the struct element
@ -202,12 +202,12 @@ void CDfnDialog::getFromDocument (const NLGEORGES::CFormDfn &dfn)
for (elm=0; elm<dfn.getNumEntry (); elm++)
{
// Add the label and value
Struct.ListCtrl.InsertItem (elm, utf8ToTStr(dfn.getEntry (elm).getName()));
Struct.ListCtrl.InsertItem(elm, nlUtf8ToTStr(dfn.getEntry(elm).getName()));
switch (elm, dfn.getEntry (elm).getType ())
{
case UFormDfn::EntryType:
Struct.ListCtrl.SetItemText (elm, 1, dfn.getEntry (elm).getArrayFlag () ? _T("Type array") : _T("Type"));
Struct.ListCtrl.SetItemText (elm, 4, utf8ToTStr(dfn.getEntry (elm).getFilenameExt ()));
Struct.ListCtrl.SetItemText(elm, 4, nlUtf8ToTStr(dfn.getEntry(elm).getFilenameExt()));
break;
case UFormDfn::EntryDfn:
Struct.ListCtrl.SetItemText (elm, 1, dfn.getEntry (elm).getArrayFlag () ? _T("Dfn array") : _T("Dfn"));
@ -216,8 +216,8 @@ void CDfnDialog::getFromDocument (const NLGEORGES::CFormDfn &dfn)
Struct.ListCtrl.SetItemText (elm, 1, _T("Virtual Dfn"));
break;
}
Struct.ListCtrl.SetItemText (elm, 2, utf8ToTStr(dfn.getEntry (elm).getFilename()));
Struct.ListCtrl.SetItemText (elm, 3, utf8ToTStr(dfn.getEntry (elm).getDefault()));
Struct.ListCtrl.SetItemText(elm, 2, nlUtf8ToTStr(dfn.getEntry(elm).getFilename()));
Struct.ListCtrl.SetItemText(elm, 3, nlUtf8ToTStr(dfn.getEntry(elm).getDefault()));
}
}
}
@ -385,7 +385,7 @@ void CDfnEditListCtrl::getNewItemText (uint item, uint subItem, std::string &ret
// ***************************************************************************
void CDfnEditListCtrl::getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, std::tstring &filter)
void CDfnEditListCtrl::getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, NLMISC::tstring &filter)
{
if (subItem == 2)
{
@ -422,7 +422,7 @@ void CDfnEditListCtrl::onItemChanged (uint item, uint subItem)
str = Dialog->Struct.ListCtrl.GetItemText (item, 2);
std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(str));
if (ext == "typ")
Dialog->Struct.ListCtrl.SetItemText (item, 2, utf8ToTStr(theApp.DefaultType));
Dialog->Struct.ListCtrl.SetItemText(item, 2, nlUtf8ToTStr(theApp.DefaultType));
}
else if ((type == "Dfn") || (type == "Dfn array"))
{
@ -430,7 +430,7 @@ void CDfnEditListCtrl::onItemChanged (uint item, uint subItem)
str = Dialog->Struct.ListCtrl.GetItemText (item, 2);
std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(str));
if (ext == "dfn")
Dialog->Struct.ListCtrl.SetItemText (item, 2, utf8ToTStr(theApp.DefaultDfn));
Dialog->Struct.ListCtrl.SetItemText(item, 2, nlUtf8ToTStr(theApp.DefaultDfn));
// Clear default value
Dialog->Struct.ListCtrl.SetItemText (item, 3, _T(""));
@ -472,7 +472,7 @@ void CDfnDialog::onOpenSelected ()
if (str != "")
{
// Look for the file
CString name = utf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false));
CString name = nlUtf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false));
if (name.IsEmpty())
name = str;
@ -494,7 +494,7 @@ void CDfnDialog::onOpenSelected ()
if (str != "")
{
// Look for the file
CString name = utf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false));
CString name = nlUtf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false));
if (name.IsEmpty())
name = str;
@ -621,7 +621,7 @@ void CDfnParentEditListCtrl::getNewItemText (uint item, uint subItem, std::strin
// ***************************************************************************
void CDfnParentEditListCtrl::getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, std::tstring &filter)
void CDfnParentEditListCtrl::getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, NLMISC::tstring &filter)
{
filter = DfnFilter;
defDir = theApp.RootSearchPath;

View file

@ -36,7 +36,7 @@ class CDfnParentEditListCtrl : public CEditListCtrl
CEditListCtrl::TItemEdit getItemEditMode (uint item, uint subItem);
void getMemComboBoxProp (uint item, uint subItem, std::string &regAdr, bool &browse);
void getNewItemText (uint item, uint subItem, std::string &ret);
void getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, std::tstring &filter);
void getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, NLMISC::tstring &filter);
public:
class CDfnDialog *Dialog;
};
@ -47,7 +47,7 @@ class CDfnEditListCtrl : public CEditListCtrl
void getComboBoxStrings (uint item, uint subItem, std::vector<std::string> &retStrings);
void getMemComboBoxProp (uint item, uint subItem, std::string &regAdr, bool &browse);
void getNewItemText (uint item, uint subItem, std::string &ret);
void getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, std::tstring &filter);
void getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, NLMISC::tstring &filter);
void onItemChanged (uint item, uint subItem);
public:
class CDfnDialog *Dialog;

View file

@ -122,11 +122,11 @@ BOOL CEditListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
// Insert an item at the end
string text;
getNewItemText (ListCtrl.GetItemCount (), 0, text);
ListCtrl.InsertItem (ListCtrl.GetItemCount (), utf8ToTStr(text));
ListCtrl.InsertItem(ListCtrl.GetItemCount(), nlUtf8ToTStr(text));
for (uint i=1; i<ColumnCount; i++)
{
getNewItemText (ListCtrl.GetItemCount ()-1, i, text);
ListCtrl.SetItemText (ListCtrl.GetItemCount ()-1, i, utf8ToTStr(text));
ListCtrl.SetItemText(ListCtrl.GetItemCount() - 1, i, nlUtf8ToTStr(text));
}
ListCtrl.SetItemState (ListCtrl.GetItemCount ()-1, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
@ -151,22 +151,22 @@ BOOL CEditListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
item = ListCtrl.GetNextSelectedItem(pos);
string text;
getNewItemText (item, 0, text);
ListCtrl.InsertItem (item, utf8ToTStr(text));
ListCtrl.InsertItem(item, nlUtf8ToTStr(text));
for (uint i=1; i<ColumnCount; i++)
{
getNewItemText (item, i, text);
ListCtrl.SetItemText (item, i, utf8ToTStr(text));
ListCtrl.SetItemText(item, i, nlUtf8ToTStr(text));
}
}
else
{
string text;
getNewItemText (0, 0, text);
ListCtrl.InsertItem (0, utf8ToTStr(text));
ListCtrl.InsertItem(0, nlUtf8ToTStr(text));
for (uint i=1; i<ColumnCount; i++)
{
getNewItemText (0, i, text);
ListCtrl.SetItemText (0, i, utf8ToTStr(text));
ListCtrl.SetItemText(0, i, nlUtf8ToTStr(text));
}
ListCtrl.SetItemState (0, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
}
@ -312,9 +312,9 @@ LRESULT CMyListCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
Ctrl->getBrowseInfo (Ctrl->Item, Ctrl->SubItem, defExt, defFilename, defDir, filter);
TCHAR buffer[MAX_PATH];
_tcscpy_s(buffer, MAX_PATH, utf8ToTStr(defDir));
_tcscpy_s(buffer, MAX_PATH, nlUtf8ToTStr(defDir));
CFileDialog dlgFile (TRUE, utf8ToTStr(defExt), utf8ToTStr(defFilename), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, utf8ToTStr(filter), theApp.m_pMainWnd);
CFileDialog dlgFile(TRUE, nlUtf8ToTStr(defExt), nlUtf8ToTStr(defFilename), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, nlUtf8ToTStr(filter), theApp.m_pMainWnd);
dlgFile.m_ofn.lpstrInitialDir = buffer;
Ctrl->OnBrowse = true;
if (dlgFile.DoModal () == IDOK)
@ -453,8 +453,8 @@ void CEditListCtrl::editItem (uint item, uint subitem)
getComboBoxStrings (Item, SubItem, retStrings);
for (uint i=0; i<retStrings.size (); i++)
{
Combo.InsertString (-1, utf8ToTStr(retStrings[i]));
if (retStrings[i] == tStrToUtf8(tmp))
Combo.InsertString(-1, nlUtf8ToTStr(retStrings[i]));
if (retStrings[i] == NLMISC::tStrToUtf8(tmp))
Combo.SetCurSel (i);
}
@ -475,7 +475,7 @@ void CEditListCtrl::editItem (uint item, uint subitem)
string retString;
bool browse;
getMemComboBoxProp (Item, SubItem, retString, browse);
MemCombo.setRegisterAdress (utf8ToTStr(retString));
MemCombo.setRegisterAdress(nlUtf8ToTStr(retString));
MemCombo.clearCommand ();
if (browse)
MemCombo.addCommand (GEORGES_EDIT_BROWSE_LABEL, CmdBrowse);

View file

@ -279,7 +279,7 @@ void CFileBrowserDialog::openDocument ()
string pathName = CPath::lookup (filename.c_str (), false, false);
if (pathName.empty ())
pathName = filename;
theApp.OpenDocumentFile (utf8ToTStr(pathName));
theApp.OpenDocumentFile(nlUtf8ToTStr(pathName));
}
}
else if (IsWindow (TreeCtrlType) && TreeCtrlDfn.IsWindowVisible ())
@ -289,7 +289,7 @@ void CFileBrowserDialog::openDocument ()
string pathName = CPath::lookup (filename.c_str (), false, false);
if (pathName.empty ())
pathName = filename;
theApp.OpenDocumentFile (utf8ToTStr(pathName));
theApp.OpenDocumentFile(nlUtf8ToTStr(pathName));
}
}
else if (TreeCtrlForm.IsWindowVisible ())
@ -299,7 +299,7 @@ void CFileBrowserDialog::openDocument ()
string pathName = CPath::lookup (filename.c_str (), false, false);
if (pathName.empty ())
pathName = filename;
theApp.OpenDocumentFile (utf8ToTStr(pathName));
theApp.OpenDocumentFile(nlUtf8ToTStr(pathName));
}
}
}

View file

@ -77,8 +77,8 @@ struct CTreeItemInfo
pParentFolder=NULL;
dwFlags=NULL;
}
ITEMIDLIST* pidlSelf;
ITEMIDLIST* pidlFullyQual;
LPITEMIDLIST pidlSelf;
LPITEMIDLIST pidlFullyQual;
IShellFolder* pParentFolder;
DWORD dwFlags;
std::string displayName;
@ -97,8 +97,8 @@ bool CFileTreeCtrl::setRootDirectory (const char *dir)
_TreeCtrl.DeleteAllItems ();
IShellFolder* pDesktop;
ITEMIDLIST* pidl;
ITEMIDLIST* pidlDir;
LPITEMIDLIST pidl;
LPITEMIDLIST pidlDir;
TV_ITEM tvItem={0};
TV_INSERTSTRUCT tvInsert={0};
@ -318,11 +318,11 @@ BOOL CFileTreeCtrl::OnNotify ( WPARAM wParam, LPARAM lParam, LRESULT* pResult )
return CWnd::OnNotify ( wParam, lParam, pResult );
}
inline ITEMIDLIST* Pidl_GetNextItem(LPCITEMIDLIST pidl)
inline LPITEMIDLIST Pidl_GetNextItem(LPCITEMIDLIST pidl)
{
if(pidl)
{
return (ITEMIDLIST*)(BYTE*)(((BYTE*)pidl) + pidl->mkid.cb);
return (LPITEMIDLIST)(BYTE*)(((BYTE*)pidl) + pidl->mkid.cb);
}
else
return NULL;
@ -347,7 +347,7 @@ return pidl;
UINT Pidl_GetSize(LPCITEMIDLIST pidl)
{
UINT cbTotal = 0;
ITEMIDLIST* pidlTemp = (ITEMIDLIST*) pidl;
LPITEMIDLIST pidlTemp = (LPITEMIDLIST)pidl;
if(pidlTemp)
{
@ -415,12 +415,12 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
return 0;
}
bool CFileTreeCtrl::enumObjects(HTREEITEM hParentItem,IShellFolder* pParentFolder, ITEMIDLIST* pidlParent)
bool CFileTreeCtrl::enumObjects(HTREEITEM hParentItem,IShellFolder* pParentFolder, LPITEMIDLIST pidlParent)
{
IEnumIDList* pEnum;
if(SUCCEEDED(pParentFolder->EnumObjects(NULL, SHCONTF_NONFOLDERS |SHCONTF_FOLDERS|SHCONTF_INCLUDEHIDDEN, &pEnum)))
{
ITEMIDLIST* pidl;
LPITEMIDLIST pidl;
DWORD dwFetched = 1;
TV_ITEM tvItem={0};
TV_INSERTSTRUCT tvInsert={0};
@ -445,7 +445,7 @@ bool CFileTreeCtrl::enumObjects(HTREEITEM hParentItem,IShellFolder* pParentFolde
nlverify ( SHGetPathFromIDList ( pidl, name ) );
// Save it
pItemInfo->displayName = tStrToUtf8(name);
pItemInfo->displayName = NLMISC::tStrToUtf8(name);
// Is a folder ?
bool folder = (pItemInfo->dwFlags&SFGAO_FOLDER) !=0;
@ -720,7 +720,7 @@ bool CFileTreeCtrl::getCurrentFilename (std::string &result)
if (curSel)
{
CString str = _TreeCtrl.GetItemText (curSel);
result = tStrToUtf8(str);
result = NLMISC::tStrToUtf8(str);
return true;
}
return false;

View file

@ -51,7 +51,7 @@ public:
bool create( const RECT& rect, CWnd* pParentWnd, UINT nID );
bool setRootDirectory (const char *dir);
void setArrangeMode (TArrange arrangeMode);
bool enumObjects (HTREEITEM hParentItem,IShellFolder* pParentFolder, ITEMIDLIST* pidlParent);
bool enumObjects (HTREEITEM hParentItem,IShellFolder* pParentFolder, LPITEMIDLIST pidlParent);
void doItemMenu (HWND hwndTreeView, HTREEITEM hItem, LPPOINT pptScreen);
void doClick (HWND hwndTreeView, HTREEITEM hItem);
void addExclusiveExtFilter (const char *ext);

View file

@ -832,7 +832,7 @@ BOOL CFormDialog::OnCommand(WPARAM wParam, LPARAM lParam)
smprintf (filter, 512, "%s Files (%s)|%s|All Files(*.*)|*.*|", typeName+i, ext.c_str(), ext.c_str());
// Open the dialog
CFileDialog dlgFile(TRUE, utf8ToTStr(ext), utf8ToTStr(ext), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, utf8ToTStr(filter), theApp.m_pMainWnd);
CFileDialog dlgFile(TRUE, nlUtf8ToTStr(ext), nlUtf8ToTStr(ext), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, nlUtf8ToTStr(filter), theApp.m_pMainWnd);
if (dlgFile.DoModal () == IDOK)
{
combo->Combo.UpdateData ();
@ -1316,16 +1316,16 @@ void IFormWidget::updateLabel ()
switch (where)
{
case UFormElm::ValueForm:
Label.SetWindowText(utf8ToTStr(SavedLabel + comp));
Label.SetWindowText(nlUtf8ToTStr(SavedLabel + comp));
break;
case UFormElm::ValueParentForm:
Label.SetWindowText(utf8ToTStr(SavedLabel + " (in parent form)" + comp));
Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (in parent form)" + comp));
break;
case UFormElm::ValueDefaultDfn:
Label.SetWindowText(utf8ToTStr(SavedLabel + " (default DFN value)" + comp));
Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (default DFN value)" + comp));
break;
case UFormElm::ValueDefaultType:
Label.SetWindowText(utf8ToTStr(SavedLabel + " (default TYPE value)" + comp));
Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (default TYPE value)" + comp));
break;
}
}
@ -1352,18 +1352,18 @@ void IFormWidget::updateLabel ()
if (node->getForm () == doc->getFormPtr ())
{
// The node exist
Label.SetWindowText (utf8ToTStr(SavedLabel));
Label.SetWindowText(nlUtf8ToTStr(SavedLabel));
}
else
{
// The node exist in the parent form
Label.SetWindowText (utf8ToTStr(SavedLabel + " (in parent form)"));
Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (in parent form)"));
}
}
else
{
// The node is empty
Label.SetWindowText (utf8ToTStr(SavedLabel + " (undefined)"));
Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (undefined)"));
}
}
@ -1512,7 +1512,7 @@ void IFormWidget::onOpenSelected ()
std::string str2 = CPath::lookup (str, false, false);
if (str2.empty())
str2 = str;
theApp.OpenDocumentFile (utf8ToTStr(str2));
theApp.OpenDocumentFile(nlUtf8ToTStr(str2));
}
// ***************************************************************************
@ -1569,7 +1569,7 @@ void CFormMemCombo::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent,
// Create the type combo
parent->setStaticSize (currentPos);
Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent);
Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label);
parent->getNextPosLabel (currentPos);
@ -1691,7 +1691,7 @@ void CFormMemCombo::getFromDocument (CForm &form)
if (doc->getRootNode(getSlot ())->getValueByName (result, FormName, UFormElm::NoEval, NULL))
{
Combo.UpdateData ();
Combo.SetWindowText (utf8ToTStr(result));
Combo.SetWindowText(nlUtf8ToTStr(result));
Combo.UpdateData (FALSE);
updateLabel ();
}
@ -1720,7 +1720,7 @@ void CFormMemCombo::getFromDocument (CForm &form)
CFormElmArray *arrayNode = safe_cast<CFormElmArray*> (node);
char label[512];
smprintf (label, 512, "%d", arrayNode->Elements.size ());
Combo.SetWindowText (utf8ToTStr(label));
Combo.SetWindowText(nlUtf8ToTStr(label));
if (arrayNode->getForm () == &form)
Label.SetWindowText (_T("Array size:"));
@ -1751,7 +1751,7 @@ void CFormMemCombo::getFromDocument (CForm &form)
if (node)
{
CFormElmVirtualStruct *virtualNode = safe_cast<CFormElmVirtualStruct*> (node);
Combo.SetWindowText (utf8ToTStr(virtualNode->DfnFilename));
Combo.SetWindowText(nlUtf8ToTStr(virtualNode->DfnFilename));
}
else
{
@ -1903,7 +1903,7 @@ void CFormCombo::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, ui
// Create the type combo
parent->setStaticSize (currentPos);
Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent);
Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label);
parent->getNextPosLabel (currentPos);
@ -1921,7 +1921,7 @@ void CFormCombo::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, ui
Combo.InsertString (0, _T(""));
for (uint predef=0; predef<nodeType->Definitions.size(); predef++)
{
Combo.InsertString (predef+1, utf8ToTStr(nodeType->Definitions[predef].Label));
Combo.InsertString(predef + 1, nlUtf8ToTStr(nodeType->Definitions[predef].Label));
}
}
@ -2088,7 +2088,7 @@ void CFormBigEdit::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent,
// Create the type combo
parent->setStaticSize (currentPos);
Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent);
Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label);
parent->getNextPosLabel (currentPos);
@ -2262,7 +2262,7 @@ void CColorEdit::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, ui
// Create the type combo
parent->setStaticSize (currentPos);
Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent);
Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label);
parent->getNextPosLabel (currentPos);
@ -2492,7 +2492,7 @@ void CListWidget::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, u
// Create the type combo
parent->setStaticSize (currentPos);
Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent);
Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label);
parent->getNextPosLabel (currentPos);
@ -2515,7 +2515,7 @@ void CListWidget::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, u
void CListWidget::addColumn (const char *name)
{
ListCtrl.insertColumn (0, utf8ToTStr(name));
ListCtrl.insertColumn(0, nlUtf8ToTStr(name));
ListCtrl.recalcColumn ();
}
@ -2566,7 +2566,7 @@ void CListWidget::getFromDocument (NLGEORGES::CForm &form)
string filename = form.getParentFilename (parent);
// Insert in the list
ListCtrl.ListCtrl.InsertItem (parent, utf8ToTStr(filename));
ListCtrl.ListCtrl.InsertItem(parent, nlUtf8ToTStr(filename));
ListCtrl.ListCtrl.UpdateData (FALSE);
updateLabel ();
@ -2709,7 +2709,7 @@ void CListWidget::onOpenSelected ()
if (str != "")
{
// Look for the file
CString name = utf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false));
CString name = nlUtf8ToTStr(CPath::lookup(tStrToUtf8(str), false, false));
if (name.IsEmpty())
name = str;
@ -2750,7 +2750,7 @@ void CIconWidget::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, u
// Create the type combo
parent->setStaticSize (currentPos);
Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent);
Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label);
parent->getNextPosLabel (currentPos);

View file

@ -182,8 +182,8 @@ bool CGeorgesEditDocForm::initDocument (const char *dfnName, bool newElement)
// Set file name and title
std::string name2 = toLower(NLMISC::CFile::getFilenameWithoutExtension(dfnName));
SetPathName (utf8ToTStr("*." + name2), FALSE);
SetTitle (utf8ToTStr("New " + name2 + " form"));
SetPathName(nlUtf8ToTStr("*." + name2), FALSE);
SetTitle(nlUtf8ToTStr("New " + name2 + " form"));
// TMp
if (newElement)
@ -223,7 +223,7 @@ BOOL CGeorgesEditDocForm::OnNewDocument()
string defFilename = theApp.RootSearchPath;
defFilename += "*.dfn";
CFileDialog dlgFile(TRUE, _T("*.dfn"), utf8ToTStr(defFilename.c_str()), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, DfnFilter, theApp.m_pMainWnd);
CFileDialog dlgFile(TRUE, _T("*.dfn"), nlUtf8ToTStr(defFilename.c_str()), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, DfnFilter, theApp.m_pMainWnd);
if (dlgFile.DoModal () == IDOK)
{
if (initDocument(tStrToUtf8(dlgFile.GetFileName()).c_str(), true))
@ -1331,7 +1331,7 @@ void CGeorgesEditDoc::setModifiedState (bool modified)
if ( (title.size ()>=2) && (title[title.size()-1] == '*') && (title[title.size()-2] == ' ') )
{
title.resize (title.size () - 2);
SetTitle (utf8ToTStr(title));
SetTitle(nlUtf8ToTStr(title));
}
}
}

View file

@ -295,7 +295,7 @@ void CGeorgesEditView::updateTab ()
// Init the tab
CGeorgesEditDocSub *child = parent->getChild (i);
int image = child->getItemImage (doc);
TabCtrl.InsertItem (i, utf8ToTStr(child->getName()), image);
TabCtrl.InsertItem(i, nlUtf8ToTStr(child->getName()), image);
// This is the selection ?
if (subObject == child)

View file

@ -579,12 +579,12 @@ void CGeorgesImpl::LoadDocument( const std::string& _sxfullname )
AFX_MANAGE_STATE(AfxGetStaticModuleState());
try
{
theApp.OpenDocumentFile(utf8ToTStr(_sxfullname));
theApp.OpenDocumentFile(nlUtf8ToTStr(_sxfullname));
}
catch (const NLMISC::Exception &e)
{
std::string tmp = std::string(e.what()) + "(" + _sxfullname + ")";
theApp.m_pMainWnd->MessageBox(utf8ToTStr(tmp), _T("Georges_Lib"), MB_ICONERROR | MB_OK);
theApp.m_pMainWnd->MessageBox(nlUtf8ToTStr(tmp), _T("Georges_Lib"), MB_ICONERROR | MB_OK);
}
}

View file

@ -109,7 +109,7 @@ BOOL CHeaderDialog::OnInitDialog()
ComboState.Create (WS_VISIBLE|CBS_DROPDOWNLIST|WS_TABSTOP, pos, this, CbState);
uint item;
for (item=0; item<CFileHeader::StateCount; item++)
ComboState.InsertString (-1, utf8ToTStr(CFileHeader::getStateString ((CFileHeader::TState)item)));
ComboState.InsertString(-1, nlUtf8ToTStr(CFileHeader::getStateString((CFileHeader::TState)item)));
ComboState.SetCurSel (0);
initWidget (ComboState);
getNextPos (currentPos);

View file

@ -96,7 +96,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

@ -109,14 +109,14 @@ void CLeftView::getSubObject (CGeorgesEditDocSub *subObject, HTREEITEM parent, H
if (!item)
{
int itemImage = subObject->getItemImage (GetDocument());
item = TreeCtrl.InsertItem (utf8ToTStr(subObject->getName()), itemImage, itemImage, parent);
item = TreeCtrl.InsertItem(nlUtf8ToTStr(subObject->getName()), itemImage, itemImage, parent);
}
// Set name
TreeCtrl.SetItemText (item, utf8ToTStr(subObject->getName()));
TreeCtrl.SetItemText(item, nlUtf8ToTStr(subObject->getName()));
// Set item data
TreeCtrl.SetItemData (item, (DWORD)subObject);
TreeCtrl.SetItemData (item, (DWORD_PTR)subObject);
// For each children
HTREEITEM child = TreeCtrl.GetChildItem (item);

View file

@ -436,7 +436,7 @@ void CMainFrame::OnUpdateModules0(CCmdUI* pCmdUI)
pCmdUI->Enable ();
string name;
theApp.PluginArray[0].PluginInterface->getPluginName (name);
pCmdUI->SetText (utf8ToTStr(name));
pCmdUI->SetText(nlUtf8ToTStr(name));
pCmdUI->SetCheck (theApp.PluginArray[0].Activated);
}
else
@ -464,7 +464,7 @@ void CMainFrame::OnUpdateModules1(CCmdUI* pCmdUI)
pCmdUI->Enable ();
string name;
theApp.PluginArray[1].PluginInterface->getPluginName (name);
pCmdUI->SetText (utf8ToTStr(name));
pCmdUI->SetText(nlUtf8ToTStr(name));
pCmdUI->SetCheck (theApp.PluginArray[1].Activated);
}
else
@ -492,7 +492,7 @@ void CMainFrame::OnUpdateModules2(CCmdUI* pCmdUI)
pCmdUI->Enable ();
string name;
theApp.PluginArray[2].PluginInterface->getPluginName (name);
pCmdUI->SetText (utf8ToTStr(name));
pCmdUI->SetText(nlUtf8ToTStr(name));
pCmdUI->SetCheck (theApp.PluginArray[2].Activated);
}
else
@ -520,7 +520,7 @@ void CMainFrame::OnUpdateModules3(CCmdUI* pCmdUI)
pCmdUI->Enable ();
string name;
theApp.PluginArray[3].PluginInterface->getPluginName (name);
pCmdUI->SetText (utf8ToTStr(name));
pCmdUI->SetText(nlUtf8ToTStr(name));
pCmdUI->SetCheck (theApp.PluginArray[3].Activated);
}
else

View file

@ -59,7 +59,7 @@ public:
bool isWnd (const CWnd *wnd) const;
void enableAutoCompleteExtension (bool enable, const char * ext);
std::tstring RegisterAdress;
NLMISC::tstring RegisterAdress;
int MemoryCount;
UINT Id;

View file

@ -98,7 +98,7 @@ void COutputConsoleDlg::outputString (const char *message)
{
int index = edit->LineIndex(edit->GetLineCount( )-1) + edit->LineLength(edit->GetLineCount( )-1);
edit->SetSel (index, index);
edit->ReplaceSel (utf8ToTStr(message));
edit->ReplaceSel(nlUtf8ToTStr(message));
}
}

View file

@ -103,13 +103,13 @@ void CSettingsDialog::OnOK()
UpdateData ();
// Make a config file
theApp.RootSearchPath = RootSearchPath;
theApp.TypeDfnSubDirectory = TypeDfnSubDirectory;
theApp.RootSearchPath = NLMISC::tStrToUtf8(RootSearchPath);
theApp.TypeDfnSubDirectory = NLMISC::tStrToUtf8(TypeDfnSubDirectory);
theApp.RememberListSize = RememberListSize;
theApp.StartExpanded = StartExpanded ? TRUE : FALSE;
theApp.MaxUndo = MaxUndo;
theApp.DefaultDfn = DefaultDfn;
theApp.DefaultType = DefaultType;
theApp.DefaultDfn = NLMISC::tStrToUtf8(DefaultDfn);
theApp.DefaultType = NLMISC::tStrToUtf8(DefaultType);
theApp.saveCfg ();
theApp.initCfg ();
@ -121,12 +121,12 @@ void CSettingsDialog::OnBrowse()
UpdateData();
// Select a directory.
char path[MAX_PATH];
TCHAR path[MAX_PATH];
// Build the struct
BROWSEINFO info;
memset(&info, 0, sizeof(BROWSEINFO));
info.lpszTitle="Select the root search directory";
info.lpszTitle = _T("Select the root search directory");
info.ulFlags = BIF_RETURNONLYFSDIRS;
// Select the path

View file

@ -88,7 +88,7 @@ BOOL CTypeDialog::OnInitDialog()
// Create the type combo
setStaticSize (currentPos);
LabelType.Create ("Type:", WS_VISIBLE, currentPos, this);
LabelType.Create (_T("Type:"), WS_VISIBLE, currentPos, this);
initWidget (LabelType);
getNextPosLabel (currentPos);
@ -101,7 +101,7 @@ BOOL CTypeDialog::OnInitDialog()
uint item;
ComboType.ResetContent ();
for (item=0; item<CType::TypeCount; item++)
ComboType.InsertString (-1, CType::getTypeName ((CType::TType)item));
ComboType.InsertString (-1, nlUtf8ToTStr(CType::getTypeName ((CType::TType)item)));
ComboType.SetCurSel (0);
initWidget (ComboType);
@ -109,7 +109,7 @@ BOOL CTypeDialog::OnInitDialog()
// Create the type combo
setStaticSize (currentPos);
LabelUIType.Create ("User Interface:", WS_VISIBLE, currentPos, this);
LabelUIType.Create (_T("User Interface:"), WS_VISIBLE, currentPos, this);
initWidget (LabelUIType);
getNextPosLabel (currentPos);
@ -123,59 +123,59 @@ BOOL CTypeDialog::OnInitDialog()
// Default value
setStaticSize (currentPos);
LabelDefault.Create ("Default value:", WS_VISIBLE, currentPos, this);
LabelDefault.Create (_T("Default value:"), WS_VISIBLE, currentPos, this);
initWidget (LabelDefault);
getNextPosLabel (currentPos);
setComboSize (currentPos, SmallWidget);
Default.create (WS_CHILD|WS_TABSTOP, currentPos, this, EdDefault, GEORGES_EDIT_BASE_REG_KEY"\\Type Default MemCombo", theApp.RememberListSize);
Default.create (WS_CHILD|WS_TABSTOP, currentPos, this, EdDefault, nlUtf8ToTStr(GEORGES_EDIT_BASE_REG_KEY"\\Type Default MemCombo"), theApp.RememberListSize);
initWidget (Default);
getNextPos (currentPos);
// Min value
setStaticSize (currentPos);
LabelMin.Create ("Min value:", WS_VISIBLE, currentPos, this);
LabelMin.Create (_T("Min value:"), WS_VISIBLE, currentPos, this);
initWidget (LabelMin);
getNextPosLabel (currentPos);
setComboSize (currentPos, SmallWidget);
Min.create (WS_CHILD|WS_TABSTOP, currentPos, this, EdMin, GEORGES_EDIT_BASE_REG_KEY"\\Type Min MemCombo", theApp.RememberListSize);
Min.create (WS_CHILD|WS_TABSTOP, currentPos, this, EdMin, nlUtf8ToTStr(GEORGES_EDIT_BASE_REG_KEY"\\Type Min MemCombo"), theApp.RememberListSize);
initWidget (Min);
getNextPos (currentPos);
// Max value
setStaticSize (currentPos);
LabelMax.Create ("Max value:", WS_VISIBLE, currentPos, this);
LabelMax.Create (_T("Max value:"), WS_VISIBLE, currentPos, this);
initWidget (LabelMax);
getNextPosLabel (currentPos);
setComboSize (currentPos, SmallWidget);
Max.create (WS_CHILD|WS_TABSTOP, currentPos, this, EdMax, GEORGES_EDIT_BASE_REG_KEY"\\Type Max MemCombo", theApp.RememberListSize);
Max.create (WS_CHILD|WS_TABSTOP, currentPos, this, EdMax, nlUtf8ToTStr(GEORGES_EDIT_BASE_REG_KEY"\\Type Max MemCombo"), theApp.RememberListSize);
initWidget (Max);
getNextPos (currentPos);
// Increment value
setStaticSize (currentPos);
LabelIncrement.Create ("Increment value:", WS_VISIBLE, currentPos, this);
LabelIncrement.Create (_T("Increment value:"), WS_VISIBLE, currentPos, this);
initWidget (LabelIncrement);
getNextPosLabel (currentPos);
setComboSize (currentPos, SmallWidget);
Increment.create (WS_CHILD|WS_TABSTOP, currentPos, this, EdIncrement, GEORGES_EDIT_BASE_REG_KEY"\\Type Increment MemCombo", theApp.RememberListSize);
Increment.create (WS_CHILD|WS_TABSTOP, currentPos, this, EdIncrement, nlUtf8ToTStr(GEORGES_EDIT_BASE_REG_KEY"\\Type Increment MemCombo"), theApp.RememberListSize);
initWidget (Increment);
getNextColumn (currentPos);
// Predef list value
setStaticSize (currentPos);
LabelPreDef.Create ("Predefintion list:", WS_VISIBLE, currentPos, this);
LabelPreDef.Create (_T("Predefintion list:"), WS_VISIBLE, currentPos, this);
initWidget (LabelPreDef);
getNextPosLabel (currentPos);
setListSize (currentPos, SmallWidgetNotLimited, 250);
Predef.create (WS_TABSTOP, currentPos, this, LtPredef);
Predef.Dialog = this;
Predef.insertColumn (0, "Label");
Predef.insertColumn (1, "Value");
Predef.insertColumn (0, _T("Label"));
Predef.insertColumn (1, _T("Value"));
Predef.recalcColumn ();
initWidget (Predef);
getNextPos (currentPos);
@ -356,7 +356,7 @@ void CTypeDialog::getFromDocument (const NLGEORGES::CType &type)
// Insert type string
ComboType.ResetContent ();
for (item=0; item<CType::TypeCount; item++)
ComboType.InsertString (-1, CType::getTypeName ((CType::TType)item));
ComboType.InsertString (-1, nlUtf8ToTStr(CType::getTypeName ((CType::TType)item)));
// Insert UI types
ComboUIType.ResetContent ();
@ -364,7 +364,7 @@ void CTypeDialog::getFromDocument (const NLGEORGES::CType &type)
{
if (CType::uiCompatible (type.Type, (CType::TUI)item))
{
int index = ComboUIType.InsertString (-1, CType::getUIName ((CType::TUI)item));
int index = ComboUIType.InsertString(-1, nlUtf8ToTStr(CType::getUIName((CType::TUI)item)));
ComboUIType.SetItemData (index, item);
if (item == (uint)type.UIType)
@ -373,10 +373,10 @@ void CTypeDialog::getFromDocument (const NLGEORGES::CType &type)
}
ComboType.SetCurSel (type.Type);
Default.SetWindowText (type.Default.c_str());
Min.SetWindowText (type.Min.c_str());
Max.SetWindowText (type.Max.c_str());
Increment.SetWindowText (type.Increment.c_str());
Default.SetWindowText (nlUtf8ToTStr(type.Default));
Min.SetWindowText (nlUtf8ToTStr(type.Min));
Max.SetWindowText (nlUtf8ToTStr(type.Max));
Increment.SetWindowText (nlUtf8ToTStr(type.Increment));
// Disable some windows
bool number = (type.Type == UType::UnsignedInt) || (type.Type == UType::SignedInt) || (type.Type == UType::Double);
@ -390,8 +390,8 @@ void CTypeDialog::getFromDocument (const NLGEORGES::CType &type)
for (predef=0; predef<type.Definitions.size(); predef++)
{
// Add the label and value
Predef.ListCtrl.InsertItem (predef, type.Definitions[predef].Label.c_str());
Predef.ListCtrl.SetItemText (predef, 1, type.Definitions[predef].Value.c_str());
Predef.ListCtrl.InsertItem (predef, nlUtf8ToTStr(type.Definitions[predef].Label));
Predef.ListCtrl.SetItemText (predef, 1, nlUtf8ToTStr(type.Definitions[predef].Value));
}
}
}
@ -442,7 +442,7 @@ void CTypeDialog::setDefaultToDocument ()
Default.UpdateData();
Default.GetWindowText(str);
doc->modify (new CActionString (IAction::TypeDefault, str, *doc, "", "",
doc->modify(new CActionString(IAction::TypeDefault, nlTStrToUtf8(str), *doc, "", "",
doc->getLeftView()->getCurrentSelectionId(), 0));
}
}
@ -461,7 +461,7 @@ void CTypeDialog::setMinToDocument ()
Min.UpdateData();
Min.GetWindowText(str);
doc->modify (new CActionString (IAction::TypeMin, str, *doc, "", "",
doc->modify(new CActionString(IAction::TypeMin, nlTStrToUtf8(str), *doc, "", "",
doc->getLeftView()->getCurrentSelectionId(), 0));
}
}
@ -478,7 +478,7 @@ void CTypeDialog::setMaxToDocument ()
Max.UpdateData();
Max.GetWindowText(str);
doc->modify (new CActionString (IAction::TypeMax, str, *doc, "", "",
doc->modify(new CActionString(IAction::TypeMax, nlTStrToUtf8(str), *doc, "", "",
doc->getLeftView()->getCurrentSelectionId(), 0));
}
}
@ -494,7 +494,7 @@ void CTypeDialog::setIncrementToDocument ()
Increment.UpdateData();
Increment.GetWindowText(str);
doc->modify (new CActionString (IAction::TypeIncrement, str, *doc, "", "",
doc->modify(new CActionString(IAction::TypeIncrement, nlTStrToUtf8(str), *doc, "", "",
doc->getLeftView()->getCurrentSelectionId(), 0));
}
}

View file

@ -31,11 +31,7 @@
using namespace std;
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
int APIENTRY nltWinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPTSTR lpCmdLine, int nCmdShow)
{
// Init the NeL application context
NLMISC::CApplicationContext context;
@ -48,7 +44,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
// Init ui
pGeorges->initUI(nCmdShow, true);
string cmd = lpCmdLine;
string cmd = NLMISC::tStrToUtf8(lpCmdLine);
if(!cmd.empty())
{
nlinfo("Using command line '%s'", cmd.c_str());

View file

@ -191,11 +191,11 @@ BOOL CPageBgFades::OnInitDialog()
for (uint i =0; i<32; ++i)
{
char tmp[128];
GetDlgItem(FILTER_NAMES[i])->SetWindowText(SoundDialog->EnvNames[i].Name.c_str());
sprintf(tmp, "%u", SoundDialog->FilterFades.FadeIns[i]);
GetDlgItem(FILTER_FADE_IN[i])->SetWindowText(tmp);
sprintf(tmp, "%u", SoundDialog->FilterFades.FadeOuts[i]);
GetDlgItem(FILTER_FADE_OUT[i])->SetWindowText(tmp);
GetDlgItem(FILTER_NAMES[i])->SetWindowText(nlUtf8ToTStr(SoundDialog->EnvNames[i].Name));
sprintf(tmp, "%u", (unsigned int)SoundDialog->FilterFades.FadeIns[i]);
GetDlgItem(FILTER_FADE_IN[i])->SetWindowText(nlUtf8ToTStr(tmp));
sprintf(tmp, "%u", (unsigned int)SoundDialog->FilterFades.FadeOuts[i]);
GetDlgItem(FILTER_FADE_OUT[i])->SetWindowText(nlUtf8ToTStr(tmp));
}
SoundDialog->getSoundPlugin()->getMixer()->setBackgroundFilterFades(SoundDialog->FilterFades);
@ -209,20 +209,20 @@ BOOL CPageBgFades::OnCommand(WPARAM wParam, LPARAM lParam)
if (lParam != 0 && HIWORD(wParam) == EN_CHANGE)
{
int id = ::GetDlgCtrlID(HWND(lParam));
char tmp[1024];
TCHAR tmp[1024];
if (FILTER_FADE_IN_IDX.find(id) != FILTER_FADE_IN_IDX.end())
{
// this is a fade in value modified !
GetDlgItem(id)->GetWindowText(tmp, 1024);
SoundDialog->FilterFades.FadeIns[FILTER_FADE_IN_IDX[id]] = atoi(tmp);
SoundDialog->FilterFades.FadeIns[FILTER_FADE_IN_IDX[id]] = atoi(nlTStrToUtf8(tmp));
SoundDialog->getSoundPlugin()->getMixer()->setBackgroundFilterFades(SoundDialog->FilterFades);
}
else if (FILTER_FADE_OUT_IDX.find(id) != FILTER_FADE_OUT_IDX.end())
{
// this is a fade in value modified !
GetDlgItem(id)->GetWindowText(tmp, 1024);
SoundDialog->FilterFades.FadeOuts[FILTER_FADE_OUT_IDX[id]] = atoi(tmp);
SoundDialog->FilterFades.FadeOuts[FILTER_FADE_OUT_IDX[id]] = atoi(nlTStrToUtf8(tmp));
SoundDialog->getSoundPlugin()->getMixer()->setBackgroundFilterFades(SoundDialog->FilterFades);
}
}

View file

@ -421,8 +421,8 @@ BOOL CPageBgFlags::OnInitDialog()
const NLSOUND::UAudioMixer::TBackgroundFlags &flag = SoundDialog->getSoundPlugin()->getMixer()->getBackgroundFlags();
for (uint i=0; i<32; ++i)
{
GetDlgItem(FILTER_EDIT_NAME[i])->SetWindowText(SoundDialog->EnvNames[i].Name.c_str());
GetDlgItem(FILTER_SIM_NAME[i])->SetWindowText(SoundDialog->EnvNames[i].ShortName.c_str());
GetDlgItem(FILTER_EDIT_NAME[i])->SetWindowText(nlUtf8ToTStr(SoundDialog->EnvNames[i].Name));
GetDlgItem(FILTER_SIM_NAME[i])->SetWindowText(nlUtf8ToTStr(SoundDialog->EnvNames[i].ShortName));
static_cast<CButton*>(GetDlgItem(FILTER_SIM[i]))->SetCheck(flag.Flags[i] ? 1 : 0);
}

View file

@ -95,9 +95,9 @@ BOOL CPageComtext::OnCommand(WPARAM wParam, LPARAM lParam)
if (EDIT_ARG_IDX.find(id) != EDIT_ARG_IDX.end())
{
// need to update the var.
char tmp[1024];
TCHAR tmp[1024];
GetDlgItem(id)->GetWindowText(tmp, 1024);
SoundContext.Args[EDIT_ARG_IDX[id]] = atoi(tmp);
SoundContext.Args[EDIT_ARG_IDX[id]] = atoi(nlTStrToUtf8(tmp));
}
}

View file

@ -49,14 +49,13 @@ __declspec( dllexport ) IEditPlugin *IGeorgesEditGetInterface (int version, NLGE
}
catch (const std::exception &e)
{
string reason = e.what();
MessageBox (NULL, reason.c_str(), "Sound plugin", MB_OK);
MessageBox (NULL, nlUtf8ToTStr(e.what()), _T("Sound plugin"), MB_OK);
return NULL;
}
}
else
{
MessageBox (NULL, "Plugin version invalid.", "Sound plugin for georges editor", MB_OK|MB_ICONEXCLAMATION);
MessageBox (NULL, _T("Plugin version invalid."), _T("Sound plugin for georges editor"), MB_OK|MB_ICONEXCLAMATION);
return NULL;
}

View file

@ -68,7 +68,7 @@ bool CListenerView::registerClass()
}
catch (CResourceException* e)
{
AfxMessageBox("Couldn't register class! (Already registered?)");
AfxMessageBox(_T("Couldn't register class! (Already registered?)"));
e->Delete();
return false;
}
@ -80,7 +80,7 @@ bool CListenerView::registerClass()
_VolumeCurve.CreatePen(PS_SOLID, 1, RGB(255, 0, 128));
_Font.CreateFont(14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "Arial");
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, _T("Arial"));
return true;
}
@ -99,7 +99,7 @@ void CListenerView::init(CSoundPlugin* plugin, CRect& rect, CWnd* parent)
_OuterAngle = 360;
_InnerAngle = 360;
if (!Create((LPCTSTR) _WndClass, "Listener", WS_CHILD | WS_VISIBLE, rect, parent, ++_WndId))
if (!Create((LPCTSTR) _WndClass, _T("Listener"), WS_CHILD | WS_VISIBLE, rect, parent, ++_WndId))
{
throw exception("failed to create the listener view");
}

View file

@ -239,7 +239,7 @@ void CSoundDialog::displayTime(uint32 msec)
uint min = sec / 60;
sec -= min * 60;
_snprintf(s, 256, "%02d:%02d", min, sec);
GetDlgItem(IDC_TIME)->SetWindowText(s);
GetDlgItem(IDC_TIME)->SetWindowText(nlUtf8ToTStr(s));
}
// ***************************************************************************
@ -285,7 +285,7 @@ void CSoundDialog::updateInfo()
CPageBase::docChanged();
SetWindowText(_Name.c_str());
SetWindowText(nlUtf8ToTStr(_Name));
char s[256];
/* if (_Filename.empty())
@ -342,7 +342,7 @@ void CSoundDialog::updateInfo()
msec -= sec * 1000;
sec -= min * 60;
_snprintf(s, 256, "%02d:%02d.%03d", min, sec, msec);
GetDlgItem(IDC_DURATION)->SetWindowText(s);
GetDlgItem(IDC_DURATION)->SetWindowText(nlUtf8ToTStr(s));
updateButton();
}
@ -361,7 +361,7 @@ bool CSoundDialog::getFileInfo(string& filename, uint& sampleRate, uint& sampleS
}
// Open the file
HMMIO hmmio = mmioOpen((char*) path.c_str(), NULL, MMIO_READ | MMIO_DENYWRITE);
HMMIO hmmio = mmioOpen((LPTSTR)nlUtf8ToTStr(path), NULL, MMIO_READ | MMIO_DENYWRITE);
if (hmmio == NULL)
{
return false;
@ -484,7 +484,7 @@ void CSoundDialog::OnControlPlayback()
if (str == "*.sound")
{
MessageBox("You must save the file before playing it !", "Warning");
MessageBox(_T("You must save the file before playing it !"), _T("Warning"));
return;
}
}

View file

@ -362,7 +362,7 @@ void CSoundPlugin::setActiveDocument(IEditDocument *pdoc)
if (invalid && !_InvalidSound)
{
MessageBox(NULL, "This sound contains an infinite recursion !", "Sound Error", MB_ICONERROR);
MessageBox(NULL, _T("This sound contains an infinite recursion !"), _T("Sound Error"), MB_ICONERROR);
}
// pre-create the sound to force loading any missing sample bank (thus avoiding unwanted message box)
@ -410,7 +410,7 @@ void CSoundPlugin::setActiveDocument(IEditDocument *pdoc)
message += (*first)+"\n";
}
MessageBox(NULL, message.c_str(), "Sound incomplete", MB_ICONWARNING);
MessageBox(NULL, nlUtf8ToTStr(message), _T("Sound incomplete"), MB_ICONWARNING);
}
@ -474,12 +474,12 @@ void CSoundPlugin::onCreateDocument(IEditDocument *document)
void CSoundPlugin::createNew()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
char BASED_CODE szFilter[] = "Sound (*.sound)|*.sound|All Files (*.*)|*.*||";
CFileDialog fileDlg(FALSE, ".sound", "*.sound", OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter);
TCHAR BASED_CODE szFilter[] = _T("Sound (*.sound)|*.sound|All Files (*.*)|*.*||");
CFileDialog fileDlg(FALSE, _T(".sound"), _T("*.sound"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter);
if (fileDlg.DoModal() == IDOK)
{
string filename = (const char*) fileDlg.GetPathName();
string filename = NLMISC::tStrToUtf8(fileDlg.GetPathName());
_GlobalInterface->createDocument("sound.dfn", filename.c_str());
}
}
@ -585,8 +585,7 @@ void CSoundPlugin::play(std::string &filename)
}
catch (ESoundDriver& e)
{
string reason = e.what();
MessageBox (NULL, reason.c_str(), "Sound plugin", MB_OK);
MessageBox(NULL, nlUtf8ToTStr(e.what()), _T("Sound plugin"), MB_OK);
}
}