The above mentionned patch did paint the background of the sublabel to
avoid "bold-like" effect. However the correct backgound color is the
row's one, not the inset's one.
To fix this, extend MetricsInfo::backgroundColor to work when no inset
is specified. The code is also simplified as in master.
(cherry picked from commit
74540c9896892b8f956f52258a59613af83a5cf8)
(cherry picked from commit
a71b96ac426438abb4fe835d0ad000c769693421)
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;
- else {
+
+ // special handling for inset background
+ if (inset != nullptr) {
+ ColorCode const color_bg = inset->backgroundColor(*this);
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 (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;
}
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.
int w = 0;
int a = 0;
int d = 0;
- Color const col = pi.full_repaint ? Color_none : pi.backgroundColor(this);
+ 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,
- Ask to save hidden dirty documents (bug 11405).
+- Fix background color of collapsible insets with sublabel.
+
* INTERNALS