1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: XML resource compiler
4 // Author: Vaclav Slavik, Eduardo Marques <edrdo@netcabo.pt>
7 // Copyright: (c) 2000 Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx/wx.h".
12 #include "wx/wxprec.h"
18 // for all others, include the necessary headers
24 #include "wx/cmdline.h"
25 #include "wx/xml/xml.h"
27 #include "wx/filename.h"
28 #include "wx/wfstream.h"
30 #include "wx/hashset.h"
32 WX_DECLARE_HASH_SET(wxString
, wxStringHash
, wxStringEqual
, StringSet
);
37 XRCWidgetData(const wxString
& vname
,const wxString
& vclass
)
38 : m_class(vclass
), m_name(vname
) {}
39 const wxString
& GetName() const { return m_name
; }
40 const wxString
& GetClass() const { return m_class
; }
46 #include "wx/arrimpl.cpp"
47 WX_DECLARE_OBJARRAY(XRCWidgetData
,ArrayOfXRCWidgetData
);
48 WX_DEFINE_OBJARRAY(ArrayOfXRCWidgetData
)
54 wxString m_parentClassName
;
55 StringSet m_ancestorClassNames
;
56 ArrayOfXRCWidgetData m_wdata
;
58 void BrowseXmlNode(wxXmlNode
* node
)
65 if (node
->GetName() == _T("object")
66 && node
->GetPropVal(_T("class"),&classValue
)
67 && node
->GetPropVal(_T("name"),&nameValue
))
69 m_wdata
.Add(XRCWidgetData(nameValue
,classValue
));
71 children
= node
->GetChildren();
73 BrowseXmlNode(children
);
74 node
= node
->GetNext();
79 XRCWndClassData(const wxString
& className
,
80 const wxString
& parentClassName
,
81 const wxXmlNode
* node
) :
82 m_className(className
) , m_parentClassName(parentClassName
)
84 if ( className
== _T("wxMenu") )
86 m_ancestorClassNames
.insert(_T("wxMenu"));
87 m_ancestorClassNames
.insert(_T("wxMenuBar"));
89 else if ( className
== _T("wxMDIChildFrame") )
91 m_ancestorClassNames
.insert(_T("wxMDIParentFrame"));
93 else if( className
== _T("wxMenuBar") ||
94 className
== _T("wxStatusBar") ||
95 className
== _T("wxToolBar") )
97 m_ancestorClassNames
.insert(_T("wxFrame"));
101 m_ancestorClassNames
.insert(_T("wxWindow"));
104 BrowseXmlNode(node
->GetChildren());
107 const ArrayOfXRCWidgetData
& GetWidgetData()
112 bool CanBeUsedWithXRCCTRL(const wxString
& name
)
114 if (name
== _T("tool") ||
115 name
== _T("unknown") ||
116 name
== _T("notebookpage") ||
117 name
== _T("separator") ||
118 name
== _T("sizeritem") ||
119 name
== _T("wxMenuBar") ||
120 name
== _T("wxMenuItem") ||
121 name
== _T("wxStaticBoxSizer") )
128 void GenerateHeaderCode(wxFFile
& file
)
131 file
.Write(_T("class ") + m_className
+ _T(" : public ") + m_parentClassName
132 + _T(" {\nprotected:\n"));
134 for(i
=0;i
<m_wdata
.Count();++i
)
136 const XRCWidgetData
& w
= m_wdata
.Item(i
);
137 if( !CanBeUsedWithXRCCTRL(w
.GetClass()) ) continue;
138 if( w
.GetName().Length() == 0 ) continue;
140 _T(" ") + w
.GetClass() + _T("* ") + w
.GetName()
143 file
.Write(_T("\nprivate:\n void InitWidgetsFromXRC(wxWindow *parent){\n")
144 _T(" wxXmlResource::Get()->LoadObject(this,parent,_T(\"")
149 for(i
=0;i
<m_wdata
.Count();++i
)
151 const XRCWidgetData
& w
= m_wdata
.Item(i
);
152 if( !CanBeUsedWithXRCCTRL(w
.GetClass()) ) continue;
153 if( w
.GetName().Length() == 0 ) continue;
156 + _T(" = XRCCTRL(*this,\"")
162 file
.Write(_T(" }\n"));
164 file
.Write( _T("public:\n"));
166 if ( m_ancestorClassNames
.size() == 1 )
172 *m_ancestorClassNames
.begin() +
173 _T(" *parent=NULL){\n") +
174 _T(" InitWidgetsFromXRC((wxWindow *)parent);\n")
181 file
.Write(m_className
+ _T("(){\n") +
182 _T(" InitWidgetsFromXRC(NULL);\n")
186 for ( StringSet::const_iterator it
= m_ancestorClassNames
.begin();
187 it
!= m_ancestorClassNames
.end();
190 file
.Write(m_className
+ _T("(") + *it
+ _T(" *parent){\n") +
191 _T(" InitWidgetsFromXRC((wxWindow *)parent);\n")
198 WX_DECLARE_OBJARRAY(XRCWndClassData
,ArrayOfXRCWndClassData
);
199 WX_DEFINE_OBJARRAY(ArrayOfXRCWndClassData
)
202 class XmlResApp
: public wxAppConsole
205 // don't use builtin cmd line parsing:
206 virtual bool OnInit() { return true; }
210 void ParseParams(const wxCmdLineParser
& cmdline
);
212 wxArrayString
PrepareTempFiles();
213 void FindFilesInXML(wxXmlNode
*node
, wxArrayString
& flist
, const wxString
& inputPath
);
215 wxString
GetInternalFileName(const wxString
& name
, const wxArrayString
& flist
);
216 void DeleteTempFiles(const wxArrayString
& flist
);
217 void MakePackageZIP(const wxArrayString
& flist
);
218 void MakePackageCPP(const wxArrayString
& flist
);
219 void MakePackagePython(const wxArrayString
& flist
);
221 void OutputGettext();
222 wxArrayString
FindStrings();
223 wxArrayString
FindStrings(wxXmlNode
*node
);
225 bool flagVerbose
, flagCPP
, flagPython
, flagGettext
;
226 wxString parOutput
, parFuncname
, parOutputPath
;
227 wxArrayString parFiles
;
230 ArrayOfXRCWndClassData aXRCWndClassData
;
235 IMPLEMENT_APP_CONSOLE(XmlResApp
)
237 int XmlResApp::OnRun()
239 static const wxCmdLineEntryDesc cmdLineDesc
[] =
241 { wxCMD_LINE_SWITCH
, _T("h"), _T("help"), _T("show help message"),
242 wxCMD_LINE_VAL_NONE
, wxCMD_LINE_OPTION_HELP
},
243 { wxCMD_LINE_SWITCH
, _T("v"), _T("verbose"), _T("be verbose"), (wxCmdLineParamType
)0, 0 },
244 { wxCMD_LINE_SWITCH
, _T("e"), _T("extra-cpp-code"), _T("output C++ header file with XRC derived classes"), (wxCmdLineParamType
)0, 0 },
245 { wxCMD_LINE_SWITCH
, _T("c"), _T("cpp-code"), _T("output C++ source rather than .rsc file"), (wxCmdLineParamType
)0, 0 },
246 { wxCMD_LINE_SWITCH
, _T("p"), _T("python-code"), _T("output wxPython source rather than .rsc file"), (wxCmdLineParamType
)0, 0 },
247 { wxCMD_LINE_SWITCH
, _T("g"), _T("gettext"), _T("output list of translatable strings (to stdout or file if -o used)"), (wxCmdLineParamType
)0, 0 },
248 { wxCMD_LINE_OPTION
, _T("n"), _T("function"), _T("C++/Python function name (with -c or -p) [InitXmlResource]"), (wxCmdLineParamType
)0, 0 },
249 { wxCMD_LINE_OPTION
, _T("o"), _T("output"), _T("output file [resource.xrs/cpp]"), (wxCmdLineParamType
)0, 0 },
250 #if 0 // not yet implemented
251 { wxCMD_LINE_OPTION
, _T("l"), _T("list-of-handlers"), _T("output list of necessary handlers to this file"), (wxCmdLineParamType
)0, 0 },
253 { wxCMD_LINE_PARAM
, NULL
, NULL
, _T("input file(s)"),
254 wxCMD_LINE_VAL_STRING
,
255 wxCMD_LINE_PARAM_MULTIPLE
| wxCMD_LINE_OPTION_MANDATORY
},
257 { wxCMD_LINE_NONE
, NULL
, NULL
, NULL
, (wxCmdLineParamType
)0, 0 }
260 wxCmdLineParser
parser(cmdLineDesc
, argc
, argv
);
262 switch (parser
.Parse())
282 void XmlResApp::ParseParams(const wxCmdLineParser
& cmdline
)
284 flagGettext
= cmdline
.Found(_T("g"));
285 flagVerbose
= cmdline
.Found(_T("v"));
286 flagCPP
= cmdline
.Found(_T("c"));
287 flagPython
= cmdline
.Found(_T("p"));
288 flagH
= flagCPP
&& cmdline
.Found(_T("e"));
291 if (!cmdline
.Found(_T("o"), &parOutput
))
294 parOutput
= wxEmptyString
;
298 parOutput
= _T("resource.cpp");
300 parOutput
= _T("resource.py");
302 parOutput
= _T("resource.xrs");
305 if (!parOutput
.empty())
307 wxFileName
fn(parOutput
);
309 parOutput
= fn
.GetFullPath();
310 parOutputPath
= wxPathOnly(parOutput
);
312 if (!parOutputPath
) parOutputPath
= _T(".");
314 if (!cmdline
.Found(_T("n"), &parFuncname
))
315 parFuncname
= _T("InitXmlResource");
317 for (size_t i
= 0; i
< cmdline
.GetParamCount(); i
++)
320 wxString fn
=wxFindFirstFile(cmdline
.GetParam(i
), wxFILE
);
327 parFiles
.Add(cmdline
.GetParam(i
));
335 void XmlResApp::CompileRes()
337 wxArrayString files
= PrepareTempFiles();
339 wxRemoveFile(parOutput
);
344 MakePackageCPP(files
);
349 MakePackagePython(files
);
351 MakePackageZIP(files
);
354 DeleteTempFiles(files
);
358 wxString
XmlResApp::GetInternalFileName(const wxString
& name
, const wxArrayString
& flist
)
360 wxString name2
= name
;
361 name2
.Replace(_T(":"), _T("_"));
362 name2
.Replace(_T("/"), _T("_"));
363 name2
.Replace(_T("\\"), _T("_"));
364 name2
.Replace(_T("*"), _T("_"));
365 name2
.Replace(_T("?"), _T("_"));
367 wxString s
= wxFileNameFromPath(parOutput
) + _T("$") + name2
;
369 if (wxFileExists(s
) && flist
.Index(s
) == wxNOT_FOUND
)
371 for (int i
= 0;; i
++)
373 s
.Printf(wxFileNameFromPath(parOutput
) + _T("$%03i-") + name2
, i
);
374 if (!wxFileExists(s
) || flist
.Index(s
) != wxNOT_FOUND
)
381 wxArrayString
XmlResApp::PrepareTempFiles()
385 for (size_t i
= 0; i
< parFiles
.Count(); i
++)
388 wxPrintf(_T("processing ") + parFiles
[i
] + _T("...\n"));
392 if (!doc
.Load(parFiles
[i
]))
394 wxLogError(_T("Error parsing file ") + parFiles
[i
]);
399 wxString name
, ext
, path
;
400 wxSplitPath(parFiles
[i
], &path
, &name
, &ext
);
402 FindFilesInXML(doc
.GetRoot(), flist
, path
);
405 wxXmlNode
* node
= (doc
.GetRoot())->GetChildren();
406 wxString classValue
,nameValue
;
408 if(node
->GetName() == _T("object")
409 && node
->GetPropVal(_T("class"),&classValue
)
410 && node
->GetPropVal(_T("name"),&nameValue
)){
412 aXRCWndClassData
.Add(
413 XRCWndClassData(nameValue
,classValue
,node
)
416 node
= node
-> GetNext();
419 wxString internalName
= GetInternalFileName(parFiles
[i
], flist
);
421 doc
.Save(parOutputPath
+ wxFILE_SEP_PATH
+ internalName
);
422 flist
.Add(internalName
);
429 // Does 'node' contain filename information at all?
430 static bool NodeContainsFilename(wxXmlNode
*node
)
432 const wxString name
= node
->GetName();
434 // Any bitmaps (bitmap2 is used for disabled toolbar buttons):
435 if ( name
== _T("bitmap") || name
== _T("bitmap2") )
438 if ( name
== _T("icon") )
441 // URLs in wxHtmlWindow:
442 if ( name
== _T("url") )
446 wxXmlNode
*parent
= node
->GetParent();
447 if (parent
!= NULL
&&
448 parent
->GetPropVal(_T("class"), _T("")) == _T("wxBitmapButton") &&
449 (name
== _T("focus") ||
450 name
== _T("disabled") ||
451 name
== _T("selected")))
454 // wxBitmap or wxIcon toplevel resources:
455 if ( name
== _T("object") )
457 wxString klass
= node
->GetPropVal(_T("class"), wxEmptyString
);
458 if (klass
== _T("wxBitmap") || klass
== _T("wxIcon"))
465 // find all files mentioned in structure, e.g. <bitmap>filename</bitmap>
466 void XmlResApp::FindFilesInXML(wxXmlNode
*node
, wxArrayString
& flist
, const wxString
& inputPath
)
468 // Is 'node' XML node element?
469 if (node
== NULL
) return;
470 if (node
->GetType() != wxXML_ELEMENT_NODE
) return;
472 bool containsFilename
= NodeContainsFilename(node
);
474 wxXmlNode
*n
= node
->GetChildren();
477 if (containsFilename
&&
478 (n
->GetType() == wxXML_TEXT_NODE
||
479 n
->GetType() == wxXML_CDATA_SECTION_NODE
))
482 if (wxIsAbsolutePath(n
->GetContent()) || inputPath
.empty())
483 fullname
= n
->GetContent();
485 fullname
= inputPath
+ wxFILE_SEP_PATH
+ n
->GetContent();
488 wxPrintf(_T("adding ") + fullname
+ _T("...\n"));
490 wxString filename
= GetInternalFileName(n
->GetContent(), flist
);
491 n
->SetContent(filename
);
493 if (flist
.Index(filename
) == wxNOT_FOUND
)
496 wxFileInputStream
sin(fullname
);
497 wxFileOutputStream
sout(parOutputPath
+ wxFILE_SEP_PATH
+ filename
);
498 sin
.Read(sout
); // copy the stream
502 if (n
->GetType() == wxXML_ELEMENT_NODE
)
503 FindFilesInXML(n
, flist
, inputPath
);
511 void XmlResApp::DeleteTempFiles(const wxArrayString
& flist
)
513 for (size_t i
= 0; i
< flist
.Count(); i
++)
514 wxRemoveFile(parOutputPath
+ wxFILE_SEP_PATH
+ flist
[i
]);
519 void XmlResApp::MakePackageZIP(const wxArrayString
& flist
)
523 for (size_t i
= 0; i
< flist
.Count(); i
++)
524 files
+= flist
[i
] + _T(" ");
528 wxPrintf(_T("compressing ") + parOutput
+ _T("...\n"));
530 wxString cwd
= wxGetCwd();
531 wxSetWorkingDirectory(parOutputPath
);
532 int execres
= wxExecute(_T("zip -9 -j ") +
533 wxString(flagVerbose
? _T("\"") : _T("-q \"")) +
534 parOutput
+ _T("\" ") + files
, true);
535 wxSetWorkingDirectory(cwd
);
538 wxLogError(_T("Unable to execute zip program. Make sure it is in the path."));
539 wxLogError(_T("You can download it at http://www.cdrom.com/pub/infozip/"));
547 static wxString
FileToCppArray(wxString filename
, int num
)
552 wxFFile
file(filename
, wxT("rb"));
553 wxFileOffset offset
= file
.Length();
554 wxASSERT_MSG( offset
>= 0 , wxT("Invalid file length") );
556 const size_t lng
= wx_truncate_cast(size_t, offset
);
557 wxASSERT_MSG( lng
== offset
, wxT("Huge file not supported") );
559 snum
.Printf(_T("%i"), num
);
560 output
.Printf(_T("static size_t xml_res_size_") + snum
+ _T(" = %i;\n"), lng
);
561 output
+= _T("static unsigned char xml_res_file_") + snum
+ _T("[] = {\n");
562 // we cannot use string literals because MSVC is dumb wannabe compiler
563 // with arbitrary limitation to 2048 strings :(
565 unsigned char *buffer
= new unsigned char[lng
];
566 file
.Read(buffer
, lng
);
568 for (size_t i
= 0, linelng
= 0; i
< lng
; i
++)
570 tmp
.Printf(_T("%i"), buffer
[i
]);
571 if (i
!= 0) output
<< _T(',');
578 linelng
+= tmp
.Length()+1;
583 output
+= _T("};\n\n");
589 void XmlResApp::MakePackageCPP(const wxArrayString
& flist
)
591 wxFFile
file(parOutput
, wxT("wt"));
595 wxPrintf(_T("creating C++ source file ") + parOutput
+ _T("...\n"));
599 _T("// This file was automatically generated by wxrc, do not edit by hand.\n")
601 _T("#include <wx/wxprec.h>\n")
603 _T("#ifdef __BORLANDC__\n")
604 _T(" #pragma hdrstop\n")
608 _T("#include <wx/filesys.h>\n")
609 _T("#include <wx/fs_mem.h>\n")
610 _T("#include <wx/xrc/xmlres.h>\n")
611 _T("#include <wx/xrc/xh_all.h>\n")
614 for (i
= 0; i
< flist
.Count(); i
++)
616 FileToCppArray(parOutputPath
+ wxFILE_SEP_PATH
+ flist
[i
], i
));
619 _T("void ") + parFuncname
+ wxT("()\n")
622 _T(" // Check for memory FS. If not present, load the handler:\n")
624 _T(" wxMemoryFSHandler::AddFile(wxT(\"XRC_resource/dummy_file\"), wxT(\"dummy one\"));\n")
625 _T(" wxFileSystem fsys;\n")
626 _T(" wxFSFile *f = fsys.OpenFile(wxT(\"memory:XRC_resource/dummy_file\"));\n")
627 _T(" wxMemoryFSHandler::RemoveFile(wxT(\"XRC_resource/dummy_file\"));\n")
628 _T(" if (f) delete f;\n")
629 _T(" else wxFileSystem::AddHandler(new wxMemoryFSHandler);\n")
633 for (i
= 0; i
< flist
.Count(); i
++)
636 s
.Printf(_T(" wxMemoryFSHandler::AddFile(wxT(\"XRC_resource/") + flist
[i
] +
637 _T("\"), xml_res_file_%i, xml_res_size_%i);\n"), i
, i
);
641 for (i
= 0; i
< parFiles
.Count(); i
++)
643 file
.Write(_T(" wxXmlResource::Get()->Load(wxT(\"memory:XRC_resource/") +
644 GetInternalFileName(parFiles
[i
], flist
) + _T("\"));\n"));
647 file
.Write(_T("}\n"));
652 void XmlResApp::GenCPPHeader()
654 wxString fileSpec
= ((parOutput
.BeforeLast('.')).AfterLast('/')).AfterLast('\\');
655 wxString heaFileName
= fileSpec
+ _T(".h");
657 wxFFile
file(heaFileName
, wxT("wt"));
660 _T("// This file was automatically generated by wxrc, do not edit by hand.\n")
662 _T("#ifndef __") + fileSpec
+ _T("_h__\n")
663 _T("#define __") + fileSpec
+ _T("_h__\n")
665 for(size_t i
=0;i
<aXRCWndClassData
.Count();++i
){
666 aXRCWndClassData
.Item(i
).GenerateHeaderCode(file
);
671 + _T("();\n#endif\n"));
674 static wxString
FileToPythonArray(wxString filename
, int num
)
679 wxFFile
file(filename
, wxT("rb"));
680 wxFileOffset offset
= file
.Length();
681 wxASSERT_MSG( offset
>= 0 , wxT("Invalid file length") );
683 const size_t lng
= wx_truncate_cast(size_t, offset
);
684 wxASSERT_MSG( offset
== lng
, wxT("Huge file not supported") );
686 snum
.Printf(_T("%i"), num
);
687 output
= _T(" xml_res_file_") + snum
+ _T(" = '''\\\n");
689 unsigned char *buffer
= new unsigned char[lng
];
690 file
.Read(buffer
, lng
);
692 for (size_t i
= 0, linelng
= 0; i
< lng
; i
++)
694 unsigned char c
= buffer
[i
];
700 else if (c
< 32 || c
> 127 || c
== '\'')
701 tmp
.Printf(_T("\\x%02x"), c
);
709 output
<< _T("\\\n");
712 linelng
+= tmp
.Length();
717 output
+= _T("'''\n\n");
723 void XmlResApp::MakePackagePython(const wxArrayString
& flist
)
725 wxFFile
file(parOutput
, wxT("wt"));
729 wxPrintf(_T("creating Python source file ") + parOutput
+ _T("...\n"));
733 _T("# This file was automatically generated by wxrc, do not edit by hand.\n")
736 _T("import wx.xrc\n\n")
740 file
.Write(_T("def ") + parFuncname
+ _T("():\n"));
742 for (i
= 0; i
< flist
.Count(); i
++)
744 FileToPythonArray(parOutputPath
+ wxFILE_SEP_PATH
+ flist
[i
], i
));
747 _T(" # check if the memory filesystem handler has been loaded yet, and load it if not\n")
748 _T(" wx.MemoryFSHandler.AddFile('XRC_resource/dummy_file', 'dummy value')\n")
749 _T(" fsys = wx.FileSystem()\n")
750 _T(" f = fsys.OpenFile('memory:XRC_resource/dummy_file')\n")
751 _T(" wx.MemoryFSHandler.RemoveFile('XRC_resource/dummy_file')\n")
752 _T(" if f is not None:\n")
755 _T(" wx.FileSystem.AddHandler(wx.MemoryFSHandler())\n")
757 _T(" # load all the strings as memory files and load into XmlRes\n")
761 for (i
= 0; i
< flist
.Count(); i
++)
764 s
.Printf(_T(" wx.MemoryFSHandler.AddFile('XRC_resource/") + flist
[i
] +
765 _T("', xml_res_file_%i)\n"), i
);
768 for (i
= 0; i
< parFiles
.Count(); i
++)
770 file
.Write(_T(" wx.xrc.XmlResource.Get().Load('memory:XRC_resource/") +
771 GetInternalFileName(parFiles
[i
], flist
) + _T("')\n"));
774 file
.Write(_T("\n"));
779 void XmlResApp::OutputGettext()
781 wxArrayString str
= FindStrings();
784 if (parOutput
.empty())
787 fout
.Open(parOutput
, wxT("wt"));
789 for (size_t i
= 0; i
< str
.GetCount(); i
++)
790 fout
.Write(_T("_(\"") + str
[i
] + _T("\");\n"));
792 if (!parOutput
) fout
.Detach();
797 wxArrayString
XmlResApp::FindStrings()
799 wxArrayString arr
, a2
;
801 for (size_t i
= 0; i
< parFiles
.Count(); i
++)
804 wxPrintf(_T("processing ") + parFiles
[i
] + _T("...\n"));
807 if (!doc
.Load(parFiles
[i
]))
809 wxLogError(_T("Error parsing file ") + parFiles
[i
]);
813 a2
= FindStrings(doc
.GetRoot());
814 WX_APPEND_ARRAY(arr
, a2
);
822 static wxString
ConvertText(const wxString
& str
)
827 for (dt
= str
.c_str(); *dt
; dt
++)
831 if ( *(++dt
) == wxT('_') )
834 str2
<< wxT('&') << *dt
;
840 case wxT('\n') : str2
<< wxT("\\n"); break;
841 case wxT('\t') : str2
<< wxT("\\t"); break;
842 case wxT('\r') : str2
<< wxT("\\r"); break;
843 case wxT('\\') : if ((*(dt
+1) != 'n') &&
850 case wxT('"') : str2
<< wxT("\\\""); break;
851 default : str2
<< *dt
; break;
860 wxArrayString
XmlResApp::FindStrings(wxXmlNode
*node
)
865 if (n
== NULL
) return arr
;
866 n
= n
->GetChildren();
870 if ((node
->GetType() == wxXML_ELEMENT_NODE
) &&
871 // parent is an element, i.e. has subnodes...
872 (n
->GetType() == wxXML_TEXT_NODE
||
873 n
->GetType() == wxXML_CDATA_SECTION_NODE
) &&
874 // ...it is textnode...
876 node
/*not n!*/->GetName() == _T("label") ||
877 (node
/*not n!*/->GetName() == _T("value") &&
878 !n
->GetContent().IsNumber()) ||
879 node
/*not n!*/->GetName() == _T("help") ||
880 node
/*not n!*/->GetName() == _T("longhelp") ||
881 node
/*not n!*/->GetName() == _T("tooltip") ||
882 node
/*not n!*/->GetName() == _T("htmlcode") ||
883 node
/*not n!*/->GetName() == _T("title") ||
884 node
/*not n!*/->GetName() == _T("item")
886 // ...and known to contain translatable string
889 node
->GetPropVal(_T("translate"), _T("1")) != _T("0"))
891 arr
.Add(ConvertText(n
->GetContent()));
896 if (n
->GetType() == wxXML_ELEMENT_NODE
)
898 wxArrayString a2
= FindStrings(n
);
899 WX_APPEND_ARRAY(arr
, a2
);