]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix for wrong line placement when centering or right-aligning
authorJulian Smart <julian@anthemion.co.uk>
Wed, 23 Sep 2009 07:38:42 +0000 (07:38 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 23 Sep 2009 07:38:42 +0000 (07:38 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62026 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextbuffer.cpp

index 4e00843d4bab8e7204866d6cc93042b36c8ff86a..14fcf8998464fe05093111a6ef6b8447289dc9a6 100644 (file)
@@ -3641,17 +3641,13 @@ void wxRichTextParagraph::ApplyParagraphStyle(const wxTextAttr& attr, const wxRe
         if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_CENTRE)
         {
             int rightIndent = ConvertTenthsMMToPixels(dc, attr.GetRightIndent());
-            pos.x = (rect.GetWidth() - (pos.x - rect.x) - rightIndent - size.x)/2 + pos.x;
-            // Lines are relative to the paragraph position
-            pos.x -= GetPosition().x;
+            pos.x = (rect.GetWidth() - pos.x - rightIndent - size.x)/2 + pos.x;
             line->SetPosition(pos);
         }
         else if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_RIGHT)
         {
             int rightIndent = ConvertTenthsMMToPixels(dc, attr.GetRightIndent());
-            pos.x = rect.x + rect.GetWidth() - size.x - rightIndent;
-            // Lines are relative to the paragraph position
-            pos.x -= GetPosition().x;
+            pos.x = rect.GetWidth() - size.x - rightIndent;
             line->SetPosition(pos);
         }