]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbutton.C
Don't remove cell selections after fontchange.
[lyx.git] / src / insets / insetbutton.C
index 617b2bf8200dba10272bf095ed2692842173e3bb..b171dc91012285ed9dea6f930bd58abfe237ddad 100644 (file)
@@ -36,24 +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 0
-        if (editable()) {
-               bv->painter().buttonText(0, 0, s, font,
-                                        false, width, ascent, descent);
-       } else {
-               bv->painter().rectText(0, 0, s, font,
-                                      LColor::commandbg, LColor::commandframe,
-                                      false, width, ascent, descent);
-       }
-#else
         if (editable()) {
                lyxfont::buttonText(s, font, width, ascent, descent);
        } else {
                lyxfont::rectText(s, font, width, ascent, descent);
        }
-#endif
+
        return ascent;
 }
 
@@ -68,24 +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 0
-        if (editable()) {
-               bv->painter().buttonText(0, 0, s, font,
-                                        false, width, ascent, descent);
-       } else {
-               bv->painter().rectText(0, 0, s, font,
-                                  LColor::commandbg, LColor::commandframe,
-                                  false, width, ascent, descent);
-       }
-#else
         if (editable()) {
                lyxfont::buttonText(s, font, width, ascent, descent);
        } else {
                lyxfont::rectText(s, font, width, ascent, descent);
        }
-#endif
+
        return descent;
 }
 
@@ -100,24 +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 0
-        if (editable()) {
-               bv->painter().buttonText(0, 0, s, font,
-                                        false, width, ascent, descent);
-       } else {
-               bv->painter().rectText(0, 0, s, font,
-                                      LColor::commandbg, LColor::commandframe,
-                                      false, width, ascent, descent);
-       }
-#else
         if (editable()) {
                lyxfont::buttonText(s, font, width, ascent, descent);
        } else {
                lyxfont::rectText(s, font, width, ascent, descent);
        }
-#endif
+
        return width + 4;
 }
 
@@ -132,29 +102,14 @@ void InsetButton::draw(BufferView * bv, LyXFont const &,
        LyXFont font(LyXFont::ALL_SANE);
        font.setColor(LColor::command).decSize();
 
-       string const s = getScreenLabel();
+       string const s = getScreenLabel(bv->buffer());
 
-#if 0
-       int width;
-       if (editable()) {
-               pain.buttonText(int(x) + 2, baseline, s, font, true, width);
-       } else {
-               pain.rectText(int(x) + 2, baseline, s, font,
-                             LColor::commandbg, LColor::commandframe,
-                             true, width);
-       }
-#else
        if (editable()) {
                pain.buttonText(int(x) + 2, baseline, s, font);
        } else {
                pain.rectText(int(x) + 2, baseline, s, font,
                              LColor::commandbg, LColor::commandframe);
        }
-#endif
 
-#if 0
-       x += width + 4;
-#else
        x += width(bv, font);
-#endif
 }