mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
replace a few more naked MathInset * by MathAtom &
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4907 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
96b8c4a00e
commit
c567e8312a
@ -175,7 +175,7 @@ int InsetFormula::docbook(Buffer const * buf, ostream & os, bool) const
|
|||||||
ms << "]]>";
|
ms << "]]>";
|
||||||
ms << ETag("alt");
|
ms << ETag("alt");
|
||||||
ms << MTag("math");
|
ms << MTag("math");
|
||||||
ms << par_.nucleus();
|
ms << par_;
|
||||||
ms << ETag("math");
|
ms << ETag("math");
|
||||||
ms << ETag("equation");
|
ms << ETag("equation");
|
||||||
return ms.line() + res;
|
return ms.line() + res;
|
||||||
|
@ -105,7 +105,7 @@ void MathArray::dump2() const
|
|||||||
{
|
{
|
||||||
NormalStream ns(lyxerr);
|
NormalStream ns(lyxerr);
|
||||||
for (const_iterator it = begin(); it != end(); ++it)
|
for (const_iterator it = begin(); it != end(); ++it)
|
||||||
ns << it->nucleus() << ' ';
|
ns << *it << ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -113,15 +113,14 @@ void MathArray::dump() const
|
|||||||
{
|
{
|
||||||
NormalStream ns(lyxerr);
|
NormalStream ns(lyxerr);
|
||||||
for (const_iterator it = begin(); it != end(); ++it)
|
for (const_iterator it = begin(); it != end(); ++it)
|
||||||
ns << "<" << it->nucleus() << ">";
|
ns << "<" << *it << ">";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathArray::validate(LaTeXFeatures & features) const
|
void MathArray::validate(LaTeXFeatures & features) const
|
||||||
{
|
{
|
||||||
for (const_iterator it = begin(); it != end(); ++it)
|
for (const_iterator it = begin(); it != end(); ++it)
|
||||||
if (it->nucleus())
|
(*it)->validate(features);
|
||||||
it->nucleus()->validate(features);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -137,7 +136,7 @@ bool MathArray::matchpart(MathArray const & ar, pos_type pos) const
|
|||||||
return false;
|
return false;
|
||||||
const_iterator it = begin() + pos;
|
const_iterator it = begin() + pos;
|
||||||
for (const_iterator jt = ar.begin(); jt != ar.end(); ++jt, ++it)
|
for (const_iterator jt = ar.begin(); jt != ar.end(); ++jt, ++it)
|
||||||
if (!jt->nucleus()->match(it->nucleus()))
|
if (!(*jt)->match(it->nucleus()))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -132,10 +132,7 @@ bool MathDelimInset::isAbs() const
|
|||||||
void MathDelimInset::maplize(MapleStream & os) const
|
void MathDelimInset::maplize(MapleStream & os) const
|
||||||
{
|
{
|
||||||
if (isAbs()) {
|
if (isAbs()) {
|
||||||
bool mat =
|
if (cell(0).size() == 1 && cell(0).front()->asMatrixInset())
|
||||||
cell(0).size() == 1 && cell(0).begin()->nucleus()
|
|
||||||
&& cell(0).begin()->nucleus()->asMatrixInset();
|
|
||||||
if (mat)
|
|
||||||
os << "linalg[det](" << cell(0) << ")";
|
os << "linalg[det](" << cell(0) << ")";
|
||||||
else
|
else
|
||||||
os << "abs(" << cell(0) << ")";
|
os << "abs(" << cell(0) << ")";
|
||||||
@ -147,10 +144,7 @@ void MathDelimInset::maplize(MapleStream & os) const
|
|||||||
void MathDelimInset::mathematicize(MathematicaStream & os) const
|
void MathDelimInset::mathematicize(MathematicaStream & os) const
|
||||||
{
|
{
|
||||||
if (isAbs()) {
|
if (isAbs()) {
|
||||||
bool mat =
|
if (cell(0).size() == 1 && cell(0).front()->asMatrixInset())
|
||||||
cell(0).size() == 1 && cell(0).begin()->nucleus()
|
|
||||||
&& cell(0).begin()->nucleus()->asMatrixInset();
|
|
||||||
if (mat)
|
|
||||||
os << "Det" << cell(0) << ']';
|
os << "Det" << cell(0) << ']';
|
||||||
else
|
else
|
||||||
os << "Abs[" << cell(0) << ']';
|
os << "Abs[" << cell(0) << ']';
|
||||||
|
@ -5,17 +5,24 @@
|
|||||||
|
|
||||||
void MathDimInset::metricsT(TextMetricsInfo const &) const
|
void MathDimInset::metricsT(TextMetricsInfo const &) const
|
||||||
{
|
{
|
||||||
|
#ifndef WITH_WARNINGS
|
||||||
|
#warning temporarily disabled
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << *this;
|
os << MathAtom(this);
|
||||||
dim_.w = int(os.str().size());
|
dim_.w = int(os.str().size());
|
||||||
dim_.a = 1;
|
dim_.a = 1;
|
||||||
dim_.d = 0;
|
dim_.d = 0;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MathDimInset::drawT(TextPainter & pain, int x, int y) const
|
void MathDimInset::drawT(TextPainter &, int, int) const
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << *this;
|
os << MathAtom(this);
|
||||||
pain.draw(x, y, os.str().c_str());
|
pain.draw(x, y, os.str().c_str());
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
@ -865,7 +865,7 @@ void mathmlize(MathArray const & dat, MathMLStream & os)
|
|||||||
if (ar.size() == 0)
|
if (ar.size() == 0)
|
||||||
os << "<mrow/>";
|
os << "<mrow/>";
|
||||||
else if (ar.size() == 1)
|
else if (ar.size() == 1)
|
||||||
os << ar.begin()->nucleus();
|
os << ar.front();
|
||||||
else {
|
else {
|
||||||
os << MTag("mrow");
|
os << MTag("mrow");
|
||||||
for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
|
for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
|
||||||
|
@ -46,19 +46,9 @@ int MathInset::height() const
|
|||||||
|
|
||||||
|
|
||||||
ostream & operator<<(ostream & os, MathAtom const & at)
|
ostream & operator<<(ostream & os, MathAtom const & at)
|
||||||
{
|
|
||||||
if (at.nucleus())
|
|
||||||
os << *(at.nucleus());
|
|
||||||
else
|
|
||||||
os << "(nil)";
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ostream & operator<<(ostream & os, MathInset const & inset)
|
|
||||||
{
|
{
|
||||||
WriteStream wi(os, false, false);
|
WriteStream wi(os, false, false);
|
||||||
inset.write(wi);
|
at->write(wi);
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,6 @@ public:
|
|||||||
virtual string name() const;
|
virtual string name() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream & operator<<(std::ostream &, MathInset const &);
|
|
||||||
std::ostream & operator<<(std::ostream &, MathAtom const &);
|
std::ostream & operator<<(std::ostream &, MathAtom const &);
|
||||||
|
|
||||||
string asString(MathArray const & ar);
|
string asString(MathArray const & ar);
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include "math_mathmlstream.h"
|
#include "math_mathmlstream.h"
|
||||||
#include "math_inset.h"
|
#include "math_inset.h"
|
||||||
#include "math_extern.h"
|
#include "math_extern.h"
|
||||||
#include "debug.h"
|
|
||||||
#include "support/lyxalgo.h"
|
#include "support/lyxalgo.h"
|
||||||
|
|
||||||
|
|
||||||
@ -16,12 +15,9 @@ MathMLStream::MathMLStream(ostream & os)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
MathMLStream & operator<<(MathMLStream & ms, MathInset const * p)
|
MathMLStream & operator<<(MathMLStream & ms, MathAtom const & at)
|
||||||
{
|
{
|
||||||
if (p)
|
at->mathmlize(ms);
|
||||||
p->mathmlize(ms);
|
|
||||||
else
|
|
||||||
lyxerr << "operator<<(MathMLStream, NULL) called\n";
|
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,12 +74,9 @@ void MathMLStream::cr()
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
MapleStream & operator<<(MapleStream & ms, MathInset const * p)
|
MapleStream & operator<<(MapleStream & ms, MathAtom const & at)
|
||||||
{
|
{
|
||||||
if (p)
|
at->maplize(ms);
|
||||||
p->maplize(ms);
|
|
||||||
else
|
|
||||||
lyxerr << "operator<<(MapleStream, NULL) called\n";
|
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,12 +112,9 @@ MapleStream & operator<<(MapleStream & ms, int i)
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
MathematicaStream & operator<<(MathematicaStream & ms, MathInset const * p)
|
MathematicaStream & operator<<(MathematicaStream & ms, MathAtom const & at)
|
||||||
{
|
{
|
||||||
if (p)
|
at->mathematicize(ms);
|
||||||
p->mathematicize(ms);
|
|
||||||
else
|
|
||||||
lyxerr << "operator<<(MathematicaStream, NULL) called\n";
|
|
||||||
return ms;
|
return ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,12 +151,9 @@ MathematicaStream & operator<<(MathematicaStream & ms, int i)
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
OctaveStream & operator<<(OctaveStream & ns, MathInset const * p)
|
OctaveStream & operator<<(OctaveStream & ns, MathAtom const & at)
|
||||||
{
|
{
|
||||||
if (p)
|
at->octavize(ns);
|
||||||
p->octavize(ns);
|
|
||||||
else
|
|
||||||
lyxerr << "operator<<(OctaveStream, NULL) called\n";
|
|
||||||
return ns;
|
return ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,12 +189,9 @@ OctaveStream & operator<<(OctaveStream & ns, int i)
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
NormalStream & operator<<(NormalStream & ns, MathInset const * p)
|
NormalStream & operator<<(NormalStream & ns, MathAtom const & at)
|
||||||
{
|
{
|
||||||
if (p)
|
at->normalize(ns);
|
||||||
p->normalize(ns);
|
|
||||||
else
|
|
||||||
lyxerr << "operator<<(NormalStream, NULL) called\n";
|
|
||||||
return ns;
|
return ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,12 +244,9 @@ void WriteStream::addlines(unsigned int n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WriteStream & operator<<(WriteStream & ws, MathInset const * p)
|
WriteStream & operator<<(WriteStream & ws, MathAtom const & at)
|
||||||
{
|
{
|
||||||
if (p)
|
at->write(ws);
|
||||||
p->write(ws);
|
|
||||||
else
|
|
||||||
lyxerr << "operator<<(WriteStream, NULL) called\n";
|
|
||||||
return ws;
|
return ws;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,10 +269,8 @@ WriteStream & operator<<(WriteStream & ws, char const * s)
|
|||||||
WriteStream & operator<<(WriteStream & ws, char c)
|
WriteStream & operator<<(WriteStream & ws, char c)
|
||||||
{
|
{
|
||||||
ws.os() << c;
|
ws.os() << c;
|
||||||
if (c == '\n') {
|
if (c == '\n')
|
||||||
lyxerr << "writing a newline\n";
|
|
||||||
ws.addlines(1);
|
ws.addlines(1);
|
||||||
}
|
|
||||||
return ws;
|
return ws;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
class MathArray;
|
class MathArray;
|
||||||
class MathInset;
|
class MathInset;
|
||||||
|
class MathAtom;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -58,7 +59,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
MathMLStream & operator<<(MathMLStream &, MathInset const *);
|
MathMLStream & operator<<(MathMLStream &, MathAtom const &);
|
||||||
///
|
///
|
||||||
MathMLStream & operator<<(MathMLStream &, MathArray const &);
|
MathMLStream & operator<<(MathMLStream &, MathArray const &);
|
||||||
///
|
///
|
||||||
@ -88,7 +89,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
NormalStream & operator<<(NormalStream &, MathInset const *);
|
NormalStream & operator<<(NormalStream &, MathAtom const &);
|
||||||
///
|
///
|
||||||
NormalStream & operator<<(NormalStream &, MathArray const &);
|
NormalStream & operator<<(NormalStream &, MathArray const &);
|
||||||
///
|
///
|
||||||
@ -119,7 +120,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
MapleStream & operator<<(MapleStream &, MathInset const *);
|
MapleStream & operator<<(MapleStream &, MathAtom const &);
|
||||||
///
|
///
|
||||||
MapleStream & operator<<(MapleStream &, MathArray const &);
|
MapleStream & operator<<(MapleStream &, MathArray const &);
|
||||||
///
|
///
|
||||||
@ -148,7 +149,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
MathematicaStream & operator<<(MathematicaStream &, MathInset const *);
|
MathematicaStream & operator<<(MathematicaStream &, MathAtom const &);
|
||||||
///
|
///
|
||||||
MathematicaStream & operator<<(MathematicaStream &, MathArray const &);
|
MathematicaStream & operator<<(MathematicaStream &, MathArray const &);
|
||||||
///
|
///
|
||||||
@ -176,7 +177,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
OctaveStream & operator<<(OctaveStream &, MathInset const *);
|
OctaveStream & operator<<(OctaveStream &, MathAtom const &);
|
||||||
///
|
///
|
||||||
OctaveStream & operator<<(OctaveStream &, MathArray const &);
|
OctaveStream & operator<<(OctaveStream &, MathArray const &);
|
||||||
///
|
///
|
||||||
@ -224,7 +225,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
WriteStream & operator<<(WriteStream &, MathInset const *);
|
WriteStream & operator<<(WriteStream &, MathAtom const &);
|
||||||
///
|
///
|
||||||
WriteStream & operator<<(WriteStream &, MathArray const &);
|
WriteStream & operator<<(WriteStream &, MathArray const &);
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user