]> git.lyx.org Git - lyx.git/blob - src/mathed/math_dotsinset.C
use stream-like syntax for LaTeX output
[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 "support/LOstream.h"
8
9 using std::ostream;
10
11
12 MathDotsInset::MathDotsInset(string const & name)
13         : name_(name)
14 {}
15
16
17 MathInset * MathDotsInset::clone() const
18 {
19         return new MathDotsInset(*this);
20 }     
21
22
23 void MathDotsInset::draw(Painter & pain, int x, int y) const
24 {
25         mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, name_);
26         char const c = name_[0];
27         if (c == 'v' || c == 'd')
28                 ++x;
29         if (c != 'v')
30                 --y;
31         mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, name_);
32 }
33
34
35 void MathDotsInset::metrics(MathMetricsInfo const & st) const
36 {
37         size_ = st;
38         mathed_char_dim(LM_TC_VAR, size(), 'M', ascent_, descent_, width_);
39         switch (name_[0]) {
40                 case 'l': dh_ = 0; break;
41                 case 'c': dh_ = ascent_ / 2; break;
42                 case 'v': width_ /= 2;
43                 case 'd': dh_ = ascent_; break;
44         }
45
46
47
48 void MathDotsInset::write(MathWriteInfo & os) const
49 {
50         os << '\\' << name_ << ' ';
51 }
52
53
54 void MathDotsInset::writeNormal(ostream & os) const
55 {
56         os << "[" << name_ << "] ";
57 }