]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_braceinset.C
Jean-Marc's fix for wrong descent
[lyx.git] / src / mathed / math_braceinset.C
index 81d3cc4bfd102a883edee24eae75e8f843652f5f..4cd94c19504d5c2f90814580d3b865c9e8228b9b 100644 (file)
@@ -1,14 +1,11 @@
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "math_braceinset.h"
 #include "math_parser.h"
 #include "math_support.h"
 #include "math_mathmlstream.h"
-
+#include "support/LOstream.h"
 
 using std::max;
 
@@ -18,6 +15,13 @@ MathBraceInset::MathBraceInset()
 {}
 
 
+MathBraceInset::MathBraceInset(MathArray const & ar)
+       : MathNestInset(1)
+{
+       cell(0) = ar;
+}
+
+
 MathInset * MathBraceInset::clone() const
 {
        return new MathBraceInset(*this);
@@ -26,12 +30,13 @@ MathInset * MathBraceInset::clone() const
 
 void MathBraceInset::metrics(MathMetricsInfo & mi) const
 {
-       xcell(0).metrics(mi);
-       int a, d;
-       mathed_char_dim(mi.base.font, '{', a, d, wid_);
-       ascent_  = max(xcell(0).ascent(), a);
-       descent_ = max(xcell(0).descent(), a);
-       width_   = xcell(0).width() + 2 * wid_;
+       cell(0).metrics(mi);
+       Dimension t;
+       mathed_char_dim(mi.base.font, '{', t);
+       wid_ = t.w;
+       dim_.a = max(cell(0).ascent(), t.a);
+       dim_.d = max(cell(0).descent(), t.d);
+       dim_.w = cell(0).width() + 2 * wid_;
 }
 
 
@@ -40,8 +45,8 @@ void MathBraceInset::draw(MathPainterInfo & pi, int x, int y) const
        LyXFont font = pi.base.font;
        font.setColor(LColor::latex);
        drawChar(pi, font, x, y, '{');
-       xcell(0).draw(pi, x + wid_, y);
-       drawChar(pi, font, x + width_ - wid_, y, '}');
+       cell(0).draw(pi, x + wid_, y);
+       drawChar(pi, font, x + width() - wid_, y, '}');
 }
 
 
@@ -57,6 +62,30 @@ void MathBraceInset::normalize(NormalStream & os) const
 }
 
 
+void MathBraceInset::maple(MapleStream & os) const
+{
+       os << cell(0);
+}
+
+
+void MathBraceInset::octave(OctaveStream & os) const
+{
+       os << cell(0);
+}
+
+
+void MathBraceInset::mathmlize(MathMLStream & os) const
+{
+       os << MTag("mrow") << cell(0) << ETag("mrow");
+}
+
+
+void MathBraceInset::mathematica(MathematicaStream & os) const
+{
+       os << cell(0);
+}
+
+
 void MathBraceInset::infoize(std::ostream & os) const
 {
        os << "Nested Block: ";