2003-08-19 13:00:56 +00:00
|
|
|
/**
|
2007-04-25 03:01:35 +00:00
|
|
|
* \file InsetMathEnv.cpp
|
2003-08-19 13:00:56 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2003-08-19 13:00:56 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2002-07-09 09:46:31 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "InsetMathEnv.h"
|
2007-11-06 21:45:24 +00:00
|
|
|
|
2007-04-26 16:05:57 +00:00
|
|
|
#include "MathData.h"
|
2006-10-22 10:15:23 +00:00
|
|
|
#include "MathStream.h"
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "MathStream.h"
|
2007-11-06 21:45:24 +00:00
|
|
|
|
2016-11-22 10:26:15 +00:00
|
|
|
#include "MetricsInfo.h"
|
|
|
|
|
2014-11-14 17:18:30 +00:00
|
|
|
#include "support/gettext.h"
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
2008-05-06 10:36:32 +00:00
|
|
|
#include <ostream>
|
|
|
|
|
2014-11-14 17:18:30 +00:00
|
|
|
using namespace lyx::support;
|
2003-10-06 15:43:21 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2009-11-08 11:45:46 +00:00
|
|
|
InsetMathEnv::InsetMathEnv(Buffer * buf, docstring const & name)
|
|
|
|
: InsetMathNest(buf, 1), name_(name)
|
2002-07-09 09:46:31 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2007-08-30 18:03:17 +00:00
|
|
|
Inset * InsetMathEnv::clone() const
|
2002-07-09 09:46:31 +00:00
|
|
|
{
|
2007-08-30 18:03:17 +00:00
|
|
|
return new InsetMathEnv(*this);
|
2002-07-09 09:46:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
void InsetMathEnv::metrics(MetricsInfo & mi, Dimension & dim) const
|
2002-07-09 09:46:31 +00:00
|
|
|
{
|
2016-11-22 10:26:15 +00:00
|
|
|
Changer dummy = mi.base.changeEnsureMath();
|
2004-01-30 11:41:12 +00:00
|
|
|
cell(0).metrics(mi, dim);
|
2016-11-14 17:01:56 +00:00
|
|
|
metricsMarkers(mi, dim);
|
2002-07-09 09:46:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
void InsetMathEnv::draw(PainterInfo & pi, int x, int y) const
|
2002-07-09 09:46:31 +00:00
|
|
|
{
|
2016-11-22 10:26:15 +00:00
|
|
|
Changer dummy = pi.base.changeEnsureMath();
|
2002-08-02 14:29:42 +00:00
|
|
|
cell(0).draw(pi, x + 1, y);
|
2003-05-28 13:22:36 +00:00
|
|
|
drawMarkers(pi, x, y);
|
2002-07-09 09:46:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
void InsetMathEnv::write(WriteStream & os) const
|
2002-07-09 09:46:31 +00:00
|
|
|
{
|
2008-06-17 11:10:43 +00:00
|
|
|
MathEnsurer ensurer(os);
|
2002-07-09 09:46:31 +00:00
|
|
|
os << "\\begin{" << name_ << '}' << cell(0) << "\\end{" << name_ << '}';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
void InsetMathEnv::normalize(NormalStream & os) const
|
2002-07-09 09:46:31 +00:00
|
|
|
{
|
2002-11-27 10:30:28 +00:00
|
|
|
os << "[env " << name_ << ' ' << cell(0) << ']';
|
2002-07-09 09:46:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
void InsetMathEnv::infoize(odocstream & os) const
|
2002-07-09 09:46:31 +00:00
|
|
|
{
|
2014-11-14 17:18:30 +00:00
|
|
|
os << bformat(_("Environment: %1$s"), name_);
|
2002-07-09 09:46:31 +00:00
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|