]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextbuffer.cpp
fix preprocessor expression, closes #12822
[wxWidgets.git] / src / richtext / richtextbuffer.cpp
index 9236cda997af06e259b73a722a5a21495c0a661f..924074a58673a9140098b572f6b2f53c108c2129 100644 (file)
@@ -5117,7 +5117,7 @@ bool wxRichTextPlainText::DrawTabbedString(wxDC& dc, const wxRichTextAttr& attr,
             dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
     }
 
-    wxCoord x_orig = x;
+    wxCoord x_orig = GetParent()->GetPosition().x;
     while (hasTabs)
     {
         // the string has a tab
@@ -5216,6 +5216,7 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz
 
     wxRichTextParagraph* para = wxDynamicCast(GetParent(), wxRichTextParagraph);
     wxASSERT (para != NULL);
+    int relativeX = position.x - GetParent()->GetPosition().x;
 
     wxRichTextAttr textAttr(para ? para->GetCombinedAttributes(GetAttributes()) : GetAttributes());
 
@@ -5302,9 +5303,9 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz
                     partialExtents->Add(oldWidth + p[j]);
 
                 if (partialExtents->GetCount() > 0)
-                    absoluteWidth = (*partialExtents)[(*partialExtents).GetCount()-1] + position.x;
+                    absoluteWidth = (*partialExtents)[(*partialExtents).GetCount()-1] + relativeX;
                 else
-                    absoluteWidth = position.x;
+                    absoluteWidth = relativeX;
             }
             else
             {
@@ -5331,7 +5332,7 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz
                     }
 
                     notFound = false;
-                    width = nextTabPos - position.x;
+                    width = nextTabPos - relativeX;
 
                     if (partialExtents)
                         partialExtents->Add(width);
@@ -6535,7 +6536,11 @@ bool wxRichTextBuffer::PasteFromClipboard(long position)
                     delete richTextBuffer;
                 }
             }
-            else if (wxTheClipboard->IsSupported(wxDF_TEXT) || wxTheClipboard->IsSupported(wxDF_UNICODETEXT))
+            else if (wxTheClipboard->IsSupported(wxDF_TEXT)
+#if wxUSE_UNICODE
+                        || wxTheClipboard->IsSupported(wxDF_UNICODETEXT)
+#endif // wxUSE_UNICODE
+                    )
             {
                 wxTextDataObject data;
                 wxTheClipboard->GetData(data);
@@ -6599,9 +6604,12 @@ bool wxRichTextBuffer::CanPasteFromClipboard() const
 #if wxUSE_CLIPBOARD && wxUSE_DATAOBJ
     if (!wxTheClipboard->IsOpened() && wxTheClipboard->Open())
     {
-        if (wxTheClipboard->IsSupported(wxDF_TEXT) || wxTheClipboard->IsSupported(wxDF_UNICODETEXT) ||
-            wxTheClipboard->IsSupported(wxDataFormat(wxRichTextBufferDataObject::GetRichTextBufferFormatId())) ||
-            wxTheClipboard->IsSupported(wxDF_BITMAP))
+        if (wxTheClipboard->IsSupported(wxDF_TEXT)
+#if wxUSE_UNICODE
+                || wxTheClipboard->IsSupported(wxDF_UNICODETEXT)
+#endif // wxUSE_UNICODE
+                || wxTheClipboard->IsSupported(wxDataFormat(wxRichTextBufferDataObject::GetRichTextBufferFormatId()))
+                || wxTheClipboard->IsSupported(wxDF_BITMAP))
         {
             canPaste = true;
         }
@@ -7837,7 +7845,7 @@ bool wxRichTextImageBlock::DoMakeImageBlock(const wxImage& image, wxBitmapType i
 
     unsigned char* block = new unsigned char[memStream.GetSize()];
     if (!block)
-        return NULL;
+        return false;
 
     if (m_data)
         delete[] m_data;