if (selected && sel)
// This inset is in a selection
return Color_selection;
- else {
- if (color_bg != Color_none)
- // This inset has its own color
- return color_bg;
- else {
- if (background_color == Color_none)
- // This inset has no own color and does not inherit a color
- return Color_background;
- else
- // This inset has no own color, but inherits a color
- return background_color;
- }
- }
+
+ if (pain.develMode() && !inset->isBufferValid())
+ // This inset is in error
+ return Color_error;
+
+ if (color_bg != Color_none)
+ // This inset has its own color
+ return color_bg;
+
+ if (background_color == Color_none)
+ // This inset has no own color and does not inherit a color
+ return Color_background;
+
+ // This inset has no own color, but inherits a color
+ return background_color;
}
*/
class NullPainter : public Painter {
public:
- NullPainter() : Painter(1) {}
+ NullPainter() : Painter(1, false) {}
~NullPainter() {}
*/
class Painter {
public:
- Painter(double pixel_ratio) : pixel_ratio_(pixel_ratio) {}
+ Painter(double pixel_ratio, bool devel_mode)
+ : pixel_ratio_(pixel_ratio), devel_mode_(devel_mode) {}
static const int thin_line;
double pixelRatio() const { return pixel_ratio_; }
+ double develMode() const { return devel_mode_; }
+
/// draw the underbar, strikeout, xout, uuline and uwave font attributes
virtual void textDecoration(FontInfo const & f, int x, int y, int width) = 0;
private:
/// Ratio between physical pixels and device-independent pixels
double pixel_ratio_;
+ /// True when developer more is on at application-level.
+ bool devel_mode_;
};
} // namespace frontend
const int Painter::thin_line = 1;
-GuiPainter::GuiPainter(QPaintDevice * device, double pixel_ratio)
- : QPainter(device), Painter(pixel_ratio)
+GuiPainter::GuiPainter(QPaintDevice * device, double pixel_ratio, bool devel_mode)
+ : QPainter(device), Painter(pixel_ratio, devel_mode)
{
// set cache correctly
current_color_ = pen().color();
*/
class GuiPainter : public QPainter, public Painter {
public:
- GuiPainter(QPaintDevice *, double pixel_ratio);
+ GuiPainter(QPaintDevice *, double pixel_ratio, bool devel_mode);
virtual ~GuiPainter();
/// This painter paints
d->last_pixel_ratio_ = pixelRatio();
- GuiPainter pain(d->screenDevice(), pixelRatio());
+ GuiPainter pain(d->screenDevice(), pixelRatio(), d->lyx_view_->develMode());
d->buffer_view_->draw(pain, d->caret_visible_);
Dimension d2 = d;
d2.wid -= e.before + e.after;
coords.insets().add(e.inset, d2);
+ if (pi.pain.develMode() && !e.inset->isBufferValid())
+ pi.pain.fillRectangle(x + e.before, y - d2.ascent(),
+ d2.width(), d2.height(), Color_error);
e.inset->draw(pi, x + e.before, y);
coords.insets().add(e.inset, x, y);
coords.insets().add(e.inset, d);