commit de786bfcdf739822fe4c21847735c54140cf84f4
Author: Guillaume Munch <[email protected]>
Date:   Mon May 23 15:06:26 2016 +0100

    Change tracking cue: for display() math insets
    
    Strike through deleted display math insets.
---
 src/Changes.cpp              |   19 ++++++++++---------
 src/mathed/InsetMathHull.cpp |   16 ++++++++++++++--
 src/mathed/InsetMathHull.h   |    2 ++
 3 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/src/Changes.cpp b/src/Changes.cpp
index e9191e3..1626f50 100644
--- a/src/Changes.cpp
+++ b/src/Changes.cpp
@@ -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());
 }
 
 
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index beb3b2a..2916bb2 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -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
diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h
index 6f2f850..f3ea8a8 100644
--- a/src/mathed/InsetMathHull.h
+++ b/src/mathed/InsetMathHull.h
@@ -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 &);

Reply via email to