]> git.lyx.org Git - lyx.git/blob - src/insets/insetnote.C
fix insertion of raw double quote, reading of Info inset, initial width of collapsed...
[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 "debug.h"
26
27 using std::ostream;
28
29 void InsetNote::init()
30 {
31         LyXFont font(LyXFont::ALL_SANE);
32         font.decSize();
33         font.setColor(LColor::note);
34         setLabelFont(font);
35         setAutoCollapse(false);
36
37         setLabel(_("note"));
38         setInsetName("Note");
39 }
40
41 InsetNote::InsetNote()
42         : InsetCollapsable()
43 {
44         init();
45 }
46
47 InsetNote::InsetNote(Buffer const * buf, string const & contents, 
48                      bool collapsed)
49         : InsetCollapsable(collapsed)
50 {
51         init();
52
53         Paragraph * par = inset.paragraph();
54         Paragraph::size_type pos = 0;
55         buf->insertStringAsLines(par, pos, labelfont, contents);
56 }
57
58 Inset * InsetNote::clone(Buffer const &, bool same_id) const
59 {
60         InsetNote * result = new InsetNote;
61         result->inset.init(&inset, same_id);
62
63         result->collapsed_ = collapsed_;
64         if (same_id)
65                 result->id_ = id_;
66         return result;
67 }
68
69
70 string const InsetNote::editMessage() const 
71 {
72         return _("Opened Note Inset");
73 }
74
75
76 void InsetNote::write(Buffer const *buf, ostream & os) const
77 {
78         os << getInsetName() << "\n";
79         InsetCollapsable::write(buf, os);
80 }