]> git.lyx.org Git - lyx.git/blob - src/mathed/math_biginset.C
Strip out redundant #includes
[lyx.git] / src / mathed / math_biginset.C
1 /**
2  * \file math_biginset.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "math_biginset.h"
14 #include "math_support.h"
15 #include "math_mathmlstream.h"
16 #include "math_streamstr.h"
17
18 using std::auto_ptr;
19
20
21 MathBigInset::MathBigInset(string const & name, string const & delim)
22         : name_(name), delim_(delim)
23 {}
24
25
26 auto_ptr<InsetBase> MathBigInset::clone() const
27 {
28         return auto_ptr<InsetBase>(new MathBigInset(*this));
29 }
30
31
32 MathBigInset::size_type MathBigInset::size() const
33 {
34         return name_.size() - 4;
35 }
36
37
38 double MathBigInset::increase() const
39 {
40         switch (size()) {
41                 case 1:  return 0.2;
42                 case 2:  return 0.44;
43                 case 3:  return 0.7;
44                 default: return 0.0;
45         }
46 }
47
48
49 void MathBigInset::metrics(MetricsInfo & mi, Dimension & dim) const
50 {
51         double const h = mathed_char_ascent(mi.base.font, 'I');
52         double const f = increase();
53         dim_.wid = 6;
54         dim_.asc = int(h + f * h);
55         dim_.des = int(f * h);
56         dim = dim_;
57 }
58
59
60 void MathBigInset::draw(PainterInfo & pi, int x, int y) const
61 {
62         mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 4, dim_.height(), delim_);
63 }
64
65
66 void MathBigInset::write(WriteStream & os) const
67 {
68         os << '\\' << name_ << ' ' << delim_;
69 }
70
71
72 void MathBigInset::normalize(NormalStream & os) const
73 {
74         os << '[' << name_ << ' ' <<  delim_ << ']';
75 }