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