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