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