X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetbutton.C;h=b171dc91012285ed9dea6f930bd58abfe237ddad;hb=4a5b7a5952ad2381fcdf4830511293e184c7c5a1;hp=8b0d3d6d5f26fc095397fc9be16c0e5843e893d3;hpb=85a5ea7bfc80e179a61a99f2955455e84d3384cc;p=lyx.git diff --git a/src/insets/insetbutton.C b/src/insets/insetbutton.C index 8b0d3d6d5f..b171dc9101 100644 --- a/src/insets/insetbutton.C +++ b/src/insets/insetbutton.C @@ -20,6 +20,7 @@ #include "Painter.h" #include "support/LAssert.h" #include "lyxfont.h" +#include "font.h" using std::ostream; using std::endl; @@ -35,16 +36,14 @@ int InsetButton::ascent(BufferView * bv, LyXFont const &) const int width; int ascent; int descent; - string const s = getScreenLabel(); - + string const s = getScreenLabel(bv->buffer()); + if (editable()) { - bv->painter().buttonText(0, 0, s, font, - false, width, ascent, descent); + lyxfont::buttonText(s, font, width, ascent, descent); } else { - bv->painter().rectText(0, 0, s, font, - LColor::commandbg, LColor::commandframe, - false, width, ascent, descent); + lyxfont::rectText(s, font, width, ascent, descent); } + return ascent; } @@ -59,16 +58,14 @@ int InsetButton::descent(BufferView * bv, LyXFont const &) const int width; int ascent; int descent; - string const s = getScreenLabel(); - + string const s = getScreenLabel(bv->buffer()); + if (editable()) { - bv->painter().buttonText(0, 0, s, font, - false, width, ascent, descent); + lyxfont::buttonText(s, font, width, ascent, descent); } else { - bv->painter().rectText(0, 0, s, font, - LColor::commandbg, LColor::commandframe, - false, width, ascent, descent); + lyxfont::rectText(s, font, width, ascent, descent); } + return descent; } @@ -83,16 +80,14 @@ int InsetButton::width(BufferView * bv, LyXFont const &) const int width; int ascent; int descent; - string const s = getScreenLabel(); - + string const s = getScreenLabel(bv->buffer()); + if (editable()) { - bv->painter().buttonText(0, 0, s, font, - false, width, ascent, descent); + lyxfont::buttonText(s, font, width, ascent, descent); } else { - bv->painter().rectText(0, 0, s, font, - LColor::commandbg, LColor::commandframe, - false, width, ascent, descent); + lyxfont::rectText(s, font, width, ascent, descent); } + return width + 4; } @@ -107,16 +102,14 @@ void InsetButton::draw(BufferView * bv, LyXFont const &, LyXFont font(LyXFont::ALL_SANE); font.setColor(LColor::command).decSize(); - int width; - string const s = getScreenLabel(); + string const s = getScreenLabel(bv->buffer()); if (editable()) { - pain.buttonText(int(x) + 2, baseline, s, font, true, width); + pain.buttonText(int(x) + 2, baseline, s, font); } else { pain.rectText(int(x) + 2, baseline, s, font, - LColor::commandbg, LColor::commandframe, - true, width); + LColor::commandbg, LColor::commandframe); } - x += width + 4; + x += width(bv, font); }