]> git.lyx.org Git - lyx.git/blob - src/mathed/math_dotsinset.C
mathed58.diff
[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 & nam, int id, short st)
15         : MathedInset(nam, LM_OT_DOTS, st), code_(id) {}
16
17
18 MathedInset * MathDotsInset::Clone()
19 {
20         return new MathDotsInset(name, code_, GetStyle());
21 }     
22
23
24 void
25 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) ++x;
29         if (code_ != LM_vdots) --y;
30         mathed_draw_deco(pain, x + 2, y - dh_, width - 2, ascent, code_);
31 }
32
33
34 void
35 MathDotsInset::Metrics()
36 {
37         mathed_char_height(LM_TC_VAR, size(), 'M', ascent, descent);
38         width = mathed_char_width(LM_TC_VAR, size(), 'M');   
39         switch (code_) {
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
49 MathDotsInset::Write(ostream & os, bool /* fragile */)
50 {
51         os << '\\' << name << ' ';
52 }