]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathFBox.cpp
adjust
[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 InsetMathFBox::InsetMathFBox()
25         : InsetMathNest(1)
26 {}
27
28
29 Inset * InsetMathFBox::clone() const
30 {
31         return new InsetMathFBox(*this);
32 }
33
34
35 InsetMath::mode_type InsetMathFBox::currentMode() const
36 {
37         return TEXT_MODE;
38 }
39
40
41 void InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const
42 {
43         FontSetChanger dummy(mi.base, "textnormal");
44         cell(0).metrics(mi, dim);
45         metricsMarkers(dim, 3); // 1 pixel space, 1 frame, 1 space
46         // Cache the inset dimension. 
47         setDimCache(mi, dim);
48 }
49
50
51 void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const
52 {
53         Dimension const dim = dimension(*pi.base.bv);
54         pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
55                 dim.width() - 2, dim.height() - 2, Color::foreground);
56         FontSetChanger dummy(pi.base, "textnormal");
57         cell(0).draw(pi, x + 3, y);
58         setPosCache(pi, x, y);
59 }
60
61
62 void InsetMathFBox::write(WriteStream & os) const
63 {
64         os << "\\fbox{" << cell(0) << '}';
65 }
66
67
68 void InsetMathFBox::normalize(NormalStream & os) const
69 {
70         os << "[fbox " << cell(0) << ']';
71 }
72
73
74 void InsetMathFBox::infoize(odocstream & os) const
75 {
76         os << "FBox: ";
77 }
78
79
80 } // namespace lyx