]> git.lyx.org Git - lyx.git/blob - src/mathed/math_biginset.C
rename commandtags.h to lfuns.h and renumber/cleanup. Rebuild the tree !
[lyx.git] / src / mathed / math_biginset.C
1 #include <config.h>
2
3
4 #include "math_biginset.h"
5 #include "math_support.h"
6 #include "math_parser.h"
7 #include "math_mathmlstream.h"
8 #include "math_streamstr.h"
9
10
11 MathBigInset::MathBigInset(string const & name, string const & delim)
12         : name_(name), delim_(delim)
13 {}
14
15
16 MathInset * MathBigInset::clone() const
17 {
18         return new MathBigInset(*this);
19 }
20
21
22 MathBigInset::size_type MathBigInset::size() const
23 {
24         return name_.size() - 4;
25 }
26
27
28 double MathBigInset::increase() const
29 {
30         switch (size()) {
31                 case 1:  return 0.2;
32                 case 2:  return 0.44;
33                 case 3:  return 0.7;
34                 default: return 0.0;
35         }
36         return 0.0;
37 }
38
39
40 void MathBigInset::metrics(MathMetricsInfo & mi) const
41 {
42         double const h = mathed_char_ascent(mi.base.font, 'I');
43         double const f = increase();
44         dim_.w = 6;
45         dim_.a = int(h + f * h);
46         dim_.d = int(f * h);
47 }
48
49
50 void MathBigInset::draw(MathPainterInfo & pi, int x, int y) const
51 {
52         mathed_draw_deco(pi, x + 1, y - ascent(), 4, height(), delim_);
53 }
54
55
56 void MathBigInset::write(WriteStream & os) const
57 {
58         os << '\\' << name_ << ' ' << delim_;
59 }
60
61
62 void MathBigInset::normalize(NormalStream & os) const
63 {
64         os << '[' << name_ << ' ' <<  delim_ << ']';
65 }