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
This commit is contained in:
cxl 2017-08-06 08:56:22 +00:00
parent 2c052a3d32
commit 603286af25
4 changed files with 12 additions and 6 deletions

View file

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

View file

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

View file

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

View file

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