]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathEnv.cpp
* src/frontends/controllers/Dialog.{cpp,h}:
[lyx.git] / src / mathed / InsetMathEnv.cpp
1 /**
2  * \file InsetMathEnv.cpp
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 "InsetMathEnv.h"
14 #include "MathData.h"
15 #include "MathStream.h"
16 #include "MathStream.h"
17 #include "support/std_ostream.h"
18
19
20 namespace lyx {
21
22
23 using std::string;
24 using std::auto_ptr;
25
26
27 InsetMathEnv::InsetMathEnv(docstring const & name)
28         : InsetMathNest(1), name_(name)
29 {}
30
31
32 auto_ptr<Inset> InsetMathEnv::doClone() const
33 {
34         return auto_ptr<Inset>(new InsetMathEnv(*this));
35 }
36
37
38 bool InsetMathEnv::metrics(MetricsInfo & mi, Dimension & dim) const
39 {
40         cell(0).metrics(mi, dim);
41         metricsMarkers(dim);
42         if (dim_ == dim)
43                 return false;
44         dim_ = dim;
45         return true;
46 }
47
48
49 void InsetMathEnv::draw(PainterInfo & pi, int x, int y) const
50 {
51         cell(0).draw(pi, x + 1, y);
52         drawMarkers(pi, x, y);
53 }
54
55
56 void InsetMathEnv::write(WriteStream & os) const
57 {
58         os << "\\begin{" << name_ << '}' << cell(0) << "\\end{" << name_ << '}';
59 }
60
61
62 void InsetMathEnv::normalize(NormalStream & os) const
63 {
64         os << "[env " << name_ << ' ' << cell(0) << ']';
65 }
66
67
68 void InsetMathEnv::infoize(odocstream & os) const
69 {
70         os << "Env: " << name_;
71 }
72
73
74 } // namespace lyx