]> git.lyx.org Git - lyx.git/blob - src/insets/insetfoot.C
05087bb391d89c445e881e4b027744ceaf66d197
[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     InsetFoot * result = new InsetFoot(buffer);
39     result->init(buffer, par);
40
41     return result;
42 }
43
44
45 char const * InsetFoot::EditMessage() const
46 {
47     return _("Opened Footnote Inset");
48 }
49
50
51 int InsetFoot::Latex(ostream & os, signed char fragile, bool fp) const
52 {
53         if (fragile) 
54                 os << "\\footnotetext{";
55         else 
56                 os << "\\footnote{";
57         
58         int i = InsetText::Latex(os, fragile, fp);
59         os << "}";
60         
61         return i;
62 }
63
64
65 void InsetFoot::Write(ostream & os) const
66 {
67         os << "Foot\n"
68            << "\ncollapsed ";
69         if (display())
70                 os << "false\n";
71         else
72                 os << "true\n";
73         WriteParagraphData(os);
74 }
75
76
77 void InsetFoot::Read(LyXLex & lex)
78 {
79     if (lex.IsOK()) {
80         lex.next();
81         string token = lex.GetString();
82         if (token == "collapsed") {
83             lex.next();
84             collapsed = lex.GetBool();
85         }
86     }
87     InsetText::Read(lex);
88 }
89
90
91 bool InsetFoot::InsertInset(BufferView * bv, Inset * inset)
92 {
93     if ((inset->LyxCode() == Inset::FOOT_CODE) ||
94         (inset->LyxCode() == Inset::MARGIN_CODE)) {
95         return false;
96     }
97     return InsetText::InsertInset(bv, inset);
98 }