diff --git a/uppsrc/Report/Report.upp b/uppsrc/Report/Report.upp index 459e5cbdb..9d71de976 100644 --- a/uppsrc/Report/Report.upp +++ b/uppsrc/Report/Report.upp @@ -5,7 +5,7 @@ uses RichText; file - Report.h options PCH, + Report.h options(BUILDER_OPTION) PCH, Report.cpp, ReportDlg.cpp, ReportI.icpp, diff --git a/uppsrc/RichText/RichText.upp b/uppsrc/RichText/RichText.upp index 081e58fdf..244486337 100644 --- a/uppsrc/RichText/RichText.upp +++ b/uppsrc/RichText/RichText.upp @@ -5,7 +5,7 @@ uses Draw; file - RichText.h options PCH, + RichText.h options(BUILDER_OPTION) PCH, Object.cpp, RichImage.icpp, Para.h, diff --git a/uppsrc/RichText/Text.h b/uppsrc/RichText/Text.h index a2d866dcc..515073a86 100644 --- a/uppsrc/RichText/Text.h +++ b/uppsrc/RichText/Text.h @@ -42,7 +42,7 @@ public: void CatPick(RichText rval_ p); using RichTxt::CatPick; - RichContext Context(const Rect& page) const; + RichContext Context(const Rect& page, PageY py) const; RichPos GetRichPos(int pos, int maxlevel = INT_MAX) const; int operator[](int pos) const { return GetRichPos(pos).chr; } diff --git a/uppsrc/RichText/TextPaint.cpp b/uppsrc/RichText/TextPaint.cpp index 3cbfd0886..3255acdad 100644 --- a/uppsrc/RichText/TextPaint.cpp +++ b/uppsrc/RichText/TextPaint.cpp @@ -2,23 +2,25 @@ NAMESPACE_UPP -RichContext RichText::Context(const Rect& page) const +RichContext RichText::Context(const Rect& page, PageY py) const { RichContext c(style); c.page = GetPageMinusHeaderFooter(page); - c.py = PageY(0, c.page.top); + if(py.y < c.page.top) + c.py = PageY(0, c.page.top); + else + c.py = py; return c; } PageY RichText::GetHeight(const Rect& page) const { - return RichTxt::GetHeight(Context(page)); + return RichTxt::GetHeight(Context(page, PageY(0, 0))); } PageY RichText::GetHeight(PageY py, const Rect& page) const { - RichContext ctx = Context(page); - ctx.py = py; + RichContext ctx = Context(page, py); return RichTxt::GetHeight(ctx); } @@ -29,18 +31,15 @@ int RichText::GetWidth() const void RichText::Paint(PageDraw& w, PageY py, const Rect& page, const PaintInfo& pi) const { - RichContext ctx = Context(page); + RichContext ctx = Context(page, py); int from_page = py.page; - if(py.y < ctx.page.top) - py.y = ctx.page.top; - ctx.py = py; RichTxt::Paint(w, ctx, pi); PaintHeaderFooter(w, page, pi, from_page, ctx.py.page); } void RichText::Paint(PageDraw& w, const Rect& page, const PaintInfo& pi) const { - RichContext ctx = Context(page); + RichContext ctx = Context(page, PageY(0, 0)); int from_page = ctx.py.page; RichTxt::Paint(w, ctx, pi); PaintHeaderFooter(w, page, pi, from_page, ctx.py.page); @@ -48,22 +47,22 @@ void RichText::Paint(PageDraw& w, const Rect& page, const PaintInfo& pi) const RichCaret RichText::GetCaret(int pos, const Rect& page) const { - return RichTxt::GetCaret(pos, Context(page)); + return RichTxt::GetCaret(pos, Context(page, PageY(0, 0))); } int RichText::GetPos(int x, PageY y, const Rect& page) const { - return RichTxt::GetPos(x, y, Context(page)); + return RichTxt::GetPos(x, y, Context(page, y)); } int RichText::GetVertMove(int pos, int gx, const Rect& page, int dir) const { - return RichTxt::GetVertMove(pos, gx, Context(page), dir); + return RichTxt::GetVertMove(pos, gx, Context(page, PageY(0, 0)), dir); } RichHotPos RichText::GetHotPos(int x, PageY y, int tolerance, const Rect& page) const { - RichHotPos p = RichTxt::GetHotPos(x, y, tolerance, Context(page)); + RichHotPos p = RichTxt::GetHotPos(x, y, tolerance, Context(page, y)); if(p.column < -2) p.table = 0; return p; @@ -72,7 +71,7 @@ RichHotPos RichText::GetHotPos(int x, PageY y, int tolerance, const Rect& page) Vector RichText::GetValPos(const Rect& page, int type) const { Vector f; - GatherValPos(f, Context(page), 0, type); + GatherValPos(f, Context(page, PageY(0, 0)), 0, type); return f; } @@ -116,7 +115,7 @@ bool RichText::GetInvalid(PageY& top, PageY& bottom, const Rect& page, bottom = GetHeight(page); return true; } - RichContext rc = Context(page); + RichContext rc = Context(page, PageY(0, 0)); if(rtype == SPARA) { rc.py = top = GetPartPageY(spi, rc); bottom = GetNextPageY(spi, rc); diff --git a/uppsrc/RichText/TxtPaint.cpp b/uppsrc/RichText/TxtPaint.cpp index 197464371..be306e7a2 100644 --- a/uppsrc/RichText/TxtPaint.cpp +++ b/uppsrc/RichText/TxtPaint.cpp @@ -129,6 +129,12 @@ bool IsPainting(PageDraw& pw, Zoom z, const Rect& page, PageY top, PageY bottom) return false; } +PageY RichTxt::GetHeight(RichContext rc) const +{ + for(int i = 0; i < GetPartCount(); i++) + rc.py = GetNextPageY(i, rc); + return rc.py; +} void RichTxt::Paint(PageDraw& pw, RichContext& rc, const PaintInfo& _pi) const { @@ -351,13 +357,6 @@ void RichTxt::GatherValPos(Vector& f, RichContext rc, int pos, int t } } -PageY RichTxt::GetHeight(RichContext rc) const -{ - for(int i = 0; i < GetPartCount(); i++) - rc.py = GetNextPageY(i, rc); - return rc.py; -} - PageY RichTxt::GetTop(RichContext rc) const { if(part.GetCount() == 0)