]> git.lyx.org Git - lyx.git/blob - src/insets/insetfoot.C
Added a preliminary NOT working insettabular. Lot's of fixes for the text
[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 #include "support/LOstream.h"
23
24 using std::ostream;
25
26 InsetFoot::InsetFoot(Buffer * bf)
27                 : InsetCollapsable(bf)
28 {
29     setLabel(_("foot"));
30     LyXFont font(LyXFont::ALL_SANE);
31     font.decSize();
32     font.decSize();
33     font.setColor(LColor::footnote);
34     setLabelFont(font);
35     setAutoCollapse(false);
36     setInsetName("Foot");
37 }
38
39
40 Inset * InsetFoot::Clone() const
41 {
42     InsetFoot * result = new InsetFoot(buffer);
43     result->init(buffer, this);
44
45     result->collapsed = collapsed;
46     return result;
47 }
48
49
50 char const * InsetFoot::EditMessage() const
51 {
52     return _("Opened Footnote Inset");
53 }
54
55
56 int InsetFoot::Latex(ostream & os, bool fragile, bool fp) const
57 {
58     if (fragile) 
59         os << "\\footnote{"; // was footnotemark but that won't work
60     else 
61         os << "\\footnote{";
62     
63     int i = InsetText::Latex(os, fragile, fp);
64     os << "}";
65     
66     return i;
67 }
68
69
70 bool InsetFoot::InsertInset(BufferView * bv, Inset * inset)
71 {
72     if (!InsertInsetAllowed(inset))
73         return false;
74
75     return InsetText::InsertInset(bv, inset);
76 }
77
78 bool InsetFoot::InsertInsetAllowed(Inset * inset) const
79 {
80     if ((inset->LyxCode() == Inset::FOOT_CODE) ||
81         (inset->LyxCode() == Inset::MARGIN_CODE)) {
82         return false;
83     }
84     return true;
85 }
86
87 LyXFont InsetFoot::GetDrawFont(LyXParagraph * par, int pos) const
88 {
89     LyXFont fn = InsetCollapsable::GetDrawFont(par, pos);
90     fn.decSize();
91     fn.decSize();
92     return fn;
93 }