Fix for wrong line placement when centering or right-aligning

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@62027 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2009-09-23 07:38:57 +00:00
parent 66b33d22fa
commit 279df2ce99

View File

@@ -4177,18 +4177,14 @@ void wxRichTextParagraph::ApplyParagraphStyle(const wxTextAttrEx& attr, const wx
// centering, right-justification // centering, right-justification
if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_CENTRE) if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_CENTRE)
{ {
int rightIndent = ConvertTenthsMMToPixels(* g_globalDC, attr.GetRightIndent()); int rightIndent = ConvertTenthsMMToPixels(dc, attr.GetRightIndent());
pos.x = (rect.GetWidth() - (pos.x - rect.x) - rightIndent - size.x)/2 + pos.x; pos.x = (rect.GetWidth() - pos.x - rightIndent - size.x)/2 + pos.x;
// Lines are relative to the paragraph position
pos.x -= GetPosition().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)
{ {
int rightIndent = ConvertTenthsMMToPixels(* g_globalDC, attr.GetRightIndent()); int rightIndent = ConvertTenthsMMToPixels(dc, attr.GetRightIndent());
pos.x = rect.x + rect.GetWidth() - size.x - rightIndent; pos.x = rect.GetWidth() - size.x - rightIndent;
// Lines are relative to the paragraph position
pos.x -= GetPosition().x;
line->SetPosition(pos); line->SetPosition(pos);
} }
@@ -5313,7 +5309,7 @@ bool wxRichTextPlainText::DrawTabbedString(wxDC& dc, const wxTextAttrEx& attr, c
dc.SetBackgroundMode(wxTRANSPARENT); dc.SetBackgroundMode(wxTRANSPARENT);
} }
wxCoord x_orig = x; wxCoord x_orig = x;
while (hasTabs) while (hasTabs)
{ {
// the string has a tab // the string has a tab