Proofed that iostreams break threads
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1313 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
2d17d68f47
commit
f5abe9111b
@ -21,12 +21,20 @@
|
||||
#include "wx/string.h"
|
||||
#include "wx/control.h"
|
||||
|
||||
#ifdef wxUSE_STD_IOSTREAM
|
||||
|
||||
#if wxUSE_IOSTREAMH
|
||||
#include <iostream.h>
|
||||
#else
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define NO_TEXT_WINDOW_STREAM
|
||||
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -43,7 +51,11 @@ extern const char *wxTextCtrlNameStr;
|
||||
// wxTextCtrl
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
class wxTextCtrl: public wxControl, public streambuf
|
||||
#else
|
||||
class wxTextCtrl: public wxControl
|
||||
#endif
|
||||
{
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxTextCtrl);
|
||||
@ -89,6 +101,7 @@ class wxTextCtrl: public wxControl, public streambuf
|
||||
|
||||
void OnChar( wxKeyEvent &event );
|
||||
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
int overflow(int i);
|
||||
int sync();
|
||||
int underflow();
|
||||
@ -99,6 +112,7 @@ class wxTextCtrl: public wxControl, public streambuf
|
||||
wxTextCtrl& operator<<(float f);
|
||||
wxTextCtrl& operator<<(double d);
|
||||
wxTextCtrl& operator<<(const char c);
|
||||
#endif
|
||||
|
||||
void SetFont( const wxFont &font );
|
||||
void SetForegroundColour(const wxColour &colour);
|
||||
|
@ -40,8 +40,10 @@ extern wxList wxTopLevelWindows;
|
||||
|
||||
class wxLayoutConstraints;
|
||||
class wxSizer;
|
||||
#if wxUSE_WX_RESOURCES
|
||||
class wxResourceTable;
|
||||
class wxItemResource;
|
||||
#endif
|
||||
|
||||
class wxClientData;
|
||||
class wxVoidClientData;
|
||||
@ -120,10 +122,12 @@ public:
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~wxWindow();
|
||||
|
||||
#if wxUSE_WX_RESOURCES
|
||||
virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName,
|
||||
const wxResourceTable *table = (const wxResourceTable *) NULL);
|
||||
virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource,
|
||||
const wxResourceTable *table = (const wxResourceTable *) NULL);
|
||||
#endif
|
||||
|
||||
bool Close( bool force = FALSE );
|
||||
virtual bool Destroy();
|
||||
|
@ -21,12 +21,20 @@
|
||||
#include "wx/string.h"
|
||||
#include "wx/control.h"
|
||||
|
||||
#ifdef wxUSE_STD_IOSTREAM
|
||||
|
||||
#if wxUSE_IOSTREAMH
|
||||
#include <iostream.h>
|
||||
#else
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define NO_TEXT_WINDOW_STREAM
|
||||
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -43,7 +51,11 @@ extern const char *wxTextCtrlNameStr;
|
||||
// wxTextCtrl
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
class wxTextCtrl: public wxControl, public streambuf
|
||||
#else
|
||||
class wxTextCtrl: public wxControl
|
||||
#endif
|
||||
{
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxTextCtrl);
|
||||
@ -89,6 +101,7 @@ class wxTextCtrl: public wxControl, public streambuf
|
||||
|
||||
void OnChar( wxKeyEvent &event );
|
||||
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
int overflow(int i);
|
||||
int sync();
|
||||
int underflow();
|
||||
@ -99,6 +112,7 @@ class wxTextCtrl: public wxControl, public streambuf
|
||||
wxTextCtrl& operator<<(float f);
|
||||
wxTextCtrl& operator<<(double d);
|
||||
wxTextCtrl& operator<<(const char c);
|
||||
#endif
|
||||
|
||||
void SetFont( const wxFont &font );
|
||||
void SetForegroundColour(const wxColour &colour);
|
||||
|
@ -40,8 +40,10 @@ extern wxList wxTopLevelWindows;
|
||||
|
||||
class wxLayoutConstraints;
|
||||
class wxSizer;
|
||||
#if wxUSE_WX_RESOURCES
|
||||
class wxResourceTable;
|
||||
class wxItemResource;
|
||||
#endif
|
||||
|
||||
class wxClientData;
|
||||
class wxVoidClientData;
|
||||
@ -120,10 +122,12 @@ public:
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~wxWindow();
|
||||
|
||||
#if wxUSE_WX_RESOURCES
|
||||
virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName,
|
||||
const wxResourceTable *table = (const wxResourceTable *) NULL);
|
||||
virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource,
|
||||
const wxResourceTable *table = (const wxResourceTable *) NULL);
|
||||
#endif
|
||||
|
||||
bool Close( bool force = FALSE );
|
||||
virtual bool Destroy();
|
||||
|
@ -180,6 +180,7 @@ private:
|
||||
FILE *m_fp;
|
||||
};
|
||||
|
||||
#ifdef wxUSE_STD_IOSTREAM
|
||||
// log everything to an "ostream", cerr by default
|
||||
class WXDLLEXPORT wxLogStream : public wxLog
|
||||
{
|
||||
@ -194,9 +195,11 @@ protected:
|
||||
// @@ using ptr here to avoid including <iostream.h> from this file
|
||||
ostream *m_ostr;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef wxUSE_NOGUI
|
||||
|
||||
#ifdef wxUSE_STD_IOSTREAM
|
||||
// log everything to a text window (GUI only of course)
|
||||
class WXDLLEXPORT wxLogTextCtrl : public wxLogStream
|
||||
{
|
||||
@ -205,6 +208,7 @@ public:
|
||||
wxLogTextCtrl(wxTextCtrl *pTextCtrl);
|
||||
~wxLogTextCtrl();
|
||||
};
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GUI log target, the default one for wxWindows programs
|
||||
|
@ -33,11 +33,11 @@ DEBUG = @WXDEBUG@ @WXDEBUG_DEFINE@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS=@CPPFLAGS@
|
||||
CFLAGS = @CFLAGS@ $(CPPFLAGS) $(OPTIMISE) $(PROFILE) $(DEBUG)
|
||||
CFLAGS = @CFLAGS@ $(CPPFLAGS) $(OPTIMISE) $(PROFILE) $(DEBUG) -D_REENTRANT
|
||||
|
||||
# c++-compiler stuff
|
||||
CXX = @CXX@
|
||||
CXXFLAGS = @CXXFLAGS@ $(CPPFLAGS) $(OPTIMISE) $(PROFILE) $(DEBUG)
|
||||
CXXFLAGS = @CXXFLAGS@ $(CPPFLAGS) $(OPTIMISE) $(PROFILE) $(DEBUG) -D_REENTRANT
|
||||
CXXCPP = @CXXCPP@
|
||||
|
||||
# shared compile stuff
|
||||
|
@ -75,6 +75,7 @@
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
// No, Cygwin doesn't appear to have fnmatch.h after all.
|
||||
#if defined(HAVE_FNMATCH_H)
|
||||
@ -1091,7 +1092,7 @@ char *wxGetTempFileName(const wxString& prefix, char *buf)
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
cerr << _("wxWindows: error finding temporary file name.\n");
|
||||
wxLogError( _("wxWindows: error finding temporary file name.\n") );
|
||||
if (buf) buf[0] = 0;
|
||||
return (char *) NULL;
|
||||
#endif
|
||||
|
@ -389,6 +389,7 @@ void wxLogStderr::DoLogString(const char *szString)
|
||||
// wxLogStream implementation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef wxUSE_STD_IOSTREAM
|
||||
wxLogStream::wxLogStream(ostream *ostr)
|
||||
{
|
||||
if ( ostr == NULL )
|
||||
@ -401,15 +402,17 @@ void wxLogStream::DoLogString(const char *szString)
|
||||
{
|
||||
(*m_ostr) << szString << endl << flush;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef wxUSE_NOGUI
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxLogTextCtrl implementation
|
||||
// ----------------------------------------------------------------------------
|
||||
wxLogTextCtrl::wxLogTextCtrl(wxTextCtrl *pTextCtrl)
|
||||
// @@@ TODO: in wxGTK wxTextCtrl doesn't derive from streambuf
|
||||
|
||||
// Also, in DLL mode in wxMSW, can't use it.
|
||||
#ifdef wxUSE_STD_IOSTREAM
|
||||
wxLogTextCtrl::wxLogTextCtrl(wxTextCtrl *pTextCtrl)
|
||||
// DLL mode in wxMSW, can't use it.
|
||||
#if defined(NO_TEXT_WINDOW_STREAM)
|
||||
#else
|
||||
: wxLogStream(new ostream(pTextCtrl))
|
||||
@ -421,6 +424,7 @@ wxLogTextCtrl::~wxLogTextCtrl()
|
||||
{
|
||||
delete m_ostr;
|
||||
}
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxLogGui implementation
|
||||
|
@ -8,6 +8,7 @@ LIB_MINOR=1
|
||||
|
||||
# define library sources
|
||||
|
||||
|
||||
LIB_CPP_SRC=\
|
||||
\
|
||||
common/cmndata.cpp \
|
||||
@ -38,7 +39,6 @@ LIB_CPP_SRC=\
|
||||
common/dbtable.cpp \
|
||||
common/postscrp.cpp \
|
||||
common/prntbase.cpp \
|
||||
common/resource.cpp \
|
||||
common/serbase.cpp \
|
||||
common/string.cpp \
|
||||
common/textfile.cpp \
|
||||
@ -57,7 +57,6 @@ LIB_CPP_SRC=\
|
||||
common/validate.cpp \
|
||||
common/valtext.cpp \
|
||||
common/variant.cpp \
|
||||
common/wxexpr.cpp \
|
||||
common/socket.cpp \
|
||||
common/sckaddr.cpp \
|
||||
common/sckipc.cpp \
|
||||
@ -66,6 +65,8 @@ LIB_CPP_SRC=\
|
||||
common/ftp.cpp \
|
||||
common/url.cpp \
|
||||
common/tokenzr.cpp \
|
||||
common/resource.cpp \
|
||||
common/wxexpr.cpp \
|
||||
\
|
||||
gtk/accel.cpp \
|
||||
gtk/app.cpp \
|
||||
|
@ -19,7 +19,9 @@
|
||||
#include "wx/memory.h"
|
||||
#include "wx/font.h"
|
||||
#include "wx/settings.h"
|
||||
#ifdef wxUSE_WX_RESOURCES
|
||||
#include "wx/resource.h"
|
||||
#endif
|
||||
#include "wx/module.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/thread.h"
|
||||
@ -320,8 +322,7 @@ void wxApp::CommonInit(void)
|
||||
#endif
|
||||
*/
|
||||
wxSystemSettings::Init();
|
||||
wxTheResourceCache = new wxResourceCache(wxKEY_STRING);
|
||||
|
||||
|
||||
wxTheFontNameDirectory = new wxFontNameDirectory;
|
||||
wxTheFontNameDirectory->Initialize();
|
||||
|
||||
@ -331,7 +332,11 @@ void wxApp::CommonInit(void)
|
||||
wxInitializeStockLists();
|
||||
wxInitializeStockObjects();
|
||||
|
||||
#ifdef wxUSE_WX_RESOURCES
|
||||
wxTheResourceCache = new wxResourceCache(wxKEY_STRING);
|
||||
|
||||
wxInitializeResourceSystem();
|
||||
#endif
|
||||
|
||||
wxImage::InitStandardHandlers();
|
||||
|
||||
@ -344,14 +349,16 @@ void wxApp::CommonCleanUp(void)
|
||||
wxDELETE(wxTheFontNameDirectory);
|
||||
wxDeleteStockObjects();
|
||||
|
||||
#ifdef wxUSE_WX_RESOURCES
|
||||
wxFlushResources();
|
||||
|
||||
wxDELETE(wxTheResourceCache);
|
||||
|
||||
wxCleanUpResourceSystem();
|
||||
#endif
|
||||
|
||||
wxDeleteStockLists();
|
||||
|
||||
wxCleanUpResourceSystem();
|
||||
|
||||
wxImage::CleanUpHandlers();
|
||||
|
||||
wxSystemSettings::Done();
|
||||
|
@ -180,7 +180,7 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
|
||||
else
|
||||
{
|
||||
/* the user pressed on the menu item -> report */
|
||||
item->m_isChecked; /* make consistent again */
|
||||
item->m_isChecked = item->IsChecked(); /* make consistent again */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,13 +68,21 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
|
||||
EVT_CHAR(wxTextCtrl::OnChar)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
wxTextCtrl::wxTextCtrl() : streambuf()
|
||||
{
|
||||
if (allocate()) setp(base(),ebuf());
|
||||
|
||||
m_modified = FALSE;
|
||||
}
|
||||
#else
|
||||
wxTextCtrl::wxTextCtrl()
|
||||
{
|
||||
m_modified = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
int style, const wxValidator& validator, const wxString &name ) : streambuf()
|
||||
@ -84,6 +92,15 @@ wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
m_modified = FALSE;
|
||||
Create( parent, id, value, pos, size, style, validator, name );
|
||||
}
|
||||
#else
|
||||
wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
int style, const wxValidator& validator, const wxString &name )
|
||||
{
|
||||
m_modified = FALSE;
|
||||
Create( parent, id, value, pos, size, style, validator, name );
|
||||
}
|
||||
#endif
|
||||
|
||||
bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
@ -621,6 +638,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
|
||||
key_event.Skip();
|
||||
}
|
||||
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
int wxTextCtrl::overflow( int WXUNUSED(c) )
|
||||
{
|
||||
int len = pptr() - pbase();
|
||||
@ -697,6 +715,7 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
|
||||
WriteText(buf);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
GtkWidget* wxTextCtrl::GetConnectWidget()
|
||||
{
|
||||
|
@ -19,7 +19,9 @@
|
||||
#include "wx/memory.h"
|
||||
#include "wx/font.h"
|
||||
#include "wx/settings.h"
|
||||
#ifdef wxUSE_WX_RESOURCES
|
||||
#include "wx/resource.h"
|
||||
#endif
|
||||
#include "wx/module.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/thread.h"
|
||||
@ -320,8 +322,7 @@ void wxApp::CommonInit(void)
|
||||
#endif
|
||||
*/
|
||||
wxSystemSettings::Init();
|
||||
wxTheResourceCache = new wxResourceCache(wxKEY_STRING);
|
||||
|
||||
|
||||
wxTheFontNameDirectory = new wxFontNameDirectory;
|
||||
wxTheFontNameDirectory->Initialize();
|
||||
|
||||
@ -331,7 +332,11 @@ void wxApp::CommonInit(void)
|
||||
wxInitializeStockLists();
|
||||
wxInitializeStockObjects();
|
||||
|
||||
#ifdef wxUSE_WX_RESOURCES
|
||||
wxTheResourceCache = new wxResourceCache(wxKEY_STRING);
|
||||
|
||||
wxInitializeResourceSystem();
|
||||
#endif
|
||||
|
||||
wxImage::InitStandardHandlers();
|
||||
|
||||
@ -344,14 +349,16 @@ void wxApp::CommonCleanUp(void)
|
||||
wxDELETE(wxTheFontNameDirectory);
|
||||
wxDeleteStockObjects();
|
||||
|
||||
#ifdef wxUSE_WX_RESOURCES
|
||||
wxFlushResources();
|
||||
|
||||
wxDELETE(wxTheResourceCache);
|
||||
|
||||
wxCleanUpResourceSystem();
|
||||
#endif
|
||||
|
||||
wxDeleteStockLists();
|
||||
|
||||
wxCleanUpResourceSystem();
|
||||
|
||||
wxImage::CleanUpHandlers();
|
||||
|
||||
wxSystemSettings::Done();
|
||||
|
@ -180,7 +180,7 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
|
||||
else
|
||||
{
|
||||
/* the user pressed on the menu item -> report */
|
||||
item->m_isChecked; /* make consistent again */
|
||||
item->m_isChecked = item->IsChecked(); /* make consistent again */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,13 +68,21 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
|
||||
EVT_CHAR(wxTextCtrl::OnChar)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
wxTextCtrl::wxTextCtrl() : streambuf()
|
||||
{
|
||||
if (allocate()) setp(base(),ebuf());
|
||||
|
||||
m_modified = FALSE;
|
||||
}
|
||||
#else
|
||||
wxTextCtrl::wxTextCtrl()
|
||||
{
|
||||
m_modified = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
int style, const wxValidator& validator, const wxString &name ) : streambuf()
|
||||
@ -84,6 +92,15 @@ wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
m_modified = FALSE;
|
||||
Create( parent, id, value, pos, size, style, validator, name );
|
||||
}
|
||||
#else
|
||||
wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
int style, const wxValidator& validator, const wxString &name )
|
||||
{
|
||||
m_modified = FALSE;
|
||||
Create( parent, id, value, pos, size, style, validator, name );
|
||||
}
|
||||
#endif
|
||||
|
||||
bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
@ -621,6 +638,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
|
||||
key_event.Skip();
|
||||
}
|
||||
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
int wxTextCtrl::overflow( int WXUNUSED(c) )
|
||||
{
|
||||
int len = pptr() - pbase();
|
||||
@ -697,6 +715,7 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
|
||||
WriteText(buf);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
GtkWidget* wxTextCtrl::GetConnectWidget()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user