RichText, CtrlLib: PaintInfo - shrink_oversized_objects, used in RichTextView

git-svn-id: svn://ultimatepp.org/upp/trunk@2172 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-03-04 08:25:11 +00:00
parent 3355bcdcbe
commit 2038bcb97d
5 changed files with 13 additions and 3 deletions

View file

@ -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); }

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -271,6 +271,7 @@ struct PaintInfo {
bool coloroverride;
void *context;
bool showlabels;
bool shrink_oversized_objects;
PaintInfo();
};