]> git.lyx.org Git - lyx.git/blob - src/mathed/math_dotsinset.C
get rid of several friends small cleanup
[lyx.git] / src / mathed / math_dotsinset.C
1 #include <config.h>
2
3 #include "math_dotsinset.h"
4 #include "mathed/support.h"
5 #include "support/LOstream.h"
6
7 using std::ostream;
8
9
10 MathDotsInset::MathDotsInset(string const & nam, int id, short st)
11         : MathedInset(nam, LM_OT_DOTS, st), code(id) {}
12
13
14 MathedInset * MathDotsInset::Clone()
15 {
16         return new MathDotsInset(name, code, GetStyle());
17 }     
18
19
20 void
21 MathDotsInset::draw(Painter & pain, int x, int y)
22 {
23         mathed_draw_deco(pain, x + 2, y - dh, width - 2, ascent, code);
24         if (code == LM_vdots || code == LM_ddots) ++x; 
25         if (code != LM_vdots) --y;
26         mathed_draw_deco(pain, x + 2, y - dh, width - 2, ascent, code);
27 }
28
29
30 void
31 MathDotsInset::Metrics()
32 {
33         mathed_char_height(LM_TC_VAR, size(), 'M', ascent, descent);
34         width = mathed_char_width(LM_TC_VAR, size(), 'M');   
35         switch (code) {
36         case LM_ldots: dh = 0; break;
37         case LM_cdots: dh = ascent/2; break;
38         case LM_vdots: width /= 2;
39         case LM_ddots: dh = ascent; break;
40         }
41
42
43
44 void
45 MathDotsInset::Write(ostream & os, bool /* fragile */)
46 {
47         os << '\\' << name << ' ';
48 }