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