2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file math_envinset.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2002-07-09 09:46:31 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "math_envinset.h"
|
2003-09-07 21:25:37 +00:00
|
|
|
|
#include "math_data.h"
|
2002-07-09 09:46:31 +00:00
|
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
|
#include "math_streamstr.h"
|
2003-09-05 17:23:11 +00:00
|
|
|
|
#include "support/std_ostream.h"
|
2002-07-09 09:46:31 +00:00
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
|
|
|
|
|
using std::string;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
|
|
|
|
|
2002-07-09 09:46:31 +00:00
|
|
|
|
|
|
|
|
|
MathEnvInset::MathEnvInset(string const & name)
|
|
|
|
|
: MathNestInset(1), name_(name)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2003-07-25 17:11:25 +00:00
|
|
|
|
auto_ptr<InsetBase> MathEnvInset::clone() const
|
2002-07-09 09:46:31 +00:00
|
|
|
|
{
|
2003-07-25 17:11:25 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new MathEnvInset(*this));
|
2002-07-09 09:46:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-06-02 10:03:27 +00:00
|
|
|
|
void MathEnvInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
2002-07-09 09:46:31 +00:00
|
|
|
|
{
|
2003-05-28 13:22:36 +00:00
|
|
|
|
cell(0).metrics(mi, dim_);
|
|
|
|
|
metricsMarkers();
|
2003-06-02 10:03:27 +00:00
|
|
|
|
dim = dim_;
|
2002-07-09 09:46:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-03-21 14:20:48 +00:00
|
|
|
|
void MathEnvInset::draw(PainterInfo & pi, int x, int y) const
|
2002-07-09 09:46:31 +00:00
|
|
|
|
{
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathEnvInset::write(WriteStream & os) const
|
|
|
|
|
{
|
|
|
|
|
os << "\\begin{" << name_ << '}' << cell(0) << "\\end{" << name_ << '}';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathEnvInset::normalize(NormalStream & os) const
|
|
|
|
|
{
|
2002-11-27 10:30:28 +00:00
|
|
|
|
os << "[env " << name_ << ' ' << cell(0) << ']';
|
2002-07-09 09:46:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathEnvInset::infoize(std::ostream & os) const
|
|
|
|
|
{
|
|
|
|
|
os << "Env: " << name_;
|
|
|
|
|
}
|