From 23a54e14a71e9184c3c33c2ba39b10ee1dd029b6 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sun, 1 Aug 1999 11:02:05 +0000 Subject: [PATCH] Updated testconf, Compile fixes for docview and iostreams, SO_RCVTIMEO doesn't exist everywhere and must not be used for setting this option - only getting it on some systems Distrib things git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3230 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/gtk/copy_src | 41 ++++++- distrib/motif/copy_src | 59 ++++++++-- distrib/msw/tmake/filelist.t | 2 + distrib/msw/tmake/filelist.txt | 249 +++++++++++++++++++++++++++++++++++++++++ distrib/msw/tmake/unx.t | 17 +++ include/wx/docview.h | 4 +- include/wx/stream.h | 10 +- samples/docview/doc.cpp | 60 ++++++---- samples/docview/doc.h | 16 +-- samples/docvwmdi/doc.cpp | 118 +++++++++++++++++-- samples/docvwmdi/doc.h | 27 +++-- src/common/docview.cpp | 22 ++-- src/unix/gsocket.c | 5 + 13 files changed, 553 insertions(+), 77 deletions(-) diff --git a/distrib/gtk/copy_src b/distrib/gtk/copy_src index 97903a0..2de6a92 100755 --- a/distrib/gtk/copy_src +++ b/distrib/gtk/copy_src @@ -86,6 +86,7 @@ cd .. mkdir ~/wxgtk_dist/wxGTK/include/wx/gtk cd gtk cp *.h ~/wxgtk_dist/wxGTK/include/wx/gtk +cp *.xpm ~/wxgtk_dist/wxGTK/include/wx/gtk rm ~/wxgtk_dist/wxGTK/include/wx/gtk/setup.h cp Makefile.am ~/wxgtk_dist/wxGTK/include/wx/gtk cp Makefile.in ~/wxgtk_dist/wxGTK/include/wx/gtk @@ -144,7 +145,6 @@ cp Makefile.am ~/wxgtk_dist/wxGTK/src/gtk cp Makefile.in ~/wxgtk_dist/wxGTK/src/gtk cp *.xbm ~/wxgtk_dist/wxGTK/src/gtk cp *.c ~/wxgtk_dist/wxGTK/src/gtk -cp *.inc ~/wxgtk_dist/wxGTK/src/gtk cp *.cpp ~/wxgtk_dist/wxGTK/src/gtk cd .. @@ -154,12 +154,15 @@ cp glob.inc ~/wxgtk_dist/wxGTK/src/common cp lexer.l ~/wxgtk_dist/wxGTK/src/common cp parser.y ~/wxgtk_dist/wxGTK/src/common cp extended.c ~/wxgtk_dist/wxGTK/src/common +cp unzip.* ~/wxgtk_dist/wxGTK/src/common cp *.cpp ~/wxgtk_dist/wxGTK/src/common cd .. cd unix mkdir ~/wxgtk_dist/wxGTK/src/unix cp *.cpp ~/wxgtk_dist/wxGTK/src/unix +cp *.h ~/wxgtk_dist/wxGTK/src/unix +cp *.c ~/wxgtk_dist/wxGTK/src/unix cd .. cd html @@ -516,6 +519,42 @@ mkdir ~/wxgtk_dist/wxGTK/samples/help/doc cp * ~/wxgtk_dist/wxGTK/samples/help/doc cd ../.. +echo HTML samples.. + +cd html +mkdir ~/wxgtk_dist/wxGTK/samples/html +cp Makefile.* ~/wxgtk_dist/wxGTK/samples/html + +mkdir ~/wxgtk_dist/wxGTK/samples/html/about +cp about/Makefile.* ~/wxgtk_dist/wxGTK/samples/html/about +cp about/about.* ~/wxgtk_dist/wxGTK/samples/html/about + +mkdir ~/wxgtk_dist/wxGTK/samples/html/about/data +cp about/data/*.* ~/wxgtk_dist/wxGTK/samples/html/about/data + +mkdir ~/wxgtk_dist/wxGTK/samples/html/help +cp help/Makefile.* ~/wxgtk_dist/wxGTK/samples/html/help +cp help/help.* ~/wxgtk_dist/wxGTK/samples/html/help + +mkdir ~/wxgtk_dist/wxGTK/samples/html/help/helpfiles +cp help/helpfiles/*.* ~/wxgtk_dist/wxGTK/samples/html/help/helpfiles + +mkdir ~/wxgtk_dist/wxGTK/samples/html/printing +cp printing/*.* ~/wxgtk_dist/wxGTK/samples/html/printing + +mkdir ~/wxgtk_dist/wxGTK/samples/html/test +cp test/*.* ~/wxgtk_dist/wxGTK/samples/html/test + +mkdir ~/wxgtk_dist/wxGTK/samples/html/virtual +cp virtual/*.* ~/wxgtk_dist/wxGTK/samples/html/virtual + +mkdir ~/wxgtk_dist/wxGTK/samples/html/widget +cp widget/*.* ~/wxgtk_dist/wxGTK/samples/html/widget + +mkdir ~/wxgtk_dist/wxGTK/samples/html/zip +cp zip/*.* ~/wxgtk_dist/wxGTK/samples/html/zip +cd .. + echo Image sample.. cd image diff --git a/distrib/motif/copy_src b/distrib/motif/copy_src index 5c4a488..6276487 100755 --- a/distrib/motif/copy_src +++ b/distrib/motif/copy_src @@ -29,6 +29,7 @@ cp ltmain.sh ~/wxmotif_dist/wxMotif cp missing ~/wxmotif_dist/wxMotif cp mkinstalldirs ~/wxmotif_dist/wxMotif cp wx-config.in ~/wxmotif_dist/wxMotif +cp makefile.unx.in ~/wxmotif_dist/wxMotif cp setup.h.in ~/wxmotif_dist/wxMotif cp stamp-h.in ~/wxmotif_dist/wxMotif cp Makefile.in ~/wxmotif_dist/wxMotif @@ -68,11 +69,11 @@ cp Makefile.am ~/wxmotif_dist/wxMotif/include/wx/generic cp Makefile.in ~/wxmotif_dist/wxMotif/include/wx/generic cd .. -mkdir ~/wxgtk_dist/wxGTK/include/wx/html +mkdir ~/wxmotif_dist/wxMotif/include/wx/html cd html -cp *.h ~/wxgtk_dist/wxGTK/include/wx/html -cp Makefile.am ~/wxgtk_dist/wxGTK/include/wx/html -cp Makefile.in ~/wxgtk_dist/wxGTK/include/wx/html +cp *.h ~/wxmotif_dist/wxMotif/include/wx/html +cp Makefile.am ~/wxmotif_dist/wxMotif/include/wx/html +cp Makefile.in ~/wxmotif_dist/wxMotif/include/wx/html cd .. mkdir ~/wxmotif_dist/wxMotif/include/wx/unix @@ -143,7 +144,6 @@ cp Makefile.am ~/wxmotif_dist/wxMotif/src/motif cp Makefile.in ~/wxmotif_dist/wxMotif/src/motif cp *.xbm ~/wxmotif_dist/wxMotif/src/motif cp *.c ~/wxmotif_dist/wxMotif/src/motif -cp *.inc ~/wxmotif_dist/wxMotif/src/motif cp *.cpp ~/wxmotif_dist/wxMotif/src/motif cd .. @@ -153,21 +153,24 @@ cp glob.inc ~/wxmotif_dist/wxMotif/src/common cp lexer.l ~/wxmotif_dist/wxMotif/src/common cp parser.y ~/wxmotif_dist/wxMotif/src/common cp extended.c ~/wxmotif_dist/wxMotif/src/common +cp unzip.* ~/wxmotif_dist/wxMotif/src/common cp *.cpp ~/wxmotif_dist/wxMotif/src/common cd .. cd html -mkdir ~/wxgtk_dist/wxGTK/src/html -cp *.cpp ~/wxgtk_dist/wxGTK/src/html -cp *.h ~/wxgtk_dist/wxGTK/src/html +mkdir ~/wxmotif_dist/wxMotif/src/html +cp *.cpp ~/wxmotif_dist/wxMotif/src/html +cp *.h ~/wxmotif_dist/wxMotif/src/html cd bitmaps -mkdir ~/wxgtk_dist/wxGTK/src/html/bitmaps -cp *.xpm ~/wxgtk_dist/wxGTK/src/html/bitmaps +mkdir ~/wxmotif_dist/wxMotif/src/html/bitmaps +cp *.xpm ~/wxmotif_dist/wxMotif/src/html/bitmaps cd ../.. cd unix mkdir ~/wxmotif_dist/wxMotif/src/unix cp *.cpp ~/wxmotif_dist/wxMotif/src/unix +cp *.h ~/wxmotif_dist/wxMotif/src/unix +cp *.c ~/wxmotif_dist/wxMotif/src/unix cd .. cd generic @@ -401,6 +404,42 @@ mkdir ~/wxmotif_dist/wxMotif/samples/help/doc cp * ~/wxmotif_dist/wxMotif/samples/help/doc cd ../.. +echo HTML samples.. + +cd html +mkdir ~/wxmotif_dist/wxMotif/samples/html +cp Makefile.* ~/wxmotif_dist/wxMotif/samples/html + +mkdir ~/wxmotif_dist/wxMotif/samples/html/about +cp about/Makefile.* ~/wxmotif_dist/wxMotif/samples/html/about +cp about/about.* ~/wxmotif_dist/wxMotif/samples/html/about + +mkdir ~/wxmotif_dist/wxMotif/samples/html/about/data +cp about/data/*.* ~/wxmotif_dist/wxMotif/samples/html/about/data + +mkdir ~/wxmotif_dist/wxMotif/samples/html/help +cp help/Makefile.* ~/wxmotif_dist/wxMotif/samples/html/help +cp help/help.* ~/wxmotif_dist/wxMotif/samples/html/help + +mkdir ~/wxmotif_dist/wxMotif/samples/html/help/helpfiles +cp help/helpfiles/*.* ~/wxmotif_dist/wxMotif/samples/html/help/helpfiles + +mkdir ~/wxmotif_dist/wxMotif/samples/html/printing +cp printing/*.* ~/wxmotif_dist/wxMotif/samples/html/printing + +mkdir ~/wxmotif_dist/wxMotif/samples/html/test +cp test/*.* ~/wxmotif_dist/wxMotif/samples/html/test + +mkdir ~/wxmotif_dist/wxMotif/samples/html/virtual +cp virtual/*.* ~/wxgtk_dist/wxGTK/samples/html/virtual + +mkdir ~/wxmotif_dist/wxMotif/samples/html/widget +cp widget/*.* ~/wxmotif_dist/wxMotif/samples/html/widget + +mkdir ~/wxmotif_dist/wxMotif/samples/html/zip +cp zip/*.* ~/wxmotif_dist/wxMotif/samples/html/zip +cd .. + echo Image sample.. cd image diff --git a/distrib/msw/tmake/filelist.t b/distrib/msw/tmake/filelist.t index 3ad997b..d231c6f 100644 --- a/distrib/msw/tmake/filelist.t +++ b/distrib/msw/tmake/filelist.t @@ -45,6 +45,8 @@ $wxHTML{$fields[0]} = $fields[2]; } elsif ( $fields[1] eq "U" ) { $wxUNIX{$fields[0]} = $fields[2]; + } elsif ( $fields[1] eq "I" ) { + $wxINCLUDE{$fields[0]} = $fields[2]; } else { warn "Unknown file type $fields[1] for $fields[0], ignoring.\n"; next line; diff --git a/distrib/msw/tmake/filelist.txt b/distrib/msw/tmake/filelist.txt index 7f94c0f..8a5e3e4 100644 --- a/distrib/msw/tmake/filelist.txt +++ b/distrib/msw/tmake/filelist.txt @@ -13,6 +13,7 @@ # U /src/unix # R /src/gtk # H /src/html +# I /include/wx, /include/wx/gtk, /include/wx/msw, etc. # # The third column may be empty or contain some additional info about this # file (only compile it in 16bit mode, don't compile it with this or that @@ -27,6 +28,16 @@ # O OLE file (needs Win32 and a decent compiler) # S Socket file (currently doesn't compile under Win16 nor with GNU) # R Not required for the GTK port +# WX Base header +# GTK GTK header +# MSW MSW header +# MAC Mac header +# MOT Motif header +# PM OS/2 header +# GEN Generic header +# PRO Protocol header +# HTM wxHtml header +# UNX Unix header ############################################################################### # File name Type Flags @@ -320,4 +331,242 @@ mod_pre.cpp H mod_tables.cpp H search.cpp H +arrimpl.cpp I WX +listimpl.cpp I WX +accel.h I WX +app.h I WX +bitmap.h I WX +bmpbuttn.h I WX +brush.h I WX +buffer.h I WX +busyinfo.h I WX +button.h I WX +caret.h I WX +checkbox.h I WX +checklst.h I WX +choicdlg.h I WX +choice.h I WX +clipbrd.h I WX +cmndata.h I WX +colordlg.h I WX +colour.h I WX +combobox.h I WX +confbase.h I WX +config.h I WX +control.h I WX +cursor.h I WX +dataobj.h I WX +date.h I WX +datstrm.h I WX +db.h I WX +dbtable.h I WX +dc.h I WX +dcclient.h I WX +dcmemory.h I WX +dcprint.h I WX +dcps.h I WX +dcscreen.h I WX +dde.h I WX +debug.h I WX +defs.h I WX +dialog.h I WX +dirdlg.h I WX +dnd.h I WX +docmdi.h I WX +docview.h I WX +dragimag.h I WX +dynarray.h I WX +dynlib.h I WX +event.h I WX +expr.h I WX +extdlg.h I WX +ffile.h I WX +file.h I WX +fileconf.h I WX +filedlg.h I WX +filefn.h I WX +filesys.h I WX +font.h I WX +fontdlg.h I WX +frame.h I WX +fs_inet.h I WX +fs_zip.h I WX +gauge.h I WX +gdicmn.h I WX +gdiobj.h I WX +grid.h I WX +hash.h I WX +help.h I WX +helpbase.h I WX +helphtml.h I WX +helpwin.h I WX +helpxlp.h I WX +icon.h I WX +image.h I WX +imaglist.h I WX +intl.h I WX +ioswrap.h I WX +ipcbase.h I WX +joystick.h I WX +layout.h I WX +laywin.h I WX +list.h I WX +listbox.h I WX +listctrl.h I WX +log.h I WX +longlong.h I WX +matrix.h I WX +mdi.h I WX +memory.h I WX +menu.h I WX +menuitem.h I WX +metafile.h I WX +mimetype.h I WX +minifram.h I WX +module.h I WX +msgdlg.h I WX +mstream.h I WX +notebook.h I WX +object.h I WX +objstrm.h I WX +odbc.h I WX +ownerdrw.h I WX +palette.h I WX +panel.h I WX +paper.h I WX +pen.h I WX +pnghand.h I WX +print.h I WX +printdlg.h I WX +prntbase.h I WX +process.h I WX +progdlg.h I WX +prop.h I WX +propform.h I WX +proplist.h I WX +radiobox.h I WX +radiobut.h I WX +region.h I WX +resource.h I WX +sashwin.h I WX +sckaddr.h I WX +sckipc.h I WX +sckstrm.h I WX +scrolbar.h I WX +scrolwin.h I WX +serbase.h I WX +settings.h I WX +setup.h I WX +slider.h I WX +socket.h I WX +spinbutt.h I WX +splitter.h I WX +statbmp.h I WX +statbox.h I WX +statline.h I WX +stattext.h I WX +statusbr.h I WX +stream.h I WX +string.h I WX +tab.h I WX +tabctrl.h I WX +taskbar.h I WX +tbar95.h I WX +tbarbase.h I WX +tbarmsw.h I WX +tbarsmpl.h I WX +textctrl.h I WX +textdlg.h I WX +textfile.h I WX +txtstrm.h I WX +thread.h I WX +time.h I WX +timer.h I WX +tipdlg.h I WX +tokenzr.h I WX +toolbar.h I WX +tooltip.h I WX +treectrl.h I WX +types.h I WX +url.h I WX +utils.h I WX +valgen.h I WX +validate.h I WX +valtext.h I WX +variant.h I WX +version.h I WX +wave.h I WX +wfstream.h I WX +window.h I WX +wx.h I WX +wx_cw.h I WX +wx_cw_cm.h I WX +wx_cw_d.h I WX +wxchar.h I WX +wxexpr.h I WX +wxhtml.h I WX +wxprec.h I WX +xpmhand.h I WX +zipstream.h I WX +zstream.h I WX + +accel.h I GTK +app.h I GTK +bitmap.h I GTK +bmpbuttn.h I GTK +brush.h I GTK +button.h I GTK +checkbox.h I GTK +checklst.h I GTK +choice.h I GTK +choicdlg.h I GTK +clipbrd.h I GTK +colour.h I GTK +combobox.h I GTK +control.h I GTK +cursor.h I GTK +dataobj.h I GTK +dc.h I GTK +dcclient.h I GTK +dcmemory.h I GTK +dcscreen.h I GTK +dialog.h I GTK +dnd.h I GTK +filedlg.h I GTK +font.h I GTK +frame.h I GTK +gauge.h I GTK +gdiobj.h I GTK +icon.h I GTK +joystick.h I GTK +listbox.h I GTK +mdi.h I GTK +menu.h I GTK +menuitem.h I GTK +msgdlg.h I GTK +minifram.h I GTK +notebook.h I GTK +palette.h I GTK +pen.h I GTK +radiobox.h I GTK +radiobut.h I GTK +region.h I GTK +scrolbar.h I GTK +settings.h I GTK +slider.h I GTK +spinbutt.h I GTK +statbmp.h I GTK +statbox.h I GTK +statline.h I GTK +stattext.h I GTK +tbargtk.h I GTK +textctrl.h I GTK +textdlg.h I GTK +timer.h I GTK +tooltip.h I GTK +treectrl.h I GTK +wave.h I GTK +win_gtk.h I GTK +window.h I GTK + # vi: set noet ts=16 nolist: diff --git a/distrib/msw/tmake/unx.t b/distrib/msw/tmake/unx.t index 0e6b1cc..7c14b25 100644 --- a/distrib/msw/tmake/unx.t +++ b/distrib/msw/tmake/unx.t @@ -41,7 +41,20 @@ $file =~ s/cp?p?$/\o/; $project{"WXUNIXOBJS"} .= $file . " " } + #$} +# +# I want this to be: +# $(INSTALL_DATA) $(INCDIR)/wx/window.h $(includedir)/wx/window.h +# +# foreach $file (sort keys %wxINCLUDE) { +# next if $wxINCLUDE{$file} =~ /\b(GTK|MSW|MOT|PM|MAC|GEN|HTM|UNX)\b/; +# +# $project{"WXINSTALLWX"} .= "$(INSTALL_DATA)" . " " . "\$(INCDIR)/wx/" . $file . " \$(includedir)/wx/" . $file . "\n" +# } +# +# +# # This file was automatically generated by tmake at #$ Now() # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE UNX.T! @@ -182,6 +195,7 @@ PNGDIR = $(WXDIR)/src/png JPEGDIR = $(WXDIR)/src/jpeg ZLIBDIR = $(WXDIR)/src/zlib GTKDIR = $(WXDIR)/src/gtk +INCDIR = $(WXDIR)/include DOCDIR = $(WXDIR)\docs @@ -315,6 +329,9 @@ lexer.c: $(COMMDIR)/lexer.l sed -e "s/unput/PROIO_unput/g" > lexer.c @$(RM) lex.yy.c +install: $(WXLIB) + #$ ExpandList("WXINSTALLWX"); + clean: rm -f *.o rm -f *.lo diff --git a/include/wx/docview.h b/include/wx/docview.h index 68a49c8..592b3d6 100644 --- a/include/wx/docview.h +++ b/include/wx/docview.h @@ -92,8 +92,8 @@ public: virtual ostream& SaveObject(ostream& stream); virtual istream& LoadObject(istream& stream); #else - virtual bool SaveObject(wxOutputStream& stream); - virtual bool LoadObject(wxInputStream& stream); + virtual wxOutputStream& SaveObject(wxOutputStream& stream); + virtual wxInputStream& LoadObject(wxInputStream& stream); #endif // Called by wxWindows diff --git a/include/wx/stream.h b/include/wx/stream.h index 030f4f4..5a95880 100644 --- a/include/wx/stream.h +++ b/include/wx/stream.h @@ -38,10 +38,10 @@ WXDLLEXPORT wxOutputStream& wxEndL(wxOutputStream& o_stream); // wxStream: base classes // --------------------------------------------------------------------------- -#define wxStream_NOERROR wxSTR_NOERROR -#define wxStream_EOF wxSTR_EOF -#define wxStream_WRITE_ERR wxSTR_WRITE_ERROR -#define wxStream_READ_ERR wxSTR_READ_ERROR +#define wxStream_NOERROR wxSTREAM_NOERROR +#define wxStream_EOF wxSTREAM_EOF +#define wxStream_WRITE_ERR wxSTREAM_WRITE_ERROR +#define wxStream_READ_ERR wxSTREAM_READ_ERROR typedef enum { wxStream_NOERROR = 0, @@ -55,7 +55,7 @@ class WXDLLEXPORT wxStreamBase { wxStreamBase(); virtual ~wxStreamBase(); - bool operator!() const { return (LastError() != wxSTR_NOERROR); } + bool operator!() const { return (LastError() != wxSTREAM_NOERROR); } wxStreamError LastError() const { return m_lasterror; } virtual size_t GetSize() const { return ~((size_t)0); } size_t StreamSize() const { return GetSize(); } diff --git a/samples/docview/doc.cpp b/samples/docview/doc.cpp index fb915e6..d679a53 100644 --- a/samples/docview/doc.cpp +++ b/samples/docview/doc.cpp @@ -47,8 +47,10 @@ DrawingDocument::~DrawingDocument(void) ostream& DrawingDocument::SaveObject(ostream& stream) { wxDocument::SaveObject(stream); - - stream << doodleSegments.Number() << '\n'; + + wxInt32 n = doodleSegments.Number(); + stream << n << '\n'; + wxNode *node = doodleSegments.First(); while (node) { @@ -58,28 +60,30 @@ ostream& DrawingDocument::SaveObject(ostream& stream) node = node->Next(); } + return stream; } #else -bool DrawingDocument::SaveObject(wxOutputStream &stream) +wxOutputStream& DrawingDocument::SaveObject(wxOutputStream& stream) { wxDocument::SaveObject(stream); - + wxTextOutputStream text_stream( stream ); wxInt32 n = doodleSegments.Number(); - text_stream << n << "\n"; + text_stream << n << '\n'; wxNode *node = doodleSegments.First(); while (node) { DoodleSegment *segment = (DoodleSegment *)node->Data(); segment->SaveObject(stream); - text_stream << "\n"; + text_stream << '\n'; node = node->Next(); } - return TRUE; + + return stream; } #endif @@ -87,8 +91,8 @@ bool DrawingDocument::SaveObject(wxOutputStream &stream) istream& DrawingDocument::LoadObject(istream& stream) { wxDocument::LoadObject(stream); - - int n = 0; + + wxInt32 n = 0; stream >> n; for (int i = 0; i < n; i++) @@ -101,12 +105,12 @@ istream& DrawingDocument::LoadObject(istream& stream) return stream; } #else -bool DrawingDocument::LoadObject(wxInputStream& stream) +wxInputStream& DrawingDocument::LoadObject(wxInputStream& stream) { wxDocument::LoadObject(stream); wxTextInputStream text_stream( stream ); - + wxInt32 n = 0; text_stream >> n; @@ -117,7 +121,7 @@ bool DrawingDocument::LoadObject(wxInputStream& stream) doodleSegments.Append(segment); } - return TRUE; + return stream; } #endif @@ -151,23 +155,29 @@ DoodleSegment::~DoodleSegment(void) #if wxUSE_STD_IOSTREAM ostream& DoodleSegment::SaveObject(ostream& stream) { - stream << lines.Number() << '\n'; + wxInt32 n = lines.Number(); + stream << n << '\n'; + wxNode *node = lines.First(); while (node) { DoodleLine *line = (DoodleLine *)node->Data(); - stream << line->x1 << " " << line->y1 << " " << line->x2 << " " << line->y2 << "\n"; + stream << line->x1 << " " << + line->y1 << " " << + line->x2 << " " << + line->y2 << "\n"; node = node->Next(); } + return stream; } #else -bool DoodleSegment::SaveObject(wxOutputStream& stream) +wxOutputStream &DoodleSegment::SaveObject(wxOutputStream& stream) { wxTextOutputStream text_stream( stream ); wxInt32 n = lines.Number(); - text_stream << n << "\n"; + text_stream << n << '\n'; wxNode *node = lines.First(); while (node) @@ -179,29 +189,34 @@ bool DoodleSegment::SaveObject(wxOutputStream& stream) line->y2 << "\n"; node = node->Next(); } - return TRUE; + + return stream; } #endif #if wxUSE_STD_IOSTREAM istream& DoodleSegment::LoadObject(istream& stream) { - int n = 0; + wxInt32 n = 0; stream >> n; for (int i = 0; i < n; i++) { DoodleLine *line = new DoodleLine; - stream >> line->x1 >> line->y1 >> line->x2 >> line->y2; + stream >> line->x1 >> + line->y1 >> + line->x2 >> + line->y2; lines.Append(line); } + return stream; } #else -bool DoodleSegment::LoadObject(wxInputStream& stream) +wxInputStream &DoodleSegment::LoadObject(wxInputStream& stream) { wxTextInputStream text_stream( stream ); - + wxInt32 n = 0; text_stream >> n; @@ -214,7 +229,8 @@ bool DoodleSegment::LoadObject(wxInputStream& stream) line->y2; lines.Append(line); } - return TRUE; + + return stream; } #endif diff --git a/samples/docview/doc.h b/samples/docview/doc.h index 5507967..2842a32 100644 --- a/samples/docview/doc.h +++ b/samples/docview/doc.h @@ -40,11 +40,11 @@ class DoodleSegment: public wxObject void Draw(wxDC *dc); #if wxUSE_STD_IOSTREAM - ostream& SaveObject(ostream& stream); - istream& LoadObject(istream& stream); + ostream& SaveObject(ostream& text_stream); + istream& LoadObject(istream& text_stream); #else - bool SaveObject(wxOutputStream& stream); - bool LoadObject(wxInputStream& stream); + wxOutputStream& SaveObject(wxOutputStream& stream); + wxInputStream& LoadObject(wxInputStream& stream); #endif }; @@ -60,11 +60,11 @@ class DrawingDocument: public wxDocument ~DrawingDocument(void); #if wxUSE_STD_IOSTREAM - ostream& SaveObject(ostream& stream); - istream& LoadObject(istream& stream); + ostream& SaveObject(ostream& text_stream); + istream& LoadObject(istream& text_stream); #else - bool SaveObject(wxOutputStream& stream); - bool LoadObject(wxInputStream& stream); + wxOutputStream& SaveObject(wxOutputStream& stream); + wxInputStream& LoadObject(wxInputStream& stream); #endif inline wxList& GetDoodleSegments(void) const { return (wxList&) doodleSegments; }; diff --git a/samples/docvwmdi/doc.cpp b/samples/docvwmdi/doc.cpp index 23a5316..fe26f59 100644 --- a/samples/docvwmdi/doc.cpp +++ b/samples/docvwmdi/doc.cpp @@ -23,6 +23,7 @@ #ifndef WX_PRECOMP #include "wx/wx.h" #endif +#include "wx/txtstrm.h" #if !wxUSE_DOC_VIEW_ARCHITECTURE #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h! @@ -42,11 +43,14 @@ DrawingDocument::~DrawingDocument(void) doodleSegments.DeleteContents(TRUE); } +#if wxUSE_STD_IOSTREAM ostream& DrawingDocument::SaveObject(ostream& stream) { wxDocument::SaveObject(stream); - - stream << doodleSegments.Number() << '\n'; + + wxInt32 n = doodleSegments.Number(); + stream << n << '\n'; + wxNode *node = doodleSegments.First(); while (node) { @@ -56,14 +60,39 @@ ostream& DrawingDocument::SaveObject(ostream& stream) node = node->Next(); } + return stream; } +#else +wxOutputStream& DrawingDocument::SaveObject(wxOutputStream& stream) +{ + wxDocument::SaveObject(stream); + + wxTextOutputStream text_stream( stream ); + wxInt32 n = doodleSegments.Number(); + text_stream << n << '\n'; + + wxNode *node = doodleSegments.First(); + while (node) + { + DoodleSegment *segment = (DoodleSegment *)node->Data(); + segment->SaveObject(stream); + text_stream << '\n'; + + node = node->Next(); + } + + return stream; +} +#endif + +#if wxUSE_STD_IOSTREAM istream& DrawingDocument::LoadObject(istream& stream) { wxDocument::LoadObject(stream); - - int n = 0; + + wxInt32 n = 0; stream >> n; for (int i = 0; i < n; i++) @@ -75,7 +104,26 @@ istream& DrawingDocument::LoadObject(istream& stream) return stream; } +#else +wxInputStream& DrawingDocument::LoadObject(wxInputStream& stream) +{ + wxDocument::LoadObject(stream); + + wxTextInputStream text_stream( stream ); + + wxInt32 n = 0; + text_stream >> n; + + for (int i = 0; i < n; i++) + { + DoodleSegment *segment = new DoodleSegment; + segment->LoadObject(stream); + doodleSegments.Append(segment); + } + return stream; +} +#endif DoodleSegment::DoodleSegment(void) { } @@ -103,33 +151,87 @@ DoodleSegment::~DoodleSegment(void) lines.DeleteContents(TRUE); } +#if wxUSE_STD_IOSTREAM ostream& DoodleSegment::SaveObject(ostream& stream) { - stream << lines.Number() << '\n'; + wxInt32 n = lines.Number(); + stream << n << '\n'; + wxNode *node = lines.First(); while (node) { DoodleLine *line = (DoodleLine *)node->Data(); - stream << line->x1 << " " << line->y1 << " " << line->x2 << " " << line->y2 << "\n"; + stream << line->x1 << " " << + line->y1 << " " << + line->x2 << " " << + line->y2 << "\n"; node = node->Next(); } + return stream; } +#else +wxOutputStream &DoodleSegment::SaveObject(wxOutputStream& stream) +{ + wxTextOutputStream text_stream( stream ); + + wxInt32 n = lines.Number(); + text_stream << n << '\n'; + + wxNode *node = lines.First(); + while (node) + { + DoodleLine *line = (DoodleLine *)node->Data(); + text_stream << line->x1 << " " << + line->y1 << " " << + line->x2 << " " << + line->y2 << "\n"; + node = node->Next(); + } + return stream; +} +#endif + +#if wxUSE_STD_IOSTREAM istream& DoodleSegment::LoadObject(istream& stream) { - int n = 0; + wxInt32 n = 0; stream >> n; for (int i = 0; i < n; i++) { DoodleLine *line = new DoodleLine; - stream >> line->x1 >> line->y1 >> line->x2 >> line->y2; + stream >> line->x1 >> + line->y1 >> + line->x2 >> + line->y2; lines.Append(line); } + return stream; } +#else +wxInputStream &DoodleSegment::LoadObject(wxInputStream& stream) +{ + wxTextInputStream text_stream( stream ); + wxInt32 n = 0; + text_stream >> n; + + for (int i = 0; i < n; i++) + { + DoodleLine *line = new DoodleLine; + text_stream >> line->x1 >> + line->y1 >> + line->x2 >> + line->y2; + lines.Append(line); + } + + return stream; +} +#endif void DoodleSegment::Draw(wxDC *dc) { wxNode *node = lines.First(); diff --git a/samples/docvwmdi/doc.h b/samples/docvwmdi/doc.h index a83b45c..ce250ff 100644 --- a/samples/docvwmdi/doc.h +++ b/samples/docvwmdi/doc.h @@ -22,10 +22,10 @@ class DoodleLine: public wxObject { public: - long x1; - long y1; - long x2; - long y2; + wxInt32 x1; + wxInt32 y1; + wxInt32 x2; + wxInt32 y2; }; // Contains a list of lines: represents a mouse-down doodle @@ -39,8 +39,14 @@ class DoodleSegment: public wxObject ~DoodleSegment(void); void Draw(wxDC *dc); - ostream& SaveObject(ostream& stream); - istream& LoadObject(istream& stream); + +#if wxUSE_STD_IOSTREAM + ostream& SaveObject(ostream& text_stream); + istream& LoadObject(istream& text_stream); +#else + wxOutputStream& SaveObject(wxOutputStream& stream); + wxInputStream& LoadObject(wxInputStream& stream); +#endif }; class DrawingDocument: public wxDocument @@ -53,8 +59,13 @@ class DrawingDocument: public wxDocument DrawingDocument(void); ~DrawingDocument(void); - ostream& SaveObject(ostream& stream); - istream& LoadObject(istream& stream); +#if wxUSE_STD_IOSTREAM + ostream& SaveObject(ostream& text_stream); + istream& LoadObject(istream& text_stream); +#else + wxOutputStream& SaveObject(wxOutputStream& stream); + wxInputStream& LoadObject(wxInputStream& stream); +#endif inline wxList& GetDoodleSegments(void) const { return (wxList&) doodleSegments; }; }; diff --git a/src/common/docview.cpp b/src/common/docview.cpp index e5dda96..fcfe874 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -294,7 +294,7 @@ bool wxDocument::OnSaveDocument(const wxString& file) // Saving error return FALSE; } - if (SaveObject(store)==FALSE) + if (!SaveObject(store)) { (void)wxMessageBox(_("Sorry, could not save this file."), msgTitle, wxOK | wxICON_EXCLAMATION, GetDocumentWindow()); @@ -329,7 +329,7 @@ bool wxDocument::OnOpenDocument(const wxString& file) GetDocumentWindow()); return FALSE; } - if (LoadObject(store)==FALSE) + if (!LoadObject(store)) { (void)wxMessageBox(_("Sorry, could not open this file."), msgTitle, wxOK|wxICON_EXCLAMATION, GetDocumentWindow()); @@ -346,25 +346,21 @@ bool wxDocument::OnOpenDocument(const wxString& file) #if wxUSE_STD_IOSTREAM istream& wxDocument::LoadObject(istream& stream) +#else +wxInputStream& wxDocument::LoadObject(wxInputStream& stream) +#endif { return stream; } +#if wxUSE_STD_IOSTREAM ostream& wxDocument::SaveObject(ostream& stream) -{ - return stream; -} #else -bool wxDocument::LoadObject(wxInputStream& stream) -{ - return TRUE; -} - -bool wxDocument::SaveObject(wxOutputStream& stream) +wxOutputStream& wxDocument::SaveObject(wxOutputStream& stream) +#endif { - return TRUE; + return stream; } -#endif bool wxDocument::Revert() { diff --git a/src/unix/gsocket.c b/src/unix/gsocket.c index 9ab270d..9b56a93 100644 --- a/src/unix/gsocket.c +++ b/src/unix/gsocket.c @@ -494,6 +494,10 @@ void GSocket_SetTimeout(GSocket *socket, unsigned long millisec) assert(socket != NULL); socket->m_timeout = millisec; + /* Neither GLIBC 2.0 nor the kernel 2.0.36 define SO_SNDTIMEO or + SO_RCVTIMEO. The man pages, that these flags should exist but + are read only. RR. */ +#ifndef __LINUX__ if (socket->m_fd != -1) { struct timeval tval; @@ -502,6 +506,7 @@ void GSocket_SetTimeout(GSocket *socket, unsigned long millisec) setsockopt(socket->m_fd, SOL_SOCKET, SO_SNDTIMEO, &tval, sizeof(tval)); setsockopt(socket->m_fd, SOL_SOCKET, SO_RCVTIMEO, &tval, sizeof(tval)); } +#endif } /* -- 2.7.4