]> git.lyx.org Git - lyx.git/blob - src/mathed/math_exfuncinset.C
Maxima
[lyx.git] / src / mathed / math_exfuncinset.C
1
2 #ifdef __GNUG__
3 #pragma implementation 
4 #endif
5
6 #include <config.h>
7
8 #include "math_exfuncinset.h"
9 #include "math_support.h"
10 #include "math_mathmlstream.h"
11 #include "math_streamstr.h"
12
13
14 MathExFuncInset::MathExFuncInset(string const & name)
15         : MathNestInset(1), name_(name)
16 {}
17
18
19 MathExFuncInset::MathExFuncInset(string const & name, MathArray const & ar)
20         : MathNestInset(1), name_(name)
21 {
22         cell(0) = ar;
23 }
24
25
26 MathInset * MathExFuncInset::clone() const
27 {
28         return new MathExFuncInset(*this);
29 }
30
31
32 void MathExFuncInset::metrics(MathMetricsInfo & mi) const
33 {
34         mathed_string_dim(mi.base.font, name_, dim_);
35 }
36
37
38 void MathExFuncInset::draw(MathPainterInfo & pi, int x, int y) const
39 {
40         drawStrBlack(pi, x, y, name_);
41 }
42
43
44 string MathExFuncInset::name() const
45 {
46         return name_;
47 }
48
49
50 void MathExFuncInset::maplize(MapleStream & os) const
51 {
52         if (name_ == "det")
53                 os << "linalg[det](" << cell(0) << ')';
54         else
55                 os << name_ << '(' << cell(0) << ')';
56 }
57
58
59 void MathExFuncInset::maximize(MaximaStream & os) const
60 {
61         if (name_ == "det")
62                 os << "determinant(" << cell(0) << ')';
63         else
64                 os << name_ << '(' << cell(0) << ')';
65 }
66
67
68 string asMathematicaName(string const & name)
69 {
70         if (name == "sin")    return "Sin";
71         if (name == "sinh")   return "Sinh";
72         if (name == "arcsin") return "ArcSin";
73         if (name == "cos")    return "Cos";
74         if (name == "cosh")   return "Cosh";
75         if (name == "arcos")  return "ArcCos";
76         if (name == "tan")    return "Tan";
77         if (name == "tanh")   return "Tanh";
78         if (name == "arctan") return "ArcTan";
79         if (name == "cot")    return "Cot";
80         if (name == "coth")   return "Coth";
81         if (name == "csc")    return "Csc";
82         if (name == "sec")    return "Sec";
83         if (name == "exp")    return "Exp";
84         if (name == "log")    return "Log";
85         if (name == "ln" )    return "Log";
86         return name;
87 }
88
89
90 void MathExFuncInset::mathematicize(MathematicaStream & os) const
91 {
92         os << asMathematicaName(name_) << '[' << cell(0) << ']';
93 }
94
95
96 void MathExFuncInset::mathmlize(MathMLStream & os) const
97 {
98         os << MTag(name_.c_str()) << cell(0) << ETag(name_.c_str());
99 }
100
101
102 void MathExFuncInset::octavize(OctaveStream & os) const
103 {
104         os << name_ << '(' << cell(0) << ')';
105 }