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:
@@ -5249,7 +5249,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
currentPosition.y += lineSpacing;
|
currentPosition.y += lineSpacing;
|
||||||
maxDescent = 0;
|
maxDescent = 0;
|
||||||
maxAscent = 0;
|
maxAscent = 0;
|
||||||
maxWidth = wxMax(maxWidth, currentWidth+startOffset);
|
maxWidth = wxMax(maxWidth, currentWidth+currentPosition.x);
|
||||||
currentWidth = 0;
|
currentWidth = 0;
|
||||||
|
|
||||||
lineCount ++;
|
lineCount ++;
|
||||||
@@ -5296,7 +5296,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
|
|
||||||
lineHeight = wxMax(lineHeight, (maxDescent + maxAscent));
|
lineHeight = wxMax(lineHeight, (maxDescent + maxAscent));
|
||||||
|
|
||||||
maxWidth = wxMax(maxWidth, currentWidth+startOffset);
|
maxWidth = wxMax(maxWidth, currentWidth+currentPosition.x);
|
||||||
lastEndPos = child->GetRange().GetEnd();
|
lastEndPos = child->GetRange().GetEnd();
|
||||||
|
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
@@ -5376,7 +5376,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co
|
|||||||
wxRect marginRect, borderRect, contentRect, paddingRect, outlineRect;
|
wxRect marginRect, borderRect, contentRect, paddingRect, outlineRect;
|
||||||
contentRect = wxRect(wxPoint(0, 0), wxSize(paraSize.x + wxMax(leftIndent, leftIndent + leftSubIndent) + rightIndent, currentPosition.y + spaceAfterPara));
|
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);
|
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,
|
// 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);
|
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 */
|
/* Update the offset */
|
||||||
int newOffsetY = pos - rect.y;
|
int newOffsetY = pos - rect.y;
|
||||||
if (newOffsetY != offsetY)
|
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);
|
anchored->GetAttributes().GetTextBoxAttr().GetTop().SetValue(newOffsetY, wxTEXT_ATTR_UNITS_TENTHS_MM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (anchored->GetAttributes().GetTextBoxAttr().GetFloatMode() == wxTEXT_BOX_ATTR_FLOAT_LEFT)
|
if (anchored->GetAttributes().GetTextBoxAttr().GetFloatMode() == wxTEXT_BOX_ATTR_FLOAT_LEFT)
|
||||||
x = rect.x;
|
x = rect.x;
|
||||||
else if (anchored->GetAttributes().GetTextBoxAttr().GetFloatMode() == wxTEXT_BOX_ATTR_FLOAT_RIGHT)
|
else if (anchored->GetAttributes().GetTextBoxAttr().GetFloatMode() == wxTEXT_BOX_ATTR_FLOAT_RIGHT)
|
||||||
|
Reference in New Issue
Block a user