]> git.lyx.org Git - lyx.git/blob - src/insets/insetfootlike.C
* src/LyXAction.C: mark goto-clear-bookmark as working without buffer
[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
23 namespace lyx {
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 bool 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         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         LyXFont 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(getInsetName()) << "\n";
71         InsetCollapsable::write(buf, os);
72 }
73
74
75 bool InsetFootlike::insetAllowed(InsetBase::Code code) const
76 {
77         if (code == InsetBase::FOOT_CODE || code == InsetBase::MARGIN_CODE
78             || code == InsetBase::FLOAT_CODE)
79                 return false;
80         return InsetCollapsable::insetAllowed(code);
81 }
82
83
84 } // namespace lyx