X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/76806f59067a98cd004359c1f83021c36c7b6d3b..6a205442c40cd6e22efab15fd7170a0aeab99cae:/contrib/src/xrc/xmlres.cpp?ds=sidebyside diff --git a/contrib/src/xrc/xmlres.cpp b/contrib/src/xrc/xmlres.cpp index 52d9881e13..36d3989fc2 100644 --- a/contrib/src/xrc/xmlres.cpp +++ b/contrib/src/xrc/xmlres.cpp @@ -35,7 +35,7 @@ #include "wx/fontmap.h" #include "wx/artprov.h" -#include "wx/xrc/xml.h" +#include "wx/xml/xml.h" #include "wx/xrc/xmlres.h" #include "wx/arrimpl.cpp" @@ -107,7 +107,7 @@ bool wxXmlResource::Load(const wxString& filemask) // filename and not URL: if (wxFileName::FileExists(fnd)) { - // Make the name absolute filename, because the app may + // Make the name absolute filename, because the app may // change working directory later: wxFileName fn(fnd); if (fn.IsRelative()) @@ -115,8 +115,11 @@ bool wxXmlResource::Load(const wxString& filemask) fn.MakeAbsolute(); fnd = fn.GetFullPath(); } +#if wxUSE_FILESYSTEM + fnd = wxFileSystem::FileNameToURL(fnd); +#endif } - + #if wxUSE_FILESYSTEM if (fnd.Lower().Matches(wxT("*.zip")) || fnd.Lower().Matches(wxT("*.xrs"))) @@ -143,6 +146,7 @@ bool wxXmlResource::Load(const wxString& filemask) } +IMPLEMENT_ABSTRACT_CLASS(wxXmlResourceHandler, wxObject) void wxXmlResource::AddHandler(wxXmlResourceHandler *handler) { @@ -283,19 +287,20 @@ static void ProcessPlatformProperty(wxXmlNode *node) while (tkn.HasMoreTokens()) { s = tkn.GetNextToken(); - if ( -#ifdef __WXMSW__ - s == wxString(wxT("win")) +#ifdef __WINDOWS__ + if (s == wxT("win")) isok = true; +#endif +#if defined(__MAC__) || defined(__APPLE__) + if (s == wxT("mac")) isok = true; #elif defined(__UNIX__) - s == wxString(wxT("unix")) -#elif defined(__MAC__) - s == wxString(wxT("mac")) -#elif defined(__OS2__) - s == wxString(wxT("os2")) -#else - FALSE + if (s == wxT("unix")) isok = true; +#endif +#ifdef __OS2__ + if (s == wxT("os2")) isok = true; #endif - ) isok = TRUE; + + if (isok) + break; } } @@ -328,9 +333,9 @@ void wxXmlResource::UpdateResources() #if !wxUSE_UNICODE && wxUSE_INTL if ( (GetFlags() & wxXRC_USE_LOCALE) == 0 ) { - // In case we are not using wxLocale to translate strings, convert the strings - // GUI's charset. This must not be done when wxXRC_USE_LOCALE is on, because - // it could break wxGetTranslation lookup. + // In case we are not using wxLocale to translate strings, convert the + // strings GUI's charset. This must not be done when wxXRC_USE_LOCALE + // is on, because it could break wxGetTranslation lookup. encoding = wxLocale::GetSystemEncodingName(); } #endif @@ -563,14 +568,14 @@ wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent, wxXmlResourceHandler *handler; if (handlerToUse) - { + { if (handlerToUse->CanHandle(node)) { return handlerToUse->CreateResource(node, parent, instance); } } else if (node->GetName() == wxT("object")) - { + { wxNode *ND = m_handlers.GetFirst(); while (ND) { @@ -866,7 +871,8 @@ wxBitmap wxXmlResourceHandler::GetBitmap(const wxString& param, wxFSFile *fsfile = GetCurFileSystem().OpenFile(name); if (fsfile == NULL) { - wxLogError(_("XRC resource: Cannot create bitmap from '%s'."), param.c_str()); + wxLogError(_("XRC resource: Cannot create bitmap from '%s'."), + name.c_str()); return wxNullBitmap; } wxImage img(*(fsfile->GetStream())); @@ -1223,7 +1229,10 @@ static void CleanXRCID_Record(XRCID_record *rec) static void CleanXRCID_Records() { for (int i = 0; i < XRCID_TABLE_SIZE; i++) + { CleanXRCID_Record(XRCID_Records[i]); + XRCID_Records[i] = NULL; + } } static void AddStdXRCID_Records() @@ -1283,5 +1292,3 @@ void wxXmlInitResourceModule() module->Init(); wxModule::RegisterModule(module); } - -