]> git.lyx.org Git - features.git/blobdiff - src/mathed/math_fracinset.C
new hierarchy for frac-like things
[features.git] / src / mathed / math_fracinset.C
index 96ad21049c74cd5ac52a2248c2ffb46c74757259..6f6853f31efddf443721c25b4d21d4d14c667d93 100644 (file)
@@ -8,8 +8,7 @@
 #include "support/LOstream.h"
 
 
-MathFracInset::MathFracInset(string const & name)
-       : MathNestInset(2, name)
+MathFracInset::MathFracInset()
 {}
 
 
@@ -37,15 +36,13 @@ void MathFracInset::draw(Painter & pain, int x, int y) const
        int m = x + width() / 2;
        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 (name() == "frac")
-               pain.line(x + 2, y - 5, x + width() - 4, y - 5, LColor::mathline);
+       pain.line(x + 2, y - 5, x + width() - 4, y - 5, LColor::mathline);
 }
 
 
 void MathFracInset::write(std::ostream & os, bool fragile) const
 {
-       os << '\\' << name() << '{';
+       os << "\\frac{";
        cell(0).write(os, fragile);
        os << "}{";
        cell(1).write(os, fragile);
@@ -55,66 +52,9 @@ void MathFracInset::write(std::ostream & os, bool fragile) const
 
 void MathFracInset::writeNormal(std::ostream & os) const
 {
-       os << '[' << name() << ' ';
+       os << "[frac ";
        cell(0).writeNormal(os);
        os << " ";
        cell(1).writeNormal(os);
        os << "] ";
 }
-
-
-bool MathFracInset::idxRight(int &, int &) const
-{
-       return false;
-}
-
-bool MathFracInset::idxLeft(int &, int &) const
-{
-       return false;
-}
-
-
-bool MathFracInset::idxUp(int & idx, int &) const
-{
-       if (idx == 0)
-               return false;
-       idx = 0;
-       return true;
-}
-
-bool MathFracInset::idxDown(int & idx, int &) const
-{
-       if (idx == 1)
-               return false;
-       idx = 1;
-       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;
-}
-