commit 8e1a869c45b0c1cb1ee1f3e85d51325224ec3eb4
Author: Guillaume Munch <[email protected]>
Date: Mon May 23 15:44:29 2016 +0100
Change tracking cue: for instant preview
Strike through deleted previews (expect for inline math where it is already
taken care of by RowPainter).
---
src/insets/InsetPreview.h | 12 +++++++-----
src/insets/RenderPreview.cpp | 2 ++
src/mathed/InsetMathHull.cpp | 9 ++++++---
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/insets/InsetPreview.h b/src/insets/InsetPreview.h
index d6d693d..f2bfdd5 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 59a870c..e985d29 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 2916bb2..88a4c1d 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 <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);