forgot to check in new wxrc -- as a side effect, this commit also fixes the bug with deleting source files
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15923 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -58,6 +58,7 @@ private:
|
|||||||
wxArrayString PrepareTempFiles();
|
wxArrayString PrepareTempFiles();
|
||||||
void FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath);
|
void FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath);
|
||||||
|
|
||||||
|
wxString GetInternalFileName(const wxString& name, const wxArrayString& flist);
|
||||||
void DeleteTempFiles(const wxArrayString& flist);
|
void DeleteTempFiles(const wxArrayString& flist);
|
||||||
void MakePackageZIP(const wxArrayString& flist);
|
void MakePackageZIP(const wxArrayString& flist);
|
||||||
void MakePackageCPP(const wxArrayString& flist);
|
void MakePackageCPP(const wxArrayString& flist);
|
||||||
@@ -181,6 +182,28 @@ void XmlResApp::CompileRes()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString XmlResApp::GetInternalFileName(const wxString& name, const wxArrayString& flist)
|
||||||
|
{
|
||||||
|
wxString name2 = name;
|
||||||
|
name2.Replace(":", "_");
|
||||||
|
name2.Replace("/", "_");
|
||||||
|
name2.Replace("\\", "_");
|
||||||
|
name2.Replace("*", "_");
|
||||||
|
name2.Replace("?", "_");
|
||||||
|
|
||||||
|
wxString s = wxFileNameFromPath(parOutput) + "$" + name2;
|
||||||
|
|
||||||
|
if (wxFileExists(s) && flist.Index(s) == wxNOT_FOUND)
|
||||||
|
{
|
||||||
|
for (int i = 0;; i++)
|
||||||
|
{
|
||||||
|
s.Printf(wxFileNameFromPath(parOutput) + "$%03i-" + name2, i);
|
||||||
|
if (!wxFileExists(s) || flist.Index(s) != wxNOT_FOUND)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
wxArrayString XmlResApp::PrepareTempFiles()
|
wxArrayString XmlResApp::PrepareTempFiles()
|
||||||
{
|
{
|
||||||
@@ -205,8 +228,10 @@ wxArrayString XmlResApp::PrepareTempFiles()
|
|||||||
|
|
||||||
FindFilesInXML(doc.GetRoot(), flist, path);
|
FindFilesInXML(doc.GetRoot(), flist, path);
|
||||||
|
|
||||||
doc.Save(parOutputPath + "/" + name + ".xrc");
|
wxString internalName = GetInternalFileName(parFiles[i], flist);
|
||||||
flist.Add(name + ".xrc");
|
|
||||||
|
doc.Save(parOutputPath + "/" + internalName);
|
||||||
|
flist.Add(internalName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return flist;
|
return flist;
|
||||||
@@ -233,18 +258,14 @@ void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxSt
|
|||||||
// ...and known to contain filename
|
// ...and known to contain filename
|
||||||
{
|
{
|
||||||
wxString fullname;
|
wxString fullname;
|
||||||
wxString filename = n->GetContent();
|
|
||||||
if (wxIsAbsolutePath(n->GetContent())) fullname = n->GetContent();
|
if (wxIsAbsolutePath(n->GetContent())) fullname = n->GetContent();
|
||||||
else fullname = inputPath + "/" + n->GetContent();
|
else fullname = inputPath + "/" + n->GetContent();
|
||||||
|
|
||||||
filename.Replace("/", "_");
|
|
||||||
filename.Replace("\\", "_");
|
|
||||||
filename.Replace("*", "_");
|
|
||||||
filename.Replace("?", "_");
|
|
||||||
n->SetContent(filename);
|
|
||||||
|
|
||||||
if (flagVerbose)
|
if (flagVerbose)
|
||||||
wxPrintf("adding " + filename + "...\n");
|
wxPrintf("adding " + fullname + "...\n");
|
||||||
|
|
||||||
|
wxString filename = GetInternalFileName(n->GetContent(), flist);
|
||||||
|
n->SetContent(filename);
|
||||||
|
|
||||||
flist.Add(filename);
|
flist.Add(filename);
|
||||||
|
|
||||||
@@ -342,20 +363,20 @@ void XmlResApp::MakePackageCPP(const wxArrayString& flist)
|
|||||||
wxPrintf("creating C++ source file " + parOutput + "...\n");
|
wxPrintf("creating C++ source file " + parOutput + "...\n");
|
||||||
|
|
||||||
file.Write("\
|
file.Write("\
|
||||||
#include \"wx/wxprec.h\"\n\
|
#include <wx/wxprec.h>\n\
|
||||||
\n\
|
\n\
|
||||||
#ifdef __BORLANDC__\n\
|
#ifdef __BORLANDC__\n\
|
||||||
#pragma hdrstop\n\
|
#pragma hdrstop\n\
|
||||||
#endif\n\
|
#endif\n\
|
||||||
\n\
|
\n\
|
||||||
#ifndef WX_PRECOMP\n\
|
#ifndef WX_PRECOMP\n\
|
||||||
#include \"wx/wx.h\"\n\
|
#include <wx/wx.h>\n\
|
||||||
#endif\n\
|
#endif\n\
|
||||||
\
|
\
|
||||||
#include \"wx/filesys.h\"\n\
|
#include <wx/filesys.h>\n\
|
||||||
#include \"wx/fs_mem.h\"\n\
|
#include <wx/fs_mem.h>\n\
|
||||||
#include \"wx/xrc/xmlres.h\"\n\
|
#include <wx/xrc/xmlres.h>\n\
|
||||||
#include \"wx/xrc/xh_all.h\"\n\
|
#include <wx/xrc/xh_all.h>\n\
|
||||||
\n");
|
\n");
|
||||||
|
|
||||||
for (i = 0; i < flist.Count(); i++)
|
for (i = 0; i < flist.Count(); i++)
|
||||||
@@ -367,10 +388,10 @@ void " + parFuncname + "()\n\
|
|||||||
\n\
|
\n\
|
||||||
// Check for memory FS. If not present, load the handler:\n\
|
// Check for memory FS. If not present, load the handler:\n\
|
||||||
{\n\
|
{\n\
|
||||||
wxMemoryFSHandler::AddFile(\"xml_resource/dummy_file\", \"dummy one\");\n\
|
wxMemoryFSHandler::AddFile(\"XRC_resource/dummy_file\", \"dummy one\");\n\
|
||||||
wxFileSystem fsys;\n\
|
wxFileSystem fsys;\n\
|
||||||
wxFSFile *f = fsys.OpenFile(\"memory:xml_resource/dummy_file\");\n\
|
wxFSFile *f = fsys.OpenFile(\"memory:XRC_resource/dummy_file\");\n\
|
||||||
wxMemoryFSHandler::RemoveFile(\"xml_resource/dummy_file\");\n\
|
wxMemoryFSHandler::RemoveFile(\"XRC_resource/dummy_file\");\n\
|
||||||
if (f) delete f;\n\
|
if (f) delete f;\n\
|
||||||
else wxFileSystem::AddHandler(new wxMemoryFSHandler);\n\
|
else wxFileSystem::AddHandler(new wxMemoryFSHandler);\n\
|
||||||
}\n\
|
}\n\
|
||||||
@@ -379,17 +400,15 @@ void " + parFuncname + "()\n\
|
|||||||
for (i = 0; i < flist.Count(); i++)
|
for (i = 0; i < flist.Count(); i++)
|
||||||
{
|
{
|
||||||
wxString s;
|
wxString s;
|
||||||
s.Printf(" wxMemoryFSHandler::AddFile(\"xml_resource/" + flist[i] +
|
s.Printf(" wxMemoryFSHandler::AddFile(\"XRC_resource/" + flist[i] +
|
||||||
"\", xml_res_file_%i, xml_res_size_%i);\n", i, i);
|
"\", xml_res_file_%i, xml_res_size_%i);\n", i, i);
|
||||||
file.Write(s);
|
file.Write(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < parFiles.Count(); i++)
|
for (i = 0; i < parFiles.Count(); i++)
|
||||||
{
|
{
|
||||||
wxString name, ext, path;
|
file.Write(" wxXmlResource::Get()->Load(\"memory:XRC_resource/" +
|
||||||
wxSplitPath(parFiles[i], &path, &name, &ext);
|
GetInternalFileName(parFiles[i], flist) + "\");\n");
|
||||||
file.Write(" wxXmlResource::Get()->Load(\"memory:xml_resource/" +
|
|
||||||
name + ".xrc" + "\");\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file.Write("}\n");
|
file.Write("}\n");
|
||||||
|
@@ -58,6 +58,7 @@ private:
|
|||||||
wxArrayString PrepareTempFiles();
|
wxArrayString PrepareTempFiles();
|
||||||
void FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath);
|
void FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath);
|
||||||
|
|
||||||
|
wxString GetInternalFileName(const wxString& name, const wxArrayString& flist);
|
||||||
void DeleteTempFiles(const wxArrayString& flist);
|
void DeleteTempFiles(const wxArrayString& flist);
|
||||||
void MakePackageZIP(const wxArrayString& flist);
|
void MakePackageZIP(const wxArrayString& flist);
|
||||||
void MakePackageCPP(const wxArrayString& flist);
|
void MakePackageCPP(const wxArrayString& flist);
|
||||||
@@ -181,6 +182,28 @@ void XmlResApp::CompileRes()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString XmlResApp::GetInternalFileName(const wxString& name, const wxArrayString& flist)
|
||||||
|
{
|
||||||
|
wxString name2 = name;
|
||||||
|
name2.Replace(":", "_");
|
||||||
|
name2.Replace("/", "_");
|
||||||
|
name2.Replace("\\", "_");
|
||||||
|
name2.Replace("*", "_");
|
||||||
|
name2.Replace("?", "_");
|
||||||
|
|
||||||
|
wxString s = wxFileNameFromPath(parOutput) + "$" + name2;
|
||||||
|
|
||||||
|
if (wxFileExists(s) && flist.Index(s) == wxNOT_FOUND)
|
||||||
|
{
|
||||||
|
for (int i = 0;; i++)
|
||||||
|
{
|
||||||
|
s.Printf(wxFileNameFromPath(parOutput) + "$%03i-" + name2, i);
|
||||||
|
if (!wxFileExists(s) || flist.Index(s) != wxNOT_FOUND)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
wxArrayString XmlResApp::PrepareTempFiles()
|
wxArrayString XmlResApp::PrepareTempFiles()
|
||||||
{
|
{
|
||||||
@@ -205,8 +228,10 @@ wxArrayString XmlResApp::PrepareTempFiles()
|
|||||||
|
|
||||||
FindFilesInXML(doc.GetRoot(), flist, path);
|
FindFilesInXML(doc.GetRoot(), flist, path);
|
||||||
|
|
||||||
doc.Save(parOutputPath + "/" + name + ".xrc");
|
wxString internalName = GetInternalFileName(parFiles[i], flist);
|
||||||
flist.Add(name + ".xrc");
|
|
||||||
|
doc.Save(parOutputPath + "/" + internalName);
|
||||||
|
flist.Add(internalName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return flist;
|
return flist;
|
||||||
@@ -233,18 +258,14 @@ void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxSt
|
|||||||
// ...and known to contain filename
|
// ...and known to contain filename
|
||||||
{
|
{
|
||||||
wxString fullname;
|
wxString fullname;
|
||||||
wxString filename = n->GetContent();
|
|
||||||
if (wxIsAbsolutePath(n->GetContent())) fullname = n->GetContent();
|
if (wxIsAbsolutePath(n->GetContent())) fullname = n->GetContent();
|
||||||
else fullname = inputPath + "/" + n->GetContent();
|
else fullname = inputPath + "/" + n->GetContent();
|
||||||
|
|
||||||
filename.Replace("/", "_");
|
|
||||||
filename.Replace("\\", "_");
|
|
||||||
filename.Replace("*", "_");
|
|
||||||
filename.Replace("?", "_");
|
|
||||||
n->SetContent(filename);
|
|
||||||
|
|
||||||
if (flagVerbose)
|
if (flagVerbose)
|
||||||
wxPrintf("adding " + filename + "...\n");
|
wxPrintf("adding " + fullname + "...\n");
|
||||||
|
|
||||||
|
wxString filename = GetInternalFileName(n->GetContent(), flist);
|
||||||
|
n->SetContent(filename);
|
||||||
|
|
||||||
flist.Add(filename);
|
flist.Add(filename);
|
||||||
|
|
||||||
@@ -342,20 +363,20 @@ void XmlResApp::MakePackageCPP(const wxArrayString& flist)
|
|||||||
wxPrintf("creating C++ source file " + parOutput + "...\n");
|
wxPrintf("creating C++ source file " + parOutput + "...\n");
|
||||||
|
|
||||||
file.Write("\
|
file.Write("\
|
||||||
#include \"wx/wxprec.h\"\n\
|
#include <wx/wxprec.h>\n\
|
||||||
\n\
|
\n\
|
||||||
#ifdef __BORLANDC__\n\
|
#ifdef __BORLANDC__\n\
|
||||||
#pragma hdrstop\n\
|
#pragma hdrstop\n\
|
||||||
#endif\n\
|
#endif\n\
|
||||||
\n\
|
\n\
|
||||||
#ifndef WX_PRECOMP\n\
|
#ifndef WX_PRECOMP\n\
|
||||||
#include \"wx/wx.h\"\n\
|
#include <wx/wx.h>\n\
|
||||||
#endif\n\
|
#endif\n\
|
||||||
\
|
\
|
||||||
#include \"wx/filesys.h\"\n\
|
#include <wx/filesys.h>\n\
|
||||||
#include \"wx/fs_mem.h\"\n\
|
#include <wx/fs_mem.h>\n\
|
||||||
#include \"wx/xrc/xmlres.h\"\n\
|
#include <wx/xrc/xmlres.h>\n\
|
||||||
#include \"wx/xrc/xh_all.h\"\n\
|
#include <wx/xrc/xh_all.h>\n\
|
||||||
\n");
|
\n");
|
||||||
|
|
||||||
for (i = 0; i < flist.Count(); i++)
|
for (i = 0; i < flist.Count(); i++)
|
||||||
@@ -367,10 +388,10 @@ void " + parFuncname + "()\n\
|
|||||||
\n\
|
\n\
|
||||||
// Check for memory FS. If not present, load the handler:\n\
|
// Check for memory FS. If not present, load the handler:\n\
|
||||||
{\n\
|
{\n\
|
||||||
wxMemoryFSHandler::AddFile(\"xml_resource/dummy_file\", \"dummy one\");\n\
|
wxMemoryFSHandler::AddFile(\"XRC_resource/dummy_file\", \"dummy one\");\n\
|
||||||
wxFileSystem fsys;\n\
|
wxFileSystem fsys;\n\
|
||||||
wxFSFile *f = fsys.OpenFile(\"memory:xml_resource/dummy_file\");\n\
|
wxFSFile *f = fsys.OpenFile(\"memory:XRC_resource/dummy_file\");\n\
|
||||||
wxMemoryFSHandler::RemoveFile(\"xml_resource/dummy_file\");\n\
|
wxMemoryFSHandler::RemoveFile(\"XRC_resource/dummy_file\");\n\
|
||||||
if (f) delete f;\n\
|
if (f) delete f;\n\
|
||||||
else wxFileSystem::AddHandler(new wxMemoryFSHandler);\n\
|
else wxFileSystem::AddHandler(new wxMemoryFSHandler);\n\
|
||||||
}\n\
|
}\n\
|
||||||
@@ -379,17 +400,15 @@ void " + parFuncname + "()\n\
|
|||||||
for (i = 0; i < flist.Count(); i++)
|
for (i = 0; i < flist.Count(); i++)
|
||||||
{
|
{
|
||||||
wxString s;
|
wxString s;
|
||||||
s.Printf(" wxMemoryFSHandler::AddFile(\"xml_resource/" + flist[i] +
|
s.Printf(" wxMemoryFSHandler::AddFile(\"XRC_resource/" + flist[i] +
|
||||||
"\", xml_res_file_%i, xml_res_size_%i);\n", i, i);
|
"\", xml_res_file_%i, xml_res_size_%i);\n", i, i);
|
||||||
file.Write(s);
|
file.Write(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < parFiles.Count(); i++)
|
for (i = 0; i < parFiles.Count(); i++)
|
||||||
{
|
{
|
||||||
wxString name, ext, path;
|
file.Write(" wxXmlResource::Get()->Load(\"memory:XRC_resource/" +
|
||||||
wxSplitPath(parFiles[i], &path, &name, &ext);
|
GetInternalFileName(parFiles[i], flist) + "\");\n");
|
||||||
file.Write(" wxXmlResource::Get()->Load(\"memory:xml_resource/" +
|
|
||||||
name + ".xrc" + "\");\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file.Write("}\n");
|
file.Write("}\n");
|
||||||
|
Reference in New Issue
Block a user