]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFootlike.cpp
following rev. 18724 boost/signal is not needed.
[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 "Color.h"
19 #include "MetricsInfo.h"
20 #include "Paragraph.h"
21
22
23 namespace lyx {
24
25 InsetFootlike::InsetFootlike(BufferParams const & bp)
26         : InsetCollapsable(bp)
27 {
28         Font font(Font::ALL_SANE);
29         font.decSize();
30         font.decSize();
31         font.setColor(Color::collapsable);
32         setLabelFont(font);
33 }
34
35
36 InsetFootlike::InsetFootlike(InsetFootlike const & in)
37         : InsetCollapsable(in)
38 {
39         Font font(Font::ALL_SANE);
40         font.decSize();
41         font.decSize();
42         font.setColor(Color::collapsable);
43         setLabelFont(font);
44 }
45
46
47 bool InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
48 {
49         Font tmpfont = mi.base.font;
50         mi.base.font = mi.base.bv->buffer()->params().getFont();
51         InsetCollapsable::metrics(mi, dim);
52         mi.base.font = tmpfont;
53         bool const changed = dim_ != dim;
54         dim_ = dim;
55         return changed;
56 }
57
58
59 void InsetFootlike::draw(PainterInfo & pi, int x, int y) const
60 {
61         Font tmpfont = pi.base.font;
62         pi.base.font = pi.base.bv->buffer()->params().getFont();
63         InsetCollapsable::draw(pi, x, y);
64         pi.base.font = tmpfont;
65 }
66
67
68 void InsetFootlike::write(Buffer const & buf, std::ostream & os) const
69 {
70         os << to_utf8(name()) << "\n";
71         InsetCollapsable::write(buf, os);
72 }
73
74
75 bool InsetFootlike::insetAllowed(Inset::Code code) const
76 {
77         if (code == Inset::FOOT_CODE || code == Inset::MARGIN_CODE
78             || code == Inset::FLOAT_CODE)
79                 return false;
80         return InsetCollapsable::insetAllowed(code);
81 }
82
83
84 } // namespace lyx