]> git.lyx.org Git - lyx.git/blob - src/insets/insetoptarg.C
setFont rework + some code simplification
[lyx.git] / src / insets / insetoptarg.C
1 /**
2  * \file insetoptarg.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Martin Vermeer
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "insetoptarg.h"
14
15 #include "debug.h"
16 #include "gettext.h"
17 #include "LColor.h"
18 #include "paragraph.h"
19
20
21 using std::string;
22 using std::auto_ptr;
23 using std::ostream;
24
25
26 InsetOptArg::InsetOptArg(BufferParams const & ins)
27         : InsetCollapsable(ins, true)
28 {
29         LyXFont font(LyXFont::ALL_SANE);
30         font.setColor(LColor::collapsable);
31         setLabelFont(font);
32         setLabel(_("opt"));
33 }
34
35
36 InsetOptArg::InsetOptArg(InsetOptArg const & in)
37         : InsetCollapsable(in)
38 {
39         LyXFont font(LyXFont::ALL_SANE);
40         font.setColor(LColor::collapsable);
41         setLabelFont(font);
42         setLabel(_("opt"));
43 }
44
45
46 auto_ptr<InsetBase> InsetOptArg::clone() const
47 {
48         return auto_ptr<InsetBase>(new InsetOptArg(*this));
49 }
50
51
52 string const InsetOptArg::editMessage() const
53 {
54         return _("Opened Optional Argument Inset");
55 }
56
57
58 void InsetOptArg::write(Buffer const & buf, ostream & os) const
59 {
60         os << "OptArg" << "\n";
61         InsetCollapsable::write(buf, os);
62 }
63
64
65 int InsetOptArg::latex(Buffer const &, ostream &,
66                        OutputParams const &) const
67 {
68         return 0;
69 }
70
71
72 int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
73                                OutputParams const & runparams) const
74 {
75         os << '[';
76         int const i = inset.latex(buf, os, runparams);
77         os << ']';
78         return i + 2;
79 }