2003-08-19 13:00:56 +00:00
|
|
|
/**
|
2007-04-25 03:01:35 +00:00
|
|
|
* \file InsetMathDiff.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.
|
|
|
|
*/
|
|
|
|
|
2003-08-02 11:30:30 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "InsetMathDiff.h"
|
2007-04-26 16:05:57 +00:00
|
|
|
#include "MathData.h"
|
2006-10-22 10:15:23 +00:00
|
|
|
#include "MathStream.h"
|
2008-02-18 07:14:42 +00:00
|
|
|
|
2007-11-29 07:04:28 +00:00
|
|
|
#include "support/debug.h"
|
2001-11-13 16:27:06 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2009-11-08 11:45:46 +00:00
|
|
|
InsetMathDiff::InsetMathDiff(Buffer * buf)
|
|
|
|
: InsetMathNest(buf, 1)
|
2001-11-13 16:27:06 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2007-08-30 18:03:17 +00:00
|
|
|
Inset * InsetMathDiff::clone() const
|
2001-11-13 16:27:06 +00:00
|
|
|
{
|
2007-08-30 18:03:17 +00:00
|
|
|
return new InsetMathDiff(*this);
|
2001-11-13 16:27:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-26 16:05:57 +00:00
|
|
|
void InsetMathDiff::addDer(MathData 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 << ']';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
void InsetMathDiff::metrics(MetricsInfo &, Dimension &) const
|
2001-11-13 16:27:06 +00:00
|
|
|
{
|
2007-11-28 22:12:03 +00:00
|
|
|
LYXERR0("should not happen");
|
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
|
|
|
{
|
2007-11-28 22:12:03 +00:00
|
|
|
LYXERR0("should not happen");
|
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::write(WriteStream &) const
|
2001-11-13 16:27:06 +00:00
|
|
|
{
|
2007-11-28 22:12:03 +00:00
|
|
|
LYXERR0("should not happen");
|
2001-11-13 16:27:06 +00:00
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|