2002-09-25 14:26:13 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file insettheorem.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:09:55 +00:00
|
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2002-03-21 17:09:55 +00:00
|
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS
|
2000-07-04 19:16:35 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "insettheorem.h"
|
|
|
|
|
#include "gettext.h"
|
|
|
|
|
#include "lyxfont.h"
|
|
|
|
|
#include "BufferView.h"
|
|
|
|
|
#include "lyxtext.h"
|
|
|
|
|
#include "support/LOstream.h"
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include "insets/insettext.h"
|
|
|
|
|
|
|
|
|
|
using std::ostream;
|
|
|
|
|
using std::endl;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
The intention is to be able to create arbitrary theorem like environments
|
|
|
|
|
sing this class and some helper/container classes. It should be possible
|
|
|
|
|
to create these theorems both from layout file and interactively by the
|
|
|
|
|
user.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
InsetTheorem::InsetTheorem()
|
|
|
|
|
: InsetCollapsable()
|
|
|
|
|
{
|
|
|
|
|
setLabel(_("theorem"));
|
|
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
|
|
|
|
font.decSize();
|
|
|
|
|
font.decSize();
|
2001-06-05 17:05:51 +00:00
|
|
|
|
font.setColor(LColor::collapsable);
|
2000-07-04 19:16:35 +00:00
|
|
|
|
setLabelFont(font);
|
2001-07-24 22:08:49 +00:00
|
|
|
|
#if 0
|
2000-07-04 19:16:35 +00:00
|
|
|
|
setAutoCollapse(false);
|
2001-07-24 22:08:49 +00:00
|
|
|
|
#endif
|
2000-07-04 19:16:35 +00:00
|
|
|
|
setInsetName("Theorem");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-03-21 17:09:55 +00:00
|
|
|
|
void InsetTheorem::write(Buffer const * buf, ostream & os) const
|
2000-07-04 19:16:35 +00:00
|
|
|
|
{
|
|
|
|
|
os << getInsetName() << "\n";
|
2001-06-28 10:25:20 +00:00
|
|
|
|
InsetCollapsable::write(buf, os);
|
2000-07-04 19:16:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-06-03 15:10:14 +00:00
|
|
|
|
Inset * InsetTheorem::clone() const
|
2000-07-04 19:16:35 +00:00
|
|
|
|
{
|
2002-03-19 09:47:34 +00:00
|
|
|
|
#ifdef WITH_WARNINGS
|
2001-07-06 15:57:54 +00:00
|
|
|
|
#warning Is this inset used? If YES this is WRONG!!! (Jug)
|
2002-03-19 09:47:34 +00:00
|
|
|
|
#endif
|
2000-07-04 19:16:35 +00:00
|
|
|
|
InsetTheorem * result = new InsetTheorem;
|
2002-03-21 17:09:55 +00:00
|
|
|
|
|
2001-07-12 14:35:38 +00:00
|
|
|
|
result->collapsed_ = collapsed_;
|
2000-07-04 19:16:35 +00:00
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
|
string const InsetTheorem::editMessage() const
|
2000-07-04 19:16:35 +00:00
|
|
|
|
{
|
|
|
|
|
return _("Opened Theorem Inset");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-05-22 22:44:30 +00:00
|
|
|
|
int InsetTheorem::latex(Buffer const * buf, ostream & os,
|
2003-05-23 08:59:47 +00:00
|
|
|
|
LatexRunParams const & runparams) const
|
2000-07-04 19:16:35 +00:00
|
|
|
|
{
|
|
|
|
|
os << "\\begin{theorem}%\n";
|
2002-03-21 17:09:55 +00:00
|
|
|
|
|
2003-05-23 08:59:47 +00:00
|
|
|
|
int i = inset.latex(buf, os, runparams);
|
2000-07-04 19:16:35 +00:00
|
|
|
|
os << "\\end{theorem}%\n";
|
2002-03-21 17:09:55 +00:00
|
|
|
|
|
2000-07-04 19:16:35 +00:00
|
|
|
|
return i + 2;
|
|
|
|
|
}
|