]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_fracinset.C
fix pullArg when pressing <Delete> at the end of an cell
[lyx.git] / src / mathed / math_fracinset.C
index b3307cb339e4544fb03cc65f3f49aee298fdd5e3..576f98c4e877fe15f8d0dd30dff23a3f63425bbb 100644 (file)
@@ -1,24 +1,16 @@
-#include <config.h>
-
 #ifdef __GNUG__
 #pragma implementation
 #endif
 
-#include <functional>
-
 #include "math_fracinset.h"
-#include "LColor.h"
-#include "Painter.h"
 #include "mathed/support.h"
+#include "Painter.h"
 #include "support/LOstream.h"
 
 
-MathFracInset::MathFracInset(MathInsetTypes ot)
-       : MathInset("frac", ot, 2)
-{
-       if (objtype == LM_OT_STACKREL) 
-               SetName("stackrel");
-}
+MathFracInset::MathFracInset(string const & name)
+       : MathInset(2, name)
+{}
 
 
 MathInset * MathFracInset::clone() const
@@ -27,11 +19,11 @@ MathInset * MathFracInset::clone() const
 }
 
 
-void MathFracInset::Metrics(MathStyles st)
+void MathFracInset::Metrics(MathStyles st, int, int)
 {
-       xcell(0).Metrics(st);
-       xcell(1).Metrics(st);
-       size_    = st;
+       size_    = smallerStyleFrac(st);
+       xcell(0).Metrics(size_);
+       xcell(1).Metrics(size_);
        width_   = std::max(xcell(0).width(), xcell(1).width()) + 4; 
        ascent_  = xcell(0).height() + 4 + 5;
        descent_ = xcell(1).height() + 4 - 5; 
@@ -46,7 +38,7 @@ void MathFracInset::draw(Painter & pain, int x, int y)
        xcell(0).draw(pain, m - xcell(0).width() / 2, y - xcell(0).descent() - 3 - 5);
        xcell(1).draw(pain, m - xcell(1).width() / 2, y + xcell(1).ascent()  + 3 - 5);
        
-       if (objtype == LM_OT_FRAC)
+       if (name() == "frac")
                pain.line(x + 2, y - 5, x + width() - 4, y - 5, LColor::mathline);
 }