Change tracking cue: for display() math insets

Strike through deleted display math insets.
This commit is contained in:
Guillaume Munch 2016-05-23 15:06:26 +01:00
parent 28f6c312a9
commit de786bfcdf
3 changed files with 26 additions and 11 deletions

View File

@ -575,21 +575,22 @@ void Change::paintCue(PainterInfo & pi, double const x1, double const y1,
* y2 /_____
* x1 x2
*/
double y = 0;
switch(type) {
case UNCHANGED:
return;
case INSERTED:
y = y2;
break;
pi.pain.line(int(x1), int(y2) + 1, int(x2), int(y2) + 1,
color(), Painter::line_solid,
pi.base.solidLineThickness());
return;
case DELETED:
y = y1;
break;
// FIXME: we cannot use antialias since we keep drawing on the same
// background with the current painting mechanism.
pi.pain.line(int(x1), int(y2), int(x2), int(y1),
color(), Painter::line_solid_aliased,
pi.base.solidLineThickness());
return;
}
// we cannot use antialias since we keep drawing on the same background
pi.pain.line(int(x1), int(y2), int(x2), int(y),
color(), Painter::line_solid_aliased,
pi.base.solidLineThickness());
}

View File

@ -559,15 +559,15 @@ void InsetMathHull::drawBackground(PainterInfo & pi, int x, int y) const
void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
{
BufferView const * const bv = pi.base.bv;
Dimension const dim = dimension(*bv);
if (type_ == hullRegexp) {
Dimension const dim = dimension(*bv);
pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
dim.width() - 2, dim.height() - 2, Color_regexpframe);
}
if (previewState(bv)) {
Dimension const dim = dimension(*bv);
// FIXME CT this
if (previewTooSmall(dim)) {
// we have an extra frame
preview_->draw(pi, x + ERROR_FRAME_WIDTH, y);
@ -597,6 +597,10 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
pi.draw(xx, yy, nl);
}
}
// drawing change line
if (canPaintChange(*bv))
pi.change_.paintCue(pi, x + 1, y + 1 - dim.asc,
x + dim.wid, y + dim.des);
setPosCache(pi, x, y);
}
@ -2582,4 +2586,12 @@ void InsetMathHull::recordLocation(DocIterator const & di)
docit_ = di;
}
bool InsetMathHull::canPaintChange(BufferView const &) const
{
// We let RowPainter do it seamlessly for inline insets
return display() != Inline;
}
} // namespace lyx

View File

@ -185,6 +185,8 @@ public:
std::string contextMenuName() const;
///
InsetCode lyxCode() const { return MATH_HULL_CODE; }
///
bool canPaintChange(BufferView const &) const;
protected:
InsetMathHull(InsetMathHull const &);