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