]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathFBox.cpp
make index label translatable
[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 bool 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         if (dim_ == dim)
47                 return false;
48         dim_ = dim;
49         return true;
50 }
51
52
53 void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const
54 {
55         pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
56                 dim_.width() - 2, dim_.height() - 2, Color::foreground);
57         FontSetChanger dummy(pi.base, "textnormal");
58         cell(0).draw(pi, x + 3, y);
59         setPosCache(pi, x, y);
60 }
61
62
63 void InsetMathFBox::write(WriteStream & os) const
64 {
65         os << "\\fbox{" << cell(0) << '}';
66 }
67
68
69 void InsetMathFBox::normalize(NormalStream & os) const
70 {
71         os << "[fbox " << cell(0) << ']';
72 }
73
74
75 void InsetMathFBox::infoize(odocstream & os) const
76 {
77         os << "FBox: ";
78 }
79
80
81 } // namespace lyx