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