mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Correctly paint the background of the instant preview of a displayed equation.
For a displayed equation, the height is artificially increased by a displayMargin() in InsetMathHull::metrics if it is a displayed equation and there is a preview. This extra height is not covered by the preview image and what one can see is the background as drawn by the MathHull inset. The color of this background should be either Color_mathbg or Color_background depending on whether the preview is shown or not. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32560 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
378d32bc06
commit
6b96abd211
@ -86,7 +86,7 @@ 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();
|
||||
ColorCode const color_bg = inset->backgroundColor(*this);
|
||||
|
||||
if (selected && sel)
|
||||
// This inset is in a selection
|
||||
|
@ -540,7 +540,7 @@ void Inset::dump() const
|
||||
}
|
||||
|
||||
|
||||
ColorCode Inset::backgroundColor() const
|
||||
ColorCode Inset::backgroundColor(PainterInfo const & /*pi*/) const
|
||||
{
|
||||
return Color_none;
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ public:
|
||||
///
|
||||
int scroll() const { return 0; }
|
||||
///
|
||||
virtual ColorCode backgroundColor() const;
|
||||
virtual ColorCode backgroundColor(PainterInfo const &) const;
|
||||
///
|
||||
virtual ColorCode labelColor() const;
|
||||
//
|
||||
|
@ -104,10 +104,10 @@ docstring const InsetBranch::buttonLabel(BufferView const & bv) const
|
||||
}
|
||||
|
||||
|
||||
ColorCode InsetBranch::backgroundColor() const
|
||||
ColorCode InsetBranch::backgroundColor(PainterInfo const & pi) const
|
||||
{
|
||||
if (params_.branch.empty())
|
||||
return Inset::backgroundColor();
|
||||
return Inset::backgroundColor(pi);
|
||||
// FIXME UNICODE
|
||||
ColorCode c = lcolor.getFromLyXName(to_utf8(params_.branch));
|
||||
if (c == Color_none)
|
||||
|
@ -66,7 +66,7 @@ private:
|
||||
///
|
||||
docstring const buttonLabel(BufferView const & bv) const;
|
||||
///
|
||||
ColorCode backgroundColor() const;
|
||||
ColorCode backgroundColor(PainterInfo const &) const;
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
|
@ -127,7 +127,8 @@ public:
|
||||
///
|
||||
bool setMouseHover(bool mouse_hover);
|
||||
///
|
||||
ColorCode backgroundColor() const { return getLayout().bgcolor(); }
|
||||
ColorCode backgroundColor(PainterInfo const &) const
|
||||
{ return getLayout().bgcolor(); }
|
||||
///
|
||||
ColorCode labelColor() const { return getLayout().labelfont().color(); }
|
||||
///
|
||||
|
@ -370,6 +370,14 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
}
|
||||
|
||||
|
||||
ColorCode InsetMathHull::backgroundColor(PainterInfo const & pi) const
|
||||
{
|
||||
if (previewState(pi.base.bv))
|
||||
return Color_background;
|
||||
return Color_mathbg;
|
||||
}
|
||||
|
||||
|
||||
void InsetMathHull::drawBackground(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
Dimension const dim = dimension(*pi.base.bv);
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
///
|
||||
void label(row_type row, docstring const & label);
|
||||
///
|
||||
ColorCode backgroundColor() const { return Color_mathbg; }
|
||||
ColorCode backgroundColor(PainterInfo const &) const;
|
||||
///
|
||||
void numbered(row_type row, bool num);
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user