fix for filenames extraction for wxBitmapButton
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17289 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -251,24 +251,35 @@ wxArrayString XmlResApp::PrepareTempFiles()
|
|||||||
// find all files mentioned in structure, e.g. <bitmap>filename</bitmap>
|
// find all files mentioned in structure, e.g. <bitmap>filename</bitmap>
|
||||||
void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath)
|
void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath)
|
||||||
{
|
{
|
||||||
wxXmlNode *n = node;
|
// Is 'node' XML node element?
|
||||||
if (n == NULL) return;
|
if (node == NULL) return;
|
||||||
n = n->GetChildren();
|
if (node->GetType() != wxXML_ELEMENT_NODE) return;
|
||||||
|
|
||||||
|
// Does 'node' contain filename information at all?
|
||||||
|
if (
|
||||||
|
// Any bitmaps:
|
||||||
|
(node->GetName() == _T("bitmap")) ||
|
||||||
|
// URLs in wxHtmlWindow:
|
||||||
|
(node->GetName() == _T("url")) ||
|
||||||
|
// wxBitmapButton:
|
||||||
|
(node->GetParent() != NULL &&
|
||||||
|
node->GetParent()->GetPropVal(_T("class"), _T("")) == _T("wxBitmapButton") &&
|
||||||
|
(node->GetName() == _T("focus") ||
|
||||||
|
node->GetName() == _T("disabled") ||
|
||||||
|
node->GetName() == _T("selected")))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
wxXmlNode *n = node->GetChildren();
|
||||||
while (n)
|
while (n)
|
||||||
{
|
{
|
||||||
if ((node->GetType() == wxXML_ELEMENT_NODE) &&
|
if (n->GetType() == wxXML_TEXT_NODE ||
|
||||||
// parent is an element, i.e. has subnodes...
|
n->GetType() == wxXML_CDATA_SECTION_NODE)
|
||||||
(n->GetType() == wxXML_TEXT_NODE ||
|
|
||||||
n->GetType() == wxXML_CDATA_SECTION_NODE) &&
|
|
||||||
// ...it is textnode...
|
|
||||||
((node/*not n!*/->GetName() == "bitmap") ||
|
|
||||||
(node/*not n!*/->GetName() == "url")))
|
|
||||||
// ...and known to contain filename
|
|
||||||
{
|
{
|
||||||
wxString fullname;
|
wxString fullname;
|
||||||
if (wxIsAbsolutePath(n->GetContent()) || inputPath == "") fullname = n->GetContent();
|
if (wxIsAbsolutePath(n->GetContent()) || inputPath == "")
|
||||||
else fullname = inputPath + "/" + n->GetContent();
|
fullname = n->GetContent();
|
||||||
|
else
|
||||||
|
fullname = inputPath + "/" + n->GetContent();
|
||||||
|
|
||||||
if (flagVerbose)
|
if (flagVerbose)
|
||||||
wxPrintf("adding " + fullname + "...\n");
|
wxPrintf("adding " + fullname + "...\n");
|
||||||
@@ -289,6 +300,7 @@ void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxSt
|
|||||||
|
|
||||||
n = n->GetNext();
|
n = n->GetNext();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -251,24 +251,35 @@ wxArrayString XmlResApp::PrepareTempFiles()
|
|||||||
// find all files mentioned in structure, e.g. <bitmap>filename</bitmap>
|
// find all files mentioned in structure, e.g. <bitmap>filename</bitmap>
|
||||||
void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath)
|
void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxString& inputPath)
|
||||||
{
|
{
|
||||||
wxXmlNode *n = node;
|
// Is 'node' XML node element?
|
||||||
if (n == NULL) return;
|
if (node == NULL) return;
|
||||||
n = n->GetChildren();
|
if (node->GetType() != wxXML_ELEMENT_NODE) return;
|
||||||
|
|
||||||
|
// Does 'node' contain filename information at all?
|
||||||
|
if (
|
||||||
|
// Any bitmaps:
|
||||||
|
(node->GetName() == _T("bitmap")) ||
|
||||||
|
// URLs in wxHtmlWindow:
|
||||||
|
(node->GetName() == _T("url")) ||
|
||||||
|
// wxBitmapButton:
|
||||||
|
(node->GetParent() != NULL &&
|
||||||
|
node->GetParent()->GetPropVal(_T("class"), _T("")) == _T("wxBitmapButton") &&
|
||||||
|
(node->GetName() == _T("focus") ||
|
||||||
|
node->GetName() == _T("disabled") ||
|
||||||
|
node->GetName() == _T("selected")))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
wxXmlNode *n = node->GetChildren();
|
||||||
while (n)
|
while (n)
|
||||||
{
|
{
|
||||||
if ((node->GetType() == wxXML_ELEMENT_NODE) &&
|
if (n->GetType() == wxXML_TEXT_NODE ||
|
||||||
// parent is an element, i.e. has subnodes...
|
n->GetType() == wxXML_CDATA_SECTION_NODE)
|
||||||
(n->GetType() == wxXML_TEXT_NODE ||
|
|
||||||
n->GetType() == wxXML_CDATA_SECTION_NODE) &&
|
|
||||||
// ...it is textnode...
|
|
||||||
((node/*not n!*/->GetName() == "bitmap") ||
|
|
||||||
(node/*not n!*/->GetName() == "url")))
|
|
||||||
// ...and known to contain filename
|
|
||||||
{
|
{
|
||||||
wxString fullname;
|
wxString fullname;
|
||||||
if (wxIsAbsolutePath(n->GetContent()) || inputPath == "") fullname = n->GetContent();
|
if (wxIsAbsolutePath(n->GetContent()) || inputPath == "")
|
||||||
else fullname = inputPath + "/" + n->GetContent();
|
fullname = n->GetContent();
|
||||||
|
else
|
||||||
|
fullname = inputPath + "/" + n->GetContent();
|
||||||
|
|
||||||
if (flagVerbose)
|
if (flagVerbose)
|
||||||
wxPrintf("adding " + fullname + "...\n");
|
wxPrintf("adding " + fullname + "...\n");
|
||||||
@@ -289,6 +300,7 @@ void XmlResApp::FindFilesInXML(wxXmlNode *node, wxArrayString& flist, const wxSt
|
|||||||
|
|
||||||
n = n->GetNext();
|
n = n->GetNext();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user