2002-08-24 20:25:17 +00:00
|
|
|
/**
|
|
|
|
* \file insetoptarg.C
|
2002-09-25 14:26:13 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-08-23 09:05:32 +00:00
|
|
|
*
|
2002-12-01 22:59:25 +00:00
|
|
|
* \author Martin Vermeer
|
2002-09-25 14:26:13 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2002-08-24 20:25:17 +00:00
|
|
|
*/
|
2002-08-23 09:05:32 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
#include "insetoptarg.h"
|
|
|
|
#include "support/LOstream.h"
|
|
|
|
#include "frontends/Alert.h"
|
2002-08-24 20:25:17 +00:00
|
|
|
#include "support/lstrings.h" // frontStrip, strip
|
2002-08-23 09:05:32 +00:00
|
|
|
#include "lyxtext.h"
|
|
|
|
#include "buffer.h"
|
|
|
|
#include "gettext.h"
|
|
|
|
#include "BufferView.h"
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
|
|
|
using std::ostream;
|
|
|
|
using std::vector;
|
|
|
|
using std::pair;
|
|
|
|
|
|
|
|
InsetOptArg::InsetOptArg(BufferParams const & ins)
|
|
|
|
: InsetCollapsable(ins, true)
|
|
|
|
{
|
2002-08-24 20:25:17 +00:00
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
2002-08-23 09:05:32 +00:00
|
|
|
font.setColor(LColor::collapsable);
|
|
|
|
setLabelFont(font);
|
|
|
|
setLabel(_("opt"));
|
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2002-08-23 09:05:32 +00:00
|
|
|
InsetOptArg::InsetOptArg(InsetOptArg const & in, bool same_id)
|
2002-08-24 20:25:17 +00:00
|
|
|
: InsetCollapsable(in, same_id)
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2002-08-24 20:25:17 +00:00
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
2002-08-23 09:05:32 +00:00
|
|
|
font.setColor(LColor::collapsable);
|
|
|
|
setLabelFont(font);
|
|
|
|
setLabel(_("opt"));
|
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2002-08-23 09:05:32 +00:00
|
|
|
Inset * InsetOptArg::clone(Buffer const &, bool same_id) const
|
|
|
|
{
|
2002-08-24 20:25:17 +00:00
|
|
|
return new InsetOptArg(*this, same_id);
|
2002-08-23 09:05:32 +00:00
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2002-08-23 09:05:32 +00:00
|
|
|
string const InsetOptArg::editMessage() const
|
|
|
|
{
|
|
|
|
return _("Opened Optional Argument Inset");
|
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2002-08-23 09:05:32 +00:00
|
|
|
void InsetOptArg::write(Buffer const * buf, ostream & os) const
|
|
|
|
{
|
|
|
|
os << "OptArg" << "\n";
|
|
|
|
InsetCollapsable::write(buf, os);
|
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-08-23 09:05:32 +00:00
|
|
|
int InsetOptArg::latex(Buffer const *, ostream &, bool, bool) const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-08-23 09:05:32 +00:00
|
|
|
int InsetOptArg::latexOptional(Buffer const * buf, ostream & os,
|
|
|
|
bool, bool fp) const
|
|
|
|
{
|
|
|
|
os << '[';
|
|
|
|
int const i = inset.latex(buf, os, false, fp);
|
|
|
|
os << ']';
|
|
|
|
return i + 2;
|
|
|
|
}
|