]> git.lyx.org Git - lyx.git/blob - src/mathed/math_biginset.C
oh well
[lyx.git] / src / mathed / math_biginset.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "math_biginset.h"
8 #include "math_support.h"
9 #include "math_parser.h"
10 #include "math_mathmlstream.h"
11 #include "math_streamstr.h"
12
13
14 MathBigInset::MathBigInset(string const & name, string const & delim)
15         : name_(name), delim_(delim)
16 {}
17
18
19 MathInset * MathBigInset::clone() const
20 {
21         return new MathBigInset(*this);
22 }
23
24
25 MathBigInset::size_type MathBigInset::size() const
26 {
27         return name_.size() - 4;
28 }
29
30
31 double MathBigInset::increase() const
32 {
33         switch (size()) {
34                 case 1:  return 0.2;
35                 case 2:  return 0.44;
36                 case 3:  return 0.7;
37                 default: return 0.0;
38         }
39         return 0.0;
40 }
41
42
43 void MathBigInset::metrics(MathMetricsInfo const & mi) const
44 {
45         LyXFont font;
46         whichFont(font, LM_TC_VAR, mi);
47         double h = mathed_char_ascent(font, 'I');
48         double f = increase();
49         width_   = 6;
50         ascent_  = int(h + f * h);
51         descent_ = int(f * h);
52 }
53
54
55 void MathBigInset::draw(Painter & pain, int x, int y) const
56 {
57         mathed_draw_deco(pain, x + 1, y - ascent_, 4, height(), delim_);
58 }
59
60
61 void MathBigInset::write(WriteStream & os) const
62 {
63         os << '\\' << name_ << ' ' << delim_;
64 }
65
66
67 void MathBigInset::normalize(NormalStream & os) const
68 {
69         os << "[" << name_ << ' ' <<  delim_ << ']';
70 }