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