]> git.lyx.org Git - lyx.git/blob - src/insets/insetfoot.C
Changes to make text-inset work better (f.ex. cursor), and now we have
[lyx.git] / src / insets / insetfoot.C
1 /* This file is part of
2  * ======================================================
3  * 
4  *           LyX, The Document Processor
5  *       
6  *          Copyright 1998 The LyX Team.
7  *
8  *======================================================*/
9
10 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "insetfoot.h"
17 #include "gettext.h"
18 #include "lyxfont.h"
19 #include "BufferView.h"
20 #include "Painter.h"
21 #include "support/LOstream.h"
22
23 using std::ostream;
24 using std::endl;
25
26 InsetFoot::InsetFoot() : InsetCollapsable()
27 {
28     setLabel(_("foot"));
29     LyXFont font(LyXFont::ALL_SANE);
30     font.decSize();
31     font.decSize();
32     font.setColor(LColor::footnote);
33     setLabelFont(font);
34     setAutoCollapse(false);
35     setInsetName("Foot");
36 }
37
38
39 Inset * InsetFoot::Clone() const
40 {
41     InsetFoot * result = new InsetFoot();
42     result->init(this);
43
44     result->collapsed = collapsed;
45     return result;
46 }
47
48
49 char const * InsetFoot::EditMessage() const
50 {
51     return _("Opened Footnote Inset");
52 }
53
54
55 int InsetFoot::Latex(Buffer const * buf, ostream & os, bool fragile, bool fp) const
56 {
57     os << "\\footnote{%" << endl;
58     
59     int i = InsetText::Latex(buf, os, fragile, fp);
60     os << "}%" << endl;
61     
62     return i + 2;
63 }
64
65
66 bool InsetFoot::InsertInset(BufferView * bv, Inset * inset)
67 {
68     if (!InsertInsetAllowed(inset))
69         return false;
70
71     return InsetText::InsertInset(bv, inset);
72 }
73
74
75 bool InsetFoot::InsertInsetAllowed(Inset * inset) const
76 {
77     if ((inset->LyxCode() == Inset::FOOT_CODE) ||
78         (inset->LyxCode() == Inset::MARGIN_CODE)) {
79         return false;
80     }
81     return true;
82 }
83
84
85 LyXFont InsetFoot::GetDrawFont(Buffer const * buf, LyXParagraph * p, int pos) const
86 {
87     LyXFont fn = InsetCollapsable::GetDrawFont(buf, p, pos);
88     fn.decSize().decSize();
89     return fn;
90 }