]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathEnv.cpp
Remove hardcoded values
[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
15 #include "MathData.h"
16 #include "MathStream.h"
17 #include "MathStream.h"
18
19 #include "MetricsInfo.h"
20
21 #include "support/gettext.h"
22 #include "support/lstrings.h"
23
24 #include <ostream>
25
26 using namespace lyx::support;
27
28 namespace lyx {
29
30 InsetMathEnv::InsetMathEnv(Buffer * buf, docstring const & name)
31         : InsetMathNest(buf, 1), name_(name)
32 {}
33
34
35 Inset * InsetMathEnv::clone() const
36 {
37         return new InsetMathEnv(*this);
38 }
39
40
41 void InsetMathEnv::metrics(MetricsInfo & mi, Dimension & dim) const
42 {
43         Changer dummy = mi.base.changeEnsureMath();
44         cell(0).metrics(mi, dim);
45         metricsMarkers(mi, dim);
46 }
47
48
49 void InsetMathEnv::draw(PainterInfo & pi, int x, int y) const
50 {
51         Changer dummy = pi.base.changeEnsureMath();
52         cell(0).draw(pi, x + 1, y);
53         drawMarkers(pi, x, y);
54 }
55
56
57 void InsetMathEnv::write(WriteStream & os) const
58 {
59         MathEnsurer ensurer(os);
60         os << "\\begin{" << name_ << '}' << cell(0) << "\\end{" << name_ << '}';
61 }
62
63
64 void InsetMathEnv::normalize(NormalStream & os) const
65 {
66         os << "[env " << name_ << ' ' << cell(0) << ']';
67 }
68
69
70 void InsetMathEnv::infoize(odocstream & os) const
71 {
72         os << bformat(_("Environment: %1$s"), name_);
73 }
74
75
76 } // namespace lyx