Now by default all insets paint their own background when needed. This
means that
63cf3297 and part of
9940acc5 can be reverted.
To avoid extra painting, background drawing is disabled for
InsetCommand and InsetCollapsable. These insets draw background as
part of their normal drawing activity.
This will avoid drawing artifacts with InsetNewpage, InsetVSpace and
probably some others.
}
+void Inset::drawBackground(PainterInfo & pi, int x, int y) const
+{
+ if (pi.full_repaint && backgroundColor(pi) == Color_none)
+ return;
+ Dimension const dim = dimension(*pi.base.bv);
+ pi.pain.fillRectangle(x, y - dim.asc, dim.wid, dim.asc + dim.des,
+ pi.backgroundColor(this));
+}
+
+
void Inset::drawMarkers(PainterInfo & pi, int x, int y) const
{
ColorCode pen_color = mouseHovered(pi.base.bv) || editing(pi.base.bv)?
virtual void drawSelection(PainterInfo &, int, int) const {}
/// draw inset background if the inset has an own background and a
/// selection is drawn by drawSelection.
- virtual void drawBackground(PainterInfo &, int, int) const {}
+ virtual void drawBackground(PainterInfo &, int, int) const;
///
virtual bool editing(BufferView const * bv) const;
///
void metrics(MetricsInfo &, Dimension &) const;
///
void draw(PainterInfo & pi, int x, int y) const;
+ ///
+ virtual void drawBackground(PainterInfo &, int, int) const {}
/// return x,y of given position relative to the inset's baseline
void cursorPos(BufferView const & bv, CursorSlice const & sl,
///
void draw(PainterInfo & pi, int x, int y) const;
///
+ virtual void drawBackground(PainterInfo &, int, int) const {}
+ ///
void latex(otexstream &, OutputParams const &) const;
///
int plaintext(odocstringstream & ods, OutputParams const & op,
}
-void InsetQuotes::drawBackground(PainterInfo & pi, int x, int y) const
-{
- if (pi.full_repaint)
- return;
- Dimension const dim = dimension(*pi.base.bv);
- pi.pain.fillRectangle(x, y - dim.asc, dim.wid, dim.asc + dim.des,
- pi.backgroundColor(this));
-}
-
-
void InsetQuotes::draw(PainterInfo & pi, int x, int y) const
{
FontInfo font = pi.base.font;
///
void metrics(MetricsInfo &, Dimension &) const;
///
- void drawBackground(PainterInfo & pi, int x, int y) const;
- ///
void draw(PainterInfo & pi, int x, int y) const;
///
void write(std::ostream &) const;
}
-void InsetSpecialChar::drawBackground(PainterInfo & pi, int x, int y) const
-{
- if (pi.full_repaint)
- return;
- Dimension const dim = dimension(*pi.base.bv);
- pi.pain.fillRectangle(x, y - dim.asc, dim.wid, dim.asc + dim.des,
- pi.backgroundColor(this));
-}
-
-
namespace {
// helper function: draw text and update x.
///
void metrics(MetricsInfo &, Dimension &) const;
///
- void drawBackground(PainterInfo & pi, int x, int y) const;
- ///
void draw(PainterInfo & pi, int x, int y) const;
///
void write(std::ostream &) const;
}
-void MathMacroTemplate::drawBackground(PainterInfo & pi, int x, int y) const
-{
- if (pi.full_repaint)
- return;
- Dimension const dim = dimension(*pi.base.bv);
- pi.pain.fillRectangle(x, y - dim.asc, dim.wid, dim.asc + dim.des,
- pi.backgroundColor(this));
-}
-
-
-
void MathMacroTemplate::draw(PainterInfo & pi, int x, int y) const
{
// FIXME: Calling Changer on the same object repeatedly is inefficient.
///
void draw(PainterInfo & pi, int x, int y) const;
///
- void drawBackground(PainterInfo & pi, int x, int y) const;
- ///
void metrics(MetricsInfo & mi, Dimension & dim) const;
/// identifies macro templates
MathMacroTemplate * asMacroTemplate() { return this; }