]> git.lyx.org Git - lyx.git/blob - src/mathed/math_dotsinset.C
1391970bc0e77cc3698d3a378cd46e93b91ae718
[lyx.git] / src / mathed / math_dotsinset.C
1 #ifdef __GNUG__
2 #pragma implementation
3 #endif
4
5 #include "math_dotsinset.h"
6 #include "mathed/support.h"
7 #include "mathed/math_parser.h"
8 #include "support/LOstream.h"
9
10 using std::ostream;
11
12
13 MathDotsInset::MathDotsInset(latexkeys const * key)
14         : key_(key)
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_, key_->id);
27         if (key_->id == LM_vdots || key_->id == LM_ddots)
28                 ++x;
29         if (key_->id != LM_vdots)
30                 --y;
31         mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, key_->id);
32 }
33
34
35 void MathDotsInset::metrics(MathStyles st) const
36 {
37         size(st);
38         mathed_char_dim(LM_TC_VAR, size(), 'M', ascent_, descent_, width_);
39         switch (key_->id) {
40                 case LM_ldots: dh_ = 0; break;
41                 case LM_cdots: dh_ = ascent_ / 2; break;
42                 case LM_vdots: width_ /= 2;
43                 case LM_ddots: dh_ = ascent_; break;
44         }
45
46
47
48 void MathDotsInset::write(ostream & os, bool /* fragile */) const
49 {
50         os << '\\' << key_->name << ' ';
51 }
52
53
54 void MathDotsInset::writeNormal(ostream & os) const
55 {
56         os << "[" << key_->name << "] ";
57 }