X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c8b7a961ff4ec4a57b2388c15277f55fc41b4deb..d91535c47f8bb17ab9740e35baea3f6450de026d:/contrib/utils/wxrc/wxrc.cpp diff --git a/contrib/utils/wxrc/wxrc.cpp b/contrib/utils/wxrc/wxrc.cpp index f36768d150..be9b7b75b5 100644 --- a/contrib/utils/wxrc/wxrc.cpp +++ b/contrib/utils/wxrc/wxrc.cpp @@ -27,8 +27,7 @@ #endif #include "wx/cmdline.h" -#include "wx/xml/xml.h" -#include "wx/xml/xmlio.h" +#include "wx/xrc/xml.h" #include "wx/ffile.h" #include "wx/wfstream.h" @@ -67,7 +66,7 @@ private: wxArrayString FindStrings(); wxArrayString FindStrings(wxXmlNode *node); - bool flagVerbose, flagCPP, flagCompress, flagGettext; + bool flagVerbose, flagCPP, flagGettext; wxString parOutput, parFuncname, parOutputPath; wxArrayString parFiles; int retCode; @@ -86,8 +85,7 @@ int XmlResApp::OnRun() { wxCMD_LINE_SWITCH, "h", "help", "show help message" }, { wxCMD_LINE_SWITCH, "v", "verbose", "be verbose" }, { wxCMD_LINE_SWITCH, "c", "cpp-code", "output C++ source rather than .rsc file" }, - { wxCMD_LINE_SWITCH, "u", "uncompressed", "do not compress .xml files (C++ only)" }, - { wxCMD_LINE_SWITCH, "g", "gettext", "output .po catalog (to stdout or file if -o used)" }, + { wxCMD_LINE_SWITCH, "g", "gettext", "output list of translatable strings (to stdout or file if -o used)" }, { wxCMD_LINE_OPTION, "n", "function", "C++ function name (with -c) [InitXmlResource]" }, { wxCMD_LINE_OPTION, "o", "output", "output file [resource.xrs/cpp]" }, { wxCMD_LINE_OPTION, "l", "list-of-handlers", "output list of neccessary handlers to this file" }, @@ -98,7 +96,11 @@ int XmlResApp::OnRun() { wxCMD_LINE_NONE } }; - wxXmlDocument::AddHandler(new wxXmlIOHandlerBinZ); +#if wxUSE_GUI + // VS: I need reasonable output to console from wxCmdLineParser + wxLog::SetTimestamp(NULL); + delete wxLog::SetActiveTarget(new wxLogStderr); +#endif wxCmdLineParser parser(cmdLineDesc, argc, argv); @@ -140,7 +142,6 @@ void XmlResApp::ParseParams(const wxCmdLineParser& cmdline) flagGettext = cmdline.Found("g"); flagVerbose = cmdline.Found("v"); flagCPP = cmdline.Found("c"); - flagCompress = flagCPP && !cmdline.Found("u"); if (!cmdline.Found("o", &parOutput)) { @@ -204,7 +205,7 @@ wxArrayString XmlResApp::PrepareTempFiles() FindFilesInXML(doc.GetRoot(), flist, path); - doc.Save(parOutputPath + "/" + name + ".xrc", flagCompress ? wxXML_IO_BINZ : wxXML_IO_BIN); + doc.Save(parOutputPath + "/" + name + ".xrc"); flist.Add(name + ".xrc"); } @@ -352,8 +353,8 @@ void XmlResApp::MakePackageCPP(const wxArrayString& flist) \ #include \"wx/filesys.h\"\n\ #include \"wx/fs_mem.h\"\n\ -#include \"wx/xml/xmlres.h\"\n\ -#include \"wx/xml/xh_all.h\"\n\ +#include \"wx/xrc/xmlres.h\"\n\ +#include \"wx/xrc/xh_all.h\"\n\ \n"); for (i = 0; i < flist.Count(); i++) @@ -386,11 +387,11 @@ void " + parFuncname + "()\n\ { wxString name, ext, path; wxSplitPath(parFiles[i], &path, &name, &ext); - file.Write(" wxTheXmlResource->Load(\"memory:xml_resource/" + + file.Write(" wxXmlResource::Get()->Load(\"memory:xml_resource/" + name + ".xrc" + "\");\n"); } - file.Write("\n}\n"); + file.Write("}\n"); } @@ -406,7 +407,7 @@ void XmlResApp::OutputGettext() else fout.Open(parOutput, _T("wt")); for (size_t i = 0; i < str.GetCount(); i++) - fout.Write(_T("msgid \"") + str[i] + _T("\"\nmsgstr \"\"\n\n")); + fout.Write(_T("_(\"") + str[i] + _T("\")\n")); if (!parOutput) fout.Detach(); }