]> git.lyx.org Git - lyx.git/blob - src/insets/insetfootlike.C
Fix font inside inset (bugs 1766, 1809)
[lyx.git] / src / insets / insetfootlike.C
1 /**
2  * \file insetfootlike.C
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 "LColor.h"
17 #include "metricsinfo.h"
18 #include "paragraph.h"
19
20 using std::ostream;
21
22
23 InsetFootlike::InsetFootlike(BufferParams const & bp)
24         : InsetCollapsable(bp)
25 {
26         LyXFont font(LyXFont::ALL_SANE);
27         font.decSize();
28         font.decSize();
29         font.setColor(LColor::collapsable);
30         setLabelFont(font);
31 }
32
33
34 InsetFootlike::InsetFootlike(InsetFootlike const & in)
35         : InsetCollapsable(in)
36 {
37         LyXFont font(LyXFont::ALL_SANE);
38         font.decSize();
39         font.decSize();
40         font.setColor(LColor::collapsable);
41         setLabelFont(font);
42 }
43
44
45 void InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
46 {
47         LyXFont tmpfont = mi.base.font;
48         mi.base.font = LyXFont(LyXFont::ALL_SANE);
49         InsetCollapsable::metrics(mi, dim);
50         mi.base.font = tmpfont;
51         dim_ = dim;
52 }
53
54
55 void InsetFootlike::draw(PainterInfo & pi, int x, int y) const
56 {
57         LyXFont tmpfont = pi.base.font;
58         pi.base.font = LyXFont(LyXFont::ALL_SANE);
59         InsetCollapsable::draw(pi, x, y);
60         pi.base.font = tmpfont;
61 }
62
63
64 void InsetFootlike::write(Buffer const & buf, ostream & os) const
65 {
66         os << getInsetName() << "\n";
67         InsetCollapsable::write(buf, os);
68 }
69
70
71 bool InsetFootlike::insetAllowed(InsetBase::Code code) const
72 {
73         if (code == InsetBase::FOOT_CODE || code == InsetBase::MARGIN_CODE
74             || code == InsetBase::FLOAT_CODE)
75                 return false;
76         return InsetCollapsable::insetAllowed(code);
77 }