]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_exfuncinset.C
Jean-Marc's fix for wrong descent
[lyx.git] / src / mathed / math_exfuncinset.C
index ceb4d621fba05baace15c1e9d99a57f1ed08e52e..e0b6e1c049908d2af01910e2ad8b8a6aa26a8c53 100644 (file)
@@ -1,3 +1,4 @@
+
 #include <config.h>
 
 #include "math_exfuncinset.h"
@@ -11,6 +12,13 @@ MathExFuncInset::MathExFuncInset(string const & name)
 {}
 
 
+MathExFuncInset::MathExFuncInset(string const & name, MathArray const & ar)
+       : MathNestInset(1), name_(name)
+{
+       cell(0) = ar;
+}
+
+
 MathInset * MathExFuncInset::clone() const
 {
        return new MathExFuncInset(*this);
@@ -19,7 +27,7 @@ MathInset * MathExFuncInset::clone() const
 
 void MathExFuncInset::metrics(MathMetricsInfo & mi) const
 {
-       mathed_string_dim(mi.base.font, name_, ascent_, descent_, width_);
+       mathed_string_dim(mi.base.font, name_, dim_);
 }
 
 
@@ -29,31 +37,65 @@ void MathExFuncInset::draw(MathPainterInfo & pi, int x, int y) const
 }
 
 
-void MathExFuncInset::normalize(NormalStream & os) const
+string MathExFuncInset::name() const
 {
-       os << '[' << name_ << ' ' << cell(0) << ']';
+       return name_;
 }
 
 
-void MathExFuncInset::maplize(MapleStream & os) const
+void MathExFuncInset::maple(MapleStream & os) const
 {
-       os << name_ << '(' << cell(0) << ')';
+       if (name_ == "det")
+               os << "linalg[det](" << cell(0) << ')';
+       else
+               os << name_ << '(' << cell(0) << ')';
 }
 
 
-void MathExFuncInset::mathmlize(MathMLStream & os) const
+void MathExFuncInset::maxima(MaximaStream & os) const
 {
-       os << MTag(name_.c_str()) << cell(0) << ETag(name_.c_str());
+       if (name_ == "det")
+               os << "determinant(" << cell(0) << ')';
+       else
+               os << name_ << '(' << cell(0) << ')';
 }
 
 
-void MathExFuncInset::octavize(OctaveStream & os) const
+string asMathematicaName(string const & name)
 {
-       os << name_ << '(' << cell(0) << ')';
+       if (name == "sin")    return "Sin";
+       if (name == "sinh")   return "Sinh";
+       if (name == "arcsin") return "ArcSin";
+       if (name == "cos")    return "Cos";
+       if (name == "cosh")   return "Cosh";
+       if (name == "arcos")  return "ArcCos";
+       if (name == "tan")    return "Tan";
+       if (name == "tanh")   return "Tanh";
+       if (name == "arctan") return "ArcTan";
+       if (name == "cot")    return "Cot";
+       if (name == "coth")   return "Coth";
+       if (name == "csc")    return "Csc";
+       if (name == "sec")    return "Sec";
+       if (name == "exp")    return "Exp";
+       if (name == "log")    return "Log";
+       if (name == "ln" )    return "Log";
+       return name;
 }
 
 
-void MathExFuncInset::write(WriteStream & os) const
+void MathExFuncInset::mathematica(MathematicaStream & os) const
 {
-       os << '\\' << name_ << '{' << cell(0) << '}';
+       os << asMathematicaName(name_) << '[' << cell(0) << ']';
+}
+
+
+void MathExFuncInset::mathmlize(MathMLStream & os) const
+{
+       os << MTag(name_.c_str()) << cell(0) << ETag(name_.c_str());
+}
+
+
+void MathExFuncInset::octave(OctaveStream & os) const
+{
+       os << name_ << '(' << cell(0) << ')';
 }