wxRichTextObject* child = node->GetData();
if (!child->GetRange().IsOutside(range))
{
-// if (lineCount > 0)
-// text += wxT("\n");
wxRichTextRange childRange = range;
childRange.LimitTo(child->GetRange());
text += childText;
- if (childRange.GetEnd() == child->GetRange().GetEnd())
+ if ((childRange.GetEnd() == child->GetRange().GetEnd()) && node->GetNext())
text += wxT("\n");
lineCount ++;
IMPLEMENT_CLASS(wxRichTextFileHandler, wxObject)
-#if wxUSE_STREAMS
+#if wxUSE_FFILE && wxUSE_STREAMS
bool wxRichTextFileHandler::LoadFile(wxRichTextBuffer *buffer, const wxString& filename)
{
wxFFileInputStream stream(filename);
return false;
}
-#endif // wxUSE_STREAMS
+#endif // wxUSE_FFILE && wxUSE_STREAMS
/// Can we handle this filename (if using files)? By default, checks the extension.
bool wxRichTextFileHandler::CanHandle(const wxString& filename) const
// Write data in hex to a stream
bool wxRichTextImageBlock::WriteHex(wxOutputStream& stream)
{
- wxString hex;
- int i;
- for (i = 0; i < (int) m_dataSize; i++)
+ const int bufSize = 512;
+ char buf[bufSize+1];
+
+ int left = m_dataSize;
+ int n, i, j;
+ j = 0;
+ while (left > 0)
{
- hex = wxDecToHex(m_data[i]);
- wxCharBuffer buf = hex.ToAscii();
+ if (left*2 > bufSize)
+ {
+ n = bufSize; left -= (bufSize/2);
+ }
+ else
+ {
+ n = left*2; left = 0;
+ }
- stream.Write((const char*) buf, hex.length());
- }
+ char* b = buf;
+ for (i = 0; i < (n/2); i++)
+ {
+ wxDecToHex(m_data[j], b, b+1);
+ b += 2; j ++;
+ }
+ buf[n] = 0;
+ stream.Write((const char*) buf, n);
+ }
return true;
}
if (m_data)
delete[] m_data;
- wxString str(wxT(" "));
+ wxChar str[2];
m_data = new unsigned char[dataSize];
int i;
for (i = 0; i < dataSize; i ++)