]> git.lyx.org Git - lyx.git/blob - src/mathed/math_envinset.C
New support for \begin{...}...\end{...} style environments
[lyx.git] / src / mathed / math_envinset.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "math_envinset.h"
8 #include "math_mathmlstream.h"
9 #include "math_streamstr.h"
10
11
12 MathEnvInset::MathEnvInset(string const & name)
13         : MathNestInset(1), name_(name)
14 {}
15
16
17 MathInset * MathEnvInset::clone() const
18 {
19         return new MathEnvInset(*this);
20 }
21
22
23 void MathEnvInset::metrics(MathMetricsInfo & mi) const
24 {
25         xcell(0).metrics(mi);
26         ascent_  = xcell(0).ascent() + 1;
27         descent_ = xcell(0).descent() + 1;
28         width_   = xcell(0).width() + 2;
29 }
30
31
32 void MathEnvInset::draw(MathPainterInfo & pi, int x, int y) const
33 {
34         xcell(0).draw(pi, x + 1, y);
35         drawMarkers2(pi, x, y);
36 }
37
38
39 void MathEnvInset::write(WriteStream & os) const
40 {
41         os << "\\begin{" << name_ << '}' << cell(0) << "\\end{" << name_ << '}';
42 }
43
44
45 void MathEnvInset::normalize(NormalStream & os) const
46 {
47         os << "[env " << name_ << " " << cell(0) << ']';
48 }
49
50
51 void MathEnvInset::infoize(std::ostream & os) const
52 {
53         os << "Env: " << name_;
54 }