Fixed centering and right-justification when combined with left indentation (bug #10221).

Fixed wrapping problem for long lines (bug #10149).


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57002 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2008-11-28 15:53:13 +00:00
parent 54cb21d692
commit 34b4899df5

View File

@@ -3618,12 +3618,12 @@ void wxRichTextParagraph::ApplyParagraphStyle(const wxTextAttr& attr, const wxRe
// centering, right-justification // centering, right-justification
if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_CENTRE) if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_CENTRE)
{ {
pos.x = (rect.GetWidth() - size.x)/2 + pos.x; pos.x = (rect.GetWidth() - (pos.x - rect.x) - size.x)/2 + pos.x;
line->SetPosition(pos); line->SetPosition(pos);
} }
else if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_RIGHT) else if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_RIGHT)
{ {
pos.x = pos.x + rect.GetWidth() - size.x; pos.x = rect.x + rect.GetWidth() - size.x;
line->SetPosition(pos); line->SetPosition(pos);
} }
@@ -4228,7 +4228,7 @@ bool wxRichTextParagraph::FindWrapPosition(const wxRichTextRange& range, wxDC& d
widthBefore = 0; widthBefore = 0;
size_t i; 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; int widthFromStartOfThisRange = (*partialExtents)[i - GetRange().GetStart()] - widthBefore;
@@ -5473,7 +5473,7 @@ wxTextAttr wxRichTextBuffer::GetStyleForNewParagraph(long pos, bool caretPositio
if (para->GetAttributes().HasBulletNumber()) if (para->GetAttributes().HasBulletNumber())
attr.SetBulletNumber(para->GetAttributes().GetBulletNumber()); attr.SetBulletNumber(para->GetAttributes().GetBulletNumber());
} }
} }
if (!foundAttributes) if (!foundAttributes)
{ {