]> git.lyx.org Git - lyx.git/blob - src/insets/insetoptarg.C
another fix
[lyx.git] / src / insets / insetoptarg.C
1 /**
2  * \file insetoptarg.C
3  * Copyright 2002 the LyX Team
4  * Read the file COPYING
5  *
6  * \author Martin Vermeer  <martin.vermeer@hut.fi>
7  */
8
9 #include <config.h>
10
11 #ifdef __GNUG__
12 #pragma implementation
13 #endif
14
15 #include "debug.h"
16
17 #include "insetoptarg.h"
18 #include "support/LOstream.h"
19 #include "frontends/Alert.h"
20 #include "support/lstrings.h" // frontStrip, strip
21 #include "lyxtext.h"
22 #include "buffer.h"
23 #include "gettext.h"
24 #include "BufferView.h"
25 #include "support/lstrings.h"
26
27 using std::ostream;
28 using std::vector;
29 using std::pair;
30
31 InsetOptArg::InsetOptArg(BufferParams const & ins)
32         : InsetCollapsable(ins, true)
33 {
34         LyXFont font(LyXFont::ALL_SANE);
35         font.setColor(LColor::collapsable);
36         setLabelFont(font);
37         setLabel(_("opt"));
38 }
39
40
41 InsetOptArg::InsetOptArg(InsetOptArg const & in, bool same_id)
42         : InsetCollapsable(in, same_id)
43 {
44         LyXFont font(LyXFont::ALL_SANE);
45         font.setColor(LColor::collapsable);
46         setLabelFont(font);
47         setLabel(_("opt"));
48 }
49
50
51 Inset * InsetOptArg::clone(Buffer const &, bool same_id) const
52 {
53         return new InsetOptArg(*this, same_id);
54 }
55
56
57 string const InsetOptArg::editMessage() const
58 {
59         return _("Opened Optional Argument Inset");
60 }
61
62
63 void InsetOptArg::write(Buffer const * buf, ostream & os) const
64 {
65         os << "OptArg" << "\n";
66         InsetCollapsable::write(buf, os);
67 }
68
69  
70 int InsetOptArg::latex(Buffer const *, ostream &, bool, bool) const
71 {
72         return 0;
73 }
74
75  
76 int InsetOptArg::latexOptional(Buffer const * buf, ostream & os,
77                                 bool, bool fp) const
78 {
79         os << '[';
80         int const i = inset.latex(buf, os, false, fp);
81         os << ']';
82         return i + 2;
83 }