#endif
#include "math_scriptinset.h"
-#include "debug.h"
-#include "support.h"
+#include "math_support.h"
+#include "math_symbolinset.h"
#include "math_mathmlstream.h"
#include "support/LAssert.h"
+#include "debug.h"
MathScriptInset::MathScriptInset()
bool MathScriptInset::hasLimits(MathInset const * nuc) const
{
- return limits_ == 1 || (limits_ == 0 && nuc && nuc->isScriptable());
+ // obviuos cases
+ if (limits_ == 1)
+ return true;
+ if (limits_ == -1)
+ return false;
+
+ // we can only display limits if the nucleus wants some
+ if (!nuc)
+ return false;
+ if (!nuc->isScriptable())
+ return false;
+
+ // per default \int has limits beside the \int even in displayed formulas
+ if (nuc->asSymbolInset())
+ if (nuc->asSymbolInset()->name().find("int") != string::npos)
+ return false;
+
+ // assume "real" limits for everything else
+ return true;
}
}
-void MathScriptInset::write(MathWriteInfo & os) const
+void MathScriptInset::write(WriteStream & os) const
{
//lyxerr << "unexpected call to MathScriptInset::write()\n";
- write(0, os);
+ write2(0, os);
}
-void MathScriptInset::write(MathInset const * nuc, MathWriteInfo & os) const
+void MathScriptInset::write2(MathInset const * nuc, WriteStream & os) const
{
if (nuc) {
os << nuc;
if (limits_ == 1)
os << "\\limits ";
}
- }
- else
- os << "{}";
+ } else
+ if (os.firstitem())
+ lyxerr << "suppressing {} \n";
+ else
+ os << "{}";
if (hasDown() && down().data_.size())
os << "_{" << down().data_ << '}';
}
-void MathScriptInset::writeNormal(NormalStream & os) const
+void MathScriptInset::normalize(NormalStream & os) const
{
- //lyxerr << "unexpected call to MathScriptInset::writeNormal()\n";
- writeNormal(0, os);
+ //lyxerr << "unexpected call to MathScriptInset::normalize()\n";
+ normalize2(0, os);
}
-void MathScriptInset::writeNormal(MathInset const * nuc, NormalStream & os) const
+void MathScriptInset::normalize2(MathInset const * nuc, NormalStream & os) const
{
bool d = hasDown() && down().data_.size();
bool u = hasUp() && up().data_.size();
}
-void MathScriptInset::maplize(MathInset const * nuc, MapleStream & os) const
+void MathScriptInset::maplize2(MathInset const * nuc, MapleStream & os) const
{
if (nuc)
os << nuc;
}
-void MathScriptInset::mathmlize(MathInset const * nuc, MathMLStream & os) const
+void MathScriptInset::mathmlize2(MathInset const * nuc, MathMLStream & os) const
{
bool d = hasDown() && down().data_.size();
bool u = hasUp() && up().data_.size();
}
-void MathScriptInset::octavize(MathInset const * nuc, OctaveStream & os) const
+void MathScriptInset::octavize2(MathInset const * nuc, OctaveStream & os) const
{
if (nuc)
os << nuc;