]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_fracinset.C
mathed95.diff
[lyx.git] / src / mathed / math_fracinset.C
index a3b33c1ad44b30cc3233790c7590225dc9229471..856e3b664b5b333379481908975005f091ecdeae 100644 (file)
@@ -4,6 +4,8 @@
 #pragma implementation
 #endif
 
+#include <functional>
+
 #include "math_fracinset.h"
 #include "LColor.h"
 #include "Painter.h"
@@ -11,7 +13,7 @@
 #include "support/LOstream.h"
 
 
-MathFracInset::MathFracInset(short ot)
+MathFracInset::MathFracInset(MathInsetTypes ot)
        : MathInset("frac", ot, 2)
 {
        if (objtype == LM_OT_STACKREL) 
@@ -19,7 +21,7 @@ MathFracInset::MathFracInset(short ot)
 }
 
 
-MathInset * MathFracInset::Clone() const
+MathInset * MathFracInset::clone() const
 {   
        return new MathFracInset(*this);
 }
@@ -27,10 +29,10 @@ MathInset * MathFracInset::Clone() const
 
 void MathFracInset::Metrics(MathStyles st)
 {
-       xcell(0).Metrics(st);
-       xcell(1).Metrics(st);
-       size_    = st;
-       width_   = max(xcell(0).width(), xcell(1).width()) + 4; 
+       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; 
 }
@@ -96,3 +98,31 @@ bool MathFracInset::idxDown(int & idx, int &) const
        return true;
 }
 
+bool MathFracInset::idxFirstUp(int & idx, int & pos) const
+{
+       idx = 0;
+       pos = 0;
+       return true;
+}
+
+bool MathFracInset::idxFirstDown(int & idx, int & pos) const
+{
+       idx = 1;
+       pos = 0;
+       return true;
+}
+
+bool MathFracInset::idxLastUp(int & idx, int & pos) const
+{
+       idx = 0;
+       pos = cell(idx).size();
+       return true;
+}
+
+bool MathFracInset::idxLastDown(int & idx, int & pos) const
+{
+       idx = 1;
+       pos = cell(idx).size();
+       return true;
+}
+