]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFootlike.cpp
Fix text frame drawing.
[lyx.git] / src / insets / InsetFootlike.cpp
1 /**
2  * \file InsetFootlike.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "InsetFootlike.h"
14
15 #include "Buffer.h"
16 #include "BufferView.h"
17 #include "BufferParams.h"
18 #include "MetricsInfo.h"
19
20
21 namespace lyx {
22
23
24 InsetFootlike::InsetFootlike(BufferParams const & bp)
25         : InsetCollapsable(bp)
26 {}
27
28
29 InsetFootlike::InsetFootlike(InsetFootlike const & in)
30         : InsetCollapsable(in)
31 {}
32
33
34 bool InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
35 {
36         Font tmpfont = mi.base.font;
37         mi.base.font = mi.base.bv->buffer().params().getFont();
38         InsetCollapsable::metrics(mi, dim);
39         mi.base.font = tmpfont;
40         bool const changed = dim_ != dim;
41         dim_ = dim;
42         return changed;
43 }
44
45
46 void InsetFootlike::draw(PainterInfo & pi, int x, int y) const
47 {
48         Font tmpfont = pi.base.font;
49         pi.base.font = pi.base.bv->buffer().params().getFont();
50         InsetCollapsable::draw(pi, x, y);
51         pi.base.font = tmpfont;
52 }
53
54
55 void InsetFootlike::write(Buffer const & buf, std::ostream & os) const
56 {
57         os << to_utf8(name()) << "\n";
58         InsetCollapsable::write(buf, os);
59 }
60
61
62 bool InsetFootlike::insetAllowed(Inset::Code code) const
63 {
64         if (code == Inset::FOOT_CODE || code == Inset::MARGIN_CODE
65             || code == Inset::FLOAT_CODE)
66                 return false;
67         return InsetCollapsable::insetAllowed(code);
68 }
69
70
71 } // namespace lyx