* Added wxSerial DLL support for Borland 32

* zstream.h doesn't anymore include zlib.h
* updated static data
* made wxClassInfo::GetFirst() static
* added user/password support in the URL parser
* fixed bugs


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@746 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Guilhem Lavaux
1998-09-17 17:30:13 +00:00
parent 46ccb5107f
commit 856d2e527d
19 changed files with 345 additions and 95 deletions

View File

@@ -0,0 +1,57 @@
#
# File: makefile.b32
# Author: Patrick Halke, modified by Guilhem Lavaux
# Created: 1997
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds 32bit wxstring library for Windows 3.1
# and Borland C++ 4.x
WXDIR = $(WXWIN)
DLL=1
WXBUILDDLL=1
WXUSINGDLL=1
!include $(WXDIR)\src\makeb32.env
WXLIBDIR = $(WXDIR)\lib
LIBS=$(WXLIB) cw32 import32
!ifndef DEBUG
DEBUG=0
!endif
LIBTARGET= $(WXLIBDIR)\wxserial.dll
CPPFLAGS= $(CPPFLAGS) -Od
.c.obj:
bcc32 $(CPPFLAGS) -P- -c {$< }
OBJECTS = sermain.obj sercore.obj serwnd.obj serctrl.obj sergdi.obj serext.obj
all: $(LIBTARGET)
sermain.obj: sermain.$(SRCSUFF)
bcc32 $(CPPFLAGS) -P- -u- -c sermain.$(SRCSUFF)
$(LIBTARGET): $(OBJECTS)
erase $(LIBTARGET)
tlink32 $(LINK_FLAGS) /v @&&!
c0d32.obj $(OBJECTS)
$(LIBTARGET)
nul
$(LIBS)
serial
!
clean:
-erase *.obj
-erase $(LIBTARGET)
-erase *.exe
-erase *.res
-erase *.map
-erase *.rws

View File

@@ -35,11 +35,16 @@
#include "serctrl.h"
IMPLEMENT_ALIAS_SERIAL_CLASS(wxControl, wxWindow)
#ifdef __WINDOWS__
IMPLEMENT_SERIAL_CLASS(wxSlider95, wxControl)
IMPLEMENT_SERIAL_CLASS(wxGauge95, wxControl)
#else
IMPLEMENT_SERIAL_CLASS(wxSlider, wxControl)
IMPLEMENT_SERIAL_CLASS(wxGauge, wxControl)
#endif
IMPLEMENT_SERIAL_CLASS(wxCheckBox, wxControl)
IMPLEMENT_SERIAL_CLASS(wxChoice, wxControl)
IMPLEMENT_SERIAL_CLASS(wxComboBox, wxControl)
IMPLEMENT_SERIAL_CLASS(wxGauge, wxControl)
IMPLEMENT_SERIAL_CLASS(wxListBox, wxControl)
IMPLEMENT_SERIAL_CLASS(wxNotebook, wxControl)
IMPLEMENT_SERIAL_CLASS(wxRadioBox, wxControl)
@@ -59,6 +64,9 @@ void WXSERIAL(wxButton)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall())
return;
wxButton *button = (wxButton *)Object();
printf("label = %s\n", WXSTRINGCAST m_label);
@@ -83,6 +91,9 @@ void WXSERIAL(wxCheckBox)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall())
return;
wxDataInputStream data_s(s);
wxCheckBox *chkbox = (wxCheckBox *)Object();
@@ -94,7 +105,11 @@ void WXSERIAL(wxCheckBox)::LoadObject(wxObjectInputStream& s)
//-----------------------------------------------------------------------------
#ifdef __WXMSW__
void WXSERIAL(wxSlider95)::StoreObject(wxObjectOutputStream& s)
#else
void WXSERIAL(wxSlider)::StoreObject(wxObjectOutputStream& s)
#endif
{
WXSERIAL(wxControl)::StoreObject(s);
@@ -115,10 +130,17 @@ void WXSERIAL(wxSlider)::StoreObject(wxObjectOutputStream& s)
data_s.Write32( slider->GetThumbLength() );
}
#ifdef __WXMSW__
void WXSERIAL(wxSlider95)::LoadObject(wxObjectInputStream& s)
#else
void WXSERIAL(wxSlider)::LoadObject(wxObjectInputStream& s)
#endif
{
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall())
return;
wxDataInputStream data_s(s);
wxSlider *slider = (wxSlider *)Object();
int value, min, max;
@@ -141,7 +163,11 @@ void WXSERIAL(wxSlider)::LoadObject(wxObjectInputStream& s)
//-----------------------------------------------------------------------------
#ifdef __WXMSW__
void WXSERIAL(wxGauge95)::StoreObject(wxObjectOutputStream& s)
#else
void WXSERIAL(wxGauge)::StoreObject(wxObjectOutputStream& s)
#endif
{
WXSERIAL(wxControl)::StoreObject(s);
@@ -157,10 +183,17 @@ void WXSERIAL(wxGauge)::StoreObject(wxObjectOutputStream& s)
data_s.Write32( gauge->GetValue() );
}
#ifdef __WXMSW__
void WXSERIAL(wxGauge95)::LoadObject(wxObjectInputStream& s)
#else
void WXSERIAL(wxGauge)::LoadObject(wxObjectInputStream& s)
#endif
{
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall())
return;
wxDataInputStream data_s(s);
wxGauge *gauge = (wxGauge *)Object();
int range;
@@ -196,6 +229,9 @@ void WXSERIAL(wxChoice)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall())
return;
wxDataInputStream data_s(s);
wxChoice *choice = (wxChoice *)Object();
int i,num = data_s.Read32();
@@ -229,6 +265,9 @@ void WXSERIAL(wxListBox)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxListBox)::LoadObject(s);
if (s.SecondCall())
return;
wxDataInputStream data_s(s);
wxListBox *listbox = (wxListBox *)Object();
int i, num = data_s.Read32();
@@ -265,14 +304,14 @@ void WXSERIAL(wxNotebook)::LoadObject(wxObjectInputStream& s)
int i;
wxImageList *imaglist;
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall()) {
for (i=0;i<m_pcount;i++)
notebook->AddPage( (wxWindow *)s.GetChild(), m_stringlist[i] );
return;
}
WXSERIAL(wxControl)::LoadObject(s);
imaglist = (wxImageList *)s.GetChild();
notebook->Create(m_parent, m_id, wxPoint(m_x, m_y), wxSize(m_w, m_h),
@@ -312,6 +351,9 @@ void WXSERIAL(wxRadioBox)::LoadObject(wxObjectInputStream& s)
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall())
return;
wxDataInputStream data_s(s);
int i, n_rows_cols, n_items;
wxString *items;
@@ -345,6 +387,10 @@ void WXSERIAL(wxRadioButton)::LoadObject(wxObjectInputStream& s)
wxDataInputStream data_s(s);
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall())
return;
((wxRadioButton *)Object())->SetValue( (bool)data_s.Read8() );
}
@@ -375,6 +421,9 @@ void WXSERIAL(wxComboBox)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall())
return;
wxDataInputStream data_s(s);
wxComboBox *box = (wxComboBox *)Object();
int i, num, selection;
@@ -403,6 +452,9 @@ void WXSERIAL(wxStaticText)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall())
return;
((wxStaticText *)Object())->Create(m_parent, m_id, m_label, wxPoint(m_x, m_y),
wxSize(m_w, m_h), m_style, m_name);
}
@@ -417,6 +469,9 @@ void WXSERIAL(wxStaticBox)::StoreObject(wxObjectOutputStream& s)
void WXSERIAL(wxStaticBox)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall())
return;
((wxStaticBox *)Object())->Create(m_parent, m_id, m_label, wxPoint(m_x, m_y),
wxSize(m_w, m_h), m_style, m_name);

View File

@@ -21,11 +21,16 @@
DECLARE_ALIAS_SERIAL_CLASS(wxControl, wxWindow)
DECLARE_SERIAL_CLASS(wxButton, wxControl)
#ifdef __WINDOWS__
DECLARE_SERIAL_CLASS(wxSlider95, wxControl)
DECLARE_SERIAL_CLASS(wxGauge95, wxControl)
#else
DECLARE_SERIAL_CLASS(wxSlider, wxControl)
DECLARE_SERIAL_CLASS(wxGauge, wxControl)
#endif
DECLARE_SERIAL_CLASS(wxCheckBox, wxControl)
DECLARE_SERIAL_CLASS(wxChoice, wxControl)
DECLARE_SERIAL_CLASS(wxComboBox, wxControl)
DECLARE_SERIAL_CLASS(wxGauge, wxControl)
DECLARE_SERIAL_CLASS(wxListBox, wxControl)
DECLARE_SERIAL_CLASS(wxRadioBox, wxControl)
DECLARE_SERIAL_CLASS(wxRadioButton, wxControl)

View File

@@ -25,12 +25,13 @@
#include <wx/colour.h>
#include <wx/palette.h>
#include <wx/dcmemory.h>
#include <wx/log.h>
#include "sergdi.h"
IMPLEMENT_SERIAL_CLASS(wxBitmap, wxObject)
IMPLEMENT_SERIAL_CLASS(wxGDIObject, wxObject)
IMPLEMENT_SERIAL_CLASS(wxRegion, wxGDIObject)
IMPLEMENT_SERIAL_CLASS(wxColour, wxGDIObject)
IMPLEMENT_SERIAL_CLASS(wxColour, wxObject)
IMPLEMENT_SERIAL_CLASS(wxFont, wxGDIObject)
IMPLEMENT_SERIAL_CLASS(wxPen, wxGDIObject)
IMPLEMENT_SERIAL_CLASS(wxBrush, wxGDIObject)
@@ -89,7 +90,11 @@ void WXSERIAL(wxBitmap)::LoadObject(wxObjectInputStream& s)
w = data_s.Read16();
h = data_s.Read16();
#ifdef __WXGTK__
bitmap->Resize(w, h);
#else
bitmap->Create(w, h);
#endif
dc.SelectObject(*bitmap);
for (y=0;y<h;y++)
@@ -161,14 +166,20 @@ void WXSERIAL(wxRegion)::LoadObject(wxObjectInputStream& s)
void WXSERIAL(wxColour)::StoreObject(wxObjectOutputStream& s)
{
WXSERIAL(wxGDIObject)::StoreObject(s);
if (s.FirstStage())
return;
wxDataOutputStream data_s(s);
wxColour *colour = (wxColour *)Object();
if (!colour->Ok()) {
data_s.Write8(0);
data_s.Write8(0);
data_s.Write8(0);
wxLogDebug("wxColour (0x%x) isn't ready.\n", colour);
return;
}
data_s.Write8(colour->Red());
data_s.Write8(colour->Green());
data_s.Write8(colour->Blue());
@@ -176,8 +187,6 @@ void WXSERIAL(wxColour)::StoreObject(wxObjectOutputStream& s)
void WXSERIAL(wxColour)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxGDIObject)::LoadObject(s);
wxDataInputStream data_s(s);
wxColour *colour = (wxColour *)Object();
int r, g, b;
@@ -305,8 +314,10 @@ void WXSERIAL(wxImageList)::StoreObject(wxObjectOutputStream& s)
int i;
if (s.FirstStage()) {
#ifdef __WXGTK__
for (i=0;i<list->GetImageCount();i++)
s.AddChild(list->GetBitmap(i));
#endif
}
wxDataOutputStream data_s(s);

View File

@@ -22,7 +22,7 @@
DECLARE_SERIAL_CLASS(wxBitmap, wxObject)
DECLARE_SERIAL_CLASS(wxGDIObject, wxObject)
DECLARE_SERIAL_CLASS(wxRegion, wxGDIObject)
DECLARE_SERIAL_CLASS(wxColour, wxGDIObject)
DECLARE_SERIAL_CLASS(wxColour, wxObject)
DECLARE_SERIAL_CLASS(wxFont, wxGDIObject)
DECLARE_SERIAL_CLASS(wxPen, wxGDIObject)
DECLARE_SERIAL_CLASS(wxBrush, wxGDIObject)

View File

@@ -58,8 +58,8 @@ void WXSERIAL(wxWindow)::StoreObject(wxObjectOutputStream& s)
s.AddChild(win_object->GetValidator());
// BAD HACK, but I don't have access to the internal variable of wxWindow.
m_bg_colour = win_object->GetDefaultBackgroundColour();
m_fg_colour = win_object->GetDefaultForegroundColour();
m_bg_colour = win_object->GetBackgroundColour();
m_fg_colour = win_object->GetForegroundColour();
s.AddChild(&m_bg_colour);
s.AddChild(&m_fg_colour);
s.AddChild(win_object->GetFont());
@@ -98,7 +98,24 @@ void WXSERIAL(wxWindow)::LoadObject(wxObjectInputStream& s)
wxWindow *win_object = (wxWindow *)Object();
wxColour *colour;
wxFont *font;
int number;
if (s.SecondCall()) {
/* I assume we will never create raw wxWindow object */
(void)s.GetChild(); // We pass wxLayoutConstraints.
(void)s.GetChild(); // We pass wxValidator.
colour = (wxColour *)s.GetChild();
if (colour)
win_object->SetBackgroundColour(*colour);
colour = (wxColour *)s.GetChild();
if (colour)
win_object->SetForegroundColour(*colour);
font = (wxFont *)s.GetChild();
if (font)
win_object->SetFont(*font);
s.RemoveChildren(m_number);
return;
}
m_parent = (wxWindow *)s.GetParent();
@@ -110,31 +127,22 @@ void WXSERIAL(wxWindow)::LoadObject(wxObjectInputStream& s)
m_shown = data_s.Read8();
m_style = data_s.Read32();
m_id = data_s.Read32();
number = data_s.Read8();
m_number = data_s.Read8();
m_x = data_s.Read16();
m_y = data_s.Read16();
m_w = data_s.Read16();
m_h = data_s.Read16();
/* I assume we will never create raw wxWindow object */
(void)s.GetChild(); // We pass wxLayoutConstraints.
m_validator = (wxValidator *)s.GetChild();
if (!m_validator)
m_validator = (wxValidator *)&wxDefaultValidator;
colour = (wxColour *)s.GetChild();
if (colour)
win_object->SetDefaultBackgroundColour(*colour);
colour = (wxColour *)s.GetChild();
if (colour)
win_object->SetDefaultForegroundColour(*colour);
font = (wxFont *)s.GetChild();
if (font)
win_object->SetFont(*font);
s.RemoveChildren(m_number+3);
s.RemoveChildren(number);
s.Recall();
return;
}
@@ -262,12 +270,15 @@ void WXSERIAL(wxFrame)::LoadObject(wxObjectInputStream& s)
WXSERIAL(wxWindow)::LoadObject(s);
if (s.SecondCall())
return;
wxDataInputStream data_s(s);
frame->SetMenuBar(mbar);
if (frame->GetClassInfo() == CLASSINFO(wxFrame))
frame->Create(m_parent, m_id, m_title, wxPoint(m_x, m_y),
wxSize(m_w, m_h), m_style, m_name);
frame->SetMenuBar(mbar);
frame->CreateStatusBar(data_s.Read8());
}
@@ -348,17 +359,21 @@ void WXSERIAL(wxMenuItem)::StoreObject(wxObjectOutputStream& s)
wxMenuItem *item = (wxMenuItem *)Object();
if (s.FirstStage()) {
#ifdef __WXGTK__
s.AddChild(item->GetSubMenu());
#endif
return;
}
wxDataOutputStream data_s(s);
#ifdef __WXGTK__
data_s.Write8( item->GetId() );
data_s.WriteString( item->GetText() );
data_s.Write8( item->IsCheckable() );
data_s.Write8( item->IsEnabled() );
data_s.Write8( item->IsChecked() );
#endif
}
void WXSERIAL(wxMenuItem)::LoadObject(wxObjectInputStream& s)
@@ -366,12 +381,14 @@ void WXSERIAL(wxMenuItem)::LoadObject(wxObjectInputStream& s)
wxMenuItem *item = (wxMenuItem *)Object();
wxDataInputStream data_s(s);
#ifdef __WXGTK__
item->SetId( data_s.Read8() );
item->SetText( data_s.ReadString() );
item->SetCheckable( data_s.Read8() );
item->Enable( data_s.Read8() );
item->Check( data_s.Read8() );
item->SetSubMenu( (wxMenu *)s.GetChild() );
#endif
}
/////////////////////////////////////////////////////////////////////////////
@@ -385,6 +402,9 @@ void WXSERIAL(wxPanel)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxWindow)::LoadObject(s);
if (s.SecondCall())
return;
((wxPanel *)Object())->Create(m_parent, m_id, wxPoint(m_x, m_y),
wxSize(m_w, m_h), m_style, m_name);
}
@@ -400,6 +420,9 @@ void WXSERIAL(wxDialog)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxWindow)::LoadObject(s);
if (s.SecondCall())
return;
((wxDialog *)Object())->Create(m_parent, m_id, m_title, wxPoint(m_x, m_y),
wxSize(m_w, m_h), m_style, m_name);
}
@@ -424,6 +447,11 @@ void WXSERIAL(wxMDIParentFrame)::LoadObject(wxObjectInputStream& s)
wxMDIParentFrame *frame = (wxMDIParentFrame *)Object();
wxMDIClientWindow *client;
if (s.SecondCall()) {
WXSERIAL(wxFrame)::LoadObject(s);
return;
}
client = (wxMDIClientWindow *) s.GetChild();
frame->Create(m_parent, m_id, m_title, wxPoint(m_x, m_y),
@@ -443,6 +471,9 @@ void WXSERIAL(wxMDIChildFrame)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxFrame)::LoadObject(s);
if (s.SecondCall())
return;
((wxMDIChildFrame *)Object())->Create((wxMDIParentFrame *)m_parent,
m_id, m_title,
wxPoint(m_x, m_y), wxSize(m_w, m_h),
@@ -460,5 +491,8 @@ void WXSERIAL(wxMDIClientWindow)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxWindow)::LoadObject(s);
if (s.SecondCall())
return;
((wxMDIClientWindow *)Object())->CreateClient((wxMDIParentFrame *)m_parent, m_style);
}

View File

@@ -38,6 +38,7 @@ class WXSERIAL(wxWindow) : public WXSERIAL(wxObject)
wxValidator *m_validator;
wxColour m_bg_colour, m_fg_colour;
long m_style;
int m_number;
};
DECLARE_SERIAL_CLASS(wxIndividualLayoutConstraint, wxObject)