]> git.lyx.org Git - lyx.git/blob - src/mathed/math_dotsinset.C
2615aed1df585f187a82160e35373763ad2c5006
[lyx.git] / src / mathed / math_dotsinset.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "math_dotsinset.h"
8 #include "math_mathmlstream.h"
9 #include "math_streamstr.h"
10 #include "math_support.h"
11
12
13 MathDotsInset::MathDotsInset(string const & name)
14         : name_(name)
15 {}
16
17
18 MathInset * MathDotsInset::clone() const
19 {
20         return new MathDotsInset(*this);
21 }     
22
23
24 void MathDotsInset::draw(Painter & pain, int x, int y) const
25 {
26         mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, name_);
27         char const c = name_[0];
28         if (c == 'v' || c == 'd')
29                 ++x;
30         if (c != 'v')
31                 --y;
32         mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, name_);
33 }
34
35
36 void MathDotsInset::metrics(MathMetricsInfo const & mi) const
37 {
38         mathed_char_dim(LM_TC_VAR, mi, 'M', ascent_, descent_, width_);
39         switch (name_[0]) {
40                 case 'l': dh_ = 0; break;
41                 case 'c': dh_ = ascent_ / 2; break;
42                 case 'v': width_ /= 2;
43                 case 'd': dh_ = ascent_; break;
44         }
45
46
47
48 void MathDotsInset::write(WriteStream & os) const
49 {
50         os << '\\' << name_ << ' ';
51 }
52
53
54 void MathDotsInset::normalize(NormalStream & os) const
55 {
56         os << "[" << name_ << "] ";
57 }