#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 <string.h>
#include <assert.h>
-#if (WXDEBUG && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
+#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
#include "wx/memory.h"
#endif
-#if WXDEBUG || wxUSE_DEBUG_CONTEXT
+#if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT
// for wxObject::Dump
#if wxUSE_IOSTREAMH
# include <iostream.h>
wxObject::wxObject(void)
{
m_refData = (wxObjectRefData *) NULL;
-#ifdef wxUSE_SERIAL
+#if wxUSE_SERIAL
m_serialObj = (wxObject_Serialize *)NULL;
#endif
}
wxObject::~wxObject(void)
{
UnRef();
-#ifdef wxUSE_SERIAL
+#if wxUSE_SERIAL
if (m_serialObj)
delete m_serialObj;
#endif
return FALSE;
}
-#if WXDEBUG || wxUSE_DEBUG_CONTEXT
+#if defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT
void wxObject::Dump(ostream& str)
{
if (GetClassInfo() && GetClassInfo()->GetClassName())
}
#endif
-#if WXDEBUG && wxUSE_MEMORY_TRACING
+#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING
#ifdef new
#undef new
// VC++ 6.0
#if _MSC_VER >= 1200
-void operator wxObject::delete(void* pData, char* /* fileName */, int /* lineNum */)
+void wxObject::operator delete(void* pData, char* /* fileName */, int /* lineNum */)
{
::operator delete(pData);
}
#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);
return (wxObject*) NULL;
}
-#ifdef wxUSE_SERIAL
+#if wxUSE_SERIAL
#include "wx/serbase.h"
#include "wx/dynlib.h"
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);
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);