9 #ifndef CMyRedirector_H
10 #define CMyRedirector_H
12 #include <wx/string.h>
13 #include <wx/textctrl.h>
15 #include <wx/thread.h>
52 wxTextCtrl*
obj,
bool yieldApplication =
false,
int bufferSize = 3000,
53 bool also_cerr =
false,
bool threadSafe =
false,
54 bool also_to_cout_cerr =
false)
63 char* ptr =
new char[bufferSize];
64 setp(ptr, ptr + bufferSize);
70 sbOld = std::cout.rdbuf();
71 std::cout.rdbuf(
this);
76 std::cerr.rdbuf(
this);
84 std::cout.rdbuf(
sbOld);
98 s = wxString(str.c_str(), wxConvUTF8);
103 #if wxCHECK_VERSION(3, 0, 0) && !defined(__APPLE__) // OSX build error?
104 m_txt->GetEventHandler()->CallAfter(&wxTextCtrl::WriteText,
s);
117 wxTheApp->Yield(
true);
126 wxCriticalSectionLocker lock(
m_cs);
147 wxCriticalSectionLocker lock(
m_cs);
148 if (pbase() == epptr())
163 wxCriticalSectionLocker lock(
m_cs);
165 if (pbase() != pptr())
167 int len = int(pptr() - pbase());
170 setp(pbase(), epptr());