]> git.lyx.org Git - lyx.git/blob - src/insets/insetert.C
4b95d37706419a7df38f3157ac6b3e4b8fb76715
[lyx.git] / src / insets / insetert.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 "insetert.h"
17 #include "gettext.h"
18 #include "lyxfont.h"
19 #include "Painter.h"
20 #include "buffer.h"
21 //#include "lyx_gui_misc.h"
22
23 using std::ostream;
24
25 InsetERT::InsetERT(Buffer * bf)
26         : InsetCollapsable(bf)
27 {
28     setLabel(_("ERT"));
29     LyXFont font(LyXFont::ALL_SANE);
30     font.setLatex (LyXFont::ON);
31     real_current_font = current_font = font;
32     LyXFont labelfont(LyXFont::ALL_SANE);
33     labelfont.decSize();
34     labelfont.decSize();
35     labelfont.setColor(LColor::ert);
36     setLabelFont(labelfont);
37     setAutoCollapse(false);
38 }
39
40
41 Inset * InsetERT::Clone() const
42 {
43     InsetERT * result = new InsetERT(buffer);
44     return result;
45 }
46
47
48 void InsetERT::Write(ostream & os) const
49 {
50     os << "ERT\n";
51     WriteParagraphData(os);
52 }
53
54
55 char const * InsetERT::EditMessage() const 
56 {
57         return _("Opened ERT Inset");
58 }
59
60
61 bool InsetERT::InsertInset(BufferView *, Inset *)
62 {
63     return false;
64 }
65
66
67 void InsetERT::SetFont(BufferView *, LyXFont const &, bool)
68 {
69     WriteAlert(_("Impossible Operation!"),
70                _("Not permitted to change font-types inside ERT-insets!"),
71                _("Sorry."));
72 }
73
74 void InsetERT::Edit(BufferView * bv, int x, int y, unsigned int button)
75 {
76     InsetCollapsable::Edit(bv, x, y, button);
77     LyXFont font(LyXFont::ALL_SANE);
78     font.setLatex (LyXFont::ON);
79     current_font = real_current_font = font;
80 }