Change tracking cue: for instant preview

Strike through deleted previews (expect for inline math where it is already taken care of by RowPainter).
This commit is contained in:
Guillaume Munch 2016-05-23 15:44:29 +01:00
parent de786bfcdf
commit 8e1a869c45
3 changed files with 15 additions and 8 deletions

View File

@ -29,7 +29,7 @@ namespace graphics {
/// An inset with an instant preview /// An inset with an instant preview
class InsetPreview : public InsetText { class InsetPreview : public InsetText {
public: public:
/// ///
InsetPreview(Buffer *); InsetPreview(Buffer *);
@ -45,11 +45,11 @@ public:
Inset * clone() const { return new InsetPreview(*this); } Inset * clone() const { return new InsetPreview(*this); }
bool neverIndent() const { return true; } bool neverIndent() const { return true; }
InsetCode lyxCode() const { return PREVIEW_CODE; } InsetCode lyxCode() const { return PREVIEW_CODE; }
docstring layoutName() const { return from_ascii("Preview"); } docstring layoutName() const { return from_ascii("Preview"); }
bool descendable(BufferView const & /*bv*/) const { return true; } bool descendable(BufferView const & /*bv*/) const { return true; }
std::string contextMenuName() const std::string contextMenuName() const
@ -69,8 +69,10 @@ public:
void write(std::ostream & os) const; void write(std::ostream & os) const;
void edit(Cursor & cur, bool front, EntryDirection entry_from); void edit(Cursor & cur, bool front, EntryDirection entry_from);
bool canPaintChange(BufferView const &) const { return true; };
//@} //@}
protected: protected:
/// Retrieves the preview state. Returns true if preview /// Retrieves the preview state. Returns true if preview
/// is enabled and the preview image is availabled. /// is enabled and the preview image is availabled.

View File

@ -193,6 +193,8 @@ void RenderPreview::draw(PainterInfo & pi, int x, int y) const
y - theFontMetrics(font).maxAscent() - 4, y - theFontMetrics(font).maxAscent() - 4,
stat, font); stat, font);
} }
pi.change_.paintCue(pi, x, y - dim_.asc,
x + dim_.width(), y - dim_.asc + dim_.height());
} }

View File

@ -59,11 +59,12 @@
#include "frontends/Painter.h" #include "frontends/Painter.h"
#include "support/convert.h" #include "support/convert.h"
#include "support/lassert.h"
#include "support/debug.h" #include "support/debug.h"
#include "support/filetools.h"
#include "support/gettext.h" #include "support/gettext.h"
#include "support/filetools.h"
#include "support/lassert.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/RefChanger.h"
#include <sstream> #include <sstream>
@ -567,7 +568,9 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
} }
if (previewState(bv)) { 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)) { if (previewTooSmall(dim)) {
// we have an extra frame // we have an extra frame
preview_->draw(pi, x + ERROR_FRAME_WIDTH, y); preview_->draw(pi, x + ERROR_FRAME_WIDTH, y);