From: Guillaume Munch Date: Mon, 23 May 2016 14:44:29 +0000 (+0100) Subject: Change tracking cue: for instant preview X-Git-Tag: 2.3.0alpha1~1348 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=8e1a869c45b0c1cb1ee1f3e85d51325224ec3eb4;p=features.git Change tracking cue: for instant preview Strike through deleted previews (expect for inline math where it is already taken care of by RowPainter). --- diff --git a/src/insets/InsetPreview.h b/src/insets/InsetPreview.h index d6d693da75..f2bfdd535f 100644 --- a/src/insets/InsetPreview.h +++ b/src/insets/InsetPreview.h @@ -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. diff --git a/src/insets/RenderPreview.cpp b/src/insets/RenderPreview.cpp index 59a870c412..e985d290a2 100644 --- a/src/insets/RenderPreview.cpp +++ b/src/insets/RenderPreview.cpp @@ -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()); } diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 2916bb2ea0..88a4c1d328 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -59,11 +59,12 @@ #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 @@ -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);