mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 01:09:50 +00:00
Fixed: Compilation of World Editor in Unicode
--HG-- branch : develop
This commit is contained in:
parent
94bf8fd54e
commit
fe72e1c8d3
22 changed files with 288 additions and 396 deletions
|
@ -233,7 +233,7 @@ bool CActionLigoResize::redo ()
|
|||
// CActionImportPrimitive
|
||||
// ***************************************************************************
|
||||
|
||||
CActionImportPrimitive::CActionImportPrimitive (const char *oldPrimFile)
|
||||
CActionImportPrimitive::CActionImportPrimitive (const std::string &oldPrimFile)
|
||||
{
|
||||
_Filename = oldPrimFile;
|
||||
_FirstLoad = true;
|
||||
|
@ -549,7 +549,7 @@ bool CActionImportPrimitive::redo ()
|
|||
// CActionLoadPrimitive
|
||||
// ***************************************************************************
|
||||
|
||||
CActionLoadPrimitive::CActionLoadPrimitive (const char *oldPrimFile)
|
||||
CActionLoadPrimitive::CActionLoadPrimitive(const std::string &oldPrimFile)
|
||||
{
|
||||
_Filename = oldPrimFile;
|
||||
_FirstLoad = true;
|
||||
|
@ -2156,7 +2156,7 @@ bool CActionDelete::redo ()
|
|||
// CActionSetPrimitivePropertyString
|
||||
// ***************************************************************************
|
||||
|
||||
CActionSetPrimitivePropertyString::CActionSetPrimitivePropertyString (const CDatabaseLocatorPointer &locator, const char *propertyName, const char *newValue, bool _default)
|
||||
CActionSetPrimitivePropertyString::CActionSetPrimitivePropertyString(const CDatabaseLocatorPointer &locator, const std::string &propertyName, const std::string &newValue, bool _default)
|
||||
{
|
||||
_PropertyName = propertyName;
|
||||
_PropertyNewValue = newValue;
|
||||
|
@ -2238,7 +2238,7 @@ bool CActionSetPrimitivePropertyString::redo ()
|
|||
// CActionSetPrimitivePropertyStringArray
|
||||
// ***************************************************************************
|
||||
|
||||
CActionSetPrimitivePropertyStringArray::CActionSetPrimitivePropertyStringArray (const CDatabaseLocatorPointer &locator, const char *propertyName, const std::vector<std::string> &newValue, bool _default)
|
||||
CActionSetPrimitivePropertyStringArray::CActionSetPrimitivePropertyStringArray (const CDatabaseLocatorPointer &locator, const std::string &propertyName, const std::vector<std::string> &newValue, bool _default)
|
||||
{
|
||||
_PropertyName = propertyName;
|
||||
_PropertyNewValue = newValue;
|
||||
|
@ -2312,7 +2312,7 @@ bool CActionSetPrimitivePropertyStringArray::redo ()
|
|||
// CActionAddPrimitiveByClass
|
||||
// ***************************************************************************
|
||||
|
||||
CActionAddPrimitiveByClass::CActionAddPrimitiveByClass (const CDatabaseLocator &locator, const char *className,
|
||||
CActionAddPrimitiveByClass::CActionAddPrimitiveByClass (const CDatabaseLocator &locator, const std::string &className,
|
||||
const NLMISC::CVector &initPos, float deltaPos,
|
||||
const std::vector<CPrimitiveClass::CInitParameters> initParameters)
|
||||
{
|
||||
|
@ -2424,7 +2424,7 @@ bool CActionAddPrimitiveByClass::redo ()
|
|||
// CActionAddLandscape
|
||||
// ***************************************************************************
|
||||
|
||||
CActionAddLandscape::CActionAddLandscape (const char *filename)
|
||||
CActionAddLandscape::CActionAddLandscape (const std::string &filename)
|
||||
{
|
||||
_FirstTime = true;
|
||||
_Filename = filename;
|
||||
|
@ -2469,7 +2469,7 @@ bool CActionAddLandscape::redo ()
|
|||
if (_FirstTime)
|
||||
{
|
||||
// Load the file
|
||||
getMainFrame ()->launchLoadingDialog (string("loading land ") + _Filename);
|
||||
getMainFrame ()->launchLoadingDialog ("loading land " + _Filename);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ class CActionAddLandscape : public IAction
|
|||
{
|
||||
public:
|
||||
// Landscape name
|
||||
CActionAddLandscape (const char *name);
|
||||
CActionAddLandscape (const std::string &name);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -150,7 +150,7 @@ class CActionImportPrimitive : public IAction
|
|||
public:
|
||||
|
||||
// Constructor
|
||||
CActionImportPrimitive (const char *oldPrimFile);
|
||||
CActionImportPrimitive (const std::string &oldPrimFile);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -169,7 +169,7 @@ class CActionLoadPrimitive : public IAction
|
|||
public:
|
||||
|
||||
// Constructor
|
||||
CActionLoadPrimitive (const char *oldPrimFile);
|
||||
CActionLoadPrimitive (const std::string &oldPrimFile);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -622,7 +622,7 @@ class CActionAddPrimitiveByClass : public IAction
|
|||
public:
|
||||
|
||||
// Constructor
|
||||
CActionAddPrimitiveByClass (const CDatabaseLocator &locator, const char *className, const NLMISC::CVector &initPos, float deltaPos,
|
||||
CActionAddPrimitiveByClass (const CDatabaseLocator &locator, const std::string &className, const NLMISC::CVector &initPos, float deltaPos,
|
||||
const std::vector<NLLIGO::CPrimitiveClass::CInitParameters> initParameters);
|
||||
|
||||
private:
|
||||
|
|
|
@ -698,7 +698,7 @@ uint32 CBuilderZone::countZones ()
|
|||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
void CBuilderZone::snapshot (const char *fileName, uint sizeSource, bool grayscale)
|
||||
void CBuilderZone::snapshot (const std::string &fileName, uint sizeSource, bool grayscale)
|
||||
{
|
||||
const CZoneRegion *pBZR = &(getDocument ()->getZoneRegion (_ZoneRegionSelected));
|
||||
sint32 nMinX = pBZR->getMinX();
|
||||
|
@ -712,7 +712,7 @@ void CBuilderZone::snapshot (const char *fileName, uint sizeSource, bool graysca
|
|||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
void CBuilderZone::snapshotCustom (const char *fileName, uint width, uint height, bool keepRatio, uint sizeSource, bool grayscale)
|
||||
void CBuilderZone::snapshotCustom (const std::string &fileName, uint width, uint height, bool keepRatio, uint sizeSource, bool grayscale)
|
||||
{
|
||||
if (_ZoneRegions.size() == 0)
|
||||
return;
|
||||
|
|
|
@ -176,8 +176,8 @@ public:
|
|||
void unload (uint32 i);
|
||||
void move (sint32 x, sint32 y);
|
||||
uint32 countZones ();
|
||||
void snapshot (const char *fileName, uint sizeSource, bool grayscale);
|
||||
void snapshotCustom (const char *fileName, uint width, uint height, bool keepRatio, uint sizeSource, bool grayscale);
|
||||
void snapshot (const std::string &fileName, uint sizeSource, bool grayscale);
|
||||
void snapshotCustom(const std::string &fileName, uint width, uint height, bool keepRatio, uint sizeSource, bool grayscale);
|
||||
|
||||
void add (const NLMISC::CVector &worldPos);
|
||||
void addTransition (const NLMISC::CVector &worldPos);
|
||||
|
|
|
@ -915,11 +915,11 @@ bool CDialogProperties::CWidget::fromParameter (const IProperty *property, const
|
|||
updateBoolean ();
|
||||
break;
|
||||
case CPrimitiveClass::CParameter::ConstString:
|
||||
if (Parameter.Editable || ComboBox.SelectString(-1 ,propString->String.c_str ()) == CB_ERR)
|
||||
if (Parameter.Editable || ComboBox.SelectString(-1, utf8ToTStr(propString->String)) == CB_ERR)
|
||||
{
|
||||
ComboBox.SetWindowText(propString->String.c_str ());
|
||||
ComboBox.InsertString( -1, propString->String.c_str());
|
||||
ComboBox.SelectString(-1 ,propString->String.c_str ());
|
||||
ComboBox.SetWindowText(utf8ToTStr(propString->String));
|
||||
ComboBox.InsertString( -1, utf8ToTStr(propString->String));
|
||||
ComboBox.SelectString(-1, utf8ToTStr(propString->String));
|
||||
}
|
||||
OriginalString = propString->String.c_str();
|
||||
updateCombo ();
|
||||
|
@ -953,7 +953,7 @@ bool CDialogProperties::CWidget::fromParameter (const IProperty *property, const
|
|||
updateBoolean ();
|
||||
break;
|
||||
case CPrimitiveClass::CParameter::ConstString:
|
||||
ComboBox.SelectString(-1 ,result.c_str ());
|
||||
ComboBox.SelectString(-1, utf8ToTStr(result));
|
||||
OriginalString = result.c_str();
|
||||
updateCombo ();
|
||||
break;
|
||||
|
@ -1159,18 +1159,14 @@ void CDialogProperties::CWidget::getValue (std::string &result) const
|
|||
else if (Parameter.Type == CPrimitiveClass::CParameter::ConstString)
|
||||
{
|
||||
// Get the text
|
||||
CString str;
|
||||
getWindowTextUTF8 (ComboBox, str);
|
||||
result = (const char*)str;
|
||||
getWindowTextUTF8 (ComboBox, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
nlassert (Parameter.Type == CPrimitiveClass::CParameter::String);
|
||||
|
||||
// Get the text
|
||||
CString str;
|
||||
getWindowTextUTF8 (EditBox, str);
|
||||
result = (const char*)str;
|
||||
getWindowTextUTF8 (EditBox, result);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1183,29 +1179,23 @@ void CDialogProperties::CWidget::getValue (std::vector<std::string> &result) con
|
|||
|
||||
// Get the string
|
||||
result.clear ();
|
||||
CString str;
|
||||
if (Parameter.Type == CPrimitiveClass::CParameter::StringArray)
|
||||
{
|
||||
getWindowTextUTF8 (MultiLineEditBox, str);
|
||||
std::string temp;
|
||||
getWindowTextUTF8 (MultiLineEditBox, temp);
|
||||
// MultiLineEditBox.UnloadText(str);
|
||||
const char *strP = str;
|
||||
string dst;
|
||||
while (*strP)
|
||||
|
||||
// remove \r
|
||||
temp = removeSlashR(temp);
|
||||
|
||||
// append each line to result
|
||||
explode(temp, std::string("\n"), result);
|
||||
|
||||
// remove the last line if empty
|
||||
if (!result.empty() && result.back().empty())
|
||||
{
|
||||
// New line ?
|
||||
if (*strP == '\n')
|
||||
{
|
||||
result.push_back (dst);
|
||||
dst.clear();
|
||||
}
|
||||
else if (*strP != '\r')
|
||||
{
|
||||
dst += *strP;
|
||||
}
|
||||
strP++;
|
||||
result.resize(result.size() - 1);
|
||||
}
|
||||
if (!dst.empty())
|
||||
result.push_back (dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1216,7 +1206,7 @@ void CDialogProperties::CWidget::getValue (std::vector<std::string> &result) con
|
|||
{
|
||||
CString str;
|
||||
ListEditBox.GetText( i, str);
|
||||
result[i] = (const char*)str;
|
||||
result[i] = tStrToUtf8(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1292,7 +1282,7 @@ void CDialogProperties::CWidget::updateCombo ()
|
|||
DialogProperties->setDefaultValue (this, value);
|
||||
if (value != "")
|
||||
{
|
||||
int index = ComboBox.FindString (-1, value.c_str());
|
||||
int index = ComboBox.FindString (-1, utf8ToTStr(value));
|
||||
if (index != CB_ERR)
|
||||
ComboBox.SetCurSel (index);
|
||||
}
|
||||
|
@ -1370,9 +1360,9 @@ bool CDialogProperties::isModified()
|
|||
// special case for editable combo box
|
||||
if ((*iteWid).Parameter.Type == CPrimitiveClass::CParameter::ConstString)
|
||||
{
|
||||
CString text;
|
||||
std::string text;
|
||||
getWindowTextUTF8 ((*iteWid).ComboBox, text);
|
||||
if ((*iteWid).OriginalString.c_str() != text)
|
||||
if ((*iteWid).OriginalString != text)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -1631,17 +1621,22 @@ BOOL CDialogProperties::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||
/* todo hulud remove
|
||||
CString oldValue;
|
||||
widget->EditBox.GetWindowText (oldValue);*/
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("default"), TRUE, widget->Parameter.FileExtension.c_str (), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("default"), TRUE, utf8ToTStr(widget->Parameter.FileExtension), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
|
||||
utf8ToTStr(widget->Parameter.FileExtension+" (*."+widget->Parameter.FileExtension+")|*."+widget->Parameter.FileExtension+"|All Files (*.*)|*.*||"), getMainFrame ());
|
||||
if (widget->Parameter.Folder != "")
|
||||
|
||||
TCHAR temp[MAX_PATH];
|
||||
|
||||
if (!widget->Parameter.Folder.empty())
|
||||
{
|
||||
dialog.m_ofn.lpstrInitialDir = widget->Parameter.Folder.c_str();
|
||||
_tcscpy_s(temp, MAX_PATH, utf8ToTStr(widget->Parameter.Folder));
|
||||
dialog.m_ofn.lpstrInitialDir = temp;
|
||||
}
|
||||
|
||||
if (dialog.DoModal() == IDOK)
|
||||
{
|
||||
CString str;
|
||||
str = dialog.GetFileTitle();
|
||||
setWindowTextUTF8 (widget->EditBox, str);
|
||||
setWindowTextUTF8 (widget->EditBox, tStrToUtf8(str));
|
||||
|
||||
/* todo hulud remove
|
||||
if ((const char*)oldValue != str)
|
||||
|
@ -1708,15 +1703,15 @@ BOOL CDialogProperties::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||
if (!filename.empty ())
|
||||
{
|
||||
// Open the file
|
||||
if (!openFile (filename.c_str ()))
|
||||
if (!openDoc (filename))
|
||||
// Error
|
||||
theApp.errorMessage ("Can't open the file %s", filename.c_str ());
|
||||
theApp.errorMessage ("Can't open the file %s", filename.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Error
|
||||
widget->getFilename (filename);
|
||||
theApp.errorMessage ("Can't find the file %s", filename.c_str ());
|
||||
theApp.errorMessage ("Can't find the file %s", filename.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1772,9 +1767,9 @@ BOOL CDialogProperties::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||
widget->EditBox.GetWindowText (oldValue);*/
|
||||
|
||||
// String NULL ?
|
||||
CString text;
|
||||
std::string text;
|
||||
getWindowTextUTF8 (widget->EditBox, text);
|
||||
widget->Default = (text == "");
|
||||
widget->Default = text.empty();
|
||||
|
||||
// Default ?
|
||||
if (widget->Default)
|
||||
|
|
|
@ -318,7 +318,7 @@ void CDisplay::init (CMainFrame *pMF)
|
|||
}
|
||||
}
|
||||
|
||||
SetCurrentDirectory (pMF->_ExeDir.c_str());
|
||||
SetCurrentDirectory (utf8ToTStr(pMF->_ExeDir));
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -3554,7 +3554,7 @@ void CDisplay::DrawCollisionTexture(sint32 count, float x1, float y1)
|
|||
string dir = getDocument ()->getDataDir ();
|
||||
if (dir.empty()) dir = _MainFrame->_ExeDir;
|
||||
dir += "\\collisionmap\\";
|
||||
SetCurrentDirectory (dir.c_str());
|
||||
SetCurrentDirectory (utf8ToTStr(dir));
|
||||
|
||||
if(NLMISC::CFile::fileExists(Name+".tga") || NLMISC::CFile::fileExists(Name+".png"))
|
||||
{
|
||||
|
|
|
@ -886,7 +886,7 @@ CPrimBitmap::CPrimBitmap ()
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CPrimBitmap::init (const char *filename)
|
||||
void CPrimBitmap::init (const std::string &filename)
|
||||
{
|
||||
// Set the name
|
||||
removePropertyByName ("filename");
|
||||
|
@ -926,12 +926,12 @@ NL3D::CTextureBlank *CPrimBitmap::getTexture () const
|
|||
}
|
||||
else
|
||||
{
|
||||
theApp.errorMessage ("Can't read bitmap %s", filename.c_str ());
|
||||
theApp.errorMessage ("Can't read bitmap %s", filename.c_str());
|
||||
}
|
||||
}
|
||||
catch (const Exception &e)
|
||||
{
|
||||
theApp.errorMessage ("Error reading bitmap %s : %s", filename.c_str (), e.what ());
|
||||
theApp.errorMessage ("Error reading bitmap %s : %s", filename.c_str(), e.what ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -452,7 +452,7 @@ public:
|
|||
CPrimBitmap ();
|
||||
|
||||
// Init
|
||||
void init (const char *filename);
|
||||
void init (const std::string &filename);
|
||||
|
||||
// \name From IClassable
|
||||
NLMISC_DECLARE_CLASS (CPrimBitmap)
|
||||
|
|
|
@ -569,12 +569,10 @@ void CMainFrame::stopPositionControl(IPluginCallback *plugin)
|
|||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CMainFrame::setExeDir (const char* str)
|
||||
void CMainFrame::setExeDir (const std::string &str)
|
||||
{
|
||||
// AFX_MANAGE_STATE (AfxGetStaticModuleState());
|
||||
_ExeDir = str;
|
||||
if ((str[strlen(str)-1] != '\\') || (str[strlen(str)-1] != '/'))
|
||||
_ExeDir += "\\";
|
||||
_ExeDir = CPath::standardizePath(str);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -761,11 +759,11 @@ void CMainFrame::displayStatusBarInfo ()
|
|||
string text;
|
||||
if (dispWnd->getActionHelp (text))
|
||||
{
|
||||
m_wndStatusBar.SetPaneText (0, text.c_str());
|
||||
m_wndStatusBar.SetPaneText (0, utf8ToTStr(text));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_wndStatusBar.SetPaneText (0, sTmp.c_str());
|
||||
m_wndStatusBar.SetPaneText (0, utf8ToTStr(sTmp));
|
||||
}
|
||||
//for (uint32 i = sTmp.size(); i < 10; ++i)
|
||||
// sTmp += " ";
|
||||
|
@ -773,12 +771,12 @@ void CMainFrame::displayStatusBarInfo ()
|
|||
// Write zone reference name
|
||||
if (dispWnd->getActionText (text))
|
||||
{
|
||||
m_wndStatusBar.SetPaneText (1, text.c_str());
|
||||
m_wndStatusBar.SetPaneText (1, utf8ToTStr(text));
|
||||
}
|
||||
else
|
||||
{
|
||||
sTmp = _ZoneBuilder->getZoneName (x, y);
|
||||
m_wndStatusBar.SetPaneText (1, sTmp.c_str());
|
||||
m_wndStatusBar.SetPaneText (1, utf8ToTStr(sTmp));
|
||||
}
|
||||
|
||||
// Write coordinates
|
||||
|
@ -786,15 +784,15 @@ void CMainFrame::displayStatusBarInfo ()
|
|||
sprintf(temp, "(%.3f , %.3f)", v.x, v.y);
|
||||
sTmp = temp;
|
||||
// sTmp = "( " + toString(v.x) + " , " + toString(v.y) + " )";
|
||||
m_wndStatusBar.SetPaneText (2, sTmp.c_str());
|
||||
m_wndStatusBar.SetPaneText (2, utf8ToTStr(sTmp));
|
||||
|
||||
// Write rot
|
||||
sTmp = "Rot(" + toString(_ZoneBuilder->getRot(x, y)) + ")";
|
||||
m_wndStatusBar.SetPaneText (3, sTmp.c_str());
|
||||
m_wndStatusBar.SetPaneText (3, utf8ToTStr(sTmp));
|
||||
|
||||
// Write flip
|
||||
sTmp = "Flip(" + toString(_ZoneBuilder->getFlip(x, y)) + ")";
|
||||
m_wndStatusBar.SetPaneText (4, sTmp.c_str());
|
||||
m_wndStatusBar.SetPaneText (4, utf8ToTStr(sTmp));
|
||||
|
||||
// Write selection
|
||||
if (Selection.size ())
|
||||
|
@ -806,7 +804,7 @@ void CMainFrame::displayStatusBarInfo ()
|
|||
}
|
||||
else
|
||||
sTmp = "No selected primitive";
|
||||
m_wndStatusBar.SetPaneText (5, sTmp.c_str());
|
||||
m_wndStatusBar.SetPaneText (5, utf8ToTStr(sTmp));
|
||||
|
||||
// Write path of selected primitive
|
||||
if (Selection.size())
|
||||
|
@ -814,14 +812,14 @@ void CMainFrame::displayStatusBarInfo ()
|
|||
else
|
||||
sTmp.clear();
|
||||
|
||||
m_wndStatusBar.SetPaneText (6, sTmp.c_str());
|
||||
m_wndStatusBar.SetPaneText (6, utf8ToTStr(sTmp));
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void CMainFrame::displayInfo (const char *info)
|
||||
void CMainFrame::displayInfo (const std::string &info)
|
||||
{
|
||||
m_wndStatusBar.SetPaneText (6, info);
|
||||
m_wndStatusBar.SetPaneText (6, utf8ToTStr(info));
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -860,7 +858,7 @@ void CMainFrame::uninit ()
|
|||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
MessageBox (e.what(), "Warning");
|
||||
MessageBox (utf8ToTStr(e.what()), _T("Warning"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -871,10 +869,10 @@ void CMainFrame::uninit ()
|
|||
// ***************************************************************************
|
||||
void CMainFrame::onMenuFileOpenLogic ()
|
||||
{
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, "prim", TRUE, "prim", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Primitives Files (*.prim)|*.prim||", this);
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("prim"), TRUE, _T("prim"), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, _T("Primitives Files (*.prim)|*.prim||"), this);
|
||||
if (dialog.DoModal() == IDOK)
|
||||
{
|
||||
launchLoadingDialog(string("loading prim zone ") + (LPCSTR)dialog.GetFileName());
|
||||
launchLoadingDialog(string("loading prim zone ") + tStrToUtf8(dialog.GetFileName()));
|
||||
// todo primitive load
|
||||
primZoneModified ();
|
||||
terminateLoadingDialog();
|
||||
|
@ -1453,7 +1451,7 @@ struct CViewerConfig
|
|||
|
||||
if(f==NULL)
|
||||
{
|
||||
fprintf(stderr,"can't open file '%s'\n",configFileName);
|
||||
fprintf(stderr,"can't open file '%s'\n",configFileName.c_str());
|
||||
}
|
||||
|
||||
fprintf(f,"FullScreen = %d;\n",this->Windowed?0:1);
|
||||
|
@ -1495,17 +1493,17 @@ struct CViewerConfig
|
|||
fprintf(f,"Zones = {\n");
|
||||
for (i = 0; i < Zones.size(); ++i)
|
||||
if (i < (Zones.size()-1))
|
||||
fprintf(f,"\"%s\",\n", Zones[i]);
|
||||
fprintf(f,"\"%s\",\n", Zones[i].c_str());
|
||||
else
|
||||
fprintf(f,"\"%s\"\n", Zones[i]);
|
||||
fprintf(f,"\"%s\"\n", Zones[i].c_str());
|
||||
fprintf(f,"};\n");
|
||||
|
||||
fprintf(f,"Ig = {\n");
|
||||
for (i = 0; i < Igs.size(); ++i)
|
||||
if (i < (Igs.size()-1))
|
||||
fprintf(f,"\"%s\",\n", Igs[i]);
|
||||
fprintf(f,"\"%s\",\n", Igs[i].c_str());
|
||||
else
|
||||
fprintf(f,"\"%s\"\n", Igs[i]);
|
||||
fprintf(f,"\"%s\"\n", Igs[i].c_str());
|
||||
fprintf(f,"};\n");
|
||||
|
||||
fclose(f);
|
||||
|
@ -1618,12 +1616,12 @@ void CMainFrame::viewLand(bool withIgs)
|
|||
|
||||
void CMainFrame::onProjectAddlandscape()
|
||||
{
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, "land", TRUE, "land", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "NeL Ligo Landscape Files (*.land)|*.land|All Files (*.*)|*.*||", this);
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("land"), TRUE, _T("land"), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, _T("NeL Ligo Landscape Files (*.land)|*.land|All Files (*.*)|*.*||"), this);
|
||||
if (dialog.DoModal() == IDOK)
|
||||
{
|
||||
// Add the landscape in the project
|
||||
getDocument ()->beginModification ();
|
||||
getDocument ()->addModification (new CActionAddLandscape (dialog.GetPathName()));
|
||||
getDocument ()->addModification (new CActionAddLandscape (tStrToUtf8(dialog.GetPathName())));
|
||||
getDocument ()->endModification ();
|
||||
|
||||
// Update data
|
||||
|
@ -1633,7 +1631,7 @@ void CMainFrame::onProjectAddlandscape()
|
|||
if (getDocument()->getDataDir() != "")
|
||||
return;
|
||||
|
||||
string path = dialog.GetPathName();
|
||||
string path = tStrToUtf8(dialog.GetPathName());
|
||||
|
||||
uint pos = path.rfind("\\");
|
||||
if (pos == string::npos)
|
||||
|
@ -1750,9 +1748,9 @@ void CMainFrame::onProjectSettings()
|
|||
|
||||
// Get the new data path
|
||||
std::string oldDataDir = standardizePath (getDocument ()->getDataDir ().c_str ());
|
||||
std::string newDataDir = standardizePath (projectSettings.DataDirectory);
|
||||
std::string newDataDir = standardizePath (tStrToUtf8(projectSettings.DataDirectory));
|
||||
initLandscape |= (oldDataDir != newDataDir);
|
||||
getDocument ()->setDataDir (projectSettings.DataDirectory);
|
||||
getDocument ()->setDataDir (tStrToUtf8(projectSettings.DataDirectory));
|
||||
|
||||
// Init the landscape
|
||||
if (initLandscape)
|
||||
|
@ -1802,12 +1800,12 @@ void CMainFrame::OnUpdateEditLogic(CCmdUI* pCmdUI)
|
|||
|
||||
void CMainFrame::OnProjectImportPrim()
|
||||
{
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, "prim", TRUE, "prim", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Old NeL Ligo Prim Files (*.prim)|*.prim|All Files (*.*)|*.*||", this);
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("prim"), TRUE, _T("prim"), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, _T("Old NeL Ligo Prim Files (*.prim)|*.prim|All Files (*.*)|*.*||"), this);
|
||||
if (dialog.DoModal() == IDOK)
|
||||
{
|
||||
// Add the landscape in the project
|
||||
getDocument ()->beginModification ();
|
||||
getDocument ()->addModification (new CActionImportPrimitive (dialog.GetPathName()));
|
||||
getDocument ()->addModification (new CActionImportPrimitive (tStrToUtf8(dialog.GetPathName())));
|
||||
getDocument ()->endModification ();
|
||||
|
||||
// Update data
|
||||
|
@ -1819,8 +1817,8 @@ void CMainFrame::OnProjectImportPrim()
|
|||
|
||||
void CMainFrame::OnProjectAddPrimitive()
|
||||
{
|
||||
static char buffer[32000];
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, "primitive", TRUE, "primitive", NULL, OFN_ALLOWMULTISELECT|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "NeL Ligo Primitive Files (*.primitive)|*.primitive|All Files (*.*)|*.*||", this);
|
||||
static TCHAR buffer[32000];
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("primitive"), TRUE, _T("primitive"), NULL, OFN_ALLOWMULTISELECT|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, _T("NeL Ligo Primitive Files (*.primitive)|*.primitive|All Files (*.*)|*.*||"), this);
|
||||
// increase result buffer size (for multi select)
|
||||
memset(buffer, 0, 32000);
|
||||
dialog.m_ofn.lpstrFile = buffer;
|
||||
|
@ -1835,7 +1833,7 @@ void CMainFrame::OnProjectAddPrimitive()
|
|||
|
||||
while (pos!=NULL)
|
||||
{
|
||||
string path = dialog.GetNextPathName(pos);
|
||||
string path = tStrToUtf8(dialog.GetNextPathName(pos));
|
||||
if (!getDocument()->isPrimitiveLoaded(path))
|
||||
getDocument ()->addModification (new CActionLoadPrimitive (path.c_str()));
|
||||
else
|
||||
|
@ -2209,7 +2207,7 @@ void CMainFrame::setTransformMode (TTransformMode mode)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CMainFrame::deletePrimitive (bool subDelete, const char *actionName)
|
||||
void CMainFrame::deletePrimitive (bool subDelete, const std::string &actionName)
|
||||
{
|
||||
list<NLLIGO::IPrimitive*> oldSelection;
|
||||
|
||||
|
@ -2629,7 +2627,7 @@ void CMainFrame::OnOpenFile (UINT nID)
|
|||
nlassert (nID<files.size ());
|
||||
|
||||
// Open the file
|
||||
if (!openFile (files[nID].c_str ()))
|
||||
if (!openDoc (files[nID]))
|
||||
theApp.errorMessage ("Can't open the file %s", files[nID].c_str ());
|
||||
}
|
||||
|
||||
|
@ -2647,14 +2645,14 @@ void CMainFrame::createContextMenu (CWnd *parent, const CPoint &point, bool tran
|
|||
if (_Mode == 1)
|
||||
{
|
||||
// Add commands
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_SELECT, "&Select\tF5");
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_TRANSLATE, "&Move\tF6");
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_ROTATE, "&Rotate\tF7");
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_TURN, "&Turn\tF8");
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_SCALE, "&Scale\tF9");
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_RADIUS, "&Radius\tF10");
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_SELECT, _T("&Select\tF5"));
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_TRANSLATE, _T("&Move\tF6"));
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_ROTATE, _T("&Rotate\tF7"));
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_TURN, _T("&Turn\tF8"));
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_SCALE, _T("&Scale\tF9"));
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_RADIUS, _T("&Radius\tF10"));
|
||||
if (isSelectionLocked ())
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_ADD_POINT, "&Add points\tF11");
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_ADD_POINT, _T("&Add points\tF11"));
|
||||
|
||||
// Check the good one
|
||||
pMenu->CheckMenuRadioItem (ID_EDIT_SELECT, isSelectionLocked ()?ID_EDIT_ADD_POINT:ID_EDIT_SCALE, ID_EDIT_SELECT+getTransformMode (),
|
||||
|
@ -2666,35 +2664,35 @@ void CMainFrame::createContextMenu (CWnd *parent, const CPoint &point, bool tran
|
|||
}
|
||||
|
||||
// Always a delete menu
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_DELETE, "&Delete\tDel");
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_DELETE, _T("&Delete\tDel"));
|
||||
|
||||
// Add properties menu
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_PROPERTIES, "&Properties\tAlt+Enter");
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_PROPERTIES, _T("&Properties\tAlt+Enter"));
|
||||
|
||||
// Select Children
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_SELECT_CHILDREN, "&Select Children\tC");
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_SELECT_CHILDREN, _T("&Select Children\tC"));
|
||||
|
||||
// Tree help
|
||||
pMenu->AppendMenu (MF_STRING, ID_HELP_FINDER, "&Help\tF1");
|
||||
pMenu->AppendMenu (MF_STRING, ID_HELP_FINDER, _T("&Help\tF1"));
|
||||
|
||||
// Add separator
|
||||
pMenu->AppendMenu (MF_SEPARATOR);
|
||||
pMenu->AppendMenu (MF_STRING, ID_RENAME_SELECTED, "&Rename All Selected");
|
||||
pMenu->AppendMenu (MF_STRING, ID_REPAIR_SELECTED, "&Repair All Selected");
|
||||
pMenu->AppendMenu (MF_STRING, ID_RENAME_SELECTED, _T("&Rename All Selected"));
|
||||
pMenu->AppendMenu (MF_STRING, ID_REPAIR_SELECTED, _T("&Repair All Selected"));
|
||||
|
||||
// Add separator
|
||||
pMenu->AppendMenu (MF_SEPARATOR);
|
||||
|
||||
// Add properties menu
|
||||
pMenu->AppendMenu (MF_STRING, ID_VIEW_SHOW, "&Show\tS");
|
||||
pMenu->AppendMenu (MF_STRING, ID_VIEW_HIDE, "&Hide\tH");
|
||||
pMenu->AppendMenu (MF_STRING, ID_VIEW_SHOW, _T("&Show\tS"));
|
||||
pMenu->AppendMenu (MF_STRING, ID_VIEW_HIDE, _T("&Hide\tH"));
|
||||
|
||||
// Add separator
|
||||
pMenu->AppendMenu (MF_SEPARATOR);
|
||||
|
||||
// Add expand / collapse menu
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_EXPAND, "&Expand\tE");
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_COLLAPSE, "&Collapse\tR");
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_EXPAND, _T("&Expand\tE"));
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_COLLAPSE, _T("&Collapse\tR"));
|
||||
|
||||
// Only one selection ?
|
||||
if (Selection.size () == 1)
|
||||
|
@ -2712,7 +2710,7 @@ void CMainFrame::createContextMenu (CWnd *parent, const CPoint &point, bool tran
|
|||
// For each child, add a create method
|
||||
for (uint i=0; i<primClass->DynamicChildren.size (); i++)
|
||||
{
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_CREATE_BEGIN+i, ("Add "+primClass->DynamicChildren[i].ClassName).c_str ());
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_CREATE_BEGIN+i, utf8ToTStr("Add " + primClass->DynamicChildren[i].ClassName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2725,7 +2723,7 @@ void CMainFrame::createContextMenu (CWnd *parent, const CPoint &point, bool tran
|
|||
// For each child, add a create method
|
||||
for (uint i=0; i<primClass->GeneratedChildren.size (); i++)
|
||||
{
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_GENERATE_BEGIN+i, ("Generate "+primClass->GeneratedChildren[i].ClassName).c_str ());
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_GENERATE_BEGIN+i, utf8ToTStr("Generate "+primClass->GeneratedChildren[i].ClassName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2749,7 +2747,7 @@ void CMainFrame::createContextMenu (CWnd *parent, const CPoint &point, bool tran
|
|||
for (i=0; i<filenames.size (); i++)
|
||||
{
|
||||
// Add a menu entry
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_OPEN_FILE_BEGIN+i, ("Open "+NLMISC::CFile::getFilename (filenames[i])).c_str ());
|
||||
pMenu->AppendMenu (MF_STRING, ID_EDIT_OPEN_FILE_BEGIN+i, utf8ToTStr("Open " + NLMISC::CFile::getFilename (filenames[i])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3375,9 +3373,9 @@ void CMainFrame::OnHelpFinder()
|
|||
{
|
||||
//string filename = theApp.ExePath+"doc/"+className+".html";
|
||||
string filename = theApp.DocPath+"/"+className+".html";
|
||||
if (!NLMISC::CFile::fileExists(filename) || !openFile (filename.c_str ()))
|
||||
if (!NLMISC::CFile::fileExists(filename) || !openDoc (filename))
|
||||
{
|
||||
//openFile ((theApp.ExePath+"world_editor.html").c_str ());
|
||||
//openDoc (theApp.ExePath+"world_editor.html");
|
||||
theApp.errorMessage ("Can't open the file %s", filename.c_str ());
|
||||
}
|
||||
}
|
||||
|
@ -3385,7 +3383,7 @@ void CMainFrame::OnHelpFinder()
|
|||
}
|
||||
else
|
||||
{
|
||||
openFile ((theApp.ExePath+"world_editor.html").c_str ());
|
||||
openDoc((theApp.ExePath+"world_editor.html"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3719,7 +3717,7 @@ void CMainFrame::OnProjectForceiduniqueness()
|
|||
// End modifications
|
||||
doc->endModification ();
|
||||
|
||||
AfxMessageBox(NLMISC::toString("%u ids checked, %u non unique ID regenerated", ids.size()+nonUnique.size(), nonUnique.size()).c_str(), MB_OK);
|
||||
AfxMessageBox(utf8ToTStr(NLMISC::toString("%u ids checked, %u non unique ID regenerated", ids.size()+nonUnique.size(), nonUnique.size())), MB_OK);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -3795,7 +3793,7 @@ void CMainFrame::OnViewCollisions()
|
|||
// ***************************************************************************
|
||||
|
||||
// routines for the plugin
|
||||
NLLIGO::IPrimitive *CMainFrame::createRootPluginPrimitive (const char *name)
|
||||
NLLIGO::IPrimitive *CMainFrame::createRootPluginPrimitive (const std::string &name)
|
||||
{
|
||||
AFX_MANAGE_STATE(AfxGetAppModuleState());
|
||||
|
||||
|
@ -3861,8 +3859,8 @@ void CMainFrame::getAllRootPluginPrimitive (std::vector<NLLIGO::IPrimitive*> &pr
|
|||
|
||||
const NLLIGO::IPrimitive *CMainFrame::createPluginPrimitive
|
||||
(
|
||||
const char *className,
|
||||
const char *primName,
|
||||
const std::string &className,
|
||||
const std::string &primName,
|
||||
const NLMISC::CVector &initPos,
|
||||
float deltaPos,
|
||||
const std::vector<CPrimitiveClass::CInitParameters> &initParameters,
|
||||
|
@ -3982,7 +3980,7 @@ void CMainFrame::getWindowCoordinates(NLMISC::CVector &vmin, NLMISC::CVector &vm
|
|||
void CMainFrame::OnHelpHistory()
|
||||
{
|
||||
string filename = theApp.ExePath+"history.txt";
|
||||
if (!openFile (filename.c_str()))
|
||||
if (!openDoc(filename))
|
||||
{
|
||||
theApp.errorMessage ("Can't open the file %s", filename.c_str ());
|
||||
}
|
||||
|
@ -3995,13 +3993,13 @@ void CMainFrame::OnExportSnapshot()
|
|||
CCustomSnapshot snapShot (this);
|
||||
if (snapShot.DoModal () == IDOK)
|
||||
{
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, "image", FALSE, "tga", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Targa Files (*.tga)|*.tga|All Files (*.*)|*.*||", this);
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("image"), FALSE, _T("tga"), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, _T("Targa Files (*.tga)|*.tga|All Files (*.*)|*.*||"), this);
|
||||
if (dialog.DoModal() == IDOK)
|
||||
{
|
||||
if (snapShot.FixedSize == 0)
|
||||
_ZoneBuilder->snapshot (dialog.GetPathName(), (uint)theApp.Config.CellSize, snapShot.OutputRGB == 1);
|
||||
_ZoneBuilder->snapshot (tStrToUtf8(dialog.GetPathName()), (uint)theApp.Config.CellSize, snapShot.OutputRGB == 1);
|
||||
else
|
||||
_ZoneBuilder->snapshotCustom (dialog.GetPathName(), snapShot.Width, snapShot.Height, snapShot.KeepRatio != FALSE,
|
||||
_ZoneBuilder->snapshotCustom (tStrToUtf8(dialog.GetPathName()), snapShot.Width, snapShot.Height, snapShot.KeepRatio != FALSE,
|
||||
(uint)theApp.Config.CellSize, snapShot.OutputRGB == 1);
|
||||
}
|
||||
}
|
||||
|
@ -4241,14 +4239,14 @@ void CMainFrame::OnSavePosition()
|
|||
x = (sint32)floor(v.x / dispWnd->_CellSize);
|
||||
y = (sint32)floor(v.y / dispWnd->_CellSize);
|
||||
|
||||
str.Format( "[%s] X = %.3f, Y = %.3f\r\n", t.Format( "%m/%d/%y, %H:%M:%S" ), v.x, v.y );
|
||||
str.Format( _T("[%s] X = %.3f, Y = %.3f\r\n"), t.Format( "%m/%d/%y, %H:%M:%S" ), v.x, v.y );
|
||||
|
||||
file.Open( "position.txt", ::CFile::modeCreate|::CFile::modeNoTruncate|::CFile::modeWrite|::CFile::typeText );
|
||||
file.Open( _T("position.txt"), ::CFile::modeCreate|::CFile::modeNoTruncate|::CFile::modeWrite|::CFile::typeText );
|
||||
file.SeekToEnd();
|
||||
file.WriteString( str );
|
||||
file.Close();
|
||||
|
||||
MessageBox( "Current coordinates saved in file position.txt", "Position saved", MB_OK );
|
||||
MessageBox( _T("Current coordinates saved in file position.txt"), _T("Position saved"), MB_OK );
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -4266,9 +4264,9 @@ void CMainFrame::OnDropFiles(HDROP hDropInfo)
|
|||
for (uint i=0 ; i<numFiles ; i++)
|
||||
{
|
||||
// Get the path of this file
|
||||
char* pFilename = Filename.GetBuffer(_MAX_PATH);
|
||||
TCHAR* pFilename = Filename.GetBuffer(_MAX_PATH);
|
||||
DragQueryFile(hDropInfo, i, pFilename, _MAX_PATH);
|
||||
string path(pFilename);
|
||||
string path(tStrToUtf8(pFilename));
|
||||
|
||||
// Add it if it's a primitive not already loaded
|
||||
if (path.find(".primitive") != string::npos)
|
||||
|
@ -4330,11 +4328,11 @@ void CMainFrame::OnMissionCompiler()
|
|||
if (files.size() > 0)
|
||||
{
|
||||
// use system temp directory
|
||||
char tmpPath[MAX_PATH];
|
||||
GetEnvironmentVariable("TMP", tmpPath, MAX_PATH);
|
||||
strcat(tmpPath, "\\tmptool.txt");
|
||||
TCHAR tmpPath[MAX_PATH];
|
||||
GetEnvironmentVariable(_T("TMP"), tmpPath, MAX_PATH);
|
||||
_tcscat(tmpPath, _T("\\tmptool.txt"));
|
||||
|
||||
FILE *f = nlfopen(tmpPath, "w");
|
||||
FILE *f = nlfopen(tStrToUtf8(tmpPath), "w");
|
||||
if (f==NULL)
|
||||
infoMessage("Can't open file for writing !\n%s", tmpPath);
|
||||
|
||||
|
@ -4352,8 +4350,8 @@ void CMainFrame::OnMissionCompiler()
|
|||
return;
|
||||
}
|
||||
|
||||
char path[MAX_PATH];
|
||||
strcpy(path, var->asString().c_str());
|
||||
TCHAR path[MAX_PATH];
|
||||
_tcscpy(path, utf8ToTStr(var->asString()));
|
||||
|
||||
SHELLEXECUTEINFO ExecuteInfo;
|
||||
memset(&ExecuteInfo, 0, sizeof(ExecuteInfo));
|
||||
|
@ -4361,8 +4359,8 @@ void CMainFrame::OnMissionCompiler()
|
|||
ExecuteInfo.cbSize = sizeof(ExecuteInfo);
|
||||
ExecuteInfo.fMask = 0;
|
||||
ExecuteInfo.hwnd = 0;
|
||||
ExecuteInfo.lpVerb = "open";
|
||||
ExecuteInfo.lpFile = "mission_compiler_fe_r.exe";
|
||||
ExecuteInfo.lpVerb = _T("open");
|
||||
ExecuteInfo.lpFile = _T("mission_compiler_fe_r.exe");
|
||||
ExecuteInfo.lpParameters = 0;
|
||||
ExecuteInfo.lpDirectory = path;
|
||||
ExecuteInfo.nShow = SW_SHOW;
|
||||
|
|
|
@ -207,13 +207,13 @@ public:
|
|||
void setSelectionLocked (bool lock);
|
||||
|
||||
// Delete selected primitives
|
||||
void deletePrimitive (bool subDelete, const char *actionName);
|
||||
void deletePrimitive (bool subDelete, const std::string &actionName);
|
||||
|
||||
// Create a context menu for selection
|
||||
void createContextMenu (CWnd *parent, const CPoint &point, bool transformMode);
|
||||
|
||||
// Display info in the status bar
|
||||
void displayInfo (const char *info);
|
||||
void displayInfo (const std::string &info);
|
||||
|
||||
// Disactive / enable interaction
|
||||
void interaction (bool enable);
|
||||
|
@ -258,8 +258,8 @@ public:
|
|||
/// The controled position
|
||||
NLMISC::CVector _PositionControl;
|
||||
|
||||
void setExeDir (const char* str);
|
||||
void setDataDir (const char* str);
|
||||
void setExeDir (const std::string &str);
|
||||
void setDataDir (const std::string &str);
|
||||
void uninitTools();
|
||||
void initTools();
|
||||
void invalidateLandscape ();
|
||||
|
@ -293,7 +293,7 @@ public:
|
|||
void startPositionControl(IPluginCallback *plugin, const NLMISC::CVector &initPos);
|
||||
void stopPositionControl(IPluginCallback *plugin);
|
||||
// functions to create/remove the Root Primitive for server actions
|
||||
virtual NLLIGO::IPrimitive *createRootPluginPrimitive (const char *name);
|
||||
virtual NLLIGO::IPrimitive *createRootPluginPrimitive (const std::string &name);
|
||||
virtual void deleteRootPluginPrimitive (void);
|
||||
virtual void getAllRootPluginPrimitive (std::vector<NLLIGO::IPrimitive*> &prims);
|
||||
/*
|
||||
|
@ -302,8 +302,8 @@ public:
|
|||
*/
|
||||
// Create a plugin primitive
|
||||
const NLLIGO::IPrimitive *createPluginPrimitive (
|
||||
const char *className,
|
||||
const char *primName,
|
||||
const std::string &className,
|
||||
const std::string &primName,
|
||||
const NLMISC::CVector &initPos,
|
||||
float deltaPos,
|
||||
const std::vector<NLLIGO::CPrimitiveClass::CInitParameters> &initParameters,
|
||||
|
|
|
@ -66,10 +66,10 @@ BOOL CMyListBox::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
case CBN_SELENDOK:
|
||||
{
|
||||
CString str;
|
||||
std::string str;
|
||||
getWindowTextUTF8 (StringSelectComboBox, str);
|
||||
DeleteString(_EditingItem);
|
||||
InsertString(_EditingItem, str);
|
||||
InsertString(_EditingItem, utf8ToTStr(str));
|
||||
SetCurSel (_SelectAfter);
|
||||
_EditingItem = LB_ERR;
|
||||
notifyParent ();
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
/* Functions to create/remove the Root Primitive for server actions
|
||||
Returns the id of the root primitive
|
||||
*/
|
||||
virtual NLLIGO::IPrimitive *createRootPluginPrimitive (const char *name) = 0;
|
||||
virtual NLLIGO::IPrimitive *createRootPluginPrimitive (const std::string &name) = 0;
|
||||
virtual void deleteRootPluginPrimitive (void) = 0;
|
||||
/// get all the current root primitve in the world editor. only the editable one are returned
|
||||
virtual void getAllRootPluginPrimitive (std::vector<NLLIGO::IPrimitive*> &prims) = 0;
|
||||
|
@ -95,8 +95,8 @@ public:
|
|||
*/
|
||||
// Create a plugin primitive
|
||||
virtual const NLLIGO::IPrimitive *createPluginPrimitive (
|
||||
const char *className,
|
||||
const char *primName,
|
||||
const std::string &className,
|
||||
const std::string &primName,
|
||||
const NLMISC::CVector &initPos,
|
||||
float deltaPos,
|
||||
const std::vector<NLLIGO::CPrimitiveClass::CInitParameters> &initParameters,
|
||||
|
|
|
@ -76,20 +76,20 @@ void CProjectSettings::OnBrowse()
|
|||
UpdateData ();
|
||||
|
||||
BROWSEINFO bi;
|
||||
char str[MAX_PATH];
|
||||
TCHAR str[MAX_PATH];
|
||||
ITEMIDLIST* pidl;
|
||||
char sTemp[1024];
|
||||
TCHAR sTemp[1024];
|
||||
|
||||
bi.hwndOwner = this->m_hWnd;
|
||||
bi.pidlRoot = NULL;
|
||||
bi.pidlRoot = NULL;
|
||||
bi.pszDisplayName = sTemp;
|
||||
bi.lpszTitle = "Choose the data directory for this project";
|
||||
bi.lpszTitle = _T("Choose the data directory for this project");
|
||||
bi.ulFlags = 0;
|
||||
bi.lpfn = dataDirBrowseCallbackProc;
|
||||
|
||||
char sDir[512];
|
||||
strcpy(sDir, DataDirectory);
|
||||
TCHAR sDir[512];
|
||||
_tcscpy(sDir, DataDirectory);
|
||||
bi.lParam = (LPARAM)sDir;
|
||||
|
||||
bi.iImage = 0;
|
||||
|
@ -114,9 +114,9 @@ void CProjectSettings::OnOK()
|
|||
// Get the document
|
||||
CWorldEditorDoc *doc = getDocument ();
|
||||
|
||||
CString str;
|
||||
std::string str;
|
||||
getWindowTextUTF8 (Context, str);
|
||||
doc->setContext ((const char*)str);
|
||||
doc->setContext (str);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -133,11 +133,11 @@ BOOL CProjectSettings::OnInitDialog()
|
|||
for (uint i=0; i<contexts.size (); i++)
|
||||
{
|
||||
// Add the string
|
||||
Context.InsertString (-1, contexts[i].c_str());
|
||||
Context.InsertString (-1, utf8ToTStr(contexts[i]));
|
||||
}
|
||||
|
||||
// Select the string
|
||||
Context.SelectString (-1, doc->getContext ().c_str ());
|
||||
Context.SelectString (-1, utf8ToTStr(doc->getContext ()));
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
|
|
|
@ -681,9 +681,9 @@ void CToolsLogicTree::OnMenuGroupCreatePoint()
|
|||
dialog.MainFrame = _MainFrame;
|
||||
|
||||
if (dialog.DoModal () == IDOK)
|
||||
if (strlen(dialog.Name) > 0)
|
||||
if (_tcslen(dialog.Name) > 0)
|
||||
{
|
||||
HTREEITEM newItem = insertItemUTF8 (*this, dialog.Name, 2, 2, itemGroup);
|
||||
HTREEITEM newItem = insertItemUTF8 (*this, tStrToUtf8(dialog.Name), 2, 2, itemGroup);
|
||||
Expand (itemGroup, TVE_EXPAND);
|
||||
// Create the newItem
|
||||
for (i = 0; i < _RegionsInfo.size(); ++i)
|
||||
|
@ -715,9 +715,9 @@ void CToolsLogicTree::OnMenuGroupCreatePath()
|
|||
dialog.MainFrame = _MainFrame;
|
||||
|
||||
if (dialog.DoModal () == IDOK)
|
||||
if (strlen(dialog.Name) > 0)
|
||||
if (_tcslen(dialog.Name) > 0)
|
||||
{
|
||||
HTREEITEM newItem = insertItemUTF8 (*this, dialog.Name, 4, 4, itemGroup);
|
||||
HTREEITEM newItem = insertItemUTF8 (*this, tStrToUtf8(dialog.Name), 4, 4, itemGroup);
|
||||
Expand (itemGroup, TVE_EXPAND);
|
||||
// Create the newItem
|
||||
for (i = 0; i < _RegionsInfo.size(); ++i)
|
||||
|
@ -749,9 +749,9 @@ void CToolsLogicTree::OnMenuGroupCreateZone()
|
|||
dialog.MainFrame = _MainFrame;
|
||||
|
||||
if (dialog.DoModal () == IDOK)
|
||||
if (strlen(dialog.Name) > 0)
|
||||
if (_tcslen(dialog.Name) > 0)
|
||||
{
|
||||
HTREEITEM newItem = insertItemUTF8 (*this, dialog.Name, 6, 6, itemGroup);
|
||||
HTREEITEM newItem = insertItemUTF8 (*this, tStrToUtf8(dialog.Name), 6, 6, itemGroup);
|
||||
Expand (itemGroup, TVE_EXPAND);
|
||||
// Create the newItem
|
||||
for (i = 0; i < _RegionsInfo.size(); ++i)
|
||||
|
@ -814,7 +814,7 @@ void CToolsLogicTree::OnMenuGroupProperties()
|
|||
es.Name = GetItemText (hItem);
|
||||
if (es.DoModal() == IDOK)
|
||||
{
|
||||
setItemTextUTF8 (*this, hItem, es.Name);
|
||||
setItemTextUTF8 (*this, hItem, tStrToUtf8(es.Name));
|
||||
|
||||
HTREEITEM hChildItem = GetChildItem(hItem);
|
||||
while (hChildItem != NULL)
|
||||
|
@ -878,7 +878,7 @@ void CToolsLogicTree::OnMenuGroupTransfertAppend ()
|
|||
{
|
||||
HTREEITEM hNextItem = GetNextItem (hChildItem, TVGN_NEXT);
|
||||
|
||||
vTemp.push_back((LPCSTR)GetItemText(hChildItem));
|
||||
vTemp.push_back(tStrToUtf8(GetItemText(hChildItem)));
|
||||
|
||||
hChildItem = hNextItem;
|
||||
}
|
||||
|
@ -898,7 +898,7 @@ void CToolsLogicTree::OnMenuGroupTransfertReplace ()
|
|||
{
|
||||
HTREEITEM hNextItem = GetNextItem (hChildItem, TVGN_NEXT);
|
||||
|
||||
vTemp.push_back((LPCSTR)GetItemText(hChildItem));
|
||||
vTemp.push_back(tStrToUtf8(GetItemText(hChildItem)));
|
||||
|
||||
hChildItem = hNextItem;
|
||||
}
|
||||
|
@ -1198,9 +1198,9 @@ void CToolsLogic::OnNewGroup ()
|
|||
void CToolsLogic::OnNewPatat ()
|
||||
{
|
||||
CComboBox *pCB = (CComboBox*)GetDlgItem(IDC_TYPE);
|
||||
CString str;
|
||||
std::string str;
|
||||
getWindowTextUTF8 (*pCB, str);
|
||||
string sStr = (LPCSTR)str;
|
||||
// TODO: what to do with str?
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -1231,7 +1231,7 @@ BOOL CCreateDialog::OnInitDialog ()
|
|||
|
||||
for (uint32 i = 0; i < TypesForInit->size(); ++i)
|
||||
{
|
||||
ComboType.InsertString (-1, TypesForInit->operator[](i).Name.c_str());
|
||||
ComboType.InsertString (-1, utf8ToTStr(TypesForInit->operator[](i).Name));
|
||||
}
|
||||
|
||||
if (TypesForInit->size()>0)
|
||||
|
@ -1239,7 +1239,7 @@ BOOL CCreateDialog::OnInitDialog ()
|
|||
if (ComboType.SelectString (0, LayerName) == CB_ERR)
|
||||
ComboType.SetCurSel (0);
|
||||
UpdateData();
|
||||
if (strlen(Name) == 0)
|
||||
if (_tcslen(Name) == 0)
|
||||
OnSelChange();
|
||||
}
|
||||
|
||||
|
@ -1264,16 +1264,16 @@ void CCreateDialog::OnOK()
|
|||
UpdateData ();
|
||||
|
||||
// If the "region_" do not exist add it
|
||||
if (strncmp(RegionPost.c_str(), Name, strlen(RegionPost.c_str())) != 0)
|
||||
if (_tcsnccmp(utf8ToTStr(RegionPost), Name, strlen(RegionPost.c_str())) != 0)
|
||||
{
|
||||
char sTmp[128];
|
||||
strcpy (sTmp, RegionPost.c_str());
|
||||
strcat (sTmp, Name);
|
||||
strcpy (Name, sTmp);
|
||||
TCHAR sTmp[128];
|
||||
_tcscpy (sTmp, utf8ToTStr(RegionPost));
|
||||
_tcscat (sTmp, Name);
|
||||
_tcscpy (Name, sTmp);
|
||||
UpdateData (false);
|
||||
}
|
||||
|
||||
if (strcmp(PropName.c_str(), Name) == 0)
|
||||
if (PropName == tStrToUtf8(Name))
|
||||
CDialog::OnOK();
|
||||
|
||||
CDialog::OnOK();
|
||||
|
@ -1301,15 +1301,15 @@ void CCreateDialog::OnSelChange ()
|
|||
CString sTmp;
|
||||
ComboType.GetLBText (cs, sTmp);
|
||||
|
||||
if (PropType == (LPCSTR)sTmp)
|
||||
if (PropType == tStrToUtf8(sTmp))
|
||||
{
|
||||
strcpy (Name, PropName.c_str());
|
||||
_tcscpy (Name, utf8ToTStr(PropName));
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (Name, RegionPost.c_str());
|
||||
strcat (Name, (LPCSTR)sTmp);
|
||||
strcat (Name, "-");
|
||||
_tcscpy(Name, utf8ToTStr(RegionPost));
|
||||
_tcscat (Name, (LPCTSTR)sTmp);
|
||||
_tcscat (Name, _T("-"));
|
||||
}
|
||||
|
||||
UpdateData (false);
|
||||
|
@ -1617,7 +1617,7 @@ HTREEITEM CToolsLogic::addPrimitive (HTREEITEM parentItem, HTREEITEM lastBrother
|
|||
const NLLIGO::CPrimitives *primitives = &(doc->getDatabaseElements (locator.getDatabaseIndex ()));
|
||||
|
||||
// Set the item data
|
||||
_Tree->SetItemData (treeItem, (DWORD)new CPrimitiveTreeData (primitives, locator.Primitive));
|
||||
_Tree->SetItemData (treeItem, (DWORD_PTR)new CPrimitiveTreeData (primitives, locator.Primitive));
|
||||
|
||||
// Expand parent ?
|
||||
if (parentItem != TVI_ROOT)
|
||||
|
|
|
@ -196,7 +196,7 @@ class CCreateDialog : public CDialog
|
|||
|
||||
public:
|
||||
|
||||
char Name[128],
|
||||
TCHAR Name[128],
|
||||
LayerName[128];
|
||||
|
||||
std::vector<SType> *TypesForInit;
|
||||
|
|
|
@ -105,7 +105,7 @@ void CToolsZoneList::reset()
|
|||
void CToolsZoneList::addItem (const string &itemName)
|
||||
{
|
||||
_ItemNames.push_back (itemName);
|
||||
InsertString (-1, itemName.c_str());
|
||||
InsertString (-1, utf8ToTStr(itemName));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@ -168,7 +168,7 @@ void CToolsZoneList::DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
|
|||
}
|
||||
|
||||
// Draw the text.
|
||||
dc.DrawText (lpszText, strlen(lpszText), &rectLeft, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
|
||||
dc.DrawText (lpszText, _tcslen(lpszText), &rectLeft, DT_CENTER|DT_SINGLELINE|DT_VCENTER);
|
||||
|
||||
// Reset the background color and the text color back to their original values.
|
||||
dc.SetTextColor (crOldTextColor);
|
||||
|
@ -261,13 +261,13 @@ void CToolsZone::addToAllCatTypeCB (const string &Name)
|
|||
{
|
||||
CComboBox* pCB;
|
||||
pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE1);
|
||||
pCB->AddString (Name.c_str());
|
||||
pCB->AddString (utf8ToTStr(Name));
|
||||
pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE2);
|
||||
pCB->AddString (Name.c_str());
|
||||
pCB->AddString (utf8ToTStr(Name));
|
||||
pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE3);
|
||||
pCB->AddString (Name.c_str());
|
||||
pCB->AddString (utf8ToTStr(Name));
|
||||
pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE4);
|
||||
pCB->AddString (Name.c_str());
|
||||
pCB->AddString (utf8ToTStr(Name));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@ -285,26 +285,26 @@ void CToolsZone::init (CMainFrame *pMF)
|
|||
// Select right category types
|
||||
CComboBox* pCB;
|
||||
pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE1);
|
||||
pCB->SelectString (-1, _MainFrame->_ZoneBuilder->_FilterType1.c_str());
|
||||
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType1));
|
||||
pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE2);
|
||||
pCB->SelectString (-1, _MainFrame->_ZoneBuilder->_FilterType2.c_str());
|
||||
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType2));
|
||||
pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE3);
|
||||
pCB->SelectString (-1, _MainFrame->_ZoneBuilder->_FilterType3.c_str());
|
||||
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType3));
|
||||
pCB = (CComboBox*)GetDlgItem (IDC_CATTYPE4);
|
||||
pCB->SelectString (-1, _MainFrame->_ZoneBuilder->_FilterType4.c_str());
|
||||
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterType4));
|
||||
|
||||
updateComboPairAndFilter (IDC_CATTYPE1, IDC_CATVALUE1, &_MainFrame->_ZoneBuilder->_FilterType1);
|
||||
pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE1);
|
||||
pCB->SelectString (-1, _MainFrame->_ZoneBuilder->_FilterValue1.c_str());
|
||||
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue1));
|
||||
updateComboPairAndFilter (IDC_CATTYPE2, IDC_CATVALUE2, &_MainFrame->_ZoneBuilder->_FilterType2);
|
||||
pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE2);
|
||||
pCB->SelectString (-1, _MainFrame->_ZoneBuilder->_FilterValue2.c_str());
|
||||
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue2));
|
||||
updateComboPairAndFilter (IDC_CATTYPE3, IDC_CATVALUE3, &_MainFrame->_ZoneBuilder->_FilterType3);
|
||||
pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE3);
|
||||
pCB->SelectString (-1, _MainFrame->_ZoneBuilder->_FilterValue3.c_str());
|
||||
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue3));
|
||||
updateComboPairAndFilter (IDC_CATTYPE4, IDC_CATVALUE4, &_MainFrame->_ZoneBuilder->_FilterType4);
|
||||
pCB = (CComboBox*)GetDlgItem (IDC_CATVALUE4);
|
||||
pCB->SelectString (-1, _MainFrame->_ZoneBuilder->_FilterValue4.c_str());
|
||||
pCB->SelectString (-1, utf8ToTStr(_MainFrame->_ZoneBuilder->_FilterValue4));
|
||||
|
||||
// Select right operators
|
||||
CButton *pButAnd, *pButOr;
|
||||
|
@ -432,11 +432,11 @@ void CToolsZone::OnPaint()
|
|||
void CToolsZone::updateComboPairAndFilter (int CatTypeId, int CatValueId, string *pFilterType)
|
||||
{
|
||||
uint32 i;
|
||||
char sTmp[256];
|
||||
TCHAR sTmp[256];
|
||||
CComboBox *pCBType, *pCBValue;
|
||||
pCBType = (CComboBox*)GetDlgItem (CatTypeId);
|
||||
pCBType->GetLBText (pCBType->GetCurSel(), sTmp);
|
||||
*pFilterType = sTmp;
|
||||
*pFilterType = tStrToUtf8(sTmp);
|
||||
pCBValue = (CComboBox*)GetDlgItem (CatValueId);
|
||||
pCBValue->ResetContent ();
|
||||
|
||||
|
@ -446,7 +446,7 @@ void CToolsZone::updateComboPairAndFilter (int CatTypeId, int CatValueId, string
|
|||
vector<string> allCategoryValues;
|
||||
_MainFrame->_ZoneBuilder->getZoneBank().getCategoryValues (*pFilterType, allCategoryValues);
|
||||
for(i = 0; i < allCategoryValues.size(); ++i)
|
||||
pCBValue->AddString (allCategoryValues[i].c_str());
|
||||
pCBValue->AddString (utf8ToTStr(allCategoryValues[i]));
|
||||
pCBValue->SetCurSel (0);
|
||||
}
|
||||
|
||||
|
@ -485,40 +485,40 @@ void CToolsZone::OnSelectCatType4 ()
|
|||
// ---------------------------------------------------------------------------
|
||||
void CToolsZone::OnSelectCatValue1()
|
||||
{
|
||||
char sTmp[256];
|
||||
TCHAR sTmp[256];
|
||||
CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE1);
|
||||
pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp);
|
||||
_MainFrame->_ZoneBuilder->_FilterValue1 = sTmp;
|
||||
_MainFrame->_ZoneBuilder->_FilterValue1 = tStrToUtf8(sTmp);
|
||||
_MainFrame->_ZoneBuilder->updateToolsZone ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
void CToolsZone::OnSelectCatValue2()
|
||||
{
|
||||
char sTmp[256];
|
||||
TCHAR sTmp[256];
|
||||
CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE2);
|
||||
pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp);
|
||||
_MainFrame->_ZoneBuilder->_FilterValue2 = sTmp;
|
||||
_MainFrame->_ZoneBuilder->_FilterValue2 = tStrToUtf8(sTmp);
|
||||
_MainFrame->_ZoneBuilder->updateToolsZone ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
void CToolsZone::OnSelectCatValue3()
|
||||
{
|
||||
char sTmp[256];
|
||||
TCHAR sTmp[256];
|
||||
CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE3);
|
||||
pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp);
|
||||
_MainFrame->_ZoneBuilder->_FilterValue3 = sTmp;
|
||||
_MainFrame->_ZoneBuilder->_FilterValue3 = tStrToUtf8(sTmp);
|
||||
_MainFrame->_ZoneBuilder->updateToolsZone ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
void CToolsZone::OnSelectCatValue4()
|
||||
{
|
||||
char sTmp[256];
|
||||
TCHAR sTmp[256];
|
||||
CComboBox *pCBValue = (CComboBox*)GetDlgItem (IDC_CATVALUE4);
|
||||
pCBValue->GetLBText (pCBValue->GetCurSel(), sTmp);
|
||||
_MainFrame->_ZoneBuilder->_FilterValue4 = sTmp;
|
||||
_MainFrame->_ZoneBuilder->_FilterValue4 = tStrToUtf8(sTmp);
|
||||
_MainFrame->_ZoneBuilder->updateToolsZone ();
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ void CTypeManagerDlg::OnAddtype()
|
|||
if (typeDlg.DoModal() == IDOK)
|
||||
{
|
||||
SType typeTmp;
|
||||
typeTmp.Name = (LPCSTR)typeDlg.EditName;
|
||||
typeTmp.Name = tStrToUtf8(typeDlg.EditName);
|
||||
typeTmp.Color = typeDlg.ButtonColorValue;
|
||||
// Check if the name of the new type is the same as an existing one
|
||||
bool bFound = false;
|
||||
|
@ -91,7 +91,7 @@ void CTypeManagerDlg::OnAddtype()
|
|||
if (!bFound)
|
||||
{
|
||||
LocalTypes.push_back (typeTmp);
|
||||
ListType.InsertString(-1, typeTmp.Name.c_str());
|
||||
ListType.InsertString(-1, utf8ToTStr(typeTmp.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,11 +111,11 @@ void CTypeManagerDlg::OnEdittype()
|
|||
if (typeDlg.DoModal() == IDOK)
|
||||
{
|
||||
SType typeTmp;
|
||||
typeTmp.Name = (LPCSTR)typeDlg.EditName;
|
||||
typeTmp.Name = tStrToUtf8(typeDlg.EditName);
|
||||
typeTmp.Color = typeDlg.ButtonColorValue;
|
||||
LocalTypes[cursel] = typeTmp;
|
||||
ListType.DeleteString (ListType.GetCurSel());
|
||||
ListType.InsertString (cursel, typeTmp.Name.c_str());
|
||||
ListType.InsertString (cursel, utf8ToTStr(typeTmp.Name));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ BOOL CTypeManagerDlg::OnInitDialog()
|
|||
// TODO: Add extra initialization here
|
||||
for (uint32 i = 0; i < LocalTypes.size(); ++i)
|
||||
{
|
||||
ListType.InsertString(-1, LocalTypes[i].Name.c_str());
|
||||
ListType.InsertString(-1, utf8ToTStr(LocalTypes[i].Name));
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
|
|
|
@ -60,7 +60,7 @@ void CTypeSelDlg::OnOK()
|
|||
|
||||
CString sTmp;
|
||||
TypeList.GetText(TypeList.GetCurSel(), sTmp);
|
||||
_TypeSelected = (LPCSTR)sTmp;
|
||||
_TypeSelected = tStrToUtf8(sTmp);
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ BOOL CTypeSelDlg::OnInitDialog()
|
|||
// TODO: Add extra initialization here
|
||||
for (uint32 i = 0; i < _TypesInit->size(); ++i)
|
||||
{
|
||||
TypeList.InsertString(-1, _TypesInit->operator[](i).Name.c_str());
|
||||
TypeList.InsertString(-1, utf8ToTStr(_TypesInit->operator[](i).Name));
|
||||
}
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
|
|
|
@ -128,7 +128,7 @@ BOOL CWorldEditorApp::InitInstance()
|
|||
splashScreen.addLine(string("Exe path"));
|
||||
|
||||
// Exe path
|
||||
ExePath = GetCommandLine ();
|
||||
ExePath = tStrToUtf8(GetCommandLine ());
|
||||
if (ExePath.size()>0)
|
||||
{
|
||||
if (ExePath[0] == '\"')
|
||||
|
@ -170,7 +170,7 @@ BOOL CWorldEditorApp::InitInstance()
|
|||
}
|
||||
catch (const Exception& e)
|
||||
{
|
||||
::MessageBox (NULL, e.what(), "Warning", MB_OK|MB_ICONEXCLAMATION);
|
||||
::MessageBox (NULL, utf8ToTStr(e.what()), _T("Warning"), MB_OK|MB_ICONEXCLAMATION);
|
||||
|
||||
// Can't found the module put some default values
|
||||
Config.CellSize = 160.0f;
|
||||
|
@ -218,7 +218,7 @@ BOOL CWorldEditorApp::InitInstance()
|
|||
|
||||
// Enable DDE Execute open
|
||||
EnableShellOpen();
|
||||
RegDeleteKey (HKEY_CLASSES_ROOT, "Worldeditor.Document\\DefaultIcon");
|
||||
RegDeleteKey (HKEY_CLASSES_ROOT, _T("Worldeditor.Document\\DefaultIcon"));
|
||||
RegisterShellFileTypes(TRUE);
|
||||
|
||||
// Parse command line for standard shell commands, DDE, file open
|
||||
|
@ -286,13 +286,13 @@ BOOL CWorldEditorApp::InitInstance()
|
|||
|
||||
CMenu* menu = new CMenu();
|
||||
menu->CreatePopupMenu();
|
||||
dynamic_menu->InsertMenu(6, MF_BYPOSITION | MF_POPUP, (UINT)menu->GetSafeHmenu(), "Plugins");
|
||||
dynamic_menu->InsertMenu(6, MF_BYPOSITION | MF_POPUP, (UINT_PTR)menu->GetSafeHmenu(), _T("Plugins"));
|
||||
|
||||
for(uint k=0;k<Plugins.size();k++)
|
||||
{
|
||||
IPluginCallback* test=Plugins[k];
|
||||
string retest=test->getName();
|
||||
menu->InsertMenu( k, MF_BYPOSITION | MF_POPUP, ID_WINDOWS_PLUGINS+1 + k, retest.c_str() );
|
||||
menu->InsertMenu( k, MF_BYPOSITION | MF_POPUP, ID_WINDOWS_PLUGINS+1 + k, utf8ToTStr(retest) );
|
||||
menu->CheckMenuItem(ID_WINDOWS_PLUGINS+1 +k, MF_CHECKED);
|
||||
}
|
||||
|
||||
|
@ -444,7 +444,7 @@ bool CWorldEditorApp::yesNoMessage (const char *format, ... )
|
|||
strcpy(buffer, "Unknown error");
|
||||
}
|
||||
|
||||
return MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, buffer, "NeL World Editor", MB_YESNO|MB_ICONQUESTION) == IDYES;
|
||||
return MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, utf8ToTStr(buffer), _T("NeL World Editor"), MB_YESNO|MB_ICONQUESTION) == IDYES;
|
||||
}
|
||||
|
||||
void CWorldEditorApp::errorMessage (const char *format, ... )
|
||||
|
@ -463,7 +463,7 @@ void CWorldEditorApp::errorMessage (const char *format, ... )
|
|||
strcpy(buffer, "Unknown error");
|
||||
}
|
||||
|
||||
MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, buffer, "NeL World Editor", MB_OK|MB_ICONEXCLAMATION);
|
||||
MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, utf8ToTStr(buffer), _T("NeL World Editor"), MB_OK|MB_ICONEXCLAMATION);
|
||||
}
|
||||
|
||||
void CWorldEditorApp::infoMessage (const char *format, ... )
|
||||
|
@ -482,10 +482,10 @@ void CWorldEditorApp::infoMessage (const char *format, ... )
|
|||
strcpy(buffer, "Unknown error");
|
||||
}
|
||||
|
||||
MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, buffer, "NeL World Editor", MB_OK|MB_ICONINFORMATION);
|
||||
MessageBox (m_pMainWnd?m_pMainWnd->m_hWnd:NULL, utf8ToTStr(buffer), _T("NeL World Editor"), MB_OK|MB_ICONINFORMATION);
|
||||
}
|
||||
|
||||
void CWorldEditorApp::syntaxError (const char *filename, xmlNodePtr xmlNode, const char *format, ...)
|
||||
void CWorldEditorApp::syntaxError (const std::string &filename, xmlNodePtr xmlNode, const char *format, ...)
|
||||
{
|
||||
char buffer[1024];
|
||||
|
||||
|
@ -501,10 +501,10 @@ void CWorldEditorApp::syntaxError (const char *filename, xmlNodePtr xmlNode, con
|
|||
strcpy(buffer, "Unknown error");
|
||||
}
|
||||
|
||||
errorMessage ("(%s), node (%s), line (%d) :\n%s", filename, xmlNode->name, (int)xmlNode->content, buffer);
|
||||
errorMessage ("(%s), node (%s), line (%d) :\n%s", filename.c_str(), xmlNode->name, (int)xmlNode->line, buffer);
|
||||
}
|
||||
|
||||
bool CWorldEditorApp::getPropertyString (std::string &result, const char *filename, xmlNodePtr xmlNode, const char *propName)
|
||||
bool CWorldEditorApp::getPropertyString (std::string &result, const std::string &filename, xmlNodePtr xmlNode, const std::string &propName)
|
||||
{
|
||||
// Call the CIXml version
|
||||
if (!CIXml::getPropertyString (result, xmlNode, propName))
|
||||
|
@ -516,7 +516,7 @@ bool CWorldEditorApp::getPropertyString (std::string &result, const char *filena
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CWorldEditorApp::initPath (const char *filename, CSplashScreen &splashScreen)
|
||||
bool CWorldEditorApp::initPath (const std::string &filename, CSplashScreen &splashScreen)
|
||||
{
|
||||
// The context strings
|
||||
set<string> contextStrings;
|
||||
|
@ -630,16 +630,16 @@ class CMainFrame *getMainFrame ()
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
std::string standardizePath (const char *str)
|
||||
std::string standardizePath (const std::string &str)
|
||||
{
|
||||
return NLMISC::strlwr (NLMISC::CPath::standardizePath (str, true));
|
||||
return NLMISC::toLower(NLMISC::CPath::standardizePath (str, true));
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
std::string formatString (const char *str)
|
||||
std::string formatString (const std::string &str)
|
||||
{
|
||||
string copy = NLMISC::strlwr (str);
|
||||
string copy = NLMISC::toLower(str);
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
@ -679,9 +679,9 @@ void invalidateLeftView ()
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
std::string numberize (const char *oldString, uint value)
|
||||
std::string numberize (const std::string &oldString, uint value)
|
||||
{
|
||||
int i=strlen (oldString)-1;
|
||||
int i = oldString.length()-1;
|
||||
while ((i>=0) && (((oldString[i]<='9') && (oldString[i]>='0')) || (oldString[i]==' ')))
|
||||
{
|
||||
// again
|
||||
|
@ -723,52 +723,6 @@ bool getZoneNameFromXY (sint32 x, sint32 y, std::string &zoneName)
|
|||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool openFile (const char *filename)
|
||||
{
|
||||
char key[MAX_PATH + MAX_PATH];
|
||||
|
||||
// Extension
|
||||
string extension = NLMISC::CFile::getExtension (filename);
|
||||
|
||||
// First try ShellExecute()
|
||||
HINSTANCE result = ShellExecute(NULL, "open", filename, NULL,NULL, SW_SHOW);
|
||||
|
||||
// If it failed, get the .htm regkey and lookup the program
|
||||
if ((UINT)result <= HINSTANCE_ERROR)
|
||||
{
|
||||
|
||||
if (getRegKey(HKEY_CLASSES_ROOT, ("."+extension).c_str (), key) == ERROR_SUCCESS)
|
||||
{
|
||||
lstrcat(key, "\\shell\\open\\command");
|
||||
|
||||
if (getRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS)
|
||||
{
|
||||
char *pos;
|
||||
pos = strstr(key, "\"%1\"");
|
||||
if (pos == NULL)
|
||||
{ // No quotes found
|
||||
pos = strstr(key, "%1"); // Check for %1, without quotes
|
||||
if (pos == NULL) // No parameter at all...
|
||||
pos = key+lstrlen(key)-1;
|
||||
else
|
||||
*pos = '\0'; // Remove the parameter
|
||||
}
|
||||
else
|
||||
*pos = '\0'; // Remove the parameter
|
||||
|
||||
lstrcat(pos, " ");
|
||||
lstrcat(pos, filename);
|
||||
result = (HINSTANCE) WinExec(key, SW_SHOW);
|
||||
return ((UINT)result) >= 31;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
|
@ -780,7 +734,7 @@ uint getRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata)
|
|||
if (retval == ERROR_SUCCESS)
|
||||
{
|
||||
long datasize = MAX_PATH;
|
||||
char data[MAX_PATH];
|
||||
TCHAR data[MAX_PATH];
|
||||
RegQueryValue(hkey, NULL, data, &datasize);
|
||||
lstrcpy(retdata,data);
|
||||
RegCloseKey(hkey);
|
||||
|
@ -832,21 +786,9 @@ void CMyLigoConfig::errorMessage (const char *format, ... )
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void setEditTextMultiLine (CEdit &edit, const char *text)
|
||||
void setEditTextMultiLine (CEdit &edit, const std::string &text)
|
||||
{
|
||||
string temp;
|
||||
uint size = strlen (text);
|
||||
temp.reserve (2*size);
|
||||
bool previousR=false;
|
||||
for (uint c=0; c<size; c++)
|
||||
{
|
||||
if ((text[c] == '\n') && (!previousR))
|
||||
temp += "\r\n";
|
||||
else
|
||||
temp += text[c];
|
||||
previousR = (text[c] == '\r');
|
||||
}
|
||||
setWindowTextUTF8 (edit, temp.c_str ());
|
||||
setWindowTextUTF8(edit, NLMISC::addSlashR(text));
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -864,45 +806,6 @@ void setEditTextMultiLine (CEdit &edit, const std::vector<std::string> &vect)
|
|||
setEditTextMultiLine (edit, temp.c_str());
|
||||
}
|
||||
|
||||
/*
|
||||
void setEditTextMultiLine (ColorEditWnd &edit, const char *text)
|
||||
{
|
||||
string temp;
|
||||
uint size = strlen (text);
|
||||
temp.reserve (2*size);
|
||||
bool previousR=false;
|
||||
for (uint c=0; c<size; c++)
|
||||
{
|
||||
if ((text[c] == '\n') && (!previousR))
|
||||
temp += "\r\n";
|
||||
else
|
||||
temp += text[c];
|
||||
previousR = (text[c] == '\r');
|
||||
}
|
||||
edit.LoadText(CString(temp.c_str()));
|
||||
}
|
||||
|
||||
void setEditTextMultiLine (ColorEditWnd &edit, const std::vector<std::string> &vect)
|
||||
{
|
||||
string temp;
|
||||
uint i;
|
||||
for (i=0; i<vect.size (); i++)
|
||||
{
|
||||
temp += vect[i];
|
||||
if (i != (vect.size ()-1))
|
||||
temp += "\n";
|
||||
}
|
||||
edit.LoadText(CString(temp.c_str()));
|
||||
}
|
||||
*/
|
||||
// ***************************************************************************
|
||||
|
||||
/*void setEditTextMultiLine (CListBox &listBox, const char *text)
|
||||
{
|
||||
listBox.ResetContent();
|
||||
nlverify (listBox.InsertString( -1, text) != LB_ERR);
|
||||
}*/
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void setEditTextMultiLine (CListBox &listBox, const std::vector<std::string> &vect)
|
||||
|
@ -910,12 +813,12 @@ void setEditTextMultiLine (CListBox &listBox, const std::vector<std::string> &ve
|
|||
listBox.ResetContent();
|
||||
uint i;
|
||||
for (i=0; i<vect.size (); i++)
|
||||
nlverify (listBox.InsertString( -1, vect[i].c_str()) != LB_ERR);
|
||||
nlverify (listBox.InsertString( -1, utf8ToTStr(vect[i])) != LB_ERR);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool setWindowTextUTF8 (HWND hwnd, const char *textUtf8)
|
||||
bool setWindowTextUTF8 (HWND hwnd, const std::string &textUtf8)
|
||||
{
|
||||
ucstring str;
|
||||
|
||||
|
@ -925,7 +828,7 @@ bool setWindowTextUTF8 (HWND hwnd, const char *textUtf8)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool getWindowTextUTF8 (HWND hwnd, CString &textUtf8)
|
||||
bool getWindowTextUTF8 (HWND hwnd, std::string &textUtf8)
|
||||
{
|
||||
ucstring text;
|
||||
text.resize (GetWindowTextLengthW (hwnd));
|
||||
|
@ -940,7 +843,7 @@ bool getWindowTextUTF8 (HWND hwnd, CString &textUtf8)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
HTREEITEM insertItemUTF8 (HWND hwnd, const char *textUtf8, HTREEITEM hParent, HTREEITEM hInsertAfter)
|
||||
HTREEITEM insertItemUTF8 (HWND hwnd, const std::string &textUtf8, HTREEITEM hParent, HTREEITEM hInsertAfter)
|
||||
{
|
||||
ucstring str;
|
||||
str.fromUtf8 (textUtf8);
|
||||
|
@ -954,7 +857,7 @@ HTREEITEM insertItemUTF8 (HWND hwnd, const char *textUtf8, HTREEITEM hParent, HT
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
HTREEITEM insertItemUTF8 (HWND hwnd, const char *textUtf8, int nImage, int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter)
|
||||
HTREEITEM insertItemUTF8 (HWND hwnd, const std::string &textUtf8, int nImage, int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter)
|
||||
{
|
||||
ucstring str;
|
||||
str.fromUtf8 (textUtf8);
|
||||
|
@ -970,10 +873,10 @@ HTREEITEM insertItemUTF8 (HWND hwnd, const char *textUtf8, int nImage, int nSele
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool setItemTextUTF8 ( HWND hwnd, HTREEITEM hItem, LPCTSTR lpszItem )
|
||||
bool setItemTextUTF8 ( HWND hwnd, HTREEITEM hItem, const std::string &sitem )
|
||||
{
|
||||
ucstring str;
|
||||
str.fromUtf8 (lpszItem);
|
||||
str.fromUtf8 (sitem);
|
||||
TVITEMW item;
|
||||
item.mask = TVIF_TEXT;
|
||||
item.pszText = (WCHAR*)str.c_str();
|
||||
|
@ -995,8 +898,8 @@ bool isPrimitiveVisible (const NLLIGO::IPrimitive *primitive)
|
|||
|
||||
void CWorldEditorApp::OnFileOpen()
|
||||
{
|
||||
static char BASED_CODE szFilter[] = "NeL World Editor Files (*.worldedit)|*.worldedit|All Files (*.*)|*.*||";
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, "worldedit", TRUE, "worldedit", NULL, 0, szFilter);
|
||||
static TCHAR BASED_CODE szFilter[] = _T("NeL World Editor Files (*.worldedit)|*.worldedit|All Files (*.*)|*.*||");
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("worldedit"), TRUE, _T("worldedit"), NULL, 0, szFilter);
|
||||
if (dialog.DoModal() == IDOK)
|
||||
{
|
||||
CDocument &doc = *getDocument ();
|
||||
|
@ -1024,8 +927,8 @@ void CWorldEditorApp::OnFileSave()
|
|||
|
||||
void CWorldEditorApp::OnFileSaveAs()
|
||||
{
|
||||
static char BASED_CODE szFilter[] = "NeL World Editor Files (*.worldedit)|*.worldedit|All Files (*.*)|*.*||";
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, "worldedit", FALSE, "worldedit", NULL, 0, szFilter);
|
||||
static TCHAR BASED_CODE szFilter[] = _T("NeL World Editor Files (*.worldedit)|*.worldedit|All Files (*.*)|*.*||");
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("worldedit"), FALSE, _T("worldedit"), NULL, 0, szFilter);
|
||||
if (dialog.DoModal() == IDOK)
|
||||
{
|
||||
CWorldEditorDoc &doc = *getDocument ();
|
||||
|
|
|
@ -59,8 +59,8 @@ public:
|
|||
bool yesNoMessage (const char *format, ... );
|
||||
void errorMessage (const char *format, ... );
|
||||
void infoMessage (const char *format, ... );
|
||||
void syntaxError (const char *filename, xmlNodePtr, const char *format, ...);
|
||||
bool getPropertyString (std::string &result, const char *filename, xmlNodePtr xmlNode, const char *propName);
|
||||
void syntaxError (const std::string &filename, xmlNodePtr, const char *format, ...);
|
||||
bool getPropertyString (std::string &result, const std::string &filename, xmlNodePtr xmlNode, const std::string &propName);
|
||||
|
||||
// The image list
|
||||
CImageListEx ImageList;
|
||||
|
@ -110,7 +110,7 @@ public:
|
|||
private:
|
||||
|
||||
// Read the path config file
|
||||
bool initPath (const char *filename, class CSplashScreen &splashScreen);
|
||||
bool initPath (const std::string &filename, class CSplashScreen &splashScreen);
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
|
@ -135,8 +135,8 @@ public:
|
|||
extern CWorldEditorApp theApp;
|
||||
class CMainFrame *getMainFrame ();
|
||||
void invalidateLeftView ();
|
||||
std::string standardizePath (const char *str);
|
||||
std::string formatString (const char *str);
|
||||
std::string standardizePath (const std::string &str);
|
||||
std::string formatString (const std::string &str);
|
||||
inline void transformVector (NLMISC::CVector &toTransform, float angle, const NLMISC::CVector &pivot)
|
||||
{
|
||||
float cosa = (float)cos (angle);
|
||||
|
@ -147,21 +147,17 @@ inline void transformVector (NLMISC::CVector &toTransform, float angle, const NL
|
|||
toTransform.x = temp;
|
||||
toTransform += pivot;
|
||||
}
|
||||
std::string numberize (const char *oldString, uint value);
|
||||
std::string numberize (const std::string &oldString, uint value);
|
||||
bool getZoneNameFromXY (sint32 x, sint32 y, std::string &zoneName);
|
||||
bool openFile (const char *url);
|
||||
uint getRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
|
||||
void setEditTextMultiLine (CEdit &edit, const char *text);
|
||||
void setEditTextMultiLine (CEdit &edit, const std::string &text);
|
||||
void setEditTextMultiLine (CEdit &edit, const std::vector<std::string> &vect);
|
||||
//void setEditTextMultiLine (ColorEditWnd &edit, const char *text);
|
||||
//void setEditTextMultiLine (ColorEditWnd &edit, const std::vector<std::string> &vect);
|
||||
//void setEditTextMultiLine (CListBox &listBox, const char *text);
|
||||
void setEditTextMultiLine (CListBox &listBox, const std::vector<std::string> &vect);
|
||||
bool setWindowTextUTF8 (HWND hwnd, const char *textUtf8);
|
||||
bool getWindowTextUTF8 (HWND hwnd, CString &textUtf8);
|
||||
HTREEITEM insertItemUTF8 (HWND hwnd, const char *textUtf8, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST);
|
||||
HTREEITEM insertItemUTF8 (HWND hwnd, const char *textUtf8, int nImage, int nSelectedImage, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST);
|
||||
bool setItemTextUTF8 ( HWND hwnd, HTREEITEM hItem, LPCTSTR lpszItem );
|
||||
bool setWindowTextUTF8 (HWND hwnd, const std::string &textUtf8);
|
||||
bool getWindowTextUTF8 (HWND hwnd, std::string &textUtf8);
|
||||
HTREEITEM insertItemUTF8 (HWND hwnd, const std::string &textUtf8, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST);
|
||||
HTREEITEM insertItemUTF8 (HWND hwnd, const std::string &textUtf8, int nImage, int nSelectedImage, HTREEITEM hParent = TVI_ROOT, HTREEITEM hInsertAfter = TVI_LAST);
|
||||
bool setItemTextUTF8 ( HWND hwnd, HTREEITEM hItem, const std::string &item );
|
||||
bool isPrimitiveVisible (const NLLIGO::IPrimitive *primitive);
|
||||
|
||||
std::string getTextureFile(const std::string &filename);
|
||||
|
|
|
@ -172,7 +172,7 @@ BOOL CWorldEditorDoc::OnOpenDocument(LPCTSTR lpszPathName)
|
|||
|
||||
// Result
|
||||
newDocument ();
|
||||
bool res = loadDocument (lpszPathName) ? TRUE : FALSE;
|
||||
bool res = loadDocument (tStrToUtf8(lpszPathName)) ? TRUE : FALSE;
|
||||
|
||||
// Timer enabled ?
|
||||
getMainFrame ()->TimerEnabled = true;
|
||||
|
@ -182,7 +182,7 @@ BOOL CWorldEditorDoc::OnOpenDocument(LPCTSTR lpszPathName)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CWorldEditorDoc::loadDocument (const char *filename)
|
||||
bool CWorldEditorDoc::loadDocument (const std::string &filename)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
|
@ -346,7 +346,7 @@ bool CWorldEditorDoc::loadDocument (const char *filename)
|
|||
// Not modified
|
||||
_DataHierarchy[i].Modified = false;
|
||||
|
||||
getMainFrame()->launchLoadingDialog(toString("loading %s", _DataHierarchy[i].Filename.c_str()).c_str());
|
||||
getMainFrame()->launchLoadingDialog("loading " + _DataHierarchy[i].Filename);
|
||||
getMainFrame()->progressLoadingDialog(float(i+0.0001f)/_DataHierarchy.size());
|
||||
// Landscape ?
|
||||
if (_DataHierarchy[i].Type == CDatabaseElement::Landscape)
|
||||
|
@ -504,7 +504,7 @@ BOOL CWorldEditorDoc::OnSaveDocument(LPCTSTR lpszPathName)
|
|||
BOOL result = TRUE;
|
||||
|
||||
// Get path name
|
||||
string path = NLMISC::CFile::getPath (lpszPathName);
|
||||
string path = NLMISC::CFile::getPath (tStrToUtf8(lpszPathName));
|
||||
|
||||
// Backup current path
|
||||
string backupPath = CPath::getCurrentPath ();
|
||||
|
@ -522,7 +522,7 @@ BOOL CWorldEditorDoc::OnSaveDocument(LPCTSTR lpszPathName)
|
|||
{
|
||||
// Make path relative
|
||||
string relativeFileName = _DataHierarchy[i].Filename;
|
||||
CPath::makePathRelative (NLMISC::CFile::getPath (lpszPathName).c_str (), relativeFileName);
|
||||
CPath::makePathRelative (NLMISC::CFile::getPath (tStrToUtf8(lpszPathName)), relativeFileName);
|
||||
if (relativeFileName != _DataHierarchy[i].Filename)
|
||||
{
|
||||
_DataHierarchy[i].Filename = relativeFileName;
|
||||
|
@ -541,10 +541,10 @@ BOOL CWorldEditorDoc::OnSaveDocument(LPCTSTR lpszPathName)
|
|||
// Got a filename ?
|
||||
if (_DataHierarchy[i].Filename.empty ())
|
||||
{
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, "land", FALSE, "land", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "NeL Ligo Landscape Files (*.land)|*.land|All Files (*.*)|*.*||", getMainFrame ());
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("land"), FALSE, _T("land"), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, _T("NeL Ligo Landscape Files (*.land)|*.land|All Files (*.*)|*.*||"), getMainFrame ());
|
||||
if (dialog.DoModal() == IDOK)
|
||||
{
|
||||
_DataHierarchy[i].Filename = dialog.GetPathName();
|
||||
_DataHierarchy[i].Filename = tStrToUtf8(dialog.GetPathName());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -594,10 +594,10 @@ BOOL CWorldEditorDoc::OnSaveDocument(LPCTSTR lpszPathName)
|
|||
// Got a filename ?
|
||||
if (_DataHierarchy[i].Filename.empty ())
|
||||
{
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, "primitive", FALSE, "primitive", NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "NeL Ligo Primitive Files (*.primitive)|*.primitive|All Files (*.*)|*.*||", getMainFrame ());
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("primitive"), FALSE, _T("primitive"), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, _T("NeL Ligo Primitive Files (*.primitive)|*.primitive|All Files (*.*)|*.*||"), getMainFrame ());
|
||||
if (dialog.DoModal() == IDOK)
|
||||
{
|
||||
string pathFromDialog = dialog.GetPathName();
|
||||
string pathFromDialog = tStrToUtf8(dialog.GetPathName());
|
||||
|
||||
// Remove uppercase in filename
|
||||
string::size_type pos = pathFromDialog.rfind ("\\", 0);
|
||||
|
@ -665,7 +665,7 @@ BOOL CWorldEditorDoc::OnSaveDocument(LPCTSTR lpszPathName)
|
|||
{
|
||||
// Save the document
|
||||
COFile file;
|
||||
if (file.open (lpszPathName, false, false, true))
|
||||
if (file.open (tStrToUtf8(lpszPathName), false, false, true))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -708,7 +708,7 @@ BOOL CWorldEditorDoc::OnSaveDocument(LPCTSTR lpszPathName)
|
|||
if (landscape)
|
||||
{
|
||||
node = xmlNewChild ( node, NULL, (const xmlChar*)"PRIMITIVES", NULL);
|
||||
_DataHierarchy[i].Primitives.write (node, lpszPathName);
|
||||
_DataHierarchy[i].Primitives.write (node, tStrToUtf8(lpszPathName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -732,7 +732,7 @@ BOOL CWorldEditorDoc::OnSaveDocument(LPCTSTR lpszPathName)
|
|||
result = FALSE;
|
||||
}
|
||||
|
||||
_LastModifedTime = NLMISC::CFile::getFileModificationDate (lpszPathName);
|
||||
_LastModifedTime = NLMISC::CFile::getFileModificationDate (tStrToUtf8(lpszPathName));
|
||||
}
|
||||
|
||||
// No modification is for this level of undo
|
||||
|
@ -826,11 +826,11 @@ void CWorldEditorDoc::updateModifiedState ()
|
|||
}
|
||||
else
|
||||
{
|
||||
string title = (const char*)GetTitle ();
|
||||
string title = tStrToUtf8(GetTitle ());
|
||||
if ( (title.size ()>=2) && (title[title.size()-1] == '*') && (title[title.size()-2] == ' ') )
|
||||
{
|
||||
title.resize (title.size () - 2);
|
||||
SetTitle (title.c_str());
|
||||
SetTitle (utf8ToTStr(title));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -912,12 +912,12 @@ const string &CWorldEditorDoc::getDataDir () const
|
|||
void CWorldEditorDoc::getFilePath(uint primIndex,string & relativeFileName)
|
||||
{
|
||||
relativeFileName=_DataHierarchy[primIndex].Filename;
|
||||
CPath::makePathRelative ((NLMISC::CFile::getPath ((LPCTSTR)CWorldEditorDoc::GetPathName())).c_str(), relativeFileName);
|
||||
CPath::makePathRelative (NLMISC::CFile::getPath (tStrToUtf8(CWorldEditorDoc::GetPathName())), relativeFileName);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void CWorldEditorDoc::setDataDir (const char *dir)
|
||||
void CWorldEditorDoc::setDataDir (const std::string &dir)
|
||||
{
|
||||
_DataDir = dir;
|
||||
|
||||
|
@ -1444,7 +1444,7 @@ void CWorldEditorDoc::initPrimitiveParameters (const CPrimitiveClass &primClass,
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
const NLLIGO::IPrimitive *CWorldEditorDoc::createPrimitive (const CDatabaseLocator &locator, const char *className, const char *primName,
|
||||
const NLLIGO::IPrimitive *CWorldEditorDoc::createPrimitive (const CDatabaseLocator &locator, const std::string &className, const std::string &primName,
|
||||
const CVector &initPos, float deltaPos,
|
||||
const std::vector<CPrimitiveClass::CInitParameters> &initParameters)
|
||||
{
|
||||
|
@ -1532,12 +1532,12 @@ const NLLIGO::IPrimitive *CWorldEditorDoc::createPrimitive (const CDatabaseLocat
|
|||
if (primClass->Type == CPrimitiveClass::Bitmap)
|
||||
{
|
||||
// Create a dialog file
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("image"), TRUE, primClass->FileExtension.c_str (), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
|
||||
(primClass->FileType+" (*."+primClass->FileExtension+")|*."+primClass->FileExtension+"|All Files (*.*)|*.*||").c_str (), getMainFrame ());
|
||||
CFileDialogEx dialog (BASE_REGISTRY_KEY, _T("image"), TRUE, utf8ToTStr(primClass->FileExtension), NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
|
||||
utf8ToTStr(toString("%s (*.%s)|*.%s|All Files (*.*)|*.*||", primClass->FileType.c_str(), primClass->FileExtension.c_str(), primClass->FileExtension.c_str())), getMainFrame ());
|
||||
if (dialog.DoModal() == IDOK)
|
||||
{
|
||||
// Save filename
|
||||
static_cast<CPrimBitmap*>(primitive)->init (dialog.GetPathName ());
|
||||
static_cast<CPrimBitmap*>(primitive)->init (tStrToUtf8(dialog.GetPathName ()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1728,25 +1728,25 @@ void CWorldEditorDoc::updateFiles ()
|
|||
}
|
||||
|
||||
// Check date
|
||||
if (!checkFileDate (GetPathName (), _LastModifedTime))
|
||||
if (!checkFileDate (tStrToUtf8(GetPathName ()), _LastModifedTime))
|
||||
{
|
||||
// Ask for reloading
|
||||
if (theApp.yesNoMessage ("The file \"%s\" has been modified.\nReload it ?", (const char*)GetPathName ()))
|
||||
if (theApp.yesNoMessage ("The file \"%s\" has been modified.\nReload it ?", tStrToUtf8(GetPathName ()).c_str()))
|
||||
{
|
||||
newDocument ();
|
||||
loadDocument (GetPathName ());
|
||||
loadDocument (tStrToUtf8(GetPathName ()));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the new date
|
||||
_LastModifedTime = NLMISC::CFile::getFileModificationDate ((const char*)GetPathName ());
|
||||
_LastModifedTime = NLMISC::CFile::getFileModificationDate (tStrToUtf8(GetPathName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CWorldEditorDoc::checkFileDate (const char *filename, uint32 date)
|
||||
bool CWorldEditorDoc::checkFileDate (const std::string &filename, uint32 date)
|
||||
{
|
||||
// File exist ?
|
||||
if (!NLMISC::CFile::fileExists (filename))
|
||||
|
|
|
@ -158,7 +158,7 @@ public:
|
|||
void getFilePath(uint primIndex,std::string&);
|
||||
|
||||
// Set the data directory
|
||||
void setDataDir (const char *dir);
|
||||
void setDataDir (const std::string &dir);
|
||||
|
||||
// Get the path of selected primitive
|
||||
const std::string &getPathOfSelectedPrimitive() const;
|
||||
|
@ -263,7 +263,7 @@ private:
|
|||
void insertPrimitive (const CDatabaseLocator &locator, NLLIGO::IPrimitive *primitive);
|
||||
|
||||
// Create a primitive, for actions only
|
||||
const NLLIGO::IPrimitive *createPrimitive (const CDatabaseLocator &locator, const char *className, const char *primName,
|
||||
const NLLIGO::IPrimitive *createPrimitive (const CDatabaseLocator &locator, const std::string &className, const std::string &primName,
|
||||
const NLMISC::CVector &initPos, float deltaPos, const std::vector<NLLIGO::CPrimitiveClass::CInitParameters> &initParameters);
|
||||
|
||||
// Init a primitive parameters
|
||||
|
@ -279,7 +279,7 @@ public:
|
|||
|
||||
// *** File modification
|
||||
void updateFiles ();
|
||||
static bool checkFileDate (const char *filename, uint32 date);
|
||||
static bool checkFileDate(const std::string &filename, uint32 date);
|
||||
|
||||
/* // Get ligo data at a specific locator
|
||||
void getLigoData (CLigoData &data, const CDatabaseLocator &locator);
|
||||
|
@ -294,7 +294,7 @@ public:
|
|||
}
|
||||
|
||||
// Get document context
|
||||
void setContext (const char *context)
|
||||
void setContext (const std::string &context)
|
||||
{
|
||||
_Context = context;
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ public:
|
|||
|
||||
private:
|
||||
bool newDocument ();
|
||||
bool loadDocument (const char *filename);
|
||||
bool loadDocument (const std::string &filename);
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue