]> git.lyx.org Git - lyx.git/blob - src/mathed/math_dotsinset.C
fix #1073
[lyx.git] / src / mathed / math_dotsinset.C
1 #include <config.h>
2
3
4 #include "math_dotsinset.h"
5 #include "math_mathmlstream.h"
6 #include "math_streamstr.h"
7 #include "math_support.h"
8 #include "math_parser.h"
9
10
11 MathDotsInset::MathDotsInset(latexkeys const * key)
12         : key_(key)
13 {}
14
15
16 MathInset * MathDotsInset::clone() const
17 {
18         return new MathDotsInset(*this);
19 }
20
21
22 void MathDotsInset::metrics(MetricsInfo & mi) const
23 {
24         mathed_char_dim(mi.base.font, 'M', dim_);
25         dh_ = 0;
26         if (key_->name == "cdots" || key_->name == "dotsb"
27                         || key_->name == "dotsm" || key_->name == "dotsi")
28                 dh_ = ascent() / 2;
29         else if (key_->name == "dotsc")
30                 dh_ = ascent() / 4;
31         else if (key_->name == "vdots") {
32                 dim_.w = (dim_.w / 2) + 1;
33                 dh_ = ascent();
34         }
35         else if (key_->name == "ddots")
36                 dh_ = ascent();
37 }
38
39
40 void MathDotsInset::draw(PainterInfo & pain, int x, int y) const
41 {
42         mathed_draw_deco(pain, x + 2, y - dh_, width() - 2, ascent(), key_->name);
43         if (key_->name == "vdots" || key_->name == "ddots")
44                 ++x;
45         if (key_->name != "vdots")
46                 --y;
47         mathed_draw_deco(pain, x + 2, y - dh_, width() - 2, ascent(), key_->name);
48 }
49
50
51 string MathDotsInset::name() const
52 {
53         return key_->name;
54 }