mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
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 !
This commit is contained in:
parent
cb26ecbb58
commit
a71b96ac42
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user