]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_braceinset.C
fix #1073
[lyx.git] / src / mathed / math_braceinset.C
index ff1c46965190bd05fe82307841e951a0d3ddad9c..b0213e2c387950bc17df0a4d33e0ca79c5dc13ab 100644 (file)
@@ -1,13 +1,13 @@
 #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;
 
 
 MathBraceInset::MathBraceInset()
@@ -15,40 +15,78 @@ MathBraceInset::MathBraceInset()
 {}
 
 
+MathBraceInset::MathBraceInset(MathArray const & ar)
+       : MathNestInset(1)
+{
+       cell(0) = ar;
+}
+
+
 MathInset * MathBraceInset::clone() const
-{   
+{
        return new MathBraceInset(*this);
 }
 
 
-void MathBraceInset::write(MathWriteInfo & os) const
+void MathBraceInset::metrics(MetricsInfo & mi) const
+{
+       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_;
+}
+
+
+void MathBraceInset::draw(PainterInfo & pi, int x, int y) const
+{
+       LyXFont font = pi.base.font;
+       font.setColor(LColor::latex);
+       drawChar(pi, font, x, y, '{');
+       cell(0).draw(pi, x + wid_, y);
+       drawChar(pi, font, x + width() - wid_, y, '}');
+}
+
+
+void MathBraceInset::write(WriteStream & os) const
 {
        os << '{' << cell(0) << '}';
 }
 
 
-void MathBraceInset::writeNormal(NormalStream & os) const
+void MathBraceInset::normalize(NormalStream & os) const
+{
+       os << "[block " << cell(0) << ']';
+}
+
+
+void MathBraceInset::maple(MapleStream & os) const
+{
+       os << cell(0);
+}
+
+
+void MathBraceInset::octave(OctaveStream & os) const
 {
-       os << "[block ";
-       cell(0).writeNormal(os);
-       os << "]";
+       os << cell(0);
 }
 
 
-void MathBraceInset::metrics(MathMetricsInfo const & mi) const
+void MathBraceInset::mathmlize(MathMLStream & os) const
 {
-       xcell(0).metrics(mi);
-       int a, d;
-       mathed_char_dim(LM_TC_TEX, mi, '{', a, d, wid_);
-       ascent_  = std::max(xcell(0).ascent(), a);
-       descent_ = std::max(xcell(0).descent(), a);
-       width_   = xcell(0).width() + 2 * wid_;
+       os << MTag("mrow") << cell(0) << ETag("mrow");
 }
 
 
-void MathBraceInset::draw(Painter & pain, int x, int y) const
-{ 
-       drawChar(pain, LM_TC_TEX, mi_, x, y, '{');
-       xcell(0).draw(pain, x + wid_, y);
-       drawChar(pain, LM_TC_TEX, mi_, x + width_ - wid_, y, '}');
+void MathBraceInset::mathematica(MathematicaStream & os) const
+{
+       os << cell(0);
+}
+
+
+void MathBraceInset::infoize(std::ostream & os) const
+{
+       os << "Nested Block: ";
 }