]> git.lyx.org Git - lyx.git/blob - src/insets/insetnote.C
Added copy constructor to inset.h and used it in most insets which permit
[lyx.git] / src / insets / insetnote.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 "insetnote.h"
18 #include "gettext.h"
19 #include "lyxfont.h"
20 #include "buffer.h"
21 #include "BufferView.h"
22 #include "lyxtext.h"
23 #include "insets/insettext.h"
24 #include "support/LOstream.h"
25 #include "support/lstrings.h"
26 #include "debug.h"
27
28 using std::ostream;
29
30 void InsetNote::init()
31 {
32         LyXFont font(LyXFont::ALL_SANE);
33         font.decSize();
34         font.setColor(LColor::note);
35         setLabelFont(font);
36
37         setAutoCollapse(false);
38         setBackgroundColor(LColor::note);
39
40         setLabel(_("note"));
41         setInsetName("Note");
42 }
43
44
45 InsetNote::InsetNote()
46         : InsetCollapsable()
47 {
48         init();
49 }
50
51
52 InsetNote::InsetNote(Buffer const * buf, string const & contents, 
53                      bool collapsed)
54         : InsetCollapsable(collapsed)
55 {
56         init();
57
58         Paragraph * par = inset.paragraph();
59         Paragraph::size_type pos = 0;
60         buf->insertStringAsLines(par, pos, LyXFont(LyXFont::ALL_INHERIT), 
61                                  strip(contents, '\n'));
62 }
63
64
65 string const InsetNote::editMessage() const 
66 {
67         return _("Opened Note Inset");
68 }
69
70
71 void InsetNote::write(Buffer const *buf, ostream & os) const
72 {
73         os << getInsetName() << "\n";
74         InsetCollapsable::write(buf, os);
75 }