]> git.lyx.org Git - lyx.git/blob - src/insets/insetmarginal.C
86bba7f28efcd51249a71be4cac387699f115792
[lyx.git] / src / insets / insetmarginal.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 "insetmarginal.h"
18 #include "gettext.h"
19 #include "lyxfont.h"
20 #include "BufferView.h"
21 #include "lyxtext.h"
22 #include "insets/insettext.h"
23 #include "support/LOstream.h"
24 #include "debug.h"
25
26 using std::ostream;
27 using std::endl;
28
29
30 InsetMarginal::InsetMarginal()
31         : InsetFootlike()
32 {
33         setLabel(_("margin"));
34         setInsetName("Marginal");
35 }
36
37
38 Inset * InsetMarginal::Clone() const
39 {
40     InsetMarginal * result = new InsetMarginal;
41     result->inset->init(inset);
42     
43     result->collapsed = collapsed;
44     return result;
45 }
46
47
48 char const * InsetMarginal::EditMessage() const
49 {
50         return _("Opened Marginal Note Inset");
51 }
52
53
54 int InsetMarginal::Latex(Buffer const * buf,
55                          ostream & os, bool fragile, bool fp) const
56 {
57     os << "\\marginpar{%\n";
58     
59     int i = inset->Latex(buf, os, fragile, fp);
60     os << "}%\n";
61     
62     return i + 2;
63 }
64
65
66 bool InsetMarginal::InsertInsetAllowed(Inset * in) const
67 {
68     if ((in->LyxCode() == Inset::FOOT_CODE) ||
69         (in->LyxCode() == Inset::MARGIN_CODE)) {
70         return false;
71     }
72     return true;
73 }
74
75
76 #if 0
77 LyXFont InsetMarginal::GetDrawFont(BufferView * bv,
78                                    LyXParagraph * p, int pos) const
79 {
80     LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
81     fn.decSize().decSize();
82     return fn;
83 }
84 #endif