2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file math_diffinset.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.
|
|
|
|
|
*/
|
|
|
|
|
|
2003-08-02 11:30:30 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2001-11-13 16:27:06 +00:00
|
|
|
|
#include "math_diffinset.h"
|
2003-09-07 21:25:37 +00:00
|
|
|
|
#include "math_data.h"
|
2001-11-13 16:27:06 +00:00
|
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
2003-08-02 11:30:30 +00:00
|
|
|
|
using std::endl;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
|
2001-11-13 16:27:06 +00:00
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathDiff::InsetMathDiff()
|
|
|
|
|
: InsetMathNest(1)
|
2001-11-13 16:27:06 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
auto_ptr<InsetBase> InsetMathDiff::doClone() const
|
2001-11-13 16:27:06 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new InsetMathDiff(*this));
|
2001-11-13 16:27:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathDiff::addDer(MathArray const & der)
|
2001-11-13 16:27:06 +00:00
|
|
|
|
{
|
2002-08-02 14:29:42 +00:00
|
|
|
|
cells_.push_back(der);
|
2001-11-13 16:27:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathDiff::normalize(NormalStream & os) const
|
2001-11-13 16:27:06 +00:00
|
|
|
|
{
|
|
|
|
|
os << "[diff";
|
|
|
|
|
for (idx_type idx = 0; idx < nargs(); ++idx)
|
|
|
|
|
os << ' ' << cell(idx);
|
|
|
|
|
os << ']';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathDiff::metrics(MetricsInfo &, Dimension &) const
|
2001-11-13 16:27:06 +00:00
|
|
|
|
{
|
2003-08-02 11:30:30 +00:00
|
|
|
|
lyxerr << "should not happen" << endl;
|
2001-11-13 16:27:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathDiff::draw(PainterInfo &, int, int) const
|
2002-03-21 17:42:56 +00:00
|
|
|
|
{
|
2003-08-02 11:30:30 +00:00
|
|
|
|
lyxerr << "should not happen" << endl;
|
2001-11-13 16:27:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathDiff::maple(MapleStream & os) const
|
2001-11-13 16:27:06 +00:00
|
|
|
|
{
|
|
|
|
|
os << "diff(";
|
|
|
|
|
for (idx_type idx = 0; idx < nargs(); ++idx) {
|
|
|
|
|
if (idx != 0)
|
|
|
|
|
os << ',';
|
|
|
|
|
os << cell(idx);
|
|
|
|
|
}
|
|
|
|
|
os << ')';
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-12 11:21:21 +00:00
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathDiff::maxima(MaximaStream & os) const
|
2006-09-02 01:57:36 +00:00
|
|
|
|
{
|
|
|
|
|
os << "diff(";
|
|
|
|
|
for (idx_type idx = 0; idx < nargs(); ++idx) {
|
|
|
|
|
if (idx != 0)
|
|
|
|
|
os << ',';
|
|
|
|
|
os << cell(idx);
|
|
|
|
|
if (idx != 0)
|
|
|
|
|
os << ",1";
|
|
|
|
|
}
|
|
|
|
|
os << ')';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathDiff::mathematica(MathematicaStream & os) const
|
2002-07-01 11:17:14 +00:00
|
|
|
|
{
|
2006-09-02 01:57:36 +00:00
|
|
|
|
os << "D[";
|
2002-07-01 11:17:14 +00:00
|
|
|
|
for (idx_type idx = 0; idx < nargs(); ++idx) {
|
|
|
|
|
if (idx != 0)
|
|
|
|
|
os << ',';
|
|
|
|
|
os << cell(idx);
|
|
|
|
|
}
|
|
|
|
|
os << ']';
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-13 16:27:06 +00:00
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathDiff::mathmlize(MathMLStream & os) const
|
2001-11-13 16:27:06 +00:00
|
|
|
|
{
|
|
|
|
|
os << "diff(";
|
|
|
|
|
for (idx_type idx = 0; idx < nargs(); ++idx) {
|
|
|
|
|
if (idx != 0)
|
|
|
|
|
os << ',';
|
|
|
|
|
os << cell(idx);
|
|
|
|
|
}
|
|
|
|
|
os << ')';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathDiff::write(WriteStream &) const
|
2001-11-13 16:27:06 +00:00
|
|
|
|
{
|
2003-08-02 11:30:30 +00:00
|
|
|
|
lyxerr << "should not happen" << endl;
|
2001-11-13 16:27:06 +00:00
|
|
|
|
}
|