]> git.lyx.org Git - features.git/commitdiff
Change tracking cue: for Graphics
authorGuillaume Munch <gm@lyx.org>
Mon, 23 May 2016 16:01:48 +0000 (17:01 +0100)
committerGuillaume Munch <gm@lyx.org>
Sun, 3 Jul 2016 15:28:47 +0000 (17:28 +0200)
Strike through deleted graphics.

src/insets/InsetGraphics.h
src/insets/RenderGraphic.cpp

index 5270f2bfa9f9497109e510de965719fafaa9cda7..a2fef00a39d68e809a4d49ef117d14404a386710 100644 (file)
@@ -54,6 +54,8 @@ public:
        InsetGraphicsParams getParams() const { return params_;}
        ///
        bool clickable(BufferView const &, int, int) const { return true; }
+       ///
+       bool canPaintChange(BufferView const &) const { return true; };
 
 private:
        ///
index 48b41e285478875bcc4a5eb11b229dace4e5e10e..9d9cf31789aeb955d88edc6ac24dc790ee1166ba 100644 (file)
@@ -182,41 +182,38 @@ void RenderGraphic::draw(PainterInfo & pi, int x, int y) const
 {
        // This will draw the graphics. If the graphics has not been
        // loaded yet, we draw just a rectangle.
+       int const x1 = x + Inset::TEXT_TO_INSET_OFFSET;
+       int const y1 = y - dim_.asc;
+       int const w = dim_.wid - 2 * Inset::TEXT_TO_INSET_OFFSET;
+       int const h = dim_.height();
 
-       if (displayGraphic(params_) && readyToDisplay(loader_)) {
-               pi.pain.image(x + Inset::TEXT_TO_INSET_OFFSET,
-                             y - dim_.asc,
-                             dim_.wid - 2 * Inset::TEXT_TO_INSET_OFFSET,
-                             dim_.asc + dim_.des,
-                             *loader_.image());
+       if (displayGraphic(params_) && readyToDisplay(loader_))
+               pi.pain.image(x1, y1, w, h, *loader_.image());
 
-       } else {
-               pi.pain.rectangle(x + Inset::TEXT_TO_INSET_OFFSET,
-                                 y - dim_.asc,
-                                 dim_.wid - 2 * Inset::TEXT_TO_INSET_OFFSET,
-                                 dim_.asc + dim_.des,
-                                 Color_foreground);
+       else {
+               Color c = pi.change_.changed() ? pi.change_.color() : Color_foreground;
+               pi.pain.rectangle(x1, y1, w, h, c);
 
                // Print the file name.
                FontInfo msgFont = pi.base.font;
+               msgFont.setPaintColor(c);
                msgFont.setFamily(SANS_FAMILY);
                string const justname = params_.filename.onlyFileName();
 
                if (!justname.empty()) {
                        msgFont.setSize(FONT_SIZE_FOOTNOTE);
-                       pi.pain.text(x + Inset::TEXT_TO_INSET_OFFSET + 6,
-                                  y - theFontMetrics(msgFont).maxAscent() - 4,
-                                  from_utf8(justname), msgFont);
+                       pi.pain.text(x1 + 6, y - theFontMetrics(msgFont).maxAscent() - 4,
+                                    from_utf8(justname), msgFont);
                }
 
                // Print the message.
                docstring const msg = statusMessage(params_, loader_.status());
                if (!msg.empty()) {
                        msgFont.setSize(FONT_SIZE_TINY);
-                       pi.pain.text(x + Inset::TEXT_TO_INSET_OFFSET + 6,
-                                    y - 4, msg, msgFont);
+                       pi.pain.text(x1 + 6, y - 4, msg, msgFont);
                }
        }
+       pi.change_.paintCue(pi, x1, y1, x1 + w, y1 + h);
 }