Eliminated some warnings under Windows; wxGetHomeDir problem in wxFile;
eliminated memory leak report by making class table dynamically allocated/freed; tidied up names in wxClassInfo. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@725 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,6 +2,17 @@
|
||||
wxWindows 2.0 for Windows Change Log
|
||||
------------------------------------
|
||||
|
||||
Alpha 16, September 8th 1998
|
||||
----------------------------
|
||||
|
||||
- Added wxSashWindow, wxSashLayoutWindow classes, and sashtest
|
||||
sample.
|
||||
- Guilhem's socket classes added, plus wxsocket sample.
|
||||
- A few more makefiles added.
|
||||
- GnuWin32/BC++ compatibility mods.
|
||||
- Further doc updates.
|
||||
- wxProp updates for correct working with wxGTK.
|
||||
|
||||
Alpha 15, August 31st 1998
|
||||
--------------------------
|
||||
|
||||
|
@@ -10,6 +10,10 @@
|
||||
#include <wx/dynarray.h>
|
||||
#include <wx/hash.h>
|
||||
|
||||
#ifdef LoadLibrary
|
||||
#undef LoadLibrary
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxLibrary
|
||||
|
||||
|
@@ -8,14 +8,26 @@
|
||||
// Copyright: (c) Guilhem Lavaux
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_WXFSTREAM_H__
|
||||
#define _WX_WXFSTREAM_H__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "fstream.h"
|
||||
#endif
|
||||
|
||||
#include <wx/object.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/stream.h>
|
||||
#include <wx/file.h>
|
||||
|
||||
// Disable warnings such as
|
||||
// 'wxFileStream' : inherits 'wxFileInputStream::Peek' via dominance
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4250)
|
||||
#endif
|
||||
|
||||
class wxFileStreamBase {
|
||||
protected:
|
||||
wxFile *m_file;
|
||||
@@ -69,4 +81,8 @@ class wxFileStream: public wxStream,
|
||||
virtual ~wxFileStream();
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default:4250)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -45,38 +45,48 @@ typedef wxObject * (*wxObjectConstructorFn) (void);
|
||||
class WXDLLEXPORT wxClassInfo
|
||||
{
|
||||
public:
|
||||
char *className;
|
||||
char *baseClassName1;
|
||||
char *baseClassName2;
|
||||
int objectSize;
|
||||
wxObjectConstructorFn objectConstructor;
|
||||
|
||||
// Pointers to base wxClassInfos: set in InitializeClasses
|
||||
// called from wx_main.cc
|
||||
wxClassInfo *baseInfo1;
|
||||
wxClassInfo *baseInfo2;
|
||||
|
||||
static wxClassInfo *first;
|
||||
wxClassInfo *next;
|
||||
|
||||
static wxHashTable classTable;
|
||||
|
||||
wxClassInfo(char *cName, char *baseName1, char *baseName2, int sz, wxObjectConstructorFn fn);
|
||||
|
||||
wxObject *CreateObject(void);
|
||||
|
||||
inline char *GetClassName(void) const { return className; }
|
||||
inline char *GetBaseClassName1(void) const { return baseClassName1; }
|
||||
inline char *GetBaseClassName2(void) const { return baseClassName2; }
|
||||
inline int GetSize(void) const { return objectSize; }
|
||||
inline char *GetClassName(void) const { return m_className; }
|
||||
inline char *GetBaseClassName1(void) const { return m_baseClassName1; }
|
||||
inline char *GetBaseClassName2(void) const { return m_baseClassName2; }
|
||||
inline wxClassInfo* GetBaseClass1() const { return m_baseInfo1; }
|
||||
inline wxClassInfo* GetBaseClass2() const { return m_baseInfo2; }
|
||||
inline int GetSize(void) const { return m_objectSize; }
|
||||
inline wxObjectConstructorFn GetConstructor() const { return m_objectConstructor; }
|
||||
inline wxClassInfo* GetFirst() const { return sm_first; }
|
||||
inline wxClassInfo* GetNext() const { return m_next; }
|
||||
bool IsKindOf(wxClassInfo *info);
|
||||
|
||||
static wxClassInfo *FindClass(char *c);
|
||||
// Initializes parent pointers for fast searching.
|
||||
|
||||
// Initializes parent pointers and hash table for fast searching.
|
||||
static void InitializeClasses(void);
|
||||
|
||||
// Cleans up hash table used for fast searching.
|
||||
static void CleanUpClasses(void);
|
||||
|
||||
public:
|
||||
char* m_className;
|
||||
char* m_baseClassName1;
|
||||
char* m_baseClassName2;
|
||||
int m_objectSize;
|
||||
wxObjectConstructorFn m_objectConstructor;
|
||||
|
||||
// Pointers to base wxClassInfos: set in InitializeClasses
|
||||
// called from wx_main.cc
|
||||
wxClassInfo* m_baseInfo1;
|
||||
wxClassInfo* m_baseInfo2;
|
||||
|
||||
static wxClassInfo* sm_first;
|
||||
wxClassInfo* m_next;
|
||||
|
||||
static wxHashTable* sm_classTable;
|
||||
};
|
||||
|
||||
wxObject* WXDLLEXPORT wxCreateDynamicObject(char *name);
|
||||
wxObject* WXDLLEXPORT wxCreateDynamicObject(const char *name);
|
||||
|
||||
#ifdef USE_SERIAL
|
||||
wxObject* WXDLLEXPORT wxCreateStoredObject( wxInputStream& stream );
|
||||
@@ -84,9 +94,9 @@ wxObject* WXDLLEXPORT wxCreateStoredObject( wxInputStream& stream );
|
||||
|
||||
#define DECLARE_DYNAMIC_CLASS(name) \
|
||||
public:\
|
||||
static wxClassInfo class##name;\
|
||||
static wxClassInfo sm_class##name;\
|
||||
wxClassInfo *GetClassInfo() \
|
||||
{ return &name::class##name; }
|
||||
{ return &name::sm_class##name; }
|
||||
|
||||
#define DECLARE_ABSTRACT_CLASS(name) DECLARE_DYNAMIC_CLASS(name)
|
||||
#define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name)
|
||||
@@ -99,13 +109,13 @@ wxObject* WXDLLEXPORT wxCreateStoredObject( wxInputStream& stream );
|
||||
#define IMPLEMENT_DYNAMIC_CLASS(name, basename) \
|
||||
wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \
|
||||
{ return new name; }\
|
||||
wxClassInfo name::class##name((char *) #name, (char *) #basename, (char *) NULL, (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name);
|
||||
wxClassInfo name::sm_class##name((char *) #name, (char *) #basename, (char *) NULL, (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name);
|
||||
|
||||
// Multiple inheritance with two base classes
|
||||
#define IMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) \
|
||||
wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \
|
||||
{ return new name; }\
|
||||
wxClassInfo name::class##name((char *) #name, (char *) #basename1, (char *) #basename2, (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name);
|
||||
wxClassInfo name::sm_class##name((char *) #name, (char *) #basename1, (char *) #basename2, (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name);
|
||||
|
||||
//////
|
||||
////// for abstract classes
|
||||
@@ -113,17 +123,17 @@ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \
|
||||
|
||||
// Single inheritance with one base class
|
||||
#define IMPLEMENT_ABSTRACT_CLASS(name, basename) \
|
||||
wxClassInfo name::class##name((char *) #name, (char *) #basename, \
|
||||
wxClassInfo name::sm_class##name((char *) #name, (char *) #basename, \
|
||||
(char *) NULL, (int) sizeof(name), (wxObjectConstructorFn) NULL);
|
||||
|
||||
// Multiple inheritance with two base classes
|
||||
#define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \
|
||||
wxClassInfo name::class##name((char *) #name, (char *) #basename1, (char *) #basename2, (int) sizeof(name), (wxObjectConstructorFn) NULL);
|
||||
wxClassInfo name::sm_class##name((char *) #name, (char *) #basename1, (char *) #basename2, (int) sizeof(name), (wxObjectConstructorFn) NULL);
|
||||
|
||||
#define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS
|
||||
#define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2
|
||||
|
||||
#define CLASSINFO(name) (&name::class##name)
|
||||
#define CLASSINFO(name) (&name::sm_class##name)
|
||||
|
||||
#else
|
||||
|
||||
@@ -140,7 +150,7 @@ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \
|
||||
|
||||
#endif
|
||||
|
||||
#define IS_KIND_OF(obj, className) obj->IsKindOf(&className::class##className)
|
||||
#define IS_KIND_OF(obj, className) obj->IsKindOf(&className::sm_class##className)
|
||||
|
||||
// Unfortunately Borland seems to need this include.
|
||||
#ifdef __BORLANDC__
|
||||
@@ -158,12 +168,12 @@ class WXDLLEXPORT wxObject
|
||||
public:
|
||||
|
||||
// This is equivalent to using the macro DECLARE_ABSTRACT_CLASS
|
||||
static wxClassInfo classwxObject;
|
||||
static wxClassInfo sm_classwxObject;
|
||||
|
||||
wxObject(void);
|
||||
virtual ~wxObject(void);
|
||||
|
||||
virtual wxClassInfo *GetClassInfo(void) { return &classwxObject; }
|
||||
virtual wxClassInfo *GetClassInfo(void) { return &sm_classwxObject; }
|
||||
|
||||
bool IsKindOf(wxClassInfo *info);
|
||||
|
||||
@@ -198,9 +208,9 @@ class WXDLLEXPORT wxObject
|
||||
inline void SetRefData(wxObjectRefData *data) { m_refData = data; }
|
||||
|
||||
protected:
|
||||
wxObjectRefData *m_refData;
|
||||
wxObjectRefData* m_refData;
|
||||
#ifdef USE_SERIAL
|
||||
wxObject_Serialize *m_serialObj;
|
||||
wxObject_Serialize* m_serialObj;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@@ -8,11 +8,12 @@
|
||||
// Copyright: (c) Guilhem Lavaux
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_NETWORK_SOCKET_H
|
||||
#define _WX_NETWORK_SOCKET_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface "socket.h"
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@@ -29,6 +29,13 @@ typedef wxOutputStream& (*__wxOutputManip)(wxOutputStream&);
|
||||
|
||||
wxOutputStream& WXDLLEXPORT wxEndL(wxOutputStream& o_stream);
|
||||
|
||||
// Disable warnings such as
|
||||
// 'wxFilterStream' : inherits 'wxFilterInputStream::Peek' via dominance
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4250)
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Stream buffer
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -244,4 +251,8 @@ class WXDLLEXPORT wxFilterStream: public wxStream,
|
||||
wxFilterStream();
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(default:4250)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -13,6 +13,15 @@
|
||||
#pragma implementation "dynlib.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif //__BORLANDC__
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#endif //WX_PRECOMP
|
||||
|
||||
#include <wx/dynlib.h>
|
||||
#include <wx/filefn.h>
|
||||
#include <wx/list.h>
|
||||
@@ -87,9 +96,9 @@ void wxLibrary::PrepareClasses(wxClassInfo **first)
|
||||
wxClassInfo *info = *first;
|
||||
while (info)
|
||||
{
|
||||
if (info->className)
|
||||
classTable.Put(info->className, (wxObject *)info);
|
||||
info = info->next;
|
||||
if (info->m_className)
|
||||
classTable.Put(info->m_className, (wxObject *)info);
|
||||
info = info->m_next;
|
||||
}
|
||||
|
||||
// Set base pointers for each wxClassInfo
|
||||
@@ -97,10 +106,10 @@ void wxLibrary::PrepareClasses(wxClassInfo **first)
|
||||
while (info)
|
||||
{
|
||||
if (info->GetBaseClassName1())
|
||||
info->baseInfo1 = (wxClassInfo *)classTable.Get(info->GetBaseClassName1());
|
||||
info->m_baseInfo1 = (wxClassInfo *)classTable.Get(info->GetBaseClassName1());
|
||||
if (info->GetBaseClassName2())
|
||||
info->baseInfo2 = (wxClassInfo *)classTable.Get(info->GetBaseClassName2());
|
||||
info = info->next;
|
||||
info->m_baseInfo2 = (wxClassInfo *)classTable.Get(info->GetBaseClassName2());
|
||||
info = info->m_next;
|
||||
}
|
||||
*first = NULL;
|
||||
}
|
||||
@@ -111,7 +120,7 @@ void *wxLibrary::GetSymbol(const wxString& symbname)
|
||||
return dlsym(m_handle, WXSTRINGCAST symbname);
|
||||
#endif
|
||||
#ifdef __WINDOWS__
|
||||
return GetProcAddress(m_handle, WXSTRINGCAST symbname);
|
||||
return GetProcAddress((HINSTANCE) m_handle, WXSTRINGCAST symbname);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -84,14 +84,14 @@ void ConvertToIeeeExtended(double num, unsigned char *bytes)
|
||||
|
||||
bytes[0] = expon >> 8;
|
||||
bytes[1] = expon;
|
||||
bytes[2] = hiMant >> 24;
|
||||
bytes[3] = hiMant >> 16;
|
||||
bytes[4] = hiMant >> 8;
|
||||
bytes[5] = hiMant;
|
||||
bytes[6] = loMant >> 24;
|
||||
bytes[7] = loMant >> 16;
|
||||
bytes[8] = loMant >> 8;
|
||||
bytes[9] = loMant;
|
||||
bytes[2] = (unsigned char) hiMant >> 24;
|
||||
bytes[3] = (unsigned char) hiMant >> 16;
|
||||
bytes[4] = (unsigned char) hiMant >> 8;
|
||||
bytes[5] = (unsigned char) hiMant;
|
||||
bytes[6] = (unsigned char) loMant >> 24;
|
||||
bytes[7] = (unsigned char) loMant >> 16;
|
||||
bytes[8] = (unsigned char) loMant >> 8;
|
||||
bytes[9] = (unsigned char) loMant;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -788,8 +788,8 @@ bool wxDebugContext::PrintClasses(void)
|
||||
wxNode *node;
|
||||
wxClassInfo *info;
|
||||
|
||||
wxClassInfo::classTable.BeginFind();
|
||||
node = wxClassInfo::classTable.Next();
|
||||
wxClassInfo::sm_classTable->BeginFind();
|
||||
node = wxClassInfo::sm_classTable->Next();
|
||||
while (node)
|
||||
{
|
||||
info = (wxClassInfo *)node->Data();
|
||||
@@ -801,7 +801,7 @@ bool wxDebugContext::PrintClasses(void)
|
||||
wxTrace("is a %s", info->GetBaseClassName1());
|
||||
else if (info->GetBaseClassName1() && info->GetBaseClassName2())
|
||||
wxTrace("is a %s, %s", info->GetBaseClassName1(), info->GetBaseClassName2());
|
||||
if (info->objectConstructor)
|
||||
if (info->GetConstructor())
|
||||
wxTrace(": dynamic\n");
|
||||
else
|
||||
wxTrace("\n");
|
||||
|
@@ -39,18 +39,18 @@ bool wxModule::RegisterModules(void)
|
||||
wxNode *node;
|
||||
wxClassInfo* classInfo;
|
||||
|
||||
wxClassInfo::classTable.BeginFind();
|
||||
node = wxClassInfo::classTable.Next();
|
||||
wxClassInfo::sm_classTable->BeginFind();
|
||||
node = wxClassInfo::sm_classTable->Next();
|
||||
while (node)
|
||||
{
|
||||
classInfo = (wxClassInfo *)node->Data();
|
||||
if ((classInfo != (& (wxModule::classwxModule))) &&
|
||||
if ((classInfo != (& (wxModule::sm_classwxModule))) &&
|
||||
classInfo->IsKindOf(CLASSINFO(wxModule)))
|
||||
{
|
||||
wxModule* module = (wxModule*) classInfo->CreateObject();
|
||||
RegisterModule(module);
|
||||
}
|
||||
node = wxClassInfo::classTable.Next();
|
||||
node = wxClassInfo::sm_classTable->Next();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -41,9 +41,9 @@
|
||||
#endif
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
wxClassInfo wxObject::classwxObject((char *) "wxObject", (char *) NULL, (char *) NULL, (int ) sizeof(wxObject), (wxObjectConstructorFn) NULL);
|
||||
wxClassInfo *wxClassInfo::first = (wxClassInfo *) NULL;
|
||||
wxHashTable wxClassInfo::classTable(wxKEY_STRING);
|
||||
wxClassInfo wxObject::sm_classwxObject((char *) "wxObject", (char *) NULL, (char *) NULL, (int ) sizeof(wxObject), (wxObjectConstructorFn) NULL);
|
||||
wxClassInfo* wxClassInfo::sm_first = (wxClassInfo *) NULL;
|
||||
wxHashTable* wxClassInfo::sm_classTable = (wxHashTable*) NULL;
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -130,36 +130,36 @@ void wxObject::operator delete[] (void * buf)
|
||||
|
||||
wxClassInfo::wxClassInfo(char *cName, char *baseName1, char *baseName2, int sz, wxObjectConstructorFn constr)
|
||||
{
|
||||
className = cName;
|
||||
baseClassName1 = baseName1;
|
||||
baseClassName2 = baseName2;
|
||||
m_className = cName;
|
||||
m_baseClassName1 = baseName1;
|
||||
m_baseClassName2 = baseName2;
|
||||
|
||||
objectSize = sz;
|
||||
objectConstructor = constr;
|
||||
m_objectSize = sz;
|
||||
m_objectConstructor = constr;
|
||||
|
||||
next = first;
|
||||
first = this;
|
||||
m_next = sm_first;
|
||||
sm_first = this;
|
||||
|
||||
baseInfo1 = (wxClassInfo *) NULL;
|
||||
baseInfo2 = (wxClassInfo *) NULL;
|
||||
m_baseInfo1 = (wxClassInfo *) NULL;
|
||||
m_baseInfo2 = (wxClassInfo *) NULL;
|
||||
}
|
||||
|
||||
wxObject *wxClassInfo::CreateObject(void)
|
||||
{
|
||||
if (objectConstructor)
|
||||
return (wxObject *)(*objectConstructor)();
|
||||
if (m_objectConstructor)
|
||||
return (wxObject *)(*m_objectConstructor)();
|
||||
else
|
||||
return (wxObject *) NULL;
|
||||
}
|
||||
|
||||
wxClassInfo *wxClassInfo::FindClass(char *c)
|
||||
{
|
||||
wxClassInfo *p = first;
|
||||
wxClassInfo *p = sm_first;
|
||||
while (p)
|
||||
{
|
||||
if (p && p->GetClassName() && strcmp(p->GetClassName(), c) == 0)
|
||||
return p;
|
||||
p = p->next;
|
||||
p = p->m_next;
|
||||
}
|
||||
return (wxClassInfo *) NULL;
|
||||
}
|
||||
@@ -174,20 +174,22 @@ bool wxClassInfo::IsKindOf(wxClassInfo *info)
|
||||
// For some reason, when making/using a DLL, static data has to be included
|
||||
// in both the DLL and the application. This can lead to duplicate
|
||||
// wxClassInfo objects, so we have to test the name instead of the pointers.
|
||||
// PROBABLY NO LONGER TRUE now I've done DLL creation right.
|
||||
/*
|
||||
#if WXMAKINGDLL
|
||||
if (GetClassName() && info->GetClassName() && (strcmp(GetClassName(), info->GetClassName()) == 0))
|
||||
return TRUE;
|
||||
#else
|
||||
*/
|
||||
if (this == info)
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
if (baseInfo1)
|
||||
if (baseInfo1->IsKindOf(info))
|
||||
if (m_baseInfo1)
|
||||
if (m_baseInfo1->IsKindOf(info))
|
||||
return TRUE;
|
||||
|
||||
if (baseInfo2)
|
||||
return baseInfo2->IsKindOf(info);
|
||||
if (m_baseInfo2)
|
||||
return m_baseInfo2->IsKindOf(info);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -195,37 +197,58 @@ bool wxClassInfo::IsKindOf(wxClassInfo *info)
|
||||
// Set pointers to base class(es) to speed up IsKindOf
|
||||
void wxClassInfo::InitializeClasses(void)
|
||||
{
|
||||
wxClassInfo::sm_classTable = new wxHashTable(wxKEY_STRING);
|
||||
|
||||
// Index all class infos by their class name
|
||||
wxClassInfo *info = first;
|
||||
wxClassInfo *info = sm_first;
|
||||
while (info)
|
||||
{
|
||||
if (info->className)
|
||||
classTable.Put(info->className, (wxObject *)info);
|
||||
info = info->next;
|
||||
if (info->m_className)
|
||||
sm_classTable->Put(info->m_className, (wxObject *)info);
|
||||
info = info->m_next;
|
||||
}
|
||||
|
||||
// Set base pointers for each wxClassInfo
|
||||
info = first;
|
||||
info = sm_first;
|
||||
while (info)
|
||||
{
|
||||
if (info->GetBaseClassName1())
|
||||
info->baseInfo1 = (wxClassInfo *)classTable.Get(info->GetBaseClassName1());
|
||||
info->m_baseInfo1 = (wxClassInfo *)sm_classTable->Get(info->GetBaseClassName1());
|
||||
if (info->GetBaseClassName2())
|
||||
info->baseInfo2 = (wxClassInfo *)classTable.Get(info->GetBaseClassName2());
|
||||
info = info->next;
|
||||
info->m_baseInfo2 = (wxClassInfo *)sm_classTable->Get(info->GetBaseClassName2());
|
||||
info = info->m_next;
|
||||
}
|
||||
first = NULL;
|
||||
}
|
||||
|
||||
wxObject *wxCreateDynamicObject(char *name)
|
||||
// Clean up hash table
|
||||
void wxClassInfo::CleanUpClasses(void)
|
||||
{
|
||||
wxClassInfo *info;
|
||||
delete wxClassInfo::sm_classTable;
|
||||
wxClassInfo::sm_classTable = NULL;
|
||||
}
|
||||
|
||||
info = (wxClassInfo *)wxClassInfo::classTable.Get(name);
|
||||
if (!info)
|
||||
return (wxObject *)NULL;
|
||||
wxObject *wxCreateDynamicObject(const char *name)
|
||||
{
|
||||
if (wxClassInfo::sm_classTable)
|
||||
{
|
||||
wxClassInfo *info = (wxClassInfo *)wxClassInfo::sm_classTable->Get(name);
|
||||
if (!info)
|
||||
return (wxObject *)NULL;
|
||||
|
||||
return info->CreateObject();
|
||||
return info->CreateObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxClassInfo *info = wxClassInfo::sm_first;
|
||||
while (info)
|
||||
{
|
||||
if (info->m_className && strcmp(info->m_className, name) == 0)
|
||||
return info->CreateObject();
|
||||
info = info->m_next;
|
||||
}
|
||||
return (wxObject*) NULL;
|
||||
}
|
||||
return (wxObject*) NULL;
|
||||
}
|
||||
|
||||
#ifdef USE_SERIAL
|
||||
|
@@ -11,8 +11,8 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "socket.h"
|
||||
#pragma interface
|
||||
#pragma implementation "socket.cpp"
|
||||
// #pragma interface
|
||||
// #pragma implementation "socket.cpp"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
@@ -92,6 +92,9 @@
|
||||
#ifdef __WINDOWS__
|
||||
#define close closesocket
|
||||
#define ioctl ioctlsocket
|
||||
#ifdef errno
|
||||
#undef errno
|
||||
#endif
|
||||
#define errno WSAGetLastError()
|
||||
#ifdef EWOULDBLOCK
|
||||
#undef EWOULDBLOCK
|
||||
@@ -369,26 +372,26 @@ wxSocketBase& wxSocketBase::WriteMsg(const char *buffer, size_t nbytes)
|
||||
{
|
||||
SockMsg msg;
|
||||
|
||||
msg.sig[0] = 0xad;
|
||||
msg.sig[1] = 0xde;
|
||||
msg.sig[2] = 0xed;
|
||||
msg.sig[3] = 0xfe;
|
||||
msg.sig[0] = (char) 0xad;
|
||||
msg.sig[1] = (char) 0xde;
|
||||
msg.sig[2] = (char) 0xed;
|
||||
msg.sig[3] = (char) 0xfe;
|
||||
|
||||
msg.len[0] = nbytes & 0xff;
|
||||
msg.len[1] = (nbytes >> 8) & 0xff;
|
||||
msg.len[2] = (nbytes >> 16) & 0xff;
|
||||
msg.len[3] = (nbytes >> 24) & 0xff;
|
||||
msg.len[0] = (char) nbytes & 0xff;
|
||||
msg.len[1] = (char) (nbytes >> 8) & 0xff;
|
||||
msg.len[2] = (char) (nbytes >> 16) & 0xff;
|
||||
msg.len[3] = (char) (nbytes >> 24) & 0xff;
|
||||
|
||||
if (Write((char *)&msg, sizeof(msg)).LastCount() < sizeof(msg))
|
||||
return *this;
|
||||
if (Write(buffer, nbytes).LastCount() < nbytes)
|
||||
return *this;
|
||||
|
||||
msg.sig[0] = 0xed;
|
||||
msg.sig[1] = 0xfe;
|
||||
msg.sig[2] = 0xad;
|
||||
msg.sig[3] = 0xde;
|
||||
msg.len[0] = msg.len[1] = msg.len[2] = msg.len[3] = 0;
|
||||
msg.sig[0] = (char) 0xed;
|
||||
msg.sig[1] = (char) 0xfe;
|
||||
msg.sig[2] = (char) 0xad;
|
||||
msg.sig[3] = (char) 0xde;
|
||||
msg.len[0] = msg.len[1] = msg.len[2] = msg.len[3] = (char) 0;
|
||||
Write((char *)&msg, sizeof(msg));
|
||||
|
||||
return *this;
|
||||
@@ -415,7 +418,7 @@ bool wxSocketBase::IsData() const
|
||||
FD_ZERO(&sock_set);
|
||||
FD_SET(m_fd, &sock_set);
|
||||
select(FD_SETSIZE, &sock_set, NULL, NULL, &tv);
|
||||
return FD_ISSET(m_fd, &sock_set);
|
||||
return (FD_ISSET(m_fd, &sock_set) != 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
@@ -348,7 +348,7 @@ wxInputStream& wxInputStream::operator>>(float& f)
|
||||
}
|
||||
|
||||
if (c == '.') {
|
||||
float f_multiplicator = 0.1;
|
||||
float f_multiplicator = (float) 0.1;
|
||||
c = GetC();
|
||||
|
||||
while (isdigit(c)) {
|
||||
|
@@ -293,6 +293,8 @@ void wxApp::CommonCleanUp(void)
|
||||
wxCleanUpResourceSystem();
|
||||
|
||||
wxSystemSettings::Done();
|
||||
|
||||
wxClassInfo::CleanUpClasses();
|
||||
}
|
||||
|
||||
wxLog *wxApp::CreateLogTarget()
|
||||
|
@@ -293,6 +293,8 @@ void wxApp::CommonCleanUp(void)
|
||||
wxCleanUpResourceSystem();
|
||||
|
||||
wxSystemSettings::Done();
|
||||
|
||||
wxClassInfo::CleanUpClasses();
|
||||
}
|
||||
|
||||
wxLog *wxApp::CreateLogTarget()
|
||||
|
@@ -337,6 +337,8 @@ void wxApp::CleanUp()
|
||||
if (wxWinHandleList)
|
||||
delete wxWinHandleList ;
|
||||
|
||||
wxClassInfo::CleanUpClasses();
|
||||
|
||||
// do it as the very last thing because everything else can log messages
|
||||
wxLog::DontCreateOnDemand();
|
||||
delete wxLog::SetActiveTarget(NULL);
|
||||
|
@@ -81,6 +81,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\docview.obj \
|
||||
$(COMMDIR)\docmdi.obj \
|
||||
$(COMMDIR)\dynarray.obj \
|
||||
$(COMMDIR)\dynlib.obj \
|
||||
$(COMMDIR)\event.obj \
|
||||
$(COMMDIR)\file.obj \
|
||||
$(COMMDIR)\filefn.obj \
|
||||
@@ -770,6 +771,11 @@ $(COMMDIR)/dynarray.obj: $*.$(SRCSUFF)
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||
<<
|
||||
|
||||
$(COMMDIR)/dynlib.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||
<<
|
||||
|
||||
$(COMMDIR)/event.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||
|
@@ -34,9 +34,9 @@ wxDirInfo::wxDirInfo( const wxString &path )
|
||||
{
|
||||
m_name = "My Home";
|
||||
m_path += "/";
|
||||
char buf[300];
|
||||
wxGetHomeDir( buf );
|
||||
m_path = buf;
|
||||
wxString str;
|
||||
wxGetHomeDir( & str );
|
||||
m_path = str;
|
||||
}
|
||||
else
|
||||
if (m_path == "/proc") m_name = "Info Filesystem";
|
||||
|
@@ -156,9 +156,9 @@ MyFrame::MyFrame(void) :
|
||||
m_dir = new wxDirCtrl( m_splitter, ID_DIRCTRL, "/", wxPoint(10,45), wxSize(200,330) );
|
||||
|
||||
wxString homepath( "/home" );
|
||||
char buf[300];
|
||||
wxGetHomeDir( buf );
|
||||
homepath = buf;
|
||||
wxString str;
|
||||
wxGetHomeDir( & str );
|
||||
homepath = str;
|
||||
m_rightFile = new wxFileCtrl( m_splitter, ID_FILECTRL, homepath, wxPoint(220,5), wxSize(200,330) );
|
||||
|
||||
m_leftFile = new wxFileCtrl( m_splitter, ID_FILECTRL, homepath, wxPoint(0,5), wxSize(200,330) );
|
||||
|
Reference in New Issue
Block a user