mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-22 14:56:13 +00:00
Changed: Replace all _splitpath by NeL methods
This commit is contained in:
parent
83d508bddb
commit
936dbec82c
20 changed files with 126 additions and 252 deletions
|
@ -151,7 +151,7 @@ Value* export_material_cf (Value** arg_list, int count)
|
|||
nlassert (node);
|
||||
|
||||
// The second arg
|
||||
const char *fileName = arg_list[1]->to_string();
|
||||
const std::string fileName = tStrToUtf8(arg_list[1]->to_string());
|
||||
|
||||
// The third arg
|
||||
bool checkOnly = (arg_list[2]->to_bool() != FALSE);
|
||||
|
@ -204,12 +204,7 @@ Value* export_material_cf (Value** arg_list, int count)
|
|||
{
|
||||
|
||||
// Make a name for the zone
|
||||
char drive[512];
|
||||
char dir[512];
|
||||
char name[512];
|
||||
char path[512];
|
||||
_splitpath (fileName, drive, dir, name, NULL);
|
||||
_makepath (path, drive, dir, name, ".zone");
|
||||
std::string path = CFile::getPath(fileName) + CFile::getFilenameWithoutExtension(fileName) + ".zone";
|
||||
|
||||
// Ok ?
|
||||
bool ok = true;
|
||||
|
@ -322,7 +317,7 @@ Value* export_transition_cf (Value** arg_list, int count)
|
|||
nlassert (is_array(nodes));
|
||||
|
||||
// The second arg
|
||||
const char *fileName = arg_list[1]->to_string();
|
||||
std::string fileName = tStrToUtf8(arg_list[1]->to_string());
|
||||
|
||||
// The second arg
|
||||
string matFilename[2];
|
||||
|
@ -505,10 +500,7 @@ Value* export_transition_cf (Value** arg_list, int count)
|
|||
for (zone=0; zone<CTransition::TransitionZoneCount; zone++)
|
||||
{
|
||||
// Final path
|
||||
char path[512];
|
||||
_splitpath (fileName, drive, dir, path, NULL);
|
||||
sprintf (name, "%s-%d", path, zone);
|
||||
_makepath (path, drive, dir, name, ".zone");
|
||||
std::string path = CFile::getPath(fileName) + toString("%s-%u", CFile::getFilenameWithoutExtension(fileName).c_str(), zone) + ".zone";
|
||||
|
||||
// Another the stream
|
||||
COFile outputfile2;
|
||||
|
@ -1072,30 +1064,17 @@ Value* export_zone_cf (Value** arg_list, int count)
|
|||
else
|
||||
{
|
||||
// Build a filename
|
||||
char drive[512];
|
||||
char path[512];
|
||||
char finalpath[512];
|
||||
char name[512];
|
||||
char ext[512];
|
||||
_splitpath (fileName.c_str(), drive, path, name, ext);
|
||||
std::string path = NLMISC::CFile::getPath(fileName);
|
||||
std::string name = NLMISC::CFile::getFilenameWithoutExtension(fileName);
|
||||
|
||||
// Build the zone filename
|
||||
char outputFilenameZone[512];
|
||||
strcpy (finalpath, path);
|
||||
strcat (finalpath, "zones\\");
|
||||
_makepath (outputFilenameZone, drive, finalpath, name, ".zone");
|
||||
std::string outputFilenameZone = path + "zones/" + name + ".zone";
|
||||
|
||||
// Build the snap shot filename
|
||||
char outputFilenameSnapShot[512];
|
||||
strcpy (finalpath, path);
|
||||
strcat (finalpath, "zoneBitmaps\\");
|
||||
_makepath (outputFilenameSnapShot, drive, finalpath, name, ".tga");
|
||||
std::string outputFilenameSnapShot = path + "zonesBitmaps/" + name + ".tga";
|
||||
|
||||
// Build the ligozone filename
|
||||
char outputFilenameLigozone[512];
|
||||
strcpy (finalpath, path);
|
||||
strcat (finalpath, "zoneLigos\\");
|
||||
_makepath (outputFilenameLigozone, drive, finalpath, name, ".ligozone");
|
||||
std::string outputFilenameLigozone = path + "zoneLigos/" + name + ".ligozone";
|
||||
|
||||
// Build the zone
|
||||
CZone zone;
|
||||
|
@ -1179,12 +1158,12 @@ Value* export_zone_cf (Value** arg_list, int count)
|
|||
if (weWantToMakeASnapshot)
|
||||
{
|
||||
CIFile fileFarBank;
|
||||
char drive[512];
|
||||
char path[512];
|
||||
char name[512];
|
||||
char farBankPathName[512];
|
||||
_splitpath (GetBankPathName ().c_str (), drive, path, name, NULL);
|
||||
_makepath (farBankPathName, drive, path, name, "farbank");
|
||||
|
||||
std::string path = NLMISC::CFile::getPath(GetBankPathName());
|
||||
std::string name = NLMISC::CFile::getFilenameWithoutExtension(GetBankPathName());
|
||||
|
||||
std::string farBankPathName = path + name + ".farbank";
|
||||
|
||||
if (fileFarBank.open (farBankPathName))
|
||||
{
|
||||
// Create an xml stream
|
||||
|
@ -1908,11 +1887,9 @@ Value* make_snapshot_cf (Value** arg_list, int count)
|
|||
else
|
||||
{
|
||||
// Build a filename
|
||||
char drivetga[512];
|
||||
char pathtga[512];
|
||||
char nametga[512];
|
||||
char exttga[512];
|
||||
_splitpath (fileName.c_str(), drivetga, pathtga, nametga, exttga);
|
||||
std::string nametga = CFile::getFilenameWithoutExtension(fileName);
|
||||
std::string pathtga = CFile::getPath(fileName);
|
||||
|
||||
|
||||
// Build the zone
|
||||
CZone zone;
|
||||
|
@ -1956,12 +1933,9 @@ Value* make_snapshot_cf (Value** arg_list, int count)
|
|||
if (tileBank != NULL)
|
||||
{
|
||||
CIFile fileFarBank;
|
||||
char drive[512];
|
||||
char path[512];
|
||||
char name[512];
|
||||
char farBankPathName[512];
|
||||
_splitpath (GetBankPathName ().c_str (), drive, path, name, NULL);
|
||||
_makepath (farBankPathName, drive, path, name, "farbank");
|
||||
std::string name = CFile::getFilenameWithoutExtension(GetBankPathName());
|
||||
std::string farBankPathName = CFile::getPath(GetBankPathName()) + name + ".farbank";
|
||||
|
||||
if (fileFarBank.open (farBankPathName))
|
||||
{
|
||||
// Create an xml stream
|
||||
|
@ -1974,8 +1948,7 @@ Value* make_snapshot_cf (Value** arg_list, int count)
|
|||
if (MakeSnapShot (snapshot, *tileBank, *tileFarBank, xMin, xMax, yMin, yMax, config, errorInDialog))
|
||||
{
|
||||
// Build the snap shot filename
|
||||
char outputFilenameSnapShot[512];
|
||||
_makepath (outputFilenameSnapShot, drivetga, pathtga, nametga, ".tga");
|
||||
std::string outputFilenameSnapShot = pathtga + nametga + ".tga";
|
||||
|
||||
// Output the snap shot
|
||||
COFile outputSnapShot;
|
||||
|
@ -2014,12 +1987,14 @@ Value* make_snapshot_cf (Value** arg_list, int count)
|
|||
bankElm.addCategory (strlwr (categories[j].first), strlwr (categories[j].second));
|
||||
}
|
||||
|
||||
// Catch exception
|
||||
#if 0
|
||||
// Write the zone
|
||||
COFile outputLigoZone;
|
||||
std::string outputFilenameSnapShot = pathtga + nametga + ".tga";
|
||||
_makepath (outputFilenameSnapShot, drivetga, pathtga, nametga, ".ligozone");
|
||||
|
||||
// Catch exception
|
||||
/*try
|
||||
try
|
||||
{
|
||||
// Open the selected zone file
|
||||
if (outputLigoZone.open (outputFilenameSnapShot))
|
||||
|
@ -2048,7 +2023,8 @@ Value* make_snapshot_cf (Value** arg_list, int count)
|
|||
char tmp[512];
|
||||
smprintf (tmp, 512, "Error while loading the file %s : %s", fileName, e.what());
|
||||
CMaxToLigo::errorMessage (tmp, "NeL Ligo export zone", *MAXScript_interface, errorInDialog);
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -262,8 +262,7 @@ void CAnimationSetDlg::refresh (BOOL update)
|
|||
for (i=0; i<object->Saved.AnimationFileName.size(); i++)
|
||||
{
|
||||
// Get the animation name
|
||||
char name[512];
|
||||
_splitpath (object->Saved.AnimationFileName[i].c_str(), NULL, NULL, name, NULL);
|
||||
std::string name = NLMISC::CFile::getFilenameWithoutExtension(object->Saved.AnimationFileName[i]);
|
||||
|
||||
// Get the animation pointer
|
||||
CAnimation *anim = object->AnimationSet.getAnimation (object->AnimationSet.getAnimationIdByName (name));
|
||||
|
@ -314,8 +313,7 @@ void CAnimationSetDlg::refresh (BOOL update)
|
|||
for (i=0; i<object->Saved.SWTFileName.size(); i++)
|
||||
{
|
||||
// Get the animation name
|
||||
char name[512];
|
||||
_splitpath (object->Saved.SWTFileName[i].c_str(), NULL, NULL, name, NULL);
|
||||
std::string name = NLMISC::CFile::getFilenameWithoutExtension(object->Saved.SWTFileName[i]);
|
||||
|
||||
// Get the animation pointer
|
||||
CSkeletonWeight *swt = object->AnimationSet.getSkeletonWeight (object->AnimationSet.getSkeletonWeightIdByName (name));
|
||||
|
|
|
@ -84,21 +84,9 @@ bool CEditMorphMeshDlg::getShapeNameFromDlg(std::string &name)
|
|||
CFileDialog fd(TRUE, _T(".shape"), _T("*.shape"), 0, NULL, this);
|
||||
if (fd.DoModal() == IDOK)
|
||||
{
|
||||
// Add to the path
|
||||
/*
|
||||
char drive[256];
|
||||
char dir[256];
|
||||
char path[256];
|
||||
char fname[256];
|
||||
char ext[256];
|
||||
*/
|
||||
|
||||
|
||||
// Add search path for the texture
|
||||
/*
|
||||
_splitpath (fd.GetPathName(), drive, dir, fname, ext);
|
||||
_makepath (path, drive, dir, NULL, NULL);
|
||||
NLMISC::CPath::addSearchPath (path);
|
||||
NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(tStrToUtf8(fd.GetPathName()));
|
||||
*/
|
||||
|
||||
name = tStrToUtf8(fd.GetPathName());
|
||||
|
|
|
@ -94,22 +94,17 @@ void CMeshDlg::OnBrowseShape()
|
|||
if (fd.DoModal() == IDOK)
|
||||
{
|
||||
// Add to the path
|
||||
char drive[256];
|
||||
char dir[256];
|
||||
char path[256];
|
||||
char fname[256];
|
||||
char ext[256];
|
||||
|
||||
std::string fullPath = tStrToUtf8(fd.GetPathName());
|
||||
std::string fname = NLMISC::CFile::getFilenameWithoutExtension(fullPath);
|
||||
std::string ext = NLMISC::CFile::getExtension(fullPath);
|
||||
|
||||
// Add search path for the texture
|
||||
_splitpath (fd.GetPathName(), drive, dir, fname, ext);
|
||||
_makepath (path, drive, dir, NULL, NULL);
|
||||
NLMISC::CPath::addSearchPath (path);
|
||||
NLMISC::CPath::addSearchPath (NLMISC::CFile::getPath(fullPath));
|
||||
|
||||
try
|
||||
{
|
||||
_ShapeParticle->setShape(std::string(fname) + ext);
|
||||
m_ShapeName = (std::string(fname) + ext).c_str();
|
||||
_ShapeParticle->setShape(fname + "." + ext);
|
||||
m_ShapeName = utf8ToTStr(fname + "." + ext);
|
||||
touchPSState();
|
||||
}
|
||||
catch (const NLMISC::Exception &e)
|
||||
|
|
|
@ -111,15 +111,13 @@ void regsiterOVPath ()
|
|||
if (!hModule) { ::MessageBox(NULL, "'hModule' failed at '" __FUNCTION__ "' in file '" __FILE__ " on line " NL_MACRO_TO_STR(__LINE__), "NeL Export", MB_OK | MB_ICONERROR); return; }
|
||||
char sModulePath[256];
|
||||
int res = GetModuleFileName(hModule, sModulePath, 256);
|
||||
if (!res) { ::MessageBox(NULL, "'res' failed at '" __FUNCTION__ "' in file '" __FILE__ " on line " NL_MACRO_TO_STR(__LINE__), "NeL Export", MB_OK | MB_ICONERROR); return; }
|
||||
char SDrive[512];
|
||||
char SDir[512];
|
||||
_splitpath (sModulePath, SDrive, SDir, NULL, NULL);
|
||||
_makepath (sModulePath, SDrive, SDir, "object_viewer", ".cfg");
|
||||
if (!res) { ::MessageBox(NULL, _T("'res' failed at '") __FUNCTION__ _T("' in file '") __FILE__ _T(" on line ") NL_MACRO_TO_STR(__LINE__), _T("NeL Export"), MB_OK | MB_ICONERROR); return; }
|
||||
|
||||
std::string modulePath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)) + "object_viewer.cfg";
|
||||
|
||||
// Load the config file
|
||||
CConfigFile cf;
|
||||
cf.load (sModulePath);
|
||||
cf.load (modulePath);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -1142,22 +1142,6 @@ int CExportNel::getVertMapChannel (Texmap& texmap, Matrix3& channelMatrix, TimeV
|
|||
// get the absolute or relative path from a texture filename
|
||||
static std::string ConvertTexFileName(const std::string &path, bool _AbsolutePath)
|
||||
{
|
||||
/*// File name, maxlen 256 under windows
|
||||
char sFileName[512];
|
||||
strcpy (sFileName, src);
|
||||
|
||||
// Let absolute path ?
|
||||
if (!_AbsolutePath)
|
||||
{
|
||||
// Decompose bitmap file name
|
||||
char sName[256];
|
||||
char sExt[256];
|
||||
_splitpath (sFileName, NULL, NULL, sName, sExt);
|
||||
|
||||
// Make the final path
|
||||
_makepath (sFileName, NULL, NULL, sName, sExt);
|
||||
}
|
||||
return std::string(sFileName);*/
|
||||
if (_AbsolutePath)
|
||||
{
|
||||
return path;
|
||||
|
|
|
@ -561,13 +561,10 @@ std::string CExportNel::getNelObjectName (INode& node)
|
|||
ad = obj->GetAppDataChunk (MAXSCRIPT_UTILITY_CLASS_ID, UTILITY_CLASS_ID, NEL3D_APPDATA_INSTANCE_SHAPE);
|
||||
if (ad&&ad->data)
|
||||
{
|
||||
if (::strlen((const char *) ad->data) != 0)
|
||||
if (_tcslen((const TCHAR *) ad->data) != 0)
|
||||
{
|
||||
// get file name only
|
||||
char fName[_MAX_FNAME];
|
||||
char ext[_MAX_FNAME];
|
||||
::_splitpath((const char*)ad->data, NULL, NULL, fName, ext) ;
|
||||
return std::string(fName + std::string(ext));
|
||||
return NLMISC::CFile::getFilename(tStrToUtf8((const TCHAR*)ad->data));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -4058,20 +4058,18 @@ bool loadLigoConfigFile (CLigoConfig& config, Interface& it)
|
|||
if (hModule)
|
||||
{
|
||||
// Get the path
|
||||
char sModulePath[256];
|
||||
TCHAR sModulePath[256];
|
||||
int res=GetModuleFileName(hModule, sModulePath, 256);
|
||||
// Success ?
|
||||
if (res)
|
||||
{
|
||||
// Path
|
||||
char sDrive[256];
|
||||
char sDir[256];
|
||||
_splitpath (sModulePath, sDrive, sDir, NULL, NULL);
|
||||
_makepath (sModulePath, sDrive, sDir, "ligoscape", ".cfg");
|
||||
std::string modulePath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath));
|
||||
|
||||
try
|
||||
{
|
||||
// Load the config file
|
||||
config.readConfigFile (sModulePath, false);
|
||||
config.readConfigFile (modulePath, false);
|
||||
// ok
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -409,24 +409,17 @@ void LoadKeyCfg ()
|
|||
HMODULE hModule = hInstance;
|
||||
if (hModule)
|
||||
{
|
||||
char sModulePath[256];
|
||||
TCHAR sModulePath[256];
|
||||
int res=GetModuleFileName(hModule, sModulePath, 256);
|
||||
if (res)
|
||||
{
|
||||
// split path
|
||||
char drive[256];
|
||||
char dir[256];
|
||||
_splitpath (sModulePath, drive, dir, NULL, NULL);
|
||||
|
||||
// Make a new path
|
||||
char cgfPath[256];
|
||||
_makepath (cgfPath, drive, dir, "keys", ".cfg");
|
||||
|
||||
std::string cfgPath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)) + "keys.cfg";
|
||||
|
||||
CConfigFile cf;
|
||||
|
||||
// Load and parse "test.txt" file
|
||||
cf.load (cgfPath);
|
||||
cf.load (cfgPath);
|
||||
|
||||
// For each keys
|
||||
for (uint key=0; key<KeyCounter; key++)
|
||||
|
@ -458,23 +451,18 @@ void LoadVarCfg ()
|
|||
HMODULE hModule = hInstance;
|
||||
if (hModule)
|
||||
{
|
||||
char sModulePath[256];
|
||||
TCHAR sModulePath[256];
|
||||
int res=GetModuleFileName(hModule, sModulePath, 256);
|
||||
if (res)
|
||||
{
|
||||
// split path
|
||||
char drive[256];
|
||||
char dir[256];
|
||||
_splitpath (sModulePath, drive, dir, NULL, NULL);
|
||||
|
||||
// Make a new path
|
||||
char cgfPath[256];
|
||||
_makepath (cgfPath, drive, dir, "keys", ".cfg");
|
||||
std::string cfgPath = NLMISC::CFile::getPath(tStrToUtf8(sModulePath)) + "keys.cfg";
|
||||
|
||||
CConfigFile cf;
|
||||
|
||||
// Load and parse "test.txt" file
|
||||
cf.load (cgfPath);
|
||||
cf.load (cfgPath);
|
||||
|
||||
// go
|
||||
try
|
||||
|
|
|
@ -366,18 +366,15 @@ void Tile_utility::SetupUI ()
|
|||
if (Bank.getLandCount())
|
||||
{
|
||||
// Button text
|
||||
char sName[256];
|
||||
_splitpath (Path.c_str(), NULL, NULL, sName, NULL);
|
||||
char *sName2=sName;
|
||||
if (*sName2)
|
||||
*sName2=toupper (*sName2);
|
||||
sName2++;
|
||||
while (*sName2)
|
||||
std::string name = toLower(NLMISC::CFile::getFilenameWithoutExtension(Path));
|
||||
|
||||
if (!name.empty())
|
||||
{
|
||||
*sName2=tolower (*sName2);
|
||||
sName2++;
|
||||
std::string upName = toUpper(name);
|
||||
name[0] = upName[0];
|
||||
}
|
||||
SetWindowText (hwnd, sName);
|
||||
|
||||
SetWindowText (hwnd, utf8ToTStr(name));
|
||||
|
||||
// Static text
|
||||
TCHAR sTmp[256];
|
||||
|
|
|
@ -889,11 +889,11 @@ void Browse::OnBatchLoad ()
|
|||
|
||||
if (sFile.DoModal()==IDOK)
|
||||
{
|
||||
char sDrive[256];
|
||||
char sPath[256];
|
||||
char sName[256];
|
||||
char sExt[256];
|
||||
_splitpath (sFile.GetPathName(), sDrive, sPath, sName, sExt);
|
||||
std::string fullPath = tStrToUtf8(sFile.GetPathName());
|
||||
|
||||
std::string path = NLMISC::CFile::getPath(fullPath);
|
||||
std::string filename = NLMISC::CFile::getFilenameWithoutExtension(fullPath);
|
||||
std::string ext = NLMISC::CFile::getExtension(fullPath);
|
||||
|
||||
// look for some numbers..
|
||||
char *sNumber=sName+strlen(sName)-1;
|
||||
|
@ -925,11 +925,9 @@ void Browse::OnBatchLoad ()
|
|||
for (int rot=0; rot<4; rot++)
|
||||
{
|
||||
// Try to load a tile with a file name like /tiletransition0.tga
|
||||
char sName2[256];
|
||||
char sFinal[256];
|
||||
sprintf (sName2, "%s%02d", sName, (int)transition);
|
||||
_makepath (sFinal, sDrive, sPath, sName2, sExt);
|
||||
FILE *pFile=fopen (sFinal, "rb");
|
||||
std::string sFinal = path + toString("%s%02d.%s", filename.c_str(), (int)transition, ext.c_str());
|
||||
|
||||
FILE *pFile = nlfopen (sFinal, "rb");
|
||||
|
||||
// Close the file and add the tile if opened
|
||||
if (pFile)
|
||||
|
@ -961,11 +959,9 @@ void Browse::OnBatchLoad ()
|
|||
if (tileBank2.getTile (trans->getTile())->getRelativeFileName (m_ctrl.Texture==1?CTile::diffuse:CTile::additive).empty())
|
||||
{
|
||||
// Try to load a tile with a file name like /tiletransition0.tga
|
||||
char sName2[256];
|
||||
char sFinal[256];
|
||||
sprintf (sName2, "%s%02d", sName, (int)transition);
|
||||
_makepath (sFinal, sDrive, sPath, sName2, sExt);
|
||||
FILE *pFile=fopen (sFinal, "rb");
|
||||
std::string sFinal = path + toString("%s%02d.%s", filename.c_str(), (int)transition, ext.c_str());
|
||||
|
||||
FILE *pFile = nlfopen (sFinal, "rb");
|
||||
|
||||
// Close the file and add the tile if opened
|
||||
if (pFile)
|
||||
|
|
|
@ -386,12 +386,8 @@ void SelectionTerritoire::OnSelect()
|
|||
list2->AddString(tileBank.getTileSet(i)->getName().c_str());
|
||||
}
|
||||
|
||||
char drive[256],name[256],path[256],ext[256];
|
||||
_splitpath(temp,drive,path,name,ext);
|
||||
MainFileName = name;
|
||||
MainFileName += ext;
|
||||
DefautPath = drive;
|
||||
DefautPath += path;
|
||||
MainFileName = CString(utf8ToTStr(NLMISC::CFile::getFilename(temp)));
|
||||
DefautPath = CString(utf8ToTStr(NLMISC::CFile::getPath(temp)));
|
||||
|
||||
MainFileOk = 1;
|
||||
CButton *button = (CButton*)GetDlgItem(IDC_ADD_TERRITOIRE);
|
||||
|
@ -468,12 +464,10 @@ void SelectionTerritoire::OnSaveAs()
|
|||
button->EnableWindow(true);
|
||||
|
||||
// Create a file name
|
||||
char drive[256],name[256],path[256],ext[256];
|
||||
_splitpath(sFile.GetPathName(), drive, path, name, ext);
|
||||
MainFileName = name;
|
||||
MainFileName += ext;
|
||||
DefautPath = drive;
|
||||
DefautPath += path;
|
||||
std::string temp = tStrToUtf8(sFile.GetPathName());
|
||||
|
||||
MainFileName = CString(utf8ToTStr(NLMISC::CFile::getFilename(temp)));
|
||||
DefautPath = CString(utf8ToTStr(NLMISC::CFile::getPath(temp)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1283,11 +1283,10 @@ void CTView::DrawTile(tilelist::iterator i,CDC *pDC,int clear, int n)
|
|||
&*bits->begin(),bmpinf,DIB_RGB_COLORS,SRCCOPY);
|
||||
}
|
||||
|
||||
char temp[100];
|
||||
char Name[256]; Name[0] = 0;
|
||||
std::string Name;
|
||||
if (InfoTexte==2)
|
||||
{
|
||||
_splitpath(pth.c_str(),temp,temp,Name,temp);
|
||||
Name = NLMISC::CFile::getFilenameWithoutExtension(pth);
|
||||
}
|
||||
else if (InfoTexte==3)
|
||||
{
|
||||
|
@ -1295,12 +1294,20 @@ void CTView::DrawTile(tilelist::iterator i,CDC *pDC,int clear, int n)
|
|||
}
|
||||
else if (InfoTexte==1)
|
||||
{
|
||||
sprintf(Name,"%d",i->id);
|
||||
Name = NLMISC::toString("%d", i->id);
|
||||
}
|
||||
rect_txt.top = pt.y + sizetile_y + spacing_tile_text;
|
||||
rect_txt.bottom += rect_txt.top + sizetext_y;
|
||||
rect_txt.left -= spacing_x;
|
||||
pDC->DrawText(Name,(int)strlen(Name),&rect_txt,DT_CENTER | DT_SINGLELINE);
|
||||
|
||||
#ifdef _UNICODE
|
||||
ucstring tmp;
|
||||
tmp.fromUtf8(Name);
|
||||
#else
|
||||
std::string tmp = Name;
|
||||
#endif
|
||||
|
||||
pDC->DrawText((LPCTSTR)tmp.c_str(), (int)tmp.length(), &rect_txt,DT_CENTER | DT_SINGLELINE);
|
||||
|
||||
// Restore the device context
|
||||
pDC->SetBkColor( clrBk );
|
||||
|
@ -1537,15 +1544,12 @@ LRESULT CTView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
CString str = load.GetNextPathName(p);
|
||||
|
||||
char sDrive[256];
|
||||
char sPath[256];
|
||||
_splitpath (str, sDrive, sPath, NULL, NULL);
|
||||
LastPath=string (sDrive)+string (sPath);
|
||||
LastPath = NLMISC::CFile::getPath(tStrToUtf8(str));
|
||||
|
||||
if (str!=CString(""))
|
||||
if (!str.IsEmpty())
|
||||
{
|
||||
int index=0;
|
||||
const char *pathname = (LPCTSTR)str;
|
||||
std::string pathname = tStrToUtf8(str);
|
||||
|
||||
// Add mode, to the end of the list
|
||||
if (id==ID_MENU_ADD)
|
||||
|
|
|
@ -420,19 +420,17 @@ void CDfnEditListCtrl::onItemChanged (uint item, uint subItem)
|
|||
{
|
||||
CString str;
|
||||
str = Dialog->Struct.ListCtrl.GetItemText (item, 2);
|
||||
char ext[MAX_PATH];
|
||||
_splitpath (str, NULL, NULL, NULL, ext);
|
||||
if (stricmp (ext, ".typ") != 0)
|
||||
Dialog->Struct.ListCtrl.SetItemText (item, 2, theApp.DefaultType.c_str ());
|
||||
std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(str));
|
||||
if (ext == "typ")
|
||||
Dialog->Struct.ListCtrl.SetItemText (item, 2, utf8ToTStr(theApp.DefaultType));
|
||||
}
|
||||
else if ((type == "Dfn") || (type == "Dfn array"))
|
||||
{
|
||||
CString str;
|
||||
str = Dialog->Struct.ListCtrl.GetItemText (item, 2);
|
||||
char ext[MAX_PATH];
|
||||
_splitpath (str, NULL, NULL, NULL, ext);
|
||||
if (stricmp (ext, ".dfn") != 0)
|
||||
Dialog->Struct.ListCtrl.SetItemText (item, 2, theApp.DefaultDfn.c_str ());
|
||||
std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(str));
|
||||
if (ext == "dfn")
|
||||
Dialog->Struct.ListCtrl.SetItemText (item, 2, utf8ToTStr(theApp.DefaultDfn));
|
||||
|
||||
// Clear default value
|
||||
Dialog->Struct.ListCtrl.SetItemText (item, 3, _T(""));
|
||||
|
|
|
@ -403,11 +403,9 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
|||
return stricmp (pItemInfo1->displayName.c_str(), pItemInfo2->displayName.c_str());
|
||||
if (pfileTreeCtrl->_ArrangeMode == CFileTreeCtrl::ByType)
|
||||
{
|
||||
char ext1[_MAX_EXT];
|
||||
_splitpath (pItemInfo1->displayName.c_str(), NULL, NULL, NULL, ext1);
|
||||
char ext2[_MAX_EXT];
|
||||
_splitpath (pItemInfo2->displayName.c_str(), NULL, NULL, NULL, ext2);
|
||||
int res = stricmp (ext1, ext2);
|
||||
std::string ext1 = NLMISC::CFile::getExtension(pItemInfo1->displayName);
|
||||
std::string ext2 = NLMISC::CFile::getExtension(pItemInfo2->displayName);
|
||||
int res = stricmp (ext1.c_str(), ext2.c_str());
|
||||
if ( res == 0)
|
||||
return stricmp (pItemInfo1->displayName.c_str(), pItemInfo2->displayName.c_str());
|
||||
else
|
||||
|
|
|
@ -1173,9 +1173,7 @@ void CFormDialog::getDfnName (string &result) const
|
|||
{
|
||||
// Get the DFN filename
|
||||
CString str = doc->GetPathName ();
|
||||
char extension[512];
|
||||
_splitpath (str, NULL, NULL, NULL, extension);
|
||||
result = (*extension == '.') ? extension+1 : extension;
|
||||
result NLMISC::CFile::getExtension(tStrToUtf8(str));
|
||||
}
|
||||
else
|
||||
result.clear();
|
||||
|
|
|
@ -485,12 +485,7 @@ void CGeorgesEditApp::outputError (const char* message)
|
|||
void CGeorgesEditApp::getConfigFilePath (std::string &output)
|
||||
{
|
||||
// Get the config file path
|
||||
char sDrive[MAX_PATH];
|
||||
char sDir[MAX_PATH];
|
||||
char sPath[MAX_PATH];
|
||||
_splitpath (theApp.ExePath.c_str (), sDrive, sDir, NULL, NULL);
|
||||
_makepath (sPath, sDrive, sDir, "georges", ".cfg");
|
||||
output = sPath;
|
||||
output = NLMISC::CFile::getPath(theApp.ExePath) + "georges.cfg";
|
||||
}
|
||||
|
||||
bool CGeorgesEditApp::loadCfg ()
|
||||
|
@ -962,12 +957,7 @@ void CGeorgesEditApp::gotoURL (LPCTSTR url)
|
|||
|
||||
void CGeorgesEditApp::WinHelp(DWORD dwData, UINT nCmd)
|
||||
{
|
||||
char drive[512];
|
||||
char dir[512];
|
||||
char path[512];
|
||||
_splitpath (ExePath.c_str (), drive, dir, NULL, NULL);
|
||||
_makepath (path, drive, dir, "georges_edit", ".html");
|
||||
gotoURL (path);
|
||||
gotoURL(utf8ToTStr(NLMISC::CFile::getPath(ExePath) + "georges_edit.html"));
|
||||
}
|
||||
|
||||
void CGeorgesEditApp::OnViewRefresh()
|
||||
|
@ -1478,9 +1468,8 @@ BOOL CGeorgesEditApp::OnDDECommand(LPTSTR lpszCommand)
|
|||
name = name.substr (6, name.size ()-8);
|
||||
|
||||
// Get the extension
|
||||
char ext[MAX_PATH];
|
||||
_splitpath (name.c_str (), NULL, NULL, NULL, ext);
|
||||
string dfnName = string (ext+1) + ".dfn";
|
||||
std::string ext = NLMISC::CFile::getExtension(name);
|
||||
string dfnName = ext + ".dfn";
|
||||
|
||||
// Get the doc template
|
||||
CMultiDocTemplate *docTemplate = getFormDocTemplate (dfnName.c_str ());
|
||||
|
@ -1541,18 +1530,15 @@ BOOL CGeorgesEditApp::OnDDECommand(LPTSTR lpszCommand)
|
|||
name = name.substr (8, name.size ()-10);
|
||||
|
||||
// Get the extension
|
||||
char ext[MAX_PATH];
|
||||
_splitpath (name.c_str (), NULL, NULL, NULL, ext);
|
||||
string dfnName = string (ext+1) + ".dfn";
|
||||
std::string ext = NLMISC::CFile::getExtension(name);
|
||||
string dfnName = ext + ".dfn";
|
||||
|
||||
// Create a document
|
||||
CGeorgesEditDocForm *doc = (CGeorgesEditDocForm*)createDocument (dfnName.c_str (), "");
|
||||
if (doc)
|
||||
{
|
||||
char nameFile[MAX_PATH];
|
||||
char extFile[MAX_PATH];
|
||||
_splitpath (name.c_str (), NULL, NULL, nameFile, extFile);
|
||||
doc->addParent ((string (nameFile) + extFile).c_str ());
|
||||
std::string nameFile = NLMISC::CFile::getFilename(name);
|
||||
doc->addParent (nameFile.c_str());
|
||||
doc->updateDocumentStructure ();
|
||||
doc->UpdateAllViews (NULL);
|
||||
}
|
||||
|
@ -1570,11 +1556,7 @@ BOOL CGeorgesEditApp::OnDDECommand(LPTSTR lpszCommand)
|
|||
name = name.substr (10, name.size ()-12);
|
||||
|
||||
// Get the extension
|
||||
char name2[MAX_PATH];
|
||||
char ext[MAX_PATH];
|
||||
_splitpath (name.c_str (), NULL, NULL, name2, ext);
|
||||
string dfnName = name2;
|
||||
dfnName += ext;
|
||||
std::string dfnName = NLMISC::CFile::getFilename(name);
|
||||
|
||||
// Create a document
|
||||
CGeorgesEditDocForm *doc = (CGeorgesEditDocForm*)createDocument (dfnName.c_str (), "");
|
||||
|
|
|
@ -181,13 +181,9 @@ bool CGeorgesEditDocForm::initDocument (const char *dfnName, bool newElement)
|
|||
}
|
||||
|
||||
// Set file name and title
|
||||
char name[512];
|
||||
char ext[512];
|
||||
_splitpath (dfnName, NULL, NULL, name, ext);
|
||||
string name2 = (const char*)(name);
|
||||
name2 = strlwr (name2);
|
||||
SetPathName ( ("*."+name2).c_str(), FALSE);
|
||||
SetTitle ( ("New "+name2+" form").c_str() );
|
||||
std::string name2 = toLower(NLMISC::CFile::getFilenameWithoutExtension(dfnName));
|
||||
SetPathName (utf8ToTStr("*." + name2), FALSE);
|
||||
SetTitle (utf8ToTStr("New " + name2 + " form"));
|
||||
|
||||
// TMp
|
||||
if (newElement)
|
||||
|
@ -547,9 +543,9 @@ BOOL CGeorgesEditDoc::OnOpenDocument(LPCTSTR lpszPathName)
|
|||
try
|
||||
{
|
||||
// Check form
|
||||
char ext[MAX_PATH];
|
||||
_splitpath (lpszPathName, NULL, NULL, NULL, ext);
|
||||
string extLower = strlwr (string (ext));
|
||||
std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(lpszPathName));
|
||||
string extLower = toLower(ext);
|
||||
|
||||
if (!extLower.empty ())
|
||||
{
|
||||
string dfnName = extLower.substr (1, string::npos) + ".dfn";
|
||||
|
@ -1090,10 +1086,7 @@ void CGeorgesEditDoc::getDfnFilename (std::string &dfnName)
|
|||
|
||||
// Get the DFN filename
|
||||
CString str = GetPathName ();
|
||||
char extension[512];
|
||||
_splitpath (str, NULL, NULL, NULL, extension);
|
||||
dfnName = extension+1;
|
||||
dfnName += ".dfn";
|
||||
dfnName = NLMISC::CFile::getExtension(tStrToUtf8(str)) + ".dfn";
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -103,10 +103,8 @@ void CImageListEx::addResourceIcon (const char *filename)
|
|||
index = ImageList.Replace( index, handle);
|
||||
|
||||
// Add in the map
|
||||
char name[MAX_PATH];
|
||||
_splitpath (filename, NULL, NULL, name, NULL);
|
||||
string llwr = strlwr (string (name));
|
||||
_IconMapString.insert (std::map<string, int>::value_type (llwr, index));
|
||||
std::string name = NLMISC::CFile::getFilenameWithoutExtension(filename);
|
||||
_IconMapString.insert (std::map<string, int>::value_type (toLower(name), index));
|
||||
|
||||
// Release the icon
|
||||
DestroyIcon (handle);
|
||||
|
@ -131,10 +129,8 @@ int CImageListEx::getImage (int resource) const
|
|||
|
||||
int CImageListEx::getImage (const char *filename) const
|
||||
{
|
||||
char name[MAX_PATH];
|
||||
_splitpath (filename, NULL, NULL, name, NULL);
|
||||
string llwr = strlwr (string (name));
|
||||
std::map<string, int>::const_iterator ite = _IconMapString.find (llwr);
|
||||
std::string name = toLower(NLMISC::CFile::getFilenameWithoutExtension(filename));
|
||||
std::map<string, int>::const_iterator ite = _IconMapString.find (name);
|
||||
if (ite == _IconMapString.end())
|
||||
return -1;
|
||||
else
|
||||
|
|
|
@ -103,10 +103,8 @@ void CImageListEx::addResourceIcon (const char *filename)
|
|||
index = ImageList.Replace( index, handle);
|
||||
|
||||
// Add in the map
|
||||
char name[MAX_PATH];
|
||||
_splitpath (filename, NULL, NULL, name, NULL);
|
||||
string llwr = strlwr (string (name));
|
||||
_IconMapString.insert (std::map<string, int>::value_type (llwr, index));
|
||||
std::string name = toLower(NLMISC::CFile::getFilenameWithoutExtension(filename));
|
||||
_IconMapString.insert (std::map<string, int>::value_type (name, index));
|
||||
|
||||
// Release the icon
|
||||
DestroyIcon (handle);
|
||||
|
@ -131,10 +129,8 @@ int CImageListEx::getImage (int resource) const
|
|||
|
||||
int CImageListEx::getImage (const char *filename) const
|
||||
{
|
||||
char name[MAX_PATH];
|
||||
_splitpath (filename, NULL, NULL, name, NULL);
|
||||
string llwr = strlwr (string (name));
|
||||
std::map<string, int>::const_iterator ite = _IconMapString.find (llwr);
|
||||
std::string name = toLower(NLMISC::CFile::getFilenameWithoutExtension(filename));
|
||||
std::map<string, int>::const_iterator ite = _IconMapString.find (name);
|
||||
if (ite == _IconMapString.end())
|
||||
return -1;
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue