]> git.lyx.org Git - lyx.git/blob - src/mathed/math_envinset.C
Fix event loop to no longer eat CPU
[lyx.git] / src / mathed / math_envinset.C
1 /**
2  * \file math_envinset.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_envinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_streamstr.h"
17 #include "support/std_ostream.h"
18
19
20 using std::string;
21 using std::auto_ptr;
22
23
24 MathEnvInset::MathEnvInset(string const & name)
25         : MathNestInset(1), name_(name)
26 {}
27
28
29 auto_ptr<InsetBase> MathEnvInset::doClone() const
30 {
31         return auto_ptr<InsetBase>(new MathEnvInset(*this));
32 }
33
34
35 void MathEnvInset::metrics(MetricsInfo & mi, Dimension & dim) const
36 {
37         cell(0).metrics(mi, dim);
38         metricsMarkers(dim);
39         dim_ = dim;
40 }
41
42
43 void MathEnvInset::draw(PainterInfo & pi, int x, int y) const
44 {
45         cell(0).draw(pi, x + 1, y);
46         drawMarkers(pi, x, y);
47 }
48
49
50 void MathEnvInset::write(WriteStream & os) const
51 {
52         os << "\\begin{" << name_ << '}' << cell(0) << "\\end{" << name_ << '}';
53 }
54
55
56 void MathEnvInset::normalize(NormalStream & os) const
57 {
58         os << "[env " << name_ << ' ' << cell(0) << ']';
59 }
60
61
62 void MathEnvInset::infoize(std::ostream & os) const
63 {
64         os << "Env: " << name_;
65 }