]> git.lyx.org Git - lyx.git/blob - src/insets/insetfoot.C
Some more changes for updating text-insets.
[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
11 #include <config.h>
12
13 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "insetfoot.h"
18 #include "gettext.h"
19 #include "lyxfont.h"
20 #include "BufferView.h"
21 #include "Painter.h"
22 #include "lyxtext.h"
23 #include "insets/insettext.h"
24 #include "support/LOstream.h"
25
26 using std::ostream;
27 using std::endl;
28
29 InsetFoot::InsetFoot() : InsetCollapsable()
30 {
31     setLabel(_("foot"));
32     LyXFont font(LyXFont::ALL_SANE);
33     font.decSize();
34     font.decSize();
35     font.setColor(LColor::footnote);
36     setLabelFont(font);
37     setAutoCollapse(false);
38     setInsetName("Foot");
39 }
40
41
42 void InsetFoot::Write(Buffer const * buf, ostream & os) const 
43 {
44     os << getInsetName() << "\n";
45     InsetCollapsable::Write(buf, os);
46 }
47
48
49 Inset * InsetFoot::Clone() const
50 {
51     InsetFoot * result = new InsetFoot;
52     result->inset->init(inset);
53
54     result->collapsed = collapsed;
55     return result;
56 }
57
58
59 char const * InsetFoot::EditMessage() const
60 {
61     return _("Opened Footnote Inset");
62 }
63
64
65 int InsetFoot::Latex(Buffer const * buf,
66                      ostream & os, bool fragile, bool fp) const
67 {
68     os << "\\footnote{%\n";
69     
70     int i = inset->Latex(buf, os, fragile, fp);
71     os << "}%\n";
72     
73     return i + 2;
74 }
75
76
77 bool InsetFoot::InsertInset(BufferView * bv, Inset * in)
78 {
79     if (!InsertInsetAllowed(in))
80         return false;
81
82     return inset->InsertInset(bv, in);
83 }
84
85
86 bool InsetFoot::InsertInsetAllowed(Inset * in) const
87 {
88     if ((in->LyxCode() == Inset::FOOT_CODE) ||
89         (in->LyxCode() == Inset::MARGIN_CODE)) {
90         return false;
91     }
92     return true;
93 }
94
95 #if 0
96 LyXFont InsetFoot::GetDrawFont(BufferView * bv,
97                                LyXParagraph * p, int pos) const
98 {
99     LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
100     fn.decSize().decSize();
101     return fn;
102 }
103 #endif