]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbutton.C
reformatting and remove using delc
[lyx.git] / src / insets / insetbutton.C
index 327ab0b6566cd97f74cccae7a4c3f6e4c00f160b..e63832d9aa1cb4604039bd347fc4da73cbe356d1 100644 (file)
@@ -23,11 +23,7 @@ using std::ostream;
 using std::endl;
 
 
-InsetButton::InsetButton()
-{
-}
-
-int InsetButton::ascent(Painter & pain, LyXFont const &) const
+int InsetButton::ascent(BufferView * bv, LyXFont const &) const
 {
        LyXFont font(LyXFont::ALL_SANE);
        font.decSize();
@@ -36,18 +32,18 @@ int InsetButton::ascent(Painter & pain, LyXFont const &) const
         string s = getScreenLabel();
        
         if (Editable()) {
-               pain.buttonText(0, 0, s, font,
-                               false, width, ascent, descent);
+               bv->painter().buttonText(0, 0, s, font,
+                                        false, width, ascent, descent);
        } else {
-               pain.rectText(0, 0, s, font,
-                             LColor::commandbg, LColor::commandframe,
-                             false, width, ascent, descent);
+               bv->painter().rectText(0, 0, s, font,
+                                      LColor::commandbg, LColor::commandframe,
+                                      false, width, ascent, descent);
        }
        return ascent;
 }
 
 
-int InsetButton::descent(Painter & pain, LyXFont const &) const
+int InsetButton::descent(BufferView * bv, LyXFont const &) const
 {
        LyXFont font(LyXFont::ALL_SANE);
        font.decSize();
@@ -56,39 +52,41 @@ int InsetButton::descent(Painter & pain, LyXFont const &) const
         string s = getScreenLabel();
        
         if (Editable()) {
-               pain.buttonText(0, 0, s, font,
-                               false, width, ascent, descent);
+               bv->painter().buttonText(0, 0, s, font,
+                                        false, width, ascent, descent);
        } else {
-               pain.rectText(0, 0, s, font,
-                             LColor::commandbg, LColor::commandframe,
-                             false, width, ascent, descent);
+               bv->painter().rectText(0, 0, s, font,
+                                  LColor::commandbg, LColor::commandframe,
+                                  false, width, ascent, descent);
        }
        return descent;
 }
 
 
-int InsetButton::width(Painter & pain, LyXFont const &) const
+int InsetButton::width(BufferView * bv, LyXFont const &) const
 {
        LyXFont font(LyXFont::ALL_SANE);
        font.decSize();
        
        int width, ascent, descent;
         string s = getScreenLabel();
+       //if (!bv)
+       //      int(s.length());
        
         if (Editable()) {
-               pain.buttonText(0, 0, s, font,
-                               false, width, ascent, descent);
+               bv->painter().buttonText(0, 0, s, font,
+                                        false, width, ascent, descent);
        } else {
-               pain.rectText(0, 0, s, font,
-                             LColor::commandbg, LColor::commandframe,
-                             false, width, ascent, descent);
+               bv->painter().rectText(0, 0, s, font,
+                                      LColor::commandbg, LColor::commandframe,
+                                      false, width, ascent, descent);
        }
        return width + 4;
 }
 
 
 void InsetButton::draw(BufferView * bv, LyXFont const &,
-                       int baseline, float & x) const
+                       int baseline, float & x, bool) const
 {
        Painter & pain = bv->painter();
        // Draw it as a box with the LaTeX text