]> git.lyx.org Git - lyx.git/blob - src/mathed/math_dotsinset.C
fix "make dist" target
[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 MathDotsInset::draw(Painter & pain, int x, int y)
25 {
26         mathed_draw_deco(pain, x + 2, y - dh_, width - 2, ascent, code_);
27         if (code_ == LM_vdots || code_ == LM_ddots)
28                 ++x;
29         if (code_ != LM_vdots)
30                 --y;
31         mathed_draw_deco(pain, x + 2, y - dh_, width - 2, ascent, code_);
32 }
33
34
35 void 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 MathDotsInset::Write(ostream & os, bool /* fragile */)
49 {
50         os << '\\' << name << ' ';
51 }
52
53
54 void MathDotsInset::WriteNormal(ostream & os)
55 {
56         os << "[" << name << "] ";
57 }