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