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