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