Fixed: Compilation of Tiles Editor MFC version
--HG-- branch : develop
This commit is contained in:
parent
2502e10592
commit
c41b20c9e9
8 changed files with 130 additions and 94 deletions
|
@ -64,8 +64,8 @@ void GetVal::OnOK()
|
||||||
CString rString;
|
CString rString;
|
||||||
EditStr->GetWindowText( rString );
|
EditStr->GetWindowText( rString );
|
||||||
int size = rString.GetLength();
|
int size = rString.GetLength();
|
||||||
name = new char[size+1];
|
name = new TCHAR[size+1];
|
||||||
strcpy (name, rString);
|
_tcscpy(name, rString);
|
||||||
/**((short*)name)=size;
|
/**((short*)name)=size;
|
||||||
EditStr->GetLine(0,name,size);
|
EditStr->GetLine(0,name,size);
|
||||||
for (int i=0;i<size;i++)
|
for (int i=0;i<size;i++)
|
||||||
|
|
|
@ -31,7 +31,7 @@ class GetVal : public CDialog
|
||||||
{
|
{
|
||||||
// Construction
|
// Construction
|
||||||
public:
|
public:
|
||||||
char *name;
|
TCHAR *name;
|
||||||
int NameOk;
|
int NameOk;
|
||||||
GetVal(CWnd* pParent = NULL); // standard constructor
|
GetVal(CWnd* pParent = NULL); // standard constructor
|
||||||
|
|
||||||
|
|
|
@ -98,12 +98,12 @@ void SelectionTerritoire::OnAddTerritoire()
|
||||||
CListBox *list=(CListBox*)GetDlgItem(IDC_LIST_TERRITOIRE);
|
CListBox *list=(CListBox*)GetDlgItem(IDC_LIST_TERRITOIRE);
|
||||||
if (list->FindStringExact(0,GetStr.name)!=LB_ERR)
|
if (list->FindStringExact(0,GetStr.name)!=LB_ERR)
|
||||||
{
|
{
|
||||||
MessageBox(_T("Ce nom existe deja","Error"), MB_ICONERROR);
|
MessageBox(_T("Ce nom existe deja"), _T("Error"), MB_ICONERROR);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
list->InsertString(-1, GetStr.name);
|
list->InsertString(-1, GetStr.name);
|
||||||
tileBank.addLand (GetStr.name);
|
tileBank.addLand (tStrToUtf8(GetStr.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,14 +119,14 @@ private:
|
||||||
virtual void OnInit ()
|
virtual void OnInit ()
|
||||||
{
|
{
|
||||||
UpdateData ();
|
UpdateData ();
|
||||||
char sTitle[512];
|
TCHAR sTitle[512];
|
||||||
sprintf (sTitle, "Tile sets use by %s", tileBank.getLand(_land)->getName().c_str());
|
_stprintf(sTitle, _T("Tile sets use by %s"), utf8ToTStr(tileBank.getLand(_land)->getName()));
|
||||||
SetWindowText (sTitle);
|
SetWindowText (sTitle);
|
||||||
for (int i=0; i<tileBank.getTileSetCount(); i++)
|
for (int i=0; i<tileBank.getTileSetCount(); i++)
|
||||||
{
|
{
|
||||||
m_ctrlCombo.InsertString (-1, tileBank.getTileSet(i)->getName().c_str());
|
m_ctrlCombo.InsertString (-1, utf8ToTStr(tileBank.getTileSet(i)->getName()));
|
||||||
if (tileBank.getLand(_land)->isTileSet (tileBank.getTileSet(i)->getName()))
|
if (tileBank.getLand(_land)->isTileSet (tileBank.getTileSet(i)->getName()))
|
||||||
m_ctrlList.InsertString (-1, tileBank.getTileSet(i)->getName().c_str());
|
m_ctrlList.InsertString (-1, utf8ToTStr(tileBank.getTileSet(i)->getName()));
|
||||||
}
|
}
|
||||||
UpdateData (FALSE);
|
UpdateData (FALSE);
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ private:
|
||||||
{
|
{
|
||||||
CString rString;
|
CString rString;
|
||||||
m_ctrlList.GetText(i, rString);
|
m_ctrlList.GetText(i, rString);
|
||||||
tileBank.getLand(_land)->addTileSet ((const char*)rString);
|
tileBank.getLand(_land)->addTileSet (tStrToUtf8(rString));
|
||||||
}
|
}
|
||||||
UpdateData (FALSE);
|
UpdateData (FALSE);
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ void SelectionTerritoire::OnAddTileSet()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
list->InsertString(-1, GetStr.name);
|
list->InsertString(-1, GetStr.name);
|
||||||
tileBank.addTileSet (GetStr.name);
|
tileBank.addTileSet (tStrToUtf8(GetStr.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,16 +218,18 @@ private:
|
||||||
virtual void OnInit ()
|
virtual void OnInit ()
|
||||||
{
|
{
|
||||||
UpdateData ();
|
UpdateData ();
|
||||||
char sTitle[512];
|
TCHAR sTitle[512];
|
||||||
sprintf (sTitle, "Children of the tile set %s", tileBank.getTileSet(_tileSet)->getName().c_str());
|
_stprintf(sTitle, _T("Children of the tile set %s"), utf8ToTStr(tileBank.getTileSet(_tileSet)->getName()));
|
||||||
SetWindowText (sTitle);
|
SetWindowText (sTitle);
|
||||||
for (int i=0; i<tileBank.getTileSetCount(); i++)
|
for (int i=0; i<tileBank.getTileSetCount(); i++)
|
||||||
{
|
{
|
||||||
if (i!=_tileSet)
|
if (i!=_tileSet)
|
||||||
m_ctrlCombo.InsertString (-1, tileBank.getTileSet(i)->getName().c_str());
|
m_ctrlCombo.InsertString (-1, utf8ToTStr(tileBank.getTileSet(i)->getName()));
|
||||||
|
|
||||||
if (tileBank.getTileSet(_tileSet)->isChild (tileBank.getTileSet(i)->getName()))
|
if (tileBank.getTileSet(_tileSet)->isChild (tileBank.getTileSet(i)->getName()))
|
||||||
m_ctrlList.InsertString (-1, tileBank.getTileSet(i)->getName().c_str());
|
m_ctrlList.InsertString (-1, utf8ToTStr(tileBank.getTileSet(i)->getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateData (FALSE);
|
UpdateData (FALSE);
|
||||||
}
|
}
|
||||||
virtual void OnOk ()
|
virtual void OnOk ()
|
||||||
|
@ -243,7 +245,7 @@ private:
|
||||||
{
|
{
|
||||||
CString rString;
|
CString rString;
|
||||||
m_ctrlList.GetText(i, rString);
|
m_ctrlList.GetText(i, rString);
|
||||||
tileBank.getTileSet(_tileSet)->addChild ((const char*)rString);
|
tileBank.getTileSet(_tileSet)->addChild (tStrToUtf8(rString));
|
||||||
}
|
}
|
||||||
UpdateData (FALSE);
|
UpdateData (FALSE);
|
||||||
}
|
}
|
||||||
|
@ -433,12 +435,12 @@ void SelectionTerritoire::OnSave()
|
||||||
Save (str, tileBank);
|
Save (str, tileBank);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionTerritoire::Save(const char* path, CTileBank &toSave)
|
void SelectionTerritoire::Save(const TCHAR* path, CTileBank &toSave)
|
||||||
{
|
{
|
||||||
// TODO: Add extra validation here
|
// TODO: Add extra validation here
|
||||||
{
|
{
|
||||||
COFile stream;
|
COFile stream;
|
||||||
if (stream.open ((const char*)path))
|
if (stream.open (tStrToUtf8(path)))
|
||||||
{
|
{
|
||||||
toSave.serial (stream);
|
toSave.serial (stream);
|
||||||
}
|
}
|
||||||
|
@ -452,7 +454,7 @@ void SelectionTerritoire::OnSaveAs()
|
||||||
CFileDialog sFile(false, _T("bank"), DefautPath+MainFileName, 0, szFilter, this);
|
CFileDialog sFile(false, _T("bank"), DefautPath+MainFileName, 0, szFilter, this);
|
||||||
if (sFile.DoModal()==IDOK)
|
if (sFile.DoModal()==IDOK)
|
||||||
{
|
{
|
||||||
Save (tStrToUtf8(sFile.GetPathName()).c_str(), tileBank);
|
Save (sFile.GetPathName(), tileBank);
|
||||||
MainFileOk = 1;
|
MainFileOk = 1;
|
||||||
CButton *button = (CButton*)GetDlgItem(IDC_ADD_TERRITOIRE);
|
CButton *button = (CButton*)GetDlgItem(IDC_ADD_TERRITOIRE);
|
||||||
button->EnableWindow(true);
|
button->EnableWindow(true);
|
||||||
|
@ -480,26 +482,25 @@ void SelectionTerritoire::OnCancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckPath (const std::string& path, const char* absolutePathToRemplace)
|
bool CheckPath (const std::string& path, const std::string &absolutePathToRemplace)
|
||||||
{
|
{
|
||||||
// Look for absolute path in path
|
// Look for absolute path in path
|
||||||
if (strnicmp (path.c_str(), absolutePathToRemplace, strlen (absolutePathToRemplace))==0)
|
if (strnicmp(path.c_str(), absolutePathToRemplace.c_str(), absolutePathToRemplace.length()) == 0)
|
||||||
return true;
|
return true;
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemovePath (std::string& path, const char* absolutePathToRemplace)
|
bool RemovePath (std::string& path, const std::string &absolutePathToRemplace)
|
||||||
{
|
{
|
||||||
// Look for absolute path in path
|
// Look for absolute path in path
|
||||||
if (strnicmp (path.c_str(), absolutePathToRemplace, strlen (absolutePathToRemplace))==0)
|
if (strnicmp(path.c_str(), absolutePathToRemplace.c_str(), absolutePathToRemplace.length())==0)
|
||||||
{
|
{
|
||||||
// New path
|
// New path
|
||||||
std::string toto=path;
|
path = path.substr(absolutePathToRemplace.length());
|
||||||
path=toto.c_str()+strlen (absolutePathToRemplace);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,12 +509,12 @@ void SelectionTerritoire::OnPath()
|
||||||
// TODO: Add your control notification handler code here
|
// TODO: Add your control notification handler code here
|
||||||
|
|
||||||
// Select a directory.
|
// Select a directory.
|
||||||
char path[MAX_PATH];
|
TCHAR path[MAX_PATH];
|
||||||
|
|
||||||
// Build the struct
|
// Build the struct
|
||||||
BROWSEINFO info;
|
BROWSEINFO info;
|
||||||
memset (&info, 0, sizeof (BROWSEINFO));
|
memset (&info, 0, sizeof (BROWSEINFO));
|
||||||
info.lpszTitle="Select the absolute base path of the bank";
|
info.lpszTitle = _T("Select the absolute base path of the bank");
|
||||||
info.ulFlags=BIF_RETURNONLYFSDIRS;
|
info.ulFlags=BIF_RETURNONLYFSDIRS;
|
||||||
|
|
||||||
// Select the path
|
// Select the path
|
||||||
|
@ -525,16 +526,17 @@ void SelectionTerritoire::OnPath()
|
||||||
nlassert (bRet);
|
nlassert (bRet);
|
||||||
|
|
||||||
// Add a final back slash
|
// Add a final back slash
|
||||||
if (strcmp (path, "")!=0)
|
if (_tcscmp(path, _T("")) != 0)
|
||||||
{
|
{
|
||||||
// Add a '\' at the end
|
// Add a '\' at the end
|
||||||
if (path[strlen (path)-1]!='\\')
|
if (path[_tcslen(path)-1] != _T('\\'))
|
||||||
strcat (path, "\\");
|
_tcscat(path, _T("\\"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last check
|
// Last check
|
||||||
char msg[512];
|
TCHAR msg[512];
|
||||||
sprintf (msg, "Do you really want to set %s as base path of the bank ?", path);
|
_stprintf(msg, _T("Do you really want to set %s as base path of the bank ?"), path);
|
||||||
|
|
||||||
if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDYES)
|
if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDYES)
|
||||||
{
|
{
|
||||||
// Set as default path..
|
// Set as default path..
|
||||||
|
@ -574,13 +576,13 @@ void SelectionTerritoire::OnPath()
|
||||||
if (!bitmapPath.empty())
|
if (!bitmapPath.empty())
|
||||||
{
|
{
|
||||||
// Check the path
|
// Check the path
|
||||||
if (CheckPath (bitmapPath, path)==false)
|
if (CheckPath (bitmapPath, tStrToUtf8(path))==false)
|
||||||
{
|
{
|
||||||
// Bad path
|
// Bad path
|
||||||
goodPath=false;
|
goodPath=false;
|
||||||
|
|
||||||
// Make a message
|
// Make a message
|
||||||
sprintf (msg, "Path '%s' can't be found in bitmap '%s'. Continue ?", path, bitmapPath.c_str());
|
_stprintf(msg, _T("Path '%s' can't be found in bitmap '%s'. Continue ?"), path, utf8ToTStr(bitmapPath));
|
||||||
|
|
||||||
// Message
|
// Message
|
||||||
if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO)
|
if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO)
|
||||||
|
@ -603,13 +605,13 @@ void SelectionTerritoire::OnPath()
|
||||||
if (strcmp (bitmapPath, "")!=0)
|
if (strcmp (bitmapPath, "")!=0)
|
||||||
{
|
{
|
||||||
// Check the path
|
// Check the path
|
||||||
if (CheckPath (bitmapPath, path)==false)
|
if (CheckPath (bitmapPath, tStrToUtf8(path))==false)
|
||||||
{
|
{
|
||||||
// Bad path
|
// Bad path
|
||||||
goodPath=false;
|
goodPath=false;
|
||||||
|
|
||||||
// Make a message
|
// Make a message
|
||||||
sprintf (msg, "Path '%s' can't be found in bitmap '%s'. Continue ?", path, bitmapPath);
|
_stprintf(msg, _T("Path '%s' can't be found in bitmap '%s'. Continue ?"), path, utf8ToTStr(bitmapPath));
|
||||||
|
|
||||||
// Message
|
// Message
|
||||||
if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO)
|
if (MessageBox (msg, _T("TileEdit"), MB_YESNO|MB_ICONQUESTION)==IDNO)
|
||||||
|
@ -645,7 +647,7 @@ void SelectionTerritoire::OnPath()
|
||||||
if (!bitmapPath.empty())
|
if (!bitmapPath.empty())
|
||||||
{
|
{
|
||||||
// Remove the absolute path
|
// Remove the absolute path
|
||||||
bool res=RemovePath (bitmapPath, path);
|
bool res=RemovePath (bitmapPath, tStrToUtf8(path));
|
||||||
nlassert (res);
|
nlassert (res);
|
||||||
|
|
||||||
// Set the bitmap
|
// Set the bitmap
|
||||||
|
@ -665,7 +667,7 @@ void SelectionTerritoire::OnPath()
|
||||||
if (!bitmapPath.empty())
|
if (!bitmapPath.empty())
|
||||||
{
|
{
|
||||||
// Remove the absolute path
|
// Remove the absolute path
|
||||||
bool res=RemovePath (bitmapPath, path);
|
bool res=RemovePath (bitmapPath, tStrToUtf8(path));
|
||||||
nlassert (res);
|
nlassert (res);
|
||||||
|
|
||||||
// Set the bitmap
|
// Set the bitmap
|
||||||
|
@ -683,7 +685,7 @@ void SelectionTerritoire::OnPath()
|
||||||
if (goodPath)
|
if (goodPath)
|
||||||
{
|
{
|
||||||
// Change the abs path of the bank
|
// Change the abs path of the bank
|
||||||
tileBank.setAbsPath (path);
|
tileBank.setAbsPath (tStrToUtf8(path));
|
||||||
|
|
||||||
// Change the bouton text
|
// Change the bouton text
|
||||||
GetDlgItem (IDC_PATH)->SetWindowText (path);
|
GetDlgItem (IDC_PATH)->SetWindowText (path);
|
||||||
|
@ -698,9 +700,10 @@ void SelectionTerritoire::OnPath()
|
||||||
void SelectionTerritoire::OnExport()
|
void SelectionTerritoire::OnExport()
|
||||||
{
|
{
|
||||||
// TODO: Add your control notification handler code here
|
// TODO: Add your control notification handler code here
|
||||||
static TCHAR BASED_CODE szFilter[] =
|
static TCHAR BASED_CODE szFilter[] = _T("NeL tile bank files (*.smallbank)|*.smallbank|All Files (*.*)|*.*||");
|
||||||
_T("NeL tile bank files (*.smallbank)|*.smallbank|All Files (*.*)|*.*||");
|
|
||||||
CFileDialog sFile(false, _T("*.smallbank"), DefautPath+ _T("*.smallbank"), 0, szFilter, this);
|
CFileDialog sFile(false, _T("*.smallbank"), DefautPath+ _T("*.smallbank"), 0, szFilter, this);
|
||||||
|
|
||||||
if (sFile.DoModal()==IDOK)
|
if (sFile.DoModal()==IDOK)
|
||||||
{
|
{
|
||||||
// Copy the bank
|
// Copy the bank
|
||||||
|
|
|
@ -86,7 +86,7 @@ protected:
|
||||||
afx_msg void OnSelchangeTileSet();
|
afx_msg void OnSelchangeTileSet();
|
||||||
virtual BOOL OnInitDialog();
|
virtual BOOL OnInitDialog();
|
||||||
//}}AFX_MSG
|
//}}AFX_MSG
|
||||||
void Save(const char* path, NL3D::CTileBank &toSave);
|
void Save(const TCHAR* path, NL3D::CTileBank &toSave);
|
||||||
|
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
};
|
};
|
||||||
|
|
|
@ -227,7 +227,7 @@ int TileList::addTile256 ()
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemovePath (std::string& path, const char* absolutePathToRemplace);
|
bool RemovePath (std::string& path, const std::string &absolutePathToRemplace);
|
||||||
|
|
||||||
int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitmap type)
|
int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitmap type)
|
||||||
{
|
{
|
||||||
|
@ -240,7 +240,9 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma
|
||||||
uint Height;
|
uint Height;
|
||||||
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
|
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
|
||||||
{
|
{
|
||||||
return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?";
|
||||||
|
|
||||||
|
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -256,10 +258,10 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma
|
||||||
error=tileBank2.getTileSet(_tileSet)->checkTile128 (type, border, pixel, composante);
|
error=tileBank2.getTileSet(_tileSet)->checkTile128 (type, border, pixel, composante);
|
||||||
if ((error!=CTileSet::ok)&&(error!=CTileSet::addFirstA128128)&&!zouille ())
|
if ((error!=CTileSet::ok)&&(error!=CTileSet::addFirstA128128)&&!zouille ())
|
||||||
{
|
{
|
||||||
char sTmp[512];
|
|
||||||
static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""};
|
static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""};
|
||||||
sprintf (sTmp, "%s\nPixel: %d (%s)", CTileSet::getErrorMessage (error), pixel, comp[composante]);
|
std::string msg = NLMISC::toString("%s\nPixel: %d (%s)\nContinue ?", CTileSet::getErrorMessage (error), pixel, comp[composante]);
|
||||||
return (int)(MessageBox (NULL, (std::string(sTmp)+"\nContinue ?").c_str(), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
|
||||||
|
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -286,9 +288,8 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Error: bitmap not in the absolute path..
|
// Error: bitmap not in the absolute path..
|
||||||
char msg[512];
|
std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.\nContinue ?", name.c_str(), tileBank2.getAbsPath ().c_str());
|
||||||
sprintf (msg, "The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str());
|
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Load error"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||||
return (int)(MessageBox (NULL, (std::string (msg)+"\nContinue ?").c_str(), _T("Load error"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -305,7 +306,8 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma
|
||||||
uint Height;
|
uint Height;
|
||||||
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
|
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
|
||||||
{
|
{
|
||||||
return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?";
|
||||||
|
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -322,10 +324,9 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma
|
||||||
error=tileBank2.getTileSet(_tileSet)->checkTile256 (type, border, pixel, composante);
|
error=tileBank2.getTileSet(_tileSet)->checkTile256 (type, border, pixel, composante);
|
||||||
if ((error!=CTileSet::ok)&&!zouille())
|
if ((error!=CTileSet::ok)&&!zouille())
|
||||||
{
|
{
|
||||||
char sTmp[512];
|
static const char* comp[] = { "Red", "Green", "Blue", "Alpha", "" };
|
||||||
static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""};
|
std::string msg = NLMISC::toString("%s\nPixel: %d (%s)\nContinue ?", CTileSet::getErrorMessage (error), pixel, comp[composante]);
|
||||||
sprintf (sTmp, "%s\nPixel: %d (%s)", CTileSet::getErrorMessage (error), pixel, comp[composante]);
|
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||||
return (int)(MessageBox (NULL, (std::string(sTmp)+"\nContinue ?").c_str(), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -349,9 +350,8 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Error: bitmap not in the absolute path..
|
// Error: bitmap not in the absolute path..
|
||||||
char msg[512];
|
std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.\nContinue ?", name.c_str(), tileBank2.getAbsPath ().c_str());
|
||||||
sprintf (msg, "The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str());
|
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Load error"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||||
return (int)(MessageBox (NULL, (std::string (msg)+"\nContinue ?").c_str(), _T("Load error"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -371,7 +371,8 @@ int TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile:
|
||||||
uint Height;
|
uint Height;
|
||||||
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
|
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
|
||||||
{
|
{
|
||||||
return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?";
|
||||||
|
return (int)(MessageBox (NULL, utf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -387,10 +388,9 @@ int TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile:
|
||||||
error=tileBank2.getTileSet(_tileSet)->checkTile128 (type, border, pixel, composante);
|
error=tileBank2.getTileSet(_tileSet)->checkTile128 (type, border, pixel, composante);
|
||||||
if ((error!=CTileSet::ok)&&(error!=CTileSet::addFirstA128128)&&!zouille ())
|
if ((error!=CTileSet::ok)&&(error!=CTileSet::addFirstA128128)&&!zouille ())
|
||||||
{
|
{
|
||||||
char sTmp[512];
|
|
||||||
static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""};
|
static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""};
|
||||||
sprintf (sTmp, "%s\nPixel: %d (%s)", CTileSet::getErrorMessage (error), pixel, comp[composante]);
|
std::string msg = NLMISC::toString("%s\nPixel: %d (%s)\nContinue ?", CTileSet::getErrorMessage(error), pixel, comp[composante]);
|
||||||
return MessageBox (NULL, (std::string(sTmp)+"\nContinue ?").c_str(), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES;
|
return MessageBox (NULL, utf8ToTStr(msg), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -437,14 +437,17 @@ int TileList::setDisplacement (int tile, const std::string& name)
|
||||||
theListDisplacement[tile].loaded=0;
|
theListDisplacement[tile].loaded=0;
|
||||||
|
|
||||||
if (!_LoadBitmap(tileBank2.getAbsPath() + troncated, &theListDisplacement[tile].BmpInfo, theListDisplacement[tile].Bits, NULL, 0))
|
if (!_LoadBitmap(tileBank2.getAbsPath() + troncated, &theListDisplacement[tile].BmpInfo, theListDisplacement[tile].Bits, NULL, 0))
|
||||||
MessageBox (NULL, (tileBank2.getAbsPath() + troncated).c_str(), _T("Can't load file"), MB_OK|MB_ICONEXCLAMATION);
|
{
|
||||||
|
std::string msg = tileBank2.getAbsPath() + troncated;
|
||||||
|
MessageBox(NULL, utf8ToTStr(msg), _T("Can't load file"), MB_OK | MB_ICONEXCLAMATION);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Check the size
|
// Check the size
|
||||||
if ((theListDisplacement[tile].BmpInfo.bmiHeader.biWidth!=32)||(-theListDisplacement[tile].BmpInfo.bmiHeader.biHeight!=32))
|
if ((theListDisplacement[tile].BmpInfo.bmiHeader.biWidth!=32)||(-theListDisplacement[tile].BmpInfo.bmiHeader.biHeight!=32))
|
||||||
{
|
{
|
||||||
// Error message
|
// Error message
|
||||||
MessageBox (NULL, _T("Invalid size: displacement map must be 32x32 8 bits."), troncated.c_str(),
|
MessageBox (NULL, _T("Invalid size: displacement map must be 32x32 8 bits."), utf8ToTStr(troncated),
|
||||||
MB_OK|MB_ICONEXCLAMATION);
|
MB_OK|MB_ICONEXCLAMATION);
|
||||||
|
|
||||||
// Free the bitmap
|
// Free the bitmap
|
||||||
|
@ -464,9 +467,8 @@ int TileList::setDisplacement (int tile, const std::string& name)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Error: bitmap not in the absolute path..
|
// Error: bitmap not in the absolute path..
|
||||||
char msg[512];
|
std::string msg = NLMISC::toString("The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str());
|
||||||
sprintf (msg, "The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str());
|
MessageBox (NULL, utf8ToTStr(msg), _T("Load error"), MB_OK|MB_ICONEXCLAMATION);
|
||||||
MessageBox (NULL, msg, _T("Load error"), MB_OK|MB_ICONEXCLAMATION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -483,7 +485,8 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot
|
||||||
uint Height;
|
uint Height;
|
||||||
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
|
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
|
||||||
{
|
{
|
||||||
return MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES;
|
std::string msg = tileBank2.getAbsPath() + troncated + "\nContinue ?";
|
||||||
|
return MessageBox (NULL, utf8ToTStr(msg), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -505,23 +508,27 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot
|
||||||
if (((error=tileBank2.getTileSet(_tileSet)->checkTileTransition ((CTileSet::TTransition)tile, CTile::alpha, border, indexError,
|
if (((error=tileBank2.getTileSet(_tileSet)->checkTileTransition ((CTileSet::TTransition)tile, CTile::alpha, border, indexError,
|
||||||
pixel, composante))!=CTileSet::ok)&&!zouille ())
|
pixel, composante))!=CTileSet::ok)&&!zouille ())
|
||||||
{
|
{
|
||||||
char sMsg[512];
|
std::string msg;
|
||||||
if ((error==CTileSet::topInterfaceProblem)||(error==CTileSet::bottomInterfaceProblem)||(error==CTileSet::leftInterfaceProblem)
|
if ((error==CTileSet::topInterfaceProblem)||(error==CTileSet::bottomInterfaceProblem)||(error==CTileSet::leftInterfaceProblem)
|
||||||
||(error==CTileSet::rightInterfaceProblem)||(error==CTileSet::topBottomNotTheSame)||(error==CTileSet::rightLeftNotTheSame)
|
||(error==CTileSet::rightInterfaceProblem)||(error==CTileSet::topBottomNotTheSame)||(error==CTileSet::rightLeftNotTheSame)
|
||||||
||(error==CTileSet::topInterfaceProblem))
|
||(error==CTileSet::topInterfaceProblem))
|
||||||
{
|
{
|
||||||
static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""};
|
static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""};
|
||||||
if (indexError!=-1)
|
if (indexError!=-1)
|
||||||
sprintf (sMsg, "%s\nIncompatible with tile nb %d\nPixel: %d (%s)", CTileSet::getErrorMessage (error), indexError,
|
msg = NLMISC::toString("%s\nIncompatible with tile nb %d\nPixel: %d (%s)", CTileSet::getErrorMessage (error), indexError,
|
||||||
pixel, comp[composante]);
|
pixel, comp[composante]);
|
||||||
else
|
else
|
||||||
sprintf (sMsg, "%s\nIncompatible with the 128x128 tile\nPixel: %d (%s)", CTileSet::getErrorMessage (error),
|
msg = NLMISC::toString("%s\nIncompatible with the 128x128 tile\nPixel: %d (%s)", CTileSet::getErrorMessage (error),
|
||||||
pixel, comp[composante]);
|
pixel, comp[composante]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sprintf (sMsg, "%s\nIncompatible filled tile", CTileSet::getErrorMessage (error));
|
{
|
||||||
|
msg = NLMISC::toString("%s\nIncompatible filled tile", CTileSet::getErrorMessage(error));
|
||||||
|
}
|
||||||
|
|
||||||
return MessageBox (NULL, (std::string(sMsg)+"\nContinue ?").c_str(), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES;
|
msg += "\nContinue ?";
|
||||||
|
|
||||||
|
return MessageBox (NULL, utf8ToTStr(msg), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -534,8 +541,8 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Error: bitmap not in the absolute path..
|
// Error: bitmap not in the absolute path..
|
||||||
char msg[512];
|
TCHAR msg[512];
|
||||||
sprintf (msg, "The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str());
|
_stprintf(msg, _T("The bitmap %s is not in the absolute path %s."), utf8ToTStr(name), utf8ToTStr(tileBank2.getAbsPath ()));
|
||||||
MessageBox (NULL, msg, _T("Load error"), MB_OK|MB_ICONEXCLAMATION);
|
MessageBox (NULL, msg, _T("Load error"), MB_OK|MB_ICONEXCLAMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,36 @@
|
||||||
#include "ViewColumn.h"
|
#include "ViewColumn.h"
|
||||||
#include "Browse.h"
|
#include "Browse.h"
|
||||||
|
|
||||||
char *WndRegKeys[4][5] = {{"POPUP BOTTOM RX","POPUP BOTTOM RY","POPUP BOTTOM CX","POPUP BOTTOM CY","POPUP BOTTOM N"},
|
TCHAR *WndRegKeys[4][5] = {
|
||||||
{"POPUP TOP RX","POPUP TOP RY","POPUP TOP CX","POPUP TOP CY","POPUP TOP N"},
|
{
|
||||||
{"POPUP LEFT RX","POPUP LEFT RY","POPUP LEFT CX","POPUP LEFT CY","POPUP LEFT N"},
|
_T("POPUP BOTTOM RX"),
|
||||||
{"POPUP RIGHT RX","POPUP RIGHT RY","POPUP RIGHT CX","POPUP RIGHT CY","POPUP RIGHT N"}};
|
_T("POPUP BOTTOM RY"),
|
||||||
|
_T("POPUP BOTTOM CX"),
|
||||||
|
_T("POPUP BOTTOM CY"),
|
||||||
|
_T("POPUP BOTTOM N")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
_T("POPUP TOP RX"),
|
||||||
|
_T("POPUP TOP RY"),
|
||||||
|
_T("POPUP TOP CX"),
|
||||||
|
_T("POPUP TOP CY"),
|
||||||
|
_T("POPUP TOP N")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
_T("POPUP LEFT RX"),
|
||||||
|
_T("POPUP LEFT RY"),
|
||||||
|
_T("POPUP LEFT CX"),
|
||||||
|
_T("POPUP LEFT CY"),
|
||||||
|
_T("POPUP LEFT N")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
_T("POPUP RIGHT RX"),
|
||||||
|
_T("POPUP RIGHT RY"),
|
||||||
|
_T("POPUP RIGHT CX"),
|
||||||
|
_T("POPUP RIGHT CY"),
|
||||||
|
_T("POPUP RIGHT N")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// ViewColumn dialog
|
// ViewColumn dialog
|
||||||
|
@ -164,11 +190,11 @@ BOOL ViewColumn::OnInitDialog()
|
||||||
if (RegOpenKey(HKEY_CURRENT_USER,REGKEY_TILEDIT,®key)==ERROR_SUCCESS)
|
if (RegOpenKey(HKEY_CURRENT_USER,REGKEY_TILEDIT,®key)==ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
unsigned long value;
|
unsigned long value;
|
||||||
RegQueryValueEx(regkey,WndRegKeys[pos&3][0],0,&value,(unsigned char *)&rx,&value);
|
RegQueryValueEx(regkey, WndRegKeys[pos&3][0], 0, &value, (LPBYTE)&rx, &value);
|
||||||
RegQueryValueEx(regkey,WndRegKeys[pos&3][1],0,&value,(unsigned char *)&ry,&value);
|
RegQueryValueEx(regkey, WndRegKeys[pos&3][1], 0, &value, (LPBYTE)&ry, &value);
|
||||||
RegQueryValueEx(regkey,WndRegKeys[pos&3][2],0,&value,(unsigned char *)&cx,&value);
|
RegQueryValueEx(regkey, WndRegKeys[pos&3][2], 0, &value, (LPBYTE)&cx, &value);
|
||||||
RegQueryValueEx(regkey,WndRegKeys[pos&3][3],0,&value,(unsigned char *)&cy,&value);
|
RegQueryValueEx(regkey, WndRegKeys[pos&3][3], 0, &value, (LPBYTE)&cy, &value);
|
||||||
RegQueryValueEx(regkey,WndRegKeys[pos&3][4],0,&value,(unsigned char *)&nTileInWnd,&value);
|
RegQueryValueEx(regkey, WndRegKeys[pos&3][4], 0, &value, (LPBYTE)&nTileInWnd, &value);
|
||||||
RegCloseKey(regkey);
|
RegCloseKey(regkey);
|
||||||
}
|
}
|
||||||
EnableScrollBar(SB_VERT);
|
EnableScrollBar(SB_VERT);
|
||||||
|
@ -378,9 +404,9 @@ void ViewColumn::OnRButtonDown(UINT nFlags, CPoint point)
|
||||||
// TODO: Add your message handler code here and/or call default
|
// TODO: Add your message handler code here and/or call default
|
||||||
CMenu popup;
|
CMenu popup;
|
||||||
popup.CreatePopupMenu();
|
popup.CreatePopupMenu();
|
||||||
popup.AppendMenu(MF_STRING | (nTileInWnd==1?MF_CHECKED:0),10,"*1");
|
popup.AppendMenu(MF_STRING | (nTileInWnd == 1 ? MF_CHECKED:0), 10, _T("*1"));
|
||||||
popup.AppendMenu(MF_STRING | (nTileInWnd==4?MF_CHECKED:0),12,"*4");
|
popup.AppendMenu(MF_STRING | (nTileInWnd == 4 ? MF_CHECKED:0), 12, _T("*4"));
|
||||||
popup.AppendMenu(MF_STRING,13,"Replace window");
|
popup.AppendMenu(MF_STRING, 13, _T("Replace window"));
|
||||||
|
|
||||||
RECT rect; GetWindowRect(&rect);
|
RECT rect; GetWindowRect(&rect);
|
||||||
popup.TrackPopupMenu(TPM_LEFTALIGN,MousePos.x+rect.left,MousePos.y+rect.top,this,NULL);
|
popup.TrackPopupMenu(TPM_LEFTALIGN,MousePos.x+rect.left,MousePos.y+rect.top,this,NULL);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
// ViewColumn.h : header file
|
// ViewColumn.h : header file
|
||||||
//
|
//
|
||||||
|
|
||||||
extern char *WndRegKeys[4][5];
|
extern TCHAR *WndRegKeys[4][5];
|
||||||
|
|
||||||
#include "View.h"
|
#include "View.h"
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ LRESULT Custom::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
CString str;
|
CString str;
|
||||||
clist->GetLBText(i+2,str);
|
clist->GetLBText(i+2,str);
|
||||||
buttonList[i].Create((LPCSTR)str,BS_CHECKBOX,button,this,i+10);
|
buttonList[i].Create(str,BS_CHECKBOX,button,this,i+10);
|
||||||
buttonList[i].SetFont(&font,1);
|
buttonList[i].SetFont(&font,1);
|
||||||
buttonList[i].ModifyStyle(0,WS_VISIBLE);
|
buttonList[i].ModifyStyle(0,WS_VISIBLE);
|
||||||
/* RECT st = button; st.left+=20; st.right = client.right - 90; st.top -= 3;
|
/* RECT st = button; st.left+=20; st.right = client.right - 90; st.top -= 3;
|
||||||
|
|
Loading…
Reference in a new issue