X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5dcf05ae082a2da39102dec13ab3ad4c483221c8..6c56b261b7a0159516b46c57be8a85a281eaefd8:/src/common/object.cpp diff --git a/src/common/object.cpp b/src/common/object.cpp index decda33776..acebb41729 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -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 @@ -36,15 +40,8 @@ #endif #if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT - // for wxObject::Dump -#if wxUSE_IOSTREAMH -# include -#else -# include -# ifdef _MSC_VER - using namespace std; -# endif -#endif + // for wxObject::Dump + #include "wx/ioswrap.h" #endif #if !USE_SHARED_LIBRARY @@ -60,7 +57,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 +65,7 @@ wxObject::wxObject(void) wxObject::~wxObject(void) { UnRef(); -#ifdef wxUSE_SERIAL +#if wxUSE_SERIAL if (m_serialObj) delete m_serialObj; #endif @@ -117,7 +114,7 @@ void wxObject::operator delete (void * buf) } // VC++ 6.0 -#if _MSC_VER >= 1200 +#if defined(__VISUALC__) && (__VISUALC__ >= 1200) void wxObject::operator delete(void* pData, char* /* fileName */, int /* lineNum */) { ::operator delete(pData); @@ -125,7 +122,7 @@ void wxObject::operator delete(void* pData, char* /* fileName */, int /* lineNum #endif // Cause problems for VC++ - crashes -#if !defined(_MSC_VER) && wxUSE_ARRAY_MEMORY_OPERATORS +#if !defined(__VISUALC__) && wxUSE_ARRAY_MEMORY_OPERATORS void * wxObject::operator new[] (size_t size, char * fileName, int lineNum) { return wxDebugAlloc(size, fileName, lineNum, TRUE, TRUE); @@ -265,7 +262,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 +280,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 +308,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);