]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_fracinset.C
whichFont down to 5.3%
[lyx.git] / src / mathed / math_fracinset.C
index 6577510700eb75a13a21d1f6bf664528fab0d8c2..5b560c88a35804c8f9fa83583f0780f61c662f7d 100644 (file)
@@ -19,6 +19,12 @@ MathInset * MathFracInset::clone() const
 }
 
 
+MathFracInset * MathFracInset::asFracInset()
+{
+       return atop_ ? 0 : this;
+}
+
+
 void MathFracInset::metrics(MathMetricsInfo const & mi) const
 {
        MathMetricsInfo m = mi;
@@ -26,22 +32,22 @@ void MathFracInset::metrics(MathMetricsInfo const & mi) const
        xcell(0).metrics(m);
        xcell(1).metrics(m);
        width_   = std::max(xcell(0).width(), xcell(1).width()) + 4; 
-       ascent_  = xcell(0).height() + 4 + 5;
-       descent_ = xcell(1).height() + 4 - 5; 
+       ascent_  = xcell(0).height() + 2 + 5;
+       descent_ = xcell(1).height() + 2 - 5; 
 }
 
 
 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);
+       xcell(0).draw(pain, m - xcell(0).width() / 2, y - xcell(0).descent() - 2 - 5);
+       xcell(1).draw(pain, m - xcell(1).width() / 2, y + xcell(1).ascent()  + 2 - 5);
        if (!atop_)
-               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::math);
 }
 
 
-void MathFracInset::write(MathWriteInfo & os) const
+void MathFracInset::write(WriteStream & os) const
 {
        if (atop_)
                os << '{' << cell(0) << "\\atop " << cell(1) << '}';
@@ -50,22 +56,19 @@ void MathFracInset::write(MathWriteInfo & os) const
 }
 
 
-void MathFracInset::writeNormal(NormalStream & os) const
+void MathFracInset::normalize(NormalStream & os) const
 {
        if (atop_) 
                os << "[atop ";
        else
                os << "[frac ";
-       cell(0).writeNormal(os);
-       os << " ";
-       cell(1).writeNormal(os);
-       os << "] ";
+       os << cell(0) << ' ' << cell(1) << ']';
 }
 
 
 void MathFracInset::maplize(MapleStream & os) const
 {
-       os << '(' << cell(0) << '/' << cell(1) << ')';
+       os << '(' << cell(0) << ")/(" << cell(1) << ')';
 }