From 603286af25ee19dee5ddce192fc34ba2303d6344 Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 6 Aug 2017 08:56:22 +0000 Subject: [PATCH] RichText: QTFDisplay now ignores text color / paper if style is not normal git-svn-id: svn://ultimatepp.org/upp/trunk@11294 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/RichText/ParaData.cpp | 1 + uppsrc/RichText/ParaPaint.cpp | 9 ++++----- uppsrc/RichText/RichText.h | 1 + uppsrc/RichText/Util.cpp | 7 ++++++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/uppsrc/RichText/ParaData.cpp b/uppsrc/RichText/ParaData.cpp index 1dbaec1b5..cc2509c72 100644 --- a/uppsrc/RichText/ParaData.cpp +++ b/uppsrc/RichText/ParaData.cpp @@ -60,6 +60,7 @@ PaintInfo::PaintInfo() context = NULL; showlabels = false; shrink_oversized_objects = false; + textcolor = Null; } String RichPara::Number::AsText(const RichPara::NumberFormat& format) const diff --git a/uppsrc/RichText/ParaPaint.cpp b/uppsrc/RichText/ParaPaint.cpp index f854fe2f3..76485cf96 100644 --- a/uppsrc/RichText/ParaPaint.cpp +++ b/uppsrc/RichText/ParaPaint.cpp @@ -32,7 +32,7 @@ void RichPara::Flush(Draw& draw, const PaintInfo& pi, wchar *text, else draw.DrawRect(zx0, zy0, width, 2, pi.indexentry); } - if(!IsNull(f.paper) && !highlight) + if(!IsNull(f.paper) && !highlight && IsNull(pi.textcolor)) draw.DrawRect(zx0, z * y, width, z * (y + linecy) - z * y, pi.coloroverride ? SColorPaper() : f.paper); Font fnt = f; @@ -47,17 +47,16 @@ void RichPara::Flush(Draw& draw, const PaintInfo& pi, wchar *text, } fnt.Height(zht ? zht : 1); FontInfo fi = fnt.Info(); + Color ink = Nvl(pi.textcolor, pi.coloroverride ? SColorText() : f.ink); if(f.dashed) { int dx = max(fi.GetAscent() / 5, 2); for(int i = 0; dx * i < width; i++) draw.DrawRect(zx0 + i * dx, zy0 + fi.GetDescent() / 2, - dx / 2, max(fi.GetDescent() / 3, 1), - pi.coloroverride ? SColorText() : f.ink); + dx / 2, max(fi.GetDescent() / 3, 1), ink); } - Color ink = pi.coloroverride ? SColorText() : f.ink; if(!IsNull(f.link) && !IsNull(pi.hyperlink) && !(fnt.IsUnderline() || f.dashed)) { fnt.Underline(); - if(!pi.coloroverride) + if(!pi.coloroverride && IsNull(pi.textcolor)) ink = pi.hyperlink; } x = zx0; diff --git a/uppsrc/RichText/RichText.h b/uppsrc/RichText/RichText.h index 1221f5c84..3307e40ae 100644 --- a/uppsrc/RichText/RichText.h +++ b/uppsrc/RichText/RichText.h @@ -274,6 +274,7 @@ struct PaintInfo { PageY bottom; Color hyperlink; Color indexentry; + Color textcolor; // not Null overrides text color, makes paper transparent, useful for QTFDisplay bool indexentrybg; bool usecache; bool sizetracking; diff --git a/uppsrc/RichText/Util.cpp b/uppsrc/RichText/Util.cpp index ecac1e2c3..c6301957c 100644 --- a/uppsrc/RichText/Util.cpp +++ b/uppsrc/RichText/Util.cpp @@ -73,7 +73,12 @@ void QTFDisplayCls::Paint(Draw& draw, const Rect& r, const Value& v, Color ink, rtext.ApplyZoom(GetRichTextStdScreenZoom()); draw.DrawRect(r, paper); draw.Clipoff(r); - rtext.Paint(Zoom(1, 1), draw, 0, 0, r.Width()); + PaintInfo pi; + pi.highlightpara = false; + pi.zoom = Zoom(1, 1); + if(style & (CURSOR|SELECT|READONLY)) + pi.textcolor = ink; + rtext.Paint(draw, 0, 0, r.Width(), pi); draw.End(); }