]> git.lyx.org Git - lyx.git/blob - src/mathed/math_dotsinset.C
change a lot of methods to begin with small char
[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 "mathed/support.h"
9 #include "support/LOstream.h"
10
11 using std::ostream;
12
13
14 MathDotsInset::MathDotsInset(string const & name, int id)
15         : MathInset(name, LM_OT_DOTS), code_(id)
16 {}
17
18
19 MathInset * MathDotsInset::clone() const
20 {
21         return new MathDotsInset(*this);
22 }     
23
24
25 void MathDotsInset::draw(Painter & pain, int x, int y)
26 {
27         mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, code_);
28         if (code_ == LM_vdots || code_ == LM_ddots)
29                 ++x;
30         if (code_ != LM_vdots)
31                 --y;
32         mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, code_);
33 }
34
35
36 void MathDotsInset::Metrics(MathStyles st)
37 {
38         size(st);
39         mathed_char_dim(LM_TC_VAR, size(), 'M', ascent_, descent_, width_);
40         switch (code_) {
41                 case LM_ldots: dh_ = 0; break;
42                 case LM_cdots: dh_ = ascent_/2; break;
43                 case LM_vdots: width_ /= 2;
44                 case LM_ddots: dh_ = ascent_; break;
45         }
46
47
48
49 void MathDotsInset::Write(ostream & os, bool /* fragile */) const
50 {
51         os << '\\' << name() << ' ';
52 }
53
54
55 void MathDotsInset::WriteNormal(ostream & os) const
56 {
57         os << "[" << name() << "] ";
58 }