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