]> git.lyx.org Git - lyx.git/blob - src/insets/insetnote.C
a27c71c0ce6a30c0285bc0f7fd9c68f0edee9261
[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 #if 0
37         setAutoCollapse(false);
38 #endif
39         setBackgroundColor(LColor::note);
40
41         setLabel(_("note"));
42         setInsetName("Note");
43 }
44
45
46 InsetNote::InsetNote()
47         : InsetCollapsable()
48 {
49         init();
50 }
51
52
53 InsetNote::InsetNote(Buffer const * buf, string const & contents, 
54                      bool collapsed)
55         : InsetCollapsable(collapsed)
56 {
57         init();
58
59         Paragraph * par = inset.paragraph();
60         Paragraph::size_type pos = 0;
61         buf->insertStringAsLines(par, pos, LyXFont(LyXFont::ALL_INHERIT), 
62                                  strip(contents, '\n'));
63 }
64
65
66 string const InsetNote::editMessage() const 
67 {
68         return _("Opened Note Inset");
69 }
70
71
72 void InsetNote::write(Buffer const *buf, ostream & os) const
73 {
74         os << getInsetName() << "\n";
75         InsetCollapsable::write(buf, os);
76 }