]> git.lyx.org Git - lyx.git/blob - src/mathed/math_dotsinset.C
oh well
[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::metrics(MathMetricsInfo const & mi) const
25 {
26         LyXFont font;
27         whichFont(font, LM_TC_VAR, mi);
28         mathed_char_dim(font, 'M', ascent_, descent_, width_);
29         switch (name_[0]) {
30                 case 'l': dh_ = 0; break;
31                 case 'c': dh_ = ascent_ / 2; break;
32                 case 'v': width_ /= 2;
33                 case 'd': dh_ = ascent_; break;
34         }
35 }
36
37
38 void MathDotsInset::draw(Painter & pain, int x, int y) const
39 {
40         mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, name_);
41         char const c = name_[0];
42         if (c == 'v' || c == 'd')
43                 ++x;
44         if (c != 'v')
45                 --y;
46         mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, name_);
47 }
48
49
50 void MathDotsInset::write(WriteStream & os) const
51 {
52         os << '\\' << name_ << ' ';
53 }
54
55
56 void MathDotsInset::normalize(NormalStream & os) const
57 {
58         os << "[" << name_ << "] ";
59 }