X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/34b4899df5053a53482f18d8c97a2b1913019d30..fc5d9e38ee002c024be3019e37b63f1a1d88e7c2:/src/richtext/richtextbuffer.cpp diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 80e5e8fd1b..33031e957a 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -3550,7 +3550,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style) ClearUnusedLines(lineCount); // Apply styles to wrapped lines - ApplyParagraphStyle(attr, rect); + ApplyParagraphStyle(attr, rect, dc); SetCachedSize(wxSize(maxWidth, currentPosition.y + spaceBeforePara + spaceAfterPara)); @@ -3602,7 +3602,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style) } /// Apply paragraph styles, such as centering, to wrapped lines -void wxRichTextParagraph::ApplyParagraphStyle(const wxTextAttr& attr, const wxRect& rect) +void wxRichTextParagraph::ApplyParagraphStyle(const wxTextAttr& attr, const wxRect& rect, wxDC& dc) { if (!attr.HasAlignment()) return; @@ -3618,12 +3618,14 @@ void wxRichTextParagraph::ApplyParagraphStyle(const wxTextAttr& attr, const wxRe // centering, right-justification if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_CENTRE) { - pos.x = (rect.GetWidth() - (pos.x - rect.x) - size.x)/2 + pos.x; + int rightIndent = ConvertTenthsMMToPixels(dc, attr.GetRightIndent()); + pos.x = (rect.GetWidth() - (pos.x - rect.x) - rightIndent - size.x)/2 + pos.x; line->SetPosition(pos); } else if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_RIGHT) { - pos.x = rect.x + rect.GetWidth() - size.x; + int rightIndent = ConvertTenthsMMToPixels(dc, attr.GetRightIndent()); + pos.x = rect.x + rect.GetWidth() - size.x - rightIndent; line->SetPosition(pos); } @@ -4228,7 +4230,7 @@ bool wxRichTextParagraph::FindWrapPosition(const wxRichTextRange& range, wxDC& d widthBefore = 0; size_t i; - for (i = (size_t) range.GetStart(); i= < (size_t) range.GetEnd(); i++) + for (i = (size_t) range.GetStart(); i <= (size_t) range.GetEnd(); i++) { int widthFromStartOfThisRange = (*partialExtents)[i - GetRange().GetStart()] - widthBefore;