]> git.lyx.org Git - lyx.git/blob - src/mathed/math_funcinset.C
try to fix rounding errors
[lyx.git] / src / mathed / math_funcinset.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "math_funcinset.h"
8 #include "frontends/font_metrics.h"
9 #include "frontends/Painter.h"
10 #include "math_support.h"
11 #include "math_mathmlstream.h"
12 #include "math_streamstr.h"
13
14
15 extern LyXFont WhichFont(short type, int size);
16
17
18 MathFuncInset::MathFuncInset(string const & nm)
19         : name_(nm)
20 {}
21
22
23 MathInset * MathFuncInset::clone() const
24 {
25         return new MathFuncInset(*this);
26 }
27
28
29 string const & MathFuncInset::name() const
30 {
31         return name_;
32 }
33
34
35 void MathFuncInset::setName(string const & n)
36 {
37         name_ = n;
38 }
39
40
41 void MathFuncInset::metrics(MathMetricsInfo & mi) const
42 {
43         mathed_string_dim(mi.font_, name_, ascent_, descent_, width_);
44 }
45
46
47 void MathFuncInset::draw(Painter & pain, int x, int y) const
48 {
49         drawStr(pain, mi.font_, x, y, name_);
50 }
51
52
53 bool MathFuncInset::match(MathInset * p) const
54 {
55         MathFuncInset const * q = p->asFuncInset();
56         return q && name_ == q->name_;
57 }
58
59
60 void MathFuncInset::maplize(MapleStream & os) const
61 {
62         os << ' ' << name_;
63 }
64
65
66 void MathFuncInset::mathmlize(MathMLStream & os) const
67 {
68         os << MTag("mi") << name_ << ETag("mi");
69 }
70
71
72 void MathFuncInset::octavize(OctaveStream & os) const
73 {
74         os << ' ' << name_;
75 }
76
77
78 void MathFuncInset::normalize(NormalStream & os) const
79 {
80         os << "[func " << name_ << ']';
81 }
82
83
84 void MathFuncInset::write(WriteStream & os) const
85 {
86         os << "\\" << name_ << ' ';
87 }