X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ea57084d103187771c0306a6e1684e32244d6101..7482b22003c03f7aa3335aec271b5fcb48e2693d:/src/common/object.cpp?ds=sidebyside diff --git a/src/common/object.cpp b/src/common/object.cpp index 15e3f0fec0..4ac78acc23 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -21,12 +21,16 @@ #endif #ifndef WX_PRECOMP -#include "wx/hash.h" -#ifdef wxUSE_SERIAL -#include "wx/objstrm.h" -#include "wx/serbase.h" -#endif -#endif + #include "wx/hash.h" + #if wxUSE_SERIAL + #include "wx/objstrm.h" + #include "wx/serbase.h" + + // for error messages + #include "wx/log.h" + #include "wx/intl.h" + #endif // wxUSE_SERIAL +#endif // WX_PRECOMP #include #include @@ -60,7 +64,7 @@ wxHashTable* wxClassInfo::sm_classTable = (wxHashTable*) NULL; wxObject::wxObject(void) { m_refData = (wxObjectRefData *) NULL; -#ifdef wxUSE_SERIAL +#if wxUSE_SERIAL m_serialObj = (wxObject_Serialize *)NULL; #endif } @@ -68,7 +72,7 @@ wxObject::wxObject(void) wxObject::~wxObject(void) { UnRef(); -#ifdef wxUSE_SERIAL +#if wxUSE_SERIAL if (m_serialObj) delete m_serialObj; #endif @@ -125,7 +129,7 @@ void wxObject::operator delete(void* pData, char* /* fileName */, int /* lineNum #endif // Cause problems for VC++ - crashes -#ifndef _MSC_VER +#if !defined(_MSC_VER) && wxUSE_ARRAY_MEMORY_OPERATORS void * wxObject::operator new[] (size_t size, char * fileName, int lineNum) { return wxDebugAlloc(size, fileName, lineNum, TRUE, TRUE); @@ -265,7 +269,7 @@ wxObject *wxCreateDynamicObject(const char *name) return (wxObject*) NULL; } -#ifdef wxUSE_SERIAL +#if wxUSE_SERIAL #include "wx/serbase.h" #include "wx/dynlib.h" @@ -283,19 +287,17 @@ void wxObject::StoreObject( wxObjectOutputStream& stream ) wxLibrary *lib = wxTheLibraries.LoadLibrary("wxserial"); if (!lib) { - wxMessageBox("Can't load wxSerial dynamic library.", "Alert !"); + wxLogError(_("Can't load wxSerial dynamic library.")); return; } if (!m_serialObj) { m_serialObj = (WXSERIAL(wxObject) *)lib->CreateObject( obj_name ); if (!m_serialObj) { - wxString message; - - message.Printf("Can't find the serialization object (%s) for the object %s", - WXSTRINGCAST obj_name, - WXSTRINGCAST GetClassInfo()->GetClassName()); - wxMessageBox(message, "Alert !"); + wxLogError(_("Can't find the serialization object '%s' " + "for the object '%s'."), + obj_name.c_str(), + GetClassInfo()->GetClassName()); return; } m_serialObj->SetObject(this); @@ -313,12 +315,10 @@ void wxObject::LoadObject( wxObjectInputStream& stream ) m_serialObj = (WXSERIAL(wxObject) *)lib->CreateObject( obj_name ); if (!m_serialObj) { - wxString message; - - message.Printf("Can't find the serialization object (%s) for the object %s", - WXSTRINGCAST obj_name, - WXSTRINGCAST GetClassInfo()->GetClassName()); - wxMessageBox(message, "Alert !"); + wxLogError(_("Can't find the serialization object '%s' " + "for the object '%s'."), + obj_name.c_str(), + GetClassInfo()->GetClassName()); return; } m_serialObj->SetObject(this);