diff --git a/uppsrc/CtrlLib/RichText.h b/uppsrc/CtrlLib/RichText.h index 885baef19..d659d40d0 100644 --- a/uppsrc/CtrlLib/RichText.h +++ b/uppsrc/CtrlLib/RichText.h @@ -27,6 +27,7 @@ private: int sell, selh; int cursor, anchor; bool lazy; + bool shrink_oversized_objects; void EndSizeTracking(); void SetSb(); @@ -89,8 +90,10 @@ public: RichTextView& AutoHideSb(bool b = true) { sb.AutoHide(b); return *this; } RichTextView& HyperlinkDecoration(bool b = true) { hldec = b; Refresh(); return *this; } RichTextView& NoHyperlinkDecoration() { return HyperlinkDecoration(false); } - RichTextView& Lazy(bool b) { lazy = b; return *this; } + RichTextView& Lazy(bool b = true) { lazy = b; return *this; } RichTextView& NoLazy() { return Lazy(false); } + RichTextView& ShrinkOversizedObjects(bool b = true) { shrink_oversized_objects = b; return *this; } + RichTextView& NoShrinkOversizedObjects() { return ShrinkOversizedObjects(false); } void operator=(const char *qtf) { SetQTF(qtf); } diff --git a/uppsrc/CtrlLib/RichTextView.cpp b/uppsrc/CtrlLib/RichTextView.cpp index 697c946de..a48ffe603 100644 --- a/uppsrc/CtrlLib/RichTextView.cpp +++ b/uppsrc/CtrlLib/RichTextView.cpp @@ -34,6 +34,7 @@ void RichTextView::Paint(Draw& w) pi.bottom = PageY(0, sb + sz.cy / pi.zoom); pi.usecache = true; pi.sizetracking = sizetracking; + pi.shrink_oversized_objects = shrink_oversized_objects; int y = 0; if(vcenter && sb.GetTotal() < sb.GetPage()) { PageY py = text.GetHeight(GetPage()); @@ -410,6 +411,7 @@ RichTextCtrl::RichTextCtrl() Background(Null); SetFrame(NullFrame()); AutoHideSb(); + shrink_oversized_objects = true; } #ifndef PLATFORM_PDA diff --git a/uppsrc/RichText/ParaData.cpp b/uppsrc/RichText/ParaData.cpp index 84a1e67e9..c442ca8f2 100644 --- a/uppsrc/RichText/ParaData.cpp +++ b/uppsrc/RichText/ParaData.cpp @@ -59,6 +59,7 @@ PaintInfo::PaintInfo() coloroverride = false; context = NULL; showlabels = false; + shrink_oversized_objects = false; } String RichPara::Number::AsText(const RichPara::NumberFormat& format) const diff --git a/uppsrc/RichText/ParaPaint.cpp b/uppsrc/RichText/ParaPaint.cpp index add37a4bd..b71298117 100644 --- a/uppsrc/RichText/ParaPaint.cpp +++ b/uppsrc/RichText/ParaPaint.cpp @@ -247,8 +247,11 @@ void RichPara::Paint(PageDraw& pw, const Rect& page, PageY py, const PaintInfo& const RichObject& o = *hg->object; if(o) { Size sz = z * o.GetSize(); - draw.DrawRect(z * x, z * py.y, sz.cx, z * linecy, (*i)->paper); - draw.Clipoff(z * x, z * (y0 - hg->ascent), sz.cx, sz.cy); + int ix = z * x; + if(pi.shrink_oversized_objects && sz.cx + ix > page.right) + sz.cx = page.right - ix; + draw.DrawRect(ix, z * py.y, sz.cx, z * linecy, (*i)->paper); + draw.Clipoff(ix, z * (y0 - hg->ascent), sz.cx, sz.cy); if(pi.sizetracking) draw.DrawRect(sz, SColorFace); else diff --git a/uppsrc/RichText/RichText.h b/uppsrc/RichText/RichText.h index b20307d85..654b86a14 100644 --- a/uppsrc/RichText/RichText.h +++ b/uppsrc/RichText/RichText.h @@ -271,6 +271,7 @@ struct PaintInfo { bool coloroverride; void *context; bool showlabels; + bool shrink_oversized_objects; PaintInfo(); };