Fixed floating object layout when there is only a short text string in the paragraph

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75895 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2014-02-17 14:54:09 +00:00
parent ba7e065a34
commit 29a83101bc

View File

@@ -5249,7 +5249,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
currentPosition.y += lineSpacing;
maxDescent = 0;
maxAscent = 0;
maxWidth = wxMax(maxWidth, currentWidth+startOffset);
maxWidth = wxMax(maxWidth, currentWidth+currentPosition.x);
currentWidth = 0;
lineCount ++;
@@ -5296,7 +5296,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
lineHeight = wxMax(lineHeight, (maxDescent + maxAscent));
maxWidth = wxMax(maxWidth, currentWidth+startOffset);
maxWidth = wxMax(maxWidth, currentWidth+currentPosition.x);
lastEndPos = child->GetRange().GetEnd();
node = node->GetNext();
@@ -5376,7 +5376,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
wxRect marginRect, borderRect, contentRect, paddingRect, outlineRect;
contentRect = wxRect(wxPoint(0, 0), wxSize(paraSize.x + wxMax(leftIndent, leftIndent + leftSubIndent) + rightIndent, currentPosition.y + spaceAfterPara));
GetBoxRects(dc, buffer, attr, marginRect, borderRect, contentRect, paddingRect, outlineRect);
SetMaxSize(marginRect.GetSize());
SetMaxSize(wxSize(wxMax(GetCachedSize().x, marginRect.GetSize().x), wxMax(GetCachedSize().y, marginRect.y)));
}
// Find the greatest minimum size. Currently we only look at non-text objects,
@@ -6536,6 +6536,9 @@ void wxRichTextParagraph::LayoutFloat(wxDC& dc, wxRichTextDrawingContext& contex
int pos = floatCollector->GetFitPosition(anchored->GetAttributes().GetTextBoxAttr().GetFloatMode(), rect.y + offsetY, size.y);
// I can't remember why we tried to update the top offset here, but anyhow it results in
// a wrong position being computed, so don't.
#if 0
/* Update the offset */
int newOffsetY = pos - rect.y;
if (newOffsetY != offsetY)
@@ -6551,7 +6554,7 @@ void wxRichTextParagraph::LayoutFloat(wxDC& dc, wxRichTextDrawingContext& contex
anchored->GetAttributes().GetTextBoxAttr().GetTop().SetValue(newOffsetY, wxTEXT_ATTR_UNITS_TENTHS_MM);
}
}
#endif
if (anchored->GetAttributes().GetTextBoxAttr().GetFloatMode() == wxTEXT_BOX_ATTR_FLOAT_LEFT)
x = rect.x;
else if (anchored->GetAttributes().GetTextBoxAttr().GetFloatMode() == wxTEXT_BOX_ATTR_FLOAT_RIGHT)