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) #if defined(NL_OS_WINDOWS) && defined(_WINDOWS)
#define NLNET_SERVICE_MAIN(__ServiceClassName, __ServiceShortName, __ServiceLongName, __ServicePort, __ServiceCallbackArray, __ConfigDir, __LogDir) \ #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; \ NLMISC::CApplicationContext serviceContext; \
__ServiceClassName *scn = new __ServiceClassName; \ __ServiceClassName *scn = new __ServiceClassName; \
scn->setArgs (lpCmdLine); \ scn->setArgs (nlTStrToUtf8(lpCmdLine)); \
createDebug(NULL,!scn->haveLongArg("nolog"));\ createDebug(NULL,!scn->haveLongArg("nolog"));\
scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \ scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \
sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__ " " __TIME__); \ 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 #else
#define NLNET_SERVICE_MAIN(__ServiceClassName, __ServiceShortName, __ServiceLongName, __ServicePort, __ServiceCallbackArray, __ConfigDir, __LogDir) \ #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; \ NLMISC::CApplicationContext serviceContext; \
__ServiceClassName *scn = new __ServiceClassName; \ __ServiceClassName *scn = new __ServiceClassName; \
scn->setArgs (argc, argv); \ scn->setArgs (argc, nlTStrToUtf8(argv)); \
createDebug(NULL,!scn->haveLongArg("nolog"));\ createDebug(NULL,!scn->haveLongArg("nolog"));\
scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \ scn->setCallbackArray (__ServiceCallbackArray, sizeof(__ServiceCallbackArray)/sizeof(__ServiceCallbackArray[0])); \
sint retval = scn->main (__ServiceShortName, __ServiceLongName, __ServicePort, __ConfigDir, __LogDir, __DATE__ " " __TIME__); \ 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 // Main
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
#ifdef NL_OS_WINDOWS #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 #else // NL_OS_WINDOWS
int main(int argc, char **argv) int nltmain(int argc, NLMISC::tchar **argv)
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
{ {
double rGlobalTime = 0; double rGlobalTime = 0;

View file

@ -88,7 +88,7 @@ static CHashKeyMD5 getNewMD5(const std::string &filename)
} }
#if defined(NL_OS_WINDOWS) && !defined(_CONSOLE) #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 // we can specify several shapes on command line
// so we need to process it // so we need to process it

View file

@ -953,12 +953,11 @@ void initViewerConfig(const char * configFileName)
MAIN MAIN
\****************************************************************/ \****************************************************************/
#ifdef NL_OS_WINDOWS #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 try
{ {
NLMISC::CApplicationContext myApplicationContext; NLMISC::CApplicationContext myApplicationContext;

View file

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

View file

@ -45,7 +45,7 @@ CCounter::~CCounter()
void cCounterToCLogicCounter( CCounter& counter, CLogicCounter& logicCounter ) void cCounterToCLogicCounter( CCounter& counter, CLogicCounter& logicCounter )
{ {
// counter name // counter name
logicCounter.setName(tStrToUtf8(counter.m_sName)); logicCounter.setName(NLMISC::tStrToUtf8(counter.m_sName));
// running mode // running mode
if( counter.m_sMode == "Shuttle" ) 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 ) void cEventToCLogicEvent( CEvent& event, CLogicEvent& logicEvent )
{ {
/// condition name /// condition name
logicEvent.ConditionName = tStrToUtf8(event.m_sConditionName); logicEvent.ConditionName = NLMISC::tStrToUtf8(event.m_sConditionName);
/// event action /// event action
logicEvent.EventAction.IsStateChange = !event.m_bActionIsMessage; logicEvent.EventAction.IsStateChange = !event.m_bActionIsMessage;
@ -78,18 +78,18 @@ void cEventToCLogicEvent( CEvent& event, CLogicEvent& logicEvent )
if( logicEvent.EventAction.IsStateChange ) if( logicEvent.EventAction.IsStateChange )
{ {
/// state name for state change /// state name for state change
logicEvent.EventAction.StateChange = tStrToUtf8(event.m_sStateChange); logicEvent.EventAction.StateChange = NLMISC::tStrToUtf8(event.m_sStateChange);
} }
else else
{ {
/// message destination /// message destination
logicEvent.EventAction.EventMessage.Destination = tStrToUtf8(event.m_sMessageDestination); logicEvent.EventAction.EventMessage.Destination = NLMISC::tStrToUtf8(event.m_sMessageDestination);
/// message id /// message id
logicEvent.EventAction.EventMessage.MessageId = "LOGIC"; //string( (LPCSTR)event.m_sMessageID ); //TEMP!!! logicEvent.EventAction.EventMessage.MessageId = "LOGIC"; //string( (LPCSTR)event.m_sMessageID ); //TEMP!!!
/// message arguments /// message arguments
logicEvent.EventAction.EventMessage.Arguments = tStrToUtf8(event.m_sArguments); logicEvent.EventAction.EventMessage.Arguments = NLMISC::tStrToUtf8(event.m_sArguments);
} }
} // cEventToCLogicEvent // } // cEventToCLogicEvent //
@ -176,7 +176,7 @@ BOOL CState::removeEvent( CEvent *event)
void cStateToCLogicState( CState& state, CLogicState& logicState ) void cStateToCLogicState( CState& state, CLogicState& logicState )
{ {
/// state name /// state name
logicState.setName(tStrToUtf8(state.m_sName)); logicState.setName(NLMISC::tStrToUtf8(state.m_sName));
POSITION pos; POSITION pos;
for( pos = state.m_evEvents.GetHeadPosition(); pos != NULL; ) for( pos = state.m_evEvents.GetHeadPosition(); pos != NULL; )

View file

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

View file

@ -19,11 +19,7 @@
#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 WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{ {
char *filename; char *filename;
if (filename = strstr (lpCmdLine, "-f ")) if (filename = strstr (lpCmdLine, "-f "))

View file

@ -40,11 +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,
LPSTR 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

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

View file

@ -193,7 +193,7 @@ void CDfnDialog::getFromDocument (const NLGEORGES::CFormDfn &dfn)
for (parent=0; parent<dfn.getNumParent (); parent++) for (parent=0; parent<dfn.getNumParent (); parent++)
{ {
// Add the label and value // 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 // Add the struct element
@ -202,12 +202,12 @@ void CDfnDialog::getFromDocument (const NLGEORGES::CFormDfn &dfn)
for (elm=0; elm<dfn.getNumEntry (); elm++) for (elm=0; elm<dfn.getNumEntry (); elm++)
{ {
// Add the label and value // 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 ()) switch (elm, dfn.getEntry (elm).getType ())
{ {
case UFormDfn::EntryType: case UFormDfn::EntryType:
Struct.ListCtrl.SetItemText (elm, 1, dfn.getEntry (elm).getArrayFlag () ? _T("Type array") : _T("Type")); 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; break;
case UFormDfn::EntryDfn: case UFormDfn::EntryDfn:
Struct.ListCtrl.SetItemText (elm, 1, dfn.getEntry (elm).getArrayFlag () ? _T("Dfn array") : _T("Dfn")); 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")); Struct.ListCtrl.SetItemText (elm, 1, _T("Virtual Dfn"));
break; break;
} }
Struct.ListCtrl.SetItemText (elm, 2, utf8ToTStr(dfn.getEntry (elm).getFilename())); Struct.ListCtrl.SetItemText(elm, 2, nlUtf8ToTStr(dfn.getEntry(elm).getFilename()));
Struct.ListCtrl.SetItemText (elm, 3, utf8ToTStr(dfn.getEntry (elm).getDefault())); 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) if (subItem == 2)
{ {
@ -422,7 +422,7 @@ void CDfnEditListCtrl::onItemChanged (uint item, uint subItem)
str = Dialog->Struct.ListCtrl.GetItemText (item, 2); str = Dialog->Struct.ListCtrl.GetItemText (item, 2);
std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(str)); std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(str));
if (ext == "typ") 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")) 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); str = Dialog->Struct.ListCtrl.GetItemText (item, 2);
std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(str)); std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(str));
if (ext == "dfn") if (ext == "dfn")
Dialog->Struct.ListCtrl.SetItemText (item, 2, utf8ToTStr(theApp.DefaultDfn)); Dialog->Struct.ListCtrl.SetItemText(item, 2, nlUtf8ToTStr(theApp.DefaultDfn));
// Clear default value // Clear default value
Dialog->Struct.ListCtrl.SetItemText (item, 3, _T("")); Dialog->Struct.ListCtrl.SetItemText (item, 3, _T(""));
@ -472,7 +472,7 @@ void CDfnDialog::onOpenSelected ()
if (str != "") if (str != "")
{ {
// Look for the file // 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()) if (name.IsEmpty())
name = str; name = str;
@ -494,7 +494,7 @@ void CDfnDialog::onOpenSelected ()
if (str != "") if (str != "")
{ {
// Look for the file // 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()) if (name.IsEmpty())
name = str; 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; filter = DfnFilter;
defDir = theApp.RootSearchPath; defDir = theApp.RootSearchPath;

View file

@ -36,7 +36,7 @@ class CDfnParentEditListCtrl : public CEditListCtrl
CEditListCtrl::TItemEdit getItemEditMode (uint item, uint subItem); CEditListCtrl::TItemEdit getItemEditMode (uint item, uint subItem);
void getMemComboBoxProp (uint item, uint subItem, std::string &regAdr, bool &browse); void getMemComboBoxProp (uint item, uint subItem, std::string &regAdr, bool &browse);
void getNewItemText (uint item, uint subItem, std::string &ret); 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: public:
class CDfnDialog *Dialog; class CDfnDialog *Dialog;
}; };
@ -47,7 +47,7 @@ class CDfnEditListCtrl : public CEditListCtrl
void getComboBoxStrings (uint item, uint subItem, std::vector<std::string> &retStrings); void getComboBoxStrings (uint item, uint subItem, std::vector<std::string> &retStrings);
void getMemComboBoxProp (uint item, uint subItem, std::string &regAdr, bool &browse); void getMemComboBoxProp (uint item, uint subItem, std::string &regAdr, bool &browse);
void getNewItemText (uint item, uint subItem, std::string &ret); 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); void onItemChanged (uint item, uint subItem);
public: public:
class CDfnDialog *Dialog; class CDfnDialog *Dialog;

View file

@ -122,11 +122,11 @@ BOOL CEditListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
// Insert an item at the end // Insert an item at the end
string text; string text;
getNewItemText (ListCtrl.GetItemCount (), 0, text); getNewItemText (ListCtrl.GetItemCount (), 0, text);
ListCtrl.InsertItem (ListCtrl.GetItemCount (), utf8ToTStr(text)); ListCtrl.InsertItem(ListCtrl.GetItemCount(), nlUtf8ToTStr(text));
for (uint i=1; i<ColumnCount; i++) for (uint i=1; i<ColumnCount; i++)
{ {
getNewItemText (ListCtrl.GetItemCount ()-1, i, text); getNewItemText (ListCtrl.GetItemCount ()-1, i, text);
ListCtrl.SetItemText (ListCtrl.GetItemCount ()-1, i, utf8ToTStr(text)); ListCtrl.SetItemText(ListCtrl.GetItemCount() - 1, i, nlUtf8ToTStr(text));
} }
ListCtrl.SetItemState (ListCtrl.GetItemCount ()-1, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED); ListCtrl.SetItemState (ListCtrl.GetItemCount ()-1, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
@ -151,22 +151,22 @@ BOOL CEditListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
item = ListCtrl.GetNextSelectedItem(pos); item = ListCtrl.GetNextSelectedItem(pos);
string text; string text;
getNewItemText (item, 0, text); getNewItemText (item, 0, text);
ListCtrl.InsertItem (item, utf8ToTStr(text)); ListCtrl.InsertItem(item, nlUtf8ToTStr(text));
for (uint i=1; i<ColumnCount; i++) for (uint i=1; i<ColumnCount; i++)
{ {
getNewItemText (item, i, text); getNewItemText (item, i, text);
ListCtrl.SetItemText (item, i, utf8ToTStr(text)); ListCtrl.SetItemText(item, i, nlUtf8ToTStr(text));
} }
} }
else else
{ {
string text; string text;
getNewItemText (0, 0, text); getNewItemText (0, 0, text);
ListCtrl.InsertItem (0, utf8ToTStr(text)); ListCtrl.InsertItem(0, nlUtf8ToTStr(text));
for (uint i=1; i<ColumnCount; i++) for (uint i=1; i<ColumnCount; i++)
{ {
getNewItemText (0, i, text); 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); 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); Ctrl->getBrowseInfo (Ctrl->Item, Ctrl->SubItem, defExt, defFilename, defDir, filter);
TCHAR buffer[MAX_PATH]; 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; dlgFile.m_ofn.lpstrInitialDir = buffer;
Ctrl->OnBrowse = true; Ctrl->OnBrowse = true;
if (dlgFile.DoModal () == IDOK) if (dlgFile.DoModal () == IDOK)
@ -453,8 +453,8 @@ void CEditListCtrl::editItem (uint item, uint subitem)
getComboBoxStrings (Item, SubItem, retStrings); getComboBoxStrings (Item, SubItem, retStrings);
for (uint i=0; i<retStrings.size (); i++) for (uint i=0; i<retStrings.size (); i++)
{ {
Combo.InsertString (-1, utf8ToTStr(retStrings[i])); Combo.InsertString(-1, nlUtf8ToTStr(retStrings[i]));
if (retStrings[i] == tStrToUtf8(tmp)) if (retStrings[i] == NLMISC::tStrToUtf8(tmp))
Combo.SetCurSel (i); Combo.SetCurSel (i);
} }
@ -475,7 +475,7 @@ void CEditListCtrl::editItem (uint item, uint subitem)
string retString; string retString;
bool browse; bool browse;
getMemComboBoxProp (Item, SubItem, retString, browse); getMemComboBoxProp (Item, SubItem, retString, browse);
MemCombo.setRegisterAdress (utf8ToTStr(retString)); MemCombo.setRegisterAdress(nlUtf8ToTStr(retString));
MemCombo.clearCommand (); MemCombo.clearCommand ();
if (browse) if (browse)
MemCombo.addCommand (GEORGES_EDIT_BROWSE_LABEL, CmdBrowse); 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); string pathName = CPath::lookup (filename.c_str (), false, false);
if (pathName.empty ()) if (pathName.empty ())
pathName = filename; pathName = filename;
theApp.OpenDocumentFile (utf8ToTStr(pathName)); theApp.OpenDocumentFile(nlUtf8ToTStr(pathName));
} }
} }
else if (IsWindow (TreeCtrlType) && TreeCtrlDfn.IsWindowVisible ()) else if (IsWindow (TreeCtrlType) && TreeCtrlDfn.IsWindowVisible ())
@ -289,7 +289,7 @@ void CFileBrowserDialog::openDocument ()
string pathName = CPath::lookup (filename.c_str (), false, false); string pathName = CPath::lookup (filename.c_str (), false, false);
if (pathName.empty ()) if (pathName.empty ())
pathName = filename; pathName = filename;
theApp.OpenDocumentFile (utf8ToTStr(pathName)); theApp.OpenDocumentFile(nlUtf8ToTStr(pathName));
} }
} }
else if (TreeCtrlForm.IsWindowVisible ()) else if (TreeCtrlForm.IsWindowVisible ())
@ -299,7 +299,7 @@ void CFileBrowserDialog::openDocument ()
string pathName = CPath::lookup (filename.c_str (), false, false); string pathName = CPath::lookup (filename.c_str (), false, false);
if (pathName.empty ()) if (pathName.empty ())
pathName = filename; pathName = filename;
theApp.OpenDocumentFile (utf8ToTStr(pathName)); theApp.OpenDocumentFile(nlUtf8ToTStr(pathName));
} }
} }
} }

View file

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

View file

@ -51,7 +51,7 @@ public:
bool create( const RECT& rect, CWnd* pParentWnd, UINT nID ); bool create( const RECT& rect, CWnd* pParentWnd, UINT nID );
bool setRootDirectory (const char *dir); bool setRootDirectory (const char *dir);
void setArrangeMode (TArrange arrangeMode); 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 doItemMenu (HWND hwndTreeView, HTREEITEM hItem, LPPOINT pptScreen);
void doClick (HWND hwndTreeView, HTREEITEM hItem); void doClick (HWND hwndTreeView, HTREEITEM hItem);
void addExclusiveExtFilter (const char *ext); 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()); smprintf (filter, 512, "%s Files (%s)|%s|All Files(*.*)|*.*|", typeName+i, ext.c_str(), ext.c_str());
// Open the dialog // 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) if (dlgFile.DoModal () == IDOK)
{ {
combo->Combo.UpdateData (); combo->Combo.UpdateData ();
@ -1316,16 +1316,16 @@ void IFormWidget::updateLabel ()
switch (where) switch (where)
{ {
case UFormElm::ValueForm: case UFormElm::ValueForm:
Label.SetWindowText(utf8ToTStr(SavedLabel + comp)); Label.SetWindowText(nlUtf8ToTStr(SavedLabel + comp));
break; break;
case UFormElm::ValueParentForm: case UFormElm::ValueParentForm:
Label.SetWindowText(utf8ToTStr(SavedLabel + " (in parent form)" + comp)); Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (in parent form)" + comp));
break; break;
case UFormElm::ValueDefaultDfn: case UFormElm::ValueDefaultDfn:
Label.SetWindowText(utf8ToTStr(SavedLabel + " (default DFN value)" + comp)); Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (default DFN value)" + comp));
break; break;
case UFormElm::ValueDefaultType: case UFormElm::ValueDefaultType:
Label.SetWindowText(utf8ToTStr(SavedLabel + " (default TYPE value)" + comp)); Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (default TYPE value)" + comp));
break; break;
} }
} }
@ -1352,18 +1352,18 @@ void IFormWidget::updateLabel ()
if (node->getForm () == doc->getFormPtr ()) if (node->getForm () == doc->getFormPtr ())
{ {
// The node exist // The node exist
Label.SetWindowText (utf8ToTStr(SavedLabel)); Label.SetWindowText(nlUtf8ToTStr(SavedLabel));
} }
else else
{ {
// The node exist in the parent form // The node exist in the parent form
Label.SetWindowText (utf8ToTStr(SavedLabel + " (in parent form)")); Label.SetWindowText(nlUtf8ToTStr(SavedLabel + " (in parent form)"));
} }
} }
else else
{ {
// The node is empty // 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); std::string str2 = CPath::lookup (str, false, false);
if (str2.empty()) if (str2.empty())
str2 = str; 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 // Create the type combo
parent->setStaticSize (currentPos); parent->setStaticSize (currentPos);
Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent); Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label); parent->initWidget (Label);
parent->getNextPosLabel (currentPos); parent->getNextPosLabel (currentPos);
@ -1691,7 +1691,7 @@ void CFormMemCombo::getFromDocument (CForm &form)
if (doc->getRootNode(getSlot ())->getValueByName (result, FormName, UFormElm::NoEval, NULL)) if (doc->getRootNode(getSlot ())->getValueByName (result, FormName, UFormElm::NoEval, NULL))
{ {
Combo.UpdateData (); Combo.UpdateData ();
Combo.SetWindowText (utf8ToTStr(result)); Combo.SetWindowText(nlUtf8ToTStr(result));
Combo.UpdateData (FALSE); Combo.UpdateData (FALSE);
updateLabel (); updateLabel ();
} }
@ -1720,7 +1720,7 @@ void CFormMemCombo::getFromDocument (CForm &form)
CFormElmArray *arrayNode = safe_cast<CFormElmArray*> (node); CFormElmArray *arrayNode = safe_cast<CFormElmArray*> (node);
char label[512]; char label[512];
smprintf (label, 512, "%d", arrayNode->Elements.size ()); smprintf (label, 512, "%d", arrayNode->Elements.size ());
Combo.SetWindowText (utf8ToTStr(label)); Combo.SetWindowText(nlUtf8ToTStr(label));
if (arrayNode->getForm () == &form) if (arrayNode->getForm () == &form)
Label.SetWindowText (_T("Array size:")); Label.SetWindowText (_T("Array size:"));
@ -1751,7 +1751,7 @@ void CFormMemCombo::getFromDocument (CForm &form)
if (node) if (node)
{ {
CFormElmVirtualStruct *virtualNode = safe_cast<CFormElmVirtualStruct*> (node); CFormElmVirtualStruct *virtualNode = safe_cast<CFormElmVirtualStruct*> (node);
Combo.SetWindowText (utf8ToTStr(virtualNode->DfnFilename)); Combo.SetWindowText(nlUtf8ToTStr(virtualNode->DfnFilename));
} }
else else
{ {
@ -1903,7 +1903,7 @@ void CFormCombo::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, ui
// Create the type combo // Create the type combo
parent->setStaticSize (currentPos); parent->setStaticSize (currentPos);
Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent); Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label); parent->initWidget (Label);
parent->getNextPosLabel (currentPos); parent->getNextPosLabel (currentPos);
@ -1921,7 +1921,7 @@ void CFormCombo::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, ui
Combo.InsertString (0, _T("")); Combo.InsertString (0, _T(""));
for (uint predef=0; predef<nodeType->Definitions.size(); predef++) 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 // Create the type combo
parent->setStaticSize (currentPos); parent->setStaticSize (currentPos);
Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent); Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label); parent->initWidget (Label);
parent->getNextPosLabel (currentPos); parent->getNextPosLabel (currentPos);
@ -2262,7 +2262,7 @@ void CColorEdit::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, ui
// Create the type combo // Create the type combo
parent->setStaticSize (currentPos); parent->setStaticSize (currentPos);
Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent); Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label); parent->initWidget (Label);
parent->getNextPosLabel (currentPos); parent->getNextPosLabel (currentPos);
@ -2492,7 +2492,7 @@ void CListWidget::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, u
// Create the type combo // Create the type combo
parent->setStaticSize (currentPos); parent->setStaticSize (currentPos);
Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent); Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label); parent->initWidget (Label);
parent->getNextPosLabel (currentPos); parent->getNextPosLabel (currentPos);
@ -2515,7 +2515,7 @@ void CListWidget::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, u
void CListWidget::addColumn (const char *name) void CListWidget::addColumn (const char *name)
{ {
ListCtrl.insertColumn (0, utf8ToTStr(name)); ListCtrl.insertColumn(0, nlUtf8ToTStr(name));
ListCtrl.recalcColumn (); ListCtrl.recalcColumn ();
} }
@ -2566,7 +2566,7 @@ void CListWidget::getFromDocument (NLGEORGES::CForm &form)
string filename = form.getParentFilename (parent); string filename = form.getParentFilename (parent);
// Insert in the list // Insert in the list
ListCtrl.ListCtrl.InsertItem (parent, utf8ToTStr(filename)); ListCtrl.ListCtrl.InsertItem(parent, nlUtf8ToTStr(filename));
ListCtrl.ListCtrl.UpdateData (FALSE); ListCtrl.ListCtrl.UpdateData (FALSE);
updateLabel (); updateLabel ();
@ -2709,7 +2709,7 @@ void CListWidget::onOpenSelected ()
if (str != "") if (str != "")
{ {
// Look for the file // 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()) if (name.IsEmpty())
name = str; name = str;
@ -2750,7 +2750,7 @@ void CIconWidget::create (DWORD wStyle, RECT &currentPos, CFormDialog *parent, u
// Create the type combo // Create the type combo
parent->setStaticSize (currentPos); parent->setStaticSize (currentPos);
Label.Create (utf8ToTStr(label), WS_VISIBLE, currentPos, parent); Label.Create(nlUtf8ToTStr(label), WS_VISIBLE, currentPos, parent);
parent->initWidget (Label); parent->initWidget (Label);
parent->getNextPosLabel (currentPos); parent->getNextPosLabel (currentPos);

View file

@ -182,8 +182,8 @@ bool CGeorgesEditDocForm::initDocument (const char *dfnName, bool newElement)
// Set file name and title // Set file name and title
std::string name2 = toLower(NLMISC::CFile::getFilenameWithoutExtension(dfnName)); std::string name2 = toLower(NLMISC::CFile::getFilenameWithoutExtension(dfnName));
SetPathName (utf8ToTStr("*." + name2), FALSE); SetPathName(nlUtf8ToTStr("*." + name2), FALSE);
SetTitle (utf8ToTStr("New " + name2 + " form")); SetTitle(nlUtf8ToTStr("New " + name2 + " form"));
// TMp // TMp
if (newElement) if (newElement)
@ -223,7 +223,7 @@ BOOL CGeorgesEditDocForm::OnNewDocument()
string defFilename = theApp.RootSearchPath; string defFilename = theApp.RootSearchPath;
defFilename += "*.dfn"; 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 (dlgFile.DoModal () == IDOK)
{ {
if (initDocument(tStrToUtf8(dlgFile.GetFileName()).c_str(), true)) 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] == ' ') ) 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));
} }
} }
} }

View file

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

View file

@ -579,12 +579,12 @@ void CGeorgesImpl::LoadDocument( const std::string& _sxfullname )
AFX_MANAGE_STATE(AfxGetStaticModuleState()); AFX_MANAGE_STATE(AfxGetStaticModuleState());
try try
{ {
theApp.OpenDocumentFile(utf8ToTStr(_sxfullname)); theApp.OpenDocumentFile(nlUtf8ToTStr(_sxfullname));
} }
catch (const NLMISC::Exception &e) catch (const NLMISC::Exception &e)
{ {
std::string tmp = std::string(e.what()) + "(" + _sxfullname + ")"; 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); ComboState.Create (WS_VISIBLE|CBS_DROPDOWNLIST|WS_TABSTOP, pos, this, CbState);
uint item; uint item;
for (item=0; item<CFileHeader::StateCount; 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); ComboState.SetCurSel (0);
initWidget (ComboState); initWidget (ComboState);
getNextPos (currentPos); getNextPos (currentPos);

View file

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

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

View file

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

View file

@ -59,7 +59,7 @@ public:
bool isWnd (const CWnd *wnd) const; bool isWnd (const CWnd *wnd) const;
void enableAutoCompleteExtension (bool enable, const char * ext); void enableAutoCompleteExtension (bool enable, const char * ext);
std::tstring RegisterAdress; NLMISC::tstring RegisterAdress;
int MemoryCount; int MemoryCount;
UINT Id; 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); int index = edit->LineIndex(edit->GetLineCount( )-1) + edit->LineLength(edit->GetLineCount( )-1);
edit->SetSel (index, index); edit->SetSel (index, index);
edit->ReplaceSel (utf8ToTStr(message)); edit->ReplaceSel(nlUtf8ToTStr(message));
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -421,8 +421,8 @@ BOOL CPageBgFlags::OnInitDialog()
const NLSOUND::UAudioMixer::TBackgroundFlags &flag = SoundDialog->getSoundPlugin()->getMixer()->getBackgroundFlags(); const NLSOUND::UAudioMixer::TBackgroundFlags &flag = SoundDialog->getSoundPlugin()->getMixer()->getBackgroundFlags();
for (uint i=0; i<32; ++i) for (uint i=0; i<32; ++i)
{ {
GetDlgItem(FILTER_EDIT_NAME[i])->SetWindowText(SoundDialog->EnvNames[i].Name.c_str()); GetDlgItem(FILTER_EDIT_NAME[i])->SetWindowText(nlUtf8ToTStr(SoundDialog->EnvNames[i].Name));
GetDlgItem(FILTER_SIM_NAME[i])->SetWindowText(SoundDialog->EnvNames[i].ShortName.c_str()); GetDlgItem(FILTER_SIM_NAME[i])->SetWindowText(nlUtf8ToTStr(SoundDialog->EnvNames[i].ShortName));
static_cast<CButton*>(GetDlgItem(FILTER_SIM[i]))->SetCheck(flag.Flags[i] ? 1 : 0); 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()) if (EDIT_ARG_IDX.find(id) != EDIT_ARG_IDX.end())
{ {
// need to update the var. // need to update the var.
char tmp[1024]; TCHAR tmp[1024];
GetDlgItem(id)->GetWindowText(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) catch (const std::exception &e)
{ {
string reason = e.what(); MessageBox (NULL, nlUtf8ToTStr(e.what()), _T("Sound plugin"), MB_OK);
MessageBox (NULL, reason.c_str(), "Sound plugin", MB_OK);
return NULL; return NULL;
} }
} }
else 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; return NULL;
} }

View file

@ -68,7 +68,7 @@ bool CListenerView::registerClass()
} }
catch (CResourceException* e) catch (CResourceException* e)
{ {
AfxMessageBox("Couldn't register class! (Already registered?)"); AfxMessageBox(_T("Couldn't register class! (Already registered?)"));
e->Delete(); e->Delete();
return false; return false;
} }
@ -80,7 +80,7 @@ bool CListenerView::registerClass()
_VolumeCurve.CreatePen(PS_SOLID, 1, RGB(255, 0, 128)); _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, _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; return true;
} }
@ -99,7 +99,7 @@ void CListenerView::init(CSoundPlugin* plugin, CRect& rect, CWnd* parent)
_OuterAngle = 360; _OuterAngle = 360;
_InnerAngle = 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"); throw exception("failed to create the listener view");
} }

View file

@ -239,7 +239,7 @@ void CSoundDialog::displayTime(uint32 msec)
uint min = sec / 60; uint min = sec / 60;
sec -= min * 60; sec -= min * 60;
_snprintf(s, 256, "%02d:%02d", min, sec); _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(); CPageBase::docChanged();
SetWindowText(_Name.c_str()); SetWindowText(nlUtf8ToTStr(_Name));
char s[256]; char s[256];
/* if (_Filename.empty()) /* if (_Filename.empty())
@ -342,7 +342,7 @@ void CSoundDialog::updateInfo()
msec -= sec * 1000; msec -= sec * 1000;
sec -= min * 60; sec -= min * 60;
_snprintf(s, 256, "%02d:%02d.%03d", min, sec, msec); _snprintf(s, 256, "%02d:%02d.%03d", min, sec, msec);
GetDlgItem(IDC_DURATION)->SetWindowText(s); GetDlgItem(IDC_DURATION)->SetWindowText(nlUtf8ToTStr(s));
updateButton(); updateButton();
} }
@ -361,7 +361,7 @@ bool CSoundDialog::getFileInfo(string& filename, uint& sampleRate, uint& sampleS
} }
// Open the file // 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) if (hmmio == NULL)
{ {
return false; return false;
@ -484,7 +484,7 @@ void CSoundDialog::OnControlPlayback()
if (str == "*.sound") 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; return;
} }
} }

View file

@ -362,7 +362,7 @@ void CSoundPlugin::setActiveDocument(IEditDocument *pdoc)
if (invalid && !_InvalidSound) 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) // 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"; 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() void CSoundPlugin::createNew()
{ {
AFX_MANAGE_STATE(AfxGetStaticModuleState()); AFX_MANAGE_STATE(AfxGetStaticModuleState());
char BASED_CODE szFilter[] = "Sound (*.sound)|*.sound|All Files (*.*)|*.*||"; TCHAR BASED_CODE szFilter[] = _T("Sound (*.sound)|*.sound|All Files (*.*)|*.*||");
CFileDialog fileDlg(FALSE, ".sound", "*.sound", OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); CFileDialog fileDlg(FALSE, _T(".sound"), _T("*.sound"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter);
if (fileDlg.DoModal() == IDOK) if (fileDlg.DoModal() == IDOK)
{ {
string filename = (const char*) fileDlg.GetPathName(); string filename = NLMISC::tStrToUtf8(fileDlg.GetPathName());
_GlobalInterface->createDocument("sound.dfn", filename.c_str()); _GlobalInterface->createDocument("sound.dfn", filename.c_str());
} }
} }
@ -585,8 +585,7 @@ void CSoundPlugin::play(std::string &filename)
} }
catch (ESoundDriver& e) catch (ESoundDriver& e)
{ {
string reason = e.what(); MessageBox(NULL, nlUtf8ToTStr(e.what()), _T("Sound plugin"), MB_OK);
MessageBox (NULL, reason.c_str(), "Sound plugin", MB_OK);
} }
} }