]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathBoxed.C
Fix comment according to Enricos explanation
[lyx.git] / src / mathed / InsetMathBoxed.C
1 /**
2  * \file InsetMathBoxed.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 "InsetMathBoxed.h"
14 #include "MathData.h"
15 #include "MathStream.h"
16 #include "MathParser.h"
17 #include "MathStream.h"
18 #include "LaTeXFeatures.h"
19 #include "LColor.h"
20
21 #include "support/std_ostream.h"
22 #include "frontends/Painter.h"
23
24
25 namespace lyx {
26
27 using std::auto_ptr;
28
29
30 InsetMathBoxed::InsetMathBoxed()
31         : InsetMathNest(1)
32 {}
33
34
35 auto_ptr<InsetBase> InsetMathBoxed::doClone() const
36 {
37         return auto_ptr<InsetBase>(new InsetMathBoxed(*this));
38 }
39
40
41 void InsetMathBoxed::metrics(MetricsInfo & mi, Dimension & dim) const
42 {
43         cell(0).metrics(mi, dim);
44         metricsMarkers2(dim, 3); // 1 pixel space, 1 frame, 1 space
45         dim_ = dim;
46 }
47
48
49 void InsetMathBoxed::draw(PainterInfo & pi, int x, int y) const
50 {
51         pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
52                 dim_.width() - 2, dim_.height() - 2, LColor::foreground);
53         cell(0).draw(pi, x + 3, y);
54         setPosCache(pi, x, y);
55 }
56
57
58 void InsetMathBoxed::write(WriteStream & os) const
59 {
60         os << "\\boxed{" << cell(0) << '}';
61 }
62
63
64 void InsetMathBoxed::normalize(NormalStream & os) const
65 {
66         os << "[boxed " << cell(0) << ']';
67 }
68
69
70 void InsetMathBoxed::infoize(odocstream & os) const
71 {
72         os << "Boxed: ";
73 }
74
75
76 void InsetMathBoxed::validate(LaTeXFeatures & features) const
77 {
78         features.require("amsmath");
79 }
80
81
82 } // namespace lyx