]> git.lyx.org Git - lyx.git/blob - src/mathed/math_biginset.C
inactive new stuff to re-sync my tree before going on holyday
[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 int 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         double h = mathed_char_height(LM_TC_VAR, mi, 'I', ascent_, descent_);  
46         double f = increase();
47         width_   = 6;
48         ascent_  = int(h + f * h);
49         descent_ = int(f * h);
50 }
51
52
53 void MathBigInset::draw(Painter & pain, int x, int y) const
54
55         mathed_draw_deco(pain, x + 1, y - ascent_, 4, height(), delim_);
56 }
57
58
59 void MathBigInset::write(WriteStream & os) const
60 {
61         os << '\\' << name_ << ' ' << delim_;
62 }
63
64
65 void MathBigInset::normalize(NormalStream & os) const
66 {
67         os << "[" << name_ << ' ' <<  delim_ << ']';
68 }