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,43 +251,55 @@ 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;
|
||||||
|
|
||||||
while (n)
|
// 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")))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if ((node->GetType() == wxXML_ELEMENT_NODE) &&
|
wxXmlNode *n = node->GetChildren();
|
||||||
// parent is an element, i.e. has subnodes...
|
while (n)
|
||||||
(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;
|
if (n->GetType() == wxXML_TEXT_NODE ||
|
||||||
if (wxIsAbsolutePath(n->GetContent()) || inputPath == "") fullname = n->GetContent();
|
n->GetType() == wxXML_CDATA_SECTION_NODE)
|
||||||
else fullname = inputPath + "/" + n->GetContent();
|
{
|
||||||
|
wxString fullname;
|
||||||
|
if (wxIsAbsolutePath(n->GetContent()) || inputPath == "")
|
||||||
|
fullname = n->GetContent();
|
||||||
|
else
|
||||||
|
fullname = inputPath + "/" + n->GetContent();
|
||||||
|
|
||||||
if (flagVerbose)
|
if (flagVerbose)
|
||||||
wxPrintf("adding " + fullname + "...\n");
|
wxPrintf("adding " + fullname + "...\n");
|
||||||
|
|
||||||
wxString filename = GetInternalFileName(n->GetContent(), flist);
|
wxString filename = GetInternalFileName(n->GetContent(), flist);
|
||||||
n->SetContent(filename);
|
n->SetContent(filename);
|
||||||
|
|
||||||
flist.Add(filename);
|
flist.Add(filename);
|
||||||
|
|
||||||
wxFileInputStream sin(fullname);
|
wxFileInputStream sin(fullname);
|
||||||
wxFileOutputStream sout(parOutputPath + "/" + filename);
|
wxFileOutputStream sout(parOutputPath + "/" + filename);
|
||||||
sin.Read(sout); // copy the stream
|
sin.Read(sout); // copy the stream
|
||||||
|
}
|
||||||
|
|
||||||
|
// subnodes:
|
||||||
|
if (n->GetType() == wxXML_ELEMENT_NODE)
|
||||||
|
FindFilesInXML(n, flist, inputPath);
|
||||||
|
|
||||||
|
n = n->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
// subnodes:
|
|
||||||
if (n->GetType() == wxXML_ELEMENT_NODE)
|
|
||||||
FindFilesInXML(n, flist, inputPath);
|
|
||||||
|
|
||||||
n = n->GetNext();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -251,43 +251,55 @@ 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;
|
||||||
|
|
||||||
while (n)
|
// 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")))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if ((node->GetType() == wxXML_ELEMENT_NODE) &&
|
wxXmlNode *n = node->GetChildren();
|
||||||
// parent is an element, i.e. has subnodes...
|
while (n)
|
||||||
(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;
|
if (n->GetType() == wxXML_TEXT_NODE ||
|
||||||
if (wxIsAbsolutePath(n->GetContent()) || inputPath == "") fullname = n->GetContent();
|
n->GetType() == wxXML_CDATA_SECTION_NODE)
|
||||||
else fullname = inputPath + "/" + n->GetContent();
|
{
|
||||||
|
wxString fullname;
|
||||||
|
if (wxIsAbsolutePath(n->GetContent()) || inputPath == "")
|
||||||
|
fullname = n->GetContent();
|
||||||
|
else
|
||||||
|
fullname = inputPath + "/" + n->GetContent();
|
||||||
|
|
||||||
if (flagVerbose)
|
if (flagVerbose)
|
||||||
wxPrintf("adding " + fullname + "...\n");
|
wxPrintf("adding " + fullname + "...\n");
|
||||||
|
|
||||||
wxString filename = GetInternalFileName(n->GetContent(), flist);
|
wxString filename = GetInternalFileName(n->GetContent(), flist);
|
||||||
n->SetContent(filename);
|
n->SetContent(filename);
|
||||||
|
|
||||||
flist.Add(filename);
|
flist.Add(filename);
|
||||||
|
|
||||||
wxFileInputStream sin(fullname);
|
wxFileInputStream sin(fullname);
|
||||||
wxFileOutputStream sout(parOutputPath + "/" + filename);
|
wxFileOutputStream sout(parOutputPath + "/" + filename);
|
||||||
sin.Read(sout); // copy the stream
|
sin.Read(sout); // copy the stream
|
||||||
|
}
|
||||||
|
|
||||||
|
// subnodes:
|
||||||
|
if (n->GetType() == wxXML_ELEMENT_NODE)
|
||||||
|
FindFilesInXML(n, flist, inputPath);
|
||||||
|
|
||||||
|
n = n->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
// subnodes:
|
|
||||||
if (n->GetType() == wxXML_ELEMENT_NODE)
|
|
||||||
FindFilesInXML(n, flist, inputPath);
|
|
||||||
|
|
||||||
n = n->GetNext();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user