commit a71b96ac426438abb4fe835d0ad000c769693421 Author: Jean-Marc Lasgouttes <lasgout...@lyx.org> Date: Fri Jun 5 22:32:58 2020 +0200
Fixup 74540c98: handle selection for label background 74540c98 was a fixup of d207e85c, which avoided using inset background as inset label background. d207e85c introduced a background under inset labels to avoid fake bold effect. Hopefully, this last variation will be the right one ! --- src/MetricsInfo.cpp | 18 ++++++++++-------- src/MetricsInfo.h | 6 +++--- src/insets/InsetCollapsible.cpp | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index 537efd3..e7de5d0 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -153,19 +153,21 @@ void PainterInfo::draw(int x, int y, docstring const & str) ColorCode PainterInfo::backgroundColor(Inset const * inset, bool sel) const { - ColorCode const color_bg = inset->backgroundColor(*this); - if (selected && sel) // This inset is in a selection return Color_selection; - if (pain.develMode() && !inset->isBufferValid()) - // This inset is in error - return Color_error; + // special handling for inset background + if (inset != nullptr) { + 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; + ColorCode const color_bg = inset->backgroundColor(*this); + 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 diff --git a/src/MetricsInfo.h b/src/MetricsInfo.h index 3ad59cd..14c3990 100644 --- a/src/MetricsInfo.h +++ b/src/MetricsInfo.h @@ -116,11 +116,11 @@ public: void draw(int x, int y, char_type c); /// void draw(int x, int y, docstring const & str); - /// Determines the background color for the specified inset based on the + /// Determines the background color based on the /// selection state, the background color inherited from the parent inset - /// and the inset's own background color. + /// and the inset's own background color (if one is specified). /// \param sel whether to take the selection state into account - ColorCode backgroundColor(Inset const * inset, bool sel = true) const; + ColorCode backgroundColor(Inset const * inset = nullptr, bool sel = true) const; /// Determines the text color based on the intended color, the /// change tracking state and the selection state. diff --git a/src/insets/InsetCollapsible.cpp b/src/insets/InsetCollapsible.cpp index d4c3fd3..20e595f 100644 --- a/src/insets/InsetCollapsible.cpp +++ b/src/insets/InsetCollapsible.cpp @@ -371,7 +371,7 @@ void InsetCollapsible::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.background_color; + Color const col = pi.full_repaint ? Color_none : pi.backgroundColor(); 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, -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs