From 20d09da5f8b5fb9c991a37efcb486bec24886d42 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Mon, 7 May 2012 15:47:23 +0000 Subject: [PATCH] Corrected top-level object layout in paragraphs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71377 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/richtext/richtextbuffer.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 82b67e7d68..1a679f6711 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -4793,6 +4793,12 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co } while (doLoop); + if (child->IsTopLevel()) + { + // We can move it to the correct position at this point + child->Move(GetPosition() + wxPoint(currentWidth, currentPosition.y)); + } + // Cases: // 1) There was a line break BEFORE the natural break // 2) There was a line break AFTER the natural break @@ -4807,12 +4813,6 @@ bool wxRichTextParagraph::Layout(wxDC& dc, wxRichTextDrawingContext& context, co ) { - if (child->IsTopLevel()) - { - // We can move it to the correct position at this point - child->Move(GetPosition() + wxPoint(currentWidth, currentPosition.y)); - } - long wrapPosition = 0; if ((childSize.x + currentWidth <= availableRect.width) && !node->GetNext() && !lineBreakInThisObject) wrapPosition = child->GetRange().GetEnd(); @@ -10334,7 +10334,7 @@ bool wxRichTextImage::LoadImageCache(wxDC& dc, bool resetCache) } /// Draw the item -bool wxRichTextImage::Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& range, const wxRichTextSelection& selection, const wxRect& rect, int WXUNUSED(descent), int WXUNUSED(style)) +bool wxRichTextImage::Draw(wxDC& dc, wxRichTextDrawingContext& context, const wxRichTextRange& WXUNUSED(range), const wxRichTextSelection& selection, const wxRect& rect, int WXUNUSED(descent), int WXUNUSED(style)) { if (!IsShown()) return true; @@ -10349,12 +10349,6 @@ bool wxRichTextImage::Draw(wxDC& dc, wxRichTextDrawingContext& context, const wx DrawBoxAttributes(dc, GetBuffer(), attr, wxRect(rect.GetPosition(), GetCachedSize())); -#if 0 - int y = rect.y + (rect.height - m_imageCache.GetHeight()); - - dc.DrawBitmap(m_imageCache, rect.x, y, true); -#endif - wxSize imageSize(m_imageCache.GetWidth(), m_imageCache.GetHeight()); wxRect marginRect, borderRect, contentRect, paddingRect, outlineRect; marginRect = rect; // outer rectangle, will calculate contentRect -- 2.45.2