]> git.lyx.org Git - lyx.git/blob - src/insets/insetfoot.C
79fbcc83d02f3485640779f7017b38b08e711d9c
[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 "lyxscreen.h"
21 #include "Painter.h"
22
23
24 InsetFoot::InsetFoot(Buffer * bf): InsetCollapsable(bf)
25 {
26     setLabel(_("foot"));
27     LyXFont font(LyXFont::ALL_SANE);
28     font.decSize();
29     font.decSize();
30     font.setColor(LColor::footnote);
31     setLabelFont(font);
32     setAutoCollapse(false);
33 }
34
35
36 Inset * InsetFoot::Clone() const
37 {
38     Inset * result = new InsetFoot(buffer);
39     return result;
40 }
41
42
43 char const * InsetFoot::EditMessage() const
44 {
45     return _("Opened Footnote Inset");
46 }
47
48
49 int InsetFoot::Latex(ostream & os, signed char fragile, bool fp) const
50 {
51         if (fragile) 
52                 os << "\\footnotetext{";
53         else 
54                 os << "\\footnote{";
55         
56         int i = InsetText::Latex(os, fragile, fp);
57         os << "}";
58         
59         return i;
60 }
61
62
63 void InsetFoot::Write(ostream & os) const
64 {
65         os << "Foot\n"
66            << "\ncollapsed ";
67         if (display())
68                 os << "false\n";
69         else
70                 os << "true\n";
71         WriteParagraphData(os);
72 }
73
74
75 void InsetFoot::Read(LyXLex & lex)
76 {
77     if (lex.IsOK()) {
78         lex.next();
79         string token = lex.GetString();
80         if (token == "collapsed") {
81             lex.next();
82             collapsed = lex.GetBool();
83         }
84     }
85     InsetText::Read(lex);
86 }
87
88
89 bool InsetFoot::InsertInset(BufferView * bv, Inset * inset)
90 {
91     if ((inset->LyxCode() == Inset::FOOT_CODE) ||
92         (inset->LyxCode() == Inset::MARGIN_CODE)) {
93         return false;
94     }
95     return InsetText::InsertInset(bv, inset);
96 }