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
|
|
|
*
|
2003-08-23 00:17:00 +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;
|
2003-07-25 17:11:25 +00:00
|
|
|
using std::auto_ptr;
|
|
|
|
|
2002-08-23 09:05:32 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2003-05-26 09:13:55 +00:00
|
|
|
InsetOptArg::InsetOptArg(InsetOptArg const & in)
|
|
|
|
: InsetCollapsable(in)
|
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
|
|
|
|
2003-07-25 17:11:25 +00:00
|
|
|
auto_ptr<InsetBase> InsetOptArg::clone() const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2003-07-25 17:11:25 +00:00
|
|
|
return auto_ptr<InsetBase>(new InsetOptArg(*this));
|
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
|
|
|
|
2003-05-23 08:59:47 +00:00
|
|
|
int InsetOptArg::latex(Buffer const *, ostream &,
|
|
|
|
LatexRunParams const &) const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
|
|
|
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,
|
2003-05-23 08:59:47 +00:00
|
|
|
LatexRunParams const & runparams) const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
|
|
|
os << '[';
|
2003-05-23 08:59:47 +00:00
|
|
|
int const i = inset.latex(buf, os, runparams);
|
2002-08-23 09:05:32 +00:00
|
|
|
os << ']';
|
|
|
|
return i + 2;
|
|
|
|
}
|