commit 48144c474b9ac006e93413482dbcab06e4dd4caf
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Wed Jun 7 16:01:11 2017 +0200
Revert "Fix drawing of collpsable insets"
This patch cuses unintended issues (see #10587).
This reverts commit 18fb9cd7f9886295dbae66eb6ac060f9ac367f2d.
---
src/insets/InsetCollapsable.cpp | 3 ++-
src/insets/InsetCollapsable.h | 2 ++
src/insets/InsetText.cpp | 4 ++++
src/insets/InsetText.h | 2 ++
4 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp
index 213e058..92802b9 100644
--- a/src/insets/InsetCollapsable.cpp
+++ b/src/insets/InsetCollapsable.cpp
@@ -335,10 +335,11 @@ void InsetCollapsable::draw(PainterInfo & pi, int x, int
y) const
int w = 0;
int a = 0;
int d = 0;
+ Color const col = pi.full_repaint ? Color_none :
pi.backgroundColor(this);
theFontMetrics(font).rectText(buttonLabel(bv), w, a, d);
int const ww = max(textdim.wid, w);
pi.pain.rectText(x + (ww - w) / 2, y + desc + a,
- buttonLabel(bv), font, Color_none,
Color_none);
+ buttonLabel(bv), font, col,
Color_none);
}
int const y1 = y - textdim.asc + 3;
diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h
index 4c08bdc..a426db0 100644
--- a/src/insets/InsetCollapsable.h
+++ b/src/insets/InsetCollapsable.h
@@ -54,6 +54,8 @@ public:
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,
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index 2e60692..7680ee5 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -221,6 +221,10 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
int const xframe = x + TEXT_TO_INSET_OFFSET / 2;
bool change_drawn = false;
if (drawFrame_ || pi.full_repaint) {
+ if (pi.full_repaint)
+ pi.pain.fillRectangle(xframe, yframe, w, h,
+ pi.backgroundColor(this));
+
// Change color of the frame in tracked changes, like for
tabulars.
// Only do so if the color is not custom. But do so even if
RowPainter
// handles the strike-through already.
diff --git a/src/insets/InsetText.h b/src/insets/InsetText.h
index bfaee44..eb52bc8 100644
--- a/src/insets/InsetText.h
+++ b/src/insets/InsetText.h
@@ -60,6 +60,8 @@ public:
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
+ /// Drawing background is handled in draw
+ virtual void drawBackground(PainterInfo &, int, int) const {}
///
bool editable() const { return true; }
///