Minor changes to wxTreeCtrl's horiz size,
Text stream now can write Mac/Unix/Dos EOL on resp. other platforms, Fixed return value of wxBufferedOutputStream::GetSize() and ::TellO() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5036 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -44,14 +44,23 @@ WXDLLEXPORT wxOutputStream& wxEndL(wxOutputStream& o_stream);
|
||||
#define wxStream_READ_ERR wxSTREAM_READ_ERROR
|
||||
|
||||
typedef enum {
|
||||
wxStream_NOERROR = 0,
|
||||
wxStream_EOF,
|
||||
wxStream_WRITE_ERR,
|
||||
wxStream_READ_ERR
|
||||
wxSTREAM_NO_ERROR = 0,
|
||||
wxSTREAM_NO_ERR = wxSTREAM_NO_ERROR,
|
||||
wxSTREAM_NOERROR = wxSTREAM_NO_ERROR,
|
||||
|
||||
wxSTREAM_EOF,
|
||||
|
||||
wxSTREAM_WRITE_ERROR,
|
||||
wxSTREAM_WRITE_ERR = wxSTREAM_WRITE_ERROR,
|
||||
|
||||
wxSTREAM_READ_ERROR,
|
||||
wxSTREAM_READ_ERR = wxSTREAM_READ_ERROR,
|
||||
|
||||
} wxStreamError;
|
||||
|
||||
class WXDLLEXPORT wxStreamBase {
|
||||
public:
|
||||
class WXDLLEXPORT wxStreamBase
|
||||
{
|
||||
public:
|
||||
wxStreamBase();
|
||||
virtual ~wxStreamBase();
|
||||
|
||||
@@ -60,22 +69,21 @@ class WXDLLEXPORT wxStreamBase {
|
||||
virtual size_t GetSize() const { return ~((size_t)0); }
|
||||
size_t StreamSize() const { return GetSize(); }
|
||||
|
||||
protected:
|
||||
|
||||
protected:
|
||||
virtual size_t OnSysRead(void *buffer, size_t bufsize);
|
||||
virtual size_t OnSysWrite(const void *buffer, size_t bufsize);
|
||||
virtual off_t OnSysSeek(off_t seek, wxSeekMode mode);
|
||||
virtual off_t OnSysTell() const;
|
||||
|
||||
protected:
|
||||
friend class wxStreamBuffer;
|
||||
|
||||
size_t m_lastcount;
|
||||
wxStreamError m_lasterror;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxInputStream: public wxStreamBase {
|
||||
public:
|
||||
class WXDLLEXPORT wxInputStream: public wxStreamBase
|
||||
{
|
||||
public:
|
||||
wxInputStream();
|
||||
virtual ~wxInputStream();
|
||||
|
||||
@@ -103,7 +111,7 @@ class WXDLLEXPORT wxInputStream: public wxStreamBase {
|
||||
#endif
|
||||
wxInputStream& operator>>( __wxInputManip func) { return func(*this); }
|
||||
|
||||
protected:
|
||||
protected:
|
||||
// Ungetch managers
|
||||
char *m_wback;
|
||||
size_t m_wbacksize;
|
||||
@@ -111,11 +119,11 @@ class WXDLLEXPORT wxInputStream: public wxStreamBase {
|
||||
|
||||
char *AllocSpaceWBack(size_t needed_size);
|
||||
size_t GetWBack(char *buf, size_t bsize);
|
||||
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxOutputStream: public wxStreamBase {
|
||||
public:
|
||||
class WXDLLEXPORT wxOutputStream: public wxStreamBase
|
||||
{
|
||||
public:
|
||||
wxOutputStream();
|
||||
virtual ~wxOutputStream();
|
||||
|
||||
@@ -141,20 +149,19 @@ class WXDLLEXPORT wxOutputStream: public wxStreamBase {
|
||||
// A stream for measuring streamed output
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class wxCountingOutputStream: public wxOutputStream {
|
||||
public:
|
||||
class wxCountingOutputStream: public wxOutputStream
|
||||
{
|
||||
public:
|
||||
wxCountingOutputStream();
|
||||
|
||||
size_t GetSize() const;
|
||||
bool Ok() const { return TRUE; }
|
||||
|
||||
protected:
|
||||
|
||||
protected:
|
||||
size_t OnSysWrite(const void *buffer, size_t size);
|
||||
off_t OnSysSeek(off_t pos, wxSeekMode mode);
|
||||
off_t OnSysTell() const;
|
||||
|
||||
protected:
|
||||
size_t m_currentPos;
|
||||
};
|
||||
|
||||
@@ -163,8 +170,9 @@ class wxCountingOutputStream: public wxOutputStream {
|
||||
// "Filter" streams
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFilterInputStream: public wxInputStream {
|
||||
public:
|
||||
class WXDLLEXPORT wxFilterInputStream: public wxInputStream
|
||||
{
|
||||
public:
|
||||
wxFilterInputStream();
|
||||
wxFilterInputStream(wxInputStream& stream);
|
||||
~wxFilterInputStream();
|
||||
@@ -173,19 +181,20 @@ class WXDLLEXPORT wxFilterInputStream: public wxInputStream {
|
||||
|
||||
size_t GetSize() const { return m_parent_i_stream->GetSize(); }
|
||||
|
||||
protected:
|
||||
protected:
|
||||
wxInputStream *m_parent_i_stream;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxFilterOutputStream: public wxOutputStream {
|
||||
public:
|
||||
class WXDLLEXPORT wxFilterOutputStream: public wxOutputStream
|
||||
{
|
||||
public:
|
||||
wxFilterOutputStream();
|
||||
wxFilterOutputStream(wxOutputStream& stream);
|
||||
~wxFilterOutputStream();
|
||||
|
||||
size_t GetSize() const { return m_parent_o_stream->GetSize(); }
|
||||
|
||||
protected:
|
||||
protected:
|
||||
wxOutputStream *m_parent_o_stream;
|
||||
};
|
||||
|
||||
@@ -193,23 +202,19 @@ class WXDLLEXPORT wxFilterOutputStream: public wxOutputStream {
|
||||
// Stream buffer
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStreamBuffer {
|
||||
public:
|
||||
class WXDLLEXPORT wxStreamBuffer
|
||||
{
|
||||
public:
|
||||
typedef enum {
|
||||
read = 0, write, read_write
|
||||
} BufMode;
|
||||
|
||||
// -----------
|
||||
// ctor & dtor
|
||||
// -----------
|
||||
wxStreamBuffer(wxStreamBase& stream, BufMode mode);
|
||||
wxStreamBuffer(BufMode mode);
|
||||
wxStreamBuffer(const wxStreamBuffer& buf);
|
||||
~wxStreamBuffer();
|
||||
|
||||
// -----------
|
||||
// Filtered IO
|
||||
// -----------
|
||||
size_t Read(void *buffer, size_t size);
|
||||
size_t Read(wxStreamBuffer *buf);
|
||||
size_t Write(const void *buffer, size_t size);
|
||||
@@ -221,9 +226,7 @@ class WXDLLEXPORT wxStreamBuffer {
|
||||
off_t Tell() const;
|
||||
off_t Seek(off_t pos, wxSeekMode mode);
|
||||
|
||||
// --------------
|
||||
// Buffer control
|
||||
// --------------
|
||||
void ResetBuffer();
|
||||
void SetBufferIO(char *buffer_start, char *buffer_end);
|
||||
void SetBufferIO(size_t bufsize);
|
||||
@@ -241,16 +244,13 @@ class WXDLLEXPORT wxStreamBuffer {
|
||||
bool FillBuffer();
|
||||
size_t GetDataLeft();
|
||||
|
||||
// --------------
|
||||
// Administration
|
||||
// --------------
|
||||
// Misc.
|
||||
wxStreamBase *Stream() { return m_stream; }
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void GetFromBuffer(void *buffer, size_t size);
|
||||
void PutToBuffer(const void *buffer, size_t size);
|
||||
|
||||
protected:
|
||||
char *m_buffer_start, *m_buffer_end, *m_buffer_pos;
|
||||
size_t m_buffer_size;
|
||||
|
||||
@@ -265,8 +265,9 @@ class WXDLLEXPORT wxStreamBuffer {
|
||||
// wxBufferedStreams
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class wxBufferedInputStream: public wxFilterInputStream {
|
||||
public:
|
||||
class wxBufferedInputStream: public wxFilterInputStream
|
||||
{
|
||||
public:
|
||||
wxBufferedInputStream(wxInputStream& stream);
|
||||
~wxBufferedInputStream();
|
||||
|
||||
@@ -279,17 +280,17 @@ class wxBufferedInputStream: public wxFilterInputStream {
|
||||
|
||||
wxStreamBuffer *InputStreamBuffer() const { return m_i_streambuf; }
|
||||
|
||||
protected:
|
||||
protected:
|
||||
size_t OnSysRead(void *buffer, size_t bufsize);
|
||||
off_t OnSysSeek(off_t seek, wxSeekMode mode);
|
||||
off_t OnSysTell() const;
|
||||
|
||||
protected:
|
||||
wxStreamBuffer *m_i_streambuf;
|
||||
};
|
||||
|
||||
class wxBufferedOutputStream: public wxFilterOutputStream {
|
||||
public:
|
||||
class wxBufferedOutputStream: public wxFilterOutputStream
|
||||
{
|
||||
public:
|
||||
wxBufferedOutputStream(wxOutputStream& stream);
|
||||
~wxBufferedOutputStream();
|
||||
|
||||
@@ -301,14 +302,15 @@ class wxBufferedOutputStream: public wxFilterOutputStream {
|
||||
|
||||
void Sync();
|
||||
|
||||
size_t GetSize() const;
|
||||
|
||||
wxStreamBuffer *OutputStreamBuffer() const { return m_o_streambuf; }
|
||||
|
||||
protected:
|
||||
protected:
|
||||
size_t OnSysWrite(const void *buffer, size_t bufsize);
|
||||
off_t OnSysSeek(off_t seek, wxSeekMode mode);
|
||||
off_t OnSysTell() const;
|
||||
|
||||
protected:
|
||||
wxStreamBuffer *m_o_streambuf;
|
||||
};
|
||||
|
||||
|
@@ -28,9 +28,10 @@ typedef wxTextOutputStream& (*__wxTextOutputManip)(wxTextOutputStream&);
|
||||
|
||||
WXDLLEXPORT wxTextOutputStream &endl( wxTextOutputStream &stream );
|
||||
|
||||
class WXDLLEXPORT wxTextInputStream {
|
||||
class WXDLLEXPORT wxTextInputStream
|
||||
{
|
||||
public:
|
||||
wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t"));
|
||||
wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t") );
|
||||
~wxTextInputStream();
|
||||
|
||||
wxUint32 Read32();
|
||||
@@ -41,8 +42,8 @@ public:
|
||||
wxString ReadLine();
|
||||
wxString ReadWord();
|
||||
|
||||
wxString GetStringSeparators() const { return m_separators;}
|
||||
void SetStringSeparators(const wxString &c) { m_separators=c;}
|
||||
wxString GetStringSeparators() const { return m_separators; }
|
||||
void SetStringSeparators(const wxString &c) { m_separators = c; }
|
||||
|
||||
// Operators
|
||||
wxTextInputStream& operator>>(wxString& word);
|
||||
@@ -56,7 +57,7 @@ public:
|
||||
|
||||
wxTextInputStream& operator>>( __wxTextInputManip func) { return func(*this); }
|
||||
|
||||
protected:
|
||||
protected:
|
||||
wxInputStream &m_input;
|
||||
wxString m_separators;
|
||||
|
||||
@@ -65,16 +66,27 @@ public:
|
||||
void SkipIfEndOfLine( wxChar c );
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxTextOutputStream {
|
||||
public:
|
||||
wxTextOutputStream(wxOutputStream& s);
|
||||
~wxTextOutputStream();
|
||||
typedef enum {
|
||||
wxEOL_NATIVE,
|
||||
wxEOL_UNIX,
|
||||
wxEOL_MAC,
|
||||
wxEOL_DOS,
|
||||
} wxEOL;
|
||||
|
||||
class WXDLLEXPORT wxTextOutputStream
|
||||
{
|
||||
public:
|
||||
wxTextOutputStream( wxOutputStream& s, wxEOL mode = wxEOL_NATIVE );
|
||||
virtual ~wxTextOutputStream();
|
||||
|
||||
void SetMode( wxEOL mode = wxEOL_NATIVE );
|
||||
wxEOL GetMode() { return m_mode; }
|
||||
|
||||
void Write32(wxUint32 i);
|
||||
void Write16(wxUint16 i);
|
||||
void Write8(wxUint8 i);
|
||||
void WriteDouble(double d);
|
||||
void WriteString(const wxString& string);
|
||||
virtual void WriteDouble(double d);
|
||||
virtual void WriteString(const wxString& string);
|
||||
|
||||
wxTextOutputStream& operator<<(const wxChar *string);
|
||||
wxTextOutputStream& operator<<(const wxString& string);
|
||||
@@ -88,8 +100,9 @@ class WXDLLEXPORT wxTextOutputStream {
|
||||
|
||||
wxTextOutputStream& operator<<( __wxTextOutputManip func) { return func(*this); }
|
||||
|
||||
protected:
|
||||
protected:
|
||||
wxOutputStream &m_output;
|
||||
wxEOL m_mode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -469,7 +469,7 @@ void wxBoxSizer::RecalcSizes()
|
||||
wxSize wxBoxSizer::CalcMin()
|
||||
{
|
||||
if (m_children.GetCount() == 0)
|
||||
return wxSize(2,2);
|
||||
return wxSize(10,10);
|
||||
|
||||
m_stretchable = 0;
|
||||
m_minWidth = 0;
|
||||
|
@@ -423,21 +423,24 @@ off_t wxStreamBuffer::Seek(off_t pos, wxSeekMode mode)
|
||||
|
||||
off_t wxStreamBuffer::Tell() const
|
||||
{
|
||||
off_t pos;
|
||||
|
||||
if (m_flushable) {
|
||||
pos = m_stream->OnSysTell();
|
||||
off_t pos = m_stream->OnSysTell();
|
||||
if (pos == wxInvalidOffset)
|
||||
return wxInvalidOffset;
|
||||
return pos - GetLastAccess() + GetIntPosition();
|
||||
} else
|
||||
return GetIntPosition();
|
||||
|
||||
pos += GetIntPosition();
|
||||
|
||||
if (m_mode == read && m_flushable)
|
||||
pos -= GetLastAccess();
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
size_t wxStreamBuffer::GetDataLeft()
|
||||
{
|
||||
/* Why is this done? RR. */
|
||||
if (m_buffer_end == m_buffer_pos && m_flushable)
|
||||
FillBuffer();
|
||||
|
||||
return m_buffer_end-m_buffer_pos;
|
||||
}
|
||||
|
||||
@@ -493,14 +496,11 @@ wxInputStream::~wxInputStream()
|
||||
|
||||
char *wxInputStream::AllocSpaceWBack(size_t needed_size)
|
||||
{
|
||||
char *temp_b;
|
||||
size_t toget;
|
||||
|
||||
/* get number of bytes left from previous wback buffer */
|
||||
toget = m_wbacksize - m_wbackcur;
|
||||
size_t toget = m_wbacksize - m_wbackcur;
|
||||
|
||||
/* allocate a buffer large enough to hold prev + new data */
|
||||
temp_b = (char *) malloc(needed_size + toget);
|
||||
char *temp_b = (char *) malloc(needed_size + toget);
|
||||
|
||||
if (!temp_b)
|
||||
return NULL;
|
||||
@@ -533,7 +533,8 @@ size_t wxInputStream::GetWBack(char *buf, size_t bsize)
|
||||
memcpy(buf, (m_wback+m_wbackcur), s_toget);
|
||||
|
||||
m_wbackcur += s_toget;
|
||||
if (m_wbackcur == m_wbacksize) {
|
||||
if (m_wbackcur == m_wbacksize)
|
||||
{
|
||||
free(m_wback);
|
||||
m_wback = (char *)NULL;
|
||||
m_wbacksize = 0;
|
||||
@@ -545,9 +546,7 @@ size_t wxInputStream::GetWBack(char *buf, size_t bsize)
|
||||
|
||||
size_t wxInputStream::Ungetch(const void *buf, size_t bufsize)
|
||||
{
|
||||
char *ptrback;
|
||||
|
||||
ptrback = AllocSpaceWBack(bufsize);
|
||||
char *ptrback = AllocSpaceWBack(bufsize);
|
||||
if (!ptrback)
|
||||
return 0;
|
||||
|
||||
@@ -557,9 +556,7 @@ size_t wxInputStream::Ungetch(const void *buf, size_t bufsize)
|
||||
|
||||
bool wxInputStream::Ungetch(char c)
|
||||
{
|
||||
char *ptrback;
|
||||
|
||||
ptrback = AllocSpaceWBack(1);
|
||||
char * ptrback = AllocSpaceWBack(1);
|
||||
if (!ptrback)
|
||||
return FALSE;
|
||||
|
||||
@@ -576,11 +573,11 @@ char wxInputStream::GetC()
|
||||
|
||||
wxInputStream& wxInputStream::Read(void *buffer, size_t size)
|
||||
{
|
||||
size_t retsize;
|
||||
char *buf = (char *)buffer;
|
||||
|
||||
retsize = GetWBack(buf, size);
|
||||
if (retsize == size) {
|
||||
size_t retsize = GetWBack(buf, size);
|
||||
if (retsize == size)
|
||||
{
|
||||
m_lastcount = size;
|
||||
m_lasterror = wxStream_NOERROR;
|
||||
return *this;
|
||||
@@ -595,12 +592,13 @@ wxInputStream& wxInputStream::Read(void *buffer, size_t size)
|
||||
char wxInputStream::Peek()
|
||||
{
|
||||
char c;
|
||||
|
||||
Read(&c, 1);
|
||||
if (m_lasterror == wxStream_NOERROR) {
|
||||
if (m_lasterror == wxStream_NOERROR)
|
||||
{
|
||||
Ungetch(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -609,7 +607,8 @@ wxInputStream& wxInputStream::Read(wxOutputStream& stream_out)
|
||||
char buf[BUF_TEMP_SIZE];
|
||||
size_t bytes_read = BUF_TEMP_SIZE;
|
||||
|
||||
while (bytes_read == BUF_TEMP_SIZE) {
|
||||
while (bytes_read == BUF_TEMP_SIZE)
|
||||
{
|
||||
bytes_read = Read(buf, bytes_read).LastRead();
|
||||
bytes_read = stream_out.Write(buf, bytes_read).LastWrite();
|
||||
}
|
||||
@@ -618,16 +617,17 @@ wxInputStream& wxInputStream::Read(wxOutputStream& stream_out)
|
||||
|
||||
off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode)
|
||||
{
|
||||
// Should be check and improve, just to remove a slight bug !
|
||||
// I don't know whether it should be put as well in wxFileInputStream::OnSysSeek ?
|
||||
/* Should be check and improve, just to remove a slight bug !
|
||||
I don't know whether it should be put as well in wxFileInputStream::OnSysSeek ? */
|
||||
if (m_lasterror==wxSTREAM_EOF)
|
||||
m_lasterror=wxSTREAM_NOERROR;
|
||||
|
||||
// A call to SeekI() will automatically invalidate any previous call
|
||||
// to Ungetch(), otherwise it would be possible to SeeI() to one
|
||||
// one position, unread some bytes there, SeekI() to another position
|
||||
// and the data would be corrupted.
|
||||
if (m_wback) {
|
||||
/* A call to SeekI() will automatically invalidate any previous call
|
||||
to Ungetch(), otherwise it would be possible to SeekI() to one
|
||||
one position, unread some bytes there, SeekI() to another position
|
||||
and the data would be corrupted. */
|
||||
if (m_wback)
|
||||
{
|
||||
free(m_wback);
|
||||
m_wback = (char*) NULL;
|
||||
m_wbacksize = 0;
|
||||
@@ -733,25 +733,20 @@ size_t wxCountingOutputStream::OnSysWrite(const void *WXUNUSED(buffer), size_t s
|
||||
off_t wxCountingOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
|
||||
{
|
||||
if (mode == wxFromStart)
|
||||
{
|
||||
m_currentPos = pos;
|
||||
}
|
||||
if (mode == wxFromEnd)
|
||||
{
|
||||
m_currentPos = m_lastcount + pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_currentPos += pos;
|
||||
}
|
||||
|
||||
if (m_currentPos > m_lastcount) m_lastcount = m_currentPos;
|
||||
|
||||
return m_currentPos; // ?
|
||||
return m_currentPos;
|
||||
}
|
||||
|
||||
off_t wxCountingOutputStream::OnSysTell() const
|
||||
{
|
||||
return m_currentPos; // ?
|
||||
return m_currentPos;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -821,7 +816,8 @@ wxInputStream& wxBufferedInputStream::Read(void *buffer, size_t size)
|
||||
|
||||
retsize = GetWBack(buf, size);
|
||||
m_lastcount = retsize;
|
||||
if (retsize == size) {
|
||||
if (retsize == size)
|
||||
{
|
||||
m_lasterror = wxStream_NOERROR;
|
||||
return *this;
|
||||
}
|
||||
@@ -858,6 +854,7 @@ off_t wxBufferedInputStream::OnSysTell() const
|
||||
return m_parent_i_stream->TellI();
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBufferedOutputStream
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -914,6 +911,11 @@ off_t wxBufferedOutputStream::OnSysTell() const
|
||||
return m_parent_o_stream->TellO();
|
||||
}
|
||||
|
||||
size_t wxBufferedOutputStream::GetSize() const
|
||||
{
|
||||
return m_parent_o_stream->GetSize() + m_o_streambuf->GetIntPosition();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Some IOManip function
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -323,15 +323,41 @@ wxTextInputStream& wxTextInputStream::operator>>(float& f)
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxTextOutputStream::wxTextOutputStream(wxOutputStream& s)
|
||||
wxTextOutputStream::wxTextOutputStream(wxOutputStream& s, wxEOL mode)
|
||||
: m_output(s)
|
||||
{
|
||||
m_mode = mode;
|
||||
if (m_mode == wxEOL_NATIVE)
|
||||
{
|
||||
#if defined(__WXMSW__) || defined(__WXPM__)
|
||||
m_mode = wxEOL_DOS;
|
||||
#elif defined(__WXMAC__)
|
||||
m_mode = wxEOL_MAC;
|
||||
#else
|
||||
m_mode = wxEOL_UNIX;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
wxTextOutputStream::~wxTextOutputStream()
|
||||
{
|
||||
}
|
||||
|
||||
void wxTextOutputStream::SetMode( wxEOL mode = wxEOL_NATIVE )
|
||||
{
|
||||
m_mode = mode;
|
||||
if (m_mode == wxEOL_NATIVE)
|
||||
{
|
||||
#if defined(__WXMSW__) || defined(__WXPM__)
|
||||
m_mode = wxEOL_DOS;
|
||||
#elif defined(__WXMAC__)
|
||||
m_mode = wxEOL_MAC;
|
||||
#else
|
||||
m_mode = wxEOL_UNIX;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void wxTextOutputStream::Write32(wxUint32 i)
|
||||
{
|
||||
wxString str;
|
||||
@@ -371,25 +397,22 @@ void wxTextOutputStream::WriteString(const wxString& string)
|
||||
wxChar c = string[i];
|
||||
if (c == wxT('\n'))
|
||||
{
|
||||
#if defined(__WINDOWS__)
|
||||
if (m_mode == wxEOL_DOS)
|
||||
{
|
||||
c = wxT('\r');
|
||||
m_output.Write( (const void*)(&c), sizeof(wxChar) );
|
||||
c = wxT('\n');
|
||||
m_output.Write( (const void*)(&c), sizeof(wxChar) );
|
||||
#elif defined(__UNIX__)
|
||||
c = wxT('\n');
|
||||
m_output.Write( (const void*)(&c), sizeof(wxChar) );
|
||||
#elif defined(__WXMAC__)
|
||||
c = wxT('\r');
|
||||
m_output.Write( (const void*)(&c), sizeof(wxChar) );
|
||||
#elif defined(__OS2__)
|
||||
} else
|
||||
if (m_mode == wxEOL_MAC)
|
||||
{
|
||||
c = wxT('\r');
|
||||
m_output.Write( (const void*)(&c), sizeof(wxChar) );
|
||||
} else
|
||||
{
|
||||
c = wxT('\n');
|
||||
m_output.Write( (const void*)(&c), sizeof(wxChar) );
|
||||
#else
|
||||
#error "wxTextOutputStream: unsupported platform."
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -298,11 +298,8 @@ wxGenericTreeItem::wxGenericTreeItem(wxGenericTreeItem *parent,
|
||||
|
||||
m_attr = (wxTreeItemAttr *)NULL;
|
||||
|
||||
dc.GetTextExtent( m_text, &m_width, &m_height );
|
||||
// TODO : Add the width of the image
|
||||
// PB : We don't know which image is shown (image, selImage)
|
||||
// We don't even know imageList from the treectrl this item belongs to !!!
|
||||
// At this point m_width doesn't mean much, this can be remove !
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
}
|
||||
|
||||
wxGenericTreeItem::~wxGenericTreeItem()
|
||||
@@ -1327,6 +1324,7 @@ void wxTreeCtrl::ScrollTo(const wxTreeItemId &item)
|
||||
int y = 0;
|
||||
m_anchor->GetSize( x, y, this );
|
||||
y += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels
|
||||
x += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels
|
||||
int x_pos = GetScrollPos( wxHORIZONTAL );
|
||||
// Item should appear at top
|
||||
SetScrollbars( PIXELS_PER_UNIT, PIXELS_PER_UNIT, x/PIXELS_PER_UNIT, y/PIXELS_PER_UNIT, x_pos, item_y/PIXELS_PER_UNIT );
|
||||
@@ -1338,6 +1336,7 @@ void wxTreeCtrl::ScrollTo(const wxTreeItemId &item)
|
||||
int y = 0;
|
||||
m_anchor->GetSize( x, y, this );
|
||||
y += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels
|
||||
x += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels
|
||||
item_y += PIXELS_PER_UNIT+2;
|
||||
int x_pos = GetScrollPos( wxHORIZONTAL );
|
||||
// Item should appear at bottom
|
||||
@@ -1435,8 +1434,8 @@ void wxTreeCtrl::AdjustMyScrollbars()
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
m_anchor->GetSize( x, y, this );
|
||||
//y += GetLineHeight(m_anchor);
|
||||
y += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels
|
||||
x += PIXELS_PER_UNIT+2; // one more scrollbar unit + 2 pixels
|
||||
int x_pos = GetScrollPos( wxHORIZONTAL );
|
||||
int y_pos = GetScrollPos( wxVERTICAL );
|
||||
SetScrollbars( PIXELS_PER_UNIT, PIXELS_PER_UNIT, x/PIXELS_PER_UNIT, y/PIXELS_PER_UNIT, x_pos, y_pos );
|
||||
|
Reference in New Issue
Block a user