]> git.lyx.org Git - features.git/commitdiff
Change tracking cue: for instant preview
authorGuillaume Munch <gm@lyx.org>
Mon, 23 May 2016 14:44:29 +0000 (15:44 +0100)
committerGuillaume Munch <gm@lyx.org>
Sun, 3 Jul 2016 15:28:47 +0000 (17:28 +0200)
Strike through deleted previews (expect for inline math where it is already taken care of by RowPainter).

src/insets/InsetPreview.h
src/insets/RenderPreview.cpp
src/mathed/InsetMathHull.cpp

index d6d693da756fad16be93aaa4adb5ee06f351b2ad..f2bfdd535f6bb28f14bb54cbf877373a8ef07203 100644 (file)
@@ -29,7 +29,7 @@ namespace graphics {
 
 /// An inset with an instant preview
 class InsetPreview : public InsetText {
-       
+
 public:
        ///
        InsetPreview(Buffer *);
@@ -45,11 +45,11 @@ public:
        Inset * clone() const { return new InsetPreview(*this); }
 
        bool neverIndent() const { return true; }
-       
+
        InsetCode lyxCode() const { return PREVIEW_CODE; }
-       
+
        docstring layoutName() const { return from_ascii("Preview"); }
-       
+
        bool descendable(BufferView const & /*bv*/) const { return true; }
 
        std::string contextMenuName() const
@@ -69,8 +69,10 @@ public:
        void write(std::ostream & os) const;
 
        void edit(Cursor & cur, bool front, EntryDirection entry_from);
+
+       bool canPaintChange(BufferView const &) const { return true; };
        //@}
-       
+
 protected:
        /// Retrieves the preview state. Returns true if preview
        /// is enabled and the preview image is availabled.
index 59a870c412728d4a2e847cb0b4c2029818de5cb0..e985d290a27391427a44df676147d0f8b4c56b95 100644 (file)
@@ -193,6 +193,8 @@ void RenderPreview::draw(PainterInfo & pi, int x, int y) const
                             y - theFontMetrics(font).maxAscent() - 4,
                             stat, font);
        }
+       pi.change_.paintCue(pi, x, y - dim_.asc,
+                           x + dim_.width(), y - dim_.asc + dim_.height());
 }
 
 
index 2916bb2ea0fc1a1ddd97c5991792350bf4f8f282..88a4c1d3288214aec7045d4f338ae994718bed92 100644 (file)
 #include "frontends/Painter.h"
 
 #include "support/convert.h"
-#include "support/lassert.h"
 #include "support/debug.h"
-#include "support/filetools.h"
 #include "support/gettext.h"
+#include "support/filetools.h"
+#include "support/lassert.h"
 #include "support/lstrings.h"
+#include "support/RefChanger.h"
 
 #include <sstream>
 
@@ -567,7 +568,9 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
        }
 
        if (previewState(bv)) {
-               // FIXME CT this
+               // Do not draw change tracking cue if taken care of by RowPainter
+               // already.
+               Changer dummy = make_change(pi.change_, Change(), !canPaintChange(*bv));
                if (previewTooSmall(dim)) {
                        // we have an extra frame
                        preview_->draw(pi, x + ERROR_FRAME_WIDTH, y);