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
22 #include "wx/wxcrtvararg.h"
25 #include "wx/cmdline.h"
26 #include "wx/xml/xml.h"
28 #include "wx/filename.h"
29 #include "wx/wfstream.h"
31 #include "wx/hashset.h"
33 WX_DECLARE_HASH_SET(wxString
, wxStringHash
, wxStringEqual
, StringSet
);
38 XRCWidgetData(const wxString
& vname
,const wxString
& vclass
)
39 : m_class(vclass
), m_name(vname
) {}
40 const wxString
& GetName() const { return m_name
; }
41 const wxString
& GetClass() const { return m_class
; }
47 #include "wx/arrimpl.cpp"
48 WX_DECLARE_OBJARRAY(XRCWidgetData
,ArrayOfXRCWidgetData
);
49 WX_DEFINE_OBJARRAY(ArrayOfXRCWidgetData
)
55 wxString m_parentClassName
;
56 StringSet m_ancestorClassNames
;
57 ArrayOfXRCWidgetData m_wdata
;
59 void BrowseXmlNode(wxXmlNode
* node
)
66 if (node
->GetName() == _T("object")
67 && node
->GetPropVal(_T("class"),&classValue
)
68 && node
->GetPropVal(_T("name"),&nameValue
))
70 m_wdata
.Add(XRCWidgetData(nameValue
,classValue
));
72 children
= node
->GetChildren();
74 BrowseXmlNode(children
);
75 node
= node
->GetNext();
80 XRCWndClassData(const wxString
& className
,
81 const wxString
& parentClassName
,
82 const wxXmlNode
* node
) :
83 m_className(className
) , m_parentClassName(parentClassName
)
85 if ( className
== _T("wxMenu") )
87 m_ancestorClassNames
.insert(_T("wxMenu"));
88 m_ancestorClassNames
.insert(_T("wxMenuBar"));
90 else if ( className
== _T("wxMDIChildFrame") )
92 m_ancestorClassNames
.insert(_T("wxMDIParentFrame"));
94 else if( className
== _T("wxMenuBar") ||
95 className
== _T("wxStatusBar") ||
96 className
== _T("wxToolBar") )
98 m_ancestorClassNames
.insert(_T("wxFrame"));
102 m_ancestorClassNames
.insert(_T("wxWindow"));
105 BrowseXmlNode(node
->GetChildren());
108 const ArrayOfXRCWidgetData
& GetWidgetData()
113 bool CanBeUsedWithXRCCTRL(const wxString
& name
)
115 if (name
== _T("tool") ||
116 name
== _T("data") ||
117 name
== _T("unknown") ||
118 name
== _T("notebookpage") ||
119 name
== _T("separator") ||
120 name
== _T("sizeritem") ||
121 name
== _T("wxMenuBar") ||
122 name
== _T("wxMenuItem") ||
123 name
== _T("wxStaticBoxSizer") )
130 void GenerateHeaderCode(wxFFile
& file
)
133 file
.Write(_T("class ") + m_className
+ _T(" : public ") + m_parentClassName
134 + _T(" {\nprotected:\n"));
136 for(i
=0;i
<m_wdata
.GetCount();++i
)
138 const XRCWidgetData
& w
= m_wdata
.Item(i
);
139 if( !CanBeUsedWithXRCCTRL(w
.GetClass()) ) continue;
140 if( w
.GetName().Length() == 0 ) continue;
142 _T(" ") + w
.GetClass() + _T("* ") + w
.GetName()
145 file
.Write(_T("\nprivate:\n void InitWidgetsFromXRC(wxWindow *parent){\n")
146 _T(" wxXmlResource::Get()->LoadObject(this,parent,_T(\"")
151 for(i
=0;i
<m_wdata
.GetCount();++i
)
153 const XRCWidgetData
& w
= m_wdata
.Item(i
);
154 if( !CanBeUsedWithXRCCTRL(w
.GetClass()) ) continue;
155 if( w
.GetName().Length() == 0 ) continue;
158 + _T(" = XRCCTRL(*this,\"")
164 file
.Write(_T(" }\n"));
166 file
.Write( _T("public:\n"));
168 if ( m_ancestorClassNames
.size() == 1 )
174 *m_ancestorClassNames
.begin() +
175 _T(" *parent=NULL){\n") +
176 _T(" InitWidgetsFromXRC((wxWindow *)parent);\n")
183 file
.Write(m_className
+ _T("(){\n") +
184 _T(" InitWidgetsFromXRC(NULL);\n")
188 for ( StringSet::const_iterator it
= m_ancestorClassNames
.begin();
189 it
!= m_ancestorClassNames
.end();
192 file
.Write(m_className
+ _T("(") + *it
+ _T(" *parent){\n") +
193 _T(" InitWidgetsFromXRC((wxWindow *)parent);\n")
200 WX_DECLARE_OBJARRAY(XRCWndClassData
,ArrayOfXRCWndClassData
);
201 WX_DEFINE_OBJARRAY(ArrayOfXRCWndClassData
)
204 class XmlResApp
: public wxAppConsole
207 // don't use builtin cmd line parsing:
208 virtual bool OnInit() { return true; }
212 void ParseParams(const wxCmdLineParser
& cmdline
);
214 wxArrayString
PrepareTempFiles();
215 void FindFilesInXML(wxXmlNode
*node
, wxArrayString
& flist
, const wxString
& inputPath
);
217 wxString
GetInternalFileName(const wxString
& name
, const wxArrayString
& flist
);
218 void DeleteTempFiles(const wxArrayString
& flist
);
219 void MakePackageZIP(const wxArrayString
& flist
);
220 void MakePackageCPP(const wxArrayString
& flist
);
221 void MakePackagePython(const wxArrayString
& flist
);
223 void OutputGettext();
224 wxArrayString
FindStrings();
225 wxArrayString
FindStrings(wxXmlNode
*node
);
227 bool flagVerbose
, flagCPP
, flagPython
, flagGettext
;
228 wxString parOutput
, parFuncname
, parOutputPath
;
229 wxArrayString parFiles
;
232 ArrayOfXRCWndClassData aXRCWndClassData
;
237 IMPLEMENT_APP_CONSOLE(XmlResApp
)
239 int XmlResApp::OnRun()
241 static const wxCmdLineEntryDesc cmdLineDesc
[] =
243 { wxCMD_LINE_SWITCH
, _T("h"), _T("help"), _T("show help message"),
244 wxCMD_LINE_VAL_NONE
, wxCMD_LINE_OPTION_HELP
},
245 { wxCMD_LINE_SWITCH
, _T("v"), _T("verbose"), _T("be verbose"), (wxCmdLineParamType
)0, 0 },
246 { wxCMD_LINE_SWITCH
, _T("e"), _T("extra-cpp-code"), _T("output C++ header file with XRC derived classes"), (wxCmdLineParamType
)0, 0 },
247 { wxCMD_LINE_SWITCH
, _T("c"), _T("cpp-code"), _T("output C++ source rather than .rsc file"), (wxCmdLineParamType
)0, 0 },
248 { wxCMD_LINE_SWITCH
, _T("p"), _T("python-code"), _T("output wxPython source rather than .rsc file"), (wxCmdLineParamType
)0, 0 },
249 { wxCMD_LINE_SWITCH
, _T("g"), _T("gettext"), _T("output list of translatable strings (to stdout or file if -o used)"), (wxCmdLineParamType
)0, 0 },
250 { wxCMD_LINE_OPTION
, _T("n"), _T("function"), _T("C++/Python function name (with -c or -p) [InitXmlResource]"), (wxCmdLineParamType
)0, 0 },
251 { wxCMD_LINE_OPTION
, _T("o"), _T("output"), _T("output file [resource.xrs/cpp]"), (wxCmdLineParamType
)0, 0 },
252 #if 0 // not yet implemented
253 { wxCMD_LINE_OPTION
, _T("l"), _T("list-of-handlers"), _T("output list of necessary handlers to this file"), (wxCmdLineParamType
)0, 0 },
255 { wxCMD_LINE_PARAM
, NULL
, NULL
, _T("input file(s)"),
256 wxCMD_LINE_VAL_STRING
,
257 wxCMD_LINE_PARAM_MULTIPLE
| wxCMD_LINE_OPTION_MANDATORY
},
259 { wxCMD_LINE_NONE
, NULL
, NULL
, NULL
, (wxCmdLineParamType
)0, 0 }
262 wxCmdLineParser
parser(cmdLineDesc
, argc
, argv
);
264 switch (parser
.Parse())
284 void XmlResApp::ParseParams(const wxCmdLineParser
& cmdline
)
286 flagGettext
= cmdline
.Found(_T("g"));
287 flagVerbose
= cmdline
.Found(_T("v"));
288 flagCPP
= cmdline
.Found(_T("c"));
289 flagPython
= cmdline
.Found(_T("p"));
290 flagH
= flagCPP
&& cmdline
.Found(_T("e"));
293 if (!cmdline
.Found(_T("o"), &parOutput
))
296 parOutput
= wxEmptyString
;
300 parOutput
= _T("resource.cpp");
302 parOutput
= _T("resource.py");
304 parOutput
= _T("resource.xrs");
307 if (!parOutput
.empty())
309 wxFileName
fn(parOutput
);
311 parOutput
= fn
.GetFullPath();
312 parOutputPath
= wxPathOnly(parOutput
);
314 if (!parOutputPath
) parOutputPath
= _T(".");
316 if (!cmdline
.Found(_T("n"), &parFuncname
))
317 parFuncname
= _T("InitXmlResource");
319 for (size_t i
= 0; i
< cmdline
.GetParamCount(); i
++)
322 wxString fn
=wxFindFirstFile(cmdline
.GetParam(i
), wxFILE
);
329 parFiles
.Add(cmdline
.GetParam(i
));
337 void XmlResApp::CompileRes()
339 wxArrayString files
= PrepareTempFiles();
341 wxRemoveFile(parOutput
);
346 MakePackageCPP(files
);
351 MakePackagePython(files
);
353 MakePackageZIP(files
);
356 DeleteTempFiles(files
);
360 wxString
XmlResApp::GetInternalFileName(const wxString
& name
, const wxArrayString
& flist
)
362 wxString name2
= name
;
363 name2
.Replace(_T(":"), _T("_"));
364 name2
.Replace(_T("/"), _T("_"));
365 name2
.Replace(_T("\\"), _T("_"));
366 name2
.Replace(_T("*"), _T("_"));
367 name2
.Replace(_T("?"), _T("_"));
369 wxString s
= wxFileNameFromPath(parOutput
) + _T("$") + name2
;
371 if (wxFileExists(s
) && flist
.Index(s
) == wxNOT_FOUND
)
373 for (int i
= 0;; i
++)
375 s
.Printf(wxFileNameFromPath(parOutput
) + _T("$%03i-") + name2
, i
);
376 if (!wxFileExists(s
) || flist
.Index(s
) != wxNOT_FOUND
)
383 wxArrayString
XmlResApp::PrepareTempFiles()
387 for (size_t i
= 0; i
< parFiles
.GetCount(); i
++)
390 wxPrintf(_T("processing ") + parFiles
[i
] + _T("...\n"));
394 if (!doc
.Load(parFiles
[i
]))
396 wxLogError(_T("Error parsing file ") + parFiles
[i
]);
401 wxString name
, ext
, path
;
402 wxSplitPath(parFiles
[i
], &path
, &name
, &ext
);
404 FindFilesInXML(doc
.GetRoot(), flist
, path
);
407 wxXmlNode
* node
= (doc
.GetRoot())->GetChildren();
408 wxString classValue
,nameValue
;
410 if(node
->GetName() == _T("object")
411 && node
->GetPropVal(_T("class"),&classValue
)
412 && node
->GetPropVal(_T("name"),&nameValue
)){
414 aXRCWndClassData
.Add(
415 XRCWndClassData(nameValue
,classValue
,node
)
418 node
= node
-> GetNext();
421 wxString internalName
= GetInternalFileName(parFiles
[i
], flist
);
423 doc
.Save(parOutputPath
+ wxFILE_SEP_PATH
+ internalName
);
424 flist
.Add(internalName
);
431 // Does 'node' contain filename information at all?
432 static bool NodeContainsFilename(wxXmlNode
*node
)
434 const wxString name
= node
->GetName();
436 // Any bitmaps (bitmap2 is used for disabled toolbar buttons):
437 if ( name
== _T("bitmap") || name
== _T("bitmap2") )
440 if ( name
== _T("icon") )
443 // URLs in wxHtmlWindow:
444 if ( name
== _T("url") )
448 wxXmlNode
*parent
= node
->GetParent();
449 if (parent
!= NULL
&&
450 parent
->GetPropVal(_T("class"), _T("")) == _T("wxBitmapButton") &&
451 (name
== _T("focus") ||
452 name
== _T("disabled") ||
453 name
== _T("selected")))
456 // wxBitmap or wxIcon toplevel resources:
457 if ( name
== _T("object") )
459 wxString klass
= node
->GetPropVal(_T("class"), wxEmptyString
);
460 if (klass
== _T("wxBitmap") ||
461 klass
== _T("wxIcon") ||
462 klass
== _T("data") )
469 // find all files mentioned in structure, e.g. <bitmap>filename</bitmap>
470 void XmlResApp::FindFilesInXML(wxXmlNode
*node
, wxArrayString
& flist
, const wxString
& inputPath
)
472 // Is 'node' XML node element?
473 if (node
== NULL
) return;
474 if (node
->GetType() != wxXML_ELEMENT_NODE
) return;
476 bool containsFilename
= NodeContainsFilename(node
);
478 wxXmlNode
*n
= node
->GetChildren();
481 if (containsFilename
&&
482 (n
->GetType() == wxXML_TEXT_NODE
||
483 n
->GetType() == wxXML_CDATA_SECTION_NODE
))
486 if (wxIsAbsolutePath(n
->GetContent()) || inputPath
.empty())
487 fullname
= n
->GetContent();
489 fullname
= inputPath
+ wxFILE_SEP_PATH
+ n
->GetContent();
492 wxPrintf(_T("adding ") + fullname
+ _T("...\n"));
494 wxString filename
= GetInternalFileName(n
->GetContent(), flist
);
495 n
->SetContent(filename
);
497 if (flist
.Index(filename
) == wxNOT_FOUND
)
500 wxFileInputStream
sin(fullname
);
501 wxFileOutputStream
sout(parOutputPath
+ wxFILE_SEP_PATH
+ filename
);
502 sin
.Read(sout
); // copy the stream
506 if (n
->GetType() == wxXML_ELEMENT_NODE
)
507 FindFilesInXML(n
, flist
, inputPath
);
515 void XmlResApp::DeleteTempFiles(const wxArrayString
& flist
)
517 for (size_t i
= 0; i
< flist
.GetCount(); i
++)
518 wxRemoveFile(parOutputPath
+ wxFILE_SEP_PATH
+ flist
[i
]);
523 void XmlResApp::MakePackageZIP(const wxArrayString
& flist
)
527 for (size_t i
= 0; i
< flist
.GetCount(); i
++)
528 files
+= flist
[i
] + _T(" ");
532 wxPrintf(_T("compressing ") + parOutput
+ _T("...\n"));
534 wxString cwd
= wxGetCwd();
535 wxSetWorkingDirectory(parOutputPath
);
536 int execres
= wxExecute(_T("zip -9 -j ") +
537 wxString(flagVerbose
? _T("\"") : _T("-q \"")) +
538 parOutput
+ _T("\" ") + files
, true);
539 wxSetWorkingDirectory(cwd
);
542 wxLogError(_T("Unable to execute zip program. Make sure it is in the path."));
543 wxLogError(_T("You can download it at http://www.cdrom.com/pub/infozip/"));
551 static wxString
FileToCppArray(wxString filename
, int num
)
556 wxFFile
file(filename
, wxT("rb"));
557 wxFileOffset offset
= file
.Length();
558 wxASSERT_MSG( offset
>= 0 , wxT("Invalid file length") );
560 const size_t lng
= wx_truncate_cast(size_t, offset
);
561 wxASSERT_MSG( lng
== offset
, wxT("Huge file not supported") );
563 snum
.Printf(_T("%i"), num
);
564 output
.Printf(_T("static size_t xml_res_size_") + snum
+ _T(" = %i;\n"), lng
);
565 output
+= _T("static unsigned char xml_res_file_") + snum
+ _T("[] = {\n");
566 // we cannot use string literals because MSVC is dumb wannabe compiler
567 // with arbitrary limitation to 2048 strings :(
569 unsigned char *buffer
= new unsigned char[lng
];
570 file
.Read(buffer
, lng
);
572 for (size_t i
= 0, linelng
= 0; i
< lng
; i
++)
574 tmp
.Printf(_T("%i"), buffer
[i
]);
575 if (i
!= 0) output
<< _T(',');
582 linelng
+= tmp
.Length()+1;
587 output
+= _T("};\n\n");
593 void XmlResApp::MakePackageCPP(const wxArrayString
& flist
)
595 wxFFile
file(parOutput
, wxT("wt"));
599 wxPrintf(_T("creating C++ source file ") + parOutput
+ _T("...\n"));
603 _T("// This file was automatically generated by wxrc, do not edit by hand.\n")
605 _T("#include <wx/wxprec.h>\n")
607 _T("#ifdef __BORLANDC__\n")
608 _T(" #pragma hdrstop\n")
612 _T("#include <wx/filesys.h>\n")
613 _T("#include <wx/fs_mem.h>\n")
614 _T("#include <wx/xrc/xmlres.h>\n")
615 _T("#include <wx/xrc/xh_all.h>\n")
618 for (i
= 0; i
< flist
.GetCount(); i
++)
620 FileToCppArray(parOutputPath
+ wxFILE_SEP_PATH
+ flist
[i
], i
));
623 _T("void ") + parFuncname
+ wxT("()\n")
626 _T(" // Check for memory FS. If not present, load the handler:\n")
628 _T(" wxMemoryFSHandler::AddFile(wxT(\"XRC_resource/dummy_file\"), wxT(\"dummy one\"));\n")
629 _T(" wxFileSystem fsys;\n")
630 _T(" wxFSFile *f = fsys.OpenFile(wxT(\"memory:XRC_resource/dummy_file\"));\n")
631 _T(" wxMemoryFSHandler::RemoveFile(wxT(\"XRC_resource/dummy_file\"));\n")
632 _T(" if (f) delete f;\n")
633 _T(" else wxFileSystem::AddHandler(new wxMemoryFSHandler);\n")
637 for (i
= 0; i
< flist
.GetCount(); i
++)
640 s
.Printf(_T(" wxMemoryFSHandler::AddFile(wxT(\"XRC_resource/") + flist
[i
] +
641 _T("\"), xml_res_file_%i, xml_res_size_%i);\n"), i
, i
);
645 for (i
= 0; i
< parFiles
.GetCount(); i
++)
647 file
.Write(_T(" wxXmlResource::Get()->Load(wxT(\"memory:XRC_resource/") +
648 GetInternalFileName(parFiles
[i
], flist
) + _T("\"));\n"));
651 file
.Write(_T("}\n"));
656 void XmlResApp::GenCPPHeader()
658 wxString fileSpec
= ((parOutput
.BeforeLast('.')).AfterLast('/')).AfterLast('\\');
659 wxString heaFileName
= fileSpec
+ _T(".h");
661 wxFFile
file(heaFileName
, wxT("wt"));
664 _T("// This file was automatically generated by wxrc, do not edit by hand.\n")
666 _T("#ifndef __") + fileSpec
+ _T("_h__\n")
667 _T("#define __") + fileSpec
+ _T("_h__\n")
669 for(size_t i
=0;i
<aXRCWndClassData
.GetCount();++i
){
670 aXRCWndClassData
.Item(i
).GenerateHeaderCode(file
);
675 + _T("();\n#endif\n"));
678 static wxString
FileToPythonArray(wxString filename
, int num
)
683 wxFFile
file(filename
, wxT("rb"));
684 wxFileOffset offset
= file
.Length();
685 wxASSERT_MSG( offset
>= 0 , wxT("Invalid file length") );
687 const size_t lng
= wx_truncate_cast(size_t, offset
);
688 wxASSERT_MSG( offset
== lng
, wxT("Huge file not supported") );
690 snum
.Printf(_T("%i"), num
);
691 output
= _T(" xml_res_file_") + snum
+ _T(" = '''\\\n");
693 unsigned char *buffer
= new unsigned char[lng
];
694 file
.Read(buffer
, lng
);
696 for (size_t i
= 0, linelng
= 0; i
< lng
; i
++)
698 unsigned char c
= buffer
[i
];
704 else if (c
< 32 || c
> 127 || c
== '\'')
705 tmp
.Printf(_T("\\x%02x"), c
);
713 output
<< _T("\\\n");
716 linelng
+= tmp
.Length();
721 output
+= _T("'''\n\n");
727 void XmlResApp::MakePackagePython(const wxArrayString
& flist
)
729 wxFFile
file(parOutput
, wxT("wt"));
733 wxPrintf(_T("creating Python source file ") + parOutput
+ _T("...\n"));
737 _T("# This file was automatically generated by wxrc, do not edit by hand.\n")
740 _T("import wx.xrc\n\n")
744 file
.Write(_T("def ") + parFuncname
+ _T("():\n"));
746 for (i
= 0; i
< flist
.GetCount(); i
++)
748 FileToPythonArray(parOutputPath
+ wxFILE_SEP_PATH
+ flist
[i
], i
));
751 _T(" # check if the memory filesystem handler has been loaded yet, and load it if not\n")
752 _T(" wx.MemoryFSHandler.AddFile('XRC_resource/dummy_file', 'dummy value')\n")
753 _T(" fsys = wx.FileSystem()\n")
754 _T(" f = fsys.OpenFile('memory:XRC_resource/dummy_file')\n")
755 _T(" wx.MemoryFSHandler.RemoveFile('XRC_resource/dummy_file')\n")
756 _T(" if f is not None:\n")
759 _T(" wx.FileSystem.AddHandler(wx.MemoryFSHandler())\n")
761 _T(" # load all the strings as memory files and load into XmlRes\n")
765 for (i
= 0; i
< flist
.GetCount(); i
++)
768 s
.Printf(_T(" wx.MemoryFSHandler.AddFile('XRC_resource/") + flist
[i
] +
769 _T("', xml_res_file_%i)\n"), i
);
772 for (i
= 0; i
< parFiles
.GetCount(); i
++)
774 file
.Write(_T(" wx.xrc.XmlResource.Get().Load('memory:XRC_resource/") +
775 GetInternalFileName(parFiles
[i
], flist
) + _T("')\n"));
778 file
.Write(_T("\n"));
783 void XmlResApp::OutputGettext()
785 wxArrayString str
= FindStrings();
788 if (parOutput
.empty())
791 fout
.Open(parOutput
, wxT("wt"));
793 for (size_t i
= 0; i
< str
.GetCount(); i
++)
794 fout
.Write(_T("_(\"") + str
[i
] + _T("\");\n"));
796 if (!parOutput
) fout
.Detach();
801 wxArrayString
XmlResApp::FindStrings()
803 wxArrayString arr
, a2
;
805 for (size_t i
= 0; i
< parFiles
.GetCount(); i
++)
808 wxPrintf(_T("processing ") + parFiles
[i
] + _T("...\n"));
811 if (!doc
.Load(parFiles
[i
]))
813 wxLogError(_T("Error parsing file ") + parFiles
[i
]);
817 a2
= FindStrings(doc
.GetRoot());
818 WX_APPEND_ARRAY(arr
, a2
);
826 static wxString
ConvertText(const wxString
& str
)
831 for (dt
= str
.c_str(); *dt
; dt
++)
835 if ( *(++dt
) == wxT('_') )
838 str2
<< wxT('&') << *dt
;
844 case wxT('\n') : str2
<< wxT("\\n"); break;
845 case wxT('\t') : str2
<< wxT("\\t"); break;
846 case wxT('\r') : str2
<< wxT("\\r"); break;
847 case wxT('\\') : if ((*(dt
+1) != 'n') &&
854 case wxT('"') : str2
<< wxT("\\\""); break;
855 default : str2
<< *dt
; break;
864 wxArrayString
XmlResApp::FindStrings(wxXmlNode
*node
)
869 if (n
== NULL
) return arr
;
870 n
= n
->GetChildren();
874 if ((node
->GetType() == wxXML_ELEMENT_NODE
) &&
875 // parent is an element, i.e. has subnodes...
876 (n
->GetType() == wxXML_TEXT_NODE
||
877 n
->GetType() == wxXML_CDATA_SECTION_NODE
) &&
878 // ...it is textnode...
880 node
/*not n!*/->GetName() == _T("label") ||
881 (node
/*not n!*/->GetName() == _T("value") &&
882 !n
->GetContent().IsNumber()) ||
883 node
/*not n!*/->GetName() == _T("help") ||
884 node
/*not n!*/->GetName() == _T("longhelp") ||
885 node
/*not n!*/->GetName() == _T("tooltip") ||
886 node
/*not n!*/->GetName() == _T("htmlcode") ||
887 node
/*not n!*/->GetName() == _T("title") ||
888 node
/*not n!*/->GetName() == _T("item")
890 // ...and known to contain translatable string
893 node
->GetPropVal(_T("translate"), _T("1")) != _T("0"))
895 arr
.Add(ConvertText(n
->GetContent()));
900 if (n
->GetType() == wxXML_ELEMENT_NODE
)
902 wxArrayString a2
= FindStrings(n
);
903 WX_APPEND_ARRAY(arr
, a2
);